From 19b894c3b5561160b794ec26e93ddc0531f19e1c Mon Sep 17 00:00:00 2001 From: Rizky Date: Mon, 16 Oct 2023 11:40:24 +0700 Subject: [PATCH] fix --- app/web/static/Side.d0586ad5.js | 3726 + app/web/static/Side.fa071797.js | 12811 ++ app/web/static/all.2a032bf1.js | 41 + app/web/static/comp-mgr.27b10bdd.js | 873 + app/web/static/dist.f8eecf79.js | 908 + app/web/static/ed.de27588b.js | 274 + app/web/static/editor.73d38fbd.js | 49313 +++++ app/web/static/editor.9f6769c5.css | 38 + app/web/static/editor.b81cc496.js | 337 + app/web/static/editor.ed238427.js | 15259 ++ app/web/static/estree.7a133e28.js | 8284 + app/web/static/favicon.ico | Bin 0 -> 117932 bytes app/web/static/images/bg-auth.png | Bin 0 -> 194817 bytes app/web/static/images/blank.jpg | Bin 0 -> 631 bytes app/web/static/images/template/1/mobile-0.png | Bin 0 -> 2309870 bytes .../images/template/1/preview-desktop-0.png | Bin 0 -> 2453138 bytes app/web/static/index.css | 2334 + app/web/static/index.html | 16 + app/web/static/index.js | 10556 + app/web/static/index.module.15cb72f1.js | 778 + app/web/static/ipc.0049bc9e.js | 206 + app/web/static/live.7c683dce.js | 3545 + app/web/static/login.116f51a6.js | 211 + app/web/static/logo/logo-white.png | Bin 0 -> 126377 bytes app/web/static/logo/logo.png | Bin 0 -> 5121 bytes app/web/static/logout.4a23bd73.js | 38 + .../browser/ui/codicons/codicon/codicon.ttf | Bin 0 -> 73464 bytes .../base/common/worker/simpleWorker.nls.de.js | 8 + .../base/common/worker/simpleWorker.nls.es.js | 8 + .../base/common/worker/simpleWorker.nls.fr.js | 8 + .../base/common/worker/simpleWorker.nls.it.js | 8 + .../base/common/worker/simpleWorker.nls.ja.js | 8 + .../vs/base/common/worker/simpleWorker.nls.js | 8 + .../base/common/worker/simpleWorker.nls.ko.js | 8 + .../base/common/worker/simpleWorker.nls.ru.js | 8 + .../common/worker/simpleWorker.nls.zh-cn.js | 8 + .../common/worker/simpleWorker.nls.zh-tw.js | 8 + .../static/min/vs/base/worker/workerMain.js | 25 + .../min/vs/basic-languages/abap/abap.js | 10 + .../min/vs/basic-languages/apex/apex.js | 10 + .../min/vs/basic-languages/azcli/azcli.js | 10 + .../static/min/vs/basic-languages/bat/bat.js | 10 + .../min/vs/basic-languages/bicep/bicep.js | 11 + .../vs/basic-languages/cameligo/cameligo.js | 10 + .../min/vs/basic-languages/clojure/clojure.js | 10 + .../min/vs/basic-languages/coffee/coffee.js | 10 + .../static/min/vs/basic-languages/cpp/cpp.js | 10 + .../min/vs/basic-languages/csharp/csharp.js | 10 + .../static/min/vs/basic-languages/csp/csp.js | 10 + .../static/min/vs/basic-languages/css/css.js | 12 + .../min/vs/basic-languages/cypher/cypher.js | 10 + .../min/vs/basic-languages/dart/dart.js | 10 + .../basic-languages/dockerfile/dockerfile.js | 10 + .../static/min/vs/basic-languages/ecl/ecl.js | 10 + .../min/vs/basic-languages/elixir/elixir.js | 10 + .../min/vs/basic-languages/flow9/flow9.js | 10 + .../freemarker2/freemarker2.js | 12 + .../min/vs/basic-languages/fsharp/fsharp.js | 10 + .../static/min/vs/basic-languages/go/go.js | 10 + .../min/vs/basic-languages/graphql/graphql.js | 10 + .../basic-languages/handlebars/handlebars.js | 10 + .../static/min/vs/basic-languages/hcl/hcl.js | 10 + .../min/vs/basic-languages/html/html.js | 10 + .../static/min/vs/basic-languages/ini/ini.js | 10 + .../min/vs/basic-languages/java/java.js | 10 + .../basic-languages/javascript/javascript.js | 10 + .../min/vs/basic-languages/julia/julia.js | 10 + .../min/vs/basic-languages/kotlin/kotlin.js | 10 + .../min/vs/basic-languages/less/less.js | 11 + .../min/vs/basic-languages/lexon/lexon.js | 10 + .../min/vs/basic-languages/liquid/liquid.js | 10 + .../static/min/vs/basic-languages/lua/lua.js | 10 + .../static/min/vs/basic-languages/m3/m3.js | 10 + .../vs/basic-languages/markdown/markdown.js | 10 + .../min/vs/basic-languages/mips/mips.js | 10 + .../min/vs/basic-languages/msdax/msdax.js | 10 + .../min/vs/basic-languages/mysql/mysql.js | 10 + .../objective-c/objective-c.js | 10 + .../min/vs/basic-languages/pascal/pascal.js | 10 + .../vs/basic-languages/pascaligo/pascaligo.js | 10 + .../min/vs/basic-languages/perl/perl.js | 10 + .../min/vs/basic-languages/pgsql/pgsql.js | 10 + .../static/min/vs/basic-languages/php/php.js | 10 + .../static/min/vs/basic-languages/pla/pla.js | 10 + .../vs/basic-languages/postiats/postiats.js | 10 + .../basic-languages/powerquery/powerquery.js | 10 + .../basic-languages/powershell/powershell.js | 10 + .../vs/basic-languages/protobuf/protobuf.js | 11 + .../static/min/vs/basic-languages/pug/pug.js | 10 + .../min/vs/basic-languages/python/python.js | 10 + .../min/vs/basic-languages/qsharp/qsharp.js | 10 + app/web/static/min/vs/basic-languages/r/r.js | 10 + .../min/vs/basic-languages/razor/razor.js | 10 + .../min/vs/basic-languages/redis/redis.js | 10 + .../vs/basic-languages/redshift/redshift.js | 10 + .../restructuredtext/restructuredtext.js | 10 + .../min/vs/basic-languages/ruby/ruby.js | 10 + .../min/vs/basic-languages/rust/rust.js | 10 + .../static/min/vs/basic-languages/sb/sb.js | 10 + .../min/vs/basic-languages/scala/scala.js | 10 + .../min/vs/basic-languages/scheme/scheme.js | 10 + .../min/vs/basic-languages/scss/scss.js | 12 + .../min/vs/basic-languages/shell/shell.js | 10 + .../vs/basic-languages/solidity/solidity.js | 10 + .../min/vs/basic-languages/sophia/sophia.js | 10 + .../min/vs/basic-languages/sparql/sparql.js | 10 + .../static/min/vs/basic-languages/sql/sql.js | 10 + .../static/min/vs/basic-languages/st/st.js | 10 + .../min/vs/basic-languages/swift/swift.js | 13 + .../systemverilog/systemverilog.js | 10 + .../static/min/vs/basic-languages/tcl/tcl.js | 10 + .../min/vs/basic-languages/twig/twig.js | 10 + .../basic-languages/typescript/typescript.js | 10 + .../static/min/vs/basic-languages/vb/vb.js | 10 + .../min/vs/basic-languages/wgsl/wgsl.js | 307 + .../static/min/vs/basic-languages/xml/xml.js | 10 + .../min/vs/basic-languages/yaml/yaml.js | 10 + app/web/static/min/vs/editor/editor.main.css | 4899 + app/web/static/min/vs/editor/editor.main.js | 169028 +++++++++++++++ .../min/vs/editor/editor.main.nls.de.js | 31 + .../min/vs/editor/editor.main.nls.es.js | 31 + .../min/vs/editor/editor.main.nls.fr.js | 29 + .../min/vs/editor/editor.main.nls.it.js | 29 + .../min/vs/editor/editor.main.nls.ja.js | 31 + .../static/min/vs/editor/editor.main.nls.js | 29 + .../min/vs/editor/editor.main.nls.ko.js | 29 + .../min/vs/editor/editor.main.nls.ru.js | 31 + .../min/vs/editor/editor.main.nls.zh-cn.js | 31 + .../min/vs/editor/editor.main.nls.zh-tw.js | 29 + app/web/static/min/vs/language/css/cssMode.js | 13 + .../static/min/vs/language/css/cssWorker.js | 33928 +++ .../static/min/vs/language/html/htmlMode.js | 13 + .../static/min/vs/language/html/htmlWorker.js | 453 + .../static/min/vs/language/json/jsonMode.js | 15 + .../static/min/vs/language/json/jsonWorker.js | 36 + .../min/vs/language/typescript/tsMode.js | 20 + .../min/vs/language/typescript/tsWorker.js | 37016 ++++ app/web/static/min/vs/loader.js | 11 + app/web/static/page-mgr.6c081154.js | 950 + app/web/static/pages.297d11c9.js | 112 + app/web/static/register.6da13020.js | 216 + app/web/static/site-mgr.aa4495d1.js | 503 + app/web/static/standalone.f3e74186.js | 3410 + app/web/static/sworker.js | 321 + app/web/static/typescript.dbf03dd2.js | 35456 +++ app/web/static/versions.752026f5.js | 59 + app/web/static/worker.0b25d7de.js | 3054 + captain-definition | 14 - deploy.sh | 4 +- package.json | 1 + pkgs/core/build.ts | 23 + pkgs/core/utils/parcel.ts | 12 +- 152 files changed, 400592 insertions(+), 27 deletions(-) create mode 100644 app/web/static/Side.d0586ad5.js create mode 100644 app/web/static/Side.fa071797.js create mode 100644 app/web/static/all.2a032bf1.js create mode 100644 app/web/static/comp-mgr.27b10bdd.js create mode 100644 app/web/static/dist.f8eecf79.js create mode 100644 app/web/static/ed.de27588b.js create mode 100644 app/web/static/editor.73d38fbd.js create mode 100644 app/web/static/editor.9f6769c5.css create mode 100644 app/web/static/editor.b81cc496.js create mode 100644 app/web/static/editor.ed238427.js create mode 100644 app/web/static/estree.7a133e28.js create mode 100644 app/web/static/favicon.ico create mode 100644 app/web/static/images/bg-auth.png create mode 100644 app/web/static/images/blank.jpg create mode 100644 app/web/static/images/template/1/mobile-0.png create mode 100644 app/web/static/images/template/1/preview-desktop-0.png create mode 100644 app/web/static/index.css create mode 100644 app/web/static/index.html create mode 100644 app/web/static/index.js create mode 100644 app/web/static/index.module.15cb72f1.js create mode 100644 app/web/static/ipc.0049bc9e.js create mode 100644 app/web/static/live.7c683dce.js create mode 100644 app/web/static/login.116f51a6.js create mode 100644 app/web/static/logo/logo-white.png create mode 100644 app/web/static/logo/logo.png create mode 100644 app/web/static/logout.4a23bd73.js create mode 100644 app/web/static/min/vs/base/browser/ui/codicons/codicon/codicon.ttf create mode 100644 app/web/static/min/vs/base/common/worker/simpleWorker.nls.de.js create mode 100644 app/web/static/min/vs/base/common/worker/simpleWorker.nls.es.js create mode 100644 app/web/static/min/vs/base/common/worker/simpleWorker.nls.fr.js create mode 100644 app/web/static/min/vs/base/common/worker/simpleWorker.nls.it.js create mode 100644 app/web/static/min/vs/base/common/worker/simpleWorker.nls.ja.js create mode 100644 app/web/static/min/vs/base/common/worker/simpleWorker.nls.js create mode 100644 app/web/static/min/vs/base/common/worker/simpleWorker.nls.ko.js create mode 100644 app/web/static/min/vs/base/common/worker/simpleWorker.nls.ru.js create mode 100644 app/web/static/min/vs/base/common/worker/simpleWorker.nls.zh-cn.js create mode 100644 app/web/static/min/vs/base/common/worker/simpleWorker.nls.zh-tw.js create mode 100644 app/web/static/min/vs/base/worker/workerMain.js create mode 100644 app/web/static/min/vs/basic-languages/abap/abap.js create mode 100644 app/web/static/min/vs/basic-languages/apex/apex.js create mode 100644 app/web/static/min/vs/basic-languages/azcli/azcli.js create mode 100644 app/web/static/min/vs/basic-languages/bat/bat.js create mode 100644 app/web/static/min/vs/basic-languages/bicep/bicep.js create mode 100644 app/web/static/min/vs/basic-languages/cameligo/cameligo.js create mode 100644 app/web/static/min/vs/basic-languages/clojure/clojure.js create mode 100644 app/web/static/min/vs/basic-languages/coffee/coffee.js create mode 100644 app/web/static/min/vs/basic-languages/cpp/cpp.js create mode 100644 app/web/static/min/vs/basic-languages/csharp/csharp.js create mode 100644 app/web/static/min/vs/basic-languages/csp/csp.js create mode 100644 app/web/static/min/vs/basic-languages/css/css.js create mode 100644 app/web/static/min/vs/basic-languages/cypher/cypher.js create mode 100644 app/web/static/min/vs/basic-languages/dart/dart.js create mode 100644 app/web/static/min/vs/basic-languages/dockerfile/dockerfile.js create mode 100644 app/web/static/min/vs/basic-languages/ecl/ecl.js create mode 100644 app/web/static/min/vs/basic-languages/elixir/elixir.js create mode 100644 app/web/static/min/vs/basic-languages/flow9/flow9.js create mode 100644 app/web/static/min/vs/basic-languages/freemarker2/freemarker2.js create mode 100644 app/web/static/min/vs/basic-languages/fsharp/fsharp.js create mode 100644 app/web/static/min/vs/basic-languages/go/go.js create mode 100644 app/web/static/min/vs/basic-languages/graphql/graphql.js create mode 100644 app/web/static/min/vs/basic-languages/handlebars/handlebars.js create mode 100644 app/web/static/min/vs/basic-languages/hcl/hcl.js create mode 100644 app/web/static/min/vs/basic-languages/html/html.js create mode 100644 app/web/static/min/vs/basic-languages/ini/ini.js create mode 100644 app/web/static/min/vs/basic-languages/java/java.js create mode 100644 app/web/static/min/vs/basic-languages/javascript/javascript.js create mode 100644 app/web/static/min/vs/basic-languages/julia/julia.js create mode 100644 app/web/static/min/vs/basic-languages/kotlin/kotlin.js create mode 100644 app/web/static/min/vs/basic-languages/less/less.js create mode 100644 app/web/static/min/vs/basic-languages/lexon/lexon.js create mode 100644 app/web/static/min/vs/basic-languages/liquid/liquid.js create mode 100644 app/web/static/min/vs/basic-languages/lua/lua.js create mode 100644 app/web/static/min/vs/basic-languages/m3/m3.js create mode 100644 app/web/static/min/vs/basic-languages/markdown/markdown.js create mode 100644 app/web/static/min/vs/basic-languages/mips/mips.js create mode 100644 app/web/static/min/vs/basic-languages/msdax/msdax.js create mode 100644 app/web/static/min/vs/basic-languages/mysql/mysql.js create mode 100644 app/web/static/min/vs/basic-languages/objective-c/objective-c.js create mode 100644 app/web/static/min/vs/basic-languages/pascal/pascal.js create mode 100644 app/web/static/min/vs/basic-languages/pascaligo/pascaligo.js create mode 100644 app/web/static/min/vs/basic-languages/perl/perl.js create mode 100644 app/web/static/min/vs/basic-languages/pgsql/pgsql.js create mode 100644 app/web/static/min/vs/basic-languages/php/php.js create mode 100644 app/web/static/min/vs/basic-languages/pla/pla.js create mode 100644 app/web/static/min/vs/basic-languages/postiats/postiats.js create mode 100644 app/web/static/min/vs/basic-languages/powerquery/powerquery.js create mode 100644 app/web/static/min/vs/basic-languages/powershell/powershell.js create mode 100644 app/web/static/min/vs/basic-languages/protobuf/protobuf.js create mode 100644 app/web/static/min/vs/basic-languages/pug/pug.js create mode 100644 app/web/static/min/vs/basic-languages/python/python.js create mode 100644 app/web/static/min/vs/basic-languages/qsharp/qsharp.js create mode 100644 app/web/static/min/vs/basic-languages/r/r.js create mode 100644 app/web/static/min/vs/basic-languages/razor/razor.js create mode 100644 app/web/static/min/vs/basic-languages/redis/redis.js create mode 100644 app/web/static/min/vs/basic-languages/redshift/redshift.js create mode 100644 app/web/static/min/vs/basic-languages/restructuredtext/restructuredtext.js create mode 100644 app/web/static/min/vs/basic-languages/ruby/ruby.js create mode 100644 app/web/static/min/vs/basic-languages/rust/rust.js create mode 100644 app/web/static/min/vs/basic-languages/sb/sb.js create mode 100644 app/web/static/min/vs/basic-languages/scala/scala.js create mode 100644 app/web/static/min/vs/basic-languages/scheme/scheme.js create mode 100644 app/web/static/min/vs/basic-languages/scss/scss.js create mode 100644 app/web/static/min/vs/basic-languages/shell/shell.js create mode 100644 app/web/static/min/vs/basic-languages/solidity/solidity.js create mode 100644 app/web/static/min/vs/basic-languages/sophia/sophia.js create mode 100644 app/web/static/min/vs/basic-languages/sparql/sparql.js create mode 100644 app/web/static/min/vs/basic-languages/sql/sql.js create mode 100644 app/web/static/min/vs/basic-languages/st/st.js create mode 100644 app/web/static/min/vs/basic-languages/swift/swift.js create mode 100644 app/web/static/min/vs/basic-languages/systemverilog/systemverilog.js create mode 100644 app/web/static/min/vs/basic-languages/tcl/tcl.js create mode 100644 app/web/static/min/vs/basic-languages/twig/twig.js create mode 100644 app/web/static/min/vs/basic-languages/typescript/typescript.js create mode 100644 app/web/static/min/vs/basic-languages/vb/vb.js create mode 100644 app/web/static/min/vs/basic-languages/wgsl/wgsl.js create mode 100644 app/web/static/min/vs/basic-languages/xml/xml.js create mode 100644 app/web/static/min/vs/basic-languages/yaml/yaml.js create mode 100644 app/web/static/min/vs/editor/editor.main.css create mode 100644 app/web/static/min/vs/editor/editor.main.js create mode 100644 app/web/static/min/vs/editor/editor.main.nls.de.js create mode 100644 app/web/static/min/vs/editor/editor.main.nls.es.js create mode 100644 app/web/static/min/vs/editor/editor.main.nls.fr.js create mode 100644 app/web/static/min/vs/editor/editor.main.nls.it.js create mode 100644 app/web/static/min/vs/editor/editor.main.nls.ja.js create mode 100644 app/web/static/min/vs/editor/editor.main.nls.js create mode 100644 app/web/static/min/vs/editor/editor.main.nls.ko.js create mode 100644 app/web/static/min/vs/editor/editor.main.nls.ru.js create mode 100644 app/web/static/min/vs/editor/editor.main.nls.zh-cn.js create mode 100644 app/web/static/min/vs/editor/editor.main.nls.zh-tw.js create mode 100644 app/web/static/min/vs/language/css/cssMode.js create mode 100644 app/web/static/min/vs/language/css/cssWorker.js create mode 100644 app/web/static/min/vs/language/html/htmlMode.js create mode 100644 app/web/static/min/vs/language/html/htmlWorker.js create mode 100644 app/web/static/min/vs/language/json/jsonMode.js create mode 100644 app/web/static/min/vs/language/json/jsonWorker.js create mode 100644 app/web/static/min/vs/language/typescript/tsMode.js create mode 100644 app/web/static/min/vs/language/typescript/tsWorker.js create mode 100644 app/web/static/min/vs/loader.js create mode 100644 app/web/static/page-mgr.6c081154.js create mode 100644 app/web/static/pages.297d11c9.js create mode 100644 app/web/static/register.6da13020.js create mode 100644 app/web/static/site-mgr.aa4495d1.js create mode 100644 app/web/static/standalone.f3e74186.js create mode 100644 app/web/static/sworker.js create mode 100644 app/web/static/typescript.dbf03dd2.js create mode 100644 app/web/static/versions.752026f5.js create mode 100644 app/web/static/worker.0b25d7de.js delete mode 100644 captain-definition create mode 100644 pkgs/core/build.ts diff --git a/app/web/static/Side.d0586ad5.js b/app/web/static/Side.d0586ad5.js new file mode 100644 index 00000000..81c4f82b --- /dev/null +++ b/app/web/static/Side.d0586ad5.js @@ -0,0 +1,3726 @@ +(() => { + +function $parcel$export(e, n, v, s) { + Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); +} + +function $parcel$interopDefault(a) { + return a && a.__esModule ? a.default : a; +} + + var $parcel$global = globalThis; + var parcelRequire = $parcel$global["parcelRequire2d1f"]; +var parcelRegister = parcelRequire.register; +parcelRegister("dCav9", function(module, exports) { + +$parcel$export(module.exports, "Dropdown", () => $f45dd14ce0054273$export$931cbfb6bfb85fc); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $6j6Xp = parcelRequire("6j6Xp"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $bTIRf = parcelRequire("bTIRf"); +const $f45dd14ce0054273$export$931cbfb6bfb85fc = (prop)=>{ + const local = (0, $4WfNn.useLocal)({ + open: false, + search: "", + searchChanged: false, + status: "init", + itemsCache: prop.items, + activeIdx: -1, + listEl: null, + listElTimeout: null, + scrolled: false + }); + (0, $63SH6.useEffect)(()=>{ + if (!local.open) { + local.scrolled = false; + local.render(); + } + }, [ + local.open + ]); + const resetInputValue = ()=>{ + if (prop.items) { + const val = prop.value || ""; + let idx = 0; + for (const item of prop.items){ + if (typeof item === "string" && item === val) { + local.search = item; + local.activeIdx = idx; + } else if (typeof item === "object" && item.value === val) { + local.search = item.label; + local.activeIdx = idx; + } + local.searchChanged = false; + idx++; + } + } + }; + if (local.status === "init" || prop.items !== local.itemsCache) { + local.status = "ready"; + local.itemsCache = prop.items; + resetInputValue(); + } + const elProp = { + ...prop + }; + delete elProp["value"]; + delete elProp["items"]; + delete elProp["onChange"]; + delete elProp["popover"]; + let items = prop.items || []; + if (local.searchChanged) { + local.searchChanged = false; + const search = local.search.toLowerCase().replace(/\W/, ""); + if (search) { + items = []; + for (const item of prop.items || []){ + if (typeof item === "string" && item.toLowerCase().replace(/\W/, "").includes(search)) items.push(item); + else if (typeof item === "object" && (item.label.toLowerCase().replace(/\W/, "").includes(search) || item.value.toLowerCase().replace(/\W/, "").includes(search))) items.push(item); + } + } + } + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), { + open: local.open, + onOpenChange: (open)=>{ + local.open = open; + local.render(); + }, + autoFocus: false, + placement: "bottom-start", + backdrop: false, + arrow: false, + offset: 0, + popoverClassName: cx("bg-white border", prop.popover?.className), + content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: items.length > 0 ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6j6Xp.Virtuoso), { + className: `${items.length > 3 ? "min-h-[140px] max-h-[350px]" : items.length === 3 ? "min-h-[85px]" : items.length === 1 ? "min-h-[30px]" : "min-h-[57px]"} min-w-[200px] flex-1 w-full`, + data: items, + ref: (el)=>{ + if (el && !local.scrolled) { + clearTimeout(local.listElTimeout); + local.listElTimeout = setTimeout(()=>{ + local.scrolled = true; + local.listEl = el; + el.scrollToIndex(local.activeIdx - 2); + }, 50); + } + }, + itemContent: (idx, e)=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("cursor-pointer", prop.value === (typeof e === "string" ? e : e.value) && "active", prop.popover?.itemClassName ? prop.popover?.itemClassName : "hover:bg-blue-100 border-b px-2 whitespace-nowrap select-none"), + onClick: ()=>{ + local.open = false; + local.status; + if (prop.onChange) prop.onChange(typeof e === "string" ? e : e.value, idx, e); + local.render(); + }, + children: prop.popover?.renderItem ? prop.popover.renderItem(e, idx) : typeof e === "string" ? e : e.label + }, typeof e === "string" ? e : e.value); + } + }) : /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "min-h-[100px] min-w-[250px] flex-1 w-full" + }) + }), + ...elProp, + className: cx("dropdown bg-white px-2 relative flex items-stretch", elProp.className), + children: /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "pointer-events-none absolute right-0 bottom-0 top-0 bg-white flex items-center justify-center w-[30px] ", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M3.135 6.158a.5.5 0 01.707-.023L7.5 9.565l3.658-3.43a.5.5 0 01.684.73l-4 3.75a.5.5 0 01-.684 0l-4-3.75a.5.5 0 01-.023-.707z", + clipRule: "evenodd" + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("input", { + className: cx("cursor-pointer outline-none input flex-1"), + type: "string", + placeholder: elProp.placeholder, + spellCheck: false, + value: local.search, + onChange: (e)=>{ + local.search = e.currentTarget.value; + local.searchChanged = true; + local.render(); + }, + onFocus: ()=>{ + local.open = true; + local.render(); + } + }) + ] + }) + }); +}; + +}); +parcelRegister("6j6Xp", function(module, exports) { + +$parcel$export(module.exports, "Virtuoso", () => $ed43cc03b55b9961$export$ea50ab61e1198ee3); + +var $63SH6 = parcelRequire("63SH6"); + +var $grDIR = parcelRequire("grDIR"); +const $ed43cc03b55b9961$var$PUBLISH = 0; +const $ed43cc03b55b9961$var$SUBSCRIBE = 1; +const $ed43cc03b55b9961$var$RESET = 2; +const $ed43cc03b55b9961$var$VALUE = 4; +function $ed43cc03b55b9961$var$compose(a, b) { + return (arg)=>a(b(arg)); +} +function $ed43cc03b55b9961$var$thrush(arg, proc) { + return proc(arg); +} +function $ed43cc03b55b9961$var$curry2to1(proc, arg1) { + return (arg2)=>proc(arg1, arg2); +} +function $ed43cc03b55b9961$var$curry1to0(proc, arg) { + return ()=>proc(arg); +} +function $ed43cc03b55b9961$var$tap(arg, proc) { + proc(arg); + return arg; +} +function $ed43cc03b55b9961$var$tup(...args) { + return args; +} +function $ed43cc03b55b9961$var$call(proc) { + proc(); +} +function $ed43cc03b55b9961$var$always(value) { + return ()=>value; +} +function $ed43cc03b55b9961$var$joinProc(...procs) { + return ()=>{ + procs.map($ed43cc03b55b9961$var$call); + }; +} +function $ed43cc03b55b9961$var$isDefined(arg) { + return arg !== void 0; +} +function $ed43cc03b55b9961$var$noop() {} +function $ed43cc03b55b9961$var$subscribe(emitter, subscription) { + return emitter($ed43cc03b55b9961$var$SUBSCRIBE, subscription); +} +function $ed43cc03b55b9961$var$publish(publisher, value) { + publisher($ed43cc03b55b9961$var$PUBLISH, value); +} +function $ed43cc03b55b9961$var$reset(emitter) { + emitter($ed43cc03b55b9961$var$RESET); +} +function $ed43cc03b55b9961$var$getValue(depot) { + return depot($ed43cc03b55b9961$var$VALUE); +} +function $ed43cc03b55b9961$var$connect(emitter, publisher) { + return $ed43cc03b55b9961$var$subscribe(emitter, $ed43cc03b55b9961$var$curry2to1(publisher, $ed43cc03b55b9961$var$PUBLISH)); +} +function $ed43cc03b55b9961$var$handleNext(emitter, subscription) { + const unsub = emitter($ed43cc03b55b9961$var$SUBSCRIBE, (value)=>{ + unsub(); + subscription(value); + }); + return unsub; +} +function $ed43cc03b55b9961$var$stream() { + const subscriptions = []; + return (action, arg)=>{ + switch(action){ + case $ed43cc03b55b9961$var$RESET: + subscriptions.splice(0, subscriptions.length); + return; + case $ed43cc03b55b9961$var$SUBSCRIBE: + subscriptions.push(arg); + return ()=>{ + const indexOf = subscriptions.indexOf(arg); + if (indexOf > -1) subscriptions.splice(indexOf, 1); + }; + case $ed43cc03b55b9961$var$PUBLISH: + subscriptions.slice().forEach((subscription)=>{ + subscription(arg); + }); + return; + default: + throw new Error(`unrecognized action ${action}`); + } + }; +} +function $ed43cc03b55b9961$var$statefulStream(initial) { + let value = initial; + const innerSubject = $ed43cc03b55b9961$var$stream(); + return (action, arg)=>{ + switch(action){ + case $ed43cc03b55b9961$var$SUBSCRIBE: + const subscription = arg; + subscription(value); + break; + case $ed43cc03b55b9961$var$PUBLISH: + value = arg; + break; + case $ed43cc03b55b9961$var$VALUE: + return value; + } + return innerSubject(action, arg); + }; +} +function $ed43cc03b55b9961$var$eventHandler(emitter) { + let unsub; + let currentSubscription; + const cleanup = ()=>unsub && unsub(); + return function(action, subscription) { + switch(action){ + case $ed43cc03b55b9961$var$SUBSCRIBE: + if (subscription) { + if (currentSubscription === subscription) return; + cleanup(); + currentSubscription = subscription; + unsub = $ed43cc03b55b9961$var$subscribe(emitter, subscription); + return unsub; + } else { + cleanup(); + return $ed43cc03b55b9961$var$noop; + } + case $ed43cc03b55b9961$var$RESET: + cleanup(); + currentSubscription = null; + return; + default: + throw new Error(`unrecognized action ${action}`); + } + }; +} +function $ed43cc03b55b9961$var$streamFromEmitter(emitter) { + return $ed43cc03b55b9961$var$tap($ed43cc03b55b9961$var$stream(), (stream2)=>$ed43cc03b55b9961$var$connect(emitter, stream2)); +} +function $ed43cc03b55b9961$var$statefulStreamFromEmitter(emitter, initial) { + return $ed43cc03b55b9961$var$tap($ed43cc03b55b9961$var$statefulStream(initial), (stream2)=>$ed43cc03b55b9961$var$connect(emitter, stream2)); +} +function $ed43cc03b55b9961$var$combineOperators(...operators) { + return (subscriber)=>{ + return operators.reduceRight($ed43cc03b55b9961$var$thrush, subscriber); + }; +} +function $ed43cc03b55b9961$var$pipe(source, ...operators) { + const project = $ed43cc03b55b9961$var$combineOperators(...operators); + return (action, subscription)=>{ + switch(action){ + case $ed43cc03b55b9961$var$SUBSCRIBE: + return $ed43cc03b55b9961$var$subscribe(source, project(subscription)); + case $ed43cc03b55b9961$var$RESET: + $ed43cc03b55b9961$var$reset(source); + return; + } + }; +} +function $ed43cc03b55b9961$var$defaultComparator(previous, next) { + return previous === next; +} +function $ed43cc03b55b9961$var$distinctUntilChanged(comparator = $ed43cc03b55b9961$var$defaultComparator) { + let current; + return (done)=>(next)=>{ + if (!comparator(current, next)) { + current = next; + done(next); + } + }; +} +function $ed43cc03b55b9961$var$filter(predicate) { + return (done)=>(value)=>{ + predicate(value) && done(value); + }; +} +function $ed43cc03b55b9961$var$map(project) { + return (done)=>$ed43cc03b55b9961$var$compose(done, project); +} +function $ed43cc03b55b9961$var$mapTo(value) { + return (done)=>()=>done(value); +} +function $ed43cc03b55b9961$var$scan(scanner, initial) { + return (done)=>(value)=>done(initial = scanner(initial, value)); +} +function $ed43cc03b55b9961$var$skip(times) { + return (done)=>(value)=>{ + times > 0 ? times-- : done(value); + }; +} +function $ed43cc03b55b9961$var$throttleTime(interval) { + let currentValue = null; + let timeout; + return (done)=>(value)=>{ + currentValue = value; + if (timeout) return; + timeout = setTimeout(()=>{ + timeout = void 0; + done(currentValue); + }, interval); + }; +} +function $ed43cc03b55b9961$var$debounceTime(interval) { + let currentValue; + let timeout; + return (done)=>(value)=>{ + currentValue = value; + if (timeout) clearTimeout(timeout); + timeout = setTimeout(()=>{ + done(currentValue); + }, interval); + }; +} +function $ed43cc03b55b9961$var$withLatestFrom(...sources) { + const values = new Array(sources.length); + let called = 0; + let pendingCall = null; + const allCalled = Math.pow(2, sources.length) - 1; + sources.forEach((source, index)=>{ + const bit = Math.pow(2, index); + $ed43cc03b55b9961$var$subscribe(source, (value)=>{ + const prevCalled = called; + called = called | bit; + values[index] = value; + if (prevCalled !== allCalled && called === allCalled && pendingCall) { + pendingCall(); + pendingCall = null; + } + }); + }); + return (done)=>(value)=>{ + const call2 = ()=>done([ + value + ].concat(values)); + if (called === allCalled) call2(); + else pendingCall = call2; + }; +} +function $ed43cc03b55b9961$var$merge(...sources) { + return function(action, subscription) { + switch(action){ + case $ed43cc03b55b9961$var$SUBSCRIBE: + return $ed43cc03b55b9961$var$joinProc(...sources.map((source)=>$ed43cc03b55b9961$var$subscribe(source, subscription))); + case $ed43cc03b55b9961$var$RESET: + return; + default: + throw new Error(`unrecognized action ${action}`); + } + }; +} +function $ed43cc03b55b9961$var$duc(source, comparator = $ed43cc03b55b9961$var$defaultComparator) { + return $ed43cc03b55b9961$var$pipe(source, $ed43cc03b55b9961$var$distinctUntilChanged(comparator)); +} +function $ed43cc03b55b9961$var$combineLatest(...emitters) { + const innerSubject = $ed43cc03b55b9961$var$stream(); + const values = new Array(emitters.length); + let called = 0; + const allCalled = Math.pow(2, emitters.length) - 1; + emitters.forEach((source, index)=>{ + const bit = Math.pow(2, index); + $ed43cc03b55b9961$var$subscribe(source, (value)=>{ + values[index] = value; + called = called | bit; + if (called === allCalled) $ed43cc03b55b9961$var$publish(innerSubject, values); + }); + }); + return function(action, subscription) { + switch(action){ + case $ed43cc03b55b9961$var$SUBSCRIBE: + if (called === allCalled) subscription(values); + return $ed43cc03b55b9961$var$subscribe(innerSubject, subscription); + case $ed43cc03b55b9961$var$RESET: + return $ed43cc03b55b9961$var$reset(innerSubject); + default: + throw new Error(`unrecognized action ${action}`); + } + }; +} +function $ed43cc03b55b9961$var$system(constructor, dependencies = [], { singleton: singleton } = { + singleton: true +}) { + return { + id: $ed43cc03b55b9961$var$id(), + constructor: constructor, + dependencies: dependencies, + singleton: singleton + }; +} +const $ed43cc03b55b9961$var$id = ()=>Symbol(); +function $ed43cc03b55b9961$var$init(systemSpec) { + const singletons = /* @__PURE__ */ new Map(); + const _init = ({ id: id2, constructor: constructor, dependencies: dependencies, singleton: singleton })=>{ + if (singleton && singletons.has(id2)) return singletons.get(id2); + const system2 = constructor(dependencies.map((e)=>_init(e))); + if (singleton) singletons.set(id2, system2); + return system2; + }; + return _init(systemSpec); +} +function $ed43cc03b55b9961$var$omit(keys, obj) { + const result = {}; + const index = {}; + let idx = 0; + const len = keys.length; + while(idx < len){ + index[keys[idx]] = 1; + idx += 1; + } + for(const prop in obj)if (!index.hasOwnProperty(prop)) result[prop] = obj[prop]; + return result; +} +const $ed43cc03b55b9961$var$useIsomorphicLayoutEffect$2 = typeof document !== "undefined" ? (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useLayoutEffect : (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useEffect; +function $ed43cc03b55b9961$var$systemToComponent(systemSpec, map2, Root) { + const requiredPropNames = Object.keys(map2.required || {}); + const optionalPropNames = Object.keys(map2.optional || {}); + const methodNames = Object.keys(map2.methods || {}); + const eventNames = Object.keys(map2.events || {}); + const Context = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createContext({}); + function applyPropsToSystem(system2, props) { + if (system2["propsReady"]) $ed43cc03b55b9961$var$publish(system2["propsReady"], false); + for (const requiredPropName of requiredPropNames){ + const stream2 = system2[map2.required[requiredPropName]]; + $ed43cc03b55b9961$var$publish(stream2, props[requiredPropName]); + } + for (const optionalPropName of optionalPropNames)if (optionalPropName in props) { + const stream2 = system2[map2.optional[optionalPropName]]; + $ed43cc03b55b9961$var$publish(stream2, props[optionalPropName]); + } + if (system2["propsReady"]) $ed43cc03b55b9961$var$publish(system2["propsReady"], true); + } + function buildMethods(system2) { + return methodNames.reduce((acc, methodName)=>{ + acc[methodName] = (value)=>{ + const stream2 = system2[map2.methods[methodName]]; + $ed43cc03b55b9961$var$publish(stream2, value); + }; + return acc; + }, {}); + } + function buildEventHandlers(system2) { + return eventNames.reduce((handlers, eventName)=>{ + handlers[eventName] = $ed43cc03b55b9961$var$eventHandler(system2[map2.events[eventName]]); + return handlers; + }, {}); + } + const Component = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).forwardRef((propsWithChildren, ref)=>{ + const { children: children, ...props } = propsWithChildren; + const [system2] = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useState(()=>{ + return $ed43cc03b55b9961$var$tap($ed43cc03b55b9961$var$init(systemSpec), (system22)=>applyPropsToSystem(system22, props)); + }); + const [handlers] = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useState($ed43cc03b55b9961$var$curry1to0(buildEventHandlers, system2)); + $ed43cc03b55b9961$var$useIsomorphicLayoutEffect$2(()=>{ + for (const eventName of eventNames)if (eventName in props) $ed43cc03b55b9961$var$subscribe(handlers[eventName], props[eventName]); + return ()=>{ + Object.values(handlers).map($ed43cc03b55b9961$var$reset); + }; + }, [ + props, + handlers, + system2 + ]); + $ed43cc03b55b9961$var$useIsomorphicLayoutEffect$2(()=>{ + applyPropsToSystem(system2, props); + }); + (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useImperativeHandle(ref, $ed43cc03b55b9961$var$always(buildMethods(system2))); + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(Context.Provider, { + value: system2 + }, Root ? (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(Root, $ed43cc03b55b9961$var$omit([ + ...requiredPropNames, + ...optionalPropNames, + ...eventNames + ], props), children) : children); + }); + const usePublisher2 = (key)=>{ + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useCallback($ed43cc03b55b9961$var$curry2to1($ed43cc03b55b9961$var$publish, (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useContext(Context)[key]), [ + key + ]); + }; + const useEmitterValue2 = (key)=>{ + const system2 = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useContext(Context); + const source = system2[key]; + const [value, setValue] = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useState($ed43cc03b55b9961$var$curry1to0($ed43cc03b55b9961$var$getValue, source)); + $ed43cc03b55b9961$var$useIsomorphicLayoutEffect$2(()=>$ed43cc03b55b9961$var$subscribe(source, (next)=>{ + if (next !== value) setValue($ed43cc03b55b9961$var$always(next)); + }), [ + source, + value + ]); + return value; + }; + const useEmitter2 = (key, callback)=>{ + const context = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useContext(Context); + const source = context[key]; + $ed43cc03b55b9961$var$useIsomorphicLayoutEffect$2(()=>$ed43cc03b55b9961$var$subscribe(source, callback), [ + callback, + source + ]); + }; + return { + Component: Component, + usePublisher: usePublisher2, + useEmitterValue: useEmitterValue2, + useEmitter: useEmitter2 + }; +} +const $ed43cc03b55b9961$var$useIsomorphicLayoutEffect = typeof document !== "undefined" ? (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useLayoutEffect : (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useEffect; +const $ed43cc03b55b9961$var$useIsomorphicLayoutEffect$1 = $ed43cc03b55b9961$var$useIsomorphicLayoutEffect; +var $ed43cc03b55b9961$export$243e62d78d3b544d = /* @__PURE__ */ ((LogLevel2)=>{ + LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG"; + LogLevel2[LogLevel2["INFO"] = 1] = "INFO"; + LogLevel2[LogLevel2["WARN"] = 2] = "WARN"; + LogLevel2[LogLevel2["ERROR"] = 3] = "ERROR"; + return LogLevel2; +})($ed43cc03b55b9961$export$243e62d78d3b544d || {}); +const $ed43cc03b55b9961$var$CONSOLE_METHOD_MAP = { + [0]: "debug", + [1]: "log", + [2]: "warn", + [3]: "error" +}; +const $ed43cc03b55b9961$var$getGlobalThis = ()=>typeof globalThis === "undefined" ? window : globalThis; +const $ed43cc03b55b9961$var$loggerSystem = $ed43cc03b55b9961$var$system(()=>{ + const logLevel = $ed43cc03b55b9961$var$statefulStream(3); + const log = $ed43cc03b55b9961$var$statefulStream((label, message, level = 1)=>{ + var _a; + const currentLevel = (_a = $ed43cc03b55b9961$var$getGlobalThis()["VIRTUOSO_LOG_LEVEL"]) != null ? _a : $ed43cc03b55b9961$var$getValue(logLevel); + if (level >= currentLevel) console[$ed43cc03b55b9961$var$CONSOLE_METHOD_MAP[level]]("%creact-virtuoso: %c%s %o", "color: #0253b3; font-weight: bold", "color: initial", label, message); + }); + return { + log: log, + logLevel: logLevel + }; +}, [], { + singleton: true +}); +function $ed43cc03b55b9961$var$useSizeWithElRef(callback, enabled = true) { + const ref = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useRef(null); + let callbackRef = (_el)=>{}; + if (typeof ResizeObserver !== "undefined") { + const observer = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useMemo(()=>{ + return new ResizeObserver((entries)=>{ + const element = entries[0].target; + if (element.offsetParent !== null) callback(element); + }); + }, [ + callback + ]); + callbackRef = (elRef)=>{ + if (elRef && enabled) { + observer.observe(elRef); + ref.current = elRef; + } else { + if (ref.current) observer.unobserve(ref.current); + ref.current = null; + } + }; + } + return { + ref: ref, + callbackRef: callbackRef + }; +} +function $ed43cc03b55b9961$var$useSize(callback, enabled = true) { + return $ed43cc03b55b9961$var$useSizeWithElRef(callback, enabled).callbackRef; +} +function $ed43cc03b55b9961$var$useChangedListContentsSizes(callback, itemSize, enabled, scrollContainerStateCallback, log, gap, customScrollParent) { + const memoedCallback = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useCallback((el)=>{ + const ranges = $ed43cc03b55b9961$var$getChangedChildSizes(el.children, itemSize, "offsetHeight", log); + let scrollableElement = el.parentElement; + while(!scrollableElement.dataset["virtuosoScroller"])scrollableElement = scrollableElement.parentElement; + const windowScrolling = scrollableElement.lastElementChild.dataset["viewportType"] === "window"; + const scrollTop = customScrollParent ? customScrollParent.scrollTop : windowScrolling ? window.pageYOffset || document.documentElement.scrollTop : scrollableElement.scrollTop; + const scrollHeight = customScrollParent ? customScrollParent.scrollHeight : windowScrolling ? document.documentElement.scrollHeight : scrollableElement.scrollHeight; + const viewportHeight = customScrollParent ? customScrollParent.offsetHeight : windowScrolling ? window.innerHeight : scrollableElement.offsetHeight; + scrollContainerStateCallback({ + scrollTop: Math.max(scrollTop, 0), + scrollHeight: scrollHeight, + viewportHeight: viewportHeight + }); + gap == null || gap($ed43cc03b55b9961$var$resolveGapValue$1("row-gap", getComputedStyle(el).rowGap, log)); + if (ranges !== null) callback(ranges); + }, [ + callback, + itemSize, + log, + gap, + customScrollParent, + scrollContainerStateCallback + ]); + return $ed43cc03b55b9961$var$useSizeWithElRef(memoedCallback, enabled); +} +function $ed43cc03b55b9961$var$getChangedChildSizes(children, itemSize, field, log) { + const length = children.length; + if (length === 0) return null; + const results = []; + for(let i = 0; i < length; i++){ + const child = children.item(i); + if (!child || child.dataset.index === void 0) continue; + const index = parseInt(child.dataset.index); + const knownSize = parseFloat(child.dataset.knownSize); + const size = itemSize(child, field); + if (size === 0) log("Zero-sized element, this should not happen", { + child: child + }, $ed43cc03b55b9961$export$243e62d78d3b544d.ERROR); + if (size === knownSize) continue; + const lastResult = results[results.length - 1]; + if (results.length === 0 || lastResult.size !== size || lastResult.endIndex !== index - 1) results.push({ + startIndex: index, + endIndex: index, + size: size + }); + else results[results.length - 1].endIndex++; + } + return results; +} +function $ed43cc03b55b9961$var$resolveGapValue$1(property, value, log) { + if (value !== "normal" && !(value == null ? void 0 : value.endsWith("px"))) log(`${property} was not resolved to pixel value correctly`, value, $ed43cc03b55b9961$export$243e62d78d3b544d.WARN); + if (value === "normal") return 0; + return parseInt(value != null ? value : "0", 10); +} +function $ed43cc03b55b9961$var$correctItemSize(el, dimension) { + return Math.round(el.getBoundingClientRect()[dimension]); +} +function $ed43cc03b55b9961$var$approximatelyEqual(num1, num2) { + return Math.abs(num1 - num2) < 1.01; +} +function $ed43cc03b55b9961$var$useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, scrollerElement, scrollerRefCallback = $ed43cc03b55b9961$var$noop, customScrollParent) { + const scrollerRef = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useRef(null); + const scrollTopTarget = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useRef(null); + const timeoutRef = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useRef(null); + const handler = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useCallback((ev)=>{ + const el = ev.target; + const windowScroll = el === window || el === document; + const scrollTop = windowScroll ? window.pageYOffset || document.documentElement.scrollTop : el.scrollTop; + const scrollHeight = windowScroll ? document.documentElement.scrollHeight : el.scrollHeight; + const viewportHeight = windowScroll ? window.innerHeight : el.offsetHeight; + const call2 = ()=>{ + scrollContainerStateCallback({ + scrollTop: Math.max(scrollTop, 0), + scrollHeight: scrollHeight, + viewportHeight: viewportHeight + }); + }; + if (ev.suppressFlushSync) call2(); + else (0, (/*@__PURE__*/$parcel$interopDefault($grDIR))).flushSync(call2); + if (scrollTopTarget.current !== null) { + if (scrollTop === scrollTopTarget.current || scrollTop <= 0 || scrollTop === scrollHeight - viewportHeight) { + scrollTopTarget.current = null; + smoothScrollTargetReached(true); + if (timeoutRef.current) { + clearTimeout(timeoutRef.current); + timeoutRef.current = null; + } + } + } + }, [ + scrollContainerStateCallback, + smoothScrollTargetReached + ]); + (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useEffect(()=>{ + const localRef = customScrollParent ? customScrollParent : scrollerRef.current; + scrollerRefCallback(customScrollParent ? customScrollParent : scrollerRef.current); + handler({ + target: localRef, + suppressFlushSync: true + }); + localRef.addEventListener("scroll", handler, { + passive: true + }); + return ()=>{ + scrollerRefCallback(null); + localRef.removeEventListener("scroll", handler); + }; + }, [ + scrollerRef, + handler, + scrollerElement, + scrollerRefCallback, + customScrollParent + ]); + function scrollToCallback(location) { + const scrollerElement2 = scrollerRef.current; + if (!scrollerElement2 || "offsetHeight" in scrollerElement2 && scrollerElement2.offsetHeight === 0) return; + const isSmooth = location.behavior === "smooth"; + let offsetHeight; + let scrollHeight; + let scrollTop; + if (scrollerElement2 === window) { + scrollHeight = Math.max($ed43cc03b55b9961$var$correctItemSize(document.documentElement, "height"), document.documentElement.scrollHeight); + offsetHeight = window.innerHeight; + scrollTop = document.documentElement.scrollTop; + } else { + scrollHeight = scrollerElement2.scrollHeight; + offsetHeight = $ed43cc03b55b9961$var$correctItemSize(scrollerElement2, "height"); + scrollTop = scrollerElement2.scrollTop; + } + const maxScrollTop = scrollHeight - offsetHeight; + location.top = Math.ceil(Math.max(Math.min(maxScrollTop, location.top), 0)); + if ($ed43cc03b55b9961$var$approximatelyEqual(offsetHeight, scrollHeight) || location.top === scrollTop) { + scrollContainerStateCallback({ + scrollTop: scrollTop, + scrollHeight: scrollHeight, + viewportHeight: offsetHeight + }); + if (isSmooth) smoothScrollTargetReached(true); + return; + } + if (isSmooth) { + scrollTopTarget.current = location.top; + if (timeoutRef.current) clearTimeout(timeoutRef.current); + timeoutRef.current = setTimeout(()=>{ + timeoutRef.current = null; + scrollTopTarget.current = null; + smoothScrollTargetReached(true); + }, 1e3); + } else scrollTopTarget.current = null; + scrollerElement2.scrollTo(location); + } + function scrollByCallback(location) { + scrollerRef.current.scrollBy(location); + } + return { + scrollerRef: scrollerRef, + scrollByCallback: scrollByCallback, + scrollToCallback: scrollToCallback + }; +} +const $ed43cc03b55b9961$var$domIOSystem = $ed43cc03b55b9961$var$system(()=>{ + const scrollContainerState = $ed43cc03b55b9961$var$stream(); + const scrollTop = $ed43cc03b55b9961$var$stream(); + const deviation = $ed43cc03b55b9961$var$statefulStream(0); + const smoothScrollTargetReached = $ed43cc03b55b9961$var$stream(); + const statefulScrollTop = $ed43cc03b55b9961$var$statefulStream(0); + const viewportHeight = $ed43cc03b55b9961$var$stream(); + const scrollHeight = $ed43cc03b55b9961$var$stream(); + const headerHeight = $ed43cc03b55b9961$var$statefulStream(0); + const fixedHeaderHeight = $ed43cc03b55b9961$var$statefulStream(0); + const fixedFooterHeight = $ed43cc03b55b9961$var$statefulStream(0); + const footerHeight = $ed43cc03b55b9961$var$statefulStream(0); + const scrollTo = $ed43cc03b55b9961$var$stream(); + const scrollBy = $ed43cc03b55b9961$var$stream(); + const scrollingInProgress = $ed43cc03b55b9961$var$statefulStream(false); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(scrollContainerState, $ed43cc03b55b9961$var$map(({ scrollTop: scrollTop2 })=>scrollTop2)), scrollTop); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(scrollContainerState, $ed43cc03b55b9961$var$map(({ scrollHeight: scrollHeight2 })=>scrollHeight2)), scrollHeight); + $ed43cc03b55b9961$var$connect(scrollTop, statefulScrollTop); + return { + scrollContainerState: // input + scrollContainerState, + scrollTop: scrollTop, + viewportHeight: viewportHeight, + headerHeight: headerHeight, + fixedHeaderHeight: fixedHeaderHeight, + fixedFooterHeight: fixedFooterHeight, + footerHeight: footerHeight, + scrollHeight: scrollHeight, + smoothScrollTargetReached: smoothScrollTargetReached, + scrollTo: // signals + scrollTo, + scrollBy: scrollBy, + statefulScrollTop: // state + statefulScrollTop, + deviation: deviation, + scrollingInProgress: scrollingInProgress + }; +}, [], { + singleton: true +}); +const $ed43cc03b55b9961$var$NIL_NODE = { + lvl: 0 +}; +function $ed43cc03b55b9961$var$newAANode(k, v, lvl, l = $ed43cc03b55b9961$var$NIL_NODE, r = $ed43cc03b55b9961$var$NIL_NODE) { + return { + k: k, + v: v, + lvl: lvl, + l: l, + r: r + }; +} +function $ed43cc03b55b9961$var$empty(node) { + return node === $ed43cc03b55b9961$var$NIL_NODE; +} +function $ed43cc03b55b9961$var$newTree() { + return $ed43cc03b55b9961$var$NIL_NODE; +} +function $ed43cc03b55b9961$var$remove(node, key) { + if ($ed43cc03b55b9961$var$empty(node)) return $ed43cc03b55b9961$var$NIL_NODE; + const { k: k, l: l, r: r } = node; + if (key === k) { + if ($ed43cc03b55b9961$var$empty(l)) return r; + else if ($ed43cc03b55b9961$var$empty(r)) return l; + else { + const [lastKey, lastValue] = $ed43cc03b55b9961$var$last(l); + return $ed43cc03b55b9961$var$adjust($ed43cc03b55b9961$var$clone(node, { + k: lastKey, + v: lastValue, + l: $ed43cc03b55b9961$var$deleteLast(l) + })); + } + } else if (key < k) return $ed43cc03b55b9961$var$adjust($ed43cc03b55b9961$var$clone(node, { + l: $ed43cc03b55b9961$var$remove(l, key) + })); + else return $ed43cc03b55b9961$var$adjust($ed43cc03b55b9961$var$clone(node, { + r: $ed43cc03b55b9961$var$remove(r, key) + })); +} +function $ed43cc03b55b9961$var$find(node, key) { + if ($ed43cc03b55b9961$var$empty(node)) return; + if (key === node.k) return node.v; + else if (key < node.k) return $ed43cc03b55b9961$var$find(node.l, key); + else return $ed43cc03b55b9961$var$find(node.r, key); +} +function $ed43cc03b55b9961$var$findMaxKeyValue(node, value, field = "k") { + if ($ed43cc03b55b9961$var$empty(node)) return [ + -Infinity, + void 0 + ]; + if (Number(node[field]) === value) return [ + node.k, + node.v + ]; + if (Number(node[field]) < value) { + const r = $ed43cc03b55b9961$var$findMaxKeyValue(node.r, value, field); + if (r[0] === -Infinity) return [ + node.k, + node.v + ]; + else return r; + } + return $ed43cc03b55b9961$var$findMaxKeyValue(node.l, value, field); +} +function $ed43cc03b55b9961$var$insert(node, k, v) { + if ($ed43cc03b55b9961$var$empty(node)) return $ed43cc03b55b9961$var$newAANode(k, v, 1); + if (k === node.k) return $ed43cc03b55b9961$var$clone(node, { + k: k, + v: v + }); + else if (k < node.k) return $ed43cc03b55b9961$var$rebalance($ed43cc03b55b9961$var$clone(node, { + l: $ed43cc03b55b9961$var$insert(node.l, k, v) + })); + else return $ed43cc03b55b9961$var$rebalance($ed43cc03b55b9961$var$clone(node, { + r: $ed43cc03b55b9961$var$insert(node.r, k, v) + })); +} +function $ed43cc03b55b9961$var$walkWithin(node, start, end) { + if ($ed43cc03b55b9961$var$empty(node)) return []; + const { k: k, v: v, l: l, r: r } = node; + let result = []; + if (k > start) result = result.concat($ed43cc03b55b9961$var$walkWithin(l, start, end)); + if (k >= start && k <= end) result.push({ + k: k, + v: v + }); + if (k <= end) result = result.concat($ed43cc03b55b9961$var$walkWithin(r, start, end)); + return result; +} +function $ed43cc03b55b9961$var$walk(node) { + if ($ed43cc03b55b9961$var$empty(node)) return []; + return [ + ...$ed43cc03b55b9961$var$walk(node.l), + { + k: node.k, + v: node.v + }, + ...$ed43cc03b55b9961$var$walk(node.r) + ]; +} +function $ed43cc03b55b9961$var$last(node) { + return $ed43cc03b55b9961$var$empty(node.r) ? [ + node.k, + node.v + ] : $ed43cc03b55b9961$var$last(node.r); +} +function $ed43cc03b55b9961$var$deleteLast(node) { + return $ed43cc03b55b9961$var$empty(node.r) ? node.l : $ed43cc03b55b9961$var$adjust($ed43cc03b55b9961$var$clone(node, { + r: $ed43cc03b55b9961$var$deleteLast(node.r) + })); +} +function $ed43cc03b55b9961$var$clone(node, args) { + return $ed43cc03b55b9961$var$newAANode(args.k !== void 0 ? args.k : node.k, args.v !== void 0 ? args.v : node.v, args.lvl !== void 0 ? args.lvl : node.lvl, args.l !== void 0 ? args.l : node.l, args.r !== void 0 ? args.r : node.r); +} +function $ed43cc03b55b9961$var$isSingle(node) { + return $ed43cc03b55b9961$var$empty(node) || node.lvl > node.r.lvl; +} +function $ed43cc03b55b9961$var$rebalance(node) { + return $ed43cc03b55b9961$var$split($ed43cc03b55b9961$var$skew(node)); +} +function $ed43cc03b55b9961$var$adjust(node) { + const { l: l, r: r, lvl: lvl } = node; + if (r.lvl >= lvl - 1 && l.lvl >= lvl - 1) return node; + else if (lvl > r.lvl + 1) { + if ($ed43cc03b55b9961$var$isSingle(l)) return $ed43cc03b55b9961$var$skew($ed43cc03b55b9961$var$clone(node, { + lvl: lvl - 1 + })); + else { + if (!$ed43cc03b55b9961$var$empty(l) && !$ed43cc03b55b9961$var$empty(l.r)) return $ed43cc03b55b9961$var$clone(l.r, { + l: $ed43cc03b55b9961$var$clone(l, { + r: l.r.l + }), + r: $ed43cc03b55b9961$var$clone(node, { + l: l.r.r, + lvl: lvl - 1 + }), + lvl: lvl + }); + else throw new Error("Unexpected empty nodes"); + } + } else { + if ($ed43cc03b55b9961$var$isSingle(node)) return $ed43cc03b55b9961$var$split($ed43cc03b55b9961$var$clone(node, { + lvl: lvl - 1 + })); + else { + if (!$ed43cc03b55b9961$var$empty(r) && !$ed43cc03b55b9961$var$empty(r.l)) { + const rl = r.l; + const rlvl = $ed43cc03b55b9961$var$isSingle(rl) ? r.lvl - 1 : r.lvl; + return $ed43cc03b55b9961$var$clone(rl, { + l: $ed43cc03b55b9961$var$clone(node, { + r: rl.l, + lvl: lvl - 1 + }), + r: $ed43cc03b55b9961$var$split($ed43cc03b55b9961$var$clone(r, { + l: rl.r, + lvl: rlvl + })), + lvl: rl.lvl + 1 + }); + } else throw new Error("Unexpected empty nodes"); + } + } +} +function $ed43cc03b55b9961$var$rangesWithin(node, startIndex, endIndex) { + if ($ed43cc03b55b9961$var$empty(node)) return []; + const adjustedStart = $ed43cc03b55b9961$var$findMaxKeyValue(node, startIndex)[0]; + return $ed43cc03b55b9961$var$toRanges($ed43cc03b55b9961$var$walkWithin(node, adjustedStart, endIndex)); +} +function $ed43cc03b55b9961$var$arrayToRanges(items, parser) { + const length = items.length; + if (length === 0) return []; + let { index: start, value: value } = parser(items[0]); + const result = []; + for(let i = 1; i < length; i++){ + const { index: nextIndex, value: nextValue } = parser(items[i]); + result.push({ + start: start, + end: nextIndex - 1, + value: value + }); + start = nextIndex; + value = nextValue; + } + result.push({ + start: start, + end: Infinity, + value: value + }); + return result; +} +function $ed43cc03b55b9961$var$toRanges(nodes) { + return $ed43cc03b55b9961$var$arrayToRanges(nodes, ({ k: index, v: value })=>({ + index: index, + value: value + })); +} +function $ed43cc03b55b9961$var$split(node) { + const { r: r, lvl: lvl } = node; + return !$ed43cc03b55b9961$var$empty(r) && !$ed43cc03b55b9961$var$empty(r.r) && r.lvl === lvl && r.r.lvl === lvl ? $ed43cc03b55b9961$var$clone(r, { + l: $ed43cc03b55b9961$var$clone(node, { + r: r.l + }), + lvl: lvl + 1 + }) : node; +} +function $ed43cc03b55b9961$var$skew(node) { + const { l: l } = node; + return !$ed43cc03b55b9961$var$empty(l) && l.lvl === node.lvl ? $ed43cc03b55b9961$var$clone(l, { + r: $ed43cc03b55b9961$var$clone(node, { + l: l.r + }) + }) : node; +} +function $ed43cc03b55b9961$var$findIndexOfClosestSmallerOrEqual(items, value, comparator, start = 0) { + let end = items.length - 1; + while(start <= end){ + const index = Math.floor((start + end) / 2); + const item = items[index]; + const match = comparator(item, value); + if (match === 0) return index; + if (match === -1) { + if (end - start < 2) return index - 1; + end = index - 1; + } else { + if (end === start) return index; + start = index + 1; + } + } + throw new Error(`Failed binary finding record in array - ${items.join(",")}, searched for ${value}`); +} +function $ed43cc03b55b9961$var$findClosestSmallerOrEqual(items, value, comparator) { + return items[$ed43cc03b55b9961$var$findIndexOfClosestSmallerOrEqual(items, value, comparator)]; +} +function $ed43cc03b55b9961$var$findRange(items, startValue, endValue, comparator) { + const startIndex = $ed43cc03b55b9961$var$findIndexOfClosestSmallerOrEqual(items, startValue, comparator); + const endIndex = $ed43cc03b55b9961$var$findIndexOfClosestSmallerOrEqual(items, endValue, comparator, startIndex); + return items.slice(startIndex, endIndex + 1); +} +const $ed43cc03b55b9961$var$recalcSystem = $ed43cc03b55b9961$var$system(()=>{ + const recalcInProgress = $ed43cc03b55b9961$var$statefulStream(false); + return { + recalcInProgress: recalcInProgress + }; +}, [], { + singleton: true +}); +function $ed43cc03b55b9961$var$rangeIncludes(refRange) { + const { size: size, startIndex: startIndex, endIndex: endIndex } = refRange; + return (range)=>{ + return range.start === startIndex && (range.end === endIndex || range.end === Infinity) && range.value === size; + }; +} +function $ed43cc03b55b9961$var$affectedGroupCount(offset, groupIndices) { + let recognizedOffsetItems = 0; + let groupIndex = 0; + while(recognizedOffsetItems < offset){ + recognizedOffsetItems += groupIndices[groupIndex + 1] - groupIndices[groupIndex] - 1; + groupIndex++; + } + const offsetIsExact = recognizedOffsetItems === offset; + return groupIndex - (offsetIsExact ? 0 : 1); +} +function $ed43cc03b55b9961$var$insertRanges(sizeTree, ranges) { + let syncStart = $ed43cc03b55b9961$var$empty(sizeTree) ? 0 : Infinity; + for (const range of ranges){ + const { size: size, startIndex: startIndex, endIndex: endIndex } = range; + syncStart = Math.min(syncStart, startIndex); + if ($ed43cc03b55b9961$var$empty(sizeTree)) { + sizeTree = $ed43cc03b55b9961$var$insert(sizeTree, 0, size); + continue; + } + const overlappingRanges = $ed43cc03b55b9961$var$rangesWithin(sizeTree, startIndex - 1, endIndex + 1); + if (overlappingRanges.some($ed43cc03b55b9961$var$rangeIncludes(range))) continue; + let firstPassDone = false; + let shouldInsert = false; + for (const { start: rangeStart, end: rangeEnd, value: rangeValue } of overlappingRanges){ + if (!firstPassDone) { + shouldInsert = rangeValue !== size; + firstPassDone = true; + } else if (endIndex >= rangeStart || size === rangeValue) sizeTree = $ed43cc03b55b9961$var$remove(sizeTree, rangeStart); + if (rangeEnd > endIndex && endIndex >= rangeStart) { + if (rangeValue !== size) sizeTree = $ed43cc03b55b9961$var$insert(sizeTree, endIndex + 1, rangeValue); + } + } + if (shouldInsert) sizeTree = $ed43cc03b55b9961$var$insert(sizeTree, startIndex, size); + } + return [ + sizeTree, + syncStart + ]; +} +function $ed43cc03b55b9961$var$initialSizeState() { + return { + offsetTree: [], + sizeTree: $ed43cc03b55b9961$var$newTree(), + groupOffsetTree: $ed43cc03b55b9961$var$newTree(), + lastIndex: 0, + lastOffset: 0, + lastSize: 0, + groupIndices: [] + }; +} +function $ed43cc03b55b9961$var$indexComparator({ index: itemIndex }, index) { + return index === itemIndex ? 0 : index < itemIndex ? -1 : 1; +} +function $ed43cc03b55b9961$var$offsetComparator({ offset: itemOffset }, offset) { + return offset === itemOffset ? 0 : offset < itemOffset ? -1 : 1; +} +function $ed43cc03b55b9961$var$offsetPointParser(point) { + return { + index: point.index, + value: point + }; +} +function $ed43cc03b55b9961$var$rangesWithinOffsets(tree, startOffset, endOffset, minStartIndex = 0) { + if (minStartIndex > 0) startOffset = Math.max(startOffset, $ed43cc03b55b9961$var$findClosestSmallerOrEqual(tree, minStartIndex, $ed43cc03b55b9961$var$indexComparator).offset); + return $ed43cc03b55b9961$var$arrayToRanges($ed43cc03b55b9961$var$findRange(tree, startOffset, endOffset, $ed43cc03b55b9961$var$offsetComparator), $ed43cc03b55b9961$var$offsetPointParser); +} +function $ed43cc03b55b9961$var$createOffsetTree(prevOffsetTree, syncStart, sizeTree, gap) { + let offsetTree = prevOffsetTree; + let prevIndex = 0; + let prevSize = 0; + let prevOffset = 0; + let startIndex = 0; + if (syncStart !== 0) { + startIndex = $ed43cc03b55b9961$var$findIndexOfClosestSmallerOrEqual(offsetTree, syncStart - 1, $ed43cc03b55b9961$var$indexComparator); + const offsetInfo = offsetTree[startIndex]; + prevOffset = offsetInfo.offset; + const kv = $ed43cc03b55b9961$var$findMaxKeyValue(sizeTree, syncStart - 1); + prevIndex = kv[0]; + prevSize = kv[1]; + if (offsetTree.length && offsetTree[startIndex].size === $ed43cc03b55b9961$var$findMaxKeyValue(sizeTree, syncStart)[1]) startIndex -= 1; + offsetTree = offsetTree.slice(0, startIndex + 1); + } else offsetTree = []; + for (const { start: startIndex2, value: value } of $ed43cc03b55b9961$var$rangesWithin(sizeTree, syncStart, Infinity)){ + const indexOffset = startIndex2 - prevIndex; + const aOffset = indexOffset * prevSize + prevOffset + indexOffset * gap; + offsetTree.push({ + offset: aOffset, + size: value, + index: startIndex2 + }); + prevIndex = startIndex2; + prevOffset = aOffset; + prevSize = value; + } + return { + offsetTree: offsetTree, + lastIndex: prevIndex, + lastOffset: prevOffset, + lastSize: prevSize + }; +} +function $ed43cc03b55b9961$var$sizeStateReducer(state, [ranges, groupIndices, log, gap]) { + if (ranges.length > 0) log("received item sizes", ranges, $ed43cc03b55b9961$export$243e62d78d3b544d.DEBUG); + const sizeTree = state.sizeTree; + let newSizeTree = sizeTree; + let syncStart = 0; + if (groupIndices.length > 0 && $ed43cc03b55b9961$var$empty(sizeTree) && ranges.length === 2) { + const groupSize = ranges[0].size; + const itemSize = ranges[1].size; + newSizeTree = groupIndices.reduce((tree, groupIndex)=>{ + return $ed43cc03b55b9961$var$insert($ed43cc03b55b9961$var$insert(tree, groupIndex, groupSize), groupIndex + 1, itemSize); + }, newSizeTree); + } else [newSizeTree, syncStart] = $ed43cc03b55b9961$var$insertRanges(newSizeTree, ranges); + if (newSizeTree === sizeTree) return state; + const { offsetTree: newOffsetTree, lastIndex: lastIndex, lastSize: lastSize, lastOffset: lastOffset } = $ed43cc03b55b9961$var$createOffsetTree(state.offsetTree, syncStart, newSizeTree, gap); + return { + sizeTree: newSizeTree, + offsetTree: newOffsetTree, + lastIndex: lastIndex, + lastOffset: lastOffset, + lastSize: lastSize, + groupOffsetTree: groupIndices.reduce((tree, index)=>{ + return $ed43cc03b55b9961$var$insert(tree, index, $ed43cc03b55b9961$var$offsetOf(index, newOffsetTree, gap)); + }, $ed43cc03b55b9961$var$newTree()), + groupIndices: groupIndices + }; +} +function $ed43cc03b55b9961$var$offsetOf(index, tree, gap) { + if (tree.length === 0) return 0; + const { offset: offset, index: startIndex, size: size } = $ed43cc03b55b9961$var$findClosestSmallerOrEqual(tree, index, $ed43cc03b55b9961$var$indexComparator); + const itemCount = index - startIndex; + const top = size * itemCount + (itemCount - 1) * gap + offset; + return top > 0 ? top + gap : top; +} +function $ed43cc03b55b9961$var$isGroupLocation(location) { + return typeof location.groupIndex !== "undefined"; +} +function $ed43cc03b55b9961$var$originalIndexFromLocation(location, sizes, lastIndex) { + if ($ed43cc03b55b9961$var$isGroupLocation(location)) return sizes.groupIndices[location.groupIndex] + 1; + else { + const numericIndex = location.index === "LAST" ? lastIndex : location.index; + let result = $ed43cc03b55b9961$var$originalIndexFromItemIndex(numericIndex, sizes); + result = Math.max(0, result, Math.min(lastIndex, result)); + return result; + } +} +function $ed43cc03b55b9961$var$originalIndexFromItemIndex(itemIndex, sizes) { + if (!$ed43cc03b55b9961$var$hasGroups(sizes)) return itemIndex; + let groupOffset = 0; + while(sizes.groupIndices[groupOffset] <= itemIndex + groupOffset)groupOffset++; + return itemIndex + groupOffset; +} +function $ed43cc03b55b9961$var$hasGroups(sizes) { + return !$ed43cc03b55b9961$var$empty(sizes.groupOffsetTree); +} +function $ed43cc03b55b9961$var$sizeTreeToRanges(sizeTree) { + return $ed43cc03b55b9961$var$walk(sizeTree).map(({ k: startIndex, v: size }, index, sizeArray)=>{ + const nextSize = sizeArray[index + 1]; + const endIndex = nextSize ? nextSize.k - 1 : Infinity; + return { + startIndex: startIndex, + endIndex: endIndex, + size: size + }; + }); +} +const $ed43cc03b55b9961$var$SIZE_MAP = { + offsetHeight: "height", + offsetWidth: "width" +}; +const $ed43cc03b55b9961$var$sizeSystem = $ed43cc03b55b9961$var$system(([{ log: log }, { recalcInProgress: recalcInProgress }])=>{ + const sizeRanges = $ed43cc03b55b9961$var$stream(); + const totalCount = $ed43cc03b55b9961$var$stream(); + const statefulTotalCount = $ed43cc03b55b9961$var$statefulStreamFromEmitter(totalCount, 0); + const unshiftWith = $ed43cc03b55b9961$var$stream(); + const shiftWith = $ed43cc03b55b9961$var$stream(); + const firstItemIndex = $ed43cc03b55b9961$var$statefulStream(0); + const groupIndices = $ed43cc03b55b9961$var$statefulStream([]); + const fixedItemSize = $ed43cc03b55b9961$var$statefulStream(void 0); + const defaultItemSize = $ed43cc03b55b9961$var$statefulStream(void 0); + const itemSize = $ed43cc03b55b9961$var$statefulStream((el, field)=>$ed43cc03b55b9961$var$correctItemSize(el, $ed43cc03b55b9961$var$SIZE_MAP[field])); + const data = $ed43cc03b55b9961$var$statefulStream(void 0); + const gap = $ed43cc03b55b9961$var$statefulStream(0); + const initial = $ed43cc03b55b9961$var$initialSizeState(); + const sizes = $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe(sizeRanges, $ed43cc03b55b9961$var$withLatestFrom(groupIndices, log, gap), $ed43cc03b55b9961$var$scan($ed43cc03b55b9961$var$sizeStateReducer, initial), $ed43cc03b55b9961$var$distinctUntilChanged()), initial); + const prevGroupIndices = $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe(groupIndices, $ed43cc03b55b9961$var$distinctUntilChanged(), $ed43cc03b55b9961$var$scan((prev, curr)=>({ + prev: prev.current, + current: curr + }), { + prev: [], + current: [] + }), $ed43cc03b55b9961$var$map(({ prev: prev })=>prev)), []); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(groupIndices, $ed43cc03b55b9961$var$filter((indexes)=>indexes.length > 0), $ed43cc03b55b9961$var$withLatestFrom(sizes, gap), $ed43cc03b55b9961$var$map(([groupIndices2, sizes2, gap2])=>{ + const groupOffsetTree = groupIndices2.reduce((tree, index, idx)=>{ + return $ed43cc03b55b9961$var$insert(tree, index, $ed43cc03b55b9961$var$offsetOf(index, sizes2.offsetTree, gap2) || idx); + }, $ed43cc03b55b9961$var$newTree()); + return { + ...sizes2, + groupIndices: groupIndices2, + groupOffsetTree: groupOffsetTree + }; + })), sizes); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(totalCount, $ed43cc03b55b9961$var$withLatestFrom(sizes), $ed43cc03b55b9961$var$filter(([totalCount2, { lastIndex: lastIndex }])=>{ + return totalCount2 < lastIndex; + }), $ed43cc03b55b9961$var$map(([totalCount2, { lastIndex: lastIndex, lastSize: lastSize }])=>{ + return [ + { + startIndex: totalCount2, + endIndex: lastIndex, + size: lastSize + } + ]; + })), sizeRanges); + $ed43cc03b55b9961$var$connect(fixedItemSize, defaultItemSize); + const trackItemSizes = $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe(fixedItemSize, $ed43cc03b55b9961$var$map((size)=>size === void 0)), true); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(defaultItemSize, $ed43cc03b55b9961$var$filter((value)=>{ + return value !== void 0 && $ed43cc03b55b9961$var$empty($ed43cc03b55b9961$var$getValue(sizes).sizeTree); + }), $ed43cc03b55b9961$var$map((size)=>[ + { + startIndex: 0, + endIndex: 0, + size: size + } + ])), sizeRanges); + const listRefresh = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe(sizeRanges, $ed43cc03b55b9961$var$withLatestFrom(sizes), $ed43cc03b55b9961$var$scan(({ sizes: oldSizes }, [_, newSizes])=>{ + return { + changed: newSizes !== oldSizes, + sizes: newSizes + }; + }, { + changed: false, + sizes: initial + }), $ed43cc03b55b9961$var$map((value)=>value.changed))); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe(firstItemIndex, $ed43cc03b55b9961$var$scan((prev, next)=>{ + return { + diff: prev.prev - next, + prev: next + }; + }, { + diff: 0, + prev: 0 + }), $ed43cc03b55b9961$var$map((val)=>val.diff)), (offset)=>{ + const { groupIndices: groupIndices2 } = $ed43cc03b55b9961$var$getValue(sizes); + if (offset > 0) { + $ed43cc03b55b9961$var$publish(recalcInProgress, true); + $ed43cc03b55b9961$var$publish(unshiftWith, offset + $ed43cc03b55b9961$var$affectedGroupCount(offset, groupIndices2)); + } else if (offset < 0) { + const prevGroupIndicesValue = $ed43cc03b55b9961$var$getValue(prevGroupIndices); + if (prevGroupIndicesValue.length > 0) offset -= $ed43cc03b55b9961$var$affectedGroupCount(-offset, prevGroupIndicesValue); + $ed43cc03b55b9961$var$publish(shiftWith, offset); + } + }); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe(firstItemIndex, $ed43cc03b55b9961$var$withLatestFrom(log)), ([index, log2])=>{ + if (index < 0) log2("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value", { + firstItemIndex: firstItemIndex + }, $ed43cc03b55b9961$export$243e62d78d3b544d.ERROR); + }); + const beforeUnshiftWith = $ed43cc03b55b9961$var$streamFromEmitter(unshiftWith); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(unshiftWith, $ed43cc03b55b9961$var$withLatestFrom(sizes), $ed43cc03b55b9961$var$map(([unshiftWith2, sizes2])=>{ + const groupedMode = sizes2.groupIndices.length > 0; + const initialRanges = []; + const defaultSize = sizes2.lastSize; + if (groupedMode) { + const firstGroupSize = $ed43cc03b55b9961$var$find(sizes2.sizeTree, 0); + let prependedGroupItemsCount = 0; + let groupIndex = 0; + while(prependedGroupItemsCount < unshiftWith2){ + const theGroupIndex = sizes2.groupIndices[groupIndex]; + const groupItemCount = sizes2.groupIndices.length === groupIndex + 1 ? Infinity : sizes2.groupIndices[groupIndex + 1] - theGroupIndex - 1; + initialRanges.push({ + startIndex: theGroupIndex, + endIndex: theGroupIndex, + size: firstGroupSize + }); + initialRanges.push({ + startIndex: theGroupIndex + 1, + endIndex: theGroupIndex + 1 + groupItemCount - 1, + size: defaultSize + }); + groupIndex++; + prependedGroupItemsCount += groupItemCount + 1; + } + const sizeTreeKV = $ed43cc03b55b9961$var$walk(sizes2.sizeTree); + const firstGroupIsExpanded = prependedGroupItemsCount !== unshiftWith2; + if (firstGroupIsExpanded) sizeTreeKV.shift(); + return sizeTreeKV.reduce((acc, { k: index, v: size })=>{ + let ranges = acc.ranges; + if (acc.prevSize !== 0) ranges = [ + ...acc.ranges, + { + startIndex: acc.prevIndex, + endIndex: index + unshiftWith2 - 1, + size: acc.prevSize + } + ]; + return { + ranges: ranges, + prevIndex: index + unshiftWith2, + prevSize: size + }; + }, { + ranges: initialRanges, + prevIndex: unshiftWith2, + prevSize: 0 + }).ranges; + } + return $ed43cc03b55b9961$var$walk(sizes2.sizeTree).reduce((acc, { k: index, v: size })=>{ + return { + ranges: [ + ...acc.ranges, + { + startIndex: acc.prevIndex, + endIndex: index + unshiftWith2 - 1, + size: acc.prevSize + } + ], + prevIndex: index + unshiftWith2, + prevSize: size + }; + }, { + ranges: [], + prevIndex: 0, + prevSize: defaultSize + }).ranges; + })), sizeRanges); + const shiftWithOffset = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe(shiftWith, $ed43cc03b55b9961$var$withLatestFrom(sizes, gap), $ed43cc03b55b9961$var$map(([shiftWith2, { offsetTree: offsetTree }, gap2])=>{ + const newFirstItemIndex = -shiftWith2; + return $ed43cc03b55b9961$var$offsetOf(newFirstItemIndex, offsetTree, gap2); + }))); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(shiftWith, $ed43cc03b55b9961$var$withLatestFrom(sizes, gap), $ed43cc03b55b9961$var$map(([shiftWith2, sizes2, gap2])=>{ + const groupedMode = sizes2.groupIndices.length > 0; + if (groupedMode) { + if ($ed43cc03b55b9961$var$empty(sizes2.sizeTree)) return sizes2; + let newSizeTree = $ed43cc03b55b9961$var$newTree(); + const prevGroupIndicesValue = $ed43cc03b55b9961$var$getValue(prevGroupIndices); + let removedItemsCount = 0; + let groupIndex = 0; + let groupOffset = 0; + while(removedItemsCount < -shiftWith2){ + groupOffset = prevGroupIndicesValue[groupIndex]; + const groupItemCount = prevGroupIndicesValue[groupIndex + 1] - groupOffset - 1; + groupIndex++; + removedItemsCount += groupItemCount + 1; + } + newSizeTree = $ed43cc03b55b9961$var$walk(sizes2.sizeTree).reduce((acc, { k: k, v: v })=>{ + return $ed43cc03b55b9961$var$insert(acc, Math.max(0, k + shiftWith2), v); + }, newSizeTree); + const aGroupIsShrunk = removedItemsCount !== -shiftWith2; + if (aGroupIsShrunk) { + const firstGroupSize = $ed43cc03b55b9961$var$find(sizes2.sizeTree, groupOffset); + newSizeTree = $ed43cc03b55b9961$var$insert(newSizeTree, 0, firstGroupSize); + const nextItemSize = $ed43cc03b55b9961$var$findMaxKeyValue(sizes2.sizeTree, -shiftWith2 + 1)[1]; + newSizeTree = $ed43cc03b55b9961$var$insert(newSizeTree, 1, nextItemSize); + } + return { + ...sizes2, + sizeTree: newSizeTree, + ...$ed43cc03b55b9961$var$createOffsetTree(sizes2.offsetTree, 0, newSizeTree, gap2) + }; + } else { + const newSizeTree = $ed43cc03b55b9961$var$walk(sizes2.sizeTree).reduce((acc, { k: k, v: v })=>{ + return $ed43cc03b55b9961$var$insert(acc, Math.max(0, k + shiftWith2), v); + }, $ed43cc03b55b9961$var$newTree()); + return { + ...sizes2, + sizeTree: newSizeTree, + ...$ed43cc03b55b9961$var$createOffsetTree(sizes2.offsetTree, 0, newSizeTree, gap2) + }; + } + })), sizes); + return { + data: // input + data, + totalCount: totalCount, + sizeRanges: sizeRanges, + groupIndices: groupIndices, + defaultItemSize: defaultItemSize, + fixedItemSize: fixedItemSize, + unshiftWith: unshiftWith, + shiftWith: shiftWith, + shiftWithOffset: shiftWithOffset, + beforeUnshiftWith: beforeUnshiftWith, + firstItemIndex: firstItemIndex, + gap: gap, + sizes: // output + sizes, + listRefresh: listRefresh, + statefulTotalCount: statefulTotalCount, + trackItemSizes: trackItemSizes, + itemSize: itemSize + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$loggerSystem, $ed43cc03b55b9961$var$recalcSystem), { + singleton: true +}); +const $ed43cc03b55b9961$var$SUPPORTS_SCROLL_TO_OPTIONS = typeof document !== "undefined" && "scrollBehavior" in document.documentElement.style; +function $ed43cc03b55b9961$var$normalizeIndexLocation(location) { + const result = typeof location === "number" ? { + index: location + } : location; + if (!result.align) result.align = "start"; + if (!result.behavior || !$ed43cc03b55b9961$var$SUPPORTS_SCROLL_TO_OPTIONS) result.behavior = "auto"; + if (!result.offset) result.offset = 0; + return result; +} +const $ed43cc03b55b9961$var$scrollToIndexSystem = $ed43cc03b55b9961$var$system(([{ sizes: sizes, totalCount: totalCount, listRefresh: listRefresh, gap: gap }, { scrollingInProgress: scrollingInProgress, viewportHeight: viewportHeight, scrollTo: scrollTo, smoothScrollTargetReached: smoothScrollTargetReached, headerHeight: headerHeight, footerHeight: footerHeight, fixedHeaderHeight: fixedHeaderHeight, fixedFooterHeight: fixedFooterHeight }, { log: log }])=>{ + const scrollToIndex = $ed43cc03b55b9961$var$stream(); + const topListHeight = $ed43cc03b55b9961$var$statefulStream(0); + let unsubscribeNextListRefresh = null; + let cleartTimeoutRef = null; + let unsubscribeListRefresh = null; + function cleanup() { + if (unsubscribeNextListRefresh) { + unsubscribeNextListRefresh(); + unsubscribeNextListRefresh = null; + } + if (unsubscribeListRefresh) { + unsubscribeListRefresh(); + unsubscribeListRefresh = null; + } + if (cleartTimeoutRef) { + clearTimeout(cleartTimeoutRef); + cleartTimeoutRef = null; + } + $ed43cc03b55b9961$var$publish(scrollingInProgress, false); + } + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(scrollToIndex, $ed43cc03b55b9961$var$withLatestFrom(sizes, viewportHeight, totalCount, topListHeight, headerHeight, footerHeight, log), $ed43cc03b55b9961$var$withLatestFrom(gap, fixedHeaderHeight, fixedFooterHeight), $ed43cc03b55b9961$var$map(([[location, sizes2, viewportHeight2, totalCount2, topListHeight2, headerHeight2, footerHeight2, log2], gap2, fixedHeaderHeight2, fixedFooterHeight2])=>{ + const normalLocation = $ed43cc03b55b9961$var$normalizeIndexLocation(location); + const { align: align, behavior: behavior, offset: offset } = normalLocation; + const lastIndex = totalCount2 - 1; + const index = $ed43cc03b55b9961$var$originalIndexFromLocation(normalLocation, sizes2, lastIndex); + let top = $ed43cc03b55b9961$var$offsetOf(index, sizes2.offsetTree, gap2) + headerHeight2; + if (align === "end") { + top += fixedHeaderHeight2 + $ed43cc03b55b9961$var$findMaxKeyValue(sizes2.sizeTree, index)[1] - viewportHeight2 + fixedFooterHeight2; + if (index === lastIndex) top += footerHeight2; + } else if (align === "center") top += (fixedHeaderHeight2 + $ed43cc03b55b9961$var$findMaxKeyValue(sizes2.sizeTree, index)[1] - viewportHeight2 + fixedFooterHeight2) / 2; + else top -= topListHeight2; + if (offset) top += offset; + const retry = (listChanged)=>{ + cleanup(); + if (listChanged) { + log2("retrying to scroll to", { + location: location + }, $ed43cc03b55b9961$export$243e62d78d3b544d.DEBUG); + $ed43cc03b55b9961$var$publish(scrollToIndex, location); + } else log2("list did not change, scroll successful", {}, $ed43cc03b55b9961$export$243e62d78d3b544d.DEBUG); + }; + cleanup(); + if (behavior === "smooth") { + let listChanged = false; + unsubscribeListRefresh = $ed43cc03b55b9961$var$subscribe(listRefresh, (changed)=>{ + listChanged = listChanged || changed; + }); + unsubscribeNextListRefresh = $ed43cc03b55b9961$var$handleNext(smoothScrollTargetReached, ()=>{ + retry(listChanged); + }); + } else unsubscribeNextListRefresh = $ed43cc03b55b9961$var$handleNext($ed43cc03b55b9961$var$pipe(listRefresh, $ed43cc03b55b9961$var$watchChangesFor(150)), retry); + cleartTimeoutRef = setTimeout(()=>{ + cleanup(); + }, 1200); + $ed43cc03b55b9961$var$publish(scrollingInProgress, true); + log2("scrolling from index to", { + index: index, + top: top, + behavior: behavior + }, $ed43cc03b55b9961$export$243e62d78d3b544d.DEBUG); + return { + top: top, + behavior: behavior + }; + })), scrollTo); + return { + scrollToIndex: scrollToIndex, + topListHeight: topListHeight + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$sizeSystem, $ed43cc03b55b9961$var$domIOSystem, $ed43cc03b55b9961$var$loggerSystem), { + singleton: true +}); +function $ed43cc03b55b9961$var$watchChangesFor(limit) { + return (done)=>{ + const timeoutRef = setTimeout(()=>{ + done(false); + }, limit); + return (value)=>{ + if (value) { + done(true); + clearTimeout(timeoutRef); + } + }; + }; +} +const $ed43cc03b55b9961$var$UP = "up"; +const $ed43cc03b55b9961$var$DOWN = "down"; +const $ed43cc03b55b9961$var$NONE$1 = "none"; +const $ed43cc03b55b9961$var$INITIAL_BOTTOM_STATE = { + atBottom: false, + notAtBottomBecause: "NOT_SHOWING_LAST_ITEM", + state: { + offsetBottom: 0, + scrollTop: 0, + viewportHeight: 0, + scrollHeight: 0 + } +}; +const $ed43cc03b55b9961$var$DEFAULT_AT_TOP_THRESHOLD = 0; +const $ed43cc03b55b9961$var$stateFlagsSystem = $ed43cc03b55b9961$var$system(([{ scrollContainerState: scrollContainerState, scrollTop: scrollTop, viewportHeight: viewportHeight, headerHeight: headerHeight, footerHeight: footerHeight, scrollBy: scrollBy }])=>{ + const isAtBottom = $ed43cc03b55b9961$var$statefulStream(false); + const isAtTop = $ed43cc03b55b9961$var$statefulStream(true); + const atBottomStateChange = $ed43cc03b55b9961$var$stream(); + const atTopStateChange = $ed43cc03b55b9961$var$stream(); + const atBottomThreshold = $ed43cc03b55b9961$var$statefulStream(4); + const atTopThreshold = $ed43cc03b55b9961$var$statefulStream($ed43cc03b55b9961$var$DEFAULT_AT_TOP_THRESHOLD); + const isScrolling = $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$merge($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$duc(scrollTop), $ed43cc03b55b9961$var$skip(1), $ed43cc03b55b9961$var$mapTo(true)), $ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$duc(scrollTop), $ed43cc03b55b9961$var$skip(1), $ed43cc03b55b9961$var$mapTo(false), $ed43cc03b55b9961$var$debounceTime(100))), $ed43cc03b55b9961$var$distinctUntilChanged()), false); + const isScrollingBy = $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$merge($ed43cc03b55b9961$var$pipe(scrollBy, $ed43cc03b55b9961$var$mapTo(true)), $ed43cc03b55b9961$var$pipe(scrollBy, $ed43cc03b55b9961$var$mapTo(false), $ed43cc03b55b9961$var$debounceTime(200))), $ed43cc03b55b9961$var$distinctUntilChanged()), false); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest($ed43cc03b55b9961$var$duc(scrollTop), $ed43cc03b55b9961$var$duc(atTopThreshold)), $ed43cc03b55b9961$var$map(([top, atTopThreshold2])=>top <= atTopThreshold2), $ed43cc03b55b9961$var$distinctUntilChanged()), isAtTop); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(isAtTop, $ed43cc03b55b9961$var$throttleTime(50)), atTopStateChange); + const atBottomState = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest(scrollContainerState, $ed43cc03b55b9961$var$duc(viewportHeight), $ed43cc03b55b9961$var$duc(headerHeight), $ed43cc03b55b9961$var$duc(footerHeight), $ed43cc03b55b9961$var$duc(atBottomThreshold)), $ed43cc03b55b9961$var$scan((current, [{ scrollTop: scrollTop2, scrollHeight: scrollHeight }, viewportHeight2, _headerHeight, _footerHeight, atBottomThreshold2])=>{ + const isAtBottom2 = scrollTop2 + viewportHeight2 - scrollHeight > -atBottomThreshold2; + const state = { + viewportHeight: viewportHeight2, + scrollTop: scrollTop2, + scrollHeight: scrollHeight + }; + if (isAtBottom2) { + let atBottomBecause; + let scrollTopDelta; + if (scrollTop2 > current.state.scrollTop) { + atBottomBecause = "SCROLLED_DOWN"; + scrollTopDelta = current.state.scrollTop - scrollTop2; + } else { + atBottomBecause = "SIZE_DECREASED"; + scrollTopDelta = current.state.scrollTop - scrollTop2 || current.scrollTopDelta; + } + return { + atBottom: true, + state: state, + atBottomBecause: atBottomBecause, + scrollTopDelta: scrollTopDelta + }; + } + let notAtBottomBecause; + if (state.scrollHeight > current.state.scrollHeight) notAtBottomBecause = "SIZE_INCREASED"; + else if (viewportHeight2 < current.state.viewportHeight) notAtBottomBecause = "VIEWPORT_HEIGHT_DECREASING"; + else if (scrollTop2 < current.state.scrollTop) notAtBottomBecause = "SCROLLING_UPWARDS"; + else notAtBottomBecause = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM"; + return { + atBottom: false, + notAtBottomBecause: notAtBottomBecause, + state: state + }; + }, $ed43cc03b55b9961$var$INITIAL_BOTTOM_STATE), $ed43cc03b55b9961$var$distinctUntilChanged((prev, next)=>{ + return prev && prev.atBottom === next.atBottom; + }))); + const lastJumpDueToItemResize = $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe(scrollContainerState, $ed43cc03b55b9961$var$scan((current, { scrollTop: scrollTop2, scrollHeight: scrollHeight, viewportHeight: viewportHeight2 })=>{ + if (!$ed43cc03b55b9961$var$approximatelyEqual(current.scrollHeight, scrollHeight)) { + const atBottom = scrollHeight - (scrollTop2 + viewportHeight2) < 1; + if (current.scrollTop !== scrollTop2 && atBottom) return { + scrollHeight: scrollHeight, + scrollTop: scrollTop2, + jump: current.scrollTop - scrollTop2, + changed: true + }; + else return { + scrollHeight: scrollHeight, + scrollTop: scrollTop2, + jump: 0, + changed: true + }; + } else return { + scrollTop: scrollTop2, + scrollHeight: scrollHeight, + jump: 0, + changed: false + }; + }, { + scrollHeight: 0, + jump: 0, + scrollTop: 0, + changed: false + }), $ed43cc03b55b9961$var$filter((value)=>value.changed), $ed43cc03b55b9961$var$map((value)=>value.jump)), 0); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(atBottomState, $ed43cc03b55b9961$var$map((state)=>state.atBottom)), isAtBottom); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(isAtBottom, $ed43cc03b55b9961$var$throttleTime(50)), atBottomStateChange); + const scrollDirection = $ed43cc03b55b9961$var$statefulStream($ed43cc03b55b9961$var$DOWN); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(scrollContainerState, $ed43cc03b55b9961$var$map(({ scrollTop: scrollTop2 })=>scrollTop2), $ed43cc03b55b9961$var$distinctUntilChanged(), $ed43cc03b55b9961$var$scan((acc, scrollTop2)=>{ + if ($ed43cc03b55b9961$var$getValue(isScrollingBy)) return { + direction: acc.direction, + prevScrollTop: scrollTop2 + }; + return { + direction: scrollTop2 < acc.prevScrollTop ? $ed43cc03b55b9961$var$UP : $ed43cc03b55b9961$var$DOWN, + prevScrollTop: scrollTop2 + }; + }, { + direction: $ed43cc03b55b9961$var$DOWN, + prevScrollTop: 0 + }), $ed43cc03b55b9961$var$map((value)=>value.direction)), scrollDirection); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(scrollContainerState, $ed43cc03b55b9961$var$throttleTime(50), $ed43cc03b55b9961$var$mapTo($ed43cc03b55b9961$var$NONE$1)), scrollDirection); + const scrollVelocity = $ed43cc03b55b9961$var$statefulStream(0); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(isScrolling, $ed43cc03b55b9961$var$filter((value)=>!value), // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + $ed43cc03b55b9961$var$mapTo(0)), scrollVelocity); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(scrollTop, $ed43cc03b55b9961$var$throttleTime(100), $ed43cc03b55b9961$var$withLatestFrom(isScrolling), $ed43cc03b55b9961$var$filter(([_, isScrolling2])=>!!isScrolling2), $ed43cc03b55b9961$var$scan(([_, prev], [next])=>[ + prev, + next + ], [ + 0, + 0 + ]), $ed43cc03b55b9961$var$map(([prev, next])=>next - prev)), scrollVelocity); + return { + isScrolling: isScrolling, + isAtTop: isAtTop, + isAtBottom: isAtBottom, + atBottomState: atBottomState, + atTopStateChange: atTopStateChange, + atBottomStateChange: atBottomStateChange, + scrollDirection: scrollDirection, + atBottomThreshold: atBottomThreshold, + atTopThreshold: atTopThreshold, + scrollVelocity: scrollVelocity, + lastJumpDueToItemResize: lastJumpDueToItemResize + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$domIOSystem)); +const $ed43cc03b55b9961$var$propsReadySystem = $ed43cc03b55b9961$var$system(([{ log: log }])=>{ + const propsReady = $ed43cc03b55b9961$var$statefulStream(false); + const didMount = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe(propsReady, $ed43cc03b55b9961$var$filter((ready)=>ready), $ed43cc03b55b9961$var$distinctUntilChanged())); + $ed43cc03b55b9961$var$subscribe(propsReady, (value)=>{ + value && $ed43cc03b55b9961$var$getValue(log)("props updated", {}, $ed43cc03b55b9961$export$243e62d78d3b544d.DEBUG); + }); + return { + propsReady: propsReady, + didMount: didMount + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$loggerSystem), { + singleton: true +}); +function $ed43cc03b55b9961$var$skipFrames(frameCount, callback) { + if (frameCount == 0) callback(); + else requestAnimationFrame(()=>$ed43cc03b55b9961$var$skipFrames(frameCount - 1, callback)); +} +function $ed43cc03b55b9961$var$getInitialTopMostItemIndexNumber(location, totalCount) { + const lastIndex = totalCount - 1; + const index = typeof location === "number" ? location : location.index === "LAST" ? lastIndex : location.index; + return index; +} +const $ed43cc03b55b9961$var$initialTopMostItemIndexSystem = $ed43cc03b55b9961$var$system(([{ sizes: sizes, listRefresh: listRefresh, defaultItemSize: defaultItemSize }, { scrollTop: scrollTop }, { scrollToIndex: scrollToIndex }, { didMount: didMount }])=>{ + const scrolledToInitialItem = $ed43cc03b55b9961$var$statefulStream(true); + const initialTopMostItemIndex = $ed43cc03b55b9961$var$statefulStream(0); + const scrollScheduled = $ed43cc03b55b9961$var$statefulStream(false); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(didMount, $ed43cc03b55b9961$var$withLatestFrom(initialTopMostItemIndex), $ed43cc03b55b9961$var$filter(([_, location])=>!!location), $ed43cc03b55b9961$var$mapTo(false)), scrolledToInitialItem); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest(listRefresh, didMount), $ed43cc03b55b9961$var$withLatestFrom(scrolledToInitialItem, sizes, defaultItemSize, scrollScheduled), $ed43cc03b55b9961$var$filter(([[, didMount2], scrolledToInitialItem2, { sizeTree: sizeTree }, defaultItemSize2, scrollScheduled2])=>{ + return didMount2 && (!$ed43cc03b55b9961$var$empty(sizeTree) || $ed43cc03b55b9961$var$isDefined(defaultItemSize2)) && !scrolledToInitialItem2 && !scrollScheduled2; + }), $ed43cc03b55b9961$var$withLatestFrom(initialTopMostItemIndex)), ([, initialTopMostItemIndex2])=>{ + $ed43cc03b55b9961$var$publish(scrollScheduled, true); + $ed43cc03b55b9961$var$skipFrames(3, ()=>{ + $ed43cc03b55b9961$var$handleNext(scrollTop, ()=>$ed43cc03b55b9961$var$publish(scrolledToInitialItem, true)); + $ed43cc03b55b9961$var$publish(scrollToIndex, initialTopMostItemIndex2); + }); + }); + return { + scrolledToInitialItem: scrolledToInitialItem, + initialTopMostItemIndex: initialTopMostItemIndex + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$sizeSystem, $ed43cc03b55b9961$var$domIOSystem, $ed43cc03b55b9961$var$scrollToIndexSystem, $ed43cc03b55b9961$var$propsReadySystem), { + singleton: true +}); +function $ed43cc03b55b9961$var$normalizeFollowOutput(follow) { + if (!follow) return false; + return follow === "smooth" ? "smooth" : "auto"; +} +const $ed43cc03b55b9961$var$behaviorFromFollowOutput = (follow, isAtBottom)=>{ + if (typeof follow === "function") return $ed43cc03b55b9961$var$normalizeFollowOutput(follow(isAtBottom)); + return isAtBottom && $ed43cc03b55b9961$var$normalizeFollowOutput(follow); +}; +const $ed43cc03b55b9961$var$followOutputSystem = $ed43cc03b55b9961$var$system(([{ totalCount: totalCount, listRefresh: listRefresh }, { isAtBottom: isAtBottom, atBottomState: atBottomState }, { scrollToIndex: scrollToIndex }, { scrolledToInitialItem: scrolledToInitialItem }, { propsReady: propsReady, didMount: didMount }, { log: log }, { scrollingInProgress: scrollingInProgress }])=>{ + const followOutput = $ed43cc03b55b9961$var$statefulStream(false); + const autoscrollToBottom = $ed43cc03b55b9961$var$stream(); + let pendingScrollHandle = null; + function scrollToBottom(followOutputBehavior) { + $ed43cc03b55b9961$var$publish(scrollToIndex, { + index: "LAST", + align: "end", + behavior: followOutputBehavior + }); + } + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$duc(totalCount), $ed43cc03b55b9961$var$skip(1)), didMount), $ed43cc03b55b9961$var$withLatestFrom($ed43cc03b55b9961$var$duc(followOutput), isAtBottom, scrolledToInitialItem, scrollingInProgress), $ed43cc03b55b9961$var$map(([[totalCount2, didMount2], followOutput2, isAtBottom2, scrolledToInitialItem2, scrollingInProgress2])=>{ + let shouldFollow = didMount2 && scrolledToInitialItem2; + let followOutputBehavior = "auto"; + if (shouldFollow) { + followOutputBehavior = $ed43cc03b55b9961$var$behaviorFromFollowOutput(followOutput2, isAtBottom2 || scrollingInProgress2); + shouldFollow = shouldFollow && !!followOutputBehavior; + } + return { + totalCount: totalCount2, + shouldFollow: shouldFollow, + followOutputBehavior: followOutputBehavior + }; + }), $ed43cc03b55b9961$var$filter(({ shouldFollow: shouldFollow })=>shouldFollow)), ({ totalCount: totalCount2, followOutputBehavior: followOutputBehavior })=>{ + if (pendingScrollHandle) { + pendingScrollHandle(); + pendingScrollHandle = null; + } + pendingScrollHandle = $ed43cc03b55b9961$var$handleNext(listRefresh, ()=>{ + $ed43cc03b55b9961$var$getValue(log)("following output to ", { + totalCount: totalCount2 + }, $ed43cc03b55b9961$export$243e62d78d3b544d.DEBUG); + scrollToBottom(followOutputBehavior); + pendingScrollHandle = null; + }); + }); + function trapNextSizeIncrease(followOutput2) { + const cancel = $ed43cc03b55b9961$var$handleNext(atBottomState, (state)=>{ + if (followOutput2 && !state.atBottom && state.notAtBottomBecause === "SIZE_INCREASED" && !pendingScrollHandle) { + $ed43cc03b55b9961$var$getValue(log)("scrolling to bottom due to increased size", {}, $ed43cc03b55b9961$export$243e62d78d3b544d.DEBUG); + scrollToBottom("auto"); + } + }); + setTimeout(cancel, 100); + } + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest($ed43cc03b55b9961$var$duc(followOutput), totalCount, propsReady), $ed43cc03b55b9961$var$filter(([follow, , ready])=>follow && ready), $ed43cc03b55b9961$var$scan(({ value: value }, [, next])=>{ + return { + refreshed: value === next, + value: next + }; + }, { + refreshed: false, + value: 0 + }), $ed43cc03b55b9961$var$filter(({ refreshed: refreshed })=>refreshed), $ed43cc03b55b9961$var$withLatestFrom(followOutput, totalCount)), ([, followOutput2])=>{ + trapNextSizeIncrease(followOutput2 !== false); + }); + $ed43cc03b55b9961$var$subscribe(autoscrollToBottom, ()=>{ + trapNextSizeIncrease($ed43cc03b55b9961$var$getValue(followOutput) !== false); + }); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$combineLatest($ed43cc03b55b9961$var$duc(followOutput), atBottomState), ([followOutput2, state])=>{ + if (followOutput2 && !state.atBottom && state.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING") scrollToBottom("auto"); + }); + return { + followOutput: followOutput, + autoscrollToBottom: autoscrollToBottom + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$sizeSystem, $ed43cc03b55b9961$var$stateFlagsSystem, $ed43cc03b55b9961$var$scrollToIndexSystem, $ed43cc03b55b9961$var$initialTopMostItemIndexSystem, $ed43cc03b55b9961$var$propsReadySystem, $ed43cc03b55b9961$var$loggerSystem, $ed43cc03b55b9961$var$domIOSystem)); +function $ed43cc03b55b9961$var$groupCountsToIndicesAndCount(counts) { + return counts.reduce((acc, groupCount)=>{ + acc.groupIndices.push(acc.totalCount); + acc.totalCount += groupCount + 1; + return acc; + }, { + totalCount: 0, + groupIndices: [] + }); +} +const $ed43cc03b55b9961$var$groupedListSystem = $ed43cc03b55b9961$var$system(([{ totalCount: totalCount, groupIndices: groupIndices, sizes: sizes }, { scrollTop: scrollTop, headerHeight: headerHeight }])=>{ + const groupCounts = $ed43cc03b55b9961$var$stream(); + const topItemsIndexes = $ed43cc03b55b9961$var$stream(); + const groupIndicesAndCount = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe(groupCounts, $ed43cc03b55b9961$var$map($ed43cc03b55b9961$var$groupCountsToIndicesAndCount))); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(groupIndicesAndCount, $ed43cc03b55b9961$var$map((value)=>value.totalCount)), totalCount); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(groupIndicesAndCount, $ed43cc03b55b9961$var$map((value)=>value.groupIndices)), groupIndices); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest(scrollTop, sizes, headerHeight), $ed43cc03b55b9961$var$filter(([_, sizes2])=>$ed43cc03b55b9961$var$hasGroups(sizes2)), $ed43cc03b55b9961$var$map(([scrollTop2, state, headerHeight2])=>$ed43cc03b55b9961$var$findMaxKeyValue(state.groupOffsetTree, Math.max(scrollTop2 - headerHeight2, 0), "v")[0]), $ed43cc03b55b9961$var$distinctUntilChanged(), $ed43cc03b55b9961$var$map((index)=>[ + index + ])), topItemsIndexes); + return { + groupCounts: groupCounts, + topItemsIndexes: topItemsIndexes + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$sizeSystem, $ed43cc03b55b9961$var$domIOSystem)); +function $ed43cc03b55b9961$var$tupleComparator(prev, current) { + return !!(prev && prev[0] === current[0] && prev[1] === current[1]); +} +function $ed43cc03b55b9961$var$rangeComparator(prev, next) { + return !!(prev && prev.startIndex === next.startIndex && prev.endIndex === next.endIndex); +} +const $ed43cc03b55b9961$var$TOP = "top"; +const $ed43cc03b55b9961$var$BOTTOM = "bottom"; +const $ed43cc03b55b9961$var$NONE = "none"; +function $ed43cc03b55b9961$var$getOverscan(overscan, end, direction) { + if (typeof overscan === "number") return direction === $ed43cc03b55b9961$var$UP && end === $ed43cc03b55b9961$var$TOP || direction === $ed43cc03b55b9961$var$DOWN && end === $ed43cc03b55b9961$var$BOTTOM ? overscan : 0; + else { + if (direction === $ed43cc03b55b9961$var$UP) return end === $ed43cc03b55b9961$var$TOP ? overscan.main : overscan.reverse; + else return end === $ed43cc03b55b9961$var$BOTTOM ? overscan.main : overscan.reverse; + } +} +function $ed43cc03b55b9961$var$getViewportIncrease(value, end) { + return typeof value === "number" ? value : value[end] || 0; +} +const $ed43cc03b55b9961$var$sizeRangeSystem = $ed43cc03b55b9961$var$system(([{ scrollTop: scrollTop, viewportHeight: viewportHeight, deviation: deviation, headerHeight: headerHeight, fixedHeaderHeight: fixedHeaderHeight }])=>{ + const listBoundary = $ed43cc03b55b9961$var$stream(); + const topListHeight = $ed43cc03b55b9961$var$statefulStream(0); + const increaseViewportBy = $ed43cc03b55b9961$var$statefulStream(0); + const overscan = $ed43cc03b55b9961$var$statefulStream(0); + const visibleRange = $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest($ed43cc03b55b9961$var$duc(scrollTop), $ed43cc03b55b9961$var$duc(viewportHeight), $ed43cc03b55b9961$var$duc(headerHeight), $ed43cc03b55b9961$var$duc(listBoundary, $ed43cc03b55b9961$var$tupleComparator), $ed43cc03b55b9961$var$duc(overscan), $ed43cc03b55b9961$var$duc(topListHeight), $ed43cc03b55b9961$var$duc(fixedHeaderHeight), $ed43cc03b55b9961$var$duc(deviation), $ed43cc03b55b9961$var$duc(increaseViewportBy)), $ed43cc03b55b9961$var$map(([scrollTop2, viewportHeight2, headerHeight2, [listTop, listBottom], overscan2, topListHeight2, fixedHeaderHeight2, deviation2, increaseViewportBy2])=>{ + const top = scrollTop2 - deviation2; + const stickyHeaderHeight = topListHeight2 + fixedHeaderHeight2; + const headerVisible = Math.max(headerHeight2 - top, 0); + let direction = $ed43cc03b55b9961$var$NONE; + const topViewportAddition = $ed43cc03b55b9961$var$getViewportIncrease(increaseViewportBy2, $ed43cc03b55b9961$var$TOP); + const bottomViewportAddition = $ed43cc03b55b9961$var$getViewportIncrease(increaseViewportBy2, $ed43cc03b55b9961$var$BOTTOM); + listTop -= deviation2; + listTop += headerHeight2 + fixedHeaderHeight2; + listBottom += headerHeight2 + fixedHeaderHeight2; + listBottom -= deviation2; + if (listTop > scrollTop2 + stickyHeaderHeight - topViewportAddition) direction = $ed43cc03b55b9961$var$UP; + if (listBottom < scrollTop2 - headerVisible + viewportHeight2 + bottomViewportAddition) direction = $ed43cc03b55b9961$var$DOWN; + if (direction !== $ed43cc03b55b9961$var$NONE) return [ + Math.max(top - headerHeight2 - $ed43cc03b55b9961$var$getOverscan(overscan2, $ed43cc03b55b9961$var$TOP, direction) - topViewportAddition, 0), + top - headerVisible - fixedHeaderHeight2 + viewportHeight2 + $ed43cc03b55b9961$var$getOverscan(overscan2, $ed43cc03b55b9961$var$BOTTOM, direction) + bottomViewportAddition + ]; + return null; + }), $ed43cc03b55b9961$var$filter((value)=>value != null), $ed43cc03b55b9961$var$distinctUntilChanged($ed43cc03b55b9961$var$tupleComparator)), [ + 0, + 0 + ]); + return { + listBoundary: // input + listBoundary, + overscan: overscan, + topListHeight: topListHeight, + increaseViewportBy: increaseViewportBy, + visibleRange: // output + visibleRange + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$domIOSystem), { + singleton: true +}); +function $ed43cc03b55b9961$var$probeItemSet(index, sizes, data) { + if ($ed43cc03b55b9961$var$hasGroups(sizes)) { + const itemIndex = $ed43cc03b55b9961$var$originalIndexFromItemIndex(index, sizes); + const groupIndex = $ed43cc03b55b9961$var$findMaxKeyValue(sizes.groupOffsetTree, itemIndex)[0]; + return [ + { + index: groupIndex, + size: 0, + offset: 0 + }, + { + index: itemIndex, + size: 0, + offset: 0, + data: data && data[0] + } + ]; + } + return [ + { + index: index, + size: 0, + offset: 0, + data: data && data[0] + } + ]; +} +const $ed43cc03b55b9961$var$EMPTY_LIST_STATE = { + items: [], + topItems: [], + offsetTop: 0, + offsetBottom: 0, + top: 0, + bottom: 0, + topListHeight: 0, + totalCount: 0, + firstItemIndex: 0 +}; +function $ed43cc03b55b9961$var$transposeItems(items, sizes, firstItemIndex) { + if (items.length === 0) return []; + if (!$ed43cc03b55b9961$var$hasGroups(sizes)) return items.map((item)=>({ + ...item, + index: item.index + firstItemIndex, + originalIndex: item.index + })); + const startIndex = items[0].index; + const endIndex = items[items.length - 1].index; + const transposedItems = []; + const groupRanges = $ed43cc03b55b9961$var$rangesWithin(sizes.groupOffsetTree, startIndex, endIndex); + let currentRange = void 0; + let currentGroupIndex = 0; + for (const item of items){ + if (!currentRange || currentRange.end < item.index) { + currentRange = groupRanges.shift(); + currentGroupIndex = sizes.groupIndices.indexOf(currentRange.start); + } + let transposedItem; + if (item.index === currentRange.start) transposedItem = { + type: "group", + index: currentGroupIndex + }; + else transposedItem = { + index: item.index - (currentGroupIndex + 1) + firstItemIndex, + groupIndex: currentGroupIndex + }; + transposedItems.push({ + ...transposedItem, + size: item.size, + offset: item.offset, + originalIndex: item.index, + data: item.data + }); + } + return transposedItems; +} +function $ed43cc03b55b9961$var$buildListState(items, topItems, totalCount, gap, sizes, firstItemIndex) { + const { lastSize: lastSize, lastOffset: lastOffset, lastIndex: lastIndex } = sizes; + let offsetTop = 0; + let bottom = 0; + if (items.length > 0) { + offsetTop = items[0].offset; + const lastItem = items[items.length - 1]; + bottom = lastItem.offset + lastItem.size; + } + const itemCount = totalCount - lastIndex; + const total = lastOffset + itemCount * lastSize + (itemCount - 1) * gap; + const top = offsetTop; + const offsetBottom = total - bottom; + return { + items: $ed43cc03b55b9961$var$transposeItems(items, sizes, firstItemIndex), + topItems: $ed43cc03b55b9961$var$transposeItems(topItems, sizes, firstItemIndex), + topListHeight: topItems.reduce((height, item)=>item.size + height, 0), + offsetTop: offsetTop, + offsetBottom: offsetBottom, + top: top, + bottom: bottom, + totalCount: totalCount, + firstItemIndex: firstItemIndex + }; +} +function $ed43cc03b55b9961$var$buildListStateFromItemCount(itemCount, initialTopMostItemIndex, sizes, firstItemIndex, gap, data) { + let includedGroupsCount = 0; + if (sizes.groupIndices.length > 0) for (const index of sizes.groupIndices){ + if (index - includedGroupsCount >= itemCount) break; + includedGroupsCount++; + } + const adjustedCount = itemCount + includedGroupsCount; + const initialTopMostItemIndexNumber = $ed43cc03b55b9961$var$getInitialTopMostItemIndexNumber(initialTopMostItemIndex, adjustedCount); + const items = Array.from({ + length: adjustedCount + }).map((_, index)=>({ + index: index + initialTopMostItemIndexNumber, + size: 0, + offset: 0, + data: data[index + initialTopMostItemIndexNumber] + })); + return $ed43cc03b55b9961$var$buildListState(items, [], adjustedCount, gap, sizes, firstItemIndex); +} +const $ed43cc03b55b9961$var$listStateSystem = $ed43cc03b55b9961$var$system(([{ sizes: sizes, totalCount: totalCount, data: data, firstItemIndex: firstItemIndex, gap: gap }, groupedListSystem2, { visibleRange: visibleRange, listBoundary: listBoundary, topListHeight: rangeTopListHeight }, { scrolledToInitialItem: scrolledToInitialItem, initialTopMostItemIndex: initialTopMostItemIndex }, { topListHeight: topListHeight }, stateFlags, { didMount: didMount }, { recalcInProgress: recalcInProgress }])=>{ + const topItemsIndexes = $ed43cc03b55b9961$var$statefulStream([]); + const initialItemCount = $ed43cc03b55b9961$var$statefulStream(0); + const itemsRendered = $ed43cc03b55b9961$var$stream(); + $ed43cc03b55b9961$var$connect(groupedListSystem2.topItemsIndexes, topItemsIndexes); + const listState = $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest(didMount, recalcInProgress, $ed43cc03b55b9961$var$duc(visibleRange, $ed43cc03b55b9961$var$tupleComparator), $ed43cc03b55b9961$var$duc(totalCount), $ed43cc03b55b9961$var$duc(sizes), $ed43cc03b55b9961$var$duc(initialTopMostItemIndex), scrolledToInitialItem, $ed43cc03b55b9961$var$duc(topItemsIndexes), $ed43cc03b55b9961$var$duc(firstItemIndex), $ed43cc03b55b9961$var$duc(gap), data), $ed43cc03b55b9961$var$filter(([mount, recalcInProgress2, , totalCount2, , , , , , , data2])=>{ + const dataChangeInProgress = data2 && data2.length !== totalCount2; + return mount && !recalcInProgress2 && !dataChangeInProgress; + }), $ed43cc03b55b9961$var$map(([, , [startOffset, endOffset], totalCount2, sizes2, initialTopMostItemIndex2, scrolledToInitialItem2, topItemsIndexes2, firstItemIndex2, gap2, data2])=>{ + const sizesValue = sizes2; + const { sizeTree: sizeTree, offsetTree: offsetTree } = sizesValue; + const initialItemCountValue = $ed43cc03b55b9961$var$getValue(initialItemCount); + if (totalCount2 === 0) return { + ...$ed43cc03b55b9961$var$EMPTY_LIST_STATE, + totalCount: totalCount2 + }; + if (startOffset === 0 && endOffset === 0) { + if (initialItemCountValue === 0) return { + ...$ed43cc03b55b9961$var$EMPTY_LIST_STATE, + totalCount: totalCount2 + }; + else return $ed43cc03b55b9961$var$buildListStateFromItemCount(initialItemCountValue, initialTopMostItemIndex2, sizes2, firstItemIndex2, gap2, data2 || []); + } + if ($ed43cc03b55b9961$var$empty(sizeTree)) { + if (initialItemCountValue > 0) return null; + const state = $ed43cc03b55b9961$var$buildListState($ed43cc03b55b9961$var$probeItemSet($ed43cc03b55b9961$var$getInitialTopMostItemIndexNumber(initialTopMostItemIndex2, totalCount2), sizesValue, data2), [], totalCount2, gap2, sizesValue, firstItemIndex2); + return state; + } + const topItems = []; + if (topItemsIndexes2.length > 0) { + const startIndex = topItemsIndexes2[0]; + const endIndex = topItemsIndexes2[topItemsIndexes2.length - 1]; + let offset = 0; + for (const range of $ed43cc03b55b9961$var$rangesWithin(sizeTree, startIndex, endIndex)){ + const size = range.value; + const rangeStartIndex = Math.max(range.start, startIndex); + const rangeEndIndex = Math.min(range.end, endIndex); + for(let i = rangeStartIndex; i <= rangeEndIndex; i++){ + topItems.push({ + index: i, + size: size, + offset: offset, + data: data2 && data2[i] + }); + offset += size; + } + } + } + if (!scrolledToInitialItem2) return $ed43cc03b55b9961$var$buildListState([], topItems, totalCount2, gap2, sizesValue, firstItemIndex2); + const minStartIndex = topItemsIndexes2.length > 0 ? topItemsIndexes2[topItemsIndexes2.length - 1] + 1 : 0; + const offsetPointRanges = $ed43cc03b55b9961$var$rangesWithinOffsets(offsetTree, startOffset, endOffset, minStartIndex); + if (offsetPointRanges.length === 0) return null; + const maxIndex = totalCount2 - 1; + const items = $ed43cc03b55b9961$var$tap([], (result)=>{ + for (const range of offsetPointRanges){ + const point = range.value; + let offset = point.offset; + let rangeStartIndex = range.start; + const size = point.size; + if (point.offset < startOffset) { + rangeStartIndex += Math.floor((startOffset - point.offset + gap2) / (size + gap2)); + const itemCount = rangeStartIndex - range.start; + offset += itemCount * size + itemCount * gap2; + } + if (rangeStartIndex < minStartIndex) { + offset += (minStartIndex - rangeStartIndex) * size; + rangeStartIndex = minStartIndex; + } + const endIndex = Math.min(range.end, maxIndex); + for(let i = rangeStartIndex; i <= endIndex; i++){ + if (offset >= endOffset) break; + result.push({ + index: i, + size: size, + offset: offset, + data: data2 && data2[i] + }); + offset += size + gap2; + } + } + }); + return $ed43cc03b55b9961$var$buildListState(items, topItems, totalCount2, gap2, sizesValue, firstItemIndex2); + }), //@ts-expect-error filter needs to be fixed + $ed43cc03b55b9961$var$filter((value)=>value !== null), $ed43cc03b55b9961$var$distinctUntilChanged()), $ed43cc03b55b9961$var$EMPTY_LIST_STATE); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(data, $ed43cc03b55b9961$var$filter($ed43cc03b55b9961$var$isDefined), $ed43cc03b55b9961$var$map((data2)=>data2 == null ? void 0 : data2.length)), totalCount); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(listState, $ed43cc03b55b9961$var$map((value)=>value.topListHeight)), topListHeight); + $ed43cc03b55b9961$var$connect(topListHeight, rangeTopListHeight); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(listState, $ed43cc03b55b9961$var$map((state)=>[ + state.top, + state.bottom + ])), listBoundary); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(listState, $ed43cc03b55b9961$var$map((state)=>state.items)), itemsRendered); + const endReached = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe(listState, $ed43cc03b55b9961$var$filter(({ items: items })=>items.length > 0), $ed43cc03b55b9961$var$withLatestFrom(totalCount, data), $ed43cc03b55b9961$var$filter(([{ items: items }, totalCount2])=>items[items.length - 1].originalIndex === totalCount2 - 1), $ed43cc03b55b9961$var$map(([, totalCount2, data2])=>[ + totalCount2 - 1, + data2 + ]), $ed43cc03b55b9961$var$distinctUntilChanged($ed43cc03b55b9961$var$tupleComparator), $ed43cc03b55b9961$var$map(([count])=>count))); + const startReached = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe(listState, $ed43cc03b55b9961$var$throttleTime(200), $ed43cc03b55b9961$var$filter(({ items: items, topItems: topItems })=>{ + return items.length > 0 && items[0].originalIndex === topItems.length; + }), $ed43cc03b55b9961$var$map(({ items: items })=>items[0].index), $ed43cc03b55b9961$var$distinctUntilChanged())); + const rangeChanged = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe(listState, $ed43cc03b55b9961$var$filter(({ items: items })=>items.length > 0), $ed43cc03b55b9961$var$map(({ items: items })=>{ + let startIndex = 0; + let endIndex = items.length - 1; + while(items[startIndex].type === "group" && startIndex < endIndex)startIndex++; + while(items[endIndex].type === "group" && endIndex > startIndex)endIndex--; + return { + startIndex: items[startIndex].index, + endIndex: items[endIndex].index + }; + }), $ed43cc03b55b9961$var$distinctUntilChanged($ed43cc03b55b9961$var$rangeComparator))); + return { + listState: listState, + topItemsIndexes: topItemsIndexes, + endReached: endReached, + startReached: startReached, + rangeChanged: rangeChanged, + itemsRendered: itemsRendered, + initialItemCount: initialItemCount, + ...stateFlags + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$sizeSystem, $ed43cc03b55b9961$var$groupedListSystem, $ed43cc03b55b9961$var$sizeRangeSystem, $ed43cc03b55b9961$var$initialTopMostItemIndexSystem, $ed43cc03b55b9961$var$scrollToIndexSystem, $ed43cc03b55b9961$var$stateFlagsSystem, $ed43cc03b55b9961$var$propsReadySystem, $ed43cc03b55b9961$var$recalcSystem), { + singleton: true +}); +const $ed43cc03b55b9961$var$initialItemCountSystem = $ed43cc03b55b9961$var$system(([{ sizes: sizes, firstItemIndex: firstItemIndex, data: data, gap: gap }, { initialTopMostItemIndex: initialTopMostItemIndex }, { initialItemCount: initialItemCount, listState: listState }, { didMount: didMount }])=>{ + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(didMount, $ed43cc03b55b9961$var$withLatestFrom(initialItemCount), $ed43cc03b55b9961$var$filter(([, count])=>count !== 0), $ed43cc03b55b9961$var$withLatestFrom(initialTopMostItemIndex, sizes, firstItemIndex, gap, data), $ed43cc03b55b9961$var$map(([[, count], initialTopMostItemIndexValue, sizes2, firstItemIndex2, gap2, data2 = []])=>{ + return $ed43cc03b55b9961$var$buildListStateFromItemCount(count, initialTopMostItemIndexValue, sizes2, firstItemIndex2, gap2, data2); + })), listState); + return {}; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$sizeSystem, $ed43cc03b55b9961$var$initialTopMostItemIndexSystem, $ed43cc03b55b9961$var$listStateSystem, $ed43cc03b55b9961$var$propsReadySystem), { + singleton: true +}); +const $ed43cc03b55b9961$var$scrollSeekSystem = $ed43cc03b55b9961$var$system(([{ scrollVelocity: scrollVelocity }])=>{ + const isSeeking = $ed43cc03b55b9961$var$statefulStream(false); + const rangeChanged = $ed43cc03b55b9961$var$stream(); + const scrollSeekConfiguration = $ed43cc03b55b9961$var$statefulStream(false); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(scrollVelocity, $ed43cc03b55b9961$var$withLatestFrom(scrollSeekConfiguration, isSeeking, rangeChanged), $ed43cc03b55b9961$var$filter(([_, config])=>!!config), $ed43cc03b55b9961$var$map(([speed, config, isSeeking2, range])=>{ + const { exit: exit, enter: enter } = config; + if (isSeeking2) { + if (exit(speed, range)) return false; + } else { + if (enter(speed, range)) return true; + } + return isSeeking2; + }), $ed43cc03b55b9961$var$distinctUntilChanged()), isSeeking); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest(isSeeking, scrollVelocity, rangeChanged), $ed43cc03b55b9961$var$withLatestFrom(scrollSeekConfiguration)), ([[isSeeking2, velocity, range], config])=>isSeeking2 && config && config.change && config.change(velocity, range)); + return { + isSeeking: isSeeking, + scrollSeekConfiguration: scrollSeekConfiguration, + scrollVelocity: scrollVelocity, + scrollSeekRangeChanged: rangeChanged + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$stateFlagsSystem), { + singleton: true +}); +const $ed43cc03b55b9961$var$topItemCountSystem = $ed43cc03b55b9961$var$system(([{ topItemsIndexes: topItemsIndexes }])=>{ + const topItemCount = $ed43cc03b55b9961$var$statefulStream(0); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(topItemCount, $ed43cc03b55b9961$var$filter((length)=>length > 0), $ed43cc03b55b9961$var$map((length)=>Array.from({ + length: length + }).map((_, index)=>index))), topItemsIndexes); + return { + topItemCount: topItemCount + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$listStateSystem)); +const $ed43cc03b55b9961$var$totalListHeightSystem = $ed43cc03b55b9961$var$system(([{ footerHeight: footerHeight, headerHeight: headerHeight, fixedHeaderHeight: fixedHeaderHeight, fixedFooterHeight: fixedFooterHeight }, { listState: listState }])=>{ + const totalListHeightChanged = $ed43cc03b55b9961$var$stream(); + const totalListHeight = $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest(footerHeight, fixedFooterHeight, headerHeight, fixedHeaderHeight, listState), $ed43cc03b55b9961$var$map(([footerHeight2, fixedFooterHeight2, headerHeight2, fixedHeaderHeight2, listState2])=>{ + return footerHeight2 + fixedFooterHeight2 + headerHeight2 + fixedHeaderHeight2 + listState2.offsetBottom + listState2.bottom; + })), 0); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$duc(totalListHeight), totalListHeightChanged); + return { + totalListHeight: totalListHeight, + totalListHeightChanged: totalListHeightChanged + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$domIOSystem, $ed43cc03b55b9961$var$listStateSystem), { + singleton: true +}); +function $ed43cc03b55b9961$var$simpleMemoize(func) { + let called = false; + let result; + return ()=>{ + if (!called) { + called = true; + result = func(); + } + return result; + }; +} +const $ed43cc03b55b9961$var$isMobileSafari = $ed43cc03b55b9961$var$simpleMemoize(()=>{ + return /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent); +}); +const $ed43cc03b55b9961$var$upwardScrollFixSystem = $ed43cc03b55b9961$var$system(([{ scrollBy: scrollBy, scrollTop: scrollTop, deviation: deviation, scrollingInProgress: scrollingInProgress }, { isScrolling: isScrolling, isAtBottom: isAtBottom, scrollDirection: scrollDirection, lastJumpDueToItemResize: lastJumpDueToItemResize }, { listState: listState }, { beforeUnshiftWith: beforeUnshiftWith, shiftWithOffset: shiftWithOffset, sizes: sizes, gap: gap }, { log: log }, { recalcInProgress: recalcInProgress }])=>{ + const deviationOffset = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe(listState, $ed43cc03b55b9961$var$withLatestFrom(lastJumpDueToItemResize), $ed43cc03b55b9961$var$scan(([, prevItems, prevTotalCount, prevTotalHeight], [{ items: items, totalCount: totalCount, bottom: bottom, offsetBottom: offsetBottom }, lastJumpDueToItemResize2])=>{ + const totalHeight = bottom + offsetBottom; + let newDev = 0; + if (prevTotalCount === totalCount) { + if (prevItems.length > 0 && items.length > 0) { + const atStart = items[0].originalIndex === 0 && prevItems[0].originalIndex === 0; + if (!atStart) { + newDev = totalHeight - prevTotalHeight; + if (newDev !== 0) newDev += lastJumpDueToItemResize2; + } + } + } + return [ + newDev, + items, + totalCount, + totalHeight + ]; + }, [ + 0, + [], + 0, + 0 + ]), $ed43cc03b55b9961$var$filter(([amount])=>amount !== 0), $ed43cc03b55b9961$var$withLatestFrom(scrollTop, scrollDirection, scrollingInProgress, isAtBottom, log, recalcInProgress), $ed43cc03b55b9961$var$filter(([, scrollTop2, scrollDirection2, scrollingInProgress2, , , recalcInProgress2])=>{ + return !recalcInProgress2 && !scrollingInProgress2 && scrollTop2 !== 0 && scrollDirection2 === $ed43cc03b55b9961$var$UP; + }), $ed43cc03b55b9961$var$map(([[amount], , , , , log2])=>{ + log2("Upward scrolling compensation", { + amount: amount + }, $ed43cc03b55b9961$export$243e62d78d3b544d.DEBUG); + return amount; + }))); + function scrollByWith(offset) { + if (offset > 0) { + $ed43cc03b55b9961$var$publish(scrollBy, { + top: -offset, + behavior: "auto" + }); + $ed43cc03b55b9961$var$publish(deviation, 0); + } else { + $ed43cc03b55b9961$var$publish(deviation, 0); + $ed43cc03b55b9961$var$publish(scrollBy, { + top: -offset, + behavior: "auto" + }); + } + } + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe(deviationOffset, $ed43cc03b55b9961$var$withLatestFrom(deviation, isScrolling)), ([offset, deviationAmount, isScrolling2])=>{ + if (isScrolling2 && $ed43cc03b55b9961$var$isMobileSafari()) $ed43cc03b55b9961$var$publish(deviation, deviationAmount - offset); + else scrollByWith(-offset); + }); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest($ed43cc03b55b9961$var$statefulStreamFromEmitter(isScrolling, false), deviation, recalcInProgress), $ed43cc03b55b9961$var$filter(([is, deviation2, recalc])=>!is && !recalc && deviation2 !== 0), $ed43cc03b55b9961$var$map(([_, deviation2])=>deviation2), $ed43cc03b55b9961$var$throttleTime(1)), scrollByWith); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(shiftWithOffset, $ed43cc03b55b9961$var$map((offset)=>{ + return { + top: -offset + }; + })), scrollBy); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe(beforeUnshiftWith, $ed43cc03b55b9961$var$withLatestFrom(sizes, gap), $ed43cc03b55b9961$var$map(([offset, { lastSize: defaultItemSize, groupIndices: groupIndices, sizeTree: sizeTree }, gap2])=>{ + function getItemOffset(itemCount) { + return itemCount * (defaultItemSize + gap2); + } + if (groupIndices.length === 0) return getItemOffset(offset); + else { + let amount = 0; + const defaultGroupSize = $ed43cc03b55b9961$var$find(sizeTree, 0); + let recognizedOffsetItems = 0; + let groupIndex = 0; + while(recognizedOffsetItems < offset){ + recognizedOffsetItems++; + amount += defaultGroupSize; + let groupItemCount = groupIndices.length === groupIndex + 1 ? Infinity : groupIndices[groupIndex + 1] - groupIndices[groupIndex] - 1; + if (recognizedOffsetItems + groupItemCount > offset) { + amount -= defaultGroupSize; + groupItemCount = offset - recognizedOffsetItems + 1; + } + recognizedOffsetItems += groupItemCount; + amount += getItemOffset(groupItemCount); + groupIndex++; + } + return amount; + } + })), (offset)=>{ + $ed43cc03b55b9961$var$publish(deviation, offset); + requestAnimationFrame(()=>{ + $ed43cc03b55b9961$var$publish(scrollBy, { + top: offset + }); + requestAnimationFrame(()=>{ + $ed43cc03b55b9961$var$publish(deviation, 0); + $ed43cc03b55b9961$var$publish(recalcInProgress, false); + }); + }); + }); + return { + deviation: deviation + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$domIOSystem, $ed43cc03b55b9961$var$stateFlagsSystem, $ed43cc03b55b9961$var$listStateSystem, $ed43cc03b55b9961$var$sizeSystem, $ed43cc03b55b9961$var$loggerSystem, $ed43cc03b55b9961$var$recalcSystem)); +const $ed43cc03b55b9961$var$initialScrollTopSystem = $ed43cc03b55b9961$var$system(([{ didMount: didMount }, { scrollTo: scrollTo }, { listState: listState }])=>{ + const initialScrollTop = $ed43cc03b55b9961$var$statefulStream(0); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe(didMount, $ed43cc03b55b9961$var$withLatestFrom(initialScrollTop), $ed43cc03b55b9961$var$filter(([, offset])=>offset !== 0), $ed43cc03b55b9961$var$map(([, offset])=>({ + top: offset + }))), (location)=>{ + $ed43cc03b55b9961$var$handleNext($ed43cc03b55b9961$var$pipe(listState, $ed43cc03b55b9961$var$skip(1), $ed43cc03b55b9961$var$filter((state)=>state.items.length > 1)), ()=>{ + requestAnimationFrame(()=>{ + $ed43cc03b55b9961$var$publish(scrollTo, location); + }); + }); + }); + return { + initialScrollTop: initialScrollTop + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$propsReadySystem, $ed43cc03b55b9961$var$domIOSystem, $ed43cc03b55b9961$var$listStateSystem), { + singleton: true +}); +const $ed43cc03b55b9961$var$alignToBottomSystem = $ed43cc03b55b9961$var$system(([{ viewportHeight: viewportHeight }, { totalListHeight: totalListHeight }])=>{ + const alignToBottom = $ed43cc03b55b9961$var$statefulStream(false); + const paddingTopAddition = $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest(alignToBottom, viewportHeight, totalListHeight), $ed43cc03b55b9961$var$filter(([enabled])=>enabled), $ed43cc03b55b9961$var$map(([, viewportHeight2, totalListHeight2])=>{ + return Math.max(0, viewportHeight2 - totalListHeight2); + }), $ed43cc03b55b9961$var$throttleTime(0), $ed43cc03b55b9961$var$distinctUntilChanged()), 0); + return { + alignToBottom: alignToBottom, + paddingTopAddition: paddingTopAddition + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$domIOSystem, $ed43cc03b55b9961$var$totalListHeightSystem), { + singleton: true +}); +const $ed43cc03b55b9961$var$windowScrollerSystem = $ed43cc03b55b9961$var$system(([{ scrollTo: scrollTo, scrollContainerState: scrollContainerState }])=>{ + const windowScrollContainerState = $ed43cc03b55b9961$var$stream(); + const windowViewportRect = $ed43cc03b55b9961$var$stream(); + const windowScrollTo = $ed43cc03b55b9961$var$stream(); + const useWindowScroll = $ed43cc03b55b9961$var$statefulStream(false); + const customScrollParent = $ed43cc03b55b9961$var$statefulStream(void 0); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest(windowScrollContainerState, windowViewportRect), $ed43cc03b55b9961$var$map(([{ viewportHeight: viewportHeight, scrollTop: windowScrollTop, scrollHeight: scrollHeight }, { offsetTop: offsetTop }])=>{ + return { + scrollTop: Math.max(0, windowScrollTop - offsetTop), + scrollHeight: scrollHeight, + viewportHeight: viewportHeight + }; + })), scrollContainerState); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(scrollTo, $ed43cc03b55b9961$var$withLatestFrom(windowViewportRect), $ed43cc03b55b9961$var$map(([scrollTo2, { offsetTop: offsetTop }])=>{ + return { + ...scrollTo2, + top: scrollTo2.top + offsetTop + }; + })), windowScrollTo); + return { + useWindowScroll: // config + useWindowScroll, + customScrollParent: customScrollParent, + windowScrollContainerState: // input + windowScrollContainerState, + windowViewportRect: windowViewportRect, + windowScrollTo: // signals + windowScrollTo + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$domIOSystem)); +const $ed43cc03b55b9961$var$defaultCalculateViewLocation = ({ itemTop: itemTop2, itemBottom: itemBottom, viewportTop: viewportTop, viewportBottom: viewportBottom, locationParams: { behavior: behavior, align: align, ...rest } })=>{ + if (itemTop2 < viewportTop) return { + ...rest, + behavior: behavior, + align: align != null ? align : "start" + }; + if (itemBottom > viewportBottom) return { + ...rest, + behavior: behavior, + align: align != null ? align : "end" + }; + return null; +}; +const $ed43cc03b55b9961$var$scrollIntoViewSystem = $ed43cc03b55b9961$var$system(([{ sizes: sizes, totalCount: totalCount, gap: gap }, { scrollTop: scrollTop, viewportHeight: viewportHeight, headerHeight: headerHeight, fixedHeaderHeight: fixedHeaderHeight, fixedFooterHeight: fixedFooterHeight, scrollingInProgress: scrollingInProgress }, { scrollToIndex: scrollToIndex }])=>{ + const scrollIntoView = $ed43cc03b55b9961$var$stream(); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(scrollIntoView, $ed43cc03b55b9961$var$withLatestFrom(sizes, viewportHeight, totalCount, headerHeight, fixedHeaderHeight, fixedFooterHeight, scrollTop), $ed43cc03b55b9961$var$withLatestFrom(gap), $ed43cc03b55b9961$var$map(([[viewLocation, sizes2, viewportHeight2, totalCount2, headerHeight2, fixedHeaderHeight2, fixedFooterHeight2, scrollTop2], gap2])=>{ + const { done: done, behavior: behavior, align: align, calculateViewLocation: calculateViewLocation = $ed43cc03b55b9961$var$defaultCalculateViewLocation, ...rest } = viewLocation; + const actualIndex = $ed43cc03b55b9961$var$originalIndexFromLocation(viewLocation, sizes2, totalCount2 - 1); + const itemTop2 = $ed43cc03b55b9961$var$offsetOf(actualIndex, sizes2.offsetTree, gap2) + headerHeight2 + fixedHeaderHeight2; + const itemBottom = itemTop2 + $ed43cc03b55b9961$var$findMaxKeyValue(sizes2.sizeTree, actualIndex)[1]; + const viewportTop = scrollTop2 + fixedHeaderHeight2; + const viewportBottom = scrollTop2 + viewportHeight2 - fixedFooterHeight2; + const location = calculateViewLocation({ + itemTop: itemTop2, + itemBottom: itemBottom, + viewportTop: viewportTop, + viewportBottom: viewportBottom, + locationParams: { + behavior: behavior, + align: align, + ...rest + } + }); + if (location) done && $ed43cc03b55b9961$var$handleNext($ed43cc03b55b9961$var$pipe(scrollingInProgress, $ed43cc03b55b9961$var$filter((value)=>value === false), // skips the initial publish of false, and the cleanup call. + // but if scrollingInProgress is true, we skip the initial publish. + $ed43cc03b55b9961$var$skip($ed43cc03b55b9961$var$getValue(scrollingInProgress) ? 1 : 2)), done); + else done && done(); + return location; + }), $ed43cc03b55b9961$var$filter((value)=>value !== null)), scrollToIndex); + return { + scrollIntoView: scrollIntoView + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$sizeSystem, $ed43cc03b55b9961$var$domIOSystem, $ed43cc03b55b9961$var$scrollToIndexSystem, $ed43cc03b55b9961$var$listStateSystem, $ed43cc03b55b9961$var$loggerSystem), { + singleton: true +}); +const $ed43cc03b55b9961$var$stateLoadSystem = $ed43cc03b55b9961$var$system(([{ sizes: sizes, sizeRanges: sizeRanges }, { scrollTop: scrollTop }, { initialTopMostItemIndex: initialTopMostItemIndex }, { didMount: didMount }, { useWindowScroll: useWindowScroll, windowScrollContainerState: windowScrollContainerState, windowViewportRect: windowViewportRect }])=>{ + const getState = $ed43cc03b55b9961$var$stream(); + const restoreStateFrom = $ed43cc03b55b9961$var$statefulStream(void 0); + const statefulWindowScrollContainerState = $ed43cc03b55b9961$var$statefulStream(null); + const statefulWindowViewportRect = $ed43cc03b55b9961$var$statefulStream(null); + $ed43cc03b55b9961$var$connect(windowScrollContainerState, statefulWindowScrollContainerState); + $ed43cc03b55b9961$var$connect(windowViewportRect, statefulWindowViewportRect); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe(getState, $ed43cc03b55b9961$var$withLatestFrom(sizes, scrollTop, useWindowScroll, statefulWindowScrollContainerState, statefulWindowViewportRect)), ([callback, sizes2, scrollTop2, useWindowScroll2, windowScrollContainerState2, windowViewportRect2])=>{ + const ranges = $ed43cc03b55b9961$var$sizeTreeToRanges(sizes2.sizeTree); + if (useWindowScroll2 && windowScrollContainerState2 !== null && windowViewportRect2 !== null) scrollTop2 = windowScrollContainerState2.scrollTop - windowViewportRect2.offsetTop; + callback({ + ranges: ranges, + scrollTop: scrollTop2 + }); + }); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(restoreStateFrom, $ed43cc03b55b9961$var$filter($ed43cc03b55b9961$var$isDefined), $ed43cc03b55b9961$var$map($ed43cc03b55b9961$var$locationFromSnapshot)), initialTopMostItemIndex); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(didMount, $ed43cc03b55b9961$var$withLatestFrom(restoreStateFrom), $ed43cc03b55b9961$var$filter(([, state])=>state !== void 0), $ed43cc03b55b9961$var$distinctUntilChanged(), $ed43cc03b55b9961$var$map(([, snapshot])=>{ + return snapshot.ranges; + })), sizeRanges); + return { + getState: getState, + restoreStateFrom: restoreStateFrom + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$sizeSystem, $ed43cc03b55b9961$var$domIOSystem, $ed43cc03b55b9961$var$initialTopMostItemIndexSystem, $ed43cc03b55b9961$var$propsReadySystem, $ed43cc03b55b9961$var$windowScrollerSystem)); +function $ed43cc03b55b9961$var$locationFromSnapshot(snapshot) { + return { + offset: snapshot.scrollTop, + index: 0, + align: "start" + }; +} +const $ed43cc03b55b9961$var$featureGroup1System = $ed43cc03b55b9961$var$system(([sizeRange, initialItemCount, propsReady, scrollSeek, totalListHeight, initialScrollTopSystem2, alignToBottom, windowScroller, scrollIntoView, logger])=>{ + return { + ...sizeRange, + ...initialItemCount, + ...propsReady, + ...scrollSeek, + ...totalListHeight, + ...initialScrollTopSystem2, + ...alignToBottom, + ...windowScroller, + ...scrollIntoView, + ...logger + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$sizeRangeSystem, $ed43cc03b55b9961$var$initialItemCountSystem, $ed43cc03b55b9961$var$propsReadySystem, $ed43cc03b55b9961$var$scrollSeekSystem, $ed43cc03b55b9961$var$totalListHeightSystem, $ed43cc03b55b9961$var$initialScrollTopSystem, $ed43cc03b55b9961$var$alignToBottomSystem, $ed43cc03b55b9961$var$windowScrollerSystem, $ed43cc03b55b9961$var$scrollIntoViewSystem, $ed43cc03b55b9961$var$loggerSystem)); +const $ed43cc03b55b9961$var$listSystem = $ed43cc03b55b9961$var$system(([{ totalCount: totalCount, sizeRanges: sizeRanges, fixedItemSize: fixedItemSize, defaultItemSize: defaultItemSize, trackItemSizes: trackItemSizes, itemSize: itemSize, data: data, firstItemIndex: firstItemIndex, groupIndices: groupIndices, statefulTotalCount: statefulTotalCount, gap: gap, sizes: sizes }, { initialTopMostItemIndex: initialTopMostItemIndex, scrolledToInitialItem: scrolledToInitialItem }, domIO, stateLoad, followOutput, { listState: listState, topItemsIndexes: topItemsIndexes, ...flags }, { scrollToIndex: scrollToIndex }, _, { topItemCount: topItemCount }, { groupCounts: groupCounts }, featureGroup1])=>{ + $ed43cc03b55b9961$var$connect(flags.rangeChanged, featureGroup1.scrollSeekRangeChanged); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(featureGroup1.windowViewportRect, $ed43cc03b55b9961$var$map((value)=>value.visibleHeight)), domIO.viewportHeight); + return { + totalCount: // input + totalCount, + data: data, + firstItemIndex: firstItemIndex, + sizeRanges: sizeRanges, + initialTopMostItemIndex: initialTopMostItemIndex, + scrolledToInitialItem: scrolledToInitialItem, + topItemsIndexes: topItemsIndexes, + topItemCount: topItemCount, + groupCounts: groupCounts, + fixedItemHeight: fixedItemSize, + defaultItemHeight: defaultItemSize, + gap: gap, + ...followOutput, + statefulTotalCount: // output + statefulTotalCount, + listState: listState, + scrollToIndex: scrollToIndex, + trackItemSizes: trackItemSizes, + itemSize: itemSize, + groupIndices: groupIndices, + // exported from stateFlagsSystem + ...flags, + // the bag of IO from featureGroup1System + ...featureGroup1, + ...domIO, + sizes: sizes, + ...stateLoad + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$sizeSystem, $ed43cc03b55b9961$var$initialTopMostItemIndexSystem, $ed43cc03b55b9961$var$domIOSystem, $ed43cc03b55b9961$var$stateLoadSystem, $ed43cc03b55b9961$var$followOutputSystem, $ed43cc03b55b9961$var$listStateSystem, $ed43cc03b55b9961$var$scrollToIndexSystem, $ed43cc03b55b9961$var$upwardScrollFixSystem, $ed43cc03b55b9961$var$topItemCountSystem, $ed43cc03b55b9961$var$groupedListSystem, $ed43cc03b55b9961$var$featureGroup1System)); +const $ed43cc03b55b9961$var$WEBKIT_STICKY = "-webkit-sticky"; +const $ed43cc03b55b9961$var$STICKY = "sticky"; +const $ed43cc03b55b9961$var$positionStickyCssValue = $ed43cc03b55b9961$var$simpleMemoize(()=>{ + if (typeof document === "undefined") return $ed43cc03b55b9961$var$STICKY; + const node = document.createElement("div"); + node.style.position = $ed43cc03b55b9961$var$WEBKIT_STICKY; + return node.style.position === $ed43cc03b55b9961$var$WEBKIT_STICKY ? $ed43cc03b55b9961$var$WEBKIT_STICKY : $ed43cc03b55b9961$var$STICKY; +}); +function $ed43cc03b55b9961$var$useWindowViewportRectRef(callback, customScrollParent) { + const viewportInfo = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useRef(null); + const calculateInfo = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useCallback((element)=>{ + if (element === null || !element.offsetParent) return; + const rect = element.getBoundingClientRect(); + const visibleWidth = rect.width; + let visibleHeight, offsetTop; + if (customScrollParent) { + const customScrollParentRect = customScrollParent.getBoundingClientRect(); + const deltaTop = rect.top - customScrollParentRect.top; + visibleHeight = customScrollParentRect.height - Math.max(0, deltaTop); + offsetTop = deltaTop + customScrollParent.scrollTop; + } else { + visibleHeight = window.innerHeight - Math.max(0, rect.top); + offsetTop = rect.top + window.pageYOffset; + } + viewportInfo.current = { + offsetTop: offsetTop, + visibleHeight: visibleHeight, + visibleWidth: visibleWidth + }; + callback(viewportInfo.current); + }, [ + callback, + customScrollParent + ]); + const { callbackRef: callbackRef, ref: ref } = $ed43cc03b55b9961$var$useSizeWithElRef(calculateInfo); + const scrollAndResizeEventHandler = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useCallback(()=>{ + calculateInfo(ref.current); + }, [ + calculateInfo, + ref + ]); + (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useEffect(()=>{ + if (customScrollParent) { + customScrollParent.addEventListener("scroll", scrollAndResizeEventHandler); + const observer = new ResizeObserver(scrollAndResizeEventHandler); + observer.observe(customScrollParent); + return ()=>{ + customScrollParent.removeEventListener("scroll", scrollAndResizeEventHandler); + observer.unobserve(customScrollParent); + }; + } else { + window.addEventListener("scroll", scrollAndResizeEventHandler); + window.addEventListener("resize", scrollAndResizeEventHandler); + return ()=>{ + window.removeEventListener("scroll", scrollAndResizeEventHandler); + window.removeEventListener("resize", scrollAndResizeEventHandler); + }; + } + }, [ + scrollAndResizeEventHandler, + customScrollParent + ]); + return callbackRef; +} +const $ed43cc03b55b9961$export$99e9d54e386aea7b = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createContext(void 0); +const $ed43cc03b55b9961$export$81e3217b4b7a890f = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createContext(void 0); +function $ed43cc03b55b9961$var$identity(value) { + return value; +} +const $ed43cc03b55b9961$var$listComponentPropsSystem = /* @__PURE__ */ $ed43cc03b55b9961$var$system(()=>{ + const itemContent = $ed43cc03b55b9961$var$statefulStream((index)=>`Item ${index}`); + const context = $ed43cc03b55b9961$var$statefulStream(null); + const groupContent = $ed43cc03b55b9961$var$statefulStream((index)=>`Group ${index}`); + const components = $ed43cc03b55b9961$var$statefulStream({}); + const computeItemKey = $ed43cc03b55b9961$var$statefulStream($ed43cc03b55b9961$var$identity); + const headerFooterTag = $ed43cc03b55b9961$var$statefulStream("div"); + const scrollerRef = $ed43cc03b55b9961$var$statefulStream($ed43cc03b55b9961$var$noop); + const distinctProp = (propName, defaultValue = null)=>{ + return $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe(components, $ed43cc03b55b9961$var$map((components2)=>components2[propName]), $ed43cc03b55b9961$var$distinctUntilChanged()), defaultValue); + }; + return { + context: context, + itemContent: itemContent, + groupContent: groupContent, + components: components, + computeItemKey: computeItemKey, + headerFooterTag: headerFooterTag, + scrollerRef: scrollerRef, + FooterComponent: distinctProp("Footer"), + HeaderComponent: distinctProp("Header"), + TopItemListComponent: distinctProp("TopItemList"), + ListComponent: distinctProp("List", "div"), + ItemComponent: distinctProp("Item", "div"), + GroupComponent: distinctProp("Group", "div"), + ScrollerComponent: distinctProp("Scroller", "div"), + EmptyPlaceholder: distinctProp("EmptyPlaceholder"), + ScrollSeekPlaceholder: distinctProp("ScrollSeekPlaceholder") + }; +}); +const $ed43cc03b55b9961$var$combinedSystem$2 = /* @__PURE__ */ $ed43cc03b55b9961$var$system(([listSystem2, propsSystem])=>{ + return { + ...listSystem2, + ...propsSystem + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$listSystem, $ed43cc03b55b9961$var$listComponentPropsSystem)); +const $ed43cc03b55b9961$var$DefaultScrollSeekPlaceholder$1 = ({ height: height })=>/* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("div", { + style: { + height: height + } + }); +const $ed43cc03b55b9961$var$GROUP_STYLE = { + position: $ed43cc03b55b9961$var$positionStickyCssValue(), + zIndex: 1, + overflowAnchor: "none" +}; +const $ed43cc03b55b9961$var$ITEM_STYLE$1 = { + overflowAnchor: "none" +}; +const $ed43cc03b55b9961$var$Items$1 = /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function VirtuosoItems({ showTopList: showTopList = false }) { + const listState = $ed43cc03b55b9961$var$useEmitterValue$2("listState"); + const sizeRanges = $ed43cc03b55b9961$var$usePublisher$2("sizeRanges"); + const useWindowScroll = $ed43cc03b55b9961$var$useEmitterValue$2("useWindowScroll"); + const customScrollParent = $ed43cc03b55b9961$var$useEmitterValue$2("customScrollParent"); + const windowScrollContainerStateCallback = $ed43cc03b55b9961$var$usePublisher$2("windowScrollContainerState"); + const _scrollContainerStateCallback = $ed43cc03b55b9961$var$usePublisher$2("scrollContainerState"); + const scrollContainerStateCallback = customScrollParent || useWindowScroll ? windowScrollContainerStateCallback : _scrollContainerStateCallback; + const itemContent = $ed43cc03b55b9961$var$useEmitterValue$2("itemContent"); + const context = $ed43cc03b55b9961$var$useEmitterValue$2("context"); + const groupContent = $ed43cc03b55b9961$var$useEmitterValue$2("groupContent"); + const trackItemSizes = $ed43cc03b55b9961$var$useEmitterValue$2("trackItemSizes"); + const itemSize = $ed43cc03b55b9961$var$useEmitterValue$2("itemSize"); + const log = $ed43cc03b55b9961$var$useEmitterValue$2("log"); + const listGap = $ed43cc03b55b9961$var$usePublisher$2("gap"); + const { callbackRef: callbackRef } = $ed43cc03b55b9961$var$useChangedListContentsSizes(sizeRanges, itemSize, trackItemSizes, showTopList ? $ed43cc03b55b9961$var$noop : scrollContainerStateCallback, log, listGap, customScrollParent); + const [deviation, setDeviation] = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useState(0); + $ed43cc03b55b9961$var$useEmitter$2("deviation", (value)=>{ + if (deviation !== value) setDeviation(value); + }); + const EmptyPlaceholder = $ed43cc03b55b9961$var$useEmitterValue$2("EmptyPlaceholder"); + const ScrollSeekPlaceholder = $ed43cc03b55b9961$var$useEmitterValue$2("ScrollSeekPlaceholder") || $ed43cc03b55b9961$var$DefaultScrollSeekPlaceholder$1; + const ListComponent = $ed43cc03b55b9961$var$useEmitterValue$2("ListComponent"); + const ItemComponent = $ed43cc03b55b9961$var$useEmitterValue$2("ItemComponent"); + const GroupComponent = $ed43cc03b55b9961$var$useEmitterValue$2("GroupComponent"); + const computeItemKey = $ed43cc03b55b9961$var$useEmitterValue$2("computeItemKey"); + const isSeeking = $ed43cc03b55b9961$var$useEmitterValue$2("isSeeking"); + const hasGroups2 = $ed43cc03b55b9961$var$useEmitterValue$2("groupIndices").length > 0; + const paddingTopAddition = $ed43cc03b55b9961$var$useEmitterValue$2("paddingTopAddition"); + const scrolledToInitialItem = $ed43cc03b55b9961$var$useEmitterValue$2("scrolledToInitialItem"); + const containerStyle = showTopList ? {} : { + boxSizing: "border-box", + paddingTop: listState.offsetTop + paddingTopAddition, + paddingBottom: listState.offsetBottom, + marginTop: deviation, + ...scrolledToInitialItem ? {} : { + visibility: "hidden" + } + }; + if (!showTopList && listState.totalCount === 0 && EmptyPlaceholder) return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(EmptyPlaceholder, $ed43cc03b55b9961$var$contextPropIfNotDomElement(EmptyPlaceholder, context)); + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(ListComponent, { + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(ListComponent, context), + ref: callbackRef, + style: containerStyle, + "data-test-id": showTopList ? "virtuoso-top-item-list" : "virtuoso-item-list" + }, (showTopList ? listState.topItems : listState.items).map((item)=>{ + const index = item.originalIndex; + const key = computeItemKey(index + listState.firstItemIndex, item.data, context); + if (isSeeking) return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(ScrollSeekPlaceholder, { + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(ScrollSeekPlaceholder, context), + key: key, + index: item.index, + height: item.size, + type: item.type || "item", + ...item.type === "group" ? {} : { + groupIndex: item.groupIndex + } + }); + if (item.type === "group") return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(GroupComponent, { + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(GroupComponent, context), + key: key, + "data-index": index, + "data-known-size": item.size, + "data-item-index": item.index, + style: $ed43cc03b55b9961$var$GROUP_STYLE + }, groupContent(item.index, context)); + else return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(ItemComponent, { + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(ItemComponent, context), + ...$ed43cc03b55b9961$var$itemPropIfNotDomElement(ItemComponent, item.data), + key: key, + "data-index": index, + "data-known-size": item.size, + "data-item-index": item.index, + "data-item-group-index": item.groupIndex, + style: $ed43cc03b55b9961$var$ITEM_STYLE$1 + }, hasGroups2 ? itemContent(item.index, item.groupIndex, item.data, context) : itemContent(item.index, item.data, context)); + })); +}); +const $ed43cc03b55b9961$var$scrollerStyle = { + height: "100%", + outline: "none", + overflowY: "auto", + position: "relative", + WebkitOverflowScrolling: "touch" +}; +const $ed43cc03b55b9961$var$viewportStyle = { + width: "100%", + height: "100%", + position: "absolute", + top: 0 +}; +const $ed43cc03b55b9961$var$topItemListStyle = { + width: "100%", + position: $ed43cc03b55b9961$var$positionStickyCssValue(), + top: 0, + zIndex: 1 +}; +function $ed43cc03b55b9961$var$contextPropIfNotDomElement(element, context) { + if (typeof element === "string") return void 0; + return { + context: context + }; +} +function $ed43cc03b55b9961$var$itemPropIfNotDomElement(element, item) { + return { + item: typeof element === "string" ? void 0 : item + }; +} +const $ed43cc03b55b9961$var$Header$1 = /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function VirtuosoHeader() { + const Header2 = $ed43cc03b55b9961$var$useEmitterValue$2("HeaderComponent"); + const headerHeight = $ed43cc03b55b9961$var$usePublisher$2("headerHeight"); + const headerFooterTag = $ed43cc03b55b9961$var$useEmitterValue$2("headerFooterTag"); + const ref = $ed43cc03b55b9961$var$useSize((el)=>headerHeight($ed43cc03b55b9961$var$correctItemSize(el, "height"))); + const context = $ed43cc03b55b9961$var$useEmitterValue$2("context"); + return Header2 ? (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(headerFooterTag, { + ref: ref + }, (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(Header2, $ed43cc03b55b9961$var$contextPropIfNotDomElement(Header2, context))) : null; +}); +const $ed43cc03b55b9961$var$Footer$1 = /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function VirtuosoFooter() { + const Footer2 = $ed43cc03b55b9961$var$useEmitterValue$2("FooterComponent"); + const footerHeight = $ed43cc03b55b9961$var$usePublisher$2("footerHeight"); + const headerFooterTag = $ed43cc03b55b9961$var$useEmitterValue$2("headerFooterTag"); + const ref = $ed43cc03b55b9961$var$useSize((el)=>footerHeight($ed43cc03b55b9961$var$correctItemSize(el, "height"))); + const context = $ed43cc03b55b9961$var$useEmitterValue$2("context"); + return Footer2 ? (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(headerFooterTag, { + ref: ref + }, (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(Footer2, $ed43cc03b55b9961$var$contextPropIfNotDomElement(Footer2, context))) : null; +}); +function $ed43cc03b55b9961$var$buildScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, useEmitterValue: useEmitterValue2 }) { + const Scroller2 = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function VirtuosoScroller({ style: style, children: children, ...props }) { + const scrollContainerStateCallback = usePublisher2("scrollContainerState"); + const ScrollerComponent = useEmitterValue2("ScrollerComponent"); + const smoothScrollTargetReached = usePublisher2("smoothScrollTargetReached"); + const scrollerRefCallback = useEmitterValue2("scrollerRef"); + const context = useEmitterValue2("context"); + const { scrollerRef: scrollerRef, scrollByCallback: scrollByCallback, scrollToCallback: scrollToCallback } = $ed43cc03b55b9961$var$useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, ScrollerComponent, scrollerRefCallback); + useEmitter2("scrollTo", scrollToCallback); + useEmitter2("scrollBy", scrollByCallback); + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(ScrollerComponent, { + ref: scrollerRef, + style: { + ...$ed43cc03b55b9961$var$scrollerStyle, + ...style + }, + "data-test-id": "virtuoso-scroller", + "data-virtuoso-scroller": true, + tabIndex: 0, + ...props, + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(ScrollerComponent, context) + }, children); + }); + return Scroller2; +} +function $ed43cc03b55b9961$var$buildWindowScroller({ usePublisher: usePublisher2, useEmitter: useEmitter2, useEmitterValue: useEmitterValue2 }) { + const Scroller2 = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function VirtuosoWindowScroller({ style: style, children: children, ...props }) { + const scrollContainerStateCallback = usePublisher2("windowScrollContainerState"); + const ScrollerComponent = useEmitterValue2("ScrollerComponent"); + const smoothScrollTargetReached = usePublisher2("smoothScrollTargetReached"); + const totalListHeight = useEmitterValue2("totalListHeight"); + const deviation = useEmitterValue2("deviation"); + const customScrollParent = useEmitterValue2("customScrollParent"); + const context = useEmitterValue2("context"); + const { scrollerRef: scrollerRef, scrollByCallback: scrollByCallback, scrollToCallback: scrollToCallback } = $ed43cc03b55b9961$var$useScrollTop(scrollContainerStateCallback, smoothScrollTargetReached, ScrollerComponent, $ed43cc03b55b9961$var$noop, customScrollParent); + $ed43cc03b55b9961$var$useIsomorphicLayoutEffect$1(()=>{ + scrollerRef.current = customScrollParent ? customScrollParent : window; + return ()=>{ + scrollerRef.current = null; + }; + }, [ + scrollerRef, + customScrollParent + ]); + useEmitter2("windowScrollTo", scrollToCallback); + useEmitter2("scrollBy", scrollByCallback); + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(ScrollerComponent, { + style: { + position: "relative", + ...style, + ...totalListHeight !== 0 ? { + height: totalListHeight + deviation + } : {} + }, + "data-virtuoso-scroller": true, + ...props, + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(ScrollerComponent, context) + }, children); + }); + return Scroller2; +} +const $ed43cc03b55b9961$var$Viewport$2 = ({ children: children })=>{ + const ctx = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useContext($ed43cc03b55b9961$export$99e9d54e386aea7b); + const viewportHeight = $ed43cc03b55b9961$var$usePublisher$2("viewportHeight"); + const fixedItemHeight = $ed43cc03b55b9961$var$usePublisher$2("fixedItemHeight"); + const viewportRef = $ed43cc03b55b9961$var$useSize($ed43cc03b55b9961$var$compose(viewportHeight, (el)=>$ed43cc03b55b9961$var$correctItemSize(el, "height"))); + (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useEffect(()=>{ + if (ctx) { + viewportHeight(ctx.viewportHeight); + fixedItemHeight(ctx.itemHeight); + } + }, [ + ctx, + viewportHeight, + fixedItemHeight + ]); + return /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("div", { + style: $ed43cc03b55b9961$var$viewportStyle, + ref: viewportRef, + "data-viewport-type": "element" + }, children); +}; +const $ed43cc03b55b9961$var$WindowViewport$2 = ({ children: children })=>{ + const ctx = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useContext($ed43cc03b55b9961$export$99e9d54e386aea7b); + const windowViewportRect = $ed43cc03b55b9961$var$usePublisher$2("windowViewportRect"); + const fixedItemHeight = $ed43cc03b55b9961$var$usePublisher$2("fixedItemHeight"); + const customScrollParent = $ed43cc03b55b9961$var$useEmitterValue$2("customScrollParent"); + const viewportRef = $ed43cc03b55b9961$var$useWindowViewportRectRef(windowViewportRect, customScrollParent); + (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useEffect(()=>{ + if (ctx) { + fixedItemHeight(ctx.itemHeight); + windowViewportRect({ + offsetTop: 0, + visibleHeight: ctx.viewportHeight, + visibleWidth: 100 + }); + } + }, [ + ctx, + windowViewportRect, + fixedItemHeight + ]); + return /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("div", { + ref: viewportRef, + style: $ed43cc03b55b9961$var$viewportStyle, + "data-viewport-type": "window" + }, children); +}; +const $ed43cc03b55b9961$var$TopItemListContainer = ({ children: children })=>{ + const TopItemList = $ed43cc03b55b9961$var$useEmitterValue$2("TopItemListComponent"); + const headerHeight = $ed43cc03b55b9961$var$useEmitterValue$2("headerHeight"); + const style = { + ...$ed43cc03b55b9961$var$topItemListStyle, + marginTop: `${headerHeight}px` + }; + const context = $ed43cc03b55b9961$var$useEmitterValue$2("context"); + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TopItemList || "div", { + style: style, + context: context + }, children); +}; +const $ed43cc03b55b9961$var$ListRoot = /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function VirtuosoRoot(props) { + const useWindowScroll = $ed43cc03b55b9961$var$useEmitterValue$2("useWindowScroll"); + const showTopList = $ed43cc03b55b9961$var$useEmitterValue$2("topItemsIndexes").length > 0; + const customScrollParent = $ed43cc03b55b9961$var$useEmitterValue$2("customScrollParent"); + const TheScroller = customScrollParent || useWindowScroll ? $ed43cc03b55b9961$var$WindowScroller$2 : $ed43cc03b55b9961$var$Scroller$2; + const TheViewport = customScrollParent || useWindowScroll ? $ed43cc03b55b9961$var$WindowViewport$2 : $ed43cc03b55b9961$var$Viewport$2; + return /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TheScroller, { + ...props + }, showTopList && /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($ed43cc03b55b9961$var$TopItemListContainer, null, /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($ed43cc03b55b9961$var$Items$1, { + showTopList: true + })), /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TheViewport, null, /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($ed43cc03b55b9961$var$Header$1, null), /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($ed43cc03b55b9961$var$Items$1, null), /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($ed43cc03b55b9961$var$Footer$1, null))); +}); +const { Component: $ed43cc03b55b9961$var$List, usePublisher: $ed43cc03b55b9961$var$usePublisher$2, useEmitterValue: $ed43cc03b55b9961$var$useEmitterValue$2, useEmitter: $ed43cc03b55b9961$var$useEmitter$2 } = /* @__PURE__ */ $ed43cc03b55b9961$var$systemToComponent($ed43cc03b55b9961$var$combinedSystem$2, { + required: {}, + optional: { + restoreStateFrom: "restoreStateFrom", + context: "context", + followOutput: "followOutput", + itemContent: "itemContent", + groupContent: "groupContent", + overscan: "overscan", + increaseViewportBy: "increaseViewportBy", + totalCount: "totalCount", + groupCounts: "groupCounts", + topItemCount: "topItemCount", + firstItemIndex: "firstItemIndex", + initialTopMostItemIndex: "initialTopMostItemIndex", + components: "components", + atBottomThreshold: "atBottomThreshold", + atTopThreshold: "atTopThreshold", + computeItemKey: "computeItemKey", + defaultItemHeight: "defaultItemHeight", + fixedItemHeight: "fixedItemHeight", + itemSize: "itemSize", + scrollSeekConfiguration: "scrollSeekConfiguration", + headerFooterTag: "headerFooterTag", + data: "data", + initialItemCount: "initialItemCount", + initialScrollTop: "initialScrollTop", + alignToBottom: "alignToBottom", + useWindowScroll: "useWindowScroll", + customScrollParent: "customScrollParent", + scrollerRef: "scrollerRef", + logLevel: "logLevel" + }, + methods: { + scrollToIndex: "scrollToIndex", + scrollIntoView: "scrollIntoView", + scrollTo: "scrollTo", + scrollBy: "scrollBy", + autoscrollToBottom: "autoscrollToBottom", + getState: "getState" + }, + events: { + isScrolling: "isScrolling", + endReached: "endReached", + startReached: "startReached", + rangeChanged: "rangeChanged", + atBottomStateChange: "atBottomStateChange", + atTopStateChange: "atTopStateChange", + totalListHeightChanged: "totalListHeightChanged", + itemsRendered: "itemsRendered", + groupIndices: "groupIndices" + } +}, $ed43cc03b55b9961$var$ListRoot); +const $ed43cc03b55b9961$var$Scroller$2 = /* @__PURE__ */ $ed43cc03b55b9961$var$buildScroller({ + usePublisher: $ed43cc03b55b9961$var$usePublisher$2, + useEmitterValue: $ed43cc03b55b9961$var$useEmitterValue$2, + useEmitter: $ed43cc03b55b9961$var$useEmitter$2 +}); +const $ed43cc03b55b9961$var$WindowScroller$2 = /* @__PURE__ */ $ed43cc03b55b9961$var$buildWindowScroller({ + usePublisher: $ed43cc03b55b9961$var$usePublisher$2, + useEmitterValue: $ed43cc03b55b9961$var$useEmitterValue$2, + useEmitter: $ed43cc03b55b9961$var$useEmitter$2 +}); +const $ed43cc03b55b9961$export$ea50ab61e1198ee3 = $ed43cc03b55b9961$var$List; +const $ed43cc03b55b9961$export$41737384f976dee3 = $ed43cc03b55b9961$var$List; +const $ed43cc03b55b9961$var$INITIAL_GRID_STATE = { + items: [], + offsetBottom: 0, + offsetTop: 0, + top: 0, + bottom: 0, + itemHeight: 0, + itemWidth: 0 +}; +const $ed43cc03b55b9961$var$PROBE_GRID_STATE = { + items: [ + { + index: 0 + } + ], + offsetBottom: 0, + offsetTop: 0, + top: 0, + bottom: 0, + itemHeight: 0, + itemWidth: 0 +}; +const { round: $ed43cc03b55b9961$var$round, ceil: $ed43cc03b55b9961$var$ceil, floor: $ed43cc03b55b9961$var$floor, min: $ed43cc03b55b9961$var$min, max: $ed43cc03b55b9961$var$max } = Math; +function $ed43cc03b55b9961$var$buildProbeGridState(items) { + return { + ...$ed43cc03b55b9961$var$PROBE_GRID_STATE, + items: items + }; +} +function $ed43cc03b55b9961$var$buildItems(startIndex, endIndex, data) { + return Array.from({ + length: endIndex - startIndex + 1 + }).map((_, i)=>{ + const dataItem = data === null ? null : data[i + startIndex]; + return { + index: i + startIndex, + data: dataItem + }; + }); +} +function $ed43cc03b55b9961$var$gapComparator(prev, next) { + return prev && prev.column === next.column && prev.row === next.row; +} +function $ed43cc03b55b9961$var$dimensionComparator(prev, next) { + return prev && prev.width === next.width && prev.height === next.height; +} +const $ed43cc03b55b9961$var$gridSystem = /* @__PURE__ */ $ed43cc03b55b9961$var$system(([{ overscan: overscan, visibleRange: visibleRange, listBoundary: listBoundary }, { scrollTop: scrollTop, viewportHeight: viewportHeight, scrollBy: scrollBy, scrollTo: scrollTo, smoothScrollTargetReached: smoothScrollTargetReached, scrollContainerState: scrollContainerState, footerHeight: footerHeight, headerHeight: headerHeight }, stateFlags, scrollSeek, { propsReady: propsReady, didMount: didMount }, { windowViewportRect: windowViewportRect, useWindowScroll: useWindowScroll, customScrollParent: customScrollParent, windowScrollContainerState: windowScrollContainerState, windowScrollTo: windowScrollTo }, log])=>{ + const totalCount = $ed43cc03b55b9961$var$statefulStream(0); + const initialItemCount = $ed43cc03b55b9961$var$statefulStream(0); + const gridState = $ed43cc03b55b9961$var$statefulStream($ed43cc03b55b9961$var$INITIAL_GRID_STATE); + const viewportDimensions = $ed43cc03b55b9961$var$statefulStream({ + height: 0, + width: 0 + }); + const itemDimensions = $ed43cc03b55b9961$var$statefulStream({ + height: 0, + width: 0 + }); + const scrollToIndex = $ed43cc03b55b9961$var$stream(); + const scrollHeight = $ed43cc03b55b9961$var$stream(); + const deviation = $ed43cc03b55b9961$var$statefulStream(0); + const data = $ed43cc03b55b9961$var$statefulStream(null); + const gap = $ed43cc03b55b9961$var$statefulStream({ + row: 0, + column: 0 + }); + const stateChanged = $ed43cc03b55b9961$var$stream(); + const restoreStateFrom = $ed43cc03b55b9961$var$stream(); + const stateRestoreInProgress = $ed43cc03b55b9961$var$statefulStream(false); + const initialTopMostItemIndex = $ed43cc03b55b9961$var$statefulStream(0); + const scrolledToInitialItem = $ed43cc03b55b9961$var$statefulStream(true); + const scrollScheduled = $ed43cc03b55b9961$var$statefulStream(false); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe(didMount, $ed43cc03b55b9961$var$withLatestFrom(initialTopMostItemIndex), $ed43cc03b55b9961$var$filter(([_, location])=>!!location)), ()=>{ + $ed43cc03b55b9961$var$publish(scrolledToInitialItem, false); + $ed43cc03b55b9961$var$publish(initialItemCount, 0); + }); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest(didMount, scrolledToInitialItem, itemDimensions, viewportDimensions, initialTopMostItemIndex, scrollScheduled), $ed43cc03b55b9961$var$filter(([didMount2, scrolledToInitialItem2, itemDimensions2, viewportDimensions2, , scrollScheduled2])=>{ + return didMount2 && !scrolledToInitialItem2 && itemDimensions2.height !== 0 && viewportDimensions2.height !== 0 && !scrollScheduled2; + })), ([, , , , initialTopMostItemIndex2])=>{ + $ed43cc03b55b9961$var$publish(scrollScheduled, true); + $ed43cc03b55b9961$var$skipFrames(1, ()=>{ + $ed43cc03b55b9961$var$publish(scrollToIndex, initialTopMostItemIndex2); + }); + $ed43cc03b55b9961$var$handleNext($ed43cc03b55b9961$var$pipe(scrollTop), ()=>{ + $ed43cc03b55b9961$var$publish(listBoundary, [ + 0, + 0 + ]); + $ed43cc03b55b9961$var$publish(scrolledToInitialItem, true); + }); + }); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(restoreStateFrom, $ed43cc03b55b9961$var$filter((value)=>value !== void 0 && value !== null && value.scrollTop > 0), $ed43cc03b55b9961$var$mapTo(0)), initialItemCount); + $ed43cc03b55b9961$var$subscribe($ed43cc03b55b9961$var$pipe(didMount, $ed43cc03b55b9961$var$withLatestFrom(restoreStateFrom), $ed43cc03b55b9961$var$filter(([, snapshot])=>snapshot !== void 0 && snapshot !== null)), ([, snapshot])=>{ + if (!snapshot) return; + $ed43cc03b55b9961$var$publish(viewportDimensions, snapshot.viewport), $ed43cc03b55b9961$var$publish(itemDimensions, snapshot == null ? void 0 : snapshot.item); + $ed43cc03b55b9961$var$publish(gap, snapshot.gap); + if (snapshot.scrollTop > 0) { + $ed43cc03b55b9961$var$publish(stateRestoreInProgress, true); + $ed43cc03b55b9961$var$handleNext($ed43cc03b55b9961$var$pipe(scrollTop, $ed43cc03b55b9961$var$skip(1)), (_value)=>{ + $ed43cc03b55b9961$var$publish(stateRestoreInProgress, false); + }); + $ed43cc03b55b9961$var$publish(scrollTo, { + top: snapshot.scrollTop + }); + } + }); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(viewportDimensions, $ed43cc03b55b9961$var$map(({ height: height })=>height)), viewportHeight); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest($ed43cc03b55b9961$var$duc(viewportDimensions, $ed43cc03b55b9961$var$dimensionComparator), $ed43cc03b55b9961$var$duc(itemDimensions, $ed43cc03b55b9961$var$dimensionComparator), $ed43cc03b55b9961$var$duc(gap, (prev, next)=>prev && prev.column === next.column && prev.row === next.row), $ed43cc03b55b9961$var$duc(scrollTop)), $ed43cc03b55b9961$var$map(([viewport, item, gap2, scrollTop2])=>({ + viewport: viewport, + item: item, + gap: gap2, + scrollTop: scrollTop2 + }))), stateChanged); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest($ed43cc03b55b9961$var$duc(totalCount), visibleRange, $ed43cc03b55b9961$var$duc(gap, $ed43cc03b55b9961$var$gapComparator), $ed43cc03b55b9961$var$duc(itemDimensions, $ed43cc03b55b9961$var$dimensionComparator), $ed43cc03b55b9961$var$duc(viewportDimensions, $ed43cc03b55b9961$var$dimensionComparator), $ed43cc03b55b9961$var$duc(data), $ed43cc03b55b9961$var$duc(initialItemCount), $ed43cc03b55b9961$var$duc(stateRestoreInProgress), $ed43cc03b55b9961$var$duc(scrolledToInitialItem), $ed43cc03b55b9961$var$duc(initialTopMostItemIndex)), $ed43cc03b55b9961$var$filter(([, , , , , , , stateRestoreInProgress2])=>{ + return !stateRestoreInProgress2; + }), $ed43cc03b55b9961$var$map(([totalCount2, [startOffset, endOffset], gap2, item, viewport, data2, initialItemCount2, , scrolledToInitialItem2, initialTopMostItemIndex2])=>{ + const { row: rowGap, column: columnGap } = gap2; + const { height: itemHeight, width: itemWidth } = item; + const { width: viewportWidth } = viewport; + if (initialItemCount2 === 0 && (totalCount2 === 0 || viewportWidth === 0)) return $ed43cc03b55b9961$var$INITIAL_GRID_STATE; + if (itemWidth === 0) { + const startIndex2 = $ed43cc03b55b9961$var$getInitialTopMostItemIndexNumber(initialTopMostItemIndex2, totalCount2); + const endIndex2 = startIndex2 === 0 ? Math.max(initialItemCount2 - 1, 0) : startIndex2; + return $ed43cc03b55b9961$var$buildProbeGridState($ed43cc03b55b9961$var$buildItems(startIndex2, endIndex2, data2)); + } + const perRow = $ed43cc03b55b9961$var$itemsPerRow(viewportWidth, itemWidth, columnGap); + let startIndex; + let endIndex; + if (!scrolledToInitialItem2) { + startIndex = 0; + endIndex = -1; + } else if (startOffset === 0 && endOffset === 0 && initialItemCount2 > 0) { + startIndex = 0; + endIndex = initialItemCount2 - 1; + } else { + startIndex = perRow * $ed43cc03b55b9961$var$floor((startOffset + rowGap) / (itemHeight + rowGap)); + endIndex = perRow * $ed43cc03b55b9961$var$ceil((endOffset + rowGap) / (itemHeight + rowGap)) - 1; + endIndex = $ed43cc03b55b9961$var$min(totalCount2 - 1, $ed43cc03b55b9961$var$max(endIndex, perRow - 1)); + startIndex = $ed43cc03b55b9961$var$min(endIndex, $ed43cc03b55b9961$var$max(0, startIndex)); + } + const items = $ed43cc03b55b9961$var$buildItems(startIndex, endIndex, data2); + const { top: top, bottom: bottom } = $ed43cc03b55b9961$var$gridLayout(viewport, gap2, item, items); + const rowCount = $ed43cc03b55b9961$var$ceil(totalCount2 / perRow); + const totalHeight = rowCount * itemHeight + (rowCount - 1) * rowGap; + const offsetBottom = totalHeight - bottom; + return { + items: items, + offsetTop: top, + offsetBottom: offsetBottom, + top: top, + bottom: bottom, + itemHeight: itemHeight, + itemWidth: itemWidth + }; + })), gridState); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(data, $ed43cc03b55b9961$var$filter((data2)=>data2 !== null), $ed43cc03b55b9961$var$map((data2)=>data2.length)), totalCount); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$combineLatest(viewportDimensions, itemDimensions, gridState, gap), $ed43cc03b55b9961$var$filter(([viewportDimensions2, itemDimensions2, { items: items }])=>{ + return items.length > 0 && itemDimensions2.height !== 0 && viewportDimensions2.height !== 0; + }), $ed43cc03b55b9961$var$map(([viewportDimensions2, itemDimensions2, { items: items }, gap2])=>{ + const { top: top, bottom: bottom } = $ed43cc03b55b9961$var$gridLayout(viewportDimensions2, gap2, itemDimensions2, items); + return [ + top, + bottom + ]; + }), $ed43cc03b55b9961$var$distinctUntilChanged($ed43cc03b55b9961$var$tupleComparator)), listBoundary); + const hasScrolled = $ed43cc03b55b9961$var$statefulStream(false); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(scrollTop, $ed43cc03b55b9961$var$withLatestFrom(hasScrolled), $ed43cc03b55b9961$var$map(([scrollTop2, hasScrolled2])=>{ + return hasScrolled2 || scrollTop2 !== 0; + })), hasScrolled); + const endReached = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$duc(gridState), $ed43cc03b55b9961$var$filter(({ items: items })=>items.length > 0), $ed43cc03b55b9961$var$withLatestFrom(totalCount, hasScrolled), $ed43cc03b55b9961$var$filter(([{ items: items }, totalCount2, hasScrolled2])=>hasScrolled2 && items[items.length - 1].index === totalCount2 - 1), $ed43cc03b55b9961$var$map(([, totalCount2])=>totalCount2 - 1), $ed43cc03b55b9961$var$distinctUntilChanged())); + const startReached = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$duc(gridState), $ed43cc03b55b9961$var$filter(({ items: items })=>{ + return items.length > 0 && items[0].index === 0; + }), // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + $ed43cc03b55b9961$var$mapTo(0), $ed43cc03b55b9961$var$distinctUntilChanged())); + const rangeChanged = $ed43cc03b55b9961$var$streamFromEmitter($ed43cc03b55b9961$var$pipe($ed43cc03b55b9961$var$duc(gridState), $ed43cc03b55b9961$var$withLatestFrom(stateRestoreInProgress), $ed43cc03b55b9961$var$filter(([{ items: items }, stateRestoreInProgress2])=>items.length > 0 && !stateRestoreInProgress2), $ed43cc03b55b9961$var$map(([{ items: items }])=>{ + return { + startIndex: items[0].index, + endIndex: items[items.length - 1].index + }; + }), $ed43cc03b55b9961$var$distinctUntilChanged($ed43cc03b55b9961$var$rangeComparator), $ed43cc03b55b9961$var$throttleTime(0))); + $ed43cc03b55b9961$var$connect(rangeChanged, scrollSeek.scrollSeekRangeChanged); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(scrollToIndex, $ed43cc03b55b9961$var$withLatestFrom(viewportDimensions, itemDimensions, totalCount, gap), $ed43cc03b55b9961$var$map(([location, viewportDimensions2, itemDimensions2, totalCount2, gap2])=>{ + const normalLocation = $ed43cc03b55b9961$var$normalizeIndexLocation(location); + const { align: align, behavior: behavior, offset: offset } = normalLocation; + let index = normalLocation.index; + if (index === "LAST") index = totalCount2 - 1; + index = $ed43cc03b55b9961$var$max(0, index, $ed43cc03b55b9961$var$min(totalCount2 - 1, index)); + let top = $ed43cc03b55b9961$var$itemTop(viewportDimensions2, gap2, itemDimensions2, index); + if (align === "end") top = $ed43cc03b55b9961$var$round(top - viewportDimensions2.height + itemDimensions2.height); + else if (align === "center") top = $ed43cc03b55b9961$var$round(top - viewportDimensions2.height / 2 + itemDimensions2.height / 2); + if (offset) top += offset; + return { + top: top, + behavior: behavior + }; + })), scrollTo); + const totalListHeight = $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe(gridState, $ed43cc03b55b9961$var$map((gridState2)=>{ + return gridState2.offsetBottom + gridState2.bottom; + })), 0); + $ed43cc03b55b9961$var$connect($ed43cc03b55b9961$var$pipe(windowViewportRect, $ed43cc03b55b9961$var$map((viewportInfo)=>({ + width: viewportInfo.visibleWidth, + height: viewportInfo.visibleHeight + }))), viewportDimensions); + return { + data: // input + data, + totalCount: totalCount, + viewportDimensions: viewportDimensions, + itemDimensions: itemDimensions, + scrollTop: scrollTop, + scrollHeight: scrollHeight, + overscan: overscan, + scrollBy: scrollBy, + scrollTo: scrollTo, + scrollToIndex: scrollToIndex, + smoothScrollTargetReached: smoothScrollTargetReached, + windowViewportRect: windowViewportRect, + windowScrollTo: windowScrollTo, + useWindowScroll: useWindowScroll, + customScrollParent: customScrollParent, + windowScrollContainerState: windowScrollContainerState, + deviation: deviation, + scrollContainerState: scrollContainerState, + footerHeight: footerHeight, + headerHeight: headerHeight, + initialItemCount: initialItemCount, + gap: gap, + restoreStateFrom: restoreStateFrom, + ...scrollSeek, + initialTopMostItemIndex: initialTopMostItemIndex, + gridState: // output + gridState, + totalListHeight: totalListHeight, + ...stateFlags, + startReached: startReached, + endReached: endReached, + rangeChanged: rangeChanged, + stateChanged: stateChanged, + propsReady: propsReady, + stateRestoreInProgress: stateRestoreInProgress, + ...log + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$sizeRangeSystem, $ed43cc03b55b9961$var$domIOSystem, $ed43cc03b55b9961$var$stateFlagsSystem, $ed43cc03b55b9961$var$scrollSeekSystem, $ed43cc03b55b9961$var$propsReadySystem, $ed43cc03b55b9961$var$windowScrollerSystem, $ed43cc03b55b9961$var$loggerSystem)); +function $ed43cc03b55b9961$var$gridLayout(viewport, gap, item, items) { + const { height: itemHeight } = item; + if (itemHeight === void 0 || items.length === 0) return { + top: 0, + bottom: 0 + }; + const top = $ed43cc03b55b9961$var$itemTop(viewport, gap, item, items[0].index); + const bottom = $ed43cc03b55b9961$var$itemTop(viewport, gap, item, items[items.length - 1].index) + itemHeight; + return { + top: top, + bottom: bottom + }; +} +function $ed43cc03b55b9961$var$itemTop(viewport, gap, item, index) { + const perRow = $ed43cc03b55b9961$var$itemsPerRow(viewport.width, item.width, gap.column); + const rowCount = $ed43cc03b55b9961$var$floor(index / perRow); + const top = rowCount * item.height + $ed43cc03b55b9961$var$max(0, rowCount - 1) * gap.row; + return top > 0 ? top + gap.row : top; +} +function $ed43cc03b55b9961$var$itemsPerRow(viewportWidth, itemWidth, gap) { + return $ed43cc03b55b9961$var$max(1, $ed43cc03b55b9961$var$floor((viewportWidth + gap) / ($ed43cc03b55b9961$var$floor(itemWidth) + gap))); +} +const $ed43cc03b55b9961$var$gridComponentPropsSystem = /* @__PURE__ */ $ed43cc03b55b9961$var$system(()=>{ + const itemContent = $ed43cc03b55b9961$var$statefulStream((index)=>`Item ${index}`); + const components = $ed43cc03b55b9961$var$statefulStream({}); + const context = $ed43cc03b55b9961$var$statefulStream(null); + const itemClassName = $ed43cc03b55b9961$var$statefulStream("virtuoso-grid-item"); + const listClassName = $ed43cc03b55b9961$var$statefulStream("virtuoso-grid-list"); + const computeItemKey = $ed43cc03b55b9961$var$statefulStream($ed43cc03b55b9961$var$identity); + const headerFooterTag = $ed43cc03b55b9961$var$statefulStream("div"); + const scrollerRef = $ed43cc03b55b9961$var$statefulStream($ed43cc03b55b9961$var$noop); + const distinctProp = (propName, defaultValue = null)=>{ + return $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe(components, $ed43cc03b55b9961$var$map((components2)=>components2[propName]), $ed43cc03b55b9961$var$distinctUntilChanged()), defaultValue); + }; + return { + context: context, + itemContent: itemContent, + components: components, + computeItemKey: computeItemKey, + itemClassName: itemClassName, + listClassName: listClassName, + headerFooterTag: headerFooterTag, + scrollerRef: scrollerRef, + FooterComponent: distinctProp("Footer"), + HeaderComponent: distinctProp("Header"), + ListComponent: distinctProp("List", "div"), + ItemComponent: distinctProp("Item", "div"), + ScrollerComponent: distinctProp("Scroller", "div"), + ScrollSeekPlaceholder: distinctProp("ScrollSeekPlaceholder", "div") + }; +}); +const $ed43cc03b55b9961$var$combinedSystem$1 = /* @__PURE__ */ $ed43cc03b55b9961$var$system(([gridSystem2, gridComponentPropsSystem2])=>{ + return { + ...gridSystem2, + ...gridComponentPropsSystem2 + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$gridSystem, $ed43cc03b55b9961$var$gridComponentPropsSystem)); +const $ed43cc03b55b9961$var$GridItems = /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function GridItems2() { + const gridState = $ed43cc03b55b9961$var$useEmitterValue$1("gridState"); + const listClassName = $ed43cc03b55b9961$var$useEmitterValue$1("listClassName"); + const itemClassName = $ed43cc03b55b9961$var$useEmitterValue$1("itemClassName"); + const itemContent = $ed43cc03b55b9961$var$useEmitterValue$1("itemContent"); + const computeItemKey = $ed43cc03b55b9961$var$useEmitterValue$1("computeItemKey"); + const isSeeking = $ed43cc03b55b9961$var$useEmitterValue$1("isSeeking"); + const scrollHeightCallback = $ed43cc03b55b9961$var$usePublisher$1("scrollHeight"); + const ItemComponent = $ed43cc03b55b9961$var$useEmitterValue$1("ItemComponent"); + const ListComponent = $ed43cc03b55b9961$var$useEmitterValue$1("ListComponent"); + const ScrollSeekPlaceholder = $ed43cc03b55b9961$var$useEmitterValue$1("ScrollSeekPlaceholder"); + const context = $ed43cc03b55b9961$var$useEmitterValue$1("context"); + const itemDimensions = $ed43cc03b55b9961$var$usePublisher$1("itemDimensions"); + const gridGap = $ed43cc03b55b9961$var$usePublisher$1("gap"); + const log = $ed43cc03b55b9961$var$useEmitterValue$1("log"); + const stateRestoreInProgress = $ed43cc03b55b9961$var$useEmitterValue$1("stateRestoreInProgress"); + const listRef = $ed43cc03b55b9961$var$useSize((el)=>{ + const scrollHeight = el.parentElement.parentElement.scrollHeight; + scrollHeightCallback(scrollHeight); + const firstItem = el.firstChild; + if (firstItem) { + const { width: width, height: height } = firstItem.getBoundingClientRect(); + itemDimensions({ + width: width, + height: height + }); + } + gridGap({ + row: $ed43cc03b55b9961$var$resolveGapValue("row-gap", getComputedStyle(el).rowGap, log), + column: $ed43cc03b55b9961$var$resolveGapValue("column-gap", getComputedStyle(el).columnGap, log) + }); + }); + if (stateRestoreInProgress) return null; + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(ListComponent, { + ref: listRef, + className: listClassName, + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(ListComponent, context), + style: { + paddingTop: gridState.offsetTop, + paddingBottom: gridState.offsetBottom + }, + "data-test-id": "virtuoso-item-list" + }, gridState.items.map((item)=>{ + const key = computeItemKey(item.index, item.data, context); + return isSeeking ? (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(ScrollSeekPlaceholder, { + key: key, + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(ScrollSeekPlaceholder, context), + index: item.index, + height: gridState.itemHeight, + width: gridState.itemWidth + }) : (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(ItemComponent, { + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(ItemComponent, context), + className: itemClassName, + "data-index": item.index, + key: key + }, itemContent(item.index, item.data, context)); + })); +}); +const $ed43cc03b55b9961$var$Header = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function VirtuosoHeader2() { + const Header2 = $ed43cc03b55b9961$var$useEmitterValue$1("HeaderComponent"); + const headerHeight = $ed43cc03b55b9961$var$usePublisher$1("headerHeight"); + const headerFooterTag = $ed43cc03b55b9961$var$useEmitterValue$1("headerFooterTag"); + const ref = $ed43cc03b55b9961$var$useSize((el)=>headerHeight($ed43cc03b55b9961$var$correctItemSize(el, "height"))); + const context = $ed43cc03b55b9961$var$useEmitterValue$1("context"); + return Header2 ? (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(headerFooterTag, { + ref: ref + }, (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(Header2, $ed43cc03b55b9961$var$contextPropIfNotDomElement(Header2, context))) : null; +}); +const $ed43cc03b55b9961$var$Footer = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function VirtuosoGridFooter() { + const Footer2 = $ed43cc03b55b9961$var$useEmitterValue$1("FooterComponent"); + const footerHeight = $ed43cc03b55b9961$var$usePublisher$1("footerHeight"); + const headerFooterTag = $ed43cc03b55b9961$var$useEmitterValue$1("headerFooterTag"); + const ref = $ed43cc03b55b9961$var$useSize((el)=>footerHeight($ed43cc03b55b9961$var$correctItemSize(el, "height"))); + const context = $ed43cc03b55b9961$var$useEmitterValue$1("context"); + return Footer2 ? (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(headerFooterTag, { + ref: ref + }, (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(Footer2, $ed43cc03b55b9961$var$contextPropIfNotDomElement(Footer2, context))) : null; +}); +const $ed43cc03b55b9961$var$Viewport$1 = ({ children: children })=>{ + const ctx = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useContext($ed43cc03b55b9961$export$81e3217b4b7a890f); + const itemDimensions = $ed43cc03b55b9961$var$usePublisher$1("itemDimensions"); + const viewportDimensions = $ed43cc03b55b9961$var$usePublisher$1("viewportDimensions"); + const viewportRef = $ed43cc03b55b9961$var$useSize((el)=>{ + viewportDimensions(el.getBoundingClientRect()); + }); + (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useEffect(()=>{ + if (ctx) { + viewportDimensions({ + height: ctx.viewportHeight, + width: ctx.viewportWidth + }); + itemDimensions({ + height: ctx.itemHeight, + width: ctx.itemWidth + }); + } + }, [ + ctx, + viewportDimensions, + itemDimensions + ]); + return /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("div", { + style: $ed43cc03b55b9961$var$viewportStyle, + ref: viewportRef + }, children); +}; +const $ed43cc03b55b9961$var$WindowViewport$1 = ({ children: children })=>{ + const ctx = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useContext($ed43cc03b55b9961$export$81e3217b4b7a890f); + const windowViewportRect = $ed43cc03b55b9961$var$usePublisher$1("windowViewportRect"); + const itemDimensions = $ed43cc03b55b9961$var$usePublisher$1("itemDimensions"); + const customScrollParent = $ed43cc03b55b9961$var$useEmitterValue$1("customScrollParent"); + const viewportRef = $ed43cc03b55b9961$var$useWindowViewportRectRef(windowViewportRect, customScrollParent); + (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useEffect(()=>{ + if (ctx) { + itemDimensions({ + height: ctx.itemHeight, + width: ctx.itemWidth + }); + windowViewportRect({ + offsetTop: 0, + visibleHeight: ctx.viewportHeight, + visibleWidth: ctx.viewportWidth + }); + } + }, [ + ctx, + windowViewportRect, + itemDimensions + ]); + return /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("div", { + ref: viewportRef, + style: $ed43cc03b55b9961$var$viewportStyle + }, children); +}; +const $ed43cc03b55b9961$var$GridRoot = /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function GridRoot2({ ...props }) { + const useWindowScroll = $ed43cc03b55b9961$var$useEmitterValue$1("useWindowScroll"); + const customScrollParent = $ed43cc03b55b9961$var$useEmitterValue$1("customScrollParent"); + const TheScroller = customScrollParent || useWindowScroll ? $ed43cc03b55b9961$var$WindowScroller$1 : $ed43cc03b55b9961$var$Scroller$1; + const TheViewport = customScrollParent || useWindowScroll ? $ed43cc03b55b9961$var$WindowViewport$1 : $ed43cc03b55b9961$var$Viewport$1; + return /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TheScroller, { + ...props + }, /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TheViewport, null, /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($ed43cc03b55b9961$var$Header, null), /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($ed43cc03b55b9961$var$GridItems, null), /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($ed43cc03b55b9961$var$Footer, null))); +}); +const { Component: $ed43cc03b55b9961$var$Grid, usePublisher: $ed43cc03b55b9961$var$usePublisher$1, useEmitterValue: $ed43cc03b55b9961$var$useEmitterValue$1, useEmitter: $ed43cc03b55b9961$var$useEmitter$1 } = /* @__PURE__ */ $ed43cc03b55b9961$var$systemToComponent($ed43cc03b55b9961$var$combinedSystem$1, { + optional: { + context: "context", + totalCount: "totalCount", + overscan: "overscan", + itemContent: "itemContent", + components: "components", + computeItemKey: "computeItemKey", + data: "data", + initialItemCount: "initialItemCount", + scrollSeekConfiguration: "scrollSeekConfiguration", + headerFooterTag: "headerFooterTag", + listClassName: "listClassName", + itemClassName: "itemClassName", + useWindowScroll: "useWindowScroll", + customScrollParent: "customScrollParent", + scrollerRef: "scrollerRef", + logLevel: "logLevel", + restoreStateFrom: "restoreStateFrom", + initialTopMostItemIndex: "initialTopMostItemIndex" + }, + methods: { + scrollTo: "scrollTo", + scrollBy: "scrollBy", + scrollToIndex: "scrollToIndex" + }, + events: { + isScrolling: "isScrolling", + endReached: "endReached", + startReached: "startReached", + rangeChanged: "rangeChanged", + atBottomStateChange: "atBottomStateChange", + atTopStateChange: "atTopStateChange", + stateChanged: "stateChanged" + } +}, $ed43cc03b55b9961$var$GridRoot); +const $ed43cc03b55b9961$var$Scroller$1 = /* @__PURE__ */ $ed43cc03b55b9961$var$buildScroller({ + usePublisher: $ed43cc03b55b9961$var$usePublisher$1, + useEmitterValue: $ed43cc03b55b9961$var$useEmitterValue$1, + useEmitter: $ed43cc03b55b9961$var$useEmitter$1 +}); +const $ed43cc03b55b9961$var$WindowScroller$1 = /* @__PURE__ */ $ed43cc03b55b9961$var$buildWindowScroller({ + usePublisher: $ed43cc03b55b9961$var$usePublisher$1, + useEmitterValue: $ed43cc03b55b9961$var$useEmitterValue$1, + useEmitter: $ed43cc03b55b9961$var$useEmitter$1 +}); +function $ed43cc03b55b9961$var$resolveGapValue(property, value, log) { + if (value !== "normal" && !(value == null ? void 0 : value.endsWith("px"))) log(`${property} was not resolved to pixel value correctly`, value, $ed43cc03b55b9961$export$243e62d78d3b544d.WARN); + if (value === "normal") return 0; + return parseInt(value != null ? value : "0", 10); +} +const $ed43cc03b55b9961$export$eef3fd285144b65e = $ed43cc03b55b9961$var$Grid; +const $ed43cc03b55b9961$var$tableComponentPropsSystem = /* @__PURE__ */ $ed43cc03b55b9961$var$system(()=>{ + const itemContent = $ed43cc03b55b9961$var$statefulStream((index)=>/* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("td", null, "Item $", index)); + const context = $ed43cc03b55b9961$var$statefulStream(null); + const fixedHeaderContent = $ed43cc03b55b9961$var$statefulStream(null); + const fixedFooterContent = $ed43cc03b55b9961$var$statefulStream(null); + const components = $ed43cc03b55b9961$var$statefulStream({}); + const computeItemKey = $ed43cc03b55b9961$var$statefulStream($ed43cc03b55b9961$var$identity); + const scrollerRef = $ed43cc03b55b9961$var$statefulStream($ed43cc03b55b9961$var$noop); + const distinctProp = (propName, defaultValue = null)=>{ + return $ed43cc03b55b9961$var$statefulStreamFromEmitter($ed43cc03b55b9961$var$pipe(components, $ed43cc03b55b9961$var$map((components2)=>components2[propName]), $ed43cc03b55b9961$var$distinctUntilChanged()), defaultValue); + }; + return { + context: context, + itemContent: itemContent, + fixedHeaderContent: fixedHeaderContent, + fixedFooterContent: fixedFooterContent, + components: components, + computeItemKey: computeItemKey, + scrollerRef: scrollerRef, + TableComponent: distinctProp("Table", "table"), + TableHeadComponent: distinctProp("TableHead", "thead"), + TableFooterComponent: distinctProp("TableFoot", "tfoot"), + TableBodyComponent: distinctProp("TableBody", "tbody"), + TableRowComponent: distinctProp("TableRow", "tr"), + ScrollerComponent: distinctProp("Scroller", "div"), + EmptyPlaceholder: distinctProp("EmptyPlaceholder"), + ScrollSeekPlaceholder: distinctProp("ScrollSeekPlaceholder"), + FillerRow: distinctProp("FillerRow") + }; +}); +const $ed43cc03b55b9961$var$combinedSystem = /* @__PURE__ */ $ed43cc03b55b9961$var$system(([listSystem2, propsSystem])=>{ + return { + ...listSystem2, + ...propsSystem + }; +}, $ed43cc03b55b9961$var$tup($ed43cc03b55b9961$var$listSystem, $ed43cc03b55b9961$var$tableComponentPropsSystem)); +const $ed43cc03b55b9961$var$DefaultScrollSeekPlaceholder = ({ height: height })=>/* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("tr", null, /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("td", { + style: { + height: height + } + })); +const $ed43cc03b55b9961$var$DefaultFillerRow = ({ height: height })=>/* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("tr", null, /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("td", { + style: { + height: height, + padding: 0, + border: 0 + } + })); +const $ed43cc03b55b9961$var$ITEM_STYLE = { + overflowAnchor: "none" +}; +const $ed43cc03b55b9961$var$Items = /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function VirtuosoItems2() { + const listState = $ed43cc03b55b9961$var$useEmitterValue("listState"); + const sizeRanges = $ed43cc03b55b9961$var$usePublisher("sizeRanges"); + const useWindowScroll = $ed43cc03b55b9961$var$useEmitterValue("useWindowScroll"); + const customScrollParent = $ed43cc03b55b9961$var$useEmitterValue("customScrollParent"); + const windowScrollContainerStateCallback = $ed43cc03b55b9961$var$usePublisher("windowScrollContainerState"); + const _scrollContainerStateCallback = $ed43cc03b55b9961$var$usePublisher("scrollContainerState"); + const scrollContainerStateCallback = customScrollParent || useWindowScroll ? windowScrollContainerStateCallback : _scrollContainerStateCallback; + const itemContent = $ed43cc03b55b9961$var$useEmitterValue("itemContent"); + const trackItemSizes = $ed43cc03b55b9961$var$useEmitterValue("trackItemSizes"); + const itemSize = $ed43cc03b55b9961$var$useEmitterValue("itemSize"); + const log = $ed43cc03b55b9961$var$useEmitterValue("log"); + const { callbackRef: callbackRef, ref: ref } = $ed43cc03b55b9961$var$useChangedListContentsSizes(sizeRanges, itemSize, trackItemSizes, scrollContainerStateCallback, log, void 0, customScrollParent); + const [deviation, setDeviation] = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useState(0); + $ed43cc03b55b9961$var$useEmitter("deviation", (value)=>{ + if (deviation !== value) { + ref.current.style.marginTop = `${value}px`; + setDeviation(value); + } + }); + const EmptyPlaceholder = $ed43cc03b55b9961$var$useEmitterValue("EmptyPlaceholder"); + const ScrollSeekPlaceholder = $ed43cc03b55b9961$var$useEmitterValue("ScrollSeekPlaceholder") || $ed43cc03b55b9961$var$DefaultScrollSeekPlaceholder; + const FillerRow = $ed43cc03b55b9961$var$useEmitterValue("FillerRow") || $ed43cc03b55b9961$var$DefaultFillerRow; + const TableBodyComponent = $ed43cc03b55b9961$var$useEmitterValue("TableBodyComponent"); + const TableRowComponent = $ed43cc03b55b9961$var$useEmitterValue("TableRowComponent"); + const computeItemKey = $ed43cc03b55b9961$var$useEmitterValue("computeItemKey"); + const isSeeking = $ed43cc03b55b9961$var$useEmitterValue("isSeeking"); + const paddingTopAddition = $ed43cc03b55b9961$var$useEmitterValue("paddingTopAddition"); + const firstItemIndex = $ed43cc03b55b9961$var$useEmitterValue("firstItemIndex"); + const statefulTotalCount = $ed43cc03b55b9961$var$useEmitterValue("statefulTotalCount"); + const context = $ed43cc03b55b9961$var$useEmitterValue("context"); + if (statefulTotalCount === 0 && EmptyPlaceholder) return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(EmptyPlaceholder, $ed43cc03b55b9961$var$contextPropIfNotDomElement(EmptyPlaceholder, context)); + const paddingTop = listState.offsetTop + paddingTopAddition + deviation; + const paddingBottom = listState.offsetBottom; + const paddingTopEl = paddingTop > 0 ? /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(FillerRow, { + height: paddingTop, + key: "padding-top", + context: context + }) : null; + const paddingBottomEl = paddingBottom > 0 ? /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(FillerRow, { + height: paddingBottom, + key: "padding-bottom", + context: context + }) : null; + const items = listState.items.map((item)=>{ + const index = item.originalIndex; + const key = computeItemKey(index + firstItemIndex, item.data, context); + if (isSeeking) return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(ScrollSeekPlaceholder, { + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(ScrollSeekPlaceholder, context), + key: key, + index: item.index, + height: item.size, + type: item.type || "item" + }); + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TableRowComponent, { + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(TableRowComponent, context), + ...$ed43cc03b55b9961$var$itemPropIfNotDomElement(TableRowComponent, item.data), + key: key, + "data-index": index, + "data-known-size": item.size, + "data-item-index": item.index, + style: $ed43cc03b55b9961$var$ITEM_STYLE + }, itemContent(item.index, item.data, context)); + }); + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TableBodyComponent, { + ref: callbackRef, + "data-test-id": "virtuoso-item-list", + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(TableBodyComponent, context) + }, [ + paddingTopEl, + ...items, + paddingBottomEl + ]); +}); +const $ed43cc03b55b9961$var$Viewport = ({ children: children })=>{ + const ctx = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useContext($ed43cc03b55b9961$export$99e9d54e386aea7b); + const viewportHeight = $ed43cc03b55b9961$var$usePublisher("viewportHeight"); + const fixedItemHeight = $ed43cc03b55b9961$var$usePublisher("fixedItemHeight"); + const viewportRef = $ed43cc03b55b9961$var$useSize($ed43cc03b55b9961$var$compose(viewportHeight, (el)=>$ed43cc03b55b9961$var$correctItemSize(el, "height"))); + (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useEffect(()=>{ + if (ctx) { + viewportHeight(ctx.viewportHeight); + fixedItemHeight(ctx.itemHeight); + } + }, [ + ctx, + viewportHeight, + fixedItemHeight + ]); + return /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("div", { + style: $ed43cc03b55b9961$var$viewportStyle, + ref: viewportRef, + "data-viewport-type": "element" + }, children); +}; +const $ed43cc03b55b9961$var$WindowViewport = ({ children: children })=>{ + const ctx = (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useContext($ed43cc03b55b9961$export$99e9d54e386aea7b); + const windowViewportRect = $ed43cc03b55b9961$var$usePublisher("windowViewportRect"); + const fixedItemHeight = $ed43cc03b55b9961$var$usePublisher("fixedItemHeight"); + const customScrollParent = $ed43cc03b55b9961$var$useEmitterValue("customScrollParent"); + const viewportRef = $ed43cc03b55b9961$var$useWindowViewportRectRef(windowViewportRect, customScrollParent); + (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useEffect(()=>{ + if (ctx) { + fixedItemHeight(ctx.itemHeight); + windowViewportRect({ + offsetTop: 0, + visibleHeight: ctx.viewportHeight, + visibleWidth: 100 + }); + } + }, [ + ctx, + windowViewportRect, + fixedItemHeight + ]); + return /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("div", { + ref: viewportRef, + style: $ed43cc03b55b9961$var$viewportStyle, + "data-viewport-type": "window" + }, children); +}; +const $ed43cc03b55b9961$var$TableRoot = /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).memo(function TableVirtuosoRoot(props) { + const useWindowScroll = $ed43cc03b55b9961$var$useEmitterValue("useWindowScroll"); + const customScrollParent = $ed43cc03b55b9961$var$useEmitterValue("customScrollParent"); + const fixedHeaderHeight = $ed43cc03b55b9961$var$usePublisher("fixedHeaderHeight"); + const fixedFooterHeight = $ed43cc03b55b9961$var$usePublisher("fixedFooterHeight"); + const fixedHeaderContent = $ed43cc03b55b9961$var$useEmitterValue("fixedHeaderContent"); + const fixedFooterContent = $ed43cc03b55b9961$var$useEmitterValue("fixedFooterContent"); + const context = $ed43cc03b55b9961$var$useEmitterValue("context"); + const theadRef = $ed43cc03b55b9961$var$useSize($ed43cc03b55b9961$var$compose(fixedHeaderHeight, (el)=>$ed43cc03b55b9961$var$correctItemSize(el, "height"))); + const tfootRef = $ed43cc03b55b9961$var$useSize($ed43cc03b55b9961$var$compose(fixedFooterHeight, (el)=>$ed43cc03b55b9961$var$correctItemSize(el, "height"))); + const TheScroller = customScrollParent || useWindowScroll ? $ed43cc03b55b9961$var$WindowScroller : $ed43cc03b55b9961$var$Scroller; + const TheViewport = customScrollParent || useWindowScroll ? $ed43cc03b55b9961$var$WindowViewport : $ed43cc03b55b9961$var$Viewport; + const TheTable = $ed43cc03b55b9961$var$useEmitterValue("TableComponent"); + const TheTHead = $ed43cc03b55b9961$var$useEmitterValue("TableHeadComponent"); + const TheTFoot = $ed43cc03b55b9961$var$useEmitterValue("TableFooterComponent"); + const theHead = fixedHeaderContent ? (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TheTHead, { + key: "TableHead", + style: { + zIndex: 2, + position: "sticky", + top: 0 + }, + ref: theadRef, + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(TheTHead, context) + }, fixedHeaderContent()) : null; + const theFoot = fixedFooterContent ? (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TheTFoot, { + key: "TableFoot", + style: { + zIndex: 1, + position: "sticky", + bottom: 0 + }, + ref: tfootRef, + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(TheTFoot, context) + }, fixedFooterContent()) : null; + return /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TheScroller, { + ...props + }, /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TheViewport, null, (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement(TheTable, { + style: { + borderSpacing: 0, + overflowAnchor: "none" + }, + ...$ed43cc03b55b9961$var$contextPropIfNotDomElement(TheTable, context) + }, [ + theHead, + /* @__PURE__ */ (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($ed43cc03b55b9961$var$Items, { + key: "TableBody" + }), + theFoot + ]))); +}); +const { Component: $ed43cc03b55b9961$var$Table, usePublisher: $ed43cc03b55b9961$var$usePublisher, useEmitterValue: $ed43cc03b55b9961$var$useEmitterValue, useEmitter: $ed43cc03b55b9961$var$useEmitter } = /* @__PURE__ */ $ed43cc03b55b9961$var$systemToComponent($ed43cc03b55b9961$var$combinedSystem, { + required: {}, + optional: { + restoreStateFrom: "restoreStateFrom", + context: "context", + followOutput: "followOutput", + firstItemIndex: "firstItemIndex", + itemContent: "itemContent", + fixedHeaderContent: "fixedHeaderContent", + fixedFooterContent: "fixedFooterContent", + overscan: "overscan", + increaseViewportBy: "increaseViewportBy", + totalCount: "totalCount", + topItemCount: "topItemCount", + initialTopMostItemIndex: "initialTopMostItemIndex", + components: "components", + groupCounts: "groupCounts", + atBottomThreshold: "atBottomThreshold", + atTopThreshold: "atTopThreshold", + computeItemKey: "computeItemKey", + defaultItemHeight: "defaultItemHeight", + fixedItemHeight: "fixedItemHeight", + itemSize: "itemSize", + scrollSeekConfiguration: "scrollSeekConfiguration", + data: "data", + initialItemCount: "initialItemCount", + initialScrollTop: "initialScrollTop", + alignToBottom: "alignToBottom", + useWindowScroll: "useWindowScroll", + customScrollParent: "customScrollParent", + scrollerRef: "scrollerRef", + logLevel: "logLevel" + }, + methods: { + scrollToIndex: "scrollToIndex", + scrollIntoView: "scrollIntoView", + scrollTo: "scrollTo", + scrollBy: "scrollBy", + getState: "getState" + }, + events: { + isScrolling: "isScrolling", + endReached: "endReached", + startReached: "startReached", + rangeChanged: "rangeChanged", + atBottomStateChange: "atBottomStateChange", + atTopStateChange: "atTopStateChange", + totalListHeightChanged: "totalListHeightChanged", + itemsRendered: "itemsRendered", + groupIndices: "groupIndices" + } +}, $ed43cc03b55b9961$var$TableRoot); +const $ed43cc03b55b9961$var$Scroller = /* @__PURE__ */ $ed43cc03b55b9961$var$buildScroller({ + usePublisher: $ed43cc03b55b9961$var$usePublisher, + useEmitterValue: $ed43cc03b55b9961$var$useEmitterValue, + useEmitter: $ed43cc03b55b9961$var$useEmitter +}); +const $ed43cc03b55b9961$var$WindowScroller = /* @__PURE__ */ $ed43cc03b55b9961$var$buildWindowScroller({ + usePublisher: $ed43cc03b55b9961$var$usePublisher, + useEmitterValue: $ed43cc03b55b9961$var$useEmitterValue, + useEmitter: $ed43cc03b55b9961$var$useEmitter +}); +const $ed43cc03b55b9961$export$3631598018434e6e = $ed43cc03b55b9961$var$Table; + +}); + + +})(); +//# sourceMappingURL=Side.d0586ad5.js.map diff --git a/app/web/static/Side.fa071797.js b/app/web/static/Side.fa071797.js new file mode 100644 index 00000000..a1d8f379 --- /dev/null +++ b/app/web/static/Side.fa071797.js @@ -0,0 +1,12811 @@ +(() => { + +function $parcel$export(e, n, v, s) { + Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); +} + +function $parcel$interopDefault(a) { + return a && a.__esModule ? a.default : a; +} + + var $parcel$global = globalThis; + var parcelRequire = $parcel$global["parcelRequire2d1f"]; +var parcelRegister = parcelRequire.register; +parcelRegister("4RKhA", function(module, exports) { + +$parcel$export(module.exports, "ESide", () => $475d4bd78b640430$export$67a99baba9cd1fa0); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $8QizP = parcelRequire("8QizP"); + +var $aVHaH = parcelRequire("aVHaH"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $eS1Mm = parcelRequire("eS1Mm"); + +var $a7GGz = parcelRequire("a7GGz"); + +var $8l3Wa = parcelRequire("8l3Wa"); + +var $bwyLh = parcelRequire("bwyLh"); + +var $4BXR3 = parcelRequire("4BXR3"); + +var $9LESc = parcelRequire("9LESc"); + +var $j4Xk5 = parcelRequire("j4Xk5"); + +var $eGTfQ = parcelRequire("eGTfQ"); + +var $gYVef = parcelRequire("gYVef"); + +var $4KU0E = parcelRequire("4KU0E"); + +var $bhjA3 = parcelRequire("bhjA3"); + +var $9ABAk = parcelRequire("9ABAk"); +const $475d4bd78b640430$export$67a99baba9cd1fa0 = ()=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + const local = (0, $4WfNn.useLocal)({ + rootEditingProps: false, + lastActive: null + }); + p.softRender.side = local.render; + const update = (0, $63SH6.useCallback)((key, value)=>{ + if (p.item.active) { + const meta = p.treeMeta[p.item.active]; + if (meta) { + let mitem = meta.comp ? meta.comp.mcomp : meta.mitem; + mitem.doc?.transact(()=>{ + if (p.mode === "mobile") { + let mobile = mitem.get("mobile"); + if (!mobile) { + mitem.set("mobile", new $aVHaH.Map()); + mobile = mitem.get("mobile"); + } + mitem = mobile; + } + let prop = mitem?.get(key); + if (!prop) { + let nprop = null; + if (typeof value === "object") { + if (Array.isArray(value)) nprop = new $aVHaH.Array(); + else nprop = new $aVHaH.Map(); + } + if (mitem) { + mitem.set(key, nprop); + prop = mitem.get(key); + } + } + if (prop) (0, $8QizP.syncronize)(prop, value); + }); + } + } + }, [ + p.item.active + ]); + let meta = p.item.active ? p.treeMeta[p.item.active] : null; + if (!meta) return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("side flex select-none relative overflow-x-hidden overflow-y-auto p-3 text-sm items-center justify-center text-slate-500"), + children: "Please select an item" + }); + const item = meta.item; + const rootComponentID = p.comp?.id; + let compItem = item.component; + let isComponentRoot = false; + if (rootComponentID && rootComponentID === compItem?.id) { + compItem = undefined; + isComponentRoot = true; + } + let mitem = meta ? meta.mitem : null; + if (isComponentRoot && meta.comp) mitem = meta.comp.mcomp; + if (!isComponentRoot) { + local.rootEditingProps = false; + local.lastActive = null; + } + if (compItem && !compItem.props) { + const comp = mitem?.get("component"); + if (comp) comp.set("props", new $aVHaH.Map()); + } + let active = item; + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("side flex select-none relative overflow-x-hidden overflow-y-auto"), + onPointerEnter: ()=>{ + p.item.sideHover = true; + p.render(); + }, + onPointerLeave: ()=>{ + p.item.sideHover = false; + p.render(); + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "absolute inset-0 flex flex-col items-stretch justify-start text-[13px]", + children: mitem ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: compItem?.id ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $gYVef.CPInstance), { + mitem: mitem + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: rootComponentID && p.compProp.edit ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $4KU0E.CPMaster), { + mitem: mitem + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9ABAk.SideLabel), { + sep: "bottom", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex items-center justify-between", + children: !rootComponentID ? /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: "LAYOUT" + }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex mr-1 px-2 bg-white text-xs border rounded-sm cursor-pointer hover:bg-blue-50 hover:border-blue-500 text-blue-700 space-x-1", + onClick: (e)=>{ + e.preventDefault(); + e.stopPropagation(); + p.compProp.edit = true; + p.render(); + }, + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: "Edit Prop:" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-ellipsis font-bold", + children: meta.comp?.mcomp?.get("name") || meta.parent_comp?.item.name + }) + ] + }) + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $bhjA3.SideBox), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $a7GGz.PanelAutoLayout), { + value: active, + mode: p.mode, + update: update + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $eGTfQ.PanelPadding), { + id: p.item.active, + value: active, + mode: p.mode, + update: update + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $4BXR3.PanelDimension), { + value: active, + mode: p.mode, + id: p.item.active, + update: update + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9ABAk.SideLabel), { + children: "BACKGROUND" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bhjA3.SideBox), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $8l3Wa.PanelBackground), { + value: active, + mode: p.mode, + update: update + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9ABAk.SideLabel), { + children: "FONT" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bhjA3.SideBox), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9LESc.PanelFont), { + value: active, + mode: p.mode, + update: update + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9ABAk.SideLabel), { + children: "BORDER" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bhjA3.SideBox), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bwyLh.PanelBorder), { + value: active, + mode: p.mode, + update: update + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $9ABAk.SideLabel), { + children: "ADVANCED" + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $bhjA3.SideBox), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $j4Xk5.PanelLink), { + value: active, + mode: p.mode, + update: update + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $eS1Mm.PanelAdv), { + value: active, + mode: p.mode, + update: update + }) + ] + }) + ] + }) + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {}) + }) + }); +}; + +}); +parcelRegister("eS1Mm", function(module, exports) { + +$parcel$export(module.exports, "PanelAdv", () => $988c41acdccfaa16$export$4a8bb35652d5fce6); + +var $lAN3N = parcelRequire("lAN3N"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $6ai3B = parcelRequire("6ai3B"); +const $988c41acdccfaa16$export$4a8bb35652d5fce6 = ({ value: value, update: update })=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + const adv = p.mpage?.get("adv")?.toJSON() || {}; + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex items-stretch justify-between space-x-2", css` + button { + min-width: 0px; + } + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-white p-[2px] border flex flex-1 border-gray-300", css` + > * { + flex: 1; + } + `, !!adv.css && css` + button { + background: #e8ffe8; + border-bottom: solid green !important; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6ai3B.Button), { + onClick: ()=>{ + p.script.active = true; + p.script.type = "css"; + p.render(); + }, + appearance: "subtle", + children: "CSS" + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-white p-[2px] border flex flex-1 border-gray-300", css` + > * { + flex: 1; + } + `, !!adv.html && [ + css` + button { + background: #e8f5ff; + border-bottom: 2px solid blue !important; + } + ` + ]), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6ai3B.Button), { + onClick: ()=>{ + p.script.active = true; + p.script.type = "html"; + p.render(); + }, + appearance: "subtle", + children: "HTML" + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-white p-[2px] border flex flex-1 border-gray-300", css` + > * { + flex: 1; + } + `, !!adv.js && [ + css` + button { + background: #fff4e8; + border-bottom: 2px solid orange !important; + } + ` + ]), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6ai3B.Button), { + appearance: "subtle", + className: "js", + onClick: ()=>{ + p.script.active = true; + p.script.type = "js"; + p.render(); + }, + children: "JS" + }) + }) + ] + }) + }); +}; + +}); +parcelRegister("6ai3B", function(module, exports) { + +$parcel$export(module.exports, "Button", () => $3d101778ef5811d9$export$353f5b6fc5456de1); + +var $lAN3N = parcelRequire("lAN3N"); +const $3d101778ef5811d9$export$353f5b6fc5456de1 = ({ children: children, appearance: appearance, className: className, onClick: onClick })=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)("button", { + className: cx("transition-all flex items-center justify-center border select-none outline-none prasi-btn", css` + height: 25px; + width: 28px; + `, className, appearance !== "subtle" ? "bg-white border-[#d1d5db] hover:border-[#ccc] active:bg-[#d1d1d1] focus:border-[#ccc]" : "active:bg-[#d1d1d1] hover:bg-white hover:bg-opacity-50 cursor-pointer border-transparent hover:border-blue-100 focus:border-[#ccc]"), + onClick: onClick, + children: children + }); +}; + +}); + + +parcelRegister("a7GGz", function(module, exports) { + +$parcel$export(module.exports, "PanelAutoLayout", () => $3c8a82cfebb971cb$export$8f1fcd267da1c03c); + +var $lAN3N = parcelRequire("lAN3N"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $bTIRf = parcelRequire("bTIRf"); + +var $emJmR = parcelRequire("emJmR"); + +var $bjM6F = parcelRequire("bjM6F"); + +var $eClhP = parcelRequire("eClhP"); + +var $6ai3B = parcelRequire("6ai3B"); + +var $34isQ = parcelRequire("34isQ"); + +var $3M49X = parcelRequire("3M49X"); + +var $kGdHA = parcelRequire("kGdHA"); + +var $lvFnH = parcelRequire("lvFnH"); +const $3c8a82cfebb971cb$export$8f1fcd267da1c03c = ({ value: value, update: update, mode: mode })=>{ + const local = (0, $4WfNn.useLocal)({ + lastGap: 0, + open: false + }); + const layout = (0, $bjM6F.responsiveVal)(value, "layout", mode, { + dir: "col", + align: "top-left", + gap: 0, + wrap: "flex-nowrap" + }); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex items-stretch justify-between", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex flex-col items-stretch justify-around w-[125px] space-y-[5px]", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex flex-row space-x-1 items-center"), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx(`flex flex-row space-x-1 border ${"border-slate-300"} fg`, css` + padding-left: 1px; + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $eClhP.BoxSep), { + className: cx("justify-between my-0.5", css` + padding: 0px; + & > button { + min-width: 0px; + flex: 1; + padding: 2px 4px; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $34isQ.FieldBtnRadio), { + items: { + col: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Direction: Column", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)($3c8a82cfebb971cb$var$TapDown, {}) + }) + }), + row: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Direction: Row", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)($3c8a82cfebb971cb$var$TapRight, {}) + }) + }) + }, + value: layout.dir, + disabled: false, + update: (dir)=>{ + let align = layout.align; + if (layout.gap === "auto") { + if (dir.startsWith("col") && align === "top") align = "left"; + if (dir.startsWith("col") && align === "bottom") align = "right"; + if (dir.startsWith("row") && align === "left") align = "top"; + if (dir.startsWith("row") && align === "right") align = "bottom"; + } + update("layout", { + ...layout, + align: align, + dir: dir + }); + local.render(); + } + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), { + open: local.open, + onOpenChange: (open)=>{ + local.open = open; + local.render(); + }, + backdrop: false, + autoFocus: false, + popoverClassName: "rounded-md p-2 text-sm bg-white shadow-2xl border border-slate-300", + content: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex flex-col", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("p", { + children: "Direction" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $eClhP.BoxSep), { + className: cx("justify-between", css` + padding: 0px; + & > button { + min-width: 0px; + flex: 1; + padding: 2px 4px; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $34isQ.FieldBtnRadio), { + items: { + col: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Direction: Column", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)($3c8a82cfebb971cb$var$TapDown, {}) + }) + }), + "col-reverse": /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Direction: Column Reverse", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "rotate-180", + children: /*#__PURE__*/ (0, $lAN3N.jsx)($3c8a82cfebb971cb$var$TapDown, {}) + }) + }), + row: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Direction: Row", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)($3c8a82cfebb971cb$var$TapRight, {}) + }) + }), + "row-reverse": /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Direction: Row Reverse", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "rotate-180", + children: /*#__PURE__*/ (0, $lAN3N.jsx)($3c8a82cfebb971cb$var$TapRight, {}) + }) + }) + }, + value: layout.dir, + disabled: false, + update: (dir)=>{ + let align = layout.align; + if (layout.gap === "auto") { + if (dir.startsWith("col") && align === "top") align = "left"; + if (dir.startsWith("col") && align === "bottom") align = "right"; + if (dir.startsWith("row") && align === "left") align = "top"; + if (dir.startsWith("row") && align === "right") align = "bottom"; + } + update("layout", { + ...layout, + align: align, + dir: dir + }); + local.render(); + } + }) + }) + ] + }), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + onClick: ()=>{ + local.open = !local.open; + local.render(); + }, + className: `${false} h-full px-1 flex flew-row items-center justify-center border-l border-l-slate-300 hover:bg-blue-100 bg-white other cursor-pointer`, + children: /*#__PURE__*/ (0, $lAN3N.jsx)($3c8a82cfebb971cb$var$Down, {}) + }) + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: layout.wrap === "flex-wrap" ? "Flex Wrap" : "No Wrap", + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6ai3B.Button), { + className: cx("flex-1", css` + width: 28px !important; + min-width: 0px !important; + margin-left: 3px !important; + padding: 0px 5px !important; + height: 28px !important; + `, layout.dir.startsWith("col") && "rotate-90"), + onClick: ()=>{ + update("layout", { + ...layout, + wrap: layout.wrap === "flex-wrap" ? "flex-nowrap" : "flex-wrap" + }); + }, + children: layout.wrap !== "flex-wrap" ? /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "18", + height: "18", + fill: "none", + viewBox: "0 0 436 128", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M38.4 0A38.4 38.4 0 000 38.4v51.2A38.4 38.4 0 0038.4 128h51.2A38.401 38.401 0 00128 89.6V38.4A38.402 38.402 0 0089.6 0H38.4zM25.6 38.4a12.8 12.8 0 0112.8-12.8h51.2a12.8 12.8 0 0112.8 12.8v51.2a12.802 12.802 0 01-12.8 12.8H38.4a12.802 12.802 0 01-12.8-12.8V38.4zm128 0A38.402 38.402 0 01192 0h51.2a38.4 38.4 0 0138.4 38.4v51.2a38.401 38.401 0 01-38.4 38.4H192a38.402 38.402 0 01-38.4-38.4V38.4zM192 25.6a12.8 12.8 0 00-12.8 12.8v51.2a12.802 12.802 0 0012.8 12.8h51.2A12.8 12.8 0 00256 89.6V38.4a12.802 12.802 0 00-12.8-12.8H192zm115.2 12.8A38.402 38.402 0 01345.6 0h51.2a38.402 38.402 0 0138.4 38.4v51.2a38.401 38.401 0 01-38.4 38.4h-51.2a38.403 38.403 0 01-38.4-38.4V38.4zm38.4-12.8a12.8 12.8 0 00-12.8 12.8v51.2a12.802 12.802 0 0012.8 12.8h51.2a12.8 12.8 0 0012.8-12.8V38.4a12.802 12.802 0 00-12.8-12.8h-51.2z" + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "18", + height: "18", + viewBox: "0 0 20 20", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M3 4a1.5 1.5 0 00-1.5 1.5v2A1.5 1.5 0 003 9h2a1.5 1.5 0 001.5-1.5v-2A1.5 1.5 0 005 4H3zm-.5 1.5A.5.5 0 013 5h2a.5.5 0 01.5.5v2A.5.5 0 015 8H3a.5.5 0 01-.5-.5v-2zM3 10a1.5 1.5 0 00-1.5 1.5v2A1.5 1.5 0 003 15h2a1.5 1.5 0 001.5-1.5v-2A1.5 1.5 0 005 10H3zm-.5 1.5A.5.5 0 013 11h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5H3a.5.5 0 01-.5-.5v-2zm5-6A1.5 1.5 0 019 4h2a1.5 1.5 0 011.5 1.5v2A1.5 1.5 0 0111 9H9a1.5 1.5 0 01-1.5-1.5v-2zM9 5a.5.5 0 00-.5.5v2A.5.5 0 009 8h2a.5.5 0 00.5-.5v-2A.5.5 0 0011 5H9zm0 5a1.5 1.5 0 00-1.5 1.5v2A1.5 1.5 0 009 15h2a1.5 1.5 0 001.5-1.5v-2A1.5 1.5 0 0011 10H9zm-.5 1.5A.5.5 0 019 11h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5H9a.5.5 0 01-.5-.5v-2zm5-6A1.5 1.5 0 0115 4h2a1.5 1.5 0 011.5 1.5v2A1.5 1.5 0 0117 9h-2a1.5 1.5 0 01-1.5-1.5v-2zM15 5a.5.5 0 00-.5.5v2a.5.5 0 00.5.5h2a.5.5 0 00.5-.5v-2A.5.5 0 0017 5h-2zm0 5a1.5 1.5 0 00-1.5 1.5v2A1.5 1.5 0 0015 15h2a1.5 1.5 0 001.5-1.5v-2A1.5 1.5 0 0017 10h-2zm-.5 1.5a.5.5 0 01.5-.5h2a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2z" + }) + }) + }) + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex items-stretch justify-between", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Gap Size", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "border border-gray-300 max-w-[56px] h-[25px]", + children: layout.gap !== "auto" ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)($3c8a82cfebb971cb$var$GapIcon, { + layout: layout + }), + value: layout.gap + "px", + update: (val)=>{ + update("layout", { + ...layout, + gap: parseInt(val.replaceAll("px", "")) + }); + } + }) : /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $eClhP.BoxSep), { + className: "flex text-xs flex-1 bg-white", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)($3c8a82cfebb971cb$var$GapIcon, { + layout: layout + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx(css` + width: 90px; + flex: 1; + font-size: 12px; + color: #999; + `), + children: "Auto" + }) + ] + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + "Gap Mode:", + /*#__PURE__*/ (0, $lAN3N.jsx)("br", {}), + " Space Between / Packed" + ] + }), + children: /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $6ai3B.Button), { + className: cx("flex-1", css` + width: 30px; + min-width: 0px !important; + margin-left: 5px !important; + padding: 0 5px !important; + background: ${layout.gap === "auto" ? "#3c82f6" : "#fff"} !important; + + border-color: ${layout.gap === "auto" ? "#7baeff" : "#d1d1d1"} !important; + `), + onClick: ()=>{ + if (layout.gap !== "auto") local.lastGap = layout.gap; + const gap = layout.gap !== "auto" ? "auto" : local.lastGap; + let align = layout.align; + if (gap === "auto") { + if (align.includes("-")) align = "center"; + } else if (align === "top" || align === "bottom") align = "top-left"; + update("layout", { + ...layout, + align: align, + gap: gap + }); + }, + children: [ + layout.dir.startsWith("row") && /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: 14, + height: 6, + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M5.5 3a.375.375 0 0 1-.375.375H2.283l1.23 1.237a.36.36 0 0 1 0 .526.36.36 0 0 1-.526 0L1.112 3.263a.36.36 0 0 1 0-.526L2.987.863a.36.36 0 0 1 .526 0 .36.36 0 0 1 0 .524l-1.23 1.238h2.842A.375.375 0 0 1 5.5 3Zm7.387-.263L11.012.863a.36.36 0 0 0-.524 0 .359.359 0 0 0 0 .524l1.23 1.238H8.874a.375.375 0 0 0 0 .75h2.842l-1.23 1.237a.359.359 0 0 0 0 .526.36.36 0 0 0 .525 0l1.875-1.875a.359.359 0 0 0 0-.526Z", + fill: layout.gap === "auto" ? "#fff" : "#000" + }) + }), + layout.dir.startsWith("col") && /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: 6, + height: 14, + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M3 8.5a.375.375 0 0 1 .375.375v2.842l1.237-1.23a.359.359 0 0 1 .526 0 .36.36 0 0 1 0 .525l-1.875 1.875a.359.359 0 0 1-.526 0L.863 11.012a.36.36 0 0 1 0-.524.359.359 0 0 1 .524 0l1.238 1.23V8.874A.375.375 0 0 1 3 8.5Zm-.263-7.387L.863 2.988a.36.36 0 0 0 0 .525.36.36 0 0 0 .524 0l1.238-1.23v2.842a.375.375 0 0 0 .75 0V2.283l1.237 1.23a.36.36 0 0 0 .526 0 .36.36 0 0 0 0-.525L3.263 1.113a.36.36 0 0 0-.526 0Z", + fill: layout.gap === "auto" ? "#fff" : "#000" + }) + }) + ] + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + "Align Items:", + /*#__PURE__*/ (0, $lAN3N.jsx)("br", {}), + " Stretch / Normal" + ] + }), + children: /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $6ai3B.Button), { + className: cx("flex-1", css` + width: 30px; + min-width: 0px !important; + margin-left: 5px !important; + padding: 0 5px !important; + background: ${layout.align === "stretch" ? "#3c82f6" : "#fff"} !important; + + border-color: ${layout.align === "stretch" ? "#7baeff" : "#d1d1d1"} !important; + + color: ${layout.align === "stretch" ? "white" : "black"} !important; + `), + onClick: ()=>{ + let align = layout.align; + if (layout.align !== "stretch") align = "stretch"; + else align = "center"; + update("layout", { + ...layout, + align: align + }); + }, + children: [ + layout.align === "stretch" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: layout.dir.startsWith("row") ? /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M1 .5a.5.5 0 01.5-.5h12a.5.5 0 010 1h-12A.5.5 0 011 .5zM9 14V1H6v13H1.5a.5.5 0 000 1h12a.5.5 0 000-1H9z", + clipRule: "evenodd" + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M14.5 1a.5.5 0 00-.5.5V6H1V1.5a.5.5 0 10-1 0v12a.5.5 0 001 0V9h13v4.5a.5.5 0 101 0v-12a.5.5 0 00-.5-.5z", + clipRule: "evenodd" + }) + }) + }), + layout.align !== "stretch" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: layout.dir.startsWith("row") ? /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M7 1a1 1 0 00-1 1v5H1.5a.5.5 0 000 1H6v5a1 1 0 001 1h1a1 1 0 001-1V8h4.5a.5.5 0 000-1H9V2a1 1 0 00-1-1H7z", + clipRule: "evenodd" + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M2 6a1 1 0 00-1 1v1a1 1 0 001 1h5v4.5a.5.5 0 001 0V9h5a1 1 0 001-1V7a1 1 0 00-1-1H8V1.5a.5.5 0 00-1 0V6H2z", + clipRule: "evenodd" + }) + }) + }) + ] + }) + }) + ] + }) + ] + }), + layout.gap === "auto" ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lvFnH.LayoutSpaced), { + dir: layout.dir, + align: layout.align, + onChange: (align)=>{ + update("layout", { + ...layout, + align: align + }); + } + }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $kGdHA.LayoutPacked), { + dir: layout.dir, + align: layout.align, + onChange: (align)=>{ + update("layout", { + ...layout, + align: align + }); + } + }) + ] + }) + }); +}; +const $3c8a82cfebb971cb$var$Down = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + viewBox: "0 0 48 48", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "none", + stroke: "#000", + strokeLinecap: "round", + strokeLinejoin: "round", + strokeWidth: "4", + d: "M36 18L24 30 12 18" + }) + }); +const $3c8a82cfebb971cb$var$Wrap = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + viewBox: "0 0 24 24", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M4 20V4h2v16H4zm14 0V4h2v16h-2zm-7.4-2.45L7.05 14l3.55-3.525 1.4 1.4L10.875 13H13q.825 0 1.413-.588T15 11q0-.825-.588-1.413T13 9H7V7h6q1.65 0 2.825 1.175T17 11q0 1.65-1.175 2.825T13 15h-2.125L12 16.125l-1.4 1.425z" + }) + }); +const $3c8a82cfebb971cb$var$TapDown = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "20", + height: "20", + fill: "none", + viewBox: "0 0 20 20", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M14 6a4 4 0 0 1-2.5 3.7V8.6a3 3 0 1 0-3 0v1.1A4 4 0 1 1 14 6ZM9.65 17.85c.2.2.5.2.7 0l3-3a.5.5 0 0 0-.7-.7l-2.15 2.14V5.5a.5.5 0 0 0-1 0v10.8l-2.15-2.15a.5.5 0 1 0-.7.7l3 3Z", + fill: "currentColor" + }) + }); +const $3c8a82cfebb971cb$var$TapRight = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "20", + height: "20", + fill: "none", + viewBox: "0 0 20 20", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M6 6a4 4 0 0 1 3.7 2.5H8.6a3 3 0 1 0 0 3h1.1A4 4 0 1 1 6 6Zm8.85 7.35 3-3a.5.5 0 0 0 0-.7l-3-3a.5.5 0 1 0-.7.7l2.14 2.15H5.5a.5.5 0 0 0 0 1h10.8l-2.15 2.15a.5.5 0 0 0 .7.7Z", + fill: "currentColor" + }) + }); +const $3c8a82cfebb971cb$var$GapIcon = ({ layout: layout })=>/*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx(layout.gap !== "auto" ? "pr-2 border-r border-gray-300 mr-1" : "pr-1 pl-1"), + children: layout.dir === "col" ? /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + className: "svg", + width: 12, + height: 13, + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M11 13v-2H1v2H0v-3h12v3h-1zm1-10H0V0h1v2h10V0h1v3zM9 7V6H3v1h6z" + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + className: "svg", + width: 13, + height: 12, + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M13 1h-2v10h2v1h-3V0h3v1zM3 0v12H0v-1h2V1H0V0h3zm4 3H6v6h1V3z" + }) + }) + }); + +}); +parcelRegister("eClhP", function(module, exports) { + +$parcel$export(module.exports, "BoxSep", () => $83c54c38a8949ba8$export$f7b7e5b1ef27a6ce); + +var $lAN3N = parcelRequire("lAN3N"); +const $83c54c38a8949ba8$export$f7b7e5b1ef27a6ce = ({ children: children, className: className = "border-l" })=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: `box-sep flex items-center p-[3px] space-x-[2px] ${className ? className : ""} border-slate-100`, + children: children + }); +}; + +}); + +parcelRegister("34isQ", function(module, exports) { + +$parcel$export(module.exports, "FieldBtnRadio", () => $03189ca8e4098e1b$export$2de3fa5dc6b8b57d); + +var $lAN3N = parcelRequire("lAN3N"); + +var $6ai3B = parcelRequire("6ai3B"); +const $03189ca8e4098e1b$export$2de3fa5dc6b8b57d = ({ items: items, update: update, value: value, disabled: disabled })=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: Object.entries(items).map(([name, content], idx)=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6ai3B.Button), { + disabled: disabled, + className: cx("btn-hover", value === name && name.toUpperCase() === "ON" && css` + color: white !important; + font-weight: bold !important; + background-color: green !important; + border: 0px !important; + `), + onClick: ()=>{ + update(name); + }, + appearance: value === name ? "secondary" : "subtle", + children: content + }, idx); + }) + }); +}; + +}); + +parcelRegister("3M49X", function(module, exports) { + +$parcel$export(module.exports, "FieldNumUnit", () => $559519ae6065c127$export$11bba922b6cc51e5); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); +const $559519ae6065c127$export$11bba922b6cc51e5 = ({ icon: icon, value: value, label: label, update: update, unit: unit, hideUnit: hideUnit, width: width, disabled: disabled, positiveOnly: positiveOnly, enableWhenDrag: enableWhenDrag })=>{ + const local = (0, $4WfNn.useLocal)({ + val: 0, + unit: "", + drag: { + clientX: 0, + old: 0 + }, + dragging: false + }); + const parseVal = (0, $63SH6.useCallback)(()=>{ + let val = ""; + let unt = ""; + if (value.length >= 1) { + let fillMode = "val"; + for(let idx = 0; idx < value.length; idx++){ + const c = value[idx]; + if (idx > 0 && isNaN(parseInt(c))) fillMode = "unit"; + if (fillMode === "val") val += c; + else unt += c || ""; + } + if (!parseInt(val)) unt = ""; + } + local.val = parseInt(val) || 0; + if (positiveOnly && local.val < 0) local.val = Math.max(0, local.val); + local.unit = unit || unt || "px"; + local.render(); + }, [ + value, + unit + ]); + (0, $63SH6.useEffect)(()=>{ + parseVal(); + local.render(); + }, [ + value, + unit + ]); + const [txPending, tx] = (0, $63SH6.useTransition)(); + (0, $63SH6.useEffect)(()=>{ + // Only change the value if the drag was actually started. + const onUpdate = (event)=>{ + if (local.drag.clientX) { + local.val = Math.round(local.drag.old + (event.clientX - local.drag.clientX)); + if (positiveOnly && local.val < 0) local.val = Math.max(0, local.val); + local.render(); + tx(()=>{ + update(local.val + local.unit); + }); + } + }; + // Stop the drag operation now. + const onEnd = ()=>{ + local.drag.clientX = 0; + local.dragging = false; + local.render(); + }; + document.addEventListener("pointermove", onUpdate); + document.addEventListener("pointerup", onEnd); + return ()=>{ + document.removeEventListener("pointermove", onUpdate); + document.removeEventListener("pointerup", onEnd); + }; + }, [ + local.drag.clientX, + local.drag.old, + local.val + ]); + const onStart = (0, $63SH6.useCallback)((event)=>{ + let _disabled = disabled; + if (enableWhenDrag && _disabled) { + update(local.val + local.unit, (val)=>{ + local.val = val; + }); + _disabled = false; + } + if (!_disabled) { + local.dragging = true; + local.render(); + local.drag.clientX = event.clientX; + local.drag.old = local.val; + } + }, [ + local.val, + disabled + ]); + return /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "field-num flex flex-row items-stretch justify-between bg-white border border-transparent btn-hover h-full", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex cursor-ew-resize", + onPointerDown: onStart, + children: [ + icon && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex items-center justify-center opacity-50 ml-1", + onPointerDown: onStart, + children: icon + }), + label && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex items-center justify-center text-[11px] opacity-50 w-[14px] ml-1", + children: label + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex justify-between flex-1 items-center flex-grow overflow-hidden", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("input", { + type: "text", + className: cx(css` + width: ${width ? width : "23px"}; + background: transparent; + outline: none; + font-size: 11px; + `, !!disabled && "text-center text-gray-400"), + disabled: !!disabled, + value: typeof disabled === "string" ? disabled : local.val, + onChange: (e)=>{ + local.val = parseInt(e.currentTarget.value) || 0; + update(local.val + local.unit); + } + }), + hideUnit !== true && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-[11px] mx-1 flex cursor-ew-resize", + onPointerDown: onStart, + children: local.unit + }) + ] + }) + ] + }), + local.dragging && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "fixed z-50 inset-0 cursor-ew-resize" + }) + ] + }); +}; + +}); + +parcelRegister("kGdHA", function(module, exports) { + +$parcel$export(module.exports, "LayoutPacked", () => $672ac23ac8adf73d$export$dc9cd4a08eb2d13b); + +var $lAN3N = parcelRequire("lAN3N"); + +var $dzRGn = parcelRequire("dzRGn"); + +var $emJmR = parcelRequire("emJmR"); +const $672ac23ac8adf73d$export$dc9cd4a08eb2d13b = ({ dir: dir, align: align, onChange: onChange })=>{ + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "ml-1 w-[68px] h-[68px] p-[2px] border grid grid-cols-3 bg-white", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)($672ac23ac8adf73d$var$AlignItem, { + dir: dir, + active: align, + onChange: onChange, + align: "top-left" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($672ac23ac8adf73d$var$AlignItem, { + dir: dir, + active: align, + onChange: onChange, + align: "top-center" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($672ac23ac8adf73d$var$AlignItem, { + dir: dir, + active: align, + onChange: onChange, + align: "top-right" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($672ac23ac8adf73d$var$AlignItem, { + dir: dir, + active: align, + onChange: onChange, + align: "left" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($672ac23ac8adf73d$var$AlignItem, { + dir: dir, + active: align, + onChange: onChange, + align: "center" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($672ac23ac8adf73d$var$AlignItem, { + dir: dir, + active: align, + onChange: onChange, + align: "right" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($672ac23ac8adf73d$var$AlignItem, { + dir: dir, + active: align, + onChange: onChange, + align: "bottom-left" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($672ac23ac8adf73d$var$AlignItem, { + dir: dir, + active: align, + onChange: onChange, + align: "bottom-center" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($672ac23ac8adf73d$var$AlignItem, { + dir: dir, + active: align, + onChange: onChange, + align: "bottom-right" + }) + ] + }); +}; +const $672ac23ac8adf73d$var$AlignItem = ({ dir: dir, align: align, active: active, onChange: onChange })=>{ + let pos = "start"; + if (dir.startsWith("col")) { + if (align.endsWith("left")) pos = "start"; + if (align.endsWith("center")) pos = "center"; + if (align.endsWith("right")) pos = "end"; + } else { + if (align.startsWith("top")) pos = "start"; + else if (align.startsWith("bottom")) pos = "end"; + else pos = "center"; + } + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: `Align: ${align}`, + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("w-[21px] h-[21px] flex items-center justify-center cursor-pointer", active === align && css` + .icon { + display: flex; + } + .point { + display: none; + } + `, css` + &:hover { + .icon { + display: flex; + opacity: 0.5; + } + .point { + display: none; + } + } + `), + onClick: ()=>{ + onChange(align); + }, + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $dzRGn.AlignIcon), { + dir: dir, + pos: pos, + className: "icon hidden" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[2px] h-[2px] bg-slate-400 point" + }) + ] + }) + }); +}; + +}); +parcelRegister("dzRGn", function(module, exports) { + +$parcel$export(module.exports, "AlignIcon", () => $a6ed4c061feb2755$export$70a0c2f5862937b6); + +var $lAN3N = parcelRequire("lAN3N"); +const $a6ed4c061feb2755$export$70a0c2f5862937b6 = ({ dir: dir, pos: pos, className: className })=>{ + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex w-[16px] h-[16px] justify-between", `flex-${dir}`, `items-${pos}`, className), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-blue-500", dir.startsWith("col") ? "w-[12px] h-[4px]" : "h-[12px] w-[4px]") + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-blue-500", dir.startsWith("col") ? "w-[18px] h-[4px]" : "h-[18px] w-[4px]") + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-blue-500", dir.startsWith("col") ? "w-[8px] h-[4px]" : "h-[8px] w-[4px]") + }) + ] + }); +}; + +}); + + +parcelRegister("lvFnH", function(module, exports) { + +$parcel$export(module.exports, "LayoutSpaced", () => $2f500fd093253811$export$580deb3bc11d8e53); + +var $lAN3N = parcelRequire("lAN3N"); + +var $4WfNn = parcelRequire("4WfNn"); +const $2f500fd093253811$export$580deb3bc11d8e53 = ({ dir: dir, align: align, onChange: onChange })=>{ + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("w-[68px] h-[68px] border flex bg-white items-stretch p-[2px]", { + col: "flex-row", + row: "flex-col", + "col-reverse": "flex-row-reverse", + "row-reverse": "flex-col-reverse" + }[dir]), + children: [ + dir === "col" && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemCol, { + active: align, + onChange: onChange, + align: "left" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemCol, { + active: align, + onChange: onChange, + align: "center" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemCol, { + active: align, + onChange: onChange, + align: "right" + }) + ] + }), + dir === "col-reverse" && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemCol, { + active: align, + onChange: onChange, + align: "left" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemCol, { + active: align, + onChange: onChange, + align: "center", + reverse: true + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemCol, { + active: align, + onChange: onChange, + align: "right" + }) + ] + }), + dir === "row" && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemRow, { + active: align, + onChange: onChange, + align: "top" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemRow, { + active: align, + onChange: onChange, + align: "center" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemRow, { + active: align, + onChange: onChange, + align: "bottom" + }) + ] + }), + dir === "row-reverse" && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemRow, { + active: align, + onChange: onChange, + align: "bottom" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemRow, { + active: align, + onChange: onChange, + align: "center", + reverse: true + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($2f500fd093253811$var$AlignItemRow, { + active: align, + onChange: onChange, + align: "top" + }) + ] + }) + ] + }); +}; +const $2f500fd093253811$var$AlignItemRow = ({ align: align, active: active, onChange: onChange, reverse: reverse })=>{ + const local = (0, $4WfNn.useLocal)({ + hover: false + }); + let justify = "justify-start"; + if (align === "center") justify = `justify-center`; + if (align === "bottom") justify = `justify-end`; + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("flex flex-row cursor-pointer justify-between flex-1 items-stretch", local.hover && "hover", active === align && css` + .icon { + display: flex; + } + .point { + display: none; + } + `, css` + &.hover { + .icon { + display: flex; + opacity: 0.5; + } + .point { + display: none; + } + } + `), + onMouseOver: ()=>{ + local.hover = true; + local.render(); + }, + onMouseOut: ()=>{ + local.hover = false; + local.render(); + }, + onClick: ()=>{ + onChange(align); + }, + children: active === align || local.hover ? /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("icon flex-1 flex flex-col items-center", justify), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-blue-500", reverse ? "py-[2px] w-[4px] h-[8px]" : "py-[2px] w-[4px] h-[10px]") + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("icon flex-1 flex flex-col items-center", justify), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-blue-500", "py-[2px] w-[4px] h-[16px]") + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("icon flex-1 flex flex-col items-center", justify), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-blue-500", !reverse ? "py-[2px] w-[4px] h-[8px]" : "py-[2px] w-[4px] h-[10px]") + }) + }) + ] + }) : /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 flex items-center justify-center", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[2px] h-[2px] bg-slate-400 point" + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 flex items-center justify-center", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[2px] h-[2px] bg-slate-400 point" + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 flex items-center justify-center", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[2px] h-[2px] bg-slate-400 point" + }) + }) + ] + }) + }); +}; +const $2f500fd093253811$var$AlignItemCol = ({ align: align, active: active, onChange: onChange, reverse: reverse })=>{ + const local = (0, $4WfNn.useLocal)({ + hover: false + }); + let justify = "justify-start"; + if (align === "center") justify = `justify-center`; + if (align === "right") justify = `justify-end`; + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("flex flex-col cursor-pointer justify-between flex-1 items-stretch", local.hover && "hover", active === align && css` + .icon { + display: flex; + } + .point { + display: none; + } + `, css` + &.hover { + .icon { + display: flex; + opacity: 0.5; + } + .point { + display: none; + } + } + `), + onMouseOver: ()=>{ + local.hover = true; + local.render(); + }, + onMouseOut: ()=>{ + local.hover = false; + local.render(); + }, + onClick: ()=>{ + onChange(align); + }, + children: active === align || local.hover ? /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("icon flex-1 flex items-center", justify), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-blue-500", reverse ? "px-[2px] w-[8px] h-[4px]" : "px-[2px] w-[10px] h-[4px]") + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("icon flex-1 flex items-center", justify), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-blue-500", "px-[2px] w-[16px] h-[4px]") + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("icon flex-1 flex items-center", justify), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-blue-500", !reverse ? "px-[2px] w-[8px] h-[4px]" : "px-[2px] w-[10px] h-[4px]") + }) + }) + ] + }) : /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 flex items-center justify-center", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[2px] h-[2px] bg-slate-400 point" + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 flex items-center justify-center", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[2px] h-[2px] bg-slate-400 point" + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 flex items-center justify-center", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[2px] h-[2px] bg-slate-400 point" + }) + }) + ] + }) + }); +}; + +}); + + +parcelRegister("8l3Wa", function(module, exports) { + +$parcel$export(module.exports, "PanelBackground", () => $3e3a4cf107808e8f$export$dc101e1690ff9c5e); + +var $lAN3N = parcelRequire("lAN3N"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $769fS = parcelRequire("769fS"); + +var $7dWeq = parcelRequire("7dWeq"); + +var $bjM6F = parcelRequire("bjM6F"); + +var $emJmR = parcelRequire("emJmR"); + +var $dCav9 = parcelRequire("dCav9"); +const $3e3a4cf107808e8f$export$dc101e1690ff9c5e = ({ value: value, update: update, mode: mode })=>{ + const local = (0, $4WfNn.useLocal)({ + colorOpen: false + }); + const bg = (0, $bjM6F.responsiveVal)(value, "bg", mode, { + size: "cover", + pos: "center" + }); + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex flex-col space-y-2", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("flex items-stretch space-x-2 text-xs "), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Background Color", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-white p-[2px] border border-gray-300 flex items-stretch", css` + .color-box { + height: 25px !important; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $769fS.FieldColor), { + popupID: "bg-color", + value: bg.color, + update: (color)=>{ + update("bg", { + ...bg, + color: color + }); + } + }) + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex items-stretch space-x-2", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Background Size", + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $dCav9.Dropdown), { + ...(0, $7dWeq.dropdownProp), + value: bg.size, + items: [ + { + value: "cover", + label: "Cover" + }, + { + value: "contain", + label: "Contain" + }, + { + value: "full", + label: "Full" + }, + { + value: "auto", + label: "Auto" + } + ], + onChange: (val)=>{ + update("bg", { + ...bg, + size: val + }); + } + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Background Position", + className: css` + .dropdown { + max-width: 90px; + overflow: hidden; + } + `, + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $dCav9.Dropdown), { + ...(0, $7dWeq.dropdownProp), + value: bg.pos, + items: [ + { + value: "top", + label: "Top" + }, + { + value: "center", + label: "Center" + }, + { + value: "bottom", + label: "Bottom" + }, + { + value: "right", + label: "Right" + }, + { + value: "left", + label: "Left" + } + ], + onChange: (val)=>{ + update("bg", { + ...bg, + pos: val + }); + } + }) + }) + ] + }) + ] + }); +}; +const $3e3a4cf107808e8f$var$getImgMeta = (url)=>{ + return new Promise((resolve, reject)=>{ + const img = new Image(); + img.onload = ()=>resolve(img); + img.onerror = (err)=>{ + console.error(err, url); + resolve(null); + }; + img.src = url; + }); +}; + +}); +parcelRegister("769fS", function(module, exports) { + +$parcel$export(module.exports, "FieldColor", () => $b15ed1490ada63fa$export$ca27cf61053caa36); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $4diSG = parcelRequire("4diSG"); + +var $3i93m = parcelRequire("3i93m"); +const $b15ed1490ada63fa$export$ca27cf61053caa36 = ({ value: value, update: update, showHistory: showHistory = true, popupID: popupID })=>{ + if (!(0, $3i93m.w).openedPopupID) (0, $3i93m.w).openedPopupID = {}; + const local = (0, $4WfNn.useLocal)({ + val: (0, $3i93m.w).lastColorPicked || "" + }); + (0, $63SH6.useEffect)(()=>{ + if (value) (0, $3i93m.w).lastColorPicked = value; + local.val = value || ""; + local.render(); + }, [ + value + ]); + const onOpen = ()=>{ + (0, $3i93m.w).openedPopupID[popupID] = true; + local.render(); + }; + const onClose = ()=>{ + delete (0, $3i93m.w).openedPopupID[popupID]; + (0, $3i93m.w).lastColorPicked = ""; + local.render(); + }; + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $4diSG.FieldColorPicker), { + value: local.val, + update: (val)=>update(val), + onOpen: onOpen, + onClose: onClose, + open: (0, $3i93m.w).openedPopupID[popupID], + showHistory: showHistory, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx(css` + background-image: url('data:image/svg+xml;charset=utf-8,'); + `, "cursor-pointer"), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx(css` + background: ${local.val}; + width: 30px; + height: 20px; + `, "color-box") + }) + }) + }); +}; + +}); +parcelRegister("4diSG", function(module, exports) { + +$parcel$export(module.exports, "FieldColorPicker", () => $b6e648bfde201683$export$4121e647b1063549); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $j4tzk = parcelRequire("j4tzk"); + +var $bTIRf = parcelRequire("bTIRf"); +const $b6e648bfde201683$export$4121e647b1063549 = ({ children: children, value: value, update: update, open: open, onClose: onClose, onOpen: onOpen, showHistory: showHistory })=>{ + const local = (0, $4WfNn.useLocal)({ + show: open || false + }); + (0, $63SH6.useEffect)(()=>{ + if (value) { + local.show = open || false; + local.render(); + } + }, [ + value, + open + ]); + const [_, tx] = (0, $63SH6.useTransition)(); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), { + open: local.show, + onOpenChange: (open)=>{ + local.show = open; + if (open && onOpen) onOpen(); + else if (onClose) onClose(); + local.render(); + }, + backdrop: false, + popoverClassName: "rounded-md p-2 text-sm bg-white shadow-2xl border border-slate-300", + content: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $j4tzk.FieldPickColor), { + value: value, + showHistory: showHistory, + onClose: ()=>{ + local.show = false; + local.render(); + if (onClose) onClose(); + }, + onChangePicker: (color)=>{ + tx(()=>{ + if (color.indexOf("NaN") < 0) update(color); + }); + } + }), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + onClick: ()=>{ + local.show = true; + local.render(); + if (onOpen) onOpen(); + }, + children: children + }) + }); +}; + +}); +parcelRegister("j4tzk", function(module, exports) { + +$parcel$export(module.exports, "FieldPickColor", () => $390543dd7791b547$export$c449c2e399ddbae5); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $3rnVg = parcelRequire("3rnVg"); + +var $4WfNn = parcelRequire("4WfNn"); + +const $390543dd7791b547$var$HexAlphaColorPicker = /*#__PURE__*/ (0, $63SH6.lazy)(async ()=>{ + return { + default: (await (parcelRequire("i3H5K"))).HexAlphaColorPicker + }; +}); +const $390543dd7791b547$export$c449c2e399ddbae5 = ({ value: value, onChangePicker: onChangePicker, onClose: onClose, showHistory: showHistory })=>{ + const meta = (0, $4WfNn.useLocal)({ + originalValue: "", + inputValue: value, + rgbValue: "", + selectedEd: "" + }); + (0, $63SH6.useEffect)(()=>{ + meta.inputValue = value || ""; + const convertColor = (0, (/*@__PURE__*/$parcel$interopDefault($3rnVg)))(meta.inputValue); + meta.rgbValue = convertColor.toRgbString(); + meta.render(); + }, [ + value + ]); + const colors = []; + const tin = (0, (/*@__PURE__*/$parcel$interopDefault($3rnVg)))(meta.inputValue); + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex p-3 space-x-4 items-start", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("flex flex-col items-center", css` + .react-colorful__pointer { + border-radius: 4px; + width: 20px; + height: 20px; + } + `), + onClick: (e)=>{ + e.stopPropagation(); + e.preventDefault(); + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $63SH6.Suspense), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)($390543dd7791b547$var$HexAlphaColorPicker, { + color: meta.inputValue, + onChange: (color)=>{ + if (color) { + meta.inputValue = color; + onChangePicker(color); + const convertColor = (0, (/*@__PURE__*/$parcel$interopDefault($3rnVg)))(meta.inputValue); + meta.rgbValue = convertColor.toRgbString(); + } + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("grid grid-cols-1 gap-y-0.5", css` + width: 78px; + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "p-[1px] border rounded flex items-center justify-center", + style: { + marginBottom: "4px" + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("input", { + value: meta.inputValue || "#FFFFFFFF", + className: cx(`rounded cursor-text bg-[${meta.inputValue}] min-w-[0px] text-[13px] px-[8px] py-[1px] uppercase`, tin.isValid() && css` + color: ${!tin.isLight() ? "#FFF" : "#000"}; + background-color: ${meta.inputValue}; + `), + onClick: ()=>{ + // height: "18px", + // minWidth: "0px", + // fontSize: "13px", + // meta.selectedEd = -1; + // meta.render(); + }, + spellCheck: false, + onChange: (e)=>{ + const color = e.currentTarget.value; + meta.inputValue = color; + // if (meta.selectedEd >= 0) { + // ed.colors[meta.selectedEd] = color; + // } + onChangePicker(color); + } + }) + }), + showHistory && colors.map((e, key)=>/*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("flex space-x-1 items-center border p-0.5 rounded", meta.selectedEd === e.id && "border-black"), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx(`w-12 h-4 rounded cursor-pointer border bg-[${e}]`, css` + background-color: ${e.value}; + `), + style: { + backgroundColor: e.value + }, + onClick: ()=>{ + meta.inputValue = e.value; + meta.selectedEd = e.id; + onChangePicker(e.value); + const convertColor = (0, (/*@__PURE__*/$parcel$interopDefault($3rnVg)))(meta.inputValue); + meta.rgbValue = convertColor.toRgbString(); + } + }) + }, key)), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "", + children: [ + meta.inputValue !== "" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "cursor-pointer text-center border border-gray-200 rounded hover:bg-gray-100", + onClick: ()=>{ + meta.inputValue = ""; + onChangePicker(""); + }, + children: "Reset" + }) + }), + onClose && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "cursor-pointer text-center border border-gray-200 rounded hover:bg-gray-100 mt-[4px]", + onClick: onClose, + children: "Close" + }) + ] + }) + ] + }) + ] + }); +}; + +}); +parcelRegister("3rnVg", function(module, exports) { +// This file is autogenerated. It's used to publish CJS to npm. +(function(global, factory) { + module.exports = factory(); +})(module.exports, function() { + "use strict"; + function _typeof(obj) { + "@babel/helpers - typeof"; + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) { + return typeof obj; + } : function(obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); + } + // https://github.com/bgrins/TinyColor + // Brian Grinstead, MIT License + var trimLeft = /^\s+/; + var trimRight = /\s+$/; + function tinycolor(color, opts) { + color = color ? color : ""; + opts = opts || {}; + // If input is already a tinycolor, return itself + if (color instanceof tinycolor) return color; + // If we are called as a function, call using new instead + if (!(this instanceof tinycolor)) return new tinycolor(color, opts); + var rgb = inputToRGB(color); + this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format; + this._gradientType = opts.gradientType; + // Don't let the range of [0,255] come back in [0,1]. + // Potentially lose a little bit of precision here, but will fix issues where + // .5 gets interpreted as half of the total, instead of half of 1 + // If it was supposed to be 128, this was already taken care of by `inputToRgb` + if (this._r < 1) this._r = Math.round(this._r); + if (this._g < 1) this._g = Math.round(this._g); + if (this._b < 1) this._b = Math.round(this._b); + this._ok = rgb.ok; + } + tinycolor.prototype = { + isDark: function isDark() { + return this.getBrightness() < 128; + }, + isLight: function isLight() { + return !this.isDark(); + }, + isValid: function isValid() { + return this._ok; + }, + getOriginalInput: function getOriginalInput() { + return this._originalInput; + }, + getFormat: function getFormat() { + return this._format; + }, + getAlpha: function getAlpha() { + return this._a; + }, + getBrightness: function getBrightness() { + //http://www.w3.org/TR/AERT#color-contrast + var rgb = this.toRgb(); + return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; + }, + getLuminance: function getLuminance() { + //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef + var rgb = this.toRgb(); + var RsRGB, GsRGB, BsRGB, R, G, B; + RsRGB = rgb.r / 255; + GsRGB = rgb.g / 255; + BsRGB = rgb.b / 255; + if (RsRGB <= 0.03928) R = RsRGB / 12.92; + else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4); + if (GsRGB <= 0.03928) G = GsRGB / 12.92; + else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); + if (BsRGB <= 0.03928) B = BsRGB / 12.92; + else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4); + return 0.2126 * R + 0.7152 * G + 0.0722 * B; + }, + setAlpha: function setAlpha(value) { + this._a = boundAlpha(value); + this._roundA = Math.round(100 * this._a) / 100; + return this; + }, + toHsv: function toHsv() { + var hsv = rgbToHsv(this._r, this._g, this._b); + return { + h: hsv.h * 360, + s: hsv.s, + v: hsv.v, + a: this._a + }; + }, + toHsvString: function toHsvString() { + var hsv = rgbToHsv(this._r, this._g, this._b); + var h = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v = Math.round(hsv.v * 100); + return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")"; + }, + toHsl: function toHsl() { + var hsl = rgbToHsl(this._r, this._g, this._b); + return { + h: hsl.h * 360, + s: hsl.s, + l: hsl.l, + a: this._a + }; + }, + toHslString: function toHslString() { + var hsl = rgbToHsl(this._r, this._g, this._b); + var h = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l = Math.round(hsl.l * 100); + return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")"; + }, + toHex: function toHex(allow3Char) { + return rgbToHex(this._r, this._g, this._b, allow3Char); + }, + toHexString: function toHexString(allow3Char) { + return "#" + this.toHex(allow3Char); + }, + toHex8: function toHex8(allow4Char) { + return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); + }, + toHex8String: function toHex8String(allow4Char) { + return "#" + this.toHex8(allow4Char); + }, + toRgb: function toRgb() { + return { + r: Math.round(this._r), + g: Math.round(this._g), + b: Math.round(this._b), + a: this._a + }; + }, + toRgbString: function toRgbString() { + return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")"; + }, + toPercentageRgb: function toPercentageRgb() { + return { + r: Math.round(bound01(this._r, 255) * 100) + "%", + g: Math.round(bound01(this._g, 255) * 100) + "%", + b: Math.round(bound01(this._b, 255) * 100) + "%", + a: this._a + }; + }, + toPercentageRgbString: function toPercentageRgbString() { + return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; + }, + toName: function toName() { + if (this._a === 0) return "transparent"; + if (this._a < 1) return false; + return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; + }, + toFilter: function toFilter(secondColor) { + var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a); + var secondHex8String = hex8String; + var gradientType = this._gradientType ? "GradientType = 1, " : ""; + if (secondColor) { + var s = tinycolor(secondColor); + secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a); + } + return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")"; + }, + toString: function toString(format) { + var formatSet = !!format; + format = format || this._format; + var formattedString = false; + var hasAlpha = this._a < 1 && this._a >= 0; + var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); + if (needsAlphaFormat) { + // Special case for "transparent", all other non-alpha formats + // will return rgba when there is transparency. + if (format === "name" && this._a === 0) return this.toName(); + return this.toRgbString(); + } + if (format === "rgb") formattedString = this.toRgbString(); + if (format === "prgb") formattedString = this.toPercentageRgbString(); + if (format === "hex" || format === "hex6") formattedString = this.toHexString(); + if (format === "hex3") formattedString = this.toHexString(true); + if (format === "hex4") formattedString = this.toHex8String(true); + if (format === "hex8") formattedString = this.toHex8String(); + if (format === "name") formattedString = this.toName(); + if (format === "hsl") formattedString = this.toHslString(); + if (format === "hsv") formattedString = this.toHsvString(); + return formattedString || this.toHexString(); + }, + clone: function clone() { + return tinycolor(this.toString()); + }, + _applyModification: function _applyModification(fn, args) { + var color = fn.apply(null, [ + this + ].concat([].slice.call(args))); + this._r = color._r; + this._g = color._g; + this._b = color._b; + this.setAlpha(color._a); + return this; + }, + lighten: function lighten() { + return this._applyModification(_lighten, arguments); + }, + brighten: function brighten() { + return this._applyModification(_brighten, arguments); + }, + darken: function darken() { + return this._applyModification(_darken, arguments); + }, + desaturate: function desaturate() { + return this._applyModification(_desaturate, arguments); + }, + saturate: function saturate() { + return this._applyModification(_saturate, arguments); + }, + greyscale: function greyscale() { + return this._applyModification(_greyscale, arguments); + }, + spin: function spin() { + return this._applyModification(_spin, arguments); + }, + _applyCombination: function _applyCombination(fn, args) { + return fn.apply(null, [ + this + ].concat([].slice.call(args))); + }, + analogous: function analogous() { + return this._applyCombination(_analogous, arguments); + }, + complement: function complement() { + return this._applyCombination(_complement, arguments); + }, + monochromatic: function monochromatic() { + return this._applyCombination(_monochromatic, arguments); + }, + splitcomplement: function splitcomplement() { + return this._applyCombination(_splitcomplement, arguments); + }, + // Disabled until https://github.com/bgrins/TinyColor/issues/254 + // polyad: function (number) { + // return this._applyCombination(polyad, [number]); + // }, + triad: function triad() { + return this._applyCombination(polyad, [ + 3 + ]); + }, + tetrad: function tetrad() { + return this._applyCombination(polyad, [ + 4 + ]); + } + }; + // If input is an object, force 1 into "1.0" to handle ratios properly + // String input requires "1.0" as input, so 1 will be treated as 1 + tinycolor.fromRatio = function(color, opts) { + if (_typeof(color) == "object") { + var newColor = {}; + for(var i in color)if (color.hasOwnProperty(i)) { + if (i === "a") newColor[i] = color[i]; + else newColor[i] = convertToPercentage(color[i]); + } + color = newColor; + } + return tinycolor(color, opts); + }; + // Given a string or object, convert that input to RGB + // Possible string inputs: + // + // "red" + // "#f00" or "f00" + // "#ff0000" or "ff0000" + // "#ff000000" or "ff000000" + // "rgb 255 0 0" or "rgb (255, 0, 0)" + // "rgb 1.0 0 0" or "rgb (1, 0, 0)" + // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" + // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" + // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" + // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" + // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" + // + function inputToRGB(color) { + var rgb = { + r: 0, + g: 0, + b: 0 + }; + var a = 1; + var s = null; + var v = null; + var l = null; + var ok = false; + var format = false; + if (typeof color == "string") color = stringInputToObject(color); + if (_typeof(color) == "object") { + if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { + rgb = rgbToRgb(color.r, color.g, color.b); + ok = true; + format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { + s = convertToPercentage(color.s); + v = convertToPercentage(color.v); + rgb = hsvToRgb(color.h, s, v); + ok = true; + format = "hsv"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { + s = convertToPercentage(color.s); + l = convertToPercentage(color.l); + rgb = hslToRgb(color.h, s, l); + ok = true; + format = "hsl"; + } + if (color.hasOwnProperty("a")) a = color.a; + } + a = boundAlpha(a); + return { + ok: ok, + format: color.format || format, + r: Math.min(255, Math.max(rgb.r, 0)), + g: Math.min(255, Math.max(rgb.g, 0)), + b: Math.min(255, Math.max(rgb.b, 0)), + a: a + }; + } + // Conversion Functions + // -------------------- + // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: + // + // `rgbToRgb` + // Handle bounds / percentage checking to conform to CSS color spec + // + // *Assumes:* r, g, b in [0, 255] or [0, 1] + // *Returns:* { r, g, b } in [0, 255] + function rgbToRgb(r, g, b) { + return { + r: bound01(r, 255) * 255, + g: bound01(g, 255) * 255, + b: bound01(b, 255) * 255 + }; + } + // `rgbToHsl` + // Converts an RGB color value to HSL. + // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] + // *Returns:* { h, s, l } in [0,1] + function rgbToHsl(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), min = Math.min(r, g, b); + var h, s, l = (max + min) / 2; + if (max == min) h = s = 0; // achromatic + else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch(max){ + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + l: l + }; + } + // `hslToRgb` + // Converts an HSL color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hslToRgb(h, s, l) { + var r, g, b; + h = bound01(h, 360); + s = bound01(s, 100); + l = bound01(l, 100); + function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 0.5) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + if (s === 0) r = g = b = l; // achromatic + else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1 / 3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1 / 3); + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + } + // `rgbToHsv` + // Converts an RGB color value to HSV + // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] + // *Returns:* { h, s, v } in [0,1] + function rgbToHsv(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), min = Math.min(r, g, b); + var h, s, v = max; + var d = max - min; + s = max === 0 ? 0 : d / max; + if (max == min) h = 0; // achromatic + else { + switch(max){ + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + v: v + }; + } + // `hsvToRgb` + // Converts an HSV color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hsvToRgb(h, s, v) { + h = bound01(h, 360) * 6; + s = bound01(s, 100); + v = bound01(v, 100); + var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [ + v, + q, + p, + p, + t, + v + ][mod], g = [ + t, + v, + v, + q, + p, + p + ][mod], b = [ + p, + p, + t, + v, + v, + q + ][mod]; + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + } + // `rgbToHex` + // Converts an RGB color to hex + // Assumes r, g, and b are contained in the set [0, 255] + // Returns a 3 or 6 character hex + function rgbToHex(r, g, b, allow3Char) { + var hex = [ + pad2(Math.round(r).toString(16)), + pad2(Math.round(g).toString(16)), + pad2(Math.round(b).toString(16)) + ]; + // Return a 3 character hex if possible + if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); + return hex.join(""); + } + // `rgbaToHex` + // Converts an RGBA color plus alpha transparency to hex + // Assumes r, g, b are contained in the set [0, 255] and + // a in [0, 1]. Returns a 4 or 8 character rgba hex + function rgbaToHex(r, g, b, a, allow4Char) { + var hex = [ + pad2(Math.round(r).toString(16)), + pad2(Math.round(g).toString(16)), + pad2(Math.round(b).toString(16)), + pad2(convertDecimalToHex(a)) + ]; + // Return a 4 character hex if possible + if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); + return hex.join(""); + } + // `rgbaToArgbHex` + // Converts an RGBA color to an ARGB Hex8 string + // Rarely used, but required for "toFilter()" + function rgbaToArgbHex(r, g, b, a) { + var hex = [ + pad2(convertDecimalToHex(a)), + pad2(Math.round(r).toString(16)), + pad2(Math.round(g).toString(16)), + pad2(Math.round(b).toString(16)) + ]; + return hex.join(""); + } + // `equals` + // Can be called with any tinycolor input + tinycolor.equals = function(color1, color2) { + if (!color1 || !color2) return false; + return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); + }; + tinycolor.random = function() { + return tinycolor.fromRatio({ + r: Math.random(), + g: Math.random(), + b: Math.random() + }); + }; + // Modification Functions + // ---------------------- + // Thanks to less.js for some of the basics here + // + function _desaturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s -= amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); + } + function _saturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s += amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); + } + function _greyscale(color) { + return tinycolor(color).desaturate(100); + } + function _lighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l += amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); + } + function _brighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var rgb = tinycolor(color).toRgb(); + rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))); + rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))); + rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))); + return tinycolor(rgb); + } + function _darken(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l -= amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); + } + // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. + // Values outside of this range will be wrapped into this range. + function _spin(color, amount) { + var hsl = tinycolor(color).toHsl(); + var hue = (hsl.h + amount) % 360; + hsl.h = hue < 0 ? 360 + hue : hue; + return tinycolor(hsl); + } + // Combination Functions + // --------------------- + // Thanks to jQuery xColor for some of the ideas behind these + // + function _complement(color) { + var hsl = tinycolor(color).toHsl(); + hsl.h = (hsl.h + 180) % 360; + return tinycolor(hsl); + } + function polyad(color, number) { + if (isNaN(number) || number <= 0) throw new Error("Argument to polyad must be a positive number"); + var hsl = tinycolor(color).toHsl(); + var result = [ + tinycolor(color) + ]; + var step = 360 / number; + for(var i = 1; i < number; i++)result.push(tinycolor({ + h: (hsl.h + i * step) % 360, + s: hsl.s, + l: hsl.l + })); + return result; + } + function _splitcomplement(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [ + tinycolor(color), + tinycolor({ + h: (h + 72) % 360, + s: hsl.s, + l: hsl.l + }), + tinycolor({ + h: (h + 216) % 360, + s: hsl.s, + l: hsl.l + }) + ]; + } + function _analogous(color, results, slices) { + results = results || 6; + slices = slices || 30; + var hsl = tinycolor(color).toHsl(); + var part = 360 / slices; + var ret = [ + tinycolor(color) + ]; + for(hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;){ + hsl.h = (hsl.h + part) % 360; + ret.push(tinycolor(hsl)); + } + return ret; + } + function _monochromatic(color, results) { + results = results || 6; + var hsv = tinycolor(color).toHsv(); + var h = hsv.h, s = hsv.s, v = hsv.v; + var ret = []; + var modification = 1 / results; + while(results--){ + ret.push(tinycolor({ + h: h, + s: s, + v: v + })); + v = (v + modification) % 1; + } + return ret; + } + // Utility Functions + // --------------------- + tinycolor.mix = function(color1, color2, amount) { + amount = amount === 0 ? 0 : amount || 50; + var rgb1 = tinycolor(color1).toRgb(); + var rgb2 = tinycolor(color2).toRgb(); + var p = amount / 100; + var rgba = { + r: (rgb2.r - rgb1.r) * p + rgb1.r, + g: (rgb2.g - rgb1.g) * p + rgb1.g, + b: (rgb2.b - rgb1.b) * p + rgb1.b, + a: (rgb2.a - rgb1.a) * p + rgb1.a + }; + return tinycolor(rgba); + }; + // Readability Functions + // --------------------- + // false + // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false + tinycolor.isReadable = function(color1, color2, wcag2) { + var readability = tinycolor.readability(color1, color2); + var wcag2Parms, out; + out = false; + wcag2Parms = validateWCAG2Parms(wcag2); + switch(wcag2Parms.level + wcag2Parms.size){ + case "AAsmall": + case "AAAlarge": + out = readability >= 4.5; + break; + case "AAlarge": + out = readability >= 3; + break; + case "AAAsmall": + out = readability >= 7; + break; + } + return out; + }; + // `mostReadable` + // Given a base color and a list of possible foreground or background + // colors for that base, returns the most readable color. + // Optionally returns Black or White if the most readable color is unreadable. + // *Example* + // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" + // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" + // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" + // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" + tinycolor.mostReadable = function(baseColor, colorList, args) { + var bestColor = null; + var bestScore = 0; + var readability; + var includeFallbackColors, level, size; + args = args || {}; + includeFallbackColors = args.includeFallbackColors; + level = args.level; + size = args.size; + for(var i = 0; i < colorList.length; i++){ + readability = tinycolor.readability(baseColor, colorList[i]); + if (readability > bestScore) { + bestScore = readability; + bestColor = tinycolor(colorList[i]); + } + } + if (tinycolor.isReadable(baseColor, bestColor, { + level: level, + size: size + }) || !includeFallbackColors) return bestColor; + else { + args.includeFallbackColors = false; + return tinycolor.mostReadable(baseColor, [ + "#fff", + "#000" + ], args); + } + }; + // Big List of Colors + // ------------------ + // + var names = tinycolor.names = { + aliceblue: "f0f8ff", + antiquewhite: "faebd7", + aqua: "0ff", + aquamarine: "7fffd4", + azure: "f0ffff", + beige: "f5f5dc", + bisque: "ffe4c4", + black: "000", + blanchedalmond: "ffebcd", + blue: "00f", + blueviolet: "8a2be2", + brown: "a52a2a", + burlywood: "deb887", + burntsienna: "ea7e5d", + cadetblue: "5f9ea0", + chartreuse: "7fff00", + chocolate: "d2691e", + coral: "ff7f50", + cornflowerblue: "6495ed", + cornsilk: "fff8dc", + crimson: "dc143c", + cyan: "0ff", + darkblue: "00008b", + darkcyan: "008b8b", + darkgoldenrod: "b8860b", + darkgray: "a9a9a9", + darkgreen: "006400", + darkgrey: "a9a9a9", + darkkhaki: "bdb76b", + darkmagenta: "8b008b", + darkolivegreen: "556b2f", + darkorange: "ff8c00", + darkorchid: "9932cc", + darkred: "8b0000", + darksalmon: "e9967a", + darkseagreen: "8fbc8f", + darkslateblue: "483d8b", + darkslategray: "2f4f4f", + darkslategrey: "2f4f4f", + darkturquoise: "00ced1", + darkviolet: "9400d3", + deeppink: "ff1493", + deepskyblue: "00bfff", + dimgray: "696969", + dimgrey: "696969", + dodgerblue: "1e90ff", + firebrick: "b22222", + floralwhite: "fffaf0", + forestgreen: "228b22", + fuchsia: "f0f", + gainsboro: "dcdcdc", + ghostwhite: "f8f8ff", + gold: "ffd700", + goldenrod: "daa520", + gray: "808080", + green: "008000", + greenyellow: "adff2f", + grey: "808080", + honeydew: "f0fff0", + hotpink: "ff69b4", + indianred: "cd5c5c", + indigo: "4b0082", + ivory: "fffff0", + khaki: "f0e68c", + lavender: "e6e6fa", + lavenderblush: "fff0f5", + lawngreen: "7cfc00", + lemonchiffon: "fffacd", + lightblue: "add8e6", + lightcoral: "f08080", + lightcyan: "e0ffff", + lightgoldenrodyellow: "fafad2", + lightgray: "d3d3d3", + lightgreen: "90ee90", + lightgrey: "d3d3d3", + lightpink: "ffb6c1", + lightsalmon: "ffa07a", + lightseagreen: "20b2aa", + lightskyblue: "87cefa", + lightslategray: "789", + lightslategrey: "789", + lightsteelblue: "b0c4de", + lightyellow: "ffffe0", + lime: "0f0", + limegreen: "32cd32", + linen: "faf0e6", + magenta: "f0f", + maroon: "800000", + mediumaquamarine: "66cdaa", + mediumblue: "0000cd", + mediumorchid: "ba55d3", + mediumpurple: "9370db", + mediumseagreen: "3cb371", + mediumslateblue: "7b68ee", + mediumspringgreen: "00fa9a", + mediumturquoise: "48d1cc", + mediumvioletred: "c71585", + midnightblue: "191970", + mintcream: "f5fffa", + mistyrose: "ffe4e1", + moccasin: "ffe4b5", + navajowhite: "ffdead", + navy: "000080", + oldlace: "fdf5e6", + olive: "808000", + olivedrab: "6b8e23", + orange: "ffa500", + orangered: "ff4500", + orchid: "da70d6", + palegoldenrod: "eee8aa", + palegreen: "98fb98", + paleturquoise: "afeeee", + palevioletred: "db7093", + papayawhip: "ffefd5", + peachpuff: "ffdab9", + peru: "cd853f", + pink: "ffc0cb", + plum: "dda0dd", + powderblue: "b0e0e6", + purple: "800080", + rebeccapurple: "663399", + red: "f00", + rosybrown: "bc8f8f", + royalblue: "4169e1", + saddlebrown: "8b4513", + salmon: "fa8072", + sandybrown: "f4a460", + seagreen: "2e8b57", + seashell: "fff5ee", + sienna: "a0522d", + silver: "c0c0c0", + skyblue: "87ceeb", + slateblue: "6a5acd", + slategray: "708090", + slategrey: "708090", + snow: "fffafa", + springgreen: "00ff7f", + steelblue: "4682b4", + tan: "d2b48c", + teal: "008080", + thistle: "d8bfd8", + tomato: "ff6347", + turquoise: "40e0d0", + violet: "ee82ee", + wheat: "f5deb3", + white: "fff", + whitesmoke: "f5f5f5", + yellow: "ff0", + yellowgreen: "9acd32" + }; + // Make it easy to access colors via `hexNames[hex]` + var hexNames = tinycolor.hexNames = flip(names); + // Utilities + // --------- + // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` + function flip(o) { + var flipped = {}; + for(var i in o)if (o.hasOwnProperty(i)) flipped[o[i]] = i; + return flipped; + } + // Return a valid alpha value [0,1] with all invalid values being set to 1 + function boundAlpha(a) { + a = parseFloat(a); + if (isNaN(a) || a < 0 || a > 1) a = 1; + return a; + } + // Take input from [0, n] and return it as [0, 1] + function bound01(n, max) { + if (isOnePointZero(n)) n = "100%"; + var processPercent = isPercentage(n); + n = Math.min(max, Math.max(0, parseFloat(n))); + // Automatically convert percentage into number + if (processPercent) n = parseInt(n * max, 10) / 100; + // Handle floating point rounding errors + if (Math.abs(n - max) < 0.000001) return 1; + // Convert into [0, 1] range if it isn't already + return n % max / parseFloat(max); + } + // Force a number between 0 and 1 + function clamp01(val) { + return Math.min(1, Math.max(0, val)); + } + // Parse a base-16 hex value into a base-10 integer + function parseIntFromHex(val) { + return parseInt(val, 16); + } + // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 + // + function isOnePointZero(n) { + return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1; + } + // Check to see if string passed in is a percentage + function isPercentage(n) { + return typeof n === "string" && n.indexOf("%") != -1; + } + // Force a hex value to have 2 characters + function pad2(c) { + return c.length == 1 ? "0" + c : "" + c; + } + // Replace a decimal with it's percentage value + function convertToPercentage(n) { + if (n <= 1) n = n * 100 + "%"; + return n; + } + // Converts a decimal to a hex value + function convertDecimalToHex(d) { + return Math.round(parseFloat(d) * 255).toString(16); + } + // Converts a hex value to a decimal + function convertHexToDecimal(h) { + return parseIntFromHex(h) / 255; + } + var matchers = function() { + // + var CSS_INTEGER = "[-\\+]?\\d+%?"; + // + var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; + // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. + var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; + // Actual matching. + // Parentheses and commas are optional, but not required. + // Whitespace can take the place of commas or opening paren + var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + return { + CSS_UNIT: new RegExp(CSS_UNIT), + rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), + rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), + hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), + hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), + hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), + hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), + hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, + hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ + }; + }(); + // `isValidCSSUnit` + // Take in a single string / number and check to see if it looks like a CSS unit + // (see `matchers` above for definition). + function isValidCSSUnit(color) { + return !!matchers.CSS_UNIT.exec(color); + } + // `stringInputToObject` + // Permissive string parsing. Take in a number of formats, and output an object + // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` + function stringInputToObject(color) { + color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase(); + var named = false; + if (names[color]) { + color = names[color]; + named = true; + } else if (color == "transparent") return { + r: 0, + g: 0, + b: 0, + a: 0, + format: "name" + }; + // Try to match string input using regular expressions. + // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] + // Just return an object and let the conversion functions handle that. + // This way the result will be the same whether the tinycolor is initialized with string or object. + var match; + if (match = matchers.rgb.exec(color)) return { + r: match[1], + g: match[2], + b: match[3] + }; + if (match = matchers.rgba.exec(color)) return { + r: match[1], + g: match[2], + b: match[3], + a: match[4] + }; + if (match = matchers.hsl.exec(color)) return { + h: match[1], + s: match[2], + l: match[3] + }; + if (match = matchers.hsla.exec(color)) return { + h: match[1], + s: match[2], + l: match[3], + a: match[4] + }; + if (match = matchers.hsv.exec(color)) return { + h: match[1], + s: match[2], + v: match[3] + }; + if (match = matchers.hsva.exec(color)) return { + h: match[1], + s: match[2], + v: match[3], + a: match[4] + }; + if (match = matchers.hex8.exec(color)) return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + a: convertHexToDecimal(match[4]), + format: named ? "name" : "hex8" + }; + if (match = matchers.hex6.exec(color)) return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + format: named ? "name" : "hex" + }; + if (match = matchers.hex4.exec(color)) return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + a: convertHexToDecimal(match[4] + "" + match[4]), + format: named ? "name" : "hex8" + }; + if (match = matchers.hex3.exec(color)) return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + format: named ? "name" : "hex" + }; + return false; + } + function validateWCAG2Parms(parms) { + // return valid WCAG2 parms for isReadable. + // If input parms are invalid, return {"level":"AA", "size":"small"} + var level, size; + parms = parms || { + level: "AA", + size: "small" + }; + level = (parms.level || "AA").toUpperCase(); + size = (parms.size || "small").toLowerCase(); + if (level !== "AA" && level !== "AAA") level = "AA"; + if (size !== "small" && size !== "large") size = "small"; + return { + level: level, + size: size + }; + } + return tinycolor; +}); + +}); + +parcelRegister("i3H5K", function(module, exports) { + + +module.exports = (parcelRequire("hK98B"))((parcelRequire("5XuQH")).resolve("6Ct7A")).then(()=>parcelRequire("6ZJcz")); + +}); + + + + +parcelRegister("7dWeq", function(module, exports) { + +$parcel$export(module.exports, "dropdownProp", () => $fc5b0f46855d27ea$export$d24dfb195c42dd3d); +const $fc5b0f46855d27ea$export$d24dfb195c42dd3d = { + className: cx("p-1 border border-gray-300 h-[28px]", css` + input { + max-width: none; + width: 87px; + flex: 1; + } + `), + popover: { + className: "border border-gray-300", + itemClassName: cx("text-sm cursor-pointer min-w-[150px] p-1 hover:bg-blue-100", css` + &.active { + background: #3c82f6; + color: white; + } + `) + } +}; + +}); + + +parcelRegister("bwyLh", function(module, exports) { + +$parcel$export(module.exports, "PanelBorder", () => $80f3586702f68954$export$245eebb4f4e6c72b); + +var $lAN3N = parcelRequire("lAN3N"); + +var $cfpVL = parcelRequire("cfpVL"); + +var $eW2Jy = parcelRequire("eW2Jy"); + +var $43Iq0 = parcelRequire("43Iq0"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $6ai3B = parcelRequire("6ai3B"); + +var $769fS = parcelRequire("769fS"); + +var $3M49X = parcelRequire("3M49X"); + +var $7dWeq = parcelRequire("7dWeq"); + +var $bjM6F = parcelRequire("bjM6F"); + +var $emJmR = parcelRequire("emJmR"); + +var $dCav9 = parcelRequire("dCav9"); +const $80f3586702f68954$export$245eebb4f4e6c72b = ({ value: value, update: update, mode: mode })=>{ + const params = (0, $bjM6F.responsiveVal)(value, "border", mode, { + style: "solid" + }); + const detectMixed = (round)=>{ + let rounded = round; + let corner = []; + (0, (/*@__PURE__*/$parcel$interopDefault($eW2Jy)))(rounded, (r, v, k)=>{ + corner.push(v); + }); + let uniqueCorner = (0, (/*@__PURE__*/$parcel$interopDefault($43Iq0)))(corner); + if (uniqueCorner.length > 1 && corner.length === 4) return true; + return false; + }; + const detectMixedCorner = (round)=>{ + let rounded = round; + let corner = []; + (0, (/*@__PURE__*/$parcel$interopDefault($eW2Jy)))(rounded, (r, v, k)=>{ + corner.push(v); + }); + let uniqueCorner = (0, (/*@__PURE__*/$parcel$interopDefault($43Iq0)))(corner); + if (uniqueCorner.length > 1 && corner.length === 4) return { + isMix: true, + value: "Mixed" + }; + return { + isMix: false, + value: uniqueCorner[0] + "" + }; + }; + const updateAllCorner = (props)=>{ + const { value: value } = props; + update("border", { + ...params, + rounded: { + tr: value, + tl: value, + bl: value, + br: value + } + }); + return { + tr: value, + tl: value, + bl: value, + br: value + }; + }; + const local = (0, $4WfNn.useLocal)({ + colorOpen: false, + isMix: false, + isBorderMix: false, + open: false, + corner: null, + borderVal: null, + ready: false, + border: false + }, ()=>{ + let isMixed = detectMixedCorner(params.rounded); + local.isMix = isMixed.isMix; + if (isMixed.isMix) local.open = true; + let mixStroke = detectMixedCorner(params.stroke); + local.isBorderMix = mixStroke.isMix; + if (mixStroke.isMix) local.border = true; + local.render(); + }); + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex flex-col space-y-2", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex flex-row justify-between text-xs "), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Background Size", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-white p-[2px] border border-gray-300 flex items-stretch", css` + .border { + width: 70px !important; + } + input { + width: 100%; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $dCav9.Dropdown), { + ...(0, $7dWeq.dropdownProp), + value: params.style, + items: [ + { + value: "solid", + label: "Solid" + }, + { + value: "dash", + label: "Dash" + } + ], + onChange: (val)=>{ + update("border", { + ...params, + style: val + }); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Stroke", + asChild: true, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-white p-[2px] border border-gray-300 flex items-stretch", css` + input { + width: 100% !important; + } + .field-num { + width: 60px !important; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M20 15H4c-.55 0-1 .45-1 1s.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1zm0-5H4c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-1c0-.55-.45-1-1-1zm0-6H4c-.55 0-1 .45-1 1v2c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1zm.5 15h-17c-.28 0-.5.22-.5.5s.22.5.5.5h17c.28 0 .5-.22.5-.5s-.22-.5-.5-.5z" + }) + }) + }), + value: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(detectMixedCorner(params.stroke), "isMix") ? "" : (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(detectMixedCorner(params.stroke), "value") + "", + disabled: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(detectMixedCorner(params.stroke), "isMix") ? "Mixed" : false, + update: (val)=>{ + let value = parseInt(val.replaceAll("px", "")); + let data = { + t: value, + b: value, + l: value, + r: value + }; + update("border", { + ...params, + stroke: data + }); + let mixStroke = detectMixedCorner(data); + local.isBorderMix = mixStroke.isMix; + local.render(); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Toggle Border", + placement: "top-end", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6ai3B.Button), { + className: cx("flex-1", css` + width: 30px; + max-width: 30px; + height: 35px; + min-width: 0px !important; + background: ${local.border ? "#3c82f6" : "#fff"} !important; + border-color: ${local.border ? "#7baeff" : "#d1d1d1"} !important; + `), + onClick: ()=>{ + local.border = !local.border; + local.render(); + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "none", + stroke: "currentColor", + strokeLinecap: "round", + strokeLinejoin: "round", + strokeWidth: "2", + d: "M4 8v8m16 0V8M8 4h8M8 20h8" + }) + }) + }) + }) + }) + }) + ] + }), + local.border ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex flex-row text-xs ", css` + .field-num { + height: 25px; + border: 1px solid #d1d1d1; + } + `, css` + .field-num { + width: 45px !important; + border-right: 0px !important; + } + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Border Left", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M3.5 21a1 1 0 0 1-1-1V4a1 1 0 0 1 2 0v16a1 1 0 0 1-1 1Z" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "7.5", + cy: "12", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "11.5", + cy: "12", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "15.5", + cy: "12", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "19.5", + cy: "12", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "7.5", + cy: "4", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "11.5", + cy: "4", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "15.5", + cy: "4", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "19.5", + cy: "4", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "19.5", + cy: "8", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "19.5", + cy: "16", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "11.5", + cy: "8", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "11.5", + cy: "16", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "7.5", + cy: "20", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "11.5", + cy: "20", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "15.5", + cy: "20", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "19.5", + cy: "20", + r: "1", + fill: "currentColor", + opacity: ".5" + }) + ] + }) + }), + value: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(params, "stroke.l") + "px", + update: (val)=>{ + let data = { + ...params.stroke, + l: parseInt(val.replaceAll("px", "")) + }; + update("border", { + ...params, + stroke: data + }); + let isMixed = detectMixedCorner(data); + local.isBorderMix = isMixed.isMix; + local.borderVal = isMixed.value; + local.render(); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Border Top", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M20 4.5H4a1 1 0 0 1 0-2h16a1 1 0 0 1 0 2Z" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12", + cy: "7.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12", + cy: "11.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12", + cy: "15.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12", + cy: "19.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "20", + cy: "7.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "20", + cy: "11.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "20", + cy: "15.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "20", + cy: "19.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "16", + cy: "19.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "8", + cy: "19.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "16", + cy: "11.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "8", + cy: "11.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4", + cy: "7.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4", + cy: "11.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4", + cy: "15.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4", + cy: "19.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }) + ] + }) + }), + value: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(params, "stroke.t") + "px", + update: (val)=>{ + let data = { + ...params.stroke, + t: parseInt(val.replaceAll("px", "")) + }; + update("border", { + ...params, + stroke: data + }); + let isMixed = detectMixedCorner(data); + local.isBorderMix = isMixed.isMix; + local.borderVal = isMixed.value; + local.render(); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Border Right", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M20.5 21a1 1 0 0 1-1-1V4a1 1 0 0 1 2 0v16a1 1 0 0 1-1 1Z" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "16.5", + cy: "12", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12.5", + cy: "12", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "8.5", + cy: "12", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4.5", + cy: "12", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "16.5", + cy: "20", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12.5", + cy: "20", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "8.5", + cy: "20", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4.5", + cy: "20", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4.5", + cy: "16", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4.5", + cy: "8", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12.5", + cy: "16", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12.5", + cy: "8", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "16.5", + cy: "4", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12.5", + cy: "4", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "8.5", + cy: "4", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4.5", + cy: "4", + r: "1", + fill: "currentColor", + opacity: ".5" + }) + ] + }) + }), + value: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(params, "stroke.r") + "px", + update: (val)=>{ + let data = { + ...params.stroke, + r: parseInt(val.replaceAll("px", "")) + }; + update("border", { + ...params, + stroke: data + }); + let isMixed = detectMixedCorner(data); + local.isBorderMix = isMixed.isMix; + local.borderVal = isMixed.value; + local.render(); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Border Bottom", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M20 21.5H4a1 1 0 0 1 0-2h16a1 1 0 0 1 0 2Z" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12", + cy: "16.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12", + cy: "12.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12", + cy: "8.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "12", + cy: "4.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4", + cy: "16.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4", + cy: "12.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4", + cy: "8.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "4", + cy: "4.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "8", + cy: "4.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "16", + cy: "4.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "8", + cy: "12.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "16", + cy: "12.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "20", + cy: "16.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "20", + cy: "12.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "20", + cy: "8.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("circle", { + cx: "20", + cy: "4.5", + r: "1", + fill: "currentColor", + opacity: ".5" + }) + ] + }) + }), + value: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(params, "stroke.b") + "px", + update: (val)=>{ + let data = { + ...params.stroke, + b: parseInt(val.replaceAll("px", "")) + }; + update("border", { + ...params, + stroke: data + }); + let isMixed = detectMixedCorner(data); + local.isBorderMix = isMixed.isMix; + local.borderVal = isMixed.value; + local.render(); + } + }) + }) + }) + ] + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {}), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex flex-row items-stretch justify-between text-xs ", css` + .field-num { + border: 1px solid #d1d1d1; + } + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Border Color", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-white p-[2px] border border-gray-300 flex items-stretch", css` + .color-box { + height: 25px !important; + width: 50px; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $769fS.FieldColor), { + popupID: "border-color", + value: params.color, + update: (color)=>{ + update("border", { + ...params, + color: color + }); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Corner", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("", css` + .field-num { + width: 85px; + height: 30px; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M19 19h2v2h-2v-2zm0-2h2v-2h-2v2zM3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm0-4h2V3H3v2zm4 0h2V3H7v2zm8 16h2v-2h-2v2zm-4 0h2v-2h-2v2zm4 0h2v-2h-2v2zm-8 0h2v-2H7v2zm-4 0h2v-2H3v2zM21 8c0-2.76-2.24-5-5-5h-5v2h5c1.65 0 3 1.35 3 3v5h2V8z" + }) + }) + }), + width: "100%", + enableWhenDrag: true, + value: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(detectMixedCorner(params.rounded), "isMix") ? "" : (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(detectMixedCorner(params.rounded), "value") + "", + disabled: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(detectMixedCorner(params.rounded), "isMix") ? "Mixed" : false, + update: (val, setVal)=>{ + let result = updateAllCorner({ + value: parseInt(val.replaceAll("px", "")) + }); + let isMixed = detectMixedCorner(result); + local.isMix = isMixed.isMix; + local.render(); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Independent Rounded Corner", + placement: "top-end", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6ai3B.Button), { + className: cx("flex-1 flex flex-row items-center justify-center", css` + width: 30px; + max-width: 30px; + height: 30px; + background: ${local.open ? "rgb(229,231,235)" : "#fff"} !important; + border-color: #d1d1d1 !important; + `), + onClick: ()=>{ + local.open = !local.open; + local.render(); + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "none", + stroke: "currentColor", + strokeLinecap: "round", + strokeLinejoin: "round", + strokeWidth: "2", + d: "M16 4h2a2 2 0 0 1 2 2v2m0 8v2a2 2 0 0 1-2 2h-2m-8 0H6a2 2 0 0 1-2-2v-2m0-8V6a2 2 0 0 1 2-2h2" + }) + }) + }) + }) + }) + }) + ] + }), + local.open ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex flex-row text-xs ", css` + .field-num { + height: 25px; + border: 1px solid #d1d1d1; + } + `, css` + .field-num { + width: 45px !important; + border-right: 0px !important; + } + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Corner Top Right", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "none", + stroke: "currentColor", + strokeLinecap: "round", + strokeLinejoin: "round", + strokeWidth: "1.5", + d: "m20.01 16.01l-.01-.011m.01 4.011l-.01-.011m-3.99.011l-.01-.011m-3.99.011l-.01-.011m-3.99.011L8 19.999m-3.99.011L4 19.999m.01-3.989L4 15.999m.01-3.989L4 11.999m.01-3.989L4 7.999m.01-3.989L4 3.999m4.01.011L8 3.999M20.01 12V4h-8v8h8Z" + }) + }) + }), + value: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(params, "rounded.tr") + "px", + update: (val)=>{ + update("border", { + ...params, + rounded: { + ...params.rounded, + tr: parseInt(val.replaceAll("px", "")) + } + }); + let isMixed = detectMixedCorner({ + ...params.rounded, + tr: parseInt(val.replaceAll("px", "")) + }); + local.isMix = isMixed.isMix; + local.render(); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Corner Top Left", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "none", + stroke: "currentColor", + strokeLinecap: "round", + strokeLinejoin: "round", + strokeWidth: "1.5", + d: "m4 16.01l.01-.011M4 20.01l.01-.011M8 20.01l.01-.011m3.99.011l.01-.011m3.99.011l.01-.011m3.99.011l.01-.011M20 16.01l.01-.011M20 12.01l.01-.011M20 8.01l.01-.011M20 4.01l.01-.011M16 4.01l.01-.011M4 12V4h8v8H4Z" + }) + }) + }), + value: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(params, "rounded.tl") + "px", + update: (val)=>{ + update("border", { + ...params, + rounded: { + ...params.rounded, + tl: parseInt(val.replaceAll("px", "")) + } + }); + let isMixed = detectMixedCorner({ + ...params.rounded, + tl: parseInt(val.replaceAll("px", "")) + }); + local.isMix = isMixed.isMix; + local.render(); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Corner Bottom Left", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "none", + stroke: "currentColor", + strokeLinecap: "round", + strokeLinejoin: "round", + strokeWidth: "1.5", + d: "m4 8l.01.011M4 4l.01.011M8 4l.01.011M12 4l.01.011M16 4l.01.011M20 4l.01.011M20 8l.01.011M20 12l.01.011M20 16l.01.011M20 20l.01.011M16 20l.01.011M4 12.01v8h8v-8H4Z" + }) + }) + }), + value: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(params, "rounded.bl") + "px", + update: (val)=>{ + update("border", { + ...params, + rounded: { + ...params.rounded, + bl: parseInt(val.replaceAll("px", "")) + } + }); + let isMixed = detectMixedCorner({ + ...params.rounded, + bl: parseInt(val.replaceAll("px", "")) + }); + local.isMix = isMixed.isMix; + local.render(); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Corner Bottom Right", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "none", + stroke: "currentColor", + strokeLinecap: "round", + strokeLinejoin: "round", + strokeWidth: "1.5", + d: "m20.01 8l-.01.011M20.01 4l-.01.011M16.01 4l-.01.011M12.01 4l-.01.011M8.01 4L8 4.011M4.01 4L4 4.011M4.01 8L4 8.011M4.01 12l-.01.011M4.01 16l-.01.011M4.01 20l-.01.011M8.01 20l-.01.011m12.01-8.001v8h-8v-8h8Z" + }) + }) + }), + value: (0, (/*@__PURE__*/$parcel$interopDefault($cfpVL)))(params, "rounded.br") + "px", + update: (val)=>{ + update("border", { + ...params, + rounded: { + ...params.rounded, + br: parseInt(val.replaceAll("px", "")) + } + }); + let isMixed = detectMixedCorner({ + ...params.rounded, + br: parseInt(val.replaceAll("px", "")) + }); + local.isMix = isMixed.isMix; + local.render(); + } + }) + }) + }) + ] + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {}) + ] + }); +}; + +}); +parcelRegister("eW2Jy", function(module, exports) { +/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; +/** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = "Expected a function"; +/** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = "__lodash_hash_undefined__"; +/** Used to compose bitmasks for comparison styles. */ var UNORDERED_COMPARE_FLAG = 1, PARTIAL_COMPARE_FLAG = 2; +/** Used as references for various `Number` constants. */ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991; +/** `Object#toString` result references. */ var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag = "[object Object]", promiseTag = "[object Promise]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", weakMapTag = "[object WeakMap]"; +var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; +/** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; +/** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; +/** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; +/** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; +/** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; +/** Detect free variable `global` from Node.js. */ var freeGlobal = typeof $parcel$global == "object" && $parcel$global && $parcel$global.Object === Object && $parcel$global; +/** Detect free variable `self`. */ var freeSelf = typeof self == "object" && self && self.Object === Object && self; +/** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function("return this")(); +/** Detect free variable `exports`. */ var freeExports = exports && !exports.nodeType && exports; +/** Detect free variable `module`. */ var freeModule = freeExports && true && module && !module.nodeType && module; +/** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; +/** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process; +/** Used to access faster Node.js helpers. */ var nodeUtil = function() { + try { + return freeProcess && freeProcess.binding("util"); + } catch (e) {} +}(); +/* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; +/** + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ function arrayEach(array, iteratee) { + var index = -1, length = array ? array.length : 0; + while(++index < length){ + if (iteratee(array[index], index, array) === false) break; + } + return array; +} +/** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ function arraySome(array, predicate) { + var index = -1, length = array ? array.length : 0; + while(++index < length){ + if (predicate(array[index], index, array)) return true; + } + return false; +} +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ function baseTimes(n, iteratee) { + var index = -1, result = Array(n); + while(++index < n)result[index] = iteratee(index); + return result; +} +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ function baseUnary(func) { + return function(value) { + return func(value); + }; +} +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ function getValue(object, key) { + return object == null ? undefined : object[key]; +} +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != "function") try { + result = !!(value + ""); + } catch (e) {} + return result; +} +/** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ function mapToArray(map) { + var index = -1, result = Array(map.size); + map.forEach(function(value, key) { + result[++index] = [ + key, + value + ]; + }); + return result; +} +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} +/** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ function setToArray(set) { + var index = -1, result = Array(set.size); + set.forEach(function(value) { + result[++index] = value; + }); + return result; +} +/** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; +/** Used to detect overreaching core-js shims. */ var coreJsData = root["__core-js_shared__"]; +/** Used to detect methods masquerading as native. */ var maskSrcKey = function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; +}(); +/** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; +/** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ var objectToString = objectProto.toString; +/** Used to detect if a method is native. */ var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); +/** Built-in value references. */ var Symbol = root.Symbol, Uint8Array = root.Uint8Array, getPrototype = overArg(Object.getPrototypeOf, Object), objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice; +/* Built-in method references for those with the same name as other `lodash` methods. */ var nativeKeys = overArg(Object.keys, Object); +/* Built-in method references that are verified to be native. */ var DataView = getNative(root, "DataView"), Map = getNative(root, "Map"), Promise = getNative(root, "Promise"), Set = getNative(root, "Set"), WeakMap = getNative(root, "WeakMap"), nativeCreate = getNative(Object, "create"); +/** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); +/** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function Hash(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ function hashSet(key, value) { + var data = this.__data__; + data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value; + return this; +} +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype["delete"] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function ListCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ function listCacheClear() { + this.__data__ = []; +} +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function listCacheDelete(key) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) return false; + var lastIndex = data.length - 1; + if (index == lastIndex) data.pop(); + else splice.call(data, index, 1); + return true; +} +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function listCacheGet(key) { + var data = this.__data__, index = assocIndexOf(data, key); + return index < 0 ? undefined : data[index][1]; +} +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ function listCacheSet(key, value) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) data.push([ + key, + value + ]); + else data[index][1] = value; + return this; +} +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype["delete"] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function MapCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ function mapCacheClear() { + this.__data__ = { + "hash": new Hash, + "map": new (Map || ListCache), + "string": new Hash + }; +} +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function mapCacheDelete(key) { + return getMapData(this, key)["delete"](key); +} +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function mapCacheGet(key) { + return getMapData(this, key).get(key); +} +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function mapCacheHas(key) { + return getMapData(this, key).has(key); +} +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; +} +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype["delete"] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ function SetCache(values) { + var index = -1, length = values ? values.length : 0; + this.__data__ = new MapCache; + while(++index < length)this.add(values[index]); +} +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ function setCacheHas(value) { + return this.__data__.has(value); +} +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function Stack(entries) { + this.__data__ = new ListCache(entries); +} +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ function stackClear() { + this.__data__ = new ListCache; +} +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function stackDelete(key) { + return this.__data__["delete"](key); +} +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function stackGet(key) { + return this.__data__.get(key); +} +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function stackHas(key) { + return this.__data__.has(key); +} +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ function stackSet(key, value) { + var cache = this.__data__; + if (cache instanceof ListCache) { + var pairs = cache.__data__; + if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) { + pairs.push([ + key, + value + ]); + return this; + } + cache = this.__data__ = new MapCache(pairs); + } + cache.set(key, value); + return this; +} +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype["delete"] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = isArray(value) || isArguments(value) ? baseTimes(value.length, String) : []; + var length = result.length, skipIndexes = !!length; + for(var key in value)if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == "length" || isIndex(key, length)))) result.push(key); + return result; +} +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ function assocIndexOf(array, key) { + var length = array.length; + while(length--){ + if (eq(array[length][0], key)) return length; + } + return -1; +} +/** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. + */ function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} +/** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ var baseFor = createBaseFor(); +/** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); +} +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ function baseGet(object, path) { + path = isKey(path, object) ? [ + path + ] : castPath(path); + var index = 0, length = path.length; + while(object != null && index < length)object = object[toKey(path[index++])]; + return index && index == length ? object : undefined; +} +/** + * The base implementation of `getTag`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ function baseGetTag(value) { + return objectToString.call(value); +} +/** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ function baseHasIn(object, key) { + return object != null && key in Object(object); +} +/** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @param {boolean} [bitmask] The bitmask of comparison flags. + * The bitmask may be composed of the following flags: + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ function baseIsEqual(value, other, customizer, bitmask, stack) { + if (value === other) return true; + if (value == null || other == null || !isObject(value) && !isObjectLike(other)) return value !== value && other !== other; + return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); +} +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { + var objIsArr = isArray(object), othIsArr = isArray(other), objTag = arrayTag, othTag = arrayTag; + if (!objIsArr) { + objTag = getTag(object); + objTag = objTag == argsTag ? objectTag : objTag; + } + if (!othIsArr) { + othTag = getTag(other); + othTag = othTag == argsTag ? objectTag : othTag; + } + var objIsObj = objTag == objectTag && !isHostObject(object), othIsObj = othTag == objectTag && !isHostObject(other), isSameTag = objTag == othTag; + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return objIsArr || isTypedArray(object) ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); + } + if (!(bitmask & PARTIAL_COMPARE_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); + } + } + if (!isSameTag) return false; + stack || (stack = new Stack); + return equalObjects(object, other, equalFunc, customizer, bitmask, stack); +} +/** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, length = index, noCustomizer = !customizer; + if (object == null) return !length; + object = Object(object); + while(index--){ + var data = matchData[index]; + if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) return false; + } + while(++index < length){ + data = matchData[index]; + var key = data[0], objValue = object[key], srcValue = data[1]; + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) return false; + } else { + var stack = new Stack; + if (customizer) var result = customizer(objValue, srcValue, key, object, source, stack); + if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) : result)) return false; + } + } + return true; +} +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) return false; + var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ function baseIsTypedArray(value) { + return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; +} +/** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == "function") return value; + if (value == null) return identity; + if (typeof value == "object") return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); + return property(value); +} +/** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ function baseKeys(object) { + if (!isPrototype(object)) return nativeKeys(object); + var result = []; + for(var key in Object(object))if (hasOwnProperty.call(object, key) && key != "constructor") result.push(key); + return result; +} +/** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) return matchesStrictComparable(matchData[0][0], matchData[0][1]); + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; +} +/** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) return matchesStrictComparable(toKey(path), srcValue); + return function(object) { + var objValue = get(object, path); + return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); + }; +} +/** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ function basePropertyDeep(path) { + return function(object) { + return baseGet(object, path); + }; +} +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == "string") return value; + if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : ""; + var result = value + ""; + return result == "0" && 1 / value == -INFINITY ? "-0" : result; +} +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ function castPath(value) { + return isArray(value) ? value : stringToPath(value); +} +/** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; + while(length--){ + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) break; + } + return object; + }; +} +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, arrLength = array.length, othLength = other.length; + if (arrLength != othLength && !(isPartial && othLength > arrLength)) return false; + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked && stack.get(other)) return stacked == other; + var index = -1, result = true, seen = bitmask & UNORDERED_COMPARE_FLAG ? new SetCache : undefined; + stack.set(array, other); + stack.set(other, array); + // Ignore non-index properties. + while(++index < arrLength){ + var arrValue = array[index], othValue = other[index]; + if (customizer) var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); + if (compared !== undefined) { + if (compared) continue; + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!seen.has(othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) return seen.add(othIndex); + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + result = false; + break; + } + } + stack["delete"](array); + stack["delete"](other); + return result; +} +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { + switch(tag){ + case dataViewTag: + if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) return false; + object = object.buffer; + other = other.buffer; + case arrayBufferTag: + if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) return false; + return true; + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + case errorTag: + return object.name == other.name && object.message == other.message; + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == other + ""; + case mapTag: + var convert = mapToArray; + case setTag: + var isPartial = bitmask & PARTIAL_COMPARE_FLAG; + convert || (convert = setToArray); + if (object.size != other.size && !isPartial) return false; + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) return stacked == other; + bitmask |= UNORDERED_COMPARE_FLAG; + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack); + stack["delete"](object); + return result; + case symbolTag: + if (symbolValueOf) return symbolValueOf.call(object) == symbolValueOf.call(other); + } + return false; +} +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, objProps = keys(object), objLength = objProps.length, othProps = keys(other), othLength = othProps.length; + if (objLength != othLength && !isPartial) return false; + var index = objLength; + while(index--){ + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked && stack.get(other)) return stacked == other; + var result = true; + stack.set(object, other); + stack.set(other, object); + var skipCtor = isPartial; + while(++index < objLength){ + key = objProps[index]; + var objValue = object[key], othValue = other[key]; + if (customizer) var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack) : compared)) { + result = false; + break; + } + skipCtor || (skipCtor = key == "constructor"); + } + if (result && !skipCtor) { + var objCtor = object.constructor, othCtor = other.constructor; + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && "constructor" in object && "constructor" in other && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) result = false; + } + stack["delete"](object); + stack["delete"](other); + return result; +} +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; +} +/** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ function getMatchData(object) { + var result = keys(object), length = result.length; + while(length--){ + var key = result[length], value = object[key]; + result[length] = [ + key, + value, + isStrictComparable(value) + ]; + } + return result; +} +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} +/** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ var getTag = baseGetTag; +// Fallback for data views, maps, sets, and weak maps in IE 11, +// for data views in Edge < 14, and promises in Node.js. +if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set) != setTag || WeakMap && getTag(new WeakMap) != weakMapTag) getTag = function(value) { + var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : undefined; + if (ctorString) switch(ctorString){ + case dataViewCtorString: + return dataViewTag; + case mapCtorString: + return mapTag; + case promiseCtorString: + return promiseTag; + case setCtorString: + return setTag; + case weakMapCtorString: + return weakMapTag; + } + return result; +}; +/** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ function hasPath(object, path, hasFunc) { + path = isKey(path, object) ? [ + path + ] : castPath(path); + var result, index = -1, length = path.length; + while(++index < length){ + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) break; + object = object[key]; + } + if (result) return result; + var length = object ? object.length : 0; + return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object)); +} +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && (typeof value == "number" || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length; +} +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ function isKey(value, object) { + if (isArray(value)) return false; + var type = typeof value; + if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) return true; + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); +} +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ function isKeyable(value) { + var type = typeof value; + return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; +} +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ function isMasked(func) { + return !!maskSrcKey && maskSrcKey in func; +} +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ function isPrototype(value) { + var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; + return value === proto; +} +/** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ function isStrictComparable(value) { + return value === value && !isObject(value); +} +/** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) return false; + return object[key] === srcValue && (srcValue !== undefined || key in Object(object)); + }; +} +/** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ var stringToPath = memoize(function(string) { + string = toString(string); + var result = []; + if (reLeadingDot.test(string)) result.push(""); + string.replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, "$1") : number || match); + }); + return result; +}); +/** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ function toKey(value) { + if (typeof value == "string" || isSymbol(value)) return value; + var result = value + ""; + return result == "0" && 1 / value == -INFINITY ? "-0" : result; +} +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return func + ""; + } catch (e) {} + } + return ""; +} +/** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ function memoize(func, resolver) { + if (typeof func != "function" || resolver && typeof resolver != "function") throw new TypeError(FUNC_ERROR_TEXT); + var memoized = function() { + var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; + if (cache.has(key)) return cache.get(key); + var result = func.apply(this, args); + memoized.cache = cache.set(key, result); + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; +} +// Assign cache to `_.memoize`. +memoize.Cache = MapCache; +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ function eq(value, other) { + return value === other || value !== value && other !== other; +} +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ function isArguments(value) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag); +} +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ var isArray = Array.isArray; +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); +} +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8-9 which returns 'object' for typed array and other constructors. + var tag = isObject(value) ? objectToString.call(value) : ""; + return tag == funcTag || tag == genTag; +} +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ function isLength(value) { + return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ function isObject(value) { + var type = typeof value; + return !!value && (type == "object" || type == "function"); +} +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ function isObjectLike(value) { + return !!value && typeof value == "object"; +} +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ function isSymbol(value) { + return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag; +} +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ function toString(value) { + return value == null ? "" : baseToString(value); +} +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} +/** + * Checks if `path` is a direct or inherited property of `object`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @example + * + * var object = _.create({ 'a': _.create({ 'b': 2 }) }); + * + * _.hasIn(object, 'a'); + * // => true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); +} +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); +} +/** + * An alternative to `_.reduce`; this method transforms `object` to a new + * `accumulator` object which is the result of running each of its own + * enumerable string keyed properties thru `iteratee`, with each invocation + * potentially mutating the `accumulator` object. If `accumulator` is not + * provided, a new object with the same `[[Prototype]]` will be used. The + * iteratee is invoked with four arguments: (accumulator, value, key, object). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The custom accumulator value. + * @returns {*} Returns the accumulated value. + * @example + * + * _.transform([2, 3, 4], function(result, n) { + * result.push(n *= n); + * return n % 2 == 0; + * }, []); + * // => [4, 9] + * + * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } + */ function transform(object, iteratee, accumulator) { + var isArr = isArray(object) || isTypedArray(object); + iteratee = baseIteratee(iteratee, 4); + if (accumulator == null) { + if (isArr || isObject(object)) { + var Ctor = object.constructor; + if (isArr) accumulator = isArray(object) ? new Ctor : []; + else accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; + } else accumulator = {}; + } + (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) { + return iteratee(accumulator, value, index, object); + }); + return accumulator; +} +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ function identity(value) { + return value; +} +/** + * Creates a function that returns the value at `path` of a given object. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + * @example + * + * var objects = [ + * { 'a': { 'b': 2 } }, + * { 'a': { 'b': 1 } } + * ]; + * + * _.map(objects, _.property('a.b')); + * // => [2, 1] + * + * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); + * // => [1, 2] + */ function property(path) { + return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); +} +module.exports = transform; + +}); + +parcelRegister("43Iq0", function(module, exports) { +/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ /** Used as the size to enable large array optimizations. */ var $2f49e5d1107b818d$var$LARGE_ARRAY_SIZE = 200; +/** Used to stand-in for `undefined` hash values. */ var $2f49e5d1107b818d$var$HASH_UNDEFINED = "__lodash_hash_undefined__"; +/** Used as references for various `Number` constants. */ var $2f49e5d1107b818d$var$INFINITY = 1 / 0; +/** `Object#toString` result references. */ var $2f49e5d1107b818d$var$funcTag = "[object Function]", $2f49e5d1107b818d$var$genTag = "[object GeneratorFunction]"; +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ var $2f49e5d1107b818d$var$reRegExpChar = /[\\^$.*+?()[\]{}|]/g; +/** Used to detect host constructors (Safari). */ var $2f49e5d1107b818d$var$reIsHostCtor = /^\[object .+?Constructor\]$/; +/** Detect free variable `global` from Node.js. */ var $2f49e5d1107b818d$var$freeGlobal = typeof $parcel$global == "object" && $parcel$global && $parcel$global.Object === Object && $parcel$global; +/** Detect free variable `self`. */ var $2f49e5d1107b818d$var$freeSelf = typeof self == "object" && self && self.Object === Object && self; +/** Used as a reference to the global object. */ var $2f49e5d1107b818d$var$root = $2f49e5d1107b818d$var$freeGlobal || $2f49e5d1107b818d$var$freeSelf || Function("return this")(); +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ function $2f49e5d1107b818d$var$arrayIncludes(array, value) { + var length = array ? array.length : 0; + return !!length && $2f49e5d1107b818d$var$baseIndexOf(array, value, 0) > -1; +} +/** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ function $2f49e5d1107b818d$var$arrayIncludesWith(array, value, comparator) { + var index = -1, length = array ? array.length : 0; + while(++index < length){ + if (comparator(value, array[index])) return true; + } + return false; +} +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ function $2f49e5d1107b818d$var$baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, index = fromIndex + (fromRight ? 1 : -1); + while(fromRight ? index-- : ++index < length){ + if (predicate(array[index], index, array)) return index; + } + return -1; +} +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ function $2f49e5d1107b818d$var$baseIndexOf(array, value, fromIndex) { + if (value !== value) return $2f49e5d1107b818d$var$baseFindIndex(array, $2f49e5d1107b818d$var$baseIsNaN, fromIndex); + var index = fromIndex - 1, length = array.length; + while(++index < length){ + if (array[index] === value) return index; + } + return -1; +} +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ function $2f49e5d1107b818d$var$baseIsNaN(value) { + return value !== value; +} +/** + * Checks if a cache value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function $2f49e5d1107b818d$var$cacheHas(cache, key) { + return cache.has(key); +} +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ function $2f49e5d1107b818d$var$getValue(object, key) { + return object == null ? undefined : object[key]; +} +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ function $2f49e5d1107b818d$var$isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != "function") try { + result = !!(value + ""); + } catch (e) {} + return result; +} +/** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ function $2f49e5d1107b818d$var$setToArray(set) { + var index = -1, result = Array(set.size); + set.forEach(function(value) { + result[++index] = value; + }); + return result; +} +/** Used for built-in method references. */ var $2f49e5d1107b818d$var$arrayProto = Array.prototype, $2f49e5d1107b818d$var$funcProto = Function.prototype, $2f49e5d1107b818d$var$objectProto = Object.prototype; +/** Used to detect overreaching core-js shims. */ var $2f49e5d1107b818d$var$coreJsData = $2f49e5d1107b818d$var$root["__core-js_shared__"]; +/** Used to detect methods masquerading as native. */ var $2f49e5d1107b818d$var$maskSrcKey = function() { + var uid = /[^.]+$/.exec($2f49e5d1107b818d$var$coreJsData && $2f49e5d1107b818d$var$coreJsData.keys && $2f49e5d1107b818d$var$coreJsData.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; +}(); +/** Used to resolve the decompiled source of functions. */ var $2f49e5d1107b818d$var$funcToString = $2f49e5d1107b818d$var$funcProto.toString; +/** Used to check objects for own properties. */ var $2f49e5d1107b818d$var$hasOwnProperty = $2f49e5d1107b818d$var$objectProto.hasOwnProperty; +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ var $2f49e5d1107b818d$var$objectToString = $2f49e5d1107b818d$var$objectProto.toString; +/** Used to detect if a method is native. */ var $2f49e5d1107b818d$var$reIsNative = RegExp("^" + $2f49e5d1107b818d$var$funcToString.call($2f49e5d1107b818d$var$hasOwnProperty).replace($2f49e5d1107b818d$var$reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); +/** Built-in value references. */ var $2f49e5d1107b818d$var$splice = $2f49e5d1107b818d$var$arrayProto.splice; +/* Built-in method references that are verified to be native. */ var $2f49e5d1107b818d$var$Map = $2f49e5d1107b818d$var$getNative($2f49e5d1107b818d$var$root, "Map"), $2f49e5d1107b818d$var$Set = $2f49e5d1107b818d$var$getNative($2f49e5d1107b818d$var$root, "Set"), $2f49e5d1107b818d$var$nativeCreate = $2f49e5d1107b818d$var$getNative(Object, "create"); +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function $2f49e5d1107b818d$var$Hash(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ function $2f49e5d1107b818d$var$hashClear() { + this.__data__ = $2f49e5d1107b818d$var$nativeCreate ? $2f49e5d1107b818d$var$nativeCreate(null) : {}; +} +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function $2f49e5d1107b818d$var$hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function $2f49e5d1107b818d$var$hashGet(key) { + var data = this.__data__; + if ($2f49e5d1107b818d$var$nativeCreate) { + var result = data[key]; + return result === $2f49e5d1107b818d$var$HASH_UNDEFINED ? undefined : result; + } + return $2f49e5d1107b818d$var$hasOwnProperty.call(data, key) ? data[key] : undefined; +} +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function $2f49e5d1107b818d$var$hashHas(key) { + var data = this.__data__; + return $2f49e5d1107b818d$var$nativeCreate ? data[key] !== undefined : $2f49e5d1107b818d$var$hasOwnProperty.call(data, key); +} +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ function $2f49e5d1107b818d$var$hashSet(key, value) { + var data = this.__data__; + data[key] = $2f49e5d1107b818d$var$nativeCreate && value === undefined ? $2f49e5d1107b818d$var$HASH_UNDEFINED : value; + return this; +} +// Add methods to `Hash`. +$2f49e5d1107b818d$var$Hash.prototype.clear = $2f49e5d1107b818d$var$hashClear; +$2f49e5d1107b818d$var$Hash.prototype["delete"] = $2f49e5d1107b818d$var$hashDelete; +$2f49e5d1107b818d$var$Hash.prototype.get = $2f49e5d1107b818d$var$hashGet; +$2f49e5d1107b818d$var$Hash.prototype.has = $2f49e5d1107b818d$var$hashHas; +$2f49e5d1107b818d$var$Hash.prototype.set = $2f49e5d1107b818d$var$hashSet; +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function $2f49e5d1107b818d$var$ListCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ function $2f49e5d1107b818d$var$listCacheClear() { + this.__data__ = []; +} +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function $2f49e5d1107b818d$var$listCacheDelete(key) { + var data = this.__data__, index = $2f49e5d1107b818d$var$assocIndexOf(data, key); + if (index < 0) return false; + var lastIndex = data.length - 1; + if (index == lastIndex) data.pop(); + else $2f49e5d1107b818d$var$splice.call(data, index, 1); + return true; +} +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function $2f49e5d1107b818d$var$listCacheGet(key) { + var data = this.__data__, index = $2f49e5d1107b818d$var$assocIndexOf(data, key); + return index < 0 ? undefined : data[index][1]; +} +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function $2f49e5d1107b818d$var$listCacheHas(key) { + return $2f49e5d1107b818d$var$assocIndexOf(this.__data__, key) > -1; +} +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ function $2f49e5d1107b818d$var$listCacheSet(key, value) { + var data = this.__data__, index = $2f49e5d1107b818d$var$assocIndexOf(data, key); + if (index < 0) data.push([ + key, + value + ]); + else data[index][1] = value; + return this; +} +// Add methods to `ListCache`. +$2f49e5d1107b818d$var$ListCache.prototype.clear = $2f49e5d1107b818d$var$listCacheClear; +$2f49e5d1107b818d$var$ListCache.prototype["delete"] = $2f49e5d1107b818d$var$listCacheDelete; +$2f49e5d1107b818d$var$ListCache.prototype.get = $2f49e5d1107b818d$var$listCacheGet; +$2f49e5d1107b818d$var$ListCache.prototype.has = $2f49e5d1107b818d$var$listCacheHas; +$2f49e5d1107b818d$var$ListCache.prototype.set = $2f49e5d1107b818d$var$listCacheSet; +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function $2f49e5d1107b818d$var$MapCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ function $2f49e5d1107b818d$var$mapCacheClear() { + this.__data__ = { + "hash": new $2f49e5d1107b818d$var$Hash, + "map": new ($2f49e5d1107b818d$var$Map || $2f49e5d1107b818d$var$ListCache), + "string": new $2f49e5d1107b818d$var$Hash + }; +} +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function $2f49e5d1107b818d$var$mapCacheDelete(key) { + return $2f49e5d1107b818d$var$getMapData(this, key)["delete"](key); +} +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function $2f49e5d1107b818d$var$mapCacheGet(key) { + return $2f49e5d1107b818d$var$getMapData(this, key).get(key); +} +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function $2f49e5d1107b818d$var$mapCacheHas(key) { + return $2f49e5d1107b818d$var$getMapData(this, key).has(key); +} +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ function $2f49e5d1107b818d$var$mapCacheSet(key, value) { + $2f49e5d1107b818d$var$getMapData(this, key).set(key, value); + return this; +} +// Add methods to `MapCache`. +$2f49e5d1107b818d$var$MapCache.prototype.clear = $2f49e5d1107b818d$var$mapCacheClear; +$2f49e5d1107b818d$var$MapCache.prototype["delete"] = $2f49e5d1107b818d$var$mapCacheDelete; +$2f49e5d1107b818d$var$MapCache.prototype.get = $2f49e5d1107b818d$var$mapCacheGet; +$2f49e5d1107b818d$var$MapCache.prototype.has = $2f49e5d1107b818d$var$mapCacheHas; +$2f49e5d1107b818d$var$MapCache.prototype.set = $2f49e5d1107b818d$var$mapCacheSet; +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ function $2f49e5d1107b818d$var$SetCache(values) { + var index = -1, length = values ? values.length : 0; + this.__data__ = new $2f49e5d1107b818d$var$MapCache; + while(++index < length)this.add(values[index]); +} +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ function $2f49e5d1107b818d$var$setCacheAdd(value) { + this.__data__.set(value, $2f49e5d1107b818d$var$HASH_UNDEFINED); + return this; +} +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ function $2f49e5d1107b818d$var$setCacheHas(value) { + return this.__data__.has(value); +} +// Add methods to `SetCache`. +$2f49e5d1107b818d$var$SetCache.prototype.add = $2f49e5d1107b818d$var$SetCache.prototype.push = $2f49e5d1107b818d$var$setCacheAdd; +$2f49e5d1107b818d$var$SetCache.prototype.has = $2f49e5d1107b818d$var$setCacheHas; +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ function $2f49e5d1107b818d$var$assocIndexOf(array, key) { + var length = array.length; + while(length--){ + if ($2f49e5d1107b818d$var$eq(array[length][0], key)) return length; + } + return -1; +} +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ function $2f49e5d1107b818d$var$baseIsNative(value) { + if (!$2f49e5d1107b818d$var$isObject(value) || $2f49e5d1107b818d$var$isMasked(value)) return false; + var pattern = $2f49e5d1107b818d$var$isFunction(value) || $2f49e5d1107b818d$var$isHostObject(value) ? $2f49e5d1107b818d$var$reIsNative : $2f49e5d1107b818d$var$reIsHostCtor; + return pattern.test($2f49e5d1107b818d$var$toSource(value)); +} +/** + * The base implementation of `_.uniqBy` without support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} [iteratee] The iteratee invoked per element. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + */ function $2f49e5d1107b818d$var$baseUniq(array, iteratee, comparator) { + var index = -1, includes = $2f49e5d1107b818d$var$arrayIncludes, length = array.length, isCommon = true, result = [], seen = result; + if (comparator) { + isCommon = false; + includes = $2f49e5d1107b818d$var$arrayIncludesWith; + } else if (length >= $2f49e5d1107b818d$var$LARGE_ARRAY_SIZE) { + var set = iteratee ? null : $2f49e5d1107b818d$var$createSet(array); + if (set) return $2f49e5d1107b818d$var$setToArray(set); + isCommon = false; + includes = $2f49e5d1107b818d$var$cacheHas; + seen = new $2f49e5d1107b818d$var$SetCache; + } else seen = iteratee ? [] : result; + outer: while(++index < length){ + var value = array[index], computed = iteratee ? iteratee(value) : value; + value = comparator || value !== 0 ? value : 0; + if (isCommon && computed === computed) { + var seenIndex = seen.length; + while(seenIndex--){ + if (seen[seenIndex] === computed) continue outer; + } + if (iteratee) seen.push(computed); + result.push(value); + } else if (!includes(seen, computed, comparator)) { + if (seen !== result) seen.push(computed); + result.push(value); + } + } + return result; +} +/** + * Creates a set object of `values`. + * + * @private + * @param {Array} values The values to add to the set. + * @returns {Object} Returns the new set. + */ var $2f49e5d1107b818d$var$createSet = !($2f49e5d1107b818d$var$Set && 1 / $2f49e5d1107b818d$var$setToArray(new $2f49e5d1107b818d$var$Set([ + , + -0 +]))[1] == $2f49e5d1107b818d$var$INFINITY) ? $2f49e5d1107b818d$var$noop : function(values) { + return new $2f49e5d1107b818d$var$Set(values); +}; +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ function $2f49e5d1107b818d$var$getMapData(map, key) { + var data = map.__data__; + return $2f49e5d1107b818d$var$isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; +} +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ function $2f49e5d1107b818d$var$getNative(object, key) { + var value = $2f49e5d1107b818d$var$getValue(object, key); + return $2f49e5d1107b818d$var$baseIsNative(value) ? value : undefined; +} +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ function $2f49e5d1107b818d$var$isKeyable(value) { + var type = typeof value; + return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; +} +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ function $2f49e5d1107b818d$var$isMasked(func) { + return !!$2f49e5d1107b818d$var$maskSrcKey && $2f49e5d1107b818d$var$maskSrcKey in func; +} +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ function $2f49e5d1107b818d$var$toSource(func) { + if (func != null) { + try { + return $2f49e5d1107b818d$var$funcToString.call(func); + } catch (e) {} + try { + return func + ""; + } catch (e) {} + } + return ""; +} +/** + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurrence of each + * element is kept. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Array + * @param {Array} array The array to inspect. + * @returns {Array} Returns the new duplicate free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + */ function $2f49e5d1107b818d$var$uniq(array) { + return array && array.length ? $2f49e5d1107b818d$var$baseUniq(array) : []; +} +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ function $2f49e5d1107b818d$var$eq(value, other) { + return value === other || value !== value && other !== other; +} +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ function $2f49e5d1107b818d$var$isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8-9 which returns 'object' for typed array and other constructors. + var tag = $2f49e5d1107b818d$var$isObject(value) ? $2f49e5d1107b818d$var$objectToString.call(value) : ""; + return tag == $2f49e5d1107b818d$var$funcTag || tag == $2f49e5d1107b818d$var$genTag; +} +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ function $2f49e5d1107b818d$var$isObject(value) { + var type = typeof value; + return !!value && (type == "object" || type == "function"); +} +/** + * This method returns `undefined`. + * + * @static + * @memberOf _ + * @since 2.3.0 + * @category Util + * @example + * + * _.times(2, _.noop); + * // => [undefined, undefined] + */ function $2f49e5d1107b818d$var$noop() { +// No operation performed. +} +module.exports = $2f49e5d1107b818d$var$uniq; + +}); + + +parcelRegister("4BXR3", function(module, exports) { + +$parcel$export(module.exports, "PanelDimension", () => $63409fe7911523b7$export$f9d0edab25b29b18); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $0t7p0 = parcelRequire("0t7p0"); + +var $emJmR = parcelRequire("emJmR"); + +var $bjM6F = parcelRequire("bjM6F"); + +var $6ai3B = parcelRequire("6ai3B"); + +var $3M49X = parcelRequire("3M49X"); +const $63409fe7911523b7$export$f9d0edab25b29b18 = ({ value: value, update: update, mode: mode, id: id })=>{ + const local = (0, $4WfNn.useLocal)({ + menuWidth: null, + menuHeight: null, + toggle: true, + activeWidth: 0, + activeHeight: 0, + dim: (0, $bjM6F.responsiveVal)(value, "dim", mode, { + w: "fit", + h: "fit", + wUnit: "px", + hUnit: "px" + }) + }); + (0, $63SH6.useEffect)(()=>{ + local.dim = (0, $bjM6F.responsiveVal)(value, "dim", mode, { + w: "fit", + h: "fit", + wUnit: "px", + hUnit: "px" + }); + local.render(); + }, [ + value + ]); + const dim = local.dim; + const calculateAspectRatioFit = (props)=>{ + const { srcWidth: srcWidth, srcHeight: srcHeight, maxWidth: maxWidth, maxHeight: maxHeight } = props; + var height = maxHeight; + var width = maxWidth; + if (typeof maxWidth === "number" && typeof maxHeight === "number" && typeof srcWidth === "number" && typeof srcHeight === "number") { + height = srcHeight === maxHeight ? maxWidth * srcHeight / srcWidth : maxHeight; + width = srcWidth === maxWidth ? maxHeight * (srcWidth / srcHeight) : maxWidth; + width = Number(width.toFixed(2)); + height = Number(height.toFixed(2)); + } + return { + width: width, + height: height + }; + }; + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex items-stretch justify-between text-xs ", css` + .field-num { + width: 66px !important; + border: 1px solid #d1d1d1; + } + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex", css` + .border { + width: 70px !important; + } + input { + width: 100%; + } + .field-num { + width: 50px !important; + } + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Width", + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-[10px] w-[15px] pr-[2px] mr-[3px] h-[14px] flex items-center justify-center border-r", + children: "W" + }), + enableWhenDrag: true, + disabled: dim.w === "fit" || dim.w === "full" ? dim.w : false, + value: dim.w + (dim.wUnit || "px"), + unit: dim.wUnit || "px", + update: (val, setVal)=>{ + let _val = val; + if (typeof dim.w !== "number" && setVal) { + const nval = local.activeWidth || 0; + _val = nval + ""; + setVal(nval); + } + local.dim.w = parseInt(_val); + update("dim", { + ...dim, + w: local.dim.w, + h: local.dim.h + }); + local.render(); + } + }) + }), + local.menuWidth && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $0t7p0.Menu), { + mouseEvent: local.menuWidth, + onClose: ()=>{ + local.menuWidth = null; + local.render(); + }, + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), { + label: "Fit", + onClick: ()=>{ + local.dim.w = "fit"; + update("dim", { + ...dim, + w: local.dim.w, + h: local.dim.h + }); + } + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), { + label: "Full", + onClick: ()=>{ + local.dim.w = "full"; + update("dim", { + ...dim, + w: local.dim.w, + h: local.dim.h + }); + } + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), { + label: "Pixel", + onClick: ()=>{ + local.dim.w = local.activeWidth || 0; + local.dim.wUnit = "px"; + update("dim", { + ...dim, + w: local.dim.w, + h: local.dim.h + }); + } + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), { + label: "Percent", + onClick: ()=>{ + local.dim.w = local.activeWidth || 0; + local.dim.wUnit = "%"; + update("dim", { + ...dim, + w: local.dim.w, + h: local.dim.h + }); + } + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $6ai3B.Button), { + className: cx("flex-1", css` + width: 24px; + max-width: 25px; + border-left: 0px !important; + padding: 0px !important; + min-width: 0px !important; + `), + onClick: (e)=>{ + local.menuWidth = e; + local.render(); + }, + children: [ + dim.w === "full" && /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "16", + height: "16", + viewBox: "0 0 16 16", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fillRule: "evenodd", + d: "M3.5 7.5v-2h-1v5h1v-2h9v2h1v-5h-1v2h-9z", + fill: "#000" + }) + }), + dim.w === "fit" && /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "16", + height: "16", + viewBox: "0 0 16 16", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M3.354 4.646l-.708.708L5.293 8l-2.646 2.646.707.708L6.707 8 3.354 4.646zm10 .708L10.707 8l2.647 2.646-.708.708L9.293 8l3.354-3.354.707.708z", + fill: "#000" + }) + }), + dim.w !== "fit" && dim.w !== "full" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[16px] h-[16px] flex items-center justify-center", + children: dim.wUnit || "px" + }) + ] + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex", css` + .border { + width: 70px !important; + } + input { + width: 100%; + } + .field-num { + width: 50px !important; + } + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Height", + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-[10px] w-[15px] pr-[2px] mr-[3px] h-[14px] flex items-center justify-center border-r", + children: "H" + }), + disabled: dim.h === "fit" || dim.h === "full" ? dim.h : false, + enableWhenDrag: true, + value: dim.h + (dim.hUnit || "px"), + unit: dim.hUnit || "px", + update: (val, setVal)=>{ + let _val = val; + if (typeof dim.h !== "number" && setVal) { + const nval = local.activeHeight || 0; + _val = nval + ""; + setVal(nval); + } + local.dim.h = parseInt(_val); + update("dim", { + ...dim, + w: local.dim.w, + h: local.dim.h + }); + local.render(); + } + }) + }), + local.menuHeight && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $0t7p0.Menu), { + mouseEvent: local.menuHeight, + onClose: ()=>{ + local.menuHeight = null; + local.render(); + }, + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), { + label: "Fit", + onClick: ()=>{ + local.dim.h = "fit"; + update("dim", { + ...dim, + w: local.dim.w, + h: local.dim.h + }); + } + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), { + label: "Full", + onClick: ()=>{ + local.dim.h = "full"; + update("dim", { + ...dim, + w: local.dim.w, + h: local.dim.h + }); + } + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), { + label: "Pixel", + onClick: ()=>{ + local.dim.h = local.activeHeight || 0; + local.dim.hUnit = "px"; + update("dim", { + ...dim, + w: local.dim.w, + h: local.dim.h + }); + } + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), { + label: "Percent", + onClick: ()=>{ + local.dim.h = local.activeHeight || 0; + local.dim.hUnit = "%"; + update("dim", { + ...dim, + w: local.dim.w, + h: local.dim.h + }); + } + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $6ai3B.Button), { + className: cx("flex-1", css` + width: 24px; + max-width: 25px; + border-left: 0px !important; + padding: 0px !important; + min-width: 0px !important; + `), + onClick: (e)=>{ + local.menuHeight = e; + local.render(); + // let val = dim.h; + // if (dim.h === "fit") val = "full"; + // else if (dim.h === "full") val = activeEl?.offsetHeight || 0; + // else val = "fit"; + // update("dim", { + // ...dim, + // h: val, + // }); + }, + children: [ + dim.h === "full" && /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + className: "w-[16px] h-[16px]", + xmlns: "http://www.h3.org/2000/svg", + width: "16", + height: "16", + viewBox: "0 0 16 16", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fillRule: "evenodd", + d: "M8.5 3.5h2v-1h-5v1h2v9h-2v1h5v-1h-2v-9z", + fill: "#000" + }) + }), + dim.h === "fit" && /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.h3.org/2000/svg", + width: "16", + height: "16", + viewBox: "0 0 16 16", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M4.646 12.646l.708.708L8 10.707l2.646 2.646.708-.707L8 9.293l-3.354 3.354zm.708-10L8 5.294l2.646-2.647.708.708L8 6.707 4.646 3.354l.708-.707z", + fill: "#000" + }) + }), + dim.h !== "fit" && dim.h !== "full" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[16px] h-[16px] flex items-center justify-center", + children: dim.hUnit || "px" + }) + ] + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex", + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: local.toggle ? "Full" : "Fit", + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6ai3B.Button), { + className: cx("flex-1", css` + width: 30px; + max-width: 30px; + min-width: 0px !important; + padding: 0px !important; + min-width: 0px !important; + `), + onClick: (e)=>{ + update("dim", { + ...dim, + w: !local.toggle ? "fit" : "full", + h: !local.toggle ? "fit" : "full" + }); + local.toggle = !local.toggle; + local.render(); + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[10px] h-[16px] flex items-center justify-center", + children: local.toggle ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 512 512", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M208 48V16H16v192h32V70.627l160.687 160.686l22.626-22.626L70.627 48H208zm256 256v137.373L299.313 276.687l-22.626 22.626L441.373 464H304v32h192V304h-32z" + }) + }) + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 512 512", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M204 181.372L38.628 16H16v22.628L181.372 204H44v32h192V44h-32v137.372zM326.628 304H464v-32H272v192h32V326.628L473.372 496H496v-22.628L326.628 304z" + }) + }) + }) + }) + }) + }) + }) + }) + ] + }); +}; + +}); + +parcelRegister("9LESc", function(module, exports) { + +$parcel$export(module.exports, "PanelFont", () => $ac66b7df81bcd978$export$f13b6951a671eff9); + +var $lAN3N = parcelRequire("lAN3N"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $769fS = parcelRequire("769fS"); + +var $acn6z = parcelRequire("acn6z"); + +var $3M49X = parcelRequire("3M49X"); + +var $6ai3B = parcelRequire("6ai3B"); + +var $7dWeq = parcelRequire("7dWeq"); + +var $3i93m = parcelRequire("3i93m"); + +var $eClhP = parcelRequire("eClhP"); + +var $34isQ = parcelRequire("34isQ"); + +var $bjM6F = parcelRequire("bjM6F"); + +var $emJmR = parcelRequire("emJmR"); + +var $dCav9 = parcelRequire("dCav9"); +const $ac66b7df81bcd978$var$EmptyFont = { + name: "DEFAULT", + weight: [ + "200", + "300", + "400", + "600", + "700", + "900" + ] +}; +const $ac66b7df81bcd978$var$fflist = [ + $ac66b7df81bcd978$var$EmptyFont, + ...(0, (/*@__PURE__*/$parcel$interopDefault($acn6z))) +]; +const $ac66b7df81bcd978$export$f13b6951a671eff9 = ({ value: value, update: update, mode: mode })=>{ + const local = (0, $4WfNn.useLocal)({ + font: $ac66b7df81bcd978$var$EmptyFont + }); + const font = (0, $bjM6F.responsiveVal)(value, "font", mode, { + size: 15, + height: "auto", + align: "left", + whitespace: "whitespace-normal", + wordBreak: "break-normal" + }); + if (font.height === 0) font.height = "auto"; + if (font.family) { + const ffont = (0, (/*@__PURE__*/$parcel$interopDefault($acn6z))).find((f)=>f.name === font.family); + if (ffont) local.font = ffont; + } else local.font = $ac66b7df81bcd978$var$EmptyFont; + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex flex-col items-stretch space-y-2", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex items-stretch space-x-2 text-xs justify-between"), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Text Color", + asChild: true, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-white p-[2px] border border-gray-300 flex items-stretch", css` + .color-box { + height: 25px !important; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $769fS.FieldColor), { + popupID: "font-color", + value: font.color, + update: (color)=>{ + update("font", { + ...font, + color: color + }); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Font Size", + asChild: true, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("bg-white p-[2px] border border-gray-300 flex items-stretch", css` + input { + width: 20px !important; + } + .field-num { + width: 55px !important; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[22px] h-[14px] flex items-center justify-center pr-2 border-r border-gray-300 mr-1", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "11", + fill: "none", + viewBox: "0 0 15 11", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "#000", + fillRule: "evenodd", + d: "M14.125 5.167c.387 0 .7.28.7.625v3.75c0 .345-.313.624-.7.624a.708.708 0 01-.638-.367 3.04 3.04 0 01-1.462.367c-1.546 0-2.8-1.119-2.8-2.5 0-1.38 1.254-2.5 2.8-2.5a3.04 3.04 0 011.462.368.709.709 0 01.638-.367zm-9.1-5c.513 0 .967.295 1.124.73L9.192 9.35c.118.329-.084.68-.452.787-.369.105-.763-.076-.881-.404L6.89 7.042H3.16l-.968 2.69c-.118.33-.513.51-.88.405C.942 10.03.74 9.678.858 9.35L3.902.898c.157-.436.61-.731 1.123-.731zm7 6.25c-.773 0-1.4.56-1.4 1.25s.627 1.25 1.4 1.25c.774 0 1.4-.56 1.4-1.25s-.627-1.25-1.4-1.25zm-7-4.555l-1.414 3.93h2.83l-1.416-3.93z", + clipRule: "evenodd" + }) + }) + }), + value: (font.size === 0 ? 15 : font.size) + "px", + update: (size)=>{ + update("font", { + ...font, + size: parseInt(size.replaceAll("px", "")) + }); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("bg-white p-[2px] border border-gray-300 flex items-stretch", css` + input { + width: 24px !important; + } + .field-num { + width: 60px !important; + } + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Font Height", + asChild: true, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 flex items-center", + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("w-[22px] h-[14px] flex items-center justify-center pr-2 border-r border-gray-300 mr-1"), + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "14", + height: "14", + className: "svg", + viewBox: "0 0 14 14", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M14 1H0V0h14v1zm0 13H0v-1h14v1z" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fillRule: "evenodd", + d: "M3.548 11l2.8-8h1.304l2.8 8h-.954l-.7-2H5.202l-.7 2h-.954zM7 3.862L8.448 8H5.552L7 3.862z" + }) + ] + }) + }), + hideUnit: true, + disabled: font.height === "auto" ? "Auto" : false, + value: (font.height || 100) + "%", + update: (size)=>{ + update("font", { + ...font, + height: parseInt(size.replaceAll("px", "")) + }); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + placement: "top-end", + content: "Toggle: Auto font height", + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6ai3B.Button), { + className: cx("flex-1", css` + width: 4px; + min-width: 0px !important; + margin-left: 5px !important; + padding: 0 3px !important; + background: ${font.height === "auto" ? "#70a3f4" : "#fff"} !important; + border: ${font.height === "auto" ? "2px solid transparent" : "2px solid #708dcb"} !important; + `), + onClick: ()=>{ + if (font.height !== "auto") update("font", { + ...font, + height: "auto" + }); + else update("font", { + ...font, + height: 100 + }); + } + }) + }) + ] + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + "Font Family", + /*#__PURE__*/ (0, $lAN3N.jsx)("br", {}), + "Changing font family for current element." + ] + }), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $dCav9.Dropdown), { + ...(0, $7dWeq.dropdownProp), + value: local.font.name || "DEFAULT", + items: Object.entries($ac66b7df81bcd978$var$fflist).map((e, idx)=>{ + return { + label: e[1].name, + value: e[1].name + }; + }), + popover: { + ...(0, $7dWeq.dropdownProp).popover, + renderItem (item, idx) { + if (typeof item === "string") return null; + if (!(0, $3i93m.w).loadedFonts) (0, $3i93m.w).loadedFonts = []; + if ((0, $3i93m.w).loadedFonts.indexOf(item.value) < 0 && item.value !== "DEFAULT") { + (0, $3i93m.w).loadedFonts.push(item.value); + const doc = document; + let weight = `:wght@${[ + 300, + 400, + 500, + 600 + ].join(";")}`; + let fontName = item.value.replace(/ /g, "+"); + const _href = `https://fonts.googleapis.com/css2?family=${fontName}${weight}&display=block`; + if (!doc.querySelector(`link[href="${_href}]`)) { + const link = doc.createElement("link"); + link.type = "text/css"; + link.rel = "stylesheet"; + link.href = _href; + doc.head.appendChild(link); + } + } + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx(item.value !== "DEFAULT" && css` + font-family: "${item.value}", "Inter"; + `), + children: item.label + }); + } + }, + onChange: (val)=>{ + if (val) { + if (val === $ac66b7df81bcd978$var$EmptyFont.name) update("font", { + ...font, + family: undefined + }); + else update("font", { + ...font, + family: val + }); + } + } + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex flex-row justify-between text-xs "), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $eClhP.BoxSep), { + className: cx("justify-between", css` + padding: 0px; + & > button { + min-width: 0px; + flex: 1; + padding: 2px 4px; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $34isQ.FieldBtnRadio), { + items: { + left: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Direction: Column", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + viewBox: "0 0 24 24", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("g", { + fill: "none", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M24 0v24H0V0h24zM12.593 23.258l-.011.002-.071.035-.02.004-.014-.004-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01-.017.428.005.02.01.013.104.074.015.004.012-.004.104-.074.012-.016.004-.017-.017-.427c-.002-.01-.009-.017-.017-.018zm.265-.113l-.013.002-.185.093-.01.01-.003.011.018.43.005.012.008.007.201.093c.012.004.023 0 .029-.008l.004-.014-.034-.614c-.003-.012-.01-.02-.02-.022zm-.715.002a.023.023 0 00-.027.006l-.006.014-.034.614c0 .012.007.02.017.024l.015-.002.201-.093.01-.008.004-.011.017-.43-.003-.012-.01-.01-.184-.092z" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M14 18a1 1 0 01.117 1.993L14 20H4a1 1 0 01-.117-1.993L4 18h10zm6-5a1 1 0 110 2H4a1 1 0 110-2h16zm-6-5a1 1 0 01.117 1.993L14 10H4a1 1 0 01-.117-1.993L4 8h10zm6-5a1 1 0 01.117 1.993L20 5H4a1 1 0 01-.117-1.993L4 3h16z" + }) + ] + }) + }) + }) + }), + center: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Direction: Column Reverse", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("g", { + fill: "none", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M17 18a1 1 0 0 1 .117 1.993L17 20H7a1 1 0 0 1-.117-1.993L7 18h10Zm3-5a1 1 0 1 1 0 2H4a1 1 0 1 1 0-2h16Zm-3-5a1 1 0 0 1 .117 1.993L17 10H7a1 1 0 0 1-.117-1.993L7 8h10Zm3-5a1 1 0 0 1 .117 1.993L20 5H4a1 1 0 0 1-.117-1.993L4 3h16Z" + }) + ] + }) + }) + }) + }), + right: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Direction: Row", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("g", { + fill: "none", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M24 0v24H0V0h24ZM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035c-.01-.004-.019-.001-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427c-.002-.01-.009-.017-.017-.018Zm.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093c.012.004.023 0 .029-.008l.004-.014l-.034-.614c-.003-.012-.01-.02-.02-.022Zm-.715.002a.023.023 0 0 0-.027.006l-.006.014l-.034.614c0 .012.007.02.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01l-.184-.092Z" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M20 18a1 1 0 0 1 .117 1.993L20 20H10a1 1 0 0 1-.117-1.993L10 18h10Zm0-5a1 1 0 1 1 0 2H4a1 1 0 1 1 0-2h16Zm0-5a1 1 0 0 1 .117 1.993L20 10H10a1 1 0 0 1-.117-1.993L10 8h10Zm0-5a1 1 0 0 1 .117 1.993L20 5H4a1 1 0 0 1-.117-1.993L4 3h16Z" + }) + ] + }) + }) + }) + }) + }, + value: font.align, + disabled: false, + update: (dir)=>{ + update("font", { + ...font, + align: dir + }); + } + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $eClhP.BoxSep), { + className: cx("justify-between", css` + padding: 0px; + & > button { + min-width: 0px; + flex: 1; + padding: 2px 4px; + } + `), + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $34isQ.FieldBtnRadio), { + items: { + "whitespace-normal": /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Whitespace Normal", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M4 20V4h2v16H4Zm14 0V4h2v16h-2Zm-7.4-2.45L7.05 14l3.55-3.525l1.4 1.4L10.875 13H13q.825 0 1.413-.588T15 11q0-.825-.588-1.413T13 9H7V7h6q1.65 0 2.825 1.175T17 11q0 1.65-1.175 2.825T13 15h-2.125L12 16.125l-1.4 1.425Z" + }) + }) + }) + }), + "whitespace-nowrap": /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Whitespace no wrap", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-lg text-gray-700", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: "15", + height: "15", + viewBox: "0 0 48 48", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("g", { + fill: "none", + stroke: "#000", + strokeLinecap: "round", + strokeWidth: "4", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M8 10V38" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M24 4V16" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M16 24H42" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + strokeLinejoin: "round", + d: "M37.0561 19.0113L42.0929 24.0255L37.0561 29.123" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M24 32V44" + }) + ] + }) + }) + }) + }) + }, + value: font.whitespace, + disabled: false, + update: (dir)=>{ + update("font", { + ...font, + whitespace: dir + }); + } + }) + }) + ] + }) + ] + }); +}; + +}); +parcelRegister("acn6z", function(module, exports) { +module.exports = JSON.parse('[{"name":"ABeeZee","weight":["400"]},{"name":"Abel","weight":["400"]},{"name":"Abhaya Libre","weight":["400","500","600","700","800"]},{"name":"Abril Fatface","weight":["400"]},{"name":"Aclonica","weight":["400"]},{"name":"Acme","weight":["400"]},{"name":"Actor","weight":["400"]},{"name":"Adamina","weight":["400"]},{"name":"Advent Pro","weight":["100","200","300","400","500","600","700"]},{"name":"Aguafina Script","weight":["400"]},{"name":"Akaya Kanadaka","weight":["400"]},{"name":"Akaya Telivigala","weight":["400"]},{"name":"Akronim","weight":["400"]},{"name":"Aladin","weight":["400"]},{"name":"Alata","weight":["400"]},{"name":"Alatsi","weight":["400"]},{"name":"Aldrich","weight":["400"]},{"name":"Alef","weight":["400","700"]},{"name":"Alegreya","weight":["400","500","600","700","800","900"]},{"name":"Alegreya SC","weight":["400","500","700","800","900"]},{"name":"Alegreya Sans","weight":["100","300","400","500","700","800","900"]},{"name":"Alegreya Sans SC","weight":["100","300","400","500","700","800","900"]},{"name":"Aleo","weight":["300","400","700"]},{"name":"Alex Brush","weight":["400"]},{"name":"Alfa Slab One","weight":["400"]},{"name":"Alice","weight":["400"]},{"name":"Alike","weight":["400"]},{"name":"Alike Angular","weight":["400"]},{"name":"Allan","weight":["400","700"]},{"name":"Allerta","weight":["400"]},{"name":"Allerta Stencil","weight":["400"]},{"name":"Allison","weight":["400"]},{"name":"Allura","weight":["400"]},{"name":"Almarai","weight":["300","400","700","800"]},{"name":"Almendra","weight":["400","700"]},{"name":"Almendra Display","weight":["400"]},{"name":"Almendra SC","weight":["400"]},{"name":"Alumni Sans","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Amarante","weight":["400"]},{"name":"Amaranth","weight":["400","700"]},{"name":"Amatic SC","weight":["400","700"]},{"name":"Amethysta","weight":["400"]},{"name":"Amiko","weight":["400","600","700"]},{"name":"Amiri","weight":["400","700"]},{"name":"Amita","weight":["400","700"]},{"name":"Anaheim","weight":["400"]},{"name":"Andada Pro","weight":["400","500","600","700","800"]},{"name":"Andika","weight":["400"]},{"name":"Andika New Basic","weight":["400","700"]},{"name":"Angkor","weight":["400"]},{"name":"Annie Use Your Telescope","weight":["400"]},{"name":"Anonymous Pro","weight":["400","700"]},{"name":"Antic","weight":["400"]},{"name":"Antic Didone","weight":["400"]},{"name":"Antic Slab","weight":["400"]},{"name":"Anton","weight":["400"]},{"name":"Antonio","weight":["100","200","300","400","500","600","700"]},{"name":"Arapey","weight":["400"]},{"name":"Arbutus","weight":["400"]},{"name":"Arbutus Slab","weight":["400"]},{"name":"Architects Daughter","weight":["400"]},{"name":"Archivo","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Archivo Black","weight":["400"]},{"name":"Archivo Narrow","weight":["400","500","600","700"]},{"name":"Are You Serious","weight":["400"]},{"name":"Aref Ruqaa","weight":["400","700"]},{"name":"Arima Madurai","weight":["100","200","300","400","500","700","800","900"]},{"name":"Arimo","weight":["400","500","600","700"]},{"name":"Arizonia","weight":["400"]},{"name":"Armata","weight":["400"]},{"name":"Arsenal","weight":["400","700"]},{"name":"Artifika","weight":["400"]},{"name":"Arvo","weight":["400","700"]},{"name":"Arya","weight":["400","700"]},{"name":"Asap","weight":["400","500","600","700"]},{"name":"Asap Condensed","weight":["400","500","600","700"]},{"name":"Asar","weight":["400"]},{"name":"Asset","weight":["400"]},{"name":"Assistant","weight":["200","300","400","500","600","700","800"]},{"name":"Astloch","weight":["400","700"]},{"name":"Asul","weight":["400","700"]},{"name":"Athiti","weight":["200","300","400","500","600","700"]},{"name":"Atkinson Hyperlegible","weight":["400","700"]},{"name":"Atma","weight":["300","400","500","600","700"]},{"name":"Atomic Age","weight":["400"]},{"name":"Aubrey","weight":["400"]},{"name":"Audiowide","weight":["400"]},{"name":"Autour One","weight":["400"]},{"name":"Average","weight":["400"]},{"name":"Average Sans","weight":["400"]},{"name":"Averia Gruesa Libre","weight":["400"]},{"name":"Averia Libre","weight":["300","400","700"]},{"name":"Averia Sans Libre","weight":["300","400","700"]},{"name":"Averia Serif Libre","weight":["300","400","700"]},{"name":"Azeret Mono","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"B612","weight":["400","700"]},{"name":"B612 Mono","weight":["400","700"]},{"name":"Bad Script","weight":["400"]},{"name":"Bahiana","weight":["400"]},{"name":"Bahianita","weight":["400"]},{"name":"Bai Jamjuree","weight":["200","300","400","500","600","700"]},{"name":"Ballet","weight":["400"]},{"name":"Baloo 2","weight":["400","500","600","700","800"]},{"name":"Baloo Bhai 2","weight":["400","500","600","700","800"]},{"name":"Baloo Bhaina 2","weight":["400","500","600","700","800"]},{"name":"Baloo Chettan 2","weight":["400","500","600","700","800"]},{"name":"Baloo Da 2","weight":["400","500","600","700","800"]},{"name":"Baloo Paaji 2","weight":["400","500","600","700","800"]},{"name":"Baloo Tamma 2","weight":["400","500","600","700","800"]},{"name":"Baloo Tammudu 2","weight":["400","500","600","700","800"]},{"name":"Baloo Thambi 2","weight":["400","500","600","700","800"]},{"name":"Balsamiq Sans","weight":["400","700"]},{"name":"Balthazar","weight":["400"]},{"name":"Bangers","weight":["400"]},{"name":"Barlow","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Barlow Condensed","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Barlow Semi Condensed","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Barriecito","weight":["400"]},{"name":"Barrio","weight":["400"]},{"name":"Basic","weight":["400"]},{"name":"Baskervville","weight":["400"]},{"name":"Battambang","weight":["100","300","400","700","900"]},{"name":"Baumans","weight":["400"]},{"name":"Bayon","weight":["400"]},{"name":"Be Vietnam","weight":["100","300","400","500","600","700","800"]},{"name":"Be Vietnam Pro","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Bebas Neue","weight":["400"]},{"name":"Belgrano","weight":["400"]},{"name":"Bellefair","weight":["400"]},{"name":"Belleza","weight":["400"]},{"name":"Bellota","weight":["300","400","700"]},{"name":"Bellota Text","weight":["300","400","700"]},{"name":"BenchNine","weight":["300","400","700"]},{"name":"Benne","weight":["400"]},{"name":"Bentham","weight":["400"]},{"name":"Berkshire Swash","weight":["400"]},{"name":"Besley","weight":["400","500","600","700","800","900"]},{"name":"Beth Ellen","weight":["400"]},{"name":"Bevan","weight":["400"]},{"name":"Big Shoulders Display","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Big Shoulders Inline Display","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Big Shoulders Inline Text","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Big Shoulders Stencil Display","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Big Shoulders Stencil Text","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Big Shoulders Text","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Bigelow Rules","weight":["400"]},{"name":"Bigshot One","weight":["400"]},{"name":"Bilbo","weight":["400"]},{"name":"Bilbo Swash Caps","weight":["400"]},{"name":"BioRhyme","weight":["200","300","400","700","800"]},{"name":"BioRhyme Expanded","weight":["200","300","400","700","800"]},{"name":"Birthstone","weight":["400"]},{"name":"Birthstone Bounce","weight":["400","500"]},{"name":"Biryani","weight":["200","300","400","600","700","800","900"]},{"name":"Bitter","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Black And White Picture","weight":["400"]},{"name":"Black Han Sans","weight":["400"]},{"name":"Black Ops One","weight":["400"]},{"name":"Blinker","weight":["100","200","300","400","600","700","800","900"]},{"name":"Bodoni Moda","weight":["400","500","600","700","800","900"]},{"name":"Bokor","weight":["400"]},{"name":"Bona Nova","weight":["400","700"]},{"name":"Bonbon","weight":["400"]},{"name":"Bonheur Royale","weight":["400"]},{"name":"Boogaloo","weight":["400"]},{"name":"Bowlby One","weight":["400"]},{"name":"Bowlby One SC","weight":["400"]},{"name":"Brawler","weight":["400"]},{"name":"Bree Serif","weight":["400"]},{"name":"Brygada 1918","weight":["400","500","600","700"]},{"name":"Bubblegum Sans","weight":["400"]},{"name":"Bubbler One","weight":["400"]},{"name":"Buda","weight":["300"]},{"name":"Buenard","weight":["400","700"]},{"name":"Bungee","weight":["400"]},{"name":"Bungee Hairline","weight":["400"]},{"name":"Bungee Inline","weight":["400"]},{"name":"Bungee Outline","weight":["400"]},{"name":"Bungee Shade","weight":["400"]},{"name":"Butcherman","weight":["400"]},{"name":"Butterfly Kids","weight":["400"]},{"name":"Cabin","weight":["400","500","600","700"]},{"name":"Cabin Condensed","weight":["400","500","600","700"]},{"name":"Cabin Sketch","weight":["400","700"]},{"name":"Caesar Dressing","weight":["400"]},{"name":"Cagliostro","weight":["400"]},{"name":"Cairo","weight":["200","300","400","600","700","900"]},{"name":"Caladea","weight":["400","700"]},{"name":"Calistoga","weight":["400"]},{"name":"Calligraffitti","weight":["400"]},{"name":"Cambay","weight":["400","700"]},{"name":"Cambo","weight":["400"]},{"name":"Candal","weight":["400"]},{"name":"Cantarell","weight":["400","700"]},{"name":"Cantata One","weight":["400"]},{"name":"Cantora One","weight":["400"]},{"name":"Capriola","weight":["400"]},{"name":"Caramel","weight":["400"]},{"name":"Carattere","weight":["400"]},{"name":"Cardo","weight":["400","700"]},{"name":"Carme","weight":["400"]},{"name":"Carrois Gothic","weight":["400"]},{"name":"Carrois Gothic SC","weight":["400"]},{"name":"Carter One","weight":["400"]},{"name":"Castoro","weight":["400"]},{"name":"Catamaran","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Caudex","weight":["400","700"]},{"name":"Caveat","weight":["400","500","600","700"]},{"name":"Caveat Brush","weight":["400"]},{"name":"Cedarville Cursive","weight":["400"]},{"name":"Ceviche One","weight":["400"]},{"name":"Chakra Petch","weight":["300","400","500","600","700"]},{"name":"Changa","weight":["200","300","400","500","600","700","800"]},{"name":"Changa One","weight":["400"]},{"name":"Chango","weight":["400"]},{"name":"Charm","weight":["400","700"]},{"name":"Charmonman","weight":["400","700"]},{"name":"Chathura","weight":["100","300","400","700","800"]},{"name":"Chau Philomene One","weight":["400"]},{"name":"Chela One","weight":["400"]},{"name":"Chelsea Market","weight":["400"]},{"name":"Chenla","weight":["400"]},{"name":"Cherish","weight":["400"]},{"name":"Cherry Cream Soda","weight":["400"]},{"name":"Cherry Swash","weight":["400","700"]},{"name":"Chewy","weight":["400"]},{"name":"Chicle","weight":["400"]},{"name":"Chilanka","weight":["400"]},{"name":"Chivo","weight":["300","400","700","900"]},{"name":"Chonburi","weight":["400"]},{"name":"Cinzel","weight":["400","500","600","700","800","900"]},{"name":"Cinzel Decorative","weight":["400","700","900"]},{"name":"Clicker Script","weight":["400"]},{"name":"Coda","weight":["400","800"]},{"name":"Coda Caption","weight":["800"]},{"name":"Codystar","weight":["300","400"]},{"name":"Coiny","weight":["400"]},{"name":"Combo","weight":["400"]},{"name":"Comfortaa","weight":["300","400","500","600","700"]},{"name":"Comic Neue","weight":["300","400","700"]},{"name":"Coming Soon","weight":["400"]},{"name":"Commissioner","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Concert One","weight":["400"]},{"name":"Condiment","weight":["400"]},{"name":"Content","weight":["400","700"]},{"name":"Contrail One","weight":["400"]},{"name":"Convergence","weight":["400"]},{"name":"Cookie","weight":["400"]},{"name":"Copse","weight":["400"]},{"name":"Corben","weight":["400","700"]},{"name":"Cormorant","weight":["300","400","500","600","700"]},{"name":"Cormorant Garamond","weight":["300","400","500","600","700"]},{"name":"Cormorant Infant","weight":["300","400","500","600","700"]},{"name":"Cormorant SC","weight":["300","400","500","600","700"]},{"name":"Cormorant Unicase","weight":["300","400","500","600","700"]},{"name":"Cormorant Upright","weight":["300","400","500","600","700"]},{"name":"Courgette","weight":["400"]},{"name":"Courier Prime","weight":["400","700"]},{"name":"Cousine","weight":["400","700"]},{"name":"Coustard","weight":["400","900"]},{"name":"Covered By Your Grace","weight":["400"]},{"name":"Crafty Girls","weight":["400"]},{"name":"Creepster","weight":["400"]},{"name":"Crete Round","weight":["400"]},{"name":"Crimson Pro","weight":["200","300","400","500","600","700","800","900"]},{"name":"Crimson Text","weight":["400","600","700"]},{"name":"Croissant One","weight":["400"]},{"name":"Crushed","weight":["400"]},{"name":"Cuprum","weight":["400","500","600","700"]},{"name":"Cute Font","weight":["400"]},{"name":"Cutive","weight":["400"]},{"name":"Cutive Mono","weight":["400"]},{"name":"DM Mono","weight":["300","400","500"]},{"name":"DM Sans","weight":["400","500","700"]},{"name":"DM Serif Display","weight":["400"]},{"name":"DM Serif Text","weight":["400"]},{"name":"Damion","weight":["400"]},{"name":"Dancing Script","weight":["400","500","600","700"]},{"name":"Dangrek","weight":["400"]},{"name":"Darker Grotesque","weight":["300","400","500","600","700","800","900"]},{"name":"David Libre","weight":["400","500","700"]},{"name":"Dawning of a New Day","weight":["400"]},{"name":"Days One","weight":["400"]},{"name":"Dekko","weight":["400"]},{"name":"Dela Gothic One","weight":["400"]},{"name":"Delius","weight":["400"]},{"name":"Delius Swash Caps","weight":["400"]},{"name":"Delius Unicase","weight":["400","700"]},{"name":"Della Respira","weight":["400"]},{"name":"Denk One","weight":["400"]},{"name":"Devonshire","weight":["400"]},{"name":"Dhurjati","weight":["400"]},{"name":"Didact Gothic","weight":["400"]},{"name":"Diplomata","weight":["400"]},{"name":"Diplomata SC","weight":["400"]},{"name":"Do Hyeon","weight":["400"]},{"name":"Dokdo","weight":["400"]},{"name":"Domine","weight":["400","500","600","700"]},{"name":"Donegal One","weight":["400"]},{"name":"Doppio One","weight":["400"]},{"name":"Dorsa","weight":["400"]},{"name":"Dosis","weight":["200","300","400","500","600","700","800"]},{"name":"DotGothic16","weight":["400"]},{"name":"Dr Sugiyama","weight":["400"]},{"name":"Duru Sans","weight":["400"]},{"name":"Dynalight","weight":["400"]},{"name":"EB Garamond","weight":["400","500","600","700","800"]},{"name":"Eagle Lake","weight":["400"]},{"name":"East Sea Dokdo","weight":["400"]},{"name":"Eater","weight":["400"]},{"name":"Economica","weight":["400","700"]},{"name":"Eczar","weight":["400","500","600","700","800"]},{"name":"El Messiri","weight":["400","500","600","700"]},{"name":"Electrolize","weight":["400"]},{"name":"Elsie","weight":["400","900"]},{"name":"Elsie Swash Caps","weight":["400","900"]},{"name":"Emblema One","weight":["400"]},{"name":"Emilys Candy","weight":["400"]},{"name":"Encode Sans","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Encode Sans Condensed","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Encode Sans Expanded","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Encode Sans SC","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Encode Sans Semi Condensed","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Encode Sans Semi Expanded","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Engagement","weight":["400"]},{"name":"Englebert","weight":["400"]},{"name":"Enriqueta","weight":["400","500","600","700"]},{"name":"Ephesis","weight":["400"]},{"name":"Epilogue","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Erica One","weight":["400"]},{"name":"Esteban","weight":["400"]},{"name":"Euphoria Script","weight":["400"]},{"name":"Ewert","weight":["400"]},{"name":"Exo","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Exo 2","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Expletus Sans","weight":["400","500","600","700"]},{"name":"Explora","weight":["400"]},{"name":"Fahkwang","weight":["200","300","400","500","600","700"]},{"name":"Fanwood Text","weight":["400"]},{"name":"Farro","weight":["300","400","500","700"]},{"name":"Farsan","weight":["400"]},{"name":"Fascinate","weight":["400"]},{"name":"Fascinate Inline","weight":["400"]},{"name":"Faster One","weight":["400"]},{"name":"Fasthand","weight":["400"]},{"name":"Fauna One","weight":["400"]},{"name":"Faustina","weight":["400","500","600","700"]},{"name":"Federant","weight":["400"]},{"name":"Federo","weight":["400"]},{"name":"Felipa","weight":["400"]},{"name":"Fenix","weight":["400"]},{"name":"Festive","weight":["400"]},{"name":"Finger Paint","weight":["400"]},{"name":"Fira Code","weight":["300","400","500","600","700"]},{"name":"Fira Mono","weight":["400","500","700"]},{"name":"Fira Sans","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Fira Sans Condensed","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Fira Sans Extra Condensed","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Fjalla One","weight":["400"]},{"name":"Fjord One","weight":["400"]},{"name":"Flamenco","weight":["300","400"]},{"name":"Flavors","weight":["400"]},{"name":"Fleur De Leah","weight":["400"]},{"name":"Fondamento","weight":["400"]},{"name":"Fontdiner Swanky","weight":["400"]},{"name":"Forum","weight":["400"]},{"name":"Francois One","weight":["400"]},{"name":"Frank Ruhl Libre","weight":["300","400","500","700","900"]},{"name":"Fraunces","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Freckle Face","weight":["400"]},{"name":"Fredericka the Great","weight":["400"]},{"name":"Fredoka One","weight":["400"]},{"name":"Freehand","weight":["400"]},{"name":"Fresca","weight":["400"]},{"name":"Frijole","weight":["400"]},{"name":"Fruktur","weight":["400"]},{"name":"Fugaz One","weight":["400"]},{"name":"Fuggles","weight":["400"]},{"name":"GFS Didot","weight":["400"]},{"name":"GFS Neohellenic","weight":["400","700"]},{"name":"Gabriela","weight":["400"]},{"name":"Gaegu","weight":["300","400","700"]},{"name":"Gafata","weight":["400"]},{"name":"Galada","weight":["400"]},{"name":"Galdeano","weight":["400"]},{"name":"Galindo","weight":["400"]},{"name":"Gamja Flower","weight":["400"]},{"name":"Gayathri","weight":["100","400","700"]},{"name":"Gelasio","weight":["400","500","600","700"]},{"name":"Gemunu Libre","weight":["200","300","400","500","600","700","800"]},{"name":"Gentium Basic","weight":["400","700"]},{"name":"Gentium Book Basic","weight":["400","700"]},{"name":"Geo","weight":["400"]},{"name":"Georama","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Geostar","weight":["400"]},{"name":"Geostar Fill","weight":["400"]},{"name":"Germania One","weight":["400"]},{"name":"Gideon Roman","weight":["400"]},{"name":"Gidugu","weight":["400"]},{"name":"Gilda Display","weight":["400"]},{"name":"Girassol","weight":["400"]},{"name":"Give You Glory","weight":["400"]},{"name":"Glass Antiqua","weight":["400"]},{"name":"Glegoo","weight":["400","700"]},{"name":"Gloria Hallelujah","weight":["400"]},{"name":"Glory","weight":["100","200","300","400","500","600","700","800"]},{"name":"Gluten","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Goblin One","weight":["400"]},{"name":"Gochi Hand","weight":["400"]},{"name":"Goldman","weight":["400","700"]},{"name":"Gorditas","weight":["400","700"]},{"name":"Gothic A1","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Gotu","weight":["400"]},{"name":"Goudy Bookletter 1911","weight":["400"]},{"name":"Gowun Batang","weight":["400","700"]},{"name":"Gowun Dodum","weight":["400"]},{"name":"Graduate","weight":["400"]},{"name":"Grand Hotel","weight":["400"]},{"name":"Grandstander","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Gravitas One","weight":["400"]},{"name":"Great Vibes","weight":["400"]},{"name":"Grechen Fuemen","weight":["400"]},{"name":"Grenze","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Grenze Gotisch","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Grey Qo","weight":["400"]},{"name":"Griffy","weight":["400"]},{"name":"Gruppo","weight":["400"]},{"name":"Gudea","weight":["400","700"]},{"name":"Gugi","weight":["400"]},{"name":"Gupter","weight":["400","500","700"]},{"name":"Gurajada","weight":["400"]},{"name":"Habibi","weight":["400"]},{"name":"Hachi Maru Pop","weight":["400"]},{"name":"Hahmlet","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Halant","weight":["300","400","500","600","700"]},{"name":"Hammersmith One","weight":["400"]},{"name":"Hanalei","weight":["400"]},{"name":"Hanalei Fill","weight":["400"]},{"name":"Handlee","weight":["400"]},{"name":"Hanuman","weight":["100","300","400","700","900"]},{"name":"Happy Monkey","weight":["400"]},{"name":"Harmattan","weight":["400","700"]},{"name":"Headland One","weight":["400"]},{"name":"Heebo","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Henny Penny","weight":["400"]},{"name":"Hepta Slab","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Herr Von Muellerhoff","weight":["400"]},{"name":"Hi Melody","weight":["400"]},{"name":"Hina Mincho","weight":["400"]},{"name":"Hind","weight":["300","400","500","600","700"]},{"name":"Hind Guntur","weight":["300","400","500","600","700"]},{"name":"Hind Madurai","weight":["300","400","500","600","700"]},{"name":"Hind Siliguri","weight":["300","400","500","600","700"]},{"name":"Hind Vadodara","weight":["300","400","500","600","700"]},{"name":"Holtwood One SC","weight":["400"]},{"name":"Homemade Apple","weight":["400"]},{"name":"Homenaje","weight":["400"]},{"name":"IBM Plex Mono","weight":["100","200","300","400","500","600","700"]},{"name":"IBM Plex Sans","weight":["100","200","300","400","500","600","700"]},{"name":"IBM Plex Sans Arabic","weight":["100","200","300","400","500","600","700"]},{"name":"IBM Plex Sans Condensed","weight":["100","200","300","400","500","600","700"]},{"name":"IBM Plex Sans Devanagari","weight":["100","200","300","400","500","600","700"]},{"name":"IBM Plex Sans Hebrew","weight":["100","200","300","400","500","600","700"]},{"name":"IBM Plex Sans KR","weight":["100","200","300","400","500","600","700"]},{"name":"IBM Plex Sans Thai","weight":["100","200","300","400","500","600","700"]},{"name":"IBM Plex Sans Thai Looped","weight":["100","200","300","400","500","600","700"]},{"name":"IBM Plex Serif","weight":["100","200","300","400","500","600","700"]},{"name":"IM Fell DW Pica","weight":["400"]},{"name":"IM Fell DW Pica SC","weight":["400"]},{"name":"IM Fell Double Pica","weight":["400"]},{"name":"IM Fell Double Pica SC","weight":["400"]},{"name":"IM Fell English","weight":["400"]},{"name":"IM Fell English SC","weight":["400"]},{"name":"IM Fell French Canon","weight":["400"]},{"name":"IM Fell French Canon SC","weight":["400"]},{"name":"IM Fell Great Primer","weight":["400"]},{"name":"IM Fell Great Primer SC","weight":["400"]},{"name":"Ibarra Real Nova","weight":["400","500","600","700"]},{"name":"Iceberg","weight":["400"]},{"name":"Iceland","weight":["400"]},{"name":"Imbue","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Imprima","weight":["400"]},{"name":"Inconsolata","weight":["200","300","400","500","600","700","800","900"]},{"name":"Inder","weight":["400"]},{"name":"Indie Flower","weight":["400"]},{"name":"Inika","weight":["400","700"]},{"name":"Inknut Antiqua","weight":["300","400","500","600","700","800","900"]},{"name":"Inria Sans","weight":["300","400","700"]},{"name":"Inria Serif","weight":["300","400","700"]},{"name":"Inter","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Irish Grover","weight":["400"]},{"name":"Istok Web","weight":["400","700"]},{"name":"Italiana","weight":["400"]},{"name":"Italianno","weight":["400"]},{"name":"Itim","weight":["400"]},{"name":"Jacques Francois","weight":["400"]},{"name":"Jacques Francois Shadow","weight":["400"]},{"name":"Jaldi","weight":["400","700"]},{"name":"JetBrains Mono","weight":["100","200","300","400","500","600","700","800"]},{"name":"Jim Nightshade","weight":["400"]},{"name":"Jockey One","weight":["400"]},{"name":"Jolly Lodger","weight":["400"]},{"name":"Jomhuria","weight":["400"]},{"name":"Jomolhari","weight":["400"]},{"name":"Josefin Sans","weight":["100","200","300","400","500","600","700"]},{"name":"Josefin Slab","weight":["100","200","300","400","500","600","700"]},{"name":"Jost","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Joti One","weight":["400"]},{"name":"Jua","weight":["400"]},{"name":"Judson","weight":["400","700"]},{"name":"Julee","weight":["400"]},{"name":"Julius Sans One","weight":["400"]},{"name":"Junge","weight":["400"]},{"name":"Jura","weight":["300","400","500","600","700"]},{"name":"Just Another Hand","weight":["400"]},{"name":"Just Me Again Down Here","weight":["400"]},{"name":"K2D","weight":["100","200","300","400","500","600","700","800"]},{"name":"Kadwa","weight":["400","700"]},{"name":"Kaisei Decol","weight":["400","500","700"]},{"name":"Kaisei HarunoUmi","weight":["400","500","700"]},{"name":"Kaisei Opti","weight":["400","500","700"]},{"name":"Kaisei Tokumin","weight":["400","500","700","800"]},{"name":"Kalam","weight":["300","400","700"]},{"name":"Kameron","weight":["400","700"]},{"name":"Kanit","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Kantumruy","weight":["300","400","700"]},{"name":"Karantina","weight":["300","400","700"]},{"name":"Karla","weight":["200","300","400","500","600","700","800"]},{"name":"Karma","weight":["300","400","500","600","700"]},{"name":"Katibeh","weight":["400"]},{"name":"Kaushan Script","weight":["400"]},{"name":"Kavivanar","weight":["400"]},{"name":"Kavoon","weight":["400"]},{"name":"Kdam Thmor","weight":["400"]},{"name":"Keania One","weight":["400"]},{"name":"Kelly Slab","weight":["400"]},{"name":"Kenia","weight":["400"]},{"name":"Khand","weight":["300","400","500","600","700"]},{"name":"Khmer","weight":["400"]},{"name":"Khula","weight":["300","400","600","700","800"]},{"name":"Kirang Haerang","weight":["400"]},{"name":"Kite One","weight":["400"]},{"name":"Kiwi Maru","weight":["300","400","500"]},{"name":"Klee One","weight":["400","600"]},{"name":"Knewave","weight":["400"]},{"name":"KoHo","weight":["200","300","400","500","600","700"]},{"name":"Kodchasan","weight":["200","300","400","500","600","700"]},{"name":"Koh Santepheap","weight":["100","300","400","700","900"]},{"name":"Kosugi","weight":["400"]},{"name":"Kosugi Maru","weight":["400"]},{"name":"Kotta One","weight":["400"]},{"name":"Koulen","weight":["400"]},{"name":"Kranky","weight":["400"]},{"name":"Kreon","weight":["300","400","500","600","700"]},{"name":"Kristi","weight":["400"]},{"name":"Krona One","weight":["400"]},{"name":"Krub","weight":["200","300","400","500","600","700"]},{"name":"Kufam","weight":["400","500","600","700","800","900"]},{"name":"Kulim Park","weight":["200","300","400","600","700"]},{"name":"Kumar One","weight":["400"]},{"name":"Kumar One Outline","weight":["400"]},{"name":"Kumbh Sans","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Kurale","weight":["400"]},{"name":"La Belle Aurore","weight":["400"]},{"name":"Lacquer","weight":["400"]},{"name":"Laila","weight":["300","400","500","600","700"]},{"name":"Lakki Reddy","weight":["400"]},{"name":"Lalezar","weight":["400"]},{"name":"Lancelot","weight":["400"]},{"name":"Langar","weight":["400"]},{"name":"Lateef","weight":["400"]},{"name":"Lato","weight":["100","300","400","700","900"]},{"name":"League Script","weight":["400"]},{"name":"Leckerli One","weight":["400"]},{"name":"Ledger","weight":["400"]},{"name":"Lekton","weight":["400","700"]},{"name":"Lemon","weight":["400"]},{"name":"Lemonada","weight":["300","400","500","600","700"]},{"name":"Lexend","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Lexend Deca","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Lexend Exa","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Lexend Giga","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Lexend Mega","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Lexend Peta","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Lexend Tera","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Lexend Zetta","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Libre Barcode 128","weight":["400"]},{"name":"Libre Barcode 128 Text","weight":["400"]},{"name":"Libre Barcode 39","weight":["400"]},{"name":"Libre Barcode 39 Extended","weight":["400"]},{"name":"Libre Barcode 39 Extended Text","weight":["400"]},{"name":"Libre Barcode 39 Text","weight":["400"]},{"name":"Libre Barcode EAN13 Text","weight":["400"]},{"name":"Libre Baskerville","weight":["400","700"]},{"name":"Libre Caslon Display","weight":["400"]},{"name":"Libre Caslon Text","weight":["400","700"]},{"name":"Libre Franklin","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Life Savers","weight":["400","700","800"]},{"name":"Lilita One","weight":["400"]},{"name":"Lily Script One","weight":["400"]},{"name":"Limelight","weight":["400"]},{"name":"Linden Hill","weight":["400"]},{"name":"Literata","weight":["200","300","400","500","600","700","800","900"]},{"name":"Liu Jian Mao Cao","weight":["400"]},{"name":"Livvic","weight":["100","200","300","400","500","600","700","900"]},{"name":"Lobster","weight":["400"]},{"name":"Lobster Two","weight":["400","700"]},{"name":"Londrina Outline","weight":["400"]},{"name":"Londrina Shadow","weight":["400"]},{"name":"Londrina Sketch","weight":["400"]},{"name":"Londrina Solid","weight":["100","300","400","900"]},{"name":"Long Cang","weight":["400"]},{"name":"Lora","weight":["400","500","600","700"]},{"name":"Love Ya Like A Sister","weight":["400"]},{"name":"Loved by the King","weight":["400"]},{"name":"Lovers Quarrel","weight":["400"]},{"name":"Luckiest Guy","weight":["400"]},{"name":"Lusitana","weight":["400","700"]},{"name":"Lustria","weight":["400"]},{"name":"M PLUS 1p","weight":["100","300","400","500","700","800","900"]},{"name":"M PLUS Rounded 1c","weight":["100","300","400","500","700","800","900"]},{"name":"Ma Shan Zheng","weight":["400"]},{"name":"Macondo","weight":["400"]},{"name":"Macondo Swash Caps","weight":["400"]},{"name":"Mada","weight":["200","300","400","500","600","700","900"]},{"name":"Magra","weight":["400","700"]},{"name":"Maiden Orange","weight":["400"]},{"name":"Maitree","weight":["200","300","400","500","600","700"]},{"name":"Major Mono Display","weight":["400"]},{"name":"Mako","weight":["400"]},{"name":"Mali","weight":["200","300","400","500","600","700"]},{"name":"Mallanna","weight":["400"]},{"name":"Mandali","weight":["400"]},{"name":"Manjari","weight":["100","400","700"]},{"name":"Manrope","weight":["200","300","400","500","600","700","800"]},{"name":"Mansalva","weight":["400"]},{"name":"Manuale","weight":["300","400","500","600","700","800"]},{"name":"Marcellus","weight":["400"]},{"name":"Marcellus SC","weight":["400"]},{"name":"Marck Script","weight":["400"]},{"name":"Margarine","weight":["400"]},{"name":"Markazi Text","weight":["400","500","600","700"]},{"name":"Marko One","weight":["400"]},{"name":"Marmelad","weight":["400"]},{"name":"Martel","weight":["200","300","400","600","700","800","900"]},{"name":"Martel Sans","weight":["200","300","400","600","700","800","900"]},{"name":"Marvel","weight":["400","700"]},{"name":"Mate","weight":["400"]},{"name":"Mate SC","weight":["400"]},{"name":"Material Icons","weight":["400"]},{"name":"Maven Pro","weight":["400","500","600","700","800","900"]},{"name":"McLaren","weight":["400"]},{"name":"Meddon","weight":["400"]},{"name":"MedievalSharp","weight":["400"]},{"name":"Medula One","weight":["400"]},{"name":"Meera Inimai","weight":["400"]},{"name":"Megrim","weight":["400"]},{"name":"Meie Script","weight":["400"]},{"name":"Merienda","weight":["400","700"]},{"name":"Merienda One","weight":["400"]},{"name":"Merriweather","weight":["300","400","700","900"]},{"name":"Merriweather Sans","weight":["300","400","500","600","700","800"]},{"name":"Metal","weight":["400"]},{"name":"Metal Mania","weight":["400"]},{"name":"Metamorphous","weight":["400"]},{"name":"Metrophobic","weight":["400"]},{"name":"Michroma","weight":["400"]},{"name":"Milonga","weight":["400"]},{"name":"Miltonian","weight":["400"]},{"name":"Miltonian Tattoo","weight":["400"]},{"name":"Mina","weight":["400","700"]},{"name":"Miniver","weight":["400"]},{"name":"Miriam Libre","weight":["400","700"]},{"name":"Mirza","weight":["400","500","600","700"]},{"name":"Miss Fajardose","weight":["400"]},{"name":"Mitr","weight":["200","300","400","500","600","700"]},{"name":"Modak","weight":["400"]},{"name":"Modern Antiqua","weight":["400"]},{"name":"Mogra","weight":["400"]},{"name":"Molengo","weight":["400"]},{"name":"Molle","weight":["400"]},{"name":"Monda","weight":["400","700"]},{"name":"Monofett","weight":["400"]},{"name":"Monoton","weight":["400"]},{"name":"Monsieur La Doulaise","weight":["400"]},{"name":"Montaga","weight":["400"]},{"name":"MonteCarlo","weight":["400"]},{"name":"Montez","weight":["400"]},{"name":"Montserrat","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Montserrat Alternates","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Montserrat Subrayada","weight":["400","700"]},{"name":"Moul","weight":["400"]},{"name":"Moulpali","weight":["400"]},{"name":"Mountains of Christmas","weight":["400","700"]},{"name":"Mouse Memoirs","weight":["400"]},{"name":"Mr Bedfort","weight":["400"]},{"name":"Mr Dafoe","weight":["400"]},{"name":"Mr De Haviland","weight":["400"]},{"name":"Mrs Saint Delafield","weight":["400"]},{"name":"Mrs Sheppards","weight":["400"]},{"name":"Mukta","weight":["200","300","400","500","600","700","800"]},{"name":"Mukta Mahee","weight":["200","300","400","500","600","700","800"]},{"name":"Mukta Malar","weight":["200","300","400","500","600","700","800"]},{"name":"Mukta Vaani","weight":["200","300","400","500","600","700","800"]},{"name":"Mulish","weight":["200","300","400","500","600","700","800","900"]},{"name":"MuseoModerno","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Mystery Quest","weight":["400"]},{"name":"NTR","weight":["400"]},{"name":"Nanum Brush Script","weight":["400"]},{"name":"Nanum Gothic","weight":["400","700","800"]},{"name":"Nanum Gothic Coding","weight":["400","700"]},{"name":"Nanum Myeongjo","weight":["400","700","800"]},{"name":"Nanum Pen Script","weight":["400"]},{"name":"Nerko One","weight":["400"]},{"name":"Neucha","weight":["400"]},{"name":"Neuton","weight":["200","300","400","700","800"]},{"name":"New Rocker","weight":["400"]},{"name":"New Tegomin","weight":["400"]},{"name":"News Cycle","weight":["400","700"]},{"name":"Newsreader","weight":["200","300","400","500","600","700","800"]},{"name":"Niconne","weight":["400"]},{"name":"Niramit","weight":["200","300","400","500","600","700"]},{"name":"Nixie One","weight":["400"]},{"name":"Nobile","weight":["400","500","700"]},{"name":"Nokora","weight":["400","700"]},{"name":"Norican","weight":["400"]},{"name":"Nosifer","weight":["400"]},{"name":"Notable","weight":["400"]},{"name":"Nothing You Could Do","weight":["400"]},{"name":"Noticia Text","weight":["400","700"]},{"name":"Noto Kufi Arabic","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Music","weight":["400"]},{"name":"Noto Naskh Arabic","weight":["400","500","600","700"]},{"name":"Noto Nastaliq Urdu","weight":["400","700"]},{"name":"Noto Rashi Hebrew","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans","weight":["400","700"]},{"name":"Noto Sans Adlam","weight":["400","500","600","700"]},{"name":"Noto Sans Adlam Unjoined","weight":["400","500","600","700"]},{"name":"Noto Sans Anatolian Hieroglyphs","weight":["400"]},{"name":"Noto Sans Arabic","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Armenian","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Avestan","weight":["400"]},{"name":"Noto Sans Balinese","weight":["400","500","600","700"]},{"name":"Noto Sans Bamum","weight":["400","500","600","700"]},{"name":"Noto Sans Bassa Vah","weight":["400"]},{"name":"Noto Sans Batak","weight":["400"]},{"name":"Noto Sans Bengali","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Bhaiksuki","weight":["400"]},{"name":"Noto Sans Brahmi","weight":["400"]},{"name":"Noto Sans Buginese","weight":["400"]},{"name":"Noto Sans Buhid","weight":["400"]},{"name":"Noto Sans Canadian Aboriginal","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Carian","weight":["400"]},{"name":"Noto Sans Caucasian Albanian","weight":["400"]},{"name":"Noto Sans Chakma","weight":["400"]},{"name":"Noto Sans Cham","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Cherokee","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Coptic","weight":["400"]},{"name":"Noto Sans Cuneiform","weight":["400"]},{"name":"Noto Sans Cypriot","weight":["400"]},{"name":"Noto Sans Deseret","weight":["400"]},{"name":"Noto Sans Devanagari","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Display","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Duployan","weight":["400"]},{"name":"Noto Sans Egyptian Hieroglyphs","weight":["400"]},{"name":"Noto Sans Elbasan","weight":["400"]},{"name":"Noto Sans Elymaic","weight":["400"]},{"name":"Noto Sans Georgian","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Glagolitic","weight":["400"]},{"name":"Noto Sans Gothic","weight":["400"]},{"name":"Noto Sans Grantha","weight":["400"]},{"name":"Noto Sans Gujarati","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Gunjala Gondi","weight":["400"]},{"name":"Noto Sans Gurmukhi","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans HK","weight":["100","300","400","500","700","900"]},{"name":"Noto Sans Hanifi Rohingya","weight":["400","500","600","700"]},{"name":"Noto Sans Hanunoo","weight":["400"]},{"name":"Noto Sans Hatran","weight":["400"]},{"name":"Noto Sans Hebrew","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Imperial Aramaic","weight":["400"]},{"name":"Noto Sans Indic Siyaq Numbers","weight":["400"]},{"name":"Noto Sans Inscriptional Pahlavi","weight":["400"]},{"name":"Noto Sans Inscriptional Parthian","weight":["400"]},{"name":"Noto Sans JP","weight":["100","300","400","500","700","900"]},{"name":"Noto Sans Javanese","weight":["400","700"]},{"name":"Noto Sans KR","weight":["100","300","400","500","700","900"]},{"name":"Noto Sans Kaithi","weight":["400"]},{"name":"Noto Sans Kannada","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Kayah Li","weight":["400","500","600","700"]},{"name":"Noto Sans Kharoshthi","weight":["400"]},{"name":"Noto Sans Khmer","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Khojki","weight":["400"]},{"name":"Noto Sans Khudawadi","weight":["400"]},{"name":"Noto Sans Lao","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Lepcha","weight":["400"]},{"name":"Noto Sans Limbu","weight":["400"]},{"name":"Noto Sans Linear A","weight":["400"]},{"name":"Noto Sans Linear B","weight":["400"]},{"name":"Noto Sans Lisu","weight":["400","500","600","700"]},{"name":"Noto Sans Lycian","weight":["400"]},{"name":"Noto Sans Lydian","weight":["400"]},{"name":"Noto Sans Mahajani","weight":["400"]},{"name":"Noto Sans Malayalam","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Mandaic","weight":["400"]},{"name":"Noto Sans Manichaean","weight":["400"]},{"name":"Noto Sans Marchen","weight":["400"]},{"name":"Noto Sans Masaram Gondi","weight":["400"]},{"name":"Noto Sans Math","weight":["400"]},{"name":"Noto Sans Mayan Numerals","weight":["400"]},{"name":"Noto Sans Medefaidrin","weight":["400","500","600","700"]},{"name":"Noto Sans Meroitic","weight":["400"]},{"name":"Noto Sans Miao","weight":["400"]},{"name":"Noto Sans Modi","weight":["400"]},{"name":"Noto Sans Mongolian","weight":["400"]},{"name":"Noto Sans Mono","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Mro","weight":["400"]},{"name":"Noto Sans Multani","weight":["400"]},{"name":"Noto Sans Myanmar","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans N Ko","weight":["400"]},{"name":"Noto Sans Nabataean","weight":["400"]},{"name":"Noto Sans New Tai Lue","weight":["400"]},{"name":"Noto Sans Newa","weight":["400"]},{"name":"Noto Sans Nushu","weight":["400"]},{"name":"Noto Sans Ogham","weight":["400"]},{"name":"Noto Sans Ol Chiki","weight":["400","500","600","700"]},{"name":"Noto Sans Old Hungarian","weight":["400"]},{"name":"Noto Sans Old Italic","weight":["400"]},{"name":"Noto Sans Old North Arabian","weight":["400"]},{"name":"Noto Sans Old Permic","weight":["400"]},{"name":"Noto Sans Old Persian","weight":["400"]},{"name":"Noto Sans Old Sogdian","weight":["400"]},{"name":"Noto Sans Old South Arabian","weight":["400"]},{"name":"Noto Sans Old Turkic","weight":["400"]},{"name":"Noto Sans Oriya","weight":["100","400","700","900"]},{"name":"Noto Sans Osage","weight":["400"]},{"name":"Noto Sans Osmanya","weight":["400"]},{"name":"Noto Sans Pahawh Hmong","weight":["400"]},{"name":"Noto Sans Palmyrene","weight":["400"]},{"name":"Noto Sans Pau Cin Hau","weight":["400"]},{"name":"Noto Sans Phags Pa","weight":["400"]},{"name":"Noto Sans Phoenician","weight":["400"]},{"name":"Noto Sans Psalter Pahlavi","weight":["400"]},{"name":"Noto Sans Rejang","weight":["400"]},{"name":"Noto Sans Runic","weight":["400"]},{"name":"Noto Sans SC","weight":["100","300","400","500","700","900"]},{"name":"Noto Sans Samaritan","weight":["400"]},{"name":"Noto Sans Saurashtra","weight":["400"]},{"name":"Noto Sans Sharada","weight":["400"]},{"name":"Noto Sans Shavian","weight":["400"]},{"name":"Noto Sans Siddham","weight":["400"]},{"name":"Noto Sans Sinhala","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Sogdian","weight":["400"]},{"name":"Noto Sans Sora Sompeng","weight":["400","500","600","700"]},{"name":"Noto Sans Soyombo","weight":["400"]},{"name":"Noto Sans Sundanese","weight":["400","500","600","700"]},{"name":"Noto Sans Syloti Nagri","weight":["400"]},{"name":"Noto Sans Symbols","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Symbols 2","weight":["400"]},{"name":"Noto Sans Syriac","weight":["100","400","900"]},{"name":"Noto Sans TC","weight":["100","300","400","500","700","900"]},{"name":"Noto Sans Tagalog","weight":["400"]},{"name":"Noto Sans Tagbanwa","weight":["400"]},{"name":"Noto Sans Tai Le","weight":["400"]},{"name":"Noto Sans Tai Tham","weight":["400","500","600","700"]},{"name":"Noto Sans Tai Viet","weight":["400"]},{"name":"Noto Sans Takri","weight":["400"]},{"name":"Noto Sans Tamil","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Tamil Supplement","weight":["400"]},{"name":"Noto Sans Telugu","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Thaana","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Thai","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Thai Looped","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Sans Tifinagh","weight":["400"]},{"name":"Noto Sans Tirhuta","weight":["400"]},{"name":"Noto Sans Ugaritic","weight":["400"]},{"name":"Noto Sans Vai","weight":["400"]},{"name":"Noto Sans Wancho","weight":["400"]},{"name":"Noto Sans Warang Citi","weight":["400"]},{"name":"Noto Sans Yi","weight":["400"]},{"name":"Noto Sans Zanabazar Square","weight":["400"]},{"name":"Noto Serif","weight":["400","700"]},{"name":"Noto Serif Ahom","weight":["400"]},{"name":"Noto Serif Armenian","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Balinese","weight":["400"]},{"name":"Noto Serif Bengali","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Devanagari","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Display","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Dogra","weight":["400"]},{"name":"Noto Serif Ethiopic","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Georgian","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Grantha","weight":["400"]},{"name":"Noto Serif Gujarati","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Gurmukhi","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Hebrew","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif JP","weight":["200","300","400","500","600","700","900"]},{"name":"Noto Serif KR","weight":["200","300","400","500","600","700","900"]},{"name":"Noto Serif Kannada","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Khmer","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Lao","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Malayalam","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Myanmar","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Nyiakeng Puachue Hmong","weight":["400","500","600","700"]},{"name":"Noto Serif SC","weight":["200","300","400","500","600","700","900"]},{"name":"Noto Serif Sinhala","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif TC","weight":["200","300","400","500","600","700","900"]},{"name":"Noto Serif Tamil","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Tangut","weight":["400"]},{"name":"Noto Serif Telugu","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Thai","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Tibetan","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Noto Serif Yezidi","weight":["400","500","600","700"]},{"name":"Noto Traditional Nushu","weight":["400"]},{"name":"Nova Cut","weight":["400"]},{"name":"Nova Flat","weight":["400"]},{"name":"Nova Mono","weight":["400"]},{"name":"Nova Oval","weight":["400"]},{"name":"Nova Round","weight":["400"]},{"name":"Nova Script","weight":["400"]},{"name":"Nova Slim","weight":["400"]},{"name":"Nova Square","weight":["400"]},{"name":"Numans","weight":["400"]},{"name":"Nunito","weight":["200","300","400","600","700","800","900"]},{"name":"Nunito Sans","weight":["200","300","400","600","700","800","900"]},{"name":"Odibee Sans","weight":["400"]},{"name":"Odor Mean Chey","weight":["400"]},{"name":"Offside","weight":["400"]},{"name":"Oi","weight":["400"]},{"name":"Old Standard TT","weight":["400","700"]},{"name":"Oldenburg","weight":["400"]},{"name":"Oleo Script","weight":["400","700"]},{"name":"Oleo Script Swash Caps","weight":["400","700"]},{"name":"Open Sans","weight":["300","400","500","600","700","800"]},{"name":"Open Sans Condensed","weight":["300","700"]},{"name":"Oranienbaum","weight":["400"]},{"name":"Orbitron","weight":["400","500","600","700","800","900"]},{"name":"Oregano","weight":["400"]},{"name":"Orelega One","weight":["400"]},{"name":"Orienta","weight":["400"]},{"name":"Original Surfer","weight":["400"]},{"name":"Oswald","weight":["200","300","400","500","600","700"]},{"name":"Otomanopee One","weight":["400"]},{"name":"Over the Rainbow","weight":["400"]},{"name":"Overlock","weight":["400","700","900"]},{"name":"Overlock SC","weight":["400"]},{"name":"Overpass","weight":["100","200","300","400","600","700","800","900"]},{"name":"Overpass Mono","weight":["300","400","600","700"]},{"name":"Ovo","weight":["400"]},{"name":"Oxanium","weight":["200","300","400","500","600","700","800"]},{"name":"Oxygen","weight":["300","400","700"]},{"name":"Oxygen Mono","weight":["400"]},{"name":"PT Mono","weight":["400"]},{"name":"PT Sans","weight":["400","700"]},{"name":"PT Sans Caption","weight":["400","700"]},{"name":"PT Sans Narrow","weight":["400","700"]},{"name":"PT Serif","weight":["400","700"]},{"name":"PT Serif Caption","weight":["400"]},{"name":"Pacifico","weight":["400"]},{"name":"Padauk","weight":["400","700"]},{"name":"Palanquin","weight":["100","200","300","400","500","600","700"]},{"name":"Palanquin Dark","weight":["400","500","600","700"]},{"name":"Palette Mosaic","weight":["400"]},{"name":"Pangolin","weight":["400"]},{"name":"Paprika","weight":["400"]},{"name":"Parisienne","weight":["400"]},{"name":"Passero One","weight":["400"]},{"name":"Passion One","weight":["400","700","900"]},{"name":"Pathway Gothic One","weight":["400"]},{"name":"Patrick Hand","weight":["400"]},{"name":"Patrick Hand SC","weight":["400"]},{"name":"Pattaya","weight":["400"]},{"name":"Patua One","weight":["400"]},{"name":"Pavanam","weight":["400"]},{"name":"Paytone One","weight":["400"]},{"name":"Peddana","weight":["400"]},{"name":"Peralta","weight":["400"]},{"name":"Permanent Marker","weight":["400"]},{"name":"Petit Formal Script","weight":["400"]},{"name":"Petrona","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Philosopher","weight":["400","700"]},{"name":"Piazzolla","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Piedra","weight":["400"]},{"name":"Pinyon Script","weight":["400"]},{"name":"Pirata One","weight":["400"]},{"name":"Plaster","weight":["400"]},{"name":"Play","weight":["400","700"]},{"name":"Playball","weight":["400"]},{"name":"Playfair Display","weight":["400","500","600","700","800","900"]},{"name":"Playfair Display SC","weight":["400","700","900"]},{"name":"Podkova","weight":["400","500","600","700","800"]},{"name":"Poiret One","weight":["400"]},{"name":"Poller One","weight":["400"]},{"name":"Poly","weight":["400"]},{"name":"Pompiere","weight":["400"]},{"name":"Pontano Sans","weight":["400"]},{"name":"Poor Story","weight":["400"]},{"name":"Poppins","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Port Lligat Sans","weight":["400"]},{"name":"Port Lligat Slab","weight":["400"]},{"name":"Potta One","weight":["400"]},{"name":"Pragati Narrow","weight":["400","700"]},{"name":"Prata","weight":["400"]},{"name":"Preahvihear","weight":["400"]},{"name":"Press Start 2P","weight":["400"]},{"name":"Pridi","weight":["200","300","400","500","600","700"]},{"name":"Princess Sofia","weight":["400"]},{"name":"Prociono","weight":["400"]},{"name":"Prompt","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Prosto One","weight":["400"]},{"name":"Proza Libre","weight":["400","500","600","700","800"]},{"name":"Public Sans","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Puritan","weight":["400","700"]},{"name":"Purple Purse","weight":["400"]},{"name":"Qahiri","weight":["400"]},{"name":"Quando","weight":["400"]},{"name":"Quantico","weight":["400","700"]},{"name":"Quattrocento","weight":["400","700"]},{"name":"Quattrocento Sans","weight":["400","700"]},{"name":"Questrial","weight":["400"]},{"name":"Quicksand","weight":["300","400","500","600","700"]},{"name":"Quintessential","weight":["400"]},{"name":"Qwigley","weight":["400"]},{"name":"Racing Sans One","weight":["400"]},{"name":"Radley","weight":["400"]},{"name":"Rajdhani","weight":["300","400","500","600","700"]},{"name":"Rakkas","weight":["400"]},{"name":"Raleway","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Raleway Dots","weight":["400"]},{"name":"Ramabhadra","weight":["400"]},{"name":"Ramaraja","weight":["400"]},{"name":"Rambla","weight":["400","700"]},{"name":"Rammetto One","weight":["400"]},{"name":"Rampart One","weight":["400"]},{"name":"Ranchers","weight":["400"]},{"name":"Rancho","weight":["400"]},{"name":"Ranga","weight":["400","700"]},{"name":"Rasa","weight":["300","400","500","600","700"]},{"name":"Rationale","weight":["400"]},{"name":"Ravi Prakash","weight":["400"]},{"name":"Recursive","weight":["300","400","500","600","700","800","900"]},{"name":"Red Hat Display","weight":["300","400","500","600","700","800","900"]},{"name":"Red Hat Text","weight":["300","400","500","600","700"]},{"name":"Red Rose","weight":["300","400","500","600","700"]},{"name":"Redressed","weight":["400"]},{"name":"Reem Kufi","weight":["400","500","600","700"]},{"name":"Reenie Beanie","weight":["400"]},{"name":"Reggae One","weight":["400"]},{"name":"Revalia","weight":["400"]},{"name":"Rhodium Libre","weight":["400"]},{"name":"Ribeye","weight":["400"]},{"name":"Ribeye Marrow","weight":["400"]},{"name":"Righteous","weight":["400"]},{"name":"Risque","weight":["400"]},{"name":"Roboto","weight":["100","300","400","500","700","900"]},{"name":"Roboto Condensed","weight":["300","400","700"]},{"name":"Roboto Mono","weight":["100","200","300","400","500","600","700"]},{"name":"Roboto Slab","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Rochester","weight":["400"]},{"name":"Rock Salt","weight":["400"]},{"name":"RocknRoll One","weight":["400"]},{"name":"Rokkitt","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Romanesco","weight":["400"]},{"name":"Ropa Sans","weight":["400"]},{"name":"Rosario","weight":["300","400","500","600","700"]},{"name":"Rosarivo","weight":["400"]},{"name":"Rouge Script","weight":["400"]},{"name":"Rowdies","weight":["300","400","700"]},{"name":"Rozha One","weight":["400"]},{"name":"Rubik","weight":["300","400","500","600","700","800","900"]},{"name":"Rubik Beastly","weight":["400"]},{"name":"Rubik Mono One","weight":["400"]},{"name":"Ruda","weight":["400","500","600","700","800","900"]},{"name":"Rufina","weight":["400","700"]},{"name":"Ruge Boogie","weight":["400"]},{"name":"Ruluko","weight":["400"]},{"name":"Rum Raisin","weight":["400"]},{"name":"Ruslan Display","weight":["400"]},{"name":"Russo One","weight":["400"]},{"name":"Ruthie","weight":["400"]},{"name":"Rye","weight":["400"]},{"name":"STIX Two Text","weight":["400","500","600","700"]},{"name":"Sacramento","weight":["400"]},{"name":"Sahitya","weight":["400","700"]},{"name":"Sail","weight":["400"]},{"name":"Saira","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Saira Condensed","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Saira Extra Condensed","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Saira Semi Condensed","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Saira Stencil One","weight":["400"]},{"name":"Salsa","weight":["400"]},{"name":"Sanchez","weight":["400"]},{"name":"Sancreek","weight":["400"]},{"name":"Sansita","weight":["400","700","800","900"]},{"name":"Sansita Swashed","weight":["300","400","500","600","700","800","900"]},{"name":"Sarabun","weight":["100","200","300","400","500","600","700","800"]},{"name":"Sarala","weight":["400","700"]},{"name":"Sarina","weight":["400"]},{"name":"Sarpanch","weight":["400","500","600","700","800","900"]},{"name":"Satisfy","weight":["400"]},{"name":"Sawarabi Gothic","weight":["400"]},{"name":"Sawarabi Mincho","weight":["400"]},{"name":"Scada","weight":["400","700"]},{"name":"Scheherazade","weight":["400","700"]},{"name":"Scheherazade New","weight":["400","700"]},{"name":"Schoolbell","weight":["400"]},{"name":"Scope One","weight":["400"]},{"name":"Seaweed Script","weight":["400"]},{"name":"Secular One","weight":["400"]},{"name":"Sedgwick Ave","weight":["400"]},{"name":"Sedgwick Ave Display","weight":["400"]},{"name":"Sen","weight":["400","700","800"]},{"name":"Sevillana","weight":["400"]},{"name":"Seymour One","weight":["400"]},{"name":"Shadows Into Light","weight":["400"]},{"name":"Shadows Into Light Two","weight":["400"]},{"name":"Shanti","weight":["400"]},{"name":"Share","weight":["400","700"]},{"name":"Share Tech","weight":["400"]},{"name":"Share Tech Mono","weight":["400"]},{"name":"Shippori Mincho","weight":["400","500","600","700","800"]},{"name":"Shippori Mincho B1","weight":["400","500","600","700","800"]},{"name":"Shojumaru","weight":["400"]},{"name":"Short Stack","weight":["400"]},{"name":"Shrikhand","weight":["400"]},{"name":"Siemreap","weight":["400"]},{"name":"Sigmar One","weight":["400"]},{"name":"Signika","weight":["300","400","500","600","700"]},{"name":"Signika Negative","weight":["300","400","600","700"]},{"name":"Simonetta","weight":["400","900"]},{"name":"Single Day","weight":["400"]},{"name":"Sintony","weight":["400","700"]},{"name":"Sirin Stencil","weight":["400"]},{"name":"Six Caps","weight":["400"]},{"name":"Skranji","weight":["400","700"]},{"name":"Slabo 13px","weight":["400"]},{"name":"Slabo 27px","weight":["400"]},{"name":"Slackey","weight":["400"]},{"name":"Smokum","weight":["400"]},{"name":"Smythe","weight":["400"]},{"name":"Sniglet","weight":["400","800"]},{"name":"Snippet","weight":["400"]},{"name":"Snowburst One","weight":["400"]},{"name":"Sofadi One","weight":["400"]},{"name":"Sofia","weight":["400"]},{"name":"Solway","weight":["300","400","500","700","800"]},{"name":"Song Myung","weight":["400"]},{"name":"Sonsie One","weight":["400"]},{"name":"Sora","weight":["100","200","300","400","500","600","700","800"]},{"name":"Sorts Mill Goudy","weight":["400"]},{"name":"Source Code Pro","weight":["200","300","400","500","600","700","900"]},{"name":"Source Sans Pro","weight":["200","300","400","600","700","900"]},{"name":"Source Serif Pro","weight":["200","300","400","600","700","900"]},{"name":"Space Grotesk","weight":["300","400","500","600","700"]},{"name":"Space Mono","weight":["400","700"]},{"name":"Spartan","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Special Elite","weight":["400"]},{"name":"Spectral","weight":["200","300","400","500","600","700","800"]},{"name":"Spectral SC","weight":["200","300","400","500","600","700","800"]},{"name":"Spicy Rice","weight":["400"]},{"name":"Spinnaker","weight":["400"]},{"name":"Spirax","weight":["400"]},{"name":"Squada One","weight":["400"]},{"name":"Sree Krushnadevaraya","weight":["400"]},{"name":"Sriracha","weight":["400"]},{"name":"Srisakdi","weight":["400","700"]},{"name":"Staatliches","weight":["400"]},{"name":"Stalemate","weight":["400"]},{"name":"Stalinist One","weight":["400"]},{"name":"Stardos Stencil","weight":["400","700"]},{"name":"Stick","weight":["400"]},{"name":"Stick No Bills","weight":["200","300","400","500","600","700","800"]},{"name":"Stint Ultra Condensed","weight":["400"]},{"name":"Stint Ultra Expanded","weight":["400"]},{"name":"Stoke","weight":["300","400"]},{"name":"Strait","weight":["400"]},{"name":"Style Script","weight":["400"]},{"name":"Stylish","weight":["400"]},{"name":"Sue Ellen Francisco","weight":["400"]},{"name":"Suez One","weight":["400"]},{"name":"Sulphur Point","weight":["300","400","700"]},{"name":"Sumana","weight":["400","700"]},{"name":"Sunflower","weight":["300","500","700"]},{"name":"Sunshiney","weight":["400"]},{"name":"Supermercado One","weight":["400"]},{"name":"Sura","weight":["400","700"]},{"name":"Suranna","weight":["400"]},{"name":"Suravaram","weight":["400"]},{"name":"Suwannaphum","weight":["100","300","400","700","900"]},{"name":"Swanky and Moo Moo","weight":["400"]},{"name":"Syncopate","weight":["400","700"]},{"name":"Syne","weight":["400","500","600","700","800"]},{"name":"Syne Mono","weight":["400"]},{"name":"Syne Tactile","weight":["400"]},{"name":"Tajawal","weight":["200","300","400","500","700","800","900"]},{"name":"Tangerine","weight":["400","700"]},{"name":"Taprom","weight":["400"]},{"name":"Tauri","weight":["400"]},{"name":"Taviraj","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Teko","weight":["300","400","500","600","700"]},{"name":"Telex","weight":["400"]},{"name":"Tenali Ramakrishna","weight":["400"]},{"name":"Tenor Sans","weight":["400"]},{"name":"Text Me One","weight":["400"]},{"name":"Texturina","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Thasadith","weight":["400","700"]},{"name":"The Girl Next Door","weight":["400"]},{"name":"Tienne","weight":["400","700","900"]},{"name":"Tillana","weight":["400","500","600","700","800"]},{"name":"Timmana","weight":["400"]},{"name":"Tinos","weight":["400","700"]},{"name":"Titan One","weight":["400"]},{"name":"Titillium Web","weight":["200","300","400","600","700","900"]},{"name":"Tomorrow","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Tourney","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Trade Winds","weight":["400"]},{"name":"Train One","weight":["400"]},{"name":"Trirong","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Trispace","weight":["100","200","300","400","500","600","700","800"]},{"name":"Trocchi","weight":["400"]},{"name":"Trochut","weight":["400","700"]},{"name":"Truculenta","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Trykker","weight":["400"]},{"name":"Tulpen One","weight":["400"]},{"name":"Turret Road","weight":["200","300","400","500","700","800"]},{"name":"Ubuntu","weight":["300","400","500","700"]},{"name":"Ubuntu Condensed","weight":["400"]},{"name":"Ubuntu Mono","weight":["400","700"]},{"name":"Uchen","weight":["400"]},{"name":"Ultra","weight":["400"]},{"name":"Uncial Antiqua","weight":["400"]},{"name":"Underdog","weight":["400"]},{"name":"Unica One","weight":["400"]},{"name":"UnifrakturCook","weight":["700"]},{"name":"UnifrakturMaguntia","weight":["400"]},{"name":"Unkempt","weight":["400","700"]},{"name":"Unlock","weight":["400"]},{"name":"Unna","weight":["400","700"]},{"name":"Urbanist","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"VT323","weight":["400"]},{"name":"Vampiro One","weight":["400"]},{"name":"Varela","weight":["400"]},{"name":"Varela Round","weight":["400"]},{"name":"Varta","weight":["300","400","500","600","700"]},{"name":"Vast Shadow","weight":["400"]},{"name":"Vesper Libre","weight":["400","500","700","900"]},{"name":"Viaoda Libre","weight":["400"]},{"name":"Vibes","weight":["400"]},{"name":"Vibur","weight":["400"]},{"name":"Vidaloka","weight":["400"]},{"name":"Viga","weight":["400"]},{"name":"Voces","weight":["400"]},{"name":"Volkhov","weight":["400","700"]},{"name":"Vollkorn","weight":["400","500","600","700","800","900"]},{"name":"Vollkorn SC","weight":["400","600","700","900"]},{"name":"Voltaire","weight":["400"]},{"name":"Waiting for the Sunrise","weight":["400"]},{"name":"Wallpoet","weight":["400"]},{"name":"Walter Turncoat","weight":["400"]},{"name":"Warnes","weight":["400"]},{"name":"Wellfleet","weight":["400"]},{"name":"Wendy One","weight":["400"]},{"name":"WindSong","weight":["400","500"]},{"name":"Wire One","weight":["400"]},{"name":"Work Sans","weight":["100","200","300","400","500","600","700","800","900"]},{"name":"Xanh Mono","weight":["400"]},{"name":"Yaldevi","weight":["200","300","400","500","600","700"]},{"name":"Yanone Kaffeesatz","weight":["200","300","400","500","600","700"]},{"name":"Yantramanav","weight":["100","300","400","500","700","900"]},{"name":"Yatra One","weight":["400"]},{"name":"Yellowtail","weight":["400"]},{"name":"Yeon Sung","weight":["400"]},{"name":"Yeseva One","weight":["400"]},{"name":"Yesteryear","weight":["400"]},{"name":"Yomogi","weight":["400"]},{"name":"Yrsa","weight":["300","400","500","600","700"]},{"name":"Yusei Magic","weight":["400"]},{"name":"ZCOOL KuaiLe","weight":["400"]},{"name":"ZCOOL QingKe HuangYou","weight":["400"]},{"name":"ZCOOL XiaoWei","weight":["400"]},{"name":"Zen Antique","weight":["400"]},{"name":"Zen Antique Soft","weight":["400"]},{"name":"Zen Dots","weight":["400"]},{"name":"Zen Kaku Gothic Antique","weight":["300","400","500","700","900"]},{"name":"Zen Kaku Gothic New","weight":["300","400","500","700","900"]},{"name":"Zen Kurenaido","weight":["400"]},{"name":"Zen Loop","weight":["400"]},{"name":"Zen Maru Gothic","weight":["300","400","500","700","900"]},{"name":"Zen Old Mincho","weight":["400","700","900"]},{"name":"Zen Tokyo Zoo","weight":["400"]},{"name":"Zeyada","weight":["400"]},{"name":"Zhi Mang Xing","weight":["400"]},{"name":"Zilla Slab","weight":["300","400","500","600","700"]},{"name":"Zilla Slab Highlight","weight":["400","700"]}]'); + +}); + + +parcelRegister("eGTfQ", function(module, exports) { + +$parcel$export(module.exports, "PanelPadding", () => $6843f8084917b52b$export$5c27ea9c949c9c3e); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $6ai3B = parcelRequire("6ai3B"); + +var $3M49X = parcelRequire("3M49X"); + +var $eW2Jy = parcelRequire("eW2Jy"); + +var $43Iq0 = parcelRequire("43Iq0"); + +var $bjM6F = parcelRequire("bjM6F"); + +var $emJmR = parcelRequire("emJmR"); +const $6843f8084917b52b$export$5c27ea9c949c9c3e = ({ id: id, value: value, update: update, mode: mode })=>{ + const detectMixed = (v)=>{ + let data = v; + let corner = []; + (0, (/*@__PURE__*/$parcel$interopDefault($eW2Jy)))(data, (r, v, k)=>{ + corner.push(v); + }); + let uniqueCorner = (0, (/*@__PURE__*/$parcel$interopDefault($43Iq0)))(corner); + if (uniqueCorner.length > 1 && corner.length === 4) return { + isMix: true, + value: "Mixed" + }; + return { + isMix: false, + value: uniqueCorner[0] + "" + }; + }; + const local = (0, $4WfNn.useLocal)({ + id: id, + all: false + }, ()=>{ + let mix = detectMixed(padding); + local.all = mix.isMix; + local.render(); + }); + const padding = (0, $bjM6F.responsiveVal)(value, "padding", mode, { + l: 0, + b: 0, + t: 0, + r: 0 + }); + (0, $63SH6.useEffect)(()=>{ + if (local.id !== id) { + local.id = id; + if (!local.all) { + if (padding.l !== padding.r || padding.b !== padding.t) { + local.all = true; + local.render(); + } + } else if (local.all) { + if (padding.l === padding.r && padding.b === padding.t) { + local.all = false; + local.render(); + } + } + } + }, [ + id + ]); + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex flex-col space-y-2", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex items-stretch justify-between text-xs ", css` + .field-num { + height: 25px; + border: 1px solid #d1d1d1; + width: 74px !important; + } + `), + children: [ + !local.all && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Horizontal Padding", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[22px] h-[14px] flex items-center justify-center border-r border-gray-300 mr-1", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: 12, + height: 12, + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M0 12V0h1v12H0zm3-9h6v6H3V3zm1 1v4h4V4H4zm7 8V0h1v12h-1z", + fillRule: "evenodd", + fill: "#000" + }) + }) + }), + value: padding.l + "px", + update: (val)=>{ + update("padding", { + ...padding, + l: parseInt(val.replaceAll("px", "")), + r: parseInt(val.replaceAll("px", "")) + }); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Vertical Padding", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[22px] h-[14px] flex items-center justify-center border-r border-gray-300 mr-1", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: 12, + height: 12, + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M3 3h6v6H3V3zm1 1v4h4V4H4zm8 8H0v-1h12v1zm0-11H0V0h12v1z", + fillRule: "evenodd", + fill: "#000" + }) + }) + }), + value: padding.t + "px", + update: (val)=>{ + update("padding", { + ...padding, + t: parseInt(val.replaceAll("px", "")), + b: parseInt(val.replaceAll("px", "")) + }); + } + }) + }) + }) + ] + }), + local.all && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Left Padding", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[22px] h-[14px] flex items-center justify-center border-r border-gray-300 mr-1", + children: /*#__PURE__*/ (0, $lAN3N.jsx)($6843f8084917b52b$var$ArrowLeft, {}) + }), + value: padding.l + "px", + update: (val)=>{ + update("padding", { + ...padding, + l: parseInt(val.replaceAll("px", "")) + }); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Right Padding", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[22px] h-[14px] flex items-center justify-center border-r border-gray-300 mr-1", + children: /*#__PURE__*/ (0, $lAN3N.jsx)($6843f8084917b52b$var$ArrowRight, {}) + }), + value: padding.r + "px", + update: (val)=>{ + update("padding", { + ...padding, + r: parseInt(val.replaceAll("px", "")) + }); + } + }) + }) + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Toggle Padding", + placement: "top-end", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $6ai3B.Button), { + className: cx("flex-1", css` + width: 30px; + max-width: 30px; + min-width: 0px !important; + background: ${local.all ? "#3c82f6" : "#fff"} !important; + border-color: ${local.all ? "#7baeff" : "#d1d1d1"} !important; + `), + onClick: ()=>{ + local.all = !local.all; + local.render(); + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: 12, + height: 12, + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M3 0h6v1H3V0zM0 3v6h1V3H0zm11 0v6h1V3h-1zm-8 9h6v-1H3v1z", + fillRule: "evenodd", + fillOpacity: 0.8, + fill: local.all ? "#fff" : "#000" + }) + }) + }) + }) + }) + ] + }), + local.all && /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex items-stretch justify-between text-xs ", css` + .field-num { + height: 25px; + border: 1px solid #d1d1d1; + width: 74px !important; + } + `), + children: [ + local.all && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Top Padding", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[22px] h-[14px] flex items-center justify-center border-r border-gray-300 mr-1", + children: /*#__PURE__*/ (0, $lAN3N.jsx)($6843f8084917b52b$var$ArrowUp, {}) + }), + value: padding.t + "px", + update: (val)=>{ + update("padding", { + ...padding, + t: parseInt(val.replaceAll("px", "")) + }); + } + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + asChild: true, + content: "Bottom Padding", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3M49X.FieldNumUnit), { + positiveOnly: true, + hideUnit: true, + icon: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "w-[22px] h-[14px] flex items-center justify-center border-r border-gray-300 mr-1", + children: /*#__PURE__*/ (0, $lAN3N.jsx)($6843f8084917b52b$var$ArrowDown, {}) + }), + value: padding.b + "px", + update: (val)=>{ + update("padding", { + ...padding, + b: parseInt(val.replaceAll("px", "")) + }); + } + }) + }) + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("flex-1", css` + width: 30px; + max-width: 30px; + min-width: 0px !important; + `) + }) + ] + }) + ] + }); +}; +const $6843f8084917b52b$var$ArrowLeft = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M6.854 3.146a.5.5 0 010 .708L3.707 7H12.5a.5.5 0 010 1H3.707l3.147 3.146a.5.5 0 01-.708.708l-4-4a.5.5 0 010-.708l4-4a.5.5 0 01.708 0z", + clipRule: "evenodd" + }) + }); +const $6843f8084917b52b$var$ArrowRight = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M8.146 3.146a.5.5 0 01.708 0l4 4a.5.5 0 010 .708l-4 4a.5.5 0 01-.708-.708L11.293 8H2.5a.5.5 0 010-1h8.793L8.146 3.854a.5.5 0 010-.708z", + clipRule: "evenodd" + }) + }); +const $6843f8084917b52b$var$ArrowDown = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M7.5 2a.5.5 0 01.5.5v8.793l3.146-3.147a.5.5 0 01.708.708l-4 4a.5.5 0 01-.708 0l-4-4a.5.5 0 11.708-.708L7 11.293V2.5a.5.5 0 01.5-.5z", + clipRule: "evenodd" + }) + }); +const $6843f8084917b52b$var$ArrowUp = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M7.146 2.146a.5.5 0 01.708 0l4 4a.5.5 0 01-.708.708L8 3.707V12.5a.5.5 0 01-1 0V3.707L3.854 6.854a.5.5 0 11-.708-.708l4-4z", + clipRule: "evenodd" + }) + }); + +}); + +parcelRegister("gYVef", function(module, exports) { + +$parcel$export(module.exports, "CPInstance", () => $ca04eee3c1de61aa$export$53de1512c4728bbc); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $0t7p0 = parcelRequire("0t7p0"); + +var $1CiVi = parcelRequire("1CiVi"); + +var $emJmR = parcelRequire("emJmR"); + +var $5NYeV = parcelRequire("5NYeV"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $8u89v = parcelRequire("8u89v"); + +var $6QgH2 = parcelRequire("6QgH2"); + +var $ax46r = parcelRequire("ax46r"); + +var $i8e1B = parcelRequire("i8e1B"); + +var $fy4Kd = parcelRequire("fy4Kd"); + +var $3KK1E = parcelRequire("3KK1E"); + +var $18ruq = parcelRequire("18ruq"); + +var $j8xVm = parcelRequire("j8xVm"); +const $ca04eee3c1de61aa$export$53de1512c4728bbc = ({ mitem: mitem })=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + const local = (0, $4WfNn.useLocal)({ + status: "loading", + mprops: null, + props: {}, + jsx: false + }); + const compid = mitem.get("component")?.get("id") || ""; + const comp = p.comps.doc[compid]; + (0, $63SH6.useEffect)(()=>{ + (async ()=>{ + local.status = "loading"; + local.render(); + if (comp) { + const cprops = comp.getMap("map").get("content_tree")?.get("component")?.get("props")?.toJSON(); + const mprops = mitem.get("component")?.get("props"); + if (!mprops) { + local.status = "ERROR: Item not found."; + local.render(); + return; + } else if (cprops) { + local.mprops = mprops; + const props = {}; + for (const [k, v] of Object.entries(cprops)){ + props[k] = v; + const prop = mprops.get(k); + if (prop) { + props[k].value = prop.get("value"); + props[k].valueBuilt = prop.get("valueBuilt"); + } else mprops.set(k, (0, $6QgH2.newMap)(v)); + } + local.props = props; + local.render(); + } + } + if (!(0, $ax46r.jscript).build) (0, $ax46r.jscript).init().then(()=>{ + local.status = "ready"; + local.render(); + }); + else { + local.status = "ready"; + local.render(); + } + })(); + }, [ + mitem + ]); + if (!comp) { + (0, $5NYeV.loadComponent)(p, compid).then(local.render); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: "cp-comp", + backdrop: false + }); + } + if (local.status === "loading") return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: "cp-instance", + backdrop: false + }); + if (local.status !== "ready") /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex flex-col flex-1", + children: local.status + }); + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex flex-col flex-1", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "border-b bg-white flex justify-between items-center", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-[10px] select-none text-slate-400 pl-1 py-1", + children: "PROPS" + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex mr-1 px-2 bg-white text-xs border rounded-sm cursor-pointer hover:bg-blue-50 hover:border-blue-500 text-blue-700 space-x-1", + onClick: ()=>{ + const meta = p.treeMeta[p.item.active]; + if (meta) { + p.compProp.edit = true; + p.compProp.backToInstance = true; + (0, $5NYeV.editComp)(p, meta.item.id); + } + }, + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: "Edit Prop:" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-ellipsis font-bold", + children: mitem.get("name") + }) + ] + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 relative overflow-y-auto", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "absolute flex-col inset-0", + children: [ + Object.entries(local.props).sort((a, b)=>{ + return a[1].idx - b[1].idx; + }).map(([k, v])=>{ + let mprop = local.mprops.get(k); + if (mprop) { + if (!local.jsx && v.meta?.type === "content-element") return; + let visible = true; + const meta = p.treeMeta[p.item.active]; + if (v.visible && meta) { + const propvis = meta.comp?.propvis; + if (propvis) visible = propvis[k]; + } + if (visible) return /*#__PURE__*/ (0, $lAN3N.jsx)($ca04eee3c1de61aa$var$SingleProp, { + name: k, + prop: v, + mprop: mprop, + mprops: local.mprops, + comp: comp, + render: p.render, + p: p + }, k); + } + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "p-2 flex items-center justify-center space-x-2", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "bg-white border rounded px-3 text-xs cursor-pointer hover:bg-blue-100 active:bg-blue-500 active:text-white", + onClick: ()=>{ + local.jsx = !local.jsx; + local.render(); + }, + children: [ + local.jsx ? "Hide" : "Show", + " JSX" + ] + }) + }) + ] + }) + }) + ] + }); +}; +const $ca04eee3c1de61aa$var$SingleProp = ({ name: name, prop: _prop, mprop: mprop, mprops: mprops, render: render, comp: comp, p: p })=>{ + const local = (0, $4WfNn.useLocal)({ + clickEvent: null, + loading: false, + editCode: false, + propval: null + }); + const type = _prop.meta?.type || "text"; + const updateValue = async (val)=>{ + if ((0, $ax46r.jscript).build) { + const res = await (0, $ax46r.jscript).build("prop [" + name + "] -> .tsx", `return ${val}`, undefined, true); + let js = val; + let jsBuilt = res.substring(6); + mprop.doc?.transact(()=>{ + mprop.set("value", val); + mprop.set("valueBuilt", res.substring(6)); + }); + const meta = p.treeMeta[p.item.active]; + if (meta.item.type === "item" && meta.item.component) { + meta.item.component.props[name].value = js; + meta.item.component.props[name].valueBuilt = jsBuilt; + } + (0, $8u89v.rebuildTree)(p, { + mode: "update", + note: "update-props" + }); + } + }; + const reset = ()=>{ + const propVal = comp.getMap("map").get("content_tree")?.get("component")?.get("props")?.get(name)?.toJSON(); + if (propVal) { + mprop.doc?.transact(()=>{ + mprop.set("value", propVal.value); + mprop.set("valueBuilt", propVal.valueBuilt); + }); + _prop.value = propVal.value; + _prop.valueBuilt = propVal.valueBuilt; + local.loading = true; + render(); + setTimeout(()=>{ + local.loading = false; + render(); + }, 100); + } + }; + let prop = comp.getMap("map").get("content_tree")?.get("component")?.get("props")?.get(name)?.toJSON(); + let notExists = false; + if (prop) { + prop.value = mprop.get("value"); + prop.valueBuilt = mprop.get("valueBuilt"); + } else { + prop = _prop; + notExists = true; + } + const editCode = (onClose)=>{ + local.editCode = true; + p.script.active = true; + p.script.prop = { + name: name, + mode: "instance" + }; + const DEFAULT = `\ +async () => { + return \`""\` +}`; + if (prop.gen && prop.genBuilt && prop.gen.replace(/\W/g, "") !== DEFAULT.replace(/\W/g, "")) p.script.toolbar = /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "bg-blue-500 hover:bg-blue-300 cursor-pointer text-white rounded-sm flex items-center px-2", + onClick: async ()=>{ + const meta = p.treeMeta[p.item.active]; + if (prop.genBuilt && meta && p.script.doEdit) try { + const propEval = (0, $j8xVm.treePropEval)(p, meta, Object.entries(mprops.toJSON())); + const scopes = (0, $18ruq.mergeScopeUpwards)(p, meta); + let args = { + ...window.exports, + ...scopes, + db: p.script.db, + api: p.script.api, + ...propEval + }; + const fn = new Function(...Object.keys(args), `return ${prop.genBuilt}`); + const efn = fn(...Object.values(args)); + let result = ""; + if (typeof efn === "function") { + const promise = efn(); + if (promise && promise instanceof Promise) result = await promise; + else result = promise; + } + if (typeof result === "string") p.script.doEdit(result, true); + } catch (e) { + console.log(e); + } + }, + children: "Generate" + }); + p.script.onClose = ()=>{ + p.script.prop = null; + if (typeof onClose === "function") onClose(); + local.editCode = false; + local.render(); + }; + p.render(); + }; + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + onContextMenu: (e)=>{ + e.preventDefault(); + local.clickEvent = e; + local.render(); + }, + className: cx("border-b bg-white hover:bg-orange-50 flex flex-col items-stretch"), + children: [ + local.clickEvent && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $0t7p0.Menu), { + mouseEvent: local.clickEvent, + onClose: ()=>{ + local.clickEvent = null; + local.render(); + }, + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), { + label: "Reset", + onClick: reset + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $0t7p0.MenuItem), { + label: "Edit Code", + onClick: ()=>{ + editCode(); + } + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex justify-between items-stretch relative", + children: [ + (()=>{ + const label = /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("border-l-2 border-transparent cursor-pointer pr-3 flex items-center w-[60px] overflow-hidden relative min-h-[25px]", local.clickEvent ? "bg-orange-500 text-white" : " ", css` + .absolute { + max-width: 55px; + overflow: hidden; + } + &:hover { + overflow: visible; + + .absolute { + max-width: 150px; + background: white; + border: 1px solid #f1c2a7; + margin: -1px; + } + + &.text-white .absolute { + background: #f97315; + border: 0px; + margin: 0px; + } + } + `), + onClick: (e)=>{ + if (local.clickEvent) local.clickEvent = null; + else local.clickEvent = e; + local.render(); + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "absolute px-1", + children: name + }) + }); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: local.editCode ? /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "bg-orange-500 text-white px-2 flex items-center absolute inset-0", + children: name + }) : label + }); + })(), + local.loading ? /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex items-stretch flex-1", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "min-h-[30px]" + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex items-stretch flex-1", + children: [ + type === "content-element" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $i8e1B.CPJsx), { + prop: prop, + name: name, + onChange: updateValue, + editCode: editCode, + reset: reset + }), + type === "text" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3KK1E.CPText), { + prop: prop, + name: name, + onChange: updateValue, + editCode: editCode, + reset: reset + }), + type === "option" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $fy4Kd.CPOption), { + name: name, + prop: prop, + onChange: updateValue, + editCode: editCode, + reset: reset + }), + notExists && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $emJmR.Tooltip), { + content: "Not exist in Master Prop", + className: "cursor-pointer flex items-center px-1 border-l text-red-400", + onClick: ()=>{ + mprops.delete(name); + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M5.5 1a.5.5 0 000 1h4a.5.5 0 000-1h-4zM3 3.5a.5.5 0 01.5-.5h8a.5.5 0 010 1H11v8a1 1 0 01-1 1H5a1 1 0 01-1-1V4h-.5a.5.5 0 01-.5-.5zM5 4h5v8H5V4z", + clipRule: "evenodd" + }) + }) + }) + ] + }) + ] + }) + ] + }); +}; + +}); +parcelRegister("i8e1B", function(module, exports) { + +$parcel$export(module.exports, "CPJsx", () => CPJsx); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $3lO1D = parcelRequire("3lO1D"); +const CPJsx = ({ name, prop, onChange, editCode, reset })=>{ + const local = (0, $4WfNn.useLocal)({ + value: "", + codeEditing: false + }); + (0, $63SH6.useEffect)(()=>{ + if (prop.value) try { + eval(`local.value = ${prop.valueBuilt}`); + } catch (e) {} + else local.value = ""; + local.render(); + }, [ + prop.value, + prop.valueBuilt + ]); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3lO1D.CPCoded), { + editCode: ()=>{ + local.codeEditing = true; + local.render(); + editCode(()=>{ + local.codeEditing = false; + local.render(); + }); + }, + reset: reset + }); +}; + +}); +parcelRegister("3lO1D", function(module, exports) { + +$parcel$export(module.exports, "CPCoded", () => $d7b3d9320d153245$export$37d835b2cb70f63); + +var $lAN3N = parcelRequire("lAN3N"); +const $d7b3d9320d153245$export$37d835b2cb70f63 = ({ editCode: editCode, reset: reset })=>{ + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex flex-1 items-stretch justify-end pr-2", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "m-1 px-1 bg-white cursor-pointer hover:bg-blue-500 hover:text-white hover:border-blue-500 font-mono border border-slate-300 text-[11px]", + onClick: ()=>editCode(), + children: "EDIT CODE" + }), + reset && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "my-1 px-1 bg-white cursor-pointer hover:bg-blue-500 hover:text-white hover:border-blue-500 font-mono border border-slate-300 text-[11px] flex items-center", + onClick: reset, + dangerouslySetInnerHTML: { + __html: `` + } + }) + ] + }); +}; + +}); + + +parcelRegister("fy4Kd", function(module, exports) { + +$parcel$export(module.exports, "CPOption", () => CPOption); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $3lO1D = parcelRequire("3lO1D"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $1CiVi = parcelRequire("1CiVi"); + +var $hVFKL = parcelRequire("hVFKL"); + +var $eoQBx = parcelRequire("eoQBx"); +const CPOption = ({ prop, onChange, editCode, reset })=>{ + const local = (0, $4WfNn.useLocal)({ + codeEditing: false, + loading: false, + loaded: false, + isOpen: false, + val: "", + metaFn: null + }); + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + let metaOptions = []; + if (prop.meta?.options || prop.meta?.optionsBuilt) { + if (!local.loaded) try { + const args = { + ...window.exports, + db: p.script.db, + api: p.script.api + }; + eval(` +${Object.entries(args).map((e11)=>`const ${e11[0]} = args["${e11[0]}"]`).join(";\n")} +const resOpt = ${prop.meta.optionsBuilt || prop.meta.options}; +if (typeof resOpt === 'function') local.metaFn = resOpt; +else metaOptions = resOpt; +`); + } catch (e) { + console.error(e); + } + else metaOptions = local.loaded; + if (local.metaFn && !local.loaded && !local.loading) { + local.loading = true; + local.metaFn().then((e11)=>{ + local.loading = false; + local.loaded = e11; + local.render(); + }); + } + } + let evalue = null; + try { + eval(`evalue = ${prop.value}`); + } catch (e) {} + (0, $63SH6.useEffect)(()=>{ + local.val = evalue; + local.render(); + }, [ + evalue + ]); + if (!local.metaFn && (local.codeEditing || !metaOptions.find((e11)=>{ + return e11.value === evalue; + }))) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3lO1D.CPCoded), { + editCode: ()=>{ + local.codeEditing = true; + local.render(); + editCode(()=>{ + local.codeEditing = false; + local.render(); + }); + }, + reset: reset + }); + let mode = prop.meta?.option_mode; + if (!mode) mode = "button"; + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("flex items-center flex-wrap space-x-1 justify-end flex-1", mode === "dropdown" ? "max-h-[20px]" : "min-h-[30px]"), + children: local.loading ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + backdrop: false + }) : /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + mode === "dropdown" && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $hVFKL.default), { + inputValue: local.val, + isOpen: local.isOpen, + onOuterClick: ()=>{ + local.isOpen = false; + local.render(); + }, + onInputValueChange: (e11)=>{ + local.val = e11; + local.isOpen = true; + local.render(); + }, + onChange: (sel11)=>{ + if (!sel11) { + local.val = evalue; + local.isOpen = false; + local.render(); + } else { + const val11 = JSON.stringify(sel11.value); + local.isOpen = false; + onChange(val11); + } + }, + itemToString: (item11)=>item11 ? item11.value : "", + children: ({ getInputProps: getInputProps11, getItemProps: getItemProps11, getLabelProps: getLabelProps11, getMenuProps: getMenuProps11, isOpen: isOpen11, inputValue: inputValue11, highlightedIndex: highlightedIndex11, selectedItem: selectedItem11, getRootProps: getRootProps11 })=>/*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "border-l self-stretch", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + style: { + display: "inline-block" + }, + ...getRootProps11({}, { + suppressRefError: true + }), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("input", { + ...getInputProps11(), + onFocus: ()=>{ + local.val = ""; + local.isOpen = true; + local.render(); + }, + onClick: ()=>{ + local.isOpen = true; + local.render(); + }, + type: "search", + spellCheck: false, + className: "flex-1 self-stretch font-mono border-2 border-transparent outline-none bg-transparent focus:bg-white focus:border-blue-500 border-slate-300 text-[11px] min-h-[25px] pl-1 " + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("ul", { + ...getMenuProps11(), + className: "absolute z-10 border right-0 bg-white max-h-[300px] overflow-y-auto overflow-x-hidden", + children: isOpen11 ? metaOptions.filter((item11)=>!inputValue11 || item11.value.includes(inputValue11)).map((item11, index11)=>/*#__PURE__*/ (0, $lAN3N.jsx)("li", { + ...getItemProps11({ + key: item11.value, + index: index11, + item: item11 + }), + className: cx("min-w-[180px] px-2 py-[2px] border-b", selectedItem11 === item11 && highlightedIndex11 !== index11 && `bg-blue-500 text-white`, highlightedIndex11 === index11 && `bg-blue-200`), + children: item11.label || item11.value + })) : null + }) + ] + }) + }) + }), + mode === "button" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 pt-1 px-2 flex flex-wrap justify-end space-x-1", + children: Array.isArray(metaOptions) && metaOptions.map((item11, idx11)=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("flex px-2 text-xs mb-1 border rounded-sm cursor-pointer justify-center ", item11.value !== evalue ? "bg-white text-blue-700 hover:bg-blue-50 hover:border-blue-500" : "bg-blue-700 text-white border-blue-700"), + onClick: ()=>{ + const val11 = JSON.stringify(item11.value); + onChange(val11); + }, + children: item11.label + }, idx11); + }) + }) + ] + }) + }); +}; + +}); +parcelRegister("hVFKL", function(module, exports) { + +$parcel$export(module.exports, "default", () => $d0d825e43d8ba478$export$2e2bcd8739ae039); + +var $8WqTz = parcelRequire("8WqTz"); + +var $uwkDK = parcelRequire("uwkDK"); + +var $1Nh8o = parcelRequire("1Nh8o"); + +var $5VaeF = parcelRequire("5VaeF"); + +var $eu9I7 = parcelRequire("eu9I7"); + +var $63SH6 = parcelRequire("63SH6"); + +var $2oqnz = parcelRequire("2oqnz"); + +var $jybpY = parcelRequire("jybpY"); + +var $7Dnph = parcelRequire("7Dnph"); +var $d0d825e43d8ba478$var$idCounter = 0; +/** + * Accepts a parameter and returns it if it's a function + * or a noop function if it's not. This allows us to + * accept a callback, but not worry about it if it's not + * passed. + * @param {Function} cb the callback + * @return {Function} a function + */ function $d0d825e43d8ba478$var$cbToCb(cb) { + return typeof cb === "function" ? cb : $d0d825e43d8ba478$var$noop; +} +function $d0d825e43d8ba478$var$noop() {} +/** + * Scroll node into view if necessary + * @param {HTMLElement} node the element that should scroll into view + * @param {HTMLElement} menuNode the menu element of the component + */ function $d0d825e43d8ba478$var$scrollIntoView(node, menuNode) { + if (!node) return; + var actions = (0, $jybpY.compute)(node, { + boundary: menuNode, + block: "nearest", + scrollMode: "if-needed" + }); + actions.forEach(function(_ref) { + var el = _ref.el, top = _ref.top, left = _ref.left; + el.scrollTop = top; + el.scrollLeft = left; + }); +} +/** + * @param {HTMLElement} parent the parent node + * @param {HTMLElement} child the child node + * @param {Window} environment The window context where downshift renders. + * @return {Boolean} whether the parent is the child or the child is in the parent + */ function $d0d825e43d8ba478$var$isOrContainsNode(parent, child, environment) { + var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child); + return result; +} +/** + * Simple debounce implementation. Will call the given + * function once after the time given has passed since + * it was last called. + * @param {Function} fn the function to call after the time + * @param {Number} time the time to wait + * @return {Function} the debounced function + */ function $d0d825e43d8ba478$var$debounce(fn, time) { + var timeoutId; + function cancel() { + if (timeoutId) clearTimeout(timeoutId); + } + function wrapper() { + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + cancel(); + timeoutId = setTimeout(function() { + timeoutId = null; + fn.apply(void 0, args); + }, time); + } + wrapper.cancel = cancel; + return wrapper; +} +/** + * This is intended to be used to compose event handlers. + * They are executed in order until one of them sets + * `event.preventDownshiftDefault = true`. + * @param {...Function} fns the event handler functions + * @return {Function} the event handler to add to an element + */ function $d0d825e43d8ba478$var$callAllEventHandlers() { + for(var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)fns[_key2] = arguments[_key2]; + return function(event) { + for(var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++)args[_key3 - 1] = arguments[_key3]; + return fns.some(function(fn) { + if (fn) fn.apply(void 0, [ + event + ].concat(args)); + return event.preventDownshiftDefault || event.hasOwnProperty("nativeEvent") && event.nativeEvent.preventDownshiftDefault; + }); + }; +} +function $d0d825e43d8ba478$var$handleRefs() { + for(var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++)refs[_key4] = arguments[_key4]; + return function(node) { + refs.forEach(function(ref) { + if (typeof ref === "function") ref(node); + else if (ref) ref.current = node; + }); + }; +} +/** + * This generates a unique ID for an instance of Downshift + * @return {String} the unique ID + */ function $d0d825e43d8ba478$var$generateId() { + return String($d0d825e43d8ba478$var$idCounter++); +} +/** + * Resets idCounter to 0. Used for SSR. + */ function $d0d825e43d8ba478$export$4fba683129f6ab1e() { + // istanbul ignore next + if ("useId" in (0, (/*@__PURE__*/$parcel$interopDefault($63SH6)))) { + console.warn("It is not necessary to call resetIdCounter when using React 18+"); + return; + } + $d0d825e43d8ba478$var$idCounter = 0; +} +/** + * Default implementation for status message. Only added when menu is open. + * Will specify if there are results in the list, and if so, how many, + * and what keys are relevant. + * + * @param {Object} param the downshift state and other relevant properties + * @return {String} the a11y status message + */ function $d0d825e43d8ba478$var$getA11yStatusMessage$1(_ref2) { + var isOpen = _ref2.isOpen, resultCount = _ref2.resultCount, previousResultCount = _ref2.previousResultCount; + if (!isOpen) return ""; + if (!resultCount) return "No results are available."; + if (resultCount !== previousResultCount) return resultCount + " result" + (resultCount === 1 ? " is" : "s are") + " available, use up and down arrow keys to navigate. Press Enter key to select."; + return ""; +} +/** + * Takes an argument and if it's an array, returns the first item in the array + * otherwise returns the argument + * @param {*} arg the maybe-array + * @param {*} defaultValue the value if arg is falsey not defined + * @return {*} the arg or it's first item + */ function $d0d825e43d8ba478$var$unwrapArray(arg, defaultValue) { + arg = Array.isArray(arg) ? /* istanbul ignore next (preact) */ arg[0] : arg; + if (!arg && defaultValue) return defaultValue; + else return arg; +} +/** + * @param {Object} element (P)react element + * @return {Boolean} whether it's a DOM element + */ function $d0d825e43d8ba478$var$isDOMElement(element) { + // then we assume this is react + return typeof element.type === "string"; +} +/** + * @param {Object} element (P)react element + * @return {Object} the props + */ function $d0d825e43d8ba478$var$getElementProps(element) { + return element.props; +} +/** + * Throws a helpful error message for required properties. Useful + * to be used as a default in destructuring or object params. + * @param {String} fnName the function name + * @param {String} propName the prop name + */ function $d0d825e43d8ba478$var$requiredProp(fnName, propName) { + // eslint-disable-next-line no-console + console.error('The property "' + propName + '" is required in "' + fnName + '"'); +} +var $d0d825e43d8ba478$var$stateKeys = [ + "highlightedIndex", + "inputValue", + "isOpen", + "selectedItem", + "type" +]; +/** + * @param {Object} state the state object + * @return {Object} state that is relevant to downshift + */ function $d0d825e43d8ba478$var$pickState(state) { + if (state === void 0) state = {}; + var result = {}; + $d0d825e43d8ba478$var$stateKeys.forEach(function(k) { + if (state.hasOwnProperty(k)) result[k] = state[k]; + }); + return result; +} +/** + * This will perform a shallow merge of the given state object + * with the state coming from props + * (for the controlled component scenario) + * This is used in state updater functions so they're referencing + * the right state regardless of where it comes from. + * + * @param {Object} state The state of the component/hook. + * @param {Object} props The props that may contain controlled values. + * @returns {Object} The merged controlled state. + */ function $d0d825e43d8ba478$var$getState(state, props) { + return Object.keys(state).reduce(function(prevState, key) { + prevState[key] = $d0d825e43d8ba478$var$isControlledProp(props, key) ? props[key] : state[key]; + return prevState; + }, {}); +} +/** + * This determines whether a prop is a "controlled prop" meaning it is + * state which is controlled by the outside of this component rather + * than within this component. + * + * @param {Object} props The props that may contain controlled values. + * @param {String} key the key to check + * @return {Boolean} whether it is a controlled controlled prop + */ function $d0d825e43d8ba478$var$isControlledProp(props, key) { + return props[key] !== undefined; +} +/** + * Normalizes the 'key' property of a KeyboardEvent in IE/Edge + * @param {Object} event a keyboardEvent object + * @return {String} keyboard key + */ function $d0d825e43d8ba478$var$normalizeArrowKey(event) { + var key = event.key, keyCode = event.keyCode; + /* istanbul ignore next (ie) */ if (keyCode >= 37 && keyCode <= 40 && key.indexOf("Arrow") !== 0) return "Arrow" + key; + return key; +} +/** + * Simple check if the value passed is object literal + * @param {*} obj any things + * @return {Boolean} whether it's object literal + */ function $d0d825e43d8ba478$var$isPlainObject(obj) { + return Object.prototype.toString.call(obj) === "[object Object]"; +} +/** + * Returns the next non-disabled highlightedIndex value. + * + * @param {number} start The current highlightedIndex. + * @param {number} offset The offset from the current highlightedIndex to start searching. + * @param {unknown[]} items The items array. + * @param {(item: unknown, index: number) => boolean} isItemDisabled Function that tells if an item is disabled or not. + * @param {boolean?} circular If the search reaches the end, if it can search again starting from the other end. + * @returns {number} The next highlightedIndex. + */ function $d0d825e43d8ba478$var$getHighlightedIndex(start, offset, items, isItemDisabled, circular) { + if (circular === void 0) circular = false; + var count = items.length; + if (count === 0) return -1; + var itemsLastIndex = count - 1; + if (typeof start !== "number" || start < 0 || start > itemsLastIndex) start = offset > 0 ? -1 : itemsLastIndex + 1; + var current = start + offset; + if (current < 0) current = circular ? itemsLastIndex : 0; + else if (current > itemsLastIndex) current = circular ? 0 : itemsLastIndex; + var highlightedIndex = $d0d825e43d8ba478$var$getNonDisabledIndex(current, offset < 0, items, isItemDisabled, circular); + if (highlightedIndex === -1) return start >= count ? -1 : start; + return highlightedIndex; +} +/** + * Returns the next non-disabled highlightedIndex value. + * + * @param {number} start The current highlightedIndex. + * @param {boolean} backwards If true, it will search backwards from the start. + * @param {unknown[]} items The items array. + * @param {(item: unknown, index: number) => boolean} isItemDisabled Function that tells if an item is disabled or not. + * @param {boolean} circular If the search reaches the end, if it can search again starting from the other end. + * @returns {number} The next non-disabled index. + */ function $d0d825e43d8ba478$var$getNonDisabledIndex(start, backwards, items, isItemDisabled, circular) { + if (circular === void 0) circular = false; + var count = items.length; + if (backwards) for(var index = start; index >= 0; index--){ + if (!isItemDisabled(items[index], index)) return index; + } + else for(var _index = start; _index < count; _index++){ + if (!isItemDisabled(items[_index], _index)) return _index; + } + if (circular) return $d0d825e43d8ba478$var$getNonDisabledIndex(backwards ? count - 1 : 0, backwards, items, isItemDisabled); + return -1; +} +/** + * Checks if event target is within the downshift elements. + * + * @param {EventTarget} target Target to check. + * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc). + * @param {Window} environment The window context where downshift renders. + * @param {boolean} checkActiveElement Whether to also check activeElement. + * + * @returns {boolean} Whether or not the target is within downshift elements. + */ function $d0d825e43d8ba478$var$targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) { + if (checkActiveElement === void 0) checkActiveElement = true; + return environment && downshiftElements.some(function(contextNode) { + return contextNode && ($d0d825e43d8ba478$var$isOrContainsNode(contextNode, target, environment) || checkActiveElement && $d0d825e43d8ba478$var$isOrContainsNode(contextNode, environment.document.activeElement, environment)); + }); +} +// eslint-disable-next-line import/no-mutable-exports +var $d0d825e43d8ba478$var$validateControlledUnchanged = $d0d825e43d8ba478$var$noop; +var $d0d825e43d8ba478$var$cleanupStatus = $d0d825e43d8ba478$var$debounce(function(documentProp) { + $d0d825e43d8ba478$var$getStatusDiv(documentProp).textContent = ""; +}, 500); +/** + * Get the status node or create it if it does not already exist. + * @param {Object} documentProp document passed by the user. + * @return {HTMLElement} the status node. + */ function $d0d825e43d8ba478$var$getStatusDiv(documentProp) { + var statusDiv = documentProp.getElementById("a11y-status-message"); + if (statusDiv) return statusDiv; + statusDiv = documentProp.createElement("div"); + statusDiv.setAttribute("id", "a11y-status-message"); + statusDiv.setAttribute("role", "status"); + statusDiv.setAttribute("aria-live", "polite"); + statusDiv.setAttribute("aria-relevant", "additions text"); + Object.assign(statusDiv.style, { + border: "0", + clip: "rect(0 0 0 0)", + height: "1px", + margin: "-1px", + overflow: "hidden", + padding: "0", + position: "absolute", + width: "1px" + }); + documentProp.body.appendChild(statusDiv); + return statusDiv; +} +/** + * @param {String} status the status message + * @param {Object} documentProp document passed by the user. + */ function $d0d825e43d8ba478$var$setStatus(status, documentProp) { + if (!status || !documentProp) return; + var div = $d0d825e43d8ba478$var$getStatusDiv(documentProp); + div.textContent = status; + $d0d825e43d8ba478$var$cleanupStatus(documentProp); +} +var $d0d825e43d8ba478$var$unknown = 0; +var $d0d825e43d8ba478$var$mouseUp = 1; +var $d0d825e43d8ba478$var$itemMouseEnter = 2; +var $d0d825e43d8ba478$var$keyDownArrowUp = 3; +var $d0d825e43d8ba478$var$keyDownArrowDown = 4; +var $d0d825e43d8ba478$var$keyDownEscape = 5; +var $d0d825e43d8ba478$var$keyDownEnter = 6; +var $d0d825e43d8ba478$var$keyDownHome = 7; +var $d0d825e43d8ba478$var$keyDownEnd = 8; +var $d0d825e43d8ba478$var$clickItem = 9; +var $d0d825e43d8ba478$var$blurInput = 10; +var $d0d825e43d8ba478$var$changeInput = 11; +var $d0d825e43d8ba478$var$keyDownSpaceButton = 12; +var $d0d825e43d8ba478$var$clickButton = 13; +var $d0d825e43d8ba478$var$blurButton = 14; +var $d0d825e43d8ba478$var$controlledPropUpdatedSelectedItem = 15; +var $d0d825e43d8ba478$var$touchEnd = 16; +var $d0d825e43d8ba478$var$stateChangeTypes$3 = /*#__PURE__*/ Object.freeze({ + __proto__: null, + unknown: $d0d825e43d8ba478$var$unknown, + mouseUp: $d0d825e43d8ba478$var$mouseUp, + itemMouseEnter: $d0d825e43d8ba478$var$itemMouseEnter, + keyDownArrowUp: $d0d825e43d8ba478$var$keyDownArrowUp, + keyDownArrowDown: $d0d825e43d8ba478$var$keyDownArrowDown, + keyDownEscape: $d0d825e43d8ba478$var$keyDownEscape, + keyDownEnter: $d0d825e43d8ba478$var$keyDownEnter, + keyDownHome: $d0d825e43d8ba478$var$keyDownHome, + keyDownEnd: $d0d825e43d8ba478$var$keyDownEnd, + clickItem: $d0d825e43d8ba478$var$clickItem, + blurInput: $d0d825e43d8ba478$var$blurInput, + changeInput: $d0d825e43d8ba478$var$changeInput, + keyDownSpaceButton: $d0d825e43d8ba478$var$keyDownSpaceButton, + clickButton: $d0d825e43d8ba478$var$clickButton, + blurButton: $d0d825e43d8ba478$var$blurButton, + controlledPropUpdatedSelectedItem: $d0d825e43d8ba478$var$controlledPropUpdatedSelectedItem, + touchEnd: $d0d825e43d8ba478$var$touchEnd +}); +var $d0d825e43d8ba478$var$_excluded$4 = [ + "refKey", + "ref" +], $d0d825e43d8ba478$var$_excluded2$3 = [ + "onClick", + "onPress", + "onKeyDown", + "onKeyUp", + "onBlur" +], $d0d825e43d8ba478$var$_excluded3$2 = [ + "onKeyDown", + "onBlur", + "onChange", + "onInput", + "onChangeText" +], $d0d825e43d8ba478$var$_excluded4$1 = [ + "refKey", + "ref" +], $d0d825e43d8ba478$var$_excluded5 = [ + "onMouseMove", + "onMouseDown", + "onClick", + "onPress", + "index", + "item" +]; +var $d0d825e43d8ba478$var$Downshift = /*#__PURE__*/ function() { + var Downshift = /*#__PURE__*/ function(_Component) { + (0, $5VaeF.default)(Downshift, _Component); + function Downshift(_props) { + var _this; + _this = _Component.call(this, _props) || this; + // fancy destructuring + defaults + aliases + // this basically says each value of state should either be set to + // the initial value or the default value if the initial value is not provided + _this.id = _this.props.id || "downshift-" + $d0d825e43d8ba478$var$generateId(); + _this.menuId = _this.props.menuId || _this.id + "-menu"; + _this.labelId = _this.props.labelId || _this.id + "-label"; + _this.inputId = _this.props.inputId || _this.id + "-input"; + _this.getItemId = _this.props.getItemId || function(index) { + return _this.id + "-item-" + index; + }; + _this.items = []; + // itemCount can be changed asynchronously + // from within downshift (so it can't come from a prop) + // this is why we store it as an instance and use + // getItemCount rather than just use items.length + // (to support windowing + async) + _this.itemCount = null; + _this.previousResultCount = 0; + _this.timeoutIds = []; + /** + * @param {Function} fn the function to call after the time + * @param {Number} time the time to wait + */ _this.internalSetTimeout = function(fn, time) { + var id = setTimeout(function() { + _this.timeoutIds = _this.timeoutIds.filter(function(i) { + return i !== id; + }); + fn(); + }, time); + _this.timeoutIds.push(id); + }; + _this.setItemCount = function(count) { + _this.itemCount = count; + }; + _this.unsetItemCount = function() { + _this.itemCount = null; + }; + _this.isItemDisabled = function(_item, index) { + var currentElementNode = _this.getItemNodeFromIndex(index); + return currentElementNode && currentElementNode.hasAttribute("disabled"); + }; + _this.setHighlightedIndex = function(highlightedIndex, otherStateToSet) { + if (highlightedIndex === void 0) highlightedIndex = _this.props.defaultHighlightedIndex; + if (otherStateToSet === void 0) otherStateToSet = {}; + otherStateToSet = $d0d825e43d8ba478$var$pickState(otherStateToSet); + _this.internalSetState((0, $uwkDK.default)({ + highlightedIndex: highlightedIndex + }, otherStateToSet)); + }; + _this.clearSelection = function(cb) { + _this.internalSetState({ + selectedItem: null, + inputValue: "", + highlightedIndex: _this.props.defaultHighlightedIndex, + isOpen: _this.props.defaultIsOpen + }, cb); + }; + _this.selectItem = function(item, otherStateToSet, cb) { + otherStateToSet = $d0d825e43d8ba478$var$pickState(otherStateToSet); + _this.internalSetState((0, $uwkDK.default)({ + isOpen: _this.props.defaultIsOpen, + highlightedIndex: _this.props.defaultHighlightedIndex, + selectedItem: item, + inputValue: _this.props.itemToString(item) + }, otherStateToSet), cb); + }; + _this.selectItemAtIndex = function(itemIndex, otherStateToSet, cb) { + var item = _this.items[itemIndex]; + if (item == null) return; + _this.selectItem(item, otherStateToSet, cb); + }; + _this.selectHighlightedItem = function(otherStateToSet, cb) { + return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb); + }; + // any piece of our state can live in two places: + // 1. Uncontrolled: it's internal (this.state) + // We will call this.setState to update that state + // 2. Controlled: it's external (this.props) + // We will call this.props.onStateChange to update that state + // + // In addition, we'll call this.props.onChange if the + // selectedItem is changed. + _this.internalSetState = function(stateToSet, cb) { + var isItemSelected, onChangeArg; + var onStateChangeArg = {}; + var isStateToSetFunction = typeof stateToSet === "function"; + // we want to call `onInputValueChange` before the `setState` call + // so someone controlling the `inputValue` state gets notified of + // the input change as soon as possible. This avoids issues with + // preserving the cursor position. + // See https://github.com/downshift-js/downshift/issues/217 for more info. + if (!isStateToSetFunction && stateToSet.hasOwnProperty("inputValue")) _this.props.onInputValueChange(stateToSet.inputValue, (0, $uwkDK.default)({}, _this.getStateAndHelpers(), stateToSet)); + return _this.setState(function(state) { + var _newStateToSet; + state = _this.getState(state); + var newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet; + // Your own function that could modify the state that will be set. + newStateToSet = _this.props.stateReducer(state, newStateToSet); + // checks if an item is selected, regardless of if it's different from + // what was selected before + // used to determine if onSelect and onChange callbacks should be called + isItemSelected = newStateToSet.hasOwnProperty("selectedItem"); + // this keeps track of the object we want to call with setState + var nextState = {}; + // we need to call on change if the outside world is controlling any of our state + // and we're trying to update that state. OR if the selection has changed and we're + // trying to update the selection + if (isItemSelected && newStateToSet.selectedItem !== state.selectedItem) onChangeArg = newStateToSet.selectedItem; + (_newStateToSet = newStateToSet).type || (_newStateToSet.type = $d0d825e43d8ba478$var$unknown); + Object.keys(newStateToSet).forEach(function(key) { + // onStateChangeArg should only have the state that is + // actually changing + if (state[key] !== newStateToSet[key]) onStateChangeArg[key] = newStateToSet[key]; + // the type is useful for the onStateChangeArg + // but we don't actually want to set it in internal state. + // this is an undocumented feature for now... Not all internalSetState + // calls support it and I'm not certain we want them to yet. + // But it enables users controlling the isOpen state to know when + // the isOpen state changes due to mouseup events which is quite handy. + if (key === "type") return; + newStateToSet[key]; + // if it's coming from props, then we don't care to set it internally + if (!$d0d825e43d8ba478$var$isControlledProp(_this.props, key)) nextState[key] = newStateToSet[key]; + }); + // if stateToSet is a function, then we weren't able to call onInputValueChange + // earlier, so we'll call it now that we know what the inputValue state will be. + if (isStateToSetFunction && newStateToSet.hasOwnProperty("inputValue")) _this.props.onInputValueChange(newStateToSet.inputValue, (0, $uwkDK.default)({}, _this.getStateAndHelpers(), newStateToSet)); + return nextState; + }, function() { + // call the provided callback if it's a function + $d0d825e43d8ba478$var$cbToCb(cb)(); + // only call the onStateChange and onChange callbacks if + // we have relevant information to pass them. + var hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1; + if (hasMoreStateThanType) _this.props.onStateChange(onStateChangeArg, _this.getStateAndHelpers()); + if (isItemSelected) _this.props.onSelect(stateToSet.selectedItem, _this.getStateAndHelpers()); + if (onChangeArg !== undefined) _this.props.onChange(onChangeArg, _this.getStateAndHelpers()); + // this is currently undocumented and therefore subject to change + // We'll try to not break it, but just be warned. + _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers()); + }); + }; + //////////////////////////// ROOT + _this.rootRef = function(node) { + return _this._rootNode = node; + }; + _this.getRootProps = function(_temp, _temp2) { + var _extends2; + var _ref = _temp === void 0 ? {} : _temp, _ref$refKey = _ref.refKey, refKey = _ref$refKey === void 0 ? "ref" : _ref$refKey, ref = _ref.ref, rest = (0, $8WqTz.default)(_ref, $d0d825e43d8ba478$var$_excluded$4); + var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$suppressRefErro = _ref2.suppressRefError, suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro; + // this is used in the render to know whether the user has called getRootProps. + // It uses that to know whether to apply the props automatically + _this.getRootProps.called = true; + _this.getRootProps.refKey = refKey; + _this.getRootProps.suppressRefError = suppressRefError; + var _this$getState = _this.getState(), isOpen = _this$getState.isOpen; + return (0, $uwkDK.default)((_extends2 = {}, _extends2[refKey] = $d0d825e43d8ba478$var$handleRefs(ref, _this.rootRef), _extends2.role = "combobox", _extends2["aria-expanded"] = isOpen, _extends2["aria-haspopup"] = "listbox", _extends2["aria-owns"] = isOpen ? _this.menuId : undefined, _extends2["aria-labelledby"] = _this.labelId, _extends2), rest); + }; + //\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT + _this.keyDownHandlers = { + ArrowDown: function ArrowDown(event) { + var _this2 = this; + event.preventDefault(); + if (this.getState().isOpen) { + var amount = event.shiftKey ? 5 : 1; + this.moveHighlightedIndex(amount, { + type: $d0d825e43d8ba478$var$keyDownArrowDown + }); + } else this.internalSetState({ + isOpen: true, + type: $d0d825e43d8ba478$var$keyDownArrowDown + }, function() { + var itemCount = _this2.getItemCount(); + if (itemCount > 0) { + var _this2$getState = _this2.getState(), highlightedIndex = _this2$getState.highlightedIndex; + var nextHighlightedIndex = $d0d825e43d8ba478$var$getHighlightedIndex(highlightedIndex, 1, { + length: itemCount + }, _this2.isItemDisabled, true); + _this2.setHighlightedIndex(nextHighlightedIndex, { + type: $d0d825e43d8ba478$var$keyDownArrowDown + }); + } + }); + }, + ArrowUp: function ArrowUp(event) { + var _this3 = this; + event.preventDefault(); + if (this.getState().isOpen) { + var amount = event.shiftKey ? -5 : -1; + this.moveHighlightedIndex(amount, { + type: $d0d825e43d8ba478$var$keyDownArrowUp + }); + } else this.internalSetState({ + isOpen: true, + type: $d0d825e43d8ba478$var$keyDownArrowUp + }, function() { + var itemCount = _this3.getItemCount(); + if (itemCount > 0) { + var _this3$getState = _this3.getState(), highlightedIndex = _this3$getState.highlightedIndex; + var nextHighlightedIndex = $d0d825e43d8ba478$var$getHighlightedIndex(highlightedIndex, -1, { + length: itemCount + }, _this3.isItemDisabled, true); + _this3.setHighlightedIndex(nextHighlightedIndex, { + type: $d0d825e43d8ba478$var$keyDownArrowUp + }); + } + }); + }, + Enter: function Enter(event) { + if (event.which === 229) return; + var _this$getState2 = this.getState(), isOpen = _this$getState2.isOpen, highlightedIndex = _this$getState2.highlightedIndex; + if (isOpen && highlightedIndex != null) { + event.preventDefault(); + var item = this.items[highlightedIndex]; + var itemNode = this.getItemNodeFromIndex(highlightedIndex); + if (item == null || itemNode && itemNode.hasAttribute("disabled")) return; + this.selectHighlightedItem({ + type: $d0d825e43d8ba478$var$keyDownEnter + }); + } + }, + Escape: function Escape(event) { + event.preventDefault(); + this.reset((0, $uwkDK.default)({ + type: $d0d825e43d8ba478$var$keyDownEscape + }, !this.state.isOpen && { + selectedItem: null, + inputValue: "" + })); + } + }; + //////////////////////////// BUTTON + _this.buttonKeyDownHandlers = (0, $uwkDK.default)({}, _this.keyDownHandlers, { + " ": function _(event) { + event.preventDefault(); + this.toggleMenu({ + type: $d0d825e43d8ba478$var$keyDownSpaceButton + }); + } + }); + _this.inputKeyDownHandlers = (0, $uwkDK.default)({}, _this.keyDownHandlers, { + Home: function Home(event) { + var _this$getState3 = this.getState(), isOpen = _this$getState3.isOpen; + if (!isOpen) return; + event.preventDefault(); + var itemCount = this.getItemCount(); + if (itemCount <= 0 || !isOpen) return; + // get next non-disabled starting downwards from 0 if that's disabled. + var newHighlightedIndex = $d0d825e43d8ba478$var$getNonDisabledIndex(0, false, { + length: itemCount + }, this.isItemDisabled); + this.setHighlightedIndex(newHighlightedIndex, { + type: $d0d825e43d8ba478$var$keyDownHome + }); + }, + End: function End(event) { + var _this$getState4 = this.getState(), isOpen = _this$getState4.isOpen; + if (!isOpen) return; + event.preventDefault(); + var itemCount = this.getItemCount(); + if (itemCount <= 0 || !isOpen) return; + // get next non-disabled starting upwards from last index if that's disabled. + var newHighlightedIndex = $d0d825e43d8ba478$var$getNonDisabledIndex(itemCount - 1, true, { + length: itemCount + }, this.isItemDisabled); + this.setHighlightedIndex(newHighlightedIndex, { + type: $d0d825e43d8ba478$var$keyDownEnd + }); + } + }); + _this.getToggleButtonProps = function(_temp3) { + var _ref3 = _temp3 === void 0 ? {} : _temp3, onClick = _ref3.onClick; + _ref3.onPress; + var onKeyDown = _ref3.onKeyDown, onKeyUp = _ref3.onKeyUp, onBlur = _ref3.onBlur, rest = (0, $8WqTz.default)(_ref3, $d0d825e43d8ba478$var$_excluded2$3); + var _this$getState5 = _this.getState(), isOpen = _this$getState5.isOpen; + var enabledEventHandlers = { + onClick: $d0d825e43d8ba478$var$callAllEventHandlers(onClick, _this.buttonHandleClick), + onKeyDown: $d0d825e43d8ba478$var$callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown), + onKeyUp: $d0d825e43d8ba478$var$callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp), + onBlur: $d0d825e43d8ba478$var$callAllEventHandlers(onBlur, _this.buttonHandleBlur) + }; + var eventHandlers = rest.disabled ? {} : enabledEventHandlers; + return (0, $uwkDK.default)({ + type: "button", + role: "button", + "aria-label": isOpen ? "close menu" : "open menu", + "aria-haspopup": true, + "data-toggle": true + }, eventHandlers, rest); + }; + _this.buttonHandleKeyUp = function(event) { + // Prevent click event from emitting in Firefox + event.preventDefault(); + }; + _this.buttonHandleKeyDown = function(event) { + var key = $d0d825e43d8ba478$var$normalizeArrowKey(event); + if (_this.buttonKeyDownHandlers[key]) _this.buttonKeyDownHandlers[key].call((0, $1Nh8o.default)(_this), event); + }; + _this.buttonHandleClick = function(event) { + event.preventDefault(); + // handle odd case for Safari and Firefox which + // don't give the button the focus properly. + /* istanbul ignore if (can't reasonably test this) */ if (_this.props.environment) { + var _this$props$environme = _this.props.environment.document, body = _this$props$environme.body, activeElement = _this$props$environme.activeElement; + if (body && body === activeElement) event.target.focus(); + } + // Ensure that toggle of menu occurs after the potential blur event in iOS + _this.internalSetTimeout(function() { + return _this.toggleMenu({ + type: $d0d825e43d8ba478$var$clickButton + }); + }); + }; + _this.buttonHandleBlur = function(event) { + var blurTarget = event.target; // Save blur target for comparison with activeElement later + // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element + _this.internalSetTimeout(function() { + if (_this.isMouseDown || !_this.props.environment) return; + var activeElement = _this.props.environment.document.activeElement; + if ((activeElement == null || activeElement.id !== _this.inputId) && activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS) + ) _this.reset({ + type: $d0d825e43d8ba478$var$blurButton + }); + }); + }; + //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON + /////////////////////////////// LABEL + _this.getLabelProps = function(props) { + return (0, $uwkDK.default)({ + htmlFor: _this.inputId, + id: _this.labelId + }, props); + }; + //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL + /////////////////////////////// INPUT + _this.getInputProps = function(_temp4) { + var _ref4 = _temp4 === void 0 ? {} : _temp4, onKeyDown = _ref4.onKeyDown, onBlur = _ref4.onBlur, onChange = _ref4.onChange, onInput = _ref4.onInput; + _ref4.onChangeText; + var rest = (0, $8WqTz.default)(_ref4, $d0d825e43d8ba478$var$_excluded3$2); + var onChangeKey; + var eventHandlers = {}; + onChangeKey = "onChange"; + var _this$getState6 = _this.getState(), inputValue = _this$getState6.inputValue, isOpen = _this$getState6.isOpen, highlightedIndex = _this$getState6.highlightedIndex; + if (!rest.disabled) { + var _eventHandlers; + eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = $d0d825e43d8ba478$var$callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = $d0d825e43d8ba478$var$callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = $d0d825e43d8ba478$var$callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers); + } + return (0, $uwkDK.default)({ + "aria-autocomplete": "list", + "aria-activedescendant": isOpen && typeof highlightedIndex === "number" && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : undefined, + "aria-controls": isOpen ? _this.menuId : undefined, + "aria-labelledby": rest && rest["aria-label"] ? undefined : _this.labelId, + // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion + // revert back since autocomplete="nope" is ignored on latest Chrome and Opera + autoComplete: "off", + value: inputValue, + id: _this.inputId + }, eventHandlers, rest); + }; + _this.inputHandleKeyDown = function(event) { + var key = $d0d825e43d8ba478$var$normalizeArrowKey(event); + if (key && _this.inputKeyDownHandlers[key]) _this.inputKeyDownHandlers[key].call((0, $1Nh8o.default)(_this), event); + }; + _this.inputHandleChange = function(event) { + _this.internalSetState({ + type: $d0d825e43d8ba478$var$changeInput, + isOpen: true, + inputValue: event.target.value, + highlightedIndex: _this.props.defaultHighlightedIndex + }); + }; + _this.inputHandleBlur = function() { + // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element + _this.internalSetTimeout(function() { + var _activeElement$datase; + if (_this.isMouseDown || !_this.props.environment) return; + var activeElement = _this.props.environment.document.activeElement; + var downshiftButtonIsActive = (activeElement == null || (_activeElement$datase = activeElement.dataset) == null ? void 0 : _activeElement$datase.toggle) && _this._rootNode && _this._rootNode.contains(activeElement); + if (!downshiftButtonIsActive) _this.reset({ + type: $d0d825e43d8ba478$var$blurInput + }); + }); + }; + //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT + /////////////////////////////// MENU + _this.menuRef = function(node) { + _this._menuNode = node; + }; + _this.getMenuProps = function(_temp5, _temp6) { + var _extends3; + var _ref5 = _temp5 === void 0 ? {} : _temp5, _ref5$refKey = _ref5.refKey, refKey = _ref5$refKey === void 0 ? "ref" : _ref5$refKey, ref = _ref5.ref, props = (0, $8WqTz.default)(_ref5, $d0d825e43d8ba478$var$_excluded4$1); + var _ref6 = _temp6 === void 0 ? {} : _temp6, _ref6$suppressRefErro = _ref6.suppressRefError, suppressRefError = _ref6$suppressRefErro === void 0 ? false : _ref6$suppressRefErro; + _this.getMenuProps.called = true; + _this.getMenuProps.refKey = refKey; + _this.getMenuProps.suppressRefError = suppressRefError; + return (0, $uwkDK.default)((_extends3 = {}, _extends3[refKey] = $d0d825e43d8ba478$var$handleRefs(ref, _this.menuRef), _extends3.role = "listbox", _extends3["aria-labelledby"] = props && props["aria-label"] ? undefined : _this.labelId, _extends3.id = _this.menuId, _extends3), props); + }; + //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU + /////////////////////////////// ITEM + _this.getItemProps = function(_temp7) { + var _enabledEventHandlers; + var _ref7 = _temp7 === void 0 ? {} : _temp7, onMouseMove = _ref7.onMouseMove, onMouseDown = _ref7.onMouseDown, onClick = _ref7.onClick; + _ref7.onPress; + var index = _ref7.index, _ref7$item = _ref7.item, item = _ref7$item === void 0 ? /* istanbul ignore next */ undefined : _ref7$item, rest = (0, $8WqTz.default)(_ref7, $d0d825e43d8ba478$var$_excluded5); + if (index === undefined) { + _this.items.push(item); + index = _this.items.indexOf(item); + } else _this.items[index] = item; + var onSelectKey = "onClick"; + var customClickHandler = onClick; + var enabledEventHandlers = (_enabledEventHandlers = { + // onMouseMove is used over onMouseEnter here. onMouseMove + // is only triggered on actual mouse movement while onMouseEnter + // can fire on DOM changes, interrupting keyboard navigation + onMouseMove: $d0d825e43d8ba478$var$callAllEventHandlers(onMouseMove, function() { + if (index === _this.getState().highlightedIndex) return; + _this.setHighlightedIndex(index, { + type: $d0d825e43d8ba478$var$itemMouseEnter + }); + // We never want to manually scroll when changing state based + // on `onMouseMove` because we will be moving the element out + // from under the user which is currently scrolling/moving the + // cursor + _this.avoidScrolling = true; + _this.internalSetTimeout(function() { + return _this.avoidScrolling = false; + }, 250); + }), + onMouseDown: $d0d825e43d8ba478$var$callAllEventHandlers(onMouseDown, function(event) { + // This prevents the activeElement from being changed + // to the item so it can remain with the current activeElement + // which is a more common use case. + event.preventDefault(); + }) + }, _enabledEventHandlers[onSelectKey] = $d0d825e43d8ba478$var$callAllEventHandlers(customClickHandler, function() { + _this.selectItemAtIndex(index, { + type: $d0d825e43d8ba478$var$clickItem + }); + }), _enabledEventHandlers); + // Passing down the onMouseDown handler to prevent redirect + // of the activeElement if clicking on disabled items + var eventHandlers = rest.disabled ? { + onMouseDown: enabledEventHandlers.onMouseDown + } : enabledEventHandlers; + return (0, $uwkDK.default)({ + id: _this.getItemId(index), + role: "option", + "aria-selected": _this.getState().highlightedIndex === index + }, eventHandlers, rest); + }; + //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM + _this.clearItems = function() { + _this.items = []; + }; + _this.reset = function(otherStateToSet, cb) { + if (otherStateToSet === void 0) otherStateToSet = {}; + otherStateToSet = $d0d825e43d8ba478$var$pickState(otherStateToSet); + _this.internalSetState(function(_ref8) { + var selectedItem = _ref8.selectedItem; + return (0, $uwkDK.default)({ + isOpen: _this.props.defaultIsOpen, + highlightedIndex: _this.props.defaultHighlightedIndex, + inputValue: _this.props.itemToString(selectedItem) + }, otherStateToSet); + }, cb); + }; + _this.toggleMenu = function(otherStateToSet, cb) { + if (otherStateToSet === void 0) otherStateToSet = {}; + otherStateToSet = $d0d825e43d8ba478$var$pickState(otherStateToSet); + _this.internalSetState(function(_ref9) { + var isOpen = _ref9.isOpen; + return (0, $uwkDK.default)({ + isOpen: !isOpen + }, isOpen && { + highlightedIndex: _this.props.defaultHighlightedIndex + }, otherStateToSet); + }, function() { + var _this$getState7 = _this.getState(), isOpen = _this$getState7.isOpen, highlightedIndex = _this$getState7.highlightedIndex; + if (isOpen) { + if (_this.getItemCount() > 0 && typeof highlightedIndex === "number") _this.setHighlightedIndex(highlightedIndex, otherStateToSet); + } + $d0d825e43d8ba478$var$cbToCb(cb)(); + }); + }; + _this.openMenu = function(cb) { + _this.internalSetState({ + isOpen: true + }, cb); + }; + _this.closeMenu = function(cb) { + _this.internalSetState({ + isOpen: false + }, cb); + }; + _this.updateStatus = $d0d825e43d8ba478$var$debounce(function() { + var _this$props; + if (!((_this$props = _this.props) != null && (_this$props = _this$props.environment) != null && _this$props.document)) return; + var state = _this.getState(); + var item = _this.items[state.highlightedIndex]; + var resultCount = _this.getItemCount(); + var status = _this.props.getA11yStatusMessage((0, $uwkDK.default)({ + itemToString: _this.props.itemToString, + previousResultCount: _this.previousResultCount, + resultCount: resultCount, + highlightedItem: item + }, state)); + _this.previousResultCount = resultCount; + $d0d825e43d8ba478$var$setStatus(status, _this.props.environment.document); + }, 200); + var _this$props2 = _this.props, defaultHighlightedIndex = _this$props2.defaultHighlightedIndex, _this$props2$initialH = _this$props2.initialHighlightedIndex, _highlightedIndex = _this$props2$initialH === void 0 ? defaultHighlightedIndex : _this$props2$initialH, defaultIsOpen = _this$props2.defaultIsOpen, _this$props2$initialI = _this$props2.initialIsOpen, _isOpen = _this$props2$initialI === void 0 ? defaultIsOpen : _this$props2$initialI, _this$props2$initialI2 = _this$props2.initialInputValue, _inputValue = _this$props2$initialI2 === void 0 ? "" : _this$props2$initialI2, _this$props2$initialS = _this$props2.initialSelectedItem, _selectedItem = _this$props2$initialS === void 0 ? null : _this$props2$initialS; + var _state = _this.getState({ + highlightedIndex: _highlightedIndex, + isOpen: _isOpen, + inputValue: _inputValue, + selectedItem: _selectedItem + }); + if (_state.selectedItem != null && _this.props.initialInputValue === undefined) _state.inputValue = _this.props.itemToString(_state.selectedItem); + _this.state = _state; + return _this; + } + var _proto = Downshift.prototype; + /** + * Clear all running timeouts + */ _proto.internalClearTimeouts = function internalClearTimeouts() { + this.timeoutIds.forEach(function(id) { + clearTimeout(id); + }); + this.timeoutIds = []; + } /** + * Gets the state based on internal state or props + * If a state value is passed via props, then that + * is the value given, otherwise it's retrieved from + * stateToMerge + * + * @param {Object} stateToMerge defaults to this.state + * @return {Object} the state + */ ; + _proto.getState = function getState$1(stateToMerge) { + if (stateToMerge === void 0) stateToMerge = this.state; + return $d0d825e43d8ba478$var$getState(stateToMerge, this.props); + }; + _proto.getItemCount = function getItemCount() { + // things read better this way. They're in priority order: + // 1. `this.itemCount` + // 2. `this.props.itemCount` + // 3. `this.items.length` + var itemCount = this.items.length; + if (this.itemCount != null) itemCount = this.itemCount; + else if (this.props.itemCount !== undefined) itemCount = this.props.itemCount; + return itemCount; + }; + _proto.getItemNodeFromIndex = function getItemNodeFromIndex(index) { + return this.props.environment ? this.props.environment.document.getElementById(this.getItemId(index)) : null; + }; + _proto.scrollHighlightedItemIntoView = function scrollHighlightedItemIntoView() { + var node = this.getItemNodeFromIndex(this.getState().highlightedIndex); + this.props.scrollIntoView(node, this._menuNode); + }; + _proto.moveHighlightedIndex = function moveHighlightedIndex(amount, otherStateToSet) { + var itemCount = this.getItemCount(); + var _this$getState8 = this.getState(), highlightedIndex = _this$getState8.highlightedIndex; + if (itemCount > 0) { + var nextHighlightedIndex = $d0d825e43d8ba478$var$getHighlightedIndex(highlightedIndex, amount, { + length: itemCount + }, this.isItemDisabled, true); + this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet); + } + }; + _proto.getStateAndHelpers = function getStateAndHelpers() { + var _this$getState9 = this.getState(), highlightedIndex = _this$getState9.highlightedIndex, inputValue = _this$getState9.inputValue, selectedItem = _this$getState9.selectedItem, isOpen = _this$getState9.isOpen; + var itemToString = this.props.itemToString; + var id = this.id; + var getRootProps = this.getRootProps, getToggleButtonProps = this.getToggleButtonProps, getLabelProps = this.getLabelProps, getMenuProps = this.getMenuProps, getInputProps = this.getInputProps, getItemProps = this.getItemProps, openMenu = this.openMenu, closeMenu = this.closeMenu, toggleMenu = this.toggleMenu, selectItem = this.selectItem, selectItemAtIndex = this.selectItemAtIndex, selectHighlightedItem = this.selectHighlightedItem, setHighlightedIndex = this.setHighlightedIndex, clearSelection = this.clearSelection, clearItems = this.clearItems, reset = this.reset, setItemCount = this.setItemCount, unsetItemCount = this.unsetItemCount, setState = this.internalSetState; + return { + // prop getters + getRootProps: getRootProps, + getToggleButtonProps: getToggleButtonProps, + getLabelProps: getLabelProps, + getMenuProps: getMenuProps, + getInputProps: getInputProps, + getItemProps: getItemProps, + // actions + reset: reset, + openMenu: openMenu, + closeMenu: closeMenu, + toggleMenu: toggleMenu, + selectItem: selectItem, + selectItemAtIndex: selectItemAtIndex, + selectHighlightedItem: selectHighlightedItem, + setHighlightedIndex: setHighlightedIndex, + clearSelection: clearSelection, + clearItems: clearItems, + setItemCount: setItemCount, + unsetItemCount: unsetItemCount, + setState: setState, + // props + itemToString: itemToString, + // derived + id: id, + // state + highlightedIndex: highlightedIndex, + inputValue: inputValue, + isOpen: isOpen, + selectedItem: selectedItem + }; + }; + _proto.componentDidMount = function componentDidMount() { + var _this4 = this; + /* istanbul ignore if (react-native or SSR) */ if (!this.props.environment) this.cleanup = function() { + _this4.internalClearTimeouts(); + }; + else { + // this.isMouseDown helps us track whether the mouse is currently held down. + // This is useful when the user clicks on an item in the list, but holds the mouse + // down long enough for the list to disappear (because the blur event fires on the input) + // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should + // trigger hiding the menu. + var onMouseDown = function onMouseDown() { + _this4.isMouseDown = true; + }; + var onMouseUp = function onMouseUp(event) { + _this4.isMouseDown = false; + // if the target element or the activeElement is within a downshift node + // then we don't want to reset downshift + var contextWithinDownshift = $d0d825e43d8ba478$var$targetWithinDownshift(event.target, [ + _this4._rootNode, + _this4._menuNode + ], _this4.props.environment); + if (!contextWithinDownshift && _this4.getState().isOpen) _this4.reset({ + type: $d0d825e43d8ba478$var$mouseUp + }, function() { + return _this4.props.onOuterClick(_this4.getStateAndHelpers()); + }); + }; + // Touching an element in iOS gives focus and hover states, but touching out of + // the element will remove hover, and persist the focus state, resulting in the + // blur event not being triggered. + // this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen. + // If the user taps outside of Downshift, the component should be reset, + // but not if the user is swiping + var onTouchStart = function onTouchStart() { + _this4.isTouchMove = false; + }; + var onTouchMove = function onTouchMove() { + _this4.isTouchMove = true; + }; + var onTouchEnd = function onTouchEnd(event) { + var contextWithinDownshift = $d0d825e43d8ba478$var$targetWithinDownshift(event.target, [ + _this4._rootNode, + _this4._menuNode + ], _this4.props.environment, false); + if (!_this4.isTouchMove && !contextWithinDownshift && _this4.getState().isOpen) _this4.reset({ + type: $d0d825e43d8ba478$var$touchEnd + }, function() { + return _this4.props.onOuterClick(_this4.getStateAndHelpers()); + }); + }; + var environment = this.props.environment; + environment.addEventListener("mousedown", onMouseDown); + environment.addEventListener("mouseup", onMouseUp); + environment.addEventListener("touchstart", onTouchStart); + environment.addEventListener("touchmove", onTouchMove); + environment.addEventListener("touchend", onTouchEnd); + this.cleanup = function() { + _this4.internalClearTimeouts(); + _this4.updateStatus.cancel(); + environment.removeEventListener("mousedown", onMouseDown); + environment.removeEventListener("mouseup", onMouseUp); + environment.removeEventListener("touchstart", onTouchStart); + environment.removeEventListener("touchmove", onTouchMove); + environment.removeEventListener("touchend", onTouchEnd); + }; + } + }; + _proto.shouldScroll = function shouldScroll(prevState, prevProps) { + var _ref10 = this.props.highlightedIndex === undefined ? this.getState() : this.props, currentHighlightedIndex = _ref10.highlightedIndex; + var _ref11 = prevProps.highlightedIndex === undefined ? prevState : prevProps, prevHighlightedIndex = _ref11.highlightedIndex; + var scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen; + var scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex; + return scrollWhenOpen || scrollWhenNavigating; + }; + _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) { + if ($d0d825e43d8ba478$var$isControlledProp(this.props, "selectedItem") && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem)) this.internalSetState({ + type: $d0d825e43d8ba478$var$controlledPropUpdatedSelectedItem, + inputValue: this.props.itemToString(this.props.selectedItem) + }); + if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) this.scrollHighlightedItemIntoView(); + this.updateStatus(); + }; + _proto.componentWillUnmount = function componentWillUnmount() { + this.cleanup(); // avoids memory leak + }; + _proto.render = function render() { + var children = $d0d825e43d8ba478$var$unwrapArray(this.props.children, $d0d825e43d8ba478$var$noop); + // because the items are rerendered every time we call the children + // we clear this out each render and it will be populated again as + // getItemProps is called. + this.clearItems(); + // we reset this so we know whether the user calls getRootProps during + // this render. If they do then we don't need to do anything, + // if they don't then we need to clone the element they return and + // apply the props for them. + this.getRootProps.called = false; + this.getRootProps.refKey = undefined; + this.getRootProps.suppressRefError = undefined; + // we do something similar for getMenuProps + this.getMenuProps.called = false; + this.getMenuProps.refKey = undefined; + this.getMenuProps.suppressRefError = undefined; + // we do something similar for getLabelProps + this.getLabelProps.called = false; + // and something similar for getInputProps + this.getInputProps.called = false; + var element = $d0d825e43d8ba478$var$unwrapArray(children(this.getStateAndHelpers())); + if (!element) return null; + if (this.getRootProps.called || this.props.suppressRefError) return element; + else if ($d0d825e43d8ba478$var$isDOMElement(element)) // they didn't apply the root props, but we can clone + // this and apply the props ourselves + return /*#__PURE__*/ (0, $63SH6.cloneElement)(element, this.getRootProps($d0d825e43d8ba478$var$getElementProps(element))); + /* istanbul ignore next */ return undefined; + }; + return Downshift; + }((0, $63SH6.Component)); + Downshift.defaultProps = { + defaultHighlightedIndex: null, + defaultIsOpen: false, + getA11yStatusMessage: $d0d825e43d8ba478$var$getA11yStatusMessage$1, + itemToString: function itemToString(i) { + if (i == null) return ""; + return String(i); + }, + onStateChange: $d0d825e43d8ba478$var$noop, + onInputValueChange: $d0d825e43d8ba478$var$noop, + onUserAction: $d0d825e43d8ba478$var$noop, + onChange: $d0d825e43d8ba478$var$noop, + onSelect: $d0d825e43d8ba478$var$noop, + onOuterClick: $d0d825e43d8ba478$var$noop, + selectedItemChanged: function selectedItemChanged(prevItem, item) { + return prevItem !== item; + }, + environment: /* istanbul ignore next (ssr) */ typeof window === "undefined" || false ? undefined : window, + stateReducer: function stateReducer(state, stateToSet) { + return stateToSet; + }, + suppressRefError: false, + scrollIntoView: $d0d825e43d8ba478$var$scrollIntoView + }; + Downshift.stateChangeTypes = $d0d825e43d8ba478$var$stateChangeTypes$3; + return Downshift; +}(); +var $d0d825e43d8ba478$export$2e2bcd8739ae039 = $d0d825e43d8ba478$var$Downshift; +function $d0d825e43d8ba478$var$validateGetMenuPropsCalledCorrectly(node, _ref12) { + var refKey = _ref12.refKey; + if (!node) // eslint-disable-next-line no-console + console.error('downshift: The ref prop "' + refKey + '" from getMenuProps was not applied correctly on your menu element.'); +} +function $d0d825e43d8ba478$var$validateGetRootPropsCalledCorrectly(element, _ref13) { + var refKey = _ref13.refKey; + var refKeySpecified = refKey !== "ref"; + var isComposite = !$d0d825e43d8ba478$var$isDOMElement(element); + if (isComposite && !refKeySpecified && !(0, $2oqnz.isForwardRef)(element)) // eslint-disable-next-line no-console + console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"); + else if (!isComposite && refKeySpecified) // eslint-disable-next-line no-console + console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "' + refKey + '"'); + if (!(0, $2oqnz.isForwardRef)(element) && !$d0d825e43d8ba478$var$getElementProps(element)[refKey]) // eslint-disable-next-line no-console + console.error('downshift: You must apply the ref prop "' + refKey + '" from getRootProps onto your root element.'); +} +var $d0d825e43d8ba478$var$_excluded$3 = [ + "isInitialMount", + "highlightedIndex", + "items", + "environment" +]; +var $d0d825e43d8ba478$var$dropdownDefaultStateValues = { + highlightedIndex: -1, + isOpen: false, + selectedItem: null, + inputValue: "" +}; +function $d0d825e43d8ba478$var$callOnChangeProps(action, state, newState) { + var props = action.props, type = action.type; + var changes = {}; + Object.keys(state).forEach(function(key) { + $d0d825e43d8ba478$var$invokeOnChangeHandler(key, action, state, newState); + if (newState[key] !== state[key]) changes[key] = newState[key]; + }); + if (props.onStateChange && Object.keys(changes).length) props.onStateChange((0, $uwkDK.default)({ + type: type + }, changes)); +} +function $d0d825e43d8ba478$var$invokeOnChangeHandler(key, action, state, newState) { + var props = action.props, type = action.type; + var handler = "on" + $d0d825e43d8ba478$var$capitalizeString(key) + "Change"; + if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) props[handler]((0, $uwkDK.default)({ + type: type + }, newState)); +} +/** + * Default state reducer that returns the changes. + * + * @param {Object} s state. + * @param {Object} a action with changes. + * @returns {Object} changes. + */ function $d0d825e43d8ba478$var$stateReducer(s, a) { + return a.changes; +} +/** + * Returns a message to be added to aria-live region when item is selected. + * + * @param {Object} selectionParameters Parameters required to build the message. + * @returns {string} The a11y message. + */ function $d0d825e43d8ba478$var$getA11ySelectionMessage(selectionParameters) { + var selectedItem = selectionParameters.selectedItem, itemToStringLocal = selectionParameters.itemToString; + return selectedItem ? itemToStringLocal(selectedItem) + " has been selected." : ""; +} +/** + * Debounced call for updating the a11y message. + */ var $d0d825e43d8ba478$var$updateA11yStatus = $d0d825e43d8ba478$var$debounce(function(getA11yMessage, document) { + $d0d825e43d8ba478$var$setStatus(getA11yMessage(), document); +}, 200); +// istanbul ignore next +var $d0d825e43d8ba478$var$useIsomorphicLayoutEffect = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined" ? (0, $63SH6.useLayoutEffect) : (0, $63SH6.useEffect); +// istanbul ignore next +var $d0d825e43d8ba478$var$useElementIds = "useId" in (0, (/*@__PURE__*/$parcel$interopDefault($63SH6)) // Avoid conditional useId call +) ? function useElementIds(_ref) { + var id = _ref.id, labelId = _ref.labelId, menuId = _ref.menuId, getItemId = _ref.getItemId, toggleButtonId = _ref.toggleButtonId, inputId = _ref.inputId; + // Avoid conditional useId call + var reactId = "downshift-" + (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).useId(); + if (!id) id = reactId; + var elementIdsRef = (0, $63SH6.useRef)({ + labelId: labelId || id + "-label", + menuId: menuId || id + "-menu", + getItemId: getItemId || function(index) { + return id + "-item-" + index; + }, + toggleButtonId: toggleButtonId || id + "-toggle-button", + inputId: inputId || id + "-input" + }); + return elementIdsRef.current; +} : function useElementIds(_ref2) { + var _ref2$id = _ref2.id, id = _ref2$id === void 0 ? "downshift-" + $d0d825e43d8ba478$var$generateId() : _ref2$id, labelId = _ref2.labelId, menuId = _ref2.menuId, getItemId = _ref2.getItemId, toggleButtonId = _ref2.toggleButtonId, inputId = _ref2.inputId; + var elementIdsRef = (0, $63SH6.useRef)({ + labelId: labelId || id + "-label", + menuId: menuId || id + "-menu", + getItemId: getItemId || function(index) { + return id + "-item-" + index; + }, + toggleButtonId: toggleButtonId || id + "-toggle-button", + inputId: inputId || id + "-input" + }); + return elementIdsRef.current; +}; +function $d0d825e43d8ba478$var$getItemAndIndex(itemProp, indexProp, items, errorMessage) { + var item, index; + if (itemProp === undefined) { + if (indexProp === undefined) throw new Error(errorMessage); + item = items[indexProp]; + index = indexProp; + } else { + index = indexProp === undefined ? items.indexOf(itemProp) : indexProp; + item = itemProp; + } + return [ + item, + index + ]; +} +function $d0d825e43d8ba478$var$itemToString(item) { + return item ? String(item) : ""; +} +function $d0d825e43d8ba478$var$isAcceptedCharacterKey(key) { + return /^\S{1}$/.test(key); +} +function $d0d825e43d8ba478$var$capitalizeString(string) { + return "" + string.slice(0, 1).toUpperCase() + string.slice(1); +} +function $d0d825e43d8ba478$var$useLatestRef(val) { + var ref = (0, $63SH6.useRef)(val); + // technically this is not "concurrent mode safe" because we're manipulating + // the value during render (so it's not idempotent). However, the places this + // hook is used is to support memoizing callbacks which will be called + // *during* render, so we need the latest values *during* render. + // If not for this, then we'd probably want to use useLayoutEffect instead. + ref.current = val; + return ref; +} +/** + * Computes the controlled state using a the previous state, props, + * two reducers, one from downshift and an optional one from the user. + * Also calls the onChange handlers for state values that have changed. + * + * @param {Function} reducer Reducer function from downshift. + * @param {Object} initialState Initial state of the hook. + * @param {Object} props The hook props. + * @returns {Array} An array with the state and an action dispatcher. + */ function $d0d825e43d8ba478$var$useEnhancedReducer(reducer, initialState, props) { + var prevStateRef = (0, $63SH6.useRef)(); + var actionRef = (0, $63SH6.useRef)(); + var enhancedReducer = (0, $63SH6.useCallback)(function(state, action) { + actionRef.current = action; + state = $d0d825e43d8ba478$var$getState(state, action.props); + var changes = reducer(state, action); + var newState = action.props.stateReducer(state, (0, $uwkDK.default)({}, action, { + changes: changes + })); + return newState; + }, [ + reducer + ]); + var _useReducer = (0, $63SH6.useReducer)(enhancedReducer, initialState), state = _useReducer[0], dispatch = _useReducer[1]; + var propsRef = $d0d825e43d8ba478$var$useLatestRef(props); + var dispatchWithProps = (0, $63SH6.useCallback)(function(action) { + return dispatch((0, $uwkDK.default)({ + props: propsRef.current + }, action)); + }, [ + propsRef + ]); + var action = actionRef.current; + (0, $63SH6.useEffect)(function() { + if (action && prevStateRef.current && prevStateRef.current !== state) $d0d825e43d8ba478$var$callOnChangeProps(action, $d0d825e43d8ba478$var$getState(prevStateRef.current, action.props), state); + prevStateRef.current = state; + }, [ + state, + props, + action + ]); + return [ + state, + dispatchWithProps + ]; +} +/** + * Wraps the useEnhancedReducer and applies the controlled prop values before + * returning the new state. + * + * @param {Function} reducer Reducer function from downshift. + * @param {Object} initialState Initial state of the hook. + * @param {Object} props The hook props. + * @returns {Array} An array with the state and an action dispatcher. + */ function $d0d825e43d8ba478$var$useControlledReducer$1(reducer, initialState, props) { + var _useEnhancedReducer = $d0d825e43d8ba478$var$useEnhancedReducer(reducer, initialState, props), state = _useEnhancedReducer[0], dispatch = _useEnhancedReducer[1]; + return [ + $d0d825e43d8ba478$var$getState(state, props), + dispatch + ]; +} +var $d0d825e43d8ba478$var$defaultProps$3 = { + itemToString: $d0d825e43d8ba478$var$itemToString, + stateReducer: $d0d825e43d8ba478$var$stateReducer, + getA11ySelectionMessage: $d0d825e43d8ba478$var$getA11ySelectionMessage, + scrollIntoView: $d0d825e43d8ba478$var$scrollIntoView, + environment: /* istanbul ignore next (ssr) */ typeof window === "undefined" || false ? undefined : window +}; +function $d0d825e43d8ba478$var$getDefaultValue$1(props, propKey, defaultStateValues) { + if (defaultStateValues === void 0) defaultStateValues = $d0d825e43d8ba478$var$dropdownDefaultStateValues; + var defaultValue = props["default" + $d0d825e43d8ba478$var$capitalizeString(propKey)]; + if (defaultValue !== undefined) return defaultValue; + return defaultStateValues[propKey]; +} +function $d0d825e43d8ba478$var$getInitialValue$1(props, propKey, defaultStateValues) { + if (defaultStateValues === void 0) defaultStateValues = $d0d825e43d8ba478$var$dropdownDefaultStateValues; + var value = props[propKey]; + if (value !== undefined) return value; + var initialValue = props["initial" + $d0d825e43d8ba478$var$capitalizeString(propKey)]; + if (initialValue !== undefined) return initialValue; + return $d0d825e43d8ba478$var$getDefaultValue$1(props, propKey, defaultStateValues); +} +function $d0d825e43d8ba478$var$getInitialState$2(props) { + var selectedItem = $d0d825e43d8ba478$var$getInitialValue$1(props, "selectedItem"); + var isOpen = $d0d825e43d8ba478$var$getInitialValue$1(props, "isOpen"); + var highlightedIndex = $d0d825e43d8ba478$var$getInitialValue$1(props, "highlightedIndex"); + var inputValue = $d0d825e43d8ba478$var$getInitialValue$1(props, "inputValue"); + return { + highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.indexOf(selectedItem) : highlightedIndex, + isOpen: isOpen, + selectedItem: selectedItem, + inputValue: inputValue + }; +} +function $d0d825e43d8ba478$var$getHighlightedIndexOnOpen(props, state, offset) { + var items = props.items, initialHighlightedIndex = props.initialHighlightedIndex, defaultHighlightedIndex = props.defaultHighlightedIndex; + var selectedItem = state.selectedItem, highlightedIndex = state.highlightedIndex; + if (items.length === 0) return -1; + // initialHighlightedIndex will give value to highlightedIndex on initial state only. + if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) return initialHighlightedIndex; + if (defaultHighlightedIndex !== undefined) return defaultHighlightedIndex; + if (selectedItem) return items.indexOf(selectedItem); + if (offset === 0) return -1; + return offset < 0 ? items.length - 1 : 0; +} +/** + * Reuse the movement tracking of mouse and touch events. + * + * @param {boolean} isOpen Whether the dropdown is open or not. + * @param {Array} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.) + * @param {Object} environment Environment where component/hook exists. + * @param {Function} handleBlur Handler on blur from mouse or touch. + * @returns {Object} Ref containing whether mouseDown or touchMove event is happening + */ function $d0d825e43d8ba478$var$useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, handleBlur) { + var mouseAndTouchTrackersRef = (0, $63SH6.useRef)({ + isMouseDown: false, + isTouchMove: false + }); + (0, $63SH6.useEffect)(function() { + if (!environment) return; + // The same strategy for checking if a click occurred inside or outside downshift + // as in downshift.js. + var onMouseDown = function onMouseDown() { + mouseAndTouchTrackersRef.current.isMouseDown = true; + }; + var onMouseUp = function onMouseUp(event) { + mouseAndTouchTrackersRef.current.isMouseDown = false; + if (isOpen && !$d0d825e43d8ba478$var$targetWithinDownshift(event.target, downshiftElementRefs.map(function(ref) { + return ref.current; + }), environment)) handleBlur(); + }; + var onTouchStart = function onTouchStart() { + mouseAndTouchTrackersRef.current.isTouchMove = false; + }; + var onTouchMove = function onTouchMove() { + mouseAndTouchTrackersRef.current.isTouchMove = true; + }; + var onTouchEnd = function onTouchEnd(event) { + if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !$d0d825e43d8ba478$var$targetWithinDownshift(event.target, downshiftElementRefs.map(function(ref) { + return ref.current; + }), environment, false)) handleBlur(); + }; + environment.addEventListener("mousedown", onMouseDown); + environment.addEventListener("mouseup", onMouseUp); + environment.addEventListener("touchstart", onTouchStart); + environment.addEventListener("touchmove", onTouchMove); + environment.addEventListener("touchend", onTouchEnd); + // eslint-disable-next-line consistent-return + return function cleanup() { + environment.removeEventListener("mousedown", onMouseDown); + environment.removeEventListener("mouseup", onMouseUp); + environment.removeEventListener("touchstart", onTouchStart); + environment.removeEventListener("touchmove", onTouchMove); + environment.removeEventListener("touchend", onTouchEnd); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [ + isOpen, + environment + ]); + return mouseAndTouchTrackersRef; +} +/* istanbul ignore next */ // eslint-disable-next-line import/no-mutable-exports +var $d0d825e43d8ba478$var$useGetterPropsCalledChecker = function useGetterPropsCalledChecker() { + return $d0d825e43d8ba478$var$noop; +}; +function $d0d825e43d8ba478$var$useA11yMessageSetter(getA11yMessage, dependencyArray, _ref3) { + var isInitialMount = _ref3.isInitialMount, highlightedIndex = _ref3.highlightedIndex, items = _ref3.items, environment = _ref3.environment, rest = (0, $8WqTz.default)(_ref3, $d0d825e43d8ba478$var$_excluded$3); + // Sets a11y status message on changes in state. + (0, $63SH6.useEffect)(function() { + if (isInitialMount || false || !(environment != null && environment.document)) return; + $d0d825e43d8ba478$var$updateA11yStatus(function() { + return getA11yMessage((0, $uwkDK.default)({ + highlightedIndex: highlightedIndex, + highlightedItem: items[highlightedIndex], + resultCount: items.length + }, rest)); + }, environment.document); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, dependencyArray); +} +function $d0d825e43d8ba478$var$useScrollIntoView(_ref4) { + var highlightedIndex = _ref4.highlightedIndex, isOpen = _ref4.isOpen, itemRefs = _ref4.itemRefs, getItemNodeFromIndex = _ref4.getItemNodeFromIndex, menuElement = _ref4.menuElement, scrollIntoViewProp = _ref4.scrollIntoView; + // used not to scroll on highlight by mouse. + var shouldScrollRef = (0, $63SH6.useRef)(true); + // Scroll on highlighted item if change comes from keyboard. + $d0d825e43d8ba478$var$useIsomorphicLayoutEffect(function() { + if (highlightedIndex < 0 || !isOpen || !Object.keys(itemRefs.current).length) return; + if (shouldScrollRef.current === false) shouldScrollRef.current = true; + else scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [ + highlightedIndex + ]); + return shouldScrollRef; +} +// eslint-disable-next-line import/no-mutable-exports +var $d0d825e43d8ba478$var$useControlPropsValidator = $d0d825e43d8ba478$var$noop; +/** + * Handles selection on Enter / Alt + ArrowUp. Closes the menu and resets the highlighted index, unless there is a highlighted. + * In that case, selects the item and resets to defaults for open state and highlighted idex. + * @param {Object} props The useCombobox props. + * @param {number} highlightedIndex The index from the state. + * @param {boolean} inputValue Also return the input value for state. + * @returns The changes for the state. + */ function $d0d825e43d8ba478$var$getChangesOnSelection(props, highlightedIndex, inputValue) { + var _props$items; + if (inputValue === void 0) inputValue = true; + var shouldSelect = ((_props$items = props.items) == null ? void 0 : _props$items.length) && highlightedIndex >= 0; + return (0, $uwkDK.default)({ + isOpen: false, + highlightedIndex: -1 + }, shouldSelect && (0, $uwkDK.default)({ + selectedItem: props.items[highlightedIndex], + isOpen: $d0d825e43d8ba478$var$getDefaultValue$1(props, "isOpen"), + highlightedIndex: $d0d825e43d8ba478$var$getDefaultValue$1(props, "highlightedIndex") + }, inputValue && { + inputValue: props.itemToString(props.items[highlightedIndex]) + })); +} +// Shared between all exports. +var $d0d825e43d8ba478$var$commonPropTypes = { + environment: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).shape({ + addEventListener: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func.isRequired, + removeEventListener: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func.isRequired, + document: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).shape({ + createElement: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func.isRequired, + getElementById: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func.isRequired, + activeElement: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).any.isRequired, + body: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).any.isRequired + }).isRequired, + Node: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func.isRequired + }), + itemToString: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + stateReducer: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func +}; +// Shared between useSelect, useCombobox, Downshift. +var $d0d825e43d8ba478$var$commonDropdownPropTypes = (0, $uwkDK.default)({}, $d0d825e43d8ba478$var$commonPropTypes, { + getA11yStatusMessage: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + highlightedIndex: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).number, + defaultHighlightedIndex: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).number, + initialHighlightedIndex: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).number, + isOpen: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).bool, + defaultIsOpen: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).bool, + initialIsOpen: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).bool, + selectedItem: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).any, + initialSelectedItem: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).any, + defaultSelectedItem: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).any, + id: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).string, + labelId: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).string, + menuId: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).string, + getItemId: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + toggleButtonId: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).string, + onSelectedItemChange: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + onHighlightedIndexChange: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + onStateChange: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + onIsOpenChange: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + scrollIntoView: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func +}); +function $d0d825e43d8ba478$var$downshiftCommonReducer(state, action, stateChangeTypes) { + var type = action.type, props = action.props; + var changes; + switch(type){ + case stateChangeTypes.ItemMouseMove: + changes = { + highlightedIndex: action.disabled ? -1 : action.index + }; + break; + case stateChangeTypes.MenuMouseLeave: + changes = { + highlightedIndex: -1 + }; + break; + case stateChangeTypes.ToggleButtonClick: + case stateChangeTypes.FunctionToggleMenu: + changes = { + isOpen: !state.isOpen, + highlightedIndex: state.isOpen ? -1 : $d0d825e43d8ba478$var$getHighlightedIndexOnOpen(props, state, 0) + }; + break; + case stateChangeTypes.FunctionOpenMenu: + changes = { + isOpen: true, + highlightedIndex: $d0d825e43d8ba478$var$getHighlightedIndexOnOpen(props, state, 0) + }; + break; + case stateChangeTypes.FunctionCloseMenu: + changes = { + isOpen: false + }; + break; + case stateChangeTypes.FunctionSetHighlightedIndex: + changes = { + highlightedIndex: action.highlightedIndex + }; + break; + case stateChangeTypes.FunctionSetInputValue: + changes = { + inputValue: action.inputValue + }; + break; + case stateChangeTypes.FunctionReset: + changes = { + highlightedIndex: $d0d825e43d8ba478$var$getDefaultValue$1(props, "highlightedIndex"), + isOpen: $d0d825e43d8ba478$var$getDefaultValue$1(props, "isOpen"), + selectedItem: $d0d825e43d8ba478$var$getDefaultValue$1(props, "selectedItem"), + inputValue: $d0d825e43d8ba478$var$getDefaultValue$1(props, "inputValue") + }; + break; + default: + throw new Error("Reducer called without proper action type."); + } + return (0, $uwkDK.default)({}, state, changes); +} +/* eslint-enable complexity */ function $d0d825e43d8ba478$var$getItemIndexByCharacterKey(_a) { + var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, isItemDisabled = _a.isItemDisabled; + var lowerCasedKeysSoFar = keysSoFar.toLowerCase(); + for(var index = 0; index < items.length; index++){ + // if we already have a search query in progress, we also consider the current highlighted item. + var offsetIndex = (index + highlightedIndex + (keysSoFar.length < 2 ? 1 : 0)) % items.length; + var item = items[offsetIndex]; + if (item !== undefined && itemToString(item).toLowerCase().startsWith(lowerCasedKeysSoFar) && !isItemDisabled(item, offsetIndex)) return offsetIndex; + } + return highlightedIndex; +} +var $d0d825e43d8ba478$var$propTypes$2 = (0, $7Dnph.__assign)((0, $7Dnph.__assign)({}, $d0d825e43d8ba478$var$commonDropdownPropTypes), { + items: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).array.isRequired, + isItemDisabled: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + getA11ySelectionMessage: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func +}); +/** + * Default implementation for status message. Only added when menu is open. + * Will specift if there are results in the list, and if so, how many, + * and what keys are relevant. + * + * @param {Object} param the downshift state and other relevant properties + * @return {String} the a11y status message + */ function $d0d825e43d8ba478$var$getA11yStatusMessage(_a) { + var isOpen = _a.isOpen, resultCount = _a.resultCount, previousResultCount = _a.previousResultCount; + if (!isOpen) return ""; + if (!resultCount) return "No results are available."; + if (resultCount !== previousResultCount) return "".concat(resultCount, " result").concat(resultCount === 1 ? " is" : "s are", " available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select."); + return ""; +} +var $d0d825e43d8ba478$var$defaultProps$2 = (0, $7Dnph.__assign)((0, $7Dnph.__assign)({}, $d0d825e43d8ba478$var$defaultProps$3), { + getA11yStatusMessage: $d0d825e43d8ba478$var$getA11yStatusMessage, + isItemDisabled: function() { + return false; + } +}); +// eslint-disable-next-line import/no-mutable-exports +var $d0d825e43d8ba478$var$validatePropTypes$2 = $d0d825e43d8ba478$var$noop; +var $d0d825e43d8ba478$var$ToggleButtonClick$1 = 0; +var $d0d825e43d8ba478$var$ToggleButtonKeyDownArrowDown = 1; +var $d0d825e43d8ba478$var$ToggleButtonKeyDownArrowUp = 2; +var $d0d825e43d8ba478$var$ToggleButtonKeyDownCharacter = 3; +var $d0d825e43d8ba478$var$ToggleButtonKeyDownEscape = 4; +var $d0d825e43d8ba478$var$ToggleButtonKeyDownHome = 5; +var $d0d825e43d8ba478$var$ToggleButtonKeyDownEnd = 6; +var $d0d825e43d8ba478$var$ToggleButtonKeyDownEnter = 7; +var $d0d825e43d8ba478$var$ToggleButtonKeyDownSpaceButton = 8; +var $d0d825e43d8ba478$var$ToggleButtonKeyDownPageUp = 9; +var $d0d825e43d8ba478$var$ToggleButtonKeyDownPageDown = 10; +var $d0d825e43d8ba478$var$ToggleButtonBlur = 11; +var $d0d825e43d8ba478$var$MenuMouseLeave$1 = 12; +var $d0d825e43d8ba478$var$ItemMouseMove$1 = 13; +var $d0d825e43d8ba478$var$ItemClick$1 = 14; +var $d0d825e43d8ba478$var$FunctionToggleMenu$1 = 15; +var $d0d825e43d8ba478$var$FunctionOpenMenu$1 = 16; +var $d0d825e43d8ba478$var$FunctionCloseMenu$1 = 17; +var $d0d825e43d8ba478$var$FunctionSetHighlightedIndex$1 = 18; +var $d0d825e43d8ba478$var$FunctionSelectItem$1 = 19; +var $d0d825e43d8ba478$var$FunctionSetInputValue$1 = 20; +var $d0d825e43d8ba478$var$FunctionReset$2 = 21; +var $d0d825e43d8ba478$var$stateChangeTypes$2 = /*#__PURE__*/ Object.freeze({ + __proto__: null, + ToggleButtonClick: $d0d825e43d8ba478$var$ToggleButtonClick$1, + ToggleButtonKeyDownArrowDown: $d0d825e43d8ba478$var$ToggleButtonKeyDownArrowDown, + ToggleButtonKeyDownArrowUp: $d0d825e43d8ba478$var$ToggleButtonKeyDownArrowUp, + ToggleButtonKeyDownCharacter: $d0d825e43d8ba478$var$ToggleButtonKeyDownCharacter, + ToggleButtonKeyDownEscape: $d0d825e43d8ba478$var$ToggleButtonKeyDownEscape, + ToggleButtonKeyDownHome: $d0d825e43d8ba478$var$ToggleButtonKeyDownHome, + ToggleButtonKeyDownEnd: $d0d825e43d8ba478$var$ToggleButtonKeyDownEnd, + ToggleButtonKeyDownEnter: $d0d825e43d8ba478$var$ToggleButtonKeyDownEnter, + ToggleButtonKeyDownSpaceButton: $d0d825e43d8ba478$var$ToggleButtonKeyDownSpaceButton, + ToggleButtonKeyDownPageUp: $d0d825e43d8ba478$var$ToggleButtonKeyDownPageUp, + ToggleButtonKeyDownPageDown: $d0d825e43d8ba478$var$ToggleButtonKeyDownPageDown, + ToggleButtonBlur: $d0d825e43d8ba478$var$ToggleButtonBlur, + MenuMouseLeave: $d0d825e43d8ba478$var$MenuMouseLeave$1, + ItemMouseMove: $d0d825e43d8ba478$var$ItemMouseMove$1, + ItemClick: $d0d825e43d8ba478$var$ItemClick$1, + FunctionToggleMenu: $d0d825e43d8ba478$var$FunctionToggleMenu$1, + FunctionOpenMenu: $d0d825e43d8ba478$var$FunctionOpenMenu$1, + FunctionCloseMenu: $d0d825e43d8ba478$var$FunctionCloseMenu$1, + FunctionSetHighlightedIndex: $d0d825e43d8ba478$var$FunctionSetHighlightedIndex$1, + FunctionSelectItem: $d0d825e43d8ba478$var$FunctionSelectItem$1, + FunctionSetInputValue: $d0d825e43d8ba478$var$FunctionSetInputValue$1, + FunctionReset: $d0d825e43d8ba478$var$FunctionReset$2 +}); +/* eslint-disable complexity */ function $d0d825e43d8ba478$var$downshiftSelectReducer(state, action) { + var _props$items; + var type = action.type, props = action.props, altKey = action.altKey; + var changes; + switch(type){ + case $d0d825e43d8ba478$var$ItemClick$1: + changes = { + isOpen: $d0d825e43d8ba478$var$getDefaultValue$1(props, "isOpen"), + highlightedIndex: $d0d825e43d8ba478$var$getDefaultValue$1(props, "highlightedIndex"), + selectedItem: props.items[action.index] + }; + break; + case $d0d825e43d8ba478$var$ToggleButtonKeyDownCharacter: + var lowercasedKey = action.key; + var inputValue = "" + state.inputValue + lowercasedKey; + var prevHighlightedIndex = !state.isOpen && state.selectedItem ? props.items.indexOf(state.selectedItem) : state.highlightedIndex; + var highlightedIndex = $d0d825e43d8ba478$var$getItemIndexByCharacterKey({ + keysSoFar: inputValue, + highlightedIndex: prevHighlightedIndex, + items: props.items, + itemToString: props.itemToString, + isItemDisabled: props.isItemDisabled + }); + changes = { + inputValue: inputValue, + highlightedIndex: highlightedIndex, + isOpen: true + }; + break; + case $d0d825e43d8ba478$var$ToggleButtonKeyDownArrowDown: + var _highlightedIndex = state.isOpen ? $d0d825e43d8ba478$var$getHighlightedIndex(state.highlightedIndex, 1, props.items, props.isItemDisabled) : altKey && state.selectedItem == null ? -1 : $d0d825e43d8ba478$var$getHighlightedIndexOnOpen(props, state, 1); + changes = { + highlightedIndex: _highlightedIndex, + isOpen: true + }; + break; + case $d0d825e43d8ba478$var$ToggleButtonKeyDownArrowUp: + if (state.isOpen && altKey) changes = $d0d825e43d8ba478$var$getChangesOnSelection(props, state.highlightedIndex, false); + else { + var _highlightedIndex2 = state.isOpen ? $d0d825e43d8ba478$var$getHighlightedIndex(state.highlightedIndex, -1, props.items, props.isItemDisabled) : $d0d825e43d8ba478$var$getHighlightedIndexOnOpen(props, state, -1); + changes = { + highlightedIndex: _highlightedIndex2, + isOpen: true + }; + } + break; + // only triggered when menu is open. + case $d0d825e43d8ba478$var$ToggleButtonKeyDownEnter: + case $d0d825e43d8ba478$var$ToggleButtonKeyDownSpaceButton: + changes = $d0d825e43d8ba478$var$getChangesOnSelection(props, state.highlightedIndex, false); + break; + case $d0d825e43d8ba478$var$ToggleButtonKeyDownHome: + changes = { + highlightedIndex: $d0d825e43d8ba478$var$getNonDisabledIndex(0, false, props.items, props.isItemDisabled), + isOpen: true + }; + break; + case $d0d825e43d8ba478$var$ToggleButtonKeyDownEnd: + changes = { + highlightedIndex: $d0d825e43d8ba478$var$getNonDisabledIndex(props.items.length - 1, true, props.items, props.isItemDisabled), + isOpen: true + }; + break; + case $d0d825e43d8ba478$var$ToggleButtonKeyDownPageUp: + changes = { + highlightedIndex: $d0d825e43d8ba478$var$getHighlightedIndex(state.highlightedIndex, -10, props.items, props.isItemDisabled) + }; + break; + case $d0d825e43d8ba478$var$ToggleButtonKeyDownPageDown: + changes = { + highlightedIndex: $d0d825e43d8ba478$var$getHighlightedIndex(state.highlightedIndex, 10, props.items, props.isItemDisabled) + }; + break; + case $d0d825e43d8ba478$var$ToggleButtonKeyDownEscape: + changes = { + isOpen: false, + highlightedIndex: -1 + }; + break; + case $d0d825e43d8ba478$var$ToggleButtonBlur: + changes = (0, $uwkDK.default)({ + isOpen: false, + highlightedIndex: -1 + }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && { + selectedItem: props.items[state.highlightedIndex] + }); + break; + case $d0d825e43d8ba478$var$FunctionSelectItem$1: + changes = { + selectedItem: action.selectedItem + }; + break; + default: + return $d0d825e43d8ba478$var$downshiftCommonReducer(state, action, $d0d825e43d8ba478$var$stateChangeTypes$2); + } + return (0, $uwkDK.default)({}, state, changes); +} +/* eslint-enable complexity */ var $d0d825e43d8ba478$var$_excluded$2 = [ + "onMouseLeave", + "refKey", + "ref" +], $d0d825e43d8ba478$var$_excluded2$2 = [ + "onBlur", + "onClick", + "onPress", + "onKeyDown", + "refKey", + "ref" +], $d0d825e43d8ba478$var$_excluded3$1 = [ + "item", + "index", + "onMouseMove", + "onClick", + "onMouseDown", + "onPress", + "refKey", + "disabled", + "ref" +]; +$d0d825e43d8ba478$export$e64b2f635402ca43.stateChangeTypes = $d0d825e43d8ba478$var$stateChangeTypes$2; +function $d0d825e43d8ba478$export$e64b2f635402ca43(userProps) { + if (userProps === void 0) userProps = {}; + $d0d825e43d8ba478$var$validatePropTypes$2(userProps, $d0d825e43d8ba478$export$e64b2f635402ca43); + // Props defaults and destructuring. + var props = (0, $uwkDK.default)({}, $d0d825e43d8ba478$var$defaultProps$2, userProps); + var items = props.items, scrollIntoView = props.scrollIntoView, environment = props.environment, itemToString = props.itemToString, getA11ySelectionMessage = props.getA11ySelectionMessage, getA11yStatusMessage = props.getA11yStatusMessage; + // Initial state depending on controlled props. + var initialState = $d0d825e43d8ba478$var$getInitialState$2(props); + var _useControlledReducer = $d0d825e43d8ba478$var$useControlledReducer$1($d0d825e43d8ba478$var$downshiftSelectReducer, initialState, props), state = _useControlledReducer[0], dispatch = _useControlledReducer[1]; + var isOpen = state.isOpen, highlightedIndex = state.highlightedIndex, selectedItem = state.selectedItem, inputValue = state.inputValue; + // Element efs. + var toggleButtonRef = (0, $63SH6.useRef)(null); + var menuRef = (0, $63SH6.useRef)(null); + var itemRefs = (0, $63SH6.useRef)({}); + // used to keep the inputValue clearTimeout object between renders. + var clearTimeoutRef = (0, $63SH6.useRef)(null); + // prevent id re-generation between renders. + var elementIds = $d0d825e43d8ba478$var$useElementIds(props); + // used to keep track of how many items we had on previous cycle. + var previousResultCountRef = (0, $63SH6.useRef)(); + var isInitialMountRef = (0, $63SH6.useRef)(true); + // utility callback to get item element. + var latest = $d0d825e43d8ba478$var$useLatestRef({ + state: state, + props: props + }); + // Some utils. + var getItemNodeFromIndex = (0, $63SH6.useCallback)(function(index) { + return itemRefs.current[elementIds.getItemId(index)]; + }, [ + elementIds + ]); + // Effects. + // Sets a11y status message on changes in state. + $d0d825e43d8ba478$var$useA11yMessageSetter(getA11yStatusMessage, [ + isOpen, + highlightedIndex, + inputValue, + items + ], (0, $uwkDK.default)({ + isInitialMount: isInitialMountRef.current, + previousResultCount: previousResultCountRef.current, + items: items, + environment: environment, + itemToString: itemToString + }, state)); + // Sets a11y status message on changes in selectedItem. + $d0d825e43d8ba478$var$useA11yMessageSetter(getA11ySelectionMessage, [ + selectedItem + ], (0, $uwkDK.default)({ + isInitialMount: isInitialMountRef.current, + previousResultCount: previousResultCountRef.current, + items: items, + environment: environment, + itemToString: itemToString + }, state)); + // Scroll on highlighted item if change comes from keyboard. + var shouldScrollRef = $d0d825e43d8ba478$var$useScrollIntoView({ + menuElement: menuRef.current, + highlightedIndex: highlightedIndex, + isOpen: isOpen, + itemRefs: itemRefs, + scrollIntoView: scrollIntoView, + getItemNodeFromIndex: getItemNodeFromIndex + }); + // Sets cleanup for the keysSoFar callback, debounded after 500ms. + (0, $63SH6.useEffect)(function() { + // init the clean function here as we need access to dispatch. + clearTimeoutRef.current = $d0d825e43d8ba478$var$debounce(function(outerDispatch) { + outerDispatch({ + type: $d0d825e43d8ba478$var$FunctionSetInputValue$1, + inputValue: "" + }); + }, 500); + // Cancel any pending debounced calls on mount + return function() { + clearTimeoutRef.current.cancel(); + }; + }, []); + // Invokes the keysSoFar callback set up above. + (0, $63SH6.useEffect)(function() { + if (!inputValue) return; + clearTimeoutRef.current(dispatch); + }, [ + dispatch, + inputValue + ]); + $d0d825e43d8ba478$var$useControlPropsValidator({ + isInitialMount: isInitialMountRef.current, + props: props, + state: state + }); + (0, $63SH6.useEffect)(function() { + if (isInitialMountRef.current) return; + previousResultCountRef.current = items.length; + }); + // Focus the toggle button on first render if required. + (0, $63SH6.useEffect)(function() { + var focusOnOpen = $d0d825e43d8ba478$var$getInitialValue$1(props, "isOpen"); + if (focusOnOpen && toggleButtonRef.current) toggleButtonRef.current.focus(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + // Add mouse/touch events to document. + var mouseAndTouchTrackersRef = $d0d825e43d8ba478$var$useMouseAndTouchTracker(isOpen, [ + menuRef, + toggleButtonRef + ], environment, function() { + dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonBlur + }); + }); + var setGetterPropCallInfo = $d0d825e43d8ba478$var$useGetterPropsCalledChecker("getMenuProps", "getToggleButtonProps"); + // Make initial ref false. + (0, $63SH6.useEffect)(function() { + isInitialMountRef.current = false; + return function() { + isInitialMountRef.current = true; + }; + }, []); + // Reset itemRefs on close. + (0, $63SH6.useEffect)(function() { + if (!isOpen) itemRefs.current = {}; + }, [ + isOpen + ]); + // Event handler functions. + var toggleButtonKeyDownHandlers = (0, $63SH6.useMemo)(function() { + return { + ArrowDown: function ArrowDown(event) { + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonKeyDownArrowDown, + altKey: event.altKey + }); + }, + ArrowUp: function ArrowUp(event) { + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonKeyDownArrowUp, + altKey: event.altKey + }); + }, + Home: function Home(event) { + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonKeyDownHome + }); + }, + End: function End(event) { + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonKeyDownEnd + }); + }, + Escape: function Escape() { + if (latest.current.state.isOpen) dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonKeyDownEscape + }); + }, + Enter: function Enter(event) { + event.preventDefault(); + dispatch({ + type: latest.current.state.isOpen ? $d0d825e43d8ba478$var$ToggleButtonKeyDownEnter : $d0d825e43d8ba478$var$ToggleButtonClick$1 + }); + }, + PageUp: function PageUp(event) { + if (latest.current.state.isOpen) { + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonKeyDownPageUp + }); + } + }, + PageDown: function PageDown(event) { + if (latest.current.state.isOpen) { + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonKeyDownPageDown + }); + } + }, + " ": function _(event) { + event.preventDefault(); + var currentState = latest.current.state; + if (!currentState.isOpen) { + dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonClick$1 + }); + return; + } + if (currentState.inputValue) dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonKeyDownCharacter, + key: " " + }); + else dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonKeyDownSpaceButton + }); + } + }; + }, [ + dispatch, + latest + ]); + // Action functions. + var toggleMenu = (0, $63SH6.useCallback)(function() { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionToggleMenu$1 + }); + }, [ + dispatch + ]); + var closeMenu = (0, $63SH6.useCallback)(function() { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionCloseMenu$1 + }); + }, [ + dispatch + ]); + var openMenu = (0, $63SH6.useCallback)(function() { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionOpenMenu$1 + }); + }, [ + dispatch + ]); + var setHighlightedIndex = (0, $63SH6.useCallback)(function(newHighlightedIndex) { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionSetHighlightedIndex$1, + highlightedIndex: newHighlightedIndex + }); + }, [ + dispatch + ]); + var selectItem = (0, $63SH6.useCallback)(function(newSelectedItem) { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionSelectItem$1, + selectedItem: newSelectedItem + }); + }, [ + dispatch + ]); + var reset = (0, $63SH6.useCallback)(function() { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionReset$2 + }); + }, [ + dispatch + ]); + var setInputValue = (0, $63SH6.useCallback)(function(newInputValue) { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionSetInputValue$1, + inputValue: newInputValue + }); + }, [ + dispatch + ]); + // Getter functions. + var getLabelProps = (0, $63SH6.useCallback)(function(labelProps) { + return (0, $uwkDK.default)({ + id: elementIds.labelId, + htmlFor: elementIds.toggleButtonId + }, labelProps); + }, [ + elementIds + ]); + var getMenuProps = (0, $63SH6.useCallback)(function(_temp, _temp2) { + var _extends2; + var _ref = _temp === void 0 ? {} : _temp, onMouseLeave = _ref.onMouseLeave, _ref$refKey = _ref.refKey, refKey = _ref$refKey === void 0 ? "ref" : _ref$refKey, ref = _ref.ref, rest = (0, $8WqTz.default)(_ref, $d0d825e43d8ba478$var$_excluded$2); + var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$suppressRefErro = _ref2.suppressRefError, suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro; + var menuHandleMouseLeave = function menuHandleMouseLeave() { + dispatch({ + type: $d0d825e43d8ba478$var$MenuMouseLeave$1 + }); + }; + setGetterPropCallInfo("getMenuProps", suppressRefError, refKey, menuRef); + return (0, $uwkDK.default)((_extends2 = {}, _extends2[refKey] = $d0d825e43d8ba478$var$handleRefs(ref, function(menuNode) { + menuRef.current = menuNode; + }), _extends2.id = elementIds.menuId, _extends2.role = "listbox", _extends2["aria-labelledby"] = rest && rest["aria-label"] ? undefined : "" + elementIds.labelId, _extends2.onMouseLeave = $d0d825e43d8ba478$var$callAllEventHandlers(onMouseLeave, menuHandleMouseLeave), _extends2), rest); + }, [ + dispatch, + setGetterPropCallInfo, + elementIds + ]); + var getToggleButtonProps = (0, $63SH6.useCallback)(function(_temp3, _temp4) { + var _extends3; + var _ref3 = _temp3 === void 0 ? {} : _temp3, onBlur = _ref3.onBlur, onClick = _ref3.onClick; + _ref3.onPress; + var onKeyDown = _ref3.onKeyDown, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, ref = _ref3.ref, rest = (0, $8WqTz.default)(_ref3, $d0d825e43d8ba478$var$_excluded2$2); + var _ref4 = _temp4 === void 0 ? {} : _temp4, _ref4$suppressRefErro = _ref4.suppressRefError, suppressRefError = _ref4$suppressRefErro === void 0 ? false : _ref4$suppressRefErro; + var latestState = latest.current.state; + var toggleButtonHandleClick = function toggleButtonHandleClick() { + dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonClick$1 + }); + }; + var toggleButtonHandleBlur = function toggleButtonHandleBlur() { + if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonBlur + }); + }; + var toggleButtonHandleKeyDown = function toggleButtonHandleKeyDown(event) { + var key = $d0d825e43d8ba478$var$normalizeArrowKey(event); + if (key && toggleButtonKeyDownHandlers[key]) toggleButtonKeyDownHandlers[key](event); + else if ($d0d825e43d8ba478$var$isAcceptedCharacterKey(key)) dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonKeyDownCharacter, + key: key + }); + }; + var toggleProps = (0, $uwkDK.default)((_extends3 = {}, _extends3[refKey] = $d0d825e43d8ba478$var$handleRefs(ref, function(toggleButtonNode) { + toggleButtonRef.current = toggleButtonNode; + }), _extends3["aria-activedescendant"] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : "", _extends3["aria-controls"] = elementIds.menuId, _extends3["aria-expanded"] = latest.current.state.isOpen, _extends3["aria-haspopup"] = "listbox", _extends3["aria-labelledby"] = rest && rest["aria-label"] ? undefined : "" + elementIds.labelId, _extends3.id = elementIds.toggleButtonId, _extends3.role = "combobox", _extends3.tabIndex = 0, _extends3.onBlur = $d0d825e43d8ba478$var$callAllEventHandlers(onBlur, toggleButtonHandleBlur), _extends3), rest); + if (!rest.disabled) { + toggleProps.onClick = $d0d825e43d8ba478$var$callAllEventHandlers(onClick, toggleButtonHandleClick); + toggleProps.onKeyDown = $d0d825e43d8ba478$var$callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown); + } + setGetterPropCallInfo("getToggleButtonProps", suppressRefError, refKey, toggleButtonRef); + return toggleProps; + }, [ + latest, + elementIds, + setGetterPropCallInfo, + dispatch, + mouseAndTouchTrackersRef, + toggleButtonKeyDownHandlers + ]); + var getItemProps = (0, $63SH6.useCallback)(function(_temp5) { + var _extends4; + var _ref5 = _temp5 === void 0 ? {} : _temp5, itemProp = _ref5.item, indexProp = _ref5.index, onMouseMove = _ref5.onMouseMove, onClick = _ref5.onClick, onMouseDown = _ref5.onMouseDown; + _ref5.onPress; + var _ref5$refKey = _ref5.refKey, refKey = _ref5$refKey === void 0 ? "ref" : _ref5$refKey, disabledProp = _ref5.disabled, ref = _ref5.ref, rest = (0, $8WqTz.default)(_ref5, $d0d825e43d8ba478$var$_excluded3$1); + if (disabledProp !== undefined) console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useSelect.'); + var _latest$current = latest.current, latestState = _latest$current.state, latestProps = _latest$current.props; + var _getItemAndIndex = $d0d825e43d8ba478$var$getItemAndIndex(itemProp, indexProp, latestProps.items, "Pass either item or index to getItemProps!"), item = _getItemAndIndex[0], index = _getItemAndIndex[1]; + var disabled = latestProps.isItemDisabled(item, index); + var itemHandleMouseMove = function itemHandleMouseMove() { + if (index === latestState.highlightedIndex) return; + shouldScrollRef.current = false; + dispatch({ + type: $d0d825e43d8ba478$var$ItemMouseMove$1, + index: index, + disabled: disabled + }); + }; + var itemHandleClick = function itemHandleClick() { + dispatch({ + type: $d0d825e43d8ba478$var$ItemClick$1, + index: index + }); + }; + var itemHandleMouseDown = function itemHandleMouseDown(e) { + return e.preventDefault(); + }; // keep focus on the toggle after item click select. + var itemProps = (0, $uwkDK.default)((_extends4 = {}, _extends4[refKey] = $d0d825e43d8ba478$var$handleRefs(ref, function(itemNode) { + if (itemNode) itemRefs.current[elementIds.getItemId(index)] = itemNode; + }), _extends4["aria-disabled"] = disabled, _extends4["aria-selected"] = "" + (item === latestState.selectedItem), _extends4.id = elementIds.getItemId(index), _extends4.role = "option", _extends4), rest); + if (!disabled) itemProps.onClick = $d0d825e43d8ba478$var$callAllEventHandlers(onClick, itemHandleClick); + itemProps.onMouseMove = $d0d825e43d8ba478$var$callAllEventHandlers(onMouseMove, itemHandleMouseMove); + itemProps.onMouseDown = $d0d825e43d8ba478$var$callAllEventHandlers(onMouseDown, itemHandleMouseDown); + return itemProps; + }, [ + latest, + elementIds, + shouldScrollRef, + dispatch + ]); + return { + // prop getters. + getToggleButtonProps: getToggleButtonProps, + getLabelProps: getLabelProps, + getMenuProps: getMenuProps, + getItemProps: getItemProps, + // actions. + toggleMenu: toggleMenu, + openMenu: openMenu, + closeMenu: closeMenu, + setHighlightedIndex: setHighlightedIndex, + selectItem: selectItem, + reset: reset, + setInputValue: setInputValue, + // state. + highlightedIndex: highlightedIndex, + isOpen: isOpen, + selectedItem: selectedItem, + inputValue: inputValue + }; +} +var $d0d825e43d8ba478$var$InputKeyDownArrowDown = 0; +var $d0d825e43d8ba478$var$InputKeyDownArrowUp = 1; +var $d0d825e43d8ba478$var$InputKeyDownEscape = 2; +var $d0d825e43d8ba478$var$InputKeyDownHome = 3; +var $d0d825e43d8ba478$var$InputKeyDownEnd = 4; +var $d0d825e43d8ba478$var$InputKeyDownPageUp = 5; +var $d0d825e43d8ba478$var$InputKeyDownPageDown = 6; +var $d0d825e43d8ba478$var$InputKeyDownEnter = 7; +var $d0d825e43d8ba478$var$InputChange = 8; +var $d0d825e43d8ba478$var$InputBlur = 9; +var $d0d825e43d8ba478$var$InputClick = 10; +var $d0d825e43d8ba478$var$MenuMouseLeave = 11; +var $d0d825e43d8ba478$var$ItemMouseMove = 12; +var $d0d825e43d8ba478$var$ItemClick = 13; +var $d0d825e43d8ba478$var$ToggleButtonClick = 14; +var $d0d825e43d8ba478$var$FunctionToggleMenu = 15; +var $d0d825e43d8ba478$var$FunctionOpenMenu = 16; +var $d0d825e43d8ba478$var$FunctionCloseMenu = 17; +var $d0d825e43d8ba478$var$FunctionSetHighlightedIndex = 18; +var $d0d825e43d8ba478$var$FunctionSelectItem = 19; +var $d0d825e43d8ba478$var$FunctionSetInputValue = 20; +var $d0d825e43d8ba478$var$FunctionReset$1 = 21; +var $d0d825e43d8ba478$var$ControlledPropUpdatedSelectedItem = 22; +var $d0d825e43d8ba478$var$stateChangeTypes$1 = /*#__PURE__*/ Object.freeze({ + __proto__: null, + InputKeyDownArrowDown: $d0d825e43d8ba478$var$InputKeyDownArrowDown, + InputKeyDownArrowUp: $d0d825e43d8ba478$var$InputKeyDownArrowUp, + InputKeyDownEscape: $d0d825e43d8ba478$var$InputKeyDownEscape, + InputKeyDownHome: $d0d825e43d8ba478$var$InputKeyDownHome, + InputKeyDownEnd: $d0d825e43d8ba478$var$InputKeyDownEnd, + InputKeyDownPageUp: $d0d825e43d8ba478$var$InputKeyDownPageUp, + InputKeyDownPageDown: $d0d825e43d8ba478$var$InputKeyDownPageDown, + InputKeyDownEnter: $d0d825e43d8ba478$var$InputKeyDownEnter, + InputChange: $d0d825e43d8ba478$var$InputChange, + InputBlur: $d0d825e43d8ba478$var$InputBlur, + InputClick: $d0d825e43d8ba478$var$InputClick, + MenuMouseLeave: $d0d825e43d8ba478$var$MenuMouseLeave, + ItemMouseMove: $d0d825e43d8ba478$var$ItemMouseMove, + ItemClick: $d0d825e43d8ba478$var$ItemClick, + ToggleButtonClick: $d0d825e43d8ba478$var$ToggleButtonClick, + FunctionToggleMenu: $d0d825e43d8ba478$var$FunctionToggleMenu, + FunctionOpenMenu: $d0d825e43d8ba478$var$FunctionOpenMenu, + FunctionCloseMenu: $d0d825e43d8ba478$var$FunctionCloseMenu, + FunctionSetHighlightedIndex: $d0d825e43d8ba478$var$FunctionSetHighlightedIndex, + FunctionSelectItem: $d0d825e43d8ba478$var$FunctionSelectItem, + FunctionSetInputValue: $d0d825e43d8ba478$var$FunctionSetInputValue, + FunctionReset: $d0d825e43d8ba478$var$FunctionReset$1, + ControlledPropUpdatedSelectedItem: $d0d825e43d8ba478$var$ControlledPropUpdatedSelectedItem +}); +function $d0d825e43d8ba478$var$getInitialState$1(props) { + var initialState = $d0d825e43d8ba478$var$getInitialState$2(props); + var selectedItem = initialState.selectedItem; + var inputValue = initialState.inputValue; + if (inputValue === "" && selectedItem && props.defaultInputValue === undefined && props.initialInputValue === undefined && props.inputValue === undefined) inputValue = props.itemToString(selectedItem); + return (0, $uwkDK.default)({}, initialState, { + inputValue: inputValue + }); +} +var $d0d825e43d8ba478$var$propTypes$1 = (0, $uwkDK.default)({}, $d0d825e43d8ba478$var$commonDropdownPropTypes, { + items: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).array.isRequired, + isItemDisabled: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + selectedItemChanged: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + getA11ySelectionMessage: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + inputValue: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).string, + defaultInputValue: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).string, + initialInputValue: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).string, + inputId: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).string, + onInputValueChange: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func +}); +/** + * The useCombobox version of useControlledReducer, which also + * checks if the controlled prop selectedItem changed between + * renders. If so, it will also update inputValue with its + * string equivalent. It uses the common useEnhancedReducer to + * compute the rest of the state. + * + * @param {Function} reducer Reducer function from downshift. + * @param {Object} initialState Initial state of the hook. + * @param {Object} props The hook props. + * @returns {Array} An array with the state and an action dispatcher. + */ function $d0d825e43d8ba478$var$useControlledReducer(reducer, initialState, props) { + var previousSelectedItemRef = (0, $63SH6.useRef)(); + var _useEnhancedReducer = $d0d825e43d8ba478$var$useEnhancedReducer(reducer, initialState, props), state = _useEnhancedReducer[0], dispatch = _useEnhancedReducer[1]; + // ToDo: if needed, make same approach as selectedItemChanged from Downshift. + (0, $63SH6.useEffect)(function() { + if (!$d0d825e43d8ba478$var$isControlledProp(props, "selectedItem")) return; + if (props.selectedItemChanged(previousSelectedItemRef.current, props.selectedItem)) dispatch({ + type: $d0d825e43d8ba478$var$ControlledPropUpdatedSelectedItem, + inputValue: props.itemToString(props.selectedItem) + }); + previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [ + state.selectedItem, + props.selectedItem + ]); + return [ + $d0d825e43d8ba478$var$getState(state, props), + dispatch + ]; +} +// eslint-disable-next-line import/no-mutable-exports +var $d0d825e43d8ba478$var$validatePropTypes$1 = $d0d825e43d8ba478$var$noop; +var $d0d825e43d8ba478$var$defaultProps$1 = (0, $uwkDK.default)({}, $d0d825e43d8ba478$var$defaultProps$3, { + selectedItemChanged: function selectedItemChanged(prevItem, item) { + return prevItem !== item; + }, + getA11yStatusMessage: $d0d825e43d8ba478$var$getA11yStatusMessage$1, + isItemDisabled: function isItemDisabled() { + return false; + } +}); +/* eslint-disable complexity */ function $d0d825e43d8ba478$var$downshiftUseComboboxReducer(state, action) { + var _props$items; + var type = action.type, props = action.props, altKey = action.altKey; + var changes; + switch(type){ + case $d0d825e43d8ba478$var$ItemClick: + changes = { + isOpen: $d0d825e43d8ba478$var$getDefaultValue$1(props, "isOpen"), + highlightedIndex: $d0d825e43d8ba478$var$getDefaultValue$1(props, "highlightedIndex"), + selectedItem: props.items[action.index], + inputValue: props.itemToString(props.items[action.index]) + }; + break; + case $d0d825e43d8ba478$var$InputKeyDownArrowDown: + if (state.isOpen) changes = { + highlightedIndex: $d0d825e43d8ba478$var$getHighlightedIndex(state.highlightedIndex, 1, props.items, props.isItemDisabled, true) + }; + else changes = { + highlightedIndex: altKey && state.selectedItem == null ? -1 : $d0d825e43d8ba478$var$getHighlightedIndexOnOpen(props, state, 1), + isOpen: props.items.length >= 0 + }; + break; + case $d0d825e43d8ba478$var$InputKeyDownArrowUp: + if (state.isOpen) { + if (altKey) changes = $d0d825e43d8ba478$var$getChangesOnSelection(props, state.highlightedIndex); + else changes = { + highlightedIndex: $d0d825e43d8ba478$var$getHighlightedIndex(state.highlightedIndex, -1, props.items, props.isItemDisabled, true) + }; + } else changes = { + highlightedIndex: $d0d825e43d8ba478$var$getHighlightedIndexOnOpen(props, state, -1), + isOpen: props.items.length >= 0 + }; + break; + case $d0d825e43d8ba478$var$InputKeyDownEnter: + changes = $d0d825e43d8ba478$var$getChangesOnSelection(props, state.highlightedIndex); + break; + case $d0d825e43d8ba478$var$InputKeyDownEscape: + changes = (0, $uwkDK.default)({ + isOpen: false, + highlightedIndex: -1 + }, !state.isOpen && { + selectedItem: null, + inputValue: "" + }); + break; + case $d0d825e43d8ba478$var$InputKeyDownPageUp: + changes = { + highlightedIndex: $d0d825e43d8ba478$var$getHighlightedIndex(state.highlightedIndex, -10, props.items, props.isItemDisabled, true) + }; + break; + case $d0d825e43d8ba478$var$InputKeyDownPageDown: + changes = { + highlightedIndex: $d0d825e43d8ba478$var$getHighlightedIndex(state.highlightedIndex, 10, props.items, props.isItemDisabled, true) + }; + break; + case $d0d825e43d8ba478$var$InputKeyDownHome: + changes = { + highlightedIndex: $d0d825e43d8ba478$var$getNonDisabledIndex(0, false, props.items, props.isItemDisabled) + }; + break; + case $d0d825e43d8ba478$var$InputKeyDownEnd: + changes = { + highlightedIndex: $d0d825e43d8ba478$var$getNonDisabledIndex(props.items.length - 1, true, props.items, props.isItemDisabled) + }; + break; + case $d0d825e43d8ba478$var$InputBlur: + changes = (0, $uwkDK.default)({ + isOpen: false, + highlightedIndex: -1 + }, state.highlightedIndex >= 0 && ((_props$items = props.items) == null ? void 0 : _props$items.length) && action.selectItem && { + selectedItem: props.items[state.highlightedIndex], + inputValue: props.itemToString(props.items[state.highlightedIndex]) + }); + break; + case $d0d825e43d8ba478$var$InputChange: + changes = { + isOpen: true, + highlightedIndex: $d0d825e43d8ba478$var$getDefaultValue$1(props, "highlightedIndex"), + inputValue: action.inputValue + }; + break; + case $d0d825e43d8ba478$var$InputClick: + changes = { + isOpen: !state.isOpen, + highlightedIndex: state.isOpen ? -1 : $d0d825e43d8ba478$var$getHighlightedIndexOnOpen(props, state, 0) + }; + break; + case $d0d825e43d8ba478$var$FunctionSelectItem: + changes = { + selectedItem: action.selectedItem, + inputValue: props.itemToString(action.selectedItem) + }; + break; + case $d0d825e43d8ba478$var$ControlledPropUpdatedSelectedItem: + changes = { + inputValue: action.inputValue + }; + break; + default: + return $d0d825e43d8ba478$var$downshiftCommonReducer(state, action, $d0d825e43d8ba478$var$stateChangeTypes$1); + } + return (0, $uwkDK.default)({}, state, changes); +} +/* eslint-enable complexity */ var $d0d825e43d8ba478$var$_excluded$1 = [ + "onMouseLeave", + "refKey", + "ref" +], $d0d825e43d8ba478$var$_excluded2$1 = [ + "item", + "index", + "refKey", + "ref", + "onMouseMove", + "onMouseDown", + "onClick", + "onPress", + "disabled" +], $d0d825e43d8ba478$var$_excluded3 = [ + "onClick", + "onPress", + "refKey", + "ref" +], $d0d825e43d8ba478$var$_excluded4 = [ + "onKeyDown", + "onChange", + "onInput", + "onBlur", + "onChangeText", + "onClick", + "refKey", + "ref" +]; +$d0d825e43d8ba478$export$7a023a466c03eb3d.stateChangeTypes = $d0d825e43d8ba478$var$stateChangeTypes$1; +function $d0d825e43d8ba478$export$7a023a466c03eb3d(userProps) { + if (userProps === void 0) userProps = {}; + $d0d825e43d8ba478$var$validatePropTypes$1(userProps, $d0d825e43d8ba478$export$7a023a466c03eb3d); + // Props defaults and destructuring. + var props = (0, $uwkDK.default)({}, $d0d825e43d8ba478$var$defaultProps$1, userProps); + var items = props.items, scrollIntoView = props.scrollIntoView, environment = props.environment, getA11yStatusMessage = props.getA11yStatusMessage, getA11ySelectionMessage = props.getA11ySelectionMessage, itemToString = props.itemToString; + // Initial state depending on controlled props. + var initialState = $d0d825e43d8ba478$var$getInitialState$1(props); + var _useControlledReducer = $d0d825e43d8ba478$var$useControlledReducer($d0d825e43d8ba478$var$downshiftUseComboboxReducer, initialState, props), state = _useControlledReducer[0], dispatch = _useControlledReducer[1]; + var isOpen = state.isOpen, highlightedIndex = state.highlightedIndex, selectedItem = state.selectedItem, inputValue = state.inputValue; + // Element refs. + var menuRef = (0, $63SH6.useRef)(null); + var itemRefs = (0, $63SH6.useRef)({}); + var inputRef = (0, $63SH6.useRef)(null); + var toggleButtonRef = (0, $63SH6.useRef)(null); + var isInitialMountRef = (0, $63SH6.useRef)(true); + // prevent id re-generation between renders. + var elementIds = $d0d825e43d8ba478$var$useElementIds(props); + // used to keep track of how many items we had on previous cycle. + var previousResultCountRef = (0, $63SH6.useRef)(); + // utility callback to get item element. + var latest = $d0d825e43d8ba478$var$useLatestRef({ + state: state, + props: props + }); + var getItemNodeFromIndex = (0, $63SH6.useCallback)(function(index) { + return itemRefs.current[elementIds.getItemId(index)]; + }, [ + elementIds + ]); + // Effects. + // Sets a11y status message on changes in state. + $d0d825e43d8ba478$var$useA11yMessageSetter(getA11yStatusMessage, [ + isOpen, + highlightedIndex, + inputValue, + items + ], (0, $uwkDK.default)({ + isInitialMount: isInitialMountRef.current, + previousResultCount: previousResultCountRef.current, + items: items, + environment: environment, + itemToString: itemToString + }, state)); + // Sets a11y status message on changes in selectedItem. + $d0d825e43d8ba478$var$useA11yMessageSetter(getA11ySelectionMessage, [ + selectedItem + ], (0, $uwkDK.default)({ + isInitialMount: isInitialMountRef.current, + previousResultCount: previousResultCountRef.current, + items: items, + environment: environment, + itemToString: itemToString + }, state)); + // Scroll on highlighted item if change comes from keyboard. + var shouldScrollRef = $d0d825e43d8ba478$var$useScrollIntoView({ + menuElement: menuRef.current, + highlightedIndex: highlightedIndex, + isOpen: isOpen, + itemRefs: itemRefs, + scrollIntoView: scrollIntoView, + getItemNodeFromIndex: getItemNodeFromIndex + }); + $d0d825e43d8ba478$var$useControlPropsValidator({ + isInitialMount: isInitialMountRef.current, + props: props, + state: state + }); + // Focus the input on first render if required. + (0, $63SH6.useEffect)(function() { + var focusOnOpen = $d0d825e43d8ba478$var$getInitialValue$1(props, "isOpen"); + if (focusOnOpen && inputRef.current) inputRef.current.focus(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + (0, $63SH6.useEffect)(function() { + if (isInitialMountRef.current) return; + previousResultCountRef.current = items.length; + }); + // Add mouse/touch events to document. + var mouseAndTouchTrackersRef = $d0d825e43d8ba478$var$useMouseAndTouchTracker(isOpen, [ + inputRef, + menuRef, + toggleButtonRef + ], environment, function() { + dispatch({ + type: $d0d825e43d8ba478$var$InputBlur, + selectItem: false + }); + }); + var setGetterPropCallInfo = $d0d825e43d8ba478$var$useGetterPropsCalledChecker("getInputProps", "getMenuProps"); + // Make initial ref false. + (0, $63SH6.useEffect)(function() { + isInitialMountRef.current = false; + return function() { + isInitialMountRef.current = true; + }; + }, []); + // Reset itemRefs on close. + (0, $63SH6.useEffect)(function() { + if (!isOpen) itemRefs.current = {}; + }, [ + isOpen + ]); + // Reset itemRefs on close. + (0, $63SH6.useEffect)(function() { + var _inputRef$current; + if (!isOpen || !(environment != null && environment.document) || !(inputRef != null && (_inputRef$current = inputRef.current) != null && _inputRef$current.focus)) return; + if (environment.document.activeElement !== inputRef.current) inputRef.current.focus(); + }, [ + isOpen, + environment + ]); + /* Event handler functions */ var inputKeyDownHandlers = (0, $63SH6.useMemo)(function() { + return { + ArrowDown: function ArrowDown(event) { + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$InputKeyDownArrowDown, + altKey: event.altKey + }); + }, + ArrowUp: function ArrowUp(event) { + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$InputKeyDownArrowUp, + altKey: event.altKey + }); + }, + Home: function Home(event) { + if (!latest.current.state.isOpen) return; + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$InputKeyDownHome + }); + }, + End: function End(event) { + if (!latest.current.state.isOpen) return; + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$InputKeyDownEnd + }); + }, + Escape: function Escape(event) { + var latestState = latest.current.state; + if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) { + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$InputKeyDownEscape + }); + } + }, + Enter: function Enter(event) { + var latestState = latest.current.state; + // if closed or no highlighted index, do nothing. + if (!latestState.isOpen || event.which === 229 // if IME composing, wait for next Enter keydown event. + ) return; + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$InputKeyDownEnter + }); + }, + PageUp: function PageUp(event) { + if (latest.current.state.isOpen) { + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$InputKeyDownPageUp + }); + } + }, + PageDown: function PageDown(event) { + if (latest.current.state.isOpen) { + event.preventDefault(); + dispatch({ + type: $d0d825e43d8ba478$var$InputKeyDownPageDown + }); + } + } + }; + }, [ + dispatch, + latest + ]); + // Getter props. + var getLabelProps = (0, $63SH6.useCallback)(function(labelProps) { + return (0, $uwkDK.default)({ + id: elementIds.labelId, + htmlFor: elementIds.inputId + }, labelProps); + }, [ + elementIds + ]); + var getMenuProps = (0, $63SH6.useCallback)(function(_temp, _temp2) { + var _extends2; + var _ref = _temp === void 0 ? {} : _temp, onMouseLeave = _ref.onMouseLeave, _ref$refKey = _ref.refKey, refKey = _ref$refKey === void 0 ? "ref" : _ref$refKey, ref = _ref.ref, rest = (0, $8WqTz.default)(_ref, $d0d825e43d8ba478$var$_excluded$1); + var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$suppressRefErro = _ref2.suppressRefError, suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro; + setGetterPropCallInfo("getMenuProps", suppressRefError, refKey, menuRef); + return (0, $uwkDK.default)((_extends2 = {}, _extends2[refKey] = $d0d825e43d8ba478$var$handleRefs(ref, function(menuNode) { + menuRef.current = menuNode; + }), _extends2.id = elementIds.menuId, _extends2.role = "listbox", _extends2["aria-labelledby"] = rest && rest["aria-label"] ? undefined : "" + elementIds.labelId, _extends2.onMouseLeave = $d0d825e43d8ba478$var$callAllEventHandlers(onMouseLeave, function() { + dispatch({ + type: $d0d825e43d8ba478$var$MenuMouseLeave + }); + }), _extends2), rest); + }, [ + dispatch, + setGetterPropCallInfo, + elementIds + ]); + var getItemProps = (0, $63SH6.useCallback)(function(_temp3) { + var _extends3, _ref4; + var _ref3 = _temp3 === void 0 ? {} : _temp3, itemProp = _ref3.item, indexProp = _ref3.index, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, ref = _ref3.ref, onMouseMove = _ref3.onMouseMove, onMouseDown = _ref3.onMouseDown, onClick = _ref3.onClick; + _ref3.onPress; + var disabledProp = _ref3.disabled, rest = (0, $8WqTz.default)(_ref3, $d0d825e43d8ba478$var$_excluded2$1); + if (disabledProp !== undefined) console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.'); + var _latest$current = latest.current, latestProps = _latest$current.props, latestState = _latest$current.state; + var _getItemAndIndex = $d0d825e43d8ba478$var$getItemAndIndex(itemProp, indexProp, latestProps.items, "Pass either item or index to getItemProps!"), item = _getItemAndIndex[0], index = _getItemAndIndex[1]; + var disabled = latestProps.isItemDisabled(item, index); + var onSelectKey = "onClick"; + var customClickHandler = onClick; + var itemHandleMouseMove = function itemHandleMouseMove() { + if (index === latestState.highlightedIndex) return; + shouldScrollRef.current = false; + dispatch({ + type: $d0d825e43d8ba478$var$ItemMouseMove, + index: index, + disabled: disabled + }); + }; + var itemHandleClick = function itemHandleClick() { + dispatch({ + type: $d0d825e43d8ba478$var$ItemClick, + index: index + }); + }; + var itemHandleMouseDown = function itemHandleMouseDown(e) { + return e.preventDefault(); + }; // keep focus on the input after item click select. + return (0, $uwkDK.default)((_extends3 = {}, _extends3[refKey] = $d0d825e43d8ba478$var$handleRefs(ref, function(itemNode) { + if (itemNode) itemRefs.current[elementIds.getItemId(index)] = itemNode; + }), _extends3["aria-disabled"] = disabled, _extends3["aria-selected"] = "" + (index === latestState.highlightedIndex), _extends3.id = elementIds.getItemId(index), _extends3.role = "option", _extends3), !disabled && (_ref4 = {}, _ref4[onSelectKey] = $d0d825e43d8ba478$var$callAllEventHandlers(customClickHandler, itemHandleClick), _ref4), { + onMouseMove: $d0d825e43d8ba478$var$callAllEventHandlers(onMouseMove, itemHandleMouseMove), + onMouseDown: $d0d825e43d8ba478$var$callAllEventHandlers(onMouseDown, itemHandleMouseDown) + }, rest); + }, [ + dispatch, + latest, + shouldScrollRef, + elementIds + ]); + var getToggleButtonProps = (0, $63SH6.useCallback)(function(_temp4) { + var _extends4; + var _ref5 = _temp4 === void 0 ? {} : _temp4, onClick = _ref5.onClick; + _ref5.onPress; + var _ref5$refKey = _ref5.refKey, refKey = _ref5$refKey === void 0 ? "ref" : _ref5$refKey, ref = _ref5.ref, rest = (0, $8WqTz.default)(_ref5, $d0d825e43d8ba478$var$_excluded3); + var latestState = latest.current.state; + var toggleButtonHandleClick = function toggleButtonHandleClick() { + dispatch({ + type: $d0d825e43d8ba478$var$ToggleButtonClick + }); + }; + return (0, $uwkDK.default)((_extends4 = {}, _extends4[refKey] = $d0d825e43d8ba478$var$handleRefs(ref, function(toggleButtonNode) { + toggleButtonRef.current = toggleButtonNode; + }), _extends4["aria-controls"] = elementIds.menuId, _extends4["aria-expanded"] = latestState.isOpen, _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && (0, $uwkDK.default)({}, { + onClick: $d0d825e43d8ba478$var$callAllEventHandlers(onClick, toggleButtonHandleClick) + }), rest); + }, [ + dispatch, + latest, + elementIds + ]); + var getInputProps = (0, $63SH6.useCallback)(function(_temp5, _temp6) { + var _extends5; + var _ref6 = _temp5 === void 0 ? {} : _temp5, onKeyDown = _ref6.onKeyDown, onChange = _ref6.onChange, onInput = _ref6.onInput, onBlur = _ref6.onBlur; + _ref6.onChangeText; + var onClick = _ref6.onClick, _ref6$refKey = _ref6.refKey, refKey = _ref6$refKey === void 0 ? "ref" : _ref6$refKey, ref = _ref6.ref, rest = (0, $8WqTz.default)(_ref6, $d0d825e43d8ba478$var$_excluded4); + var _ref7 = _temp6 === void 0 ? {} : _temp6, _ref7$suppressRefErro = _ref7.suppressRefError, suppressRefError = _ref7$suppressRefErro === void 0 ? false : _ref7$suppressRefErro; + setGetterPropCallInfo("getInputProps", suppressRefError, refKey, inputRef); + var latestState = latest.current.state; + var inputHandleKeyDown = function inputHandleKeyDown(event) { + var key = $d0d825e43d8ba478$var$normalizeArrowKey(event); + if (key && inputKeyDownHandlers[key]) inputKeyDownHandlers[key](event); + }; + var inputHandleChange = function inputHandleChange(event) { + dispatch({ + type: $d0d825e43d8ba478$var$InputChange, + inputValue: event.target.value + }); + }; + var inputHandleBlur = function inputHandleBlur(event) { + /* istanbul ignore else */ if (environment != null && environment.document && latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) { + var isBlurByTabChange = event.relatedTarget === null && environment.document.activeElement !== environment.document.body; + dispatch({ + type: $d0d825e43d8ba478$var$InputBlur, + selectItem: !isBlurByTabChange + }); + } + }; + var inputHandleClick = function inputHandleClick() { + dispatch({ + type: $d0d825e43d8ba478$var$InputClick + }); + }; + /* istanbul ignore next (preact) */ var onChangeKey = "onChange"; + var eventHandlers = {}; + if (!rest.disabled) { + var _eventHandlers; + eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = $d0d825e43d8ba478$var$callAllEventHandlers(onChange, onInput, inputHandleChange), _eventHandlers.onKeyDown = $d0d825e43d8ba478$var$callAllEventHandlers(onKeyDown, inputHandleKeyDown), _eventHandlers.onBlur = $d0d825e43d8ba478$var$callAllEventHandlers(onBlur, inputHandleBlur), _eventHandlers.onClick = $d0d825e43d8ba478$var$callAllEventHandlers(onClick, inputHandleClick), _eventHandlers); + } + return (0, $uwkDK.default)((_extends5 = {}, _extends5[refKey] = $d0d825e43d8ba478$var$handleRefs(ref, function(inputNode) { + inputRef.current = inputNode; + }), _extends5["aria-activedescendant"] = latestState.isOpen && latestState.highlightedIndex > -1 ? elementIds.getItemId(latestState.highlightedIndex) : "", _extends5["aria-autocomplete"] = "list", _extends5["aria-controls"] = elementIds.menuId, _extends5["aria-expanded"] = latestState.isOpen, _extends5["aria-labelledby"] = rest && rest["aria-label"] ? undefined : elementIds.labelId, _extends5.autoComplete = "off", _extends5.id = elementIds.inputId, _extends5.role = "combobox", _extends5.value = latestState.inputValue, _extends5), eventHandlers, rest); + }, [ + setGetterPropCallInfo, + latest, + elementIds, + inputKeyDownHandlers, + dispatch, + mouseAndTouchTrackersRef, + environment + ]); + // returns + var toggleMenu = (0, $63SH6.useCallback)(function() { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionToggleMenu + }); + }, [ + dispatch + ]); + var closeMenu = (0, $63SH6.useCallback)(function() { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionCloseMenu + }); + }, [ + dispatch + ]); + var openMenu = (0, $63SH6.useCallback)(function() { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionOpenMenu + }); + }, [ + dispatch + ]); + var setHighlightedIndex = (0, $63SH6.useCallback)(function(newHighlightedIndex) { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionSetHighlightedIndex, + highlightedIndex: newHighlightedIndex + }); + }, [ + dispatch + ]); + var selectItem = (0, $63SH6.useCallback)(function(newSelectedItem) { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionSelectItem, + selectedItem: newSelectedItem + }); + }, [ + dispatch + ]); + var setInputValue = (0, $63SH6.useCallback)(function(newInputValue) { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionSetInputValue, + inputValue: newInputValue + }); + }, [ + dispatch + ]); + var reset = (0, $63SH6.useCallback)(function() { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionReset$1 + }); + }, [ + dispatch + ]); + return { + // prop getters. + getItemProps: getItemProps, + getLabelProps: getLabelProps, + getMenuProps: getMenuProps, + getInputProps: getInputProps, + getToggleButtonProps: getToggleButtonProps, + // actions. + toggleMenu: toggleMenu, + openMenu: openMenu, + closeMenu: closeMenu, + setHighlightedIndex: setHighlightedIndex, + setInputValue: setInputValue, + selectItem: selectItem, + reset: reset, + // state. + highlightedIndex: highlightedIndex, + isOpen: isOpen, + selectedItem: selectedItem, + inputValue: inputValue + }; +} +var $d0d825e43d8ba478$var$defaultStateValues = { + activeIndex: -1, + selectedItems: [] +}; +/** + * Returns the initial value for a state key in the following order: + * 1. controlled prop, 2. initial prop, 3. default prop, 4. default + * value from Downshift. + * + * @param {Object} props Props passed to the hook. + * @param {string} propKey Props key to generate the value for. + * @returns {any} The initial value for that prop. + */ function $d0d825e43d8ba478$var$getInitialValue(props, propKey) { + return $d0d825e43d8ba478$var$getInitialValue$1(props, propKey, $d0d825e43d8ba478$var$defaultStateValues); +} +/** + * Returns the default value for a state key in the following order: + * 1. controlled prop, 2. default prop, 3. default value from Downshift. + * + * @param {Object} props Props passed to the hook. + * @param {string} propKey Props key to generate the value for. + * @returns {any} The initial value for that prop. + */ function $d0d825e43d8ba478$var$getDefaultValue(props, propKey) { + return $d0d825e43d8ba478$var$getDefaultValue$1(props, propKey, $d0d825e43d8ba478$var$defaultStateValues); +} +/** + * Gets the initial state based on the provided props. It uses initial, default + * and controlled props related to state in order to compute the initial value. + * + * @param {Object} props Props passed to the hook. + * @returns {Object} The initial state. + */ function $d0d825e43d8ba478$var$getInitialState(props) { + var activeIndex = $d0d825e43d8ba478$var$getInitialValue(props, "activeIndex"); + var selectedItems = $d0d825e43d8ba478$var$getInitialValue(props, "selectedItems"); + return { + activeIndex: activeIndex, + selectedItems: selectedItems + }; +} +/** + * Returns true if dropdown keydown operation is permitted. Should not be + * allowed on keydown with modifier keys (ctrl, alt, shift, meta), on + * input element with text content that is either highlighted or selection + * cursor is not at the starting position. + * + * @param {KeyboardEvent} event The event from keydown. + * @returns {boolean} Whether the operation is allowed. + */ function $d0d825e43d8ba478$var$isKeyDownOperationPermitted(event) { + if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) return false; + var element = event.target; + if (element instanceof HTMLInputElement && // if element is a text input + element.value !== "" && // and we have text in it + // and cursor is either not at the start or is currently highlighting text. + (element.selectionStart !== 0 || element.selectionEnd !== 0)) return false; + return true; +} +/** + * Returns a message to be added to aria-live region when item is removed. + * + * @param {Object} selectionParameters Parameters required to build the message. + * @returns {string} The a11y message. + */ function $d0d825e43d8ba478$var$getA11yRemovalMessage(selectionParameters) { + var removedSelectedItem = selectionParameters.removedSelectedItem, itemToStringLocal = selectionParameters.itemToString; + return itemToStringLocal(removedSelectedItem) + " has been removed."; +} +var $d0d825e43d8ba478$var$propTypes = (0, $uwkDK.default)({}, $d0d825e43d8ba478$var$commonPropTypes, { + selectedItems: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).array, + initialSelectedItems: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).array, + defaultSelectedItems: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).array, + getA11yRemovalMessage: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + activeIndex: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).number, + initialActiveIndex: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).number, + defaultActiveIndex: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).number, + onActiveIndexChange: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + onSelectedItemsChange: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).func, + keyNavigationNext: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).string, + keyNavigationPrevious: (0, (/*@__PURE__*/$parcel$interopDefault($eu9I7))).string +}); +var $d0d825e43d8ba478$var$defaultProps = { + itemToString: $d0d825e43d8ba478$var$defaultProps$3.itemToString, + stateReducer: $d0d825e43d8ba478$var$defaultProps$3.stateReducer, + environment: $d0d825e43d8ba478$var$defaultProps$3.environment, + getA11yRemovalMessage: $d0d825e43d8ba478$var$getA11yRemovalMessage, + keyNavigationNext: "ArrowRight", + keyNavigationPrevious: "ArrowLeft" +}; +// eslint-disable-next-line import/no-mutable-exports +var $d0d825e43d8ba478$var$validatePropTypes = $d0d825e43d8ba478$var$noop; +var $d0d825e43d8ba478$var$SelectedItemClick = 0; +var $d0d825e43d8ba478$var$SelectedItemKeyDownDelete = 1; +var $d0d825e43d8ba478$var$SelectedItemKeyDownBackspace = 2; +var $d0d825e43d8ba478$var$SelectedItemKeyDownNavigationNext = 3; +var $d0d825e43d8ba478$var$SelectedItemKeyDownNavigationPrevious = 4; +var $d0d825e43d8ba478$var$DropdownKeyDownNavigationPrevious = 5; +var $d0d825e43d8ba478$var$DropdownKeyDownBackspace = 6; +var $d0d825e43d8ba478$var$DropdownClick = 7; +var $d0d825e43d8ba478$var$FunctionAddSelectedItem = 8; +var $d0d825e43d8ba478$var$FunctionRemoveSelectedItem = 9; +var $d0d825e43d8ba478$var$FunctionSetSelectedItems = 10; +var $d0d825e43d8ba478$var$FunctionSetActiveIndex = 11; +var $d0d825e43d8ba478$var$FunctionReset = 12; +var $d0d825e43d8ba478$var$stateChangeTypes = /*#__PURE__*/ Object.freeze({ + __proto__: null, + SelectedItemClick: $d0d825e43d8ba478$var$SelectedItemClick, + SelectedItemKeyDownDelete: $d0d825e43d8ba478$var$SelectedItemKeyDownDelete, + SelectedItemKeyDownBackspace: $d0d825e43d8ba478$var$SelectedItemKeyDownBackspace, + SelectedItemKeyDownNavigationNext: $d0d825e43d8ba478$var$SelectedItemKeyDownNavigationNext, + SelectedItemKeyDownNavigationPrevious: $d0d825e43d8ba478$var$SelectedItemKeyDownNavigationPrevious, + DropdownKeyDownNavigationPrevious: $d0d825e43d8ba478$var$DropdownKeyDownNavigationPrevious, + DropdownKeyDownBackspace: $d0d825e43d8ba478$var$DropdownKeyDownBackspace, + DropdownClick: $d0d825e43d8ba478$var$DropdownClick, + FunctionAddSelectedItem: $d0d825e43d8ba478$var$FunctionAddSelectedItem, + FunctionRemoveSelectedItem: $d0d825e43d8ba478$var$FunctionRemoveSelectedItem, + FunctionSetSelectedItems: $d0d825e43d8ba478$var$FunctionSetSelectedItems, + FunctionSetActiveIndex: $d0d825e43d8ba478$var$FunctionSetActiveIndex, + FunctionReset: $d0d825e43d8ba478$var$FunctionReset +}); +/* eslint-disable complexity */ function $d0d825e43d8ba478$var$downshiftMultipleSelectionReducer(state, action) { + var type = action.type, index = action.index, props = action.props, selectedItem = action.selectedItem; + var activeIndex = state.activeIndex, selectedItems = state.selectedItems; + var changes; + switch(type){ + case $d0d825e43d8ba478$var$SelectedItemClick: + changes = { + activeIndex: index + }; + break; + case $d0d825e43d8ba478$var$SelectedItemKeyDownNavigationPrevious: + changes = { + activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1 + }; + break; + case $d0d825e43d8ba478$var$SelectedItemKeyDownNavigationNext: + changes = { + activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1 + }; + break; + case $d0d825e43d8ba478$var$SelectedItemKeyDownBackspace: + case $d0d825e43d8ba478$var$SelectedItemKeyDownDelete: + if (activeIndex < 0) break; + var newActiveIndex = activeIndex; + if (selectedItems.length === 1) newActiveIndex = -1; + else if (activeIndex === selectedItems.length - 1) newActiveIndex = selectedItems.length - 2; + changes = (0, $uwkDK.default)({ + selectedItems: [].concat(selectedItems.slice(0, activeIndex), selectedItems.slice(activeIndex + 1)) + }, { + activeIndex: newActiveIndex + }); + break; + case $d0d825e43d8ba478$var$DropdownKeyDownNavigationPrevious: + changes = { + activeIndex: selectedItems.length - 1 + }; + break; + case $d0d825e43d8ba478$var$DropdownKeyDownBackspace: + changes = { + selectedItems: selectedItems.slice(0, selectedItems.length - 1) + }; + break; + case $d0d825e43d8ba478$var$FunctionAddSelectedItem: + changes = { + selectedItems: [].concat(selectedItems, [ + selectedItem + ]) + }; + break; + case $d0d825e43d8ba478$var$DropdownClick: + changes = { + activeIndex: -1 + }; + break; + case $d0d825e43d8ba478$var$FunctionRemoveSelectedItem: + var _newActiveIndex = activeIndex; + var selectedItemIndex = selectedItems.indexOf(selectedItem); + if (selectedItemIndex < 0) break; + if (selectedItems.length === 1) _newActiveIndex = -1; + else if (selectedItemIndex === selectedItems.length - 1) _newActiveIndex = selectedItems.length - 2; + changes = { + selectedItems: [].concat(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1)), + activeIndex: _newActiveIndex + }; + break; + case $d0d825e43d8ba478$var$FunctionSetSelectedItems: + var newSelectedItems = action.selectedItems; + changes = { + selectedItems: newSelectedItems + }; + break; + case $d0d825e43d8ba478$var$FunctionSetActiveIndex: + var _newActiveIndex2 = action.activeIndex; + changes = { + activeIndex: _newActiveIndex2 + }; + break; + case $d0d825e43d8ba478$var$FunctionReset: + changes = { + activeIndex: $d0d825e43d8ba478$var$getDefaultValue(props, "activeIndex"), + selectedItems: $d0d825e43d8ba478$var$getDefaultValue(props, "selectedItems") + }; + break; + default: + throw new Error("Reducer called without proper action type."); + } + return (0, $uwkDK.default)({}, state, changes); +} +var $d0d825e43d8ba478$var$_excluded = [ + "refKey", + "ref", + "onClick", + "onKeyDown", + "selectedItem", + "index" +], $d0d825e43d8ba478$var$_excluded2 = [ + "refKey", + "ref", + "onKeyDown", + "onClick", + "preventKeyAction" +]; +$d0d825e43d8ba478$export$134e7e7faed1473a.stateChangeTypes = $d0d825e43d8ba478$var$stateChangeTypes; +function $d0d825e43d8ba478$export$134e7e7faed1473a(userProps) { + if (userProps === void 0) userProps = {}; + $d0d825e43d8ba478$var$validatePropTypes(userProps, $d0d825e43d8ba478$export$134e7e7faed1473a); + // Props defaults and destructuring. + var props = (0, $uwkDK.default)({}, $d0d825e43d8ba478$var$defaultProps, userProps); + var getA11yRemovalMessage = props.getA11yRemovalMessage, itemToString = props.itemToString, environment = props.environment, keyNavigationNext = props.keyNavigationNext, keyNavigationPrevious = props.keyNavigationPrevious; + // Reducer init. + var _useControlledReducer = $d0d825e43d8ba478$var$useControlledReducer$1($d0d825e43d8ba478$var$downshiftMultipleSelectionReducer, $d0d825e43d8ba478$var$getInitialState(props), props), state = _useControlledReducer[0], dispatch = _useControlledReducer[1]; + var activeIndex = state.activeIndex, selectedItems = state.selectedItems; + // Refs. + var isInitialMountRef = (0, $63SH6.useRef)(true); + var dropdownRef = (0, $63SH6.useRef)(null); + var previousSelectedItemsRef = (0, $63SH6.useRef)(selectedItems); + var selectedItemRefs = (0, $63SH6.useRef)(); + selectedItemRefs.current = []; + var latest = $d0d825e43d8ba478$var$useLatestRef({ + state: state, + props: props + }); + // Effects. + /* Sets a11y status message on changes in selectedItem. */ (0, $63SH6.useEffect)(function() { + if (isInitialMountRef.current || false || !(environment != null && environment.document)) return; + if (selectedItems.length < previousSelectedItemsRef.current.length) { + var removedSelectedItem = previousSelectedItemsRef.current.find(function(item) { + return selectedItems.indexOf(item) < 0; + }); + $d0d825e43d8ba478$var$setStatus(getA11yRemovalMessage({ + itemToString: itemToString, + resultCount: selectedItems.length, + removedSelectedItem: removedSelectedItem, + activeIndex: activeIndex, + activeSelectedItem: selectedItems[activeIndex] + }), environment.document); + } + previousSelectedItemsRef.current = selectedItems; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [ + selectedItems.length + ]); + // Sets focus on active item. + (0, $63SH6.useEffect)(function() { + if (isInitialMountRef.current) return; + if (activeIndex === -1 && dropdownRef.current) dropdownRef.current.focus(); + else if (selectedItemRefs.current[activeIndex]) selectedItemRefs.current[activeIndex].focus(); + }, [ + activeIndex + ]); + $d0d825e43d8ba478$var$useControlPropsValidator({ + isInitialMount: isInitialMountRef.current, + props: props, + state: state + }); + var setGetterPropCallInfo = $d0d825e43d8ba478$var$useGetterPropsCalledChecker("getDropdownProps"); + // Make initial ref false. + (0, $63SH6.useEffect)(function() { + isInitialMountRef.current = false; + return function() { + isInitialMountRef.current = true; + }; + }, []); + // Event handler functions. + var selectedItemKeyDownHandlers = (0, $63SH6.useMemo)(function() { + var _ref; + return _ref = {}, _ref[keyNavigationPrevious] = function() { + dispatch({ + type: $d0d825e43d8ba478$var$SelectedItemKeyDownNavigationPrevious + }); + }, _ref[keyNavigationNext] = function() { + dispatch({ + type: $d0d825e43d8ba478$var$SelectedItemKeyDownNavigationNext + }); + }, _ref.Delete = function Delete() { + dispatch({ + type: $d0d825e43d8ba478$var$SelectedItemKeyDownDelete + }); + }, _ref.Backspace = function Backspace() { + dispatch({ + type: $d0d825e43d8ba478$var$SelectedItemKeyDownBackspace + }); + }, _ref; + }, [ + dispatch, + keyNavigationNext, + keyNavigationPrevious + ]); + var dropdownKeyDownHandlers = (0, $63SH6.useMemo)(function() { + var _ref2; + return _ref2 = {}, _ref2[keyNavigationPrevious] = function(event) { + if ($d0d825e43d8ba478$var$isKeyDownOperationPermitted(event)) dispatch({ + type: $d0d825e43d8ba478$var$DropdownKeyDownNavigationPrevious + }); + }, _ref2.Backspace = function Backspace(event) { + if ($d0d825e43d8ba478$var$isKeyDownOperationPermitted(event)) dispatch({ + type: $d0d825e43d8ba478$var$DropdownKeyDownBackspace + }); + }, _ref2; + }, [ + dispatch, + keyNavigationPrevious + ]); + // Getter props. + var getSelectedItemProps = (0, $63SH6.useCallback)(function(_temp) { + var _extends2; + var _ref3 = _temp === void 0 ? {} : _temp, _ref3$refKey = _ref3.refKey, refKey = _ref3$refKey === void 0 ? "ref" : _ref3$refKey, ref = _ref3.ref, onClick = _ref3.onClick, onKeyDown = _ref3.onKeyDown, selectedItemProp = _ref3.selectedItem, indexProp = _ref3.index, rest = (0, $8WqTz.default)(_ref3, $d0d825e43d8ba478$var$_excluded); + var latestState = latest.current.state; + var _getItemAndIndex = $d0d825e43d8ba478$var$getItemAndIndex(selectedItemProp, indexProp, latestState.selectedItems, "Pass either item or index to getSelectedItemProps!"), index = _getItemAndIndex[1]; + var isFocusable = index > -1 && index === latestState.activeIndex; + var selectedItemHandleClick = function selectedItemHandleClick() { + dispatch({ + type: $d0d825e43d8ba478$var$SelectedItemClick, + index: index + }); + }; + var selectedItemHandleKeyDown = function selectedItemHandleKeyDown(event) { + var key = $d0d825e43d8ba478$var$normalizeArrowKey(event); + if (key && selectedItemKeyDownHandlers[key]) selectedItemKeyDownHandlers[key](event); + }; + return (0, $uwkDK.default)((_extends2 = {}, _extends2[refKey] = $d0d825e43d8ba478$var$handleRefs(ref, function(selectedItemNode) { + if (selectedItemNode) selectedItemRefs.current.push(selectedItemNode); + }), _extends2.tabIndex = isFocusable ? 0 : -1, _extends2.onClick = $d0d825e43d8ba478$var$callAllEventHandlers(onClick, selectedItemHandleClick), _extends2.onKeyDown = $d0d825e43d8ba478$var$callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown), _extends2), rest); + }, [ + dispatch, + latest, + selectedItemKeyDownHandlers + ]); + var getDropdownProps = (0, $63SH6.useCallback)(function(_temp2, _temp3) { + var _extends3; + var _ref4 = _temp2 === void 0 ? {} : _temp2, _ref4$refKey = _ref4.refKey, refKey = _ref4$refKey === void 0 ? "ref" : _ref4$refKey, ref = _ref4.ref, onKeyDown = _ref4.onKeyDown, onClick = _ref4.onClick, _ref4$preventKeyActio = _ref4.preventKeyAction, preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio, rest = (0, $8WqTz.default)(_ref4, $d0d825e43d8ba478$var$_excluded2); + var _ref5 = _temp3 === void 0 ? {} : _temp3, _ref5$suppressRefErro = _ref5.suppressRefError, suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro; + setGetterPropCallInfo("getDropdownProps", suppressRefError, refKey, dropdownRef); + var dropdownHandleKeyDown = function dropdownHandleKeyDown(event) { + var key = $d0d825e43d8ba478$var$normalizeArrowKey(event); + if (key && dropdownKeyDownHandlers[key]) dropdownKeyDownHandlers[key](event); + }; + var dropdownHandleClick = function dropdownHandleClick() { + dispatch({ + type: $d0d825e43d8ba478$var$DropdownClick + }); + }; + return (0, $uwkDK.default)((_extends3 = {}, _extends3[refKey] = $d0d825e43d8ba478$var$handleRefs(ref, function(dropdownNode) { + if (dropdownNode) dropdownRef.current = dropdownNode; + }), _extends3), !preventKeyAction && { + onKeyDown: $d0d825e43d8ba478$var$callAllEventHandlers(onKeyDown, dropdownHandleKeyDown), + onClick: $d0d825e43d8ba478$var$callAllEventHandlers(onClick, dropdownHandleClick) + }, rest); + }, [ + dispatch, + dropdownKeyDownHandlers, + setGetterPropCallInfo + ]); + // returns + var addSelectedItem = (0, $63SH6.useCallback)(function(selectedItem) { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionAddSelectedItem, + selectedItem: selectedItem + }); + }, [ + dispatch + ]); + var removeSelectedItem = (0, $63SH6.useCallback)(function(selectedItem) { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionRemoveSelectedItem, + selectedItem: selectedItem + }); + }, [ + dispatch + ]); + var setSelectedItems = (0, $63SH6.useCallback)(function(newSelectedItems) { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionSetSelectedItems, + selectedItems: newSelectedItems + }); + }, [ + dispatch + ]); + var setActiveIndex = (0, $63SH6.useCallback)(function(newActiveIndex) { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionSetActiveIndex, + activeIndex: newActiveIndex + }); + }, [ + dispatch + ]); + var reset = (0, $63SH6.useCallback)(function() { + dispatch({ + type: $d0d825e43d8ba478$var$FunctionReset + }); + }, [ + dispatch + ]); + return { + getSelectedItemProps: getSelectedItemProps, + getDropdownProps: getDropdownProps, + addSelectedItem: addSelectedItem, + removeSelectedItem: removeSelectedItem, + setSelectedItems: setSelectedItems, + setActiveIndex: setActiveIndex, + reset: reset, + selectedItems: selectedItems, + activeIndex: activeIndex + }; +} + +}); +parcelRegister("8WqTz", function(module, exports) { + +$parcel$export(module.exports, "default", () => $68289a5ce1bcd6c4$export$2e2bcd8739ae039); +function $68289a5ce1bcd6c4$export$2e2bcd8739ae039(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} + +}); + +parcelRegister("uwkDK", function(module, exports) { + +$parcel$export(module.exports, "default", () => $05bbe1e6311f0c0f$export$2e2bcd8739ae039); +function $05bbe1e6311f0c0f$export$2e2bcd8739ae039() { + $05bbe1e6311f0c0f$export$2e2bcd8739ae039 = Object.assign ? Object.assign.bind() : function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return $05bbe1e6311f0c0f$export$2e2bcd8739ae039.apply(this, arguments); +} + +}); + +parcelRegister("1Nh8o", function(module, exports) { + +$parcel$export(module.exports, "default", () => $14e7a899f7a6fd8c$export$2e2bcd8739ae039); +function $14e7a899f7a6fd8c$export$2e2bcd8739ae039(self) { + if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return self; +} + +}); + +parcelRegister("5VaeF", function(module, exports) { + +$parcel$export(module.exports, "default", () => $44fa373266b5f7e3$export$2e2bcd8739ae039); + +var $f3xoQ = parcelRequire("f3xoQ"); +function $44fa373266b5f7e3$export$2e2bcd8739ae039(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + (0, $f3xoQ.default)(subClass, superClass); +} + +}); +parcelRegister("f3xoQ", function(module, exports) { + +$parcel$export(module.exports, "default", () => $af610b4cb32b0a5c$export$2e2bcd8739ae039); +function $af610b4cb32b0a5c$export$2e2bcd8739ae039(o, p) { + $af610b4cb32b0a5c$export$2e2bcd8739ae039 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return $af610b4cb32b0a5c$export$2e2bcd8739ae039(o, p); +} + +}); + + +parcelRegister("eu9I7", function(module, exports) { +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ var $a8bb6658ecfb1626$var$ReactIs, $a8bb6658ecfb1626$var$throwOnDirectAccess; + +// By explicitly using `prop-types` you are opting into new production behavior. +// http://fb.me/prop-types-in-prod +module.exports = (parcelRequire("ggqhU"))(); + +}); +parcelRegister("ggqhU", function(module, exports) { +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ "use strict"; + +var $hmi6A = parcelRequire("hmi6A"); +function $bd7288339e99f7a7$var$emptyFunction() {} +function $bd7288339e99f7a7$var$emptyFunctionWithReset() {} +$bd7288339e99f7a7$var$emptyFunctionWithReset.resetWarningCache = $bd7288339e99f7a7$var$emptyFunction; +module.exports = function() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === $hmi6A) // It is still safe when called from React. + return; + var err = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"); + err.name = "Invariant Violation"; + throw err; + } + shim.isRequired = shim; + function getShim() { + return shim; + } + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. + var ReactPropTypes = { + array: shim, + bigint: shim, + bool: shim, + func: shim, + number: shim, + object: shim, + string: shim, + symbol: shim, + any: shim, + arrayOf: getShim, + element: shim, + elementType: shim, + instanceOf: getShim, + node: shim, + objectOf: getShim, + oneOf: getShim, + oneOfType: getShim, + shape: getShim, + exact: getShim, + checkPropTypes: $bd7288339e99f7a7$var$emptyFunctionWithReset, + resetWarningCache: $bd7288339e99f7a7$var$emptyFunction + }; + ReactPropTypes.PropTypes = ReactPropTypes; + return ReactPropTypes; +}; + +}); +parcelRegister("hmi6A", function(module, exports) { +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ "use strict"; +var $ca32891491f834e6$var$ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; +module.exports = $ca32891491f834e6$var$ReactPropTypesSecret; + +}); + + + +parcelRegister("2oqnz", function(module, exports) { +"use strict"; + +module.exports = (parcelRequire("3ln06")); + +}); +parcelRegister("3ln06", function(module, exports) { + +$parcel$export(module.exports, "ContextConsumer", () => $26f52cba0c3bfe9e$export$a7c73072b1a182ae, (v) => $26f52cba0c3bfe9e$export$a7c73072b1a182ae = v); +$parcel$export(module.exports, "ContextProvider", () => $26f52cba0c3bfe9e$export$9f27bc3417b4524d, (v) => $26f52cba0c3bfe9e$export$9f27bc3417b4524d = v); +$parcel$export(module.exports, "Element", () => $26f52cba0c3bfe9e$export$db77ccec0bb4ccac, (v) => $26f52cba0c3bfe9e$export$db77ccec0bb4ccac = v); +$parcel$export(module.exports, "ForwardRef", () => $26f52cba0c3bfe9e$export$8392c0c9d3dcbd35, (v) => $26f52cba0c3bfe9e$export$8392c0c9d3dcbd35 = v); +$parcel$export(module.exports, "Fragment", () => $26f52cba0c3bfe9e$export$ffb0004e005737fa, (v) => $26f52cba0c3bfe9e$export$ffb0004e005737fa = v); +$parcel$export(module.exports, "Lazy", () => $26f52cba0c3bfe9e$export$b624eff549462981, (v) => $26f52cba0c3bfe9e$export$b624eff549462981 = v); +$parcel$export(module.exports, "Memo", () => $26f52cba0c3bfe9e$export$7897aa7841a5380c, (v) => $26f52cba0c3bfe9e$export$7897aa7841a5380c = v); +$parcel$export(module.exports, "Portal", () => $26f52cba0c3bfe9e$export$602eac185826482c, (v) => $26f52cba0c3bfe9e$export$602eac185826482c = v); +$parcel$export(module.exports, "Profiler", () => $26f52cba0c3bfe9e$export$e2c29f18771995cb, (v) => $26f52cba0c3bfe9e$export$e2c29f18771995cb = v); +$parcel$export(module.exports, "StrictMode", () => $26f52cba0c3bfe9e$export$5f8d39834fd61797, (v) => $26f52cba0c3bfe9e$export$5f8d39834fd61797 = v); +$parcel$export(module.exports, "Suspense", () => $26f52cba0c3bfe9e$export$74bf444e3cd11ea5, (v) => $26f52cba0c3bfe9e$export$74bf444e3cd11ea5 = v); +$parcel$export(module.exports, "SuspenseList", () => $26f52cba0c3bfe9e$export$998bcd577473dd93, (v) => $26f52cba0c3bfe9e$export$998bcd577473dd93 = v); +$parcel$export(module.exports, "isAsyncMode", () => $26f52cba0c3bfe9e$export$92387174baf9b227, (v) => $26f52cba0c3bfe9e$export$92387174baf9b227 = v); +$parcel$export(module.exports, "isConcurrentMode", () => $26f52cba0c3bfe9e$export$ec112efeb987d9c6, (v) => $26f52cba0c3bfe9e$export$ec112efeb987d9c6 = v); +$parcel$export(module.exports, "isContextConsumer", () => $26f52cba0c3bfe9e$export$b706b080d889d2c9, (v) => $26f52cba0c3bfe9e$export$b706b080d889d2c9 = v); +$parcel$export(module.exports, "isContextProvider", () => $26f52cba0c3bfe9e$export$5be5a87408f70ddc, (v) => $26f52cba0c3bfe9e$export$5be5a87408f70ddc = v); +$parcel$export(module.exports, "isElement", () => $26f52cba0c3bfe9e$export$45a5e7f76e0caa8d, (v) => $26f52cba0c3bfe9e$export$45a5e7f76e0caa8d = v); +$parcel$export(module.exports, "isForwardRef", () => $26f52cba0c3bfe9e$export$455c2e768291efa6, (v) => $26f52cba0c3bfe9e$export$455c2e768291efa6 = v); +$parcel$export(module.exports, "isFragment", () => $26f52cba0c3bfe9e$export$9522e17588c12572, (v) => $26f52cba0c3bfe9e$export$9522e17588c12572 = v); +$parcel$export(module.exports, "isLazy", () => $26f52cba0c3bfe9e$export$2110ac352bb060b9, (v) => $26f52cba0c3bfe9e$export$2110ac352bb060b9 = v); +$parcel$export(module.exports, "isMemo", () => $26f52cba0c3bfe9e$export$56885ab8b9c456ab, (v) => $26f52cba0c3bfe9e$export$56885ab8b9c456ab = v); +$parcel$export(module.exports, "isPortal", () => $26f52cba0c3bfe9e$export$d927fcb6adf8f9de, (v) => $26f52cba0c3bfe9e$export$d927fcb6adf8f9de = v); +$parcel$export(module.exports, "isProfiler", () => $26f52cba0c3bfe9e$export$b82d16f27459e05a, (v) => $26f52cba0c3bfe9e$export$b82d16f27459e05a = v); +$parcel$export(module.exports, "isStrictMode", () => $26f52cba0c3bfe9e$export$522c17b4f5e123e8, (v) => $26f52cba0c3bfe9e$export$522c17b4f5e123e8 = v); +$parcel$export(module.exports, "isSuspense", () => $26f52cba0c3bfe9e$export$1aabd8a0274ecfd6, (v) => $26f52cba0c3bfe9e$export$1aabd8a0274ecfd6 = v); +$parcel$export(module.exports, "isSuspenseList", () => $26f52cba0c3bfe9e$export$3d6c20d97e46b957, (v) => $26f52cba0c3bfe9e$export$3d6c20d97e46b957 = v); +$parcel$export(module.exports, "isValidElementType", () => $26f52cba0c3bfe9e$export$9b621391a187a31a, (v) => $26f52cba0c3bfe9e$export$9b621391a187a31a = v); +$parcel$export(module.exports, "typeOf", () => $26f52cba0c3bfe9e$export$f5bbd400c2f4426f, (v) => $26f52cba0c3bfe9e$export$f5bbd400c2f4426f = v); +/** + * @license React + * react-is.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ var $26f52cba0c3bfe9e$export$a7c73072b1a182ae; +var $26f52cba0c3bfe9e$export$9f27bc3417b4524d; +var $26f52cba0c3bfe9e$export$db77ccec0bb4ccac; +var $26f52cba0c3bfe9e$export$8392c0c9d3dcbd35; +var $26f52cba0c3bfe9e$export$ffb0004e005737fa; +var $26f52cba0c3bfe9e$export$b624eff549462981; +var $26f52cba0c3bfe9e$export$7897aa7841a5380c; +var $26f52cba0c3bfe9e$export$602eac185826482c; +var $26f52cba0c3bfe9e$export$e2c29f18771995cb; +var $26f52cba0c3bfe9e$export$5f8d39834fd61797; +var $26f52cba0c3bfe9e$export$74bf444e3cd11ea5; +var $26f52cba0c3bfe9e$export$998bcd577473dd93; +var $26f52cba0c3bfe9e$export$92387174baf9b227; +var $26f52cba0c3bfe9e$export$ec112efeb987d9c6; +var $26f52cba0c3bfe9e$export$b706b080d889d2c9; +var $26f52cba0c3bfe9e$export$5be5a87408f70ddc; +var $26f52cba0c3bfe9e$export$45a5e7f76e0caa8d; +var $26f52cba0c3bfe9e$export$455c2e768291efa6; +var $26f52cba0c3bfe9e$export$9522e17588c12572; +var $26f52cba0c3bfe9e$export$2110ac352bb060b9; +var $26f52cba0c3bfe9e$export$56885ab8b9c456ab; +var $26f52cba0c3bfe9e$export$d927fcb6adf8f9de; +var $26f52cba0c3bfe9e$export$b82d16f27459e05a; +var $26f52cba0c3bfe9e$export$522c17b4f5e123e8; +var $26f52cba0c3bfe9e$export$1aabd8a0274ecfd6; +var $26f52cba0c3bfe9e$export$3d6c20d97e46b957; +var $26f52cba0c3bfe9e$export$9b621391a187a31a; +var $26f52cba0c3bfe9e$export$f5bbd400c2f4426f; +"use strict"; +var $26f52cba0c3bfe9e$var$b = Symbol.for("react.element"), $26f52cba0c3bfe9e$var$c = Symbol.for("react.portal"), $26f52cba0c3bfe9e$var$d = Symbol.for("react.fragment"), $26f52cba0c3bfe9e$var$e = Symbol.for("react.strict_mode"), $26f52cba0c3bfe9e$var$f = Symbol.for("react.profiler"), $26f52cba0c3bfe9e$var$g = Symbol.for("react.provider"), $26f52cba0c3bfe9e$var$h = Symbol.for("react.context"), $26f52cba0c3bfe9e$var$k = Symbol.for("react.server_context"), $26f52cba0c3bfe9e$var$l = Symbol.for("react.forward_ref"), $26f52cba0c3bfe9e$var$m = Symbol.for("react.suspense"), $26f52cba0c3bfe9e$var$n = Symbol.for("react.suspense_list"), $26f52cba0c3bfe9e$var$p = Symbol.for("react.memo"), $26f52cba0c3bfe9e$var$q = Symbol.for("react.lazy"), $26f52cba0c3bfe9e$var$t = Symbol.for("react.offscreen"), $26f52cba0c3bfe9e$var$u; +$26f52cba0c3bfe9e$var$u = Symbol.for("react.module.reference"); +function $26f52cba0c3bfe9e$var$v(a) { + if ("object" === typeof a && null !== a) { + var r = a.$$typeof; + switch(r){ + case $26f52cba0c3bfe9e$var$b: + switch(a = a.type, a){ + case $26f52cba0c3bfe9e$var$d: + case $26f52cba0c3bfe9e$var$f: + case $26f52cba0c3bfe9e$var$e: + case $26f52cba0c3bfe9e$var$m: + case $26f52cba0c3bfe9e$var$n: + return a; + default: + switch(a = a && a.$$typeof, a){ + case $26f52cba0c3bfe9e$var$k: + case $26f52cba0c3bfe9e$var$h: + case $26f52cba0c3bfe9e$var$l: + case $26f52cba0c3bfe9e$var$q: + case $26f52cba0c3bfe9e$var$p: + case $26f52cba0c3bfe9e$var$g: + return a; + default: + return r; + } + } + case $26f52cba0c3bfe9e$var$c: + return r; + } + } +} +$26f52cba0c3bfe9e$export$a7c73072b1a182ae = $26f52cba0c3bfe9e$var$h; +$26f52cba0c3bfe9e$export$9f27bc3417b4524d = $26f52cba0c3bfe9e$var$g; +$26f52cba0c3bfe9e$export$db77ccec0bb4ccac = $26f52cba0c3bfe9e$var$b; +$26f52cba0c3bfe9e$export$8392c0c9d3dcbd35 = $26f52cba0c3bfe9e$var$l; +$26f52cba0c3bfe9e$export$ffb0004e005737fa = $26f52cba0c3bfe9e$var$d; +$26f52cba0c3bfe9e$export$b624eff549462981 = $26f52cba0c3bfe9e$var$q; +$26f52cba0c3bfe9e$export$7897aa7841a5380c = $26f52cba0c3bfe9e$var$p; +$26f52cba0c3bfe9e$export$602eac185826482c = $26f52cba0c3bfe9e$var$c; +$26f52cba0c3bfe9e$export$e2c29f18771995cb = $26f52cba0c3bfe9e$var$f; +$26f52cba0c3bfe9e$export$5f8d39834fd61797 = $26f52cba0c3bfe9e$var$e; +$26f52cba0c3bfe9e$export$74bf444e3cd11ea5 = $26f52cba0c3bfe9e$var$m; +$26f52cba0c3bfe9e$export$998bcd577473dd93 = $26f52cba0c3bfe9e$var$n; +$26f52cba0c3bfe9e$export$92387174baf9b227 = function() { + return !1; +}; +$26f52cba0c3bfe9e$export$ec112efeb987d9c6 = function() { + return !1; +}; +$26f52cba0c3bfe9e$export$b706b080d889d2c9 = function(a) { + return $26f52cba0c3bfe9e$var$v(a) === $26f52cba0c3bfe9e$var$h; +}; +$26f52cba0c3bfe9e$export$5be5a87408f70ddc = function(a) { + return $26f52cba0c3bfe9e$var$v(a) === $26f52cba0c3bfe9e$var$g; +}; +$26f52cba0c3bfe9e$export$45a5e7f76e0caa8d = function(a) { + return "object" === typeof a && null !== a && a.$$typeof === $26f52cba0c3bfe9e$var$b; +}; +$26f52cba0c3bfe9e$export$455c2e768291efa6 = function(a) { + return $26f52cba0c3bfe9e$var$v(a) === $26f52cba0c3bfe9e$var$l; +}; +$26f52cba0c3bfe9e$export$9522e17588c12572 = function(a) { + return $26f52cba0c3bfe9e$var$v(a) === $26f52cba0c3bfe9e$var$d; +}; +$26f52cba0c3bfe9e$export$2110ac352bb060b9 = function(a) { + return $26f52cba0c3bfe9e$var$v(a) === $26f52cba0c3bfe9e$var$q; +}; +$26f52cba0c3bfe9e$export$56885ab8b9c456ab = function(a) { + return $26f52cba0c3bfe9e$var$v(a) === $26f52cba0c3bfe9e$var$p; +}; +$26f52cba0c3bfe9e$export$d927fcb6adf8f9de = function(a) { + return $26f52cba0c3bfe9e$var$v(a) === $26f52cba0c3bfe9e$var$c; +}; +$26f52cba0c3bfe9e$export$b82d16f27459e05a = function(a) { + return $26f52cba0c3bfe9e$var$v(a) === $26f52cba0c3bfe9e$var$f; +}; +$26f52cba0c3bfe9e$export$522c17b4f5e123e8 = function(a) { + return $26f52cba0c3bfe9e$var$v(a) === $26f52cba0c3bfe9e$var$e; +}; +$26f52cba0c3bfe9e$export$1aabd8a0274ecfd6 = function(a) { + return $26f52cba0c3bfe9e$var$v(a) === $26f52cba0c3bfe9e$var$m; +}; +$26f52cba0c3bfe9e$export$3d6c20d97e46b957 = function(a) { + return $26f52cba0c3bfe9e$var$v(a) === $26f52cba0c3bfe9e$var$n; +}; +$26f52cba0c3bfe9e$export$9b621391a187a31a = function(a) { + return "string" === typeof a || "function" === typeof a || a === $26f52cba0c3bfe9e$var$d || a === $26f52cba0c3bfe9e$var$f || a === $26f52cba0c3bfe9e$var$e || a === $26f52cba0c3bfe9e$var$m || a === $26f52cba0c3bfe9e$var$n || a === $26f52cba0c3bfe9e$var$t || "object" === typeof a && null !== a && (a.$$typeof === $26f52cba0c3bfe9e$var$q || a.$$typeof === $26f52cba0c3bfe9e$var$p || a.$$typeof === $26f52cba0c3bfe9e$var$g || a.$$typeof === $26f52cba0c3bfe9e$var$h || a.$$typeof === $26f52cba0c3bfe9e$var$l || a.$$typeof === $26f52cba0c3bfe9e$var$u || void 0 !== a.getModuleId) ? !0 : !1; +}; +$26f52cba0c3bfe9e$export$f5bbd400c2f4426f = $26f52cba0c3bfe9e$var$v; + +}); + + +parcelRegister("jybpY", function(module, exports) { + +$parcel$export(module.exports, "compute", () => $e3ba0ca71cdd5b1d$export$3b12cb22b12b954b); +const $e3ba0ca71cdd5b1d$var$t = (t)=>"object" == typeof t && null != t && 1 === t.nodeType, $e3ba0ca71cdd5b1d$var$e = (t, e)=>(!e || "hidden" !== t) && "visible" !== t && "clip" !== t, $e3ba0ca71cdd5b1d$var$n = (t, n)=>{ + if (t.clientHeight < t.scrollHeight || t.clientWidth < t.scrollWidth) { + const o = getComputedStyle(t, null); + return $e3ba0ca71cdd5b1d$var$e(o.overflowY, n) || $e3ba0ca71cdd5b1d$var$e(o.overflowX, n) || ((t)=>{ + const e = ((t)=>{ + if (!t.ownerDocument || !t.ownerDocument.defaultView) return null; + try { + return t.ownerDocument.defaultView.frameElement; + } catch (t) { + return null; + } + })(t); + return !!e && (e.clientHeight < t.scrollHeight || e.clientWidth < t.scrollWidth); + })(t); + } + return !1; +}, $e3ba0ca71cdd5b1d$var$o = (t, e, n, o, l, r, i, s)=>r < t && i > e || r > t && i < e ? 0 : r <= t && s <= n || i >= e && s >= n ? r - t - o : i > e && s < n || r < t && s > n ? i - e + l : 0, $e3ba0ca71cdd5b1d$var$l = (t)=>{ + const e = t.parentElement; + return null == e ? t.getRootNode().host || null : e; +}, $e3ba0ca71cdd5b1d$export$3b12cb22b12b954b = (e, r)=>{ + var i, s, d, h; + if ("undefined" == typeof document) return []; + const { scrollMode: c, block: f, inline: u, boundary: a, skipOverflowHiddenElements: g } = r, p = "function" == typeof a ? a : (t)=>t !== a; + if (!$e3ba0ca71cdd5b1d$var$t(e)) throw new TypeError("Invalid target"); + const m = document.scrollingElement || document.documentElement, w = []; + let W = e; + for(; $e3ba0ca71cdd5b1d$var$t(W) && p(W);){ + if (W = $e3ba0ca71cdd5b1d$var$l(W), W === m) { + w.push(W); + break; + } + null != W && W === document.body && $e3ba0ca71cdd5b1d$var$n(W) && !$e3ba0ca71cdd5b1d$var$n(document.documentElement) || null != W && $e3ba0ca71cdd5b1d$var$n(W, g) && w.push(W); + } + const b = null != (s = null == (i = window.visualViewport) ? void 0 : i.width) ? s : innerWidth, H = null != (h = null == (d = window.visualViewport) ? void 0 : d.height) ? h : innerHeight, { scrollX: y, scrollY: M } = window, { height: v, width: E, top: x, right: C, bottom: I, left: R } = e.getBoundingClientRect(), { top: T, right: B, bottom: F, left: V } = ((t)=>{ + const e = window.getComputedStyle(t); + return { + top: parseFloat(e.scrollMarginTop) || 0, + right: parseFloat(e.scrollMarginRight) || 0, + bottom: parseFloat(e.scrollMarginBottom) || 0, + left: parseFloat(e.scrollMarginLeft) || 0 + }; + })(e); + let k = "start" === f || "nearest" === f ? x - T : "end" === f ? I + F : x + v / 2 - T + F, D = "center" === u ? R + E / 2 - V + B : "end" === u ? C + B : R - V; + const L = []; + for(let t = 0; t < w.length; t++){ + const e = w[t], { height: n, width: l, top: r, right: i, bottom: s, left: d } = e.getBoundingClientRect(); + if ("if-needed" === c && x >= 0 && R >= 0 && I <= H && C <= b && x >= r && I <= s && R >= d && C <= i) return L; + const h = getComputedStyle(e), a = parseInt(h.borderLeftWidth, 10), g = parseInt(h.borderTopWidth, 10), p = parseInt(h.borderRightWidth, 10), W = parseInt(h.borderBottomWidth, 10); + let T = 0, B = 0; + const F = "offsetWidth" in e ? e.offsetWidth - e.clientWidth - a - p : 0, V = "offsetHeight" in e ? e.offsetHeight - e.clientHeight - g - W : 0, S = "offsetWidth" in e ? 0 === e.offsetWidth ? 0 : l / e.offsetWidth : 0, X = "offsetHeight" in e ? 0 === e.offsetHeight ? 0 : n / e.offsetHeight : 0; + if (m === e) T = "start" === f ? k : "end" === f ? k - H : "nearest" === f ? $e3ba0ca71cdd5b1d$var$o(M, M + H, H, g, W, M + k, M + k + v, v) : k - H / 2, B = "start" === u ? D : "center" === u ? D - b / 2 : "end" === u ? D - b : $e3ba0ca71cdd5b1d$var$o(y, y + b, b, a, p, y + D, y + D + E, E), T = Math.max(0, T + M), B = Math.max(0, B + y); + else { + T = "start" === f ? k - r - g : "end" === f ? k - s + W + V : "nearest" === f ? $e3ba0ca71cdd5b1d$var$o(r, s, n, g, W + V, k, k + v, v) : k - (r + n / 2) + V / 2, B = "start" === u ? D - d - a : "center" === u ? D - (d + l / 2) + F / 2 : "end" === u ? D - i + p + F : $e3ba0ca71cdd5b1d$var$o(d, i, l, a, p + F, D, D + E, E); + const { scrollLeft: t, scrollTop: h } = e; + T = 0 === X ? 0 : Math.max(0, Math.min(h + T / X, e.scrollHeight - n / X + V)), B = 0 === S ? 0 : Math.max(0, Math.min(t + B / S, e.scrollWidth - l / S + F)), k += h - T, D += t - B; + } + L.push({ + el: e, + top: T, + left: B + }); + } + return L; +}; + +}); + + + +parcelRegister("3KK1E", function(module, exports) { + +$parcel$export(module.exports, "CPText", () => CPText); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $j4Xk5 = parcelRequire("j4Xk5"); + +var $3lO1D = parcelRequire("3lO1D"); +const CPText = ({ name, prop, onChange, editCode, reset })=>{ + const local = (0, $4WfNn.useLocal)({ + value: "", + codeEditing: false + }); + (0, $63SH6.useEffect)(()=>{ + if (prop.value) try { + eval(`local.value = ${prop.valueBuilt}`); + } catch (e) {} + else local.value = ""; + local.render(); + }, [ + prop.value, + prop.valueBuilt + ]); + if (local.codeEditing || typeof local.value !== "string" || typeof prop.valueBuilt === "string" && !prop.valueBuilt.trim().startsWith('"')) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $3lO1D.CPCoded), { + editCode: ()=>{ + local.codeEditing = true; + local.render(); + editCode(()=>{ + local.codeEditing = false; + local.render(); + }); + }, + reset: reset + }); + return /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "border-l" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $j4Xk5.AutoHeightTextarea), { + value: local.value, + onChange: async (e11)=>{ + local.value = e11.currentTarget.value; + local.render(); + }, + onBlur: ()=>{ + onChange(`"${local.value}"`); + }, + onContextMenu: (e11)=>{ + e11.stopPropagation(); + }, + className: "flex-1 self-stretch font-mono border-2 border-transparent outline-none bg-transparent focus:bg-white focus:border-blue-500 border-slate-300 text-[10px] min-h-[25px] pt-[3px] pl-[3px]", + spellCheck: false + }) + ] + }); +}; + +}); + + +parcelRegister("4KU0E", function(module, exports) { + +$parcel$export(module.exports, "CPMaster", () => $1fdd159866d5939e$export$4352c995dfdcef6d); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $bTIRf = parcelRequire("bTIRf"); + +var $5NYeV = parcelRequire("5NYeV"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $6QgH2 = parcelRequire("6QgH2"); +const $1fdd159866d5939e$var$popover = { + name: "" +}; +const $1fdd159866d5939e$export$4352c995dfdcef6d = ({ mitem: mitem })=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + const local = (0, $4WfNn.useLocal)({ + id: mitem.get("id") || "", + ready: false + }); + (0, $63SH6.useEffect)(()=>{ + const pitem = mitem.toJSON(); + if (pitem.type === "text") { + if (p.comp && meta?.parent_comp) { + const nmeta = meta.parent_comp; + p.item.active = nmeta.item.id; + p.item.activeOriginalId = nmeta.item.id; + if (nmeta.item.originalId) p.item.activeOriginalId = nmeta.item.originalId; + localStorage.setItem("prasi-item-active-oid", p.item.activeOriginalId); + localStorage.setItem("prasi-item-active-id", p.item.active); + } + if (document.activeElement) document.activeElement.blur(); + local.id = p.item.active; + p.compProp.edit = true; + p.render(); + } else if (local.id !== mitem.get("id")) { + p.compProp.edit = false; + p.render(); + } + }, [ + mitem + ]); + if (!p.comp) return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex flex-col flex-1 p-3", + children: "No Active Component" + }); + const meta = p.treeMeta[p.comp.instance_id || ""]; + if (!meta) return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex flex-col flex-1 p-3", + children: "Meta Not Found" + }); + if (!meta.comp) return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex flex-col flex-1 p-3", + children: "Meta Component Not Found" + }); + if (!meta.comp.mcomp) return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex flex-col flex-1 p-3", + children: "MComponent Not Found" + }); + const mprops = meta.comp.mcomp.get("component")?.get("props"); + if (!mprops) return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex flex-col flex-1 p-3", + children: "MProps Not Found" + }); + const props = mprops.toJSON(); + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex flex-col flex-1", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "border-b py-1 bg-white flex justify-between items-center", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex items-center", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "text-[11px] cursor-pointer select-none text-slate-400 pl-1 flex items-center", + onClick: ()=>{ + if (p.compProp.backToInstance) { + p.compProp.backToInstance = false; + (0, $5NYeV.closeEditComp)(p); + } + p.compProp.edit = false; + p.render(); + }, + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "11", + height: "11", + viewBox: "0 0 32 32", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + d: "M10 16L20 6l1.4 1.4-8.6 8.6 8.6 8.6L20 26z" + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: "Back" + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex cursor-pointer items-center border border-slate-500 bg-white rounded-sm text-[10px] px-[5px] m-1 opacity-50 hover:opacity-100", + onClick: ()=>{ + if (mprops) { + let idx = ""; + let name = "prop"; + while(mprops?.get(name)){ + idx = idx === "" ? 1 : idx + 1; + name = `prop_${idx}`; + } + mprops.set(name, (0, $6QgH2.newMap)({ + idx: Object.keys(mprops.toJSON()).length + 1, + name: name, + type: "string", + value: '"hello"', + valueBuilt: '"hello"', + meta: { + type: "text" + } + })); + } + }, + children: "Add" + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)($1fdd159866d5939e$export$9c6393e7aa57d12b, {}) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 relative overflow-y-auto", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "absolute flex-col inset-0", + children: [ + Object.entries(props).sort((a, b)=>{ + return a[1].idx - b[1].idx; + }).map(([name, prop])=>{ + const mprop = mprops?.get(name); + if (mprop) return /*#__PURE__*/ (0, $lAN3N.jsx)($1fdd159866d5939e$var$SingleProp, { + p: p, + name: name, + prop: prop, + props: props, + mprop: mprop + }, name); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {}); + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "p-2 flex items-center justify-center space-x-2", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "bg-white border rounded px-3 text-xs cursor-pointer hover:bg-blue-100 active:bg-blue-500 active:text-white", + onClick: ()=>{ + if (p.comp?.id) { + const props = p.comps.doc[p.comp.id].getMap("map").get("content_tree")?.get("component")?.get("props")?.toJSON(); + const str = JSON.stringify(props) + `_prasiprop`; + navigator.clipboard.writeText(str); + } + }, + children: "Copy All" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "bg-white border rounded px-3 text-xs cursor-pointer hover:bg-blue-100 active:bg-blue-500 active:text-white", + onClick: async ()=>{ + if (p.comp?.id) { + const props = p.comps.doc[p.comp.id].getMap("map").get("content_tree")?.get("component")?.get("props"); + let cp = await navigator.clipboard.readText(); + if (cp.endsWith("_prasiprop") && props) { + const cprops = JSON.parse(cp.substring(0, cp.length - `_prasiprop`.length)); + props.doc?.transact(()=>{ + for (const [k, v] of Object.entries(cprops)){ + const prop = (0, $6QgH2.newMap)({ + ...v, + name: k + }); + props?.set(k, prop); + } + }); + } + } + }, + children: "Paste" + }) + ] + }) + ] + }) + }) + ] + }); +}; +const $1fdd159866d5939e$export$9c6393e7aa57d12b = ()=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {}); +// const p = useGlobal(EditorGlobal, "EDITOR"); +// return ( +//
{ +// p.compProp.inherit = !p.compProp.inherit; +// p.render(); +// }} +// > +//
+// {p.compProp.inherit ? <>Prop Inherited : <>No Inheritance} +//
+//
+// {!p.compProp.inherit ? ( +// +// +// +// ) : ( +// +// +// +// )} +//
+//
+// ); +}; +const $1fdd159866d5939e$var$SingleProp = ({ p: p, name: name, prop: prop, mprop: mprop, props: props })=>{ + const local = (0, $4WfNn.useLocal)({ + name: name + }); + const type = prop.meta?.type || "text"; + return /*#__PURE__*/ (0, $lAN3N.jsx)($1fdd159866d5939e$var$SinglePopover, { + name: name, + p: p, + prop: prop, + mprop: mprop, + local: local, + props: props, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("border-b bg-white cursor-pointer hover:bg-orange-50 flex flex-col items-stretch"), + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex justify-between items-stretch flex-wrap", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("input", { + className: "outline-none border-r p-1 w-[30px] text-center", + value: prop.idx, + onClick: (e)=>{ + e.stopPropagation(); + e.currentTarget.select(); + }, + onFocus: (e)=>{ + e.stopPropagation(); + e.currentTarget.select(); + }, + onChange: (e)=>{ + prop.idx = parseInt(e.currentTarget.value) || 0; + local.render(); + }, + onBlur: (e)=>{ + mprop.set("idx", parseInt(e.currentTarget.value)); + } + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "p-1 flex flex-1 border-r justify-between items-center", + onClick: ()=>{ + $1fdd159866d5939e$var$popover.name = name; + local.render(); + }, + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: name + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-slate-500 text-xs", + children: { + option: "OPT", + text: "TXT", + "content-element": "JSX" + }[type] + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex p-1 hover:bg-red-500 hover:text-white items-center justify-center cursor-pointer", + onClick: (e)=>{ + e.preventDefault(); + e.stopPropagation(); + if (confirm("Are you sure ?")) { + const parent = mprop.parent; + parent.forEach((m, idx)=>{ + if (mprop === m) parent.delete(idx); + }); + } + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)($1fdd159866d5939e$var$Trash, {}) + }) + ] + }) + }) + }); +}; +const $1fdd159866d5939e$var$SinglePopover = ({ p: p, name: name, prop: prop, mprop: mprop, children: children, local: local, props: props })=>{ + const type = prop.meta?.type || "text"; + const mmeta = mprop.get("meta"); + const meta = prop.meta; + if (!mmeta || !meta) return null; + const args = {}; + for (const [k, v] of Object.entries(props))try { + if (v.valueBuilt || v.value) { + const fn = new Function(`return ${v.valueBuilt || v.value}`); + args[k] = fn(); + } + } catch (e) {} + const createEditScript = (mode)=>{ + return ()=>{ + p.script.active = true; + p.script.prop = { + mode: mode, + name: local.name + }; + p.script.onClose = ()=>{ + let i = 0; + p.compProp.edit = true; + $1fdd159866d5939e$var$popover.name = name; + p.render(); + const ival = setInterval(()=>{ + i++; + if (i > 10) clearInterval(ival); + p.compProp.edit = true; + $1fdd159866d5939e$var$popover.name = name; + p.render(); + }, 50); + }; + p.render(); + }; + }; + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bTIRf.Popover), { + children: children, + autoFocus: false, + backdrop: false, + placement: "left-start", + open: $1fdd159866d5939e$var$popover.name === name, + popoverClassName: "bg-white shadow-lg border border-slate-300", + onOpenChange: (open)=>{ + if (!open) setTimeout(()=>{ + $1fdd159866d5939e$var$popover.name = ""; + local.render(); + }, 100); + else { + $1fdd159866d5939e$var$popover.name = name; + local.render(); + } + }, + content: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex text-sm flex-col items-stretch space-y-1 py-1 w-[300px]", css` + textarea { + max-height: 300px; + } + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "px-2 py-1 flex space-x-1", + children: [ + { + label: "TXT", + type: "text" + }, + { + label: "OPT", + type: "option" + }, + { + label: "JSX", + type: "content-element" + } + ].map((e)=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx(type === e.type ? "bg-blue-500 text-white" : "hover:bg-blue-100", " px-2 cursor-pointer"), + onClick: ()=>{ + mmeta.set("type", e.type); + }, + children: e.label + }, e.type); + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "border-t border-slate-300 px-2 pt-2 pb-1 flex flex-col items-stretch", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "uppercase text-xs text-slate-500", + children: "Name" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("input", { + spellCheck: false, + type: "text", + className: "p-1 outline-none border focus:border-blue-500", + value: local.name, + onChange: (e)=>{ + local.name = e.currentTarget.value.toLowerCase().replace(/\W/gi, "_"); + local.render(); + }, + onBlur: ()=>{ + if (local.name !== name) { + const keys = Object.keys(mprop.parent?.toJSON()); + if ([ + ...keys, + ...$1fdd159866d5939e$var$keywords + ].includes(local.name)) { + alert(`Cannot use "${local.name}" as name`); + local.name = name; + local.render(); + return; + } + mprop.doc?.transact(()=>{ + const parent = mprop.parent; + parent.set(local.name, parent.get(name)?.clone()); + parent.delete(name); + }); + $1fdd159866d5939e$var$popover.name = local.name; + local.render(); + } + }, + onKeyDown: (e)=>{ + if (e.key === "Enter") e.currentTarget.blur(); + } + }) + ] + }), + type === "content-element" && /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "border-t border-slate-300 pl-2 pt-1 flex justify-between items-center", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "uppercase text-xs label self-stretch flex items-center", + children: "Visible" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "m-1 px-1 bg-white cursor-pointer hover:bg-blue-500 hover:text-white hover:border-blue-500 font-mono border border-slate-300 text-[11px]", + onClick: createEditScript("master-visible"), + children: "EDIT CODE" + }) + ] + }), + type !== "content-element" && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("border-t border-slate-300 pl-2 flex justify-between items-center", css` + margin-bottom: -0.25rem !important; + + > .label { + padding-top: 0.75rem; + padding-bottom: 0.75rem; + } + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "uppercase text-xs label self-stretch flex items-center", + children: "Generator" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "m-1 px-1 bg-white cursor-pointer hover:bg-blue-500 hover:text-white hover:border-blue-500 font-mono border border-slate-300 text-[11px] flex ", + onClick: createEditScript("master-gen"), + children: "EDIT CODE" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: " border-l border-slate-300 mr-2 self-stretch" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "uppercase text-xs label self-stretch flex items-center", + children: "Visible" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "m-1 px-1 bg-white cursor-pointer hover:bg-blue-500 hover:text-white hover:border-blue-500 font-mono border border-slate-300 text-[11px]", + onClick: createEditScript("master-visible"), + children: "EDIT CODE" + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "border-t border-slate-300 pl-2 pt-1 flex justify-between items-center", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "uppercase text-xs", + children: "VALUE" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "m-1 px-1 bg-white cursor-pointer hover:bg-blue-500 hover:text-white hover:border-blue-500 font-mono border border-slate-300 text-[11px]", + onClick: createEditScript("master-value"), + children: "EDIT CODE" + }) + ] + }) + ] + }), + type === "option" && /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "border-t border-slate-300 pl-2 pt-1 flex justify-between items-center select-none", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "uppercase text-xs", + children: "MODE" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex pr-1", + children: [ + "button", + "dropdown" + ].map((e)=>/*#__PURE__*/ (0, $lAN3N.jsx)("div", { + onClick: ()=>{ + const meta = mprop.get("meta"); + if (meta) meta.set("option_mode", e); + }, + className: cx("m-1 px-1 capitalize text-center cursor-pointer font-mono border border-slate-300 text-[11px]", e === prop.meta?.option_mode || e === "button" && !prop.meta?.option_mode ? "bg-blue-500 text-white" : `hover:bg-blue-500 hover:text-white bg-white hover:border-blue-500`), + children: e + }, e)) + }) + ] + }), + type === "option" && /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "border-t border-slate-300 pl-2 pt-1 flex justify-between items-center", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "uppercase text-xs", + children: "OPTIONS" + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "m-1 px-1 bg-white cursor-pointer hover:bg-blue-500 hover:text-white hover:border-blue-500 font-mono border border-slate-300 text-[11px]", + onClick: createEditScript("master-option"), + children: "EDIT CODE" + }) + ] + }) + ] + }) + }); +}; +const $1fdd159866d5939e$var$Trash = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: 13, + height: 13, + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M5.5 1a.5.5 0 000 1h4a.5.5 0 000-1h-4zM3 3.5a.5.5 0 01.5-.5h8a.5.5 0 010 1H11v8a1 1 0 01-1 1H5a1 1 0 01-1-1V4h-.5a.5.5 0 01-.5-.5zM5 4h5v8H5V4z", + clipRule: "evenodd" + }) + }); +const $1fdd159866d5939e$var$keywords = [ + "await", + "break", + "case", + "catch", + "class", + "const", + "continue", + "debugger", + "default", + "delete", + "do", + "else", + "enum", + "export", + "extends", + "false", + "finally", + "for", + "function", + "if", + "implements", + "import", + "in", + "instanceof", + "interface", + "let", + "new", + "null", + "package", + "private", + "protected", + "public", + "return", + "super", + "switch", + "static", + "this", + "throw", + "try", + "true", + "typeof", + "var", + "void", + "while", + "with", + "yield" +]; + +}); + +parcelRegister("bhjA3", function(module, exports) { + +$parcel$export(module.exports, "SideBox", () => $60c778b4666a80eb$export$262f8351f69854f4); + +var $lAN3N = parcelRequire("lAN3N"); +const $60c778b4666a80eb$export$262f8351f69854f4 = ({ children: children })=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex flex-col pb-2 px-2 space-y-2", + children: children + }); +}; + +}); + +parcelRegister("9ABAk", function(module, exports) { + +$parcel$export(module.exports, "SideLabel", () => $9ef92df658de1c26$export$2bf247a0a1771b67); + +var $lAN3N = parcelRequire("lAN3N"); +const $9ef92df658de1c26$export$2bf247a0a1771b67 = ({ children: children, sep: sep })=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx(sep === "bottom" ? "border-b border-b-slate-300 bg-white mb-1" : "border-t border-t-slate-300"), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-[10px] select-none text-slate-400 pl-2 py-1", + children: children + }) + }); +}; + +}); + + +})(); +//# sourceMappingURL=Side.fa071797.js.map diff --git a/app/web/static/all.2a032bf1.js b/app/web/static/all.2a032bf1.js new file mode 100644 index 00000000..cd5a26dc --- /dev/null +++ b/app/web/static/all.2a032bf1.js @@ -0,0 +1,41 @@ +(() => { + +function $parcel$defineInteropFlag(a) { + Object.defineProperty(a, '__esModule', {value: true, configurable: true}); +} + +function $parcel$export(e, n, v, s) { + Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); +} + + var $parcel$global = globalThis; + var parcelRequire = $parcel$global["parcelRequire2d1f"]; +var parcelRegister = parcelRequire.register; +parcelRegister("yJaD0", function(module, exports) { + +$parcel$defineInteropFlag(module.exports); + +$parcel$export(module.exports, "default", () => $01c3f730b1f50958$export$2e2bcd8739ae039); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $1CiVi = parcelRequire("1CiVi"); +var $01c3f730b1f50958$export$2e2bcd8739ae039 = (0, $4WfNn.page)({ + url: "**", + component: ({})=>{ + (0, $63SH6.useEffect)(()=>{ + if (localStorage.getItem("prasi-session")) navigate("/editor/"); + else navigate("/login"); + }, []); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), {}); + } +}); + +}); + +})(); +//# sourceMappingURL=all.2a032bf1.js.map diff --git a/app/web/static/comp-mgr.27b10bdd.js b/app/web/static/comp-mgr.27b10bdd.js new file mode 100644 index 00000000..4117ac6f --- /dev/null +++ b/app/web/static/comp-mgr.27b10bdd.js @@ -0,0 +1,873 @@ +(() => { + +function $parcel$export(e, n, v, s) { + Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); +} + + var $parcel$global = globalThis; + var parcelRequire = $parcel$global["parcelRequire2d1f"]; +var parcelRegister = parcelRequire.register; +parcelRegister("217yT", function(module, exports) { + +$parcel$export(module.exports, "CompManager", () => $9b3c4866e94c1896$export$37754299ffc77cc9); +$parcel$export(module.exports, "ChevronRight", () => $9b3c4866e94c1896$export$6172d85aadfc9b96); +$parcel$export(module.exports, "ChevronDown", () => $9b3c4866e94c1896$export$4e3778eb35f54199); +$parcel$export(module.exports, "ChevronLeft", () => $9b3c4866e94c1896$export$29ab0a58e0457c56); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $dCav9 = parcelRequire("dCav9"); + +var $1CiVi = parcelRequire("1CiVi"); + +var $5NYeV = parcelRequire("5NYeV"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $ldEjl = parcelRequire("ldEjl"); +const $9b3c4866e94c1896$var$w = window; +const $9b3c4866e94c1896$export$37754299ffc77cc9 = ()=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + if (!$9b3c4866e94c1896$var$w.compGroup) $9b3c4866e94c1896$var$w.compGroup = {}; + const local = (0, $4WfNn.useLocal)({ + loading: true, + group: $9b3c4866e94c1896$var$w.compGroup, + init: false, + edit_id: "", + selected_id: "", + renaming: { + id: "", + text: "" + }, + site_use: [], + searchRef: null, + trash_id: "", + collapsed: new Set(), + sharedPopup: false, + checked: new Set(), + site_use_loading: false + }); + (0, $63SH6.useEffect)(()=>{ + const f = (e)=>{ + if (e.key === "Escape" && document.activeElement?.tagName.toLowerCase() === "input") { + $9b3c4866e94c1896$var$w.compManagerSearch = ""; + local.render(); + } + if (local.searchRef && document.activeElement?.tagName.toLowerCase() !== "input") { + local.searchRef.value = ""; + local.searchRef.focus(); + } + }; + window.addEventListener("keydown", f); + return ()=>{ + window.removeEventListener("keydown", f); + }; + }, []); + const toggleCollapse = (id)=>{ + if (!local.collapsed.has(id)) local.collapsed.add(id); + else local.collapsed.delete(id); + local.render(); + }; + const reloadComps = async ()=>{ + if (Object.keys($9b3c4866e94c1896$var$w.compGroup).length > 0) { + local.loading = false; + local.group = $9b3c4866e94c1896$var$w.compGroup; + for (const g of Object.values(local.group))if (g.info.name === "__TRASH__") { + local.trash_id = g.info.id; + local.collapsed.add(g.info.id); + } + local.render(); + return; + } + if (p.site.id) { + local.loading = true; + local.site_use = (await db.site_use_comp.findMany({ + where: { + id_site: p.site.id + }, + select: { + use_id_site: true + } + })).map((e)=>e.use_id_site); + const group = await db.component_group.findMany({ + where: { + component_site: { + some: { + OR: [ + { + id_site: p.site.id + }, + ...local.site_use.map((e)=>({ + id_site: e, + component_group: { + name: { + not: "__TRASH__" + } + } + })) + ] + } + } + }, + select: { + name: true, + id: true, + shared: true, + component_site: { + select: { + is_owner: true + }, + where: { + id_site: p.site.id + } + } + } + }); + if (group) { + local.group = {}; + for (const g of group){ + if (g.name === "__TRASH__") { + local.trash_id = g.id; + local.collapsed.add(g.id); + } + local.group[g.id] = { + info: g, + shared: g.shared, + isOwner: !!g.component_site[0]?.is_owner, + comps: [] + }; + } + } + const group_ids = Object.keys(local.group); + if (group_ids.length > 0) { + const comps = await db.component.findMany({ + where: { + id_component_group: { + in: group_ids + } + }, + select: { + id: true, + id_component_group: true, + name: true + } + }); + for (const comp of comps){ + const gid = comp.id_component_group; + if (gid && local.group[gid]) local.group[gid].comps.push(comp); + } + } + local.loading = false; + $9b3c4866e94c1896$var$w.compGroup = local.group; + local.render(); + } + }; + if (!local.init) { + local.init = true; + reloadComps(); + } + const boxClass = "flex flex-col items-start w-[192px] p-2 text-sm border cursor-pointer hover:bg-blue-100 ml-1 mb-1"; + let groups = Object.values(local.group).sort((a, b)=>{ + const aname = a.info.name === "__TRASH__" ? "zzzTRASHzzz" : a.info.name; + const bname = b.info.name === "__TRASH__" ? "zzzTRASHzzz" : b.info.name; + return aname.localeCompare(bname); + }); + if ($9b3c4866e94c1896$var$w.compManagerSearch) groups = [ + ...groups + ].filter((g)=>{ + let count = 0; + g.comps.forEach((e)=>{ + const name = e.name.toLowerCase(); + const id = e.id.toLowerCase(); + if (name.includes($9b3c4866e94c1896$var$w.compManagerSearch.toLowerCase()) || id.includes($9b3c4866e94c1896$var$w.compManagerSearch.toLowerCase())) { + count++; + return true; + } + return false; + }); + return count > 0; + }); + return /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "fixed inset-0 bg-black bg-opacity-10 cursor-pointer", + onClick: ()=>{ + p.manager.comp = false; + p.manager.compCallback = ()=>{}; + p.render(); + } + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "fixed inset-[50px] bg-white shadow-2xl flex", + onClick: (e)=>{ + e.stopPropagation(); + e.preventDefault(); + }, + children: [ + local.loading ? /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex w-full h-full items-center justify-center", + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: "comp-mgr", + backdrop: false + }) + }) : /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("relative flex-1 flex", css` + contain: content; + overflow: auto; + + .complist { + contain: content; + overflow: auto; + } + `), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "fixed top-0 right-[20px] bg-white z-10 m-[8px] flex", + children: [ + local.checked.size > 0 && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "border text-xs flex items-center px-2 cursor-pointer mr-1", + onClick: ()=>{ + local.checked.clear(); + p.render(); + }, + children: "Unselect" + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "bg-red-500 text-white text-xs flex items-center px-2 cursor-pointer mr-1", + onClick: async ()=>{ + if (confirm("Delete component cannot be undone. Are you sure? ")) { + const totrash = []; + local.checked.forEach((e)=>{ + const [id, gid] = e.split("|"); + const idx = local.group[gid].comps.findIndex((e)=>e.id === id); + const comp = local.group[gid].comps[idx]; + if (idx >= 0) { + if (comp.id_component_group !== local.trash_id) totrash.push(comp.id); + } + }); + if (totrash.length > 0) { + if (!local.trash_id) { + const res = await db.component_group.create({ + data: { + name: "__TRASH__", + component_site: { + create: { + id_site: p.site?.id || "" + } + } + } + }); + local.trash_id = res.id; + } + if (local.trash_id) { + await db.component.updateMany({ + where: { + id: { + in: totrash + } + }, + data: { + id_component_group: local.trash_id + } + }); + $9b3c4866e94c1896$var$w.compGroup = {}; + local.checked.clear(); + await reloadComps(); + } + } + } + }, + children: [ + "Delete ", + local.checked.size, + " selected" + ] + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("input", { + type: "search", + value: $9b3c4866e94c1896$var$w.compManagerSearch || "", + ref: (e)=>{ + local.searchRef = e; + }, + onChange: (e)=>{ + $9b3c4866e94c1896$var$w.compManagerSearch = e.currentTarget.value; + local.render(); + }, + placeholder: "Search", + className: "border px-2 text-sm h-[26px] outline-none w-[150px] focus:border-blue-500 focus:w-[350px] transition-all" + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "comp-list flex-1 overflow-auto flex h-full flex-col space-y-2 select-none", + children: [ + !local.site_use.includes("9e34f31f-4ebd-4630-b61d-597045171ebb") && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex flex-col self-stretch mx-4 mt-3", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: " flex", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "border border-blue-400 text-sm px-3 cursor-pointer hover:bg-blue-200", + onClick: async ()=>{ + local.site_use_loading = true; + local.render(); + await db.site_use_comp.create({ + data: { + id_site: p.site.id, + use_id_site: "9e34f31f-4ebd-4630-b61d-597045171ebb" + } + }); + $9b3c4866e94c1896$var$w.compGroup = {}; + await reloadComps(); + local.site_use_loading = false; + local.render(); + }, + children: local.site_use_loading ? "Loading..." : "Attach Prasi UI" + }) + }) + }), + local.site_use.includes("9e34f31f-4ebd-4630-b61d-597045171ebb") && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex flex-col self-stretch mx-4 mt-3", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: " flex", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "border border-slate-400 text-sm px-3 cursor-pointer hover:bg-blue-200", + onClick: async ()=>{ + if (p.site.id) { + local.site_use_loading = true; + local.render(); + await db.site_use_comp.delete({ + where: { + id_site_use_id_site: { + id_site: p.site.id, + use_id_site: "9e34f31f-4ebd-4630-b61d-597045171ebb" + } + } + }); + $9b3c4866e94c1896$var$w.compGroup = {}; + await reloadComps(); + local.site_use_loading = false; + local.render(); + } + }, + children: local.site_use_loading ? "Loading..." : "Detach Prasi UI" + }) + }) + }), + groups.map((g)=>{ + return /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $63SH6.Fragment), { + children: [ + g.info.name === "__TRASH__" && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1" + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex flex-col border-b pt-1 pb-1", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("p-1 text-base flex items-center space-x-1", css` + .act { + display: none; + } + &:hover { + .act { + display: flex; + } + } + `, g.info.name === "__TRASH__" && css` + .act { + display: none !important; + } + `), + children: local.renaming.id === g.info.id ? /*#__PURE__*/ (0, $lAN3N.jsx)("input", { + value: local.renaming.text, + onChange: (ev)=>{ + local.renaming.text = ev.currentTarget.value; + local.render(); + }, + className: "border px-1 text-sm", + autoFocus: true, + spellCheck: false, + onKeyDown: (e)=>{ + if (e.key === "Enter") e.currentTarget.blur(); + }, + onFocus: (e)=>{ + e.currentTarget.select(); + }, + onBlur: (e)=>{ + g.info.name = e.currentTarget.value; + local.renaming.id = ""; + local.render(); + db.component_group.update({ + where: { + id: g.info.id + }, + data: { + name: g.info.name + } + }); + } + }) : /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "cursor-pointer", + onClick: ()=>toggleCollapse(g.info.id), + children: local.collapsed.has(g.info.id) ? /*#__PURE__*/ (0, $lAN3N.jsx)($9b3c4866e94c1896$export$6172d85aadfc9b96, {}) : /*#__PURE__*/ (0, $lAN3N.jsx)($9b3c4866e94c1896$export$4e3778eb35f54199, {}) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "cursor-pointer", + onClick: ()=>toggleCollapse(g.info.id), + children: g.info.name === "__TRASH__" ? /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-slate-400 text-xs", + children: "Deleted Component" + }) : g.info.name + }), + g.shared && g.isOwner && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "cursor-pointer border ml-1 border-transparent bg-blue-500 text-white text-xs px-1 hover:bg-blue-100 hover:border-blue-500 hover:text-blue-600 flex items-center h-[20px]", + onClick: async ()=>{ + g.shared = false; + db.component_group.update({ + where: { + id: g.info.id + }, + data: { + shared: g.shared + } + }); + local.render(); + }, + children: "Public" + }), + !g.shared && g.isOwner && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "act cursor-pointer ml-1 border text-xs px-1 hover:bg-blue-100 hover:border-blue-500 hover:text-blue-600 flex items-center h-[20px]", + onClick: async ()=>{ + g.shared = true; + db.component_group.update({ + where: { + id: g.info.id + }, + data: { + shared: g.shared + } + }); + local.render(); + }, + children: "Share" + }), + g.isOwner && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "act cursor-pointer border flex items-center hover:bg-blue-100 hover:border-blue-500 hover:text-blue-600 px-1 h-[20px]", + onClick: ()=>{ + local.renaming.id = g.info.id; + local.renaming.text = g.info.name; + local.render(); + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)($9b3c4866e94c1896$var$Rename, {}) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "act cursor-pointer border text-xs px-1 hover:bg-blue-100 hover:border-blue-500 hover:text-blue-600 flex items-center h-[20px]", + onClick: async ()=>{ + const name = prompt(`New Group Name:`); + if (name) { + const res = await db.component_group.create({ + data: { + component_site: { + create: { + id_site: p.site?.id || "" + } + }, + name: name + } + }); + if (res) { + local.group[res.id] = { + comps: [], + shared: false, + isOwner: true, + info: res + }; + local.render(); + } + } + }, + children: "New" + }), + g.comps.length === 0 && /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "act cursor-pointer border text-xs px-1 hover:bg-red-100 hover:border-red-500 hover:text-red-600 flex items-center h-[20px]", + onClick: async ()=>{ + if (confirm("Are you sure ?")) { + delete local.group[g.info.id]; + local.render(); + await db.component_site.delete({ + where: { + id_component_group_id_site: { + id_component_group: g.info.id, + id_site: p.site?.id || "" + } + } + }); + } + }, + children: "Del" + }) + ] + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("flex items-start flex-wrap pl-[10px]", local.collapsed.has(g.info.id) && "hidden"), + children: g.comps.map((e, idx)=>{ + const name = e.name.toLowerCase(); + const id = e.id.toLowerCase(); + if ($9b3c4866e94c1896$var$w.compManagerSearch && !name.includes($9b3c4866e94c1896$var$w.compManagerSearch.toLowerCase()) && !id.includes($9b3c4866e94c1896$var$w.compManagerSearch.toLowerCase())) return null; + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx(boxClass, "justify-between transition-all relative", local.selected_id === e.id ? "border-blue-500 bg-blue-100" : "hover:border-blue-500", css` + .edit { + display: none; + } + + &:hover { + .edit { + display: flex; + } + .pick { + opacity: 1; + } + } + `), + onClick: ()=>{ + local.selected_id = e.id; + local.render(); + }, + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("absolute top-0 right-0 flex items-center justify-center w-[20px] h-[20px] border border-r-0 border-t-0", local.checked.has(`${e.id}|${g.info.id}`) ? "bg-blue-500 text-white border-blue-500" : "bg-white hover:border-blue-500"), + onClick: (ev)=>{ + ev.stopPropagation(); + ev.preventDefault(); + if (local.checked.has(`${e.id}|${g.info.id}`)) local.checked.delete(`${e.id}|${g.info.id}`); + else local.checked.add(`${e.id}|${g.info.id}`); + p.render(); + }, + children: local.checked.has(`${e.id}|${g.info.id}`) && /*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "15", + height: "15", + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M11.467 3.727c.289.189.37.576.181.865l-4.25 6.5a.625.625 0 01-.944.12l-2.75-2.5a.625.625 0 01.841-.925l2.208 2.007 3.849-5.886a.625.625 0 01.865-.181z", + clipRule: "evenodd" + }) + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex flex-col", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: e.name + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "text-slate-400 text-[10px]", + children: e.id + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex mt-1 justify-between self-stretch", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex flex-1 justify-between space-x-1 mr-1", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "pick opacity-10 transition-all bg-blue-500 text-white px-2", + onClick: ()=>{ + p.manager.comp = false; + if (typeof p.manager.compCallback === "function") { + p.manager.compCallback(e); + p.manager.compCallback = ()=>{}; + p.render(); + } + }, + children: p.manager.compActionLabel + }) + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + onClick: (ev)=>{ + ev.preventDefault(); + ev.stopPropagation(); + }, + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $dCav9.Dropdown), { + value: g.info.id, + items: groups.filter((e)=>e.info.name !== "__TRASH__").map((e)=>{ + return { + label: e.info.name, + value: e.info.id + }; + }), + onChange: (v)=>{ + local.group[v].comps.push(e); + g.comps.splice(idx, 1); + local.render(); + db.component.update({ + where: { + id: e.id + }, + data: { + id_component_group: v + }, + select: { + id: true + } + }); + }, + className: "max-w-[30px] overflow-hidden border", + popover: { + className: "text-sm" + } + }) + }) + ] + }) + ] + }, e.id); + }) + }) + ] + }) + ] + }, g.info.id); + }) + ] + }) + ] + }), + local.selected_id && /*#__PURE__*/ (0, $lAN3N.jsx)($9b3c4866e94c1896$var$CompPreview, { + comp_id: local.selected_id, + onClose: ()=>{ + local.selected_id = ""; + local.render(); + }, + opt: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("edit bg-red-200 hover:bg-red-500 transition-all px-3 rounded-sm text-sm text-white cursor-pointer"), + onClick: async (ev)=>{ + if (confirm("Are you sure ?")) { + if (!local.trash_id) { + const res = await db.component_group.create({ + data: { + name: "__TRASH__", + component_site: { + create: { + id_site: p.site?.id || "" + } + } + } + }); + local.trash_id = res.id; + } + if (local.trash_id) { + await db.component.update({ + where: { + id: local.selected_id + }, + data: { + id_component_group: local.trash_id + }, + select: { + id: true + } + }); + $9b3c4866e94c1896$var$w.compGroup = {}; + await reloadComps(); + } + } + }, + children: "Delete" + }) + }) + }) + ] + }) + ] + }); +}; +const $9b3c4866e94c1896$var$CompPreview = ({ comp_id: comp_id, onClose: onClose, opt: opt })=>{ + const local = (0, $4WfNn.useLocal)({ + name: "", + comp: null + }); + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + const comp = p.comps.doc[comp_id]; + p.manager.compPreviewRendered = new Set(); + if (comp) { + local.comp = comp.getMap("map").get("content_tree")?.toJSON(); + if (local.comp) local.name = local.comp.name; + } else (0, $5NYeV.loadComponent)(p, comp_id).then(()=>{ + local.render(); + }); + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "border-l w-[35%] transition-all flex flex-col", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "border-b p-2 flex justify-between items-center", + children: [ + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: "flex items-center cursor-pointer", + onClick: onClose, + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)($9b3c4866e94c1896$export$29ab0a58e0457c56, {}), + local.name || "Component" + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + children: opt + }) + ] + }), + /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex flex-1 flex-col relative overflow-auto"), + children: [ + !local.comp && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: "comp-mgr-2", + backdrop: false + }), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx(css` + contain: content; + padding: 20px; + overflow: auto; + `, "flex items-center justify-center flex-1 flex-col "), + children: local.comp && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $ldEjl.CItem), { + item: local.comp, + comp_id: local.comp.component?.id || "" + }) + }) + ] + }) + ] + }); +}; +const $9b3c4866e94c1896$var$Rename = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + width: 12, + height: 12, + viewBox: "0 0 15 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + d: "M6.5 1C6.22386 1 6 1.22386 6 1.5C6 1.77614 6.22386 2 6.5 2C7.12671 2 7.45718 2.20028 7.65563 2.47812C7.8781 2.78957 8 3.28837 8 4V11C8 11.7116 7.8781 12.2104 7.65563 12.5219C7.45718 12.7997 7.12671 13 6.5 13C6.22386 13 6 13.2239 6 13.5C6 13.7761 6.22386 14 6.5 14C7.37329 14 8.04282 13.7003 8.46937 13.1031C8.47976 13.0886 8.48997 13.0739 8.5 13.0591C8.51003 13.0739 8.52024 13.0886 8.53063 13.1031C8.95718 13.7003 9.62671 14 10.5 14C10.7761 14 11 13.7761 11 13.5C11 13.2239 10.7761 13 10.5 13C9.87329 13 9.54282 12.7997 9.34437 12.5219C9.1219 12.2104 9 11.7116 9 11V4C9 3.28837 9.1219 2.78957 9.34437 2.47812C9.54282 2.20028 9.87329 2 10.5 2C10.7761 2 11 1.77614 11 1.5C11 1.22386 10.7761 1 10.5 1C9.62671 1 8.95718 1.29972 8.53063 1.89688C8.52024 1.91143 8.51003 1.92611 8.5 1.9409C8.48997 1.92611 8.47976 1.91143 8.46937 1.89688C8.04282 1.29972 7.37329 1 6.5 1ZM14 5H11V4H14C14.5523 4 15 4.44772 15 5V10C15 10.5523 14.5523 11 14 11H11V10H14V5ZM6 4V5H1L1 10H6V11H1C0.447715 11 0 10.5523 0 10V5C0 4.44772 0.447715 4 1 4H6Z", + fill: "currentColor", + fillRule: "evenodd", + clipRule: "evenodd" + }) + }); +const $9b3c4866e94c1896$var$chevronSize = 12; +const $9b3c4866e94c1896$export$6172d85aadfc9b96 = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: $9b3c4866e94c1896$var$chevronSize, + height: $9b3c4866e94c1896$var$chevronSize, + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M6.158 3.135a.5.5 0 01.707.023l3.75 4a.5.5 0 010 .684l-3.75 4a.5.5 0 11-.73-.684L9.566 7.5l-3.43-3.658a.5.5 0 01.023-.707z", + clipRule: "evenodd" + }) + }); +const $9b3c4866e94c1896$export$4e3778eb35f54199 = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: $9b3c4866e94c1896$var$chevronSize, + height: $9b3c4866e94c1896$var$chevronSize, + fill: "none", + viewBox: "0 0 15 15", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M3.135 6.158a.5.5 0 01.707-.023L7.5 9.565l3.658-3.43a.5.5 0 01.684.73l-4 3.75a.5.5 0 01-.684 0l-4-3.75a.5.5 0 01-.023-.707z", + clipRule: "evenodd" + }) + }); +const $9b3c4866e94c1896$export$29ab0a58e0457c56 = ()=>/*#__PURE__*/ (0, $lAN3N.jsx)("svg", { + xmlns: "http://www.w3.org/2000/svg", + width: "22", + height: "22", + viewBox: "0 0 24 24", + children: /*#__PURE__*/ (0, $lAN3N.jsx)("path", { + fill: "currentColor", + fillRule: "evenodd", + d: "M14 18l-6-6 6-6 1.4 1.4-4.6 4.6 4.6 4.6L14 18z" + }) + }); + +}); +parcelRegister("ldEjl", function(module, exports) { + +$parcel$export(module.exports, "CItem", () => $2208644e19f2843b$export$ad589f8a3bb81db9); + +var $lAN3N = parcelRequire("lAN3N"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $cc0Z8 = parcelRequire("cc0Z8"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $1CiVi = parcelRequire("1CiVi"); + +var $5NYeV = parcelRequire("5NYeV"); +const $2208644e19f2843b$export$ad589f8a3bb81db9 = ({ item: item, comp_id: comp_id })=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + const className = (0, $cc0Z8.produceCSS)(item, { + mode: p.mode + }); + const local = (0, $4WfNn.useLocal)({}); + if (p.manager.compPreviewRendered.has(item.id)) return null; + p.manager.compPreviewRendered.add(item.id); + if (item.component && item.component.id && item.component.id !== comp_id) { + if (!p.comps.doc[item.component.id] || !!p.comps.pending[item.component.id]) { + (0, $5NYeV.loadComponent)(p, item.component.id).then(()=>{ + local.render(); + }); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + backdrop: false + }); + } + if (p.comps.doc[item.component.id]) { + const citem = p.comps.doc[item.component.id].getMap("map").get("content_tree")?.toJSON(); + if (citem) return /*#__PURE__*/ (0, $lAN3N.jsx)($2208644e19f2843b$export$ad589f8a3bb81db9, { + item: citem, + comp_id: comp_id + }); + } + } + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: className, + children: item.childs.map((e)=>{ + if (e.type === "item") return /*#__PURE__*/ (0, $lAN3N.jsx)($2208644e19f2843b$export$ad589f8a3bb81db9, { + item: e, + comp_id: comp_id + }, e.id); + const className = (0, $cc0Z8.produceCSS)(e, { + mode: p.mode + }); + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: className, + dangerouslySetInnerHTML: { + __html: e.html + } + }, e.id); + }) + }); +}; + +}); + + +})(); +//# sourceMappingURL=comp-mgr.27b10bdd.js.map diff --git a/app/web/static/dist.f8eecf79.js b/app/web/static/dist.f8eecf79.js new file mode 100644 index 00000000..cdf332eb --- /dev/null +++ b/app/web/static/dist.f8eecf79.js @@ -0,0 +1,908 @@ +(() => { + +function $parcel$interopDefault(a) { + return a && a.__esModule ? a.default : a; +} + +function $parcel$export(e, n, v, s) { + Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); +} + + var $parcel$global = globalThis; + var parcelRequire = $parcel$global["parcelRequire2d1f"]; +var parcelRegister = parcelRequire.register; +parcelRegister("iE6Ol", function(module, exports) { + +$parcel$export(module.exports, "Editor", () => $eaec3a37b34baecc$export$7cda8d932e2f33c0); +$parcel$export(module.exports, "loader", () => (parcelRequire("id3Cn")).default); +parcelRequire("kNIee"); +var $id3Cn = parcelRequire("id3Cn"); + +var $63SH6 = parcelRequire("63SH6"); +var $eaec3a37b34baecc$var$le = { + wrapper: { + display: "flex", + position: "relative", + textAlign: "initial" + }, + fullWidth: { + width: "100%" + }, + hide: { + display: "none" + } +}, $eaec3a37b34baecc$var$v = $eaec3a37b34baecc$var$le; +var $eaec3a37b34baecc$var$ae = { + container: { + display: "flex", + height: "100%", + width: "100%", + justifyContent: "center", + alignItems: "center" + } +}, $eaec3a37b34baecc$var$Y = $eaec3a37b34baecc$var$ae; +function $eaec3a37b34baecc$var$Me({ children: e }) { + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("div", { + style: $eaec3a37b34baecc$var$Y.container + }, e); +} +var $eaec3a37b34baecc$var$Z = $eaec3a37b34baecc$var$Me; +var $eaec3a37b34baecc$var$$ = $eaec3a37b34baecc$var$Z; +function $eaec3a37b34baecc$var$Ee({ width: e, height: r, isEditorReady: n, loading: t, _ref: a, className: m, wrapperProps: E }) { + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("section", { + style: { + ...$eaec3a37b34baecc$var$v.wrapper, + width: e, + height: r + }, + ...E + }, !n && (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($eaec3a37b34baecc$var$$, null, t), (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement("div", { + ref: a, + style: { + ...$eaec3a37b34baecc$var$v.fullWidth, + ...!n && $eaec3a37b34baecc$var$v.hide + }, + className: m + })); +} +var $eaec3a37b34baecc$var$ee = $eaec3a37b34baecc$var$Ee; +var $eaec3a37b34baecc$var$H = (0, $63SH6.memo)($eaec3a37b34baecc$var$ee); +function $eaec3a37b34baecc$var$Ce(e) { + (0, $63SH6.useEffect)(e, []); +} +var $eaec3a37b34baecc$var$k = $eaec3a37b34baecc$var$Ce; +function $eaec3a37b34baecc$var$he(e, r, n = !0) { + let t = (0, $63SH6.useRef)(!0); + (0, $63SH6.useEffect)(t.current || !n ? ()=>{ + t.current = !1; + } : e, r); +} +var $eaec3a37b34baecc$var$l = $eaec3a37b34baecc$var$he; +function $eaec3a37b34baecc$var$D() {} +function $eaec3a37b34baecc$var$h(e, r, n, t) { + return $eaec3a37b34baecc$var$De(e, t) || $eaec3a37b34baecc$var$be(e, r, n, t); +} +function $eaec3a37b34baecc$var$De(e, r) { + return e.editor.getModel($eaec3a37b34baecc$var$te(e, r)); +} +function $eaec3a37b34baecc$var$be(e, r, n, t) { + return e.editor.createModel(r, n, t ? $eaec3a37b34baecc$var$te(e, t) : void 0); +} +function $eaec3a37b34baecc$var$te(e, r) { + return e.Uri.parse(r); +} +function $eaec3a37b34baecc$var$Oe({ original: e, modified: r, language: n, originalLanguage: t, modifiedLanguage: a, originalModelPath: m, modifiedModelPath: E, keepCurrentOriginalModel: g = !1, keepCurrentModifiedModel: N = !1, theme: x = "light", loading: P = "Loading...", options: y = {}, height: V = "100%", width: z = "100%", className: F, wrapperProps: j = {}, beforeMount: A = $eaec3a37b34baecc$var$D, onMount: q = $eaec3a37b34baecc$var$D }) { + let [M, O] = (0, $63SH6.useState)(!1), [T, s] = (0, $63SH6.useState)(!0), u = (0, $63SH6.useRef)(null), c = (0, $63SH6.useRef)(null), w = (0, $63SH6.useRef)(null), d = (0, $63SH6.useRef)(q), o = (0, $63SH6.useRef)(A), b = (0, $63SH6.useRef)(!1); + $eaec3a37b34baecc$var$k(()=>{ + let i = (0, $id3Cn.default).init(); + return i.then((f)=>(c.current = f) && s(!1)).catch((f)=>f?.type !== "cancelation" && console.error("Monaco initialization: error:", f)), ()=>u.current ? I() : i.cancel(); + }), $eaec3a37b34baecc$var$l(()=>{ + if (u.current && c.current) { + let i = u.current.getOriginalEditor(), f = $eaec3a37b34baecc$var$h(c.current, e || "", t || n || "text", m || ""); + f !== i.getModel() && i.setModel(f); + } + }, [ + m + ], M), $eaec3a37b34baecc$var$l(()=>{ + if (u.current && c.current) { + let i = u.current.getModifiedEditor(), f = $eaec3a37b34baecc$var$h(c.current, r || "", a || n || "text", E || ""); + f !== i.getModel() && i.setModel(f); + } + }, [ + E + ], M), $eaec3a37b34baecc$var$l(()=>{ + let i = u.current.getModifiedEditor(); + i.getOption(c.current.editor.EditorOption.readOnly) ? i.setValue(r || "") : r !== i.getValue() && (i.executeEdits("", [ + { + range: i.getModel().getFullModelRange(), + text: r || "", + forceMoveMarkers: !0 + } + ]), i.pushUndoStop()); + }, [ + r + ], M), $eaec3a37b34baecc$var$l(()=>{ + u.current?.getModel()?.original.setValue(e || ""); + }, [ + e + ], M), $eaec3a37b34baecc$var$l(()=>{ + let { original: i, modified: f } = u.current.getModel(); + c.current.editor.setModelLanguage(i, t || n || "text"), c.current.editor.setModelLanguage(f, a || n || "text"); + }, [ + n, + t, + a + ], M), $eaec3a37b34baecc$var$l(()=>{ + c.current?.editor.setTheme(x); + }, [ + x + ], M), $eaec3a37b34baecc$var$l(()=>{ + u.current?.updateOptions(y); + }, [ + y + ], M); + let L = (0, $63SH6.useCallback)(()=>{ + if (!c.current) return; + o.current(c.current); + let i = $eaec3a37b34baecc$var$h(c.current, e || "", t || n || "text", m || ""), f = $eaec3a37b34baecc$var$h(c.current, r || "", a || n || "text", E || ""); + u.current?.setModel({ + original: i, + modified: f + }); + }, [ + n, + r, + a, + e, + t, + m, + E + ]), U = (0, $63SH6.useCallback)(()=>{ + !b.current && w.current && (u.current = c.current.editor.createDiffEditor(w.current, { + automaticLayout: !0, + ...y + }), L(), c.current?.editor.setTheme(x), O(!0), b.current = !0); + }, [ + y, + x, + L + ]); + (0, $63SH6.useEffect)(()=>{ + M && d.current(u.current, c.current); + }, [ + M + ]), (0, $63SH6.useEffect)(()=>{ + !T && !M && U(); + }, [ + T, + M, + U + ]); + function I() { + let i = u.current?.getModel(); + g || i?.original?.dispose(), N || i?.modified?.dispose(), u.current?.dispose(); + } + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($eaec3a37b34baecc$var$H, { + width: z, + height: V, + isEditorReady: M, + loading: P, + _ref: w, + className: F, + wrapperProps: j + }); +} +var $eaec3a37b34baecc$var$ie = $eaec3a37b34baecc$var$Oe; +var $eaec3a37b34baecc$export$f95cfa31b5a0bc91 = (0, $63SH6.memo)($eaec3a37b34baecc$var$ie); +function $eaec3a37b34baecc$var$Pe() { + let [e, r] = (0, $63SH6.useState)((0, $id3Cn.default).__getMonacoInstance()); + return $eaec3a37b34baecc$var$k(()=>{ + let n; + return e || (n = (0, $id3Cn.default).init(), n.then((t)=>{ + r(t); + })), ()=>n?.cancel(); + }), e; +} +var $eaec3a37b34baecc$export$7c29dcfb1e21cfdd = $eaec3a37b34baecc$var$Pe; +function $eaec3a37b34baecc$var$He(e) { + let r = (0, $63SH6.useRef)(); + return (0, $63SH6.useEffect)(()=>{ + r.current = e; + }, [ + e + ]), r.current; +} +var $eaec3a37b34baecc$var$se = $eaec3a37b34baecc$var$He; +var $eaec3a37b34baecc$var$_ = new Map; +function $eaec3a37b34baecc$var$Ve({ defaultValue: e, defaultLanguage: r, defaultPath: n, value: t, language: a, path: m, theme: E = "light", line: g, loading: N = "Loading...", options: x = {}, overrideServices: P = {}, saveViewState: y = !0, keepCurrentModel: V = !1, width: z = "100%", height: F = "100%", className: j, wrapperProps: A = {}, beforeMount: q = $eaec3a37b34baecc$var$D, onMount: M = $eaec3a37b34baecc$var$D, onChange: O, onValidate: T = $eaec3a37b34baecc$var$D }) { + let [s, u] = (0, $63SH6.useState)(!1), [c, w] = (0, $63SH6.useState)(!0), d = (0, $63SH6.useRef)(null), o = (0, $63SH6.useRef)(null), b = (0, $63SH6.useRef)(null), L = (0, $63SH6.useRef)(M), U = (0, $63SH6.useRef)(q), I = (0, $63SH6.useRef)(), i = (0, $63SH6.useRef)(t), f = $eaec3a37b34baecc$var$se(m), Q = (0, $63SH6.useRef)(!1), B = (0, $63SH6.useRef)(!1); + $eaec3a37b34baecc$var$k(()=>{ + let p = (0, $id3Cn.default).init(); + return p.then((R)=>(d.current = R) && w(!1)).catch((R)=>R?.type !== "cancelation" && console.error("Monaco initialization: error:", R)), ()=>o.current ? pe() : p.cancel(); + }), $eaec3a37b34baecc$var$l(()=>{ + let p = $eaec3a37b34baecc$var$h(d.current, e || t || "", r || a || "", m || n || ""); + p !== o.current?.getModel() && (y && $eaec3a37b34baecc$var$_.set(f, o.current?.saveViewState()), o.current?.setModel(p), y && o.current?.restoreViewState($eaec3a37b34baecc$var$_.get(m))); + }, [ + m + ], s), $eaec3a37b34baecc$var$l(()=>{ + o.current?.updateOptions(x); + }, [ + x + ], s), $eaec3a37b34baecc$var$l(()=>{ + !o.current || t === void 0 || (o.current.getOption(d.current.editor.EditorOption.readOnly) ? o.current.setValue(t) : t !== o.current.getValue() && (B.current = !0, o.current.executeEdits("", [ + { + range: o.current.getModel().getFullModelRange(), + text: t, + forceMoveMarkers: !0 + } + ]), o.current.pushUndoStop(), B.current = !1)); + }, [ + t + ], s), $eaec3a37b34baecc$var$l(()=>{ + let p = o.current?.getModel(); + p && a && d.current?.editor.setModelLanguage(p, a); + }, [ + a + ], s), $eaec3a37b34baecc$var$l(()=>{ + g !== void 0 && o.current?.revealLine(g); + }, [ + g + ], s), $eaec3a37b34baecc$var$l(()=>{ + d.current?.editor.setTheme(E); + }, [ + E + ], s); + let X = (0, $63SH6.useCallback)(()=>{ + if (!(!b.current || !d.current) && !Q.current) { + U.current(d.current); + let p = m || n, R = $eaec3a37b34baecc$var$h(d.current, t || e || "", r || a || "", p || ""); + o.current = d.current?.editor.create(b.current, { + model: R, + automaticLayout: !0, + ...x + }, P), y && o.current.restoreViewState($eaec3a37b34baecc$var$_.get(p)), d.current.editor.setTheme(E), g !== void 0 && o.current.revealLine(g), u(!0), Q.current = !0; + } + }, [ + e, + r, + n, + t, + a, + m, + x, + P, + y, + E, + g + ]); + (0, $63SH6.useEffect)(()=>{ + s && L.current(o.current, d.current); + }, [ + s + ]), (0, $63SH6.useEffect)(()=>{ + !c && !s && X(); + }, [ + c, + s, + X + ]), i.current = t, (0, $63SH6.useEffect)(()=>{ + s && O && (I.current?.dispose(), I.current = o.current?.onDidChangeModelContent((p)=>{ + B.current || O(o.current.getValue(), p); + })); + }, [ + s, + O + ]), (0, $63SH6.useEffect)(()=>{ + if (s) { + let p = d.current.editor.onDidChangeMarkers((R)=>{ + let G = o.current.getModel()?.uri; + if (G && R.find((J)=>J.path === G.path)) { + let J = d.current.editor.getModelMarkers({ + resource: G + }); + T?.(J); + } + }); + return ()=>{ + p?.dispose(); + }; + } + return ()=>{}; + }, [ + s, + T + ]); + function pe() { + I.current?.dispose(), V ? y && $eaec3a37b34baecc$var$_.set(m, o.current.saveViewState()) : o.current.getModel()?.dispose(), o.current.dispose(); + } + return (0, (/*@__PURE__*/$parcel$interopDefault($63SH6))).createElement($eaec3a37b34baecc$var$H, { + width: z, + height: F, + isEditorReady: s, + loading: N, + _ref: b, + className: j, + wrapperProps: A + }); +} +var $eaec3a37b34baecc$var$fe = $eaec3a37b34baecc$var$Ve; +var $eaec3a37b34baecc$export$7cda8d932e2f33c0 = (0, $63SH6.memo)($eaec3a37b34baecc$var$fe); +var $eaec3a37b34baecc$export$2e2bcd8739ae039 = $eaec3a37b34baecc$export$7cda8d932e2f33c0; + +}); +parcelRegister("kNIee", function(module, exports) { + +$parcel$export(module.exports, "default", () => (parcelRequire("id3Cn")).default); + +var $id3Cn = parcelRequire("id3Cn"); + +}); +parcelRegister("id3Cn", function(module, exports) { + +$parcel$export(module.exports, "default", () => $d41c3f5279aed058$export$2e2bcd8739ae039); + +var $3EaYc = parcelRequire("3EaYc"); + +var $dxZFf = parcelRequire("dxZFf"); + +var $bJBBE = parcelRequire("bJBBE"); + +var $2Nb9B = parcelRequire("2Nb9B"); + +var $rWuFh = parcelRequire("rWuFh"); + +var $936KQ = parcelRequire("936KQ"); + +var $8QzCV = parcelRequire("8QzCV"); +/** the local state of the module */ var $d41c3f5279aed058$var$_state$create = (0, $dxZFf.default).create({ + config: (0, $bJBBE.default), + isInitialized: false, + resolve: null, + reject: null, + monaco: null +}), $d41c3f5279aed058$var$_state$create2 = (0, $3EaYc.slicedToArray)($d41c3f5279aed058$var$_state$create, 2), $d41c3f5279aed058$var$getState = $d41c3f5279aed058$var$_state$create2[0], $d41c3f5279aed058$var$setState = $d41c3f5279aed058$var$_state$create2[1]; +/** + * set the loader configuration + * @param {Object} config - the configuration object + */ function $d41c3f5279aed058$var$config(globalConfig) { + var _validators$config = (0, $2Nb9B.default).config(globalConfig), monaco = _validators$config.monaco, config = (0, $3EaYc.objectWithoutProperties)(_validators$config, [ + "monaco" + ]); + $d41c3f5279aed058$var$setState(function(state) { + return { + config: (0, $936KQ.default)(state.config, config), + monaco: monaco + }; + }); +} +/** + * handles the initialization of the monaco-editor + * @return {Promise} - returns an instance of monaco (with a cancelable promise) + */ function $d41c3f5279aed058$var$init() { + var state = $d41c3f5279aed058$var$getState(function(_ref) { + var monaco = _ref.monaco, isInitialized = _ref.isInitialized, resolve = _ref.resolve; + return { + monaco: monaco, + isInitialized: isInitialized, + resolve: resolve + }; + }); + if (!state.isInitialized) { + $d41c3f5279aed058$var$setState({ + isInitialized: true + }); + if (state.monaco) { + state.resolve(state.monaco); + return (0, $8QzCV.default)($d41c3f5279aed058$var$wrapperPromise); + } + if (window.monaco && window.monaco.editor) { + $d41c3f5279aed058$var$storeMonacoInstance(window.monaco); + state.resolve(window.monaco); + return (0, $8QzCV.default)($d41c3f5279aed058$var$wrapperPromise); + } + (0, $rWuFh.default)($d41c3f5279aed058$var$injectScripts, $d41c3f5279aed058$var$getMonacoLoaderScript)($d41c3f5279aed058$var$configureLoader); + } + return (0, $8QzCV.default)($d41c3f5279aed058$var$wrapperPromise); +} +/** + * injects provided scripts into the document.body + * @param {Object} script - an HTML script element + * @return {Object} - the injected HTML script element + */ function $d41c3f5279aed058$var$injectScripts(script) { + return document.body.appendChild(script); +} +/** + * creates an HTML script element with/without provided src + * @param {string} [src] - the source path of the script + * @return {Object} - the created HTML script element + */ function $d41c3f5279aed058$var$createScript(src) { + var script = document.createElement("script"); + return src && (script.src = src), script; +} +/** + * creates an HTML script element with the monaco loader src + * @return {Object} - the created HTML script element + */ function $d41c3f5279aed058$var$getMonacoLoaderScript(configureLoader) { + var state = $d41c3f5279aed058$var$getState(function(_ref2) { + var config = _ref2.config, reject = _ref2.reject; + return { + config: config, + reject: reject + }; + }); + var loaderScript = $d41c3f5279aed058$var$createScript("".concat(state.config.paths.vs, "/loader.js")); + loaderScript.onload = function() { + return configureLoader(); + }; + loaderScript.onerror = state.reject; + return loaderScript; +} +/** + * configures the monaco loader + */ function $d41c3f5279aed058$var$configureLoader() { + var state = $d41c3f5279aed058$var$getState(function(_ref3) { + var config = _ref3.config, resolve = _ref3.resolve, reject = _ref3.reject; + return { + config: config, + resolve: resolve, + reject: reject + }; + }); + var require = window.require; + require.config(state.config); + require([ + "vs/editor/editor.main" + ], function(monaco) { + $d41c3f5279aed058$var$storeMonacoInstance(monaco); + state.resolve(monaco); + }, function(error) { + state.reject(error); + }); +} +/** + * store monaco instance in local state + */ function $d41c3f5279aed058$var$storeMonacoInstance(monaco) { + if (!$d41c3f5279aed058$var$getState().monaco) $d41c3f5279aed058$var$setState({ + monaco: monaco + }); +} +/** + * internal helper function + * extracts stored monaco instance + * @return {Object|null} - the monaco instance + */ function $d41c3f5279aed058$var$__getMonacoInstance() { + return $d41c3f5279aed058$var$getState(function(_ref4) { + var monaco = _ref4.monaco; + return monaco; + }); +} +var $d41c3f5279aed058$var$wrapperPromise = new Promise(function(resolve, reject) { + return $d41c3f5279aed058$var$setState({ + resolve: resolve, + reject: reject + }); +}); +var $d41c3f5279aed058$var$loader = { + config: $d41c3f5279aed058$var$config, + init: $d41c3f5279aed058$var$init, + __getMonacoInstance: $d41c3f5279aed058$var$__getMonacoInstance +}; +var $d41c3f5279aed058$export$2e2bcd8739ae039 = $d41c3f5279aed058$var$loader; + +}); +parcelRegister("3EaYc", function(module, exports) { + +$parcel$export(module.exports, "objectSpread2", () => $2a7d9de7b661058c$export$df72099fd95ee399); +$parcel$export(module.exports, "objectWithoutProperties", () => $2a7d9de7b661058c$export$d8a2083381e8fcb); +$parcel$export(module.exports, "slicedToArray", () => $2a7d9de7b661058c$export$12b6a547ec390b98); +function $2a7d9de7b661058c$export$fdab3c20aae16ddf(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function $2a7d9de7b661058c$var$ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + return keys; +} +function $2a7d9de7b661058c$export$df72099fd95ee399(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) $2a7d9de7b661058c$var$ownKeys(Object(source), true).forEach(function(key) { + $2a7d9de7b661058c$export$fdab3c20aae16ddf(target, key, source[key]); + }); + else if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + else $2a7d9de7b661058c$var$ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; +} +function $2a7d9de7b661058c$export$81942a8f34b531c4(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +function $2a7d9de7b661058c$export$d8a2083381e8fcb(source, excluded) { + if (source == null) return {}; + var target = $2a7d9de7b661058c$export$81942a8f34b531c4(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function $2a7d9de7b661058c$export$12b6a547ec390b98(arr, i) { + return $2a7d9de7b661058c$export$993bf82df8051d40(arr) || $2a7d9de7b661058c$export$861af887bcb88094(arr, i) || $2a7d9de7b661058c$export$b471fbbbe6d7806(arr, i) || $2a7d9de7b661058c$export$37ce4bd7a39fe25f(); +} +function $2a7d9de7b661058c$export$993bf82df8051d40(arr) { + if (Array.isArray(arr)) return arr; +} +function $2a7d9de7b661058c$export$861af887bcb88094(arr, i) { + if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + try { + for(var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true){ + _arr.push(_s.value); + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally{ + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally{ + if (_d) throw _e; + } + } + return _arr; +} +function $2a7d9de7b661058c$export$b471fbbbe6d7806(o, minLen) { + if (!o) return; + if (typeof o === "string") return $2a7d9de7b661058c$export$93cc12bcce4c2e3c(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return $2a7d9de7b661058c$export$93cc12bcce4c2e3c(o, minLen); +} +function $2a7d9de7b661058c$export$93cc12bcce4c2e3c(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; +} +function $2a7d9de7b661058c$export$37ce4bd7a39fe25f() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} + +}); + +parcelRegister("dxZFf", function(module, exports) { + +$parcel$export(module.exports, "default", () => $9dce30ade1c91099$export$2e2bcd8739ae039); +function $9dce30ade1c91099$var$_defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function $9dce30ade1c91099$var$ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + return keys; +} +function $9dce30ade1c91099$var$_objectSpread2(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) $9dce30ade1c91099$var$ownKeys(Object(source), true).forEach(function(key) { + $9dce30ade1c91099$var$_defineProperty(target, key, source[key]); + }); + else if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + else $9dce30ade1c91099$var$ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; +} +function $9dce30ade1c91099$var$compose() { + for(var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++)fns[_key] = arguments[_key]; + return function(x) { + return fns.reduceRight(function(y, f) { + return f(y); + }, x); + }; +} +function $9dce30ade1c91099$var$curry(fn) { + return function curried() { + var _this = this; + for(var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; + return args.length >= fn.length ? fn.apply(this, args) : function() { + for(var _len3 = arguments.length, nextArgs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++)nextArgs[_key3] = arguments[_key3]; + return curried.apply(_this, [].concat(args, nextArgs)); + }; + }; +} +function $9dce30ade1c91099$var$isObject(value) { + return ({}).toString.call(value).includes("Object"); +} +function $9dce30ade1c91099$var$isEmpty(obj) { + return !Object.keys(obj).length; +} +function $9dce30ade1c91099$var$isFunction(value) { + return typeof value === "function"; +} +function $9dce30ade1c91099$var$hasOwnProperty(object, property) { + return Object.prototype.hasOwnProperty.call(object, property); +} +function $9dce30ade1c91099$var$validateChanges(initial, changes) { + if (!$9dce30ade1c91099$var$isObject(changes)) $9dce30ade1c91099$var$errorHandler("changeType"); + if (Object.keys(changes).some(function(field) { + return !$9dce30ade1c91099$var$hasOwnProperty(initial, field); + })) $9dce30ade1c91099$var$errorHandler("changeField"); + return changes; +} +function $9dce30ade1c91099$var$validateSelector(selector) { + if (!$9dce30ade1c91099$var$isFunction(selector)) $9dce30ade1c91099$var$errorHandler("selectorType"); +} +function $9dce30ade1c91099$var$validateHandler(handler) { + if (!($9dce30ade1c91099$var$isFunction(handler) || $9dce30ade1c91099$var$isObject(handler))) $9dce30ade1c91099$var$errorHandler("handlerType"); + if ($9dce30ade1c91099$var$isObject(handler) && Object.values(handler).some(function(_handler) { + return !$9dce30ade1c91099$var$isFunction(_handler); + })) $9dce30ade1c91099$var$errorHandler("handlersType"); +} +function $9dce30ade1c91099$var$validateInitial(initial) { + if (!initial) $9dce30ade1c91099$var$errorHandler("initialIsRequired"); + if (!$9dce30ade1c91099$var$isObject(initial)) $9dce30ade1c91099$var$errorHandler("initialType"); + if ($9dce30ade1c91099$var$isEmpty(initial)) $9dce30ade1c91099$var$errorHandler("initialContent"); +} +function $9dce30ade1c91099$var$throwError(errorMessages, type) { + throw new Error(errorMessages[type] || errorMessages["default"]); +} +var $9dce30ade1c91099$var$errorMessages = { + initialIsRequired: "initial state is required", + initialType: "initial state should be an object", + initialContent: "initial state shouldn't be an empty object", + handlerType: "handler should be an object or a function", + handlersType: "all handlers should be a functions", + selectorType: "selector should be a function", + changeType: "provided value of changes should be an object", + changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state', + "default": "an unknown error accured in `state-local` package" +}; +var $9dce30ade1c91099$var$errorHandler = $9dce30ade1c91099$var$curry($9dce30ade1c91099$var$throwError)($9dce30ade1c91099$var$errorMessages); +var $9dce30ade1c91099$var$validators = { + changes: $9dce30ade1c91099$var$validateChanges, + selector: $9dce30ade1c91099$var$validateSelector, + handler: $9dce30ade1c91099$var$validateHandler, + initial: $9dce30ade1c91099$var$validateInitial +}; +function $9dce30ade1c91099$var$create(initial) { + var handler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + $9dce30ade1c91099$var$validators.initial(initial); + $9dce30ade1c91099$var$validators.handler(handler); + var state = { + current: initial + }; + var didUpdate = $9dce30ade1c91099$var$curry($9dce30ade1c91099$var$didStateUpdate)(state, handler); + var update = $9dce30ade1c91099$var$curry($9dce30ade1c91099$var$updateState)(state); + var validate = $9dce30ade1c91099$var$curry($9dce30ade1c91099$var$validators.changes)(initial); + var getChanges = $9dce30ade1c91099$var$curry($9dce30ade1c91099$var$extractChanges)(state); + function getState() { + var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function(state) { + return state; + }; + $9dce30ade1c91099$var$validators.selector(selector); + return selector(state.current); + } + function setState(causedChanges) { + $9dce30ade1c91099$var$compose(didUpdate, update, validate, getChanges)(causedChanges); + } + return [ + getState, + setState + ]; +} +function $9dce30ade1c91099$var$extractChanges(state, causedChanges) { + return $9dce30ade1c91099$var$isFunction(causedChanges) ? causedChanges(state.current) : causedChanges; +} +function $9dce30ade1c91099$var$updateState(state, changes) { + state.current = $9dce30ade1c91099$var$_objectSpread2($9dce30ade1c91099$var$_objectSpread2({}, state.current), changes); + return changes; +} +function $9dce30ade1c91099$var$didStateUpdate(state, handler, changes) { + $9dce30ade1c91099$var$isFunction(handler) ? handler(state.current) : Object.keys(changes).forEach(function(field) { + var _handler$field; + return (_handler$field = handler[field]) === null || _handler$field === void 0 ? void 0 : _handler$field.call(handler, state.current[field]); + }); + return changes; +} +var $9dce30ade1c91099$var$index = { + create: $9dce30ade1c91099$var$create +}; +var $9dce30ade1c91099$export$2e2bcd8739ae039 = $9dce30ade1c91099$var$index; + +}); + +parcelRegister("bJBBE", function(module, exports) { + +$parcel$export(module.exports, "default", () => $88b111812c659f63$export$2e2bcd8739ae039); +var $88b111812c659f63$var$config = { + paths: { + vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs" + } +}; +var $88b111812c659f63$export$2e2bcd8739ae039 = $88b111812c659f63$var$config; + +}); + +parcelRegister("2Nb9B", function(module, exports) { + +$parcel$export(module.exports, "default", () => $2088cf488e832168$export$2e2bcd8739ae039); + +var $a6ywS = parcelRequire("a6ywS"); + +var $lkyZ4 = parcelRequire("lkyZ4"); +/** + * validates the configuration object and informs about deprecation + * @param {Object} config - the configuration object + * @return {Object} config - the validated configuration object + */ function $2088cf488e832168$var$validateConfig(config) { + if (!config) $2088cf488e832168$export$cc3fdd528b56c4a9("configIsRequired"); + if (!(0, $lkyZ4.default)(config)) $2088cf488e832168$export$cc3fdd528b56c4a9("configType"); + if (config.urls) { + $2088cf488e832168$var$informAboutDeprecation(); + return { + paths: { + vs: config.urls.monacoBase + } + }; + } + return config; +} +/** + * logs deprecation message + */ function $2088cf488e832168$var$informAboutDeprecation() { + console.warn($2088cf488e832168$export$d8bd0967cb58683.deprecation); +} +function $2088cf488e832168$var$throwError(errorMessages, type) { + throw new Error(errorMessages[type] || errorMessages["default"]); +} +var $2088cf488e832168$export$d8bd0967cb58683 = { + configIsRequired: "the configuration object is required", + configType: "the configuration object should be an object", + "default": "an unknown error accured in `@monaco-editor/loader` package", + deprecation: "Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n " +}; +var $2088cf488e832168$export$cc3fdd528b56c4a9 = (0, $a6ywS.default)($2088cf488e832168$var$throwError)($2088cf488e832168$export$d8bd0967cb58683); +var $2088cf488e832168$var$validators = { + config: $2088cf488e832168$var$validateConfig +}; +var $2088cf488e832168$export$2e2bcd8739ae039 = $2088cf488e832168$var$validators; + +}); +parcelRegister("a6ywS", function(module, exports) { + +$parcel$export(module.exports, "default", () => $75b53fbbfbeb4a2a$export$2e2bcd8739ae039); +function $75b53fbbfbeb4a2a$var$curry(fn) { + return function curried() { + var _this = this; + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + return args.length >= fn.length ? fn.apply(this, args) : function() { + for(var _len2 = arguments.length, nextArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)nextArgs[_key2] = arguments[_key2]; + return curried.apply(_this, [].concat(args, nextArgs)); + }; + }; +} +var $75b53fbbfbeb4a2a$export$2e2bcd8739ae039 = $75b53fbbfbeb4a2a$var$curry; + +}); + +parcelRegister("lkyZ4", function(module, exports) { + +$parcel$export(module.exports, "default", () => $f8769a554cf7be44$export$2e2bcd8739ae039); +function $f8769a554cf7be44$var$isObject(value) { + return ({}).toString.call(value).includes("Object"); +} +var $f8769a554cf7be44$export$2e2bcd8739ae039 = $f8769a554cf7be44$var$isObject; + +}); + + +parcelRegister("rWuFh", function(module, exports) { + +$parcel$export(module.exports, "default", () => $053fe5571d660a8d$export$2e2bcd8739ae039); +var $053fe5571d660a8d$var$compose = function compose() { + for(var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++)fns[_key] = arguments[_key]; + return function(x) { + return fns.reduceRight(function(y, f) { + return f(y); + }, x); + }; +}; +var $053fe5571d660a8d$export$2e2bcd8739ae039 = $053fe5571d660a8d$var$compose; + +}); + +parcelRegister("936KQ", function(module, exports) { + +$parcel$export(module.exports, "default", () => $6969a230ee7af900$export$2e2bcd8739ae039); + +var $3EaYc = parcelRequire("3EaYc"); +function $6969a230ee7af900$var$merge(target, source) { + Object.keys(source).forEach(function(key) { + if (source[key] instanceof Object) { + if (target[key]) Object.assign(source[key], $6969a230ee7af900$var$merge(target[key], source[key])); + } + }); + return (0, $3EaYc.objectSpread2)((0, $3EaYc.objectSpread2)({}, target), source); +} +var $6969a230ee7af900$export$2e2bcd8739ae039 = $6969a230ee7af900$var$merge; + +}); + +parcelRegister("8QzCV", function(module, exports) { + +$parcel$export(module.exports, "default", () => $670ed0d374c95f74$export$2e2bcd8739ae039); +// The source (has been changed) is https://github.com/facebook/react/issues/5465#issuecomment-157888325 +var $670ed0d374c95f74$export$ef4ebf120f9f6749 = { + type: "cancelation", + msg: "operation is manually canceled" +}; +function $670ed0d374c95f74$var$makeCancelable(promise) { + var hasCanceled_ = false; + var wrappedPromise = new Promise(function(resolve, reject) { + promise.then(function(val) { + return hasCanceled_ ? reject($670ed0d374c95f74$export$ef4ebf120f9f6749) : resolve(val); + }); + promise["catch"](reject); + }); + return wrappedPromise.cancel = function() { + return hasCanceled_ = true; + }, wrappedPromise; +} +var $670ed0d374c95f74$export$2e2bcd8739ae039 = $670ed0d374c95f74$var$makeCancelable; + +}); + + + + +})(); +//# sourceMappingURL=dist.f8eecf79.js.map diff --git a/app/web/static/ed.de27588b.js b/app/web/static/ed.de27588b.js new file mode 100644 index 00000000..2db8cd6a --- /dev/null +++ b/app/web/static/ed.de27588b.js @@ -0,0 +1,274 @@ +(() => { + +function $parcel$defineInteropFlag(a) { + Object.defineProperty(a, '__esModule', {value: true, configurable: true}); +} + +function $parcel$export(e, n, v, s) { + Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); +} + + var $parcel$global = globalThis; + var parcelRequire = $parcel$global["parcelRequire2d1f"]; +var parcelRegister = parcelRequire.register; +parcelRegister("5tPYf", function(module, exports) { + +$parcel$defineInteropFlag(module.exports); + +$parcel$export(module.exports, "default", () => $cb53ab03e48d7e32$export$2e2bcd8739ae039); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $1CiVi = parcelRequire("1CiVi"); +var $cb53ab03e48d7e32$export$2e2bcd8739ae039 = (0, $4WfNn.page)({ + url: "/editor/**", + component: ({})=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + const local = (0, $4WfNn.useLocal)({ + loading: true, + session: null, + notfound: false, + init: false + }); + const site_id = params.site_id === "_" ? "" : params.site_id; + const page_id = params.page_id === "_" ? "" : params.page_id; + (0, $63SH6.useEffect)(()=>{ + if (!local.init) (async ()=>{ + let ses = null; + try { + ses = JSON.parse(localStorage.getItem("prasi-session") || ""); + } catch (e) {} + await new Promise(async (done)=>{ + try { + if (!!ses) done(); + let e = await api.session(); + if (!e) { + window.redirectTo = location.pathname; + navigate("/login"); + localStorage.removeItem("prasi-session"); + } else localStorage.setItem("prasi-session", JSON.stringify(e)); + if (!ses) { + ses = e; + done(); + } + } catch (e) { + console.error(e); + } + }); + if (ses) { + local.session = ses; + if (!site_id) { + const res = await db.site.findFirst({ + where: { + is_deleted: false, + org: { + org_user: { + some: { + id_user: ses.data.user.id + } + } + } + }, + select: { + id: true + } + }); + if (res) { + const page = await db.page.findFirst({ + where: { + id_site: res.id, + is_deleted: false + }, + select: { + id: true + } + }); + if (page) { + local.loading = false; + local.render(); + navigate(`/editor/${res.id}/${page.id}`); + return; + } + } else { + local.loading = false; + local.render(); + return; + } + } else if (!page_id) { + let res = await db.page.findFirst({ + where: { + id_site: site_id, + is_deleted: false + }, + select: { + id: true + } + }); + if (!res) res = await db.page.create({ + data: { + content_tree: { + childs: [], + id: "root", + type: "root" + }, + name: "home", + url: "/", + id_site: site_id + } + }); + if (res) { + local.loading = false; + local.render(); + navigate(`/editor/${site_id}/${res.id}`); + return; + } + } + } + navigate(`/editor/${site_id}/${page_id}`); + })(); + }, [ + local.init + ]); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: "base-page" + }); + } +}); + +}); +parcelRegister("eoQBx", function(module, exports) { + +$parcel$export(module.exports, "EditorGlobal", () => $de9a4354d7eb3ed2$export$e6753382eac59df2); + +var $9hNJ9 = parcelRequire("9hNJ9"); +const $de9a4354d7eb3ed2$export$e6753382eac59df2 = { + /** ui */ mode: "", + status: "init", + focused: "", + pendingRebuild: false, + localReloading: {}, + manager: { + page: false, + site: false, + comp: false, + compActionLabel: "Pick", + compCallback: (comp)=>{}, + compPreviewRendered: new Set() + }, + script: { + siteActive: false, + siteTypes: {}, + prop: null, + toolbar: null, + active: false, + type: "js", + db: null, + api: null, + onClose: undefined, + doEdit: null + }, + item: { + active: "", + activeOriginalId: "", + hover: "", + sideHover: false, + selectMode: "single", + selection: [], + copy: { + mode: "single" + } + }, + preventTreeScroll: false, + softRender: { + tree: ()=>{}, + page: ()=>{}, + side: ()=>{}, + addEl: ()=>{}, + topR: ()=>{}, + all () { + this.tree(); + this.page(); + this.side(); + this.addEl(); + this.topR(); + } + }, + /** read-only */ session: { + id: "", + data: { + user: { + id: "", + username: "" + } + } + }, + lsite: null, + site: { + id: "", + api_url: "", + api_prasi: { + port: "", + db: "" + }, + responsive: "all", + domain: "", + name: "", + js: "", + js_compiled: "" + }, + layout: { + section: null, + content: null + }, + site_dts: "", + page: null, + /** content tree */ treeFlat: [], + treeFlatTemp: [], + treeMeta: {}, + /** components */ comp: null, + comps: { + pending: {}, + resolve: {}, + doc: {} + }, + compProp: { + backToInstance: false, + edit: false, + inherit: true + }, + compDirectEdit: false, + compLoading: {}, + compInstance: {}, + /** routing */ pagePreload: {}, + route: (0, $9hNJ9.createRouter)(), + /** write-only */ mpage: null, + mpageLoaded: null, + /** connection */ ws: null, + wsPing: -1, + wsPingTs: 0, + wsPingInterval: null, + wsRetry: { + fast: false, + localIP: false, + disabled: false, + reconnecting: false + }, + ui: { + loading: null, + preload: null, + notfound: null, + error: null + } +}; + +}); + + +})(); +//# sourceMappingURL=ed.de27588b.js.map diff --git a/app/web/static/editor.73d38fbd.js b/app/web/static/editor.73d38fbd.js new file mode 100644 index 00000000..79396ce4 --- /dev/null +++ b/app/web/static/editor.73d38fbd.js @@ -0,0 +1,49313 @@ +(() => { + +function $parcel$export(e, n, v, s) { + Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); +} + +function $parcel$interopDefault(a) { + return a && a.__esModule ? a.default : a; +} + + var $parcel$global = globalThis; + var parcelRequire = $parcel$global["parcelRequire2d1f"]; +var parcelRegister = parcelRequire.register; +parcelRegister("h08Qa", function(module, exports) { + +$parcel$export(module.exports, "Editor", () => $a503cc0911452745$export$7cda8d932e2f33c0); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $1CiVi = parcelRequire("1CiVi"); + +var $bhGVv = parcelRequire("bhGVv"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $3xp7a = parcelRequire("3xp7a"); + +var $7PhiD = parcelRequire("7PhiD"); + +var $aK4GE = parcelRequire("aK4GE"); + +var $3i93m = parcelRequire("3i93m"); + +var $8u89v = parcelRequire("8u89v"); +const $a503cc0911452745$export$7cda8d932e2f33c0 = ({ session: session, site_id: site_id, page_id: page_id })=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + if (p.site.responsive === "mobile-only") p.mode = "mobile"; + else if (p.site.responsive === "desktop-only") p.mode = "desktop"; + p.session = session; + (0, $63SH6.useEffect)(()=>{ + const keyDown = async (evt)=>{ + if ((evt.key === "s" || evt.key === "s") && (evt.ctrlKey || evt.metaKey)) { + evt.preventDefault(); + evt.stopPropagation(); + } + if ((evt.key === "Y" || evt.key === "y") && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) { + (0, $aK4GE.undoManager).redo(p); + return; + } + if ((evt.key === "Z" || evt.key === "z") && (evt.ctrlKey || evt.metaKey) && evt.shiftKey) { + (0, $aK4GE.undoManager).redo(p); + return; + } + if ((evt.key === "Z" || evt.key === "z") && (evt.ctrlKey || evt.metaKey) && !evt.shiftKey) (0, $aK4GE.undoManager).undo(p); + if ((evt.key === "r" || evt.key === "R" || evt.key === "\xae") && evt.altKey) { + evt.preventDefault(); + evt.stopPropagation(); + p.localReloading = {}; + p.render(); + await (0, $8u89v.rebuildTree)(p, { + mode: "reset", + note: "reload" + }); + } + }; + window.addEventListener("keydown", keyDown, true); + return ()=>{ + window.removeEventListener("keydown", keyDown, true); + }; + }, []); + (0, $63SH6.useEffect)(()=>{ + if (p.status !== "init" && (0, $3i93m.w).prasiApi) { + for (const [k, v] of Object.entries((0, $4WfNn.deepClone)((0, $eoQBx.EditorGlobal))))continue; + (0, $3xp7a.execSiteJS)(p); + p.render(); + } + }, [ + page_id + ]); + if (!p.mode) { + if (p.site.responsive === "mobile-only") p.mode = "mobile"; + else if (p.site.responsive === "desktop-only") p.mode = "desktop"; + else p.mode = localStorage.getItem("prasi-editor-mode") || "desktop"; + } + if (p.status === "init") { + window.mok = (window.mok || 0) + 1; + p.ui.loading = /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: "load-page" + }); + p.ui.preload = /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: "preload-root", + backdrop: false + }); + p.ui.notfound = /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 flex items-center justify-center", + children: "NOT FOUND" + }); + p.ui.error = /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex-1 flex items-center justify-center", + children: "PREVIEW ERROR" + }); + p.status = "loading"; + (0, $3xp7a.initEditor)(p, site_id); + } + (0, $7PhiD.routeEditor)(p, page_id); + if (p.status !== "ready") { + if (p.status === "not-found") return p.ui.notfound; + if (p.status === "error") return p.ui.error; + if (!p.site.id) return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: "editor-prepare" + }); + } + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $bhGVv.EMainEditor), {}); +}; + +}); +parcelRegister("bhGVv", function(module, exports) { + +$parcel$export(module.exports, "EMainEditor", () => $fa70a53bf60af955$export$4d4121892defa95e); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $1CiVi = parcelRequire("1CiVi"); + +var $cqXgE = parcelRequire("cqXgE"); + +var $kJk2w = parcelRequire("kJk2w"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $cfPLU = parcelRequire("cfPLU"); + +const $fa70a53bf60af955$var$ETree = /*#__PURE__*/ (0, $63SH6.lazy)(async ()=>({ + default: (await Promise.resolve((parcelRequire("1nwyv")))).ETree + })); + +const $fa70a53bf60af955$var$EPage = /*#__PURE__*/ (0, $63SH6.lazy)(async ()=>({ + default: (await Promise.resolve((parcelRequire("cqXgE")))).EPage + })); + +const $fa70a53bf60af955$var$ESide = /*#__PURE__*/ (0, $63SH6.lazy)(async ()=>({ + default: (await (parcelRequire("8yVvO"))).ESide + })); + +const $fa70a53bf60af955$var$PageManager = /*#__PURE__*/ (0, $63SH6.lazy)(async ()=>({ + default: (await (parcelRequire("7WO2G"))).PageManager + })); + +const $fa70a53bf60af955$var$EScriptElement = /*#__PURE__*/ (0, $63SH6.lazy)(async ()=>({ + default: (await Promise.resolve((parcelRequire("ax46r")))).EScriptElement + })); + +const $fa70a53bf60af955$var$SiteManager = /*#__PURE__*/ (0, $63SH6.lazy)(async ()=>({ + default: (await (parcelRequire("hN3z8"))).SiteManager + })); + +const $fa70a53bf60af955$var$CompManager = /*#__PURE__*/ (0, $63SH6.lazy)(async ()=>({ + default: (await (parcelRequire("1aNFf"))).CompManager + })); +const $fa70a53bf60af955$export$4d4121892defa95e = ()=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("editor flex-1 flex flex-col items-stretch", (0, $kJk2w.editorStyle)), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)((0, $cfPLU.Toolbar), {}), + /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("editor-box flex flex-row flex-1"), + children: p.status !== "ready" ? /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: `editor-${p.status}` + }) : /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $63SH6.Suspense), { + fallback: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: `editor-lazy` + }), + children: [ + /*#__PURE__*/ (0, $lAN3N.jsx)($fa70a53bf60af955$var$ETree, {}), + location.search === "?norender" ? /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("flex-1", (0, $cqXgE.mobileCSS)) + }) : /*#__PURE__*/ (0, $lAN3N.jsx)($fa70a53bf60af955$var$EPage, {}), + /*#__PURE__*/ (0, $lAN3N.jsx)($fa70a53bf60af955$var$ESide, {}) + ] + }) + }) + }), + p.status === "ready" && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $63SH6.Suspense), { + fallback: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: `toolbar` + }), + children: [ + p.manager.site && /*#__PURE__*/ (0, $lAN3N.jsx)($fa70a53bf60af955$var$SiteManager, {}), + p.manager.page && /*#__PURE__*/ (0, $lAN3N.jsx)($fa70a53bf60af955$var$PageManager, {}), + p.manager.comp && /*#__PURE__*/ (0, $lAN3N.jsx)($fa70a53bf60af955$var$CompManager, {}), + p.script.active && !p.script.siteActive && /*#__PURE__*/ (0, $lAN3N.jsx)($fa70a53bf60af955$var$EScriptElement, {}) + ] + }) + ] + }); +}; + +}); +parcelRegister("cqXgE", function(module, exports) { + +$parcel$export(module.exports, "EPage", () => $19e1948fe32d4520$export$bf9e6cbd52e43ca); +$parcel$export(module.exports, "mobileCSS", () => $19e1948fe32d4520$export$cf7f6ce8f07b1290); + +var $lAN3N = parcelRequire("lAN3N"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $4r8Go = parcelRequire("4r8Go"); + +var $18ruq = parcelRequire("18ruq"); +const $19e1948fe32d4520$export$bf9e6cbd52e43ca = ()=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + const local = (0, $4WfNn.useLocal)({}); + p.softRender.page = ()=>{ + if (!p.focused) local.render(); + }; + if (0, $18ruq.JS_DEBUG) console.clear(); + if (!p.page) return null; + const mode = p.mode; + let childs = Object.values(p.page?.content_tree.childs || []); + // if (p.layout.section && p.layout.content) { + // childs = [p.layout.section]; + // } + const rootChilds = Object.values(childs).map((e)=>e.id); + return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("w-full h-full relative flex items-center justify-center", mode === "mobile" ? $19e1948fe32d4520$export$cf7f6ce8f07b1290 : "bg-white"), + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: cx("absolute flex flex-col items-stretch flex-1 bg-white ", mode === "mobile" ? css` + border-left: 1px solid #ccc; + border-right: 1px solid #ccc; + width: 375px; + top: 0px; + overflow-x: hidden; + overflow-y: auto; + bottom: 0px; + ` : "inset-0 overflow-auto", css` + contain: content; + `), + children: rootChilds.map((id)=>/*#__PURE__*/ (0, $lAN3N.jsx)((0, $4r8Go.ESection), { + id: id + }, id)) + }) + }); +}; +const $19e1948fe32d4520$export$cf7f6ce8f07b1290 = css` + background-color: white; + background-image: linear-gradient(45deg, #fafafa 25%, transparent 25%), + linear-gradient(-45deg, #fafafa 25%, transparent 25%), + linear-gradient(45deg, transparent 75%, #fafafa 75%), + linear-gradient(-45deg, transparent 75%, #fafafa 75%); + + background-size: 20px 20px; + background-position: 0 0, 0 10px, 10px -10px, -10px 0px; +`; + +}); +parcelRegister("4r8Go", function(module, exports) { + +$parcel$export(module.exports, "ESection", () => $b0609cfe0aeb7fc6$export$e32a1d000d2275bd); + +var $lAN3N = parcelRequire("lAN3N"); + +var $KfUSb = parcelRequire("KfUSb"); + +var $1s6dD = parcelRequire("1s6dD"); + +var $890fz = parcelRequire("890fz"); +const $b0609cfe0aeb7fc6$export$e32a1d000d2275bd = ({ id: id })=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $KfUSb.ErrorBox), { + id: id, + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $890fz.ERender), { + id: id, + children: (childs)=>childs.map((e)=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1s6dD.EItem), { + id: e.id + }, e.id); + }) + }) + }); +}; + +}); +parcelRegister("1s6dD", function(module, exports) { + +$parcel$export(module.exports, "EItem", () => $8c9742dd1dffd442$export$6f695f5b59bda1a4); + +var $lAN3N = parcelRequire("lAN3N"); + +var $KfUSb = parcelRequire("KfUSb"); + +var $890fz = parcelRequire("890fz"); + +var $8IrKh = parcelRequire("8IrKh"); +const $8c9742dd1dffd442$export$6f695f5b59bda1a4 = ({ id: id, fromProp: fromProp })=>{ + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $KfUSb.ErrorBox), { + id: id, + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $890fz.ERender), { + id: id, + fromProp: fromProp, + children: (childs)=>{ + return childs.map((e)=>{ + if (e.type !== "text") return /*#__PURE__*/ (0, $lAN3N.jsx)($8c9742dd1dffd442$export$6f695f5b59bda1a4, { + id: e.id, + fromProp: fromProp + }, e.id); + else return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $8IrKh.EText), { + id: e.id, + fromProp: fromProp + }, e.id); + }); + } + }) + }); +}; + +}); +parcelRegister("890fz", function(module, exports) { + +$parcel$export(module.exports, "ERender", () => $7c38a471cbcf09b3$export$6b8e72bf7eb23fa7); + +var $lAN3N = parcelRequire("lAN3N"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $cc0Z8 = parcelRequire("cc0Z8"); + +var $1CiVi = parcelRequire("1CiVi"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $j8xVm = parcelRequire("j8xVm"); + +var $18ruq = parcelRequire("18ruq"); + +var $ax46r = parcelRequire("ax46r"); + +var $dJKat = parcelRequire("dJKat"); + +var $6QgH2 = parcelRequire("6QgH2"); + +var $DNtyO = parcelRequire("DNtyO"); + +var $8IrKh = parcelRequire("8IrKh"); +const $7c38a471cbcf09b3$export$6b8e72bf7eb23fa7 = ({ id: id, children: children })=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + const meta = p.treeMeta[id]; + if (!meta) return null; + let item = meta.item; + if (item.hidden) return null; + if (meta.parent_prop && typeof item.adv?.js === "string" && item.adv.js.startsWith("newElement")) { + const mitem = meta.mitem; + if (mitem && item.type === "item") { + (async ()=>{ + let childs = []; + await Promise.all(mitem.parent.map(async (e, idx)=>{ + if (e === mitem && item.adv?.js) { + const json = e.toJSON(); + const scope = (0, $18ruq.mergeScopeUpwards)(p, meta); + let fn = null; + const args = { + ...window.exports, + ...scope, + render: (f)=>{}, + newElement: (fx)=>{ + fn = fx; + } + }; + const rawfn = new Function(...Object.keys(args), item.adv.jsBuilt || ""); + rawfn(...Object.values(args)); + await Promise.all(json.childs.map(async (e)=>{ + const res = await fn((0, $dJKat.fillID)(e)); + if (Array.isArray(res)) for (const r of res)childs.push((0, $6QgH2.newMap)((0, $dJKat.fillID)(r))); + else childs.push((0, $6QgH2.newMap)(res)); + })); + } + })); + mitem.doc?.transact(()=>{ + mitem.parent.map(async (e, idx)=>{ + if (e === mitem && item.adv?.js) { + mitem.parent.delete(idx); + mitem.parent.insert(idx, childs); + } + }); + }); + })(); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), { + children: "Generating" + }); + } + } + if (meta.comp && meta.comp.mcomp) { + const comp = meta.comp; + const props = meta.comp.mcomp.get("component")?.get("props")?.toJSON(); + const cprops = Object.entries(props).sort((a, b)=>{ + return a[1].idx - b[1].idx; + }); + if (0, $18ruq.JS_DEBUG) { + const args = [ + ("~".repeat(meta.depth || 0) + meta.item.name).padEnd(30, "_") + " " + meta.item.id + ].join(" "); + if (meta.comp) console.log("%c" + args, "color:red", "prop: ", comp.propval); + } + comp.propval = (0, $j8xVm.treePropEval)(p, meta, cprops); + } + let _children = null; + if (children) { + if (item.type === "text") _children = children([]); + else _children = children(item.childs || []); + } + meta.elprop = (0, $DNtyO.createElProp)(item, p); + meta.className = (0, $cc0Z8.produceCSS)(item, { + mode: p.mode, + hover: p.item.sideHover ? false : p.item.hover === item.id, + active: p.item.sideHover ? false : p.item.active === item.id + }); + const elprop = meta.elprop; + const className = meta.className; + const adv = item.adv; + let componentOver = null; + if (item.type === "item" && item.component?.id && item.component.props) { + if (!Object.values(item.component.props).find((e)=>e.meta?.type === "content-element")) { + if (!p.comps.doc[item.component.id]) componentOver = /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + backdrop: false, + note: item.component.id.substring(28) + }); + else if (item.id !== p.comp?.instance_id) componentOver = /*#__PURE__*/ (0, $lAN3N.jsx)((0, $DNtyO.ComponentOver), { + item: item, + p: p, + elprop: elprop + }); + } + if (meta.comp && (p.comp?.id === meta.comp.id || p.comp?.last.find((e)=>e.comp_id === meta.comp?.id))) componentOver = null; + } + if (adv && adv.js && !adv.jsBuilt && meta.mitem) { + if (!(0, $ax46r.jscript).build) { + (0, $ax46r.jscript).init().then(()=>{ + p.render(); + }); + return null; + } + (0, $ax46r.jscript).build("item [" + meta.item.name + "] -> .tsx", `return ${adv.js}`, undefined, true).then((js)=>{}); + return null; + } + if (!(adv?.jsBuilt && adv?.js) && (meta.scopeAttached || meta.comp)) return (0, $18ruq.treeScopeEval)(p, meta, /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + _children, + componentOver + ] + }), `render(React.createElement("div",{...props},children));`); + if (adv) { + if (adv.html) { + const html = $7c38a471cbcf09b3$export$1a32bf6229c258c0(className, adv, elprop); + if (html) return html; + } else if (adv.jsBuilt && adv.js) { + const el = (0, $18ruq.treeScopeEval)(p, meta, /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + _children, + componentOver + ] + }), adv.jsBuilt); + return el; + } + } + if (item.type === "text") return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $8IrKh.ETextInternal), { + className: className, + elprop: elprop, + item: item, + p: p, + _children: item.html || item.text + }, item.id); + return /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: className, + ...elprop, + children: [ + _children, + componentOver + ] + }); +}; +const $7c38a471cbcf09b3$export$1a32bf6229c258c0 = (className, adv, elprop)=>{ + if (adv.html) return /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: className, + dangerouslySetInnerHTML: { + __html: adv.html + }, + ...elprop + }); + return null; +}; + +}); +parcelRegister("j8xVm", function(module, exports) { + +$parcel$export(module.exports, "treePropEval", () => $abc59d7df391d1cc$export$2f4fe33b8bea4711); + +var $lAN3N = parcelRequire("lAN3N"); + +var $isbAn = parcelRequire("isbAn"); + +var $1s6dD = parcelRequire("1s6dD"); + +var $18ruq = parcelRequire("18ruq"); +const $abc59d7df391d1cc$export$2f4fe33b8bea4711 = (p, meta, cprops)=>{ + if (meta.item.type === "item" && meta.item.component) { + if (p.site.api_url) { + if (!p.script.db) p.script.db = (0, $isbAn.createDB)(p.site.api_url); + if (!p.script.api) p.script.api = (0, $isbAn.createAPI)(p.site.api_url); + } + const props = meta.item.component.props; + const w = window; + const finalScope = (0, $18ruq.mergeScopeUpwards)(p, meta); + const args = { + ...w.exports, + ...finalScope, + db: p.script.db, + api: p.script.api + }; + const result = {}; + for (const [name, _prop] of cprops){ + const prop = props[name] || _prop; + let value = null; + if (prop.valueBuilt) try { + const fn = new Function(...Object.keys(args), `return ${prop.valueBuilt}`); + // note: by default set prop to null + // if it is undefined then it will be overidden by parent scope + // it is not desirable for prop to inherit from parent scope. + value = fn(...Object.values(args)) || null; + } catch (e) { + const cname = meta.item.name; + console.warn(e); + console.warn(`ERROR in Component [${cname}], in prop [${name}]:\n ` + prop.value); + } + if (prop.meta?.type === "content-element") { + if (!(typeof value === "object" && !!value && value._jsx)) value = { + _jsx: true, + Comp: ({ parent_id: parent_id })=>{ + if (prop.content) { + const meta = p.treeMeta[parent_id]; + const scopes = []; + (0, $18ruq.mergeScopeUpwards)(p, meta, { + each: (m, val)=>{ + scopes.push({ + meta: m, + value: val + }); + return true; + } + }); + if (p.treeMeta[prop.content.id]) p.treeMeta[prop.content.id].scopeAttached = scopes; + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1s6dD.EItem), { + id: prop.content.id, + fromProp: true + }); + } + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $lAN3N.Fragment), {}); + } + }; + } + result[name] = value; + } + const propvis = {}; + for (const [name, _prop] of cprops)if (_prop.visible) { + const finalArgs = { + ...args, + ...result + }; + try { + const fn = new Function(...Object.keys(finalArgs), `return ${_prop.visible}`); + propvis[name] = fn(...Object.values(finalArgs)); + } catch (e) { + const cname = meta.item.name; + console.warn(e); + console.warn(`ERROR in Component [${cname}], in prop [${name}]:\n ` + _prop.visible); + } + } + if (meta.comp) meta.comp.propvis = propvis; + return result; + } +}; + +}); +parcelRegister("18ruq", function(module, exports) { + +$parcel$export(module.exports, "JS_DEBUG", () => $602692a9f9421b20$export$bc6cda806d54f983); +$parcel$export(module.exports, "treeScopeEval", () => $602692a9f9421b20$export$4d9c1e8573de8067); +$parcel$export(module.exports, "mergeScopeUpwards", () => $602692a9f9421b20$export$f4fa9221fd311771); + +var $lAN3N = parcelRequire("lAN3N"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $isbAn = parcelRequire("isbAn"); + +var $KfUSb = parcelRequire("KfUSb"); +const $602692a9f9421b20$export$bc6cda806d54f983 = false; +const $602692a9f9421b20$export$4d9c1e8573de8067 = (p, meta, children, js)=>{ + const className = meta.className; + const elprop = meta.elprop; + let item = meta.item; + const adv = item.adv; + let args = {}; + if (!meta.memoize) meta.memoize = { + Local: $602692a9f9421b20$var$createLocal(p, meta), + PassProp: $602692a9f9421b20$var$createPassProp(p, meta) + }; + // prepare args + if (p.site.api_url) { + if (!p.script.db) p.script.db = (0, $isbAn.createDB)(p.site.api_url); + if (!p.script.api) p.script.api = (0, $isbAn.createAPI)(p.site.api_url); + } + const w = window; + const finalScope = $602692a9f9421b20$export$f4fa9221fd311771(p, meta); + for (const [k, v] of Object.entries(finalScope))if (v && typeof v === "object") { + const t = v; + if (t._jsx && t.Comp) finalScope[k] = /*#__PURE__*/ (0, $lAN3N.jsx)(t.Comp, { + parent_id: meta.item.id + }); + } + if ($602692a9f9421b20$export$bc6cda806d54f983) { + const args = [ + (".".repeat(meta.depth || 0) + meta.item.name).padEnd(30, "_") + " " + meta.item.id + ].join(" "); + if (meta.comp) console.log("%c" + args, "color:red", finalScope); + else console.log(args, finalScope); + } + const output = { + jsx: null + }; + args = { + ...w.exports, + ...finalScope, + ...meta.memoize, + db: p.script.db, + api: p.script.api, + children: children, + props: { + ...elprop, + className: className + }, + newElement: (opt)=>children, + useEffect: (0, $63SH6.useEffect), + render: (jsx)=>{ + output.jsx = /*#__PURE__*/ (0, $lAN3N.jsx)((0, $KfUSb.ErrorBox), { + meta: meta, + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $63SH6.Suspense), { + fallback: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "flex flex-1 items-center justify-center w-full h-full relative", + children: p.ui.loading + }), + children: jsx + }) + }); + } + }; + try { + // execute + const fn = new Function(...Object.keys(args), js); + const res = fn(...Object.values(args)); + if (res instanceof Promise) res.catch((e)=>{ + console.warn(e); + console.warn((`ERROR in ${item.type} [${item.name}]:\n ` + (adv?.js || "")).trim()); + console.warn(`Available var:`, args, `\n\n`); + }); + } catch (e) {} + return output.jsx; +}; +const $602692a9f9421b20$export$f4fa9221fd311771 = (p, meta, opt)=>{ + if (!meta.scope) meta.scope = {}; + let cur = meta; + const finalScope = {}; + while(cur){ + let scope = null; + if (cur.scopeAttached) { + for (const s of cur.scopeAttached)if (s.value) { + for (const [k, v] of Object.entries(s.value))if (typeof finalScope[k] === "undefined") finalScope[k] = v; + if (opt?.each) { + if (!opt.each(s.meta, s.value)) break; + } + } + } + if (cur.scope || cur.comp?.propval) { + scope = { + ...cur.scope, + ...cur.comp?.propval + }; + for (const [k, v] of Object.entries(scope))if (typeof finalScope[k] === "undefined") finalScope[k] = v; + if (opt?.each) { + if (!opt.each(cur, scope)) break; + } + } + cur = p.treeMeta[cur.parent_id]; + } + return finalScope; +}; +const $602692a9f9421b20$var$createPassProp = (p, meta)=>{ + return (arg)=>{ + if (!meta.scope) meta.scope = {}; + for (const [k, v] of Object.entries(arg)){ + if (k === "children") continue; + meta.scope[k] = v; + } + return arg.children; + }; +}; +const $602692a9f9421b20$var$createLocal = (p, meta)=>{ + const Local = ({ name: name, value: value, effect: effect, children: children, hook: hook, deps: deps })=>{ + if (!meta.scope) meta.scope = {}; + const immediateExecute = meta.item.id === p.item.active && p.script.active; + if (!meta.scope[name]) try { + meta.scope[name] = { + ...(0, $4WfNn.deepClone)(value), + render: ()=>{ + if (!p.focused) p.render(); + } + }; + } catch (e) {} + if (typeof hook === "function") try { + hook(meta.scope[name]); + } catch (e) { + console.warn(e); + } + (0, $63SH6.useEffect)(()=>{ + if (effect) { + if (immediateExecute) { + if (!p.localReloading[p.item.active]) p.localReloading[p.item.active] = true; + else return; + } + try { + effect(meta.scope[name]); + } catch (e) {} + } + }, []); + return children; + }; + return Local; +}; + +}); + + +parcelRegister("ax46r", function(module, exports) { + +$parcel$export(module.exports, "jscript", () => $995080ac362d425a$export$c6b82629a9326816); +$parcel$export(module.exports, "EScriptElement", () => $995080ac362d425a$export$d63aac689a6a95d3); + +var $lAN3N = parcelRequire("lAN3N"); + +var $4WfNn = parcelRequire("4WfNn"); + +var $aVHaH = parcelRequire("aVHaH"); + +var $1CiVi = parcelRequire("1CiVi"); + +var $axFja = parcelRequire("axFja"); + +var $eoQBx = parcelRequire("eoQBx"); + +var $8u89v = parcelRequire("8u89v"); + +var $eQo3h = parcelRequire("eQo3h"); + +var $dnwSp = parcelRequire("dnwSp"); + +const $995080ac362d425a$export$c6b82629a9326816 = { + editor: null, + build: null, + _init: false, + async init () { + if (!this._init) { + this._init = true; + const { sendIPC: sendIPC } = await (parcelRequire("NRpjz")); + await (0, $eQo3h.initJS)(); + this.build = async (entry, src, files, verbose)=>{ + const options = { + entryPoints: [ + entry + ], + jsx: "transform", + bundle: true, + format: "cjs", + minify: true + }; + const res = await sendIPC({ + command_: "build", + input_: { + ...files, + [entry]: src + }, + options_: options + }); + if (verbose && res.stderr_) console.log(res.stderr_); + if (res.outputFiles_) return res.outputFiles_[0].text; + return ""; + }; + await this.build("el.tsx", `return ""`); + } + } +}; + +const $995080ac362d425a$export$d63aac689a6a95d3 = ({})=>{ + const p = (0, $4WfNn.useGlobal)((0, $eoQBx.EditorGlobal), "EDITOR"); + if (!$995080ac362d425a$export$c6b82629a9326816.editor) Promise.all([ + (parcelRequire("aOi4L")).then((e)=>{ + $995080ac362d425a$export$c6b82629a9326816.editor = e.Editor; + e.loader.config({ + paths: { + vs: "/min/vs" + } + }); + }), + $995080ac362d425a$export$c6b82629a9326816.init() + ]).then(()=>{ + p.render(); + }); + if (!p.script.active) return null; + const onOpenChange = ()=>{ + if (p.script.active) { + let mitem = p.treeMeta[p.item.active]?.mitem; + if (!mitem) return; + mitem.doc?.transact(()=>{ + if (!mitem) return; + const adv = mitem.get("adv"); + if (adv) { + const src = adv.get(p.script.type); + let txt = ""; + if (src && src instanceof $aVHaH.Text) txt = src.toJSON(); + else txt = src; + if (!txt || typeof txt === "string" && txt.replace(/[\W_]+/g, "") === (0, $dnwSp.DefaultScript)[p.script.type].replace(/[\W_]+/g, "")) { + if (p.script.type === "js") { + adv.delete("js"); + adv.delete("jsBuilt"); + } else adv.delete(p.script.type); + } + } + }); + } + p.script.active = false; + p.script.prop = null; + p.script.doEdit = null; + p.script.toolbar = null; + if (typeof p.script.onClose === "function") { + p.script.onClose(); + p.script.onClose = undefined; + } + (0, $8u89v.rebuildTree)(p, { + mode: "reset", + note: "script-closed" + }); + }; + const content = /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + className: "bg-white w-[80vw] h-[80vh] flex", + children: /*#__PURE__*/ (0, $lAN3N.jsxs)("div", { + className: cx("flex flex-1 relative", css` + .monaco-editor { + .mtk9 { + color: #022f62; + } + .mtk1 { + color: #022f62; + } + .mtk22 { + color: #015cc5; + } + .mtk8 { + color: #015cc5; + } + .mtk5 { + color: #55bb8a; + } + .monaco-editor.showUnused .squiggly-inline-unnecessary { + opacity: 0.4; + } + .jsx-expression-braces { + color: #7c3813; + } + .jsx-tag-angle-bracket { + color: #619ac3; + } + .jsx-tag-name { + color: #619ac3; + } + .jsx-tag-order-1 { + color: #23863a; + } + .jsx-tag-order-2 { + color: #4e7ca1; + } + .jsx-tag-order-3 { + color: #020360; + } + .jsx-tag-attribute-key { + color: #6f42c1; + } + .jsx-text { + color: #000000; + } + } + `), + children: [ + (!$995080ac362d425a$export$c6b82629a9326816.editor || !$995080ac362d425a$export$c6b82629a9326816.build) && /*#__PURE__*/ (0, $lAN3N.jsxs)((0, $lAN3N.Fragment), { + children: [ + !$995080ac362d425a$export$c6b82629a9326816.editor && !$995080ac362d425a$export$c6b82629a9326816.build && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: "js-code", + backdrop: false + }), + !$995080ac362d425a$export$c6b82629a9326816.editor && $995080ac362d425a$export$c6b82629a9326816.build && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: "js-editor", + backdrop: false + }), + !$995080ac362d425a$export$c6b82629a9326816.build && $995080ac362d425a$export$c6b82629a9326816.editor && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $1CiVi.Loading), { + note: "js-build", + backdrop: false + }) + ] + }), + $995080ac362d425a$export$c6b82629a9326816.editor && $995080ac362d425a$export$c6b82629a9326816.build && /*#__PURE__*/ (0, $lAN3N.jsx)((0, $dnwSp.ScriptMonacoElement), { + Editor: $995080ac362d425a$export$c6b82629a9326816.editor, + build: $995080ac362d425a$export$c6b82629a9326816.build + }) + ] + }) + }); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $axFja.Modal), { + onOpenChange: onOpenChange, + children: content + }); +}; + +}); +parcelRegister("axFja", function(module, exports) { + +$parcel$export(module.exports, "Modal", () => $347af5afa63da731$export$2b77a92f1a5ad772); + +var $lAN3N = parcelRequire("lAN3N"); + +var $7rwqM = parcelRequire("7rwqM"); + +var $63SH6 = parcelRequire("63SH6"); + +var $4WfNn = parcelRequire("4WfNn"); +function $347af5afa63da731$export$33ffd74ebf07f060({ initialOpen: initialOpen = true, open: controlledOpen, onOpenChange: setControlledOpen }) { + const [uncontrolledOpen, setUncontrolledOpen] = $63SH6.useState(initialOpen); + const [labelId, setLabelId] = $63SH6.useState(); + const [descriptionId, setDescriptionId] = $63SH6.useState(); + const open = controlledOpen ?? uncontrolledOpen; + const setOpen = setControlledOpen ?? setUncontrolledOpen; + const data = (0, $7rwqM.useFloating)({ + open: open, + onOpenChange: setOpen + }); + const context = data.context; + const click = (0, $7rwqM.useClick)(context, { + enabled: controlledOpen == null + }); + const dismiss = (0, $7rwqM.useDismiss)(context, { + outsidePressEvent: "mousedown", + escapeKey: false + }); + const role = (0, $7rwqM.useRole)(context); + const interactions = (0, $7rwqM.useInteractions)([ + click, + dismiss, + role + ]); + return $63SH6.useMemo(()=>({ + open: open, + setOpen: setOpen, + ...interactions, + ...data, + labelId: labelId, + descriptionId: descriptionId, + setLabelId: setLabelId, + setDescriptionId: setDescriptionId + }), [ + open, + setOpen, + interactions, + data, + labelId, + descriptionId + ]); +} +const $347af5afa63da731$var$ModalContext = /*#__PURE__*/ $63SH6.createContext(null); +const $347af5afa63da731$export$4cc1699d46f42cae = ()=>{ + const context = $63SH6.useContext($347af5afa63da731$var$ModalContext); + if (context == null) throw new Error("Modal components must be wrapped in "); + return context; +}; +function $347af5afa63da731$export$2b77a92f1a5ad772({ children: children, ...options }) { + const dialog = $347af5afa63da731$export$33ffd74ebf07f060(options); + return /*#__PURE__*/ (0, $lAN3N.jsx)($347af5afa63da731$var$ModalContext.Provider, { + value: dialog, + children: /*#__PURE__*/ (0, $lAN3N.jsx)($347af5afa63da731$export$6da19a24bf249f17, { + className: cx("modal", "outline-none"), + children: children + }) + }); +} +const $347af5afa63da731$export$fb10b32cfe19f1e = /*#__PURE__*/ $63SH6.forwardRef(function ModalTrigger({ children: children, asChild: asChild = false, ...props }, propRef) { + const context = $347af5afa63da731$export$4cc1699d46f42cae(); + const childrenRef = children.ref; + const ref = (0, $7rwqM.useMergeRefs)([ + context.refs.setReference, + propRef, + childrenRef + ]); + // `asChild` allows the user to pass any element as the anchor + if (asChild && /*#__PURE__*/ $63SH6.isValidElement(children)) return /*#__PURE__*/ $63SH6.cloneElement(children, context.getReferenceProps({ + ref: ref, + ...props, + ...children.props, + "data-state": context.open ? "open" : "closed" + })); + return /*#__PURE__*/ (0, $lAN3N.jsx)("button", { + ref: ref, + "data-state": context.open ? "open" : "closed", + ...context.getReferenceProps(props), + children: children + }); +}); +const $347af5afa63da731$export$6da19a24bf249f17 = /*#__PURE__*/ $63SH6.forwardRef(function ModalContent(props, propRef) { + const local = (0, $4WfNn.useLocal)({ + preview: false, + timeout: null + }); + const { context: floatingContext, ...context } = $347af5afa63da731$export$4cc1699d46f42cae(); + const ref = (0, $7rwqM.useMergeRefs)([ + context.refs.setFloating, + propRef + ]); + if (!floatingContext.open) return null; + const floatingDivProps = context.getFloatingProps(props); + return /*#__PURE__*/ (0, $lAN3N.jsx)((0, $7rwqM.FloatingPortal), { + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $7rwqM.FloatingOverlay), { + className: cx("modal-overlay", "flex items-center justify-center transition-all ", css` + background: rgba(0, 0, 0, 0.3); + display: grid; + place-items: center; + `, local.preview ? "opacity-20 duration-1000" : "duration-300"), + lockScroll: true, + children: /*#__PURE__*/ (0, $lAN3N.jsx)((0, $7rwqM.FloatingFocusManager), { + context: floatingContext, + children: /*#__PURE__*/ (0, $lAN3N.jsx)("div", { + ref: ref, + onPointerMove: ()=>{ + clearTimeout(local.timeout); + if (local.preview) { + local.preview = false; + local.render(); + } + }, + onPointerLeave: (e)=>{ + // if (Object.keys(w.openedPopupID || {}).length > 0) { + // return; + // } + clearTimeout(local.timeout); + local.timeout = setTimeout(()=>{ + local.preview = true; + local.render(); + }, 1000); + }, + "aria-labelledby": context.labelId, + "aria-describedby": context.descriptionId, + ...floatingDivProps, + children: props.children + }) + }) + }) + }); +}); +const $347af5afa63da731$export$9af27c346834c182 = /*#__PURE__*/ $63SH6.forwardRef(function ModalHeading({ children: children, ...props }, ref) { + const { setLabelId: setLabelId } = $347af5afa63da731$export$4cc1699d46f42cae(); + const id = (0, $7rwqM.useId)(); + // Only sets `aria-labelledby` on the Modal root element + // if this component is mounted inside it. + $63SH6.useLayoutEffect(()=>{ + setLabelId(id); + return ()=>setLabelId(undefined); + }, [ + id, + setLabelId + ]); + return /*#__PURE__*/ (0, $lAN3N.jsx)("h2", { + ...props, + ref: ref, + id: id, + children: children + }); +}); +const $347af5afa63da731$export$70584796f9410aa4 = /*#__PURE__*/ $63SH6.forwardRef(function ModalDescription({ children: children, ...props }, ref) { + const { setDescriptionId: setDescriptionId } = $347af5afa63da731$export$4cc1699d46f42cae(); + const id = (0, $7rwqM.useId)(); + // Only sets `aria-describedby` on the Modal root element + // if this component is mounted inside it. + $63SH6.useLayoutEffect(()=>{ + setDescriptionId(id); + return ()=>setDescriptionId(undefined); + }, [ + id, + setDescriptionId + ]); + return /*#__PURE__*/ (0, $lAN3N.jsx)("p", { + ...props, + ref: ref, + id: id, + children: children + }); +}); +const $347af5afa63da731$export$9bf0f2717ffc648c = /*#__PURE__*/ $63SH6.forwardRef(function ModalClose(props, ref) { + const { setOpen: setOpen } = $347af5afa63da731$export$4cc1699d46f42cae(); + return /*#__PURE__*/ (0, $lAN3N.jsx)("button", { + type: "button", + ...props, + ref: ref, + onClick: ()=>setOpen(false) + }); +}); + +}); +parcelRegister("7rwqM", function(module, exports) { + +$parcel$export(module.exports, "useMergeRefs", () => $56b436271f6666d1$export$74665b213cb5c4cf); +$parcel$export(module.exports, "useId", () => $56b436271f6666d1$export$f680877a34711e37); +$parcel$export(module.exports, "useHover", () => $56b436271f6666d1$export$ae780daf29e6d456); +$parcel$export(module.exports, "FloatingPortal", () => $56b436271f6666d1$export$31fa5d718fa2ac09); +$parcel$export(module.exports, "FloatingFocusManager", () => $56b436271f6666d1$export$8aeee49171ded61a); +$parcel$export(module.exports, "FloatingOverlay", () => $56b436271f6666d1$export$a35954495955337b); +$parcel$export(module.exports, "useClick", () => $56b436271f6666d1$export$98524f11226063fc); +$parcel$export(module.exports, "useDismiss", () => $56b436271f6666d1$export$fcdf1ba5fafc089b); +$parcel$export(module.exports, "useFloating", () => $56b436271f6666d1$export$4e02a5c1d08bac65); +$parcel$export(module.exports, "useFocus", () => $56b436271f6666d1$export$f8168d8dd8fd66e6); +$parcel$export(module.exports, "useInteractions", () => $56b436271f6666d1$export$a519f7794e446ddd); +$parcel$export(module.exports, "useListNavigation", () => $56b436271f6666d1$export$b5d22cac4ad33f40); +$parcel$export(module.exports, "useRole", () => $56b436271f6666d1$export$f66572793fa256a1); +$parcel$export(module.exports, "useTypeahead", () => $56b436271f6666d1$export$d8d674d50b73ba93); +$parcel$export(module.exports, "offset", () => (parcelRequire("l2jTt")).offset); + +var $63SH6 = parcelRequire("63SH6"); + +var $d8YHU = parcelRequire("d8YHU"); + +var $fvpw6 = parcelRequire("fvpw6"); + +var $2Dcmu = parcelRequire("2Dcmu"); +var $91fsP = parcelRequire("91fsP"); +var $8Xnp2 = parcelRequire("8Xnp2"); +var $l2jTt = parcelRequire("l2jTt"); + +var $8Xnp2 = parcelRequire("8Xnp2"); + +var $bqiJA = parcelRequire("bqiJA"); + +var $grDIR = parcelRequire("grDIR"); +/** + * Merges an array of refs into a single memoized callback ref or `null`. + * @see https://floating-ui.com/docs/useMergeRefs + */ function $56b436271f6666d1$export$74665b213cb5c4cf(refs) { + return $63SH6.useMemo(()=>{ + if (refs.every((ref)=>ref == null)) return null; + return (value)=>{ + refs.forEach((ref)=>{ + if (typeof ref === "function") ref(value); + else if (ref != null) ref.current = value; + }); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, refs); +} +// `toString()` prevents bundlers from trying to `import { useInsertionEffect } from 'react'` +const $56b436271f6666d1$var$useInsertionEffect = $63SH6[/*#__PURE__*/ "useInsertionEffect".toString()]; +const $56b436271f6666d1$var$useSafeInsertionEffect = $56b436271f6666d1$var$useInsertionEffect || ((fn)=>fn()); +function $56b436271f6666d1$var$useEffectEvent(callback) { + const ref = $63SH6.useRef(()=>{}); + $56b436271f6666d1$var$useSafeInsertionEffect(()=>{ + ref.current = callback; + }); + return $63SH6.useCallback(function() { + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + return ref.current == null ? void 0 : ref.current(...args); + }, []); +} +const $56b436271f6666d1$var$ARROW_UP = "ArrowUp"; +const $56b436271f6666d1$var$ARROW_DOWN = "ArrowDown"; +const $56b436271f6666d1$var$ARROW_LEFT = "ArrowLeft"; +const $56b436271f6666d1$var$ARROW_RIGHT = "ArrowRight"; +function $56b436271f6666d1$var$isDifferentRow(index, cols, prevRow) { + return Math.floor(index / cols) !== prevRow; +} +function $56b436271f6666d1$var$isIndexOutOfBounds(listRef, index) { + return index < 0 || index >= listRef.current.length; +} +function $56b436271f6666d1$var$getMinIndex(listRef, disabledIndices) { + return $56b436271f6666d1$var$findNonDisabledIndex(listRef, { + disabledIndices: disabledIndices + }); +} +function $56b436271f6666d1$var$getMaxIndex(listRef, disabledIndices) { + return $56b436271f6666d1$var$findNonDisabledIndex(listRef, { + decrement: true, + startingIndex: listRef.current.length, + disabledIndices: disabledIndices + }); +} +function $56b436271f6666d1$var$findNonDisabledIndex(listRef, _temp) { + let { startingIndex: startingIndex = -1, decrement: decrement = false, disabledIndices: disabledIndices, amount: amount = 1 } = _temp === void 0 ? {} : _temp; + const list = listRef.current; + let index = startingIndex; + do { + var _list$index, _list$index2; + index = index + (decrement ? -amount : amount); + }while (index >= 0 && index <= list.length - 1 && (disabledIndices ? disabledIndices.includes(index) : list[index] == null || ((_list$index = list[index]) == null ? void 0 : _list$index.hasAttribute("disabled")) || ((_list$index2 = list[index]) == null ? void 0 : _list$index2.getAttribute("aria-disabled")) === "true")); + return index; +} +function $56b436271f6666d1$var$getGridNavigatedIndex(elementsRef, _ref) { + let { event: event, orientation: orientation, loop: loop, cols: cols, disabledIndices: disabledIndices, minIndex: minIndex, maxIndex: maxIndex, prevIndex: prevIndex, stopEvent: stop = false } = _ref; + let nextIndex = prevIndex; + if (event.key === $56b436271f6666d1$var$ARROW_UP) { + stop && (0, $d8YHU.stopEvent)(event); + if (prevIndex === -1) nextIndex = maxIndex; + else { + nextIndex = $56b436271f6666d1$var$findNonDisabledIndex(elementsRef, { + startingIndex: nextIndex, + amount: cols, + decrement: true, + disabledIndices: disabledIndices + }); + if (loop && (prevIndex - cols < minIndex || nextIndex < 0)) { + const col = prevIndex % cols; + const maxCol = maxIndex % cols; + const offset = maxIndex - (maxCol - col); + if (maxCol === col) nextIndex = maxIndex; + else nextIndex = maxCol > col ? offset : offset - cols; + } + } + if ($56b436271f6666d1$var$isIndexOutOfBounds(elementsRef, nextIndex)) nextIndex = prevIndex; + } + if (event.key === $56b436271f6666d1$var$ARROW_DOWN) { + stop && (0, $d8YHU.stopEvent)(event); + if (prevIndex === -1) nextIndex = minIndex; + else { + nextIndex = $56b436271f6666d1$var$findNonDisabledIndex(elementsRef, { + startingIndex: prevIndex, + amount: cols, + disabledIndices: disabledIndices + }); + if (loop && prevIndex + cols > maxIndex) nextIndex = $56b436271f6666d1$var$findNonDisabledIndex(elementsRef, { + startingIndex: prevIndex % cols - cols, + amount: cols, + disabledIndices: disabledIndices + }); + } + if ($56b436271f6666d1$var$isIndexOutOfBounds(elementsRef, nextIndex)) nextIndex = prevIndex; + } + // Remains on the same row/column. + if (orientation === "both") { + const prevRow = (0, $fvpw6.floor)(prevIndex / cols); + if (event.key === $56b436271f6666d1$var$ARROW_RIGHT) { + stop && (0, $d8YHU.stopEvent)(event); + if (prevIndex % cols !== cols - 1) { + nextIndex = $56b436271f6666d1$var$findNonDisabledIndex(elementsRef, { + startingIndex: prevIndex, + disabledIndices: disabledIndices + }); + if (loop && $56b436271f6666d1$var$isDifferentRow(nextIndex, cols, prevRow)) nextIndex = $56b436271f6666d1$var$findNonDisabledIndex(elementsRef, { + startingIndex: prevIndex - prevIndex % cols - 1, + disabledIndices: disabledIndices + }); + } else if (loop) nextIndex = $56b436271f6666d1$var$findNonDisabledIndex(elementsRef, { + startingIndex: prevIndex - prevIndex % cols - 1, + disabledIndices: disabledIndices + }); + if ($56b436271f6666d1$var$isDifferentRow(nextIndex, cols, prevRow)) nextIndex = prevIndex; + } + if (event.key === $56b436271f6666d1$var$ARROW_LEFT) { + stop && (0, $d8YHU.stopEvent)(event); + if (prevIndex % cols !== 0) { + nextIndex = $56b436271f6666d1$var$findNonDisabledIndex(elementsRef, { + startingIndex: prevIndex, + disabledIndices: disabledIndices, + decrement: true + }); + if (loop && $56b436271f6666d1$var$isDifferentRow(nextIndex, cols, prevRow)) nextIndex = $56b436271f6666d1$var$findNonDisabledIndex(elementsRef, { + startingIndex: prevIndex + (cols - prevIndex % cols), + decrement: true, + disabledIndices: disabledIndices + }); + } else if (loop) nextIndex = $56b436271f6666d1$var$findNonDisabledIndex(elementsRef, { + startingIndex: prevIndex + (cols - prevIndex % cols), + decrement: true, + disabledIndices: disabledIndices + }); + if ($56b436271f6666d1$var$isDifferentRow(nextIndex, cols, prevRow)) nextIndex = prevIndex; + } + const lastRow = (0, $fvpw6.floor)(maxIndex / cols) === prevRow; + if ($56b436271f6666d1$var$isIndexOutOfBounds(elementsRef, nextIndex)) { + if (loop && lastRow) nextIndex = event.key === $56b436271f6666d1$var$ARROW_LEFT ? maxIndex : $56b436271f6666d1$var$findNonDisabledIndex(elementsRef, { + startingIndex: prevIndex - prevIndex % cols - 1, + disabledIndices: disabledIndices + }); + else nextIndex = prevIndex; + } + } + return nextIndex; +} +let $56b436271f6666d1$var$rafId = 0; +function $56b436271f6666d1$var$enqueueFocus(el, options) { + if (options === void 0) options = {}; + const { preventScroll: preventScroll = false, cancelPrevious: cancelPrevious = true, sync: sync = false } = options; + cancelPrevious && cancelAnimationFrame($56b436271f6666d1$var$rafId); + const exec = ()=>el == null ? void 0 : el.focus({ + preventScroll: preventScroll + }); + if (sync) exec(); + else $56b436271f6666d1$var$rafId = requestAnimationFrame(exec); +} +var $56b436271f6666d1$var$index = typeof document !== "undefined" ? (0, $63SH6.useLayoutEffect) : (0, $63SH6.useEffect); +function $56b436271f6666d1$var$sortByDocumentPosition(a, b) { + const position = a.compareDocumentPosition(b); + if (position & Node.DOCUMENT_POSITION_FOLLOWING || position & Node.DOCUMENT_POSITION_CONTAINED_BY) return -1; + if (position & Node.DOCUMENT_POSITION_PRECEDING || position & Node.DOCUMENT_POSITION_CONTAINS) return 1; + return 0; +} +function $56b436271f6666d1$var$areMapsEqual(map1, map2) { + if (map1.size !== map2.size) return false; + for (const [key, value] of map1.entries()){ + if (value !== map2.get(key)) return false; + } + return true; +} +const $56b436271f6666d1$var$FloatingListContext = /*#__PURE__*/ $63SH6.createContext({ + register: ()=>{}, + unregister: ()=>{}, + map: /*#__PURE__*/ new Map(), + elementsRef: { + current: [] + } +}); +/** + * Provides context for a list of items within the floating element. + * @see https://floating-ui.com/docs/FloatingList + */ function $56b436271f6666d1$export$ffe15b0e64951704(_ref) { + let { children: children, elementsRef: elementsRef, labelsRef: labelsRef } = _ref; + const [map, setMap] = $63SH6.useState(()=>new Map()); + const register = $63SH6.useCallback((node)=>{ + setMap((prevMap)=>new Map(prevMap).set(node, null)); + }, []); + const unregister = $63SH6.useCallback((node)=>{ + setMap((prevMap)=>{ + const map = new Map(prevMap); + map.delete(node); + return map; + }); + }, []); + $56b436271f6666d1$var$index(()=>{ + const newMap = new Map(map); + const nodes = Array.from(newMap.keys()).sort($56b436271f6666d1$var$sortByDocumentPosition); + nodes.forEach((node, index)=>{ + newMap.set(node, index); + }); + if (!$56b436271f6666d1$var$areMapsEqual(map, newMap)) setMap(newMap); + }, [ + map + ]); + return /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$var$FloatingListContext.Provider, { + value: $63SH6.useMemo(()=>({ + register: register, + unregister: unregister, + map: map, + elementsRef: elementsRef, + labelsRef: labelsRef + }), [ + register, + unregister, + map, + elementsRef, + labelsRef + ]) + }, children); +} +function $56b436271f6666d1$export$dcdc7ff5149f7d1a(_temp) { + let { label: label } = _temp === void 0 ? {} : _temp; + const [index$1, setIndex] = $63SH6.useState(null); + const componentRef = $63SH6.useRef(null); + const { register: register, unregister: unregister, map: map, elementsRef: elementsRef, labelsRef: labelsRef } = $63SH6.useContext($56b436271f6666d1$var$FloatingListContext); + const ref = $63SH6.useCallback((node)=>{ + componentRef.current = node; + if (index$1 !== null) { + elementsRef.current[index$1] = node; + if (labelsRef) { + var _node$textContent; + const isLabelDefined = label !== undefined; + labelsRef.current[index$1] = isLabelDefined ? label : (_node$textContent = node == null ? void 0 : node.textContent) != null ? _node$textContent : null; + } + } + }, [ + index$1, + elementsRef, + labelsRef, + label + ]); + $56b436271f6666d1$var$index(()=>{ + const node = componentRef.current; + if (node) { + register(node); + return ()=>{ + unregister(node); + }; + } + }, [ + register, + unregister + ]); + $56b436271f6666d1$var$index(()=>{ + const index = componentRef.current ? map.get(componentRef.current) : null; + if (index != null) setIndex(index); + }, [ + map + ]); + return $63SH6.useMemo(()=>({ + ref: ref, + index: index$1 == null ? -1 : index$1 + }), [ + index$1, + ref + ]); +} +function $56b436271f6666d1$var$renderJsx(render, computedProps) { + if (typeof render === "function") return render(computedProps); + else if (render) return /*#__PURE__*/ $63SH6.cloneElement(render, computedProps); + return /*#__PURE__*/ $63SH6.createElement("div", computedProps); +} +const $56b436271f6666d1$var$CompositeContext = /*#__PURE__*/ $63SH6.createContext({ + activeIndex: 0, + onNavigate: ()=>{} +}); +const $56b436271f6666d1$var$horizontalKeys = [ + $56b436271f6666d1$var$ARROW_LEFT, + $56b436271f6666d1$var$ARROW_RIGHT +]; +const $56b436271f6666d1$var$verticalKeys = [ + $56b436271f6666d1$var$ARROW_UP, + $56b436271f6666d1$var$ARROW_DOWN +]; +const $56b436271f6666d1$var$allKeys = [ + ...$56b436271f6666d1$var$horizontalKeys, + ...$56b436271f6666d1$var$verticalKeys +]; +const $56b436271f6666d1$export$43586241d9db0c6d = /*#__PURE__*/ $63SH6.forwardRef(function Composite(_ref, forwardedRef) { + let { render: render, orientation: orientation = "both", loop: loop = true, cols: cols = 1, disabledIndices: disabledIndices, activeIndex: externalActiveIndex, onNavigate: externalSetActiveIndex, ...props } = _ref; + const [internalActiveIndex, internalSetActiveIndex] = $63SH6.useState(0); + const activeIndex = externalActiveIndex != null ? externalActiveIndex : internalActiveIndex; + const onNavigate = $56b436271f6666d1$var$useEffectEvent(externalSetActiveIndex != null ? externalSetActiveIndex : internalSetActiveIndex); + const elementsRef = $63SH6.useRef([]); + const renderElementProps = render && typeof render !== "function" ? render.props : {}; + const contextValue = $63SH6.useMemo(()=>({ + activeIndex: activeIndex, + onNavigate: onNavigate + }), [ + activeIndex, + onNavigate + ]); + const isGrid = cols > 1; + function handleKeyDown(event) { + if (!$56b436271f6666d1$var$allKeys.includes(event.key)) return; + const minIndex = $56b436271f6666d1$var$getMinIndex(elementsRef, disabledIndices); + const maxIndex = $56b436271f6666d1$var$getMaxIndex(elementsRef, disabledIndices); + const prevIndex = activeIndex; + let nextIndex = activeIndex; + if (isGrid) nextIndex = $56b436271f6666d1$var$getGridNavigatedIndex(elementsRef, { + event: event, + orientation: orientation, + loop: loop, + cols: cols, + disabledIndices: disabledIndices, + minIndex: minIndex, + maxIndex: maxIndex, + prevIndex: prevIndex + }); + const toEndKeys = { + horizontal: [ + $56b436271f6666d1$var$ARROW_RIGHT + ], + vertical: [ + $56b436271f6666d1$var$ARROW_DOWN + ], + both: [ + $56b436271f6666d1$var$ARROW_RIGHT, + $56b436271f6666d1$var$ARROW_DOWN + ] + }[orientation]; + const toStartKeys = { + horizontal: [ + $56b436271f6666d1$var$ARROW_LEFT + ], + vertical: [ + $56b436271f6666d1$var$ARROW_UP + ], + both: [ + $56b436271f6666d1$var$ARROW_LEFT, + $56b436271f6666d1$var$ARROW_UP + ] + }[orientation]; + const preventedKeys = isGrid ? $56b436271f6666d1$var$allKeys : ({ + horizontal: $56b436271f6666d1$var$horizontalKeys, + vertical: $56b436271f6666d1$var$verticalKeys, + both: $56b436271f6666d1$var$allKeys + })[orientation]; + if (nextIndex === activeIndex && [ + ...toEndKeys, + ...toStartKeys + ].includes(event.key)) { + if (loop && nextIndex === maxIndex && toEndKeys.includes(event.key)) nextIndex = minIndex; + else if (loop && nextIndex === minIndex && toStartKeys.includes(event.key)) nextIndex = maxIndex; + else nextIndex = $56b436271f6666d1$var$findNonDisabledIndex(elementsRef, { + startingIndex: nextIndex, + decrement: toStartKeys.includes(event.key), + disabledIndices: disabledIndices + }); + } + if (nextIndex !== activeIndex && !$56b436271f6666d1$var$isIndexOutOfBounds(elementsRef, nextIndex)) { + event.stopPropagation(); + if (preventedKeys.includes(event.key)) event.preventDefault(); + onNavigate(nextIndex); + // Wait for FocusManager `returnFocus` to execute. + queueMicrotask(()=>{ + $56b436271f6666d1$var$enqueueFocus(elementsRef.current[nextIndex]); + }); + } + } + const computedProps = { + ...props, + ...renderElementProps, + ref: forwardedRef, + "aria-orientation": orientation === "both" ? undefined : orientation, + onKeyDown (e) { + props.onKeyDown == null || props.onKeyDown(e); + renderElementProps.onKeyDown == null || renderElementProps.onKeyDown(e); + handleKeyDown(e); + } + }; + return /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$var$CompositeContext.Provider, { + value: contextValue + }, /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$export$ffe15b0e64951704, { + elementsRef: elementsRef + }, $56b436271f6666d1$var$renderJsx(render, computedProps))); +}); +const $56b436271f6666d1$export$ef1ef7a3a43ace8e = /*#__PURE__*/ $63SH6.forwardRef(function CompositeItem(_ref2, forwardedRef) { + let { render: render, ...props } = _ref2; + const renderElementProps = render && typeof render !== "function" ? render.props : {}; + const { activeIndex: activeIndex, onNavigate: onNavigate } = $63SH6.useContext($56b436271f6666d1$var$CompositeContext); + const { ref: ref, index: index } = $56b436271f6666d1$export$dcdc7ff5149f7d1a(); + const mergedRef = $56b436271f6666d1$export$74665b213cb5c4cf([ + ref, + forwardedRef, + renderElementProps.ref + ]); + const isActive = activeIndex === index; + const computedProps = { + ...props, + ...renderElementProps, + ref: mergedRef, + tabIndex: isActive ? 0 : -1, + "data-active": isActive ? "" : undefined, + onFocus (e) { + props.onFocus == null || props.onFocus(e); + renderElementProps.onFocus == null || renderElementProps.onFocus(e); + onNavigate(index); + } + }; + return $56b436271f6666d1$var$renderJsx(render, computedProps); +}); +function $56b436271f6666d1$var$_extends() { + $56b436271f6666d1$var$_extends = Object.assign ? Object.assign.bind() : function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return $56b436271f6666d1$var$_extends.apply(this, arguments); +} +let $56b436271f6666d1$var$serverHandoffComplete = false; +let $56b436271f6666d1$var$count = 0; +const $56b436271f6666d1$var$genId = ()=>"floating-ui-" + $56b436271f6666d1$var$count++; +function $56b436271f6666d1$var$useFloatingId() { + const [id, setId] = $63SH6.useState(()=>$56b436271f6666d1$var$serverHandoffComplete ? $56b436271f6666d1$var$genId() : undefined); + $56b436271f6666d1$var$index(()=>{ + if (id == null) setId($56b436271f6666d1$var$genId()); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + $63SH6.useEffect(()=>{ + if (!$56b436271f6666d1$var$serverHandoffComplete) $56b436271f6666d1$var$serverHandoffComplete = true; + }, []); + return id; +} +// `toString()` prevents bundlers from trying to `import { useId } from 'react'` +const $56b436271f6666d1$var$useReactId = $63SH6[/*#__PURE__*/ "useId".toString()]; +/** + * Uses React 18's built-in `useId()` when available, or falls back to a + * slightly less performant (requiring a double render) implementation for + * earlier React versions. + * @see https://floating-ui.com/docs/useId + */ const $56b436271f6666d1$export$f680877a34711e37 = $56b436271f6666d1$var$useReactId || $56b436271f6666d1$var$useFloatingId; +/** + * Renders a pointing arrow triangle. + * @see https://floating-ui.com/docs/FloatingArrow + */ const $56b436271f6666d1$export$33511391554732bc = /*#__PURE__*/ $63SH6.forwardRef(function FloatingArrow(_ref, ref) { + let { context: { placement: placement, elements: { floating: floating }, middlewareData: { arrow: arrow } }, width: width = 14, height: height = 7, tipRadius: tipRadius = 0, strokeWidth: strokeWidth = 0, staticOffset: staticOffset, stroke: stroke, d: d, style: { transform: transform, ...restStyle } = {}, ...rest } = _ref; + const clipPathId = $56b436271f6666d1$export$f680877a34711e37(); + if (!floating) return null; + // Strokes must be double the border width, this ensures the stroke's width + // works as you'd expect. + strokeWidth *= 2; + const halfStrokeWidth = strokeWidth / 2; + const svgX = width / 2 * (tipRadius / -8 + 1); + const svgY = height / 2 * tipRadius / 4; + const [side, alignment] = placement.split("-"); + const isRTL = (0, $91fsP.platform).isRTL(floating); + const isCustomShape = !!d; + const isVerticalSide = side === "top" || side === "bottom"; + const yOffsetProp = staticOffset && alignment === "end" ? "bottom" : "top"; + let xOffsetProp = staticOffset && alignment === "end" ? "right" : "left"; + if (staticOffset && isRTL) xOffsetProp = alignment === "end" ? "left" : "right"; + const arrowX = (arrow == null ? void 0 : arrow.x) != null ? staticOffset || arrow.x : ""; + const arrowY = (arrow == null ? void 0 : arrow.y) != null ? staticOffset || arrow.y : ""; + const dValue = d || "M0,0" + (" H" + width) + (" L" + (width - svgX) + "," + (height - svgY)) + (" Q" + width / 2 + "," + height + " " + svgX + "," + (height - svgY)) + " Z"; + const rotation = { + top: isCustomShape ? "rotate(180deg)" : "", + left: isCustomShape ? "rotate(90deg)" : "rotate(-90deg)", + bottom: isCustomShape ? "" : "rotate(180deg)", + right: isCustomShape ? "rotate(-90deg)" : "rotate(90deg)" + }[side]; + return /*#__PURE__*/ $63SH6.createElement("svg", $56b436271f6666d1$var$_extends({}, rest, { + "aria-hidden": true, + ref: ref, + width: isCustomShape ? width : width + strokeWidth, + height: width, + viewBox: "0 0 " + width + " " + (height > width ? height : width), + style: { + position: "absolute", + pointerEvents: "none", + [xOffsetProp]: arrowX, + [yOffsetProp]: arrowY, + [side]: isVerticalSide || isCustomShape ? "100%" : "calc(100% - " + strokeWidth / 2 + "px)", + transform: "" + rotation + (transform != null ? transform : ""), + ...restStyle + } + }), strokeWidth > 0 && /*#__PURE__*/ $63SH6.createElement("path", { + clipPath: "url(#" + clipPathId + ")", + fill: "none", + stroke: stroke, + strokeWidth: strokeWidth + (d ? 0 : 1), + d: dValue + }), /*#__PURE__*/ $63SH6.createElement("path", { + stroke: strokeWidth && !d ? rest.fill : "none", + d: dValue + }), /*#__PURE__*/ $63SH6.createElement("clipPath", { + id: clipPathId + }, /*#__PURE__*/ $63SH6.createElement("rect", { + x: -halfStrokeWidth, + y: halfStrokeWidth * (isCustomShape ? -1 : 1), + width: width + strokeWidth, + height: width + }))); +}); +function $56b436271f6666d1$var$createPubSub() { + const map = new Map(); + return { + emit (event, data) { + var _map$get; + (_map$get = map.get(event)) == null || _map$get.forEach((handler)=>handler(data)); + }, + on (event, listener) { + map.set(event, [ + ...map.get(event) || [], + listener + ]); + }, + off (event, listener) { + var _map$get2; + map.set(event, ((_map$get2 = map.get(event)) == null ? void 0 : _map$get2.filter((l)=>l !== listener)) || []); + } + }; +} +const $56b436271f6666d1$var$FloatingNodeContext = /*#__PURE__*/ $63SH6.createContext(null); +const $56b436271f6666d1$var$FloatingTreeContext = /*#__PURE__*/ $63SH6.createContext(null); +const $56b436271f6666d1$export$165209eae06d3488 = ()=>{ + var _React$useContext; + return ((_React$useContext = $63SH6.useContext($56b436271f6666d1$var$FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null; +}; +const $56b436271f6666d1$export$db0c2a7c7a2a4f69 = ()=>$63SH6.useContext($56b436271f6666d1$var$FloatingTreeContext); +/** + * Registers a node into the floating tree, returning its id. + */ function $56b436271f6666d1$export$9b136e0e758a42f4(customParentId) { + const id = $56b436271f6666d1$export$f680877a34711e37(); + const tree = $56b436271f6666d1$export$db0c2a7c7a2a4f69(); + const reactParentId = $56b436271f6666d1$export$165209eae06d3488(); + const parentId = customParentId || reactParentId; + $56b436271f6666d1$var$index(()=>{ + const node = { + id: id, + parentId: parentId + }; + tree == null || tree.addNode(node); + return ()=>{ + tree == null || tree.removeNode(node); + }; + }, [ + tree, + id, + parentId + ]); + return id; +} +/** + * Provides parent node context for nested floating elements. + * @see https://floating-ui.com/docs/FloatingTree + */ function $56b436271f6666d1$export$ca00a83b5b253862(_ref) { + let { children: children, id: id } = _ref; + const parentId = $56b436271f6666d1$export$165209eae06d3488(); + return /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$var$FloatingNodeContext.Provider, { + value: $63SH6.useMemo(()=>({ + id: id, + parentId: parentId + }), [ + id, + parentId + ]) + }, children); +} +/** + * Provides context for nested floating elements when they are not children of + * each other on the DOM (i.e. portalled to a common node, rather than their + * respective parent). + * @see https://floating-ui.com/docs/FloatingTree + */ function $56b436271f6666d1$export$587b60129641c4c8(_ref2) { + let { children: children } = _ref2; + const nodesRef = $63SH6.useRef([]); + const addNode = $63SH6.useCallback((node)=>{ + nodesRef.current = [ + ...nodesRef.current, + node + ]; + }, []); + const removeNode = $63SH6.useCallback((node)=>{ + nodesRef.current = nodesRef.current.filter((n)=>n !== node); + }, []); + const events = $63SH6.useState(()=>$56b436271f6666d1$var$createPubSub())[0]; + return /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$var$FloatingTreeContext.Provider, { + value: $63SH6.useMemo(()=>({ + nodesRef: nodesRef, + addNode: addNode, + removeNode: removeNode, + events: events + }), [ + nodesRef, + addNode, + removeNode, + events + ]) + }, children); +} +function $56b436271f6666d1$var$createAttribute(name) { + return "data-floating-ui-" + name; +} +function $56b436271f6666d1$var$useLatestRef(value) { + const ref = (0, $63SH6.useRef)(value); + $56b436271f6666d1$var$index(()=>{ + ref.current = value; + }); + return ref; +} +const $56b436271f6666d1$var$safePolygonIdentifier = /*#__PURE__*/ $56b436271f6666d1$var$createAttribute("safe-polygon"); +function $56b436271f6666d1$var$getDelay(value, prop, pointerType) { + if (pointerType && !(0, $d8YHU.isMouseLikePointerType)(pointerType)) return 0; + if (typeof value === "number") return value; + return value == null ? void 0 : value[prop]; +} +/** + * Opens the floating element while hovering over the reference element, like + * CSS `:hover`. + * @see https://floating-ui.com/docs/useHover + */ function $56b436271f6666d1$export$ae780daf29e6d456(context, props) { + if (props === void 0) props = {}; + const { open: open, onOpenChange: onOpenChange, dataRef: dataRef, events: events, elements: { domReference: domReference, floating: floating }, refs: refs } = context; + const { enabled: enabled = true, delay: delay = 0, handleClose: handleClose = null, mouseOnly: mouseOnly = false, restMs: restMs = 0, move: move = true } = props; + const tree = $56b436271f6666d1$export$db0c2a7c7a2a4f69(); + const parentId = $56b436271f6666d1$export$165209eae06d3488(); + const handleCloseRef = $56b436271f6666d1$var$useLatestRef(handleClose); + const delayRef = $56b436271f6666d1$var$useLatestRef(delay); + const pointerTypeRef = $63SH6.useRef(); + const timeoutRef = $63SH6.useRef(); + const handlerRef = $63SH6.useRef(); + const restTimeoutRef = $63SH6.useRef(); + const blockMouseMoveRef = $63SH6.useRef(true); + const performedPointerEventsMutationRef = $63SH6.useRef(false); + const unbindMouseMoveRef = $63SH6.useRef(()=>{}); + const isHoverOpen = $63SH6.useCallback(()=>{ + var _dataRef$current$open; + const type = (_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type; + return (type == null ? void 0 : type.includes("mouse")) && type !== "mousedown"; + }, [ + dataRef + ]); + // When dismissing before opening, clear the delay timeouts to cancel it + // from showing. + $63SH6.useEffect(()=>{ + if (!enabled) return; + function onDismiss() { + clearTimeout(timeoutRef.current); + clearTimeout(restTimeoutRef.current); + blockMouseMoveRef.current = true; + } + events.on("dismiss", onDismiss); + return ()=>{ + events.off("dismiss", onDismiss); + }; + }, [ + enabled, + events + ]); + $63SH6.useEffect(()=>{ + if (!enabled || !handleCloseRef.current || !open) return; + function onLeave(event) { + if (isHoverOpen()) onOpenChange(false, event); + } + const html = (0, $d8YHU.getDocument)(floating).documentElement; + html.addEventListener("mouseleave", onLeave); + return ()=>{ + html.removeEventListener("mouseleave", onLeave); + }; + }, [ + floating, + open, + onOpenChange, + enabled, + handleCloseRef, + dataRef, + isHoverOpen + ]); + const closeWithDelay = $63SH6.useCallback(function(event, runElseBranch) { + if (runElseBranch === void 0) runElseBranch = true; + const closeDelay = $56b436271f6666d1$var$getDelay(delayRef.current, "close", pointerTypeRef.current); + if (closeDelay && !handlerRef.current) { + clearTimeout(timeoutRef.current); + timeoutRef.current = setTimeout(()=>onOpenChange(false, event), closeDelay); + } else if (runElseBranch) { + clearTimeout(timeoutRef.current); + onOpenChange(false, event); + } + }, [ + delayRef, + onOpenChange + ]); + const cleanupMouseMoveHandler = $63SH6.useCallback(()=>{ + unbindMouseMoveRef.current(); + handlerRef.current = undefined; + }, []); + const clearPointerEvents = $63SH6.useCallback(()=>{ + if (performedPointerEventsMutationRef.current) { + const body = (0, $d8YHU.getDocument)(refs.floating.current).body; + body.style.pointerEvents = ""; + body.removeAttribute($56b436271f6666d1$var$safePolygonIdentifier); + performedPointerEventsMutationRef.current = false; + } + }, [ + refs + ]); + // Registering the mouse events on the reference directly to bypass React's + // delegation system. If the cursor was on a disabled element and then entered + // the reference (no gap), `mouseenter` doesn't fire in the delegation system. + $63SH6.useEffect(()=>{ + if (!enabled) return; + function isClickLikeOpenEvent() { + return dataRef.current.openEvent ? [ + "click", + "mousedown" + ].includes(dataRef.current.openEvent.type) : false; + } + function onMouseEnter(event) { + clearTimeout(timeoutRef.current); + blockMouseMoveRef.current = false; + if (mouseOnly && !(0, $d8YHU.isMouseLikePointerType)(pointerTypeRef.current) || restMs > 0 && $56b436271f6666d1$var$getDelay(delayRef.current, "open") === 0) return; + const openDelay = $56b436271f6666d1$var$getDelay(delayRef.current, "open", pointerTypeRef.current); + if (openDelay) timeoutRef.current = setTimeout(()=>{ + onOpenChange(true, event); + }, openDelay); + else onOpenChange(true, event); + } + function onMouseLeave(event) { + if (isClickLikeOpenEvent()) return; + unbindMouseMoveRef.current(); + const doc = (0, $d8YHU.getDocument)(floating); + clearTimeout(restTimeoutRef.current); + if (handleCloseRef.current) { + // Prevent clearing `onScrollMouseLeave` timeout. + if (!open) clearTimeout(timeoutRef.current); + handlerRef.current = handleCloseRef.current({ + ...context, + tree: tree, + x: event.clientX, + y: event.clientY, + onClose () { + clearPointerEvents(); + cleanupMouseMoveHandler(); + // Should the event expose that it was closed by `safePolygon`? + closeWithDelay(event); + } + }); + const handler = handlerRef.current; + doc.addEventListener("mousemove", handler); + unbindMouseMoveRef.current = ()=>{ + doc.removeEventListener("mousemove", handler); + }; + return; + } + // Allow interactivity without `safePolygon` on touch devices. With a + // pointer, a short close delay is an alternative, so it should work + // consistently. + const shouldClose = pointerTypeRef.current === "touch" ? !(0, $d8YHU.contains)(floating, event.relatedTarget) : true; + if (shouldClose) closeWithDelay(event); + } + // Ensure the floating element closes after scrolling even if the pointer + // did not move. + // https://github.com/floating-ui/floating-ui/discussions/1692 + function onScrollMouseLeave(event) { + if (isClickLikeOpenEvent()) return; + handleCloseRef.current == null || handleCloseRef.current({ + ...context, + tree: tree, + x: event.clientX, + y: event.clientY, + onClose () { + clearPointerEvents(); + cleanupMouseMoveHandler(); + closeWithDelay(event); + } + })(event); + } + if ((0, $8Xnp2.isElement)(domReference)) { + const ref = domReference; + open && ref.addEventListener("mouseleave", onScrollMouseLeave); + floating == null || floating.addEventListener("mouseleave", onScrollMouseLeave); + move && ref.addEventListener("mousemove", onMouseEnter, { + once: true + }); + ref.addEventListener("mouseenter", onMouseEnter); + ref.addEventListener("mouseleave", onMouseLeave); + return ()=>{ + open && ref.removeEventListener("mouseleave", onScrollMouseLeave); + floating == null || floating.removeEventListener("mouseleave", onScrollMouseLeave); + move && ref.removeEventListener("mousemove", onMouseEnter); + ref.removeEventListener("mouseenter", onMouseEnter); + ref.removeEventListener("mouseleave", onMouseLeave); + }; + } + }, [ + domReference, + floating, + enabled, + context, + mouseOnly, + restMs, + move, + closeWithDelay, + cleanupMouseMoveHandler, + clearPointerEvents, + onOpenChange, + open, + tree, + delayRef, + handleCloseRef, + dataRef + ]); + // Block pointer-events of every element other than the reference and floating + // while the floating element is open and has a `handleClose` handler. Also + // handles nested floating elements. + // https://github.com/floating-ui/floating-ui/issues/1722 + $56b436271f6666d1$var$index(()=>{ + var _handleCloseRef$curre; + if (!enabled) return; + if (open && (_handleCloseRef$curre = handleCloseRef.current) != null && _handleCloseRef$curre.__options.blockPointerEvents && isHoverOpen()) { + const body = (0, $d8YHU.getDocument)(floating).body; + body.setAttribute($56b436271f6666d1$var$safePolygonIdentifier, ""); + body.style.pointerEvents = "none"; + performedPointerEventsMutationRef.current = true; + if ((0, $8Xnp2.isElement)(domReference) && floating) { + var _tree$nodesRef$curren, _tree$nodesRef$curren2; + const ref = domReference; + const parentFloating = tree == null ? void 0 : (_tree$nodesRef$curren = tree.nodesRef.current.find((node)=>node.id === parentId)) == null ? void 0 : (_tree$nodesRef$curren2 = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren2.elements.floating; + if (parentFloating) parentFloating.style.pointerEvents = ""; + ref.style.pointerEvents = "auto"; + floating.style.pointerEvents = "auto"; + return ()=>{ + ref.style.pointerEvents = ""; + floating.style.pointerEvents = ""; + }; + } + } + }, [ + enabled, + open, + parentId, + floating, + domReference, + tree, + handleCloseRef, + dataRef, + isHoverOpen + ]); + $56b436271f6666d1$var$index(()=>{ + if (!open) { + pointerTypeRef.current = undefined; + cleanupMouseMoveHandler(); + clearPointerEvents(); + } + }, [ + open, + cleanupMouseMoveHandler, + clearPointerEvents + ]); + $63SH6.useEffect(()=>{ + return ()=>{ + cleanupMouseMoveHandler(); + clearTimeout(timeoutRef.current); + clearTimeout(restTimeoutRef.current); + clearPointerEvents(); + }; + }, [ + enabled, + domReference, + cleanupMouseMoveHandler, + clearPointerEvents + ]); + return $63SH6.useMemo(()=>{ + if (!enabled) return {}; + function setPointerRef(event) { + pointerTypeRef.current = event.pointerType; + } + return { + reference: { + onPointerDown: setPointerRef, + onPointerEnter: setPointerRef, + onMouseMove (event) { + if (open || restMs === 0) return; + clearTimeout(restTimeoutRef.current); + restTimeoutRef.current = setTimeout(()=>{ + if (!blockMouseMoveRef.current) onOpenChange(true, event.nativeEvent); + }, restMs); + } + }, + floating: { + onMouseEnter () { + clearTimeout(timeoutRef.current); + }, + onMouseLeave (event) { + events.emit("dismiss", { + type: "mouseLeave", + data: { + returnFocus: false + } + }); + closeWithDelay(event.nativeEvent, false); + } + } + }; + }, [ + events, + enabled, + restMs, + open, + onOpenChange, + closeWithDelay + ]); +} +const $56b436271f6666d1$var$FloatingDelayGroupContext = /*#__PURE__*/ $63SH6.createContext({ + delay: 0, + initialDelay: 0, + timeoutMs: 0, + currentId: null, + setCurrentId: ()=>{}, + setState: ()=>{}, + isInstantPhase: false +}); +const $56b436271f6666d1$export$e2411914b150383d = ()=>$63SH6.useContext($56b436271f6666d1$var$FloatingDelayGroupContext); +/** + * Provides context for a group of floating elements that should share a + * `delay`. + * @see https://floating-ui.com/docs/FloatingDelayGroup + */ const $56b436271f6666d1$export$718279509ff1e241 = (_ref)=>{ + let { children: children, delay: delay, timeoutMs: timeoutMs = 0 } = _ref; + const [state, setState] = $63SH6.useReducer((prev, next)=>({ + ...prev, + ...next + }), { + delay: delay, + timeoutMs: timeoutMs, + initialDelay: delay, + currentId: null, + isInstantPhase: false + }); + const initialCurrentIdRef = $63SH6.useRef(null); + const setCurrentId = $63SH6.useCallback((currentId)=>{ + setState({ + currentId: currentId + }); + }, []); + $56b436271f6666d1$var$index(()=>{ + if (state.currentId) { + if (initialCurrentIdRef.current === null) initialCurrentIdRef.current = state.currentId; + else setState({ + isInstantPhase: true + }); + } else { + setState({ + isInstantPhase: false + }); + initialCurrentIdRef.current = null; + } + }, [ + state.currentId + ]); + return /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$var$FloatingDelayGroupContext.Provider, { + value: $63SH6.useMemo(()=>({ + ...state, + setState: setState, + setCurrentId: setCurrentId + }), [ + state, + setState, + setCurrentId + ]) + }, children); +}; +const $56b436271f6666d1$export$560fc8be89c8b4a8 = (_ref2, _ref3)=>{ + let { open: open, onOpenChange: onOpenChange } = _ref2; + let { id: id } = _ref3; + const { currentId: currentId, setCurrentId: setCurrentId, initialDelay: initialDelay, setState: setState, timeoutMs: timeoutMs } = $56b436271f6666d1$export$e2411914b150383d(); + $56b436271f6666d1$var$index(()=>{ + if (currentId) { + setState({ + delay: { + open: 1, + close: $56b436271f6666d1$var$getDelay(initialDelay, "close") + } + }); + if (currentId !== id) onOpenChange(false); + } + }, [ + id, + onOpenChange, + setState, + currentId, + initialDelay + ]); + $56b436271f6666d1$var$index(()=>{ + function unset() { + onOpenChange(false); + setState({ + delay: initialDelay, + currentId: null + }); + } + if (!open && currentId === id) { + if (timeoutMs) { + const timeout = window.setTimeout(unset, timeoutMs); + return ()=>{ + clearTimeout(timeout); + }; + } else unset(); + } + }, [ + open, + setState, + currentId, + id, + onOpenChange, + initialDelay, + timeoutMs + ]); + $56b436271f6666d1$var$index(()=>{ + if (open) setCurrentId(id); + }, [ + open, + setCurrentId, + id + ]); +}; +function $56b436271f6666d1$var$getAncestors(nodes, id) { + var _nodes$find; + let allAncestors = []; + let currentParentId = (_nodes$find = nodes.find((node)=>node.id === id)) == null ? void 0 : _nodes$find.parentId; + while(currentParentId){ + const currentNode = nodes.find((node)=>node.id === currentParentId); + currentParentId = currentNode == null ? void 0 : currentNode.parentId; + if (currentNode) allAncestors = allAncestors.concat(currentNode); + } + return allAncestors; +} +function $56b436271f6666d1$var$getChildren(nodes, id) { + let allChildren = nodes.filter((node)=>{ + var _node$context; + return node.parentId === id && ((_node$context = node.context) == null ? void 0 : _node$context.open); + }); + let currentChildren = allChildren; + while(currentChildren.length){ + currentChildren = nodes.filter((node)=>{ + var _currentChildren; + return (_currentChildren = currentChildren) == null ? void 0 : _currentChildren.some((n)=>{ + var _node$context2; + return node.parentId === n.id && ((_node$context2 = node.context) == null ? void 0 : _node$context2.open); + }); + }); + allChildren = allChildren.concat(currentChildren); + } + return allChildren; +} +function $56b436271f6666d1$var$getDeepestNode(nodes, id) { + let deepestNodeId; + let maxDepth = -1; + function findDeepest(nodeId, depth) { + if (depth > maxDepth) { + deepestNodeId = nodeId; + maxDepth = depth; + } + const children = $56b436271f6666d1$var$getChildren(nodes, nodeId); + children.forEach((child)=>{ + findDeepest(child.id, depth + 1); + }); + } + findDeepest(id, 0); + return nodes.find((node)=>node.id === deepestNodeId); +} +// Modified to add conditional `aria-hidden` support: +// https://github.com/theKashey/aria-hidden/blob/9220c8f4a4fd35f63bee5510a9f41a37264382d4/src/index.ts +let $56b436271f6666d1$var$counterMap = /*#__PURE__*/ new WeakMap(); +let $56b436271f6666d1$var$uncontrolledElementsSet = /*#__PURE__*/ new WeakSet(); +let $56b436271f6666d1$var$markerMap = {}; +let $56b436271f6666d1$var$lockCount = 0; +const $56b436271f6666d1$var$supportsInert = ()=>typeof HTMLElement !== "undefined" && "inert" in HTMLElement.prototype; +const $56b436271f6666d1$var$unwrapHost = (node)=>node && (node.host || $56b436271f6666d1$var$unwrapHost(node.parentNode)); +const $56b436271f6666d1$var$correctElements = (parent, targets)=>targets.map((target)=>{ + if (parent.contains(target)) return target; + const correctedTarget = $56b436271f6666d1$var$unwrapHost(target); + if (parent.contains(correctedTarget)) return correctedTarget; + return null; + }).filter((x)=>x != null); +function $56b436271f6666d1$var$applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert) { + const markerName = "data-floating-ui-inert"; + const controlAttribute = inert ? "inert" : ariaHidden ? "aria-hidden" : null; + const avoidElements = $56b436271f6666d1$var$correctElements(body, uncorrectedAvoidElements); + const elementsToKeep = new Set(); + const elementsToStop = new Set(avoidElements); + const hiddenElements = []; + if (!$56b436271f6666d1$var$markerMap[markerName]) $56b436271f6666d1$var$markerMap[markerName] = new WeakMap(); + const markerCounter = $56b436271f6666d1$var$markerMap[markerName]; + avoidElements.forEach(keep); + deep(body); + elementsToKeep.clear(); + function keep(el) { + if (!el || elementsToKeep.has(el)) return; + elementsToKeep.add(el); + el.parentNode && keep(el.parentNode); + } + function deep(parent) { + if (!parent || elementsToStop.has(parent)) return; + Array.prototype.forEach.call(parent.children, (node)=>{ + if (elementsToKeep.has(node)) deep(node); + else { + const attr = controlAttribute ? node.getAttribute(controlAttribute) : null; + const alreadyHidden = attr !== null && attr !== "false"; + const counterValue = ($56b436271f6666d1$var$counterMap.get(node) || 0) + 1; + const markerValue = (markerCounter.get(node) || 0) + 1; + $56b436271f6666d1$var$counterMap.set(node, counterValue); + markerCounter.set(node, markerValue); + hiddenElements.push(node); + if (counterValue === 1 && alreadyHidden) $56b436271f6666d1$var$uncontrolledElementsSet.add(node); + if (markerValue === 1) node.setAttribute(markerName, ""); + if (!alreadyHidden && controlAttribute) node.setAttribute(controlAttribute, "true"); + } + }); + } + $56b436271f6666d1$var$lockCount++; + return ()=>{ + hiddenElements.forEach((element)=>{ + const counterValue = ($56b436271f6666d1$var$counterMap.get(element) || 0) - 1; + const markerValue = (markerCounter.get(element) || 0) - 1; + $56b436271f6666d1$var$counterMap.set(element, counterValue); + markerCounter.set(element, markerValue); + if (!counterValue) { + if (!$56b436271f6666d1$var$uncontrolledElementsSet.has(element) && controlAttribute) element.removeAttribute(controlAttribute); + $56b436271f6666d1$var$uncontrolledElementsSet.delete(element); + } + if (!markerValue) element.removeAttribute(markerName); + }); + $56b436271f6666d1$var$lockCount--; + if (!$56b436271f6666d1$var$lockCount) { + $56b436271f6666d1$var$counterMap = new WeakMap(); + $56b436271f6666d1$var$counterMap = new WeakMap(); + $56b436271f6666d1$var$uncontrolledElementsSet = new WeakSet(); + $56b436271f6666d1$var$markerMap = {}; + } + }; +} +function $56b436271f6666d1$var$markOthers(avoidElements, ariaHidden, inert) { + if (ariaHidden === void 0) ariaHidden = false; + if (inert === void 0) inert = false; + const body = (0, $d8YHU.getDocument)(avoidElements[0]).body; + return $56b436271f6666d1$var$applyAttributeToOthers(avoidElements.concat(Array.from(body.querySelectorAll("[aria-live]"))), body, ariaHidden, inert); +} +const $56b436271f6666d1$var$getTabbableOptions = ()=>({ + getShadowRoot: true, + displayCheck: // JSDOM does not support the `tabbable` library. To solve this we can + // check if `ResizeObserver` is a real function (not polyfilled), which + // determines if the current environment is JSDOM-like. + typeof ResizeObserver === "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none" + }); +function $56b436271f6666d1$var$getTabbableIn(container, direction) { + const allTabbable = (0, $bqiJA.tabbable)(container, $56b436271f6666d1$var$getTabbableOptions()); + if (direction === "prev") allTabbable.reverse(); + const activeIndex = allTabbable.indexOf((0, $d8YHU.activeElement)((0, $d8YHU.getDocument)(container))); + const nextTabbableElements = allTabbable.slice(activeIndex + 1); + return nextTabbableElements[0]; +} +function $56b436271f6666d1$var$getNextTabbable() { + return $56b436271f6666d1$var$getTabbableIn(document.body, "next"); +} +function $56b436271f6666d1$var$getPreviousTabbable() { + return $56b436271f6666d1$var$getTabbableIn(document.body, "prev"); +} +function $56b436271f6666d1$var$isOutsideEvent(event, container) { + const containerElement = container || event.currentTarget; + const relatedTarget = event.relatedTarget; + return !relatedTarget || !(0, $d8YHU.contains)(containerElement, relatedTarget); +} +function $56b436271f6666d1$var$disableFocusInside(container) { + const tabbableElements = (0, $bqiJA.tabbable)(container, $56b436271f6666d1$var$getTabbableOptions()); + tabbableElements.forEach((element)=>{ + element.dataset.tabindex = element.getAttribute("tabindex") || ""; + element.setAttribute("tabindex", "-1"); + }); +} +function $56b436271f6666d1$var$enableFocusInside(container) { + const elements = container.querySelectorAll("[data-tabindex]"); + elements.forEach((element)=>{ + const tabindex = element.dataset.tabindex; + delete element.dataset.tabindex; + if (tabindex) element.setAttribute("tabindex", tabindex); + else element.removeAttribute("tabindex"); + }); +} +// See Diego Haz's Sandbox for making this logic work well on Safari/iOS: +// https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/FocusTrap.tsx +const $56b436271f6666d1$var$HIDDEN_STYLES = { + border: 0, + clip: "rect(0 0 0 0)", + height: "1px", + margin: "-1px", + overflow: "hidden", + padding: 0, + position: "fixed", + whiteSpace: "nowrap", + width: "1px", + top: 0, + left: 0 +}; +let $56b436271f6666d1$var$timeoutId; +function $56b436271f6666d1$var$setActiveElementOnTab(event) { + if (event.key === "Tab") { + event.target; + clearTimeout($56b436271f6666d1$var$timeoutId); + } +} +const $56b436271f6666d1$var$FocusGuard = /*#__PURE__*/ $63SH6.forwardRef(function FocusGuard(props, ref) { + const [role, setRole] = $63SH6.useState(); + $56b436271f6666d1$var$index(()=>{ + if ((0, $d8YHU.isSafari)()) // Unlike other screen readers such as NVDA and JAWS, the virtual cursor + // on VoiceOver does trigger the onFocus event, so we can use the focus + // trap element. On Safari, only buttons trigger the onFocus event. + // NB: "group" role in the Sandbox no longer appears to work, must be a + // button role. + setRole("button"); + document.addEventListener("keydown", $56b436271f6666d1$var$setActiveElementOnTab); + return ()=>{ + document.removeEventListener("keydown", $56b436271f6666d1$var$setActiveElementOnTab); + }; + }, []); + const restProps = { + ref: ref, + tabIndex: 0, + role: // Role is only for VoiceOver + role, + "aria-hidden": role ? undefined : true, + [$56b436271f6666d1$var$createAttribute("focus-guard")]: "", + style: $56b436271f6666d1$var$HIDDEN_STYLES + }; + return /*#__PURE__*/ $63SH6.createElement("span", $56b436271f6666d1$var$_extends({}, props, restProps)); +}); +const $56b436271f6666d1$var$PortalContext = /*#__PURE__*/ $63SH6.createContext(null); +function $56b436271f6666d1$export$ac107512f3c5cca6(_temp) { + let { id: id, root: root } = _temp === void 0 ? {} : _temp; + const [portalNode, setPortalNode] = $63SH6.useState(null); + const uniqueId = $56b436271f6666d1$export$f680877a34711e37(); + const portalContext = $56b436271f6666d1$var$usePortalContext(); + const data = $63SH6.useMemo(()=>({ + id: id, + root: root, + portalContext: portalContext, + uniqueId: uniqueId + }), [ + id, + root, + portalContext, + uniqueId + ]); + const dataRef = $63SH6.useRef(); + $56b436271f6666d1$var$index(()=>{ + return ()=>{ + portalNode == null || portalNode.remove(); + }; + }, [ + portalNode, + data + ]); + $56b436271f6666d1$var$index(()=>{ + if (dataRef.current === data) return; + dataRef.current = data; + const { id: id, root: root, portalContext: portalContext, uniqueId: uniqueId } = data; + const existingIdRoot = id ? document.getElementById(id) : null; + const attr = $56b436271f6666d1$var$createAttribute("portal"); + if (existingIdRoot) { + const subRoot = document.createElement("div"); + subRoot.id = uniqueId; + subRoot.setAttribute(attr, ""); + existingIdRoot.appendChild(subRoot); + setPortalNode(subRoot); + } else { + let container = root || (portalContext == null ? void 0 : portalContext.portalNode); + if (container && !(0, $8Xnp2.isElement)(container)) container = container.current; + container = container || document.body; + let idWrapper = null; + if (id) { + idWrapper = document.createElement("div"); + idWrapper.id = id; + container.appendChild(idWrapper); + } + const subRoot = document.createElement("div"); + subRoot.id = uniqueId; + subRoot.setAttribute(attr, ""); + container = idWrapper || container; + container.appendChild(subRoot); + setPortalNode(subRoot); + } + }, [ + data + ]); + return portalNode; +} +/** + * Portals the floating element into a given container element — by default, + * outside of the app root and into the body. + * @see https://floating-ui.com/docs/FloatingPortal + */ function $56b436271f6666d1$export$31fa5d718fa2ac09(_ref) { + let { children: children, id: id, root: root = null, preserveTabOrder: preserveTabOrder = true } = _ref; + const portalNode = $56b436271f6666d1$export$ac107512f3c5cca6({ + id: id, + root: root + }); + const [focusManagerState, setFocusManagerState] = $63SH6.useState(null); + const beforeOutsideRef = $63SH6.useRef(null); + const afterOutsideRef = $63SH6.useRef(null); + const beforeInsideRef = $63SH6.useRef(null); + const afterInsideRef = $63SH6.useRef(null); + const shouldRenderGuards = // The FocusManager and therefore floating element are currently open/ + // rendered. + !!focusManagerState && // Guards are only for non-modal focus management. + !focusManagerState.modal && // Don't render if unmount is transitioning. + focusManagerState.open && preserveTabOrder && !!(root || portalNode); + // https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/TabbablePortal.tsx + $63SH6.useEffect(()=>{ + if (!portalNode || !preserveTabOrder || focusManagerState != null && focusManagerState.modal) return; + // Make sure elements inside the portal element are tabbable only when the + // portal has already been focused, either by tabbing into a focus trap + // element outside or using the mouse. + function onFocus(event) { + if (portalNode && $56b436271f6666d1$var$isOutsideEvent(event)) { + const focusing = event.type === "focusin"; + const manageFocus = focusing ? $56b436271f6666d1$var$enableFocusInside : $56b436271f6666d1$var$disableFocusInside; + manageFocus(portalNode); + } + } + // Listen to the event on the capture phase so they run before the focus + // trap elements onFocus prop is called. + portalNode.addEventListener("focusin", onFocus, true); + portalNode.addEventListener("focusout", onFocus, true); + return ()=>{ + portalNode.removeEventListener("focusin", onFocus, true); + portalNode.removeEventListener("focusout", onFocus, true); + }; + }, [ + portalNode, + preserveTabOrder, + focusManagerState == null ? void 0 : focusManagerState.modal + ]); + return /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$var$PortalContext.Provider, { + value: $63SH6.useMemo(()=>({ + preserveTabOrder: preserveTabOrder, + beforeOutsideRef: beforeOutsideRef, + afterOutsideRef: afterOutsideRef, + beforeInsideRef: beforeInsideRef, + afterInsideRef: afterInsideRef, + portalNode: portalNode, + setFocusManagerState: setFocusManagerState + }), [ + preserveTabOrder, + portalNode + ]) + }, shouldRenderGuards && portalNode && /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$var$FocusGuard, { + "data-type": "outside", + ref: beforeOutsideRef, + onFocus: (event)=>{ + if ($56b436271f6666d1$var$isOutsideEvent(event, portalNode)) { + var _beforeInsideRef$curr; + (_beforeInsideRef$curr = beforeInsideRef.current) == null || _beforeInsideRef$curr.focus(); + } else { + const prevTabbable = $56b436271f6666d1$var$getPreviousTabbable() || (focusManagerState == null ? void 0 : focusManagerState.refs.domReference.current); + prevTabbable == null || prevTabbable.focus(); + } + } + }), shouldRenderGuards && portalNode && /*#__PURE__*/ $63SH6.createElement("span", { + "aria-owns": portalNode.id, + style: $56b436271f6666d1$var$HIDDEN_STYLES + }), portalNode && /*#__PURE__*/ (0, $grDIR.createPortal)(children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$var$FocusGuard, { + "data-type": "outside", + ref: afterOutsideRef, + onFocus: (event)=>{ + if ($56b436271f6666d1$var$isOutsideEvent(event, portalNode)) { + var _afterInsideRef$curre; + (_afterInsideRef$curre = afterInsideRef.current) == null || _afterInsideRef$curre.focus(); + } else { + const nextTabbable = $56b436271f6666d1$var$getNextTabbable() || (focusManagerState == null ? void 0 : focusManagerState.refs.domReference.current); + nextTabbable == null || nextTabbable.focus(); + (focusManagerState == null ? void 0 : focusManagerState.closeOnFocusOut) && (focusManagerState == null || focusManagerState.onOpenChange(false, event.nativeEvent)); + } + } + })); +} +const $56b436271f6666d1$var$usePortalContext = ()=>$63SH6.useContext($56b436271f6666d1$var$PortalContext); +const $56b436271f6666d1$var$VisuallyHiddenDismiss = /*#__PURE__*/ $63SH6.forwardRef(function VisuallyHiddenDismiss(props, ref) { + return /*#__PURE__*/ $63SH6.createElement("button", $56b436271f6666d1$var$_extends({}, props, { + type: "button", + ref: ref, + tabIndex: -1, + style: $56b436271f6666d1$var$HIDDEN_STYLES + })); +}); +/** + * Provides focus management for the floating element. + * @see https://floating-ui.com/docs/FloatingFocusManager + */ function $56b436271f6666d1$export$8aeee49171ded61a(props) { + const { context: context, children: children, disabled: disabled = false, order: order = [ + "content" + ], guards: _guards = true, initialFocus: initialFocus = 0, returnFocus: returnFocus = true, modal: originalModal = true, visuallyHiddenDismiss: visuallyHiddenDismiss = false, closeOnFocusOut: closeOnFocusOut = true } = props; + const { open: open, refs: refs, nodeId: nodeId, onOpenChange: onOpenChange, events: events, dataRef: dataRef, elements: { domReference: domReference, floating: floating } } = context; + const ignoreInitialFocus = typeof initialFocus === "number" && initialFocus < 0; + // If the reference is a combobox and is typeable (e.g. input/textarea), + // there are different focus semantics. The guards should not be rendered, but + // aria-hidden should be applied to all nodes still. Further, the visually + // hidden dismiss button should only appear at the end of the list, not the + // start. + const isUntrappedTypeableCombobox = (domReference == null ? void 0 : domReference.getAttribute("role")) === "combobox" && (0, $d8YHU.isTypeableElement)(domReference) && ignoreInitialFocus; + const modal = isUntrappedTypeableCombobox ? false : originalModal; + // Force the guards to be rendered if the `inert` attribute is not supported. + const guards = $56b436271f6666d1$var$supportsInert() ? _guards : true; + const orderRef = $56b436271f6666d1$var$useLatestRef(order); + const initialFocusRef = $56b436271f6666d1$var$useLatestRef(initialFocus); + const returnFocusRef = $56b436271f6666d1$var$useLatestRef(returnFocus); + const tree = $56b436271f6666d1$export$db0c2a7c7a2a4f69(); + const portalContext = $56b436271f6666d1$var$usePortalContext(); + const startDismissButtonRef = $63SH6.useRef(null); + const endDismissButtonRef = $63SH6.useRef(null); + const preventReturnFocusRef = $63SH6.useRef(false); + const previouslyFocusedElementRef = $63SH6.useRef(null); + const isPointerDownRef = $63SH6.useRef(false); + const isInsidePortal = portalContext != null; + const getTabbableContent = $63SH6.useCallback(function(container) { + if (container === void 0) container = floating; + return container ? (0, $bqiJA.tabbable)(container, $56b436271f6666d1$var$getTabbableOptions()) : []; + }, [ + floating + ]); + const getTabbableElements = $63SH6.useCallback((container)=>{ + const content = getTabbableContent(container); + return orderRef.current.map((type)=>{ + if (domReference && type === "reference") return domReference; + if (floating && type === "floating") return floating; + return content; + }).filter(Boolean).flat(); + }, [ + domReference, + floating, + orderRef, + getTabbableContent + ]); + $63SH6.useEffect(()=>{ + if (disabled || !modal) return; + function onKeyDown(event) { + if (event.key === "Tab") { + // The focus guards have nothing to focus, so we need to stop the event. + if ((0, $d8YHU.contains)(floating, (0, $d8YHU.activeElement)((0, $d8YHU.getDocument)(floating))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) (0, $d8YHU.stopEvent)(event); + const els = getTabbableElements(); + const target = (0, $d8YHU.getTarget)(event); + if (orderRef.current[0] === "reference" && target === domReference) { + (0, $d8YHU.stopEvent)(event); + if (event.shiftKey) $56b436271f6666d1$var$enqueueFocus(els[els.length - 1]); + else $56b436271f6666d1$var$enqueueFocus(els[1]); + } + if (orderRef.current[1] === "floating" && target === floating && event.shiftKey) { + (0, $d8YHU.stopEvent)(event); + $56b436271f6666d1$var$enqueueFocus(els[0]); + } + } + } + const doc = (0, $d8YHU.getDocument)(floating); + doc.addEventListener("keydown", onKeyDown); + return ()=>{ + doc.removeEventListener("keydown", onKeyDown); + }; + }, [ + disabled, + domReference, + floating, + modal, + orderRef, + refs, + isUntrappedTypeableCombobox, + getTabbableContent, + getTabbableElements + ]); + $63SH6.useEffect(()=>{ + if (disabled || !closeOnFocusOut) return; + // In Safari, buttons lose focus when pressing them. + function handlePointerDown() { + isPointerDownRef.current = true; + setTimeout(()=>{ + isPointerDownRef.current = false; + }); + } + function handleFocusOutside(event) { + const relatedTarget = event.relatedTarget; + queueMicrotask(()=>{ + const movedToUnrelatedNode = !((0, $d8YHU.contains)(domReference, relatedTarget) || (0, $d8YHU.contains)(floating, relatedTarget) || (0, $d8YHU.contains)(relatedTarget, floating) || (0, $d8YHU.contains)(portalContext == null ? void 0 : portalContext.portalNode, relatedTarget) || relatedTarget != null && relatedTarget.hasAttribute($56b436271f6666d1$var$createAttribute("focus-guard")) || tree && ($56b436271f6666d1$var$getChildren(tree.nodesRef.current, nodeId).find((node)=>{ + var _node$context, _node$context2; + return (0, $d8YHU.contains)((_node$context = node.context) == null ? void 0 : _node$context.elements.floating, relatedTarget) || (0, $d8YHU.contains)((_node$context2 = node.context) == null ? void 0 : _node$context2.elements.domReference, relatedTarget); + }) || $56b436271f6666d1$var$getAncestors(tree.nodesRef.current, nodeId).find((node)=>{ + var _node$context3, _node$context4; + return ((_node$context3 = node.context) == null ? void 0 : _node$context3.elements.floating) === relatedTarget || ((_node$context4 = node.context) == null ? void 0 : _node$context4.elements.domReference) === relatedTarget; + }))); + // Focus did not move inside the floating tree, and there are no tabbable + // portal guards to handle closing. + if (relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && // Fix React 18 Strict Mode returnFocus due to double rendering. + relatedTarget !== previouslyFocusedElementRef.current) { + preventReturnFocusRef.current = true; + onOpenChange(false, event); + } + }); + } + if (floating && (0, $8Xnp2.isHTMLElement)(domReference)) { + domReference.addEventListener("focusout", handleFocusOutside); + domReference.addEventListener("pointerdown", handlePointerDown); + !modal && floating.addEventListener("focusout", handleFocusOutside); + return ()=>{ + domReference.removeEventListener("focusout", handleFocusOutside); + domReference.removeEventListener("pointerdown", handlePointerDown); + !modal && floating.removeEventListener("focusout", handleFocusOutside); + }; + } + }, [ + disabled, + domReference, + floating, + modal, + nodeId, + tree, + portalContext, + onOpenChange, + closeOnFocusOut + ]); + $63SH6.useEffect(()=>{ + var _portalContext$portal; + if (disabled) return; + // Don't hide portals nested within the parent portal. + const portalNodes = Array.from((portalContext == null ? void 0 : (_portalContext$portal = portalContext.portalNode) == null ? void 0 : _portalContext$portal.querySelectorAll("[" + $56b436271f6666d1$var$createAttribute("portal") + "]")) || []); + if (floating) { + const insideElements = [ + floating, + ...portalNodes, + startDismissButtonRef.current, + endDismissButtonRef.current, + orderRef.current.includes("reference") || isUntrappedTypeableCombobox ? domReference : null + ].filter((x)=>x != null); + const cleanup = originalModal || isUntrappedTypeableCombobox ? $56b436271f6666d1$var$markOthers(insideElements, guards, !guards) : $56b436271f6666d1$var$markOthers(insideElements); + return ()=>{ + cleanup(); + }; + } + }, [ + disabled, + domReference, + floating, + originalModal, + orderRef, + portalContext, + isUntrappedTypeableCombobox, + guards + ]); + $56b436271f6666d1$var$index(()=>{ + if (disabled || !floating) return; + const doc = (0, $d8YHU.getDocument)(floating); + const previouslyFocusedElement = (0, $d8YHU.activeElement)(doc); + // Wait for any layout effect state setters to execute to set `tabIndex`. + queueMicrotask(()=>{ + const focusableElements = getTabbableElements(floating); + const initialFocusValue = initialFocusRef.current; + const elToFocus = (typeof initialFocusValue === "number" ? focusableElements[initialFocusValue] : initialFocusValue.current) || floating; + const focusAlreadyInsideFloatingEl = (0, $d8YHU.contains)(floating, previouslyFocusedElement); + if (!ignoreInitialFocus && !focusAlreadyInsideFloatingEl && open) $56b436271f6666d1$var$enqueueFocus(elToFocus, { + preventScroll: elToFocus === floating + }); + }); + }, [ + disabled, + open, + floating, + ignoreInitialFocus, + getTabbableElements, + initialFocusRef + ]); + $56b436271f6666d1$var$index(()=>{ + if (disabled || !floating) return; + let preventReturnFocusScroll = false; + const doc = (0, $d8YHU.getDocument)(floating); + const previouslyFocusedElement = (0, $d8YHU.activeElement)(doc); + const contextData = dataRef.current; + previouslyFocusedElementRef.current = previouslyFocusedElement; + // Dismissing via outside press should always ignore `returnFocus` to + // prevent unwanted scrolling. + function onDismiss(payload) { + if (payload.type === "escapeKey" && refs.domReference.current) previouslyFocusedElementRef.current = refs.domReference.current; + if ([ + "referencePress", + "escapeKey" + ].includes(payload.type)) return; + const returnFocus = payload.data.returnFocus; + if (typeof returnFocus === "object") { + preventReturnFocusRef.current = false; + preventReturnFocusScroll = returnFocus.preventScroll; + } else preventReturnFocusRef.current = !returnFocus; + } + events.on("dismiss", onDismiss); + return ()=>{ + events.off("dismiss", onDismiss); + const activeEl = (0, $d8YHU.activeElement)(doc); + const shouldFocusReference = (0, $d8YHU.contains)(floating, activeEl) || tree && $56b436271f6666d1$var$getChildren(tree.nodesRef.current, nodeId).some((node)=>{ + var _node$context5; + return (0, $d8YHU.contains)((_node$context5 = node.context) == null ? void 0 : _node$context5.elements.floating, activeEl); + }) || contextData.openEvent && [ + "click", + "mousedown" + ].includes(contextData.openEvent.type); + if (shouldFocusReference && refs.domReference.current) previouslyFocusedElementRef.current = refs.domReference.current; + if (// eslint-disable-next-line react-hooks/exhaustive-deps + returnFocusRef.current && (0, $8Xnp2.isHTMLElement)(previouslyFocusedElementRef.current) && !preventReturnFocusRef.current) $56b436271f6666d1$var$enqueueFocus(previouslyFocusedElementRef.current, { + // When dismissing nested floating elements, by the time the rAF has + // executed, the menus will all have been unmounted. When they try + // to get focused, the calls get ignored — leaving the root + // reference focused as desired. + cancelPrevious: false, + preventScroll: preventReturnFocusScroll + }); + }; + }, [ + disabled, + floating, + returnFocusRef, + dataRef, + refs, + events, + tree, + nodeId + ]); + // Synchronize the `context` & `modal` value to the FloatingPortal context. + // It will decide whether or not it needs to render its own guards. + $56b436271f6666d1$var$index(()=>{ + if (disabled || !portalContext) return; + portalContext.setFocusManagerState({ + modal: modal, + closeOnFocusOut: closeOnFocusOut, + open: open, + onOpenChange: onOpenChange, + refs: refs + }); + return ()=>{ + portalContext.setFocusManagerState(null); + }; + }, [ + disabled, + portalContext, + modal, + open, + onOpenChange, + refs, + closeOnFocusOut + ]); + $56b436271f6666d1$var$index(()=>{ + if (disabled || !floating || typeof MutationObserver !== "function" || ignoreInitialFocus) return; + const handleMutation = ()=>{ + const tabIndex = floating.getAttribute("tabindex"); + if (orderRef.current.includes("floating") || (0, $d8YHU.activeElement)((0, $d8YHU.getDocument)(floating)) !== refs.domReference.current && getTabbableContent().length === 0) { + if (tabIndex !== "0") floating.setAttribute("tabindex", "0"); + } else if (tabIndex !== "-1") floating.setAttribute("tabindex", "-1"); + }; + handleMutation(); + const observer = new MutationObserver(handleMutation); + observer.observe(floating, { + childList: true, + subtree: true, + attributes: true + }); + return ()=>{ + observer.disconnect(); + }; + }, [ + disabled, + floating, + refs, + orderRef, + getTabbableContent, + ignoreInitialFocus + ]); + function renderDismissButton(location) { + if (disabled || !visuallyHiddenDismiss || !modal) return null; + return /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$var$VisuallyHiddenDismiss, { + ref: location === "start" ? startDismissButtonRef : endDismissButtonRef, + onClick: (event)=>onOpenChange(false, event.nativeEvent) + }, typeof visuallyHiddenDismiss === "string" ? visuallyHiddenDismiss : "Dismiss"); + } + const shouldRenderGuards = !disabled && guards && (isInsidePortal || modal); + return /*#__PURE__*/ $63SH6.createElement($63SH6.Fragment, null, shouldRenderGuards && /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$var$FocusGuard, { + "data-type": "inside", + ref: portalContext == null ? void 0 : portalContext.beforeInsideRef, + onFocus: (event)=>{ + if (modal) { + const els = getTabbableElements(); + $56b436271f6666d1$var$enqueueFocus(order[0] === "reference" ? els[0] : els[els.length - 1]); + } else if (portalContext != null && portalContext.preserveTabOrder && portalContext.portalNode) { + preventReturnFocusRef.current = false; + if ($56b436271f6666d1$var$isOutsideEvent(event, portalContext.portalNode)) { + const nextTabbable = $56b436271f6666d1$var$getNextTabbable() || domReference; + nextTabbable == null || nextTabbable.focus(); + } else { + var _portalContext$before; + (_portalContext$before = portalContext.beforeOutsideRef.current) == null || _portalContext$before.focus(); + } + } + } + }), !isUntrappedTypeableCombobox && renderDismissButton("start"), children, renderDismissButton("end"), shouldRenderGuards && /*#__PURE__*/ $63SH6.createElement($56b436271f6666d1$var$FocusGuard, { + "data-type": "inside", + ref: portalContext == null ? void 0 : portalContext.afterInsideRef, + onFocus: (event)=>{ + if (modal) $56b436271f6666d1$var$enqueueFocus(getTabbableElements()[0]); + else if (portalContext != null && portalContext.preserveTabOrder && portalContext.portalNode) { + if (closeOnFocusOut) preventReturnFocusRef.current = true; + if ($56b436271f6666d1$var$isOutsideEvent(event, portalContext.portalNode)) { + const prevTabbable = $56b436271f6666d1$var$getPreviousTabbable() || domReference; + prevTabbable == null || prevTabbable.focus(); + } else { + var _portalContext$afterO; + (_portalContext$afterO = portalContext.afterOutsideRef.current) == null || _portalContext$afterO.focus(); + } + } + } + })); +} +const $56b436271f6666d1$var$activeLocks = /*#__PURE__*/ new Set(); +/** + * Provides base styling for a fixed overlay element to dim content or block + * pointer events behind a floating element. + * It's a regular `
`, so it can be styled via any CSS solution you prefer. + * @see https://floating-ui.com/docs/FloatingOverlay + */ const $56b436271f6666d1$export$a35954495955337b = /*#__PURE__*/ $63SH6.forwardRef(function FloatingOverlay(_ref, ref) { + let { lockScroll: lockScroll = false, ...rest } = _ref; + const lockId = $56b436271f6666d1$export$f680877a34711e37(); + $56b436271f6666d1$var$index(()=>{ + if (!lockScroll) return; + $56b436271f6666d1$var$activeLocks.add(lockId); + const isIOS = /iP(hone|ad|od)|iOS/.test((0, $d8YHU.getPlatform)()); + const bodyStyle = document.body.style; + // RTL scrollbar + const scrollbarX = Math.round(document.documentElement.getBoundingClientRect().left) + document.documentElement.scrollLeft; + const paddingProp = scrollbarX ? "paddingLeft" : "paddingRight"; + const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; + const scrollX = bodyStyle.left ? parseFloat(bodyStyle.left) : window.pageXOffset; + const scrollY = bodyStyle.top ? parseFloat(bodyStyle.top) : window.pageYOffset; + bodyStyle.overflow = "hidden"; + if (scrollbarWidth) bodyStyle[paddingProp] = scrollbarWidth + "px"; + // Only iOS doesn't respect `overflow: hidden` on document.body, and this + // technique has fewer side effects. + if (isIOS) { + var _window$visualViewpor, _window$visualViewpor2; + // iOS 12 does not support `visualViewport`. + const offsetLeft = ((_window$visualViewpor = window.visualViewport) == null ? void 0 : _window$visualViewpor.offsetLeft) || 0; + const offsetTop = ((_window$visualViewpor2 = window.visualViewport) == null ? void 0 : _window$visualViewpor2.offsetTop) || 0; + Object.assign(bodyStyle, { + position: "fixed", + top: -(scrollY - Math.floor(offsetTop)) + "px", + left: -(scrollX - Math.floor(offsetLeft)) + "px", + right: "0" + }); + } + return ()=>{ + $56b436271f6666d1$var$activeLocks.delete(lockId); + if ($56b436271f6666d1$var$activeLocks.size === 0) { + Object.assign(bodyStyle, { + overflow: "", + [paddingProp]: "" + }); + if (isIOS) { + Object.assign(bodyStyle, { + position: "", + top: "", + left: "", + right: "" + }); + window.scrollTo(scrollX, scrollY); + } + } + }; + }, [ + lockId, + lockScroll + ]); + return /*#__PURE__*/ $63SH6.createElement("div", $56b436271f6666d1$var$_extends({ + ref: ref + }, rest, { + style: { + position: "fixed", + overflow: "auto", + top: 0, + right: 0, + bottom: 0, + left: 0, + ...rest.style + } + })); +}); +function $56b436271f6666d1$var$isButtonTarget(event) { + return (0, $8Xnp2.isHTMLElement)(event.target) && event.target.tagName === "BUTTON"; +} +function $56b436271f6666d1$var$isSpaceIgnored(element) { + return (0, $d8YHU.isTypeableElement)(element); +} +/** + * Opens or closes the floating element when clicking the reference element. + * @see https://floating-ui.com/docs/useClick + */ function $56b436271f6666d1$export$98524f11226063fc(context, props) { + if (props === void 0) props = {}; + const { open: open, onOpenChange: onOpenChange, dataRef: dataRef, elements: { domReference: domReference } } = context; + const { enabled: enabled = true, event: eventOption = "click", toggle: toggle = true, ignoreMouse: ignoreMouse = false, keyboardHandlers: keyboardHandlers = true } = props; + const pointerTypeRef = $63SH6.useRef(); + const didKeyDownRef = $63SH6.useRef(false); + return $63SH6.useMemo(()=>{ + if (!enabled) return {}; + return { + reference: { + onPointerDown (event) { + pointerTypeRef.current = event.pointerType; + }, + onMouseDown (event) { + // Ignore all buttons except for the "main" button. + // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button + if (event.button !== 0) return; + if ((0, $d8YHU.isMouseLikePointerType)(pointerTypeRef.current, true) && ignoreMouse) return; + if (eventOption === "click") return; + if (open && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === "mousedown" : true)) onOpenChange(false, event.nativeEvent); + else { + // Prevent stealing focus from the floating element + event.preventDefault(); + onOpenChange(true, event.nativeEvent); + } + }, + onClick (event) { + if (eventOption === "mousedown" && pointerTypeRef.current) { + pointerTypeRef.current = undefined; + return; + } + if ((0, $d8YHU.isMouseLikePointerType)(pointerTypeRef.current, true) && ignoreMouse) return; + if (open && toggle && (dataRef.current.openEvent ? dataRef.current.openEvent.type === "click" : true)) onOpenChange(false, event.nativeEvent); + else onOpenChange(true, event.nativeEvent); + }, + onKeyDown (event) { + pointerTypeRef.current = undefined; + if (event.defaultPrevented || !keyboardHandlers || $56b436271f6666d1$var$isButtonTarget(event)) return; + if (event.key === " " && !$56b436271f6666d1$var$isSpaceIgnored(domReference)) { + // Prevent scrolling + event.preventDefault(); + didKeyDownRef.current = true; + } + if (event.key === "Enter") { + if (open && toggle) onOpenChange(false, event.nativeEvent); + else onOpenChange(true, event.nativeEvent); + } + }, + onKeyUp (event) { + if (event.defaultPrevented || !keyboardHandlers || $56b436271f6666d1$var$isButtonTarget(event) || $56b436271f6666d1$var$isSpaceIgnored(domReference)) return; + if (event.key === " " && didKeyDownRef.current) { + didKeyDownRef.current = false; + if (open && toggle) onOpenChange(false, event.nativeEvent); + else onOpenChange(true, event.nativeEvent); + } + } + } + }; + }, [ + enabled, + dataRef, + eventOption, + ignoreMouse, + keyboardHandlers, + domReference, + toggle, + open, + onOpenChange + ]); +} +function $56b436271f6666d1$var$createVirtualElement(domRef, data) { + let offsetX = null; + let offsetY = null; + let isAutoUpdateEvent = false; + return { + contextElement: domRef.current || undefined, + getBoundingClientRect () { + var _domRef$current, _data$dataRef$current; + const domRect = ((_domRef$current = domRef.current) == null ? void 0 : _domRef$current.getBoundingClientRect()) || { + width: 0, + height: 0, + x: 0, + y: 0 + }; + const isXAxis = data.axis === "x" || data.axis === "both"; + const isYAxis = data.axis === "y" || data.axis === "both"; + const canTrackCursorOnAutoUpdate = [ + "mouseenter", + "mousemove" + ].includes(((_data$dataRef$current = data.dataRef.current.openEvent) == null ? void 0 : _data$dataRef$current.type) || "") && data.pointerType !== "touch"; + let width = domRect.width; + let height = domRect.height; + let x = domRect.x; + let y = domRect.y; + if (offsetX == null && data.x && isXAxis) offsetX = domRect.x - data.x; + if (offsetY == null && data.y && isYAxis) offsetY = domRect.y - data.y; + x -= offsetX || 0; + y -= offsetY || 0; + width = 0; + height = 0; + if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { + width = data.axis === "y" ? domRect.width : 0; + height = data.axis === "x" ? domRect.height : 0; + x = isXAxis && data.x != null ? data.x : x; + y = isYAxis && data.y != null ? data.y : y; + } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { + height = data.axis === "x" ? domRect.height : height; + width = data.axis === "y" ? domRect.width : width; + } + isAutoUpdateEvent = true; + return { + width: width, + height: height, + x: x, + y: y, + top: y, + right: x + width, + bottom: y + height, + left: x + }; + } + }; +} +function $56b436271f6666d1$var$isMouseBasedEvent(event) { + return event != null && event.clientX != null; +} +/** + * Positions the floating element relative to a client point (in the viewport), + * such as the mouse position. By default, it follows the mouse cursor. + * @see https://floating-ui.com/docs/useClientPoint + */ function $56b436271f6666d1$export$7fe170a73a621816(context, props) { + if (props === void 0) props = {}; + const { open: open, refs: refs, dataRef: dataRef, elements: { floating: floating } } = context; + const { enabled: enabled = true, axis: axis = "both", x: x = null, y: y = null } = props; + const initialRef = $63SH6.useRef(false); + const cleanupListenerRef = $63SH6.useRef(null); + const [pointerType, setPointerType] = $63SH6.useState(); + const [reactive, setReactive] = $63SH6.useState([]); + const setReference = $56b436271f6666d1$var$useEffectEvent((x, y)=>{ + if (initialRef.current) return; + // Prevent setting if the open event was not a mouse-like one + // (e.g. focus to open, then hover over the reference element). + // Only apply if the event exists. + if (dataRef.current.openEvent && !$56b436271f6666d1$var$isMouseBasedEvent(dataRef.current.openEvent)) return; + refs.setPositionReference($56b436271f6666d1$var$createVirtualElement(refs.domReference, { + x: x, + y: y, + axis: axis, + dataRef: dataRef, + pointerType: pointerType + })); + }); + const handleReferenceEnterOrMove = $56b436271f6666d1$var$useEffectEvent((event)=>{ + if (x != null || y != null) return; + if (!open) setReference(event.clientX, event.clientY); + else if (!cleanupListenerRef.current) // If there's no cleanup, there's no listener, but we want to ensure + // we add the listener if the cursor landed on the floating element and + // then back on the reference (i.e. it's interactive). + setReactive([]); + }); + // If the pointer is a mouse-like pointer, we want to continue following the + // mouse even if the floating element is transitioning out. On touch + // devices, this is undesirable because the floating element will move to + // the dismissal touch point. + const openCheck = (0, $d8YHU.isMouseLikePointerType)(pointerType) ? floating : open; + const addListener = $63SH6.useCallback(()=>{ + // Explicitly specified `x`/`y` coordinates shouldn't add a listener. + if (!openCheck || !enabled || x != null || y != null) return; + const win = (0, $8Xnp2.getWindow)(refs.floating.current); + function handleMouseMove(event) { + const target = (0, $d8YHU.getTarget)(event); + if (!(0, $d8YHU.contains)(refs.floating.current, target)) setReference(event.clientX, event.clientY); + else { + win.removeEventListener("mousemove", handleMouseMove); + cleanupListenerRef.current = null; + } + } + if (!dataRef.current.openEvent || $56b436271f6666d1$var$isMouseBasedEvent(dataRef.current.openEvent)) { + win.addEventListener("mousemove", handleMouseMove); + const cleanup = ()=>{ + win.removeEventListener("mousemove", handleMouseMove); + cleanupListenerRef.current = null; + }; + cleanupListenerRef.current = cleanup; + return cleanup; + } + refs.setPositionReference(refs.domReference.current); + }, [ + dataRef, + enabled, + openCheck, + refs, + setReference, + x, + y + ]); + $63SH6.useEffect(()=>{ + return addListener(); + }, [ + addListener, + reactive + ]); + $63SH6.useEffect(()=>{ + if (enabled && !floating) initialRef.current = false; + }, [ + enabled, + floating + ]); + $63SH6.useEffect(()=>{ + if (!enabled && open) initialRef.current = true; + }, [ + enabled, + open + ]); + $56b436271f6666d1$var$index(()=>{ + if (enabled && (x != null || y != null)) { + initialRef.current = false; + setReference(x, y); + } + }, [ + enabled, + x, + y, + setReference + ]); + return $63SH6.useMemo(()=>{ + if (!enabled) return {}; + function setPointerTypeRef(_ref) { + let { pointerType: pointerType } = _ref; + setPointerType(pointerType); + } + return { + reference: { + onPointerDown: setPointerTypeRef, + onPointerEnter: setPointerTypeRef, + onMouseMove: handleReferenceEnterOrMove, + onMouseEnter: handleReferenceEnterOrMove + } + }; + }, [ + enabled, + handleReferenceEnterOrMove + ]); +} +const $56b436271f6666d1$var$bubbleHandlerKeys = { + pointerdown: "onPointerDown", + mousedown: "onMouseDown", + click: "onClick" +}; +const $56b436271f6666d1$var$captureHandlerKeys = { + pointerdown: "onPointerDownCapture", + mousedown: "onMouseDownCapture", + click: "onClickCapture" +}; +const $56b436271f6666d1$var$normalizeProp = (normalizable)=>{ + var _normalizable$escapeK, _normalizable$outside; + return { + escapeKey: typeof normalizable === "boolean" ? normalizable : (_normalizable$escapeK = normalizable == null ? void 0 : normalizable.escapeKey) != null ? _normalizable$escapeK : false, + outsidePress: typeof normalizable === "boolean" ? normalizable : (_normalizable$outside = normalizable == null ? void 0 : normalizable.outsidePress) != null ? _normalizable$outside : true + }; +}; +/** + * Closes the floating element when a dismissal is requested — by default, when + * the user presses the `escape` key or outside of the floating element. + * @see https://floating-ui.com/docs/useDismiss + */ function $56b436271f6666d1$export$fcdf1ba5fafc089b(context, props) { + if (props === void 0) props = {}; + const { open: open, onOpenChange: onOpenChange, events: events, nodeId: nodeId, elements: { reference: reference, domReference: domReference, floating: floating }, dataRef: dataRef } = context; + const { enabled: enabled = true, escapeKey: escapeKey = true, outsidePress: unstable_outsidePress = true, outsidePressEvent: outsidePressEvent = "pointerdown", referencePress: referencePress = false, referencePressEvent: referencePressEvent = "pointerdown", ancestorScroll: ancestorScroll = false, bubbles: bubbles, capture: capture } = props; + const tree = $56b436271f6666d1$export$db0c2a7c7a2a4f69(); + const nested = $56b436271f6666d1$export$165209eae06d3488() != null; + const outsidePressFn = $56b436271f6666d1$var$useEffectEvent(typeof unstable_outsidePress === "function" ? unstable_outsidePress : ()=>false); + const outsidePress = typeof unstable_outsidePress === "function" ? outsidePressFn : unstable_outsidePress; + const insideReactTreeRef = $63SH6.useRef(false); + const endedOrStartedInsideRef = $63SH6.useRef(false); + const { escapeKey: escapeKeyBubbles, outsidePress: outsidePressBubbles } = $56b436271f6666d1$var$normalizeProp(bubbles); + const { escapeKey: escapeKeyCapture, outsidePress: outsidePressCapture } = $56b436271f6666d1$var$normalizeProp(capture); + const closeOnEscapeKeyDown = $56b436271f6666d1$var$useEffectEvent((event)=>{ + if (!open || !enabled || !escapeKey || event.key !== "Escape") return; + const children = tree ? $56b436271f6666d1$var$getChildren(tree.nodesRef.current, nodeId) : []; + if (!escapeKeyBubbles) { + event.stopPropagation(); + if (children.length > 0) { + let shouldDismiss = true; + children.forEach((child)=>{ + var _child$context; + if ((_child$context = child.context) != null && _child$context.open && !child.context.dataRef.current.__escapeKeyBubbles) { + shouldDismiss = false; + return; + } + }); + if (!shouldDismiss) return; + } + } + events.emit("dismiss", { + type: "escapeKey", + data: { + returnFocus: { + preventScroll: false + } + } + }); + onOpenChange(false, (0, $d8YHU.isReactEvent)(event) ? event.nativeEvent : event); + }); + const closeOnEscapeKeyDownCapture = $56b436271f6666d1$var$useEffectEvent((event)=>{ + var _getTarget2; + const callback = ()=>{ + var _getTarget; + closeOnEscapeKeyDown(event); + (_getTarget = (0, $d8YHU.getTarget)(event)) == null || _getTarget.removeEventListener("keydown", callback); + }; + (_getTarget2 = (0, $d8YHU.getTarget)(event)) == null || _getTarget2.addEventListener("keydown", callback); + }); + const closeOnPressOutside = $56b436271f6666d1$var$useEffectEvent((event)=>{ + // Given developers can stop the propagation of the synthetic event, + // we can only be confident with a positive value. + const insideReactTree = insideReactTreeRef.current; + insideReactTreeRef.current = false; + // When click outside is lazy (`click` event), handle dragging. + // Don't close if: + // - The click started inside the floating element. + // - The click ended inside the floating element. + const endedOrStartedInside = endedOrStartedInsideRef.current; + endedOrStartedInsideRef.current = false; + if (outsidePressEvent === "click" && endedOrStartedInside) return; + if (insideReactTree) return; + if (typeof outsidePress === "function" && !outsidePress(event)) return; + const target = (0, $d8YHU.getTarget)(event); + const inertSelector = "[" + $56b436271f6666d1$var$createAttribute("inert") + "]"; + const markers = (0, $d8YHU.getDocument)(floating).querySelectorAll(inertSelector); + let targetRootAncestor = (0, $8Xnp2.isElement)(target) ? target : null; + while(targetRootAncestor && !(0, $8Xnp2.isLastTraversableNode)(targetRootAncestor)){ + const nextParent = (0, $8Xnp2.getParentNode)(targetRootAncestor); + if (nextParent === (0, $d8YHU.getDocument)(floating).body || !(0, $8Xnp2.isElement)(nextParent)) break; + else targetRootAncestor = nextParent; + } + // Check if the click occurred on a third-party element injected after the + // floating element rendered. + if (markers.length && (0, $8Xnp2.isElement)(target) && !(0, $d8YHU.isRootElement)(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). + !(0, $d8YHU.contains)(target, floating) && // If the target root element contains none of the markers, then the + // element was injected after the floating element rendered. + Array.from(markers).every((marker)=>!(0, $d8YHU.contains)(targetRootAncestor, marker))) return; + // Check if the click occurred on the scrollbar + if ((0, $8Xnp2.isHTMLElement)(target) && floating) { + // In Firefox, `target.scrollWidth > target.clientWidth` for inline + // elements. + const canScrollX = target.clientWidth > 0 && target.scrollWidth > target.clientWidth; + const canScrollY = target.clientHeight > 0 && target.scrollHeight > target.clientHeight; + let xCond = canScrollY && event.offsetX > target.clientWidth; + // In some browsers it is possible to change the (or window) + // scrollbar to the left side, but is very rare and is difficult to + // check for. Plus, for modal dialogs with backdrops, it is more + // important that the backdrop is checked but not so much the window. + if (canScrollY) { + const isRTL = (0, $8Xnp2.getComputedStyle)(target).direction === "rtl"; + if (isRTL) xCond = event.offsetX <= target.offsetWidth - target.clientWidth; + } + if (xCond || canScrollX && event.offsetY > target.clientHeight) return; + } + const targetIsInsideChildren = tree && $56b436271f6666d1$var$getChildren(tree.nodesRef.current, nodeId).some((node)=>{ + var _node$context; + return (0, $d8YHU.isEventTargetWithin)(event, (_node$context = node.context) == null ? void 0 : _node$context.elements.floating); + }); + if ((0, $d8YHU.isEventTargetWithin)(event, floating) || (0, $d8YHU.isEventTargetWithin)(event, domReference) || targetIsInsideChildren) return; + const children = tree ? $56b436271f6666d1$var$getChildren(tree.nodesRef.current, nodeId) : []; + if (children.length > 0) { + let shouldDismiss = true; + children.forEach((child)=>{ + var _child$context2; + if ((_child$context2 = child.context) != null && _child$context2.open && !child.context.dataRef.current.__outsidePressBubbles) { + shouldDismiss = false; + return; + } + }); + if (!shouldDismiss) return; + } + events.emit("dismiss", { + type: "outsidePress", + data: { + returnFocus: nested ? { + preventScroll: true + } : (0, $d8YHU.isVirtualClick)(event) || (0, $d8YHU.isVirtualPointerEvent)(event) + } + }); + onOpenChange(false, event); + }); + const closeOnPressOutsideCapture = $56b436271f6666d1$var$useEffectEvent((event)=>{ + var _getTarget4; + const callback = ()=>{ + var _getTarget3; + closeOnPressOutside(event); + (_getTarget3 = (0, $d8YHU.getTarget)(event)) == null || _getTarget3.removeEventListener(outsidePressEvent, callback); + }; + (_getTarget4 = (0, $d8YHU.getTarget)(event)) == null || _getTarget4.addEventListener(outsidePressEvent, callback); + }); + $63SH6.useEffect(()=>{ + if (!open || !enabled) return; + dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; + dataRef.current.__outsidePressBubbles = outsidePressBubbles; + function onScroll(event) { + onOpenChange(false, event); + } + const doc = (0, $d8YHU.getDocument)(floating); + escapeKey && doc.addEventListener("keydown", escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture); + outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture); + let ancestors = []; + if (ancestorScroll) { + if ((0, $8Xnp2.isElement)(domReference)) ancestors = (0, $8Xnp2.getOverflowAncestors)(domReference); + if ((0, $8Xnp2.isElement)(floating)) ancestors = ancestors.concat((0, $8Xnp2.getOverflowAncestors)(floating)); + if (!(0, $8Xnp2.isElement)(reference) && reference && reference.contextElement) ancestors = ancestors.concat((0, $8Xnp2.getOverflowAncestors)(reference.contextElement)); + } + // Ignore the visual viewport for scrolling dismissal (allow pinch-zoom) + ancestors = ancestors.filter((ancestor)=>{ + var _doc$defaultView; + return ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualViewport); + }); + ancestors.forEach((ancestor)=>{ + ancestor.addEventListener("scroll", onScroll, { + passive: true + }); + }); + return ()=>{ + escapeKey && doc.removeEventListener("keydown", escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture); + outsidePress && doc.removeEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture); + ancestors.forEach((ancestor)=>{ + ancestor.removeEventListener("scroll", onScroll); + }); + }; + }, [ + dataRef, + floating, + domReference, + reference, + escapeKey, + outsidePress, + outsidePressEvent, + open, + onOpenChange, + ancestorScroll, + enabled, + escapeKeyBubbles, + outsidePressBubbles, + closeOnEscapeKeyDown, + escapeKeyCapture, + closeOnEscapeKeyDownCapture, + closeOnPressOutside, + outsidePressCapture, + closeOnPressOutsideCapture + ]); + $63SH6.useEffect(()=>{ + insideReactTreeRef.current = false; + }, [ + outsidePress, + outsidePressEvent + ]); + return $63SH6.useMemo(()=>{ + if (!enabled) return {}; + return { + reference: { + onKeyDown: closeOnEscapeKeyDown, + [$56b436271f6666d1$var$bubbleHandlerKeys[referencePressEvent]]: (event)=>{ + if (referencePress) { + events.emit("dismiss", { + type: "referencePress", + data: { + returnFocus: false + } + }); + onOpenChange(false, event.nativeEvent); + } + } + }, + floating: { + onKeyDown: closeOnEscapeKeyDown, + onMouseDown () { + endedOrStartedInsideRef.current = true; + }, + onMouseUp () { + endedOrStartedInsideRef.current = true; + }, + [$56b436271f6666d1$var$captureHandlerKeys[outsidePressEvent]]: ()=>{ + insideReactTreeRef.current = true; + } + } + }; + }, [ + enabled, + events, + referencePress, + outsidePressEvent, + referencePressEvent, + onOpenChange, + closeOnEscapeKeyDown + ]); +} +let $56b436271f6666d1$var$devMessageSet; +/** + * Provides data to position a floating element and context to add interactions. + * @see https://floating-ui.com/docs/react + */ function $56b436271f6666d1$export$4e02a5c1d08bac65(options) { + var _options$elements2; + if (options === void 0) options = {}; + const { open: open = false, onOpenChange: unstable_onOpenChange, nodeId: nodeId } = options; + var _options$elements, _devMessageSet, _devMessageSet2; + const [_domReference, setDomReference] = $63SH6.useState(null); + const domReference = ((_options$elements2 = options.elements) == null ? void 0 : _options$elements2.reference) || _domReference; + const position = (0, $2Dcmu.useFloating)(options); + const tree = $56b436271f6666d1$export$db0c2a7c7a2a4f69(); + const onOpenChange = $56b436271f6666d1$var$useEffectEvent((open, event)=>{ + if (open) dataRef.current.openEvent = event; + unstable_onOpenChange == null || unstable_onOpenChange(open, event); + }); + const domReferenceRef = $63SH6.useRef(null); + const dataRef = $63SH6.useRef({}); + const events = $63SH6.useState(()=>$56b436271f6666d1$var$createPubSub())[0]; + const floatingId = $56b436271f6666d1$export$f680877a34711e37(); + const setPositionReference = $63SH6.useCallback((node)=>{ + const positionReference = (0, $8Xnp2.isElement)(node) ? { + getBoundingClientRect: ()=>node.getBoundingClientRect(), + contextElement: node + } : node; + position.refs.setReference(positionReference); + }, [ + position.refs + ]); + const setReference = $63SH6.useCallback((node)=>{ + if ((0, $8Xnp2.isElement)(node) || node === null) { + domReferenceRef.current = node; + setDomReference(node); + } + // Backwards-compatibility for passing a virtual element to `reference` + // after it has set the DOM reference. + if ((0, $8Xnp2.isElement)(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to + // `null` to support `positionReference` + an unstable `reference` + // callback ref. + node !== null && !(0, $8Xnp2.isElement)(node)) position.refs.setReference(node); + }, [ + position.refs + ]); + const refs = $63SH6.useMemo(()=>({ + ...position.refs, + setReference: setReference, + setPositionReference: setPositionReference, + domReference: domReferenceRef + }), [ + position.refs, + setReference, + setPositionReference + ]); + const elements = $63SH6.useMemo(()=>({ + ...position.elements, + domReference: domReference + }), [ + position.elements, + domReference + ]); + const context = $63SH6.useMemo(()=>({ + ...position, + refs: refs, + elements: elements, + dataRef: dataRef, + nodeId: nodeId, + floatingId: floatingId, + events: events, + open: open, + onOpenChange: onOpenChange + }), [ + position, + nodeId, + floatingId, + events, + open, + onOpenChange, + refs, + elements + ]); + $56b436271f6666d1$var$index(()=>{ + const node = tree == null ? void 0 : tree.nodesRef.current.find((node)=>node.id === nodeId); + if (node) node.context = context; + }); + return $63SH6.useMemo(()=>({ + ...position, + context: context, + refs: refs, + elements: elements + }), [ + position, + refs, + elements, + context + ]); +} +/** + * Opens the floating element while the reference element has focus, like CSS + * `:focus`. + * @see https://floating-ui.com/docs/useFocus + */ function $56b436271f6666d1$export$f8168d8dd8fd66e6(context, props) { + if (props === void 0) props = {}; + const { open: open, onOpenChange: onOpenChange, events: events, refs: refs, elements: { floating: floating, domReference: domReference } } = context; + const { enabled: enabled = true, visibleOnly: visibleOnly = true } = props; + const blockFocusRef = $63SH6.useRef(false); + const timeoutRef = $63SH6.useRef(); + const keyboardModalityRef = $63SH6.useRef(true); + $63SH6.useEffect(()=>{ + if (!enabled) return; + const win = (0, $8Xnp2.getWindow)(domReference); + // If the reference was focused and the user left the tab/window, and the + // floating element was not open, the focus should be blocked when they + // return to the tab/window. + function onBlur() { + if (!open && (0, $8Xnp2.isHTMLElement)(domReference) && domReference === (0, $d8YHU.activeElement)((0, $d8YHU.getDocument)(domReference))) blockFocusRef.current = true; + } + function onKeyDown() { + keyboardModalityRef.current = true; + } + win.addEventListener("blur", onBlur); + win.addEventListener("keydown", onKeyDown, true); + return ()=>{ + win.removeEventListener("blur", onBlur); + win.removeEventListener("keydown", onKeyDown, true); + }; + }, [ + floating, + domReference, + open, + enabled + ]); + $63SH6.useEffect(()=>{ + if (!enabled) return; + function onDismiss(payload) { + if (payload.type === "referencePress" || payload.type === "escapeKey") blockFocusRef.current = true; + } + events.on("dismiss", onDismiss); + return ()=>{ + events.off("dismiss", onDismiss); + }; + }, [ + events, + enabled + ]); + $63SH6.useEffect(()=>{ + return ()=>{ + clearTimeout(timeoutRef.current); + }; + }, []); + return $63SH6.useMemo(()=>{ + if (!enabled) return {}; + return { + reference: { + onPointerDown (event) { + if ((0, $d8YHU.isVirtualPointerEvent)(event.nativeEvent)) return; + keyboardModalityRef.current = false; + }, + onMouseLeave () { + blockFocusRef.current = false; + }, + onFocus (event) { + if (blockFocusRef.current) return; + const target = (0, $d8YHU.getTarget)(event.nativeEvent); + if (visibleOnly && (0, $8Xnp2.isElement)(target)) try { + // Mac Safari unreliably matches `:focus-visible` on the reference + // if focus was outside the page initially - use the fallback + // instead. + if ((0, $d8YHU.isSafari)() && (0, $d8YHU.isMac)()) throw Error(); + if (!target.matches(":focus-visible")) return; + } catch (e) { + // Old browsers will throw an error when using `:focus-visible`. + if (!keyboardModalityRef.current && !(0, $d8YHU.isTypeableElement)(target)) return; + } + onOpenChange(true, event.nativeEvent); + }, + onBlur (event) { + blockFocusRef.current = false; + const relatedTarget = event.relatedTarget; + // Hit the non-modal focus management portal guard. Focus will be + // moved into the floating element immediately after. + const movedToFocusGuard = (0, $8Xnp2.isElement)(relatedTarget) && relatedTarget.hasAttribute($56b436271f6666d1$var$createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; + // Wait for the window blur listener to fire. + timeoutRef.current = window.setTimeout(()=>{ + const activeEl = (0, $d8YHU.activeElement)(domReference ? domReference.ownerDocument : document); + // Focus left the page, keep it open. + if (!relatedTarget && activeEl === domReference) return; + // When focusing the reference element (e.g. regular click), then + // clicking into the floating element, prevent it from hiding. + // Note: it must be focusable, e.g. `tabindex="-1"`. + if ((0, $d8YHU.contains)(refs.floating.current, relatedTarget) || (0, $d8YHU.contains)(domReference, relatedTarget) || movedToFocusGuard) return; + onOpenChange(false, event.nativeEvent); + }); + } + } + }; + }, [ + enabled, + visibleOnly, + domReference, + refs, + onOpenChange + ]); +} +function $56b436271f6666d1$var$mergeProps(userProps, propsList, elementKey) { + const map = new Map(); + return { + ...elementKey === "floating" && { + tabIndex: -1 + }, + ...userProps, + ...propsList.map((value)=>value ? value[elementKey] : null).concat(userProps).reduce((acc, props)=>{ + if (!props) return acc; + Object.entries(props).forEach((_ref)=>{ + let [key, value] = _ref; + if (key.indexOf("on") === 0) { + if (!map.has(key)) map.set(key, []); + if (typeof value === "function") { + var _map$get; + (_map$get = map.get(key)) == null || _map$get.push(value); + acc[key] = function() { + var _map$get2; + for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; + return (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.map((fn)=>fn(...args)).find((val)=>val !== undefined); + }; + } + } else acc[key] = value; + }); + return acc; + }, {}) + }; +} +/** + * Merges an array of interaction hooks' props into prop getters, allowing + * event handler functions to be composed together without overwriting one + * another. + * @see https://floating-ui.com/docs/react#interaction-hooks + */ function $56b436271f6666d1$export$a519f7794e446ddd(propsList) { + if (propsList === void 0) propsList = []; + // The dependencies are a dynamic array, so we can't use the linter's + // suggestion to add it to the deps array. + const deps = propsList; + const getReferenceProps = $63SH6.useCallback((userProps)=>$56b436271f6666d1$var$mergeProps(userProps, propsList, "reference"), // eslint-disable-next-line react-hooks/exhaustive-deps + deps); + const getFloatingProps = $63SH6.useCallback((userProps)=>$56b436271f6666d1$var$mergeProps(userProps, propsList, "floating"), // eslint-disable-next-line react-hooks/exhaustive-deps + deps); + const getItemProps = $63SH6.useCallback((userProps)=>$56b436271f6666d1$var$mergeProps(userProps, propsList, "item"), // Granularly check for `item` changes, because the `getItemProps` getter + // should be as referentially stable as possible since it may be passed as + // a prop to many components. All `item` key values must therefore be + // memoized. + // eslint-disable-next-line react-hooks/exhaustive-deps + propsList.map((key)=>key == null ? void 0 : key.item)); + return $63SH6.useMemo(()=>({ + getReferenceProps: getReferenceProps, + getFloatingProps: getFloatingProps, + getItemProps: getItemProps + }), [ + getReferenceProps, + getFloatingProps, + getItemProps + ]); +} +let $56b436271f6666d1$var$isPreventScrollSupported = false; +function $56b436271f6666d1$var$doSwitch(orientation, vertical, horizontal) { + switch(orientation){ + case "vertical": + return vertical; + case "horizontal": + return horizontal; + default: + return vertical || horizontal; + } +} +function $56b436271f6666d1$var$isMainOrientationKey(key, orientation) { + const vertical = key === $56b436271f6666d1$var$ARROW_UP || key === $56b436271f6666d1$var$ARROW_DOWN; + const horizontal = key === $56b436271f6666d1$var$ARROW_LEFT || key === $56b436271f6666d1$var$ARROW_RIGHT; + return $56b436271f6666d1$var$doSwitch(orientation, vertical, horizontal); +} +function $56b436271f6666d1$var$isMainOrientationToEndKey(key, orientation, rtl) { + const vertical = key === $56b436271f6666d1$var$ARROW_DOWN; + const horizontal = rtl ? key === $56b436271f6666d1$var$ARROW_LEFT : key === $56b436271f6666d1$var$ARROW_RIGHT; + return $56b436271f6666d1$var$doSwitch(orientation, vertical, horizontal) || key === "Enter" || key == " " || key === ""; +} +function $56b436271f6666d1$var$isCrossOrientationOpenKey(key, orientation, rtl) { + const vertical = rtl ? key === $56b436271f6666d1$var$ARROW_LEFT : key === $56b436271f6666d1$var$ARROW_RIGHT; + const horizontal = key === $56b436271f6666d1$var$ARROW_DOWN; + return $56b436271f6666d1$var$doSwitch(orientation, vertical, horizontal); +} +function $56b436271f6666d1$var$isCrossOrientationCloseKey(key, orientation, rtl) { + const vertical = rtl ? key === $56b436271f6666d1$var$ARROW_RIGHT : key === $56b436271f6666d1$var$ARROW_LEFT; + const horizontal = key === $56b436271f6666d1$var$ARROW_UP; + return $56b436271f6666d1$var$doSwitch(orientation, vertical, horizontal); +} +/** + * Adds arrow key-based navigation of a list of items, either using real DOM + * focus or virtual focus. + * @see https://floating-ui.com/docs/useListNavigation + */ function $56b436271f6666d1$export$b5d22cac4ad33f40(context, props) { + const { open: open, onOpenChange: onOpenChange, refs: refs, elements: { domReference: domReference, floating: floating } } = context; + const { listRef: listRef, activeIndex: activeIndex, onNavigate: unstable_onNavigate = ()=>{}, enabled: enabled = true, selectedIndex: selectedIndex = null, allowEscape: allowEscape = false, loop: loop = false, nested: nested = false, rtl: rtl = false, virtual: virtual = false, focusItemOnOpen: focusItemOnOpen = "auto", focusItemOnHover: focusItemOnHover = true, openOnArrowKeyDown: openOnArrowKeyDown = true, disabledIndices: disabledIndices, orientation: orientation = "vertical", cols: cols = 1, scrollItemIntoView: scrollItemIntoView = true, virtualItemRef: virtualItemRef } = props; + const parentId = $56b436271f6666d1$export$165209eae06d3488(); + const tree = $56b436271f6666d1$export$db0c2a7c7a2a4f69(); + const onNavigate = $56b436271f6666d1$var$useEffectEvent(unstable_onNavigate); + const focusItemOnOpenRef = $63SH6.useRef(focusItemOnOpen); + const indexRef = $63SH6.useRef(selectedIndex != null ? selectedIndex : -1); + const keyRef = $63SH6.useRef(null); + const isPointerModalityRef = $63SH6.useRef(true); + const previousOnNavigateRef = $63SH6.useRef(onNavigate); + const previousMountedRef = $63SH6.useRef(!!floating); + const forceSyncFocus = $63SH6.useRef(false); + const forceScrollIntoViewRef = $63SH6.useRef(false); + const disabledIndicesRef = $56b436271f6666d1$var$useLatestRef(disabledIndices); + const latestOpenRef = $56b436271f6666d1$var$useLatestRef(open); + const scrollItemIntoViewRef = $56b436271f6666d1$var$useLatestRef(scrollItemIntoView); + const [activeId, setActiveId] = $63SH6.useState(); + const [virtualId, setVirtualId] = $63SH6.useState(); + const focusItem = $56b436271f6666d1$var$useEffectEvent(function(listRef, indexRef, forceScrollIntoView) { + if (forceScrollIntoView === void 0) forceScrollIntoView = false; + const item = listRef.current[indexRef.current]; + if (!item) return; + if (virtual) { + setActiveId(item.id); + tree == null || tree.events.emit("virtualfocus", item); + if (virtualItemRef) virtualItemRef.current = item; + } else $56b436271f6666d1$var$enqueueFocus(item, { + preventScroll: true, + // Mac Safari does not move the virtual cursor unless the focus call + // is sync. However, for the very first focus call, we need to wait + // for the position to be ready in order to prevent unwanted + // scrolling. This means the virtual cursor will not move to the first + // item when first opening the floating element, but will on + // subsequent calls. `preventScroll` is supported in modern Safari, + // so we can use that instead. + // iOS Safari must be async or the first item will not be focused. + sync: (0, $d8YHU.isMac)() && (0, $d8YHU.isSafari)() ? $56b436271f6666d1$var$isPreventScrollSupported || forceSyncFocus.current : false + }); + requestAnimationFrame(()=>{ + const scrollIntoViewOptions = scrollItemIntoViewRef.current; + const shouldScrollIntoView = scrollIntoViewOptions && item && (forceScrollIntoView || !isPointerModalityRef.current); + if (shouldScrollIntoView) // JSDOM doesn't support `.scrollIntoView()` but it's widely supported + // by all browsers. + item.scrollIntoView == null || item.scrollIntoView(typeof scrollIntoViewOptions === "boolean" ? { + block: "nearest", + inline: "nearest" + } : scrollIntoViewOptions); + }); + }); + $56b436271f6666d1$var$index(()=>{ + document.createElement("div").focus({ + get preventScroll () { + $56b436271f6666d1$var$isPreventScrollSupported = true; + return false; + } + }); + }, []); + // Sync `selectedIndex` to be the `activeIndex` upon opening the floating + // element. Also, reset `activeIndex` upon closing the floating element. + $56b436271f6666d1$var$index(()=>{ + if (!enabled) return; + if (open && floating) { + if (focusItemOnOpenRef.current && selectedIndex != null) { + // Regardless of the pointer modality, we want to ensure the selected + // item comes into view when the floating element is opened. + forceScrollIntoViewRef.current = true; + onNavigate(selectedIndex); + } + } else if (previousMountedRef.current) { + // Since the user can specify `onNavigate` conditionally + // (onNavigate: open ? setActiveIndex : setSelectedIndex), + // we store and call the previous function. + indexRef.current = -1; + previousOnNavigateRef.current(null); + } + }, [ + enabled, + open, + floating, + selectedIndex, + onNavigate + ]); + // Sync `activeIndex` to be the focused item while the floating element is + // open. + $56b436271f6666d1$var$index(()=>{ + if (!enabled) return; + if (open && floating) { + if (activeIndex == null) { + forceSyncFocus.current = false; + if (selectedIndex != null) return; + // Reset while the floating element was open (e.g. the list changed). + if (previousMountedRef.current) { + indexRef.current = -1; + focusItem(listRef, indexRef); + } + // Initial sync. + if (!previousMountedRef.current && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) { + let runs = 0; + const waitForListPopulated = ()=>{ + if (listRef.current[0] == null) { + // Avoid letting the browser paint if possible on the first try, + // otherwise use rAF. Don't try more than twice, since something + // is wrong otherwise. + if (runs < 2) { + const scheduler = runs ? requestAnimationFrame : queueMicrotask; + scheduler(waitForListPopulated); + } + runs++; + } else { + indexRef.current = keyRef.current == null || $56b436271f6666d1$var$isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? $56b436271f6666d1$var$getMinIndex(listRef, disabledIndicesRef.current) : $56b436271f6666d1$var$getMaxIndex(listRef, disabledIndicesRef.current); + keyRef.current = null; + onNavigate(indexRef.current); + } + }; + waitForListPopulated(); + } + } else if (!$56b436271f6666d1$var$isIndexOutOfBounds(listRef, activeIndex)) { + indexRef.current = activeIndex; + focusItem(listRef, indexRef, forceScrollIntoViewRef.current); + forceScrollIntoViewRef.current = false; + } + } + }, [ + enabled, + open, + floating, + activeIndex, + selectedIndex, + nested, + listRef, + orientation, + rtl, + onNavigate, + focusItem, + disabledIndicesRef + ]); + // Ensure the parent floating element has focus when a nested child closes + // to allow arrow key navigation to work after the pointer leaves the child. + $56b436271f6666d1$var$index(()=>{ + var _nodes$find, _nodes$find$context; + if (!enabled || floating || !tree || virtual || !previousMountedRef.current) return; + const nodes = tree.nodesRef.current; + const parent = (_nodes$find = nodes.find((node)=>node.id === parentId)) == null ? void 0 : (_nodes$find$context = _nodes$find.context) == null ? void 0 : _nodes$find$context.elements.floating; + const activeEl = (0, $d8YHU.activeElement)((0, $d8YHU.getDocument)(floating)); + const treeContainsActiveEl = nodes.some((node)=>node.context && (0, $d8YHU.contains)(node.context.elements.floating, activeEl)); + if (parent && !treeContainsActiveEl && isPointerModalityRef.current) parent.focus({ + preventScroll: true + }); + }, [ + enabled, + floating, + tree, + parentId, + virtual + ]); + $56b436271f6666d1$var$index(()=>{ + if (!enabled || !tree || !virtual || parentId) return; + function handleVirtualFocus(item) { + setVirtualId(item.id); + if (virtualItemRef) virtualItemRef.current = item; + } + tree.events.on("virtualfocus", handleVirtualFocus); + return ()=>{ + tree.events.off("virtualfocus", handleVirtualFocus); + }; + }, [ + enabled, + tree, + virtual, + parentId, + virtualItemRef + ]); + $56b436271f6666d1$var$index(()=>{ + previousOnNavigateRef.current = onNavigate; + previousMountedRef.current = !!floating; + }); + $56b436271f6666d1$var$index(()=>{ + if (!open) keyRef.current = null; + }, [ + open + ]); + const hasActiveIndex = activeIndex != null; + const item = $63SH6.useMemo(()=>{ + function syncCurrentTarget(currentTarget) { + if (!open) return; + const index = listRef.current.indexOf(currentTarget); + if (index !== -1) onNavigate(index); + } + const props = { + onFocus (_ref) { + let { currentTarget: currentTarget } = _ref; + syncCurrentTarget(currentTarget); + }, + onClick: (_ref2)=>{ + let { currentTarget: currentTarget } = _ref2; + return currentTarget.focus({ + preventScroll: true + }); + }, + // Safari + ...focusItemOnHover && { + onMouseMove (_ref3) { + let { currentTarget: currentTarget } = _ref3; + syncCurrentTarget(currentTarget); + }, + onPointerLeave (_ref4) { + let { pointerType: pointerType } = _ref4; + if (!isPointerModalityRef.current || pointerType === "touch") return; + indexRef.current = -1; + focusItem(listRef, indexRef); + onNavigate(null); + if (!virtual) $56b436271f6666d1$var$enqueueFocus(refs.floating.current, { + preventScroll: true + }); + } + } + }; + return props; + }, [ + open, + refs, + focusItem, + focusItemOnHover, + listRef, + onNavigate, + virtual + ]); + return $63SH6.useMemo(()=>{ + if (!enabled) return {}; + const disabledIndices = disabledIndicesRef.current; + function onKeyDown(event) { + isPointerModalityRef.current = false; + forceSyncFocus.current = true; + // If the floating element is animating out, ignore navigation. Otherwise, + // the `activeIndex` gets set to 0 despite not being open so the next time + // the user ArrowDowns, the first item won't be focused. + if (!latestOpenRef.current && event.currentTarget === refs.floating.current) return; + if (nested && $56b436271f6666d1$var$isCrossOrientationCloseKey(event.key, orientation, rtl)) { + (0, $d8YHU.stopEvent)(event); + onOpenChange(false, event.nativeEvent); + if ((0, $8Xnp2.isHTMLElement)(domReference) && !virtual) domReference.focus(); + return; + } + const currentIndex = indexRef.current; + const minIndex = $56b436271f6666d1$var$getMinIndex(listRef, disabledIndices); + const maxIndex = $56b436271f6666d1$var$getMaxIndex(listRef, disabledIndices); + if (event.key === "Home") { + (0, $d8YHU.stopEvent)(event); + indexRef.current = minIndex; + onNavigate(indexRef.current); + } + if (event.key === "End") { + (0, $d8YHU.stopEvent)(event); + indexRef.current = maxIndex; + onNavigate(indexRef.current); + } + // Grid navigation. + if (cols > 1) { + indexRef.current = $56b436271f6666d1$var$getGridNavigatedIndex(listRef, { + event: event, + orientation: orientation, + loop: loop, + cols: cols, + disabledIndices: disabledIndices, + minIndex: minIndex, + maxIndex: maxIndex, + prevIndex: indexRef.current, + stopEvent: true + }); + onNavigate(indexRef.current); + if (orientation === "both") return; + } + if ($56b436271f6666d1$var$isMainOrientationKey(event.key, orientation)) { + (0, $d8YHU.stopEvent)(event); + // Reset the index if no item is focused. + if (open && !virtual && (0, $d8YHU.activeElement)(event.currentTarget.ownerDocument) === event.currentTarget) { + indexRef.current = $56b436271f6666d1$var$isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex; + onNavigate(indexRef.current); + return; + } + if ($56b436271f6666d1$var$isMainOrientationToEndKey(event.key, orientation, rtl)) { + if (loop) indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : $56b436271f6666d1$var$findNonDisabledIndex(listRef, { + startingIndex: currentIndex, + disabledIndices: disabledIndices + }); + else indexRef.current = Math.min(maxIndex, $56b436271f6666d1$var$findNonDisabledIndex(listRef, { + startingIndex: currentIndex, + disabledIndices: disabledIndices + })); + } else if (loop) indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : $56b436271f6666d1$var$findNonDisabledIndex(listRef, { + startingIndex: currentIndex, + decrement: true, + disabledIndices: disabledIndices + }); + else indexRef.current = Math.max(minIndex, $56b436271f6666d1$var$findNonDisabledIndex(listRef, { + startingIndex: currentIndex, + decrement: true, + disabledIndices: disabledIndices + })); + if ($56b436271f6666d1$var$isIndexOutOfBounds(listRef, indexRef.current)) onNavigate(null); + else onNavigate(indexRef.current); + } + } + function checkVirtualMouse(event) { + if (focusItemOnOpen === "auto" && (0, $d8YHU.isVirtualClick)(event.nativeEvent)) focusItemOnOpenRef.current = true; + } + function checkVirtualPointer(event) { + // `pointerdown` fires first, reset the state then perform the checks. + focusItemOnOpenRef.current = focusItemOnOpen; + if (focusItemOnOpen === "auto" && (0, $d8YHU.isVirtualPointerEvent)(event.nativeEvent)) focusItemOnOpenRef.current = true; + } + const ariaActiveDescendantProp = virtual && open && hasActiveIndex && { + "aria-activedescendant": virtualId || activeId + }; + const activeItem = listRef.current.find((item)=>(item == null ? void 0 : item.id) === activeId); + return { + reference: { + ...ariaActiveDescendantProp, + onKeyDown (event) { + isPointerModalityRef.current = false; + const isArrowKey = event.key.indexOf("Arrow") === 0; + const isCrossOpenKey = $56b436271f6666d1$var$isCrossOrientationOpenKey(event.key, orientation, rtl); + const isCrossCloseKey = $56b436271f6666d1$var$isCrossOrientationCloseKey(event.key, orientation, rtl); + const isMainKey = $56b436271f6666d1$var$isMainOrientationKey(event.key, orientation); + const isNavigationKey = (nested ? isCrossOpenKey : isMainKey) || event.key === "Enter" || event.key.trim() === ""; + if (virtual && open) { + const rootNode = tree == null ? void 0 : tree.nodesRef.current.find((node)=>node.parentId == null); + const deepestNode = tree && rootNode ? $56b436271f6666d1$var$getDeepestNode(tree.nodesRef.current, rootNode.id) : null; + if (isArrowKey && deepestNode && virtualItemRef) { + const eventObject = new KeyboardEvent("keydown", { + key: event.key, + bubbles: true + }); + if (isCrossOpenKey || isCrossCloseKey) { + var _deepestNode$context, _deepestNode$context2; + const isCurrentTarget = ((_deepestNode$context = deepestNode.context) == null ? void 0 : _deepestNode$context.elements.domReference) === event.currentTarget; + const dispatchItem = isCrossCloseKey && !isCurrentTarget ? (_deepestNode$context2 = deepestNode.context) == null ? void 0 : _deepestNode$context2.elements.domReference : isCrossOpenKey ? activeItem : null; + if (dispatchItem) { + (0, $d8YHU.stopEvent)(event); + dispatchItem.dispatchEvent(eventObject); + setVirtualId(undefined); + } + } + if (isMainKey && deepestNode.context) { + if (deepestNode.context.open && deepestNode.parentId && event.currentTarget !== deepestNode.context.elements.domReference) { + var _deepestNode$context$; + (0, $d8YHU.stopEvent)(event); + (_deepestNode$context$ = deepestNode.context.elements.domReference) == null || _deepestNode$context$.dispatchEvent(eventObject); + return; + } + } + } + return onKeyDown(event); + } + // If a floating element should not open on arrow key down, avoid + // setting `activeIndex` while it's closed. + if (!open && !openOnArrowKeyDown && isArrowKey) return; + if (isNavigationKey) keyRef.current = nested && isMainKey ? null : event.key; + if (nested) { + if (isCrossOpenKey) { + (0, $d8YHU.stopEvent)(event); + if (open) { + indexRef.current = $56b436271f6666d1$var$getMinIndex(listRef, disabledIndices); + onNavigate(indexRef.current); + } else onOpenChange(true, event.nativeEvent); + } + return; + } + if (isMainKey) { + if (selectedIndex != null) indexRef.current = selectedIndex; + (0, $d8YHU.stopEvent)(event); + if (!open && openOnArrowKeyDown) onOpenChange(true, event.nativeEvent); + else onKeyDown(event); + if (open) onNavigate(indexRef.current); + } + }, + onFocus () { + if (open) onNavigate(null); + }, + onPointerDown: checkVirtualPointer, + onMouseDown: checkVirtualMouse, + onClick: checkVirtualMouse + }, + floating: { + "aria-orientation": orientation === "both" ? undefined : orientation, + ...ariaActiveDescendantProp, + onKeyDown: onKeyDown, + onPointerMove () { + isPointerModalityRef.current = true; + } + }, + item: item + }; + }, [ + domReference, + refs, + activeId, + virtualId, + disabledIndicesRef, + latestOpenRef, + listRef, + enabled, + orientation, + rtl, + virtual, + open, + hasActiveIndex, + nested, + selectedIndex, + openOnArrowKeyDown, + allowEscape, + cols, + loop, + focusItemOnOpen, + onNavigate, + onOpenChange, + item, + tree, + virtualItemRef + ]); +} +/** + * Adds base screen reader props to the reference and floating elements for a + * given floating element `role`. + * @see https://floating-ui.com/docs/useRole + */ function $56b436271f6666d1$export$f66572793fa256a1(context, props) { + if (props === void 0) props = {}; + const { open: open, floatingId: floatingId } = context; + const { enabled: enabled = true, role: role = "dialog" } = props; + const referenceId = $56b436271f6666d1$export$f680877a34711e37(); + return $63SH6.useMemo(()=>{ + const floatingProps = { + id: floatingId, + role: role + }; + if (!enabled) return {}; + if (role === "tooltip") return { + reference: { + "aria-describedby": open ? floatingId : undefined + }, + floating: floatingProps + }; + return { + reference: { + "aria-expanded": open ? "true" : "false", + "aria-haspopup": role === "alertdialog" ? "dialog" : role, + "aria-controls": open ? floatingId : undefined, + ...role === "listbox" && { + role: "combobox" + }, + ...role === "menu" && { + id: referenceId + } + }, + floating: { + ...floatingProps, + ...role === "menu" && { + "aria-labelledby": referenceId + } + } + }; + }, [ + enabled, + role, + open, + floatingId, + referenceId + ]); +} +// Converts a JS style key like `backgroundColor` to a CSS transition-property +// like `background-color`. +const $56b436271f6666d1$var$camelCaseToKebabCase = (str)=>str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs)=>(ofs ? "-" : "") + $.toLowerCase()); +function $56b436271f6666d1$var$execWithArgsOrReturn(valueOrFn, args) { + return typeof valueOrFn === "function" ? valueOrFn(args) : valueOrFn; +} +function $56b436271f6666d1$var$useDelayUnmount(open, durationMs) { + const [isMounted, setIsMounted] = $63SH6.useState(open); + if (open && !isMounted) setIsMounted(true); + $63SH6.useEffect(()=>{ + if (!open) { + const timeout = setTimeout(()=>setIsMounted(false), durationMs); + return ()=>clearTimeout(timeout); + } + }, [ + open, + durationMs + ]); + return isMounted; +} +/** + * Provides a status string to apply CSS transitions to a floating element, + * correctly handling placement-aware transitions. + * @see https://floating-ui.com/docs/useTransition#usetransitionstatus + */ function $56b436271f6666d1$export$b2ef21706733f7e5(context, props) { + if (props === void 0) props = {}; + const { open: open, elements: { floating: floating } } = context; + const { duration: duration = 250 } = props; + const isNumberDuration = typeof duration === "number"; + const closeDuration = (isNumberDuration ? duration : duration.close) || 0; + const [initiated, setInitiated] = $63SH6.useState(false); + const [status, setStatus] = $63SH6.useState("unmounted"); + const isMounted = $56b436271f6666d1$var$useDelayUnmount(open, closeDuration); + // `initiated` check prevents this `setState` call from breaking + // . This call is necessary to ensure subsequent opens + // after the initial one allows the correct side animation to play when the + // placement has changed. + $56b436271f6666d1$var$index(()=>{ + if (initiated && !isMounted) setStatus("unmounted"); + }, [ + initiated, + isMounted + ]); + $56b436271f6666d1$var$index(()=>{ + if (!floating) return; + if (open) { + setStatus("initial"); + const frame = requestAnimationFrame(()=>{ + setStatus("open"); + }); + return ()=>{ + cancelAnimationFrame(frame); + }; + } else { + setInitiated(true); + setStatus("close"); + } + }, [ + open, + floating + ]); + return { + isMounted: isMounted, + status: status + }; +} +/** + * Provides styles to apply CSS transitions to a floating element, correctly + * handling placement-aware transitions. Wrapper around `useTransitionStatus`. + * @see https://floating-ui.com/docs/useTransition#usetransitionstyles + */ function $56b436271f6666d1$export$769fba13884bc2f4(context, props) { + if (props === void 0) props = {}; + const { initial: unstable_initial = { + opacity: 0 + }, open: unstable_open, close: unstable_close, common: unstable_common, duration: duration = 250 } = props; + const placement = context.placement; + const side = placement.split("-")[0]; + const fnArgs = $63SH6.useMemo(()=>({ + side: side, + placement: placement + }), [ + side, + placement + ]); + const isNumberDuration = typeof duration === "number"; + const openDuration = (isNumberDuration ? duration : duration.open) || 0; + const closeDuration = (isNumberDuration ? duration : duration.close) || 0; + const [styles, setStyles] = $63SH6.useState(()=>({ + ...$56b436271f6666d1$var$execWithArgsOrReturn(unstable_common, fnArgs), + ...$56b436271f6666d1$var$execWithArgsOrReturn(unstable_initial, fnArgs) + })); + const { isMounted: isMounted, status: status } = $56b436271f6666d1$export$b2ef21706733f7e5(context, { + duration: duration + }); + const initialRef = $56b436271f6666d1$var$useLatestRef(unstable_initial); + const openRef = $56b436271f6666d1$var$useLatestRef(unstable_open); + const closeRef = $56b436271f6666d1$var$useLatestRef(unstable_close); + const commonRef = $56b436271f6666d1$var$useLatestRef(unstable_common); + $56b436271f6666d1$var$index(()=>{ + const initialStyles = $56b436271f6666d1$var$execWithArgsOrReturn(initialRef.current, fnArgs); + const closeStyles = $56b436271f6666d1$var$execWithArgsOrReturn(closeRef.current, fnArgs); + const commonStyles = $56b436271f6666d1$var$execWithArgsOrReturn(commonRef.current, fnArgs); + const openStyles = $56b436271f6666d1$var$execWithArgsOrReturn(openRef.current, fnArgs) || Object.keys(initialStyles).reduce((acc, key)=>{ + acc[key] = ""; + return acc; + }, {}); + if (status === "initial") setStyles((styles)=>({ + transitionProperty: styles.transitionProperty, + ...commonStyles, + ...initialStyles + })); + if (status === "open") setStyles({ + transitionProperty: Object.keys(openStyles).map($56b436271f6666d1$var$camelCaseToKebabCase).join(","), + transitionDuration: openDuration + "ms", + ...commonStyles, + ...openStyles + }); + if (status === "close") { + const styles = closeStyles || initialStyles; + setStyles({ + transitionProperty: Object.keys(styles).map($56b436271f6666d1$var$camelCaseToKebabCase).join(","), + transitionDuration: closeDuration + "ms", + ...commonStyles, + ...styles + }); + } + }, [ + closeDuration, + closeRef, + initialRef, + openRef, + commonRef, + openDuration, + status, + fnArgs + ]); + return { + isMounted: isMounted, + styles: styles + }; +} +/** + * Provides a matching callback that can be used to focus an item as the user + * types, often used in tandem with `useListNavigation()`. + * @see https://floating-ui.com/docs/useTypeahead + */ function $56b436271f6666d1$export$d8d674d50b73ba93(context, props) { + var _ref; + const { open: open, dataRef: dataRef } = context; + const { listRef: listRef, activeIndex: activeIndex, onMatch: unstable_onMatch, onTypingChange: unstable_onTypingChange, enabled: enabled = true, findMatch: findMatch = null, resetMs: resetMs = 750, ignoreKeys: ignoreKeys = [], selectedIndex: selectedIndex = null } = props; + const timeoutIdRef = $63SH6.useRef(); + const stringRef = $63SH6.useRef(""); + const prevIndexRef = $63SH6.useRef((_ref = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref : -1); + const matchIndexRef = $63SH6.useRef(null); + const onMatch = $56b436271f6666d1$var$useEffectEvent(unstable_onMatch); + const onTypingChange = $56b436271f6666d1$var$useEffectEvent(unstable_onTypingChange); + const findMatchRef = $56b436271f6666d1$var$useLatestRef(findMatch); + const ignoreKeysRef = $56b436271f6666d1$var$useLatestRef(ignoreKeys); + $56b436271f6666d1$var$index(()=>{ + if (open) { + clearTimeout(timeoutIdRef.current); + matchIndexRef.current = null; + stringRef.current = ""; + } + }, [ + open + ]); + $56b436271f6666d1$var$index(()=>{ + // Sync arrow key navigation but not typeahead navigation. + if (open && stringRef.current === "") { + var _ref2; + prevIndexRef.current = (_ref2 = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref2 : -1; + } + }, [ + open, + selectedIndex, + activeIndex + ]); + return $63SH6.useMemo(()=>{ + if (!enabled) return {}; + function setTypingChange(value) { + if (value) { + if (!dataRef.current.typing) { + dataRef.current.typing = value; + onTypingChange(value); + } + } else if (dataRef.current.typing) { + dataRef.current.typing = value; + onTypingChange(value); + } + } + function getMatchingIndex(list, orderedList, string) { + const str = findMatchRef.current ? findMatchRef.current(orderedList, string) : orderedList.find((text)=>(text == null ? void 0 : text.toLocaleLowerCase().indexOf(string.toLocaleLowerCase())) === 0); + return str ? list.indexOf(str) : -1; + } + function onKeyDown(event) { + const listContent = listRef.current; + if (stringRef.current.length > 0 && stringRef.current[0] !== " ") { + if (getMatchingIndex(listContent, listContent, stringRef.current) === -1) setTypingChange(false); + else if (event.key === " ") (0, $d8YHU.stopEvent)(event); + } + if (listContent == null || ignoreKeysRef.current.includes(event.key) || // Character key. + event.key.length !== 1 || // Modifier key. + event.ctrlKey || event.metaKey || event.altKey) return; + if (open && event.key !== " ") { + (0, $d8YHU.stopEvent)(event); + setTypingChange(true); + } + // Bail out if the list contains a word like "llama" or "aaron". TODO: + // allow it in this case, too. + const allowRapidSuccessionOfFirstLetter = listContent.every((text)=>{ + var _text$, _text$2; + return text ? ((_text$ = text[0]) == null ? void 0 : _text$.toLocaleLowerCase()) !== ((_text$2 = text[1]) == null ? void 0 : _text$2.toLocaleLowerCase()) : true; + }); + // Allows the user to cycle through items that start with the same letter + // in rapid succession. + if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) { + stringRef.current = ""; + prevIndexRef.current = matchIndexRef.current; + } + stringRef.current += event.key; + clearTimeout(timeoutIdRef.current); + timeoutIdRef.current = setTimeout(()=>{ + stringRef.current = ""; + prevIndexRef.current = matchIndexRef.current; + setTypingChange(false); + }, resetMs); + const prevIndex = prevIndexRef.current; + const index = getMatchingIndex(listContent, [ + ...listContent.slice((prevIndex || 0) + 1), + ...listContent.slice(0, (prevIndex || 0) + 1) + ], stringRef.current); + if (index !== -1) { + onMatch(index); + matchIndexRef.current = index; + } else if (event.key !== " ") { + stringRef.current = ""; + setTypingChange(false); + } + } + return { + reference: { + onKeyDown: onKeyDown + }, + floating: { + onKeyDown: onKeyDown, + onKeyUp (event) { + if (event.key === " ") setTypingChange(false); + } + } + }; + }, [ + enabled, + open, + dataRef, + listRef, + resetMs, + ignoreKeysRef, + findMatchRef, + onMatch, + onTypingChange + ]); +} +function $56b436271f6666d1$var$getArgsWithCustomFloatingHeight(state, height) { + return { + ...state, + rects: { + ...state.rects, + floating: { + ...state.rects.floating, + height: height + } + } + }; +} +/** + * Positions the floating element such that an inner element inside + * of it is anchored to the reference element. + * @see https://floating-ui.com/docs/inner + */ const $56b436271f6666d1$export$4ae363f1d88fb658 = (props)=>({ + name: "inner", + options: props, + async fn (state) { + const { listRef: listRef, overflowRef: overflowRef, onFallbackChange: onFallbackChange, offset: innerOffset = 0, index: index = 0, minItemsVisible: minItemsVisible = 4, referenceOverflowThreshold: referenceOverflowThreshold = 0, scrollRef: scrollRef, ...detectOverflowOptions } = props; + const { rects: rects, elements: { floating: floating } } = state; + const item = listRef.current[index]; + if (!item) return {}; + const nextArgs = { + ...state, + ...await (0, $l2jTt.offset)(-item.offsetTop - floating.clientTop - rects.reference.height / 2 - item.offsetHeight / 2 - innerOffset).fn(state) + }; + const el = (scrollRef == null ? void 0 : scrollRef.current) || floating; + const overflow = await (0, $l2jTt.detectOverflow)($56b436271f6666d1$var$getArgsWithCustomFloatingHeight(nextArgs, el.scrollHeight), detectOverflowOptions); + const refOverflow = await (0, $l2jTt.detectOverflow)(nextArgs, { + ...detectOverflowOptions, + elementContext: "reference" + }); + const diffY = Math.max(0, overflow.top); + const nextY = nextArgs.y + diffY; + const maxHeight = Math.max(0, el.scrollHeight - diffY - Math.max(0, overflow.bottom)); + el.style.maxHeight = maxHeight + "px"; + el.scrollTop = diffY; + // There is not enough space, fallback to standard anchored positioning + if (onFallbackChange) { + if (el.offsetHeight < item.offsetHeight * Math.min(minItemsVisible, listRef.current.length - 1) - 1 || refOverflow.top >= -referenceOverflowThreshold || refOverflow.bottom >= -referenceOverflowThreshold) (0, $grDIR.flushSync)(()=>onFallbackChange(true)); + else (0, $grDIR.flushSync)(()=>onFallbackChange(false)); + } + if (overflowRef) overflowRef.current = await (0, $l2jTt.detectOverflow)($56b436271f6666d1$var$getArgsWithCustomFloatingHeight({ + ...nextArgs, + y: nextY + }, el.offsetHeight), detectOverflowOptions); + return { + y: nextY + }; + } + }); +/** + * Changes the `inner` middleware's `offset` upon a `wheel` event to + * expand the floating element's height, revealing more list items. + * @see https://floating-ui.com/docs/inner + */ function $56b436271f6666d1$export$3d74b0dda7cc82ff(context, props) { + const { open: open, elements: elements } = context; + const { enabled: enabled = true, overflowRef: overflowRef, scrollRef: scrollRef, onChange: unstable_onChange } = props; + const onChange = $56b436271f6666d1$var$useEffectEvent(unstable_onChange); + const controlledScrollingRef = $63SH6.useRef(false); + const prevScrollTopRef = $63SH6.useRef(null); + const initialOverflowRef = $63SH6.useRef(null); + $63SH6.useEffect(()=>{ + if (!enabled) return; + function onWheel(e) { + if (e.ctrlKey || !el || overflowRef.current == null) return; + const dY = e.deltaY; + const isAtTop = overflowRef.current.top >= -0.5; + const isAtBottom = overflowRef.current.bottom >= -0.5; + const remainingScroll = el.scrollHeight - el.clientHeight; + const sign = dY < 0 ? -1 : 1; + const method = dY < 0 ? "max" : "min"; + if (el.scrollHeight <= el.clientHeight) return; + if (!isAtTop && dY > 0 || !isAtBottom && dY < 0) { + e.preventDefault(); + (0, $grDIR.flushSync)(()=>{ + onChange((d)=>d + Math[method](dY, remainingScroll * sign)); + }); + } else if (/firefox/i.test((0, $d8YHU.getUserAgent)())) // Needed to propagate scrolling during momentum scrolling phase once + // it gets limited by the boundary. UX improvement, not critical. + el.scrollTop += dY; + } + const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating; + if (open && el) { + el.addEventListener("wheel", onWheel); + // Wait for the position to be ready. + requestAnimationFrame(()=>{ + prevScrollTopRef.current = el.scrollTop; + if (overflowRef.current != null) initialOverflowRef.current = { + ...overflowRef.current + }; + }); + return ()=>{ + prevScrollTopRef.current = null; + initialOverflowRef.current = null; + el.removeEventListener("wheel", onWheel); + }; + } + }, [ + enabled, + open, + elements.floating, + overflowRef, + scrollRef, + onChange + ]); + return $63SH6.useMemo(()=>{ + if (!enabled) return {}; + return { + floating: { + onKeyDown () { + controlledScrollingRef.current = true; + }, + onWheel () { + controlledScrollingRef.current = false; + }, + onPointerMove () { + controlledScrollingRef.current = false; + }, + onScroll () { + const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating; + if (!overflowRef.current || !el || !controlledScrollingRef.current) return; + if (prevScrollTopRef.current !== null) { + const scrollDiff = el.scrollTop - prevScrollTopRef.current; + if (overflowRef.current.bottom < -0.5 && scrollDiff < -1 || overflowRef.current.top < -0.5 && scrollDiff > 1) (0, $grDIR.flushSync)(()=>onChange((d)=>d + scrollDiff)); + } + // [Firefox] Wait for the height change to have been applied. + requestAnimationFrame(()=>{ + prevScrollTopRef.current = el.scrollTop; + }); + } + } + }; + }, [ + enabled, + overflowRef, + elements.floating, + scrollRef, + onChange + ]); +} +function $56b436271f6666d1$var$isPointInPolygon(point, polygon) { + const [x, y] = point; + let isInside = false; + const length = polygon.length; + for(let i = 0, j = length - 1; i < length; j = i++){ + const [xi, yi] = polygon[i] || [ + 0, + 0 + ]; + const [xj, yj] = polygon[j] || [ + 0, + 0 + ]; + const intersect = yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi; + if (intersect) isInside = !isInside; + } + return isInside; +} +function $56b436271f6666d1$var$isInside(point, rect) { + return point[0] >= rect.x && point[0] <= rect.x + rect.width && point[1] >= rect.y && point[1] <= rect.y + rect.height; +} +/** + * Generates a safe polygon area that the user can traverse without closing the + * floating element once leaving the reference element. + * @see https://floating-ui.com/docs/useHover#safePolygon + */ function $56b436271f6666d1$export$7484214ab62358d2(options) { + if (options === void 0) options = {}; + const { buffer: buffer = 0.5, blockPointerEvents: blockPointerEvents = false, requireIntent: requireIntent = true } = options; + let timeoutId; + let hasLanded = false; + let lastX = null; + let lastY = null; + let lastCursorTime = performance.now(); + function getCursorSpeed(x, y) { + const currentTime = performance.now(); + const elapsedTime = currentTime - lastCursorTime; + if (lastX === null || lastY === null || elapsedTime === 0) { + lastX = x; + lastY = y; + lastCursorTime = currentTime; + return null; + } + const deltaX = x - lastX; + const deltaY = y - lastY; + const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); + const speed = distance / elapsedTime; // px / ms + lastX = x; + lastY = y; + lastCursorTime = currentTime; + return speed; + } + const fn = (_ref)=>{ + let { x: x, y: y, placement: placement, elements: elements, onClose: onClose, nodeId: nodeId, tree: tree } = _ref; + return function onMouseMove(event) { + function close() { + clearTimeout(timeoutId); + onClose(); + } + clearTimeout(timeoutId); + if (!elements.domReference || !elements.floating || placement == null || x == null || y == null) return; + const { clientX: clientX, clientY: clientY } = event; + const clientPoint = [ + clientX, + clientY + ]; + const target = (0, $d8YHU.getTarget)(event); + const isLeave = event.type === "mouseleave"; + const isOverFloatingEl = (0, $d8YHU.contains)(elements.floating, target); + const isOverReferenceEl = (0, $d8YHU.contains)(elements.domReference, target); + const refRect = elements.domReference.getBoundingClientRect(); + const rect = elements.floating.getBoundingClientRect(); + const side = placement.split("-")[0]; + const cursorLeaveFromRight = x > rect.right - rect.width / 2; + const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; + const isOverReferenceRect = $56b436271f6666d1$var$isInside(clientPoint, refRect); + const isFloatingWider = rect.width > refRect.width; + const isFloatingTaller = rect.height > refRect.height; + const left = (isFloatingWider ? refRect : rect).left; + const right = (isFloatingWider ? refRect : rect).right; + const top = (isFloatingTaller ? refRect : rect).top; + const bottom = (isFloatingTaller ? refRect : rect).bottom; + if (isOverFloatingEl) { + hasLanded = true; + if (!isLeave) return; + } + if (isOverReferenceEl) hasLanded = false; + if (isOverReferenceEl && !isLeave) { + hasLanded = true; + return; + } + // Prevent overlapping floating element from being stuck in an open-close + // loop: https://github.com/floating-ui/floating-ui/issues/1910 + if (isLeave && (0, $8Xnp2.isElement)(event.relatedTarget) && (0, $d8YHU.contains)(elements.floating, event.relatedTarget)) return; + // If any nested child is open, abort. + if (tree && $56b436271f6666d1$var$getChildren(tree.nodesRef.current, nodeId).some((_ref2)=>{ + let { context: context } = _ref2; + return context == null ? void 0 : context.open; + })) return; + // If the pointer is leaving from the opposite side, the "buffer" logic + // creates a point where the floating element remains open, but should be + // ignored. + // A constant of 1 handles floating point rounding errors. + if (side === "top" && y >= refRect.bottom - 1 || side === "bottom" && y <= refRect.top + 1 || side === "left" && x >= refRect.right - 1 || side === "right" && x <= refRect.left + 1) return close(); + // Ignore when the cursor is within the rectangular trough between the + // two elements. Since the triangle is created from the cursor point, + // which can start beyond the ref element's edge, traversing back and + // forth from the ref to the floating element can cause it to close. This + // ensures it always remains open in that case. + let rectPoly = []; + switch(side){ + case "top": + rectPoly = [ + [ + left, + refRect.top + 1 + ], + [ + left, + rect.bottom - 1 + ], + [ + right, + rect.bottom - 1 + ], + [ + right, + refRect.top + 1 + ] + ]; + break; + case "bottom": + rectPoly = [ + [ + left, + rect.top + 1 + ], + [ + left, + refRect.bottom - 1 + ], + [ + right, + refRect.bottom - 1 + ], + [ + right, + rect.top + 1 + ] + ]; + break; + case "left": + rectPoly = [ + [ + rect.right - 1, + bottom + ], + [ + rect.right - 1, + top + ], + [ + refRect.left + 1, + top + ], + [ + refRect.left + 1, + bottom + ] + ]; + break; + case "right": + rectPoly = [ + [ + refRect.right - 1, + bottom + ], + [ + refRect.right - 1, + top + ], + [ + rect.left + 1, + top + ], + [ + rect.left + 1, + bottom + ] + ]; + break; + } + function getPolygon(_ref3) { + let [x, y] = _ref3; + switch(side){ + case "top": + { + const cursorPointOne = [ + isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, + y + buffer + 1 + ]; + const cursorPointTwo = [ + isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, + y + buffer + 1 + ]; + const commonPoints = [ + [ + rect.left, + cursorLeaveFromRight ? rect.bottom - buffer : isFloatingWider ? rect.bottom - buffer : rect.top + ], + [ + rect.right, + cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer + ] + ]; + return [ + cursorPointOne, + cursorPointTwo, + ...commonPoints + ]; + } + case "bottom": + { + const cursorPointOne = [ + isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, + y - buffer + ]; + const cursorPointTwo = [ + isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, + y - buffer + ]; + const commonPoints = [ + [ + rect.left, + cursorLeaveFromRight ? rect.top + buffer : isFloatingWider ? rect.top + buffer : rect.bottom + ], + [ + rect.right, + cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer + ] + ]; + return [ + cursorPointOne, + cursorPointTwo, + ...commonPoints + ]; + } + case "left": + { + const cursorPointOne = [ + x + buffer + 1, + isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4 + ]; + const cursorPointTwo = [ + x + buffer + 1, + isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4 + ]; + const commonPoints = [ + [ + cursorLeaveFromBottom ? rect.right - buffer : isFloatingTaller ? rect.right - buffer : rect.left, + rect.top + ], + [ + cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer, + rect.bottom + ] + ]; + return [ + ...commonPoints, + cursorPointOne, + cursorPointTwo + ]; + } + case "right": + { + const cursorPointOne = [ + x - buffer, + isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4 + ]; + const cursorPointTwo = [ + x - buffer, + isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4 + ]; + const commonPoints = [ + [ + cursorLeaveFromBottom ? rect.left + buffer : isFloatingTaller ? rect.left + buffer : rect.right, + rect.top + ], + [ + cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer, + rect.bottom + ] + ]; + return [ + cursorPointOne, + cursorPointTwo, + ...commonPoints + ]; + } + } + } + if ($56b436271f6666d1$var$isPointInPolygon([ + clientX, + clientY + ], rectPoly)) return; + else if (hasLanded && !isOverReferenceRect) return close(); + if (!isLeave && requireIntent) { + const cursorSpeed = getCursorSpeed(event.clientX, event.clientY); + const cursorSpeedThreshold = 0.1; + if (cursorSpeed !== null && cursorSpeed < cursorSpeedThreshold) return close(); + } + if (!$56b436271f6666d1$var$isPointInPolygon([ + clientX, + clientY + ], getPolygon([ + x, + y + ]))) close(); + else if (!hasLanded && requireIntent) timeoutId = window.setTimeout(close, 40); + }; + }; + fn.__options = { + blockPointerEvents: blockPointerEvents + }; + return fn; +} + +}); +parcelRegister("d8YHU", function(module, exports) { + +$parcel$export(module.exports, "activeElement", () => $991b1cebdd128441$export$da980962bd2147a4); +$parcel$export(module.exports, "contains", () => $991b1cebdd128441$export$2344b14b097df817); +$parcel$export(module.exports, "getPlatform", () => $991b1cebdd128441$export$867a782338812cb4); +$parcel$export(module.exports, "getUserAgent", () => $991b1cebdd128441$export$7935961ef7719cb0); +$parcel$export(module.exports, "isVirtualClick", () => $991b1cebdd128441$export$60278871457622de); +$parcel$export(module.exports, "isVirtualPointerEvent", () => $991b1cebdd128441$export$29bf1b5f2c56cf63); +$parcel$export(module.exports, "isSafari", () => $991b1cebdd128441$export$95df08bae54cb4df); +$parcel$export(module.exports, "isMac", () => $991b1cebdd128441$export$9ac100e40613ea10); +$parcel$export(module.exports, "isMouseLikePointerType", () => $991b1cebdd128441$export$81cf264172d31e51); +$parcel$export(module.exports, "isReactEvent", () => $991b1cebdd128441$export$94781ce41a161222); +$parcel$export(module.exports, "isRootElement", () => $991b1cebdd128441$export$7b296c28e0fa3aed); +$parcel$export(module.exports, "getDocument", () => $991b1cebdd128441$export$f65ca476c09acec0); +$parcel$export(module.exports, "isEventTargetWithin", () => $991b1cebdd128441$export$43c3154d5bf2c6c2); +$parcel$export(module.exports, "getTarget", () => $991b1cebdd128441$export$c22522a4dfa48e9c); +$parcel$export(module.exports, "isTypeableElement", () => $991b1cebdd128441$export$42ad131c32f0fb8d); +$parcel$export(module.exports, "stopEvent", () => $991b1cebdd128441$export$7ae4cd3a66c1e050); + +var $8Xnp2 = parcelRequire("8Xnp2"); +function $991b1cebdd128441$export$da980962bd2147a4(doc) { + let activeElement = doc.activeElement; + while(((_activeElement = activeElement) == null ? void 0 : (_activeElement$shadow = _activeElement.shadowRoot) == null ? void 0 : _activeElement$shadow.activeElement) != null){ + var _activeElement, _activeElement$shadow; + activeElement = activeElement.shadowRoot.activeElement; + } + return activeElement; +} +function $991b1cebdd128441$export$2344b14b097df817(parent, child) { + if (!parent || !child) return false; + const rootNode = child.getRootNode && child.getRootNode(); + // First, attempt with faster native method + if (parent.contains(child)) return true; + // then fallback to custom implementation with Shadow DOM support + if (rootNode && (0, $8Xnp2.isShadowRoot)(rootNode)) { + let next = child; + while(next){ + if (parent === next) return true; + // @ts-ignore + next = next.parentNode || next.host; + } + } + // Give up, the result is false + return false; +} +// Avoid Chrome DevTools blue warning. +function $991b1cebdd128441$export$867a782338812cb4() { + const uaData = navigator.userAgentData; + if (uaData != null && uaData.platform) return uaData.platform; + return navigator.platform; +} +function $991b1cebdd128441$export$7935961ef7719cb0() { + const uaData = navigator.userAgentData; + if (uaData && Array.isArray(uaData.brands)) return uaData.brands.map((_ref)=>{ + let { brand: brand, version: version } = _ref; + return brand + "/" + version; + }).join(" "); + return navigator.userAgent; +} +// License: https://github.com/adobe/react-spectrum/blob/b35d5c02fe900badccd0cf1a8f23bb593419f238/packages/@react-aria/utils/src/isVirtualEvent.ts +function $991b1cebdd128441$export$60278871457622de(event) { + // FIXME: Firefox is now emitting a deprecation warning for `mozInputSource`. + // Try to find a workaround for this. `react-aria` source still has the check. + if (event.mozInputSource === 0 && event.isTrusted) return true; + if ($991b1cebdd128441$export$a11b0059900ceec8() && event.pointerType) return event.type === "click" && event.buttons === 1; + return event.detail === 0 && !event.pointerType; +} +function $991b1cebdd128441$export$29bf1b5f2c56cf63(event) { + return !$991b1cebdd128441$export$a11b0059900ceec8() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height. + event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0; +} +function $991b1cebdd128441$export$95df08bae54cb4df() { + // Chrome DevTools does not complain about navigator.vendor + return /apple/i.test(navigator.vendor); +} +function $991b1cebdd128441$export$a11b0059900ceec8() { + const re = /android/i; + return re.test($991b1cebdd128441$export$867a782338812cb4()) || re.test($991b1cebdd128441$export$7935961ef7719cb0()); +} +function $991b1cebdd128441$export$9ac100e40613ea10() { + return $991b1cebdd128441$export$867a782338812cb4().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints; +} +function $991b1cebdd128441$export$81cf264172d31e51(pointerType, strict) { + // On some Linux machines with Chromium, mouse inputs return a `pointerType` + // of "pen": https://github.com/floating-ui/floating-ui/issues/2015 + const values = [ + "mouse", + "pen" + ]; + if (!strict) values.push("", undefined); + return values.includes(pointerType); +} +function $991b1cebdd128441$export$94781ce41a161222(event) { + return "nativeEvent" in event; +} +function $991b1cebdd128441$export$7b296c28e0fa3aed(element) { + return element.matches("html,body"); +} +function $991b1cebdd128441$export$f65ca476c09acec0(node) { + return (node == null ? void 0 : node.ownerDocument) || document; +} +function $991b1cebdd128441$export$43c3154d5bf2c6c2(event, node) { + if (node == null) return false; + if ("composedPath" in event) return event.composedPath().includes(node); + // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't + const e = event; + return e.target != null && node.contains(e.target); +} +function $991b1cebdd128441$export$c22522a4dfa48e9c(event) { + if ("composedPath" in event) return event.composedPath()[0]; + // TS thinks `event` is of type never as it assumes all browsers support + // `composedPath()`, but browsers without shadow DOM don't. + return event.target; +} +const $991b1cebdd128441$export$78b3d091ff376bc = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; +function $991b1cebdd128441$export$42ad131c32f0fb8d(element) { + return (0, $8Xnp2.isHTMLElement)(element) && element.matches($991b1cebdd128441$export$78b3d091ff376bc); +} +function $991b1cebdd128441$export$7ae4cd3a66c1e050(event) { + event.preventDefault(); + event.stopPropagation(); +} + +}); +parcelRegister("8Xnp2", function(module, exports) { + +$parcel$export(module.exports, "getNodeName", () => $6855fcb605b0f44b$export$651544f548703224); +$parcel$export(module.exports, "getWindow", () => $6855fcb605b0f44b$export$38b2d434cce3ea22); +$parcel$export(module.exports, "getDocumentElement", () => $6855fcb605b0f44b$export$e495491855dc5418); +$parcel$export(module.exports, "isElement", () => $6855fcb605b0f44b$export$45a5e7f76e0caa8d); +$parcel$export(module.exports, "isHTMLElement", () => $6855fcb605b0f44b$export$1b3bfaa9684536aa); +$parcel$export(module.exports, "isShadowRoot", () => $6855fcb605b0f44b$export$af51f0f06c0f328a); +$parcel$export(module.exports, "isOverflowElement", () => $6855fcb605b0f44b$export$989e911fa9af580a); +$parcel$export(module.exports, "getComputedStyle", () => $6855fcb605b0f44b$export$3735103072e4a80); +$parcel$export(module.exports, "isTableElement", () => $6855fcb605b0f44b$export$71535ffaa902797f); +$parcel$export(module.exports, "isContainingBlock", () => $6855fcb605b0f44b$export$d6c4e8150c35fed1); +$parcel$export(module.exports, "isWebKit", () => $6855fcb605b0f44b$export$78551043582a6a98); +$parcel$export(module.exports, "getContainingBlock", () => $6855fcb605b0f44b$export$940d8225183e1404); +$parcel$export(module.exports, "getParentNode", () => $6855fcb605b0f44b$export$4e12058fc4d51d56); +$parcel$export(module.exports, "isLastTraversableNode", () => $6855fcb605b0f44b$export$d1162fb0b6d4cd51); +$parcel$export(module.exports, "getNodeScroll", () => $6855fcb605b0f44b$export$dc8fc79fa2800137); +$parcel$export(module.exports, "getOverflowAncestors", () => $6855fcb605b0f44b$export$3b57c1601291186b); +function $6855fcb605b0f44b$export$651544f548703224(node) { + if ($6855fcb605b0f44b$export$8ee0fc9ee280b4ee(node)) return (node.nodeName || "").toLowerCase(); + // Mocked nodes in testing environments may not be instances of Node. By + // returning `#document` an infinite loop won't occur. + // https://github.com/floating-ui/floating-ui/issues/2317 + return "#document"; +} +function $6855fcb605b0f44b$export$38b2d434cce3ea22(node) { + var _node$ownerDocument; + return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; +} +function $6855fcb605b0f44b$export$e495491855dc5418(node) { + var _ref; + return (_ref = ($6855fcb605b0f44b$export$8ee0fc9ee280b4ee(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; +} +function $6855fcb605b0f44b$export$8ee0fc9ee280b4ee(value) { + return value instanceof Node || value instanceof $6855fcb605b0f44b$export$38b2d434cce3ea22(value).Node; +} +function $6855fcb605b0f44b$export$45a5e7f76e0caa8d(value) { + return value instanceof Element || value instanceof $6855fcb605b0f44b$export$38b2d434cce3ea22(value).Element; +} +function $6855fcb605b0f44b$export$1b3bfaa9684536aa(value) { + return value instanceof HTMLElement || value instanceof $6855fcb605b0f44b$export$38b2d434cce3ea22(value).HTMLElement; +} +function $6855fcb605b0f44b$export$af51f0f06c0f328a(value) { + // Browsers without `ShadowRoot` support. + if (typeof ShadowRoot === "undefined") return false; + return value instanceof ShadowRoot || value instanceof $6855fcb605b0f44b$export$38b2d434cce3ea22(value).ShadowRoot; +} +function $6855fcb605b0f44b$export$989e911fa9af580a(element) { + const { overflow: overflow, overflowX: overflowX, overflowY: overflowY, display: display } = $6855fcb605b0f44b$export$3735103072e4a80(element); + return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && ![ + "inline", + "contents" + ].includes(display); +} +function $6855fcb605b0f44b$export$71535ffaa902797f(element) { + return [ + "table", + "td", + "th" + ].includes($6855fcb605b0f44b$export$651544f548703224(element)); +} +function $6855fcb605b0f44b$export$d6c4e8150c35fed1(element) { + const webkit = $6855fcb605b0f44b$export$78551043582a6a98(); + const css = $6855fcb605b0f44b$export$3735103072e4a80(element); + // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block + return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || [ + "transform", + "perspective", + "filter" + ].some((value)=>(css.willChange || "").includes(value)) || [ + "paint", + "layout", + "strict", + "content" + ].some((value)=>(css.contain || "").includes(value)); +} +function $6855fcb605b0f44b$export$940d8225183e1404(element) { + let currentNode = $6855fcb605b0f44b$export$4e12058fc4d51d56(element); + while($6855fcb605b0f44b$export$1b3bfaa9684536aa(currentNode) && !$6855fcb605b0f44b$export$d1162fb0b6d4cd51(currentNode)){ + if ($6855fcb605b0f44b$export$d6c4e8150c35fed1(currentNode)) return currentNode; + else currentNode = $6855fcb605b0f44b$export$4e12058fc4d51d56(currentNode); + } + return null; +} +function $6855fcb605b0f44b$export$78551043582a6a98() { + if (typeof CSS === "undefined" || !CSS.supports) return false; + return CSS.supports("-webkit-backdrop-filter", "none"); +} +function $6855fcb605b0f44b$export$d1162fb0b6d4cd51(node) { + return [ + "html", + "body", + "#document" + ].includes($6855fcb605b0f44b$export$651544f548703224(node)); +} +function $6855fcb605b0f44b$export$3735103072e4a80(element) { + return $6855fcb605b0f44b$export$38b2d434cce3ea22(element).getComputedStyle(element); +} +function $6855fcb605b0f44b$export$dc8fc79fa2800137(element) { + if ($6855fcb605b0f44b$export$45a5e7f76e0caa8d(element)) return { + scrollLeft: element.scrollLeft, + scrollTop: element.scrollTop + }; + return { + scrollLeft: element.pageXOffset, + scrollTop: element.pageYOffset + }; +} +function $6855fcb605b0f44b$export$4e12058fc4d51d56(node) { + if ($6855fcb605b0f44b$export$651544f548703224(node) === "html") return node; + const result = // Step into the shadow DOM of the parent of a slotted node. + node.assignedSlot || // DOM Element detected. + node.parentNode || // ShadowRoot detected. + $6855fcb605b0f44b$export$af51f0f06c0f328a(node) && node.host || // Fallback. + $6855fcb605b0f44b$export$e495491855dc5418(node); + return $6855fcb605b0f44b$export$af51f0f06c0f328a(result) ? result.host : result; +} +function $6855fcb605b0f44b$export$7cd01a57c8ca906c(node) { + const parentNode = $6855fcb605b0f44b$export$4e12058fc4d51d56(node); + if ($6855fcb605b0f44b$export$d1162fb0b6d4cd51(parentNode)) return node.ownerDocument ? node.ownerDocument.body : node.body; + if ($6855fcb605b0f44b$export$1b3bfaa9684536aa(parentNode) && $6855fcb605b0f44b$export$989e911fa9af580a(parentNode)) return parentNode; + return $6855fcb605b0f44b$export$7cd01a57c8ca906c(parentNode); +} +function $6855fcb605b0f44b$export$3b57c1601291186b(node, list, traverseIframes) { + var _node$ownerDocument2; + if (list === void 0) list = []; + if (traverseIframes === void 0) traverseIframes = true; + const scrollableAncestor = $6855fcb605b0f44b$export$7cd01a57c8ca906c(node); + const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); + const win = $6855fcb605b0f44b$export$38b2d434cce3ea22(scrollableAncestor); + if (isBody) return list.concat(win, win.visualViewport || [], $6855fcb605b0f44b$export$989e911fa9af580a(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? $6855fcb605b0f44b$export$3b57c1601291186b(win.frameElement) : []); + return list.concat(scrollableAncestor, $6855fcb605b0f44b$export$3b57c1601291186b(scrollableAncestor, [], traverseIframes)); +} + +}); + + +parcelRegister("fvpw6", function(module, exports) { + +$parcel$export(module.exports, "sides", () => $b49d8b63aada88c5$export$832b6fa47fa053d2); +$parcel$export(module.exports, "placements", () => $b49d8b63aada88c5$export$803cd8101b6c182b); +$parcel$export(module.exports, "min", () => $b49d8b63aada88c5$export$96ec731ed4dcb222); +$parcel$export(module.exports, "max", () => $b49d8b63aada88c5$export$8960430cfd85939f); +$parcel$export(module.exports, "round", () => $b49d8b63aada88c5$export$2077e0241d6afd3c); +$parcel$export(module.exports, "floor", () => $b49d8b63aada88c5$export$a3fe094919f356fd); +$parcel$export(module.exports, "createCoords", () => $b49d8b63aada88c5$export$a397704b5e280835); +$parcel$export(module.exports, "clamp", () => $b49d8b63aada88c5$export$7d15b64cf5a3a4c4); +$parcel$export(module.exports, "evaluate", () => $b49d8b63aada88c5$export$fef61f332f2c0afc); +$parcel$export(module.exports, "getSide", () => $b49d8b63aada88c5$export$3c915306cb7fc97a); +$parcel$export(module.exports, "getAlignment", () => $b49d8b63aada88c5$export$f0989780f32bfcda); +$parcel$export(module.exports, "getOppositeAxis", () => $b49d8b63aada88c5$export$8a000a963141ac32); +$parcel$export(module.exports, "getAxisLength", () => $b49d8b63aada88c5$export$320bd9d53520c68a); +$parcel$export(module.exports, "getSideAxis", () => $b49d8b63aada88c5$export$f28e8f882010718a); +$parcel$export(module.exports, "getAlignmentAxis", () => $b49d8b63aada88c5$export$2b57e0052a6d6d4c); +$parcel$export(module.exports, "getAlignmentSides", () => $b49d8b63aada88c5$export$be42861551f17911); +$parcel$export(module.exports, "getOppositePlacement", () => $b49d8b63aada88c5$export$9c5e28bad23365fa); +$parcel$export(module.exports, "getExpandedPlacements", () => $b49d8b63aada88c5$export$496432a3699e50b1); +$parcel$export(module.exports, "getOppositeAlignmentPlacement", () => $b49d8b63aada88c5$export$2b182c584985588b); +$parcel$export(module.exports, "getOppositeAxisPlacements", () => $b49d8b63aada88c5$export$a9b6fb18fd92c3ec); +$parcel$export(module.exports, "getPaddingObject", () => $b49d8b63aada88c5$export$598c291c29bc2e71); +$parcel$export(module.exports, "rectToClientRect", () => $b49d8b63aada88c5$export$ee05aea0aeecbad4); +const $b49d8b63aada88c5$export$832b6fa47fa053d2 = [ + "top", + "right", + "bottom", + "left" +]; +const $b49d8b63aada88c5$export$27b07d8a310ed8b5 = [ + "start", + "end" +]; +const $b49d8b63aada88c5$export$803cd8101b6c182b = /*#__PURE__*/ $b49d8b63aada88c5$export$832b6fa47fa053d2.reduce((acc, side)=>acc.concat(side, side + "-" + $b49d8b63aada88c5$export$27b07d8a310ed8b5[0], side + "-" + $b49d8b63aada88c5$export$27b07d8a310ed8b5[1]), []); +const $b49d8b63aada88c5$export$96ec731ed4dcb222 = Math.min; +const $b49d8b63aada88c5$export$8960430cfd85939f = Math.max; +const $b49d8b63aada88c5$export$2077e0241d6afd3c = Math.round; +const $b49d8b63aada88c5$export$a3fe094919f356fd = Math.floor; +const $b49d8b63aada88c5$export$a397704b5e280835 = (v)=>({ + x: v, + y: v + }); +const $b49d8b63aada88c5$var$oppositeSideMap = { + left: "right", + right: "left", + bottom: "top", + top: "bottom" +}; +const $b49d8b63aada88c5$var$oppositeAlignmentMap = { + start: "end", + end: "start" +}; +function $b49d8b63aada88c5$export$7d15b64cf5a3a4c4(start, value, end) { + return $b49d8b63aada88c5$export$8960430cfd85939f(start, $b49d8b63aada88c5$export$96ec731ed4dcb222(value, end)); +} +function $b49d8b63aada88c5$export$fef61f332f2c0afc(value, param) { + return typeof value === "function" ? value(param) : value; +} +function $b49d8b63aada88c5$export$3c915306cb7fc97a(placement) { + return placement.split("-")[0]; +} +function $b49d8b63aada88c5$export$f0989780f32bfcda(placement) { + return placement.split("-")[1]; +} +function $b49d8b63aada88c5$export$8a000a963141ac32(axis) { + return axis === "x" ? "y" : "x"; +} +function $b49d8b63aada88c5$export$320bd9d53520c68a(axis) { + return axis === "y" ? "height" : "width"; +} +function $b49d8b63aada88c5$export$f28e8f882010718a(placement) { + return [ + "top", + "bottom" + ].includes($b49d8b63aada88c5$export$3c915306cb7fc97a(placement)) ? "y" : "x"; +} +function $b49d8b63aada88c5$export$2b57e0052a6d6d4c(placement) { + return $b49d8b63aada88c5$export$8a000a963141ac32($b49d8b63aada88c5$export$f28e8f882010718a(placement)); +} +function $b49d8b63aada88c5$export$be42861551f17911(placement, rects, rtl) { + if (rtl === void 0) rtl = false; + const alignment = $b49d8b63aada88c5$export$f0989780f32bfcda(placement); + const alignmentAxis = $b49d8b63aada88c5$export$2b57e0052a6d6d4c(placement); + const length = $b49d8b63aada88c5$export$320bd9d53520c68a(alignmentAxis); + let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; + if (rects.reference[length] > rects.floating[length]) mainAlignmentSide = $b49d8b63aada88c5$export$9c5e28bad23365fa(mainAlignmentSide); + return [ + mainAlignmentSide, + $b49d8b63aada88c5$export$9c5e28bad23365fa(mainAlignmentSide) + ]; +} +function $b49d8b63aada88c5$export$496432a3699e50b1(placement) { + const oppositePlacement = $b49d8b63aada88c5$export$9c5e28bad23365fa(placement); + return [ + $b49d8b63aada88c5$export$2b182c584985588b(placement), + oppositePlacement, + $b49d8b63aada88c5$export$2b182c584985588b(oppositePlacement) + ]; +} +function $b49d8b63aada88c5$export$2b182c584985588b(placement) { + return placement.replace(/start|end/g, (alignment)=>$b49d8b63aada88c5$var$oppositeAlignmentMap[alignment]); +} +function $b49d8b63aada88c5$var$getSideList(side, isStart, rtl) { + const lr = [ + "left", + "right" + ]; + const rl = [ + "right", + "left" + ]; + const tb = [ + "top", + "bottom" + ]; + const bt = [ + "bottom", + "top" + ]; + switch(side){ + case "top": + case "bottom": + if (rtl) return isStart ? rl : lr; + return isStart ? lr : rl; + case "left": + case "right": + return isStart ? tb : bt; + default: + return []; + } +} +function $b49d8b63aada88c5$export$a9b6fb18fd92c3ec(placement, flipAlignment, direction, rtl) { + const alignment = $b49d8b63aada88c5$export$f0989780f32bfcda(placement); + let list = $b49d8b63aada88c5$var$getSideList($b49d8b63aada88c5$export$3c915306cb7fc97a(placement), direction === "start", rtl); + if (alignment) { + list = list.map((side)=>side + "-" + alignment); + if (flipAlignment) list = list.concat(list.map($b49d8b63aada88c5$export$2b182c584985588b)); + } + return list; +} +function $b49d8b63aada88c5$export$9c5e28bad23365fa(placement) { + return placement.replace(/left|right|bottom|top/g, (side)=>$b49d8b63aada88c5$var$oppositeSideMap[side]); +} +function $b49d8b63aada88c5$export$1c66dbf1a9e34223(padding) { + return { + top: 0, + right: 0, + bottom: 0, + left: 0, + ...padding + }; +} +function $b49d8b63aada88c5$export$598c291c29bc2e71(padding) { + return typeof padding !== "number" ? $b49d8b63aada88c5$export$1c66dbf1a9e34223(padding) : { + top: padding, + right: padding, + bottom: padding, + left: padding + }; +} +function $b49d8b63aada88c5$export$ee05aea0aeecbad4(rect) { + return { + ...rect, + top: rect.y, + left: rect.x, + right: rect.x + rect.width, + bottom: rect.y + rect.height + }; +} + +}); + +parcelRegister("2Dcmu", function(module, exports) { + +$parcel$export(module.exports, "arrow", () => $1ea8d0139225f984$export$f2120bbfa5450bd2); +$parcel$export(module.exports, "useFloating", () => $1ea8d0139225f984$export$4e02a5c1d08bac65); + +var $l2jTt = parcelRequire("l2jTt"); +var $91fsP = parcelRequire("91fsP"); +var $8Xnp2 = parcelRequire("8Xnp2"); + +var $63SH6 = parcelRequire("63SH6"); + +var $grDIR = parcelRequire("grDIR"); +/** + * Provides data to position an inner element of the floating element so that it + * appears centered to the reference element. + * This wraps the core `arrow` middleware to allow React refs as the element. + * @see https://floating-ui.com/docs/arrow + */ const $1ea8d0139225f984$export$f2120bbfa5450bd2 = (options)=>{ + function isRef(value) { + return ({}).hasOwnProperty.call(value, "current"); + } + return { + name: "arrow", + options: options, + fn (state) { + const { element: element, padding: padding } = typeof options === "function" ? options(state) : options; + if (element && isRef(element)) { + if (element.current != null) return (0, $l2jTt.arrow)({ + element: element.current, + padding: padding + }).fn(state); + return {}; + } else if (element) return (0, $l2jTt.arrow)({ + element: element, + padding: padding + }).fn(state); + return {}; + } + }; +}; +var $1ea8d0139225f984$var$index = typeof document !== "undefined" ? (0, $63SH6.useLayoutEffect) : (0, $63SH6.useEffect); +// Fork of `fast-deep-equal` that only does the comparisons we need and compares +// functions +function $1ea8d0139225f984$var$deepEqual(a, b) { + if (a === b) return true; + if (typeof a !== typeof b) return false; + if (typeof a === "function" && a.toString() === b.toString()) return true; + let length, i, keys; + if (a && b && typeof a == "object") { + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for(i = length; i-- !== 0;){ + if (!$1ea8d0139225f984$var$deepEqual(a[i], b[i])) return false; + } + return true; + } + keys = Object.keys(a); + length = keys.length; + if (length !== Object.keys(b).length) return false; + for(i = length; i-- !== 0;){ + if (!({}).hasOwnProperty.call(b, keys[i])) return false; + } + for(i = length; i-- !== 0;){ + const key = keys[i]; + if (key === "_owner" && a.$$typeof) continue; + if (!$1ea8d0139225f984$var$deepEqual(a[key], b[key])) return false; + } + return true; + } + return a !== a && b !== b; +} +function $1ea8d0139225f984$var$getDPR(element) { + if (typeof window === "undefined") return 1; + const win = element.ownerDocument.defaultView || window; + return win.devicePixelRatio || 1; +} +function $1ea8d0139225f984$var$roundByDPR(element, value) { + const dpr = $1ea8d0139225f984$var$getDPR(element); + return Math.round(value * dpr) / dpr; +} +function $1ea8d0139225f984$var$useLatestRef(value) { + const ref = $63SH6.useRef(value); + $1ea8d0139225f984$var$index(()=>{ + ref.current = value; + }); + return ref; +} +/** + * Provides data to position a floating element. + * @see https://floating-ui.com/docs/react + */ function $1ea8d0139225f984$export$4e02a5c1d08bac65(options) { + if (options === void 0) options = {}; + const { placement: placement = "bottom", strategy: strategy = "absolute", middleware: middleware = [], platform: platform, elements: { reference: externalReference, floating: externalFloating } = {}, transform: transform = true, whileElementsMounted: whileElementsMounted, open: open } = options; + const [data, setData] = $63SH6.useState({ + x: 0, + y: 0, + strategy: strategy, + placement: placement, + middlewareData: {}, + isPositioned: false + }); + const [latestMiddleware, setLatestMiddleware] = $63SH6.useState(middleware); + if (!$1ea8d0139225f984$var$deepEqual(latestMiddleware, middleware)) setLatestMiddleware(middleware); + const [_reference, _setReference] = $63SH6.useState(null); + const [_floating, _setFloating] = $63SH6.useState(null); + const setReference = $63SH6.useCallback((node)=>{ + if (node != referenceRef.current) { + referenceRef.current = node; + _setReference(node); + } + }, [ + _setReference + ]); + const setFloating = $63SH6.useCallback((node)=>{ + if (node !== floatingRef.current) { + floatingRef.current = node; + _setFloating(node); + } + }, [ + _setFloating + ]); + const referenceEl = externalReference || _reference; + const floatingEl = externalFloating || _floating; + const referenceRef = $63SH6.useRef(null); + const floatingRef = $63SH6.useRef(null); + const dataRef = $63SH6.useRef(data); + const whileElementsMountedRef = $1ea8d0139225f984$var$useLatestRef(whileElementsMounted); + const platformRef = $1ea8d0139225f984$var$useLatestRef(platform); + const update = $63SH6.useCallback(()=>{ + if (!referenceRef.current || !floatingRef.current) return; + const config = { + placement: placement, + strategy: strategy, + middleware: latestMiddleware + }; + if (platformRef.current) config.platform = platformRef.current; + (0, $91fsP.computePosition)(referenceRef.current, floatingRef.current, config).then((data)=>{ + const fullData = { + ...data, + isPositioned: true + }; + if (isMountedRef.current && !$1ea8d0139225f984$var$deepEqual(dataRef.current, fullData)) { + dataRef.current = fullData; + $grDIR.flushSync(()=>{ + setData(fullData); + }); + } + }); + }, [ + latestMiddleware, + placement, + strategy, + platformRef + ]); + $1ea8d0139225f984$var$index(()=>{ + if (open === false && dataRef.current.isPositioned) { + dataRef.current.isPositioned = false; + setData((data)=>({ + ...data, + isPositioned: false + })); + } + }, [ + open + ]); + const isMountedRef = $63SH6.useRef(false); + $1ea8d0139225f984$var$index(()=>{ + isMountedRef.current = true; + return ()=>{ + isMountedRef.current = false; + }; + }, []); + $1ea8d0139225f984$var$index(()=>{ + if (referenceEl) referenceRef.current = referenceEl; + if (floatingEl) floatingRef.current = floatingEl; + if (referenceEl && floatingEl) { + if (whileElementsMountedRef.current) return whileElementsMountedRef.current(referenceEl, floatingEl, update); + else update(); + } + }, [ + referenceEl, + floatingEl, + update, + whileElementsMountedRef + ]); + const refs = $63SH6.useMemo(()=>({ + reference: referenceRef, + floating: floatingRef, + setReference: setReference, + setFloating: setFloating + }), [ + setReference, + setFloating + ]); + const elements = $63SH6.useMemo(()=>({ + reference: referenceEl, + floating: floatingEl + }), [ + referenceEl, + floatingEl + ]); + const floatingStyles = $63SH6.useMemo(()=>{ + const initialStyles = { + position: strategy, + left: 0, + top: 0 + }; + if (!elements.floating) return initialStyles; + const x = $1ea8d0139225f984$var$roundByDPR(elements.floating, data.x); + const y = $1ea8d0139225f984$var$roundByDPR(elements.floating, data.y); + if (transform) return { + ...initialStyles, + transform: "translate(" + x + "px, " + y + "px)", + ...$1ea8d0139225f984$var$getDPR(elements.floating) >= 1.5 && { + willChange: "transform" + } + }; + return { + position: strategy, + left: x, + top: y + }; + }, [ + strategy, + transform, + elements.floating, + data.x, + data.y + ]); + return $63SH6.useMemo(()=>({ + ...data, + update: update, + refs: refs, + elements: elements, + floatingStyles: floatingStyles + }), [ + data, + update, + refs, + elements, + floatingStyles + ]); +} + +}); +parcelRegister("l2jTt", function(module, exports) { + +$parcel$export(module.exports, "computePosition", () => $f50937607e0de9ef$export$48a53dcb22e581d0); +$parcel$export(module.exports, "detectOverflow", () => $f50937607e0de9ef$export$37b6bde19b108ecc); +$parcel$export(module.exports, "arrow", () => $f50937607e0de9ef$export$f2120bbfa5450bd2); +$parcel$export(module.exports, "flip", () => $f50937607e0de9ef$export$8a83211c878a3f1f); +$parcel$export(module.exports, "offset", () => $f50937607e0de9ef$export$cc800923e997bb8); +$parcel$export(module.exports, "shift", () => $f50937607e0de9ef$export$fba63a578e423eb); +$parcel$export(module.exports, "rectToClientRect", () => (parcelRequire("fvpw6")).rectToClientRect); + +var $fvpw6 = parcelRequire("fvpw6"); +function $f50937607e0de9ef$var$computeCoordsFromPlacement(_ref, placement, rtl) { + let { reference: reference, floating: floating } = _ref; + const sideAxis = (0, $fvpw6.getSideAxis)(placement); + const alignmentAxis = (0, $fvpw6.getAlignmentAxis)(placement); + const alignLength = (0, $fvpw6.getAxisLength)(alignmentAxis); + const side = (0, $fvpw6.getSide)(placement); + const isVertical = sideAxis === "y"; + const commonX = reference.x + reference.width / 2 - floating.width / 2; + const commonY = reference.y + reference.height / 2 - floating.height / 2; + const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; + let coords; + switch(side){ + case "top": + coords = { + x: commonX, + y: reference.y - floating.height + }; + break; + case "bottom": + coords = { + x: commonX, + y: reference.y + reference.height + }; + break; + case "right": + coords = { + x: reference.x + reference.width, + y: commonY + }; + break; + case "left": + coords = { + x: reference.x - floating.width, + y: commonY + }; + break; + default: + coords = { + x: reference.x, + y: reference.y + }; + } + switch((0, $fvpw6.getAlignment)(placement)){ + case "start": + coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); + break; + case "end": + coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); + break; + } + return coords; +} +/** + * Computes the `x` and `y` coordinates that will place the floating element + * next to a reference element when it is given a certain positioning strategy. + * + * This export does not have any `platform` interface logic. You will need to + * write one for the platform you are using Floating UI with. + */ const $f50937607e0de9ef$export$48a53dcb22e581d0 = async (reference, floating, config)=>{ + const { placement: placement = "bottom", strategy: strategy = "absolute", middleware: middleware = [], platform: platform } = config; + const validMiddleware = middleware.filter(Boolean); + const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating)); + let rects = await platform.getElementRects({ + reference: reference, + floating: floating, + strategy: strategy + }); + let { x: x, y: y } = $f50937607e0de9ef$var$computeCoordsFromPlacement(rects, placement, rtl); + let statefulPlacement = placement; + let middlewareData = {}; + let resetCount = 0; + for(let i = 0; i < validMiddleware.length; i++){ + const { name: name, fn: fn } = validMiddleware[i]; + const { x: nextX, y: nextY, data: data, reset: reset } = await fn({ + x: x, + y: y, + initialPlacement: placement, + placement: statefulPlacement, + strategy: strategy, + middlewareData: middlewareData, + rects: rects, + platform: platform, + elements: { + reference: reference, + floating: floating + } + }); + x = nextX != null ? nextX : x; + y = nextY != null ? nextY : y; + middlewareData = { + ...middlewareData, + [name]: { + ...middlewareData[name], + ...data + } + }; + if (reset && resetCount <= 50) { + resetCount++; + if (typeof reset === "object") { + if (reset.placement) statefulPlacement = reset.placement; + if (reset.rects) rects = reset.rects === true ? await platform.getElementRects({ + reference: reference, + floating: floating, + strategy: strategy + }) : reset.rects; + ({ x: x, y: y } = $f50937607e0de9ef$var$computeCoordsFromPlacement(rects, statefulPlacement, rtl)); + } + i = -1; + continue; + } + } + return { + x: x, + y: y, + placement: statefulPlacement, + strategy: strategy, + middlewareData: middlewareData + }; +}; +/** + * Resolves with an object of overflow side offsets that determine how much the + * element is overflowing a given clipping boundary on each side. + * - positive = overflowing the boundary by that number of pixels + * - negative = how many pixels left before it will overflow + * - 0 = lies flush with the boundary + * @see https://floating-ui.com/docs/detectOverflow + */ async function $f50937607e0de9ef$export$37b6bde19b108ecc(state, options) { + var _await$platform$isEle; + if (options === void 0) options = {}; + const { x: x, y: y, platform: platform, rects: rects, elements: elements, strategy: strategy } = state; + const { boundary: boundary = "clippingAncestors", rootBoundary: rootBoundary = "viewport", elementContext: elementContext = "floating", altBoundary: altBoundary = false, padding: padding = 0 } = (0, $fvpw6.evaluate)(options, state); + const paddingObject = (0, $fvpw6.getPaddingObject)(padding); + const altContext = elementContext === "floating" ? "reference" : "floating"; + const element = elements[altBoundary ? altContext : elementContext]; + const clippingClientRect = (0, $fvpw6.rectToClientRect)(await platform.getClippingRect({ + element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)), + boundary: boundary, + rootBoundary: rootBoundary, + strategy: strategy + })); + const rect = elementContext === "floating" ? { + ...rects.floating, + x: x, + y: y + } : rects.reference; + const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)); + const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || { + x: 1, + y: 1 + } : { + x: 1, + y: 1 + }; + const elementClientRect = (0, $fvpw6.rectToClientRect)(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({ + rect: rect, + offsetParent: offsetParent, + strategy: strategy + }) : rect); + return { + top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, + bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, + left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, + right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x + }; +} +/** + * Provides data to position an inner element of the floating element so that it + * appears centered to the reference element. + * @see https://floating-ui.com/docs/arrow + */ const $f50937607e0de9ef$export$f2120bbfa5450bd2 = (options)=>({ + name: "arrow", + options: options, + async fn (state) { + const { x: x, y: y, placement: placement, rects: rects, platform: platform, elements: elements, middlewareData: middlewareData } = state; + // Since `element` is required, we don't Partial<> the type. + const { element: element, padding: padding = 0 } = (0, $fvpw6.evaluate)(options, state) || {}; + if (element == null) return {}; + const paddingObject = (0, $fvpw6.getPaddingObject)(padding); + const coords = { + x: x, + y: y + }; + const axis = (0, $fvpw6.getAlignmentAxis)(placement); + const length = (0, $fvpw6.getAxisLength)(axis); + const arrowDimensions = await platform.getDimensions(element); + const isYAxis = axis === "y"; + const minProp = isYAxis ? "top" : "left"; + const maxProp = isYAxis ? "bottom" : "right"; + const clientProp = isYAxis ? "clientHeight" : "clientWidth"; + const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; + const startDiff = coords[axis] - rects.reference[axis]; + const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element)); + let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0; + // DOM platform can return `window` as the `offsetParent`. + if (!clientSize || !await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent))) clientSize = elements.floating[clientProp] || rects.floating[length]; + const centerToReference = endDiff / 2 - startDiff / 2; + // If the padding is large enough that it causes the arrow to no longer be + // centered, modify the padding so that it is centered. + const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; + const minPadding = (0, $fvpw6.min)(paddingObject[minProp], largestPossiblePadding); + const maxPadding = (0, $fvpw6.min)(paddingObject[maxProp], largestPossiblePadding); + // Make sure the arrow doesn't overflow the floating element if the center + // point is outside the floating element's bounds. + const min$1 = minPadding; + const max = clientSize - arrowDimensions[length] - maxPadding; + const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; + const offset = (0, $fvpw6.clamp)(min$1, center, max); + // If the reference is small enough that the arrow's padding causes it to + // to point to nothing for an aligned placement, adjust the offset of the + // floating element itself. To ensure `shift()` continues to take action, + // a single reset is performed when this is true. + const shouldAddOffset = !middlewareData.arrow && (0, $fvpw6.getAlignment)(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; + const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0; + return { + [axis]: coords[axis] + alignmentOffset, + data: { + [axis]: offset, + centerOffset: center - offset - alignmentOffset, + ...shouldAddOffset && { + alignmentOffset: alignmentOffset + } + }, + reset: shouldAddOffset + }; + } + }); +function $f50937607e0de9ef$var$getPlacementList(alignment, autoAlignment, allowedPlacements) { + const allowedPlacementsSortedByAlignment = alignment ? [ + ...allowedPlacements.filter((placement)=>(0, $fvpw6.getAlignment)(placement) === alignment), + ...allowedPlacements.filter((placement)=>(0, $fvpw6.getAlignment)(placement) !== alignment) + ] : allowedPlacements.filter((placement)=>(0, $fvpw6.getSide)(placement) === placement); + return allowedPlacementsSortedByAlignment.filter((placement)=>{ + if (alignment) return (0, $fvpw6.getAlignment)(placement) === alignment || (autoAlignment ? (0, $fvpw6.getOppositeAlignmentPlacement)(placement) !== placement : false); + return true; + }); +} +/** + * Optimizes the visibility of the floating element by choosing the placement + * that has the most space available automatically, without needing to specify a + * preferred placement. Alternative to `flip`. + * @see https://floating-ui.com/docs/autoPlacement + */ const $f50937607e0de9ef$export$91fb6ecbd551914 = function(options) { + if (options === void 0) options = {}; + return { + name: "autoPlacement", + options: options, + async fn (state) { + var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE; + const { rects: rects, middlewareData: middlewareData, placement: placement, platform: platform, elements: elements } = state; + const { crossAxis: crossAxis = false, alignment: alignment, allowedPlacements: allowedPlacements = (0, $fvpw6.placements), autoAlignment: autoAlignment = true, ...detectOverflowOptions } = (0, $fvpw6.evaluate)(options, state); + const placements$1 = alignment !== undefined || allowedPlacements === (0, $fvpw6.placements) ? $f50937607e0de9ef$var$getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements; + const overflow = await $f50937607e0de9ef$export$37b6bde19b108ecc(state, detectOverflowOptions); + const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0; + const currentPlacement = placements$1[currentIndex]; + if (currentPlacement == null) return {}; + const alignmentSides = (0, $fvpw6.getAlignmentSides)(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))); + // Make `computeCoords` start from the right place. + if (placement !== currentPlacement) return { + reset: { + placement: placements$1[0] + } + }; + const currentOverflows = [ + overflow[(0, $fvpw6.getSide)(currentPlacement)], + overflow[alignmentSides[0]], + overflow[alignmentSides[1]] + ]; + const allOverflows = [ + ...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || [], + { + placement: currentPlacement, + overflows: currentOverflows + } + ]; + const nextPlacement = placements$1[currentIndex + 1]; + // There are more placements to check. + if (nextPlacement) return { + data: { + index: currentIndex + 1, + overflows: allOverflows + }, + reset: { + placement: nextPlacement + } + }; + const placementsSortedByMostSpace = allOverflows.map((d)=>{ + const alignment = (0, $fvpw6.getAlignment)(d.placement); + return [ + d.placement, + alignment && crossAxis ? // Check along the mainAxis and main crossAxis side. + d.overflows.slice(0, 2).reduce((acc, v)=>acc + v, 0) : // Check only the mainAxis. + d.overflows[0], + d.overflows + ]; + }).sort((a, b)=>a[1] - b[1]); + const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter((d)=>d[2].slice(0, // Aligned placements should not check their opposite crossAxis + // side. + (0, $fvpw6.getAlignment)(d[0]) ? 2 : 3).every((v)=>v <= 0)); + const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0]; + if (resetPlacement !== placement) return { + data: { + index: currentIndex + 1, + overflows: allOverflows + }, + reset: { + placement: resetPlacement + } + }; + return {}; + } + }; +}; +/** + * Optimizes the visibility of the floating element by flipping the `placement` + * in order to keep it in view when the preferred placement(s) will overflow the + * clipping boundary. Alternative to `autoPlacement`. + * @see https://floating-ui.com/docs/flip + */ const $f50937607e0de9ef$export$8a83211c878a3f1f = function(options) { + if (options === void 0) options = {}; + return { + name: "flip", + options: options, + async fn (state) { + var _middlewareData$arrow, _middlewareData$flip; + const { placement: placement, middlewareData: middlewareData, rects: rects, initialPlacement: initialPlacement, platform: platform, elements: elements } = state; + const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy: fallbackStrategy = "bestFit", fallbackAxisSideDirection: fallbackAxisSideDirection = "none", flipAlignment: flipAlignment = true, ...detectOverflowOptions } = (0, $fvpw6.evaluate)(options, state); + // If a reset by the arrow was caused due to an alignment offset being + // added, we should skip any logic now since `flip()` has already done its + // work. + // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643 + if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {}; + const side = (0, $fvpw6.getSide)(placement); + const isBasePlacement = (0, $fvpw6.getSide)(initialPlacement) === initialPlacement; + const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); + const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [ + (0, $fvpw6.getOppositePlacement)(initialPlacement) + ] : (0, $fvpw6.getExpandedPlacements)(initialPlacement)); + if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") fallbackPlacements.push(...(0, $fvpw6.getOppositeAxisPlacements)(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); + const placements = [ + initialPlacement, + ...fallbackPlacements + ]; + const overflow = await $f50937607e0de9ef$export$37b6bde19b108ecc(state, detectOverflowOptions); + const overflows = []; + let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; + if (checkMainAxis) overflows.push(overflow[side]); + if (checkCrossAxis) { + const sides = (0, $fvpw6.getAlignmentSides)(placement, rects, rtl); + overflows.push(overflow[sides[0]], overflow[sides[1]]); + } + overflowsData = [ + ...overflowsData, + { + placement: placement, + overflows: overflows + } + ]; + // One or more sides is overflowing. + if (!overflows.every((side)=>side <= 0)) { + var _middlewareData$flip2, _overflowsData$filter; + const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; + const nextPlacement = placements[nextIndex]; + if (nextPlacement) // Try next placement and re-run the lifecycle. + return { + data: { + index: nextIndex, + overflows: overflowsData + }, + reset: { + placement: nextPlacement + } + }; + // First, find the candidates that fit on the mainAxis side of overflow, + // then find the placement that fits the best on the main crossAxis side. + let resetPlacement = (_overflowsData$filter = overflowsData.filter((d)=>d.overflows[0] <= 0).sort((a, b)=>a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; + // Otherwise fallback. + if (!resetPlacement) switch(fallbackStrategy){ + case "bestFit": + { + var _overflowsData$map$so; + const placement = (_overflowsData$map$so = overflowsData.map((d)=>[ + d.placement, + d.overflows.filter((overflow)=>overflow > 0).reduce((acc, overflow)=>acc + overflow, 0) + ]).sort((a, b)=>a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0]; + if (placement) resetPlacement = placement; + break; + } + case "initialPlacement": + resetPlacement = initialPlacement; + break; + } + if (placement !== resetPlacement) return { + reset: { + placement: resetPlacement + } + }; + } + return {}; + } + }; +}; +function $f50937607e0de9ef$var$getSideOffsets(overflow, rect) { + return { + top: overflow.top - rect.height, + right: overflow.right - rect.width, + bottom: overflow.bottom - rect.height, + left: overflow.left - rect.width + }; +} +function $f50937607e0de9ef$var$isAnySideFullyClipped(overflow) { + return (0, $fvpw6.sides).some((side)=>overflow[side] >= 0); +} +/** + * Provides data to hide the floating element in applicable situations, such as + * when it is not in the same clipping context as the reference element. + * @see https://floating-ui.com/docs/hide + */ const $f50937607e0de9ef$export$fe8985bb6374093c = function(options) { + if (options === void 0) options = {}; + return { + name: "hide", + options: options, + async fn (state) { + const { rects: rects } = state; + const { strategy: strategy = "referenceHidden", ...detectOverflowOptions } = (0, $fvpw6.evaluate)(options, state); + switch(strategy){ + case "referenceHidden": + { + const overflow = await $f50937607e0de9ef$export$37b6bde19b108ecc(state, { + ...detectOverflowOptions, + elementContext: "reference" + }); + const offsets = $f50937607e0de9ef$var$getSideOffsets(overflow, rects.reference); + return { + data: { + referenceHiddenOffsets: offsets, + referenceHidden: $f50937607e0de9ef$var$isAnySideFullyClipped(offsets) + } + }; + } + case "escaped": + { + const overflow = await $f50937607e0de9ef$export$37b6bde19b108ecc(state, { + ...detectOverflowOptions, + altBoundary: true + }); + const offsets = $f50937607e0de9ef$var$getSideOffsets(overflow, rects.floating); + return { + data: { + escapedOffsets: offsets, + escaped: $f50937607e0de9ef$var$isAnySideFullyClipped(offsets) + } + }; + } + default: + return {}; + } + } + }; +}; +function $f50937607e0de9ef$var$getBoundingRect(rects) { + const minX = (0, $fvpw6.min)(...rects.map((rect)=>rect.left)); + const minY = (0, $fvpw6.min)(...rects.map((rect)=>rect.top)); + const maxX = (0, $fvpw6.max)(...rects.map((rect)=>rect.right)); + const maxY = (0, $fvpw6.max)(...rects.map((rect)=>rect.bottom)); + return { + x: minX, + y: minY, + width: maxX - minX, + height: maxY - minY + }; +} +function $f50937607e0de9ef$var$getRectsByLine(rects) { + const sortedRects = rects.slice().sort((a, b)=>a.y - b.y); + const groups = []; + let prevRect = null; + for(let i = 0; i < sortedRects.length; i++){ + const rect = sortedRects[i]; + if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) groups.push([ + rect + ]); + else groups[groups.length - 1].push(rect); + prevRect = rect; + } + return groups.map((rect)=>(0, $fvpw6.rectToClientRect)($f50937607e0de9ef$var$getBoundingRect(rect))); +} +/** + * Provides improved positioning for inline reference elements that can span + * over multiple lines, such as hyperlinks or range selections. + * @see https://floating-ui.com/docs/inline + */ const $f50937607e0de9ef$export$18c8ad048e32c7d5 = function(options) { + if (options === void 0) options = {}; + return { + name: "inline", + options: options, + async fn (state) { + const { placement: placement, elements: elements, rects: rects, platform: platform, strategy: strategy } = state; + // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a + // ClientRect's bounds, despite the event listener being triggered. A + // padding of 2 seems to handle this issue. + const { padding: padding = 2, x: x, y: y } = (0, $fvpw6.evaluate)(options, state); + const nativeClientRects = Array.from(await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference)) || []); + const clientRects = $f50937607e0de9ef$var$getRectsByLine(nativeClientRects); + const fallback = (0, $fvpw6.rectToClientRect)($f50937607e0de9ef$var$getBoundingRect(nativeClientRects)); + const paddingObject = (0, $fvpw6.getPaddingObject)(padding); + function getBoundingClientRect() { + // There are two rects and they are disjoined. + if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) // Find the first rect in which the point is fully inside. + return clientRects.find((rect)=>x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback; + // There are 2 or more connected rects. + if (clientRects.length >= 2) { + if ((0, $fvpw6.getSideAxis)(placement) === "y") { + const firstRect = clientRects[0]; + const lastRect = clientRects[clientRects.length - 1]; + const isTop = (0, $fvpw6.getSide)(placement) === "top"; + const top = firstRect.top; + const bottom = lastRect.bottom; + const left = isTop ? firstRect.left : lastRect.left; + const right = isTop ? firstRect.right : lastRect.right; + const width = right - left; + const height = bottom - top; + return { + top: top, + bottom: bottom, + left: left, + right: right, + width: width, + height: height, + x: left, + y: top + }; + } + const isLeftSide = (0, $fvpw6.getSide)(placement) === "left"; + const maxRight = (0, $fvpw6.max)(...clientRects.map((rect)=>rect.right)); + const minLeft = (0, $fvpw6.min)(...clientRects.map((rect)=>rect.left)); + const measureRects = clientRects.filter((rect)=>isLeftSide ? rect.left === minLeft : rect.right === maxRight); + const top = measureRects[0].top; + const bottom = measureRects[measureRects.length - 1].bottom; + const left = minLeft; + const right = maxRight; + const width = right - left; + const height = bottom - top; + return { + top: top, + bottom: bottom, + left: left, + right: right, + width: width, + height: height, + x: left, + y: top + }; + } + return fallback; + } + const resetRects = await platform.getElementRects({ + reference: { + getBoundingClientRect: getBoundingClientRect + }, + floating: elements.floating, + strategy: strategy + }); + if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) return { + reset: { + rects: resetRects + } + }; + return {}; + } + }; +}; +// For type backwards-compatibility, the `OffsetOptions` type was also +// Derivable. +async function $f50937607e0de9ef$var$convertValueToCoords(state, options) { + const { placement: placement, platform: platform, elements: elements } = state; + const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)); + const side = (0, $fvpw6.getSide)(placement); + const alignment = (0, $fvpw6.getAlignment)(placement); + const isVertical = (0, $fvpw6.getSideAxis)(placement) === "y"; + const mainAxisMulti = [ + "left", + "top" + ].includes(side) ? -1 : 1; + const crossAxisMulti = rtl && isVertical ? -1 : 1; + const rawValue = (0, $fvpw6.evaluate)(options, state); + // eslint-disable-next-line prefer-const + let { mainAxis: mainAxis, crossAxis: crossAxis, alignmentAxis: alignmentAxis } = typeof rawValue === "number" ? { + mainAxis: rawValue, + crossAxis: 0, + alignmentAxis: null + } : { + mainAxis: 0, + crossAxis: 0, + alignmentAxis: null, + ...rawValue + }; + if (alignment && typeof alignmentAxis === "number") crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; + return isVertical ? { + x: crossAxis * crossAxisMulti, + y: mainAxis * mainAxisMulti + } : { + x: mainAxis * mainAxisMulti, + y: crossAxis * crossAxisMulti + }; +} +/** + * Modifies the placement by translating the floating element along the + * specified axes. + * A number (shorthand for `mainAxis` or distance), or an axes configuration + * object may be passed. + * @see https://floating-ui.com/docs/offset + */ const $f50937607e0de9ef$export$cc800923e997bb8 = function(options) { + if (options === void 0) options = 0; + return { + name: "offset", + options: options, + async fn (state) { + const { x: x, y: y } = state; + const diffCoords = await $f50937607e0de9ef$var$convertValueToCoords(state, options); + return { + x: x + diffCoords.x, + y: y + diffCoords.y, + data: diffCoords + }; + } + }; +}; +/** + * Optimizes the visibility of the floating element by shifting it in order to + * keep it in view when it will overflow the clipping boundary. + * @see https://floating-ui.com/docs/shift + */ const $f50937607e0de9ef$export$fba63a578e423eb = function(options) { + if (options === void 0) options = {}; + return { + name: "shift", + options: options, + async fn (state) { + const { x: x, y: y, placement: placement } = state; + const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter: limiter = { + fn: (_ref)=>{ + let { x: x, y: y } = _ref; + return { + x: x, + y: y + }; + } + }, ...detectOverflowOptions } = (0, $fvpw6.evaluate)(options, state); + const coords = { + x: x, + y: y + }; + const overflow = await $f50937607e0de9ef$export$37b6bde19b108ecc(state, detectOverflowOptions); + const crossAxis = (0, $fvpw6.getSideAxis)((0, $fvpw6.getSide)(placement)); + const mainAxis = (0, $fvpw6.getOppositeAxis)(crossAxis); + let mainAxisCoord = coords[mainAxis]; + let crossAxisCoord = coords[crossAxis]; + if (checkMainAxis) { + const minSide = mainAxis === "y" ? "top" : "left"; + const maxSide = mainAxis === "y" ? "bottom" : "right"; + const min = mainAxisCoord + overflow[minSide]; + const max = mainAxisCoord - overflow[maxSide]; + mainAxisCoord = (0, $fvpw6.clamp)(min, mainAxisCoord, max); + } + if (checkCrossAxis) { + const minSide = crossAxis === "y" ? "top" : "left"; + const maxSide = crossAxis === "y" ? "bottom" : "right"; + const min = crossAxisCoord + overflow[minSide]; + const max = crossAxisCoord - overflow[maxSide]; + crossAxisCoord = (0, $fvpw6.clamp)(min, crossAxisCoord, max); + } + const limitedCoords = limiter.fn({ + ...state, + [mainAxis]: mainAxisCoord, + [crossAxis]: crossAxisCoord + }); + return { + ...limitedCoords, + data: { + x: limitedCoords.x - x, + y: limitedCoords.y - y + } + }; + } + }; +}; +/** + * Built-in `limiter` that will stop `shift()` at a certain point. + */ const $f50937607e0de9ef$export$7bf07e38f3dc4b69 = function(options) { + if (options === void 0) options = {}; + return { + options: options, + fn (state) { + const { x: x, y: y, placement: placement, rects: rects, middlewareData: middlewareData } = state; + const { offset: offset = 0, mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true } = (0, $fvpw6.evaluate)(options, state); + const coords = { + x: x, + y: y + }; + const crossAxis = (0, $fvpw6.getSideAxis)(placement); + const mainAxis = (0, $fvpw6.getOppositeAxis)(crossAxis); + let mainAxisCoord = coords[mainAxis]; + let crossAxisCoord = coords[crossAxis]; + const rawOffset = (0, $fvpw6.evaluate)(offset, state); + const computedOffset = typeof rawOffset === "number" ? { + mainAxis: rawOffset, + crossAxis: 0 + } : { + mainAxis: 0, + crossAxis: 0, + ...rawOffset + }; + if (checkMainAxis) { + const len = mainAxis === "y" ? "height" : "width"; + const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; + const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; + if (mainAxisCoord < limitMin) mainAxisCoord = limitMin; + else if (mainAxisCoord > limitMax) mainAxisCoord = limitMax; + } + if (checkCrossAxis) { + var _middlewareData$offse, _middlewareData$offse2; + const len = mainAxis === "y" ? "width" : "height"; + const isOriginSide = [ + "top", + "left" + ].includes((0, $fvpw6.getSide)(placement)); + const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); + const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); + if (crossAxisCoord < limitMin) crossAxisCoord = limitMin; + else if (crossAxisCoord > limitMax) crossAxisCoord = limitMax; + } + return { + [mainAxis]: mainAxisCoord, + [crossAxis]: crossAxisCoord + }; + } + }; +}; +/** + * Provides data that allows you to change the size of the floating element — + * for instance, prevent it from overflowing the clipping boundary or match the + * width of the reference element. + * @see https://floating-ui.com/docs/size + */ const $f50937607e0de9ef$export$346677f925de839c = function(options) { + if (options === void 0) options = {}; + return { + name: "size", + options: options, + async fn (state) { + const { placement: placement, rects: rects, platform: platform, elements: elements } = state; + const { apply: apply = ()=>{}, ...detectOverflowOptions } = (0, $fvpw6.evaluate)(options, state); + const overflow = await $f50937607e0de9ef$export$37b6bde19b108ecc(state, detectOverflowOptions); + const side = (0, $fvpw6.getSide)(placement); + const alignment = (0, $fvpw6.getAlignment)(placement); + const isYAxis = (0, $fvpw6.getSideAxis)(placement) === "y"; + const { width: width, height: height } = rects.floating; + let heightSide; + let widthSide; + if (side === "top" || side === "bottom") { + heightSide = side; + widthSide = alignment === (await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; + } else { + widthSide = side; + heightSide = alignment === "end" ? "top" : "bottom"; + } + const overflowAvailableHeight = height - overflow[heightSide]; + const overflowAvailableWidth = width - overflow[widthSide]; + const noShift = !state.middlewareData.shift; + let availableHeight = overflowAvailableHeight; + let availableWidth = overflowAvailableWidth; + if (isYAxis) { + const maximumClippingWidth = width - overflow.left - overflow.right; + availableWidth = alignment || noShift ? (0, $fvpw6.min)(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth; + } else { + const maximumClippingHeight = height - overflow.top - overflow.bottom; + availableHeight = alignment || noShift ? (0, $fvpw6.min)(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight; + } + if (noShift && !alignment) { + const xMin = (0, $fvpw6.max)(overflow.left, 0); + const xMax = (0, $fvpw6.max)(overflow.right, 0); + const yMin = (0, $fvpw6.max)(overflow.top, 0); + const yMax = (0, $fvpw6.max)(overflow.bottom, 0); + if (isYAxis) availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : (0, $fvpw6.max)(overflow.left, overflow.right)); + else availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : (0, $fvpw6.max)(overflow.top, overflow.bottom)); + } + await apply({ + ...state, + availableWidth: availableWidth, + availableHeight: availableHeight + }); + const nextDimensions = await platform.getDimensions(elements.floating); + if (width !== nextDimensions.width || height !== nextDimensions.height) return { + reset: { + rects: true + } + }; + return {}; + } + }; +}; + +}); + +parcelRegister("91fsP", function(module, exports) { + +$parcel$export(module.exports, "platform", () => $691033dc47d95db1$export$722a64dea1b767dc); +$parcel$export(module.exports, "autoUpdate", () => $691033dc47d95db1$export$deee3a793edee05f); +$parcel$export(module.exports, "computePosition", () => $691033dc47d95db1$export$48a53dcb22e581d0); +$parcel$export(module.exports, "getOverflowAncestors", () => (parcelRequire("8Xnp2")).getOverflowAncestors); +parcelRequire("l2jTt"); +var $fvpw6 = parcelRequire("fvpw6"); +var $l2jTt = parcelRequire("l2jTt"); + +var $fvpw6 = parcelRequire("fvpw6"); + +var $8Xnp2 = parcelRequire("8Xnp2"); +function $691033dc47d95db1$var$getCssDimensions(element) { + const css = (0, $8Xnp2.getComputedStyle)(element); + // In testing environments, the `width` and `height` properties are empty + // strings for SVG elements, returning NaN. Fallback to `0` in this case. + let width = parseFloat(css.width) || 0; + let height = parseFloat(css.height) || 0; + const hasOffset = (0, $8Xnp2.isHTMLElement)(element); + const offsetWidth = hasOffset ? element.offsetWidth : width; + const offsetHeight = hasOffset ? element.offsetHeight : height; + const shouldFallback = (0, $fvpw6.round)(width) !== offsetWidth || (0, $fvpw6.round)(height) !== offsetHeight; + if (shouldFallback) { + width = offsetWidth; + height = offsetHeight; + } + return { + width: width, + height: height, + $: shouldFallback + }; +} +function $691033dc47d95db1$var$unwrapElement(element) { + return !(0, $8Xnp2.isElement)(element) ? element.contextElement : element; +} +function $691033dc47d95db1$var$getScale(element) { + const domElement = $691033dc47d95db1$var$unwrapElement(element); + if (!(0, $8Xnp2.isHTMLElement)(domElement)) return (0, $fvpw6.createCoords)(1); + const rect = domElement.getBoundingClientRect(); + const { width: width, height: height, $: $ } = $691033dc47d95db1$var$getCssDimensions(domElement); + let x = ($ ? (0, $fvpw6.round)(rect.width) : rect.width) / width; + let y = ($ ? (0, $fvpw6.round)(rect.height) : rect.height) / height; + // 0, NaN, or Infinity should always fallback to 1. + if (!x || !Number.isFinite(x)) x = 1; + if (!y || !Number.isFinite(y)) y = 1; + return { + x: x, + y: y + }; +} +const $691033dc47d95db1$var$noOffsets = /*#__PURE__*/ (0, $fvpw6.createCoords)(0); +function $691033dc47d95db1$var$getVisualOffsets(element) { + const win = (0, $8Xnp2.getWindow)(element); + if (!(0, $8Xnp2.isWebKit)() || !win.visualViewport) return $691033dc47d95db1$var$noOffsets; + return { + x: win.visualViewport.offsetLeft, + y: win.visualViewport.offsetTop + }; +} +function $691033dc47d95db1$var$shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { + if (isFixed === void 0) isFixed = false; + if (!floatingOffsetParent || isFixed && floatingOffsetParent !== (0, $8Xnp2.getWindow)(element)) return false; + return isFixed; +} +function $691033dc47d95db1$var$getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { + if (includeScale === void 0) includeScale = false; + if (isFixedStrategy === void 0) isFixedStrategy = false; + const clientRect = element.getBoundingClientRect(); + const domElement = $691033dc47d95db1$var$unwrapElement(element); + let scale = (0, $fvpw6.createCoords)(1); + if (includeScale) { + if (offsetParent) { + if ((0, $8Xnp2.isElement)(offsetParent)) scale = $691033dc47d95db1$var$getScale(offsetParent); + } else scale = $691033dc47d95db1$var$getScale(element); + } + const visualOffsets = $691033dc47d95db1$var$shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? $691033dc47d95db1$var$getVisualOffsets(domElement) : (0, $fvpw6.createCoords)(0); + let x = (clientRect.left + visualOffsets.x) / scale.x; + let y = (clientRect.top + visualOffsets.y) / scale.y; + let width = clientRect.width / scale.x; + let height = clientRect.height / scale.y; + if (domElement) { + const win = (0, $8Xnp2.getWindow)(domElement); + const offsetWin = offsetParent && (0, $8Xnp2.isElement)(offsetParent) ? (0, $8Xnp2.getWindow)(offsetParent) : offsetParent; + let currentIFrame = win.frameElement; + while(currentIFrame && offsetParent && offsetWin !== win){ + const iframeScale = $691033dc47d95db1$var$getScale(currentIFrame); + const iframeRect = currentIFrame.getBoundingClientRect(); + const css = (0, $8Xnp2.getComputedStyle)(currentIFrame); + const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; + const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; + x *= iframeScale.x; + y *= iframeScale.y; + width *= iframeScale.x; + height *= iframeScale.y; + x += left; + y += top; + currentIFrame = (0, $8Xnp2.getWindow)(currentIFrame).frameElement; + } + } + return (0, $fvpw6.rectToClientRect)({ + width: width, + height: height, + x: x, + y: y + }); +} +function $691033dc47d95db1$var$convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { + let { rect: rect, offsetParent: offsetParent, strategy: strategy } = _ref; + const isOffsetParentAnElement = (0, $8Xnp2.isHTMLElement)(offsetParent); + const documentElement = (0, $8Xnp2.getDocumentElement)(offsetParent); + if (offsetParent === documentElement) return rect; + let scroll = { + scrollLeft: 0, + scrollTop: 0 + }; + let scale = (0, $fvpw6.createCoords)(1); + const offsets = (0, $fvpw6.createCoords)(0); + if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") { + if ((0, $8Xnp2.getNodeName)(offsetParent) !== "body" || (0, $8Xnp2.isOverflowElement)(documentElement)) scroll = (0, $8Xnp2.getNodeScroll)(offsetParent); + if ((0, $8Xnp2.isHTMLElement)(offsetParent)) { + const offsetRect = $691033dc47d95db1$var$getBoundingClientRect(offsetParent); + scale = $691033dc47d95db1$var$getScale(offsetParent); + offsets.x = offsetRect.x + offsetParent.clientLeft; + offsets.y = offsetRect.y + offsetParent.clientTop; + } + } + return { + width: rect.width * scale.x, + height: rect.height * scale.y, + x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x, + y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + }; +} +function $691033dc47d95db1$var$getClientRects(element) { + return Array.from(element.getClientRects()); +} +function $691033dc47d95db1$var$getWindowScrollBarX(element) { + // If has a CSS width greater than the viewport, then this will be + // incorrect for RTL. + return $691033dc47d95db1$var$getBoundingClientRect((0, $8Xnp2.getDocumentElement)(element)).left + (0, $8Xnp2.getNodeScroll)(element).scrollLeft; +} +// Gets the entire size of the scrollable document area, even extending outside +// of the `` and `` rect bounds if horizontally scrollable. +function $691033dc47d95db1$var$getDocumentRect(element) { + const html = (0, $8Xnp2.getDocumentElement)(element); + const scroll = (0, $8Xnp2.getNodeScroll)(element); + const body = element.ownerDocument.body; + const width = (0, $fvpw6.max)(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); + const height = (0, $fvpw6.max)(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); + let x = -scroll.scrollLeft + $691033dc47d95db1$var$getWindowScrollBarX(element); + const y = -scroll.scrollTop; + if ((0, $8Xnp2.getComputedStyle)(body).direction === "rtl") x += (0, $fvpw6.max)(html.clientWidth, body.clientWidth) - width; + return { + width: width, + height: height, + x: x, + y: y + }; +} +function $691033dc47d95db1$var$getViewportRect(element, strategy) { + const win = (0, $8Xnp2.getWindow)(element); + const html = (0, $8Xnp2.getDocumentElement)(element); + const visualViewport = win.visualViewport; + let width = html.clientWidth; + let height = html.clientHeight; + let x = 0; + let y = 0; + if (visualViewport) { + width = visualViewport.width; + height = visualViewport.height; + const visualViewportBased = (0, $8Xnp2.isWebKit)(); + if (!visualViewportBased || visualViewportBased && strategy === "fixed") { + x = visualViewport.offsetLeft; + y = visualViewport.offsetTop; + } + } + return { + width: width, + height: height, + x: x, + y: y + }; +} +// Returns the inner client rect, subtracting scrollbars if present. +function $691033dc47d95db1$var$getInnerBoundingClientRect(element, strategy) { + const clientRect = $691033dc47d95db1$var$getBoundingClientRect(element, true, strategy === "fixed"); + const top = clientRect.top + element.clientTop; + const left = clientRect.left + element.clientLeft; + const scale = (0, $8Xnp2.isHTMLElement)(element) ? $691033dc47d95db1$var$getScale(element) : (0, $fvpw6.createCoords)(1); + const width = element.clientWidth * scale.x; + const height = element.clientHeight * scale.y; + const x = left * scale.x; + const y = top * scale.y; + return { + width: width, + height: height, + x: x, + y: y + }; +} +function $691033dc47d95db1$var$getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { + let rect; + if (clippingAncestor === "viewport") rect = $691033dc47d95db1$var$getViewportRect(element, strategy); + else if (clippingAncestor === "document") rect = $691033dc47d95db1$var$getDocumentRect((0, $8Xnp2.getDocumentElement)(element)); + else if ((0, $8Xnp2.isElement)(clippingAncestor)) rect = $691033dc47d95db1$var$getInnerBoundingClientRect(clippingAncestor, strategy); + else { + const visualOffsets = $691033dc47d95db1$var$getVisualOffsets(element); + rect = { + ...clippingAncestor, + x: clippingAncestor.x - visualOffsets.x, + y: clippingAncestor.y - visualOffsets.y + }; + } + return (0, $fvpw6.rectToClientRect)(rect); +} +function $691033dc47d95db1$var$hasFixedPositionAncestor(element, stopNode) { + const parentNode = (0, $8Xnp2.getParentNode)(element); + if (parentNode === stopNode || !(0, $8Xnp2.isElement)(parentNode) || (0, $8Xnp2.isLastTraversableNode)(parentNode)) return false; + return (0, $8Xnp2.getComputedStyle)(parentNode).position === "fixed" || $691033dc47d95db1$var$hasFixedPositionAncestor(parentNode, stopNode); +} +// A "clipping ancestor" is an `overflow` element with the characteristic of +// clipping (or hiding) child elements. This returns all clipping ancestors +// of the given element up the tree. +function $691033dc47d95db1$var$getClippingElementAncestors(element, cache) { + const cachedResult = cache.get(element); + if (cachedResult) return cachedResult; + let result = (0, $8Xnp2.getOverflowAncestors)(element, [], false).filter((el)=>(0, $8Xnp2.isElement)(el) && (0, $8Xnp2.getNodeName)(el) !== "body"); + let currentContainingBlockComputedStyle = null; + const elementIsFixed = (0, $8Xnp2.getComputedStyle)(element).position === "fixed"; + let currentNode = elementIsFixed ? (0, $8Xnp2.getParentNode)(element) : element; + // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block + while((0, $8Xnp2.isElement)(currentNode) && !(0, $8Xnp2.isLastTraversableNode)(currentNode)){ + const computedStyle = (0, $8Xnp2.getComputedStyle)(currentNode); + const currentNodeIsContaining = (0, $8Xnp2.isContainingBlock)(currentNode); + if (!currentNodeIsContaining && computedStyle.position === "fixed") currentContainingBlockComputedStyle = null; + const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && [ + "absolute", + "fixed" + ].includes(currentContainingBlockComputedStyle.position) || (0, $8Xnp2.isOverflowElement)(currentNode) && !currentNodeIsContaining && $691033dc47d95db1$var$hasFixedPositionAncestor(element, currentNode); + if (shouldDropCurrentNode) // Drop non-containing blocks. + result = result.filter((ancestor)=>ancestor !== currentNode); + else // Record last containing block for next iteration. + currentContainingBlockComputedStyle = computedStyle; + currentNode = (0, $8Xnp2.getParentNode)(currentNode); + } + cache.set(element, result); + return result; +} +// Gets the maximum area that the element is visible in due to any number of +// clipping ancestors. +function $691033dc47d95db1$var$getClippingRect(_ref) { + let { element: element, boundary: boundary, rootBoundary: rootBoundary, strategy: strategy } = _ref; + const elementClippingAncestors = boundary === "clippingAncestors" ? $691033dc47d95db1$var$getClippingElementAncestors(element, this._c) : [].concat(boundary); + const clippingAncestors = [ + ...elementClippingAncestors, + rootBoundary + ]; + const firstClippingAncestor = clippingAncestors[0]; + const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor)=>{ + const rect = $691033dc47d95db1$var$getClientRectFromClippingAncestor(element, clippingAncestor, strategy); + accRect.top = (0, $fvpw6.max)(rect.top, accRect.top); + accRect.right = (0, $fvpw6.min)(rect.right, accRect.right); + accRect.bottom = (0, $fvpw6.min)(rect.bottom, accRect.bottom); + accRect.left = (0, $fvpw6.max)(rect.left, accRect.left); + return accRect; + }, $691033dc47d95db1$var$getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); + return { + width: clippingRect.right - clippingRect.left, + height: clippingRect.bottom - clippingRect.top, + x: clippingRect.left, + y: clippingRect.top + }; +} +function $691033dc47d95db1$var$getDimensions(element) { + return $691033dc47d95db1$var$getCssDimensions(element); +} +function $691033dc47d95db1$var$getRectRelativeToOffsetParent(element, offsetParent, strategy) { + const isOffsetParentAnElement = (0, $8Xnp2.isHTMLElement)(offsetParent); + const documentElement = (0, $8Xnp2.getDocumentElement)(offsetParent); + const isFixed = strategy === "fixed"; + const rect = $691033dc47d95db1$var$getBoundingClientRect(element, true, isFixed, offsetParent); + let scroll = { + scrollLeft: 0, + scrollTop: 0 + }; + const offsets = (0, $fvpw6.createCoords)(0); + if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { + if ((0, $8Xnp2.getNodeName)(offsetParent) !== "body" || (0, $8Xnp2.isOverflowElement)(documentElement)) scroll = (0, $8Xnp2.getNodeScroll)(offsetParent); + if (isOffsetParentAnElement) { + const offsetRect = $691033dc47d95db1$var$getBoundingClientRect(offsetParent, true, isFixed, offsetParent); + offsets.x = offsetRect.x + offsetParent.clientLeft; + offsets.y = offsetRect.y + offsetParent.clientTop; + } else if (documentElement) offsets.x = $691033dc47d95db1$var$getWindowScrollBarX(documentElement); + } + return { + x: rect.left + scroll.scrollLeft - offsets.x, + y: rect.top + scroll.scrollTop - offsets.y, + width: rect.width, + height: rect.height + }; +} +function $691033dc47d95db1$var$getTrueOffsetParent(element, polyfill) { + if (!(0, $8Xnp2.isHTMLElement)(element) || (0, $8Xnp2.getComputedStyle)(element).position === "fixed") return null; + if (polyfill) return polyfill(element); + return element.offsetParent; +} +// Gets the closest ancestor positioned element. Handles some edge cases, +// such as table ancestors and cross browser bugs. +function $691033dc47d95db1$var$getOffsetParent(element, polyfill) { + const window = (0, $8Xnp2.getWindow)(element); + if (!(0, $8Xnp2.isHTMLElement)(element)) return window; + let offsetParent = $691033dc47d95db1$var$getTrueOffsetParent(element, polyfill); + while(offsetParent && (0, $8Xnp2.isTableElement)(offsetParent) && (0, $8Xnp2.getComputedStyle)(offsetParent).position === "static")offsetParent = $691033dc47d95db1$var$getTrueOffsetParent(offsetParent, polyfill); + if (offsetParent && ((0, $8Xnp2.getNodeName)(offsetParent) === "html" || (0, $8Xnp2.getNodeName)(offsetParent) === "body" && (0, $8Xnp2.getComputedStyle)(offsetParent).position === "static" && !(0, $8Xnp2.isContainingBlock)(offsetParent))) return window; + return offsetParent || (0, $8Xnp2.getContainingBlock)(element) || window; +} +const $691033dc47d95db1$var$getElementRects = async function(_ref) { + let { reference: reference, floating: floating, strategy: strategy } = _ref; + const getOffsetParentFn = this.getOffsetParent || $691033dc47d95db1$var$getOffsetParent; + const getDimensionsFn = this.getDimensions; + return { + reference: $691033dc47d95db1$var$getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy), + floating: { + x: 0, + y: 0, + ...await getDimensionsFn(floating) + } + }; +}; +function $691033dc47d95db1$var$isRTL(element) { + return (0, $8Xnp2.getComputedStyle)(element).direction === "rtl"; +} +const $691033dc47d95db1$export$722a64dea1b767dc = { + convertOffsetParentRelativeRectToViewportRelativeRect: $691033dc47d95db1$var$convertOffsetParentRelativeRectToViewportRelativeRect, + getDocumentElement: $8Xnp2.getDocumentElement, + getClippingRect: $691033dc47d95db1$var$getClippingRect, + getOffsetParent: $691033dc47d95db1$var$getOffsetParent, + getElementRects: $691033dc47d95db1$var$getElementRects, + getClientRects: $691033dc47d95db1$var$getClientRects, + getDimensions: $691033dc47d95db1$var$getDimensions, + getScale: $691033dc47d95db1$var$getScale, + isElement: $8Xnp2.isElement, + isRTL: $691033dc47d95db1$var$isRTL +}; +// https://samthor.au/2021/observing-dom/ +function $691033dc47d95db1$var$observeMove(element, onMove) { + let io = null; + let timeoutId; + const root = (0, $8Xnp2.getDocumentElement)(element); + function cleanup() { + clearTimeout(timeoutId); + io && io.disconnect(); + io = null; + } + function refresh(skip, threshold) { + if (skip === void 0) skip = false; + if (threshold === void 0) threshold = 1; + cleanup(); + const { left: left, top: top, width: width, height: height } = element.getBoundingClientRect(); + if (!skip) onMove(); + if (!width || !height) return; + const insetTop = (0, $fvpw6.floor)(top); + const insetRight = (0, $fvpw6.floor)(root.clientWidth - (left + width)); + const insetBottom = (0, $fvpw6.floor)(root.clientHeight - (top + height)); + const insetLeft = (0, $fvpw6.floor)(left); + const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; + const options = { + rootMargin: rootMargin, + threshold: (0, $fvpw6.max)(0, (0, $fvpw6.min)(1, threshold)) || 1 + }; + let isFirstUpdate = true; + function handleObserve(entries) { + const ratio = entries[0].intersectionRatio; + if (ratio !== threshold) { + if (!isFirstUpdate) return refresh(); + if (!ratio) timeoutId = setTimeout(()=>{ + refresh(false, 1e-7); + }, 100); + else refresh(false, ratio); + } + isFirstUpdate = false; + } + // Older browsers don't support a `document` as the root and will throw an + // error. + try { + io = new IntersectionObserver(handleObserve, { + ...options, + // Handle