sygnal 5.4.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +646 -0
- package/README.md +24 -9
- package/dist/astro/client.cjs.js +16 -9
- package/dist/astro/client.cjs.js.map +1 -1
- package/dist/astro/client.mjs +16 -9
- package/dist/astro/client.mjs.map +1 -1
- package/dist/astro/index.cjs.js +362 -91
- package/dist/astro/index.cjs.js.map +1 -1
- package/dist/astro/index.mjs +362 -92
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/server.cjs.js +3396 -165
- package/dist/astro/server.cjs.js.map +1 -1
- package/dist/astro/server.mjs +3396 -165
- package/dist/astro/server.mjs.map +1 -1
- package/dist/devtools.cjs.js +1431 -0
- package/dist/devtools.cjs.js.map +1 -0
- package/dist/devtools.esm.js +1419 -0
- package/dist/devtools.esm.js.map +1 -0
- package/dist/diagnostics.cjs.js +3032 -296
- package/dist/diagnostics.cjs.js.map +1 -1
- package/dist/diagnostics.esm.js +3032 -296
- package/dist/diagnostics.esm.js.map +1 -1
- package/dist/element.cjs.js +230 -0
- package/dist/element.cjs.js.map +1 -0
- package/dist/element.esm.js +228 -0
- package/dist/element.esm.js.map +1 -0
- package/dist/guide/accessibility.md +257 -0
- package/dist/guide/adapters.md +221 -0
- package/dist/guide/behaviors.md +312 -0
- package/dist/guide/browser-sources.md +203 -0
- package/dist/guide/drag-and-drop.md +342 -0
- package/dist/guide/element-commands.md +306 -0
- package/dist/guide/error-boundaries.md +169 -0
- package/dist/guide/forms-reference.md +381 -0
- package/dist/guide/forms.md +250 -0
- package/dist/guide/http.md +299 -0
- package/dist/guide/inputs.md +173 -0
- package/dist/guide/persistence.md +245 -0
- package/dist/guide/recipes/carousel.md +155 -0
- package/dist/guide/recipes/charts.md +177 -0
- package/dist/guide/recipes/code-editor.md +135 -0
- package/dist/guide/recipes/data-grid.md +155 -0
- package/dist/guide/recipes/data-table.md +196 -0
- package/dist/guide/recipes/i18n.md +222 -0
- package/dist/guide/recipes/icons.md +115 -0
- package/dist/guide/recipes/overview.md +33 -0
- package/dist/guide/recipes/rich-text.md +154 -0
- package/dist/guide/resources.md +471 -0
- package/dist/guide/ssr.md +255 -0
- package/dist/guide/timers.md +178 -0
- package/dist/guide/ui/accordion.md +93 -0
- package/dist/guide/ui/combobox.md +144 -0
- package/dist/guide/ui/dialog.md +124 -0
- package/dist/guide/ui/disclosure.md +60 -0
- package/dist/guide/ui/menu.md +125 -0
- package/dist/guide/ui/overview.md +166 -0
- package/dist/guide/ui/popover.md +101 -0
- package/dist/guide/ui/select.md +114 -0
- package/dist/guide/ui/tabs.md +161 -0
- package/dist/guide/ui/toaster.md +152 -0
- package/dist/guide/ui/tooltip.md +103 -0
- package/dist/guide/undo.md +178 -0
- package/dist/guide/virtual-collections.md +183 -0
- package/dist/guide/web-components.md +179 -0
- package/dist/guide/widgets.md +217 -0
- package/dist/index.cjs.js +13178 -5769
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2908 -276
- package/dist/index.esm.js +13149 -5779
- package/dist/index.esm.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs.js +26 -334
- package/dist/jsx-dev-runtime.cjs.js.map +1 -1
- package/dist/jsx-dev-runtime.esm.js +19 -327
- package/dist/jsx-dev-runtime.esm.js.map +1 -1
- package/dist/jsx-runtime.cjs.js +26 -334
- package/dist/jsx-runtime.cjs.js.map +1 -1
- package/dist/jsx-runtime.esm.js +19 -327
- package/dist/jsx-runtime.esm.js.map +1 -1
- package/dist/jsx.cjs.js +10 -314
- package/dist/jsx.cjs.js.map +1 -1
- package/dist/jsx.esm.js +8 -315
- package/dist/jsx.esm.js.map +1 -1
- package/dist/react.cjs.js +117 -0
- package/dist/react.cjs.js.map +1 -0
- package/dist/react.esm.js +115 -0
- package/dist/react.esm.js.map +1 -0
- package/dist/shims/globalthis.cjs +20 -0
- package/dist/sygnal.min.js +1 -1
- package/dist/sygnal.min.js.map +1 -1
- package/dist/ui-combobox.cjs.js +169 -0
- package/dist/ui-combobox.cjs.js.map +1 -0
- package/dist/ui-combobox.esm.js +148 -0
- package/dist/ui-combobox.esm.js.map +1 -0
- package/dist/ui-menu.cjs.js +87 -0
- package/dist/ui-menu.cjs.js.map +1 -0
- package/dist/ui-menu.esm.js +66 -0
- package/dist/ui-menu.esm.js.map +1 -0
- package/dist/ui-select.cjs.js +104 -0
- package/dist/ui-select.cjs.js.map +1 -0
- package/dist/ui-select.esm.js +83 -0
- package/dist/ui-select.esm.js.map +1 -0
- package/dist/ui.cjs.js +738 -0
- package/dist/ui.cjs.js.map +1 -0
- package/dist/ui.esm.js +727 -0
- package/dist/ui.esm.js.map +1 -0
- package/dist/vike/ClientOnly.cjs.js +4 -14
- package/dist/vike/ClientOnly.cjs.js.map +1 -1
- package/dist/vike/ClientOnly.mjs +4 -14
- package/dist/vike/ClientOnly.mjs.map +1 -1
- package/dist/vike/{+config.js → config/+config.js} +9 -1
- package/dist/vike/config/+config.js.map +1 -0
- package/dist/vike/config/package.json +6 -0
- package/dist/vike/onRenderClient.cjs.js +165 -95
- package/dist/vike/onRenderClient.cjs.js.map +1 -1
- package/dist/vike/onRenderClient.mjs +165 -95
- package/dist/vike/onRenderClient.mjs.map +1 -1
- package/dist/vike/onRenderHtml.cjs.js +59 -24
- package/dist/vike/onRenderHtml.cjs.js.map +1 -1
- package/dist/vike/onRenderHtml.mjs +60 -25
- package/dist/vike/onRenderHtml.mjs.map +1 -1
- package/dist/vite/plugin.cjs.js +323 -88
- package/dist/vite/plugin.cjs.js.map +1 -1
- package/dist/vite/plugin.mjs +323 -89
- package/dist/vite/plugin.mjs.map +1 -1
- package/dist/zag.cjs.js +408 -0
- package/dist/zag.cjs.js.map +1 -0
- package/dist/zag.esm.js +405 -0
- package/dist/zag.esm.js.map +1 -0
- package/llms.txt +166 -103
- package/package.json +98 -14
- package/src/astro/client.ts +27 -16
- package/src/astro/index.d.ts +24 -0
- package/src/astro/index.ts +69 -3
- package/src/astro/server.ts +8 -2
- package/src/collection.ts +6 -93
- package/src/core/actions.ts +134 -0
- package/src/core/cell.ts +202 -0
- package/src/core/debug.ts +23 -0
- package/src/core/define.ts +242 -0
- package/src/core/hooks.ts +314 -0
- package/src/core/hosts/collection.ts +325 -0
- package/src/core/hosts/switchable.ts +146 -0
- package/src/core/instance.ts +592 -0
- package/src/core/markers/clientonly.ts +13 -0
- package/src/core/markers/lazy.ts +40 -0
- package/src/core/markers/portal.ts +96 -0
- package/src/core/markers/suspense.ts +41 -0
- package/src/core/markers/transition.ts +70 -0
- package/src/core/registry.ts +25 -0
- package/src/core/runtime.ts +573 -0
- package/src/core/statics.ts +104 -0
- package/src/core/teardown.ts +60 -0
- package/src/core/view.ts +37 -0
- package/src/cycle/dom/DocumentDOMSource.ts +13 -8
- package/src/cycle/dom/ElementFinder.ts +7 -9
- package/src/cycle/dom/EventDelegator.ts +174 -223
- package/src/cycle/dom/IsolateModule.ts +65 -35
- package/src/cycle/dom/MainDOMSource.ts +9 -2
- package/src/cycle/dom/PriorityQueue.ts +4 -2
- package/src/cycle/dom/SymbolTree.ts +18 -47
- package/src/cycle/dom/classNameModule.ts +9 -7
- package/src/cycle/dom/controlledInputModule.ts +23 -6
- package/src/cycle/dom/enrichEventStream.ts +25 -47
- package/src/cycle/dom/fragment.ts +7 -0
- package/src/cycle/dom/isolate.ts +30 -27
- package/src/cycle/dom/makeDOMDriver.ts +115 -56
- package/src/cycle/dom/mockDOMSource.ts +21 -1
- package/src/cycle/dom/modules.ts +16 -3
- package/src/cycle/dom/propsModule.ts +65 -0
- package/src/cycle/dom/selectModule.ts +22 -17
- package/src/cycle/dom/snabbdom.ts +1 -6
- package/src/cycle/dom/thunk.ts +3 -0
- package/src/cycle/dom/utils.ts +98 -0
- package/src/cycle/dom/viewTransition.ts +43 -0
- package/src/cycle/state/StateSource.ts +19 -3
- package/src/cycle/state/objIsEqual.ts +50 -0
- package/src/cycle/state/types.ts +0 -10
- package/src/defineComponent.ts +34 -0
- package/src/devtools.d.ts +151 -0
- package/src/devtools.ts +34 -0
- package/src/element.d.ts +59 -0
- package/src/element.ts +235 -0
- package/src/extra/backoff.ts +9 -0
- package/src/extra/behaviors.ts +169 -0
- package/src/extra/browserSignals.ts +23 -0
- package/src/extra/browserSources.ts +326 -0
- package/src/extra/command.ts +3 -3
- package/src/extra/controls.ts +47 -0
- package/src/extra/copyAsTest.ts +286 -0
- package/src/extra/devtools.ts +101 -31
- package/src/extra/devtoolsActions.ts +379 -0
- package/src/extra/devtoolsHook.ts +9 -0
- package/src/extra/devtoolsNext.ts +83 -0
- package/src/extra/diagnostics/checks/actionLog.ts +108 -0
- package/src/extra/diagnostics/checks/behaviors.ts +49 -0
- package/src/extra/diagnostics/checks/browserSources.ts +96 -0
- package/src/extra/diagnostics/checks/collections.ts +1 -1
- package/src/extra/diagnostics/checks/controls.ts +148 -0
- package/src/extra/diagnostics/checks/dataset.ts +57 -0
- package/src/extra/diagnostics/checks/dom.ts +20 -11
- package/src/extra/diagnostics/checks/elementCommands.ts +175 -0
- package/src/extra/diagnostics/checks/events.ts +17 -2
- package/src/extra/diagnostics/checks/fetch.ts +135 -0
- package/src/extra/diagnostics/checks/forms.ts +163 -0
- package/src/extra/diagnostics/checks/index.ts +97 -4
- package/src/extra/diagnostics/checks/inspect.ts +140 -32
- package/src/extra/diagnostics/checks/next.ts +417 -0
- package/src/extra/diagnostics/checks/persist.ts +54 -0
- package/src/extra/diagnostics/checks/props.ts +10 -5
- package/src/extra/diagnostics/checks/public.d.ts +98 -7
- package/src/extra/diagnostics/checks/replies.ts +128 -0
- package/src/extra/diagnostics/checks/router.ts +100 -0
- package/src/extra/diagnostics/checks/rxjsHints.ts +1 -1
- package/src/extra/diagnostics/checks/shared.ts +86 -2
- package/src/extra/diagnostics/checks/shorthand.ts +115 -0
- package/src/extra/diagnostics/checks/sortable.ts +129 -0
- package/src/extra/diagnostics/checks/state.ts +100 -7
- package/src/extra/diagnostics/checks/statics.ts +48 -0
- package/src/extra/diagnostics/checks/strict.ts +10 -67
- package/src/extra/diagnostics/checks/timers.ts +80 -0
- package/src/extra/diagnostics/checks/viewTransitions.ts +47 -0
- package/src/extra/diagnostics/checks/virtual.ts +73 -0
- package/src/extra/diagnostics/checks/widgets.ts +109 -0
- package/src/extra/diagnostics/checks/wiring.ts +66 -10
- package/src/extra/diagnostics/codes.ts +268 -23
- package/src/extra/diagnostics/index.ts +34 -9
- package/src/extra/diagnostics/legacy.ts +17 -0
- package/src/extra/driverFactories.ts +83 -19
- package/src/extra/elementCommands.ts +53 -0
- package/src/extra/fetchDriver.ts +519 -0
- package/src/extra/focusWithin.ts +27 -0
- package/src/extra/form.ts +268 -0
- package/src/extra/formHelpers.ts +139 -0
- package/src/extra/head.ts +106 -0
- package/src/extra/hmr.ts +2 -3
- package/src/extra/owned.ts +24 -0
- package/src/extra/pager.ts +50 -0
- package/src/extra/persist.ts +133 -0
- package/src/extra/pwa.ts +1 -1
- package/src/extra/queryCache.ts +107 -0
- package/src/extra/reducers.ts +1 -1
- package/src/extra/reduxDevtools.ts +92 -0
- package/src/extra/replies.ts +54 -0
- package/src/extra/router.ts +323 -0
- package/src/extra/run.ts +90 -217
- package/src/extra/selection.ts +76 -0
- package/src/extra/socketDriver.ts +265 -0
- package/src/extra/sortable.ts +377 -0
- package/src/extra/ssr.ts +427 -160
- package/src/extra/standardSchema.ts +27 -0
- package/src/extra/testing.ts +2433 -175
- package/src/extra/timers.ts +95 -0
- package/src/extra/undo.ts +261 -0
- package/src/extra/viewTransitions.ts +38 -0
- package/src/extra/virtual.ts +513 -0
- package/src/extra/widget.ts +201 -0
- package/src/index.d.ts +2631 -117
- package/src/index.ts +25 -4
- package/src/jsx-runtime.ts +15 -1
- package/src/jsx.ts +2 -1
- package/src/lazy.ts +50 -7
- package/src/portal.ts +3 -1
- package/src/pragma/index.ts +256 -133
- package/src/react-peers.d.ts +5 -0
- package/src/react.d.ts +43 -0
- package/src/react.ts +110 -0
- package/src/shared.ts +48 -0
- package/src/slot.ts +1 -1
- package/src/suspense.ts +3 -1
- package/src/switchable.ts +6 -121
- package/src/transition.ts +3 -1
- package/src/ui/accordion.ts +64 -0
- package/src/ui/dialog.ts +129 -0
- package/src/ui/disclosure.ts +35 -0
- package/src/ui/popover.ts +45 -0
- package/src/ui/shared.ts +94 -0
- package/src/ui/tabs.ts +82 -0
- package/src/ui/toaster.ts +198 -0
- package/src/ui/tooltip.ts +70 -0
- package/src/ui/zag/combobox.ts +115 -0
- package/src/ui/zag/menu.ts +40 -0
- package/src/ui/zag/select.ts +54 -0
- package/src/ui/zag/shared.ts +43 -0
- package/src/ui-combobox.d.ts +20 -0
- package/src/ui-combobox.ts +6 -0
- package/src/ui-menu.d.ts +30 -0
- package/src/ui-menu.ts +6 -0
- package/src/ui-select.d.ts +17 -0
- package/src/ui-select.ts +6 -0
- package/src/ui-zag-types.d.ts +42 -0
- package/src/ui.d.ts +208 -0
- package/src/ui.ts +15 -0
- package/src/vike/+config.ts +9 -1
- package/src/vike/ClientOnly.ts +1 -1
- package/src/vike/onRenderClient.ts +144 -96
- package/src/vike/onRenderHtml.ts +69 -26
- package/src/vike/types.ts +7 -1
- package/src/vite/globalthis-shim.ts +18 -0
- package/src/vite/globalthis.ts +56 -0
- package/src/vite/plugin.d.ts +22 -3
- package/src/vite/plugin.ts +222 -24
- package/src/zag.d.ts +64 -0
- package/src/zag.ts +238 -0
- package/dist/vike/+config.cjs.js +0 -66
- package/dist/vike/+config.cjs.js.map +0 -1
- package/dist/vike/+config.js.map +0 -1
- package/src/component.ts +0 -2301
- package/src/cycle/isolate/index.ts +0 -196
- package/src/cycle/run/index.ts +0 -151
- package/src/cycle/run/internals.ts +0 -143
- package/src/cycle/state/Collection.ts +0 -184
- package/src/cycle/state/index.ts +0 -5
- package/src/cycle/state/pickCombine.ts +0 -201
- package/src/cycle/state/pickMerge.ts +0 -122
- package/src/cycle/state/withState.ts +0 -47
- package/src/pragma/fn.ts +0 -55
package/dist/sygnal.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Sygnal={})}(this,(function(t){"use strict";function e(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(n){if("default"!==n&&!(n in t)){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}))})),Object.freeze(t)}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r={},s={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){var e,n=t.Symbol;if("function"==typeof n)if(n.observable)e=n.observable;else{e=n.for("https://github.com/benlesh/symbol-observable");try{n.observable=e}catch(t){}}else e="@@observable";return e}}(s);var i,a,c=s,l=Object.prototype.toString,u=function(t){var e=l.call(t),n="[object Arguments]"===e;return n||(n="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===l.call(t.callee)),n};var d=Array.prototype.slice,h=u,p=Object.keys,f=p?function(t){return p(t)}:function(){if(a)return i;var t;if(a=1,!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,o=u,r=Object.prototype.propertyIsEnumerable,s=!r.call({toString:null},"toString"),c=r.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(t){var e=t.constructor;return e&&e.prototype===t},h={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},p=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!h["$"+t]&&e.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{d(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();t=function(t){var r=null!==t&&"object"==typeof t,i="[object Function]"===n.call(t),a=o(t),u=r&&"[object String]"===n.call(t),h=[];if(!r&&!i&&!a)throw new TypeError("Object.keys called on a non-object");var f=c&&i;if(u&&t.length>0&&!e.call(t,0))for(var m=0;m<t.length;++m)h.push(String(m));if(a&&t.length>0)for(var y=0;y<t.length;++y)h.push(String(y));else for(var _ in t)f&&"prototype"===_||!e.call(t,_)||h.push(String(_));if(s)for(var v=function(t){if("undefined"==typeof window||!p)return d(t);try{return d(t)}catch(t){return!1}}(t),g=0;g<l.length;++g)v&&"constructor"===l[g]||!e.call(t,l[g])||h.push(l[g]);return h}}return i=t}(),m=Object.keys;f.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return h(t)?m(d.call(t)):m(t)})}else Object.keys=f;return Object.keys||f};var y,_=f,v="undefined"!=typeof Symbol&&Symbol,g=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),n=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var r=Object.getOwnPropertyDescriptor(t,e);if(42!==r.value||!0!==r.enumerable)return!1}return!0},S={foo:{}},b=Object,w=Array.prototype.slice,A=Object.prototype.toString,E=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==A.call(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var n,o=w.call(arguments,1),r=Math.max(0,e.length-o.length),s=[],i=0;i<r;i++)s.push("$"+i);if(n=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var r=e.apply(this,o.concat(w.call(arguments)));return Object(r)===r?r:this}return e.apply(t,o.concat(w.call(arguments)))})),e.prototype){var a=function(){};a.prototype=e.prototype,n.prototype=new a,a.prototype=null}return n},N=Function.prototype.bind||E,O=N.call(Function.call,Object.prototype.hasOwnProperty),C=SyntaxError,T=Function,k=TypeError,$=function(t){try{return T('"use strict"; return ('+t+").constructor;")()}catch(t){}},x=Object.getOwnPropertyDescriptor;if(x)try{x({},"")}catch(t){x=null}var L=function(){throw new k},D=x?function(){try{return L}catch(t){try{return x(arguments,"callee").get}catch(t){return L}}}():L,G="function"==typeof v&&"function"==typeof Symbol&&"symbol"==typeof v("foo")&&"symbol"==typeof Symbol("bar")&&g(),j={__proto__:S}.foo===S.foo&&!({__proto__:null}instanceof b),I=Object.getPrototypeOf||(j?function(t){return t.__proto__}:null),M={},P="undefined"!=typeof Uint8Array&&I?I(Uint8Array):y,Y={"%AggregateError%":"undefined"==typeof AggregateError?y:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?y:ArrayBuffer,"%ArrayIteratorPrototype%":G&&I?I([][Symbol.iterator]()):y,"%AsyncFromSyncIteratorPrototype%":y,"%AsyncFunction%":M,"%AsyncGenerator%":M,"%AsyncGeneratorFunction%":M,"%AsyncIteratorPrototype%":M,"%Atomics%":"undefined"==typeof Atomics?y:Atomics,"%BigInt%":"undefined"==typeof BigInt?y:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?y:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?y:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?y:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?y:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?y:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?y:FinalizationRegistry,"%Function%":T,"%GeneratorFunction%":M,"%Int8Array%":"undefined"==typeof Int8Array?y:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?y:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":G&&I?I(I([][Symbol.iterator]())):y,"%JSON%":"object"==typeof JSON?JSON:y,"%Map%":"undefined"==typeof Map?y:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&G&&I?I((new Map)[Symbol.iterator]()):y,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?y:Promise,"%Proxy%":"undefined"==typeof Proxy?y:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?y:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?y:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&G&&I?I((new Set)[Symbol.iterator]()):y,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":G&&I?I(""[Symbol.iterator]()):y,"%Symbol%":G?Symbol:y,"%SyntaxError%":C,"%ThrowTypeError%":D,"%TypedArray%":P,"%TypeError%":k,"%Uint8Array%":"undefined"==typeof Uint8Array?y:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?y:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?y:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?y:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?y:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?y:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?y:WeakSet};if(I)try{null.error}catch(t){var R=I(I(t));Y["%Error.prototype%"]=R}var F=function t(e){var n;if("%AsyncFunction%"===e)n=$("async function () {}");else if("%GeneratorFunction%"===e)n=$("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=$("async function* () {}");else if("%AsyncGenerator%"===e){var o=t("%AsyncGeneratorFunction%");o&&(n=o.prototype)}else if("%AsyncIteratorPrototype%"===e){var r=t("%AsyncGenerator%");r&&I&&(n=I(r.prototype))}return Y[e]=n,n},B={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},U=N,V=O,W=U.call(Function.call,Array.prototype.concat),H=U.call(Function.apply,Array.prototype.splice),z=U.call(Function.call,String.prototype.replace),q=U.call(Function.call,String.prototype.slice),J=U.call(Function.call,RegExp.prototype.exec),Z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,X=/\\(\\)?/g,K=function(t,e){var n,o=t;if(V(B,o)&&(o="%"+(n=B[o])[0]+"%"),V(Y,o)){var r=Y[o];if(r===M&&(r=F(o)),void 0===r&&!e)throw new k("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:o,value:r}}throw new C("intrinsic "+t+" does not exist!")},Q=function(t,e){if("string"!=typeof t||0===t.length)throw new k("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new k('"allowMissing" argument must be a boolean');if(null===J(/^%?[^%]*%?$/,t))throw new C("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(t){var e=q(t,0,1),n=q(t,-1);if("%"===e&&"%"!==n)throw new C("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new C("invalid intrinsic syntax, expected opening `%`");var o=[];return z(t,Z,(function(t,e,n,r){o[o.length]=n?z(r,X,"$1"):e||t})),o}(t),o=n.length>0?n[0]:"",r=K("%"+o+"%",e),s=r.name,i=r.value,a=!1,c=r.alias;c&&(o=c[0],H(n,W([0,1],c)));for(var l=1,u=!0;l<n.length;l+=1){var d=n[l],h=q(d,0,1),p=q(d,-1);if(('"'===h||"'"===h||"`"===h||'"'===p||"'"===p||"`"===p)&&h!==p)throw new C("property names with quotes must have matching quotes");if("constructor"!==d&&u||(a=!0),V(Y,s="%"+(o+="."+d)+"%"))i=Y[s];else if(null!=i){if(!(d in i)){if(!e)throw new k("base intrinsic for "+t+" exists, but the property is not available.");return}if(x&&l+1>=n.length){var f=x(i,d);i=(u=!!f)&&"get"in f&&!("originalValue"in f.get)?f.get:i[d]}else u=V(i,d),i=i[d];u&&!a&&(Y[s]=i)}}return i},tt=Q("%Object.defineProperty%",!0),et=function(){if(tt)try{return tt({},"a",{value:1}),!0}catch(t){return!1}return!1};et.hasArrayLengthDefineBug=function(){if(!et())return null;try{return 1!==tt([],"length",{value:1}).length}catch(t){return!0}};var nt=et,ot=_,rt="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),st=Object.prototype.toString,it=Array.prototype.concat,at=Object.defineProperty,ct=nt(),lt=at&&ct,ut=function(t,e,n,o){if(e in t)if(!0===o){if(t[e]===n)return}else if("function"!=typeof(r=o)||"[object Function]"!==st.call(r)||!o())return;var r;lt?at(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n},dt=function(t,e){var n=arguments.length>2?arguments[2]:{},o=ot(e);rt&&(o=it.call(o,Object.getOwnPropertySymbols(e)));for(var r=0;r<o.length;r+=1)ut(t,o[r],e[o[r]],n[o[r]])};dt.supportsDescriptors=!!lt;var ht=n,pt=function(){return"object"==typeof n&&n&&n.Math===Math&&n.Array===Array?n:ht},ft=dt,mt=pt,yt=dt,_t=n,vt=pt,gt=function(){var t=mt();if(ft.supportsDescriptors){var e=Object.getOwnPropertyDescriptor(t,"globalThis");e&&(!e.configurable||!e.enumerable&&e.writable&&globalThis===t)||Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else"object"==typeof globalThis&&globalThis===t||(t.globalThis=t);return t},St=vt(),bt=function(){return St};yt(bt,{getPolyfill:vt,implementation:_t,shim:gt});var wt,At=bt,Et=n&&n.__extends||(wt=function(t,e){return wt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},wt(t,e)},function(t,e){function n(){this.constructor=t}wt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(r,"__esModule",{value:!0});var Nt=r.NO_IL=r.NO=r.MemoryStream=re=r.Stream=void 0,Ot=c.default(At.getPolyfill()),Ct={},Tt=r.NO=Ct;function kt(){}function $t(t){for(var e=t.length,n=Array(e),o=0;o<e;++o)n[o]=t[o];return n}function xt(t,e,n){try{return t.f(e)}catch(t){return n._e(t),Ct}}var Lt={_n:kt,_e:kt,_c:kt};function Dt(t){t._start=function(t){t.next=t._n,t.error=t._e,t.complete=t._c,this.start(t)},t._stop=t.stop}Nt=r.NO_IL=Lt;var Gt=function(){function t(t,e){this._stream=t,this._listener=e}return t.prototype.unsubscribe=function(){this._stream._remove(this._listener)},t}(),jt=function(){function t(t){this._listener=t}return t.prototype.next=function(t){this._listener._n(t)},t.prototype.error=function(t){this._listener._e(t)},t.prototype.complete=function(){this._listener._c()},t}(),It=function(){function t(t){this.type="fromObservable",this.ins=t,this.active=!1}return t.prototype._start=function(t){this.out=t,this.active=!0,this._sub=this.ins.subscribe(new jt(t)),this.active||this._sub.unsubscribe()},t.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},t}(),Mt=function(){function t(t){this.type="merge",this.insArr=t,this.out=Ct,this.ac=0}return t.prototype._start=function(t){this.out=t;var e=this.insArr,n=e.length;this.ac=n;for(var o=0;o<n;o++)e[o]._add(this)},t.prototype._stop=function(){for(var t=this.insArr,e=t.length,n=0;n<e;n++)t[n]._remove(this);this.out=Ct},t.prototype._n=function(t){var e=this.out;e!==Ct&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){if(--this.ac<=0){var t=this.out;if(t===Ct)return;t._c()}},t}(),Pt=function(){function t(t,e,n){this.i=t,this.out=e,this.p=n,n.ils.push(this)}return t.prototype._n=function(t){var e=this.p,n=this.out;if(n!==Ct&&e.up(t,this.i)){var o=$t(e.vals);n._n(o)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.p;t.out!==Ct&&0==--t.Nc&&t.out._c()},t}(),Yt=function(){function t(t){this.type="combine",this.insArr=t,this.out=Ct,this.ils=[],this.Nc=this.Nn=0,this.vals=[]}return t.prototype.up=function(t,e){var n=this.vals[e],o=this.Nn?n===Ct?--this.Nn:this.Nn:0;return this.vals[e]=t,0===o},t.prototype._start=function(t){this.out=t;var e=this.insArr,n=this.Nc=this.Nn=e.length,o=this.vals=new Array(n);if(0===n)t._n([]),t._c();else for(var r=0;r<n;r++)o[r]=Ct,e[r]._add(new Pt(r,t,this))},t.prototype._stop=function(){for(var t=this.insArr,e=t.length,n=this.ils,o=0;o<e;o++)t[o]._remove(n[o]);this.out=Ct,this.ils=[],this.vals=[]},t}(),Rt=function(){function t(t){this.type="fromArray",this.a=t}return t.prototype._start=function(t){for(var e=this.a,n=0,o=e.length;n<o;n++)t._n(e[n]);t._c()},t.prototype._stop=function(){},t}(),Ft=function(){function t(t){this.type="fromPromise",this.on=!1,this.p=t}return t.prototype._start=function(t){var e=this;this.on=!0,this.p.then((function(n){e.on&&(t._n(n),t._c())}),(function(e){t._e(e)})).then(kt,(function(t){setTimeout((function(){throw t}))}))},t.prototype._stop=function(){this.on=!1},t}(),Bt=function(){function t(t){this.type="periodic",this.period=t,this.intervalID=-1,this.i=0}return t.prototype._start=function(t){var e=this;this.intervalID=setInterval((function(){t._n(e.i++)}),this.period)},t.prototype._stop=function(){-1!==this.intervalID&&clearInterval(this.intervalID),this.intervalID=-1,this.i=0},t}(),Ut=function(){function t(t,e){this.type="debug",this.ins=t,this.out=Ct,this.s=kt,this.l="","string"==typeof e?this.l=e:"function"==typeof e&&(this.s=e)}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=this.s,o=this.l;if(n!==kt)try{n(t)}catch(t){e._e(t)}else o?console.log(o+":",t):console.log(t);e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),Vt=function(){function t(t,e){this.type="drop",this.ins=e,this.out=Ct,this.max=t,this.dropped=0}return t.prototype._start=function(t){this.out=t,this.dropped=0,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ct},t.prototype._n=function(t){var e=this.out;e!==Ct&&this.dropped++>=this.max&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),Wt=function(){function t(t,e){this.out=t,this.op=e}return t.prototype._n=function(){this.op.end()},t.prototype._e=function(t){this.out._e(t)},t.prototype._c=function(){this.op.end()},t}(),Ht=function(){function t(t,e){this.type="endWhen",this.ins=e,this.out=Ct,this.o=t,this.oil=Lt}return t.prototype._start=function(t){this.out=t,this.o._add(this.oil=new Wt(t,this)),this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.o._remove(this.oil),this.out=Ct,this.oil=Lt},t.prototype.end=function(){var t=this.out;t!==Ct&&t._c()},t.prototype._n=function(t){var e=this.out;e!==Ct&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){this.end()},t}(),zt=function(){function t(t,e){this.type="filter",this.ins=e,this.out=Ct,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=xt(this,t,e);n!==Ct&&n&&e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),qt=function(){function t(t,e){this.out=t,this.op=e}return t.prototype._n=function(t){this.out._n(t)},t.prototype._e=function(t){this.out._e(t)},t.prototype._c=function(){this.op.inner=Ct,this.op.less()},t}(),Jt=function(){function t(t){this.type="flatten",this.ins=t,this.out=Ct,this.open=!0,this.inner=Ct,this.il=Lt}return t.prototype._start=function(t){this.out=t,this.open=!0,this.inner=Ct,this.il=Lt,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.inner!==Ct&&this.inner._remove(this.il),this.out=Ct,this.open=!0,this.inner=Ct,this.il=Lt},t.prototype.less=function(){var t=this.out;t!==Ct&&(this.open||this.inner!==Ct||t._c())},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=this.inner,o=this.il;n!==Ct&&o!==Lt&&n._remove(o),(this.inner=t)._add(this.il=new qt(e,this))}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){this.open=!1,this.less()},t}(),Zt=function(){function t(t,e,n){var o=this;this.type="fold",this.ins=n,this.out=Ct,this.f=function(e){return t(o.acc,e)},this.acc=this.seed=e}return t.prototype._start=function(t){this.out=t,this.acc=this.seed,t._n(this.acc),this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ct,this.acc=this.seed},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=xt(this,t,e);n!==Ct&&e._n(this.acc=n)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),Xt=function(){function t(t){this.type="last",this.ins=t,this.out=Ct,this.has=!1,this.val=Ct}return t.prototype._start=function(t){this.out=t,this.has=!1,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ct,this.val=Ct},t.prototype._n=function(t){this.has=!0,this.val=t},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&(this.has?(t._n(this.val),t._c()):t._e(new Error("last() failed because input stream completed")))},t}(),Kt=function(){function t(t,e){this.type="map",this.ins=e,this.out=Ct,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=xt(this,t,e);n!==Ct&&e._n(n)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),Qt=function(){function t(t){this.type="remember",this.ins=t,this.out=Ct}return t.prototype._start=function(t){this.out=t,this.ins._add(t)},t.prototype._stop=function(){this.ins._remove(this.out),this.out=Ct},t}(),te=function(){function t(t,e){this.type="replaceError",this.ins=e,this.out=Ct,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ct},t.prototype._n=function(t){var e=this.out;e!==Ct&&e._n(t)},t.prototype._e=function(t){var e=this.out;if(e!==Ct)try{this.ins._remove(this),(this.ins=this.f(t))._add(this)}catch(t){e._e(t)}},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),ee=function(){function t(t,e){this.type="startWith",this.ins=t,this.out=Ct,this.val=e}return t.prototype._start=function(t){this.out=t,this.out._n(this.val),this.ins._add(t)},t.prototype._stop=function(){this.ins._remove(this.out),this.out=Ct},t}(),ne=function(){function t(t,e){this.type="take",this.ins=e,this.out=Ct,this.max=t,this.taken=0}return t.prototype._start=function(t){this.out=t,this.taken=0,this.max<=0?t._c():this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=++this.taken;n<this.max?e._n(t):n===this.max&&(e._n(t),e._c())}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),oe=function(){function t(t){this._prod=t||Ct,this._ils=[],this._stopID=Ct,this._dl=Ct,this._d=!1,this._target=null,this._err=Ct}return t.prototype._n=function(t){var e=this._ils,n=e.length;if(this._d&&this._dl._n(t),1==n)e[0]._n(t);else{if(0==n)return;for(var o=$t(e),r=0;r<n;r++)o[r]._n(t)}},t.prototype._e=function(t){if(this._err===Ct){this._err=t;var e=this._ils,n=e.length;if(this._x(),this._d&&this._dl._e(t),1==n)e[0]._e(t);else{if(0==n)return;for(var o=$t(e),r=0;r<n;r++)o[r]._e(t)}if(!this._d&&0==n)throw this._err}},t.prototype._c=function(){var t=this._ils,e=t.length;if(this._x(),this._d&&this._dl._c(),1==e)t[0]._c();else{if(0==e)return;for(var n=$t(t),o=0;o<e;o++)n[o]._c()}},t.prototype._x=function(){0!==this._ils.length&&(this._prod!==Ct&&this._prod._stop(),this._err=Ct,this._ils=[])},t.prototype._stopNow=function(){this._prod._stop(),this._err=Ct,this._stopID=Ct},t.prototype._add=function(t){var e=this._target;if(e)return e._add(t);var n=this._ils;if(n.push(t),!(n.length>1))if(this._stopID!==Ct)clearTimeout(this._stopID),this._stopID=Ct;else{var o=this._prod;o!==Ct&&o._start(this)}},t.prototype._remove=function(t){var e=this,n=this._target;if(n)return n._remove(t);var o=this._ils,r=o.indexOf(t);r>-1&&(o.splice(r,1),this._prod!==Ct&&o.length<=0?(this._err=Ct,this._stopID=setTimeout((function(){return e._stopNow()}))):1===o.length&&this._pruneCycles())},t.prototype._pruneCycles=function(){this._hasNoSinks(this,[])&&this._remove(this._ils[0])},t.prototype._hasNoSinks=function(t,e){if(-1!==e.indexOf(t))return!0;if(t.out===this)return!0;if(t.out&&t.out!==Ct)return this._hasNoSinks(t.out,e.concat(t));if(t._ils){for(var n=0,o=t._ils.length;n<o;n++)if(!this._hasNoSinks(t._ils[n],e.concat(t)))return!1;return!0}return!1},t.prototype.ctor=function(){return this instanceof se?se:t},t.prototype.addListener=function(t){t._n=t.next||kt,t._e=t.error||kt,t._c=t.complete||kt,this._add(t)},t.prototype.removeListener=function(t){this._remove(t)},t.prototype.subscribe=function(t){return this.addListener(t),new Gt(this,t)},t.prototype[Ot]=function(){return this},t.create=function(e){if(e){if("function"!=typeof e.start||"function"!=typeof e.stop)throw new Error("producer requires both start and stop functions");Dt(e)}return new t(e)},t.createWithMemory=function(t){return t&&Dt(t),new se(t)},t.never=function(){return new t({_start:kt,_stop:kt})},t.empty=function(){return new t({_start:function(t){t._c()},_stop:kt})},t.throw=function(e){return new t({_start:function(t){t._e(e)},_stop:kt})},t.from=function(e){if("function"==typeof e[Ot])return t.fromObservable(e);if("function"==typeof e.then)return t.fromPromise(e);if(Array.isArray(e))return t.fromArray(e);throw new TypeError("Type of input to from() must be an Array, Promise, or Observable")},t.of=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.fromArray(e)},t.fromArray=function(e){return new t(new Rt(e))},t.fromPromise=function(e){return new t(new Ft(e))},t.fromObservable=function(e){if(void 0!==e.endWhen)return e;var n="function"==typeof e[Ot]?e[Ot]():e;return new t(new It(n))},t.periodic=function(e){return new t(new Bt(e))},t.prototype._map=function(t){return new(this.ctor())(new Kt(t,this))},t.prototype.map=function(t){return this._map(t)},t.prototype.mapTo=function(t){var e=this.map((function(){return t}));return e._prod.type="mapTo",e},t.prototype.filter=function(e){var n,o,r=this._prod;return new t(r instanceof zt?new zt((n=r.f,o=e,function(t){return n(t)&&o(t)}),r.ins):new zt(e,this))},t.prototype.take=function(t){return new(this.ctor())(new ne(t,this))},t.prototype.drop=function(e){return new t(new Vt(e,this))},t.prototype.last=function(){return new t(new Xt(this))},t.prototype.startWith=function(t){return new se(new ee(this,t))},t.prototype.endWhen=function(t){return new(this.ctor())(new Ht(t,this))},t.prototype.fold=function(t,e){return new se(new Zt(t,e,this))},t.prototype.replaceError=function(t){return new(this.ctor())(new te(t,this))},t.prototype.flatten=function(){return new t(new Jt(this))},t.prototype.compose=function(t){return t(this)},t.prototype.remember=function(){return new se(new Qt(this))},t.prototype.debug=function(t){return new(this.ctor())(new Ut(this,t))},t.prototype.imitate=function(t){if(t instanceof se)throw new Error("A MemoryStream was given to imitate(), but it only supports a Stream. Read more about this restriction here: https://github.com/staltz/xstream#faq");this._target=t;for(var e=this._ils,n=e.length,o=0;o<n;o++)t._add(e[o]);this._ils=[]},t.prototype.shamefullySendNext=function(t){this._n(t)},t.prototype.shamefullySendError=function(t){this._e(t)},t.prototype.shamefullySendComplete=function(){this._c()},t.prototype.setDebugListener=function(t){t?(this._d=!0,t._n=t.next||kt,t._e=t.error||kt,t._c=t.complete||kt,this._dl=t):(this._d=!1,this._dl=Ct)},t.merge=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Mt(e))},t.combine=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Yt(e))},t}(),re=r.Stream=oe,se=function(t){function e(e){var n=t.call(this,e)||this;return n._has=!1,n}return Et(e,t),e.prototype._n=function(e){this._v=e,this._has=!0,t.prototype._n.call(this,e)},e.prototype._add=function(t){var e=this._target;if(e)return e._add(t);var n=this._ils;if(n.push(t),n.length>1)this._has&&t._n(this._v);else if(this._stopID!==Ct)this._has&&t._n(this._v),clearTimeout(this._stopID),this._stopID=Ct;else if(this._has)t._n(this._v);else{var o=this._prod;o!==Ct&&o._start(this)}},e.prototype._stopNow=function(){this._has=!1,t.prototype._stopNow.call(this)},e.prototype._x=function(){this._has=!1,t.prototype._x.call(this)},e.prototype.map=function(t){return this._map(t)},e.prototype.mapTo=function(e){return t.prototype.mapTo.call(this,e)},e.prototype.take=function(e){return t.prototype.take.call(this,e)},e.prototype.endWhen=function(e){return t.prototype.endWhen.call(this,e)},e.prototype.replaceError=function(e){return t.prototype.replaceError.call(this,e)},e.prototype.remember=function(){return this},e.prototype.debug=function(e){return t.prototype.debug.call(this,e)},e}(oe),ie=r.MemoryStream=se,ae=oe,ce=r.default=ae,le=e({__proto__:null,get MemoryStream(){return ie},get NO(){return Tt},get NO_IL(){return Nt},get Stream(){return re},default:ce},[r]);function ue(t){return function(){let t;return t="undefined"!=typeof window?window:"undefined"!=typeof global?global:this,t.Cyclejs=t.Cyclejs||{},t=t.Cyclejs,t.adaptStream=t.adaptStream||(t=>t),t}().adaptStream(t)}let de=0;function he(){return"cycle"+ ++de}function pe(t,e=he()){!function(t,e){if("function"!=typeof t)throw new Error("First argument given to isolate() must be a 'dataflowComponent' function");if(null===e)throw new Error("Second argument given to isolate() must not be null")}(t,e);const n="object"==typeof e?he():"",o="string"==typeof e||"object"==typeof e?e:e.toString();return function(e,...r){const s=function(t,e,n){const o={};return Object.keys(t).forEach((t=>{if("string"==typeof e)return void(o[t]=e);const r=e[t];if(void 0!==r)return void(o[t]=r);const s=e["*"];o[t]=void 0===s?n:s})),o}(e,o,n),i=function(t,e){const n={};for(const o in t){const r=t[o];Object.prototype.hasOwnProperty.call(t,o)&&r&&null!==e[o]&&"function"==typeof r.isolateSource?n[o]=r.isolateSource(r,e[o]):Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n}(e,s),a=function(t,e,n){const o={};for(const r in e){const s=t[r],i=e[r];Object.prototype.hasOwnProperty.call(e,r)&&s&&null!==n[r]&&"function"==typeof s.isolateSink?o[r]=ue(s.isolateSink(ce.fromObservable(i),n[r])):Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r])}return o}(e,t(i,...r),s);return a}}pe.reset=()=>de=0;class fe{constructor(t){this.streams=t,this.type="concat",this.out=null,this.i=0}_start(t){this.out=t,this.streams[this.i]._add(this)}_stop(){const t=this.streams;this.i<t.length&&t[this.i]._remove(this),this.i=0,this.out=null}_n(t){const e=this.out;e&&e._n(t)}_e(t){const e=this.out;e&&e._e(t)}_c(){const t=this.out;if(!t)return;const e=this.streams;e[this.i]._remove(this),++this.i<e.length?e[this.i]._add(this):t._c()}}function me(...t){return new re(new fe(t))}const ye={};class _e{constructor(t,e){this.dt=t,this.ins=e,this.type="debounce",this.out=null,this.id=null,this.t=ye}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this),this.out=null,this.clearInterval()}clearInterval(){const t=this.id;null!==t&&clearInterval(t),this.id=null}_n(t){const e=this.out;e&&(this.clearInterval(),this.t=t,this.id=setInterval((()=>{this.clearInterval(),e._n(t),this.t=ye}),this.dt))}_e(t){const e=this.out;e&&(this.clearInterval(),e._e(t))}_c(){const t=this.out;t&&(this.clearInterval(),this.t!=ye&&t._n(this.t),this.t=ye,t._c())}}function ve(t){return function(e){return new re(new _e(t,e))}}class ge{constructor(t,e){this.dt=t,this.ins=e,this.type="throttle",this.out=null,this.id=null}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this),this.out=null,this.id=null}clearInterval(){const t=this.id;null!==t&&clearInterval(t),this.id=null}_n(t){const e=this.out;e&&(this.id||(e._n(t),this.id=setInterval((()=>{this.clearInterval()}),this.dt)))}_e(t){const e=this.out;e&&(this.clearInterval(),e._e(t))}_c(){const t=this.out;t&&(this.clearInterval(),t._c())}}class Se{constructor(t,e){this.dt=t,this.ins=e,this.type="delay",this.out=null}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this),this.out=null}_n(t){const e=this.out;if(!e)return;const n=setInterval((()=>{e._n(t),clearInterval(n)}),this.dt)}_e(t){const e=this.out;if(!e)return;const n=setInterval((()=>{e._e(t),clearInterval(n)}),this.dt)}_c(){const t=this.out;if(!t)return;const e=setInterval((()=>{t._c(),clearInterval(e)}),this.dt)}}function be(t){return function(e){return new re(new Se(t,e))}}const we={};class Ae{constructor(t,e){this.ins=t,this.type="dropRepeats",this.out=null,this.v=we,this.isEq=e||((t,e)=>t===e)}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this),this.out=null,this.v=we}_n(t){const e=this.out;if(!e)return;const n=this.v;n!==we&&this.isEq(t,n)||(this.v=t,e._n(t))}_e(t){const e=this.out;e&&e._e(t)}_c(){const t=this.out;t&&t._c()}}function Ee(t){return function(e){return new re(new Ae(e,t))}}const Ne={};class Oe{constructor(t,e){this.i=t,this.p=e,e.ils[t]=this}_n(t){const e=this.p;e.out!==Ne&&e.up(t,this.i)}_e(t){this.p._e(t)}_c(){this.p.down(this.i,this)}}class Ce{constructor(t,e){this.ins=t,this.others=e,this.type="sampleCombine",this.out=Ne,this.ils=[],this.Nn=0,this.vals=[]}_start(t){this.out=t;const e=this.others,n=this.Nn=e.length,o=this.vals=new Array(n);for(let t=0;t<n;t++)o[t]=Ne,e[t]._add(new Oe(t,this));this.ins._add(this)}_stop(){const t=this.others,e=t.length,n=this.ils;this.ins._remove(this);for(let o=0;o<e;o++)t[o]._remove(n[o]);this.out=Ne,this.vals=[],this.ils=[]}_n(t){const e=this.out;e!==Ne&&(this.Nn>0||e._n([t,...this.vals]))}_e(t){const e=this.out;e!==Ne&&e._e(t)}_c(){const t=this.out;t!==Ne&&t._c()}up(t,e){const n=this.vals[e];this.Nn>0&&n===Ne&&this.Nn--,this.vals[e]=t}down(t,e){this.others[t]._remove(e)}}function Te(...t){return function(e){return new re(new Ce(e,t))}}function ke(t){return"string"==typeof t||"number"==typeof t?function(e){return null==e?void 0:e[t]}:t.get}function $e(t){return"string"==typeof t||"number"==typeof t?function(e,n){return Array.isArray(e)?function(t,e,n){if(n===t[e])return t;const o=parseInt(e);return void 0===n?t.filter(((t,e)=>e!==o)):t.map(((t,e)=>e===o?n:t))}(e,t,n):void 0===e?{[t]:n}:{...e,[t]:n}}:t.set}function xe(t,e){return t.select(e)}function Le(t,e){const n=ke(e),o=$e(e);return t.map((t=>function(e){const r=n(e),s=t(r);return r===s?e:o(e,s)}))}class De{constructor(t,e){this.isolateSource=xe,this.isolateSink=Le,this._stream=t.filter((t=>void 0!==t)).compose(Ee()).remember(),this._name=e,this.stream=ue(this._stream),this._stream._isCycleSource=e}select(t){const e=ke(t);return new De(this._stream.map(e),this._name)}}class Ge{constructor(t,e,n){this.ins=n,this.out=t,this.p=e}_n(t){this.p;const e=this.out;null!==e&&e._n(t)}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){}}class je{constructor(t,e){this.type="pickMerge",this.ins=e,this.out=null,this.sel=t,this.ils=new Map,this.inst=null}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this);const t=this.ils;t.forEach(((e,n)=>{e.ins._remove(e),e.ins=null,e.out=null,t.delete(n)})),t.clear(),this.out=null,this.ils=new Map,this.inst=null}_n(t){this.inst=t;const e=t.arr,n=this.ils,o=this.out,r=this.sel,s=e.length;for(let t=0;t<s;++t){const s=e[t],i=s._key,a=ce.fromObservable(s[r]||ce.never());n.has(i)||(n.set(i,new Ge(o,this,a)),a._add(n.get(i)))}n.forEach(((e,o)=>{t.dict.has(o)&&t.dict.get(o)||(e.ins._remove(e),e.ins=null,e.out=null,n.delete(o))}))}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){const t=this.out;null!==t&&t._c()}}class Ie{constructor(t,e,n,o){this.key=t,this.out=e,this.p=n,this.val=Tt,this.ins=o}_n(t){this.p;const e=this.out;this.val=t,null!==e&&this.p.up()}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){}}class Me{constructor(t,e){this.type="combine",this.ins=e,this.sel=t,this.out=null,this.ils=new Map,this.inst=null,this.keys=[]}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this);const t=this.ils;t.forEach((t=>{t.ins._remove(t),t.ins=null,t.out=null,t.val=null})),t.clear(),this.out=null,this.ils=new Map,this.inst=null,this.keys=[]}up(){const t=this.inst.arr,e=t.length,n=this.ils,o=Array(e);for(let r=0;r<e;++r){const e=t[r]._key;if(!n.has(e))return;const s=n.get(e).val;if(s===Tt)return;o[r]=s}this.out._n(o)}_n(t){this.inst=t;const e=t.arr,n=this.ils,o=this.out,r=this.sel,s=t.dict,i=e.length;let a=!1;if(n.forEach(((t,e)=>{s.has(e)||(t.ins._remove(t),t.ins=null,t.out=null,t.val=null,n.delete(e),a=!0)})),0===i)return this.keys=[],void o._n([]);const c=Array(i);for(let t=0;t<i;++t){const s=e[t],i=s._key;if(c[t]=i,!s[r])throw new Error("pickCombine found an undefined child sink stream");const a=ce.fromObservable(s[r]);n.has(i)||(n.set(i,new Ie(i,o,this,a)),a._add(n.get(i)))}const l=function(t,e,n){const o=t.length;if(o===e.length){let n=!0;for(let r=0;r<o&&n;++r)n=t[r]===e[r];if(n)return!1}let r=0;const s=new Set(t);for(let i=0;i<e.length;++i){const a=e[i];if(s.has(a)){for(;r<o&&!n.has(t[r]);)++r;if(t[r]!==a)return!0;++r}}return!1}(this.keys,c,s);this.keys=c,(a||l)&&this.up()}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){const t=this.out;null!==t&&t._c()}}class Pe{constructor(t){this._instances$=t}pickMerge(t){return ue(this._instances$.compose(function(t){return function(e){return new re(new je(t,e))}}(t)))}pickCombine(t){return ue(this._instances$.compose(function(t){return function(e){return new re(new Me(t,e))}}(t)))}}function Ye(t){return{"*":null}}function Re(t,e){return{get(n){if(void 0!==n)for(let o=0,r=n.length;o<r;++o)if(`${t(n[o],o)}`===e)return n[o]},set:(n,o)=>void 0===n?[o]:void 0===o?n.filter(((n,o)=>`${t(n,o)}`!==e)):n.map(((n,r)=>`${t(n,r)}`===e?o:n))}}const Fe={get:t=>t,set:(t,e)=>e};function Be(t,e="state"){return function(n){const o=ce.create(),r=o.fold(((t,e)=>e(t)),void 0).drop(1),s=n;s[e]=new De(r,e);const i=t(s);if(i[e]){me(ce.fromObservable(i[e]),ce.never()).subscribe({next:t=>queueMicrotask((()=>o._n(t))),error:t=>queueMicrotask((()=>o._e(t))),complete:()=>queueMicrotask((()=>o._c()))})}return i}}function Ue(t,e,n,o,r){return{sel:t,data:e,children:n,text:o,elm:r,key:void 0===e?void 0:e.key}}const Ve=Array.isArray;function We(t){return"string"==typeof t||"number"==typeof t||t instanceof String||t instanceof Number}function He(t,e,n){if(t.ns="http://www.w3.org/2000/svg","foreignObject"!==n&&void 0!==e)for(let t=0;t<e.length;++t){const n=e[t];if("string"==typeof n)continue;const o=n.data;void 0!==o&&He(o,n.children,n.sel)}}function ze(t,e,n){let o,r,s,i={};if(void 0!==n?(null!==e&&(i=e),Ve(n)?o=n:We(n)?r=n.toString():n&&n.sel&&(o=[n])):null!=e&&(Ve(e)?o=e:We(e)?r=e.toString():e&&e.sel?o=[e]:i=e),void 0!==o)for(s=0;s<o.length;++s)We(o[s])&&(o[s]=Ue(void 0,void 0,void 0,o[s],void 0));return!t.startsWith("svg")||3!==t.length&&"."!==t[3]&&"#"!==t[3]||He(i,o,t),Ue(t,i,o,r,void 0)}function qe(t){if(Je(t)){for(;t&&Je(t);){t=Ze(t).parent}return null!=t?t:null}return t.parentNode}function Je(t){return 11===t.nodeType}function Ze(t,e){var n,o,r;const s=t;return null!==(n=s.parent)&&void 0!==n||(s.parent=null!=e?e:null),null!==(o=s.firstChildNode)&&void 0!==o||(s.firstChildNode=t.firstChild),null!==(r=s.lastChildNode)&&void 0!==r||(s.lastChildNode=t.lastChild),s}const Xe={createElement:function(t,e){return document.createElement(t,e)},createElementNS:function(t,e,n){return document.createElementNS(t,e,n)},createTextNode:function(t){return document.createTextNode(t)},createDocumentFragment:function(){return Ze(document.createDocumentFragment())},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){if(Je(t)){let e=t;for(;e&&Je(e);){e=Ze(e).parent}t=null!=e?e:t}Je(e)&&(e=Ze(e,t)),n&&Je(n)&&(n=Ze(n).firstChildNode),t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){Je(e)&&(e=Ze(e,t)),t.appendChild(e)},parentNode:qe,nextSibling:function(t){var e;if(Je(t)){const n=Ze(t),o=qe(n);if(o&&n.lastChildNode){const t=Array.from(o.childNodes),r=t.indexOf(n.lastChildNode);return null!==(e=t[r+1])&&void 0!==e?e:null}return null}return t.nextSibling},tagName:function(t){return t.tagName},setTextContent:function(t,e){t.textContent=e},getTextContent:function(t){return t.textContent},isElement:function(t){return 1===t.nodeType},isText:function(t){return 3===t.nodeType},isComment:function(t){return 8===t.nodeType},isDocumentFragment:Je},Ke=Ue("",{},[],void 0,void 0);function Qe(t,e){var n,o;const r=t.key===e.key,s=(null===(n=t.data)||void 0===n?void 0:n.is)===(null===(o=e.data)||void 0===o?void 0:o.is),i=t.sel===e.sel,a=!(!t.sel&&t.sel===e.sel)||typeof t.text==typeof e.text;return i&&r&&s&&a}function tn(){throw new Error("The document fragment is not supported on this platform.")}function en(t,e,n){var o;const r={};for(let s=e;s<=n;++s){const e=null===(o=t[s])||void 0===o?void 0:o.key;void 0!==e&&(r[e]=s)}return r}const nn=["create","update","remove","destroy","pre","post"];function on(t,e,n){const o={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},r=void 0!==e?e:Xe;for(const e of nn)for(const n of t){const t=n[e];void 0!==t&&o[e].push(t)}function s(t,e){return function(){if(0==--e){const e=r.parentNode(t);null!==e&&r.removeChild(e,t)}}}function i(t,e){var s,a,c,l,u;let d;const h=t.data,p=null==h?void 0:h.hook;null===(s=null==p?void 0:p.init)||void 0===s||s.call(p,t);const f=t.children,m=t.sel;if("!"===m)null!==(a=t.text)&&void 0!==a||(t.text=""),t.elm=r.createComment(t.text);else if(""===m)t.elm=r.createTextNode(t.text);else if(void 0!==m){const n=m.indexOf("#"),s=m.indexOf(".",n),a=n>0?n:m.length,l=s>0?s:m.length,u=-1!==n||-1!==s?m.slice(0,Math.min(a,l)):m,y=null==h?void 0:h.ns,_=void 0===y?r.createElement(u,h):r.createElementNS(y,u,h);for(t.elm=_,a<l&&_.setAttribute("id",m.slice(a+1,l)),s>0&&_.setAttribute("class",m.slice(l+1).replace(/\./g," ")),d=0;d<o.create.length;++d)o.create[d](Ke,t);if(!We(t.text)||Ve(f)&&0!==f.length||r.appendChild(_,r.createTextNode(t.text)),Ve(f))for(d=0;d<f.length;++d){const t=f[d];null!=t&&r.appendChild(_,i(t,e))}void 0!==p&&(null===(c=p.create)||void 0===c||c.call(p,Ke,t),void 0!==p.insert&&e.push(t))}else if((null===(l=null==n?void 0:n.experimental)||void 0===l?void 0:l.fragments)&&t.children){for(t.elm=(null!==(u=r.createDocumentFragment)&&void 0!==u?u:tn)(),d=0;d<o.create.length;++d)o.create[d](Ke,t);for(d=0;d<t.children.length;++d){const n=t.children[d];null!=n&&r.appendChild(t.elm,i(n,e))}}else t.elm=r.createTextNode(t.text);return t.elm}function a(t,e,n,o,s,a){for(;o<=s;++o){const s=n[o];null!=s&&r.insertBefore(t,i(s,a),e)}}function c(t){var e,n;const r=t.data;if(void 0!==r){null===(n=null===(e=null==r?void 0:r.hook)||void 0===e?void 0:e.destroy)||void 0===n||n.call(e,t);for(let e=0;e<o.destroy.length;++e)o.destroy[e](t);if(void 0!==t.children)for(let e=0;e<t.children.length;++e){const n=t.children[e];null!=n&&"string"!=typeof n&&c(n)}}}function l(t,e,n,i){for(var a,u;n<=i;++n){let i;const d=e[n];if(null!=d)if(void 0!==d.sel){c(d),i=o.remove.length+1;const t=s(d.elm,i);for(let e=0;e<o.remove.length;++e)o.remove[e](d,t);const e=null===(u=null===(a=null==d?void 0:d.data)||void 0===a?void 0:a.hook)||void 0===u?void 0:u.remove;void 0!==e?e(d,t):t()}else d.children?(c(d),l(t,d.children,0,d.children.length-1)):r.removeChild(t,d.elm)}}function u(t,e,n){var s,c,d,h,p,f,m,y;const _=null===(s=e.data)||void 0===s?void 0:s.hook;null===(c=null==_?void 0:_.prepatch)||void 0===c||c.call(_,t,e);const v=e.elm=t.elm;if(t===e)return;if(void 0!==e.data||void 0!==e.text&&e.text!==t.text){null!==(d=e.data)&&void 0!==d||(e.data={}),null!==(h=t.data)&&void 0!==h||(t.data={});for(let n=0;n<o.update.length;++n)o.update[n](t,e);null===(m=null===(f=null===(p=e.data)||void 0===p?void 0:p.hook)||void 0===f?void 0:f.update)||void 0===m||m.call(f,t,e)}const g=t.children,S=e.children;void 0===e.text?void 0!==g&&void 0!==S?g!==S&&function(t,e,n,o){let s,c,d,h,p=0,f=0,m=e.length-1,y=e[0],_=e[m],v=n.length-1,g=n[0],S=n[v];for(;p<=m&&f<=v;)null==y?y=e[++p]:null==_?_=e[--m]:null==g?g=n[++f]:null==S?S=n[--v]:Qe(y,g)?(u(y,g,o),y=e[++p],g=n[++f]):Qe(_,S)?(u(_,S,o),_=e[--m],S=n[--v]):Qe(y,S)?(u(y,S,o),r.insertBefore(t,y.elm,r.nextSibling(_.elm)),y=e[++p],S=n[--v]):Qe(_,g)?(u(_,g,o),r.insertBefore(t,_.elm,y.elm),_=e[--m],g=n[++f]):(void 0===s&&(s=en(e,p,m)),c=s[g.key],void 0===c?(r.insertBefore(t,i(g,o),y.elm),g=n[++f]):void 0===s[S.key]?(r.insertBefore(t,i(S,o),r.nextSibling(_.elm)),S=n[--v]):(d=e[c],d.sel!==g.sel?r.insertBefore(t,i(g,o),y.elm):(u(d,g,o),e[c]=void 0,r.insertBefore(t,d.elm,y.elm)),g=n[++f]));f<=v&&(h=null==n[v+1]?null:n[v+1].elm,a(t,h,n,f,v,o)),p<=m&&l(t,e,p,m)}(v,g,S,n):void 0!==S?(void 0!==t.text&&r.setTextContent(v,""),a(v,null,S,0,S.length-1,n)):void 0!==g?l(v,g,0,g.length-1):void 0!==t.text&&r.setTextContent(v,""):t.text!==e.text&&(void 0!==g&&l(v,g,0,g.length-1),r.setTextContent(v,e.text)),null===(y=null==_?void 0:_.postpatch)||void 0===y||y.call(_,t,e)}return function(t,e){let n,s,a;const c=[];for(n=0;n<o.pre.length;++n)o.pre[n]();for(!function(t,e){return t.isElement(e)}(r,t)?function(t,e){return t.isDocumentFragment(e)}(r,t)&&(t=Ue(void 0,{},[],void 0,t)):t=function(t){const e=t.id?"#"+t.id:"",n=t.getAttribute("class"),o=n?"."+n.split(" ").join("."):"";return Ue(r.tagName(t).toLowerCase()+e+o,{},[],void 0,t)}(t),Qe(t,e)?u(t,e,c):(s=t.elm,a=r.parentNode(s),i(e,c),null!==a&&(r.insertBefore(a,e.elm,r.nextSibling(s)),l(a,[t],0,0))),n=0;n<c.length;++n)c[n].data.hook.insert(c[n]);for(n=0;n<o.post.length;++n)o.post[n]();return e}}function rn(t,e){var n;const o=void 0!==e?e:Xe;let r;if(o.isElement(t)){const r=t.id?"#"+t.id:"",i=null===(n=t.getAttribute("class"))||void 0===n?void 0:n.match(/[^\t\r\n\f ]+/g),a=i?"."+i.join("."):"",c=o.tagName(t).toLowerCase()+r+a,l={},u={},d={},h=[];let p,f,m;const y=t.attributes,_=t.childNodes;for(f=0,m=y.length;f<m;f++)p=y[f].nodeName,p.startsWith("data-")?u[(s=p,s.slice(5).replace(/-([a-z])/g,((t,e)=>e.toUpperCase())))]=y[f].nodeValue||"":"id"!==p&&"class"!==p&&(l[p]=y[f].nodeValue);for(f=0,m=_.length;f<m;f++)h.push(rn(_[f],e));return Object.keys(l).length>0&&(d.attrs=l),Object.keys(u).length>0&&(d.dataset=u),!c.startsWith("svg")||3!==c.length&&"."!==c[3]&&"#"!==c[3]||He(d,h,c),Ue(c,d,h,void 0,t)}return o.isText(t)?(r=o.getTextContent(t),Ue(void 0,void 0,void 0,r,t)):o.isComment(t)?(r=o.getTextContent(t),Ue("!",{},[],r,t)):Ue("",{},[],void 0,t);var s}function sn(t,e){let n,o;const r=e.elm;let s=t.data.class,i=e.data.class;if((s||i)&&s!==i){for(o in s=s||{},i=i||{},s)s[o]&&!Object.prototype.hasOwnProperty.call(i,o)&&r.classList.remove(o);for(o in i)n=i[o],n!==s[o]&&r.classList[n?"add":"remove"](o)}}const an={create:sn,update:sn};function cn(t,e){let n,o,r;const s=e.elm;let i=t.data.props,a=e.data.props;if((i||a)&&i!==a)for(n in i=i||{},a=a||{},a)o=a[n],r=i[n],r===o||"value"===n&&s[n]===o||(s[n]=o)}const ln={create:cn,update:cn};function un(t,e){let n;const o=e.elm;let r=t.data.attrs,s=e.data.attrs;if((r||s)&&r!==s){for(n in r=r||{},s=s||{},s){const t=s[n];r[n]!==t&&(!0===t?o.setAttribute(n,""):!1===t?o.removeAttribute(n):120!==n.charCodeAt(0)?o.setAttribute(n,t):58===n.charCodeAt(3)?o.setAttributeNS("http://www.w3.org/XML/1998/namespace",n,t):58===n.charCodeAt(5)?109===n.charCodeAt(1)?o.setAttributeNS("http://www.w3.org/2000/xmlns/",n,t):o.setAttributeNS("http://www.w3.org/1999/xlink",n,t):o.setAttribute(n,t))}for(n in r)n in s||o.removeAttribute(n)}}const dn={create:un,update:un},hn=/[A-Z]/g;function pn(t,e){const n=e.elm;let o,r=t.data.dataset,s=e.data.dataset;if(!r&&!s)return;if(r===s)return;r=r||{},s=s||{};const i=n.dataset;for(o in r)o in s||(i?o in i&&delete i[o]:n.removeAttribute("data-"+o.replace(hn,"-$&").toLowerCase()));for(o in s)r[o]!==s[o]&&(i?i[o]=s[o]:n.setAttribute("data-"+o.replace(hn,"-$&").toLowerCase(),s[o]))}const fn={create:pn,update:pn};function mn(t,e){e.elm=t.elm,t.data.fn=e.data.fn,t.data.args=e.data.args,t.data.isolate=e.data.isolate,e.data=t.data,e.children=t.children,e.text=t.text,e.elm=t.elm}function yn(t){const e=t.data;mn(e.fn.apply(void 0,e.args),t)}function _n(t,e){const n=t.data,o=e.data;let r;const s=n.args,i=o.args;for(n.fn===o.fn&&s.length===i.length||mn(o.fn.apply(void 0,i),e),r=0;r<i.length;++r)if(s[r]!==i[r])return void mn(o.fn.apply(void 0,i),e);mn(t,e)}function vn(t,e,n=!1,o=!1,r=!1){let s=null;return re.create({start:function(i){s=o?function(t){Sn(t,o),i.next(t)}:function(t){i.next(t)},t.addEventListener(e,s,{capture:n,passive:r})},stop:function(){t.removeEventListener(e,s,n),s=null}})}function gn(t,e){const n=Object.keys(t),o=n.length;for(let r=0;r<o;r++){const o=n[r];if("object"==typeof t[o]&&null!==t[o]&&"object"==typeof e[o]&&null!==e[o]){if(!gn(t[o],e[o]))return!1}else if(t[o]!==e[o])return!1}return!0}function Sn(t,e){if(e)if("boolean"==typeof e)t.preventDefault();else if("function"==typeof e)e(t)&&t.preventDefault();else{if("object"!=typeof e)throw new Error("preventDefault has to be either a boolean, predicate function or object");gn(e,t)&&t.preventDefault()}}function bn(t){return t.value=function(e){return bn(t.map((t=>{const n=t?.target?.value;return e?e(n):n})))},t.checked=function(e){return bn(t.map((t=>{const n=!!t?.target?.checked;return e?e(n):n})))},t.data=function(e,n){const o=String(e).replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),r=`[data-${o.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}]`;return bn(t.map((t=>{const e=t?.target,s="function"==typeof e?.closest&&e.closest(r)||e,i=s?.dataset?.[o];return n?n(i):i})))},t.target=function(e){return bn(t.map((t=>{const n=t?.target;return e?e(n):n})))},t.key=function(e){return bn(t.map((t=>{const n=t?.key;return e?e(n):n})))},t}class wn{constructor(t,e){this._name=t,this._selector=e||null}select(t){return new wn(this._name,t)}elements(){if(this._selector){const t=ue(ce.of(Array.from(document.querySelectorAll(this._selector))));return t._isCycleSource=this._name,t}const t=ue(ce.of([document]));return t._isCycleSource=this._name,t}element(){if(this._selector){const t=ue(ce.of(document.querySelector(this._selector)));return t._isCycleSource=this._name,t}const t=ue(ce.of(document));return t._isCycleSource=this._name,t}events(t,e={},n){let o;if(o=vn(document,t,e.useCapture,e.preventDefault),this._selector){const t=this._selector;o=o.filter((e=>{const n=e.target;return n instanceof Element&&(n.matches(t)||null!==n.closest(t))}))}const r=bn(ue(o));return r._isCycleSource=this._name,r}}class An{constructor(t){this._name=t}select(t){return this}elements(){const t=ue(ce.of([document.body]));return t._isCycleSource=this._name,t}element(){const t=ue(ce.of(document.body));return t._isCycleSource=this._name,t}events(t,e={},n){let o;o=vn(document.body,t,e.useCapture,e.preventDefault);const r=ue(o);return r._isCycleSource=this._name,r}}function En(t){return t.length>1&&("."===t[0]||"#"===t[0])}function Nn(t){if("string"!=typeof t&&(e=t,!("object"==typeof HTMLElement?e instanceof HTMLElement||e instanceof DocumentFragment:e&&"object"==typeof e&&null!==e&&(1===e.nodeType||11===e.nodeType)&&"string"==typeof e.nodeName)))throw new Error("Given container is not a DOM element neither a selector string.");var e}function On(t){let e="";for(let n=t.length-1;n>=0&&"selector"===t[n].type;n--)e=t[n].scope+" "+e;return e.trim()}function Cn(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n].type!==e[n].type||t[n].scope!==e[n].scope)return!1;return!0}class Tn{constructor(t,e){this.namespace=t,this.isolateModule=e,this._namespace=t.filter((t=>"selector"!==t.type))}isDirectlyInScope(t){const e=this.isolateModule.getNamespace(t);if(!e)return!1;if(this._namespace.length>e.length||!Cn(this._namespace,e.slice(0,this._namespace.length)))return!1;for(let t=this._namespace.length;t<e.length;t++)if("total"===e[t].type)return!1;return!0}}class kn{constructor(t,e){this.namespace=t,this.isolateModule=e}call(){const t=this.namespace,e=On(t),n=new Tn(t,this.isolateModule),o=this.isolateModule.getElement(t.filter((t=>"selector"!==t.type)));return void 0===o?[]:""===e?[o]:(r=o.querySelectorAll(e),Array.prototype.slice.call(r)).filter(n.isDirectlyInScope,n).concat(o.matches(e)?[o]:[]);var r}}function $n(t){return{type:En(t)?"sibling":"total",scope:t}}const xn="https://sygnal.js.org",Ln={SYG101:"warn",SYG102:"info",SYG103:"info",SYG104:"warn",SYG105:"info",SYG106:"warn",SYG110:"warn",SYG111:"warn",SYG201:"warn",SYG202:"warn",SYG301:"error",SYG401:"warn",SYG900:"warn",SYG206:"error",SYG207:"warn",SYG208:"warn",SYG209:"error",SYG210:"warn",SYG211:"error",SYG212:"error",SYG213:"warn",SYG214:"error",SYG215:"error",SYG216:"error",SYG217:"warn",SYG218:"error",SYG219:"warn",SYG220:"warn",SYG402:"error",SYG403:"error",SYG404:"error",SYG405:"warn",SYG406:"error",SYG407:"error",SYG408:"error",SYG409:"warn",SYG410:"error",SYG411:"error",SYG412:"error",SYG413:"error",SYG414:"error",SYG415:"error",SYG416:"error",SYG417:"warn",SYG418:"error",SYG419:"error",SYG420:"error",SYG601:"error",SYG602:"error",SYG603:"error",SYG604:"error",SYG605:"error",SYG606:"error",SYG607:"error",SYG901:"error",SYG902:"error",SYG903:"error"};function Dn(t){return`${xn}/reference/errors#${t.toLowerCase()}`}class Gn extends Error{constructor(t){super(t.text),this.diagnostic=t}}let jn,In="off",Mn=!1,Pn=new Set,Yn=[],Rn=[],Fn=[];function Bn(){return In=jn||(!0===globalThis.__SYGNAL_DEV__?"warn":"off"),Mn="off"!==In,In}function Un(t={}){"mode"in t&&(jn=t.mode),t.ignore&&(Pn=new Set(t.ignore)),Bn()}function Vn(){return In}const Wn=t=>(t&&"object"==typeof t?t.name:t)||void 0,Hn=t=>/[.!?]$/.test(t)?t:t+".";function zn(t,e){const n=Wn(e.component);return`[Sygnal ${t}] ${n?n+": ":""}${Hn(e.message)}`+(e.fix?" "+Hn(e.fix):"")+" "+Dn(t)}function qn(t,e){if(!Mn||Pn.has(t))return;const n=e.severity||Ln[t]||"warn",o={code:t,severity:n,component:Wn(e.component),message:e.message,fix:e.fix,data:e.data,docsUrl:Dn(t),get text(){return zn(t,this)},timestamp:Date.now()};if(Yn.push(o)>500&&Yn.shift(),Rn.forEach((t=>{try{t(o)}catch(t){}})),"info"!==n){if("error"===In)throw new Gn(o);"warn"===In&&console[n](o.text)}return o}function Jn(){return Yn.slice()}function Zn(t){return Rn=[...Rn,t],()=>{Rn=Rn.filter((e=>e!==t))}}function Xn(t){return Fn=[...Fn,t],()=>{Fn=Fn.filter((e=>e!==t))}}let Kn=t=>{const e=()=>{throw t};"function"==typeof queueMicrotask?queueMicrotask(e):setTimeout(e)};const Qn=t=>(e,...n)=>{if(Mn)for(const o of Fn)try{o[t]?.(e,...n)}catch(n){try{if(n instanceof Gn)throw n;qn("SYG900",{component:e,message:`Diagnostics check '${o.id}' threw in ${t}: ${n?.message}`,data:{check:o.id,hook:t,error:n}})}catch(t){Kn(t)}}},to=Qn("onIntent"),eo=Qn("onModel"),no=Qn("onRender"),oo=Qn("onReducer"),ro=Qn("onDispose"),so=Qn("onSelector"),io=Qn("onBusEmit"),ao=Qn("onBusSelect");globalThis.__SYGNAL_DIAGNOSTICS__={registerCheck:Xn,report:qn},Bn();class co{constructor(t,e,n=[],o,r,s){var i;this._rootElement$=t,this._sanitation$=e,this._namespace=n,this._isolateModule=o,this._eventDelegator=r,this._name=s,this.isolateSource=(t,e)=>new co(t._rootElement$,t._sanitation$,t._namespace.concat($n(e)),t._isolateModule,t._eventDelegator,t._name),this.isolateSink=(i=this._namespace,(t,e)=>":root"===e?t:t.map((t=>{if(!t)return t;const n=$n(e),o={...t,data:{...t.data,isolate:t.data&&Array.isArray(t.data.isolate)?t.data.isolate:i.concat([n])}};return{...o,key:void 0!==o.key?o.key:JSON.stringify(o.data.isolate)}})))}_elements(){if(0===this._namespace.length)return this._rootElement$.map((t=>[t]));{const t=new kn(this._namespace,this._isolateModule);return this._rootElement$.map((()=>t.call()))}}elements(){const t=ue(this._elements().remember());return t._isCycleSource=this._name,t}element(){const t=ue(this._elements().filter((t=>t.length>0)).map((t=>t[0])).remember());return t._isCycleSource=this._name,t}get namespace(){return this._namespace}select(t){if("string"!=typeof t)throw new Error("DOM driver's select() expects the argument to be a string as a CSS selector");if("document"===t)return new wn(this._name);if("body"===t)return new An(this._name);":root"!==t&&so(this,t.trim());const e=":root"===t?[]:this._namespace.concat({type:"selector",scope:t.trim()});return new co(this._rootElement$,this._sanitation$,e,this._isolateModule,this._eventDelegator,this._name)}events(t,e={},n){if("string"!=typeof t)throw new Error("DOM driver's events() expects argument to be a string representing the event type to listen for.");const o=bn(ue(this._eventDelegator.addEventListener(t,this._namespace,e,n)));return o._isCycleSource=this._name,o}dispose(){this._sanitation$.shamefullySendNext(null)}}function lo(t){if(!t.sel)return{tagName:"",id:"",className:""};const e=t.sel,n=e.indexOf("#"),o=e.indexOf(".",n),r=n>0?n:e.length,s=o>0?o:e.length;return{tagName:-1!==n||-1!==o?e.slice(0,Math.min(r,s)):e,id:r<s?e.slice(r+1,s):void 0,className:o>0?e.slice(s+1).replace(/\./g," "):void 0}}class uo{constructor(t){this.rootElement=t}call(t){if(11===this.rootElement.nodeType)return this.wrapDocFrag(null===t?[]:[t]);if(null===t)return this.wrap([]);const{tagName:e,id:n}=lo(t),o=function(t){let{className:e=""}=lo(t);if(!t.data)return e;const{class:n,props:o}=t.data;n&&(e+=` ${Object.keys(n).filter((t=>n[t])).join(" ")}`);return o&&o.className&&(e+=` ${o.className}`),e&&e.trim()}(t),r=(t.data||{}).props||{},{id:s=n}=r;return"string"==typeof s&&s.toUpperCase()===this.rootElement.id.toUpperCase()&&e.toUpperCase()===this.rootElement.tagName.toUpperCase()&&o.toUpperCase()===this.rootElement.className.toUpperCase()?t:this.wrap([t])}wrapDocFrag(t){return Ue("",{isolate:[]},t,void 0,this.rootElement)}wrap(t){const{tagName:e,id:n,className:o}=this.rootElement,r=n?`#${n}`:"",s=o?`.${o.split(" ").join(".")}`:"",i=ze(`${e.toLowerCase()}${r}${s}`,{},t);return i.data=i.data||{},i.data.isolate=i.data.isolate||[],i}}const ho="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||setTimeout,po=t=>{ho((()=>{ho(t)}))};let fo=!1;function mo(t,e,n){po((()=>{t[e]=n}))}function yo(t,e){let n,o;const r=e.elm;let s=t.data.style,i=e.data.style;if(!s&&!i)return;if(s===i)return;s=s||{},i=i||{};const a="delayed"in s;for(o in s)o in i||("-"===o[0]&&"-"===o[1]?r.style.removeProperty(o):r.style[o]="");for(o in i)if(n=i[o],"delayed"===o&&i.delayed)for(const t in i.delayed)n=i.delayed[t],a&&n===s.delayed[t]||mo(r.style,t,n);else"remove"!==o&&n!==s[o]&&("-"===o[0]&&"-"===o[1]?r.style.setProperty(o,n):r.style[o]=n)}const _o={pre:function(){fo=!1},create:yo,update:yo,destroy:function(t){let e,n;const o=t.elm,r=t.data.style;if(r&&(e=r.destroy))for(n in e)o.style[n]=e[n]},remove:function(t,e){const n=t.data.style;if(!n||!n.remove)return void e();let o;fo||(t.elm.offsetLeft,fo=!0);const r=t.elm;let s=0;const i=n.remove;let a=0;const c=[];for(o in i)c.push(o),r.style[o]=i[o];const l=getComputedStyle(r)["transition-property"].split(", ");for(;s<l.length;++s)-1!==c.indexOf(l[s])&&a++;r.addEventListener("transitionend",(t=>{t.target===r&&--a,0===a&&e()}))}};let vo=[];const go={create:function(t,e){const n=e.elm;n&&"SELECT"===n.tagName&&void 0!==e.data?.props?.value&&vo.push({elm:n,value:e.data.props.value})},post:function(){for(let t=0;t<vo.length;t++){const{elm:e,value:n}=vo[t];e.value=n}vo=[]}};const So={update:function(t,e){const n=e.data?.props,o=e.elm;if(!n||!o||!/^(INPUT|TEXTAREA|SELECT)$/.test(o.tagName)||"file"==o.type)return;const r=t.data?.props||{},{value:s,checked:i}=n;s===r.value&&null!=s&&o.value!==String(s)&&(o.value=String(s)),i===r.checked&&null!=i&&o.checked!==!!i&&(o.checked=!!i)}};function bo(t){const e=[],n=t.data?.class;if(n&&"object"==typeof n)for(const t in n)n[t]&&e.push(t);return e}function wo(t){const e=t.sel||"",n=e.indexOf("#"),o=e.indexOf(".",n);return(o>0?e.slice(o+1).split("."):[]).concat(bo(t))}function Ao(t,e){for(const n of e)n&&t.classList.add(n)}const Eo=t=>null!=t&&!1!==t;function No(t,e){const n=e.elm;if(!n||!n.classList)return;const o=e.data?.props,r=t.data?.props,s=!!o&&"className"in o,i=s?o.className:void 0;if(Eo(i))return void(r&&r.className===i||Ao(n,bo(e)));if(s)return void(r&&r.className===i||(n.className=wo(e).join(" "),""===n.className&&n.removeAttribute("class")));const a=r?r.className:void 0;if(!Eo(a))return;const c=wo(e);for(const t of(t=>"string"==typeof t?t.split(/\s+/).filter(Boolean):[])(a))-1===c.indexOf(t)&&n.classList.remove(t);Ao(n,c),""===n.getAttribute("class")&&n.removeAttribute("class")}const Oo={create:(t,e)=>No(t,e),update:No},Co=[_o,an,ln,Oo,dn,fn,go,So];class To{constructor(t){this.mapper=t,this.tree=[void 0,{}]}set(t,e,n){let o=this.tree;const r=void 0!==n?n:t.length;for(let e=0;e<r;e++){const n=this.mapper(t[e]);let r=o[1][n];r||(r=[void 0,{}],o[1][n]=r),o=r}o[0]=e}getDefault(t,e,n){return this.get(t,e,n)}get(t,e,n){let o=this.tree;const r=void 0!==n?n:t.length;for(let n=0;n<r;n++){const r=this.mapper(t[n]);let s=o[1][r];if(!s){if(!e)return;s=[void 0,{}],o[1][r]=s}o=s}return e&&!o[0]&&(o[0]=e()),o[0]}delete(t){let e=this.tree;for(let n=0;n<t.length-1;n++){const o=e[1][this.mapper(t[n])];if(!o)return;e=o}delete e[1][this.mapper(t[t.length-1])]}}class ko{constructor(){this.namespaceTree=new To((t=>t.scope)),this.namespaceByElement=new Map,this.vnodesBeingRemoved=[]}setEventDelegator(t){this.eventDelegator=t}insertElement(t,e){this.namespaceByElement.set(e,t),this.namespaceTree.set(t,e)}removeElement(t){this.namespaceByElement.delete(t);const e=this.getNamespace(t);e&&this.namespaceTree.delete(e)}getElement(t,e){return this.namespaceTree.get(t,void 0,e)}getRootElement(t){if(this.namespaceByElement.has(t))return t;let e=t;for(;!this.namespaceByElement.has(e);){if(e=e.parentNode,!e)return;if("HTML"===e.tagName)throw new Error("No root element found, this should not happen at all")}return e}getNamespace(t){const e=this.getRootElement(t);if(e)return this.namespaceByElement.get(e)}createModule(){const t=this;return{create(e,n){const{elm:o,data:r={}}=n,s=r.isolate;Array.isArray(s)&&t.insertElement(s,o)},update(e,n){const{elm:o,data:r={}}=e,{elm:s,data:i={}}=n,a=r.isolate,c=i.isolate;Cn(a,c)||Array.isArray(a)&&t.removeElement(o),Array.isArray(c)&&t.insertElement(c,s)},destroy(e){t.vnodesBeingRemoved.push(e)},remove(e,n){t.vnodesBeingRemoved.push(e),n()},post(){const e=t.vnodesBeingRemoved;for(let n=e.length-1;n>=0;n--){const o=e[n],r=void 0!==o.data?o.data.isolation:void 0;void 0!==r&&t.removeElement(r),t.eventDelegator.removeElement(o.elm,r)}t.vnodesBeingRemoved=[]}}}}class $o{constructor(){this.arr=[],this.prios=[]}add(t,e){for(let n=0;n<this.arr.length;n++)if(this.prios[n]<e)return this.arr.splice(n,0,t),void this.prios.splice(n,0,e);this.arr.push(t),this.prios.push(e)}forEach(t){for(let e=0;e<this.arr.length;e++)t(this.arr[e],e,this.arr)}delete(t){for(let e=0;e<this.arr.length;e++)if(this.arr[e]===t)return this.arr.splice(e,1),void this.prios.splice(e,1)}}const xo=["blur","focus","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture","canplay","canplaythrough","durationchange","emptied","ended","loadeddata","loadedmetadata","pause","play","playing","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","load","unload","invalid","reset","submit","formdata","toggle","animationstart","animationend","animationiteration","transitionrun","transitionstart","transitionend","scroll","scrollend"];class Lo{constructor(t,e){this.rootElement$=t,this.isolateModule=e,this.virtualListeners=new To((t=>t.scope)),this.nonBubblingListenersToAdd=new Set,this.virtualNonBubblingListener=[],this.isolateModule.setEventDelegator(this),this.domListeners=new Map,this.domListenersToAdd=new Map,this.nonBubblingListeners=new Map,t.addListener({next:t=>{this.origin!==t&&(this.origin=t,this.resetEventListeners(),this.domListenersToAdd.forEach(((t,e)=>this.setupDOMListener(e,t))),this.domListenersToAdd.clear()),this.nonBubblingListenersToAdd.forEach((t=>{this.setupNonBubblingListener(t)}))}})}addEventListener(t,e,n,o){const r=ce.never();let s;const i=new Tn(e,this.isolateModule);if(void 0===o?-1===xo.indexOf(t):o)return this.domListeners.has(t)||this.setupDOMListener(t,!!n.passive),s=this.insertListener(r,i,t,n),r;{const o=[];this.nonBubblingListenersToAdd.forEach((t=>o.push(t)));let a,c=0;const l=o.length,u=n=>{const[o,r,s,i]=n;return t===r&&Cn(s.namespace,e)};for(;!a&&c<l;){const t=o[c];a=u(t)?t:a,c++}let d,h=a;if(h){const[t]=h;d=t}else{const o=new kn(e,this.isolateModule);s=this.insertListener(r,i,t,n),h=[r,t,o,s],d=r,this.nonBubblingListenersToAdd.add(h),this.setupNonBubblingListener(h)}const p=this;let f=null;return ce.create({start:t=>{f=d.subscribe(t)},stop:()=>{const[t,e,n,o]=h;n.call().forEach((function(t){const n=t.subs;n&&n[e]&&(n[e].unsubscribe(),delete n[e])})),p.nonBubblingListenersToAdd.delete(h),f.unsubscribe()}})}}removeElement(t,e){void 0!==e&&this.virtualListeners.delete(e);const n=[];this.nonBubblingListeners.forEach(((e,o)=>{if(e.has(t)){n.push([o,t]);const e=t.subs;e&&Object.keys(e).forEach((t=>{e[t].unsubscribe()}))}}));for(let t=0;t<n.length;t++){const e=this.nonBubblingListeners.get(n[t][0]);e&&(e.delete(n[t][1]),0===e.size?this.nonBubblingListeners.delete(n[t][0]):this.nonBubblingListeners.set(n[t][0],e))}}insertListener(t,e,n,o){const r=[],s=e._namespace;let i=s.length;do{r.push(this.getVirtualListeners(n,s,!0,i)),i--}while(i>=0&&"total"!==s[i].type);const a={...o,scopeChecker:e,subject:t,bubbles:!!o.bubbles,useCapture:!!o.useCapture,passive:!!o.passive};for(let t=0;t<r.length;t++)r[t].add(a,s.length);return a}getVirtualListeners(t,e,n=!1,o){let r=void 0!==o?o:e.length;if(!n)for(let t=r-1;t>=0;t--){if("total"===e[t].type){r=t+1;break}r=t}const s=this.virtualListeners.getDefault(e,(()=>new Map),r);return s.has(t)||s.set(t,new $o),s.get(t)}setupDOMListener(t,e){if(this.origin){const n=vn(this.origin,t,!1,!1,e).subscribe({next:n=>this.onEvent(t,n,e),error:()=>{},complete:()=>{}});this.domListeners.set(t,{sub:n,passive:e})}else this.domListenersToAdd.set(t,e)}setupNonBubblingListener(t){const[e,n,o,r]=t;if(!this.origin)return;const s=o.call();if(s.length){const t=this;s.forEach((e=>{const o=e.subs;if(!o||!o[n]){const s=vn(e,n,!1,!1,r.passive).subscribe({next:e=>t.onEvent(n,e,!!r.passive,!1),error:()=>{},complete:()=>{}});t.nonBubblingListeners.has(n)||t.nonBubblingListeners.set(n,new Map);const i=t.nonBubblingListeners.get(n);if(!i)return;i.set(e,{sub:s,destination:r}),e.subs={...o,[n]:s}}}))}}resetEventListeners(){const t=this.domListeners.entries();let e=t.next();for(;!e.done;){const[n,{sub:o,passive:r}]=e.value;o.unsubscribe(),this.setupDOMListener(n,r),e=t.next()}}putNonBubblingListener(t,e,n,o){const r=this.nonBubblingListeners.get(t);if(!r)return;const s=r.get(e);s&&s.destination.passive===o&&s.destination.useCapture===n&&(this.virtualNonBubblingListener[0]=s.destination)}onEvent(t,e,n,o=!0){const r=this.patchEvent(e),s=this.isolateModule.getRootElement(e.target);if(o){const o=this.isolateModule.getNamespace(e.target);if(!o)return;const i=this.getVirtualListeners(t,o);this.bubble(t,e.target,s,r,i,o,o.length-1,!0,n),this.bubble(t,e.target,s,r,i,o,o.length-1,!1,n)}else this.putNonBubblingListener(t,e.target,!0,n),this.doBubbleStep(t,e.target,s,r,this.virtualNonBubblingListener,!0,n),this.putNonBubblingListener(t,e.target,!1,n),this.doBubbleStep(t,e.target,s,r,this.virtualNonBubblingListener,!1,n),e.stopPropagation()}bubble(t,e,n,o,r,s,i,a,c){a||o.propagationHasBeenStopped||this.doBubbleStep(t,e,n,o,r,a,c);let l=n,u=i;if(e===n){if(!(i>=0&&"sibling"===s[i].type))return;l=this.isolateModule.getElement(s,i),u--}e.parentNode&&l&&this.bubble(t,e.parentNode,l,o,r,s,u,a,c),a&&!o.propagationHasBeenStopped&&this.doBubbleStep(t,e,n,o,r,a,c)}doBubbleStep(t,e,n,o,r,s,i){n&&(this.mutateEventCurrentTarget(o,e),r.forEach((t=>{if(t.passive===i&&t.useCapture===s){const r=On(t.scopeChecker.namespace);!o.propagationHasBeenStopped&&t.scopeChecker.isDirectlyInScope(e)&&(""!==r&&e.matches(r)||""===r&&e===n)&&(Sn(o,t.preventDefault),t.subject.shamefullySendNext(o))}})))}patchEvent(t){const e=t;e.propagationHasBeenStopped=!1;const n=e.stopPropagation;return e.stopPropagation=function(){n.call(this),this.propagationHasBeenStopped=!0},e}mutateEventCurrentTarget(t,e){try{Object.defineProperty(t,"currentTarget",{value:e,configurable:!0})}catch(t){}t.ownerTarget=e}}function Do(t){return ce.merge(t,ce.never())}function Go(t){return t.elm}function jo(t){(console.error||console.log)(t)}function Io(t,e={}){Nn(t);const n=e.modules||Co;!function(t){if(!Array.isArray(t))throw new Error("Optional modules option must be an array for snabbdom modules")}(n);const o=new ko,r=e&&e.snabbdomOptions||void 0,s=on([o.createModule()].concat(n),void 0,r),i=ce.create({start(t){"loading"===document.readyState?document.addEventListener("readystatechange",(()=>{const e=document.readyState;"interactive"!==e&&"complete"!==e||(t.next(null),t.complete())})):(t.next(null),t.complete())},stop(){}});let a,c;const l=ce.create({start(t){c=new MutationObserver((()=>t.next(null)))},stop(){c.disconnect()}});return function(n,r="DOM"){!function(t){if(!t||"function"!=typeof t.addListener||"function"!=typeof t.fold)throw new Error("The DOM driver function expects as input a Stream of virtual DOM elements")}(n);const u=ce.create(),d=i.map((()=>{const e=function(t){const e="string"==typeof t?document.querySelector(t):t;if("string"==typeof t&&null===e)throw new Error(`Cannot render into unknown element \`${t}\``);return e}(t)||document.body;return a=new uo(e),e})),h=n.remember();h.addListener({}),l.addListener({});const p=d.map((t=>ce.merge(h.endWhen(u),u).map((t=>a.call(t))).startWith(function(t){return t.data=t.data||{},t.data.isolate=[],t}(rn(t))).fold(s,rn(t)).drop(1).map(Go).startWith(t).map((t=>(c.observe(t,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),t))).compose(Do))).flatten(),f=me(i,l).endWhen(u).compose(Te(p)).map((t=>t[1])).remember();f.addListener({error:e.reportSnabbdomError||jo});const m=new Lo(f,o);return new co(f,u,[],o,m,r)}}const Mo="___";class Po{constructor(t,e,n=[],o){this._mockConfig=t,this._hub=e,this._path=n,this._onEvents=o,t.elements?this._elements=t.elements:this._elements=ue(ce.empty())}elements(){const t=this._elements;return t._isCycleSource="MockedDOM",t}element(){const t=ue(this.elements().filter((t=>t.length>0)).map((t=>t[0])).remember());return t._isCycleSource="MockedDOM",t}events(t,e,n){const o=this._mockConfig[t],{_hub:r,_path:s,_onEvents:i}=this;let a;if(i&&i(s,t),r){const e=r.filter((e=>e.type===t&&e.match(s))).map((t=>t.event));let n;a=i?ce.create({start:o=>{e.addListener(n={next:t=>o.next(t),error:t=>o.error(t),complete:()=>o.complete()}),i(s,t,!0)},stop:()=>{e.removeListener(n),i(s,t,!1)}}):e}const c=bn(ue(a?ce.merge(o?ce.fromObservable(o):ce.empty(),a):o||ce.empty()));return c._isCycleSource="MockedDOM",c}select(t){const e=this._mockConfig[t]||{};return new Po(e,this._hub,this._path.concat(t),this._onEvents)}isolateSource(t,e){return t.select("."+Mo+e)}isolateSink(t,e){return ue(ce.fromObservable(t).map((t=>t?(t.sel&&-1!==t.sel.indexOf(Mo+e)||(t.sel+=`.${Mo}${e}`),t):t)))}}function Yo(t,e,n){return new Po(t,e,[],n)}const Ro=t=>(e,n,o,r,...s)=>{const i={component:n,message:o,fix:r,severity:t,data:s[0]},a=Vn();if("off"!==a)try{const n=qn(e,i);n&&"collect"===a&&"error"===t?console.error(n.text,...s):n&&"warn"===a&&s.length&&console[t](...s)}catch(t){setTimeout((()=>{throw t}))}else console[t](zn(e,i),...s)},Fo=Ro("warn"),Bo=Ro("error");function Uo(t,e,n,o){const r=new Error(zn(t,{component:e,message:n,fix:o}));throw r.code=t,r}let Vo=0;function Wo(t,e,n={}){"function"!=typeof t&&Uo("SYG411","collection","first argument (component) must be a function","Pass a component function");const{combineList:o=["DOM"],globalList:r=["EVENTS"],stateSourceName:s="STATE",domSourceName:i="DOM",container:a="div",containerClass:c}=n;return n=>{const l="sygnal-collection-"+Vo++,u={item:t,itemKey:(t,e)=>void 0!==t.id?t.id:e,itemScope:t=>`${l}-${t}`,channel:s,collectSinks:t=>Object.entries(n).reduce(((e,[n])=>{if(o.includes(n)){const o=t.pickCombine(n);n===i&&a?e[i]=o.map((t=>({sel:a,data:c?{props:{className:c}}:{},children:t,key:l,text:void 0,elm:void 0}))):e[n]=o}else e[n]=t.pickMerge(n);return e}),{})},d={[s]:e};return r.forEach((t=>d[t]=null)),o.forEach((t=>d[t]=null)),function(t,e,n){return pe(function(t){return function(e){const n=t.channel||"state",o=t.itemKey,r=t.itemScope||Ye,s=ce.fromObservable(e[n].stream),i=new Map;let a=!1;const c=s.fold(((s,c)=>{if(a)return s;if(Array.isArray(c)){const s=Array(c.length),a=new Set;for(let l=0,u=c.length;l<u;++l){const u=`${o?o(c[l],l):l}`;if(a.add(u),i.has(u))s[l]=i.get(u);else{const a=o?Re(o,u):`${l}`,d=r(u),h="string"==typeof d?{"*":d,[n]:a}:{...d,[n]:a},p=pe(t.itemFactory?t.itemFactory(c[l],l):t.item,h)(e);i.set(u,p),s[l]=p}s[l]._key=u}return i.forEach(((t,e)=>{a.has(e)||(t&&"function"==typeof t.__dispose&&t.__dispose(),i.delete(e))})),a.clear(),{dict:i,arr:s}}{i.forEach((t=>{t&&"function"==typeof t.__dispose&&t.__dispose()})),i.clear();const s=`${o?o(c,0):"this"}`,a=Fe,l=r(s),u="string"==typeof l?{"*":l,[n]:a}:{...l,[n]:a},d=pe(t.itemFactory?t.itemFactory(c,0):t.item,u)(e);return i.set(s,d),{dict:i,arr:[d]}}}),{dict:i,arr:[]}),l=t.collectSinks(new Pe(c));return l.__dispose=()=>{a=!0,i.forEach((t=>t.__dispose?.())),i.clear()},l}}(t),e)(n)}(u,d,n)}}const Ho=t=>{const{children:e,...n}=t;return ze("collection",{props:n},e)};Ho.label="collection",Ho.preventInstantiation=!0;const zo=function(t){const e=function(t){return t&&t.default&&t.default.default&&"function"==typeof t.default.default?t.default.default:t&&t.default?t.default:t}(t);return e&&e.default&&"function"==typeof e.default.create?e.default:e}(le),qo=re||ce&&ce.Stream||zo&&zo.Stream,Jo="Pass a stream, a state key string, or a state => name function";function Zo(t,e,n,o={}){const{switched:r=["DOM"],stateSourceName:s="STATE"}=o,i=typeof e;if(e||Uo("SYG419","switchable","Missing 'name$' parameter",Jo),"string"===i||"function"===i||e instanceof qo||Uo("SYG419","switchable",`Invalid 'name$' parameter: got ${i}`,Jo),e instanceof qo){const o=e.compose(Ee()).startWith(n).remember();return e=>Xo(t,e,o,r)}{const o="function"===i&&e||(t=>t[e]);return e=>{const i=e&&("string"==typeof s&&e[s]||e.STATE||e.state).stream;i instanceof qo||Uo("SYG607","switchable",`State source '${s}' not found`,"Pass the state source in sources, or set stateSourceName");const a=i.map(o).filter((t=>"string"==typeof t)).compose(Ee()).startWith(n).remember();return Xo(t,e,a,r,s)}}}function Xo(t,e,n,o=["DOM"],r="STATE"){"string"==typeof o&&(o=[o]);const s=Object.entries(t).map((([t,o])=>{if(e[r]){const s=e[r].stream,i=zo.combine(n,s).filter((([e])=>e==t)).map((([,t])=>t)).remember(),a=new e[r].constructor(i,e[r]._name);return[t,o({...e,state:a})]}return[t,o(e)]})),i=Object.keys(e).reduce(((t,e)=>{if(o.includes(e))t[e]=n.map((t=>{const n=s.find((([e])=>e===t));return n&&n[1][e]||zo.never()})).flatten().remember().startWith(void 0);else{const n=s.filter((([,t])=>void 0!==t[e])).map((([,t])=>t[e]));t[e]=zo.merge(...n)}return t}),{});return i.__dispose=()=>s.forEach((([,t])=>t.__dispose?.())),i}const Ko=t=>{const{children:e,...n}=t;return ze("switchable",{props:n},e)};function Qo(t){return{select:e=>t._stream.filter((t=>t.type===e)).map((t=>t.data))}}Ko.label="switchable",Ko.preventInstantiation=!0;const tr="undefined"!=typeof window&&window||"undefined"!=typeof process&&process.env||{},er="BOOTSTRAP",nr="INITIALIZE",or="DISPOSE",rr="PARENT",sr="READY",ir="EFFECT",ar="See the attached error",cr=Symbol("sygnal.stateSnapshot");let lr=0,ur=0;const dr=Symbol.for("sygnal.ABORT");function hr(t){return t===dr||"symbol"==typeof t&&"sygnal.ABORT"===t.description}function pr(t,e){return"function"==typeof e?{fn:e,deps:null}:Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&"function"==typeof e[1]?{fn:e[1],deps:e[0]}:void Uo("SYG206",void 0,`Invalid calculated field '${t}'`,"Use fn or [deps, fn]")}function fr(t){const{name:e,sources:n,isolateOpts:o,stateSourceName:r="STATE"}=t;let s;n&&!Tr(n)&&Uo("SYG601",e,"Invalid sources","Pass sources from run()"),s="string"==typeof o?{[r]:o}:!0===o?{}:o;const i=void 0===n;let a;if(Tr(s)){const e=e=>{const n={...t,sources:e},o=new mr(n);return o.sinks.__dispose=()=>o.dispose(),o.sinks};a=i?pe(e,s):pe(e,s)(n)}else if(i)a=e=>{const n=new mr({...t,sources:e});return n.sinks.__dispose=()=>n.dispose(),n.sinks};else{const e=new mr(t);e.sinks.__dispose=()=>e.dispose(),a=e.sinks}return a.componentName=e,a.isSygnalComponent=!0,a}class mr{constructor({name:t="NO NAME",sources:e,intent:n,model:o,hmrActions:r,context:s,response:i,view:a,peers:c={},components:l={},initialState:u,calculated:d,storeCalculatedInState:h=!0,DOMSourceName:p="DOM",stateSourceName:f="STATE",requestSourceName:m="HTTP",isolatedState:y=!1,onError:_,debug:v=!1}){if(e&&Tr(e)||Uo("SYG601",t,"Missing or invalid sources","Pass sources from run()"),this._componentNumber=lr++,this.name=t,this.sources=e,this.intent=n,this.model=o,this.hmrActions=r,this.context=s,this.response=i,this.view=a,this.peers=c,this.components=l,this.initialState=u,this.calculated=d,this.storeCalculatedInState=h,this.DOMSourceName=p,this.stateSourceName=f,this.requestSourceName=m,this.sourceNames=Object.keys(e),this.onError=_,this.isolatedState=y,this._debug=v,this.calculated&&this.initialState&&Tr(this.calculated)&&Tr(this.initialState))for(const e of Object.keys(this.calculated))e in this.initialState&&Fo("SYG207",t,`Calculated field '${e}' overwrites the initialState key of the same name`,"Rename one of them");if(this.calculated&&Tr(this.calculated)){const e=Object.entries(this.calculated);this._calculatedNormalized={};for(const[t,n]of e)this._calculatedNormalized[t]=pr(t,n);this._calculatedFieldNames=new Set(Object.keys(this._calculatedNormalized));for(const[e,{deps:n}]of Object.entries(this._calculatedNormalized))if(null!==n)for(const o of n)this._calculatedFieldNames.has(o)||!this.initialState||o in this.initialState||Fo("SYG208",t,`Calculated field '${e}' depends on unknown key '${o}'`,"Add it to initialState");const n={};for(const[t,{deps:e}]of Object.entries(this._calculatedNormalized))n[t]=null===e?[]:e.filter((t=>this._calculatedFieldNames.has(t)));const o={},r={};for(const t of this._calculatedFieldNames)o[t]=0,r[t]=[];for(const[t,e]of Object.entries(n)){o[t]=e.length;for(const n of e)r[n].push(t)}const s=[];for(const[t,e]of Object.entries(o))0===e&&s.push(t);const i=[];for(;s.length>0;){const t=s.shift();i.push(t);for(const e of r[t])o[e]--,0===o[e]&&s.push(e)}if(i.length!==this._calculatedFieldNames.size){const e=[...this._calculatedFieldNames].filter((t=>!i.includes(t))),o=new Set,r=[],s=t=>{if(o.has(t))return r.push(t),!0;o.add(t),r.push(t);for(const o of n[t])if(e.includes(o)&&s(o))return!0;return r.pop(),o.delete(t),!1};s(e[0]);const a=r[r.length-1];Uo("SYG209",t,`Circular calculated dependency: ${r.slice(r.indexOf(a)).join(" → ")}`,"Break the cycle")}this._calculatedOrder=i.map((t=>[t,this._calculatedNormalized[t]])),this._calculatedFieldCache={};for(const[t,{deps:e}]of this._calculatedOrder)null!==e&&(this._calculatedFieldCache[t]={lastDepValues:void 0,lastResult:void 0})}else this._calculatedOrder=null,this._calculatedNormalized=null,this._calculatedFieldNames=null,this._calculatedFieldCache=null;this.isSubComponent=this.sourceNames.includes("props$");const g=e[f]&&e[f].stream;this.currentSlots={},g&&(this.currentState=u||{},this.sources[f]=new De(g.map((t=>(this.currentState=t,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onStateChanged(this._componentNumber,this.name,t),t))),f));const S=e.props$;S&&(this.sources.props$=S.map((t=>{const{sygnalFactory:e,sygnalOptions:n,...o}=t;return this.currentProps=o,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onPropsChanged(this._componentNumber,this.name,o),t})));const b=e.children$;var w;if(b&&(this._processedChildren$=b.map((t=>{if(Array.isArray(t)){const{slots:e,defaultChildren:n}=function(t){const e={},n=[];for(const o of t)if(o&&"slot"===o.sel){const t=o.data?.props?.name||"default";e[t]||(e[t]=[]);const n=Array.isArray(o.children)?o.children:o.children?[o.children]:[];e[t].push(...n)}else n.push(o);n.length>0&&(e.default||(e.default=[]),e.default.push(...n));return{slots:e,defaultChildren:e.default||[]}}(t);return this.currentSlots=e,this.currentChildren=n,{children:n,slots:e}}return this.currentSlots={},this.currentChildren=t,{children:t,slots:{}}})),this.sources.children$=this._processedChildren$.map((t=>t.children))),this.sources[p]&&(this.sources[p]=(w=this.sources[p],new Proxy(w,{get:(t,e,n)=>"symbol"==typeof e||e in t?Reflect.get(t,e,n):n=>t.select(n).events(e)}))),this.isSubComponent||void 0!==this.intent||void 0!==this.model||(this.initialState=u||!0,this.intent=t=>({__NOOP_ACTION__:zo.never()}),this.model={__NOOP_ACTION__:t=>t}),this._subscriptions=[],this._activeSubComponents=new Map,this._childReadyState={},this._readyChangedListener=null,this._readyChanged$=zo.create({start:t=>{this._readyChangedListener=t},stop:()=>{}}),this._disposeListener=null,this._dispose$=zo.create({start:t=>{this._disposeListener=t},stop:()=>{}}),this.sources.dispose$=this._dispose$,this.addCalculated=this.createMemoizedAddCalculated(),this.log=function(t){return function(e,n=!1){const o="function"==typeof e?e:t=>e;if(!n)return e=>e.debug((e=>{if(this.debug){const n=`[${t}] ${o(e)}`;console.log(n),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onDebugLog(this._componentNumber,n)}}));if(this.debug){const n=`[${t}] ${o(e)}`;console.log(n),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onDebugLog(this._componentNumber,n)}}}(`${this._componentNumber} | ${t}`),this.initChildSources$(),this.initIntent$(),this.initHmrActions(),this.initAction$(),this.initState(),this.initContext(),this.initModel$(),this.initPeers$(),this.initSubComponentSink$(),this.initSubComponentsRendered$(),this.initVdom$(),this.initSinks(),this.sinks.__index=this._componentNumber,this.log("Instantiated",!0),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__){window.__SYGNAL_DEVTOOLS__.onComponentCreated(this._componentNumber,t,this);const n=e?.__parentComponentNumber;"number"==typeof n&&window.__SYGNAL_DEVTOOLS__.onSubComponentRegistered(n,this._componentNumber)}}dispose(){if(this._disposed)return;this._disposed=!0,ro(this),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onComponentDisposed(this._componentNumber,this.name);if(this.model&&(this.model[or]||Object.keys(this.model).some((t=>t.includes("|")&&t.split("|")[0].trim()===or)))&&this.action$&&"function"==typeof this.action$.shamefullySendNext)try{this.action$.shamefullySendNext({type:or})}catch(t){}if(this._disposeListener){try{this._disposeListener.next(!0),this._disposeListener.complete()}catch(t){}this._disposeListener=null}this._activeSubComponents.forEach((t=>t?.sink$?.__dispose?.())),this._activeSubComponents.clear(),setTimeout((()=>{if(this.action$&&"function"==typeof this.action$.shamefullySendComplete)try{this.action$.shamefullySendComplete()}catch(t){}if(this.vdom$&&"function"==typeof this.vdom$.shamefullySendComplete)try{this.vdom$.shamefullySendComplete()}catch(t){}for(const t of this._subscriptions)if(t&&"function"==typeof t.unsubscribe)try{t.unsubscribe()}catch(t){}this._subscriptions=[]}),0)}get debug(){return this._debug||"true"===tr.SYGNAL_DEBUG||!0===tr.SYGNAL_DEBUG}initIntent$(){this.intent?("function"!=typeof this.intent&&Uo("SYG602",this,"intent must be a function","Use intent = sources => ({ ACTION: stream$ })"),this.intent$=this.intent(this.sources),this.intent$ instanceof qo||Tr(this.intent$)||Uo("SYG603",this,"intent must return a stream or an object of streams","Return { ACTION: stream$ }"),to(this,this.intent$ instanceof qo?[]:Object.keys(this.intent$),void 0)):to(this,[],void 0)}initHmrActions(){void 0!==this.hmrActions?("string"==typeof this.hmrActions&&(this.hmrActions=[this.hmrActions]),Array.isArray(this.hmrActions)&&!this.hmrActions.some((t=>"string"!=typeof t))||Uo("SYG604",this,"hmrActions must be an action name or an array of action names","Use hmrActions = ['ACTION']"),this.hmrAction$=zo.fromArray(this.hmrActions.map((t=>({type:t}))))):this.hmrAction$=zo.of().filter((t=>!1))}initAction$(){const t=this.sources&&this.sources[this.requestSourceName]||null;if(!this.intent$)return void(this.action$=zo.never());let e;if(this.intent$ instanceof qo)e=this.intent$;else{for(const t of Object.keys(this.intent$))t.includes("|")&&Uo("SYG605",this,`Intent action '${t}' contains '|', which is reserved for model shorthand`,"Rename the action");const t=Object.entries(this.intent$).map((([t,e])=>e.map((e=>({type:t,data:e})))));e=t.length>0?zo.merge(...t):zo.never()}const n=e instanceof qo?e:e.apply&&e(this.sources)||zo.never(),o=zo.of({type:er}).compose(be(10)),r="undefined"!=typeof window&&!0===window.__SYGNAL_HMR_UPDATING,s=r?this.hmrAction$:zo.of().filter((t=>!1)),i=this.model[er]&&!r?me(o,n):me(zo.of().compose(be(1)).filter((t=>!1)),s,n);let a;a=!r&&t&&"function"==typeof t.select?t.select("initial").flatten():zo.never();const c=a.map((t=>({type:"HYDRATE",data:t})));this.action$=zo.merge(i,c).compose(this.log((({type:t})=>`<${t}> Action triggered`))).map((t=>("undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onActionDispatched(this._componentNumber,this.name,t.type,t.data),t)))}initState(){void 0!==this.model&&(void 0===this.model[nr]?this.model[nr]={[this.stateSourceName]:(t,e)=>({...this.addCalculated(e)})}:Tr(this.model[nr])&&Object.keys(this.model[nr]).forEach((t=>{t!==this.stateSourceName&&(Fo("SYG210",this,`${nr} only supports the ${this.stateSourceName} sink; ignoring '${t}'`,"Use another action"),delete this.model[nr][t])})))}initContext(){if(!this.context&&!this.sources.__parentContext$)return void(this.context$=zo.of({}));const t=this.sources[this.stateSourceName]?.stream.startWith({}).compose(Ee(Or))||zo.never(),e=this.sources.__parentContext$?.startWith({}).compose(Ee(Or))||zo.of({});this.context&&!Tr(this.context)&&Bo("SYG402",this,`context must be an object, got ${typeof this.context}; ignoring it`,"Use context = { name: state => value }"),this.context$=zo.combine(t,e).map((([t,e])=>{const n=Tr(e)?e:{},o=Tr(this.context)?this.context:{},r=this.currentState,s={...n,...Object.entries(o).reduce(((t,e)=>{const[n,o]=e;let s;const i=typeof o;if("string"===i)s=r[o];else if("boolean"===i)s=r[n];else{if("function"!==i)return Bo("SYG403",this,`Invalid context entry '${n}'; skipping it`,"Use a state key or state => value"),t;s=o(r)}return t[n]=s,t}),{})};return this.currentContext=s,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onContextChanged(this._componentNumber,this.name,s),s})).compose(Ee(Or)).startWith({}),this._subscriptions.push(this.context$.subscribe({next:t=>t,error:t=>Bo("SYG404",this,"Context stream errored; context stops updating","Check the context functions",t)}))}initModel$(){if(void 0===this.model)return this.model$=this.sourceNames.reduce(((t,e)=>(t[e]=zo.never(),t)),{}),void eo(this,{});const t=tr?.__SYGNAL_HMR_STATE,e=void 0!==t?t:this.initialState,n={type:nr,data:e};this.isSubComponent&&this.initialState&&!this.isolatedState&&Fo("SYG405",this,"Sub-component initialState replaces the state its parent passes in","Remove initialState, or set isolatedState = true");const o=void 0!==e&&(!0!==tr?.__SYGNAL_HMR_UPDATING||void 0!==t)?zo.merge(zo.of(n).compose(be(0)),this.action$):this.action$;let r=null;const s=o.map((t=>{const e=r,n=()=>e.next({...t,[cr]:this.currentState});return e&&(ur?queueMicrotask(n):n()),t}));let i;const a=zo.create({start:t=>{r=t,i=s.subscribe({})},stop:()=>{r=null,i?.unsubscribe()}}),c=()=>this.makeOnAction(s,!0,this.action$),l=()=>this.makeOnAction(a,!1,this.action$),u=Object.entries(this.model),d={},h=new Set,p={};u.forEach((t=>{let[e,n]=t;if(e.includes("|")){const t=e.split("|").map((t=>t.trim()));2===t.length&&t[0]&&t[1]||Uo("SYG211",this,`Invalid shorthand model entry '${e}'`,"Use 'ACTION | SINK'"),e=t[0],n={[t[1]]:n}}"function"==typeof n&&(n={[this.stateSourceName]:n}),Tr(n)||Uo("SYG212",this,`Model entry '${e}' must be a function or an object`,"Use { STATE: reducer }");Object.entries(n).forEach((t=>{const[n,o]=t,r=`${e}::${n}`;if(h.has(r)&&Fo("SYG213",this,`Duplicate model entry for action '${e}' on sink '${n}'; both run`,"Remove the duplicate"),h.add(r),(p[e]||(p[e]=[])).push(n),n===ir){const t=this.makeEffectHandler(a,e,o,this.action$);return void(Array.isArray(d[n])?d[n].push(t):d[n]=[t])}const s=n===this.stateSourceName,i=n===rr,u=s?c():l(),f=(i?u(e,o).map((t=>({name:this.name,component:this.view,value:t}))):u(e,o)).compose(this.log((t=>{if(s)return`<${e}> State reducer added`;if(i)return`<${e}> Data sent to parent component: ${JSON.stringify(t.value).replaceAll('"',"")}`;{const o=t&&(t.type||t.command||t.name||t.key||Array.isArray(t)&&"Array"||t);return`<${e}> Data sent to [${n}]: ${JSON.stringify(o).replaceAll('"',"")}`}})));Array.isArray(d[n])?d[n].push(f):d[n]=[f]}))}));const f=Object.entries(d).reduce(((t,e)=>{const[n,o]=e;return t[n]=1===o.length?o[0]:zo.merge(...o),t}),{});this.model$=f,eo(this,p)}initPeers$(){const t=this.sourceNames.reduce(((t,e)=>(e==this.DOMSourceName?t[e]={}:t[e]=[],t)),{});this.peers$=Object.entries(this.peers).reduce(((t,[e,n])=>{const o=n(this.sources);return this.sourceNames.forEach((n=>{n==this.DOMSourceName?t[n][e]=o[n]:t[n].push(o[n])})),t}),t)}initChildSources$(){let t;const e=zo.create({start:e=>{t=e.next.bind(e)},stop:t=>{}}).map((t=>zo.merge(...t))).flatten();this.sources.CHILD={select:t=>{const n=e;return("function"==typeof t?n.filter((e=>e.component===t)):t?n.filter((e=>e.name===t)):n).map((t=>t.value))}},this.newChildSources=e=>{"function"==typeof t&&t(e)}}initSubComponentSink$(){const t=zo.create({start:t=>{this.newSubComponentSinks=t.next.bind(t)},stop:t=>{}});this._subscriptions.push(t.subscribe({next:t=>t,error:t=>Bo("SYG901",this,"Sub-component sink stream errored",ar,t)})),this.subComponentSink$=t.filter((t=>Object.keys(t).length>0))}initSubComponentsRendered$(){const t=zo.create({start:t=>{this.triggerSubComponentsRendered=t.next.bind(t)},stop:t=>{}});this.subComponentsRendered$=t.startWith(null)}initVdom$(){if("function"!=typeof this.view)return void(this.vdom$=zo.of(null));const t=this.collectRenderParameters();this.vdom$=t.map((t=>{const{props:e,state:n,children:o,slots:r,context:s,...i}=t,{sygnalFactory:a,sygnalOptions:c,...l}=e||{};try{return this.view({...l,state:n,children:o,slots:r||{},context:s,peers:i},n,s,i)}catch(t){const e=t instanceof Error?t:new Error(String(t));if("function"==typeof this.onError)try{const t=this.onError(e,{componentName:this.name});return Fo("SYG406",this,"View threw; rendered the onError fallback",void 0,e),t}catch(t){Bo("SYG406",this,"View threw; rendering the error fallback",void 0,e),Bo("SYG407",this,"onError threw; rendering an empty error <div>","Make onError return a vnode",t)}else Bo("SYG406",this,"View threw; rendering the error fallback","Add .onError for a custom fallback",e);return{sel:"div",data:{attrs:{"data-sygnal-error":this.name}},children:[]}}})).compose(this.log("View rendered")).map((t=>t||{sel:"div",data:{},children:[]})).map((t=>wr(t,this))).compose(this.instantiateSubComponents.bind(this)).filter((t=>void 0!==t)).compose(this.renderVdom.bind(this))}initSinks(){const t=this.model$.EVENTS;if(t&&(this.model$.EVENTS=t.map((t=>Object.defineProperties({...t},{__emitterId:{value:this._componentNumber,configurable:!0},__emitterName:{value:this.name,configurable:!0}})))),this.sinks=this.sourceNames.reduce(((t,e)=>{if(e==this.DOMSourceName)return t;const n=this.subComponentSink$&&e!==rr?this.subComponentSink$.map((t=>t[e])).filter((t=>!!t)).flatten():zo.never();return e===this.stateSourceName?t[e]=zo.merge(this.model$[e]||zo.never(),n,this.sources[this.stateSourceName].stream.filter((t=>!1)),...this.peers$[e]||[]):t[e]=zo.merge(this.model$[e]||zo.never(),n,...this.peers$[e]||[]),t}),{}),this.sinks[this.DOMSourceName]=this.vdom$,this.sinks[rr]=this.model$[rr]||zo.never(),this.model$[ir]){const t=this.model$[ir].subscribe({next:()=>{},error:t=>Bo("SYG902",this,"EFFECT stream errored; effects stop running",ar,t)});this._subscriptions.push(t),delete this.sinks[ir]}this.model&&Tr(this.model)&&Object.values(this.model).some((t=>!(!Tr(t)||!(sr in t))))?(this.sinks[sr]=this.model$[sr],this.sinks[sr].__explicitReady=!0):this.sinks[sr]=zo.of(!0)}makeOnAction(t,e=!0,n){return n=n||t,(o,r)=>{const s=t.filter((({type:t})=>t==o));let i;if("function"==typeof r)i=s.map((t=>{const s=(t,e,r=10)=>{"number"!=typeof r&&Uo("SYG215",this,`next() delay in '${o}' must be a number`,"Use next('ACTION', data, ms)"),setTimeout((()=>{n.shamefullySendNext({type:t,data:e})}),r),this.log(`<${o}> Triggered a next() action: <${t}> ${r}ms delay`,!0)},i={...this.currentProps,children:this.currentChildren,slots:this.currentSlots||{},context:this.currentContext};let a=t.data;if(e){ur++||setTimeout((()=>{ur=0}));let t=!1;return e=>{!t&&ur&&(t=!0,ur--);const n=void 0!==e,c=this.isSubComponent&&!n?this.currentState:e;try{const t=this.addCalculated(c);i.state=t;const e=r(t,a,s,i);if(hr(e))return c;oo(this,o,c,e,this.stateSourceName);const l=this.cleanupCalculated(e);return n&&(this.currentState=l),l}catch(t){return Bo("SYG216",this,`Reducer for '${o}' threw; state unchanged`,ar,t),c}}}try{const e=this.addCalculated(cr in t?t[cr]:this.currentState);i.state=e;const n=r(e,a,s,i);if(hr(n))return n;const c=typeof n;if(Tr(n)||["string","number","boolean","function"].includes(c))return n;if("undefined"===c)return Fo("SYG217",this,`Reducer for '${o}' sent undefined to the driver`,"Return a value, or ABORT to send nothing"),n;Uo("SYG218",this,`Reducer for '${o}' returned a ${c}`,"Return a value, or ABORT to send nothing")}catch(t){return Bo("SYG216",this,`Reducer for '${o}' threw; nothing sent`,ar,t),dr}})).filter((t=>!hr(t)));else if(void 0===r||!0===r)i=s.map((({data:t})=>t));else{const t=r;i=s.mapTo(t)}return i}}makeEffectHandler(t,e,n,o=t){return t.filter((({type:t})=>t==e)).map((t=>{if("function"==typeof n){const r=(t,n,r=10)=>{"number"!=typeof r&&Uo("SYG215",this,`next() delay in '${e}' must be a number`,"Use next('ACTION', data, ms)"),setTimeout((()=>{o.shamefullySendNext({type:t,data:n})}),r),this.log(`<${e}> EFFECT triggered a next() action: <${t}> ${r}ms delay`,!0)};try{const o=this.addCalculated(cr in t?t[cr]:this.currentState),s={...this.currentProps,children:this.currentChildren,slots:this.currentSlots||{},context:this.currentContext,state:o},i=n(o,t.data,r,s);void 0===i||hr(i)||Fo("SYG219",this,`EFFECT handler '${e}' returned a value, which is ignored`,"Use a STATE or driver sink")}catch(t){Bo("SYG214",this,`EFFECT handler '${e}' threw`,ar,t)}}return null})).filter((t=>!1))}createMemoizedAddCalculated(){let t,e;return function(n){if(!this.calculated||!Tr(n)||Array.isArray(n))return n;if(n===t)return e;Tr(this.calculated)||Uo("SYG606",this,"calculated must be an object","Use calculated = { field: state => value }");const o=this.getCalculatedValues(n);if(!o)return t=n,e=n,n;const r={...n,...o};return t=n,e=r,r}}getCalculatedValues(t){if(!this._calculatedOrder||0===this._calculatedOrder.length)return;const e={...t},n={};for(const[t,{fn:o,deps:r}]of this._calculatedOrder)if(null!==r&&this._calculatedFieldCache){const s=this._calculatedFieldCache[t],i=r.map((t=>e[t]));if(void 0!==s.lastDepValues){let o=!0;for(let t=0;t<i.length;t++)if(i[t]!==s.lastDepValues[t]){o=!1;break}if(o){n[t]=s.lastResult,e[t]=s.lastResult;continue}}try{const r=o(e);s.lastDepValues=i,s.lastResult=r,n[t]=r,e[t]=r}catch(e){Fo("SYG220",this,`Calculated field '${t}' threw (${e instanceof Error?e.message:e}); skipped this update`,"Guard against missing data")}}else try{const r=o(e);n[t]=r,e[t]=r}catch(e){Fo("SYG220",this,`Calculated field '${t}' threw (${e instanceof Error?e.message:e}); skipped this update`,"Guard against missing data")}return n}cleanupCalculated(t){if(!t||!Tr(t)||Array.isArray(t))return t;const e={...this.storeCalculatedInState?this.addCalculated(t):t};if(!this.calculated||this.storeCalculatedInState)return e;return Object.keys(this.calculated).forEach((t=>{this.initialState&&void 0!==this.initialState[t]?e[t]=this.initialState[t]:delete e[t]})),e}collectRenderParameters(){const t=this.sources[this.stateSourceName],e={...this.peers$[this.DOMSourceName]},n=t&&t.isolateSource(t,{get:t=>this.addCalculated(t)}),o=n&&n.stream||zo.never();e.state=o.compose(Ee(Or)),this.sources.props$&&(e.props=this.sources.props$.compose(Ee(Nr))),this._processedChildren$&&(e.children=this._processedChildren$.map((t=>t.children)).compose(Ee(Or)),e.slots=this._processedChildren$.map((t=>t.slots)).compose(Ee(Or))),this.context$&&(e.context=this.context$.compose(Ee(Or)));const r=[],s=[];Object.entries(e).forEach((([t,e])=>{r.push(t),s.push(e)}));const i=zo.combine(...s).compose(ve(1)).map((t=>{const e=r.reduce(((e,n,o)=>(e[n]=t[o],"state"===n&&(e[this.stateSourceName]=t[o],e.calculated=t[o]&&this.getCalculatedValues(t[o])||{}),e)),{});return e}));return i}instantiateSubComponents(t){const e=new Set(["collection","switchable","sygnal-factory",...Object.keys(this.components)]);return t.fold(((t,n)=>{const o=yr(n,e),r=Object.entries(o),s={"::ROOT::":n};if(0===r.length)return this._activeSubComponents.forEach((t=>{t?.sink$?.__dispose&&t.sink$.__dispose()})),this._activeSubComponents.clear(),s;const i={},a=[];let c=0;const l=r.reduce(((e,[n,o])=>{const r=o.data,s=r.props||{},l=o.children||(null!=o.text?[{text:o.text}]:[]),u=r.isCollection||!1,d=r.isSwitchable||!1,h=t=>{Object.entries(t).forEach((([t,e])=>{i[t]||(i[t]=[]),t===rr?a.push(e):t!==this.DOMSourceName&&t!==sr&&i[t].push(e)}))};if(t[n]){const o=t[n];return e[n]=o,o.props$.shamefullySendNext(s),o.children$.shamefullySendNext(l),h(o.sink$),e}const p=zo.create().startWith(s),f=zo.create().startWith(l);let m,y;m=u?this.instantiateCollection.bind(this):d?this.instantiateSwitchable.bind(this):this.instantiateCustomComponent.bind(this),c++;try{y=m(o,p,f)}catch(t){const e=t instanceof Error?t:new Error(String(t));Bo("SYG408",this,"Sub-component threw; rendering the error fallback",ar,e);let n={sel:"div",data:{attrs:{"data-sygnal-error":this.name}},children:[]};if("function"==typeof this.onError)try{n=this.onError(e,{componentName:this.name})||n}catch(t){Bo("SYG407",this,"onError threw; rendering an empty error <div>","Make onError return a vnode",t)}y={[this.DOMSourceName]:zo.of(n)}}return y[this.DOMSourceName]=y[this.DOMSourceName]?this.makeCoordinatedSubComponentDomSink(y[this.DOMSourceName]):zo.never(),e[n]={sink$:y,props$:p,children$:f},this._activeSubComponents.set(n,e[n]),h(y),e}),s),u=Object.entries(i).reduce(((t,[e,n])=>(0===n.length||(t[e]=1===n.length?n[0]:zo.merge(...n)),t)),{}),d=new Set(Object.keys(l));return this._activeSubComponents.forEach(((t,e)=>{d.has(e)||(t?.sink$?.__dispose&&t.sink$.__dispose(),this._activeSubComponents.delete(e),delete this._childReadyState[e])})),this.newSubComponentSinks(u),this.newChildSources(a),c>0&&this.log(`New sub components instantiated: ${c}`,!0),l}),{})}makeCoordinatedSubComponentDomSink(t){return t.debug((t=>this.triggerSubComponentsRendered())).remember()}withCalculated(t){return this.calculated?{get:e=>t.get(Tr(e)?this.addCalculated(e):e),set:t.set}:t}createSubComponentLense(t,e,n){const o={get:t=>t,set:(t,e)=>e};return void 0===t?o:"string"==typeof t?{get:e=>{const o=e[t];return void 0===o&&n?n:o},set:(n,o)=>this.calculated&&t in this.calculated?(Fo("SYG409",this,`${e} tried to update calculated field '${t}'; ignored`,"Bind it to a non-calculated field"),n):{...n,[t]:o}}:Tr(t)?"function"!=typeof t.get?(Bo("SYG410",this,`${e} 'state' prop has no get(); it gets the parent's whole state`,"Use a state key string or { get, set }"),o):{get:t.get,set:t.set}:(Bo("SYG410",this,`${e} 'state' prop is a ${typeof t}; it gets the parent's whole state`,"Use a state key string or { get, set }"),o)}instantiateCollection(t,e,n){const o=t.data.props||{};const r={filter:"function"==typeof o.filter?o.filter:void 0,sort:Lr(o.sort)},s=zo.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState),e.startWith(o)).compose(ve(1)).map((([t,e])=>(e.filter!==r.filter&&(r.filter="function"==typeof e.filter?e.filter:void 0),e.sort!==r.sort&&(r.sort=Lr(e.sort)),t))),i=new De(s,this.stateSourceName),a=o.from,c=o.of,l=o.idfield||"id";let u,d;if("function"==typeof c)if(c.isSygnalComponent)d=c;else{const t=c.componentName||c.label||c.name||"FUNCTION_COMPONENT",e=c,{model:n,intent:o,hmrActions:r,context:s,peers:i,components:a,initialState:l,calculated:u,storeCalculatedInState:h,DOMSourceName:p,stateSourceName:f,onError:m,debug:y}=c;d=fr({name:t,view:e,model:n,intent:o,hmrActions:r,context:s,peers:i,components:a,initialState:l,calculated:u,storeCalculatedInState:h,DOMSourceName:p,stateSourceName:f,onError:m,debug:y})}else this.components[c]?d=this.components[c]:Uo("SYG411",this,`Collection 'of' is not a component: ${c}`,"Use of={ItemComponent}");const h={get:t=>{if(!Array.isArray(t[a]))return[];const e=t[a],n="function"==typeof r.filter?e.filter(r.filter):e,o=("function"==typeof r.sort?n.sort(r.sort):n).map(((t,e)=>Tr(t)?{...t,[l]:t[l]||e}:{value:t,[l]:e}));return o},set:(t,e)=>{if(this.calculated&&a in this.calculated)return Fo("SYG409",this,`Collection tried to update calculated field '${a}'; ignored`,"Bind it to a non-calculated field"),t;const n=[];for(const o of t[a].map(((t,e)=>Tr(t)?{...t,[l]:t[l]||e}:{__primitive:!0,value:t,[l]:e})))if("function"!=typeof r.filter||r.filter(o)){const t=e.find((t=>t[l]===o[l]));void 0!==t&&n.push(o.__primitive?t.value:t)}else n.push(o.__primitive?o.value:o);return{...t,[a]:n}}};if(void 0===a)u={get:t=>!(t instanceof Array)&&t.value&&t.value instanceof Array?t.value:t,set:(t,e)=>e};else if("string"==typeof a)if(Tr(this.currentState))if(this.currentState&&a in this.currentState||this.calculated&&a in this.calculated)Array.isArray(this.currentState[a])||Fo("SYG401",this,`Collection 'from' field '${a}' is not an array; it renders nothing`,"Set it to an array in initialState"),u=h;else{const t=Object.keys(this.currentState).filter((t=>Array.isArray(this.currentState[t])));Bo("SYG401",this,`Collection from="${a}" is not in state${t.length?` (array fields: '${t.join("', '")}')`:""}; it renders nothing`,"Set it to an array in initialState"),u=void 0}else Array.isArray(this.currentState[a])||Fo("SYG401",this,`Collection 'from' field '${a}' is not an array; it renders nothing`,"Set it to an array in initialState"),u=h;else Tr(a)?"function"!=typeof a.get?(Bo("SYG412",this,"Collection 'from' prop is invalid; it renders nothing","Use a state key string or { get, set }",a),u=void 0):u={get:t=>{const e=a.get(t);return Array.isArray(e)?e:(Fo("SYG401",this,"Collection 'from' getter returned a non-array; it renders nothing","Return an array from get()",e),[])},set:a.set}:(Bo("SYG412",this,"Collection 'from' prop is invalid; it renders nothing","Use a state key string or { get, set }",a),u=void 0);u&&(u=this.withCalculated(u));const p=["of","from","filter","sort","idfield","className"],f=e.map((t=>{if(!t||"object"!=typeof t)return{};const e={};for(const n in t)p.includes(n)||(e[n]=t[n]);return e})),m={...this.sources,[this.stateSourceName]:i,props$:f,children$:n,__parentContext$:this.context$,PARENT:null,__parentComponentNumber:this._componentNumber},y=Wo(d,u,{container:null})(m);if(Tr(y)||Uo("SYG903",this,"Collection factory returned invalid sinks","Return a sinks object"),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected){const t="function"==typeof c?c.componentName||c.label||c.name||"anonymous":String(c);window.__SYGNAL_DEVTOOLS__.onCollectionMounted(this._componentNumber,this.name,t,"string"==typeof a?a:null)}return y}instantiateSwitchable(t,e,n){const o=t.data.props||{},r=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>Tr(t)?this.addCalculated(t):t)),s=new De(r,this.stateSourceName),i=o.state,a=this.withCalculated(this.createSubComponentLense(i,"Switchable sub-component")),c=o.of;Object.keys(c).forEach((t=>{const e=c[t];if(!e.isSygnalComponent){const n=e.componentName||e.label||e.name||"FUNCTION_COMPONENT",o=e,{model:r,intent:s,hmrActions:i,context:a,peers:l,components:u,initialState:d,calculated:h,storeCalculatedInState:p,DOMSourceName:f,stateSourceName:m,onError:y,debug:_}=e,v={name:n,view:o,model:r,intent:s,hmrActions:i,context:a,peers:l,components:u,initialState:d,calculated:h,storeCalculatedInState:p,DOMSourceName:f,stateSourceName:m,onError:y,debug:_};c[t]=fr(v)}}));const l={...this.sources,[this.stateSourceName]:s,props$:e,children$:n,__parentContext$:this.context$,__parentComponentNumber:this._componentNumber},u=pe(Zo(c,e.map((t=>t.current)),""),{[this.stateSourceName]:a})(l);return Tr(u)||Uo("SYG903",this,"Switchable factory returned invalid sinks","Return a sinks object"),u}instantiateCustomComponent(t,e,n){const o=t.sel,r=t.data.props||{},s=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>Tr(t)?this.addCalculated(t):t));let i=new De(s,this.stateSourceName);const a=r.state;"function"!=typeof r.sygnalFactory&&Tr(r.sygnalOptions)&&(r.sygnalFactory=fr(r.sygnalOptions));const c="sygnal-factory"===o?r.sygnalFactory:this.components[o]||r.sygnalFactory;c||("sygnal-factory"===o&&Uo("SYG413",this,"Unnamed component has no factory","Name the function, or set Comp.componentName"),Uo("SYG414",this,`Component '${o}' not found`,"Import it, or add it to .components"));const l=r.sygnalOptions?.initialState,u=r.sygnalOptions?.isolatedState;if(l&&!u){Uo("SYG405",r.sygnalOptions?.name||o,"Sub-component initialState replaces the state its parent passes in","Remove initialState, or set isolatedState = true")}const d=u?l:void 0;let h,p,f=this.createSubComponentLense(a,"Sub-component",d);u&&void 0===a&&(p=zo.create(),i=new De(zo.merge(s.filter((()=>void 0===h)),p),this.stateSourceName));const m={...this.sources,[this.stateSourceName]:i,props$:e,children$:n,__parentContext$:this.context$,__parentComponentNumber:this._componentNumber};f=p?null:this.withCalculated(f);for(const t of Object.keys(r)){const e=r[t];if(e&&e.__sygnalCommand){e._targetComponentName=o,m.commands$=Qo(e);break}}const y=pe(c,{[this.stateSourceName]:f})(m);if(!Tr(y)){Uo("SYG903",this,`Factory for ${"sygnal-factory"===o?"custom element":o} returned invalid sinks`,"Return a sinks object")}return p&&y[this.stateSourceName]&&(y[this.stateSourceName]=y[this.stateSourceName].map((t=>p.shamefullySendNext(h=t(void 0===h?this.addCalculated(this.currentState):h)))).filter((()=>!1))),y}renderVdom(t){const e=new Set(["collection","switchable","sygnal-factory",...Object.keys(this.components)]);return zo.combine(this.subComponentsRendered$,t,this._readyChanged$.startWith(null)).compose(ve(1)).map((([t,n])=>{const o=n["::ROOT::"],r=Object.entries(n).filter((([t])=>"::ROOT::"!==t));if(0===r.length)return zo.of(Sr(o));const s=[],i=r.map((([t,e])=>(s.push(t),e.sink$[this.DOMSourceName].startWith(void 0))));if(0===i.length)return zo.of(o);for(const[t,e]of r){if(void 0!==this._childReadyState[t])continue;const n=e.sink$[sr];if(n){const e=n.__explicitReady;this._childReadyState[t]=!e,n.addListener({next:e=>{const n=this._childReadyState[t];this._childReadyState[t]=!!e,n!==!!e&&(this._readyChangedListener&&setTimeout((()=>{this._readyChangedListener?.next(null)}),0),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onReadyChanged(this._componentNumber,this.name,t,!!e))},error:()=>{},complete:()=>{}})}else this._childReadyState[t]=!0}return zo.combine(...i).filter((t=>t.every((t=>void 0!==t)))).map((t=>{const n=t.reduce(((t,e,n)=>(t[s[n]]=e,t)),{});return Sr(_r(o,n,e,"r",void 0,this._childReadyState))}))})).flatten().filter((t=>!!t)).map((t=>(no(this,t),t))).remember()}}function yr(t,e,n="r",o,r){var s,i;if(!t)return r||{};if(t.data?.componentsProcessed)return r||{};"r"===n&&(t.data.componentsProcessed=!0),r||(r={});const a=t.sel,c=a&&"collection"===a.toLowerCase(),l=a&&"switchable"===a.toLowerCase(),u=a&&e.has(a)||"function"==typeof t.data?.props?.sygnalFactory||Tr(t.data?.props?.sygnalOptions),d=t.data&&t.data.props||{},h=t.children||[];let p=o;if(u){if(p=vr(t,n,o),c)d.of||Uo("SYG411",void 0,"Collection is missing 'of'","Use of={ItemComponent}"),"string"!=typeof d.of&&"function"!=typeof d.of&&Uo("SYG411",void 0,"Collection 'of' is a "+typeof d.of,"Use of={ItemComponent}"),"function"==typeof d.of||e.has(d.of)||Uo("SYG411",void 0,`Collection 'of' component not found: ${d.of}`,"Use of={ItemComponent}"),t.data.isCollection=!0,(s=t.data).props||(s.props={});else if(l){d.of||Uo("SYG415",void 0,"Switchable is missing 'of'","Use of={{ name: Component }}"),Tr(d.of)||Uo("SYG415",void 0,"Switchable 'of' is a "+typeof d.of,"Use of={{ name: Component }}");Object.values(d.of).every((t=>"function"==typeof t))||Uo("SYG415",void 0,"Switchable 'of' has a value that is not a component","Use of={{ name: Component }}"),(!d.current||"string"!=typeof d.current&&"function"!=typeof d.current)&&Uo("SYG416",void 0,"Switchable 'current' is missing or a "+typeof d.current,"Set current to a key of 'of'");Object.keys(d.of).includes(d.current)||Uo("SYG416",void 0,`Switchable 'current' '${d.current}' is not a key of 'of'`,"Set current to a key of 'of'"),t.data.isSwitchable=!0}void 0===d.key&&(((i=t.data).props||(i.props={})).key=p),r[p]=t}for(let t=0;t<h.length;t++)yr(h[t],e,`${n}.${t}`,p,r);return r}function _r(t,e,n,o="r",r,s){if(!t)return;const i=t.sel||"NO SELECTOR",a=n.has(i)||"function"==typeof t.data?.props?.sygnalFactory||Tr(t.data?.props?.sygnalOptions),c=t?.data?.isCollection,l=t.children||[];let u=r;if(a){u=vr(t,o,r);let n=e[u];return s&&u&&!1===s[u]&&n&&"object"==typeof n&&n.sel&&(n={...n,data:{...n.data||{},attrs:{...n.data?.attrs||{},"data-sygnal-ready":"false"}}}),c?{...t,sel:"div",children:Array.isArray(n)?n:[n]}:n}if(l.length>0){const r=l.map(((t,r)=>_r(t,e,n,`${o}.${r}`,u,s))).flat();return{...t,children:r}}return t}function vr(t,e,n){const o=t.sel,r="string"==typeof o?o:"functionComponent",s=t.data?.props||{};return`${n?`${n}|`:""}${r}::${s.id&&JSON.stringify(s.id).replaceAll('"',"")||e}`}function gr(t){if(!t||!t.sel)return!1;if("false"===t.data?.attrs?.["data-sygnal-ready"])return!0;if("loading"===t.data?.attrs?.["data-sygnal-lazy"])return!0;if("suspense"===t.sel)return!1;if(Array.isArray(t.children))for(const e of t.children)if(gr(e))return!0;return!1}function Sr(t){if(!t||!t.sel)return t;if("suspense"===t.sel){const e=(t.data?.props||{}).fallback,n=t.children||[];return n.some(gr)&&e?"string"==typeof e?{sel:"div",data:{attrs:{"data-sygnal-suspense":"pending"}},children:[{text:e}],text:void 0,elm:void 0,key:void 0}:{sel:"div",data:{attrs:{"data-sygnal-suspense":"pending"}},children:[e],text:void 0,elm:void 0,key:void 0}:1===n.length?Sr(n[0]):{sel:"div",data:{attrs:{"data-sygnal-suspense":"resolved"}},children:n.map((t=>Sr(t))),text:void 0,elm:void 0,key:void 0}}if(t.children&&t.children.length>0){const e=t.children.map((t=>Sr(t)));return{...t,children:e}}return t}const br=on(Co);function wr(t,e){if(!t||!t.sel)return t;const n=t.data?.props?.sygnalOptions?.view;if(n&&n.__sygnalLazy)if(n.__sygnalLazyLoaded()){const e=n.__sygnalLazyLoadedComponent;if(e){const n=t.data?.props||{},o=e.componentName||e.label||e.name||"LazyLoaded",{model:r,intent:s,hmrActions:i,context:a,peers:c,components:l,initialState:u,isolatedState:d,calculated:h,storeCalculatedInState:p,DOMSourceName:f,stateSourceName:m,onError:y,debug:_}=e,v={name:o,view:e,model:r,intent:s,hmrActions:i,context:a,peers:c,components:l,initialState:u,isolatedState:d,calculated:h,storeCalculatedInState:p,DOMSourceName:f,stateSourceName:m,onError:y,debug:_},g={...n};return delete g.sygnalOptions,{sel:o,data:{props:{...g,sygnalOptions:v}},children:t.children||[],text:void 0,elm:void 0,key:void 0}}}else!n.__sygnalLazyReRenderScheduled&&n.__sygnalLazyPromise&&e&&(n.__sygnalLazyReRenderScheduled=!0,n.__sygnalLazyPromise.then((()=>{setTimeout((()=>{const t=e.sources?.[e.stateSourceName];if(t&&t.stream){const n={...e.currentState,__sygnalLazyTick:Date.now()};t.stream.shamefullySendNext(n)}}),0)})));if("portal"===t.sel){const e=t.data?.props?.target;return function(t,e){const n=e||[];return{sel:"div",data:{style:{display:"none"},attrs:{"data-sygnal-portal":t},portalChildren:n,hook:{insert:e=>{if(document.querySelector(t))return void Er(e,t,n);let o=0;const r=()=>{e.data._portalVnode||(document.querySelector(t)?Er(e,t,n):++o<10?setTimeout(r,5):Fo("SYG417","Portal",`Target '${t}' not found; content not rendered`,"Render the target first"))};setTimeout(r,5)},postpatch:(e,n)=>{const o=e.data?._portalVnode,r=e.data?._portalContainer,s=n.data?.portalChildren||[];o&&r?(n.data._portalVnode=br(o,{sel:"div",data:{},children:s,text:void 0,elm:void 0,key:void 0}),n.data._portalContainer=r):n.data._portalVnode||Er(n,t,s)},destroy:t=>{const e=t.data?._portalVnode;e&&e.elm&&e.elm.parentNode&&e.elm.parentNode.removeChild(e.elm)}}},children:[],text:void 0,elm:void 0,key:void 0}}(e,t.children||[])}if("transition"===t.sel){const n=t.data?.props||{},o=n.name||"v",r=n.duration,s=(t.children||[])[0];return s&&s.sel?function(t,e,n){const o=t.data?.hook?.insert,r=t.data?.hook?.remove;return t.data=t.data||{},t.data.hook=t.data.hook||{},t.data.hook.insert=t=>{o&&o(t);const r=t.elm;r&&r.classList&&(r.classList.add(`${e}-enter-from`,`${e}-enter-active`),requestAnimationFrame((()=>{requestAnimationFrame((()=>{r.classList.remove(`${e}-enter-from`),r.classList.add(`${e}-enter-to`),Ar(r,n,(()=>{r.classList.remove(`${e}-enter-active`,`${e}-enter-to`)}))}))})))},t.data.hook.remove=(t,o)=>{r&&r(t,(()=>{}));const s=t.elm;s&&s.classList?(s.classList.add(`${e}-leave-from`,`${e}-leave-active`),requestAnimationFrame((()=>{requestAnimationFrame((()=>{s.classList.remove(`${e}-leave-from`),s.classList.add(`${e}-leave-to`),Ar(s,n,(()=>{s.classList.remove(`${e}-leave-active`,`${e}-leave-to`),o()}))}))}))):o()},t}(wr(s,e),o,r):s||t}if("clientonly"===t.sel){const n=t.children||[];return 0===n.length?{sel:"div",data:{},children:[]}:1===n.length?wr(n[0],e):{sel:"div",data:{},children:n.map((t=>wr(t,e))),text:void 0,elm:void 0,key:void 0}}return t.children&&t.children.length>0&&(t.children=t.children.map((t=>wr(t,e)))),t}function Ar(t,e,n){if("number"==typeof e)setTimeout(n,e);else{const e=()=>{t.removeEventListener("transitionend",e),n()};t.addEventListener("transitionend",e)}}function Er(t,e,n){const o=document.querySelector(e);if(!o)return void Fo("SYG417","Portal",`Target '${e}' not found; content not rendered`,"Render the target first");const r=document.createElement("div");o.appendChild(r),t.data._portalVnode=br(r,{sel:"div",data:{},children:n,text:void 0,elm:void 0,key:void 0}),t.data._portalContainer=o}function Nr(t,e){return Or(Cr(t),Cr(e))}function Or(t,e,n=5,o=0){if(o>n)return!1;if(t===e)return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!Or(t[r],e[r],n,o+1))return!1;return!0}const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(const s of r){if(!(s in e))return!1;if(!Or(t[s],e[s],n,o+1))return!1}return!0}function Cr(t){if(!Tr(t))return t;const{state:e,of:n,from:o,filter:r,...s}=t;return s}function Tr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}const kr="Use a field name, { field: 'asc'|'desc'|1|-1 }, or a function";function $r(t,e,n=!0){const o=n?1:-1;switch(!0){case t>e:return 1*o;case t<e:return-1*o;default:return 0}}function xr(t){const e=Object.entries(t);if(e.length>1)return void Bo("SYG418","Collection","sort object must have one key; ignored",kr,t);const n=e[0],[o,r]=n;if(!["string","number"].includes(typeof r))return void Bo("SYG418","Collection","sort direction must be a string or number; ignored",kr,t);let s=!0;if("string"==typeof r){if(!["asc","desc"].includes(r.toLowerCase()))return void Bo("SYG418","Collection","sort direction must be 'asc' or 'desc'; ignored",kr,t);s="desc"!==r.toLowerCase()}if("number"==typeof r){if(1!==r&&-1!==r)return void Bo("SYG418","Collection","sort direction must be 1 or -1; ignored",kr,t);s=1===r}return(t,e)=>$r(t[o],e[o],s)}function Lr(t){if(!t)return;const e=typeof t;if("function"===e)return t;if("string"===e){if("asc"===t.toLowerCase()||"desc"===t.toLowerCase()){const e="desc"!==t.toLowerCase();return(t,n)=>$r(t,n,e)}const e=t;return(t,n)=>$r(t[e],n[e],!0)}if(Array.isArray(t)){const e=t.map((t=>"function"==typeof t?t:"string"!=typeof t||["asc","desc"].includes(t.toLowerCase())?Tr(t)?xr(t):void 0:(e,n)=>$r(e[t],n[t],!0)));return(t,n)=>e.filter((t=>"function"==typeof t)).reduce(((e,o)=>0!==e?e:o(t,n)),0)}return Tr(t)?xr(t):void Bo("SYG418","Collection","Invalid sort prop; ignored",kr,t)}const Dr=t=>{const{children:e,...n}=t;return ze("portal",{props:n},e)};Dr.label="portal",Dr.preventInstantiation=!0;const Gr=t=>{const{children:e,...n}=t;return ze("transition",{props:n},e)};Gr.label="transition",Gr.preventInstantiation=!0;const jr=t=>{const{children:e,...n}=t;return ze("suspense",{props:n},e)};jr.label="suspense",jr.preventInstantiation=!0;const Ir=t=>{const{children:e,...n}=t;return ze("slot",{props:n},e)};function Mr(t){return t.data=function(e,n){return Mr(t.map((t=>{const o=t?.dataset?.[e]??t?.dropZone?.dataset?.[e]??t?.element?.dataset?.[e];return n?n(o):o})))},t.element=function(e){return Mr(t.map((t=>{const n=t?.element??t?.dropZone??null;return e?e(n):n})))},t}function Pr(t){return 0===Object.keys(t).length}function Yr(t,e){if("function"!=typeof t)throw new Error("First argument given to Cycle must be the 'main' function.");if("object"!=typeof e||null===e)throw new Error("Second argument given to Cycle must be an object with driver functions as properties.");if(Pr(e))throw new Error("Second argument given to Cycle must be an object with at least one driver function declared as a property.");const n=function(t){if("object"!=typeof t||null===t)throw new Error("Argument given to setupReusable must be an object with driver functions as properties.");if(Pr(t))throw new Error("Argument given to setupReusable must be an object with at least one driver function declared as a property.");const e=function(t){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=ce.create());return e}(t),n=function(t,e){const n={};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o](e[o],o),n[o]&&"object"==typeof n[o]&&(n[o]._isCycleSource=o));return n}(t,e),o=function(t){for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&t[e]&&"function"==typeof t[e].shamefullySendNext&&(t[e]=ue(t[e]));return t}(n);function r(t){return function(t,e){const n=Object.keys(t).filter((t=>!!e[t]));let o={};const r={};n.forEach((t=>{o[t]={_n:[],_e:[]},r[t]={next:e=>o[t]._n.push(e),error:e=>o[t]._e.push(e),complete:()=>{}}}));const s=n.map((e=>ce.fromObservable(t[e]).subscribe(r[e])));return n.forEach((t=>{const n=e[t],s=t=>{queueMicrotask((()=>n._n(t)))},i=t=>{queueMicrotask((()=>{(console.error||console.log)(t),n._e(t)}))};o[t]._n.forEach(s),o[t]._e.forEach(i),r[t].next=s,r[t].error=i,r[t]._n=s,r[t]._e=i})),o=null,function(){s.forEach((t=>t.unsubscribe()))}}(t,e)}function s(){!function(t){for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&t[e]&&t[e].dispose&&t[e].dispose()}(o),function(t){Object.keys(t).forEach((e=>t[e]._c()))}(e)}return{sources:o,run:r,dispose:s}}(e),o=t(n.sources);return"undefined"!=typeof window&&(window.Cyclejs=window.Cyclejs||{},window.Cyclejs.sinks=o),{sinks:o,sources:n.sources,run:function(){const t=n.run(o);return function(){t(),n.dispose()}}}}function Rr(t){const e=new EventTarget;return t.subscribe({next:t=>{io(t&&t.type,t?.__emitterName),e.dispatchEvent(new CustomEvent("data",{detail:t})),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onBusEvent(t)},error:t=>console.error("[EVENTS driver] Error in sink stream:",t)}),{select:t=>{ao(t);const n=!t,o=Array.isArray(t)?t:[t];let r;const s=ce.create({start:t=>{r=({detail:e})=>{const r=e&&e.data||null;(n||o.includes(e.type))&&t.next(r)},e.addEventListener("data",r)},stop:()=>{r&&e.removeEventListener("data",r)}});return ue(s)}}}function Fr(t){t.addListener({next:t=>{console.log(t)},error:t=>{console.error("[LOG driver] Error in sink stream:",t)}})}Ir.label="slot",Ir.preventInstantiation=!0;class Br{constructor(){this._connected=!1,this._components=new Map,this._stateHistory=[],this._maxHistory=200}getDiagnostics(){return Jn()}get connected(){return this._connected&&"undefined"!=typeof window}init(){"undefined"!=typeof window&&(window.__SYGNAL_DEVTOOLS__=this,window.addEventListener("message",(t=>{t.source===window&&"__SYGNAL_DEVTOOLS_EXTENSION__"===t.data?.source&&this._handleExtensionMessage(t.data)})))}_handleExtensionMessage(t){switch(t.type){case"CONNECT":this._connected=!0,t.payload?.maxHistory&&(this._maxHistory=t.payload.maxHistory),this._sendFullTree();break;case"DISCONNECT":this._connected=!1;break;case"SET_DEBUG":this._setDebug(t.payload);break;case"TIME_TRAVEL":this._timeTravel(t.payload);break;case"SNAPSHOT":this._takeSnapshot();break;case"RESTORE_SNAPSHOT":this._restoreSnapshot(t.payload);break;case"GET_STATE":this._sendComponentState(t.payload.componentId)}}onComponentCreated(t,e,n){const o={id:t,name:e,isSubComponent:n.isSubComponent,hasModel:!!n.model,hasIntent:!!n.intent,hasContext:!!n.context,hasCalculated:!!n.calculated,components:Object.keys(n.components||{}),parentId:null,children:[],debug:n._debug,createdAt:Date.now(),mviGraph:this._extractMviGraph(n),_instanceRef:new WeakRef(n)};this._components.set(t,o),this.connected&&this._post("COMPONENT_CREATED",this._serializeMeta(o))}onStateChanged(t,e,n){if(!this.connected)return;const o={componentId:t,componentName:e,timestamp:Date.now(),state:this._safeClone(n)};this._stateHistory.push(o),this._stateHistory.length>this._maxHistory&&this._stateHistory.shift(),this._post("STATE_CHANGED",{componentId:t,componentName:e,state:o.state})}onActionDispatched(t,e,n,o){this.connected&&this._post("ACTION_DISPATCHED",{componentId:t,componentName:e,actionType:n,data:this._safeClone(o),timestamp:Date.now()})}onSubComponentRegistered(t,e){const n=this._components.get(t),o=this._components.get(e);n&&o&&(o.parentId=t,n.children.includes(e)||n.children.push(e)),this.connected&&this._post("TREE_UPDATED",{parentId:t,childId:e})}onContextChanged(t,e,n){this.connected&&this._post("CONTEXT_CHANGED",{componentId:t,componentName:e,context:this._safeClone(n),contextTrace:this._buildContextTrace(t,n)})}onPropsChanged(t,e,n){this.connected&&this._post("PROPS_CHANGED",{componentId:t,componentName:e,props:this._safeClone(n)})}onBusEvent(t){this.connected&&this._post("BUS_EVENT",{type:t.type,data:this._safeClone(t.data),componentId:t.__emitterId??null,componentName:t.__emitterName??null,timestamp:Date.now()})}onCommandSent(t,e,n,o){this.connected&&this._post("COMMAND_SENT",{type:t,data:this._safeClone(e),targetComponentName:o??null,timestamp:Date.now()})}onReadyChanged(t,e,n,o){this.connected&&this._post("READY_CHANGED",{parentId:t,parentName:e,childKey:n,ready:o,timestamp:Date.now()})}onCollectionMounted(t,e,n,o){const r=this._components.get(t);r&&(r.collection={itemComponent:n,stateField:o}),this.connected&&this._post("COLLECTION_MOUNTED",{parentId:t,parentName:e,itemComponent:n,stateField:o})}onComponentDisposed(t,e){const n=this._components.get(t);n&&(n.disposed=!0,n.disposedAt=Date.now()),this.connected&&this._post("COMPONENT_DISPOSED",{componentId:t,componentName:e,timestamp:Date.now()})}onDebugLog(t,e){this.connected&&this._post("DEBUG_LOG",{componentId:t,message:e,timestamp:Date.now()})}_setDebug({componentId:t,enabled:e}){if(null==t)return"undefined"!=typeof window&&(window.SYGNAL_DEBUG=!!e&&"true"),void this._post("DEBUG_TOGGLED",{global:!0,enabled:e});const n=this._components.get(t);if(n&&n._instanceRef){const o=n._instanceRef.deref();o&&(o._debug=e,n.debug=e,this._post("DEBUG_TOGGLED",{componentId:t,enabled:e}))}}_timeTravel({componentId:t,componentName:e,state:n}){if(null==t||!n)return void console.warn("[Sygnal DevTools] _timeTravel: missing componentId or state",{componentId:t,hasState:!!n});if("undefined"==typeof window)return;const o=this._safeClone(n),r=this._components.get(t);if(r){const n=r._instanceRef?.deref();if(n){const r=n.stateSourceName||"STATE",s=n.sinks?.[r];if(s?.shamefullySendNext)return s.shamefullySendNext((()=>({...o}))),void this._post("TIME_TRAVEL_APPLIED",{componentId:t,componentName:e,state:o});console.warn(`[Sygnal DevTools] _timeTravel: component #${t} (${e}) has no STATE sink with shamefullySendNext. sinkName=${r}, hasSinks=${!!n.sinks}, sinkKeys=${n.sinks?Object.keys(n.sinks).join(","):"none"}`)}else console.warn(`[Sygnal DevTools] _timeTravel: WeakRef for component #${t} (${e}) has been GC'd`)}else console.warn(`[Sygnal DevTools] _timeTravel: no meta for componentId ${t}`);const s=window.__SYGNAL_DEVTOOLS_APP__;s?.sinks?.STATE?.shamefullySendNext?(s.sinks.STATE.shamefullySendNext((()=>({...o}))),this._post("TIME_TRAVEL_APPLIED",{componentId:t,componentName:e,state:o})):console.warn("[Sygnal DevTools] _timeTravel: no fallback root STATE sink available")}_takeSnapshot(){const t=[];for(const[e,n]of this._components){if(n.disposed)continue;const o=n._instanceRef?.deref();null!=o?.currentState&&t.push({componentId:e,componentName:n.name,state:this._safeClone(o.currentState)})}this._post("SNAPSHOT_TAKEN",{entries:t,timestamp:Date.now()})}_restoreSnapshot(t){if(t?.entries)for(const e of t.entries)this._timeTravel(e)}_sendComponentState(t){const e=this._components.get(t);if(e&&e._instanceRef){const n=e._instanceRef.deref();n&&this._post("COMPONENT_STATE",{componentId:t,state:this._safeClone(n.currentState),context:this._safeClone(n.currentContext),contextTrace:this._buildContextTrace(t,n.currentContext),props:this._safeClone(n.currentProps)})}}_buildContextTrace(t,e){if(!e||"object"!=typeof e)return[];const n=[],o=Object.keys(e);for(const e of o){let o=t,r=!1;for(;null!=o;){const t=this._components.get(o);if(!t)break;if(t.mviGraph?.contextProvides?.includes(e)){n.push({field:e,providerId:t.id,providerName:t.name}),r=!0;break}o=t.parentId}r||n.push({field:e,providerId:-1,providerName:"unknown"})}return n}_sendFullTree(){const t=[];for(const[,e]of this._components){const n=e._instanceRef?.deref();t.push({...this._serializeMeta(e),state:n?this._safeClone(n.currentState):null,context:n?this._safeClone(n.currentContext):null})}this._post("FULL_TREE",{components:t,history:this._stateHistory})}_post(t,e){"undefined"!=typeof window&&window.postMessage({source:"__SYGNAL_DEVTOOLS_PAGE__",type:t,payload:e},"*")}_safeClone(t){if(null==t)return t;try{return JSON.parse(JSON.stringify(t))}catch(t){return"[unserializable]"}}_extractMviGraph(t){if(!t.model)return null;try{const e=t.sourceNames?[...t.sourceNames]:[],n=[],o=t.model;for(const e of Object.keys(o)){let r=e,s=o[e];if(e.includes("|")){const t=e.split("|").map((t=>t.trim()));if(2===t.length&&t[0]&&t[1]){r=t[0],n.push({name:r,sinks:[t[1]]});continue}}"function"!=typeof s?s&&"object"==typeof s&&n.push({name:r,sinks:Object.keys(s)}):n.push({name:r,sinks:[t.stateSourceName||"STATE"]})}return{sources:e,actions:n,contextProvides:t.context&&"object"==typeof t.context?Object.keys(t.context):[]}}catch(t){return null}}_serializeMeta(t){const{_instanceRef:e,...n}=t;return n}}let Ur=null;function Vr(){return Ur||(Ur=new Br),Ur}function Wr(t){if(!t)return null;const e=t.default||t;return"function"!=typeof e?null:t.default?t:{default:e}}function Hr(t){return/^[a-zA-Z0-9-_]+$/.test(t)}function zr(t){if("string"!=typeof t)throw new Error("Class name must be a string");return t.trim().split(" ").reduce(((t,e)=>{if(0===e.trim().length)return t;if(!Hr(e))throw new Error(`${e} is not a valid CSS class name`);return t.push(e),t}),[])}const qr=t=>(t=>"string"==typeof t)(t)||(t=>"number"==typeof t)(t),Jr={svg:1,g:1,defs:1,symbol:1,use:1,circle:1,ellipse:1,line:1,path:1,polygon:1,polyline:1,rect:1,text:1,tspan:1,textPath:1,linearGradient:1,radialGradient:1,stop:1,pattern:1,clipPath:1,mask:1,marker:1,filter:1,feBlend:1,feColorMatrix:1,feComponentTransfer:1,feComposite:1,feConvolveMatrix:1,feDiffuseLighting:1,feDisplacementMap:1,feDropShadow:1,feFlood:1,feGaussianBlur:1,feImage:1,feMerge:1,feMergeNode:1,feMorphology:1,feOffset:1,fePointLight:1,feSpecularLighting:1,feSpotLight:1,feTile:1,feTurbulence:1,feFuncR:1,feFuncG:1,feFuncB:1,feFuncA:1,desc:1,metadata:1,foreignObject:1,switch:1,animate:1,animateMotion:1,animateTransform:1,set:1,mpath:1};var Zr=Object.prototype.hasOwnProperty,Xr=Object.prototype.toString,Kr=Object.defineProperty,Qr=Object.getOwnPropertyDescriptor,ts=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Xr.call(t)},es=function(t){if(!t||"[object Object]"!==Xr.call(t))return!1;var e,n=Zr.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&Zr.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!o)return!1;for(e in t);return void 0===e||Zr.call(t,e)},ns=function(t,e){Kr&&"__proto__"===e.name?Kr(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},os=function(t,e){if("__proto__"===e){if(!Zr.call(t,e))return;if(Qr)return Qr(t,e).value}return t[e]},rs=function t(){var e,n,o,r,s,i,a=arguments[0],c=1,l=arguments.length,u=!1;for("boolean"==typeof a&&(u=a,a=arguments[1]||{},c=2),(null==a||"object"!=typeof a&&"function"!=typeof a)&&(a={});c<l;++c)if(null!=(e=arguments[c]))for(n in e)o=os(a,n),a!==(r=os(e,n))&&(u&&r&&(es(r)||(s=ts(r)))?(s?(s=!1,i=o&&ts(o)?o:[]):i=o&&es(o)?o:{},ns(a,{name:n,newValue:t(u,i,r)})):void 0!==r&&ns(a,{name:n,newValue:r}));return a},ss=o(rs);const is=(...t)=>ss(!1,...t),as=(t,e,n)=>{let o=n;for(let n=0;n<t.length;n++){const s=t[n];r=s,o=Array.isArray(r)?as(s,e,o):e(o,s)}var r;return o},cs=(t,e)=>Object.keys(t).map((n=>e(n,t[n]))).reduce(((t,e)=>((...t)=>ss(!0,...t))(t,e)),{}),ls=(t,e)=>cs(e,((e,n)=>e!==t?{[e]:n}:{})),us=t=>{if(!t||void 0===t.sel)return t;const e=t.data||{},n=e.props||{},o=ls("className",n),r=void 0!==n.className?{class:n.className}:{},s=is({},o,r,e.attrs||{});return is(t,{data:ls("props",is({},e,{ns:"http://www.w3.org/2000/svg",attrs:s}))},{children:Array.isArray(t.children)&&"foreignObject"!==t.sel?t.children.map((t=>us(t))):t.children})},ds=t=>t.sel in Jr?us(t):t,hs={for:"attrs",role:"attrs",tabindex:"attrs","aria-*":"attrs",key:null},ps=(t,e)=>{const{ref:n,...o}=t,r=(t=>{if(!t.props)return t;const{autoFocus:e,autoSelect:n,...o}=t.props;if(!e&&!n)return t;t.props=o,t._autoFocus=!!e,t._autoSelect=!!n;const r=t=>{t&&"function"==typeof t.focus&&requestAnimationFrame((()=>{t.focus(),n&&"function"==typeof t.select&&t.select()}))},s=t.hook?.insert,i=t.hook?.postpatch;return t.hook={...t.hook,insert:t=>{s&&s(t),(e||n)&&r(t.elm)},postpatch:(t,e)=>{i&&i(t,e);const n=t.data?._autoFocus,o=e.data?._autoFocus;!n&&o&&r(e.elm)}},t})(((t,e)=>cs(t,((t,n)=>{const o={[t]:n};if(hs[t]&&void 0!==e[hs[t]])return{[hs[t]]:o};if(null===hs[t])return{};const r=Object.keys(hs);for(let n=0;n<r.length;n++){const s=r[n];if("*"===s.charAt(s.length-1)&&0===t.indexOf(s.slice(0,-1))&&void 0!==e[hs[s]])return{[hs[s]]:o}}return void 0!==e[t]?{[e[t]?e[t]:t]:n}:void 0!==e.props?{props:o}:o})))(((t,e)=>cs(t,((t,n)=>{const o=t.indexOf("-");if(o>-1&&void 0!==e[t.slice(0,o)]){const e={[t.slice(o+1)]:n};return{[t.slice(0,o)]:e}}return{[t]:n}})))(o,e),e));return((t,e)=>{if(!e)return t;const n=t=>{"function"==typeof e?e(t):e&&"object"==typeof e&&"current"in e&&(e.current=t)},o=t.hook?.insert,r=t.hook?.destroy,s=t.hook?.postpatch;return t.hook={...t.hook,insert:t=>{o&&o(t),n(t.elm)},postpatch:(t,e)=>{s&&s(t,e),n(e.elm)},destroy:t=>{r&&r(t),n(null)}},t})(r,n)},fs=t=>t.length>1||!qr(t[0])?void 0:t[0].toString(),ms=t=>as(t,((t,e)=>{const n=(t=>"object"==typeof t&&null!==t)(r=e)&&"sel"in r&&"data"in r&&"children"in r&&"text"in r?e:qr(o=e)?{text:o,sel:void 0,data:void 0,children:void 0,elm:void 0,key:void 0}:void 0;var o,r;return t.push(n),t}),[]),ys=(t=>(e,n,...o)=>{void 0===e&&(e="UNDEFINED",console.error("[Sygnal SYG420] JSX: A JSX tag is undefined, so <UNDEFINED> is rendered instead. Import or define the component in this file. https://sygnal.js.org/reference/errors#syg420"));const r="function"==typeof e;if(r){if(e.__sygnalFragment||"Fragment"===e.name)return e(n||{},o);if(n||(n={}),e.isSygnalComponent){const t=e;e=e.componentName||e.label||e.name||"sygnal-factory",n.sygnalFactory=t}else{const r=e.componentName||e.label||e.name||"FUNCTION_COMPONENT",s=e,{model:i,intent:a,hmrActions:c,context:l,peers:u,components:d,initialState:h,isolatedState:p,calculated:f,storeCalculatedInState:m,DOMSourceName:y,stateSourceName:_,onError:v,debug:g,preventInstantiation:S}=e;if(S)return ds({sel:r,data:n?ps(n,t):{},children:ms(o),text:void 0,elm:void 0,key:n?n.key:void 0});const b={name:r,view:s,model:i,intent:a,hmrActions:c,context:l,peers:u,components:d,initialState:h,isolatedState:p,calculated:f,storeCalculatedInState:m,DOMSourceName:y,stateSourceName:_,onError:v,debug:g};n.sygnalOptions=b,e=r}}const s=r?void 0:fs(o);return ds({sel:e,data:n?ps(n,t):{},children:void 0!==s?void 0:ms(o),text:s,elm:void 0,key:n?n.key:void 0})})({attrs:"",props:"",class:"",data:"dataset",style:"",hook:"",on:""});const _s=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),vs={"&":"&","<":"<",">":">",'"':""","'":"'"};function gs(t){return String(t).replace(/[&<>"']/g,(t=>vs[t]))}function Ss(t){return t.replace(/^(Webkit|Moz|Ms|O)/,(t=>"-"+t.toLowerCase())).replace(/([A-Z])/g,"-$1").toLowerCase()}function bs(t,e={}){const{state:n,props:o={},context:r={},hydrateState:s}=e,i=void 0!==n?n:t.initialState,a=t.context||{},c={...r};for(const t of Object.keys(a)){const e=a[t];if("function"==typeof e&&null!=i)try{c[t]=e(i)}catch(t){}}let l;try{l=t({...o,state:i,children:o.children||[],slots:o.slots||{},context:c,peers:{}},i,c,{})}catch(e){if("function"==typeof t.onError){const n=t.componentName||t.name||"Component";try{l=t.onError(e,{componentName:n})}catch(t){l={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}}else l={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}l||(l={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0}),l=ws(l,c,i);let u=As(l);if(s&&null!=i){const t="string"==typeof s?s:"__SYGNAL_STATE__";gs(JSON.stringify(i)),u+=`<script>window.${t}=${JSON.stringify(i)}<\/script>`}return u}function ws(t,e,n){if(!t)return t;if("string"==typeof t||null!=t.text)return t;const o=t.sel;if(!o&&t.children&&Array.isArray(t.children))return t.children=t.children.map((t=>ws(t,e,n))).filter((t=>null!=t)),t;if("portal"===o){const o=t.children||[];return 0===o.length?null:1===o.length?ws(o[0],e,n):{sel:"div",data:{attrs:{"data-sygnal-portal":""}},children:o.map((t=>ws(t,e,n))),text:void 0,elm:void 0,key:void 0}}if("transition"===o){const o=(t.children||[])[0];return o?ws(o,e,n):null}if("suspense"===o){const o=t.children||[];return 0===o.length?null:1===o.length?ws(o[0],e,n):{sel:"div",data:{attrs:{"data-sygnal-suspense":"resolved"}},children:o.map((t=>ws(t,e,n))),text:void 0,elm:void 0,key:void 0}}if("clientonly"===o){const o=(t.data?.props||{}).fallback;return o?ws(o,e,n):{sel:"div",data:{attrs:{"data-sygnal-clientonly":""}},children:[],text:void 0,elm:void 0,key:void 0}}if("slot"===o){const o=t.children||[];return 0===o.length?null:1===o.length?ws(o[0],e,n):{sel:"div",data:{},children:o.map((t=>ws(t,e,n))),text:void 0,elm:void 0,key:void 0}}const r=t.data?.props||{};return r.sygnalOptions||"function"==typeof r.sygnalFactory?function(t,e,n){const o=t.data?.props||{},{sygnalOptions:r,sygnalFactory:s,...i}=o;let a;if(r)a=r.view,!a.initialState&&r.initialState&&(a=Object.assign(a,{initialState:r.initialState,model:r.model,intent:r.intent,context:r.context,onError:r.onError,calculated:r.calculated}));else if(s&&s.componentName)return{sel:"div",data:{attrs:{"data-sygnal-ssr":t.sel||"component"}},children:t.children||[],text:void 0,elm:void 0,key:void 0};if(!a||"function"!=typeof a)return{sel:"div",data:{attrs:{"data-sygnal-ssr":t.sel||"component"}},children:t.children||[],text:void 0,elm:void 0,key:void 0};let c=a.initialState;const l=i.state;"string"==typeof l&&null!=n&&null!=n[l]?c=n[l]:null!=l&&"string"!=typeof l&&(c=l);const u={...e},d=a.context||{};for(const t of Object.keys(d)){const e=d[t];if("function"==typeof e&&null!=c)try{u[t]=e(c)}catch(t){}}const h={},p=[],f=t.children||[];for(const t of f)if(t&&"slot"===t.sel){const e=t.data?.props?.name||"default";h[e]||(h[e]=[]);const n=t.children||[];h[e].push(...n)}else p.push(t);p.length>0&&(h.default||(h.default=[]),h.default.push(...p));let m;try{m=a({...i,state:c,children:h.default||f,slots:h,context:u,peers:{}},c,u,{})}catch(t){if("function"==typeof a.onError){const e=a.componentName||a.name||"Component";try{m=a.onError(t,{componentName:e})}catch(t){m={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}}else m={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}m||(m={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0});return ws(m,u,c)}(t,e,n):"collection"===o?function(t,e,n){const o=t.data?.props||{},{of:r,from:s,className:i}=o;if(!r||!s||!n)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};const a=n[s];if(!Array.isArray(a))return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};const c=a.map(((t,n)=>{const o={...e},s=r.context||{};for(const e of Object.keys(s)){const n=s[e];if("function"==typeof n)try{o[e]=n(t)}catch(t){}}let i;try{i=r({state:t,children:[],slots:{},context:o,peers:{}},t,o,{})}catch(t){if("function"==typeof r.onError)try{i=r.onError(t,{componentName:r.name||"CollectionItem"})}catch(t){i={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}else i={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}return ws(i,o,t)})).filter((t=>null!=t)),l={};i&&(l.props={className:i});return{sel:"div",data:l,children:c,text:void 0,elm:void 0,key:void 0}}(t,e,n):"switchable"===o?function(t,e,n){const o=t.data?.props||{},{components:r,active:s,initial:i}=o;if(!r)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};let a;"string"==typeof s&&(r[s]?a=s:n&&"string"==typeof n[s]&&(a=n[s]));!a&&i&&(a=i);a||(a=Object.keys(r)[0]);const c=r[a];if(!c||"function"!=typeof c)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};return function(t,e,n){const o=void 0!==e?e:t.initialState,r=t.context||{},s={...n};for(const t of Object.keys(r)){const e=r[t];if("function"==typeof e&&null!=o)try{s[t]=e(o)}catch(t){}}let i;try{i=t({state:o,children:[],slots:{},context:s,peers:{}},o,s,{})}catch(e){if("function"==typeof t.onError)try{i=t.onError(e,{componentName:t.name||"Component"})}catch(t){i={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}else i={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}i||(i={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0});return ws(i,s,o)}(c,n,e)}(t,e,n):(t.children&&(Array.isArray(t.children)?t.children.length>0&&(t.children=t.children.map((t=>ws(t,e,n))).filter((t=>null!=t))):t.children&&"object"==typeof t.children&&(t.children=ws(t.children,e,n))),t)}function As(t){if(null==t)return"";if("string"==typeof t)return gs(t);if(null!=t.text&&!t.sel)return gs(String(t.text));const e=t.sel;if(!e)return null!=t.text?gs(String(t.text)):t.children&&Array.isArray(t.children)?t.children.map((t=>As(t))).join(""):"";const{tag:n,id:o,selectorClasses:r}=function(t){let e=t,n=null;const o=[],r=t.indexOf("#");if(-1!==r){const s=t.slice(r+1),i=s.indexOf(".");if(-1!==i){n=s.slice(0,i),e=t.slice(0,r);const a=s.slice(i+1);a&&o.push(...a.split("."))}else n=s,e=t.slice(0,r)}else{const n=t.indexOf(".");if(-1!==n){e=t.slice(0,n);const r=t.slice(n+1);r&&o.push(...r.split("."))}}e||(e="div");return{tag:e,id:n,selectorClasses:o}}(e),s=function(t,e,n){const o=[],r=[...n];if(t.props)for(const[e,n]of Object.entries(t.props))"className"===e?"string"==typeof n&&n&&r.push(n):"htmlFor"===e?o.push(["for",n]):"innerHTML"===e||"textContent"===e||"sygnalOptions"===e||"sygnalFactory"===e||("boolean"==typeof n?n&&o.push([e,!0]):null!=n&&o.push([e,n]));if(t.attrs)for(const[e,n]of Object.entries(t.attrs))"class"===e?"string"==typeof n&&n&&r.push(n):"boolean"==typeof n?n&&o.push([e,!0]):null!=n&&o.push([e,n]);if(t.class)for(const[e,n]of Object.entries(t.class))n&&r.push(e);if(t.dataset)for(const[e,n]of Object.entries(t.dataset))null!=n&&o.push([`data-${Ss(e)}`,n]);e&&o.unshift(["id",e]);if(r.length>0){const t=[...new Set(r)];o.unshift(["class",t.join(" ")])}if(t.style&&"object"==typeof t.style){const e=function(t){const e=[];for(const n of Object.keys(t)){const o=t[n];if(null==o||""===o)continue;if("delayed"===n||"remove"===n||"destroy"===n)continue;const r=Ss(n);e.push(`${r}: ${o}`)}return e.join("; ")}(t.style);e&&o.push(["style",e])}return o}(t.data||{},o,r);let i=`<${n}`;for(const[t,e]of s)!0===e?i+=` ${t}`:!1!==e&&null!=e&&(i+=` ${t}="${gs(String(e))}"`);if(i+=">",_s.has(n))return i;if(null!=t.data?.props?.innerHTML)return i+=String(t.data.props.innerHTML),i+=`</${n}>`,i;if(null!=t.text)i+=gs(String(t.text));else if(t.children){const e=Array.isArray(t.children)?t.children:[t.children];for(const t of e)i+=As(t)}return i+=`</${n}>`,i}const Es=t=>t.startsWith(".___"),Ns=t=>Os(t.filter((t=>!Es(t))).join(" ")),Os=t=>t.trim().replace(/\s*>\s*/g," > ").replace(/\s+/g," "),Cs=/^(document|body)(\s+|$)/,Ts=t=>{const e={};for(const n in t)null!=t[n]&&(e[n]=String(t[n]));return e},ks="tag, *, .class, #id, [attr], [attr=\"v\"] (also ^= $= *= ~=), :first-child, :last-child, :only-child, :nth-child(an+b|odd|even), :nth-last-child(), :first-of-type, :last-of-type, :only-of-type, :nth-of-type(), :nth-last-of-type(), :not(...), the descendant (' ') and child ('>') combinators, ',' lists",$s=/^(?:[\w-]|\\.)+/,xs=t=>t.replace(/\\(.)/g,"$1"),Ls=new Map;function Ds(t){let e=Ls.get(t);if(!e){try{e=function(t){let e=0;const n=e=>{const n=new Error(`[Sygnal] Unsupported selector syntax in '${t}': ${e}. Supported: ${ks}. Or give the element an attribute and select it, e.g. [data-id="3"]`);throw n.unsupported=!0,n},o=()=>{const n=t.slice(e).match(/^\s*/)[0].length;return e+=n,n>0},r=o=>{const r=t.slice(e).match($s);return r?(e+=r[0].length,xs(r[0])):n(`expected ${o} at '${t.slice(e)||"end"}'`)},s=t=>{const e=t.trim().toLowerCase().replace(/\s+/g,"");if("odd"==e)return[2,1];if("even"==e)return[2,0];if(/^[+-]?\d+$/.test(e))return[0,+e];const o=e.match(/^([+-]?\d*)n([+-]\d+)?$/);return o?[""==o[1]||"+"==o[1]?1:"-"==o[1]?-1:+o[1],o[2]?+o[2]:0]:n(`'${t}' is not an+b`)},i=()=>{const o={cls:[],attrs:[],ps:[]},i=e;for("*"==t[e]?e++:$s.test(t.slice(e))&&(o.tag=r("tag").toLowerCase());;){const i=t[e];if("."==i)e++,o.cls.push(r("a class name"));else if("#"==i)e++,o.id=r("an id");else if("["==i){const r=t.slice(e).match(/^\[\s*((?:[\w-]|\\.)+)\s*(?:([~^$*|]?=)\s*(?:"([^"]*)"|'([^']*)'|((?:[\w-]|\\.)+))\s*)?\]/);if(!r)return n(`attribute selector '${t.slice(e)}'`);"|="==r[2]&&n("the '|=' attribute operator"),e+=r[0].length,o.attrs.push([xs(r[1]),r[2]||"",r[2]?r[3]??r[4]??xs(r[5]):void 0])}else{if(":"!=i)break;{":"==t[e+1]&&n("pseudo-elements"),e++;const i=r("a pseudo-class").toLowerCase();let a;if("("==t[e]){let o=0,r=e;for(;r<t.length;r++)if("("==t[r])o++;else if(")"==t[r]&&! --o)break;r>=t.length&&n(`unclosed ':${i}('`),a=t.slice(e+1,r),e=r+1}const c={k:i,a:0,b:1},l=i.match(/^(?:(first|last|only)|nth(-last)?)-(child|of-type)$/);l&&void 0===a==!!l[1]?(c.type="of-type"==l[3],"only"==l[1]?c.k="only":l[1]?c.last="last"==l[1]:(/\bof\b/.test(a)&&n(`':${i}(... of S)'`),[c.a,c.b]=s(a),c.last=!!l[2])):"not"==i&&void 0!==a?(c.not=Ds(a),c.not.some((t=>t.parts.length>1))&&n("combinators inside ':not()'")):n(`':${i}${void 0===a?"":"("+a+")"}'`),o.ps.push(c)}}}return e==i&&n(`unexpected '${t[e]||"end of selector"}'`),o},a=[];if(o(),e>=t.length)return a;for(;;){const r={parts:[i()],combs:[]};for(;;){const s=o(),a=t[e];if(e>=t.length||","==a)break;"+"!=a&&"~"!=a||n(`the '${a}' combinator`),">"==a?(e++,o(),r.combs.push(">")):s?r.combs.push(" "):n(`unexpected '${a}'`),r.parts.push(i())}if(a.push(r),e>=t.length)return a;e++,o()}}(t)}catch(t){e=t}Ls.set(t,e)}if(e instanceof Error)throw e;return e}const Gs=t=>{try{return Ds(t)}catch(t){return}};function js(t){const e=[];for(const n of[].concat(t.children||[]))n&&"object"==typeof n&&(n.sel?"!"!=n.sel&&e.push(n):n.children&&e.push(...js(n)));return e}const Is=new WeakMap;const Ms=t=>t.sel.split(/[.#]/)[0].toLowerCase();function Ps(t,e){const n=(t,o,r)=>{if(r<0||!function(t,e){const n=t.data||{},o=n.props||{},r=n.attrs||{},[s,...i]=t.sel.split("."),[a,c]=s.split("#");if(e.tag&&a.toLowerCase()!=e.tag)return!1;const l=c||o.id||r.id;if(void 0!==e.id&&l!=e.id)return!1;if(e.cls.length){const t=i.concat(`${o.className||""} ${r.class||""}`.split(" "),Object.keys(n.class||{}).filter((t=>n.class[t])));if(!e.cls.every((e=>t.includes(e))))return!1}for(const[t,s,i]of e.attrs){const e="id"==t?l:t in r?r[t]:t in o?o[t]:t.startsWith("data-")?Ts(n.dataset)[t.slice(5).replace(/-(\w)/g,((t,e)=>e.toUpperCase()))]:void 0;if(null==e||!1===e)return!1;const a=String(e);if(s&&!("="==s?a==i:i&&("^="==s?a.startsWith(i):"$="==s?a.endsWith(i):"*="==s?a.includes(i):a.split(/\s+/).includes(i))))return!1}for(const n of e.ps){if(n.not){if(Ps(n.not,[t]))return!1;continue}let e=(Is.get(t)||{sibs:[t]}).sibs;if(n.type&&(e=e.filter((e=>Ms(e)==Ms(t)))),"only"==n.k){if(1!=e.length)return!1;continue}const o=e.indexOf(t),r=n.last?e.length-o:o+1;if(0==n.a?r!=n.b:(r-n.b)/n.a<0||(r-n.b)%n.a!=0)return!1}return!0}(e[r],t.parts[o]))return!1;if(0==o)return!0;if(">"==t.combs[o-1]){const s=Is.get(e[r]);return r>0&&(!s||e[r-1]===s.p)&&n(t,o-1,r-1)}for(let e=r-1;e>=0;e--)if(n(t,o-1,e))return!0;return!1};return t.some((t=>n(t,t.parts.length-1,e.length-1)))}function Ys(t,e,n=[]){if(!t||"object"!=typeof t)return;const o=t.sel?n.concat(t):n;if(t.sel&&Ps(e,o))return o;for(const n of[].concat(t.children||[],t.data?.portalChildren||[])){const t=Ys(n,e,o);if(t)return t}}let Rs=0;let Fs,Bs;function Us(t,e){return"function"==typeof e?(n,o,r,s)=>({type:t,data:e(n,o,r,s)}):()=>({type:t,data:e})}const Vs=zo;function Ws(t,e){const n=(t,n)=>e.dispatchEvent(new CustomEvent("data",{detail:{type:t,data:n}}));t.addEventListener("statechange",(()=>{"installed"===t.state&&n("installed",!0),"activated"===t.state&&n("activated",!0)})),"installed"===t.state&&n("waiting",t),"activated"===t.state&&n("activated",!0)}let Hs;const zs=Vs.create({start(t){if("undefined"==typeof window)return void t.next(!0);t.next(navigator.onLine);const e=()=>t.next(!0),n=()=>t.next(!1);window.addEventListener("online",e),window.addEventListener("offline",n),Hs=()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}},stop(){Hs?.(),Hs=void 0}});class qs{constructor(t,e){this.out=t,this.op=e}_n(t){this.out._n(t)}_e(t){this.out._e(t)}_c(){this.op.less()}}class Js{constructor(t){this.ins=t,this.type="flattenConcurrently",this.active=1,this.out=null}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this),this.active=1,this.out=null}less(){0==--this.active&&this.out&&this.out._c()}_n(t){this.out&&(this.active++,t._add(new qs(this.out,this)))}_e(t){this.out&&this.out._e(t)}_c(){this.less()}}class Zs{constructor(t){this.ins=t,this.type="flattenSequentially",this.out=null,this.open=!0,this.active=null,this.activeIL=null,this.seq=[]}_start(t){this.out=t,this.open=!0,this.active=null,this.activeIL=new qs(t,this),this.seq=[],this.ins._add(this)}_stop(){this.ins._remove(this),this.active&&this.activeIL&&this.active._remove(this.activeIL),this.open=!0,this.active=null,this.activeIL=null,this.seq=[],this.out=null}less(){this.active=null,this.seq.length>0&&this._n(this.seq.shift()),this.open||this.active||this.out._c()}_n(t){this.out&&(this.active?this.seq.push(t):(this.active=t,t._add(this.activeIL)))}_e(t){this.out&&this.out._e(t)}_c(){this.out&&(this.open=!1,this.active||0!==this.seq.length||this.out._c())}}t.ABORT=dr,t.Collection=Ho,t.MainDOMSource=co,t.MockedDOMSource=Po,t.Portal=Dr,t.Slot=Ir,t.Suspense=jr,t.Switchable=Ko,t.Transition=Gr,t.classes=function(...t){return t.reduce(((t,e)=>{var n,o;return"string"!=typeof e||t.includes(e)?Array.isArray(e)?t.push(...(o=e,o.map(zr).flat())):"object"==typeof e&&t.push(...(n=e,Object.entries(n).filter((([t,e])=>"function"==typeof e?e():!!e)).map((([t,e])=>{const n=t.trim();if(!Hr(n))throw new Error(`${n} is not a valid CSS class name`);return n})))):t.push(...zr(e)),t}),[]).join(" ")},t.clearDiagnostics=function(){Yn=[]},t.collection=Wo,t.component=fr,t.concat=me,t.createCommand=function(){const t={next:()=>{}},e={send:(n,o)=>{t.next({type:n,data:o}),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onCommandSent(n,o,e._targetComponentId,e._targetComponentName)},_stream:zo.create({start(e){t.next=t=>e.next(t)},stop(){t.next=()=>{}}}),__sygnalCommand:!0};return e},t.createElement=ys,t.createInstallPrompt=function(){let t=null;const e=new EventTarget;return"undefined"!=typeof window&&(window.addEventListener("beforeinstallprompt",(n=>{n.preventDefault(),t=n,e.dispatchEvent(new CustomEvent("data",{detail:{type:"beforeinstallprompt",data:!0}}))})),window.addEventListener("appinstalled",(()=>{t=null,e.dispatchEvent(new CustomEvent("data",{detail:{type:"appinstalled",data:!0}}))}))),{select(t){let n;return ue(Vs.create({start:o=>{n=({detail:e})=>{e.type===t&&o.next(e.data)},e.addEventListener("data",n)},stop:()=>{n&&e.removeEventListener("data",n)}}))},prompt:()=>t?.prompt()}},t.createRef=function(){return{current:null}},t.createRef$=function(){const t={next:()=>{}},e=zo.createWithMemory({start(e){t.next=t=>e.next(t)},stop(){t.next=()=>{}}});return new Proxy({current:null,stream:e},{set:(e,n,o)=>"current"===n?(e.current=o,t.next(o),!0):(e[n]=o,!0)})},t.debounce=ve,t.delay=be,t.driverFromAsync=function(t,e={}){const{selector:n="category",args:o="value",return:r="value",pre:s=(t=>t),post:i=(t=>t)}=e,a=t.name||"[anonymous function]",c=typeof o;if(!("string"===c||"function"===c||Array.isArray(o)&&o.every((t=>"string"==typeof t))))throw new Error(`The 'args' option for driverFromAsync(${a}) must be a string, array of strings, or a function. Received ${c}`);if("string"!=typeof n)throw new Error(`The 'selector' option for driverFromAsync(${a}) must be a string. Received ${typeof n}`);return e=>{let c=null;const l=ce.create({start:t=>{c=t.next.bind(t)},stop:()=>{}}),u=new Set,d=(t,e)=>void 0===t||("function"==typeof t?t(e):e?.[n]===t);let h=!1;return e.addListener({next:e=>{const l=s(e);let h=[];if("object"==typeof l&&null!==l){if("function"==typeof o){const t=o(l);h=Array.isArray(t)?t:[t]}"string"==typeof o&&(h=[l[o]]),Array.isArray(o)&&(h=o.map((t=>l[t])))}const p=`Error in driver created using driverFromAsync(${a})`;t(...h).then((t=>{return null!=(n=t)&&"function"==typeof n.then?t.then((t=>i(t,e))):i(t,e);var n})).then((t=>{let o;if(void 0===r)o=t,"object"==typeof o&&null!==o?o[n]=e[n]:console.warn(`The 'return' option for driverFromAsync(${a}) was not set, but the promise returned an non-object. The result will be returned as-is, but the '${n}' property will not be set, so will not be filtered by the 'select' method of the driver.`);else{if("string"!=typeof r)throw new Error(`The 'return' option for driverFromAsync(${a}) must be a string. Received ${typeof r}`);o={[r]:t,[n]:e[n]}}return o})).then((t=>{try{c(t)}catch(t){console.error(`${p}: ${t}`)}}),(t=>{const o={error:t,[n]:e?.[n],request:e};let r=!1;u.forEach((t=>{let e=!1;try{e=d(t.selector,o)}catch(t){}e&&(r=!0,t.listener.next(o))})),r||console.error(`${p}: ${t}`)}))},error:t=>{console.error(`Error received from sink stream in driver created using driverFromAsync(${a}):`,t)},complete:()=>{h||console.warn(`Unexpected completion of sink stream to driver created using driverFromAsync(${a})`)}}),{dispose:()=>{h=!0},select:t=>((t,e)=>void 0===e?t:t.filter((t=>d(e,t))))(l,t),errors:t=>{let e;return ce.create({start:n=>{u.add(e={listener:n,selector:t})},stop:()=>{u.delete(e)}})}}}},t.dropRepeats=Ee,t.emit=function(t,e){return{EVENTS:Us(t,e)}},t.enableHMR=function(t,e,n,o){if(!t||"function"!=typeof t.hmr)return t;if(!e||"function"!=typeof e.accept)return t;let r=!1;const s=e=>{Promise.resolve((async e=>{if(r)return;r=!0;const o=Array.isArray(e)?e.find(Boolean):e;try{let e=Wr(o);if(e||"function"!=typeof n||(e=Wr(await n())),e){const n=t?.sources?.STATE?.stream?._v;t.hmr(e,n)}}finally{r=!1}})(e)).catch((()=>{}))};return void 0!==o&&e.accept(o,s),e.accept(s),"function"==typeof e.dispose&&"function"==typeof t.dispose&&e.dispose((()=>t.dispose())),t},t.event=Us,t.exactState=function(){return t=>t},t.flattenConcurrently=function(t){return new re(new Js(t))},t.flattenSequentially=function(t){return new re(new Zs(t))},t.getDevTools=Vr,t.getDiagnostics=Jn,t.h=ze,t.lazy=function(t){let e=null,n=null;function o(t){return n?{sel:"div",data:{attrs:{"data-sygnal-error":"lazy"}},children:[],text:void 0,elm:void 0,key:void 0}:e?e(t):{sel:"div",data:{attrs:{"data-sygnal-lazy":"loading"}},children:[],text:void 0,elm:void 0,key:void 0}}const r=t().then((t=>{e=t.default||t,o.__sygnalLazyLoadedComponent=e;const n=["model","intent","hmrActions","context","peers","components","initialState","calculated","storeCalculatedInState","DOMSourceName","stateSourceName","onError","debug","componentName"];for(const t of n)void 0!==e[t]&&void 0===o[t]&&(o[t]=e[t])})).catch((t=>{n=t,console.error("[lazy] Failed to load component:",t)}));return o.__sygnalLazy=!0,o.__sygnalLazyLoaded=()=>null!==e,o.__sygnalLazyLoadedComponent=null,o.__sygnalLazyPromise=r,o.__sygnalLazyReRenderScheduled=!1,o},t.makeDOMDriver=Io,t.makeDragDriver=function(){return function(t){const e=new Map,n=new EventTarget,o=[];let r=null;const s=t=>{if(!t?.category)return;const n=e.get(t.category)??{};e.set(t.category,{...n,...t})};t.subscribe({next(t){(t?.configs??(Array.isArray(t)?t:[t])).forEach(s)},error(){},complete(){}});const i=(t,e)=>n.dispatchEvent(new CustomEvent(t,{detail:e})),a=(t,e)=>{document.addEventListener(t,e),o.push([t,e])};a("dragstart",(t=>{const n=t;for(const[t,o]of e){if(!o.draggable)continue;const e=n.target.closest(o.draggable);if(e){if(r=t,n.dataTransfer.effectAllowed="move",o.dragImage){const t=e.closest(o.dragImage);if(t){const e=t.getBoundingClientRect();n.dataTransfer.setDragImage(t,n.clientX-e.left,n.clientY-e.top)}}return void i(`${t}:dragstart`,{element:e,dataset:{...e.dataset}})}}})),a("dragend",(()=>{r&&(i(`${r}:dragend`,null),r=null)})),a("dragover",(t=>{const n=t;for(const[,t]of e)if(t.dropZone&&(!r||!t.accepts||t.accepts===r)&&n.target.closest(t.dropZone))return void n.preventDefault()})),a("drop",(t=>{const n=t;for(const[t,o]of e){if(!o.dropZone)continue;if(r&&o.accepts&&o.accepts!==r)continue;const s=n.target.closest(o.dropZone);if(!s)continue;n.preventDefault();let a=null;const c=r?e.get(r):null;return c?.draggable&&(a=n.target.closest(c.draggable)??null),void i(`${t}:drop`,{dropZone:s,insertBefore:a})}}));const c={select:t=>({events(e){const o=`${t}:${e}`;let r;return Mr(ce.create({start(t){r=({detail:e})=>t.next(e),n.addEventListener(o,r)},stop(){r&&n.removeEventListener(o,r)}}))}}),dragstart:t=>c.select(t).events("dragstart"),dragend:t=>c.select(t).events("dragend"),drop:t=>c.select(t).events("drop"),dragover:t=>c.select(t).events("dragover"),dispose(){o.forEach((([t,e])=>document.removeEventListener(t,e)))}};return c}},t.makeServiceWorkerDriver=function(t,e={}){return function(n){const o=new EventTarget;return"undefined"!=typeof navigator&&"serviceWorker"in navigator&&(navigator.serviceWorker.register(t,{scope:e.scope}).then((t=>{const e=(t,e)=>o.dispatchEvent(new CustomEvent("data",{detail:{type:t,data:e}}));t.installing&&Ws(t.installing,o),t.waiting&&e("waiting",t.waiting),t.active&&e("activated",!0),t.addEventListener("updatefound",(()=>{t.installing&&Ws(t.installing,o)})),navigator.serviceWorker.addEventListener("controllerchange",(()=>{e("controlling",!0)})),navigator.serviceWorker.addEventListener("message",(t=>{e("message",t.data)}))})).catch((t=>{o.dispatchEvent(new CustomEvent("data",{detail:{type:"error",data:t}}))})),n.addListener({next:t=>{"skipWaiting"===t.action?navigator.serviceWorker.ready.then((t=>{t.waiting&&t.waiting.postMessage({type:"SKIP_WAITING"})})):"postMessage"===t.action?navigator.serviceWorker.ready.then((e=>{e.active&&e.active.postMessage(t.data)})):"unregister"===t.action&&navigator.serviceWorker.ready.then((t=>t.unregister()))},error:t=>console.error("[SW driver] Error in sink stream:",t)})),{select(t){let e;return ue(Vs.create({start:n=>{e=({detail:e})=>{t&&e.type!==t||n.next(e.data)},o.addEventListener("data",e)},stop:()=>{e&&o.removeEventListener("data",e)}}))}}}},t.mockDOMSource=Yo,t.onDiagnostic=Zn,t.onlineStatus$=zs,t.portal=Dr,t.processDrag=function({draggable:t,dropZone:e}={},n={}){if(t&&"function"!=typeof t.events)throw new Error("processDrag: draggable must have an .events() method (e.g. DOM.select(...))");if(e&&"function"!=typeof e.events)throw new Error("processDrag: dropZone must have an .events() method (e.g. DOM.select(...))");const{effectAllowed:o="move"}=n;return{dragStart$:t?t.events("dragstart").map((t=>(t.dataTransfer.effectAllowed=o,t))):ce.never(),dragEnd$:t?t.events("dragend").mapTo(null):ce.never(),dragOver$:e?e.events("dragover").map((t=>(t.preventDefault(),null))):ce.never(),drop$:e?e.events("drop").map((t=>(t.preventDefault(),t))):ce.never()}},t.processForm=function(t,e={}){if(!t||"function"!=typeof t.events)throw new Error("processForm: first argument must have an .events() method (e.g. DOM.select(...))");let{events:n=["input","submit"],preventDefault:o=!0}=e;"string"==typeof n&&(n=[n]);const r=n.map((e=>t.events(e)));return ce.merge(...r).map((t=>{o&&t.preventDefault();const e="submit"===t.type?t.srcElement:t.currentTarget,n=new FormData(e),r={event:t,eventType:t.type},s=e.querySelector("input[type=submit]:focus");if(s){const{name:t,value:e}=s;r[t||"submit"]=e}for(const[t,e]of n.entries())r[t]=e;return r}))},t.renderComponent=function(t,e={}){const{initialState:n,mockConfig:o={},drivers:r={},diagnostics:s,strict:i}=e,{intent:a,model:c={}}=t,l=Vn(),u=globalThis.__SYGNAL_DIAGNOSTICS__;Rs++||(Fs={mode:jn,ignore:[...Pn]},Bs=u.strict,u.resetOnce?.()),Un({mode:s||("off"==l?"collect":l)}),void 0!==i&&(u.strict=i);const d=[],h=Zn((t=>d.push(t))),p=t.name||t.componentName||"TestComponent",f=new Map,m=new Map;let y=!1;const _=new Map([["",p]]),v=new Map,g={},S=new Set,b=t=>{const e=t&&t.sources&&t.sources[t.DOMSourceName||"DOM"];return e&&e._hub===j.$&&(e._path||[]).filter(Es).pop()};let w=0,A=Date.now();const E=()=>{w++,A=Date.now()},N=Xn({id:"renderComponent",onRender:E,onReducer:E,onIntent(t){E();const e=b(t);e&&_.set(e,t.name),t.sources[t.DOMSourceName||"DOM"]?._hub==j.$&&v.set(e||"",t._componentNumber)},onDispose(t){const e=b(t);e&&(_.delete(e),v.delete(e),f.forEach(((t,n)=>{t.filter(Es).pop()==e&&f.delete(n)})))}}),O=(t,e,n,o,r)=>{try{qn(t,{component:e,message:n,fix:o,data:r})}catch(t){setTimeout((()=>{throw t}))}};let C,T=!1;const k=(t,e,n)=>{let o,r=!1,s=!n;const i=Gs(Array.isArray(t)?t.join(" "):t);if(!i||!i.length)return{own:r,child:o,hit:!1};const a=(t,e)=>Ps(i,e),c=(t,i,l,u,d)=>{if(!t||!t.sel||r)return;const h=(t.sel.match(/\.___[^.#]+/)||[])[0]||l,p=i.concat([[t,h]]);(u=u||h==e)&&(h==e?a(0,p.filter((t=>t[1]==e)).map((t=>t[0])))&&(r=!0):(d=d||h,a(0,p.map((t=>t[0])))&&(o=o||d,t===n&&(s=!0))));for(const n of[].concat(t.children||[]))c(n,p,h,u,h==e?void 0:d)};return c(dt,[],void 0,!e,void 0),{own:r,child:o,hit:s}},$=t=>{dt&&Mn&&(t||dt!==C||T)&&(t||(C=dt,T=!1),f.forEach((e=>{const n=Ns(e),o=e.filter(Es).pop(),r=_.get(o||"")||"Component",s=r+"\0"+n;if(!n||Cs.test(n)||S.has(s))return;const{own:i,child:a,hit:c}=k(n,o,t);if(i)return S.add(s);if(!a||!c)return;S.add(s);const l=_.get(a)||"a child component";O("SYG104",r,`DOM.select('${n}') in ${r} matches elements inside ${l} (isolated), so ${r} never receives their events`,`Handle the event in ${l} and send it up with PARENT (read it here with CHILD.select(${l})), or use EVENTS`,{selector:n,child:l})})))},x=()=>{N(),h(),--Rs||(Un(Fs),u.strict=Bs)},L=()=>{},D=()=>{const t={emit:L,$:null};return t.$=zo.create({start:e=>{t.emit=t=>e.next(t)},stop:()=>{t.emit=L}}),t},G=D(),j=D(),I=Object.keys(c).map((t=>t.split("|")[0].trim())).filter((t=>"INITIALIZE"!=t)),M=t=>G.$.filter((e=>e.type==t)).map((t=>t.data)),{context:P,calculated:Y,storeCalculatedInState:R,onError:F,hmrActions:B,components:U}=t,V=void 0!==n?n:t.initialState,W=!a&&!Object.keys(c).length&&void 0===V,H=fr({name:t.name||t.componentName||"TestComponent",view:t,intent:W?void 0:t=>{const e=a?a(t):{};if(e&&"function"==typeof e.addListener)return zo.merge(e,G.$);const n={...e},o=I.filter((t=>!(t in n)));for(const t of new Set([...Object.keys(n),...o]))n[t]=n[t]?zo.merge(n[t],M(t)):M(t);return Object.defineProperty(n,"__sygnalTestActions",{value:o}),n},model:W?void 0:c,hmrActions:B,components:U,context:P,calculated:Y,storeCalculatedInState:R,onError:F,initialState:V}),z={DOM:()=>Yo(o,j.$,((t,e,n)=>{const o=t.join("\0");if(void 0===n)f.has(o)||(f.set(o,t),T=!0),(g[o]=g[o]||[]).push(e);else{const t=o+"\0"+e;m.set(t,(m.get(t)||0)+(n?1:-1)),n&&at(0)}})),EVENTS:Rr,LOG:Fr,...r};for(const t in c){const e=c[t],[,n]=t.split("|");for(const t of n?[n.trim()]:e&&"object"==typeof e?Object.keys(e):[])z[t]||/^(STATE|EFFECT|PARENT|READY)$/.test(t)||(z[t]=()=>({select:()=>zo.never()}))}let q,J,Z;try{const t=Yr(Be(H,"STATE"),z);({sources:q,sinks:J}=t),Z=t.run()}catch(t){throw x(),t}const X=[],K=(t,e)=>{const n={next:e,error:L,complete:L};t.addListener(n),X.push([t,n])},Q=[],tt=q.STATE?.stream||zo.never();K(tt,(t=>{Q.push(t),E()}));const et={},nt=t=>et[t]=et[t]||[];for(const t in J)"DOM"!=t&&"STATE"!=t&&"function"==typeof J[t]?.addListener&&K(J[t],(e=>nt(t).push("EVENTS"==t?{type:e.type,data:e.data}:"PARENT"==t?e.value:e)));const ot=[];let rt,st=!1;const it=()=>{if(st&&!y)for(;ot.length;){const t=ot[0];if(t.until=t.until||Date.now()+300,!t.go(Date.now()>=t.until))return at(5);ot.shift(),E()}},at=t=>{!rt&&ot.length&&(rt=setTimeout((()=>{rt=0,it()}),t))};let ct;const lt=new Promise((t=>{ct=()=>{st=!0,it(),t()}})),ut=(t,e)=>{ot.push({go:t,missing:e}),it()};let dt,ht,pt=0;const ft=()=>ht||(ht=setTimeout((()=>ct()),12));J.DOM&&K(J.DOM,(t=>{dt=t,function(t){if(!t||"object"!=typeof t)return;const e=t=>{for(const n of[js(t),js({children:t.data?.portalChildren||[]})])for(const o of n)Is.set(o,{p:t,sibs:n}),e(o)},n=t.sel?[t]:js(t);for(const t of n)Is.set(t,{p:void 0,sibs:n}),e(t)}(t),pt=Q.length,E(),$(),ft(),it()}));const mt=setTimeout(ft,J.DOM?30:0),yt=t=>new Promise((e=>setTimeout(e,t))),_t=async(t,e,n,o=(()=>!1))=>{const r=Date.now();let s=-1;for(;!y;){const i=Date.now()-A;if(Date.now()-r>n)return!1;if((!J.DOM||pt>=t||Date.now()-r>100)&&i>=e&&!o()){if(s===w)return!0;s=w,await yt(3)}else s=-1,await yt(Math.max(1,e-i))}return!0};let vt;const gt=new Set,St=()=>{const t=vt;return vt=void 0,t},bt=()=>{const t=St();if(t)throw t},wt=(t,e,n)=>{const o=Nt();return new Error(`[Sygnal] simulateEvent('${t}', '${e}'): the selector matched nothing in the rendered output`+(n?" (waited 300ms for it to render)":"")+'. Check t.html() to see what rendered, or give the element an attribute and select it, e.g. [data-id="3"]'+` (pass { allowMissing: true } to drop the event instead).\nRendered: ${o.length>600?o.slice(0,600)+"…":o||"(nothing)"}`)},At=(t,e,n,o)=>new Promise(((r,s)=>{const i=St();if(i)return s(i);const a=t=>{var e;clearTimeout(h),tt.removeListener(d),(e=t+1,_t(e,10,250)).then((()=>{gt.delete(l),r(Q[t])}))},c=t=>{try{return e(Q[t])}catch(t){return!1}},l=t=>{clearTimeout(h),tt.removeListener(d),gt.delete(l),s(t)};gt.add(l);const u=Q.length,d={next:()=>{Q.length>u&&c(Q.length-1)&&a(Q.length-1)},error:t=>l(t),complete:()=>l(new Error(`${o}: state stream completed without matching`))},h=setTimeout((()=>l(new Error(`${o} timed out after ${n}ms`))),n);for(let e=t;e<Q.length;e++)if(c(e))return a(e);tt.addListener(d)})),Et=t=>{if(!t||"object"!=typeof t||!t.sel)return t;let e=t.data;if(e?.isCollection){const{className:t,id:n}=e.props||{};e={...e,props:{className:t,id:n}}}return{...t,data:e,children:t.children&&t.children.map(Et)}},Nt=()=>dt?bs((()=>Et(dt))).replace(/ class="([^"]*)"/g,((t,e)=>(e=e.split(" ").filter((t=>!t.startsWith("___"))).join(" "))?` class="${e}"`:"")):"";return{state$:tt,dom$:J.DOM||zo.never(),events$:q.EVENTS||{select:()=>zo.never()},sinks:J,sources:q,simulateAction:(t,e)=>{bt(),ut((()=>(G.emit({type:t,data:e}),!0)))},simulateEvent:(t,e,n={})=>{bt();const{allowMissing:o,...r}=n,s=Os(String(t)),i=!s||Cs.test(s),a=i?[]:Ds(s);if(!i&&!o&&st&&!ot.length&&dt&&pt>=Q.length&&Date.now()-A>=20&&!Ys(dt,a))throw wt(t,e,!1);ut((c=>{const l=i?void 0:Ys(dt,a),u=l?.[l.length-1];if(!i&&!u)return!!c&&(o?(O("SYG103",p,`simulateEvent('${t}', '${e}') matched no rendered element within 300ms, so the event was dropped`,"Check the selector against the view's className/id, or wait until the element is rendered (await t.next(...) or t.settle())",{selector:t,type:e}),!0):((t=>{if(!gt.size)return void(vt=vt||t);const e=[...gt];gt.clear(),e.forEach((e=>e(t)))})(wt(t,e,!0)),!0));const d=t=>{let e=Ns(t);if(!l)return e==s;let n=l;if(Cs.test(e))e=e.replace(Cs,"");else{const e=t.filter(Es).pop();let o;n=l.filter((t=>{const n=t.sel.match(/\.___[^.#]+/);return n&&(o=n[0]),o==e}))}if(!e)return!0;const o=Gs(e);return!!o&&n.some(((t,e)=>Ps(o,n.slice(0,e+1))))};if(!c)for(const[t,n]of f)if((g[t]||[]).includes(e)&&!m.get(t+"\0"+e)&&d(n))return!1;u&&$(u);const h=u?.data||{},y=h.props||{},{target:_={},value:v,checked:S,dataset:b,data:w,...A}=r,E=y.value??h.attrs?.value,N={tagName:u?.sel.split(/[.#]/)[0].toUpperCase(),value:null==E?E:String(E),checked:y.checked??h.attrs?.checked,..."value"in n&&{value:v},..."checked"in n&&{checked:S},..._};if(N.dataset=Ts({...h.dataset,...b,...w,..._.dataset}),l&&!("closest"in _)){const t=t=>{const n=l[t];return{tagName:n.sel.split(/[.#]/)[0].toUpperCase(),dataset:Ts(n.data?.dataset),closest:e(t)}},e=e=>n=>{const o=Ds(String(n));for(let n=e;n>=0;n--)if(Ps(o,l.slice(0,n+1)))return n==l.length-1?N:t(n);return null};N.closest=e(l.length-1)}const C={type:e,target:N,currentTarget:N,ownerTarget:N,dataTransfer:{},preventDefault:L,stopPropagation:L,...A};return j.emit({type:e,event:C,match:d}),!0}),i||o?void 0:()=>Ys(dt,a)?void 0:wt(t,e,!1))},ready:()=>lt,waitForState:(t,e=2e3)=>At(0,t,e,"waitForState"),next:(t=(()=>!0),e=2e3)=>At(Q.length,t,e,"next"),settle:(t=2e3)=>new Promise(((e,n)=>{const o=St();if(o)return n(o);const r=t=>{gt.delete(r),t?n(t):e()};gt.add(r),(async()=>{if(await Promise.race([lt,yt(t)]),!await _t(Q.length,20,t,(()=>!st||ot.length>0)))throw new Error(`settle timed out after ${t}ms: ${ot.length?`${ot.length} simulated input(s) still pending`:"the component kept rendering"}`)})().then((()=>r()),r)})),states:Q,sinkValues:nt,emitted:nt("EVENTS"),diagnostics:d,expectNoDiagnostics:()=>{bt();const t=d.filter((t=>"info"!=t.severity));if(t.length)throw new Error(`Expected no diagnostics, got ${t.length}:\n`+t.map((t=>t.text)).join("\n"))},html:Nt,dispose:()=>{if(y)return;y=!0,clearTimeout(ht),clearTimeout(mt),clearTimeout(rt);const t=ot[0];t&&t.until&&t.missing&&!vt&&(vt=t.missing()),ot.length=0,X.forEach((([t,e])=>{try{t.removeListener(e)}catch(t){}}));try{J.__dispose?.()}catch(t){}Z(),x(),gt.clear(),bt()},inspect:()=>{if(!u.inspect)throw Error("[Sygnal] t.inspect() needs import 'sygnal/diagnostics'");return u.inspect({ids:[...v.values()],diagnostics:d,mock:{listeners:f,evTypes:g,owners:_,scopeIds:v,probe:k,vtree:dt}})}}},t.renderToString=bs,t.run=function t(e,n={},o={}){if("undefined"!=typeof window){Vr().init()}const{diagnostics:r}=o,s="string"==typeof r?{mode:r}:r||{};Un({mode:s.mode,ignore:s.ignore||[]});const{mountPoint:i="#root",fragments:a=!0,useDefaultDrivers:c=!0}=o;if(!e.isSygnalComponent){const t=e.name||e.componentName||e.label||"FUNCTIONAL_COMPONENT",n=e,{model:o,intent:r,hmrActions:s,context:i,peers:a,components:c,initialState:l,calculated:u,storeCalculatedInState:d,DOMSourceName:h,stateSourceName:p,onError:f,debug:m}=e;e=fr({name:t,view:n,model:o,intent:r,hmrActions:s,context:i,peers:a,components:c,initialState:l,calculated:u,storeCalculatedInState:d,DOMSourceName:h,stateSourceName:p,onError:f,debug:m})}"undefined"!=typeof window&&!0===window.__SYGNAL_HMR_UPDATING&&void 0!==window.__SYGNAL_HMR_PERSISTED_STATE&&(e.initialState=window.__SYGNAL_HMR_PERSISTED_STATE);const l=Be(e,"STATE"),u={...c?{EVENTS:Rr,DOM:Io(i,{snabbdomOptions:{experimental:{fragments:a}}}),LOG:Fr}:{},...n},{sources:d,sinks:h,run:p}=Yr(l,u),f=p();let m=null;"undefined"!=typeof window&&d?.STATE?.stream&&"function"==typeof d.STATE.stream.addListener&&(m={next:t=>{window.__SYGNAL_HMR_PERSISTED_STATE=t},error:()=>{},complete:()=>{}},d.STATE.stream.addListener(m));const y={sources:d,sinks:h,dispose:()=>{if(m&&d?.STATE?.stream&&"function"==typeof d.STATE.stream.removeListener&&(d.STATE.stream.removeListener(m),m=null),"function"==typeof h.__dispose)try{h.__dispose()}catch(t){}f()}};"undefined"!=typeof window&&(window.__SYGNAL_DEVTOOLS_APP__=y);const _=(r,s)=>{const i="undefined"!=typeof window?window.__SYGNAL_HMR_PERSISTED_STATE:void 0,a=void 0!==i?i:e.initialState,c=void 0===s?a:s;"undefined"!=typeof window&&(window.__SYGNAL_HMR_UPDATING=!0,window.__SYGNAL_HMR_STATE=c,window.__SYGNAL_HMR_PERSISTED_STATE=c),y.dispose();const l=r.default||r;l.initialState=c;const u=t(l,n,o);if(y.sources=u.sources,y.sinks=u.sinks,y.dispose=u.dispose,void 0!==c&&u?.sinks?.STATE&&"function"==typeof u.sinks.STATE.shamefullySendNext){const t=()=>u.sinks.STATE.shamefullySendNext((()=>({...c})));setTimeout(t,0),setTimeout(t,20)}"undefined"!=typeof window&&u?.sources?.STATE?.stream&&"function"==typeof u.sources.STATE.stream.setDebugListener?u.sources.STATE.stream.setDebugListener({next:()=>{u.sources.STATE.stream.setDebugListener(null),window.__SYGNAL_HMR_STATE=void 0,setTimeout((()=>{window.__SYGNAL_HMR_UPDATING=!1}),100)}}):"undefined"!=typeof window&&(window.__SYGNAL_HMR_STATE=void 0,window.__SYGNAL_HMR_UPDATING=!1)},v=t=>t?Array.isArray(t)?v(t.find(Boolean)):t.default&&"function"==typeof t.default?t:"function"==typeof t?{default:t}:null:null;return y.hmr=(t,n)=>{const o=v(t)||{default:e};if(void 0!==n)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=n),void _(o,n);const r="undefined"!=typeof window?window.__SYGNAL_HMR_PERSISTED_STATE:void 0;if(void 0!==r)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=r),void _(o,r);const s=y?.sources?.STATE?.stream?._v;if(void 0!==s)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=s),void _(o,s);y?.sinks?.STATE&&"function"==typeof y.sinks.STATE.shamefullySendNext?y.sinks.STATE.shamefullySendNext((t=>("undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=t),_(o,t),dr))):_(o)},y},t.sampleCombine=Te,t.set=function(t){return"function"==typeof t?(e,n,o,r)=>({...e,...t(e,n,o,r)}):e=>({...e,...t})},t.switchable=Zo,t.throttle=function(t){return function(e){return new re(new ge(t,e))}},t.thunk=function(t,e,n,o){return void 0===o&&(o=n,n=e,e=void 0),ze(t,{key:e,hook:{init:yn,prepatch:_n},fn:n,args:o})},t.toggle=function(t){return e=>({...e,[t]:!e[t]})},t.xs=zo}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Sygnal={})}(this,(function(t){"use strict";function e(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(n){if("default"!==n&&!(n in t)){var s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:function(){return e[n]}})}}))})),Object.freeze(t)}const n=Symbol.for("sygnal.ABORT"),s=t=>"symbol"==typeof t&&"sygnal.ABORT"==t.description,r=Symbol.for("sygnal.original"),o=t=>(t+"").replace(/\W|_/g,(t=>"_"+t.charCodeAt(0)+"_")),i=(t,e,n)=>{const s={viewTransitionName:t+"-"+o(e),viewTransitionClass:t};for(const t in n)void 0!==n[t]&&(s[t]=n[t]);return s},a=/^(__|(props|children|dispose|commands)\$$|(CHILD|PARENT|EFFECT|ELEMENT)$)/;function l(t,e,n,s,r){return{sel:t,data:e,children:n,text:s,elm:r,key:void 0===e?void 0:e.key}}const c=Array.isArray;function u(t){return"string"==typeof t||"number"==typeof t||t instanceof String||t instanceof Number}function h(t,e,n){if(t.ns="http://www.w3.org/2000/svg","foreignObject"!==n&&void 0!==e)for(let t=0;t<e.length;++t){const n=e[t];if("string"==typeof n)continue;const s=n.data;void 0!==s&&h(s,n.children,n.sel)}}function d(t,e,n){let s,r,o,i={};if(void 0!==n?(null!==e&&(i=e),c(n)?s=n:u(n)?r=n.toString():n&&n.sel&&(s=[n])):null!=e&&(c(e)?s=e:u(e)?r=e.toString():e&&e.sel?s=[e]:i=e),void 0!==s)for(o=0;o<s.length;++o)u(s[o])&&(s[o]=l(void 0,void 0,void 0,s[o],void 0));return!t.startsWith("svg")||3!==t.length&&"."!==t[3]&&"#"!==t[3]||h(i,s,t),l(t,i,s,r,void 0)}function f(t){if(p(t)){for(;t&&p(t);){t=m(t).parent}return null!=t?t:null}return t.parentNode}function p(t){return 11===t.nodeType}function m(t,e){var n,s,r;const o=t;return null!==(n=o.parent)&&void 0!==n||(o.parent=null!=e?e:null),null!==(s=o.firstChildNode)&&void 0!==s||(o.firstChildNode=t.firstChild),null!==(r=o.lastChildNode)&&void 0!==r||(o.lastChildNode=t.lastChild),o}const g={createElement:function(t,e){return document.createElement(t,e)},createElementNS:function(t,e,n){return document.createElementNS(t,e,n)},createTextNode:function(t){return document.createTextNode(t)},createDocumentFragment:function(){return m(document.createDocumentFragment())},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){if(p(t)){let e=t;for(;e&&p(e);){e=m(e).parent}t=null!=e?e:t}p(e)&&(e=m(e,t)),n&&p(n)&&(n=m(n).firstChildNode),t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){p(e)&&(e=m(e,t)),t.appendChild(e)},parentNode:f,nextSibling:function(t){var e;if(p(t)){const n=m(t),s=f(n);if(s&&n.lastChildNode){const t=Array.from(s.childNodes),r=t.indexOf(n.lastChildNode);return null!==(e=t[r+1])&&void 0!==e?e:null}return null}return t.nextSibling},tagName:function(t){return t.tagName},setTextContent:function(t,e){t.textContent=e},getTextContent:function(t){return t.textContent},isElement:function(t){return 1===t.nodeType},isText:function(t){return 3===t.nodeType},isComment:function(t){return 8===t.nodeType},isDocumentFragment:p},y=l("",{},[],void 0,void 0);function v(t,e){var n,s;const r=t.key===e.key,o=(null===(n=t.data)||void 0===n?void 0:n.is)===(null===(s=e.data)||void 0===s?void 0:s.is),i=t.sel===e.sel,a=!(!t.sel&&t.sel===e.sel)||typeof t.text==typeof e.text;return i&&r&&o&&a}function b(){throw new Error("The document fragment is not supported on this platform.")}function w(t,e,n){var s;const r={};for(let o=e;o<=n;++o){const e=null===(s=t[o])||void 0===s?void 0:s.key;void 0!==e&&(r[e]=o)}return r}const S=["create","update","remove","destroy","pre","post"];function _(t,e,n){const s={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},r=void 0!==e?e:g;for(const e of S)for(const n of t){const t=n[e];void 0!==t&&s[e].push(t)}function o(t,e){return function(){if(0==--e){const e=r.parentNode(t);null!==e&&r.removeChild(e,t)}}}function i(t,e){var o,a,l,h,d;let f;const p=t.data,m=null==p?void 0:p.hook;null===(o=null==m?void 0:m.init)||void 0===o||o.call(m,t);const g=t.children,v=t.sel;if("!"===v)null!==(a=t.text)&&void 0!==a||(t.text=""),t.elm=r.createComment(t.text);else if(""===v)t.elm=r.createTextNode(t.text);else if(void 0!==v){const n=v.indexOf("#"),o=v.indexOf(".",n),a=n>0?n:v.length,h=o>0?o:v.length,d=-1!==n||-1!==o?v.slice(0,Math.min(a,h)):v,b=null==p?void 0:p.ns,w=void 0===b?r.createElement(d,p):r.createElementNS(b,d,p);for(t.elm=w,a<h&&w.setAttribute("id",v.slice(a+1,h)),o>0&&w.setAttribute("class",v.slice(h+1).replace(/\./g," ")),f=0;f<s.create.length;++f)s.create[f](y,t);if(!u(t.text)||c(g)&&0!==g.length||r.appendChild(w,r.createTextNode(t.text)),c(g))for(f=0;f<g.length;++f){const t=g[f];null!=t&&r.appendChild(w,i(t,e))}void 0!==m&&(null===(l=m.create)||void 0===l||l.call(m,y,t),void 0!==m.insert&&e.push(t))}else if((null===(h=null==n?void 0:n.experimental)||void 0===h?void 0:h.fragments)&&t.children){for(t.elm=(null!==(d=r.createDocumentFragment)&&void 0!==d?d:b)(),f=0;f<s.create.length;++f)s.create[f](y,t);for(f=0;f<t.children.length;++f){const n=t.children[f];null!=n&&r.appendChild(t.elm,i(n,e))}}else t.elm=r.createTextNode(t.text);return t.elm}function a(t,e,n,s,o,a){for(;s<=o;++s){const o=n[s];null!=o&&r.insertBefore(t,i(o,a),e)}}function h(t){var e,n;const r=t.data;if(void 0!==r){null===(n=null===(e=null==r?void 0:r.hook)||void 0===e?void 0:e.destroy)||void 0===n||n.call(e,t);for(let e=0;e<s.destroy.length;++e)s.destroy[e](t);if(void 0!==t.children)for(let e=0;e<t.children.length;++e){const n=t.children[e];null!=n&&"string"!=typeof n&&h(n)}}}function d(t,e,n,i){for(var a,l;n<=i;++n){let i;const c=e[n];if(null!=c)if(void 0!==c.sel){h(c),i=s.remove.length+1;const t=o(c.elm,i);for(let e=0;e<s.remove.length;++e)s.remove[e](c,t);const e=null===(l=null===(a=null==c?void 0:c.data)||void 0===a?void 0:a.hook)||void 0===l?void 0:l.remove;void 0!==e?e(c,t):t()}else c.children?(h(c),d(t,c.children,0,c.children.length-1)):r.removeChild(t,c.elm)}}function f(t,e,n){var o,l,c,u,h,p,m,g;const y=null===(o=e.data)||void 0===o?void 0:o.hook;null===(l=null==y?void 0:y.prepatch)||void 0===l||l.call(y,t,e);const b=e.elm=t.elm;if(t===e)return;if(void 0!==e.data||void 0!==e.text&&e.text!==t.text){null!==(c=e.data)&&void 0!==c||(e.data={}),null!==(u=t.data)&&void 0!==u||(t.data={});for(let n=0;n<s.update.length;++n)s.update[n](t,e);null===(m=null===(p=null===(h=e.data)||void 0===h?void 0:h.hook)||void 0===p?void 0:p.update)||void 0===m||m.call(p,t,e)}const S=t.children,_=e.children;void 0===e.text?void 0!==S&&void 0!==_?S!==_&&function(t,e,n,s){let o,l,c,u,h=0,p=0,m=e.length-1,g=e[0],y=e[m],b=n.length-1,S=n[0],_=n[b];for(;h<=m&&p<=b;)null==g?g=e[++h]:null==y?y=e[--m]:null==S?S=n[++p]:null==_?_=n[--b]:v(g,S)?(f(g,S,s),g=e[++h],S=n[++p]):v(y,_)?(f(y,_,s),y=e[--m],_=n[--b]):v(g,_)?(f(g,_,s),r.insertBefore(t,g.elm,r.nextSibling(y.elm)),g=e[++h],_=n[--b]):v(y,S)?(f(y,S,s),r.insertBefore(t,y.elm,g.elm),y=e[--m],S=n[++p]):(void 0===o&&(o=w(e,h,m)),l=o[S.key],void 0===l?(r.insertBefore(t,i(S,s),g.elm),S=n[++p]):void 0===o[_.key]?(r.insertBefore(t,i(_,s),r.nextSibling(y.elm)),_=n[--b]):(c=e[l],c.sel!==S.sel?r.insertBefore(t,i(S,s),g.elm):(f(c,S,s),e[l]=void 0,r.insertBefore(t,c.elm,g.elm)),S=n[++p]));p<=b&&(u=null==n[b+1]?null:n[b+1].elm,a(t,u,n,p,b,s)),h<=m&&d(t,e,h,m)}(b,S,_,n):void 0!==_?(void 0!==t.text&&r.setTextContent(b,""),a(b,null,_,0,_.length-1,n)):void 0!==S?d(b,S,0,S.length-1):void 0!==t.text&&r.setTextContent(b,""):t.text!==e.text&&(void 0!==S&&d(b,S,0,S.length-1),r.setTextContent(b,e.text)),null===(g=null==y?void 0:y.postpatch)||void 0===g||g.call(y,t,e)}return function(t,e){let n,o,a;const c=[];for(n=0;n<s.pre.length;++n)s.pre[n]();for(!function(t,e){return t.isElement(e)}(r,t)?function(t,e){return t.isDocumentFragment(e)}(r,t)&&(t=l(void 0,{},[],void 0,t)):t=function(t){const e=t.id?"#"+t.id:"",n=t.getAttribute("class"),s=n?"."+n.split(" ").join("."):"";return l(r.tagName(t).toLowerCase()+e+s,{},[],void 0,t)}(t),v(t,e)?f(t,e,c):(o=t.elm,a=r.parentNode(o),i(e,c),null!==a&&(r.insertBefore(a,e.elm,r.nextSibling(o)),d(a,[t],0,0))),n=0;n<c.length;++n)c[n].data.hook.insert(c[n]);for(n=0;n<s.post.length;++n)s.post[n]();return e}}function E(t,e){let n,s;const r=e.elm;let o=t.data.class,i=e.data.class;if((o||i)&&o!==i){for(s in o=o||{},i=i||{},o)o[s]&&!Object.prototype.hasOwnProperty.call(i,s)&&r.classList.remove(s);for(s in i)n=i[s],n!==o[s]&&r.classList[n?"add":"remove"](s)}}const k={create:E,update:E};function A(t,e){let n;const s=e.elm;let r=t.data.attrs,o=e.data.attrs;if((r||o)&&r!==o){for(n in r=r||{},o=o||{},o){const t=o[n];r[n]!==t&&(!0===t?s.setAttribute(n,""):!1===t?s.removeAttribute(n):120!==n.charCodeAt(0)?s.setAttribute(n,t):58===n.charCodeAt(3)?s.setAttributeNS("http://www.w3.org/XML/1998/namespace",n,t):58===n.charCodeAt(5)?109===n.charCodeAt(1)?s.setAttributeNS("http://www.w3.org/2000/xmlns/",n,t):s.setAttributeNS("http://www.w3.org/1999/xlink",n,t):s.setAttribute(n,t))}for(n in r)n in o||s.removeAttribute(n)}}const x={create:A,update:A},O=/[A-Z]/g;function T(t,e){const n=e.elm;let s,r=t.data.dataset,o=e.data.dataset;if(!r&&!o)return;if(r===o)return;r=r||{},o=o||{};const i=n.dataset;for(s in r)s in o||(i?s in i&&delete i[s]:n.removeAttribute("data-"+s.replace(O,"-$&").toLowerCase()));for(s in o)r[s]!==o[s]&&(i?i[s]=o[s]:n.setAttribute("data-"+s.replace(O,"-$&").toLowerCase(),o[s]))}const $={create:T,update:T},j={},C={},N={},L=[],M=[];var I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},D={},G={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){var e,n=t.Symbol;if("function"==typeof n)if(n.observable)e=n.observable;else{e=n.for("https://github.com/benlesh/symbol-observable");try{n.observable=e}catch(t){}}else e="@@observable";return e}}(G);var P,R,Y=G,F=Object.prototype.toString,q=function(t){var e=F.call(t),n="[object Arguments]"===e;return n||(n="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===F.call(t.callee)),n};var z=Array.prototype.slice,B=q,W=Object.keys,U=W?function(t){return W(t)}:function(){if(R)return P;var t;if(R=1,!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,s=q,r=Object.prototype.propertyIsEnumerable,o=!r.call({toString:null},"toString"),i=r.call((function(){}),"prototype"),a=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=t.constructor;return e&&e.prototype===t},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},u=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!c["$"+t]&&e.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{l(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();t=function(t){var r=null!==t&&"object"==typeof t,c="[object Function]"===n.call(t),h=s(t),d=r&&"[object String]"===n.call(t),f=[];if(!r&&!c&&!h)throw new TypeError("Object.keys called on a non-object");var p=i&&c;if(d&&t.length>0&&!e.call(t,0))for(var m=0;m<t.length;++m)f.push(String(m));if(h&&t.length>0)for(var g=0;g<t.length;++g)f.push(String(g));else for(var y in t)p&&"prototype"===y||!e.call(t,y)||f.push(String(y));if(o)for(var v=function(t){if("undefined"==typeof window||!u)return l(t);try{return l(t)}catch(t){return!1}}(t),b=0;b<a.length;++b)v&&"constructor"===a[b]||!e.call(t,a[b])||f.push(a[b]);return f}}return P=t}(),V=Object.keys;U.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return B(t)?V(z.call(t)):V(t)})}else Object.keys=U;return Object.keys||U};var H,J=U,K="undefined"!=typeof Symbol&&Symbol,Z=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),n=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var s=Object.getOwnPropertySymbols(t);if(1!==s.length||s[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var r=Object.getOwnPropertyDescriptor(t,e);if(42!==r.value||!0!==r.enumerable)return!1}return!0},X={foo:{}},Q=Object,tt=Array.prototype.slice,et=Object.prototype.toString,nt=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==et.call(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var n,s=tt.call(arguments,1),r=Math.max(0,e.length-s.length),o=[],i=0;i<r;i++)o.push("$"+i);if(n=Function("binder","return function ("+o.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var r=e.apply(this,s.concat(tt.call(arguments)));return Object(r)===r?r:this}return e.apply(t,s.concat(tt.call(arguments)))})),e.prototype){var a=function(){};a.prototype=e.prototype,n.prototype=new a,a.prototype=null}return n},st=Function.prototype.bind||nt,rt=st.call(Function.call,Object.prototype.hasOwnProperty),ot=SyntaxError,it=Function,at=TypeError,lt=function(t){try{return it('"use strict"; return ('+t+").constructor;")()}catch(t){}},ct=Object.getOwnPropertyDescriptor;if(ct)try{ct({},"")}catch(t){ct=null}var ut=function(){throw new at},ht=ct?function(){try{return ut}catch(t){try{return ct(arguments,"callee").get}catch(t){return ut}}}():ut,dt="function"==typeof K&&"function"==typeof Symbol&&"symbol"==typeof K("foo")&&"symbol"==typeof Symbol("bar")&&Z(),ft={__proto__:X}.foo===X.foo&&!({__proto__:null}instanceof Q),pt=Object.getPrototypeOf||(ft?function(t){return t.__proto__}:null),mt={},gt="undefined"!=typeof Uint8Array&&pt?pt(Uint8Array):H,yt={"%AggregateError%":"undefined"==typeof AggregateError?H:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?H:ArrayBuffer,"%ArrayIteratorPrototype%":dt&&pt?pt([][Symbol.iterator]()):H,"%AsyncFromSyncIteratorPrototype%":H,"%AsyncFunction%":mt,"%AsyncGenerator%":mt,"%AsyncGeneratorFunction%":mt,"%AsyncIteratorPrototype%":mt,"%Atomics%":"undefined"==typeof Atomics?H:Atomics,"%BigInt%":"undefined"==typeof BigInt?H:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?H:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?H:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?H:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?H:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?H:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?H:FinalizationRegistry,"%Function%":it,"%GeneratorFunction%":mt,"%Int8Array%":"undefined"==typeof Int8Array?H:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?H:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?H:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":dt&&pt?pt(pt([][Symbol.iterator]())):H,"%JSON%":"object"==typeof JSON?JSON:H,"%Map%":"undefined"==typeof Map?H:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&dt&&pt?pt((new Map)[Symbol.iterator]()):H,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?H:Promise,"%Proxy%":"undefined"==typeof Proxy?H:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?H:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?H:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&dt&&pt?pt((new Set)[Symbol.iterator]()):H,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?H:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":dt&&pt?pt(""[Symbol.iterator]()):H,"%Symbol%":dt?Symbol:H,"%SyntaxError%":ot,"%ThrowTypeError%":ht,"%TypedArray%":gt,"%TypeError%":at,"%Uint8Array%":"undefined"==typeof Uint8Array?H:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?H:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?H:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?H:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?H:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?H:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?H:WeakSet};if(pt)try{null.error}catch(t){var vt=pt(pt(t));yt["%Error.prototype%"]=vt}var bt=function t(e){var n;if("%AsyncFunction%"===e)n=lt("async function () {}");else if("%GeneratorFunction%"===e)n=lt("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=lt("async function* () {}");else if("%AsyncGenerator%"===e){var s=t("%AsyncGeneratorFunction%");s&&(n=s.prototype)}else if("%AsyncIteratorPrototype%"===e){var r=t("%AsyncGenerator%");r&&pt&&(n=pt(r.prototype))}return yt[e]=n,n},wt={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},St=st,_t=rt,Et=St.call(Function.call,Array.prototype.concat),kt=St.call(Function.apply,Array.prototype.splice),At=St.call(Function.call,String.prototype.replace),xt=St.call(Function.call,String.prototype.slice),Ot=St.call(Function.call,RegExp.prototype.exec),Tt=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,$t=/\\(\\)?/g,jt=function(t,e){var n,s=t;if(_t(wt,s)&&(s="%"+(n=wt[s])[0]+"%"),_t(yt,s)){var r=yt[s];if(r===mt&&(r=bt(s)),void 0===r&&!e)throw new at("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:s,value:r}}throw new ot("intrinsic "+t+" does not exist!")},Ct=function(t,e){if("string"!=typeof t||0===t.length)throw new at("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new at('"allowMissing" argument must be a boolean');if(null===Ot(/^%?[^%]*%?$/,t))throw new ot("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(t){var e=xt(t,0,1),n=xt(t,-1);if("%"===e&&"%"!==n)throw new ot("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new ot("invalid intrinsic syntax, expected opening `%`");var s=[];return At(t,Tt,(function(t,e,n,r){s[s.length]=n?At(r,$t,"$1"):e||t})),s}(t),s=n.length>0?n[0]:"",r=jt("%"+s+"%",e),o=r.name,i=r.value,a=!1,l=r.alias;l&&(s=l[0],kt(n,Et([0,1],l)));for(var c=1,u=!0;c<n.length;c+=1){var h=n[c],d=xt(h,0,1),f=xt(h,-1);if(('"'===d||"'"===d||"`"===d||'"'===f||"'"===f||"`"===f)&&d!==f)throw new ot("property names with quotes must have matching quotes");if("constructor"!==h&&u||(a=!0),_t(yt,o="%"+(s+="."+h)+"%"))i=yt[o];else if(null!=i){if(!(h in i)){if(!e)throw new at("base intrinsic for "+t+" exists, but the property is not available.");return}if(ct&&c+1>=n.length){var p=ct(i,h);i=(u=!!p)&&"get"in p&&!("originalValue"in p.get)?p.get:i[h]}else u=_t(i,h),i=i[h];u&&!a&&(yt[o]=i)}}return i},Nt=Ct("%Object.defineProperty%",!0),Lt=function(){if(Nt)try{return Nt({},"a",{value:1}),!0}catch(t){return!1}return!1};Lt.hasArrayLengthDefineBug=function(){if(!Lt())return null;try{return 1!==Nt([],"length",{value:1}).length}catch(t){return!0}};var Mt=Lt,It=J,Dt="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),Gt=Object.prototype.toString,Pt=Array.prototype.concat,Rt=Object.defineProperty,Yt=Mt(),Ft=Rt&&Yt,qt=function(t,e,n,s){if(e in t)if(!0===s){if(t[e]===n)return}else if("function"!=typeof(r=s)||"[object Function]"!==Gt.call(r)||!s())return;var r;Ft?Rt(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n},zt=function(t,e){var n=arguments.length>2?arguments[2]:{},s=It(e);Dt&&(s=Pt.call(s,Object.getOwnPropertySymbols(e)));for(var r=0;r<s.length;r+=1)qt(t,s[r],e[s[r]],n[s[r]])};zt.supportsDescriptors=!!Ft;var Bt=I,Wt=function(){return"object"==typeof I&&I&&I.Math===Math&&I.Array===Array?I:Bt},Ut=zt,Vt=Wt,Ht=zt,Jt=I,Kt=Wt,Zt=function(){var t=Vt();if(Ut.supportsDescriptors){var e=Object.getOwnPropertyDescriptor(t,"globalThis");e&&(!e.configurable||!e.enumerable&&e.writable&&globalThis===t)||Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else"object"==typeof globalThis&&globalThis===t||(t.globalThis=t);return t},Xt=Kt(),Qt=function(){return Xt};Ht(Qt,{getPolyfill:Kt,implementation:Jt,shim:Zt});var te,ee=Qt,ne=I&&I.__extends||(te=function(t,e){return te=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},te(t,e)},function(t,e){function n(){this.constructor=t}te(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(D,"__esModule",{value:!0});var se=D.NO_IL=D.NO=D.MemoryStream=De=D.Stream=void 0,re=Y.default(ee.getPolyfill()),oe={},ie=D.NO=oe;function ae(){}function le(t){for(var e=t.length,n=Array(e),s=0;s<e;++s)n[s]=t[s];return n}function ce(t,e,n){try{return t.f(e)}catch(t){return n._e(t),oe}}var ue={_n:ae,_e:ae,_c:ae};function he(t){t._start=function(t){t.next=t._n,t.error=t._e,t.complete=t._c,this.start(t)},t._stop=t.stop}se=D.NO_IL=ue;var de=function(){function t(t,e){this._stream=t,this._listener=e}return t.prototype.unsubscribe=function(){this._stream._remove(this._listener)},t}(),fe=function(){function t(t){this._listener=t}return t.prototype.next=function(t){this._listener._n(t)},t.prototype.error=function(t){this._listener._e(t)},t.prototype.complete=function(){this._listener._c()},t}(),pe=function(){function t(t){this.type="fromObservable",this.ins=t,this.active=!1}return t.prototype._start=function(t){this.out=t,this.active=!0,this._sub=this.ins.subscribe(new fe(t)),this.active||this._sub.unsubscribe()},t.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},t}(),me=function(){function t(t){this.type="merge",this.insArr=t,this.out=oe,this.ac=0}return t.prototype._start=function(t){this.out=t;var e=this.insArr,n=e.length;this.ac=n;for(var s=0;s<n;s++)e[s]._add(this)},t.prototype._stop=function(){for(var t=this.insArr,e=t.length,n=0;n<e;n++)t[n]._remove(this);this.out=oe},t.prototype._n=function(t){var e=this.out;e!==oe&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==oe&&e._e(t)},t.prototype._c=function(){if(--this.ac<=0){var t=this.out;if(t===oe)return;t._c()}},t}(),ge=function(){function t(t,e,n){this.i=t,this.out=e,this.p=n,n.ils.push(this)}return t.prototype._n=function(t){var e=this.p,n=this.out;if(n!==oe&&e.up(t,this.i)){var s=le(e.vals);n._n(s)}},t.prototype._e=function(t){var e=this.out;e!==oe&&e._e(t)},t.prototype._c=function(){var t=this.p;t.out!==oe&&0==--t.Nc&&t.out._c()},t}(),ye=function(){function t(t){this.type="combine",this.insArr=t,this.out=oe,this.ils=[],this.Nc=this.Nn=0,this.vals=[]}return t.prototype.up=function(t,e){var n=this.vals[e],s=this.Nn?n===oe?--this.Nn:this.Nn:0;return this.vals[e]=t,0===s},t.prototype._start=function(t){this.out=t;var e=this.insArr,n=this.Nc=this.Nn=e.length,s=this.vals=new Array(n);if(0===n)t._n([]),t._c();else for(var r=0;r<n;r++)s[r]=oe,e[r]._add(new ge(r,t,this))},t.prototype._stop=function(){for(var t=this.insArr,e=t.length,n=this.ils,s=0;s<e;s++)t[s]._remove(n[s]);this.out=oe,this.ils=[],this.vals=[]},t}(),ve=function(){function t(t){this.type="fromArray",this.a=t}return t.prototype._start=function(t){for(var e=this.a,n=0,s=e.length;n<s;n++)t._n(e[n]);t._c()},t.prototype._stop=function(){},t}(),be=function(){function t(t){this.type="fromPromise",this.on=!1,this.p=t}return t.prototype._start=function(t){var e=this;this.on=!0,this.p.then((function(n){e.on&&(t._n(n),t._c())}),(function(e){t._e(e)})).then(ae,(function(t){setTimeout((function(){throw t}))}))},t.prototype._stop=function(){this.on=!1},t}(),we=function(){function t(t){this.type="periodic",this.period=t,this.intervalID=-1,this.i=0}return t.prototype._start=function(t){var e=this;this.intervalID=setInterval((function(){t._n(e.i++)}),this.period)},t.prototype._stop=function(){-1!==this.intervalID&&clearInterval(this.intervalID),this.intervalID=-1,this.i=0},t}(),Se=function(){function t(t,e){this.type="debug",this.ins=t,this.out=oe,this.s=ae,this.l="","string"==typeof e?this.l=e:"function"==typeof e&&(this.s=e)}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=oe},t.prototype._n=function(t){var e=this.out;if(e!==oe){var n=this.s,s=this.l;if(n!==ae)try{n(t)}catch(t){e._e(t)}else s?console.log(s+":",t):console.log(t);e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==oe&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==oe&&t._c()},t}(),_e=function(){function t(t,e){this.type="drop",this.ins=e,this.out=oe,this.max=t,this.dropped=0}return t.prototype._start=function(t){this.out=t,this.dropped=0,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=oe},t.prototype._n=function(t){var e=this.out;e!==oe&&this.dropped++>=this.max&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==oe&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==oe&&t._c()},t}(),Ee=function(){function t(t,e){this.out=t,this.op=e}return t.prototype._n=function(){this.op.end()},t.prototype._e=function(t){this.out._e(t)},t.prototype._c=function(){this.op.end()},t}(),ke=function(){function t(t,e){this.type="endWhen",this.ins=e,this.out=oe,this.o=t,this.oil=ue}return t.prototype._start=function(t){this.out=t,this.o._add(this.oil=new Ee(t,this)),this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.o._remove(this.oil),this.out=oe,this.oil=ue},t.prototype.end=function(){var t=this.out;t!==oe&&t._c()},t.prototype._n=function(t){var e=this.out;e!==oe&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==oe&&e._e(t)},t.prototype._c=function(){this.end()},t}(),Ae=function(){function t(t,e){this.type="filter",this.ins=e,this.out=oe,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=oe},t.prototype._n=function(t){var e=this.out;if(e!==oe){var n=ce(this,t,e);n!==oe&&n&&e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==oe&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==oe&&t._c()},t}(),xe=function(){function t(t,e){this.out=t,this.op=e}return t.prototype._n=function(t){this.out._n(t)},t.prototype._e=function(t){this.out._e(t)},t.prototype._c=function(){this.op.inner=oe,this.op.less()},t}(),Oe=function(){function t(t){this.type="flatten",this.ins=t,this.out=oe,this.open=!0,this.inner=oe,this.il=ue}return t.prototype._start=function(t){this.out=t,this.open=!0,this.inner=oe,this.il=ue,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.inner!==oe&&this.inner._remove(this.il),this.out=oe,this.open=!0,this.inner=oe,this.il=ue},t.prototype.less=function(){var t=this.out;t!==oe&&(this.open||this.inner!==oe||t._c())},t.prototype._n=function(t){var e=this.out;if(e!==oe){var n=this.inner,s=this.il;n!==oe&&s!==ue&&n._remove(s),(this.inner=t)._add(this.il=new xe(e,this))}},t.prototype._e=function(t){var e=this.out;e!==oe&&e._e(t)},t.prototype._c=function(){this.open=!1,this.less()},t}(),Te=function(){function t(t,e,n){var s=this;this.type="fold",this.ins=n,this.out=oe,this.f=function(e){return t(s.acc,e)},this.acc=this.seed=e}return t.prototype._start=function(t){this.out=t,this.acc=this.seed,t._n(this.acc),this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=oe,this.acc=this.seed},t.prototype._n=function(t){var e=this.out;if(e!==oe){var n=ce(this,t,e);n!==oe&&e._n(this.acc=n)}},t.prototype._e=function(t){var e=this.out;e!==oe&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==oe&&t._c()},t}(),$e=function(){function t(t){this.type="last",this.ins=t,this.out=oe,this.has=!1,this.val=oe}return t.prototype._start=function(t){this.out=t,this.has=!1,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=oe,this.val=oe},t.prototype._n=function(t){this.has=!0,this.val=t},t.prototype._e=function(t){var e=this.out;e!==oe&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==oe&&(this.has?(t._n(this.val),t._c()):t._e(new Error("last() failed because input stream completed")))},t}(),je=function(){function t(t,e){this.type="map",this.ins=e,this.out=oe,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=oe},t.prototype._n=function(t){var e=this.out;if(e!==oe){var n=ce(this,t,e);n!==oe&&e._n(n)}},t.prototype._e=function(t){var e=this.out;e!==oe&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==oe&&t._c()},t}(),Ce=function(){function t(t){this.type="remember",this.ins=t,this.out=oe}return t.prototype._start=function(t){this.out=t,this.ins._add(t)},t.prototype._stop=function(){this.ins._remove(this.out),this.out=oe},t}(),Ne=function(){function t(t,e){this.type="replaceError",this.ins=e,this.out=oe,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=oe},t.prototype._n=function(t){var e=this.out;e!==oe&&e._n(t)},t.prototype._e=function(t){var e=this.out;if(e!==oe)try{this.ins._remove(this),(this.ins=this.f(t))._add(this)}catch(t){e._e(t)}},t.prototype._c=function(){var t=this.out;t!==oe&&t._c()},t}(),Le=function(){function t(t,e){this.type="startWith",this.ins=t,this.out=oe,this.val=e}return t.prototype._start=function(t){this.out=t,this.out._n(this.val),this.ins._add(t)},t.prototype._stop=function(){this.ins._remove(this.out),this.out=oe},t}(),Me=function(){function t(t,e){this.type="take",this.ins=e,this.out=oe,this.max=t,this.taken=0}return t.prototype._start=function(t){this.out=t,this.taken=0,this.max<=0?t._c():this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=oe},t.prototype._n=function(t){var e=this.out;if(e!==oe){var n=++this.taken;n<this.max?e._n(t):n===this.max&&(e._n(t),e._c())}},t.prototype._e=function(t){var e=this.out;e!==oe&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==oe&&t._c()},t}(),Ie=function(){function t(t){this._prod=t||oe,this._ils=[],this._stopID=oe,this._dl=oe,this._d=!1,this._target=null,this._err=oe}return t.prototype._n=function(t){var e=this._ils,n=e.length;if(this._d&&this._dl._n(t),1==n)e[0]._n(t);else{if(0==n)return;for(var s=le(e),r=0;r<n;r++)s[r]._n(t)}},t.prototype._e=function(t){if(this._err===oe){this._err=t;var e=this._ils,n=e.length;if(this._x(),this._d&&this._dl._e(t),1==n)e[0]._e(t);else{if(0==n)return;for(var s=le(e),r=0;r<n;r++)s[r]._e(t)}if(!this._d&&0==n)throw this._err}},t.prototype._c=function(){var t=this._ils,e=t.length;if(this._x(),this._d&&this._dl._c(),1==e)t[0]._c();else{if(0==e)return;for(var n=le(t),s=0;s<e;s++)n[s]._c()}},t.prototype._x=function(){0!==this._ils.length&&(this._prod!==oe&&this._prod._stop(),this._err=oe,this._ils=[])},t.prototype._stopNow=function(){this._prod._stop(),this._err=oe,this._stopID=oe},t.prototype._add=function(t){var e=this._target;if(e)return e._add(t);var n=this._ils;if(n.push(t),!(n.length>1))if(this._stopID!==oe)clearTimeout(this._stopID),this._stopID=oe;else{var s=this._prod;s!==oe&&s._start(this)}},t.prototype._remove=function(t){var e=this,n=this._target;if(n)return n._remove(t);var s=this._ils,r=s.indexOf(t);r>-1&&(s.splice(r,1),this._prod!==oe&&s.length<=0?(this._err=oe,this._stopID=setTimeout((function(){return e._stopNow()}))):1===s.length&&this._pruneCycles())},t.prototype._pruneCycles=function(){this._hasNoSinks(this,[])&&this._remove(this._ils[0])},t.prototype._hasNoSinks=function(t,e){if(-1!==e.indexOf(t))return!0;if(t.out===this)return!0;if(t.out&&t.out!==oe)return this._hasNoSinks(t.out,e.concat(t));if(t._ils){for(var n=0,s=t._ils.length;n<s;n++)if(!this._hasNoSinks(t._ils[n],e.concat(t)))return!1;return!0}return!1},t.prototype.ctor=function(){return this instanceof Ge?Ge:t},t.prototype.addListener=function(t){t._n=t.next||ae,t._e=t.error||ae,t._c=t.complete||ae,this._add(t)},t.prototype.removeListener=function(t){this._remove(t)},t.prototype.subscribe=function(t){return this.addListener(t),new de(this,t)},t.prototype[re]=function(){return this},t.create=function(e){if(e){if("function"!=typeof e.start||"function"!=typeof e.stop)throw new Error("producer requires both start and stop functions");he(e)}return new t(e)},t.createWithMemory=function(t){return t&&he(t),new Ge(t)},t.never=function(){return new t({_start:ae,_stop:ae})},t.empty=function(){return new t({_start:function(t){t._c()},_stop:ae})},t.throw=function(e){return new t({_start:function(t){t._e(e)},_stop:ae})},t.from=function(e){if("function"==typeof e[re])return t.fromObservable(e);if("function"==typeof e.then)return t.fromPromise(e);if(Array.isArray(e))return t.fromArray(e);throw new TypeError("Type of input to from() must be an Array, Promise, or Observable")},t.of=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.fromArray(e)},t.fromArray=function(e){return new t(new ve(e))},t.fromPromise=function(e){return new t(new be(e))},t.fromObservable=function(e){if(void 0!==e.endWhen)return e;var n="function"==typeof e[re]?e[re]():e;return new t(new pe(n))},t.periodic=function(e){return new t(new we(e))},t.prototype._map=function(t){return new(this.ctor())(new je(t,this))},t.prototype.map=function(t){return this._map(t)},t.prototype.mapTo=function(t){var e=this.map((function(){return t}));return e._prod.type="mapTo",e},t.prototype.filter=function(e){var n,s,r=this._prod;return new t(r instanceof Ae?new Ae((n=r.f,s=e,function(t){return n(t)&&s(t)}),r.ins):new Ae(e,this))},t.prototype.take=function(t){return new(this.ctor())(new Me(t,this))},t.prototype.drop=function(e){return new t(new _e(e,this))},t.prototype.last=function(){return new t(new $e(this))},t.prototype.startWith=function(t){return new Ge(new Le(this,t))},t.prototype.endWhen=function(t){return new(this.ctor())(new ke(t,this))},t.prototype.fold=function(t,e){return new Ge(new Te(t,e,this))},t.prototype.replaceError=function(t){return new(this.ctor())(new Ne(t,this))},t.prototype.flatten=function(){return new t(new Oe(this))},t.prototype.compose=function(t){return t(this)},t.prototype.remember=function(){return new Ge(new Ce(this))},t.prototype.debug=function(t){return new(this.ctor())(new Se(this,t))},t.prototype.imitate=function(t){if(t instanceof Ge)throw new Error("A MemoryStream was given to imitate(), but it only supports a Stream. Read more about this restriction here: https://github.com/staltz/xstream#faq");this._target=t;for(var e=this._ils,n=e.length,s=0;s<n;s++)t._add(e[s]);this._ils=[]},t.prototype.shamefullySendNext=function(t){this._n(t)},t.prototype.shamefullySendError=function(t){this._e(t)},t.prototype.shamefullySendComplete=function(){this._c()},t.prototype.setDebugListener=function(t){t?(this._d=!0,t._n=t.next||ae,t._e=t.error||ae,t._c=t.complete||ae,this._dl=t):(this._d=!1,this._dl=oe)},t.merge=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new me(e))},t.combine=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new ye(e))},t}(),De=D.Stream=Ie,Ge=function(t){function e(e){var n=t.call(this,e)||this;return n._has=!1,n}return ne(e,t),e.prototype._n=function(e){this._v=e,this._has=!0,t.prototype._n.call(this,e)},e.prototype._add=function(t){var e=this._target;if(e)return e._add(t);var n=this._ils;if(n.push(t),n.length>1)this._has&&t._n(this._v);else if(this._stopID!==oe)this._has&&t._n(this._v),clearTimeout(this._stopID),this._stopID=oe;else if(this._has)t._n(this._v);else{var s=this._prod;s!==oe&&s._start(this)}},e.prototype._stopNow=function(){this._has=!1,t.prototype._stopNow.call(this)},e.prototype._x=function(){this._has=!1,t.prototype._x.call(this)},e.prototype.map=function(t){return this._map(t)},e.prototype.mapTo=function(e){return t.prototype.mapTo.call(this,e)},e.prototype.take=function(e){return t.prototype.take.call(this,e)},e.prototype.endWhen=function(e){return t.prototype.endWhen.call(this,e)},e.prototype.replaceError=function(e){return t.prototype.replaceError.call(this,e)},e.prototype.remember=function(){return this},e.prototype.debug=function(e){return t.prototype.debug.call(this,e)},e}(Ie),Pe=D.MemoryStream=Ge,Re=Ie,Ye=D.default=Re;const Fe=function(t){const e=function(t){return t&&t.default&&t.default.default&&"function"==typeof t.default.default?t.default.default:t&&t.default?t.default:t}(t);return e&&e.default&&"function"==typeof e.default.create?e.default:e}(e({__proto__:null,get MemoryStream(){return Pe},get NO(){return ie},get NO_IL(){return se},get Stream(){return De},default:Ye},[D]));De||Ye&&Ye.Stream||Fe&&Fe.Stream;class qe{constructor(t){this.streams=t,this.type="concat",this.out=null,this.i=0}_start(t){this.out=t,this.streams[this.i]._add(this)}_stop(){const t=this.streams;this.i<t.length&&t[this.i]._remove(this),this.i=0,this.out=null}_n(t){const e=this.out;e&&e._n(t)}_e(t){const e=this.out;e&&e._e(t)}_c(){const t=this.out;if(!t)return;const e=this.streams;e[this.i]._remove(this),++this.i<e.length?e[this.i]._add(this):t._c()}}const ze={};class Be{constructor(t,e){this.dt=t,this.ins=e,this.type="debounce",this.out=null,this.id=null,this.t=ze}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this),this.out=null,this.clearInterval()}clearInterval(){const t=this.id;null!==t&&clearInterval(t),this.id=null}_n(t){const e=this.out;e&&(this.clearInterval(),this.t=t,this.id=setInterval((()=>{this.clearInterval(),e._n(t),this.t=ze}),this.dt))}_e(t){const e=this.out;e&&(this.clearInterval(),e._e(t))}_c(){const t=this.out;t&&(this.clearInterval(),this.t!=ze&&t._n(this.t),this.t=ze,t._c())}}class We{constructor(t,e){this.dt=t,this.ins=e,this.type="throttle",this.out=null,this.id=null}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this),this.out=null,this.id=null}clearInterval(){const t=this.id;null!==t&&clearInterval(t),this.id=null}_n(t){const e=this.out;e&&(this.id||(e._n(t),this.id=setInterval((()=>{this.clearInterval()}),this.dt)))}_e(t){const e=this.out;e&&(this.clearInterval(),e._e(t))}_c(){const t=this.out;t&&(this.clearInterval(),t._c())}}class Ue{constructor(t,e){this.dt=t,this.ins=e,this.type="delay",this.out=null}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this),this.out=null}_n(t){const e=this.out;if(!e)return;const n=setInterval((()=>{e._n(t),clearInterval(n)}),this.dt)}_e(t){const e=this.out;if(!e)return;const n=setInterval((()=>{e._e(t),clearInterval(n)}),this.dt)}_c(){const t=this.out;if(!t)return;const e=setInterval((()=>{t._c(),clearInterval(e)}),this.dt)}}const Ve={};class He{constructor(t,e){this.ins=t,this.type="dropRepeats",this.out=null,this.v=Ve,this.isEq=e||((t,e)=>t===e)}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this),this.out=null,this.v=Ve}_n(t){const e=this.out;if(!e)return;const n=this.v;n!==Ve&&this.isEq(t,n)||(this.v=t,e._n(t))}_e(t){const e=this.out;e&&e._e(t)}_c(){const t=this.out;t&&t._c()}}function Je(t){return function(e){return new De(new He(e,t))}}const Ke={};class Ze{constructor(t,e){this.i=t,this.p=e,e.ils[t]=this}_n(t){const e=this.p;e.out!==Ke&&e.up(t,this.i)}_e(t){this.p._e(t)}_c(){this.p.down(this.i,this)}}class Xe{constructor(t,e){this.ins=t,this.others=e,this.type="sampleCombine",this.out=Ke,this.ils=[],this.Nn=0,this.vals=[]}_start(t){this.out=t;const e=this.others,n=this.Nn=e.length,s=this.vals=new Array(n);for(let t=0;t<n;t++)s[t]=Ke,e[t]._add(new Ze(t,this));this.ins._add(this)}_stop(){const t=this.others,e=t.length,n=this.ils;this.ins._remove(this);for(let s=0;s<e;s++)t[s]._remove(n[s]);this.out=Ke,this.vals=[],this.ils=[]}_n(t){const e=this.out;e!==Ke&&(this.Nn>0||e._n([t,...this.vals]))}_e(t){const e=this.out;e!==Ke&&e._e(t)}_c(){const t=this.out;t!==Ke&&t._c()}up(t,e){const n=this.vals[e];this.Nn>0&&n===Ke&&this.Nn--,this.vals[e]=t}down(t,e){this.others[t]._remove(e)}}function Qe(t){return function(){let t;return t="undefined"!=typeof window?window:"undefined"!=typeof global?global:this,t.Cyclejs=t.Cyclejs||{},t=t.Cyclejs,t.adaptStream=t.adaptStream||(t=>t),t}().adaptStream(t)}function tn(t,e,n=5,s=0){if(s>n)return!1;if(t===e)return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!tn(t[r],e[r],n,s+1))return!1;return!0}const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(const o of r){if(!(o in e))return!1;if(!tn(t[o],e[o],n,s+1))return!1}return!0}function en(t){return"string"==typeof t||"number"==typeof t?function(e){return null==e?void 0:e[t]}:t.get}function nn(t){return"string"==typeof t||"number"==typeof t?function(e,n){return Array.isArray(e)?function(t,e,n){if(n===t[e])return t;const s=parseInt(e);return void 0===n?t.filter(((t,e)=>e!==s)):t.map(((t,e)=>e===s?n:t))}(e,t,n):void 0===e?{[t]:n}:{...e,[t]:n}}:t.set}function sn(t,e){return t.select(e)}function rn(t,e){const n=en(e),s=nn(e);return t.map((t=>function(e){const r=n(e),o=t(r);return r===o?e:s(e,o)}))}class on{constructor(t,e,n,s){this.isolateSource=sn,this.isolateSink=rn,this._end=n,this._stream=s?t.remember():t.filter((t=>void 0!==t)).compose(Je()).remember(),this._name=e,this.stream=Qe(this._stream),this._stream._isCycleSource=e}select(t){const e=en(t);return new on(this._stream.map(e),this._name,this._end)}watch(t,{immediate:e}={}){const n=this._stream.map(t).compose(Je(tn)).endWhen(this._end||Ye.never());return e?n:n.drop(1)}}const an="https://sygnal.js.org",ln={SYG101:"warn",SYG102:"info",SYG103:"info",SYG104:"warn",SYG105:"info",SYG106:"warn",SYG110:"warn",SYG111:"warn",SYG201:"warn",SYG202:"warn",SYG301:"error",SYG401:"warn",SYG900:"warn",SYG206:"error",SYG207:"warn",SYG208:"warn",SYG209:"error",SYG210:"warn",SYG211:"error",SYG212:"error",SYG213:"warn",SYG214:"error",SYG215:"error",SYG216:"error",SYG217:"warn",SYG218:"error",SYG219:"warn",SYG220:"warn",SYG402:"error",SYG403:"error",SYG404:"error",SYG405:"error",SYG406:"error",SYG407:"error",SYG408:"error",SYG409:"warn",SYG410:"error",SYG411:"error",SYG412:"error",SYG413:"error",SYG414:"error",SYG415:"error",SYG416:"error",SYG417:"warn",SYG418:"error",SYG419:"error",SYG420:"error",SYG601:"error",SYG602:"error",SYG603:"error",SYG604:"error",SYG605:"error",SYG606:"error",SYG607:"error",SYG608:"warn",SYG609:"warn",SYG610:"error",SYG901:"error",SYG902:"error",SYG903:"error"},cn={SYG112:"error",SYG115:"warn",SYG116:"error",SYG124:"error",SYG125:"error",SYG126:"info",SYG127:"error",SYG128:"error",SYG129:"warn",SYG221:"error",SYG222:"warn",SYG223:"warn",SYG224:"error",SYG226:"warn",SYG230:"warn",SYG231:"error",SYG232:"info",SYG233:"warn",SYG234:"warn",SYG235:"warn",SYG236:"warn",SYG237:"warn",SYG238:"warn",SYG421:"error",SYG611:"error",SYG130:"error",SYG131:"warn",SYG132:"warn",SYG133:"warn",SYG620:"error",SYG630:"warn",SYG631:"error",SYG632:"info",SYG633:"warn",SYG634:"info",SYG635:"warn",SYG640:"warn",SYG641:"error",SYG642:"warn",SYG422:"error",SYG643:"warn",SYG423:"warn",SYG424:"warn",SYG425:"warn",SYG612:"error",SYG644:"warn",SYG645:"warn",SYG140:"warn",SYG141:"warn",SYG142:"error",SYG143:"warn",SYG144:"info",SYG145:"warn",SYG146:"warn",SYG147:"warn",SYG148:"warn",SYG149:"warn",SYG660:"error",SYG661:"error",SYG662:"error",SYG663:"error",SYG664:"error",SYG665:"warn",SYG666:"error",SYG667:"error",SYG668:"warn",SYG669:"warn",SYG430:"warn",SYG431:"warn",SYG432:"warn",SYG433:"warn",SYG434:"warn",SYG435:"warn",SYG701:"warn",SYG702:"warn",SYG703:"warn",SYG704:"warn",SYG705:"warn",SYG706:"warn",SYG707:"warn",SYG708:"warn",SYG722:"warn",SYG724:"warn"};function un(t){return`${an}/reference/errors#${t.toLowerCase()}`}class hn extends Error{constructor(t){super(t.text),this.diagnostic=t}}let dn,fn="off",pn=!1,mn=new Set,gn=[],yn=[],vn=[];function bn(){return fn=dn||(!0===globalThis.__SYGNAL_DEV__?"warn":"off"),pn="off"!==fn,fn}function wn(t={}){"mode"in t&&(dn=t.mode),t.ignore&&(mn=new Set(t.ignore)),bn()}function Sn(){return fn}function _n(){return pn}const En=t=>(t&&"object"==typeof t?t.name:t)||void 0,kn=t=>/[.!?]$/.test(t)?t:t+".";function An(t,e){const n=En(e.component);return`[Sygnal ${t}] ${n?n+": ":""}${kn(e.message)}`+(e.fix?" "+kn(e.fix):"")+" "+un(t)}function xn(t,e){if(!pn||mn.has(t))return;const n=e.severity||ln[t]||"warn",s={code:t,severity:n,component:En(e.component),message:e.message,fix:e.fix,data:e.data,docsUrl:un(t),get text(){return An(t,this)},timestamp:Date.now()};if(gn.push(s)>500&&gn.shift(),yn.forEach((t=>{try{t(s)}catch(t){}})),"info"!==n){if("error"===fn)throw new hn(s);"warn"===fn&&console[n](s.text)}return s}function On(t){return yn=[...yn,t],()=>{yn=yn.filter((e=>e!==t))}}let Tn=t=>{const e=()=>{throw t};"function"==typeof queueMicrotask?queueMicrotask(e):setTimeout(e)};const $n=t=>(e,...n)=>{for(const s of vn)if(pn||s.always)try{s[t]?.(e,...n)}catch(n){try{if(n instanceof hn)throw n;xn("SYG900",{component:e,message:`Diagnostics check '${s.id}' threw in ${t}: ${n?.message}`,data:{check:s.id,hook:t,error:n}})}catch(t){Tn(t)}}},jn=$n("onIntent"),Cn=$n("onModel"),Nn=$n("onRender"),Ln=$n("onReducer"),Mn=$n("onDispose"),In=$n("onSelector"),Dn=$n("onBusEmit"),Gn=$n("onBusSelect");globalThis.__SYGNAL_DIAGNOSTICS__={registerCheck:function(t){return vn=[...vn,t],()=>{vn=vn.filter((e=>e!==t))}},report:xn,hooks:{onIntent:jn,onModel:Cn,onRender:Nn,onReducer:Ln,onDispose:Mn,sourcesFor:function(t){let e=t.sources;for(const n of vn)if(n.sources&&(pn||n.always))try{e=n.sources(t,e)||e}catch(t){}return e},on:_n}},bn();const Pn=t=>(e,n,s,r,...o)=>{const i={component:n,message:s,fix:r,severity:t,data:o[0]},a=Sn();if("off"!==a)try{const n=xn(e,i);n&&"collect"===a&&"error"===t?console.error(n.text,...o):n&&"warn"===a&&o.length&&console[t](...o)}catch(t){setTimeout((()=>{throw t}))}else console[t](An(e,i),...o)},Rn=Pn("warn"),Yn=Pn("error");function Fn(t,e,n,s){const r=new Error(An(t,{component:e,message:n,fix:s}));throw r.code=t,r.sygnal=[e,n,s],r}const qn=(t,e,n)=>{try{t&&t(e,n)}catch(t){console.error(t)}};globalThis.__SYGNAL_DIAGNOSTICS__.error=Yn;let zn,Bn,Wn,Un,Vn=null;const Hn=new WeakMap,Jn=()=>{if(!zn){const t=Fe.create();zn=Object.getPrototypeOf(t),Bn=t._prod}};function Kn(t){if(this._target)return this._target._remove(t);const e=this._ils,n=e.indexOf(t);n<0||(e.splice(n,1),this._prod===Bn||e.length?1==e.length&&this._pruneCycles():(this._err=Bn,this._stopID=0,Vn.push(this),Un&&Hn.set(this,Un)))}function Zn(t,e,n){Jn();const s=Vn,r=Un;s||(Wn=zn._remove,zn._remove=Kn),Vn=e,n&&(Un=n);try{t()}finally{Vn=s,Un=r,s||(zn._remove=Wn)}}function Xn(t,e){Jn();for(let n=0;n<t.length;n++){const s=t[n];if(0===s._stopID&&!s._ils.length){s._stopID=Bn;const n=Hn.get(s);Zn((()=>{if(s._prod!==Bn)try{s._stopNow()}catch(t){e?.(t,n)}}),t,n)}}t.length=0}const Qn=Symbol("sygnal.inst"),ts=Symbol("setState"),es=Symbol("seed"),ns=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),ss=t=>t.componentName||t.name||"FUNCTION_COMPONENT";const rs=t=>({model:t.model,intent:t.intent,initialState:t.initialState,idle:null,calculated:t.calculated,context:t.context,behaviorActions:{}}),os=(t,e)=>({model:t.model,intent:t.intent,initialState:t.initialState,view:e,name:ss(e),stateSourceName:"STATE",isSubComponent:!0,isolatedState:!!e.isolatedState,_idle:t.idle,_behaviorActions:t.behaviorActions}),is=(t,e)=>({...e,model:t.model,intent:t.intent,initialState:t.initialState,idle:t._idle,behaviorActions:t._behaviorActions||e.behaviorActions}),as=(t,{name:e,...n})=>({...t,[e]:n});function ls(t,e){const n=ss(t),s=new Map,r=new Set,o=e.model;for(const t in o||{}){let e=o[t];if("function"==typeof e?e={STATE:e}:ns(e)||Fn("SYG212",n,`Model entry '${t}' must be a function or an object`,"Use { STATE: reducer }"),"INITIALIZE"==t){for(const t in e)"STATE"!=t&&Rn("SYG210",n,`INITIALIZE only supports the STATE sink; ignoring '${t}'`,"Use another action");if(!("STATE"in e))continue;e={STATE:e.STATE}}const i=[];for(const t in e)i.push([t,e[t]]),r.add(t);s.set(t,i)}const i=function(t,e,n){if(!e)return null;ns(e)||Fn("SYG606",t,"calculated must be an object","Use calculated = { field: state => value }");const s={};for(const r in e){const o=e[r];"function"==typeof o?s[r]=[o,null]:Array.isArray(o)&&2==o.length&&Array.isArray(o[0])&&"function"==typeof o[1]?s[r]=[o[1],o[0]]:Fn("SYG206",t,`Invalid calculated field '${r}'`,"Use fn or [deps, fn]"),ns(n)&&r in n&&Rn("SYG207",t,`Calculated field '${r}' overwrites the initialState key of the same name`,"Rename one of them")}const r=new Set(Object.keys(s)),o={},i={},a={};for(const e of r){for(const o of s[e][1]||[])r.has(o)||!n||o in n||Rn("SYG208",t,`Calculated field '${e}' depends on unknown key '${o}'`,"Add it to initialState");const l=o[e]=(s[e][1]||[]).filter((t=>r.has(t)));i[e]=l.length,a[e]||(a[e]=[]);for(const t of l)(a[t]||(a[t]=[])).push(e)}const l=[...r].filter((t=>!i[t]));for(let t=0;t<l.length;t++)for(const e of a[l[t]])--i[e]||l.push(e);if(l.length!=r.size){const e=[...r].filter((t=>!l.includes(t))),n=[],s=t=>n.includes(t)?(n.push(t),!0):(n.push(t),!!o[t].some((t=>e.includes(t)&&s(t)))||(n.pop(),!1));s(e[0]);const i=n[n.length-1];Fn("SYG209",t,`Circular calculated dependency: ${n.slice(n.indexOf(i)).join(" → ")}`,"Break the cycle")}return[l.map((t=>[t,s[t][0],s[t][1]])),r]}(n,e.calculated,e.initialState);let a=null;if(void 0!==e.context&&null!==e.context)if(ns(e.context)){a=[];for(const t in e.context){const s=e.context[t];"function"==typeof s?a.push([t,s]):Yn("SYG403",n,`Invalid context entry '${t}' (a ${typeof s}); skipping it`,"Context entries are functions of state only: { name: state => value }. See https://sygnal.js.org/guide/migrating-to-6#leftovers")}}else Yn("SYG402",n,`context must be an object, got ${typeof e.context}; ignoring it`,"Use context = { name: state => value }");const l=e.intent;return void 0!==l&&"function"!=typeof l&&Fn("SYG602",n,"intent must be a function","Use intent = sources => ({ ACTION: stream$ })"),{name:n,view:t,intent:l,handlers:s,sinks:r,initialState:e.initialState,idle:e.idle,isolated:!!t.isolatedState,calculated:i&&i[0],calcNames:i&&i[1],context:a&&a.length?a:null,statics:[],behaviorActions:e.behaviorActions,ready:r.has("READY"),model:void 0!==o,onError:"function"==typeof t.onError?t.onError:void 0}}const cs=new WeakMap,us=["model","intent","initialState","calculated","context","isolatedState","onError","componentName","uses","resources","browser"],hs=new WeakMap;function ds(t,e,n,s){const r=e?n:cs;let o=s?void 0:r.get(t);if(o&&!((t,e)=>{const n=hs.get(t);for(let t=0;t<us.length;t++)if(n[t]!==e[us[t]])return!0;return n[us.length]!==M.length})(o,t))return o;const i=[...us.map((e=>t[e])),M.length];return o=ls(t,fs(t,e,s)),s?.name&&(o.name=s.name),s||(r.set(t,o),hs.set(o,i)),o}function fs(t,e,n,s){let r=rs(t);n&&(r={...r,...n}),s&&void 0===r.model&&!r.initialState&&(r={...r,initialState:!0}),r=function(t,e){const n=e.resources;if(n){const e={...t.idle};for(const t in n)e[t]={status:"idle"};t={...t,model:{RESOURCE:as,...t.model},idle:e}}const s=e.uses;if(s){const n=os(t,e);for(const t in s)s[t]?.merge?.(n,t);t=is(n,t)}return t}(r,t),s&&(r=s(r));for(const e of M)r=e(r,t)||r;return e&&(r=e(r,t)||r),r}const ps=t=>({get:()=>t.state,set:e=>{t.state=e,t.commit()}});function ms(t,e){let n,s=!1;return{local:!0,get:()=>s?n:e.get(),set:e=>{n=e,s=!0,t.commit()}}}function gs(t,e,n,s,r="Sub-component"){let o,i={};return{get(){const n=t.get();return n!==i&&(i=n,o=null==n?void 0:n[e],void 0===o&&(o=s)),o},set(s){if(n)return Rn("SYG409",n,`${r} tried to update calculated field '${e}'; ignored`,"Bind it to a non-calculated field");const o=t.get();o?.[e]!==s&&t.set({...o,[e]:s})},has:()=>void 0!==t.get()?.[e]}}function ys(t,e,n,s,r){if("function"!=typeof e?.get)return Yn("SYG410",n,`Sub-component 'state' prop ${ns(e)?"has no get()":"is a "+typeof e}; it gets the parent's whole state`,"Use a state key string or { get, set }"),t;let o,i,a={};return{get(){const l=t.get();if(l!==a){a=l;try{i=o=e.get(l)}catch(t){Yn("SYG410",n,"Sub-component 'state' lens get() threw; it keeps its last value","Guard the getter against missing data",t),s?.(t)}void 0===o&&(o=r)}return o},has(){return this.get(),void 0!==i},set(n){if("function"!=typeof e.set)return;const s=t.get(),r=e.set(s,n);r!==s&&t.set(r)}}}const vs=(t,e)=>ns(t)&&null!=t.id?""+t.id:"\0"+e,bs=t=>"\0"==t[0]?"_i"+t.slice(1):o(t),ws=t=>ns(t)&&null!=t.id,Ss=[];function _s(t,e,n){let s,r={};return{get(){const[t,o]=e(),i=o.get(n);if(void 0===i)return s;const a=t[i];return a===r?s:(r=a,s=ns(a)?ws(a)?a:{...a,id:i}:{value:a,id:i})},set(o){const[i,a]=e(),l=a.get(n);if(void 0===l)return;if(void 0===o)return t.set(i.filter(((t,e)=>e!==l)));const c=i[l];if(o===c||o===s&&c===r)return;const u=i.slice();ns(c)||!ns(o)?(ns(c)&&!ws(c)&&ns(o)&&o.id===l&&delete(o={...o}).id,u[l]=o):u[l]=o.value,t.set(u)}}}function Es(t,e){const n=t.sources[t.DOMSourceName];if(n)for(const s of[].concat(e))if(s){const e=Object.keys(s)[0],{[e]:r,...o}=s,i=n.select(""+r).elements();let a,l,c=0,u=0;const h=n=>{const c=!t._disposed&&a?.[0],u=r?.spec?.commands?.[e]||c?.__sw?.w.commands[e];l&&(c||n)&&(i.removeListener(l),clearInterval(d),l=0,c&&(u||c[e])?u?u(c,o):c[e]("close"==e?o.returnValue:"togglePopover"==e?o.force:o):globalThis.__SYGNAL_DIAGNOSTICS__?.elementCommand?.(t,s,c))},d=setInterval((()=>h(++u>62)),16);i.addListener(l={next:t=>{a=t,c++&&queueMicrotask(h)}})}}class ks{constructor(t){this.i=t}get id(){return this.i.id}get parentId(){return this.i.parent?.id}get name(){return this.i.def.name}get def(){return this.i.def}get state(){return this.i.cell.get()}get props(){return this.i.props}get context(){return this.i.context()}get isRoot(){return!this.i.parent}get kind(){return this.i.kind}get shown(){for(let t=this.i;t;t=t.parent)if(!t.shown)return!1;return!0}get disposed(){return this.i.disposed}get uid(){return this.i.uidBase}get sources(){return this.i.sources()}children(){const t=[];return this.i.kids.forEach((e=>{if(e.def&&e.app)t.push(As(e));else if(e.insts)for(const n of e.insts())t.push(As(n))})),t}}const As=t=>t.iv||(t.iv=new ks(t));function xs(t){t.st&&t.app.statics.delete(t);const e=t.rep;if(e){t.rep=null;for(const t of e)try{t.shamefullySendComplete()}catch(t){}}}const Os=t=>{for(let e=t;e;e=e.parent)if(!e.shown)return!1;return!0};function Ts(t){if(t.disposed)return;const e=t.cell.get(),n=Os(t);if(void 0===e||e===t.sS&&n===t.sH)return;t.sS=e,t.sH=n;const s=t.def.view,r=t.sv;for(const[o,i]of t.st){const a=s[i];let l=a;try{if("function"==typeof a)l=a(e);else if(a&&"object"==typeof a){l={};for(const t in a)l[t]=a[t](e)}}catch(e){t.app.caught(t,"SYG216",`${i} threw; nothing sent`,e,"declaration"),r[o]=void 0;continue}if(!n&&l&&"object"==typeof l){const t=l;l={};for(const e in t)t[e]?.background&&(l[e]=t[e])}const c={[i]:l};o in r&&tn(c,r[o])||(r[o]=c,t.app.hooks.onSink?.(As(t),null,o,c),Ls(t,o,c))}}const $s="undefined"!=typeof window&&window||"undefined"!=typeof process&&process.env||{};function js(t,e){if(!t.debug&&!t.def.view.debug&&"true"!==$s.SYGNAL_DEBUG&&!0!==$s.SYGNAL_DEBUG)return;let n;try{n=e()}catch(t){n="(message not shown: "+t+")"}const s=`[${t.id} | ${t.def.name}] ${n}`;console.log(s);const r="undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__;try{r?.connected&&r.onDebugLog(t.id,s)}catch(t){}}function Cs(t,e,n,r,o){const i=t.def.handlers.get(e),a=t.app,l=a.hooks;if(l.onAction&&l.onAction(As(t),{type:e,data:n,cause:r,target:As(t),source:o}),js(t,(()=>`<${e}> Action triggered`)),!i)return;const c=t.def,u=t.cell.get();let h,d;const f=(n,s,r=10,o)=>{if("number"!=typeof r&&Fn("SYG215",t,`next() delay in '${e}' must be a number`,"Use next('ACTION', data, ms)"),t.disposed||t.dying)return js(t,(()=>`next(${n}) ignored: disposed`));l.onNext?.(As(t),n,s,r),js(t,(()=>`<${e}> ${o?"EFFECT triggered":"Triggered"} a next() action: <${n}> ${r}ms delay`));const i=t.timers||(t.timers=new Set),c=setTimeout((()=>{i.delete(c),t.disposed||a.dispatch(t,n,s,"next")}),r);i.add(c)};for(const[r,o]of i){const i=l.wrapHandler&&l.wrapHandler(As(t),e,r,o)||o;if("EFFECT"==r){if("function"!=typeof i)continue;const r=n=>a.caught(t,"SYG214",`EFFECT handler '${e}' threw`,n,"effect",e);try{const o=i(u,n,((t,e,n)=>f(t,e,n,!0)),{...h||(h=Ns(t,u)),signal:(t.ac||(t.ac=globalThis.AbortController&&new AbortController))?.signal});o?.then?o.then(null,r):void 0===o||s(o)||Rn("SYG219",t,`EFFECT handler '${e}' returned a value, which is ignored`,"Use a STATE or driver sink")}catch(t){r(t)}continue}let p;if("function"==typeof i)try{p=i(u,n,f,h||(h=Ns(t,u)))}catch(n){a.caught(t,"SYG216",`Reducer for '${e}' threw; ${"STATE"==r?"state unchanged":"nothing sent"}`,n,"reducer",e);continue}else p=void 0===i||!0===i?n:i;if("STATE"!=r||!s(p)&&p!==u){if(!s(p))if("STATE"!=r)if("symbol"!=typeof p)if(void 0===p&&Rn("SYG217",t,`Reducer for '${e}' sent undefined to the driver`,"Return a value, or ABORT to send nothing"),l.onSink&&l.onSink(As(t),e,r,p),js(t,(()=>`<${e}> Data sent to [${r}]: ${JSON.stringify(p)}`)),"PARENT"==r){const e={name:c.name,component:c.view,value:p};t.parent?t.parent.toChild(e):a.out("PARENT",e)}else"READY"==r?t.setReady(!!p):"ELEMENT"==r?!1!==l.onElementCommand?.(As(t),p)&&Es(t.el||(t.el={name:c.name,DOMSourceName:"DOM",sources:{DOM:t.dom},get _disposed(){return t.disposed}}),p):t.st?(d||(d=[])).push(r,p):Ls(t,r,p);else Yn("SYG218",t,`Reducer for '${e}' returned a symbol; nothing sent`,"Return a value, or ABORT to send nothing");else if(l.onReducer?.(As(t),e,u,p),js(t,(()=>`<${e}> State reducer added`)),t.cell.set(p),c.view.viewTransitions?.includes?.(e)&&(void 0===p||!tn(u,t.cell.get()))){const e=t.dom?._isolateModule;e&&(e.vt=1)}}else/^(input|change)$/.test(globalThis.event?.type)&&t.refresh()}if(t.st&&(Ts(t),d))for(let e=0;e<d.length;e+=2)Ls(t,d[e],d[e+1])}function Ns(t,e){return{...t.props,children:t.children,slots:t.slots,context:t.context(),uid:t.uid,state:e}}function Ls(t,e,n){const s=t.app,r=s.sources[e];if(("EVENTS"==e||r?.__sygnalReplies&&ns(n))&&(n=Object.defineProperties({...n},{__emitterId:{value:t.id,configurable:!0},__emitterName:{value:t.def.name,configurable:!0}})),t.parent&&r&&"function"==typeof r.isolateSink){let r=n;for(let o=t;o.parent;o=o.parent){const i=o.parent.src(e);if("function"!=typeof i?.isolateValue)return s.pipe(t,e,n,(n=>{for(let s=t;s.parent;s=s.parent){const t=s.parent.src(e);"function"==typeof t?.isolateSink&&(n=t.isolateSink(n,s.scope))}return n}),(t=>s.out(e,t)));r=i.isolateValue(r,o.scope)}n=r}s.out(e,n)}function Ms(t){return{select:e=>t._stream.filter((t=>t.type===e)).map((t=>t.data))}}function Is(t){return t.length>1&&("."===t[0]||"#"===t[0])}function Ds(t){if("string"!=typeof t&&!function(t){return"object"==typeof HTMLElement?t instanceof HTMLElement||t instanceof DocumentFragment:t&&"object"==typeof t&&null!==t&&(1===t.nodeType||11===t.nodeType)&&"string"==typeof t.nodeName}(t))throw new Error("Given container is not a DOM element neither a selector string.")}function Gs(t){let e="";for(let n=t.length-1;n>=0&&"selector"===t[n].type;n--)e=t[n].scope+" "+e;return e.trim()}function Ps(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n].type!==e[n].type||t[n].scope!==e[n].scope)return!1;return!0}const Rs="sygnal-dom",Ys=t=>t?.dispatchEvent(new Event(Rs,{bubbles:!0})),Fs=t=>null!==t&&"object"==typeof t&&!Array.isArray(t);function qs(t,e){if(t===e)return!0;if(!t||!e)return!1;let n=0;for(const s in t){n++;const r=t[s],o=e[s];if(r!==o){if(!Fs(r)||!Fs(o))return!1;let t=0;for(const e in r)if(t++,r[e]!==o[e])return!1;for(const e in o)t--;if(t)return!1}}for(const t in e)n--;return!n}const zs=new WeakMap,Bs=new WeakMap;class Ws{constructor(t,e){this.y=t,Object.assign(this,t,e).y=t}get elm(){return this.m}set elm(t){this.y.elm=this.m=t}}const Us=(t,e)=>(t||"")+JSON.stringify("object"==typeof e?e:String(e)),Vs=t=>{if(!t||t.$p||!t.children)return t;let e=zs.get(t);if(!e){const n=[];let s=0;const r=(t,e,o={},i,a)=>{for(const l of t)if(l&&!l.sel&&l.children)s=1,null==l.key?r(l.children,e,o):(i=zs.get(l))&&i[0]===e?n.push(...i[1]):(a=n.length,r(l.children,Us(e,l.key)),zs.set(l,[e,n.slice(a)]));else{let t=Vs(l);if(t!==l&&(s=1),e&&t){const n=t.key??(o[t.sel]=-~o[t.sel]),s=Bs.get(t);t=s&&s[0]===e&&s[1]===n?s[2]:(Bs.set(t,[e,n,t=new Ws(t,{key:Us(e,t.key??[t.sel,n])})]),t)}n.push(t)}};r(t.children),zs.set(t,e=s?new Ws(t,{children:n}):t)}return e},Hs=t=>t?.sel?{...t,data:{...t.data,attrs:{...t.data?.attrs,"data-sygnal-ready":"false"}}}:t?.children?{...t,children:t.children.map(Hs)}:t&&{...t,ready:!1},Js=t=>({sel:"div",data:{attrs:{"data-sygnal-error":t}},children:[],text:void 0,elm:void 0,key:void 0});const Ks=(t,e)=>{const n=t.data?.props?.id;let s;if(n)try{s=JSON.stringify(n)}catch(t){s=String(n)}return`${t.sel}::${s&&s.replace(/"/g,"")||e}`};function Zs(t,e){if(t===e)return!0;if(!ns(t)||!ns(e))return!1;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const s of n)if(t[s]!==e[s])return!1;return!0}let Xs=0;const Qs=(t,e)=>(Xs=1e3,tr(t,e));function tr(t,e){if(t===e)return!0;if(--Xs<0||!t||!e||t.sel!==e.sel||t.key!==e.key||t.text!==e.text||e.data?.hook||!qs(t.data,e.data))return!1;const n=t.children,s=e.children;if(n===s)return!0;if(!n||!s||n.length!==s.length)return!1;for(let t=0;t<n.length;t++)if(!tr(n[t],s[t]))return!1;return!0}const er=Object.freeze({}),nr="\0all";let sr=0;class rr{constructor(t){this.outv=t,this.lr=!0,this.ready=!0,this.def=null,this.disposed=!1,this.shown=!0}render(){return this.outv}setProps(){}dispose(){}}class or{constructor(t,e,n,s,r,o,i,a,l,c=(n?"child":"root"),u=!1){this.app=t,this.def=e,this.parent=n,this.dom=r,this.scope=a,this.kind=c,this.id=sr++,this.disposed=!1,this.debug=!1,this.dying=!1,this.shown=!0,this.slots={},this.kids=new Map,this.lr=!0,this.ls={},this.keys=null,this.forced=!0,this.postSels=null,this.cver=-1,this.subs=[],this.srcs=null,this.fb=null,this.ac=null,this.hub=null,this.ep=0,this.timers=null,this.st=null,this.sv=null,this.rep=null,this.uid=t=>t?this.uidBase+"-"+t:this.uidBase,this.props=o,this.setChildren(i),this.uidBase=l,this.ready=!e.ready,this.cell=e.calculated||e.idle?function(t,e){const n=e.calculated,s=e.idle,r=n?n.map((()=>({v:null,r:void 0}))):[];let o,i={};const a=t=>{if(!ns(t))return t;if(t===i)return o;i=t;let a=s?{...s,...t}:t;if(n){a===t&&(a={...t});for(let t=0;t<n.length;t++){const[s,o,i]=n[t],l=r[t],c=i&&i.map((t=>a[t]));if(c&&l.v&&c.every(((t,e)=>t===l.v[e])))a[s]=l.r;else try{const t=o(a);c&&(l.v=c,l.r=t),a[s]=t}catch(t){Rn("SYG220",e.name,`Calculated field '${s}' threw (${t instanceof Error?t.message:t}); skipped this update`,"Guard against missing data")}}}return o=a};return{raw:()=>t.get(),get:()=>a(t.get()),set(e){if(!ns(e)||!n&&!s)return t.set(e);const r={...a(e)};i=r,o=r,t.set(r)}}}(s,e):{get:()=>s.get(),set:t=>s.set(t),raw:()=>s.get()};const h=t.hooks;let d=n||void 0===t.initState?e.initialState:t.initState;if(n||e.model||d?ns(d)&&(d={...d}):d=!0,void 0!==d){if(!n||e.isolated&&s.local)this.cell.set(d);else if(e.isolated){const n=s,r=n.has?n.has():void 0!==n.get();u||!r&&e.model?t.dispatch(this,es,{v:d,r:u,b:n},"built-in"):r&&h.onStateSeed?.(As(this),n.get(),d)}}else e.idle&&ns(this.cell.raw())&&!n&&this.cell.set(this.cell.raw());if(h.onCreate?.(As(this)),js(this,(()=>"Instantiated")),e.handlers.has("INITIALIZE")&&t.dispatch(this,"INITIALIZE",d,"built-in"),(t.stat.length||t.rep.length)&&function(t){const e=t.app,n=t.def,s=t.st=e.stat.length?function(t,e){let n=t.stc.get(e);if(void 0===n){const s=e.view,r=t.stat.filter((([,t])=>null!=s[t]));t.stc.set(e,n=r.length?r:null)}return n}(e,n):null;s&&(t.sv={},e.statics.add(t),e.flushing||e.commit());for(const r of e.rep){if(!n.sinks.has(r)&&!s?.some((t=>t[0]==r)))continue;const o=t.src(r),i=("function"==typeof o?.replies?o:e.sources[r]).replies(t.id);(t.rep||(t.rep=[])).push(i),i.subscribe({next:n=>n&&e.dispatch(t,n.type,n.data,"reply",r)})}}(this),e.intent)try{this.subscribe()}catch(e){throw this.disposed=!0,t.watchers.delete(this),xs(this),h.onDispose?.(As(this)),e}e.handlers.has("BOOTSTRAP")&&t.born.push(this)}get name(){return this.def.name}subscribe(){const t=this.app,e=t.hooks,n=this.def,s=t.draining;t.draining=!0;try{let s=this.sources();e.wrapSources&&(s=e.wrapSources(As(this),s)||s);const r=n.intent(s);r&&"function"==typeof r.addListener&&Fn("SYG603",this,"intent returned a single stream, a form Sygnal 6.0 removed","Return an object of streams, one per action: { ACTION: stream$ }. See https://sygnal.js.org/guide/migrating-to-6#leftovers"),ns(r)||Fn("SYG603",this,"intent must return an object of streams","Return { ACTION: stream$ }"),e.onIntent?.(As(this),Object.keys(r));for(const e in r){const s=r[e];null!=s&&("function"!=typeof s.subscribe&&Fn("SYG603",this,`intent entry '${e}' is not a stream`,"Return { ACTION: stream$ }"),this.subs.push(s.subscribe({next:n=>this.dying?Cs(this,e,n,"intent"):t.dispatch(this,e,n,"intent"),error:s=>{console.error(`[Sygnal] ${n.name}: intent stream '${e}' errored; it stops emitting`,s),t.appError(this,s,"intent",e)}})))}}catch(t){for(const t of this.subs)t.unsubscribe();throw this.subs=[],t}finally{t.draining=s}s||t.rendering||!t.queue.length||t.drain()}sources(){if(this.so)return this.so;const t=this.so=Object.defineProperties({},this.app.srcDesc(!!this.parent));return Object.defineProperty(t,Qn,{value:this}),t}src(t){const e=this.srcs||(this.srcs={});if(t in e)return e[t];let n=this.parent?this.parent.src(t):this.app.sources[t];return void 0!==this.scope&&n&&"function"==typeof n.isolateSource&&(n=n.isolateSource(n,this.scope)),e[t]=n}stateSource(){if(this.stateSrc)return this.stateSrc;this.st$=Fe.createWithMemory();const t=this.stLast=this.cell.raw();return void 0!==t&&this.st$.shamefullySendNext(t),this.app.watchers.add(this),this.stateSrc=new on(this.st$,"STATE",this.dispose$(),1)}notify(){const t=this.cell.raw();t!==this.stLast&&void 0!==t&&(this.stLast=t,this.st$.shamefullySendNext(t))}dispose$(){return this.disp$||(this.disp$=Fe.create())}childSource(){return{select:t=>{let e;return Fe.create({start:n=>{(this.hub||(this.hub=new Set)).add(e=e=>e.component===t&&n.next(e.value))},stop:()=>{this.hub?.delete(e)}})}}}setChildren(t){this.raw=t;const[e,n]=t.length?function(t){var e;const n={},s=[];for(const r of t)if(r?.data?.m&&"slot"===r.sel){const t=r.children;(n[e=r.data?.props?.name||"default"]||(n[e]=[])).push(...Array.isArray(t)?t:t?[t]:[])}else s.push(r);return s.length&&(n.default||(n.default=[])).push(...s),[n.default||[],n]}(t):[t,{}];this.children=e,this.slots=n}setProps(t,e){this.props=t,this.setChildren(e),this.app.hooks.onPropsChanged?.(As(this),t),this.props$?.shamefullySendNext(t),this.children$?.shamefullySendNext(this.children)}commands(){if(void 0!==this.cmds)return this.cmds;for(const t in this.props){const e=this.props[t];if(e&&e.__sygnalCommand)return e._targetComponentName=this.def.name,e._targetComponentId=this.id,this.cmds=Ms(e)}return this.cmds=void 0}toChild(t){this.hub?.forEach((e=>e(t)))}context(){const t=this.app;if(this.cver===t.ver)return this.cv;const e=this.parent?this.parent.context():er;let n=e;const s=this.def.context;if(s){const r=this.cell.get();n={...e};for(const[e,o]of s)try{n[e]=o(r)}catch(s){Yn("SYG404",this,`Context entry '${e}' threw; it keeps its last value`,"See the attached error",s),t.appError(this,s,"context"),this.cv&&(n[e]=this.cv[e])}this.cv&&Zs(n,this.cv)?n=this.cv:this.cv&&t.hooks.onContextChanged&&t.hooks.onContextChanged(As(this),n,Object.keys(n).filter((t=>n[t]!==this.cv[t])))}return this.cver=t.ver,this.cv=n}ctxChanged(t){const e=this.lctx;if(t===e)return!1;const n=this.keys;if(n){if(n.has(nr))return!0;for(const s of n)if(t[s]!==e[s])return!0}return this.app.ctxSkip?.(this,e,t),this.lctx=t,!1}refresh(){this.disposed||(this.forced=!0,this.app.commit())}setReady(t){t!==this.ready&&(this.ready=t,this.parent&&this.app.hooks.onReady?.(As(this.parent),As(this),t),this.app.commit())}render(){if(this.disposed)return this.outv;const t=this.cell.get(),e=this.context();let n=!1,s=this.forced||t!==this.ls||!Zs(this.props,this.lp)||!function(t,e){if(t===e)return!0;if(!t||!e||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}(this.raw,this.lc)||this.ctxChanged(e);if(void 0===t&&s){if(!this.tmpl)return this.outv;s=!1}if(s){const s=this.app.hooks;s.onStateChanged&&t!==this.ls&&!this.forced&&s.onStateChanged(As(this),t),this.forced=!1,this.ls=t,this.lp=this.props,this.lc=this.raw,this.lctx=e;const r=this.tmpl;this.view(t,e),js(this,(()=>"View rendered")),r?.$p&&this.tmpl.$p&&this.outv&&Qs(r,this.tmpl)?(this.tmpl=r,n=this.app.ran=!0):this.reconcile()}let r=this.ep!==this.app.ep;this.ep=this.app.ep;for(const t of this.kids.values()){const e=t.render();e===t.last&&t.ready===t.lr||(t.last=e,t.lr=t.ready,r=!0)}if(!s&&!r)return this.outv;if(n&&!r)return this.app.hooks.onRender?.(As(this),this.tmpl),this.outv;let o=this.kids.size?this.inject(this.tmpl,"r"):this.tmpl;if(this.postSels)for(const t of this.postSels)o=N[t](o,this);return this.app.hooks.onRender?.(As(this),o),this.outv=this.parent?this.app.scopeValue(this.parent,"DOM",o,this):o}sync(){if(!this.disposed)for(const t of this.kids.values())t.sync?.()}view(t,e){const n=this.def;let s=null,r=e;if(e!==er){const t=s=new Set;r=new Proxy(e,{get:(e,n)=>("string"==typeof n&&t.add(n),e[n]),has:(e,n)=>("string"==typeof n&&t.add(n),n in e),ownKeys:e=>(t.add(nr),Reflect.ownKeys(e))})}try{this.tmpl=n.view({...this.props,state:t,children:this.children,slots:this.slots,context:r,uid:this.uid})}catch(t){const e=t instanceof Error?t:new Error(String(t));let s=Js(n.name);if(n.onError)try{s=n.onError(e,{componentName:n.name}),Rn("SYG406",this,"View threw; rendered the onError fallback",void 0,e)}catch(t){Yn("SYG406",this,"View threw; rendering the error fallback",void 0,e),Yn("SYG407",this,"onError threw; rendering an empty error <div>","Make onError return a vnode",t)}else Yn("SYG406",this,"View threw; rendering the error fallback","Add .onError for a custom fallback",e);this.app.appError(this,e,"view"),this.tmpl=s}const o=this.tmpl;"string"==typeof o||"number"==typeof o?this.tmpl={text:""+o}:o||(this.tmpl={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0}),this.keys=s}reconcile(){const t=new Set;let e=null;const n=(s,r,o,i)=>{if(!s||s.$p)return;const a=s.sel;if(a&&C[a]){const t=C[a](s,this,r);if(t===s)return;return o?(o.children=o.children.slice())[i]=t:this.tmpl=t,n(t,r,o,i)}const l=s.data,c=a&&j[a];if(l?.c||c){const e=Ks(s,r);t.add(e);const n=function(t){if(!t)return{};if(!("resetState"in t))return t;const{resetState:e,...n}=t;return n}(l.props),o=s.children||(null!=s.text?[{text:s.text}]:[]);let i=l.c;if(i)for(const t of L)i=t(i,this)||i;let a=this.kids.get(e);return a&&i&&a.def&&a.def.view!==i&&(a.dispose(),this.kids.delete(e),a=void 0),void(a?a.setProps(n,o,s,e):this.kids.set(e,c?this.host(c,n,o,e,s):this.child(i,n,o,e,!!l.props?.resetState)))}N[a]&&!(e||(e=[])).includes(a)&&e.push(a);const u=s.children;if(u)for(let t=0;t<u.length;t++)n(u[t],r+"."+t,s,t)};if(n(this.tmpl,"r",null,0),this.postSels=e,this.kids.size>t.size)for(const[e,n]of this.kids)t.has(e)||(n.dispose(),this.kids.delete(e))}host(t,e,n,s,r){try{return t(this,e,n,s,r)}catch(t){return this.failed(t)}}failed(t){const e=t instanceof Error?t:new Error(String(t));let n=Js(this.def.name);if(this.def.onError)try{n=this.def.onError(e,{componentName:this.def.name})||n}catch(t){Yn("SYG407",this,"onError threw; rendering an empty error <div>","Make onError return a vnode",t)}return this.app.caught(this,"SYG408","Sub-component threw; rendering the error fallback",e,"instantiate"),new rr(n)}child(t,e,n,s,r=!1){const i=this.app;try{const a=i.def(t),l=e.state,c=this.def.calcNames;a.initialState&&!a.isolated&&Fn("SYG405",a.name,"Sub-component initialState replaces the state its parent passes in","Remove initialState, or set isolatedState = true");const u=a.isolated?a.initialState:void 0,h="string"==typeof l?gs(this.cell,l,c?.has(l)&&this.def.name,u):void 0!==l?ys(this.cell,l,this.def.name,(t=>i.appError(this,t,"view")),u):a.isolated?ms(i,this.cell):this.cell,d=i.scope();return new or(i,a,this,h,this.dom&&this.dom.isolateSource(this.dom,d),e,n,d,this.uid(o(s.replace(/.*::(r\.)?/,""))),"child",r)}catch(t){return this.failed(t)}}inject(t,e){if(!t||t.$p)return t;if(t.data?.c||t.sel&&j[t.sel]){const n=this.kids.get(Ks(t,e));return n&&(n.ready?n.outv:Hs(n.outv))}const n=t.children;if(!n)return t;let s;for(let t=0;t<n.length;t++){const r=this.inject(n[t],e+"."+t);r!==n[t]&&((s||(s=n.slice()))[t]=r)}return s?{...t,children:s}:t}handle(t,e,n,s){Cs(this,t,e,n,s)}dispose(){if(this.disposed)return;const t=this.app;if(this.def.handlers.has("DISPOSE")&&Cs(this,"DISPOSE",void 0,"built-in"),this.disp$){this.dying=!0;try{this.disp$.shamefullySendNext(!0)}finally{this.dying=!1}}this.disposed=!0,t.hooks.onDispose?.(As(this)),this.disp$&&this.disp$.shamefullySendComplete(),(this.st||this.rep)&&xs(this),this.ac?.abort(),this.timers&&(this.timers.forEach(clearTimeout),this.timers=null),this.kids.forEach((t=>t.dispose())),this.kids.clear();const e=this.subs;e.length&&Zn((()=>{for(const t of e)t.unsubscribe()}),t.dq,this),this.subs=[],this.st$&&t.watchers.delete(this),this.hub=null}}const ir=(t,e)=>{Yn("SYG418","Collection",t,"Use a field name, { field: 'asc'|'desc'|1|-1 }, or a function",e)},ar=(t,e,n=!0)=>t>e?n?1:-1:t<e?n?-1:1:0;function lr(t){const e=Object.entries(t);if(e.length>1)return ir("sort object must have one key; ignored",t);const[n,s]=e[0];let r;if("string"==typeof s){const e=s.toLowerCase();if("asc"!=e&&"desc"!=e)return ir("sort direction must be 'asc' or 'desc'; ignored",t);r="asc"==e}else{if("number"!=typeof s)return ir("sort direction must be a string or number; ignored",t);if(1!==s&&-1!==s)return ir("sort direction must be 1 or -1; ignored",t);r=1===s}return(t,e)=>ar(t[n],e[n],r)}function cr(t){if(t){if("function"==typeof t)return t;if("string"==typeof t){const e=t.toLowerCase();return"asc"==e||"desc"==e?(t,n)=>ar(t,n,"asc"==e):(e,n)=>ar(e[t],n[t])}if(Array.isArray(t)){const e=t.map((t=>"function"==typeof t?t:"string"==typeof t?["asc","desc"].includes(t.toLowerCase())?void 0:(e,n)=>ar(e[t],n[t]):ns(t)?lr(t):void 0)).filter((t=>"function"==typeof t));return(t,n)=>e.reduce(((e,s)=>0!==e?e:s(t,n)),0)}return ns(t)?lr(t):ir("Invalid sort prop; ignored",t)}}const ur=new Set(["of","from","filter","sort","idfield","className","viewTransitionName"]),hr=[];function dr(t,e){for(const n of L)t=n(t,e)||t;return t}class fr{constructor(t,e,n,s,r){this.owner=t,this.items=new Map,this.shown=[],this.ready=!0,this.disposed=!1,this.lr=!0,this.ip={},this.kids=hr,this.ep=0,this.hostProps(e,r);const i=e.of;i||Fn("SYG411",t,"Collection is missing 'of'","Use of={ItemComponent}"),"function"!=typeof i&&Fn("SYG411",t,"Collection 'of' is a "+typeof i,"Use of={ItemComponent}"),this.uidBase=t.uid(o(s.replace(/.*::(r\.)?/,""))),this.arr=function(t,e){const n=t.cell,s=t.def.name;if(void 0===e)return{get:()=>{const t=n.get();return!Array.isArray(t)&&Array.isArray(t?.value)?t.value:t},set:t=>n.set(t)};if("string"==typeof e){const r=n.get(),o=t.def.calcNames?.has(e);if(!ns(r)||e in r||o)ns(r)&&!Array.isArray(r[e])&&Rn("SYG401",s,`Collection 'from' field '${e}' is not an array; it renders nothing`,"Set it to an array in initialState");else{const t=Object.keys(r).filter((t=>Array.isArray(r[t])));Rn("SYG401",s,`Collection from="${e}" is not in state${t.length?` (array fields: '${t.join("', '")}')`:""}; it renders nothing until it exists`,"Set it to an array in initialState")}return gs(n,e,o&&s,void 0,"Collection")}if(ns(e)&&"function"==typeof e.get){let r,o={};return{get(){const i=n.get();if(i!==o){let n;o=i;try{n=e.get(i)}catch(e){return Yn("SYG412",s,"Collection 'from' getter threw; it keeps its items","Guard the getter against missing data",e),t.app.appError(t,e,"view"),r}r=n,Array.isArray(r)||(Rn("SYG401",s,"Collection 'from' getter returned a non-array; it renders nothing","Return an array from get()",r),r=hr)}return r},set(t){if("function"!=typeof e.set)return;const s=n.get(),r=e.set(s,t);r!==s&&n.set(r)}}}return Yn("SYG412",s,"Collection 'from' prop is invalid; it renders nothing","Use a state key string or { get, set }",e),null}(t,e.from),this.index=this.arr&&function(t){let e,n=new Map;return()=>{const s=t.get(),r=Array.isArray(s)?s:Ss;if(r!==e){e=r,n=new Map;for(let t=0;t<r.length;t++){const e=vs(r[t],t);n.has(e)||n.set(e,t)}}return[r,n]}}(this.arr),this.def=t.app.def(this.view=dr(i,t)),this.setProps(e,n,r,s)}hostProps(t,e){const n=this.owner.app.hooks;n.onHostProps&&n.onHostProps(As(this.owner),e.sel,t,e.data)}setProps(t,e,n,s){this.props&&this.hostProps(t,n);const r="function"==typeof t.of?dr(t.of,this.owner):this.view;if(r!==this.view&&(this.def=this.owner.app.def(this.view=r),this.clear()),this.props=t,n){const t=n.key??s;this.tr===(this.tr=n.data?.tr)&&t===this.key||(this.key=t,this.outv=void 0)}const o={};for(const e in t)ur.has(e)||(o[e]=t[e]);const i=e.length?e:hr;Zs(o,this.ip)&&i===this.kids||(this.ip=o,this.kids=i,this.items.forEach((t=>t.setProps(o,i))))}clear(){this.items.forEach((t=>t.dispose())),this.items.clear(),this.shown=[],this.la=void 0}insts(){return this.shown}list(t,e){const{filter:n,sort:s}=this.props,r=s!==this.ls?cr(s):this.cmp;let o=null;if("function"==typeof n||r){o=[];for(let e=0;e<t.length;e++)("function"!=typeof n||n(t[e],e,t))&&o.push(e);r&&o.sort(((e,n)=>r(t[e],t[n])))}this.ls=s,this.cmp=r;const i=o?o.length:t.length,a=[];for(let n=0;n<i;n++){const s=o?o[n]:n,r=vs(t[s],s);if(e.get(r)===s)a.push(r);else{const e=this.owner.app.hooks;e.onDuplicateKey&&e.onDuplicateKey(As(this.owner),"\0"==r[0]?s:t[s].id)}}return a}sync(){if(!this.disposed){this.items_();for(const t of this.shown)t.sync()}}items_(){if(!this.index)return!1;const t=this.owner.app;let e=!1;{const[n,s]=this.index(),{filter:r,sort:o}=this.props;if(n!==this.la||r!==this.lf||o!==this.ls){const o=this.list(n,s),i=new Set(o);this.la=n,this.lf=r;for(const[t,e]of this.items)i.has(t)||(e.dispose(),this.items.delete(t));const a=this.owner,l=[];for(const e of o){let n=this.items.get(e);if(!n){const s=t.scope();n=new or(t,this.def,a,_s(this.arr,this.index,e),a.dom&&a.dom.isolateSource(a.dom,s),this.ip,this.kids,s,this.uidBase+"-"+bs(e),"item"),this.items.set(e,n),n.k=e}l.push(n)}(l.length!=this.shown.length||l.some(((t,e)=>t!==this.shown[e])))&&(e=!0),this.shown=l}}return e}render(){if(this.disposed)return this.outv;const t=this.owner.app;let e=!this.outv||this.ep!==t.ep;this.ep=t.ep,this.items_()&&(e=!0);const n=this.shown,s=Array(n.length),r=this.props.viewTransitionName;let o=0;for(let t=0;t<n.length;t++){const i=n[t],a=i.render();a!==i.last&&(i.last=a,e=!0),void 0!==a&&(s[o++]=this.tr?this.tr(r?pr(i,a,r):a):r?pr(i,a,r):a)}return s.length=o,e?this.outv={sel:void 0,data:{},children:s,text:void 0,elm:void 0,key:this.key}:this.outv}dispose(){this.disposed||(this.disposed=!0,this.clear())}}function pr(t,e,n){const s=t.k;return e.sel&&"\0"!=s[0]?(t.vi===e&&t.vp===n||(t.vi=e,t.vp=n,t.vo={...e,data:{...e.data,style:i(n,s,e.data?.style)}}),t.vo):e}j.collection=(t,e,n,s,r)=>new fr(t,e,n,s,r);const mr=t=>{const{children:e,...n}=t;return d("collection",{props:n},e)};mr.componentName="collection",mr.preventInstantiation=!0;const gr=t=>"string"==typeof t,yr=t=>gr(t)||(t=>"number"==typeof t)(t),vr=t=>"object"==typeof t&&null!==t,br=t=>vr(t)&&"sel"in t&&"data"in t&&"children"in t&&"text"in t;function wr(t,e,n,s,r){this.sel=t,this.data=e,this.children=n,this.text=s,this.elm=void 0,this.key=r}Object.defineProperty(wr.prototype,"$p",{value:1});const Sr=/^(input|textarea|select)|-/i,_r=Object.create(null),Er=t=>_r[t]=+Sr.test(t)|(/^(collection|switchable)$/i.test(t)?4:0)|(t in Ar?2:0)|(/-/.test(t)?8:0),kr=t=>{if(!t||void 0===t.sel||t.$p&&t.data.ns)return;const e=t.data||{},n=e.props||{},s={};for(const t in n)"className"!=t&&void 0!==n[t]&&(s[t]=n[t]);void 0!==n.className&&(s.class=n.className);for(const t in e.attrs)void 0!==e.attrs[t]&&(s[t]=e.attrs[t]);const r={...e,ns:"http://www.w3.org/2000/svg",attrs:s};delete r.props,t.data=r,Array.isArray(t.children)&&"foreignObject"!==t.sel&&t.children.forEach(kr)},Ar={svg:1,g:1,defs:1,symbol:1,use:1,circle:1,ellipse:1,line:1,path:1,polygon:1,polyline:1,rect:1,text:1,tspan:1,textPath:1,linearGradient:1,radialGradient:1,stop:1,pattern:1,clipPath:1,mask:1,marker:1,filter:1,feBlend:1,feColorMatrix:1,feComponentTransfer:1,feComposite:1,feConvolveMatrix:1,feDiffuseLighting:1,feDisplacementMap:1,feDropShadow:1,feFlood:1,feGaussianBlur:1,feImage:1,feMerge:1,feMergeNode:1,feMorphology:1,feOffset:1,fePointLight:1,feSpecularLighting:1,feSpotLight:1,feTile:1,feTurbulence:1,feFuncR:1,feFuncG:1,feFuncB:1,feFuncA:1,desc:1,metadata:1,foreignObject:1,switch:1,animate:1,animateMotion:1,animateTransform:1,set:1,mpath:1},xr=(t,e)=>{const n=t.hook||{},s={...n};n.insert&&!n.insert.s&&(s.u=1);for(const t in e){(s[t]=(...s)=>{n[t]&&n[t](...s),e[t](...s)}).s=1}t.hook=s},Or=(t,e)=>{if(e&&"object"==typeof e)for(const n in e)Array.isArray(e)?Or(t,e[n]):e[n]&&Or(t,n);else if(e)for(const n of String(e).split(/\s+/))n&&(t[n]=!0);return t},Tr=t=>vr(t)&&!Array.isArray(t);let $r;const jr=(t,e)=>{const n=t[e];return vr(n)&&!$r?.[e]?n:($r&&($r[e]=0),t[e]=vr(n)?{...n}:{})},Cr=(t,e,n)=>{if(Tr(t[e])&&Tr(n)){const s=jr(t,e);for(const t in n)void 0!==n[t]&&(s[t]=n[t])}else t[e]=(t=>{if(Tr(t))for(const e in t)if(void 0===t[e]){const e={};for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}return t})(n),($r||($r={}))[e]=1},Nr=/^(for|form|list|role|tabindex|popovertarget(action)?|command(for)?|closedby|interestfor|anchor|aria-.*)$/,Lr=/^aria-(at|bu|ch|cu|di|ex|gr|ha|hi|in|mo|mu|pr|re[aq]|sel)/,Mr=(t,e,n)=>{if("ref"==t||"key"==t||"children"==t)return 0;const s=t.indexOf("-"),r=s>-1&&t.slice(0,s);return r&&void 0!==e[r]?[e[r]||r,"data"==r?t.slice(s+1).replace(/-([a-z])/g,((t,e)=>e.toUpperCase())):t.slice(s+1),1]:1==n||void 0===e.attrs||!Nr.test(t)||n&&"list"==t?void 0!==e[t]?[e[t]||t,0,"class"==t&&void 0!==e.class?3:2]:[void 0!==e.props&&"props",t]:["attrs",t,"aria"==r&&4,n&&"form"==t]},Ir=Object.prototype.hasOwnProperty,Dr=(t,e,n,s)=>{const r={};$r=null;for(const i in t){if(!Ir.call(t,i))continue;const a=t[i];let l=n.get(i);if(void 0===l&&(l=Mr(i,e,s),n.size<1024)&&n.set(i,l),!l)continue;const[c,u,h]=l;if(1==h){const t=jr(r,c);void 0!==a&&(t[u]=a)}else{if(void 0===a)continue;2&h?Cr(r,c,3==h?"string"==typeof(o=a)||Array.isArray(o)?Or({},o):o:a):c?jr(r,l[3]&&"string"!=typeof a?"props":c)[u]=h?a===!!a?(a||Lr.test(i))&&""+a:a??!1:a:r[i]=a}}var o;const i=r.props;return i&&(i.autoFocus||i.autoSelect)&&(t=>{const{autoFocus:e,autoSelect:n,...s}=t.props;t.props=s,t._autoFocus=!!e,t._autoSelect=!!n;const r=t=>{t&&"function"==typeof t.focus&&requestAnimationFrame((()=>{t.focus(),n&&"function"==typeof t.select&&t.select()}))};xr(t,{insert:t=>r(t.elm),postpatch:(t,e)=>{const n=t.data?._autoFocus,s=e.data?._autoFocus;!n&&s&&r(e.elm)}})})(r),t.ref&&((t,e)=>{const n=t=>{"function"==typeof e?e(t):e&&"object"==typeof e&&"current"in e&&(e.current=t)};xr(t,{insert:t=>n(t.elm),postpatch:(t,e)=>n(e.elm),destroy:()=>n(null)})})(r,t.ref),r},Gr=t=>t.length>1||!yr(t[0])?void 0:t[0].toString(),Pr=(t,e)=>{let n=1;for(let o=0;o<t.length;o++){const i=t[o];r=i,Array.isArray(r)?n&=Pr(i,e):br(i)?(e.push(i),i.$p||void 0===i.sel&&!i.children||(n=0)):e.push(yr(s=i)?new wr(void 0,void 0,void 0,s,void 0):void 0)}var s,r;return n},Rr=(t=>{const e=new Map,n=new Map,s=new Map,r=(r,i,a,l)=>{if(void 0===r){r="UNDEFINED";const t="A JSX tag is undefined, so <UNDEFINED> is rendered instead",e="Import or define the component in this file",n=globalThis.__SYGNAL_DIAGNOSTICS__;n&&n.error?n.error("SYG420","JSX",t,e):console.error(`[Sygnal SYG420] JSX: ${t}. ${e}. https://sygnal.js.org/reference/errors#syg420`)}const c="function"==typeof r;if(c&&r.__sygnalControl)return r.__sygnalControl(i,a,o);let u;if(c){if(r.__sygnalFragment||"Fragment"===r.name)return r(i||{},a);i||(i={}),u=r,r=r.componentName||r.name||"FUNCTION_COMPONENT"}const h=c?void 0:Gr(a);let d;const f=(t=>{const e=_r[t];if(void 0!==e)return e;let n=0;for(let e;n<t.length&&35!=(e=t.charCodeAt(n))&&46!=e;n++);if(n==t.length)return Er(t);const s=t.slice(0,n);return 9&(_r[s]??Er(s))})(r);let p=!c&&gr(r)&&!(5&f);void 0===h&&(p=!!(Pr(a,d=[])&+p));const m=i?Dr(i,t,c?n:8&f?s:e,c||8&f&&2):{};u&&(m[u.preventInstantiation?"m":"c"]=u);const g=void 0!==l?l:i?i.key:void 0,y=p?new wr(r,m,d,h,g):{sel:r,data:m,children:d,text:h,elm:void 0,key:g};return 2&f&&kr(y),y},o=(t,e,...n)=>r(t,e,n);return o.a=r,o.$r=e,o})({attrs:"",props:"",class:"",data:"dataset",style:"",hook:"",on:""});function Yr(t,e,n){let s,r=n.initialDeps??[],o=!0;function i(){const i=t(),a=i.length!==r.length||i.some(((t,e)=>r[e]!==t));return a?(r=i,s=e(...i),!(null==n?void 0:n.onChange)||o&&n.skipInitialOnChange||n.onChange(s),o=!1,s):s}return i.updateDeps=t=>{r=t},i}function Fr(t,e){if(void 0===t)throw new Error("Unexpected undefined"+(e?`: ${e}`:""));return t}const qr=(t,e)=>Math.abs(t-e)<1.01,zr=(t,e,n)=>{let s;return Object.assign((function(...r){t.clearTimeout(s),s=t.setTimeout((()=>e.apply(this,r)),n)}),{cancel:()=>{t.clearTimeout(s)}})};let Br;const Wr=()=>{if(void 0!==Br)return Br;if("undefined"==typeof navigator)return Br=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Br=!0;const t=navigator.maxTouchPoints;return Br="MacIntel"===navigator.platform&&void 0!==t&&t>0},Ur=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},Vr=t=>t,Hr=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1)-e+1,s=new Array(n);for(let t=0;t<n;t++)s[t]=e+t;return s},Jr={passive:!0},Kr="undefined"==typeof window||"onscrollend"in window,Zr=(t,e)=>((t,e,n)=>{const s=t.scrollElement;if(!s)return;const r=t.targetWindow;if(!r)return;const o=t.options.useScrollendEvent&&Kr;let i=0;const a=o?null:zr(r,(()=>e(n(s),!1)),t.options.isScrollingResetDelay),l=t=>()=>{i=n(s),null==a||a(),e(i,t)},c=l(!0),u=l(!1);return s.addEventListener("scroll",c,Jr),o&&s.addEventListener("scrollend",u,Jr),()=>{s.removeEventListener("scroll",c),o&&s.removeEventListener("scrollend",u),null==a||a.cancel()}})(t,e,(e=>{const{horizontal:n,isRtl:s}=t.options;return n?e.scrollLeft*(s?-1:1):e.scrollTop})),Xr=(t,e,n)=>{if(n.options.useCachedMeasurements){const e=n.indexFromElement(t),s=n.options.getItemKey(e);return n.itemSizeCache.get(s)??n.options.estimateSize(e)}if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t){return Math.round(t[n.options.horizontal?"inlineSize":"blockSize"])}}if(!e){const e=n.indexFromElement(t),s=n.options.getItemKey(e),r=n.itemSizeCache.get(s);if(void 0!==r)return r}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},Qr=(t,{adjustments:e=0,behavior:n},s)=>{var r,o;null==(o=null==(r=s.scrollElement)?void 0:r.scrollTo)||o.call(r,{[s.options.horizontal?"left":"top"]:t+e,behavior:n})};class to{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this._clampedAdjustment=null,this.elementsCache=new Map,this.now=()=>{var t,e,n;return(null==(n=null==(e=null==(t=this.targetWindow)?void 0:t.performance)?void 0:e.now)?void 0:n.call(e))??Date.now()},this.observer=(()=>{let t=null;const e=()=>t||(this.targetWindow&&this.targetWindow.ResizeObserver?t=new this.targetWindow.ResizeObserver((t=>{t.forEach((t=>{const e=()=>{const e=t.target,n=this.indexFromElement(e);if(e.isConnected)this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(e,t,this));else{this.observer.unobserve(e);for(const[t,n]of this.elementsCache)if(n===e){this.elementsCache.delete(t);break}}};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(e):e()}))})):null);return{disconnect:()=>{var n;null==(n=e())||n.disconnect(),t=null},observe:t=>{var n;return null==(n=e())?void 0:n.observe(t,{box:"border-box"})},unobserve:t=>{var n;return null==(n=e())?void 0:n.unobserve(t)}}})(),this.range=null,this.setOptions=t=>{var e;const n={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Vr,rangeExtractor:Hr,onChange:()=>{},measureElement:Xr,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const e in t){const s=t[e];void 0!==s&&(n[e]=s)}const s=this.options;let r=null,o=null,i=!1;if(void 0!==s&&s.enabled&&n.enabled&&"end"===n.anchorTo&&null!==this.scrollElement){const t=s.count,a=n.count,l=this.getMeasurements(),c=(null==(e=this._singleLaneMeasurements)?void 0:e.items)??l,u=t=>{return"object"==typeof(e=c[t])?e.key:e;var e},h=t>0?u(0):null,d=t>0?u(t-1):null;if(a!==t||t>0&&a>0&&(n.getItemKey(0)!==h||n.getItemKey(a-1)!==d)){i=!0;const e=t>0?this.getVirtualItemForOffset(this.getScrollOffset())??l[0]:null;e&&(r=[e.key,this.getScrollOffset()-e.start]);const c=!0===n.followOnAppend?"auto":n.followOnAppend||null;c&&a>0&&this.isAtEnd(s.scrollEndThreshold)&&(0===t||n.getItemKey(a-1)!==d)&&(a>t||function(t,e,n,s){if(0===e)return!1;const r=s(0),o=new Set;let i=0;for(;i<t;){const t=n(i);if(t===r)break;o.add(t),i++}const a=t-i;if(0===a||a>=e)return!1;for(let t=0;t<a;t++)if(s(t)!==n(i+t))return!1;for(let t=a;t<e;t++)if(o.has(s(t)))return!1;return!0}(t,a,u,n.getItemKey))&&(o=c)}}this.options=n,i&&(this.pendingMin=0,this.itemSizeCacheVersion++);let a=!1,l=0;if(r&&null!==this.scrollOffset){const[t,e]=r,n=this.getMeasurements(),{count:s,getItemKey:i}=this.options;let c=0;for(;c<s&&i(c)!==t;)c++;if(c<s){const t=n[c];if(t){const n=Math.max(0,t.start+e);o||n===this.scrollOffset||(l=n-this.scrollOffset,this.scrollOffset=n,a=!0)}}}(a||o)&&(this.pendingScrollAnchor=[a?r[0]:null,a?r[1]:0,o,l])},this.notify=t=>{var e,n;null==(n=(e=this.options).onChange)||n.call(e,this,t)},this.maybeNotify=Yr((()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null])),(t=>{this.notify(t)}),{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((t=>t())),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t,e;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n)return void this.maybeNotify();if(this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(t=this.scrollElement)?void 0:t.window)??null,this.elementsCache.forEach((t=>{this.observer.observe(t)})),this.unsubs.push(this.options.observeElementRect(this,(t=>{this.scrollRect=t,this.maybeNotify()}))),this.unsubs.push(this.options.observeElementOffset(this,((t,e)=>{if(e&&null===this._intendedScrollOffset&&t===this.scrollOffset)return;null!==this._intendedScrollOffset&&Math.abs(t-this._intendedScrollOffset)<1.5&&(t=this._intendedScrollOffset),this._intendedScrollOffset=null,null!==this._clampedAdjustment&&Math.abs(t-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;const n=this.getScrollOffset();this.scrollDirection=e?n===t?this.scrollDirection:n<t?"forward":"backward":null,this.scrollOffset=t,this.isScrolling=e,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()}))),"addEventListener"in this.scrollElement){const t=this.scrollElement,e=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,Wr()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout((()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()}),150))};t.addEventListener("touchstart",e,Jr),t.addEventListener("touchend",n,Jr),this.unsubs.push((()=>{t.removeEventListener("touchstart",e),t.removeEventListener("touchend",n),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)}))}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const s=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,s&&this.scrollElement&&this.options.enabled){const[t,n,r,o]=s;null===t||r||(Wr()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?0!==o&&(this._iosDeferredAdjustment+=o):("smooth"!==(null==(e=this.scrollState)?void 0:e.behavior)||qr(this.getScrollOffset()-o,this.scrollState.lastTargetOffset))&&this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(null===this._clampedAdjustment||!this.scrollElement||!this.options.enabled)return;const{target:t,maxAtWrite:e}=this._clampedAdjustment,n=this.getMaxScrollOffset();n>e+.5&&(this._clampedAdjustment=t>n+.5?{target:t,maxAtWrite:n}:null,this._scrollToOffset(t,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment)return;if(this.isScrolling)return;if(this._iosTouching)return;if(this._iosJustTouchEnded)return;const t=this.getScrollOffset(),e=this.getMaxScrollOffset();if(t<0||t>e)return;if(this._iosDeferredAdjustment<0&&t>=e-1)return void(this._iosDeferredAdjustment=0);const n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Yr((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap]),((t,e,n,s,r,o,i,a)=>(void 0!==this.prevLanes&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:t,paddingStart:e,scrollMargin:n,getItemKey:s,enabled:r,lanes:o,laneAssignmentMode:i,gap:a})),{key:!1}),this.isIndexInRange=t=>t>=0&&t<this.options.count,this.getMeasurements=Yr((()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion]),(({count:t,paddingStart:e,scrollMargin:n,getItemKey:s,enabled:r,lanes:o,laneAssignmentMode:i,gap:a},l)=>{var c;const u=this.itemSizeCache;if(!r)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const e of this.laneAssignments.keys())e>=t&&this.laneAssignments.delete(e);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach((t=>{this.itemSizeCache.set(t.key,t.size)})));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),1===o){const r=2*t;let o=null==(c=this._singleLaneMeasurements)?void 0:c.flat;if(!o||o.length<r){const t=new Float64Array(r);o&&h>0&&t.set(o.subarray(0,2*h)),o=t}const i=0===h?new Array(t):this._singleLaneMeasurements.items.slice();let l;if(0===h)l=e+n;else{const t=h-1;l=o[2*t]+o[2*t+1]+a}for(let e=h;e<t;e++){const t=s(e);i[e]=t;const n=u.get(t),r="number"==typeof n?n:this.options.estimateSize(e);o[2*e]=l,o[2*e+1]=r,l+=r+a}this._singleLaneMeasurements={flat:o,items:i};const d=function(t,e){const n=t.length;return new Proxy(t,{get(t,s,r){if("string"==typeof s){const r=s.charCodeAt(0);if(r>=48&&r<=57){const r=+s;if(Number.isInteger(r)&&r>=0&&r<n){let n=t[r];if("object"!=typeof n){const s=e[2*r];n=t[r]={index:r,key:n,start:s,size:e[2*r+1],end:s+e[2*r+1],lane:0}}return n}}if("length"===s)return n}return Reflect.get(t,s,r)}})}(i,o);return this.measurementsCache=d,d}const d=this.measurementsCache.slice(0,h),f=new Array(o).fill(void 0),p=new Float64Array(o);let m=0;for(let t=0;t<h;t++){const e=d[t];e&&(void 0===f[e.lane]&&m++,f[e.lane]=t,p[e.lane]=e.end)}for(let r=h;r<t;r++){const t=s(r),l=this.laneAssignments.get(r);let c,h;const g="estimate"===i||u.has(t);if(void 0!==l&&this.options.lanes>1){c=l;const t=f[c],s=void 0!==t?d[t]:void 0;h=s?s.end+a:e+n}else if(m===o){let t=0,e=p[0],n=f[0];for(let s=1;s<o;s++){const r=p[s];(r<e||r===e&&f[s]<n)&&(t=s,e=r,n=f[s])}c=t,h=e+a,g&&this.laneAssignments.set(r,c)}else c=r%this.options.lanes,h=e+n,g&&this.laneAssignments.set(r,c);const y=u.get(t),v="number"==typeof y?y:this.options.estimateSize(r),b=h+v;d[r]={index:r,start:h,size:v,end:b,key:t,lane:c},void 0===f[c]&&m++,f[c]=r,p[c]=b}return this.measurementsCache=d,d}),{key:!1,debug:()=>this.options.debug}),this.calculateRange=Yr((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes]),((t,e,n,s)=>0===t.length||0===e?(this.range=null,null):(this.range=function(t,e,n,s,r){const o=t.length-1;if(t.length<=s)return{startIndex:0,endIndex:o};if(1===s&&null!==r){const t=function(t,e,n){let s=0;for(;s<=e;){const r=(s+e)/2|0,o=t[2*r];if(o<n)s=r+1;else{if(!(o>n))return r;e=r-1}}return s>0?s-1:0}(r,o,n);let s=t;const i=n+e;for(;s<o&&r[2*s]+r[2*s+1]<i;)s++;return{startIndex:t,endIndex:s}}const i=e=>t[e].start;let a=eo(0,o,i,n),l=a;if(1===s)for(;l<o&&t[l].end<n+e;)l++;else if(s>1){const r=Array(s).fill(0);for(;l<o&&r.some((t=>t<n+e));){const e=t[l];r[e.lane]=e.end,l++}const i=Array(s).fill(n+e);for(;a>=0&&i.some((t=>t>=n));){const e=t[a];i[e.lane]=e.start,a--}a=Math.max(0,a-a%s),l=Math.min(o,l+(s-1-l%s))}return{startIndex:a,endIndex:l}}(t,e,n,s,1===s&&null!==this._singleLaneMeasurements?this._singleLaneMeasurements.flat:null),this.range)),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Yr((()=>{let t=null,e=null;const n=this.calculateRange();return n&&(t=n.startIndex,e=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,e]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,e]}),((t,e,n,s,r)=>null===s||null===r?[]:t({startIndex:s,endIndex:r,overscan:e,count:n})),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const e=this.options.indexAttribute,n=t.getAttribute(e);return n?parseInt(n,10):(console.warn(`Missing attribute name '${e}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var e;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;const n=this.scrollState.index??(null==(e=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:e.index);if(void 0!==n&&this.range){const e=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),s=Math.max(0,n-e),r=Math.min(this.options.count-1,n+e);return t>=s&&t<=r}return!0},this.measureElement=t=>{if(!t)return void this.elementsCache.forEach(((t,e)=>{t.isConnected||(this.observer.unobserve(t),this.elementsCache.delete(e))}));const e=this.indexFromElement(t);if(!this.isIndexInRange(e))return;const n=this.options.getItemKey(e),s=this.elementsCache.get(n);s!==t&&(s&&this.observer.unobserve(s),this.observer.observe(t),this.elementsCache.set(n,t)),this.isScrolling&&!this.scrollState||!this.shouldMeasureDuringScroll(e)||this.resizeItem(e,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,e)=>{var n,s,r;if(!this.isIndexInRange(t))return;let o,i,a;const l=null==(n=this._singleLaneMeasurements)?void 0:n.flat;if(1===this.options.lanes&&null!=l)a=this.options.getItemKey(t),i=l[2*t],o=l[2*t+1];else{const e=this.measurementsCache[t];if(!e)return;a=e.key,i=e.start,o=e.size}const c=this.itemSizeCache.get(a)??o,u=e-c;if(0!==u){const n="end"===this.options.anchorTo&&"smooth"!==(null==(s=this.scrollState)?void 0:s.behavior)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,l=n?this.getTotalSize():0,h=this.getScrollOffset()+this.scrollAdjustments,d=!this.itemSizeCache.has(a)?i<h:i+c<=h&&"backward"!==this.scrollDirection,f="smooth"!==(null==(r=this.scrollState)?void 0:r.behavior)&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:a,start:i,size:o,end:i+o,lane:0},u,this):d);(null===this.pendingMin||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(a,e),this.itemSizeCacheVersion++;let p=!1;n?p=this.applyScrollAdjustment(this.getTotalSize()-l):f&&(p=this.applyScrollAdjustment(u)),this.notify(p),this._retryClampedAdjustment()}},this.getVirtualItems=Yr((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((t,e)=>{const n=[];for(let s=0,r=t.length;s<r;s++){const r=e[t[s]];n.push(r)}return n}),{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{var e;const n=this.getMeasurements();if(0===n.length)return;const s=null==(e=this._singleLaneMeasurements)?void 0:e.flat,r=1===this.options.lanes&&null!=s,o=eo(0,n.length-1,r?t=>s[2*t]:t=>Fr(n[t]).start,t);return Fr(n[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,e,n=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),r=this.getScrollOffset();"auto"===e&&(e=t>=r+s?"end":"start"),"center"===e?t+=(n-s)/2:"end"===e&&(t-=s);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,t),0)},this.getOffsetForIndex=(t,e="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const n=this.getSize(),s=this.getScrollOffset(),r=this.measurementsCache[t];if(!r)return;if("auto"===e)if(r.end>=s+n-this.options.scrollPaddingEnd)e="end";else{if(!(r.start<=s+this.options.scrollPaddingStart))return[s,e];e="start"}if("end"===e&&t===this.options.count-1)return[this.getMaxScrollOffset(),e];const o="end"===e?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,e,r.size),e]},this.scrollToOffset=(t,{align:e="start",behavior:n="auto"}={})=>{this._iosDeferredAdjustment=0;const s=this.getOffsetForAlignment(t,e),r=this.now();this.scrollState={index:null,align:e,behavior:n,startedAt:r,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:e="auto",behavior:n="auto"}={})=>{this._iosDeferredAdjustment=0,t=Math.max(0,Math.min(t,this.options.count-1));const s=this.getOffsetForIndex(t,e);if(!s)return;const[r,o]=s,i=this.now();this.scrollState={index:t,align:o,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:e="auto"}={})=>{const n=this.getScrollOffset()+t,s=this.now();this.scrollState={index:null,align:"start",behavior:e,startedAt:s,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{this.options.count>0?this.scrollToIndex(this.options.count-1,{align:"end",behavior:t}):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t,e;const n=this.getMeasurements();let s;if(0===n.length)s=this.options.paddingStart;else if(1===this.options.lanes){const r=n.length-1,o=null==(t=this._singleLaneMeasurements)?void 0:t.flat;s=null!=o?o[2*r]+o[2*r+1]:(null==(e=n[r])?void 0:e.end)??0}else{const t=Array(this.options.lanes).fill(null);let e=n.length-1;for(;e>=0&&t.some((t=>null===t));){const s=n[e];null===t[s.lane]&&(t[s.lane]=s.end),e--}s=Math.max(...t.filter((t=>null!==t)))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(0===this.itemSizeCache.size)return t;const e=this.getMeasurements();for(const n of e)n&&this.itemSizeCache.has(n.key)&&t.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return t},this._scrollToOffset=(t,{adjustments:e,behavior:n})=>{this._intendedScrollOffset=t+(e??0),this.options.scrollToFn(t,{behavior:n,adjustments:e},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,e){if(0===t)return!1;if(Wr()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=t,!1;{const n=this.getScrollOffset()+this.scrollAdjustments+t,s=this.scrollElement,r=null!==s&&("scrollHeight"in s||"document"in s)?this.getMaxScrollOffset():null;return this._clampedAdjustment=null!==r&&n>r+.5?{target:n,maxAtWrite:r}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:e}),null!==this.scrollOffset&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){this.targetWindow?null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame((()=>{this.rafId=null,this.reconcileScroll()}))):this.scrollState=null}reconcileScroll(){if(!this.scrollState)return;if(!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3)return void(this.scrollState=null);const t=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,e=t?t[0]:this.scrollState.lastTargetOffset,n=e!==this.scrollState.lastTargetOffset;if(!n&&qr(e,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1)return this.getScrollOffset()!==e&&this._scrollToOffset(e,{adjustments:void 0,behavior:"auto"}),void(this.scrollState=null)}else if(this.scrollState.stableFrames=0,n){const t=this.getSize()||600,n=Math.abs(e-this.getScrollOffset()),s="smooth"===this.scrollState.behavior&&n>t;this.scrollState.lastTargetOffset=e,s||(this.scrollState.behavior="auto"),this._scrollToOffset(e,{adjustments:void 0,behavior:s?"smooth":"auto"})}this.scheduleScrollReconcile()}}const eo=(t,e,n,s)=>{for(;t<=e;){const r=(t+e)/2|0,o=n(r);if(o<s)t=r+1;else{if(!(o>s))return r;e=r-1}}return t>0?t-1:0};const no="virtual-collection",so=/^(estimateSize|overscan|role|tabIndex|style|id|aria-(label|labelledby|describedby))$/,ro=[],oo=(t,e,n)=>globalThis.__SYGNAL_DIAGNOSTICS__?.virtual?.(t,e,n),io=t=>t+"px",ao=t=>t&&(t.getRootNode?.()||t.ownerDocument)?.activeElement,lo=t=>"estimateSize"!=t&&"overscan"!=t,co=(t,e,n)=>{const s=Object.keys(t).filter((t=>n||lo(t)));return s.length==Object.keys(e).filter((t=>n||lo(t))).length&&s.every((s=>t[s]===e[s]||!n&&"style"==s&&t[s]&&e[s]&&"object"==typeof t[s]&&co(t[s],e[s],1)))},uo=t=>"function"==typeof t?"f":t;class ho extends fr{setProps(t,e,n,s){const r={},o={};for(const e in t)(so.test(e)?r:o)[e]=t[e];o.className=t.className,this.dc||(this.dc=new WeakMap,this.all=ro,this.warned=0,this.si=[],this.fi=this.pin=-1);const i=this.vp,a=this.props?.className;this.vp=r,super.setProps(o,e,n,s);const l=i&&uo(r.estimateSize)!==uo(i.estimateSize);i&&!l&&r.overscan===i.overscan||this.opts(l),i&&a===o.className&&co(r,i)||(this.cd=void 0)}opts(t){const e=this.vp,n=e.estimateSize,s=e.overscan;void 0===n||"function"==typeof n||n>0||oo(434,this.owner,{prop:"estimateSize",value:n}),void 0===s||s>=0||oo(434,this.owner,{prop:"overscan",value:s}),this.sz||(this.sz=t=>{const e=this.vp.estimateSize,n="function"==typeof e?e(this.itemAt(t),t):e;return n>0?n:32}),this.re||(this.re=t=>this.range(t));const r={count:this.all.length,getItemKey:this.gk||(this.gk=t=>this.all[t]),getScrollElement:()=>this.el,estimateSize:this.sz,rangeExtractor:this.re,useAnimationFrameWithResizeObserver:"function"==typeof requestAnimationFrame,overscan:s>=0?s:5,initialRect:{width:0,height:10*(n>0?n:32)},scrollToFn:Qr,observeElementOffset:Zr,observeElementRect:(t,e)=>((t,e)=>{const n=t.scrollElement;if(!n)return;const s=t.targetWindow;if(!s)return;const r=t=>{const{width:n,height:s}=t;e({width:Math.round(n),height:Math.round(s)})};if(r(Ur(n)),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver((e=>{const s=()=>{const t=e[0];if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return void r({width:e.inlineSize,height:e.blockSize})}r(Ur(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()}));return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}})(t,(t=>e(this.bound(t)))),measureElement:(t,e,n)=>e?.borderBoxSize?.[0]?.blockSize||t.getBoundingClientRect().height||t.offsetHeight||n.options.estimateSize(n.indexFromElement(t)),onChange:()=>this.disposed||this.owner.app.commit()};this.v?(this.v.setOptions(r),t&&this.v.measure()):this.v=new to(r)}range(t){const e=Hr(t),n=void 0===this.fk?-1:this.fi;return this.pin=-1,n>=0&&n<t.count&&e.length&&(n<e[0]||n>e[e.length-1])&&(this.pin=n,n<e[0]?e.unshift(n):e.push(n)),e}rowOf(t){const e=this.el;for(let n=t;n&&n!==e;n=n.parentNode)if(n.parentNode?.parentNode?.parentNode===e&&n.hasAttribute?.("data-index"))return n}focus(t){t===this.fk||this.disposed||(this.fk=t,this.fi=void 0===t?-1:this.all.indexOf(t),this.re=t=>this.range(t),this.opts(),this.owner.app.commit())}itemAt(t){const[e,n]=this.index();return e[n.get(this.all[t])]}bound(t){const e=this.el,n=this.v,s=n.getTotalSize(),r=e?.ownerDocument?.defaultView;if(!t.height)return e?.getClientRects?.().length&&this.warn(1,{reason:"height"}),{width:t.width,height:n.options.initialRect.height};const o=r?.innerHeight||0;if(o&&s>o&&Math.max(t.height,e.clientHeight||0)>=s-1&&this.grows(e)){this.warn(2,{reason:"grows",height:t.height});const n=e.currentCSSZoom||Math.min(Math.max(e.getBoundingClientRect().height/e.offsetHeight||1,.1),10);return{width:t.width,height:o/n}}return t}grows(t){const e=t.firstElementChild?.style;if(!e)return!0;const n=[],s="overflow-anchor";for(let e=t.assignedSlot||t.parentElement||t.getRootNode?.().host;e?.style;e=e.assignedSlot||e.parentElement||e.getRootNode?.().host)n.push(e,e.style.getPropertyValue(s),e.style.getPropertyPriority(s),e.hasAttribute("style")),e.style.setProperty(s,"none");const r=e.height,o=t.offsetHeight;e.height=(parseFloat(r)||0)+1e6+"px";const i=t.offsetHeight;e.height=r,t.offsetHeight;for(let t=0;t<n.length;t+=4){const e=n[t];n[t+1]?e.style.setProperty(s,n[t+1],n[t+2]):e.style.removeProperty(s),n[t+3]||(e.getAttribute("style"),e.removeAttribute("style"))}return i-o>5e5}warn(t,e){this.warned&t||(this.warned|=t,oo(430,this.owner,e))}keys(){if(!this.index)return!1;const[t,e]=this.index(),{filter:n,sort:s}=this.props;if(t===this.la&&n===this.lf&&s===this.ls)return!1;let r;"function"==typeof n||s||e.size!=t.length?r=this.list(t,e):(r=[...e.keys()],this.ls=s,this.cmp=void 0),this.la=t,this.lf=n,t.length&&!(4&this.warned)&&globalThis.__SYGNAL_DIAGNOSTICS__?.virtual&&t.some(((t,e)=>"\0"==vs(t,e)[0]))&&(this.warned|=4,oo(431,this.owner,{count:t.length}));const o=this.all;return(r.length!=o.length||!r.every(((t,e)=>t===o[e])))&&(this.all=r,void 0!==this.fk&&((this.fi=r.indexOf(this.fk))<0&&(this.fk=void 0),this.re=t=>this.range(t)),this.gk=t=>this.all[t],this.opts(),!0)}items_(){const t=this.keys(),e=this.v,n=this.owner.app,s=this.owner,r=this.all,o=r.length?e.getVirtualIndexes():ro,i=new Set;for(const t of o)i.add(r[t]);const a=this.shown;if(this.p1&&!t)return!1;if(!t&&a.length&&o.length){const t=t=>a[t].k;let e=0,s=0;for(;e<a.length&&e<o.length&&t(e)===r[o[e]];)e++;for(s=e;s<a.length&&!i.has(t(s));s++);if(s>e&&s<a.length&&t(a.length-1)!==r[o[o.length-1]]){for(let n=e;n<s;n++)a[n].dispose(),this.items.delete(t(n));return this.shown=a.slice(0,e).concat(a.slice(s)),this.si=this.si.slice(0,e).concat(this.si.slice(s)),this.p1=!0,queueMicrotask((()=>{this.p1=!1,this.disposed||n.commit()})),!0}}this.p1=!1;for(const[t,e]of this.items)i.has(t)||(e.dispose(),this.items.delete(t));const l=[];for(const t of o){const e=r[t];let o=this.items.get(e);if(!o){const t=n.scope();o=new or(n,this.def,s,_s(this.arr,this.index,e),s.dom&&s.dom.isolateSource(s.dom,t),this.ip,this.kids,t,this.uidBase+"-"+bs(e),"item"),this.items.set(e,o),o.k=e}l.push(o)}const c=l.length!=a.length||l.some(((t,e)=>t!==a[e]));return this.shown=l,this.si=o,c}clear(){super.clear(),this.all=ro,this.si=[]}deco(t,e,n,s,r,o){const i=this.dc.get(t);if(i&&i[0]===e&&i[1]===n&&i[2]===s&&i[3]===r&&i[4]===o)return i[5];let a=e;if(e.sel){const i=e.data||{},l=i.attrs?.role||i.props?.role,c={...i.attrs,"data-index":n};(r||l)&&(c["aria-posinset"]=n+1,c["aria-setsize"]=s),r&&!l&&(c.role="listitem");const u={...i,attrs:c};void 0!==o&&(u.style={...i.style,position:"absolute",top:o,left:"0",width:"100%"}),xr(u,{insert:t=>this.v?.measureElement(t.elm)}),a={...e,data:u,key:t.k}}else 8&this.warned||(this.warned|=8,oo(432,this.owner,{component:this.def.name}));return this.dc.set(t,[e,n,s,r,o,a]),a}box(){if(this.cd)return this.cd;const t=this.vp,e={role:void 0===t.role?"list":t.role,tabindex:t.tabIndex??0};for(const n of["id","aria-label","aria-labelledby","aria-describedby"])null!=t[n]&&(e[n]=t[n]);return null==e.role&&delete e.role,this.cd={props:this.props.className?{className:this.props.className}:{},attrs:e,style:{overflowY:"auto",overflowAnchor:"none",...t.style},vc:{commands:{scrollToIndex:1,scrollToId:1}},hook:{insert:Object.assign((t=>this.attach(t.elm)),{s:1}),prepatch:(t,e)=>{const n=t!==e&&ao(this.el);this.fa=n&&this.el.contains(n)?(t=>{for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t})(n):null},postpatch:(t,e)=>{const n=this.fa,s=n?.ownerDocument.activeElement;this.fa=null,!n?.isConnected||s&&s!==n.ownerDocument.body||n.focus({preventScroll:!0}),e.elm!==this.el&&this.attach(e.elm)},destroy:()=>this.detach()}}}attach(t){this.el&&this.detach(),this.el=t,t.scrollToIndex=t=>this.scrollTo("number"==typeof t?t:t?.index,t),t.scrollToId=t=>{const e="object"==typeof t&&t?t.id:t,n=null==e?-1:this.all.indexOf(""+e);n<0?oo(433,this.owner,{id:e,count:this.all.length}):this.scrollTo(n,t)};const e=t=>this.focus(this.all[this.rowOf(t.target)?.getAttribute("data-index")]),n=e=>t.contains(e.relatedTarget||ao(t))||this.focus(void 0);t.addEventListener("focusin",e),t.addEventListener("focusout",n);const s=this.v._didMount();this.un=()=>{s(),t.removeEventListener("focusin",e),t.removeEventListener("focusout",n)},this.v._willUpdate()}scrollTo(t,e){const n=this.all.length;t>=0&&t<n&&!(t%1)?this.v.scrollToIndex(t,{align:e?.align,behavior:e?.behavior}):oo(433,this.owner,{index:t,count:n})}detach(){const t=this.el;t&&(this.el=void 0,delete t.scrollToIndex,delete t.scrollToId,this.un?.())}render(){if(this.disposed)return this.outv;const t=this.owner.app;let e=!this.outv||this.ep!==t.ep;this.ep=t.ep,this.items_()&&(e=!0);const n=this.v,s=this.all.length,r=this.shown,o=this.si,i=s&&o.length?n.getMeasurements():ro,a=this.pin,l=o[0]===a&&o.length>1?o[1]:o[0],c=i[l]?i[l].start:0,u=n.getTotalSize(),h="list"==(void 0===this.vp.role?"list":this.vp.role),d=this.lw;d&&d[0]===c&&d[1]===u&&d[2]===o[0]||(e=!0);const f=[],p=this.props.viewTransitionName;for(let t=0;t<r.length;t++){const n=r[t],l=n.render(),u=o[t];l!==n.last&&(n.last=l,e=!0),void 0!==l&&f.push(this.deco(n,p?pr(n,l,p):l,u,s,h,u===a&&i[u]?io(i[u].start-c):void 0))}const m=this.box();if(m!==d?.[3]&&(e=!0),!e)return this.outv;this.lw=[c,u,o[0],m];const g={sel:"div",data:{style:{position:"absolute",top:"0",left:"0",width:"100%",transform:`translateY(${io(c)})`}},children:f,text:void 0,elm:void 0,key:void 0},y={sel:"div",data:{style:{position:"relative",width:"100%",height:io(u)}},children:[g],text:void 0,elm:void 0,key:void 0};return this.outv={sel:"div",data:m,children:[y],text:void 0,elm:void 0,key:this.key}}dispose(){this.disposed||(super.dispose(),this.detach())}}const fo=(t,e,n,s,r)=>new ho(t,e,n,s,r),po=()=>{};po.__sygnalControl=(t,e)=>{j[no]||(j[no]=fo);const{key:n,children:s,...r}=t||{},o=e?.length?e:s?[].concat(s):ro;return{sel:no,data:{props:r,m:1},children:o,text:void 0,elm:void 0,key:n}},po.componentName=no;const mo="Use of={{ name: Component }}",go="Set current to a key of 'of'";class yo{constructor(t,e,n,s){this.owner=t,this.pages={},this.ready=!0,this.disposed=!1,this.lr=!0,this.kids=[],function(t,e){const n=e.of;n||Fn("SYG415",t,"Switchable is missing 'of'",mo),ns(n)||Fn("SYG415",t,"Switchable 'of' is a "+typeof n,mo),Object.values(n).every((t=>"function"==typeof t))||Fn("SYG415",t,"Switchable 'of' has a value that is not a component",mo);const s=e.current;s&&"string"==typeof s||Fn("SYG416",t,"Switchable 'current' is missing or a "+typeof s,go),s in n||Fn("SYG416",t,`Switchable 'current' '${s}' is not a key of 'of'`,go)}(t,e);const r=e.state,i="string"==typeof r&&t.def.calcNames?.has(r);this.cell="string"==typeof r?gs(t.cell,r,i&&t.def.name,void 0,"Switchable sub-component"):void 0!==r?ys(t.cell,r,t.def.name,(e=>t.app.appError(t,e,"view"))):t.cell,this.uidBase=t.uid(o(s.replace(/.*::(r\.)?/,""))),this.props=e,this.kids=n;for(const n in e.of){const s=e.of[n],r=dr(s,t);this.pages[n]={inst:this.make(n,r),i:void 0,view:s,fn:r}}this.setProps(e,n)}make(t,e){const n=this.owner,s=n.app,r=s.def(e),i=s.scope(),a=new or(s,r,n,r.isolated?ms(s,this.cell):this.cell,n.dom&&n.dom.isolateSource(n.dom,i),this.props,this.kids,i,this.uidBase+"-"+o(t),"page");return a.shown=!1,a}setProps(t,e){let n=t.current;if("string"==typeof n&&n in this.pages||(Yn("SYG416",this.owner,`Switchable 'current' '${n}' is not a key of 'of'`,go),n=this.cur),!function(t,e){if(!t||!e)return!1;const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const s of n)if(t[s]!==e[s]&&("of"!=s||!Zs(t[s],e[s])))return!1;return!0}(t,this.props)||e!==this.kids){this.props=t,this.kids=e;for(const n in this.pages)this.pages[n].inst.setProps(t,e)}for(const t in this.pages){const e=this.pages[t],n=dr(e.view,this.owner);if(n!==e.fn){const s=e.inst.shown;e.inst.dispose(),e.inst=this.make(t,e.fn=n),e.inst.shown=s}}const s=this.pages[n];s&&(void 0!==s.i&&s.i!==t.instance&&(s.inst.dispose(),s.inst=this.make(n,s.fn)),s.i=t.instance),n!==this.cur&&(void 0!==this.cur&&(this.pages[this.cur].inst.shown=!1),this.cur=n),s&&(s.inst.shown=!0)}insts(){return Object.values(this.pages).map((t=>t.inst))}sync(){if(!this.disposed)for(const t in this.pages)this.pages[t].inst.sync()}render(){if(this.disposed)return this.outv;for(const t in this.pages)t!==this.cur&&this.pages[t].inst.sync();const t=this.pages[this.cur];return this.outv=t?t.inst.render():void 0}dispose(){if(!this.disposed){this.disposed=!0;for(const t in this.pages)this.pages[t].inst.dispose()}}}j.switchable=(t,e,n,s)=>new yo(t,e,n,s);const vo=t=>{const{children:e,...n}=t;return d("switchable",{props:n},e)};vo.componentName="switchable",vo.preventInstantiation=!0;const bo="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||setTimeout,wo=t=>{bo((()=>{bo(t)}))};let So=!1;function _o(t,e,n){wo((()=>{t[e]=n}))}function Eo(t,e){let n,s;const r=e.elm;let o=t.data.style,i=e.data.style;if(!o&&!i)return;if(o===i)return;o=o||{},i=i||{};const a="delayed"in o;for(s in o)s in i||("-"===s[0]&&"-"===s[1]?r.style.removeProperty(s):r.style[s]="");for(s in i)if(n=i[s],"delayed"===s&&i.delayed)for(const t in i.delayed)n=i.delayed[t],a&&n===o.delayed[t]||_o(r.style,t,n);else"remove"!==s&&n!==o[s]&&("-"===s[0]&&"-"===s[1]?r.style.setProperty(s,n):r.style[s]=n)}const ko={pre:function(){So=!1},create:Eo,update:Eo,destroy:function(t){let e,n;const s=t.elm,r=t.data.style;if(r&&(e=r.destroy))for(n in e)s.style[n]=e[n]},remove:function(t,e){const n=t.data.style;if(!n||!n.remove)return void e();let s;So||(t.elm.offsetLeft,So=!0);const r=t.elm;let o=0;const i=n.remove;let a=0;const l=[];for(s in i)l.push(s),r.style[s]=i[s];const c=getComputedStyle(r)["transition-property"].split(", ");for(;o<c.length;++o)-1!==l.indexOf(c[o])&&a++;r.addEventListener("transitionend",(t=>{t.target===r&&--a,0===a&&e()}))}},Ao=t=>/^(input|textarea|select)(?![\w-])/i.test(t.sel)||/^\w+-/.test(t.sel)&&t.elm.constructor.formAssociated;const xo={update:function(t,e){if(!Ao(e))return;const n=e.data?.props,s=e.elm;if(!n||!s||"file"==s.type)return;const r=t.data?.props||{},{value:o,checked:i}=n;if("value"in n&&o===r.value&&(null!=o||"SELECT"!=s.tagName)){const t=null==o?"":String(o);String(s.value)!==t&&(s.value=s.constructor.formAssociated?o:t)}"checked"in n&&i===r.checked&&s.checked!==!!i&&(s.checked=!!i)}};let Oo=[];function To(t,e){if(!Ao(e))return;const n=e.elm,s=e.data?.props?.value;n&&"SELECT"===n.tagName&&null!=s&&Oo.push({elm:n,value:s})}const $o={create:To,update:To,post:function(){const t=Oo;Oo=[];for(let e=0;e<t.length;e++){const{elm:n,value:s}=t[e];n.value!==String(s)&&(n.value=s)}}};function jo(t){const e=t.sel||"",n=e.indexOf("#"),s=e.indexOf(".",n);return(s>0?e.slice(s+1).split("."):[]).concat(function(t){const e=[],n=t.data?.class;if(n&&"object"==typeof n)for(const t in n)n[t]&&e.push(t);return e}(t))}function Co(t,e){for(const n of e)n&&t.classList.add(n)}const No=t=>null!=t&&!1!==t;function Lo(t,e){const n=e.data?.props,s=t.data?.props,r=!!n&&"className"in n,o=s?s.className:void 0;if(!r&&!No(o))return;const i=e.elm;if(!i||!i.classList)return;const a=r?n.className:void 0;if(No(a))return void(s&&s.className===a||Co(i,jo(e)));if(r)return void(s&&s.className===a||(i.className=jo(e).join(" "),""===i.className&&i.removeAttribute("class")));const l=jo(e);for(const t of(t=>"string"==typeof t?t.split(/\s+/).filter(Boolean):[])(o))-1===l.indexOf(t)&&i.classList.remove(t);Co(i,l),""===i.getAttribute("class")&&i.removeAttribute("class")}function Mo(t,e,n){if("className"===e)return;if(/^(value|checked)$/.test(e)&&/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)){const s="value"===e&&"";return void(n&&t[e]!==s&&(t[e]=s))}const s="htmlFor"===e?"for":e.replace(/^aria(?=[A-Z])/,"aria-").toLowerCase();if(t.hasAttribute?.(s))return t.removeAttribute(s);const r=t[e],o=typeof r,i="boolean"!==o&&("string"===o?"":null===r||"function"===o?null:void 0);try{"number"!==o&&r!==i&&(t[e]=i)}catch(t){}}function Io(t,e){const n=e.elm,s=e.data?.props||{},r=t.data?.props||{};if(n&&r!==s){for(const t in r)t in s||Mo(n,t);for(const e in s){const o=s[e];o!==r[e]&&(null==o?Mo(n,e,!0):"value"===e&&n[e]===o&&t.sel||(n[e]=o))}}}const Do=[ko,k,{create:Io,update:Io},{create:Lo,update:Lo},x,$,$o,xo],Go=Do.map((t=>t.update)),Po=Do.map((({update:t,...e})=>e)).concat({update(t,e){if(Ao(e)||!qs(t.data,e.data))for(let n=0;n<Go.length;n++)Go[n](t,e)}});let Ro;const Yo=t=>Rn("SYG417","Portal",`Target '${t}' not found; content not rendered`,"Render the target first"),Fo=t=>Vs({sel:"div",data:{},children:t,text:void 0,elm:void 0,key:void 0});function qo(t,e,n){const s=t.data._p={v:t,kids:n,pv:null,c:null,t:0,dead:!1};let r=0;const o=()=>{s.t=0,s.dead||s.pv||(!function(t,e){const n=document.querySelector(e);if(!n)return!1;const s=document.createElement("div");return n.appendChild(s),t.pv=t.v.data._portalVnode=(Ro||(Ro=_(Po)))(s,Fo(t.kids)),t.c=t.v.data._portalContainer=n,!0}(s,e)?r++<10?s.t=setTimeout(o,5):Yo(e):r&&Ys(s.c))};o()}C.portal=t=>function(t,e){const n=e||[];return{sel:"div.sygnal-portal",data:{style:{display:"none"},attrs:{"data-sygnal-portal":t},portalChildren:n,hook:{insert:e=>qo(e,t,n),postpatch:(e,n)=>{const s=e.data?._p;s?(n.data._p=s,s.v=n,s.kids=n.data?.portalChildren||[],s.pv&&(s.pv=n.data._portalVnode=Ro(s.pv,Fo(s.kids)),n.data._portalContainer=s.c)):qo(n,t,n.data?.portalChildren||[])},destroy:t=>{const e=t.data?._p;if(!e)return;e.dead=!0,clearTimeout(e.t);const n=e.pv?.elm;n&&(Ro(e.pv,Fo([])),n.remove())}}},children:[],text:void 0,elm:void 0,key:void 0}}(t.data?.props?.target,t.children||[]);const zo=t=>{const{children:e,...n}=t;return d("portal",{props:n},e)};function Bo(t,e){const n={...t.data?.hook},{insert:s,remove:r}=n,o=e.name||"v",i=e.duration,a=(t,e,n)=>{const s=t=>`${o}-${e}-${t}`;t.classList.add(s("from"),s("active")),requestAnimationFrame((()=>{requestAnimationFrame((()=>{t.classList.remove(s("from")),t.classList.add(s("to")),function(t,e,n){if("number"==typeof e)return void setTimeout(n,e);const s=()=>{t.removeEventListener("transitionend",s),n()};t.addEventListener("transitionend",s)}(t,i,(()=>{t.classList.remove(s("active"),s("to")),n&&n()}))}))}))};return n.insert=t=>{s&&s(t);const e=t.elm;e&&e.classList&&a(e,"enter")},n.remove=(t,e)=>{r&&r(t,(()=>{}));const n=t.elm;n&&n.classList?a(n,"leave",(()=>{const t=n.parentNode,s=()=>n.parentNode||Ys(t);e(),s(),n.addEventListener("transitionend",s)})):e()},{...t,data:{...t.data,hook:n}}}zo.componentName="portal",zo.preventInstantiation=!0;const Wo=Symbol();C.transition=t=>{const e=t.children?.[0],n=t.data?.props||{},s=n.name+" "+n.duration;return e?.sel?"collection"==e.sel?{...e,data:{...e.data,tr:t=>{var e;return(e=t[Wo]||(t[Wo]={}))[s]||(e[s]=Bo(t,n))}}}:Bo(e,n):e||t};const Uo=t=>{const{children:e,...n}=t;return d("transition",{props:n},e)};function Vo(t){if(!t)return!1;const e=t.data?.attrs;return!1===t.ready||"false"===e?.["data-sygnal-ready"]||"loading"===e?.["data-sygnal-lazy"]||"suspense"!==t.sel&&(Array.isArray(t.children)&&t.children.some(Vo))}Uo.componentName="transition",Uo.preventInstantiation=!0,N.suspense=function t(e){if(!e||e.data?.isolate)return e;if("suspense"===e.sel){const n=e.data?.props?.fallback,s=e.children||[],r=n&&s.some(Vo);return r||1!==s.length?{sel:"div",data:{attrs:{"data-sygnal-suspense":r?"pending":"resolved"}},children:r?["string"==typeof n?{text:n}:n]:s.map(t),text:void 0,elm:void 0,key:void 0}:t(s[0])}const n=e.children;let s;for(let e=0;n&&e<n.length;e++){const r=t(n[e]);r!==n[e]&&((s||(s=n.slice()))[e]=r)}return s?{...e,children:s}:e};const Ho=t=>{const{children:e,...n}=t;return d("suspense",{props:n},e)};Ho.componentName="suspense",Ho.preventInstantiation=!0;const Jo=t=>{const{children:e,...n}=t;return d("slot",{props:n},e)};Jo.componentName="slot",Jo.preventInstantiation=!0;const Ko=new WeakMap;L.push(((t,e)=>{if(!t.__sygnalLazy)return;if(t.__sygnalLazyLoaded())return t.__sygnalLazyLoadedComponent||void 0;let n=Ko.get(t);if(!n){const e=n=new Set;Ko.set(t,e);const s=()=>e.forEach((e=>{const n=e=>{e.def?.view!==t||e.disposed||(e.forced=!0)};for(const t of e.kids.values())t.insts?t.insts().forEach(n):n(t);e.refresh()}));t.__sygnalLazyStarted?.then(s),t.__sygnalLazyPromise?.then((()=>{e.done=!0,s(),e.clear()}))}const s=n;s.done||s.has(e)||(s.add(e),e.dispose$?.().addListener({next:()=>s.delete(e)}))}));const Zo="__emitterId",Xo=t=>t[Zo],Qo=(t,e)=>(void 0!==t[Zo]&&Object.defineProperty(e,Zo,{value:t[Zo]}),e),ti=(t,e)=>!("then"in t||"catch"in t)||Yn("SYG610",t.__emitterName,`${e}: request not sent: it has a 'then'/'catch' key`,"Use ok: 'ACTION' / error: 'ACTION'",t),ei=t=>{const e=new Map;return{replies:{__sygnalReplies:!0,replies:n=>Ye.create({start:t=>{e.set(n,t)},stop:()=>{e.delete(n),t?.(n)}})},reply:(t,n,s)=>{e.get(t)?.next({type:n,data:s})},listening:t=>e.has(t)}};const ni=(t,e)=>{const n=!1===t.jitter?0:null==t.jitter||!0===t.jitter?.2:+t.jitter;return Math.min(t.maxDelayMs??1e4,(t.delayMs??500)*2**e)*(1+n*(2*Math.random()-1))},si=()=>"hidden"==globalThis.document?.visibilityState,ri=t=>{const e=globalThis.window;if(!e?.addEventListener)return()=>{};const n=()=>si()||t("focus"),s=[[e,"focus",n],[e,"online",()=>t("online")],[e.document,"visibilitychange",n]];return s.forEach((([t,e,n])=>t?.addEventListener(e,n))),()=>s.forEach((([t,e,n])=>t?.removeEventListener(e,n)))},oi=async(t,e)=>{const n=await t["~standard"].validate(e);if(!n.issues)return n.value;const s=new Error("Validation failed: "+n.issues.map((t=>t.message)).join("; "));throw s.name="ValidationError",s.issues=n.issues,s},ii=100,ai=["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","priority","window","duplex"],li="__sygnalScope",ci=t=>t&&"object"==typeof t&&t[li]||[],ui=(t,e)=>{const n="string"==typeof t?{url:t}:t&&"object"==typeof t?Qo(t,{...t}):t;return n&&"object"==typeof n&&Object.defineProperty(n,li,{value:[e,...ci(t)]}),n},hi=(t,e)=>{const n=ci(e);return t.every(((t,e)=>n[e]===t))},di=t=>ci(t).join(""),fi=(t,e,n)=>{if(!e)return t;const s=new URLSearchParams;Object.keys(e).forEach((t=>[].concat(e[t]).forEach((e=>null!=e&&s.append(t,String(e)))))),n&&s.sort();const r=s.toString();if(!r)return t;const o=t.indexOf("#"),i=o<0?t:t.slice(0,o);return i+(i.includes("?")?/[?&]$/.test(i)?"":"&":"?")+r+(o<0?"":t.slice(o))},pi=async t=>{if(204==t.status)return null;const e=t.headers,n=e&&"function"==typeof e.get?e.get("content-type")||"":null;if(null===n)return"function"==typeof t.json?t.json():t.text();if(!/[/+]json\b/i.test(n))return t.text();const s=await t.text();return s?JSON.parse(s):null},mi={auto:pi,json:t=>t.json(),text:t=>t.text(),response:t=>t},gi=t=>{const e={};return t&&"object"==typeof t&&ai.forEach((n=>{void 0!==t[n]&&(e[n]=t[n])})),e},yi=(...t)=>{if("function"!=typeof Headers)return Object.assign({},...t);const e=new Headers;t.forEach((t=>t&&new Headers(t).forEach(((t,n)=>e.set(n,t)))));const n={};return e.forEach(((t,e)=>{n[e]=t})),n},vi=/^(GET|HEAD)$/i,bi=(t,e)=>{try{return"function"==typeof t?!!t(e):[].concat(t).some((t=>"/"==t[0]?String(e.url).startsWith(t):[].concat(e.tags).includes(t)))}catch(t){return!1}},wi=/^[se]/;function Si(t={}){const e=t.cache;if(e&&!e.key)throw new Error("[Sygnal] makeFetchDriver: cache takes queryCache(...) from sygnal");const n=n=>{let s=0,r=!1;const o=new Map,i=new Set,a=[!1,!1],l=[[],[]],c=(t,e)=>{let n=!1;i.forEach((s=>{let r=!1;try{r=s.err===t&&((t,e)=>hi(t.ns,e.request)&&(void 0===t.sel||("function"==typeof t.sel?t.sel(e):e.category===t.sel)))(s,e)}catch(t){}if(r){n=!0;try{s.l.next(e)}catch(t){console.error("[Sygnal] makeFetchDriver: a listener threw",t)}}})),t&&!n&&console.error(`[Sygnal] makeFetchDriver: request${void 0===e.category?"":` '${e.category}'`} failed (nothing listens to errors()):`,e.error)},u=t=>{a[t]=!0;const e=l[t];l[t]=[],e.forEach((e=>c(!!t,e)))},h=(t,e)=>{if(r)return;const n=+t;if(a[n])return c(t,e);l[n].push(e)>ii&&l[n].shift(),t&&1==l[n].length&&setTimeout((()=>a[n]||u(n)))},d=t=>{const e=e=>n=>{let s;return Ye.create({start:r=>{i.add(s={l:r,sel:n,err:e,ns:t});const o=+e;a[o]||(a[o]=!0,queueMicrotask((()=>u(o))))},stop:()=>{i.delete(s)}})};return{select:e(!1),errors:e(!0),isolateSource:(e,n)=>d(t.concat(n)),isolateSink:(t,e)=>t.map((t=>ui(t,e))),isolateValue:ui,__sygnalStatic:"resources",__inspect:x,__matches:t=>f(t,1),...w}},f=(t,n)=>{let r=e?e.inval(t,n):0;n||e?.f.forEach((e=>bi(t,e.q)&&g(e)));const o=s;return v.forEach(((e,s)=>e.forEach(((e,i)=>{!e.p&&e.q&&bi(t,e.q)&&(r++,n||E(s,i,e,1,o))})))),r},p=t=>{const e=o.get(t);if(!e)return!1;o.delete(t),clearTimeout(e.timer);const n=e.f;if(n&&!n.x&&n.s.delete(e)&&!n.s.size){m(n);try{n.c.abort?.()}catch(t){}}return!0},m=t=>{t.x=1,clearTimeout(t.t),e?.f.get(t.k)===t&&e.f.delete(t.k)},g=t=>{t.z=1,e.f.delete(t.k)},y=t=>o.forEach(((e,n)=>{t(e)&&p(n)})),v=new Map,b=(t,e,n)=>{clearTimeout(n.t),y((n=>n.sender===t&&n.rk==="\0"+e))},{replies:w,reply:S}=ei((t=>{v.get(t)?.forEach((t=>{clearTimeout(t.t),e?.use(t)})),v.delete(t),y((e=>void 0!==e.rk&&e.sender===t))})),_=(t,e,n,r,o,i,a)=>{S(t,"RESOURCE",{name:e,...n.last={status:r,data:o,error:i,refreshing:a||void 0}}),clearTimeout(n.t);const l=n.q?.refetchEvery;l>0&&!n.p&&!a&&wi.test(r)&&(n.t=setTimeout((function r(){si()?n.t=setTimeout(r,l):E(t,e,n,1,s)}),l))},E=(t,n,s,r,o)=>{const i=s.q,a=e?.key(i,1),l=e?.get(a),c=s.last,u=void 0!==o||!e?.fresh(a,i);b(t,n,s),e?.use(s,a),l&&"v"in l&&!i.validate?_(t,n,s,"success",l.v,void 0,u):(r||i.keepPrevious)&&c&&wi.test(c.status)?_(t,n,s,c.status,c.data,c.error,!0):_(t,n,s,"loading"),(u||i.validate)&&(s.i=k(i,t,n,o,s))},k=(n,i=Xo(n),a,l=-1,c,u)=>{if("string"==typeof n&&(n={url:n}),!n||"object"!=typeof n||r||!ti(n,"makeFetchDriver"))return;const{url:d,category:w,method:A,headers:x,query:O,json:T,body:$,latest:j,timeoutMs:C,parse:N,abort:L,init:M,ok:I,error:D,key:G,resources:P,refresh:R,invalidates:Y,updates:F,retry:q,validate:z,prefetch:B}=n;if("invalidate"in n)return f(n.invalidate);if(B)return e&&k(B,0,a,-1,c,1);if(P||R){if(void 0===i)return;const t=v.get(i)||new Map;return v.set(i,t),R?[].concat(R).forEach((e=>{const n=t.get(e);n?.q&&!n.p&&E(i,e,n,1,s)})):void new Set([...t.keys(),...Object.keys(P)]).forEach((n=>{let s=t.get(n);if(!(n in P)){if(s&&!s.p){s.p=1,b(i,n,s),e?.use(s);const t=s.last;t&&wi.test(t.status)?t.refreshing&&_(i,n,s,t.status,t.data,t.error):_(i,n,s,"idle")}return}let r=P[n];r&&"string"==typeof r&&(r={url:r});const o=r?JSON.stringify(r):"",a=s?.p;if(s||t.set(n,s={j:""}),s.p=0,s.j===o&&!a)return;const l=s.j===o;s.j=o,s.q=r,r?E(i,n,s,l):(b(i,n,s),e?.use(s),_(i,n,s,"idle"))}))}const W=di(n),U=void 0!==a?"\0"+a:u||void 0===i||!I&&!D?void 0:G??I??D;if(void 0!==i&&("string"==typeof L||L&&void 0!==G))return y((t=>t.sender===i&&t.rk===(G??L)));if(L)return y((t=>t.scope===W&&(!("category"in n)||t.category===w)));(void 0!==a||!u&&(j??t.latest))&&y(void 0===U?t=>void 0===t.rk&&t.scope===W&&t.category===w:t=>t.sender===i&&t.rk===U);const V=fi((t.baseUrl||"")+(d??""),O),H=t.init,J=M,K=yi(t.headers,H?.headers,J?.headers,x);let Z=$??J?.body;void 0!==T&&(Z=JSON.stringify(T),Object.keys(K).some((t=>"content-type"==t.toLowerCase()))||(K["content-type"]="application/json"));const X=A||J?.method||H?.method||(void 0!==Z?"POST":"GET"),Q=e?.key(n,void 0!==a||u),tt=++s,et={category:w,scope:W,sender:i,rk:U};o.set(tt,et);const nt=et.ko=(t,e)=>p(tt)&&(c&&_(i,a,c,"error",c.last?.data,t),void 0!==U&&D?S(i,D,{error:t,request:n,...e}):void 0===a&&!u&&h(!0,{error:t,category:w,request:n,...e}));et.ok=async(t,s)=>{if(z)try{t=await oi(z,t)}catch(t){return nt(t,{status:s,issues:t.issues})}p(tt)&&(c&&_(i,a,c,"success",t),F&&((t,n,s)=>{const r=v.get(t);("object"!=typeof n||Array.isArray(n)?[].concat(n):Object.keys(n)).forEach((t=>{const o=r?.get(t),i=o?.q,a=n[t];if(!i)return;const l=e?.key(i,1),c="function"==typeof a?a(o.last?.data??e?.get(l)?.v,s):s;if(void 0!==l){e.put(l,i,c);const t=e.f.get(l);t&&g(t)}v.forEach(((t,e)=>t.forEach(((t,n)=>{(t===o||void 0!==l&&!t.p&&t.k===l)&&(b(e,n,t),_(e,n,t,"success",c))}))))}))})(i,F,t),void 0!==U&&I?S(i,I,t):void 0===a&&!u&&h(!1,{category:w,value:t,status:s,request:n}),Y&&f(Y))};const st=C??t.timeoutMs;if(st>0&&(et.timer=setTimeout((()=>{const t=new Error(`Request timed out after ${st}ms: ${V}`);t.name="TimeoutError",nt(t)}),st)),l<0&&e?.fresh(Q,n))return queueMicrotask((()=>et.ok(e.get(Q).v,200))),tt;let rt=void 0!==Q&&e.f.get(Q);if(!rt||rt.id<=l){const s=q??(vi.test(X)?t.retry:0),r=s&&"object"==typeof s?s:{count:+s||0},o=r.count??3;rt={id:tt,k:Q,q:n,s:new Set,n:0},void 0!==Q&&e.f.set(Q,rt);const i=N||t.parse||"auto",l="function"==typeof i?i:mi[i]||pi,c=globalThis,h=t.fetch||"function"==typeof c.fetch&&((t,e)=>c.fetch(t,e)),d={...gi(H),...gi(J),method:X,headers:K,body:Z},f=(t,e,n)=>{m(rt),rt.s.forEach((s=>t?s.ko(t,o?{...e,attempts:rt.n}:e):s.ok(e,n)))},p=()=>{const s=rt.c="function"==typeof AbortController?new AbortController:{},i=()=>rt.c===s&&!rt.x,c=t=>!(rt.n>o)&&(rt.t=setTimeout(p,1e3*t?.headers?.get?.("retry-after")||ni(r,rt.n-1)),!0);let m;rt.n++;try{if("function"!=typeof h)throw new Error("fetch is not available in this environment (pass makeFetchDriver({ fetch }))");t._tap?.(n,a,u),m=Promise.resolve(h(V,{...d,signal:s.signal}))}catch(t){m=Promise.reject(t)}m.then((async t=>{if(i())try{const s=t.status;if(!1===t.ok||s<200||s>299){let e;try{e=await pi(t)}catch(t){}if(!i()||(408==s||429==s||s>499)&&c(t))return;const n=new Error(`HTTP ${s}${t.statusText?" "+t.statusText:""}: ${V}`);return n.status=s,n.body=e,f(n,{status:s,body:e})}let r;try{r=await l(t)}catch(t){return i()&&f(t,{status:s})}if(!i())return;void 0===Q||rt.z||e.put(Q,n,r),f(0,r,s)}catch(t){i()&&f(t)}}),(t=>{i()&&!c()&&f(t)}))};p()}return rt.s.add(et),et.f=rt,tt},A=e?.on(t._on,(()=>{const t=s;v.forEach(((n,s)=>n.forEach(((n,r)=>{n.p||!n.q||void 0===n.k||o.has(n.i)||e.fresh(n.k,n.q)||E(s,r,n,1,t)}))))}));e&&(e.d=k);const x=()=>({cache:e?.list()}),O=()=>{y((()=>!0)),A?.(),v.forEach((t=>t.forEach((t=>clearTimeout(t.t)))))};return n.addListener({next:t=>{try{k(t)}catch(e){console.error("[Sygnal] makeFetchDriver: invalid request",t,e)}},error:t=>console.error("[Sygnal] makeFetchDriver: the request stream errored",t),complete:O}),{...d([]),dispose:()=>{O(),r=!0}}};return n.cache=e,n}const _i=/^(GET|HEAD)$/i;const Ei="__sygnalScope",ki=t=>t[Ei]||[],Ai=(t,e)=>t&&"object"==typeof t?Object.defineProperty(Qo(t,{...t}),Ei,{value:[e,...ki(t)]}):t;function xi(t={}){return e=>{const n=globalThis,s=new Map,r=new Map,o=new Set;let i=!1,a=0;const l=(t,e)=>Yn("SYG611",e.__emitterName,`makeSocketDriver: ${t}`,"Declare { connections: { room: { socket: url } } }, then send { to: 'room', json }",e),c=(t,e,n)=>{const s=t.spec[e];if("string"==typeof s&&void 0!==t.sender)return S(t.sender,s,n);const r={name:t.name,type:e,data:n};o.forEach((e=>{if((void 0===e.name||e.name===t.name)&&e.ns.every(((e,n)=>t.scope[n]===e)))try{e.l.next(r)}catch(t){console.error(t)}}))},u=(t,e)=>[...t.subs].forEach(e),h=t=>{if("string"==typeof t)try{return JSON.parse(t)}catch(t){}return t},d=e=>{const n=e.reconnect,s=t.reconnect;return!1===n||null==n&&!1===s?null:{...s&&"object"==typeof s&&s,...n&&"object"==typeof n&&n}},f=(t,e,n)=>{try{t.s.send(e)}catch(t){c(n,"error",{error:t})}},p=t=>t.s&&t.sse&&u(t,(e=>Object.keys(e.spec.events||{}).forEach((e=>{if(t.on.has(e))return;t.on.add(e);const n=t.s;n.addEventListener(e,(s=>t.s===n&&u(t,(t=>{const n=t.spec.events?.[e];"string"==typeof n&&void 0!==t.sender&&S(t.sender,n,h(s.data))}))))})))),m=(t,e)=>{let n;t.s=null,t.open=!1,u(t,(s=>{const r=!t.x&&d(s.spec);c(s,"close",{...e,willReconnect:!!r}),r?n=n||r:y(s,!0)})),n&&t.subs.size&&(t.timer=setTimeout((()=>g(t)),ni(n,t.n++)))},g=e=>{e.timer=0;const s=e.sse?t.EventSource??n.EventSource:t.WebSocket??n.WebSocket;if("function"!=typeof s)return;let r;try{r=e.sse?new s(e.url,{withCredentials:!!e.spec.withCredentials}):new s(e.url,e.spec.protocols)}catch(t){return u(e,(e=>c(e,"error",{error:t}))),e.x=1,m(e,{code:1006,reason:""+t})}e.s=r,e.on=new Set;const o=t=>n=>{e.s===r&&t(n)};r.onopen=o((()=>{e.n=0,e.open=!0,u(e,(t=>{c(t,"open",{reconnected:!!t.opened}),t.opened=!0}));const t=e.queue;e.queue=[],t.forEach((t=>e.s===r&&f(e,t.data,t.e)))})),r.onmessage=o((t=>{const n=h(t.data);u(e,(t=>c(t,"message",n)))})),r.onerror=o((t=>{u(e,(e=>c(e,"error",{error:t}))),e.sse&&(2!=r.readyState&&[...e.subs].some((t=>d(t.spec)))?e.open&&(e.open=!1,u(e,(t=>c(t,"close",{willReconnect:!0})))):(r.close(),m(e,{})))})),e.sse||(r.onclose=o((t=>m(e,{code:t.code,reason:t.reason})))),p(e)},y=(t,e)=>{const n=t.t;e||s.get(t.sender)?.delete(t.name),n&&(t.t=null,n.subs.delete(t),n.queue=n.queue.filter((e=>e.e!==t)),n.subs.size||(t=>{clearTimeout(t.timer),r.delete(t.key);const e=t.s;if(t.s=null,e)try{e.close()}catch(t){}})(n))},v=(e,o,i)=>{let u=s.get(e);u||s.set(e,u=new Map),u.forEach(((t,e)=>{o[e]||y(t)})),Object.keys(o).forEach((s=>{const h=o[s];if(!h)return;const d=u.get(s);if("object"!=typeof h||"string"!=typeof h.socket&&"string"!=typeof h.sse||!ti(h,"makeSocketDriver")){if(d&&y(d),"object"==typeof h&&("then"in h||"catch"in h))return;return l(`connection '${s}' needs a socket or sse URL`,h)}const f="string"==typeof h.sse,m=((e,s)=>{/^[a-z][a-z\d+.-]*:/i.test(e)||(e=(t.baseUrl||"")+e);const r=n.location;if(s||/^wss?:/i.test(e)||!r)return e;try{const t=new URL(e,r.href);return t.protocol="https:"==t.protocol?"wss:":"ws:",t.href}catch(t){return e}})(f?h.sse:h.socket,f),v=(!1===h.share?"u":"")+(f?"e"+!!h.withCredentials:"s"+JSON.stringify(h.protocols))+m;if(d&&d.key===v)return d.spec=h,void(d.t&&p(d.t));d&&y(d);const b={sender:e,name:s,spec:h,scope:i,key:v,sse:f,url:m,t:null,opened:!1};u.set(s,b),(t=>{const e=!1===t.spec.share?t.key+"#"+ ++a:t.key;let n=r.get(e);const s=!n;s&&r.set(e,n={key:e,sse:t.sse,url:t.url,spec:t.spec,subs:new Set,queue:[],n:0,on:new Set}),t.t=n,n.subs.add(t),s?g(n):(p(n),n.open&&queueMicrotask((()=>{t.t===n&&n.open&&!t.opened&&(t.opened=!0,c(t,"open",{reconnected:!1}))})))})(b)}))},b=()=>{s.forEach((t=>t.forEach((t=>y(t))))),s.clear()},{replies:w,reply:S}=ei((t=>{s.get(t)?.forEach((t=>y(t))),s.delete(t)}));e.addListener({next:e=>{if(e&&"object"==typeof e&&!i&&ti(e,"makeSocketDriver"))try{const n=Xo(e);void 0!==e.connections?v(n,e.connections||{},ki(e)):void 0!==e.to?((e,n)=>{const r=s.get(e)?.get(n.to),o=r?.t;if(!o||o.sse)return l(o?`'${n.to}' is a server-sent events connection (read-only)`:`no connection named '${n.to}' is open`,n);const i=void 0!==n.json?JSON.stringify(n.json):n.text??n.binary;o.open?f(o,i,r):o.queue.push({data:i,e:r})>(t.queueLimit??100)&&o.queue.shift()})(n,e):l("expected { connections } or { to, json | text | binary }",e)}catch(t){console.error("[Sygnal] makeSocketDriver",e,t)}},error:t=>console.error("[Sygnal] makeSocketDriver",t),complete:b});const _=t=>({select:e=>{let n;return Ye.create({start:s=>{o.add(n={l:s,name:e,ns:t})},stop:()=>{o.delete(n)}})},isolateSource:(e,n)=>_(t.concat(n)),isolateSink:(t,e)=>t.map((t=>Ai(t,e))),isolateValue:Ai,__sygnalStatic:"connections",...w});return{..._([]),dispose:()=>{b(),i=!0}}}}const Oi=encodeURIComponent,Ti=t=>{try{return decodeURIComponent(t)}catch(e){return t}},$i=globalThis,ji=/:(\w+)/g,Ci=32,Ni=t=>(t.match(ji)||[]).map((t=>t.slice(1))),Li=(t,e,n)=>($i.__SYGNAL_DIAGNOSTICS__?.error||console.error)("SYG620",t.__emitterName,`router: ${e}; not navigated`,n,t);function Mi(t={}){const{mode:e,prefetch:n,navigate:s}=t,r=t.routes||{},o=(t.base||"").replace(/\/$/,""),i="hash"==e,a=t.focus??"[data-router-focus],main h1,h1",l=t.scroll??!s,c=(t,e={},n,s)=>{$i.__SYGNAL_DIAGNOSTICS__?.routerHref?.(r,t,e);const a=r[t],l=null==a||"*"==a?"/":a.replace(ji,((t,n)=>Oi(e[n]??""))),c=n&&new URLSearchParams(Object.entries(n).filter((([,t])=>null!=t)))+"";return o+(i?o?"/#":"#":"")+l+(c?"?"+c:"")+(s?"#"+s:"")},u=t=>{const e=t.split("/").filter(Boolean);let n=null;for(const t in r){const s=r[t];if("*"==s){n??(n=t);continue}const o=s.split("/").filter(Boolean),i={};if(o.length==e.length&&o.every(((t,n)=>":"==t[0]?(i[t.slice(1)]=Ti(e[n]),1):t==e[n])))return{name:t,params:i}}return{name:n,params:{}}},h=t=>{let e=new URL(t,"http://x");i&&(e=new URL(e.hash.slice(1)||"/","http://x"));let n=e.pathname;i||!o||n!=o&&!n.startsWith(o+"/")||(n=n.slice(o.length));const s="/"+n.split("/").filter(Boolean).join("/");return{...u(s),query:Object.fromEntries(new URLSearchParams(e.search)),hash:Ti(e.hash.slice(1)),path:s}},d=()=>t.window||("undefined"!=typeof window?window:null),f=e=>{const n=d();return h(e??(n?(t.location||n.location).href:"/"))};return{routes:r,href:c,match:h,current:f,driver:e=>{const u=d(),p=u&&(t.location||u.location),m=u&&(t.history||u.history),g=u&&(t.document||u.document),y=new Map,v=new Map,b=new Map;let w=0,S=0,_="",E="",k=0,A=0,x=0,O=0,T=0,$=null,j=null,C="";const N=t=>({key:_=Date.now().toString(36)+x++,i:S=t}),L=(t,e)=>{let n=0;const s=t.filter(U),r=t=>(n++||e(),t);s.length?s.forEach((t=>W(t,ts,r))):setTimeout(e)},M=e=>{E=p.href;const n=$=f(),s=[...y],r=++w,o=()=>{w==r&&s.length&&(W(s[0][0],s[0][1],n),L(s.map((t=>t[0])),(()=>{if(w==r)for(const[t,e]of s.slice(1))y.get(t)==e&&W(t,e,n)})))};O++||queueMicrotask((()=>{O=0})),O>Ci?($i.__SYGNAL_DIAGNOSTICS__?.hooks?.on?.()&&!T++&&console.warn(`[Sygnal] router: more than ${Ci} navigations in one flush (a redirect loop?); each next one waits a task (reported once)`,n.path),setTimeout(o)):o(),"start"!=e&&(e=>{if(!g)return;let n,s;C=j&&"replace"==e?C:e,j?.();const r=()=>{j?.();const t=C,e=$.hash&&g.getElementById($.hash),n="pop"==t&&b.get(_);if(l&&(n?u.scrollTo(n[0],n[1]):e?.scrollIntoView?.()),a&&"replace"!=t)for(const t of a.split(",")){const e=g.querySelector(t);if(e){e.tabIndex<0&&!e.hasAttribute("tabindex")&&e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0});break}}},o=()=>{clearTimeout(n),n=setTimeout(r,t.settleMs??30)},i=setTimeout(r,1e3);u.MutationObserver&&(s=new u.MutationObserver(o)).observe(g.body||g.documentElement,{childList:!0,subtree:!0,characterData:!0}),j=()=>{clearTimeout(n),clearTimeout(i),s?.disconnect(),j=null},o()})(e)},I=t=>{const e=[...v].pop();return e&&(W(e[0],e[1],t),1)},D=(t,e,n,r)=>{if(r||!I({to:t,route:h(t),proceed:{url:t,replace:e,force:!0}})){if(s)return s(t,{overwriteLastHistoryEntry:!!e});b.set(_,[u.scrollX,u.scrollY]),m[e?"replaceState":"pushState"](N(e?S:S+1),"",t),l&&!e&&!1!==n&&u.scrollTo(0,0),M(e?"replace":"push")}},G=()=>{const t=m.state,e=t?.i??S+1;if(A)A=0;else{if(!k&&I({to:p.href,route:f(),proceed:{go:e-S,force:!0}}))return A=1,m.go(S-e);k=0,b.set(_,[u.scrollX,u.scrollY]),t?.key?(_=t.key,S=e):m.replaceState({...t,...N(e)},""),p.href!=E&&M("pop")}},P=t=>{if(t.defaultPrevented||t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;const e=(t.composedPath?.()||[]).find((t=>"a"==t.localName))||t.target?.closest?.("a"),n=t=>e.getAttribute(t),s=e&&(n("href")??e.getAttributeNS?.("http://www.w3.org/1999/xlink","href"));if(null==s||"_self"!=(n("target")||"_self")||e.hasAttribute("download")||e.hasAttribute("data-router-ignore")||/(^|\s)external(\s|$)/i.test(n("rel")||""))return;const r=new URL(s,g.baseURI||p.href),a=r.pathname==p.pathname&&r.search==p.search;r.origin==p.origin&&((i?!a||!r.hash.startsWith("#/"):o&&r.pathname!=o&&!r.pathname.startsWith(o+"/")||r.hash&&a)||(t.preventDefault(),D(r.pathname+r.search+r.hash)))},R=t=>{t.preventDefault(),t.returnValue=""},Y=()=>{m.scrollRestoration="auto"},F=t=>{const e=t?"addEventListener":"removeEventListener";u[e]("popstate",G),i&&u[e]("hashchange",G),s?u[e]("sygnal:navigate",z):g[e]("click",P),l&&u[e]("pagehide",Y)},q=()=>u?.[v.size?"addEventListener":"removeEventListener"]("beforeunload",R),z=()=>{const t=()=>p.href!=E&&M("push");queueMicrotask(t),setTimeout(t)},{replies:B,reply:W,listening:U}=ei((t=>{y.delete(t),v.delete(t)&&q()})),V=()=>{u&&(F(!1),v.clear(),q(),j?.(),Y())};if(u){const t=m.state;t?.key?(_=t.key,S=t.i):m.replaceState({...t,...N(0)},""),l&&"scrollRestoration"in m&&(m.scrollRestoration="manual"),F(!0),M("start")}const H=(t,e)=>{if(!(e in r)||"*"==r[e])return Li(t,`no route named '${e}'`,`Use one of: ${Object.keys(r).filter((t=>"*"!=r[t])).join(", ")}`);const n=Ni(r[e]).filter((e=>null==t.params?.[e]));return n.length?Li(t,`route '${e}' (${r[e]}) needs params: ${n.join(", ")}`,`{ to: '${e}', params: { ${n.join(", ")} } }`):c(e,t.params,t.query,t.hash)};return e.addListener({next:t=>{if(!t||"object"!=typeof t)return;const e=Xo(t);if("route"in t){if(Object.keys(t).length>1||t.route in r)return Li(t,"`route` is the declaration key","Navigate with { to: 'name', params }");if(!t.route||void 0===e)return void y.delete(e);y.set(e,t.route);const n=w,s=()=>y.get(e)==t.route&&w==n&&W(e,t.route,$);return void($&&(y.keys().next().value===e&&U(e)?s():L([e],s)))}const s=t.back||t.forward||t.go||null!=t.to||null!=t.url;if(!("block"in t)||(t.block?v.set(e,t.block):v.delete(e),q(),s))if("prefetch"in t){const e=t.prefetch in r?H({...t,to:t.prefetch},t.prefetch):t.prefetch;e&&n?.(h(e),e)}else{if(!u)return;if(t.back||t.forward||t.go)k=t.force?1:0,m.go(t.back?-1:t.forward?1:t.go);else if(s){const e=t.url??H(t,t.to);e&&D(e,t.replace,t.scroll,t.force)}else Li(t,"unknown command","{ to: 'name', params?, query?, hash?, replace? }, { back: true }, { forward: true }, { block: 'ACTION' } or { prefetch: 'name' }")}},error:t=>console.error("[Sygnal] router",t),complete:V}),{...B,__sygnalStatic:"route",__sygnalRouter:t,current:()=>$,href:c,dispose:V}},options:t}}function Ii(t,e,n=!1,s=!1,r=!1){let o=null;return De.create({start:function(i){o=s?function(t){Gi(t,s),i.next(t)}:function(t){i.next(t)},t.addEventListener(e,o,{capture:n,passive:r})},stop:function(){t.removeEventListener(e,o,n),o=null}})}function Di(t,e){const n=Object.keys(t),s=n.length;for(let r=0;r<s;r++){const s=n[r];if("object"==typeof t[s]&&null!==t[s]&&"object"==typeof e[s]&&null!==e[s]){if(!Di(t[s],e[s]))return!1}else if(t[s]!==e[s])return!1}return!0}function Gi(t,e){if(e)if("boolean"==typeof e)t.preventDefault();else if("function"==typeof e)e(t)&&t.preventDefault();else{if("object"!=typeof e)throw new Error("preventDefault has to be either a boolean, predicate function or object");Di(e,t)&&t.preventDefault()}}const Pi=(t,e)=>n=>Ri(t.map((t=>(t=e(t),n?n(t):t))));function Ri(t){return t.value=Pi(t,(t=>t?.target?.value)),t.checked=Pi(t,(t=>!!t?.target?.checked)),t.data=(e,n)=>{const s=String(e).replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),r=`[data-${s.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))}]`;return Pi(t,(t=>{const e=t?.target,n="function"==typeof e?.closest&&e.closest(r)||e;return n?.dataset?.[s]}))(n)},t.target=Pi(t,(t=>t?.target)),t.key=Pi(t,(t=>t?.key)),t.detail=Pi(t,(t=>t?.detail)),t}class Yi{constructor(t,e){this._name=t,this._selector=e||null}select(t){return new Yi(this._name,t)}elements(){if(this._selector){const t=Qe(Ye.of(Array.from(document.querySelectorAll(this._selector))));return t._isCycleSource=this._name,t}const t=Qe(Ye.of([document]));return t._isCycleSource=this._name,t}element(){if(this._selector){const t=Qe(Ye.of(document.querySelector(this._selector)));return t._isCycleSource=this._name,t}const t=Qe(Ye.of(document));return t._isCycleSource=this._name,t}events(t,e={},n){let s;if(s=Ii(document,t,e.useCapture,e.preventDefault),this._selector){const t=this._selector;s=s.filter((e=>{const n=e.target;return n instanceof Element&&(n.matches(t)||null!==n.closest(t))}))}const r=Ri(Qe(s));return r._isCycleSource=this._name,r}}class Fi{constructor(t){this._name=t}select(t){return this}elements(){const t=Qe(Ye.of([document.body]));return t._isCycleSource=this._name,t}element(){const t=Qe(Ye.of(document.body));return t._isCycleSource=this._name,t}events(t,e={},n){let s;s=Ii(document.body,t,e.useCapture,e.preventDefault);const r=Qe(s);return r._isCycleSource=this._name,r}}class qi{constructor(t,e){this.namespace=t,this.isolateModule=e,this._namespace=t.filter((t=>"selector"!==t.type))}isDirectlyInScope(t){const e=this.isolateModule.getNamespace(t);if(!e)return!1;if(this._namespace.length>e.length||!Ps(this._namespace,e.slice(0,this._namespace.length)))return!1;for(let t=this._namespace.length;t<e.length;t++)if("total"===e[t].type)return!1;return!0}}class zi{constructor(t,e){this.namespace=t,this.isolateModule=e}call(){const t=this.namespace,e=Gs(t),n=new qi(t,this.isolateModule),s=this.isolateModule.getElements(t.filter((t=>"selector"!==t.type)));return""===e?s:s.reduce(((t,s)=>{return t.concat((r=s.querySelectorAll(e),Array.prototype.slice.call(r)).filter(n.isDirectlyInScope,n),s.matches(e)?[s]:[]);var r}),[])}}function Bi(t){return(e,n)=>{if(":root"===n||!e)return e;const s=t.concat([Ui(n)]),r=Wi(e,s);return{...r,key:void 0!==r.key?r.key:JSON.stringify(r.data&&r.data.isolate||s)}}}function Wi(t,e){return t&&"object"==typeof t?t.sel?{...t,data:{...t.data,isolate:t.data&&Array.isArray(t.data.isolate)?t.data.isolate:e}}:t.children?{...t,children:t.children.map((t=>Wi(t,e)))}:t:t}function Ui(t){return{type:Is(t)?"sibling":"total",scope:t}}class Vi{constructor(t,e,n=[],s,r,o){this._rootElement$=t,this._sanitation$=e,this._namespace=n,this._isolateModule=s,this._eventDelegator=r,this._name=o,this.isolateSource=(t,e)=>new Vi(t._rootElement$,t._sanitation$,t._namespace.concat(Ui(e)),t._isolateModule,t._eventDelegator,t._name),this.isolateSink=function(t){const e=Bi(t);return(t,n)=>":root"===n?t:t.map((t=>e(t,n)))}(this._namespace),this.isolateValue=Bi(this._namespace)}_elements(){if(0===this._namespace.length)return this._rootElement$.map((t=>[t]));{const t=new zi(this._namespace,this._isolateModule);return this._rootElement$.map((()=>t.call()))}}elements(){const t=Qe(this._elements().remember());return t._isCycleSource=this._name,t}element(){const t=Qe(this._elements().filter((t=>t.length>0)).map((t=>t[0])).remember());return t._isCycleSource=this._name,t}get namespace(){return this._namespace}select(t){if(t?.__sygnalControl&&(t=""+t),"string"!=typeof t)throw new Error("DOM driver's select() expects the argument to be a string as a CSS selector");if("document"===t)return new Yi(this._name);if("body"===t)return new Fi(this._name);":root"!==t&&In(this,t.trim());const e=":root"===t?[]:this._namespace.concat({type:"selector",scope:t.trim()});return new Vi(this._rootElement$,this._sanitation$,e,this._isolateModule,this._eventDelegator,this._name)}events(t,e={},n){if("string"!=typeof t)throw new Error("DOM driver's events() expects argument to be a string representing the event type to listen for.");const s=Ri(Qe(this._eventDelegator.addEventListener(t,this._namespace,e,n)));return s._isCycleSource=this._name,s}dispose(){this._sanitation$.shamefullySendNext(null)}}function Hi(t){if(!t.sel)return{tagName:"",id:"",className:""};const e=t.sel,n=e.indexOf("#"),s=e.indexOf(".",n),r=n>0?n:e.length,o=s>0?s:e.length;return{tagName:-1!==n||-1!==s?e.slice(0,Math.min(r,o)):e,id:r<o?e.slice(r+1,o):void 0,className:s>0?e.slice(o+1).replace(/\./g," "):void 0}}class Ji{constructor(t){this.rootElement=t}call(t){if(11===this.rootElement.nodeType)return this.wrapDocFrag(null===t?[]:[t]);if(null===t)return this.wrap([]);const{tagName:e,id:n}=Hi(t),s=function(t){let{className:e=""}=Hi(t);if(!t.data)return e;const{class:n,props:s}=t.data;n&&(e+=` ${Object.keys(n).filter((t=>n[t])).join(" ")}`);return s&&s.className&&(e+=` ${s.className}`),e&&e.trim()}(t),r=(t.data||{}).props||{},{id:o=n}=r;return"string"==typeof o&&o.toUpperCase()===this.rootElement.id.toUpperCase()&&e.toUpperCase()===this.rootElement.tagName.toUpperCase()&&s.toUpperCase()===this.rootElement.className.toUpperCase()?t:this.wrap([t])}wrapDocFrag(t){return l("",{isolate:[]},t,void 0,this.rootElement)}wrap(t){const{tagName:e,id:n,className:s}=this.rootElement,r=n?`#${n}`:"",o=s?`.${s.split(" ").join(".")}`:"",i=d(`${e.toLowerCase()}${r}${o}`,{},t);return i.data=i.data||{},i.data.isolate=i.data.isolate||[],i}}class Ki{constructor(t){this.mapper=t,this.tree=[,{},0]}get(t,e,n=t.length){let s=this.tree;for(let r=0;r<n;r++){const n=this.mapper(t[r]);if(!s[1][n]){if(!e)return;s[2]++,s[1][n]=[,{},0]}s=s[1][n]}return e&&!s[0]&&(s[0]=e()),s[0]}delete(t,e=t.length,n=this.tree,s=0){if(s<e){const r=this.mapper(t[s]),o=n[1][r];o&&this.delete(t,e,o,s+1)&&(delete n[1][r],n[2]--)}else n[0]=void 0;return!n[0]&&!n[2]}}const Zi=(t,e)=>{const n=t.__sygnalHome;return n&&!t.contains(n)&&(e.$h=1+(0|e.$h))<99?n:t.parentNode};class Xi{constructor(){this.namespaceTree=new Ki((t=>t.scope)),this.namespaceByElement=new WeakMap,this.vnodesBeingRemoved=[]}setEventDelegator(t){this.eventDelegator=t}insertElement(t,e){this.namespaceByElement.set(e,t),this.namespaceTree.get(t,(()=>new Set)).add(e)}removeElement(t){const e=this.namespaceByElement.get(t),n=e&&this.namespaceTree.get(e);n&&(n.delete(t),n.size||this.namespaceTree.delete(e))}getElements(t){return[...this.namespaceTree.get(t)||[]]}getRootElement(t){if(this.namespaceByElement.has(t))return t;let e=t;const n={};for(;!this.namespaceByElement.has(e);)if(e=Zi(e,n),!e||"HTML"===e.tagName)return;return e}getNamespace(t){const e=this.getRootElement(t);if(e)return this.namespaceByElement.get(e)}createModule(){const t=this,e=new Map,n=[],s=t=>e.has(t)&&(n.push(t,t.elm),t.elm=e.get(t)),r=()=>{for(let t;n.length;)t=n.pop(),n.pop().elm=t};return{pre(){r(),e.clear()},create(n,s){const{elm:r,data:o={},children:i}=s,a=o.isolate;Array.isArray(a)&&t.insertElement(a,r),i?.forEach((t=>t?.elm&&e.set(t,e.get(t)||t.elm)))},update(e,n){const{elm:s,data:r={}}=e,{elm:o,data:i={}}=n,a=r.isolate,l=i.isolate;Ps(a,l)||Array.isArray(a)&&t.removeElement(s),Array.isArray(l)&&t.insertElement(l,o)},destroy(e){e.children?.forEach(s),t.vnodesBeingRemoved.push(e.elm)},remove(e,n){t.vnodesBeingRemoved.push(e.elm),r(),n()},post(){for(const e of t.vnodesBeingRemoved)t.removeElement(e),t.eventDelegator.removeElement(e);t.vnodesBeingRemoved=[],e.clear()}}}}class Qi{constructor(){this.arr=[],this.prios=[]}add(t,e){for(let n=0;n<this.arr.length;n++)if(this.prios[n]<e)return this.arr.splice(n,0,t),void this.prios.splice(n,0,e);this.arr.push(t),this.prios.push(e)}forEach(t){for(let e=0;e<this.arr.length;e++)t(this.arr[e],e,this.arr)}delete(t){for(let e=0;e<this.arr.length;e++)if(this.arr[e]===t){this.arr.splice(e,1),this.prios.splice(e,1);break}return this.arr.length}}const ta=["blur","focus","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture","abort","error","loadstart","progress","canplay","canplaythrough","durationchange","emptied","ended","loadeddata","loadedmetadata","pause","play","playing","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","load","unload","invalid","reset","submit","formdata","toggle","beforetoggle","cancel","close","animationstart","animationend","animationiteration","transitionrun","transitionstart","transitionend","scroll","scrollend"];class ea{constructor(t,e){this.rootElement$=t,this.isolateModule=e,this.virtualListeners=new Ki((t=>t.scope)),this.nonBubblingListenersToAdd=new Set,this.virtualNonBubblingListener=[],this.isolateModule.setEventDelegator(this),this.domListeners=new Map,this.domListenersToAdd=new Map,this.nonBubblingListeners=new Map,t.addListener({next:t=>{this.origin!==t&&(this.origin=t,this.resetEventListeners(),this.domListenersToAdd.forEach(((t,e)=>this.setupDOMListener(e,t))),this.domListenersToAdd.clear()),this.nonBubblingListenersToAdd.forEach((t=>{this.setupNonBubblingListener(t)}))}})}addEventListener(t,e,n,s){const r=new qi(e,this.isolateModule);if(void 0===s?-1===ta.indexOf(t):s){let e;this.domListeners.has(t)||this.setupDOMListener(t,!!n.passive);const s=Ye.create({start:()=>{e=this.insertListener(s,r,t,n)},stop:()=>this.removeListener(e,t)});return s}let o,i;return Ye.create({start:s=>{if(o=void 0,this.nonBubblingListenersToAdd.forEach((n=>{!o&&n[1]===t&&Ps(n[2].namespace,e)&&(o=n)})),!o){const s=Ye.never();o=[s,t,new zi(e,this.isolateModule),this.insertListener(s,r,t,n),0],this.nonBubblingListenersToAdd.add(o)}o[4]++||this.setupNonBubblingListener(o),i=o[0].subscribe(s)},stop:()=>{const e=o;if(i.unsubscribe(),! --e[4]){const n=this.nonBubblingListeners.get(t);n&&n.forEach(((s,r)=>{s.destination===e[3]&&(s.sub.unsubscribe(),delete r.subs[t],n.delete(r))})),this.nonBubblingListenersToAdd.delete(e),this.removeListener(e[3],t)}}})}removeElement(t){const e=[];this.nonBubblingListeners.forEach(((n,s)=>{if(n.has(t)){e.push(s);const n=t.subs;n&&Object.keys(n).forEach((t=>n[t].unsubscribe()))}})),e.forEach((e=>{const n=this.nonBubblingListeners.get(e);n&&(n.delete(t),n.size||this.nonBubblingListeners.delete(e))}))}eachSet(t,e,n,s){let r=t.length;do{const e=this.virtualListeners.get(t,s?()=>new Map:void 0,r);e&&n(e,r),r--}while(r>=0&&"total"!==t[r].type)}insertListener(t,e,n,s){const r=e._namespace,o={...s,scopeChecker:e,subject:t,bubbles:!!s.bubbles,useCapture:!!s.useCapture,passive:!!s.passive};return this.eachSet(r,n,(t=>{t.has(n)||t.set(n,new Qi),t.get(n).add(o,r.length)}),!0),o}removeListener(t,e){const n=t.scopeChecker._namespace;this.eachSet(n,e,((s,r)=>{const o=s.get(e);o&&!o.delete(t)&&(s.delete(e),s.size||this.virtualListeners.delete(n,r))}))}getVirtualListeners(t,e){let n=e.length;for(;n&&"total"!==e[n-1].type;)n--;const s=this.virtualListeners.get(e,void 0,n);return s&&s.get(t)||[]}setupDOMListener(t,e){if(this.origin){const n=Ii(this.origin,t,!1,!1,e).subscribe({next:n=>this.onEvent(t,n,e),error:()=>{},complete:()=>{}});this.domListeners.set(t,{sub:n,passive:e})}else this.domListenersToAdd.set(t,e)}setupNonBubblingListener(t){const[e,n,s,r,o]=t;this.origin&&o&&s.call().forEach((t=>{const e=t.subs;if(!e||!e[n]){const s=Ii(t,n,!1,!1,r.passive).subscribe({next:t=>this.onEvent(n,t,!!r.passive,!1),error:()=>{},complete:()=>{}});let o=this.nonBubblingListeners.get(n);o||this.nonBubblingListeners.set(n,o=new Map),o.set(t,{sub:s,destination:r}),t.subs={...e,[n]:s}}}))}resetEventListeners(){this.domListeners.forEach((({sub:t,passive:e},n)=>{t.unsubscribe(),this.setupDOMListener(n,e)}))}putNonBubblingListener(t,e,n,s){const r=this.nonBubblingListeners.get(t);if(!r)return;const o=r.get(e);o&&o.destination.passive===s&&o.destination.useCapture===n&&(this.virtualNonBubblingListener[0]=o.destination)}onEvent(t,e,n,s=!0){const r=this.patchEvent(e),o=e.target,i=this.isolateModule.getRootElement(o);if(s){const e=this.isolateModule.getNamespace(o);if(!e)return;const s=this.getVirtualListeners(t,e),a=a=>this.bubble(t,o,i,r,s,e,e.length-1,a,n);a(!0),a(!1)}else{const s=e=>{this.putNonBubblingListener(t,o,e,n),this.doBubbleStep(t,o,i,r,this.virtualNonBubblingListener,e,n)};s(!0),s(!1),e.stopPropagation()}}bubble(t,e,n,s,r,o,i,a,l){a||s.propagationHasBeenStopped||this.doBubbleStep(t,e,n,s,r,a,l);const c=Zi(e,s);let u=n,h=i,d=r;if(e===n){if(i<0||!c)return;u=this.isolateModule.getRootElement(c),h--,"total"===o[i].type&&(d=this.getVirtualListeners(t,o.slice(0,i)))}c&&u&&this.bubble(t,c,u,s,d,o,h,a,l),a&&!s.propagationHasBeenStopped&&this.doBubbleStep(t,e,n,s,r,a,l)}doBubbleStep(t,e,n,s,r,o,i){n&&(this.mutateEventCurrentTarget(s,e),r.forEach((t=>{if(t.passive===i&&t.useCapture===o){const r=Gs(t.scopeChecker.namespace);!s.propagationHasBeenStopped&&t.scopeChecker.isDirectlyInScope(e)&&(r?e.matches(r):e===n)&&(Gi(s,t.preventDefault),t.subject.shamefullySendNext(s))}})))}patchEvent(t){const e=t;e.propagationHasBeenStopped=!1;const n=e.stopPropagation;return e.stopPropagation=function(){n.call(this),this.propagationHasBeenStopped=!0},e}mutateEventCurrentTarget(t,e){try{Object.defineProperty(t,"currentTarget",{value:e,configurable:!0})}catch(t){}t.ownerTarget=e}}function na(t){return t.elm}const sa="data-sygnal-error";const ra=(t,e)=>{const n=(e.children||[]).filter((t=>t)),s=[];for(let e,r=0,o=t.firstChild;o;o=e){const t=n[r],i=o.nodeType,a=t?.data||{},l=a.hook;let c={sel:"",data:{},elm:o};if(3==i&&null!=n[r+1]?.text&&!n[r+1].sel&&t?.text&&o.data.startsWith(t.text)&&o.splitText(t.text.length),e=o.nextSibling,3==i&&t&&!t.sel&&null!=t.text)c={text:o.data,elm:o};else if(1!=i||o.localName!=t?.sel||l&&(l.create||l.init||l.u||!(!l.insert||l.postpatch&&l.insert.s))){if(1!=i&&(3!=i||!/\S/.test(o.data))){o.remove();continue}}else{const e=a.props||{},n=a.attrs||{},s={},r={},i={},l=o.firstChild;s.class="className";for(const t in e)s["htmlFor"==t?"for":t.toLowerCase()]=t;for(const{name:t,value:e}of[...o.attributes])/^data-/.test(t)?t in n&&o.removeAttribute(t):t in n?r[t]=e:"open"!=t&&(t in s&&!a.ns?i[s[t]]=e:o.removeAttribute(t));"textarea"==o.localName&&(o.value=o.value);const u=null!=t.text&&3==l?.nodeType&&!l.nextSibling;c={sel:t.sel,key:t.key,data:{dataset:{...o.dataset},attrs:r,props:i},children:u?void 0:ra(o,t),text:u?l.data:void 0,elm:o}}s.push(c),r++}return s};function oa(t,e={}){Ds(t);const n=e.modules||Po;!function(t){if(!Array.isArray(t))throw new Error("Optional modules option must be an array for snabbdom modules")}(n);const s=new Xi,r=e&&e.snabbdomOptions||void 0,o=_([s.createModule()].concat(n),void 0,r),i=Ye.create({start(t){"loading"===document.readyState?document.addEventListener("readystatechange",(()=>{const e=document.readyState;"interactive"!==e&&"complete"!==e||(t.next(null),t.complete())})):(t.next(null),t.complete())},stop(){}});let a;return function(n,r="DOM"){!function(t){if(!t||"function"!=typeof t.addListener||"function"!=typeof t.fold)throw new Error("The DOM driver function expects as input a Stream of virtual DOM elements")}(n);const l=Ye.create();let c;const u=i.map((()=>{const e=function(t){const e="string"==typeof t?document.querySelector(t):t;if("string"==typeof t&&null===e)throw new Error(`Cannot render into unknown element \`${t}\``);return e}(t)||document.body;return a=new Ji(e),c={sel:"",data:{isolate:[]},elm:e},e})),h=n.remember();let d,f;h.addListener({});const p=t=>d&&(t.stopPropagation(),d.next(f)),m=()=>f?.removeEventListener(Rs,p),g=t=>(e.reportSnabbdomError||s.rep||console.error)(t);let y=0,v=0;const b=u.map(((t,e=((e,n)=>(n=Vs(n),o(e==c?(f.removeAttribute?.(sa),{...c,sel:n.sel,key:n.key,children:ra(t,n)}):e,n))))=>Ye.merge(Ye.merge(h.endWhen(l),l.map((()=>(v=1,null)))).map((t=>a.call(t))).startWith(c).fold(((t,n)=>{if(!y||v)try{t=e(t,n)}catch(t){y++||(f.setAttribute?.(sa,"patch"),g(t))}return v&&y&&f.removeAttribute?.(sa),t}),{...c,data:{}}).drop(1).map(na).startWith(t).map((t=>(m(),t.addEventListener(Rs,p),f=t))),Ye.create({start:t=>d=t,stop:()=>(d=0,m())})))).flatten().endWhen(l).remember();b.addListener({error:g});const w=new ea(b,s);return new Vi(b,l,[],s,w,r)}}const ia=/^(og|fb|article|book|profile|music|video|al):/,aa=t=>String(t).replace(/[&<>"]/g,(t=>`&#${t.charCodeAt(0)};`)),la=t=>ia.test(t)?"property":"name";function ca(t,e){let n;const s={},r={};for(const e of t)if(e&&"object"==typeof e){null!=e.title&&(n=e.title),Object.assign(s,e.meta);for(const t of e.link||[])t&&(r["l:"+(t.key??("canonical"==t.rel?t.rel:t.rel+" "+t.href))]=t)}return{title:null!=n&&e?e.replace("%s",n):n,meta:Object.keys(s).filter((t=>null!=s[t])).map((t=>["m:"+t,t,s[t]])),link:Object.entries(r)}}const ua=globalThis,ha=()=>Date.now(),da=t=>t.frame?"string"==typeof t.frame:"string"==typeof t.action&&!!t.action&&(null==t.every?t.after>=0:null==t.after&&t.every>0)&&(t.every||t.after)<1/0,fa=(t,e,n)=>{let s,r,o=0;const i=ha(),a=t.every,l=t.frame&&ua.requestAnimationFrame,c=t=>s=l?requestAnimationFrame(u):setTimeout(u,t),u=(s=ha())=>{const l=ha();t.frame?(c(16),e(t.frame,{t:l,dt:null==r?0:s-r}),r=s):a?(o=Math.max(o+1,Math.floor((l-i)/a)),c(i+(o+1)*a-l),e(t.action,{n:o,t:l})):(n.d=1,e(t.action,{t:l}))};return c(t.frame?16:a||t.after),()=>l?cancelAnimationFrame(s):clearTimeout(s)},pa=t=>e=>{const n=(e,n,s)=>{let r=t.get(e);r||t.set(e,r={c:s,on:{}});const i=r.on;for(const t in i)i[t].k!=JSON.stringify(n?.[t])&&(i[t].x(),delete i[t]);for(const t in n){const r=n[t];if(!r||i[t])continue;const a=i[t]={k:JSON.stringify(r),s:r,x:()=>{}};(a.ok=da(r))?a.x=fa(r,((t,n)=>o(e,t,n)),a):ua.__SYGNAL_DIAGNOSTICS__?.timerSpec?.(t,r,s)}n||t.delete(e)},s=()=>t.forEach(((t,e)=>n(e,0))),{replies:r,reply:o}=ei((t=>n(t,0)));return e.addListener({next:t=>{t&&void 0!==t.__emitterId&&"timers"in t&&n(t.__emitterId,t.timers,t.__emitterName)},error:()=>{},complete:s}),{...r,__sygnalStatic:"timers",dispose:s}},ma=globalThis,ga=()=>{},ya=["intersection","resize","media","storage","visibility","online","geolocation"],va=(...t)=>ma.__SYGNAL_DIAGNOSTICS__?.browserSource?.(...t),ba=new Set;let wa;const Sa=(t,e)=>({index:t.indexOf(e),dataset:{...e.dataset}}),_a=new WeakMap,Ea=(t,e,n,s,r,o)=>{if(!t.dom)return t.miss("dom");if(!s)return;let i=[];const a=((t,e,n,s)=>{let r=t.obs.get(e);if(!r){const o=new Map,i=new Map,a=new n((t=>t.forEach((t=>{i.set(t.target,t),o.get(t.target)?.forEach((e=>e(t)))}))),s);t.obs.set(e,r={add:(t,e)=>{let n=o.get(t);n?i.has(t)&&Promise.resolve().then((()=>n.has(e)&&e(i.get(t)))):(o.set(t,n=new Set),a.observe(t)),n.add(e)},del:(n,s)=>{const r=o.get(n);r?.delete(s)&&!r.size&&(o.delete(n),i.delete(n),a.unobserve(n),o.size||(a.disconnect(),t.obs.delete(e)))}})}return r})(t,e+JSON.stringify(r),s,r),l=e=>t.send({...o(e),...Sa(i,e.target)}),c=((t,e)=>{let n=_a.get(t);n||_a.set(t,n={});const s=!0===e?"":""+e;return n[s]||(n[s]=t.select(s).elements())})(t.dom,n),u={next:t=>{for(const e of t)i.includes(e)||a.add(e,l);for(const e of i)t.includes(e)||a.del(e,l);i=[...t]}};return c.addListener(u),()=>{c.removeListener(u),i.forEach((t=>a.del(t,l)))}},ka={d:{intersection:(t,e)=>Ea(e,"i",t.intersection,ma.IntersectionObserver,{threshold:t.threshold,rootMargin:t.rootMargin},(t=>({visible:t.isIntersecting,ratio:t.intersectionRatio})))}},Aa={d:{resize:(t,e)=>Ea(e,"r",t.resize,ma.ResizeObserver,void 0,(t=>({width:t.contentRect.width,height:t.contentRect.height})))}},xa={d:{media:(t,e)=>{const n=ma.matchMedia?.(t.media);if(!n)return;const s=()=>e.send({matches:n.matches,media:t.media});return s(),n.addEventListener("change",s),()=>n.removeEventListener("change",s)}}},Oa=t=>ma["session"==t.area?"sessionStorage":"localStorage"],Ta=t=>({name:t?.name,message:t?.message}),$a=new Set,ja={d:{storage:(t,e)=>{const n=t.storage,s=s=>{try{const r=Oa(t);if(s&&(s.storageArea!=r||null!=s.key&&s.key!=n))return;let o=r.getItem(n);t.json&&null!=o&&(o=JSON.parse(o)),e.send({key:n,value:o})}catch(t){e.fail(Ta(t))}};return s(),$a.add(s),ma.addEventListener?.("storage",s),()=>{$a.delete(s),ma.removeEventListener?.("storage",s)}}},c:(()=>{const t=(t,e,n,s)=>{try{const s=Oa(t),r=t.setItem??t.removeItem,o=s.getItem(r);null==e?s.removeItem(r):s.setItem(r,e),o!==(e??null)&&[...$a].forEach((t=>t({key:r,storageArea:s}))),n({key:r})}catch(t){s(Ta(t))}};return{setItem:(e,n,s)=>t(e,e.json?JSON.stringify(e.value):""+e.value,n,s),removeItem:(e,n,s)=>t(e,null,n,s)}})()},Ca={d:{visibility:(t,e)=>{const n=ma.document;if(!n)return;const s=()=>e.send({visible:"hidden"!=n.visibilityState});return s(),n.addEventListener("visibilitychange",s),()=>n.removeEventListener("visibilitychange",s)}}},Na={d:{online:(t,e)=>{if(!ma.navigator||!ma.addEventListener)return;const n=()=>e.send({online:ma.navigator.onLine});return n(),ma.addEventListener("online",n),ma.addEventListener("offline",n),()=>{ma.removeEventListener("online",n),ma.removeEventListener("offline",n)}}}},La={d:{geolocation:(t,e)=>{const n=ma.navigator?.geolocation;if(!n)return e.fail({code:2,message:"Geolocation is not available"});const s=n.watchPosition((t=>{const{latitude:n,longitude:s,accuracy:r,altitude:o,altitudeAccuracy:i,heading:a,speed:l}=t.coords;e.send({latitude:n,longitude:s,accuracy:r,altitude:o,altitudeAccuracy:i,heading:a,speed:l,timestamp:t.timestamp})}),(t=>e.fail({code:t.code,message:t.message})),!0===t.geolocation?void 0:t.geolocation);return()=>n.clearWatch(s)}}},Ma={c:{copy:(t,e,n)=>{const s=""+t.copy,r=ma.navigator?.clipboard;r?r.writeText(s).then((()=>e({text:s})),(t=>n(Ta(t)))):n({name:"NotSupportedError",message:"Clipboard is not available"})},paste:(t,e,n)=>{const s=ma.navigator?.clipboard;s?s.readText().then((t=>e({text:t})),(t=>n(Ta(t)))):n({name:"NotSupportedError",message:"Clipboard is not available"})}}},Ia=(t,e)=>(n,s)=>{const r={},o={},i=new Map,a=new Map;for(const e of t)Object.assign(r,e.d),Object.assign(o,e.c);const l=(t,n,s)=>{let o=e.get(t);o||e.set(t,o={c:s,on:{}});const l=o.on;for(const t in l)l[t].k!=JSON.stringify(n?.[t])&&(l[t].x(),delete l[t]);for(const e in n){const o=n[e];if(!o||l[e])continue;const c=l[e]={k:JSON.stringify(o),s:o,x:ga},u="object"==typeof o&&ya.find((t=>t in o));u&&o.action&&"string"==typeof o.action&&("intersection"!=u&&"resize"!=u||!0===o[u]||"string"==typeof o[u]&&o[u])?r[u]?c.x=r[u](o,{dom:i.get(t),send:e=>h(t,o.action,e),fail:n=>o.error?h(t,o.error,n):va("SYG665",e,o,s,n),miss:t=>va("SYG668",e,o,s,t),obs:a})||ga:va("SYG664",e,o,s,u):va("SYG663",e,o,s)}n||e.delete(t)},c=()=>e.forEach(((t,e)=>l(e,0))),{replies:u,reply:h}=ei((t=>{l(t,0),i.delete(t)}));wa||(wa=M.push(((t,e)=>null==e.browser?void 0:{...t,intent:e=>{for(const t of ba)t in e&&e[t]?.__b?.(e.DOM);return t.intent?t.intent(e):{}}}))),s&&ba.add(s),n.addListener({next:t=>{if(!t||"object"!=typeof t)return;const e=t.__emitterId;if("browser"in t&&void 0!==e)return l(e,t.browser,t.__emitterName);const n=Object.keys(t),s=n.find((t=>t in o))||n[0],r=o[s];if(!r)return va("SYG663",s,t,t.__emitterName,0,Object.keys(o));const i=n=>t.error?h(e,t.error,n):va("SYG665",s,t,t.__emitterName,n);try{r(t,(n=>t.ok&&h(e,t.ok,n)),i)}catch(t){i(Ta(t))}},error:ga,complete:c});const d=()=>{const t={...u,__sygnalStatic:"browser",replies:e=>(t.i=e,u.replies(e)),isolateSource:d,__b:e=>i.set(t.i,e)};return t};return{...d(),dispose:c}},Da=(...t)=>Ia(t,new Map),Ga=t=>({within:t,toString:()=>"",spec:{commands:{focus:(e,n)=>{const s=e.matches?.(t)?e:e.querySelector?.(t);s?.focus(n)}}}});function Pa(t){return t.data=function(e,n){return Pa(t.map((t=>{const s=t?.dataset?.[e]??t?.dropZone?.dataset?.[e]??t?.element?.dataset?.[e];return n?n(s):s})))},t.element=function(e){return Pa(t.map((t=>{const n=t?.element??t?.dropZone??null;return e?e(n):n})))},t}function Ra(t,e){t=Vs(t),e.elm=t.elm,t.data.fn=e.data.fn,t.data.args=e.data.args,t.data.isolate=e.data.isolate,e.data=t.data,e.children=t.children,e.text=t.text,e.elm=t.elm}function Ya(t){const e=t.data;Ra(e.fn.apply(void 0,e.args),t)}function Fa(t,e){const n=t.data,s=e.data;let r;const o=n.args,i=s.args;for(n.fn===s.fn&&o.length===i.length||Ra(s.fn.apply(void 0,i),e),r=0;r<i.length;++r)if(o[r]!==i[r])return void Ra(s.fn.apply(void 0,i),e);Ra(t,e)}const qa="___";class za{constructor(t,e,n=[],s){this._mockConfig=t,this._hub=e,this._path=n,this._onEvents=s,t.elements?this._elements=t.elements:this._elements=Qe(Ye.empty())}elements(){const t=this._elements;return t._isCycleSource="MockedDOM",t}element(){const t=Qe(this.elements().filter((t=>t.length>0)).map((t=>t[0])).remember());return t._isCycleSource="MockedDOM",t}events(t,e,n){const s=this._mockConfig[t],{_hub:r,_path:o,_onEvents:i}=this;let a;if(i&&i(o,t),r){const e=r.filter((e=>e.type===t&&e.match(o))).map((t=>t.event));let n;a=i?Ye.create({start:s=>{e.addListener(n={next:t=>s.next(t),error:t=>s.error(t),complete:()=>s.complete()}),i(o,t,!0)},stop:()=>{e.removeListener(n),i(o,t,!1)}}):e}const l=Ri(Qe(a?Ye.merge(s?Ye.fromObservable(s):Ye.empty(),a):s||Ye.empty()));return l._isCycleSource="MockedDOM",l}select(t){if("function"==typeof t){if(!t.__sygnalControl)throw new Error("DOM driver's select() expects the argument to be a string as a CSS selector");t=""+t}const e=this._mockConfig[t]||{};return new za(e,this._hub,this._path.concat(t),this._onEvents)}isolateSource(t,e){return t.select("."+qa+e)}isolateValue(t,e){return t&&"object"==typeof t?t.sel?t.sel.split(".").indexOf(qa+e)>0?t:{...t,sel:t.sel+`.${qa}${e}`}:t.children?{...t,children:t.children.map((t=>this.isolateValue(t,e)))}:t:t}isolateSink(t,e){return Qe(Ye.fromObservable(t).map((t=>t?(t.sel&&-1!==t.sel.indexOf(qa+e)||(t.sel+=`.${qa}${e}`),t):t)))}}function Ba(t,e,n){return new za(t,e,[],n)}function Wa(t){const e=new EventTarget;return t.subscribe({next:t=>{Dn(t&&t.type,t?.__emitterName),e.dispatchEvent(new CustomEvent("data",{detail:t})),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onBusEvent(t)},error:t=>console.error("[EVENTS driver] Error in sink stream:",t)}),{select:t=>{Gn(t);const n=!t,s=Array.isArray(t)?t:[t];let r;const o=Ye.create({start:t=>{r=({detail:e})=>{const r=e&&e.data||null;(n||s.includes(e.type))&&t.next(r)},e.addEventListener("data",r)},stop:()=>{r&&e.removeEventListener("data",r)}});return Qe(o)}}}function Ua(t){t.addListener({next:t=>{console.log(t)},error:t=>{console.error("[LOG driver] Error in sink stream:",t)}})}C.clientonly=t=>{const e=t.children||[];return e.length<2?e.length?e[0]:{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0}:{sel:"div",data:{},children:e,text:void 0,elm:void 0,key:void 0}};const Va=globalThis,Ha="function"==typeof Va.setImmediate?Va.setImmediate.bind(Va):void 0,Ja="function"==typeof Va.MessageChannel?Va.MessageChannel:void 0;class Ka{constructor(t={}){this.opts=t,this.state=void 0,this.queue=[],this.draining=!1,this.rendering=!1,this.flushing=!1,this.scheduled=!1,this.dirty=!1,this.tail=!1,this.chained=!1,this.chain=0,this.flushes=0,this.ver=0,this.ep=0,this.ran=!1,this.sources={},this.proxies={},this.bus={},this.busL={},this.early=!0,this.log={},this.ex={},this.exL={},this.born=[],this.watchers=new Set,this.dq=[],this.stopping=!1,this.disposed=!1,this.ctxSkip=null,this.afterRender=null,this.stat=[],this.rep=[],this.stc=new WeakMap,this.statics=new Set,this.defs=new WeakMap,this.waiters=[],this.scopeN=0,this.hops=[],this.ping=!1,this.desc=[],this.stopErr=(t,e)=>{console.error(`[Sygnal] ${e?e.def.name+": ":""}a stream's stop() threw while it was torn down; the other streams stopped`,t),e?this.appError(e,t,"dispose"):qn(this.opts.onError,t,{phase:"dispose"})},this.hooks={...t.__hooks},this.layers=[t.__hooks||{}],this.initState=t.__state,this.compose();const e=Va.__SYGNAL_DIAGNOSTICS__?.layers;if(e)for(const t of e){let e;try{e=t(this.api())}catch(t){Yn("SYG900","run","A dev-tools hook layer threw while the app started; it is skipped","Report this as a Sygnal bug",t);continue}this.addHooks(e)}}def(t,e){return ds(t,this.hooks.transformDef,this.defs,e)}scope(){return"s"+ ++this.scopeN}dispatch(t,e,n,s="intent",r){this.disposed||(this.queue.push(t,e,n,s,r),this.draining||this.rendering||this.drain())}drain(){this.draining=!0;const t=this.queue;try{for(let e=0;e<t.length;e+=5){const n=t[e];if(!n.disposed){try{if(t[e+1]===ts){const r=t[e+2],o=n.cell,i="function"==typeof r?r(o.get()):r;i===o.get()||s(i)||o.set(i)}else if(t[e+1]===es){const s=t[e+2],r=s.b;s.r||!(r.has?r.has():void 0!==r.get())?n.cell.set(s.v):this.hooks.onStateSeed?.(As(n),r.get(),s.v)}else n.handle(t[e+1],t[e+2],t[e+3],t[e+4])}catch(s){this.caught(n,"SYG216",("string"==typeof t[e+1]?`Action '${t[e+1]}'`:"A state update")+" threw; the actions queued after it still run",s,"reducer","string"==typeof t[e+1]?t[e+1]:void 0)}this.watchers.size&&this.notify()}}}finally{t.length=0,this.draining=!1,!this.flushing&&this.dq.length&&this.stopLater()}}notify(){for(const t of this.watchers)t.notify()}commit(){if(this.ver++,this.flushing)return void(this.dirty=!0);if(this.tail&&(this.chained=!0),this.scheduled||this.disposed)return;this.scheduled=!0;const t=this.chained;this.chained=!1,this.chain=t?this.chain+1:0,this.flushes++||this.macro(),this.chain>100||this.flushes>1e3?this.macro((()=>{this.chain=0,this.flush()})):queueMicrotask((()=>this.flush()))}macro(t){t&&this.hops.push(t),this.ping||(this.ping=!0,Ha?Ha((()=>this.pong())):Ja?(this.mc||(this.mc=new Ja,this.mc.port1.onmessage=()=>this.pong(),this.mc.port1.unref?.()),this.mc.port2.postMessage(0)):setTimeout((()=>this.pong())))}stopLater(){this.stopping||(this.stopping=!0,this.macro((()=>{this.stopping=!1,Xn(this.dq,this.stopErr)})))}pong(){this.ping=!1,this.flushes=0;for(const t of this.hops.splice(0))t()}flush(){if(this.scheduled=!1,this.disposed)return this.release();try{this.flushOnce()}finally{this.release()}}release(){if(this.waiters.length&&(!this.scheduled||this.disposed))for(const t of this.waiters.splice(0))t()}flushOnce(){this.flushing=!0;let t,e=0;try{do{this.dirty=!1,this.watchers.size&&this.notify(),this.rendering=!0;try{t=this.root.render()}catch(e){this.rendering=!1,this.caught(this.root,"SYG406","Render threw; the page keeps its last render",e,"view"),t=this.last,this.ep++;try{this.afterRender?.()}catch(t){}break}this.afterRender?.(),this.rendering=!1,this.queue.length&&this.drain()}while(this.dirty&&++e<100)}finally{this.rendering=!1,this.flushing=!1}this.tail=!0;try{this.queue.length&&this.drain(),(t!==this.last||this.ran)&&(this.ran=!1,this.last=t,this.hooks.onPatch?.(t),this.vdomL?.next(t)),this.dq.length&&this.stopLater()}finally{if(this.tail=!1,this.opts.__swap&&(this.opts.__swap=!1,this.born.length=0),this.born.length){const t=this.born.splice(0);queueMicrotask((()=>{for(const e of t)e.disposed||this.dispatch(e,"BOOTSTRAP",void 0,"built-in")}))}this.dirty&&(this.chained=!0,this.dirty=!1,this.commit()),this.early&&(this.early=!1,this.log={})}}sink(t){var e;return(e=this.bus)[t]||(e[t]=Fe.create({start:e=>{this.busL[t]=e},stop:()=>{delete this.busL[t]}}))}out(t,e){var n;this.early&&((n=this.log)[t]||(n[t]=[])).push(e);const s=this.busL[t];if(s)try{s.next(e)}catch(e){const n={phase:"driver",driver:t};qn(this.opts.onError,e,n),qn(this.hooks.onError,e,n),queueMicrotask((()=>{throw e}))}}exposed(t){var e;return(e=this.ex)[t]||(e[t]=Fe.create({start:e=>{const n=this.early?this.log[t]:void 0;if(n)for(const t of n.slice())e.next(t);this.sink(t).addListener(this.exL[t]={next:t=>e.next(t),error:t=>e.error(t),complete:()=>e.complete()})},stop:()=>{this.sink(t).removeListener(this.exL[t])}}))}pipe(t,e,n,s,r){const o=t.fb||(t.fb={});let i=o[e];if(!i){const n=Fe.create();i=o[e]=n,t.subs.push(s(n).subscribe({next:r}))}i.shamefullySendNext(n)}scopeValue(t,e,n,s){const r=t.dom;if(!r||void 0===s.scope)return n;if("function"==typeof r.isolateValue)return r.isolateValue(n,s.scope);let o;return this.pipe(s,"\0DOM",n,(t=>r.isolateSink(t,s.scope)),(t=>{o=t})),o}appError(t,e,n,s){const r={componentName:t.def.name,action:s,phase:n};qn(this.opts.onError,e,r),qn(this.hooks.onError,e,r)}caught(t,e,n,s,r,o){const i=s&&s.sygnal;i?Yn(s.code,i[0],`${i[1]} (${n})`,i[2],s):Yn(e,t,n,"See the attached error",s),this.appError(t,s,r,o)}srcDesc(t){const e=+t;if(this.desc[e])return this.desc[e];const n={},s=t=>({get(){return t(this[Qn])},enumerable:!0,configurable:!0});for(const t in this.sources)"DOM"!==t&&(n[t]=s((e=>e.src(t))));return n.DOM=s((t=>{return t.dom&&(t.wd||(t.wd=(e=t.dom,new Proxy(e,{get:(t,e,n)=>"symbol"==typeof e||e in t?Reflect.get(t,e,n):n=>t.select(n).events(e)}))));var e})),n.STATE=s((t=>t.stateSource())),n.CHILD=s((t=>t.childSource())),n.dispose$=s((t=>t.dispose$())),t&&(n.props$=s((t=>t.props$||Za(t,"props$",t.props))),n.children$=s((t=>t.children$||Za(t,"children$",t.children))),n.commands$=s((t=>t.commands()))),this.desc[e]=n}api(){const t=this,e=e=>"root"===e?t.root:"number"==typeof e?Xa(t.root,e):e&&Xa(t.root,e.id);return{get root(){return As(t.root)},get:e=>{const n=Xa(t.root,e);return n&&As(n)},getState:()=>t.state,setState:(n,s)=>{const r=e(n);r&&t.dispatch(r,ts,s,"setState")},dispatch:(n,s,r,o="simulateAction")=>{const i=e(n);i&&t.dispatch(i,s,r,o)},addHooks:e=>t.addHooks(e),setDebug:(t,n)=>{const s=e(t);s&&(s.debug=n)},flushed:()=>new Promise((e=>t.scheduled||t.flushing?t.waiters.push(e):e()))}}addHooks(t){return this.layers.push(t),this.compose(),()=>{const e=this.layers.indexOf(t);e>=0&&(this.layers.splice(e,1),this.compose())}}compose(){const t=this.hooks;for(const e in t)delete t[e];this.ctxSkip=null;for(const e of this.layers){const n=e;for(const e in n){const s=n[e],r=t[e];s&&(t[e]=r?"wrapHandler"==e?(t,e,n,o)=>{const i=r(t,e,n,o)||o;return s(t,e,n,i)||i}:"wrapSources"==e?(t,e)=>{const n=r(t,e)||e;return s(t,n)||n}:"transformDef"==e?(t,e)=>{const n=r(t,e)||t;return s(n,e)||n}:"onElementCommand"==e?(t,e)=>{const n=r(t,e);return!1!==s(t,e)&&!1!==n&&void 0}:(...t)=>{r(...t),s(...t)}:s)}}const e=t.onContextSkip;e&&(this.ctxSkip=(t,n,s)=>e(As(t),(e=>t.def.view({...t.props,state:t.cell.get(),children:t.children,slots:t.slots,context:e,uid:t.uid})),n,s,[...t.keys||[]]))}dispose(){if(!this.disposed)try{this.root?.dispose()}finally{Xn(this.dq,this.stopErr),this.disposed=!0;for(const t in this.sources)try{this.sources[t]?.dispose?.()}catch(t){}for(const t in this.proxies)try{this.proxies[t]._c()}catch(t){}this.mc?.port1.close(),this.release()}}}function Za(t,e,n){const s=Fe.createWithMemory();return s.shamefullySendNext(n),t[e]=s}function Xa(t,e){if(t.id===e)return t;for(const n of t.kids.values())if(n instanceof or){const t=Xa(n,e);if(t)return t}else if(n.insts)for(const t of n.insts()){const n=Xa(t,e);if(n)return n}}function Qa(t,e={},n={}){const s=new Ka(n),{mountPoint:r="#root",useDefaultDrivers:o=!0}=n,i=(t,e={phase:"patch"})=>{n.onError?qn(n.onError,t,e):console.error(t),qn(s.hooks.onError,t,e)},l={...o&&{EVENTS:Wa,DOM:oa(r),LOG:Ua,__m:()=>r},...e};for(const t in l){const e=s.proxies[t]=Fe.create(),n=s.sources[t]=l[t](e,t);if(n&&"object"==typeof n)try{n._isCycleSource=t}catch(t){}n?._isolateModule&&(n._isolateModule.rep=i)}!function(t){for(const e in t.sources){const n=t.sources[e];n&&"object"==typeof n&&("string"==typeof n.__sygnalStatic&&t.stat.push([e,n.__sygnalStatic]),!0===n.__sygnalReplies&&"function"==typeof n.replies&&t.rep.push(e))}t.stat.length&&(t.afterRender=()=>{for(const e of t.statics)Ts(e)})}(s),s.vdom$=Fe.create({start:t=>{s.vdomL=t,s.last&&t.next(s.last)},stop:()=>{s.vdomL=null}});for(const t in l)"DOM"==t?s.proxies.DOM.imitate(s.vdom$):a.test(t)&&"PARENT"!=t||s.proxies[t].imitate(s.sink(t));const c=s.draining;let u,h;s.draining=!0;try{const e=t.persist?.setup,r=function(t,e,n,s){const r=ls(t,fs(t,e,n,(e=>{const n=t.uses,r=e.idle;if(n&&r){const t={};for(const e in n)e in r&&(t[e]=r[e]);e={...e,initialState:{...ns(e.initialState)?e.initialState:{},...t}}}return s?s(e):e})));return n?.name&&(r.name=n.name),n?.testActions&&(r.testActions=n.testActions),r}(t,s.hooks.transformDef,n.__override,"function"==typeof e?n=>{const[r,o]=function(t,e,n){const s=Fe.create(),r=Fe.create();return[{name:e.componentName||e.name||"FUNCTION_COMPONENT",view:e,model:n.model,initialState:n.initialState,calculated:n.calculated,stateSourceName:"STATE",sources:{...t.sources,STATE:{stream:s}},vdom$:t.vdom$,_dispose$:r,action$:{shamefullySendNext:e=>{t.root&&t.dispatch(t.root,e.type,e.data,"built-in")}}},()=>{const e=t.root;e.stateSource().stream.addListener({next:t=>s.shamefullySendNext(t),error:()=>{}}),e.dispose$().addListener({next:t=>r.shamefullySendNext(t),error:()=>{}})}]}(s,t,n);return u=o,e(r),{...n,model:r.model,initialState:r.initialState}}:void 0);s.root=new or(s,r,null,ps(s),s.sources.DOM,{},[],void 0,n.uid?n.uid.replace(/[^\w-]+/g,"_"):"u","root"),u?.()}catch(t){throw s.draining=c,s.dispose(),t}s.draining=c,s.queue.length&&s.drain(),s.commit();const d={__dispose:()=>s.dispose()};for(const t of new Set([...Object.keys(l),"PARENT"]))"DOM"==t?Object.defineProperty(d,t,{get:()=>h||(h=s.vdom$.remember()),enumerable:!0}):a.test(t)&&"PARENT"!=t||Object.defineProperty(d,t,{get:()=>s.exposed(t),enumerable:!0});const f={...s.sources};return Object.defineProperty(f,"STATE",{get:()=>s.root.stateSource(),enumerable:!0}),{app:s,sources:f,sinks:d,dispose:()=>s.dispose(),api:s.api()}}let tl=!1,el=0;function nl(t){return t?Array.isArray(t)?nl(t.find(Boolean)):t.default&&"function"==typeof t.default?t:"function"==typeof t?{default:t}:null:null}function sl(t){if(!t)return null;const e=t.default||t;return"function"!=typeof e?null:t.default?t:{default:e}}function rl(t){return/^[a-zA-Z0-9-_]+$/.test(t)}function ol(t){if("string"!=typeof t)throw new Error("Class name must be a string");return t.trim().split(" ").reduce(((t,e)=>{if(0===e.trim().length)return t;if(!rl(e))throw new Error(`${e} is not a valid CSS class name`);return t.push(e),t}),[])}const il="__sw",al=/^(id|class(Name)?|style|title|name|placeholder|role|tab[iI]ndex|hidden|lang|dir|attrs)$|^(aria|data)-/,ll=(t,e,n,s,r)=>globalThis.__SYGNAL_DIAGNOSTICS__?.widget?.(t,e,n,s,r);let cl=0;const ul=(t,e,n)=>{const s=Object.keys(t);return s.length==Object.keys(e).length&&s.every((s=>t[s]===e[s]||!n&&al.test(s)&&"object"==typeof t[s]&&"object"==typeof e[s]&&t[s]&&e[s]&&ul(t[s],e[s],1)))};function hl(t,e,n,s,r,o){r=r instanceof Error?r:Error(r),ll(s,e,t,r,o)||console.error(`[Sygnal SYG${s}]`,r),t.app.appError(t,r,"widget"),s<662&&!t.disposed&&((t.$wf||(t.$wf=new Map)).set(n,[r]),t.refresh())}function dl(t){const e=t.elm,{ww:n,wp:s,wo:r}=t.data,o=(t,s)=>{ll(140,n,r,t),e.dispatchEvent(new CustomEvent(t,{detail:s,bubbles:!0}))};let i;ll(144,n,r,e);const a=s=>{e[il]&&hl(r,n,t.key,661,s,1)};try{i=n.def.mount(e,s,o,a)}catch(e){return hl(r,n,t.key,660,e)}Object.defineProperty(e,il,{value:{w:n,p:s,i:i,e:o},configurable:!0});for(const t in n.def.commands)t in e||(e[t]=n=>e[il]?.w.commands[t]?.(e,n))}function fl(t){const e=t.elm,n=e[il];if(n){delete e[il];try{n.w.def.unmount?.(n.i,e)}catch(e){hl(t.data.wo,n.w,t.key,662,e)}}}const pl={insert:dl,postpatch(t,e){const n=e.elm,s=e.data.wp,r=n[il];if(!r)return dl(e);const o=r.w.def.update;if(!ul(r.p,s)){if(!o)return fl(e),dl(e);try{o(r.i,s,n),r.p=s}catch(t){hl(e.data.wo,r.w,e.key,661,t)}}},destroy:fl};function ml(t,e,n){const{ww:s,wp:r,h:o,attrs:i,r:a}=t.data,l=s.def,c={ref:a};for(const t in r)!al.test(t)&&!l.hostProps?.includes(t)||l.ownProps?.includes(t)||(c[t]=r[t]);c.className&&(c.class=[c.class,c.className],delete c.className);const u=o(l.tag||"div",c),h=u.data;return i&&(h.attrs={...h.attrs,...i}),e&&(u.key=n,h.ww=s,h.wp=r,h.wo=e,u.children=void 0,xr(h,pl),t.data.hook&&xr(h,t.data.hook)),u}function gl(t,e,n){const s=t.data.ww,r=t.data.wp,o=e.$wf,i="w"+s.$i+(null==t.key?n:"#"+t.key);let a=o?.get(i);if(a&&a[1]&&!ul(a[1],r)&&(o.delete(i),a=0),!a)return ml(t,e,i);a[1]=r;const l=e.def,c=t.data.h("div",{attrs:{"data-sygnal-error":l.name}});let u=c;try{u=l.onError?.(a[0],{componentName:l.name})||c}catch(t){}return xr((u={...u,key:i+"!",data:{...u.data}}).data,{destroy:()=>o.delete(i)}),u}const yl=(t,e,n)=>t.map(((t,s)=>"widget"==t?.sel?gl(t,e,n+"."+s):t?.children?{...t,children:yl(t.children,e,n+"."+s)}:t));const vl=(t,e)=>{const n="function"==typeof t?{[e]:t}:{...t};for(const t in n){const e=n[t];"function"!=typeof e&&(n[t]="EFFECT"==t?()=>{}:!0===e||void 0===e?(t,e)=>e:()=>e)}return n},bl=(t,e)=>(n,...r)=>{const o=t(n,...r),i=e(s(o)?n:o,...r);return s(i)?o:i},wl=t=>e=>{if(e&&"object"==typeof e)for(const n in t)e={...e,[n]:t[n](e)};return e},Sl=new WeakSet,_l=(t,e,n)=>{const r=t.stateSourceName,o=n.calculated,i=wl(o),a=t.model={...t.model},l=n.state,c=t._behaviorActions||(t._behaviorActions={}),u=t=>e+"."+t,h=n.options;n.timers&&t.view&&(t=>{if(Sl.has(t))return;Sl.add(t);let e=t.timers;const n=n=>{const s={},r=e;if("function"==typeof r)Object.assign(s,r(n));else if(r&&"object"==typeof r)for(const t in r)s[t]=r[t](n);const o=t.uses;for(const t in o){const e=o[t],r=e?.timers?.(n?.[t]??e.state,e.options,t),i=n=>n in(e.model||{})?t+"."+n:n;for(const e in r){const n=r[e];s[t+"."+e]=n&&{...n,...n.action&&{action:i(n.action)},...n.frame&&{frame:i(n.frame)}}}}return s};Object.defineProperty(t,"timers",{configurable:!0,enumerable:!0,get:()=>n,set:t=>{e=t}})})(t.view),t.isSubComponent&&!t.isolatedState?t._idle={...t._idle,[e]:l}:t.initialState={..."object"==typeof t.initialState?t.initialState:{},[e]:l};const d=t=>(n,...s)=>{const r=t(n,...s);return r&&"object"==typeof r&&n&&r[e]!==n[e]?{...r,[e]:i(r[e])}:r};if(o)for(const t in a){const e=a[t];"function"==typeof e?t.includes("|")&&t.split("|")[1].trim()!=r||(a[t]=d(e)):e?.[r]&&(a[t]={...e,[r]:d(e[r])})}for(const t in n.model){const o=vl(n.model[t],r),l={},d=a[u(t)];for(const t in o){const a="HOST"==t,c=a?r:t,d=(l,c,d,f)=>{const p=o[t](a?l:l?.[e],c,d&&((t,...e)=>d(t in n.model?u(t):t,...e)),f,h,e);return a?s(p)||p===l||!p||p[e]===l?.[e]?p:{...p,[e]:i(p[e])}:t!=r||s(p)?p:p===l[e]?l:{...l,[e]:i(p)}};l[c]=l[c]?a?bl(l[c],d):bl(d,l[c]):d}if(d){const t=vl(d,r);for(const e in t){const n=l[e],s=t[e];l[e]=n?e==r?bl(n,s):"EFFECT"==e?(...t)=>{n(...t),s(...t)}:s:s}}a[u(t)]=l,c[u(t)]=e}if(!t._uses){const e=t.intent,n=t._uses=[];t.intent=t=>{const s={};for(const[e,o,i]of n){const n=t[r],a=o.intent?.({...t,[r]:n?.select({get:t=>t?.[e]??i})},o.options,e);for(const t in a)s[e+"."+t]=a[t],c[e+"."+t]=e}const o=e?.(t),i=o?.__sygnalTestActions||[];for(const t in o)i.includes(t)&&s[t]?s[t]=Fe.merge(s[t],o[t]):(delete c[t],s[t]=o[t]);return s}}t._uses.push([e,n,l])},El=t=>(e={})=>{const n={...t.initialState},s={...t,options:e};for(const t in e)t in n&&(n[t]=e[t]);return s.state=wl(t.calculated)(n),s.merge=(t,e)=>_l(t,e,s),s},kl=t=>null==t.total?null:Math.max(1,Math.ceil(t.total/t.pageSize)),Al=(t,e)=>{const s=kl(t);return(e=Math.max(0,Math.min(0|e,null==s?e:s-1)))===t.page?n:{...t,page:e}},xl=El({initialState:{page:0,pageSize:20,total:null},intent:({DOM:t},{next:e,prev:n})=>({...e&&{NEXT:t.click(e)},...n&&{PREV:t.click(n)}}),model:{NEXT:t=>Al(t,t.page+1),PREV:t=>Al(t,t.page-1),GOTO:(t,e)=>Al(t,e),SET_TOTAL:(t,e)=>{const s={...t,total:e},r=Al(s,t.page);return r===n?s:r}},calculated:{offset:t=>t.page*t.pageSize,pages:kl,hasPrev:t=>t.page>0,hasNext:t=>null==t.total||t.page+1<kl(t)}}),Ol=t=>null!=t?.id,Tl=(t,e)=>{if(!Array.isArray(t))return e;const n=t.findIndex((t=>Ol(t)&&t.id+""==e));return n<0&&!Ol(t[+e])?+e:n},$l=(t,e=[])=>{let n=t;return e.map((t=>{t=t?.key??t;const e=Array.isArray(n)&&Ol(n[t])?n[t].id:t;return n=n?.[t],e})).join(".")},jl=(t,e)=>e.split(".").reduce(((t,e)=>t?.[Tl(t,e)]),t),Cl=(t,e)=>{let n=t;for(const t of e.split(".")){const e=n&&"object"==typeof n?Tl(n,t):-1;if(!(e in Object(n)))return!1;n=n[e]}return!0},Nl=(t,e,n)=>{const[s,...r]=e.split("."),o=Tl(t,s),i=Array.isArray(t),a=r.length?Nl(t?.[o]??{},r.join("."),n):n;if(a===t?.[o]||i&&!(o in t))return t;const l=i?t.slice():{...t};return l[o]=a,l},Ll=(t,e="",n)=>{if(!t||"object"!=typeof t)return e?[e]:[];const s=Array.isArray(t),r=s?[e]:[];for(const o in t){const i=t[o];n&&"id"==o||r.push(...Ll(i,(e&&e+".")+(s&&Ol(i)?i.id:o),s))}return r},Ml=(t,e=[])=>{const n={};for(const s of e){const e=$l(t,s.path);e in n||(n[e]=s.message)}return n},Il=(t,e)=>{const n=t["~standard"].validate(e),s=t=>({errors:Ml(e,t.issues),value:t.issues?void 0:t.value});return n.then?n.then(s):s(n)},Dl=(t,e)=>{let n=t&&("request"in t||"body"in t&&"status"in t)?t.body:t;n=n?.errors??n;const s=Array.isArray(n)?Ml(e,n):{};if(n&&"object"==typeof n&&!Array.isArray(n))for(const t in n){const r=[].concat(n[t])[0]+"";t&&e&&!Cl(e,t)?s[""]||(s[""]=r):s[t]=r}return Object.keys(s).length?s:{"":"Request failed"+(t?.status?` (${t.status})`:"")}},Gl=(t,e)=>{const s=(Array.isArray(t)?t:Object.keys(t).filter((e=>t[e]))).filter((t=>t));return s.length?{focus:Ga(s.map((t=>`${e?e+" ":""}[name=${JSON.stringify(t)}]`)).join())}:n},Pl=(...t)=>globalThis.__SYGNAL_DIAGNOSTICS__?.form?.(...t),Rl=t=>Object.keys(t).filter((e=>t[e])),Yl=(t,e)=>{const n={};for(const s in t)s==e||s.startsWith(e+".")||(n[s]=t[s]);return n},Fl=t=>Array.isArray(t)?t.map(String):null,ql=(t,e)=>e.join("\0")===t.selected.join("\0")?n:{...t,selected:e},zl=(t,e,s)=>({initialState:{selected:[]},intent:({DOM:t},{item:e,all:n,clear:s})=>({...e&&{SELECT:t.click(e)},...n&&{TOGGLE_ALL:t.click(n)},...s&&{CLEAR:t.click(s)}}),model:{SELECT:(r,o)=>{const i=((t,e,n)=>{if(!t||"object"!=typeof t)return t;const s=t.target?.closest?.(String(n))||t.ownerTarget||t.target;return s?.getAttribute?.(e)??s?.dataset?.[e.slice(5).replace(/-(\w)/g,((t,e)=>e.toUpperCase()))]})(o,e,s);if(null==i)return n;const a=String(i),l=r.selected.includes(a);return ql(r,t?l?r.selected.filter((t=>t!==a)):[...r.selected,a]:[a])},SELECT_ALL:(t,e)=>Fl(e)?ql(t,Fl(e)):n,TOGGLE_ALL:(t,e)=>{const s=Fl(e);return s?ql(t,s.every((e=>t.selected.includes(e)))?[]:s):n},CLEAR:t=>ql(t,[])},calculated:{count:t=>t.selected.length}}),Bl=(...t)=>globalThis.__SYGNAL_DIAGNOSTICS__?.sortable?.(...t),Wl=/^( |Enter|Spacebar)$/,Ul=/^(Arrow(Up|Down|Left|Right)|Home|End|Escape|Tab)$/,Vl=String,Hl=new WeakSet,Jl=t=>/^[\w.#\-[\]="']+$/.test(t)?t:`:is(${t})`,Kl=new WeakMap,Zl=new WeakSet,Xl={lift:(t,e,n,s)=>`Picked up ${t}, position ${e} of ${n}.`+(s?" Use the arrow keys to move, Space to drop, Escape to cancel.":""),move:(t,e,n,s)=>`${t}: ${s?s+", ":""}position ${e} of ${n}.`,drop:(t,e,n,s)=>`Dropped ${t} at ${s?s+", ":""}position ${e} of ${n}.`,cancel:(t,e,n)=>`Reorder cancelled. ${t} is back at position ${e} of ${n}.`,stay:(t,e,n,s)=>`Reorder cancelled. The list changed, so ${t} stays at ${s?s+", ":""}position ${e} of ${n}.`},Ql={dragging:null,over:null,after:!1,list:null,mode:null,press:null,origin:null,message:""},tc=/^(BOOTSTRAP|INITIALIZE|DISPOSE|READY|RESOURCE)$/,ec=new WeakMap,nc=new WeakSet,sc=t=>t.split("|")[0].trim(),rc=t=>{if(Array.isArray(t?.key)&&!t.key.length)throw new Error("undo: `key: []` names no state key; use key: 'name' or key: ['a', 'b']")},oc=(t,e,n,s)=>{const r=new Set(Object.keys(t||{}).map(sc));for(const t of[...e.track||[],...e.resetOn||[],...e.coalesce||[]]){const o=t.indexOf("."),i=o>0&&s?.[t.slice(0,o)]?.model;if(!(r.has(t)||i&&t.slice(o+1)in i))try{globalThis.__SYGNAL_DIAGNOSTICS__?.report("SYG226",{severity:"warn",component:n,data:{action:t},message:`undo ${e.track?.includes(t)?"track":e.resetOn?.includes(t)?"resetOn":"coalesce"} names '${t}', which has no model entry`,fix:`Use the name of a model entry, or add '${t}' to the model`})}catch(t){queueMicrotask((()=>{throw t}))}}},ic=t=>{const{base:e,...n}=t;return n},ac=t=>Array.isArray(t)?1:t&&"object"==typeof t&&Object.getPrototypeOf(t)===Object.prototype?2:0,lc=(t,e)=>{const n=t!==e&&ac(t)&&ac(t)==ac(e)&&Object.keys(t);return t===e||!!n&&n.length==Object.keys(e).length&&n.every((n=>n in e&&t[n]===e[n]))},cc=(t,e,r,o,i="STATE",a={})=>{const{key:l,limit:c=100,track:u,coalesce:h,coalesceMs:d=(h?500:0),resetOn:f=[]}=e,p="string"==typeof l?null:l,m={},g=t=>t?.[r]||{past:[],future:[]},y=t=>{if(!p)return t?.[l];const e={};for(const n of p)t&&"object"==typeof t&&n in t&&(e[n]=t[n]);return e},v=(t,e,n)=>!!t&&!!e&&p.every((s=>s in t==s in e&&n(t[s],e[s]))),b=(t,e)=>p?t===e||v(t,e,((t,e)=>t===e)):t===e,w=(t,e)=>p?v(t,e,lc):lc(t,e),S=(t,e)=>{const n=p?{...t,...e}:{...t,[l]:e};for(const t of p||[l])(p?t in e:void 0!==e)||delete n[t];return n},_=(t,e,n,s,o)=>{const i=Date.now(),a=ec.get(e.past),l=o&&a&&a[0]==s&&i-a[1]<d&&e.past.length,u={...ic(e),past:l?e.past:[...e.past,n].slice(-c),future:[]};return ec.set(u.past,[s,i]),{...t,[r]:u}},E=(t,[e,o,i,a],l)=>{const c=t=>!!t&&o.some((e=>t.includes(e))),p=!u||c(u),m=d>0&&c(h),v=f.includes(l);return(o,...c)=>{const u=t?t(o,...c):o,h=s(u)?o:u,d=c[2]?.state||o,f=t?u:n;if(!h||"object"!=typeof h||!d)return f;const S=g(h),E=S.base,k=y(h),A=y(d);if(v)return S.past.length||S.future.length||E?{...h,[r]:{...ic(S),past:[],future:[]}}:f;if(!p)return f;const x=E&&b(E[1],A)&&E,O=1==e&&a?.(h[i]);if(1==e&&!O){if(b(k,A))return E&&!x?{...h,[r]:ic(S)}:f;const t=x?x[0]:A;return{...h,[r]:w(t,k)?ic(S):{...S,base:[t,k,i]}}}if(E&&null!=E[2]&&E[2]!==i||!E&&!O)return f;if(O){const t=x?x[0]:A;return w(t,k)?E?{...h,[r]:ic(S)}:f:_(h,S,t,l,0)}return!x||b(E[0],k)?{...h,[r]:ic(S)}:_(h,S,E[0],l,m)}},k=(t,e)=>{const n=t.base;return n&&b(n[1],e)&&!b(n[0],e)?[n[0]]:null};for(const e in a)e in t||(m[e]={[i]:E(null,a[e],e)});for(const e in t){const n=t[e],[o,l]=e.split("|").map((t=>t.trim()));if(a[e]){const t="function"==typeof n?n:n?.[i];m[e]="function"==typeof n?E(n,a[e],e):{...n,[i]:E("function"==typeof t?t:null,a[e],e)};continue}const c=f.includes(o),p=d>0&&(!h||h.includes(o)),v=l?l==i?n:null:"function"==typeof n?n:n?.[i];if(null!=v&&"function"!=typeof v){m[e]=n;continue}const w=v;if(!(w||c&&!l)||!c&&(u?!u.includes(o):tc.test(o))){m[e]=n;continue}const S=(t,...e)=>{const n=w?w(t,...e):t,i=g(t);if(!n||"object"!=typeof n||s(n))return n;if(c)return i.past.length||i.future.length||i.base?{...n,[r]:{...ic(i),past:[],future:[]}}:n;const a=y(t);if(n===t||b(y(n),a))return n;const l=k(i,a);return _(n,i,l?l[0]:a,o,!l&&p)};m[e]=l||"function"==typeof n?S:{...n,[i]:S}}const A=t=>e=>{const s=g(e),o=y(e),i=k(s,o),{past:a,future:l}=s;return(t?i||a.length:l.length)?{...S(e,t?i?i[0]:a[a.length-1]:l[0]),[r]:{...ic(s),past:t?i?a:a.slice(0,-1):[...a,i?i[0]:o].slice(-c),future:t?[o,...l]:l.slice(1)}}:n},x=(t,e)=>{const n=m[o+t];if(!n)return m[o+t]=e;const r="function"==typeof n?n:n[i],a="function"!=typeof r?e:(t,...n)=>{const o=e(t,...n),i=r(s(o)?t:o,...n);return s(i)?o:i};m[o+t]="function"==typeof n?a:{...n,[i]:a}};return x("UNDO",A(!0)),x("REDO",A(!1)),m},uc=globalThis,hc=(t,e)=>{const{key:n,pick:s,omit:r,version:o=1,migrate:i,sync:a,debounceMs:l=100}=e,c="plain"==e.format,u=t.sources,h=u.__m,d=u.__storage,f=t.calculated||{},p=e.hydrate??u.__hydrate??!!("string"==typeof h?uc.document?.querySelector(h):h)?.firstElementChild?.hasAttribute("data-sygnal-ssr");let m,g,y,v,b,w;const S={},_=(e,s)=>S[e]||(S[e]=1,Rn("SYG642",t,`persist '${n}': ${e} failed`,void 0,s)),E=t.view?.uses||{},k=t=>{const e={};for(const n in t)(s?!s.includes(n):r?.includes(n))||n in f||!1===E[n]?.persist||(e[n]=t[n]);return e},A=t=>{try{if(null==t)return;const e=JSON.parse(t);if(c)return e&&"object"==typeof e&&!Array.isArray(e)?k(e):void 0;const{version:n=1,state:s}=e,r=n===o?s:i&&i(s,n);return r&&k(r)}catch(t){_("restore",t)}},x=()=>{clearTimeout(g),g=0;const t=JSON.stringify(c?k(y):{version:o,state:k(y)}),e=v;if(t!=v)try{v=t,m.setItem(n,t),S.save=0}catch(t){v=e,_("save",t)}},O=e=>e&&t.action$.shamefullySendNext({type:"RESTORE",data:e}),T=(t,e)=>(...s)=>{const r=e?.(...s),o="function"==typeof t?t(...s):t;return o?.clear&&(()=>{clearTimeout(g),g=0,b=1,v=null,setTimeout((()=>b=0));try{m?.removeItem(n)}catch(t){_("clear",t)}})(),r},$={RESTORE:(t,e)=>({...t,...e})};for(const e in t.model){let n=t.model[e];if(n&&"object"==typeof n&&"PERSIST"in n){const{PERSIST:t,...e}=n;n={...e,EFFECT:T(t,e.EFFECT)}}$[e]=n}t.model=$;try{m="object"==typeof e.storage?e.storage:(d||uc)[(e.storage||"local")+(d?"":"Storage")]}catch(t){}if(!m)return;try{if(v=m.getItem(n),!p){const e=A(v);e&&(t.initialState={...t.initialState,...e})}}catch(t){_("restore",t)}const j=t.sources[t.stateSourceName].stream;let C=1;const N={next:e=>{if(y=e,C){C=0;let e=p;const n=t.vdom$,s={next:()=>e&&setTimeout((()=>(n.removeListener(s),O(A(v)))),e=0)};return p&&n.addListener(s)}b||(clearTimeout(g),g=setTimeout(x,l))}};j.addListener(N);const L=()=>g&&x(),M=(t,e)=>{t==n&&e!=v&&O(A(v=e))},I=t=>(!t.storageArea||t.storageArea==m)&&M(t.key,t.newValue);a&&(w=m.subscribe?m.subscribe(M):(uc.addEventListener?.("storage",I),()=>uc.removeEventListener?.("storage",I))),uc.addEventListener?.("pagehide",L),d?.f.add(L),t._dispose$.addListener({next:()=>{L(),j.removeListener(N),w?.(),uc.removeEventListener?.("pagehide",L),d?.f.delete(L)}})},dc=Symbol.for("sygnal.owned"),fc=t=>{const e=t&&"object"==typeof t?Object.getPrototypeOf(t):0;return(t=>{try{t&&"object"==typeof t&&Object.isExtensible(t)&&Object.defineProperty(t,dc,{value:1})}catch{}return t})(Array.isArray(t)?[...t]:e==Object.prototype||null===e?{...t}:t)},pc=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),mc={"&":"&","<":"<",">":">",'"':""","'":"'"};let gc=!1;const yc=t=>t?.data?.m&&"slot"===t.sel;function vc(t,e){return String(t).replace(gc?e?/[&"]/g:/[&<>]/g:/[&<>"']/g,(t=>mc[t]))}function bc(t){return t.replace(/^(Webkit|Moz|Ms|O)/,(t=>"-"+t.toLowerCase())).replace(/([A-Z])/g,"-$1").toLowerCase()}let wc,Sc,_c;function Ec(t,e){const n=t&&t.uses;if(!n||"object"!=typeof n)return e;if(null==e&&(e={}),"object"!=typeof e||Array.isArray(e))return e;let s=e;for(const t in n){const r=n[t];if(!r)continue;let o=void 0===s[t]?r.state:s[t];r.keyed&&o&&"object"==typeof o&&null==o.id&&(o={...o,id:r.options?.id??t}),o!==s[t]&&void 0!==o&&(s===e&&(s={...e}),s[t]=o)}return s}function kc(t,e){e=Ec(t,e);const n=t&&t.resources;if(!n||!e||"object"!=typeof e||Array.isArray(e))return e;const s={...e};for(const t of Object.keys(n)){if(void 0!==s[t])continue;let r;try{r="function"==typeof n[t]?n[t](e):n[t]}catch(t){}const o=r&&_c?_c.get(_c.key(r,1)):void 0;s[t]=o&&o.at>0?{status:"success",data:o.v}:{status:r?"loading":"idle"}}return s}const Ac=t=>e=>e?t+"-"+e:t;function xc(t,e,n){const s=e.data?.props?.id;return t+"-"+o(("::"+(s&&JSON.stringify(s).replaceAll('"',"")||n)).replace(/.*::(r\.)?/,""))}const Oc=t=>"string"==typeof t||"number"==typeof t?{text:""+t}:t,Tc=t=>Oc(t)||{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0},$c=()=>({sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0});function jc(t,e,n){let s=$c();if("function"==typeof t.onError)try{s=t.onError(e,{componentName:n})}catch(t){s=$c()}try{wc&&wc(e,{componentName:n,phase:"view"})}catch(t){console.error(t)}return s}function Cc(t,e){const n=t&&t.head;if(Sc&&n)try{Sc.push("function"==typeof n?n(e):n)}catch(t){}}function Nc(t,e={}){const n=Sc,s=_c,r=wc;e.head&&(Sc=e.head),e.cache&&(_c=e.cache),e.onError&&(wc=e.onError);try{return function(t,e){const{state:n,props:s={},context:r={},hydrateState:o}=e,i=(e.uid||"u").replace(/[^\w-]+/g,"_"),a=void 0!==n?n:t.initialState,l=kc(t,a);Cc(t,l);const c=t.context||{},u={...r};for(const t of Object.keys(c)){const e=c[t];if("function"==typeof e&&null!=l)try{u[t]=e(l)}catch(t){}}let h;try{h=t({...s,state:l,children:s.children||[],slots:s.slots||{},context:u,uid:Ac(i)})}catch(e){h=jc(t,e,t.componentName||t.name||"Component")}h||(h={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0});h=Lc(h,u,l,i,"r");const d=t=>{if(t?.sel)return"!"!==t.sel&&t;if(Array.isArray(t?.children))for(const e of t.children){const t=d(e);if(t)return t}},f=h?.sel?h:d(h);f&&!gc&&(f.data={...f.data,attrs:{"data-sygnal-ssr":"",...f.data?.attrs}});let p=qc(h);if(o&&null!=a){const t="string"==typeof o?o:"__SYGNAL_STATE__";vc(JSON.stringify(a)),p+=`<script>window.${t}=${JSON.stringify(a)}<\/script>`}return p}(t,e)}finally{Sc=n,_c=s,wc=r}}function Lc(t,e,n,s,r){if(!t)return t;if("string"==typeof t||null!=t.text)return t;const i=t.sel;if(!i&&t.children&&Array.isArray(t.children))return t.children=t.children.map(((t,o)=>Lc(t,e,n,s,`${r}.${o}`))).filter((t=>null!=t)),t;if("portal"===i){const o=t.children||[];return 0===o.length?null:1===o.length?Lc(o[0],e,n,s,`${r}.0`):{sel:"div.sygnal-portal",data:{attrs:{"data-sygnal-portal":t.data?.props?.target??""}},children:o.map(((t,o)=>Lc(t,e,n,s,`${r}.${o}`))),text:void 0,elm:void 0,key:void 0}}if("transition"===i){const o=(t.children||[])[0];return o?Lc(o,e,n,s,r):null}if("suspense"===i){const o=t.children||[];return 0===o.length?null:1===o.length?Lc(o[0],e,n,s,`${r}.0`):{sel:"div",data:{attrs:{"data-sygnal-suspense":"resolved"}},children:o.map(((t,o)=>Lc(t,e,n,s,`${r}.${o}`))),text:void 0,elm:void 0,key:void 0}}if("clientonly"===i){const o=(t.data?.props||{}).fallback;return o?Lc(o,e,n,s,r):{sel:"div",data:{attrs:{"data-sygnal-clientonly":""}},children:[],text:void 0,elm:void 0,key:void 0}}if("widget"===i&&t.data?.ww){const{ww:o,wp:i,h:a}=t.data,l=o.def.fallback,c=o.$ssr(t);return null!=l&&(c.children=[].concat("function"==typeof l?l(i,a):l).map((t=>"object"==typeof t?t:{text:String(t)}))),Lc(c,e,n,s,r)}if(yc(t)){const o=t.children||[];return 0===o.length?null:1===o.length?Lc(o[0],e,n,s,`${r}.0`):{sel:"div",data:{},children:o.map(((t,o)=>Lc(t,e,n,s,`${r}.${o}`))),text:void 0,elm:void 0,key:void 0}}return t.data,"function"==typeof t.data?.c?function(t,e,n,s){const r=t.data?.props||{},o=t.data?.c;if(!o||"function"!=typeof o)return{sel:"div",data:{attrs:{"data-sygnal-ssr":t.sel||"component"}},children:t.children||[],text:void 0,elm:void 0,key:void 0};let i=o.initialState;const a=r.state;"string"==typeof a&&null!=n&&null!=n[a]?i=n[a]:null!=a&&"string"!=typeof a&&(i=a);i=kc(o,i);const l={...e},c=o.context||{};for(const t of Object.keys(c)){const e=c[t];if("function"==typeof e&&null!=i)try{l[t]=e(i)}catch(t){}}const u={},h=[],d=t.children||[];for(const t of d)if(yc(t)){const e=t.data?.props?.name||"default";u[e]||(u[e]=[]);const n=t.children||[];u[e].push(...n)}else h.push(t);h.length>0&&(u.default||(u.default=[]),u.default.push(...h));let f;Cc(o,i);try{f=o({...r,state:i,children:u.default||d,slots:u,context:l,uid:Ac(s)})}catch(t){f=jc(o,t,o.componentName||o.name||"Component")}return Lc(Tc(f),l,i,s,"r")}(t,e,n,xc(s,t,r)):"collection"===i?Gc(t,e,n,xc(s,t,r)):"virtual-collection"===i?function(t,e,n,s){const r=t.data?.props||{},o=r.estimateSize,i=o>0?o:32,a=10+(r.overscan>=0?r.overscan:5),l="function"==typeof r.of?Dc(r,n):[],c=void 0===r.role?"list":r.role,u=Gc(t,e,n,s,a,Ic,((t,e)=>{const n=t.data?.attrs?.role||t.data?.props?.role,s={...t.data?.attrs,"data-index":e};return("list"==c||n)&&(s["aria-posinset"]=e+1,s["aria-setsize"]=l.length),"list"!=c||n||(s.role="listitem"),{...t,data:{...t.data,attrs:s}}})).children,h={tabindex:r.tabIndex??0};null!=c&&(h.role=c);for(const t of["id","aria-label","aria-labelledby","aria-describedby"])null!=r[t]&&(h[t]=r[t]);let d=0;for(let t=0;t<l.length;t++){const e="function"==typeof o?o(l[t][0],t):i;d+=e>0?e:32}const f=(t,e)=>({sel:"div",data:t,children:e,text:void 0,elm:void 0,key:void 0});return f({props:r.className?{className:r.className}:{},attrs:h,style:{overflowY:"auto",overflowAnchor:"none",...r.style}},[f({style:{position:"relative",width:"100%",height:d+"px"}},[f({style:{position:"absolute",top:"0",left:"0",width:"100%",transform:"translateY(0px)"}},u)])])}(t,e,n,xc(s,t,r)):"switchable"===i?function(t,e,n,s){const r=t.data?.props||{},{components:i,active:a,initial:l}=r;if(!i)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};let c;"string"==typeof a&&(i[a]?c=a:n&&"string"==typeof n[a]&&(c=n[a]));!c&&l&&(c=l);c||(c=Object.keys(i)[0]);const u=i[c];if(!u||"function"!=typeof u)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};return function(t,e,n,s){const r=kc(t,void 0!==e?e:t.initialState),o=t.context||{},i={...n};for(const t of Object.keys(o)){const e=o[t];if("function"==typeof e&&null!=r)try{i[t]=e(r)}catch(t){}}let a;Cc(t,r);try{a=t({state:r,children:[],slots:{},context:i,uid:Ac(s)})}catch(e){a=jc(t,e,t.name||"Component")}return Lc(Tc(a),i,r,s,"r")}(u,n,e,s+"-"+o(c))}(t,e,n,xc(s,t,r)):(t.children&&(Array.isArray(t.children)?t.children.length>0&&(t.children=t.children.map(((t,o)=>Lc(t,e,n,s,`${r}.${o}`))).filter((t=>null!=t))):t.children&&"object"==typeof t.children&&(t.children=Lc(t.children,e,n,s,`${r}.0`))),t)}const Mc=new Set(["of","from","filter","sort","idfield","className","viewTransitionName"]),Ic=/^(estimateSize|overscan|role|tabIndex|style|id|aria-(label|labelledby|describedby))$/;function Dc(t,e){const{from:n,filter:s,sort:r}=t;let o;if(void 0===n)o=!Array.isArray(e)&&Array.isArray(e?.value)?e.value:e;else if("string"==typeof n)o=e?.[n];else if(n&&"object"==typeof n&&"function"==typeof n.get)try{o=n.get(e)}catch(t){o=void 0}if(!Array.isArray(o))return[];let i=o.map(((t,e)=>e));try{"function"==typeof s&&(i=i.filter((t=>s(o[t],t,o))));const t=r?cr(r):void 0;t&&i.sort(((e,n)=>t(o[e],o[n])))}catch(t){}const a=new Map,l=[];for(let t=0;t<o.length;t++){const e=vs(o[t],t);a.has(e)||a.set(e,t)}for(const t of i)a.get(vs(o[t],t))===t&&l.push([o[t],t]);return l}function Gc(t,e,n,s,r,a,l){const c=t.data?.props||{},{of:u,viewTransitionName:h}=c,d=t=>({sel:void 0,data:{},children:t,text:void 0,elm:void 0,key:void 0});if(!u||"function"!=typeof u)return d([]);let f=Dc(c,n);f.length,void 0!==r&&(f=f.slice(0,r));const p={};for(const t in c)Mc.has(t)||a&&a.test(t)||"key"===t||"children"===t||(p[t]=c[t]);const m=t.children||[],g=function(t){const e={};for(const n of t){const t=yc(n)&&n.data?.props?.name||"default";(e[t]||(e[t]=[])).push(...yc(n)?n.children||[]:[n])}return e}(m),y=f.map((([t,n],r)=>{let a=t;const c=a&&"object"==typeof a&&!Array.isArray(a),d=s+"-"+(c&&null!=a.id?o(a.id):"_i"+n);a=Ec(u,a);const f={...e},y=u.context||{};for(const t of Object.keys(y)){const e=y[t];if("function"==typeof e)try{f[t]=e(a)}catch(t){}}let v;try{v=u({...p,state:a,children:g.default||m,slots:g,context:f,uid:Ac(d)})}catch(t){v=jc(u,t,u.name||"CollectionItem")}const b=Lc(Oc(v),f,a,d,"r"),w=h&&c&&null!=a.id&&b?.sel?{...b,data:{...b.data,style:i(h,a.id,b.data?.style)}}:b;return l&&w?.sel?l(w,r):w})).filter((t=>null!=t));return d(y)}const Pc=t=>t.replace(/[\t\n\f\r ]+/g," ").replace(/^ | $/g,""),Rc=t=>t?.props?.value??t?.attrs?.value,Yc=t=>{const e={...t};return e.props&&(e.props={...e.props},delete e.props.value),e.attrs&&(e.attrs={...e.attrs},delete e.attrs.value),e},Fc=t=>null==t?"":"object"!=typeof t?String(t):null!=t.text?String(t.text):Array.isArray(t.children)?t.children.map(Fc).join(""):"";function qc(t,e){if(null==t)return"";if("string"==typeof t)return vc(t);if(null!=t.text&&!t.sel)return vc(String(t.text));const n=t.sel;if(!n)return null!=t.text?vc(String(t.text)):t.children&&Array.isArray(t.children)?t.children.map((t=>qc(t,e))).join(""):"";const{tag:s,id:r,selectorClasses:o}=function(t){let e=t,n=null;const s=[],r=t.indexOf("#");if(-1!==r){const o=t.slice(r+1),i=o.indexOf(".");if(-1!==i){n=o.slice(0,i),e=t.slice(0,r);const a=o.slice(i+1);a&&s.push(...a.split("."))}else n=o,e=t.slice(0,r)}else{const n=t.indexOf(".");if(-1!==n){e=t.slice(0,n);const r=t.slice(n+1);r&&s.push(...r.split("."))}}e||(e="div");return{tag:e,id:n,selectorClasses:s}}(n);let i,a=t.data||{};const l=Rc(a);if(gc);else if("textarea"==s&&null!=l){a=Yc(a);const t=String(l);i=vc(("\n"==t[0]||"\r"==t[0]?"\n":"")+t)}else"select"==s&&null!=l?(a=Yc(a),e={v:[].concat(l).map(String),m:!!(a.props?.multiple??a.attrs?.multiple)}):"option"==s&&e&&null==a.props?.selected&&null==a.attrs?.selected&&e.v.includes(null!=l?String(l):Pc(Fc(t)))&&(a={...a,attrs:{...a.attrs,selected:!0}},e.m||(e.v=[]));"select"!=s&&"optgroup"!=s&&"option"!=s&&(e=void 0);const c=function(t,e,n,s){const r=[],o=[...n];if(t.props)for(let[e,n]of Object.entries(t.props))if("className"===e)"string"==typeof n&&n&&o.push(n);else if("htmlFor"===e)r.push(["for",n]);else if("innerHTML"===e||"textContent"===e);else if(s&&("function"==typeof n||n&&"object"==typeof n));else{const t=s&&/[A-Z]/.test(e)?zc.test(e)?[e.toLowerCase()]:/^aria[A-Z]/.test(e)?[Bc(e)]:[Bc(e),e.toLowerCase()]:[e];for(const e of t)"boolean"==typeof n?n&&r.push([e,!0]):null!=n&&r.push([e,n])}if(t.attrs)for(const[e,n]of Object.entries(t.attrs))"class"===e?"string"==typeof n&&n&&o.push(n):"boolean"==typeof n?n&&r.push([e,!0]):null!=n&&r.push([e,n]);if(t.class)for(const[e,n]of Object.entries(t.class))n&&o.push(e);if(t.dataset)for(const[e,n]of Object.entries(t.dataset))null!=n&&r.push([`data-${bc(e)}`,n]);e&&r.unshift(["id",e]);if(o.length>0){const t=[...new Set(o)];r.unshift(["class",t.join(" ")])}if(t.style&&"object"==typeof t.style){const e=function(t){const e=[];for(const n of Object.keys(t)){const s=t[n];if(null==s||""===s)continue;if("delayed"===n||"remove"===n||"destroy"===n)continue;const r=bc(n);e.push(`${r}: ${s}`)}return e.join("; ")}(t.style);e&&r.push(["style",e])}return r}(a,r,o,s.includes("-"));let u=`<${s}`;for(const[t,e]of c)!0===e?u+=` ${t}`:!1!==e&&null!=e&&(u+=` ${t}="${vc(String(e),!0)}"`);if(u+=">",pc.has(s))return u;if(null!=t.data?.props?.innerHTML)return u+=String(t.data.props.innerHTML),u+=`</${s}>`,u;if(void 0!==i)u+=i;else if(null!=t.text)u+=vc(String(t.text));else if(t.children){const n=Array.isArray(t.children)?t.children:[t.children];for(const t of n)u+=qc(t,e)}return u+=`</${s}>`,u}const zc=/^(tabIndex|readOnly|maxLength|minLength|contentEditable|accessKey|inputMode|enterKeyHint|spellCheck|autoFocus|autoComplete|autoCapitalize|autoPlay|noValidate|formAction|formEnctype|formMethod|formNoValidate|formTarget|crossOrigin|referrerPolicy|useMap|isMap|dateTime|colSpan|rowSpan|srcSet|allowFullscreen|playsInline|noModule|popoverTarget|popoverTargetAction|encType)$/,Bc=t=>t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()));const Wc=/^(BOOTSTRAP|INITIALIZE|DISPOSE|RESOURCE)$/,Uc=()=>{const t=setTimeout.clock;return t?t.now:Date.now()};function Vc(t,e,n,s,r){e.sinks.includes(s)||(e.sinks.push(s),e.sinks.sort(((t,e)=>n.indexOf(t)-n.indexOf(e))));try{t.sink?.(e,s,r)}catch(t){}}const Hc=["focus","blur","select","click","scrollIntoView","showModal","show","close","showPopover","hidePopover","togglePopover"],Jc=(t,e)=>{try{globalThis.__SYGNAL_DIAGNOSTICS__?.report(t,{severity:cn[t],...e})}catch(t){setTimeout((()=>{throw t}))}},Kc=t=>"function"==typeof t&&!!t.__sygnalControl,Zc=t=>String(t).slice(15,-2),Xc=t=>{if(!t||"object"!=typeof t)return JSON.stringify(t)??String(t);const e=Object.keys(t).map((e=>{const n=t[e];let s;if(Kc(n))s=Zc(n);else try{s=JSON.stringify(n)??String(n)}catch(t){s=String(n)}return`${e}: ${s}`}));return`{ ${e.join(", ")} }`},Qc=(t,e)=>{const n=Array.from({length:e.length+1},((t,e)=>e));for(let s=1;s<=t.length;s++){let r=n[0];n[0]=s;for(let o=1;o<=e.length;o++){const i=n[o];n[o]=Math.min(n[o]+1,n[o-1]+1,r+(t[s-1]==e[o-1]?0:1)),r=i}}return n[e.length]},tu=(t,e)=>{let n,s=3;for(const r of e){const e=r.toLowerCase()==t.toLowerCase()?0:Qc(t,r);e<s&&(s=e,n=r)}return n},eu=t=>t&&"string"==typeof t.tagName?`<${t.tagName.toLowerCase()}>`:"element",nu=(t,e,n)=>Jc("SYG641",{component:t,message:`${e} sent ${Xc(n)} to the ELEMENT sink, which is not a command`,fix:"Send { <method>: control or selector, ...options }, e.g. { focus: Email }, or an array of them",data:{command:n}});function su(t,e,n){if(t&&t._disposed)return;const s=t&&t.name||"component",r=e&&"object"==typeof e?Object.keys(e)[0]:void 0;if(void 0===r)return nu(t,s,e);const o=e[r],i=`ELEMENT ${Xc(e)}`,a=Kc(o)?Zc(o):void 0,l={method:r,command:e,...a?{control:a}:{selector:null==o?o:String(o)}};if(!n){const e=null==o||""===o;return Jc("SYG640",{component:t,message:e?`${i} in ${s} has no target (${String(o)}), so the command was dropped`:`${i} in ${s} matched no element: nothing in ${s}'s own view matches ${a?`the control ${a}`:`'${String(o)}'`} (waited 1 s), so the command was dropped`,fix:e?`Give the method a control or a selector: { ${r}: Email }`:`Render the element in ${s}'s view, or send the command from the component that renders it: a child component's elements are isolated from its parent, and a command reaches only its sender's own elements (in a Collection, each item sends its own)`,data:l})}const c=n.__sw?.w;if(c){const e=Object.keys(c.commands),o=tu(r,[...e,...Hc]);return Jc("SYG142",{component:t,message:`${i} in ${s}: the matched ${eu(n)} is a widget's host, and the widget declares no '${r}' command`+(o?` (did you mean '${o}'?)`:"")+(e.length?`; it declares: ${e.join(", ")}`:"; it declares none"),fix:`Add '${r}' to the widget's commands (defineWidget({ commands: { ${r}: (instance, options) => … } })), or send one it declares`,data:{...l,element:eu(n),commands:e}})}const u=a&&o.spec&&"object"==typeof o.spec&&o.spec.commands?Object.keys(o.spec.commands):[];let h,d;if(l.element=eu(n),u.length&&(l.commands=u),Hc.includes(r))h=`${i} in ${s}: the matched ${eu(n)} has no ${r}() method${u.length?`, and the control ${a}'s spec declares no '${r}' command (it declares: ${u.join(", ")})`:""}`,d=/^(show|showModal|close)$/.test(r)?`${r}() works on a <dialog> element: render the target as a <dialog>`:/Popover$/.test(r)?"The popover methods need an element with the popover attribute (attrs: { popover: 'auto' }) in a browser with the Popover API":`Target an element that has ${r}()`;else{const t=tu(r,[...u,...Hc]);h=`${i} in ${s}: '${r}' is not an element command`+(t?` (did you mean '${t}'?)`:"")+(n.tagName?`: the matched ${eu(n)} has no such method`:"")+(u.length?`, and the control ${a}'s spec declares only: ${u.join(", ")}`:""),d=`Use ${u.length?`one of its commands (${u.join(", ")}) or `:""}one of: ${Hc.join(", ")} (or another method of the element, like play). The first key of a command is the method, the others are its options: { scrollIntoView: Row, block: 'nearest' }`}Jc("SYG641",{component:t,message:h,fix:d,data:l})}const ru=/^(remove|append|prepend|before|after|replaceWith|replaceChildren|appendChild|removeChild|insertBefore|replaceChild|insertAdjacent(Element|HTML|Text)|(set|remove|toggle)Attribute(NS|Node)?|attachShadow|setHTML(Unsafe)?|normalize)$/;function ou(t,e){if(null==e)return;const n=t&&t.name||"component";if("object"!=typeof e||Array.isArray(e)||!Object.keys(e).length)return nu(t,n,e);const s=Object.keys(e)[0],r=e[s];!ru.test(s)||Kc(r)&&r.spec?.commands?.[s]||Jc("SYG641",{component:t,message:`ELEMENT ${Xc(e)} in ${n}: ${s}() changes the DOM that ${n}'s view renders, so the next render undoes it or fails`,fix:"Change the state and render the result instead; element commands are for what a view can't express (focus, scrolling, dialogs, popovers, media)",data:{method:s,command:e}})}const iu=t=>t.startsWith(".___"),au=t=>"function"==typeof t&&t.__sygnalControl?""+t:t,lu=t=>cu(t.filter((t=>!iu(t))).join(" ")),cu=t=>t.trim().replace(/\s*>\s*/g," > ").replace(/\s+/g," "),uu=/^(document|body)(\s+|$)/,hu=t=>{const e={};for(const n in t)null!=t[n]&&(e[n]=String(t[n]));return e},du="tag, *, .class, #id, [attr], [attr=\"v\"] (also ^= $= *= ~=), :first-child, :last-child, :only-child, :nth-child(an+b|odd|even), :nth-last-child(), :first-of-type, :last-of-type, :only-of-type, :nth-of-type(), :nth-last-of-type(), :not(...), :checked, :disabled, :enabled, the descendant (' ') and child ('>') combinators, ',' lists",fu=/^(?:[\w-]|\\.)+/,pu=["checked","disabled","enabled"],mu=["button","input","select","textarea","option","optgroup","fieldset"],gu=t=>t.replace(/\\(.)/g,"$1"),yu=new Map;function vu(t){let e=yu.get(t);if(!e){try{e=function(t){let e=0;const n=e=>{const n=new Error(`[Sygnal] Unsupported selector syntax in '${t}': ${e}. Supported: ${du}. Or give the element an attribute and select it, e.g. [data-id="3"]. With renderComponent(C, { dom: 'real' }) any CSS selector works`);throw n.unsupported=!0,n},s=()=>{const n=t.slice(e).match(/^\s*/)[0].length;return e+=n,n>0},r=s=>{const r=t.slice(e).match(fu);return r?(e+=r[0].length,gu(r[0])):n(`expected ${s} at '${t.slice(e)||"end"}'`)},o=t=>{const e=t.trim().toLowerCase().replace(/\s+/g,"");if("odd"==e)return[2,1];if("even"==e)return[2,0];if(/^[+-]?\d+$/.test(e))return[0,+e];const s=e.match(/^([+-]?\d*)n([+-]\d+)?$/);return s?[""==s[1]||"+"==s[1]?1:"-"==s[1]?-1:+s[1],s[2]?+s[2]:0]:n(`'${t}' is not an+b`)},i=()=>{const s={cls:[],attrs:[],ps:[]},i=e;for("*"==t[e]?e++:fu.test(t.slice(e))&&(s.tag=r("tag").toLowerCase());;){const i=t[e];if("."==i)e++,s.cls.push(r("a class name"));else if("#"==i)e++,s.id=r("an id");else if("["==i){const r=t.slice(e).match(/^\[\s*((?:[\w-]|\\.)+)\s*(?:([~^$*|]?=)\s*(?:"([^"]*)"|'([^']*)'|((?:[\w-]|\\.)+))\s*)?\]/);if(!r)return n(`attribute selector '${t.slice(e)}'`);"|="==r[2]&&n("the '|=' attribute operator"),e+=r[0].length,s.attrs.push([gu(r[1]),r[2]||"",r[2]?r[3]??r[4]??gu(r[5]):void 0])}else{if(":"!=i)break;{":"==t[e+1]&&n("pseudo-elements"),e++;const i=r("a pseudo-class").toLowerCase();let a;if("("==t[e]){let s=0,r=e;for(;r<t.length;r++)if("("==t[r])s++;else if(")"==t[r]&&! --s)break;r>=t.length&&n(`unclosed ':${i}('`),a=t.slice(e+1,r),e=r+1}const l={k:i,a:0,b:1},c=i.match(/^(?:(first|last|only)|nth(-last)?)-(child|of-type)$/);c&&void 0===a==!!c[1]?(l.type="of-type"==c[3],"only"==c[1]?l.k="only":c[1]?l.last="last"==c[1]:(/\bof\b/.test(a)&&n(`':${i}(... of S)'`),[l.a,l.b]=o(a),l.last=!!c[2])):pu.includes(i)&&void 0===a||("not"==i&&void 0!==a?(l.not=vu(a),l.not.some((t=>t.parts.length>1))&&n("combinators inside ':not()'")):n(`':${i}${void 0===a?"":"("+a+")"}'`)),s.ps.push(l)}}}return e==i&&n(`unexpected '${t[e]||"end of selector"}'`),s},a=[];if(s(),e>=t.length)return a;for(;;){const r={parts:[i()],combs:[]};for(;;){const o=s(),a=t[e];if(e>=t.length||","==a)break;"+"!=a&&"~"!=a||n(`the '${a}' combinator`),">"==a?(e++,s(),r.combs.push(">")):o?r.combs.push(" "):n(`unexpected '${a}'`),r.parts.push(i())}if(a.push(r),e>=t.length)return a;e++,s()}}(t)}catch(t){e=t}yu.set(t,e)}if(e instanceof Error)throw e;return e}const bu=t=>{try{return vu(t)}catch(t){return}};function wu(t){const e=[];for(const n of[].concat(t.children||[]))n&&"object"==typeof n&&(n.sel?"!"!=n.sel&&e.push(n):n.children&&e.push(...wu(n)));return e}const Su=new WeakMap;const _u=t=>t.sel.split(/[.#]/)[0].toLowerCase();function Eu(t,e){const n=(t,s,r)=>{if(r<0||!function(t,e){const n=t.data||{},s=n.props||{},r=n.attrs||{},[o,...i]=t.sel.split("."),[a,l]=o.split("#");if(e.tag&&a.toLowerCase()!=e.tag)return!1;const c=l||s.id||r.id;if(void 0!==e.id&&c!=e.id)return!1;if(e.cls.length){const t=i.concat(`${s.className||""} ${r.class||""}`.split(" "),Object.keys(n.class||{}).filter((t=>n.class[t])));if(!e.cls.every((e=>t.includes(e))))return!1}for(const[t,o,i]of e.attrs){const e="id"==t?c:t in r?r[t]:t in s?s[t]:t.startsWith("data-")?hu(n.dataset)[t.slice(5).replace(/-(\w)/g,((t,e)=>e.toUpperCase()))]:void 0;if(null==e||!1===e)return!1;const a=String(e);if(o&&!("="==o?a==i:i&&("^="==o?a.startsWith(i):"$="==o?a.endsWith(i):"*="==o?a.includes(i):a.split(/\s+/).includes(i))))return!1}for(const n of e.ps){if(n.not){if(Eu(n.not,[t]))return!1;continue}if(pu.includes(n.k)){if("checked"==n.k?!(Ou(t,"checked")||"option"==_u(t)&&Ou(t,"selected")):!mu.includes(_u(t))||Ou(t,"disabled")==("enabled"==n.k))return!1;continue}let e=(Su.get(t)||{sibs:[t]}).sibs;if(n.type&&(e=e.filter((e=>_u(e)==_u(t)))),"only"==n.k){if(1!=e.length)return!1;continue}const s=e.indexOf(t),r=n.last?e.length-s:s+1;if(0==n.a?r!=n.b:(r-n.b)/n.a<0||(r-n.b)%n.a!=0)return!1}return!0}(e[r],t.parts[s]))return!1;if(0==s)return!0;if(">"==t.combs[s-1]){const o=Su.get(e[r]);return r>0&&(!o||e[r-1]===o.p)&&n(t,s-1,r-1)}for(let e=r-1;e>=0;e--)if(n(t,s-1,e))return!0;return!1};return t.some((t=>n(t,t.parts.length-1,e.length-1)))}function ku(t,e,n=[]){if(!t||"object"!=typeof t)return;const s=t.sel?n.concat(t):n;if(t.sel&&Eu(e,s))return s;for(const n of[].concat(t.children||[],t.data?.portalChildren||[])){const t=ku(n,e,s);if(t)return t}}function Au(t,e,n,s,r=!0){if(!t||"object"!=typeof t)return s;const o=t.sel?n.concat(t):n;t.sel&&r&&Eu(e,o)&&s.push(o);for(const n of[].concat(t.children||[],t.data?.portalChildren||[]))Au(n,e,o,s);return s}const xu={class:"className",for:"htmlFor",readonly:"readOnly",tabindex:"tabIndex"};function Ou(t,e){const n=t.data||{},s=n.props||{},r=n.attrs||{};if(e in s)return!!s[e];const o=e in r?r[e]:r[e.toLowerCase()];return null!=o&&!1!==o}function Tu(t){const e=t.data||{},n=e.props||{},s=e.attrs||{},r=t.sel.split("#").flatMap((t=>t.split(".").slice(1))).concat(`${n.className||""} ${s.class||""}`.split(/\s+/),Object.keys(e.class||{}).filter((t=>e.class[t])));return r.filter(((t,e)=>t&&!t.startsWith("___")&&r.indexOf(t)==e))}function $u(t,e){const n=t.data||{},s=n.props||{},r=n.attrs||{},o=e.toLowerCase();if("class"==o){const e=Tu(t);return e.length?e.join(" "):null}if("id"==o&&t.sel.includes("#"))return t.sel.split("#")[1].split(".")[0];const i=e in r?r[e]:o in r?r[o]:e in s?s[e]:xu[o]&&xu[o]in s?s[xu[o]]:o.startsWith("data-")?(n.dataset||{})[o.slice(5).replace(/-(\w)/g,((t,e)=>e.toUpperCase()))]:void 0;return null==i||!1===i?null:!0===i?"":String(i)}function ju(t){return null==t||"boolean"==typeof t?"":"object"!=typeof t?String(t):"!"==t.sel?"":(null!=t.text?String(t.text):"")+[].concat(t.children||[]).map(ju).join("")}const Cu=new WeakMap,Nu=(t,e)=>t.reduce(((t,n)=>{const s=Cu.get(n);return s&&s._p===t?s:new Lu(n,t,e)}),null);class Lu{constructor(t,e,n){Object.defineProperties(this,{_v:{value:t},_p:{value:e},_html:{value:n},nodeType:{value:1}}),Cu.set(t,this)}chain(){const t=[];for(let e=this;e;e=e._p)t.unshift(e._v);return t}get tagName(){return _u(this._v).toUpperCase()}get nodeName(){return this.tagName}get localName(){return _u(this._v)}get id(){return $u(this._v,"id")??""}get className(){return Tu(this._v).join(" ")}get classList(){const t=Tu(this._v);return Object.assign(t,{contains:e=>t.includes(e),item:e=>t[e]??null,value:t.join(" ")})}get dataset(){const t=this._v.data||{},e={...hu(t.dataset)};for(const n of[t.props||{},t.attrs||{}])for(const t in n)t.startsWith("data-")&&null!=n[t]&&(e[t.slice(5).replace(/-(\w)/g,((t,e)=>e.toUpperCase()))]=String(n[t]));return e}get style(){return{...this._v.data?.style||{}}}get textContent(){return ju(this._v)}get innerText(){return this.textContent}get outerHTML(){return this._html(this._v)}get innerHTML(){const t=this.outerHTML,e=`</${this.localName}>`;return t.endsWith(e)?t.slice(t.indexOf(">")+1,-e.length):""}get value(){const t=this._v,e=t.data?.props||{},n=this.localName;if(null!=e.value)return String(e.value);const s=$u(t,"value");if(null!==s)return s;if("textarea"==n||"option"==n)return this.textContent;if("select"==n){const t=this.querySelector("option:checked")||this.querySelector("option");return t?t.value:""}return"input"==n&&/^(checkbox|radio)$/.test(this.type)?"on":""}get checked(){return Ou(this._v,"checked")}get selected(){return Ou(this._v,"selected")}get disabled(){return Ou(this._v,"disabled")}get readOnly(){return Ou(this._v,"readOnly")||Ou(this._v,"readonly")}get required(){return Ou(this._v,"required")}get hidden(){return Ou(this._v,"hidden")}get type(){return $u(this._v,"type")??("input"==this.localName?"text":"button"==this.localName?"submit":"")}get name(){return $u(this._v,"name")??""}get href(){return $u(this._v,"href")??""}get src(){return $u(this._v,"src")??""}get placeholder(){return $u(this._v,"placeholder")??""}get title(){return $u(this._v,"title")??""}get alt(){return $u(this._v,"alt")??""}get htmlFor(){return $u(this._v,"for")??""}getAttribute(t){return $u(this._v,t)}hasAttribute(t){return null!==$u(this._v,t)}get parentElement(){return this._p}get children(){return wu(this._v).map((t=>Nu([...this.chain(),t],this._html)))}get childElementCount(){return this.children.length}get firstElementChild(){return this.children[0]??null}get lastElementChild(){const t=this.children;return t[t.length-1]??null}matches(t){return Eu(vu(cu(t)),this.chain())}closest(t){const e=vu(cu(t));for(let t=this;t;t=t._p)if(Eu(e,t.chain()))return t;return null}querySelectorAll(t){return Au(this._v,vu(cu(t)),this.chain().slice(0,-1),[],!1).map((t=>Nu(t,this._html)))}querySelector(t){return this.querySelectorAll(t)[0]??null}toJSON(){return this.outerHTML}focus(){throw Mu("focus")}blur(){throw Mu("blur")}click(){throw Mu("click")}dispatchEvent(t){throw Mu("dispatchEvent")}addEventListener(...t){throw Mu("addEventListener")}getBoundingClientRect(){throw Mu("getBoundingClientRect")}}const Mu=t=>new Error(`[Sygnal] element.${t}(): t.query() on the default mock DOM returns a snapshot of what the view rendered. Fire events with t.simulateEvent(selector, type), or use real elements: renderComponent(C, { dom: 'real' })`);function Iu(t){const e=t.sel.match(/\.___[^.#]+/);if(e)return e[0];const n=t.data?.isolate;return n&&n.length?".___"+n[n.length-1].scope:void 0}function Du(t,e,n=[]){if(!t||"object"!=typeof t)return;const s=t.sel?n.concat(t):n;if(t.sel&&t.elm===e)return s;for(const n of[].concat(t.children||[],t.data?.portalChildren||[])){const t=Du(n,e,s);if(t)return t}}const Gu=Symbol("sygnal.testing.inner");function Pu(t,e,n,s){const r={[Gu]:t,_hub:n,_path:e,select:r=>Pu(t.select(r),e.concat(au(r)),n,s),events:(n,r,o)=>{s(e,n);const i=t.events(n,r,o);let a;const l=Ri(Fe.create({start:t=>{i.addListener(a={next:e=>t.next(e),error:e=>t.error(e),complete:()=>t.complete()}),s(e,n,!0)},stop:()=>{i.removeListener(a),s(e,n,!1)}}));return l._isCycleSource=i._isCycleSource,l}};return"function"==typeof t.isolateSource&&(r.isolateSource=(r,o)=>Pu(t.isolateSource(r[Gu]||r,o),(r._path||e).concat(".___"+o),n,s)),new Proxy(t,{get:(t,e)=>e in r?r[e]:"function"==typeof t[e]?t[e].bind(t):t[e],has:(t,e)=>e in r||e in t})}const Ru=/^(blur|focus|mouseenter|mouseleave|pointerenter|pointerleave|load|unload|scroll|scrollend|invalid|close|cancel|toggle|beforetoggle|error|abort)$/;let Yu=0;const Fu={eventWaitMs:300,settleMs:20,timeoutMs:2e3},qu=new WeakMap,zu=t=>{let e=qu.get(t);e||qu.set(t,e=new Set);const n=(t,n)=>e.forEach((e=>e(t,n)));return{getItem:e=>null==t[e]?null:"string"==typeof t[e]?t[e]:JSON.stringify(t[e]),setItem:(e,s)=>{s=String(s);try{t[e]=JSON.parse(s)}catch(n){t[e]=s}n(e,s)},removeItem:e=>{delete t[e],n(e,null)},subscribe:t=>(e.add(t),()=>{e.delete(t)})}},Bu=(t={},e)=>{const n=new Set,s=new Map,r={media:{...t.media},local:{...t.storage},session:{...t.sessionStorage},deny:new Set(t.deny||[]),visible:t.visible??!0,online:t.online??!0,clip:t.clipboard??"",pos:t.position},o=t=>({name:t?.name,message:t?.message}),i=t=>{const e=(t=>r["session"==t.area?"session":"local"])(t)[t.storage??t.setItem??t.removeItem];return null==e?null:t.json?JSON.parse(e):e},a=t=>({latitude:0,longitude:0,accuracy:0,altitude:null,altitudeAccuracy:null,heading:null,speed:null,timestamp:Date.now(),...t}),l={code:1,message:"User denied Geolocation"},c=(t,e)=>(s,r)=>{const i={k:t,s:s,c:r};if(n.add(i),e){let t;try{t=e(s,r)}catch(t){r.fail(o(t))}void 0!==t&&r.send(t)}return()=>{n.delete(i)}},u=t=>(n,s)=>{if(e&&s.dom){let e=!0;const r=s.dom.select(!0===n[t]?"":""+n[t]).elements(),o={next:t=>{e&&!t.length||(t.length||s.miss("none"),Promise.resolve().then((()=>r.removeListener(o))))}};r.addListener(o),e=!1}return{index:0,dataset:{},..."resize"==t?{width:0,height:0}:{visible:!1,ratio:0}}},h=(t,e,s)=>[...n].filter((e=>e.k==t&&(void 0===s||e.s[t]===s))).forEach(e),d=(t,e,n="local")=>{const s=r["session"==n?"session":"local"],a=s[t]??null;null==e?delete s[t]:s[t]="string"==typeof e?e:JSON.stringify(e),a!==(s[t]??null)&&h("storage",(e=>{if(("session"==e.s.area?"session":"local")==("session"==n?"session":"local"))try{e.c.send({key:t,value:i(e.s)})}catch(t){e.c.fail(o(t))}}),t)},f=t=>t({name:"NotAllowedError",message:"Clipboard permission denied"}),p={d:{intersection:c("intersection",u("intersection")),resize:c("resize",u("resize")),media:c("media",(t=>({matches:!!r.media[t.media],media:t.media}))),storage:c("storage",(t=>({key:t.storage,value:i(t)}))),visibility:c("visibility",(()=>({visible:r.visible}))),online:c("online",(()=>({online:r.online}))),geolocation:c("geolocation",((t,e)=>r.deny.has("geolocation")?void e.fail(l):r.pos&&a(r.pos)))},c:{copy:(t,e,n)=>r.deny.has("clipboard")?f(n):(r.clip=""+t.copy,e({text:r.clip})),paste:(t,e,n)=>r.deny.has("clipboard")?f(n):e({text:r.clip}),setItem:(t,e)=>{d(t.setItem,t.json?JSON.stringify(t.value):""+t.value,t.area),e({key:t.setItem})},removeItem:(t,e)=>{d(t.removeItem,null,t.area),e({key:t.removeItem})}}};return{src:p,runners:s,live:n,env:r,each:h,write:d,pos:a,DENIED:l}},Wu=/^(STATE|EFFECT|PARENT|READY|DOM|ELEMENT)$/,Uu=/^[A-Z][A-Z0-9_]*$/,Vu=2147483647,Hu=t=>"number"==typeof t&&Number.isFinite(t)&&t>=0&&t<=Vu,Ju=()=>setTimeout.clock,Ku=()=>{const t=Ju();return t?t.now:Date.now()};class Zu extends Promise{static get[Symbol.species](){return Promise}then(t,e){return this._seen?.(),super.then(t,e)}}const Xu=(t,e,n)=>{const s="string"==typeof e?e:void 0===e?"":JSON.stringify(e),r="string"==typeof e?"text/plain;charset=UTF-8":"application/json",o=t=>/^content-type$/i.test(t);return{ok:t>199&&t<300,status:t,statusText:"",url:n,redirected:!1,type:"basic",bodyUsed:!1,headers:"function"==typeof Headers?new Headers({"content-type":r}):{get:t=>o(t)?r:null,has:o},text:async()=>s,json:async()=>JSON.parse(s),clone:()=>Xu(t,e,n)}},Qu=(t,e)=>{if(t===e)return!0;if(!t||!e||"object"!=typeof t||"object"!=typeof e||Array.isArray(t)!=Array.isArray(e))return!1;const n=Object.keys(t),s=Object.keys(e);return n.length==s.length&&n.every((n=>Qu(t[n],e[n])))},th=t=>t&&t.readyState<2,eh=(t,e,n)=>(t?"e"+!(!n||!n.withCredentials):"s"+JSON.stringify(n))+e,nh=(t,e)=>class{constructor(n,s){this.readyState=0,this.sse=t,this.byApp=!1,this.ls={},this.url=String(n),this.k=eh(t,this.url,s),e(this)}send(){}close(){this.readyState<2&&(this.readyState=3,this.byApp=!0)}addEventListener(t,e){(this.ls[t]=this.ls[t]||[]).push(e)}},sh=t=>{let e;try{e="string"==typeof t?`'${t}'`:JSON.stringify(t)}catch(n){e=String(t)}return e&&e.length>80?e.slice(0,80)+"…":e},rh=(t,e)=>{const n=Ju();if(!n)return t;let s=!1;return t.then((()=>{s=!0}),(()=>{s=!0})),(async()=>{for(;!s&&!e()&&Ju()===n&&(n.countTimers()||(await n.nextAsync(),n.countTimers()));)await n.nextAsync();return t})()};function oh(t,e,n,s){const r=[{url:t,state:null}],o={},i={};let a=0;const l=()=>new URL(r[a].url),c=e?document:null,u={location:{get href(){return r[a].url},get pathname(){return l().pathname},get search(){return l().search},get hash(){return l().hash},get origin(){return l().origin}},history:{get state(){return r[a].state},get length(){return r.length},pushState(t,e,n){r.splice(a+1),r.push({url:new URL(n,r[a].url).href,state:t}),a++},replaceState(t,e,n){r[a]={url:n?new URL(n,r[a].url).href:r[a].url,state:t}},go(t){const e=a+t;t&&e>=0&&e<r.length&&setTimeout((()=>{var t;a=e,(o[t="popstate"]||[]).slice().forEach((e=>e({type:t})))}))},back(){this.go(-1)},forward(){this.go(1)}},addEventListener(t,e){(o[t]=o[t]||[]).push(e)},removeEventListener(t,e){o[t]=(o[t]||[]).filter((t=>t!==e))},document:{addEventListener(t,e){(i[t]=i[t]||[]).push(e),c?.addEventListener(t,e)},removeEventListener(t,e){i[t]=(i[t]||[]).filter((t=>t!==e)),c?.removeEventListener(t,e)},querySelector:t=>c?n(t):null,getElementById:t=>c?c.getElementById(t):null,get body(){return c?.body},get baseURI(){return r[a].url}},scrollX:0,scrollY:0,scrollTo(t,e){"object"==typeof t&&({left:t=u.scrollX,top:e=u.scrollY}=t),u.scrollX=t,u.scrollY=e},MutationObserver:e&&s?globalThis.MutationObserver:void 0};return{w:u,docLs:i,index:()=>a,size:()=>r.length}}let ih,ah;const lh=["play","pause","load","fastSeek","showPicker","requestSubmit","reset","checkValidity","reportValidity","setCustomValidity","setSelectionRange","setRangeText","stepUp","stepDown","requestFullscreen","scroll","scrollTo","scrollBy","animate","requestPointerLock"],ch=(t,e,n=("function"==typeof t&&"string"==typeof t.spec?t.spec:"div"))=>{if(Hc.includes(e)||lh.includes(e))return!0;if("undefined"==typeof document)return!1;try{return"function"==typeof document.createElement(n)[e]}catch(t){return!1}};let uh;function hh(t,e){return"function"==typeof e?(n,s,r,o)=>({type:t,data:e(n,s,r,o)}):()=>({type:t,data:e})}const dh=Fe;function fh(t,e){const n=(t,n)=>e.dispatchEvent(new CustomEvent("data",{detail:{type:t,data:n}}));t.addEventListener("statechange",(()=>{"installed"===t.state&&n("installed",!0),"activated"===t.state&&n("activated",!0)})),"installed"===t.state&&n("waiting",t),"activated"===t.state&&n("activated",!0)}let ph;const mh=dh.create({start(t){if("undefined"==typeof window)return void t.next(!0);t.next(navigator.onLine);const e=()=>t.next(!0),n=()=>t.next(!1);window.addEventListener("online",e),window.addEventListener("offline",n),ph=()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}},stop(){ph?.(),ph=void 0}});class gh{constructor(t,e){this.out=t,this.op=e}_n(t){this.out._n(t)}_e(t){this.out._e(t)}_c(){this.op.less()}}class yh{constructor(t){this.ins=t,this.type="flattenConcurrently",this.active=1,this.out=null}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this),this.active=1,this.out=null}less(){0==--this.active&&this.out&&this.out._c()}_n(t){this.out&&(this.active++,t._add(new gh(this.out,this)))}_e(t){this.out&&this.out._e(t)}_c(){this.less()}}class vh{constructor(t){this.ins=t,this.type="flattenSequentially",this.out=null,this.open=!0,this.active=null,this.activeIL=null,this.seq=[]}_start(t){this.out=t,this.open=!0,this.active=null,this.activeIL=new gh(t,this),this.seq=[],this.ins._add(this)}_stop(){this.ins._remove(this),this.active&&this.activeIL&&this.active._remove(this.activeIL),this.open=!0,this.active=null,this.activeIL=null,this.seq=[],this.out=null}less(){this.active=null,this.seq.length>0&&this._n(this.seq.shift()),this.open||this.active||this.out._c()}_n(t){this.out&&(this.active?this.seq.push(t):(this.active=t,t._add(this.activeIL)))}_e(t){this.out&&this.out._e(t)}_c(){this.out&&(this.open=!1,this.active||0!==this.seq.length||this.out._c())}}t.ABORT=n,t.Collection=mr,t.MainDOMSource=Vi,t.MockedDOMSource=za,t.Portal=zo,t.Slot=Jo,t.Suspense=Ho,t.Switchable=vo,t.Transition=Uo,t.VirtualCollection=po,t.checkForm=Il,t.classes=function(...t){return t.reduce(((t,e)=>{var n;return"string"!=typeof e||t.includes(e)?Array.isArray(e)?t.push(...(n=e,n.map(ol).flat())):"object"==typeof e&&t.push(...function(t){return Object.entries(t).filter((([t,e])=>"function"==typeof e?e():!!e)).map((([t,e])=>{const n=t.trim();if(!rl(n))throw new Error(`${n} is not a valid CSS class name`);return n}))}(e)):t.push(...ol(e)),t}),[]).join(" ")},t.clearDiagnostics=function(){gn=[]},t.clipboardSource=Ma,t.concat=function(...t){return new De(new qe(t))},t.controls=function(t){const e={};for(const n in t){const s=t[n],r=()=>{};r.__sygnalControl=(t,e,o)=>{const i="string"==typeof s?o(s,t,...e):s.vnode(t||{},e,o);globalThis.__SYGNAL_DIAGNOSTICS__?.control?.(r,i);const a=i.data||(i.data={});return a.attrs={...a.attrs,"data-control":n},void 0===i.key&&t&&(i.key=t.key),i},r.toString=()=>`[data-control="${n}"]`,r.kind="string"==typeof s?"element":s.kind,r.spec=s,e[n]=r}return e},t.createCommand=function(){const t={next:()=>{}},e={send:(n,s)=>{t.next({type:n,data:s}),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onCommandSent(n,s,e._targetComponentId,e._targetComponentName)},_stream:Fe.create({start(e){t.next=t=>e.next(t)},stop(){t.next=()=>{}}}),__sygnalCommand:!0};return e},t.createElement=Rr,t.createInstallPrompt=function(){let t=null;const e=new EventTarget;return"undefined"!=typeof window&&(window.addEventListener("beforeinstallprompt",(n=>{n.preventDefault(),t=n,e.dispatchEvent(new CustomEvent("data",{detail:{type:"beforeinstallprompt",data:!0}}))})),window.addEventListener("appinstalled",(()=>{t=null,e.dispatchEvent(new CustomEvent("data",{detail:{type:"appinstalled",data:!0}}))}))),{select(t){let n;return Qe(dh.create({start:s=>{n=({detail:e})=>{e.type===t&&s.next(e.data)},e.addEventListener("data",n)},stop:()=>{n&&e.removeEventListener("data",n)}}))},prompt:()=>t?.prompt()}},t.createRef=function(){return{current:null}},t.createRef$=function(){const t={next:()=>{}},e=Fe.createWithMemory({start(e){t.next=t=>e.next(t)},stop(){t.next=()=>{}}});return new Proxy({current:null,stream:e},{set:(e,n,s)=>"current"===n?(e.current=s,t.next(s),!0):(e[n]=s,!0)})},t.debounce=function(t){return function(e){return new De(new Be(t,e))}},t.defineBehavior=El,t.defineComponent=function(t){if(!t||"object"!=typeof t)throw new TypeError("defineComponent(opts): pass an options object, e.g. defineComponent({ view, model, initialState })");const{view:e,name:n,...s}=t;if("function"!=typeof e)throw new TypeError(`defineComponent(${n?`{ name: '${n}' }`:"opts"}): view must be a function (the view: ({ state, context, ...props }) => vnode)`);const r=t=>e(t);for(const t of Object.keys(e))r[t]=e[t];const o=n||e.componentName||(e.name&&"view"!=e.name?e.name:"Component");r.componentName=o;try{Object.defineProperty(r,"name",{value:o,configurable:!0})}catch(t){}for(const t of Object.keys(s))void 0!==s[t]&&(r[t]=s[t]);return Object.defineProperty(r,"__sygnalView",{value:e.__sygnalView||e,configurable:!0}),r},t.defineWidget=function(t){C.widget||(C.widget=gl);const e=C.portal;e&&!e.$w&&((C.portal=(t,n,s)=>e({...t,children:yl(t.children||[],n,s)},n,s)).$w=1);const n=()=>{},s={};for(const e in t.commands)s[e]=(n,s)=>n[il]&&t.commands[e](n[il].i,s||{},n);return Object.assign(n,{kind:"widget",def:t,$i:++cl,events:t.events||[],commands:s,vnode:n.__sygnalControl=(t,e,s)=>{const{key:r,ref:o,...i}=t||{};return{sel:"widget",data:{ww:n,wp:i,h:s,r:o},children:void 0,text:void 0,key:r}},$ssr:ml,toString:()=>(ll(143,n),":not(*)")})},t.delay=function(t){return function(e){return new De(new Ue(t,e))}},t.driverFromAsync=function(t,e={}){const{selector:n="category",args:s="value",return:r="value",pre:o=(t=>t),post:i=(t=>t)}=e,a=t.name||"[anonymous function]",l=typeof s;if(!("string"===l||"function"===l||Array.isArray(s)&&s.every((t=>"string"==typeof t))))throw new Error(`The 'args' option for driverFromAsync(${a}) must be a string, array of strings, or a function. Received ${l}`);if("string"!=typeof n)throw new Error(`The 'selector' option for driverFromAsync(${a}) must be a string. Received ${typeof n}`);return e=>{let l=null,c=!1,u=[];const h=()=>{const t=u;u=[],t.forEach((t=>l?.(t)))},d=Ye.create({start:t=>{l=t.next.bind(t),c||(c=!0,u.length>0&&queueMicrotask(h))},stop:()=>{l=null}}),f=new Set,p=(t,e)=>void 0===t||("function"==typeof t?t(e):e?.[n]===t),m=`Error in driver created using driverFromAsync(${a})`,g=t=>{let e=!1;f.forEach((n=>{let s=!1;try{s=p(n.selector,t)}catch(t){}s&&(e=!0,n.listener.next(t))})),e||console.error(`${m}: ${t.error}`)};let y=!1,v=[];const b=()=>{y=!0;const t=v;v=[],t.forEach(g)};let w=!1;const{replies:S,reply:_}=ei();return e.addListener({next:e=>{const h="object"==typeof e&&null!==e;if(h&&!ti(e,`driverFromAsync(${a})`))return;const d=h?Xo(e):void 0,f=void 0!==d&&e.ok,p=void 0!==d&&e.error,w=o(e);let S=[];if("object"==typeof w&&null!==w){if("function"==typeof s){const t=s(w);S=Array.isArray(t)?t:[t]}"string"==typeof s&&(S=[w[s]]),Array.isArray(s)&&(S=s.map((t=>w[t])))}t(...S).then((t=>{return null!=(n=t)&&"function"==typeof n.then?t.then((t=>i(t,e))):i(t,e);var n})).then((t=>f?t:(t=>{let s;if(void 0===r)s=t,"object"==typeof s&&null!==s?s[n]=e[n]:console.warn(`The 'return' option for driverFromAsync(${a}) was not set, but the promise returned an non-object. The result will be returned as-is, but the '${n}' property will not be set, so will not be filtered by the 'select' method of the driver.`);else{if("string"!=typeof r)throw new Error(`The 'return' option for driverFromAsync(${a}) must be a string. Received ${typeof r}`);s={[r]:t,[n]:e[n]}}return s})(t))).then((t=>{try{f?_(d,f,t):(t=>{if(!c||u.length>0)return u.push(t),void(u.length>100&&u.shift());l?.(t)})(t)}catch(t){console.error(`${m}: ${t}`)}}),(t=>{if(p)return _(d,p,{error:t,request:e});const s={error:t,[n]:e?.[n],request:e};if(y)return g(s);1===v.push(s)&&setTimeout(b),v.length>100&&v.shift()}))},error:t=>{console.error(`Error received from sink stream in driver created using driverFromAsync(${a}):`,t)},complete:()=>{w||console.warn(`Unexpected completion of sink stream to driver created using driverFromAsync(${a})`)}}),{dispose:()=>{w=!0},select:t=>((t,e)=>void 0===e?t:t.filter((t=>p(e,t))))(d,t),...S,errors:t=>{let e;return Ye.create({start:n=>{f.add(e={listener:n,selector:t}),y||queueMicrotask(b)},stop:()=>{f.delete(e)}})}}}},t.dropRepeats=Je,t.emit=function(t,e){return{EVENTS:hh(t,e)}},t.enableHMR=function(t,e,n,s){if(!t||"function"!=typeof t.hmr)return t;if(!e||"function"!=typeof e.accept)return t;let r=!1;const o=e=>{Promise.resolve((async e=>{if(r)return;r=!0;const s=Array.isArray(e)?e.find(Boolean):e;try{let e=sl(s);e||"function"!=typeof n||(e=sl(await n())),e&&t.hmr(e)}finally{r=!1}})(e)).catch((()=>{}))};return void 0!==s&&e.accept(s,o),e.accept(o),"function"==typeof e.dispose&&"function"==typeof t.dispose&&e.dispose((()=>t.dispose())),t},t.event=hh,t.exactState=function(){return t=>t},t.fieldName=$l,t.fieldNames=Ll,t.flattenConcurrently=function(t){return new De(new yh(t))},t.flattenSequentially=function(t){return new De(new vh(t))},t.focusInvalid=Gl,t.focusWithin=Ga,t.form=(t,e={})=>{(t=>!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t["~standard"]?.validate)(t)||Pl(231,t);const{values:s={},submit:r,check:o={},show:i="blur",http:a="HTTP",form:l="form",resetOnShow:c}=e,u="function"==typeof s,h=new Proxy((()=>h),{get:(t,e)=>e==Symbol.toPrimitive?()=>"":h}),d=t=>t===h?"":Array.isArray(t)?t.map(d):t&&"object"==typeof t?Object.fromEntries(Object.entries(t).map((([t,e])=>[t,d(e)]))):t;let f=s;if(u)try{f=d(s(h))}catch(t){f={}}const p=new WeakMap,m=Object.keys(o);let g=!0;const y=e=>{let n=p.get(e);return n||(p.set(e,n=Il(t,e)),n.then?.((t=>p.set(e,t)))),n},v=(t,e,n)=>{const s=e&&Cl(t.values,e);return e&&!s&&!n&&Pl(230,e,t.values),s},b=(t,e,n)=>{const s=y(e),r=!!s.then;return{s:{...t,...n,values:e,validating:r,...!r&&{errors:s.errors,validated:!0}},wait:r&&{values:e}}},w=(t,e)=>m.find((n=>{const s=jl(t.values,n);return!(e&&n!=e||t.errors[n]||""===s||null==s||n in t.pending||n in t.remote)})),S=(t,e,n,s)=>{const r=jl(t.values,e),i=o[e].request(r),a=`${n}.CHECKED_${e}`;return Pl(235,e,i),{s:{...t,queued:s,pending:{...t.pending,[e]:r}},req:{...i,ok:a,error:a,latest:!0}}},_=(t,e)=>{const n=[...Rl(t.errors),...Rl(t.remote)],s=w(t);return n.length?{s:{...t,queued:!1},focus:Gl(n,l)}:s?S(t,s,e,!0):Object.keys(t.pending).length?{s:{...t,queued:!0}}:{s:g?{...t,queued:!1,submitting:!0}:A({...t,queued:!1}),send:1}},E=t=>({initial:t,values:t,touched:{},server:{},remote:{},pending:{},submitting:!1,submitted:!1,submitCount:0,queued:!1,errors:{},validated:!1}),k=t=>b(E(t),t),A=t=>({...t,submitting:!1,submitted:!0,initial:t.values,server:{},touched:{}}),x={CHANGE:(t,e)=>v(t,e?.name)?b(t,Nl(t.values,e.name,((t,e)=>{if(!Array.isArray(t)||!("item"in e))return e.value;const n=t.filter((t=>t!==e.item));return e.value?[...n,e.item]:n})(jl(t.values,e.name),e)),{server:Yl(Yl(t.server,e.name),""),remote:Yl(t.remote,e.name),pending:Yl(t.pending,e.name),queued:!1,touched:"input"==i?{...t.touched,[e.name]:!0}:t.touched}):null,BLUR:(t,e,n)=>{if(!v(t,e,1))return null;const s="submit"==i||t.touched[e]?t.touched:{...t.touched,[e]:!0},r={...t,touched:s};return w(t,e)?S(r,e,n,t.queued):s!=t.touched?{s:r}:null},SUBMIT:(t,e,n)=>{if(t.submitting||t.queued)return void Pl(232,t);const s={...t,submitCount:t.submitCount+1},r=y(t.values);return r.then?{s:{...s,validating:!0,queued:!0},wait:{values:t.values,submit:1}}:_({...s,errors:r.errors},n)},RESULT:(t,e,n)=>{if(e.values!==t.values)return;const s={...t,errors:y(e.values).errors,validating:!1,validated:!0};return e.submit&&t.queued?_(s,n):{s:s}},ADD:(t,{field:e,value:n})=>{const s=jl(t.values,e)||[];return b(t,Nl(t.values,e,[...s,{id:s.reduce(((t,e)=>Math.max(t,+e.id||0)),0)+1,...n}]))},REMOVE:(t,{field:e,id:n})=>{const s=e+"."+n;return b(t,Nl(t.values,e,jl(t.values,e).filter((t=>t.id+""!=n))),{touched:Yl(t.touched,s),server:Yl(t.server,s)})},ERRORS:(t,e)=>{const n=Dl(e,t.values);return{s:{...t,server:n,submitting:!1,queued:!1},focus:Gl(n,l)}},DONE:t=>({s:A(t)}),RESET:(t,e)=>k(e&&"object"==typeof e?e:t.initial),VALIDATE:(t,e,n,r)=>c||u&&t.values===f?k(u?s(r):s):b({...t,submitting:!1,queued:!1,pending:{}},t.values)};for(const t of m)x["CHECKED_"+t]=(e,n,s)=>{if(!(t in e.pending))return;const r={...e,pending:Yl(e.pending,t),remote:{...e.remote,[t]:n?.error instanceof Error?"":o[t].error?.(n)||""}};return e.queued?_(r,s):{s:r}};const O={};for(const t in x){let e=[];const s=(n,s,r,o)=>o||e[0]!==n||e[1]!==s?(e=[n,s,x[t](n,s,r,o)])[2]:e[2];O[t]={..."VALIDATE"==t?{HOST:(t,e,n,r,o,i)=>{const a=s(t[i],e,i,t);return a?{...t,[i]:a.s}:t}}:{STATE:(t,e,r,o,i,a)=>s(t,e,a)?.s||n},EFFECT:(t,e,n,o,i,a)=>{const l=s(t,e,a),c=l?.wait;if(l?.send){const e=y(l.s.values).value;Pl(233,t.values,e),r in x&&Pl(234,r,a,T),n(r,e,0)}c&&Promise.resolve(y(c.values)).then((()=>n("RESULT",c,0)))},ELEMENT:(t,e,r,o,i,a)=>s(t,e,a)?.focus||n,...m.length&&{[a]:(t,e,r,o,i,a)=>s(t,e,a)?.req||n}}}const T=El({form:t,initialState:{...E(f),validating:!0},intent:({DOM:t})=>{const e=t.select(l);let n=0;return{VALIDATE:c?Fe.merge(Fe.of(0),e.elements().filter((t=>{const e=t.length&&!n;return n=t.length,e}))):Fe.of(0),CHANGE:e.events("input").filter((({target:t})=>"file"!=t.type)).map((({target:t})=>"checkbox"==t.type||/-/.test(t.tagName)&&"boolean"==typeof t.checked?{name:t.name,value:t.checked,item:t.value}:{name:t.name,value:"select-multiple"==t.type?[...t.selectedOptions].map((t=>t.value)):t.value})),BLUR:e.events("focusout").map((t=>t.target.name)),SUBMIT:e.events("submit",{preventDefault:!0})}},model:O,calculated:{fields:t=>{const e={};for(const n of Ll(t.values)){const s=jl(t.values,n),r=t.server[n]||t.remote[n]||(t.submitCount||"submit"!=i&&t.touched[n])&&t.errors[n]||"";e[n]={name:n,value:s,error:r,invalid:!!r,touched:!!t.touched[n],dirty:s!==jl(t.initial,n),pending:n in t.pending}}return e},valid:t=>t.validated&&!Rl(t.errors).length&&!Rl(t.remote).length,dirty:t=>JSON.stringify(t.values)!=JSON.stringify(t.initial),error:t=>t.server[""]||t.submitCount&&t.errors[""]||""}})({...e,values:f}),$=T.merge;return T.merge=(t,e)=>{const n=t.model?.[r];g=!!n&&"object"==typeof n&&a in n,$(t,e)},T},t.formErrors=(t,e)=>{const n=Il(t,e);return n.then?n.then((t=>t.errors)):n.errors},t.geolocationSource=La,t.getDevTools=function(){return globalThis.__SYGNAL_DEVTOOLS__},t.getDiagnostics=function(){return gn.slice()},t.getField=jl,t.h=d,t.hasField=Cl,t.intersectionSource=ka,t.isSelected=(t,e)=>!!t?.selected?.includes(String(e)),t.lazy=function(t,e){let n=null,s=null;const r=globalThis,o=e?.when,i=e?.placeholderHeight;let a,l;const c=()=>{l?.disconnect(),a?.(),a=0},u=t=>{if(a)if("idle"==o){const t=()=>c();r.requestIdleCallback?r.requestIdleCallback(t,{timeout:2e3}):setTimeout(t,1)}else r.IntersectionObserver?(l||(l=new r.IntersectionObserver((t=>t.some((t=>t.isIntersecting))&&c()),{rootMargin:e?.rootMargin}))).observe(t.elm):c()},h=o&&{insert:u,update:(t,e)=>"idle"!=o&&u(e),destroy:t=>l?.unobserve(t.elm)},d=null!=i&&{minHeight:"number"==typeof i?i+"px":i};function f(t){return s?{sel:"div",data:{attrs:{"data-sygnal-error":"lazy"}},children:[],text:void 0,elm:void 0,key:void 0}:n?n(t):{sel:"div",data:{attrs:{"data-sygnal-lazy":a?"deferred":"loading",...a&&{"data-sygnal-when":o}},...a&&{hook:h},...d&&{style:d}},children:[],text:void 0,elm:void 0,key:void 0}}const p=o&&new Promise((t=>a=t)),m=(p?p.then(t):t()).then((t=>{n=t.default||t,f.__sygnalLazyLoadedComponent=n;const e=["model","intent","context","initialState","calculated","isolatedState","onError","debug","componentName","connections","resources","route","head","uses","timers","persist","viewTransitions","browser"];for(const t of e)void 0!==n[t]&&void 0===f[t]&&(f[t]=n[t])})).catch((t=>{s=t,console.error("[lazy] Failed to load component:",t)}));return f.__sygnalLazy=!0,f.__sygnalLazyLoaded=()=>null!==n,f.__sygnalLazyLoadedComponent=null,f.__sygnalLazyPromise=m,f.__sygnalLazyStarted=p,f.__sygnalLazyReRenderScheduled=!1,f.load=()=>(c(),m),f},t.makeBrowserDriver=()=>Da(ka,Aa,xa,ja,Ca,Na,La,Ma),t.makeBrowserDriverWith=Da,t.makeDOMDriver=oa,t.makeDragDriver=function(){return function(t){const e=new Map,n=new EventTarget,s=[];let r=null;const o=t=>{if(!t?.category)return;const n=e.get(t.category)??{};e.set(t.category,{...n,...t})};t.subscribe({next(t){(t?.configs??(Array.isArray(t)?t:[t])).forEach(o)},error(){},complete(){}});const i=(t,e)=>n.dispatchEvent(new CustomEvent(t,{detail:e})),a=(t,e)=>{document.addEventListener(t,e),s.push([t,e])};a("dragstart",(t=>{const n=t;for(const[t,s]of e){if(!s.draggable)continue;const e=n.target.closest(s.draggable);if(e){if(r=t,n.dataTransfer.effectAllowed="move",s.dragImage){const t=e.closest(s.dragImage);if(t){const e=t.getBoundingClientRect();n.dataTransfer.setDragImage(t,n.clientX-e.left,n.clientY-e.top)}}return void i(`${t}:dragstart`,{element:e,dataset:{...e.dataset}})}}})),a("dragend",(()=>{r&&(i(`${r}:dragend`,null),r=null)})),a("dragover",(t=>{const n=t;for(const[,t]of e)if(t.dropZone&&(!r||!t.accepts||t.accepts===r)&&n.target.closest(t.dropZone))return void n.preventDefault()})),a("drop",(t=>{const n=t;for(const[t,s]of e){if(!s.dropZone)continue;if(r&&s.accepts&&s.accepts!==r)continue;const o=n.target.closest(s.dropZone);if(!o)continue;n.preventDefault();let a=null;const l=r?e.get(r):null;return l?.draggable&&(a=n.target.closest(l.draggable)??null),void i(`${t}:drop`,{dropZone:o,insertBefore:a})}}));const l={select:t=>({events(e){const s=`${t}:${e}`;let r;return Pa(Ye.create({start(t){r=({detail:e})=>t.next(e),n.addEventListener(s,r)},stop(){r&&n.removeEventListener(s,r)}}))}}),dragstart:t=>l.select(t).events("dragstart"),dragend:t=>l.select(t).events("dragend"),drop:t=>l.select(t).events("drop"),dragover:t=>l.select(t).events("dragover"),dispose(){s.forEach((([t,e])=>document.removeEventListener(t,e)))}};return l}},t.makeFetchDriver=Si,t.makeHeadDriver=function(t={}){return e=>{const n=t.document||("undefined"!=typeof document?document:null),s=new Map,r=new Map,o=new Map,i=n?.title;n?.querySelectorAll("[data-sygnal-head]").forEach((t=>r.set(t.getAttribute("data-sygnal-head"),t)));const a=(t,e)=>{for(const n in e)"key"!=n&&(null==e[n]||!1===e[n]?t.removeAttribute(n):t.setAttribute(n,e[n]))},l=()=>{if(!n)return;const e=ca([...s.values()],t.titleTemplate),l=new Set;n.title=e.title??i;const c=(t,e,s,i)=>{l.add(t);let c=r.get(t);c||(c=i&&n.head.querySelector(i),c?o.set(c,c.getAttribute("content")):((c=n.createElement(e)).setAttribute("data-sygnal-head",t),n.head.appendChild(c)),r.set(t,c)),a(c,s)};for(const[t,n,s]of e.meta)c(t,"meta",{[la(n)]:n,content:s},`meta[${la(n)}="${n}"]`);for(const[t,n]of e.link)c(t,"link",n);r.forEach(((t,e)=>{l.has(e)||(r.delete(e),o.has(t)?(a(t,{content:o.get(t)}),o.delete(t)):t.remove())}))},{replies:c}=ei((t=>{s.delete(t)&&l()}));e.addListener({next:t=>{if(!t||"object"!=typeof t)return;const e=Xo(t),n="head"in t?t.head:t;n&&"object"==typeof n?s.set(e,n):s.delete(e),l()},error:t=>console.error("[Sygnal] head",t)});return{...c,__sygnalStatic:"head",dispose:()=>{s.clear(),l()}}}},t.makeRouter=Mi,t.makeRouterDriver=t=>Mi(t).driver,t.makeServiceWorkerDriver=function(t,e={}){return function(n){const s=new EventTarget;return"undefined"!=typeof navigator&&"serviceWorker"in navigator&&(navigator.serviceWorker.register(t,{scope:e.scope}).then((t=>{const e=(t,e)=>s.dispatchEvent(new CustomEvent("data",{detail:{type:t,data:e}}));t.installing&&fh(t.installing,s),t.waiting&&e("waiting",t.waiting),t.active&&e("activated",!0),t.addEventListener("updatefound",(()=>{t.installing&&fh(t.installing,s)})),navigator.serviceWorker.addEventListener("controllerchange",(()=>{e("controlling",!0)})),navigator.serviceWorker.addEventListener("message",(t=>{e("message",t.data)}))})).catch((t=>{s.dispatchEvent(new CustomEvent("data",{detail:{type:"error",data:t}}))})),n.addListener({next:t=>{"skipWaiting"===t.action?navigator.serviceWorker.ready.then((t=>{t.waiting&&t.waiting.postMessage({type:"SKIP_WAITING"})})):"postMessage"===t.action?navigator.serviceWorker.ready.then((e=>{e.active&&e.active.postMessage(t.data)})):"unregister"===t.action&&navigator.serviceWorker.ready.then((t=>t.unregister()))},error:t=>console.error("[SW driver] Error in sink stream:",t)})),{select(t){let e;return Qe(dh.create({start:n=>{e=({detail:e})=>{t&&e.type!==t||n.next(e.data)},s.addEventListener("data",e)},stop:()=>{e&&s.removeEventListener("data",e)}}))}}}},t.makeSocketDriver=xi,t.makeTimerDriver=()=>pa(new Map),t.makeViewTransitionDOMDriver=function(t="#root",e={}){const n=oa(t,e);return(t,e)=>{let s;s=n(function(t,e){const n=globalThis,s=Ye.create();let r=0,o=1;return Ye.merge(t.filter((t=>{const i=e()||{},a=n.document,l=i.vt&&!o;if(i.vt=o=0,r)return r[0]=t,!1;if(!l||!a?.startViewTransition||n.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return!0;r=[t];const c=()=>{const t=r;r=0,s.shamefullySendNext(t[0])};try{a.startViewTransition(c)?.ready?.catch(Object)}catch(t){c()}return!1})),s)}(t,(()=>s?._isolateModule)),e);const r=s._isolateModule;r.vtDriver=1;let o,i=0;const a=t=>o=setTimeout((()=>Date.now()-t>30?a(Date.now()+100):i=0),100);return Object.defineProperty(r,"vt",{configurable:!0,get:()=>i,set:t=>{clearTimeout(o),(i=t?1:0)&&a(Date.now()+100)}}),s}},t.mediaSource=xa,t.mockDOMSource=Ba,t.onDiagnostic=On,t.onlineSource=Na,t.onlineStatus$=mh,t.pager=xl,t.persist=t=>({options:t,setup:e=>hc(e,t)}),t.portal=zo,t.processDrag=function({draggable:t,dropZone:e}={},n={}){if(t&&"function"!=typeof t.events)throw new Error("processDrag: draggable must have an .events() method (e.g. DOM.select(...))");if(e&&"function"!=typeof e.events)throw new Error("processDrag: dropZone must have an .events() method (e.g. DOM.select(...))");const{effectAllowed:s="move"}=n;return{dragStart$:t?t.events("dragstart").map((t=>(t.dataTransfer.effectAllowed=s,t))):Ye.never(),dragEnd$:t?t.events("dragend").mapTo(null):Ye.never(),dragOver$:e?e.events("dragover").map((t=>(t.preventDefault(),null))):Ye.never(),drop$:e?e.events("drop").map((t=>(t.preventDefault(),t))):Ye.never()}},t.processForm=function(t,e={}){if(!t||"function"!=typeof t.events)throw new Error("processForm: first argument must have an .events() method (e.g. DOM.select(...))");let{events:n=["input","submit"],preventDefault:s=!0}=e;"string"==typeof n&&(n=[n]);const r=n.map((e=>t.events(e)));return Ye.merge(...r).map((t=>{s&&t.preventDefault();const e="submit"===t.type?t.srcElement:t.currentTarget,n=new FormData(e),r={event:t,eventType:t.type},o=e.querySelector("input[type=submit]:focus");if(o){const{name:t,value:e}=o;r[t||"submit"]=e}for(const[t,e]of n.entries())r[t]=e;return r}))},t.queryCache=function(t={}){const e=new Map,n=()=>Date.now(),s=n=>{clearTimeout(n.g);const s=t.gcTime??3e5;s<1/0&&(n.g=setTimeout((()=>n.n||e.delete(n.k)),s)).unref?.()},r=(t,n)=>{let s=e.get(t);return s||e.set(t,s={k:t,q:n,n:0}),s},o=(t,e)=>{"string"==typeof t&&(t={url:t});const{method:n,json:s,body:r,parse:o,query:i}=t,a=(n||(void 0!==s||void 0!==r?"POST":"GET")).toUpperCase(),l=void 0!==s?JSON.stringify(s):r??"";if(!1!==t.cache&&"string"==typeof l&&"function"!=typeof o&&"response"!=o&&(t.cache||null!=t.staleTime||e&&_i.test(a)))return[a,fi(t.url??"",i,1),l,o].join(" ").trim()},i=(s,r)=>{const o=e.get(s);return o?.at>0&&!o.s&&n()-o.at<(r?.staleTime??t.staleTime??0)},a=(t,e,o,i=n())=>{const a=r(t,e);a.v=o,a.at=i,a.s=0,a.q=e,a.n||s(a)},l={key:o,fresh:i,put:a,get:t=>e.get(t),f:new Map,use:(t,n)=>{if(t.k===n)return;const o=e.get(t.k);if(o&&! --o.n&&s(o),void 0!==(t.k=n)){const e=r(n,t.q);e.n++,clearTimeout(e.g)}},inval:(t,n)=>{let s=0;return e.forEach((e=>{bi(t,e.q)&&(s++,n||(e.s=1))})),s},on:(e,n)=>(e||ri)((e=>{!1===t["focus"==e?"refetchOnFocus":"refetchOnReconnect"]||n()})),list:()=>[...e.values()].map((t=>({key:t.k,age:t.at&&n()-t.at,stale:!i(t.k,t.q),subscribers:t.n,data:t.v,tags:t.q?.tags}))),dehydrate:()=>[...e.values()].filter((t=>t.at>0)).map((t=>({key:t.k,data:t.v,updatedAt:t.at,tags:t.q?.tags}))),hydrate:t=>t?.forEach?.((t=>{e.get(t.key)?.at>=t.updatedAt||a(t.key,{url:t.key.split(" ")[1],tags:t.tags},t.data,t.updatedAt)})),set:(t,e)=>{const n=o(t,1);void 0!==n&&a(n,"string"==typeof t?{url:t}:t,e)},prefetch:t=>l.d?.({prefetch:t})};return l.hydrate(t.initial),l},t.renderComponent=function(t,e={}){const{initialState:n,mockConfig:o={},drivers:i={},diagnostics:a,strict:l,dom:c="mock",autoConnect:u=!0,socketSink:h="WS",resourceSink:d="HTTP",http:f,context:p}=e,{intent:m,model:g={}}=t,y="real"==c;if("mock"!=c&&!y)throw new Error(`[Sygnal] renderComponent: dom must be 'mock' (default) or 'real' (got ${String(c)})`);if(y&&("undefined"==typeof document||!document.body))throw new Error("[Sygnal] renderComponent(C, { dom: 'real' }) needs a DOM, and there is no document here. Run the test in a DOM environment: add the comment // @vitest-environment jsdom at the top of the test file, or set test.environment: 'jsdom' (or 'happy-dom') in the Vitest config (npm i -D jsdom)");if(y&&e.mockConfig)throw new Error("[Sygnal] renderComponent: mockConfig drives the mock DOM, so it can't be used with { dom: 'real' }. Use simulateEvent instead");const v={...Fu};for(const t of Object.keys(Fu)){const n=e[t];if(void 0!==n){if(!Hu(n))throw new Error(`[Sygnal] renderComponent: ${t} must be a finite number of ms between 0 and ${Vu} (got ${String(n)})`);v[t]=n}}const{eventWaitMs:b,settleMs:w,timeoutMs:S}=v;if(w>S)throw new Error(`[Sygnal] renderComponent: settleMs (${w}) is longer than timeoutMs (${S}), so settle() would always time out. Lower settleMs or raise timeoutMs`);const _=(t,e)=>{if(!Hu(e))throw new Error(`[Sygnal] ${t}: the timeout must be a finite number of ms between 0 and ${Vu} (got ${String(e)})`)},{router:E,url:k,routerSink:A="ROUTER",headSink:x="HEAD",titleTemplate:O}=e,T=t.name||t.componentName||"TestComponent";if(!(void 0===E||E&&"object"==typeof E&&E.options&&"function"==typeof E.driver))throw new Error("[Sygnal] renderComponent: the router option takes the object makeRouter() returns (import { router } from './routes.js'), not "+("function"==typeof E?"router.driver":"a "+typeof E));const $=!!E&&!i[A];if(!E&&t.route&&!i[A])throw new Error(`[Sygnal] renderComponent(${T}, { router }): ${T} declares \`route\`, so the test needs the app's router: the object makeRouter() returns (import { router } from './routes.js'). renderComponent then runs its real driver over an in-memory history starting at the url option (default '/'). Or pass a ${A} driver in drivers`);if(void 0!==k&&!$)throw new Error(`[Sygnal] renderComponent: url is the router fake's start URL: pass the app's router too (renderComponent(${T}, { router, url }))`);const j=Sn(),C=globalThis.__SYGNAL_DIAGNOSTICS__;Yu++||(ih={mode:dn,ignore:[...mn]},ah=C.strict,C.resetOnce?.()),wn({mode:a||("off"==j?"collect":j)}),void 0!==l&&(C.strict=l),y&&!uh&&(uh=function(t){const e=[],n=(t,n,s)=>{t&&!(n in t)&&(t[n]=s,e.push([t,n]))},s=t.HTMLDialogElement?.prototype,r=t.HTMLElement?.prototype;n(s,"show",(function(){this.open=!0})),n(s,"showModal",(function(){this.open=!0})),n(s,"close",(function(e){this.open&&(void 0!==e&&(this.returnValue=String(e)),this.open=!1,this.dispatchEvent(new t.Event("close")))}));const o=new WeakSet,i=(e,n)=>{if(o.has(e)==n)return;const s=s=>{const r=new t.Event(s,{cancelable:"beforetoggle"==s});return Object.defineProperties(r,{oldState:{value:n?"closed":"open"},newState:{value:n?"open":"closed"}}),e.dispatchEvent(r)};!s("beforetoggle")&&n||(n?o.add(e):o.delete(e),s("toggle"))};n(r,"showPopover",(function(){i(this,!0)})),n(r,"hidePopover",(function(){i(this,!1)})),n(r,"togglePopover",(function(t){const e=t&&"object"==typeof t?t.force:t;return i(this,void 0===e?!o.has(this):!!e),o.has(this)})),n(t.Element?.prototype,"scrollIntoView",(function(){})),n(t.Element?.prototype,"scrollTo",(function(){}));const a=class{observe(){}unobserve(){}disconnect(){}},l=t=>{const e=String(t);let n="";for(let t=0;t<e.length;t++){const s=e.charCodeAt(t),r=e[t],o="\\"+s.toString(16)+" ";n+=s?s<32||127==s||s>47&&s<58&&(!t||1==t&&"-"==e[0])?o:t||"-"!=r||1!=e.length?s>127||/[\w-]/.test(r)?r:"\\"+r:"\\-":"�"}return n},c=(t,n,s)=>{if(t[n])return;const r=Object.getOwnPropertyDescriptor(t,n);r&&!r.configurable||(Object.defineProperty(t,n,{value:s,configurable:!0,writable:!0}),e.push([t,n,r]))};for(const e of new Set([t,globalThis]))c(e,"ResizeObserver",a),e.CSS?c(e.CSS,"escape",l):c(e,"CSS",{escape:l});return()=>e.forEach((([t,e,n])=>{delete t[e],n&&Object.defineProperty(t,e,n)}))}(document.defaultView||globalThis));const N=!C.elementCommand;N&&(C.elementCommand=su);const L=[],M=On((t=>L.push(t))),I=t.name||t.componentName||"TestComponent",D=new Map,G=new Map;let P=!1;const R=new Map([["",I]]),Y=new Map,F={},q=new Set,z=t=>{const e=t&&t.sources&&t.sources[t.DOMSourceName||"DOM"];return e&&e._hub===pt.$&&(e._path||[]).filter(iu).pop()};let B=0,W=Ku();const U=()=>{B++,W=Ku()};let V=0;const H=[],J=new Map,K=Ku(),Z=[],X=new WeakMap,Q=new WeakMap,tt=new WeakMap;let et=[];const nt={action(t){const e={type:t.type,data:t.data,component:t.component,instance:t.instance,sinks:t.sinks,cause:t.cause,at:t.time-K};X.set(t,e),Z.push(e)},sink(t,e,n){const s=X.get(t);s&&"STATE"==e&&("function"==typeof n&&Q.set(s,n),et.push(s))}},st=[],rt=new Set,ot=(t,e,n="ww")=>{if("function"==typeof t&&!t.__sygnalControl)return;const s=bu(cu(String(au(t)??""))),r=z(e)||void 0,o=s&&Ve&&Au(Ve,s,[],[]).find((t=>{let e;for(const n of t)e=Iu(n)||e;return e==r}));return o&&o[o.length-1]?.data?.[n]},it=(t,e)=>{if("object"!=typeof e||Array.isArray(e))return;const n=Object.keys(e)[0],s=e[n];if(void 0===n)return;const r=s?.spec?.commands?void 0:ot(s,t),o=n.startsWith("scrollTo")&&((t,e)=>ot(t,e,"vc"))(s,t)?.commands[n];if(!(o||(r?r.commands[n]||ch(0,n,r.def.tag||"div"):s?.spec?.commands?.[n]||ch(s,n,s?.spec?.def?.tag))))return su(t,e,r?{tagName:r.def.tag||"div",__sw:{w:r}}:{});const i=s?.within,a=i??(null==s?"":String(s)),l=setTimeout((()=>{if(rt.delete(l),P||a&&!bu(a))return;const n=a&&Ve&&ut(a,z(t)||void 0);n&&(n.own||null!=i&&n.child)||su(t,e)}),1e3);rt.add(l)},at=(t,e,n,s,r)=>{try{xn(t,{component:e,message:n,fix:s,data:r})}catch(t){setTimeout((()=>{throw t}))}};let lt,ct=!1;const ut=(t,e,n)=>{let s,r=!1,o=!n;const i=bu(Array.isArray(t)?t.join(" "):t);if(!i||!i.length)return{own:r,child:s,hit:!1};const a=(t,e)=>Eu(i,e),l=(t,i,c,u,h)=>{if(!t||r)return;if(!t.sel){if(t.children)for(const e of t.children)l(e,i,c,u,h);return}const d=Iu(t)||c,f=i.concat([[t,d]]);(u=u||d==e)&&(d==e?a(0,f.filter((t=>t[1]==e)).map((t=>t[0])))&&(r=!0):(h=h||d,a(0,f.map((t=>t[0])))&&(s=s||h,t===n&&(o=!0))));for(const n of[].concat(t.children||[]))l(n,f,d,u,d==e?void 0:h)};return l(Ve,[],void 0,!e,void 0),{own:r,child:s,hit:o}},ht=t=>{y&&C.__uninstallChecks||Ve&&_n()&&(t||Ve!==lt||ct)&&(t||(lt=Ve,ct=!1),D.forEach((e=>{const n=lu(e),s=e.filter(iu).pop(),r=R.get(s||"")||"Component",o=r+"\0"+n;if(!n||uu.test(n)||q.has(o))return;const{own:i,child:a,hit:l}=ut(n,s,t);if(i)return q.add(o);if(!a||!l)return;q.add(o);const c=R.get(a)||"a child component",u=/^\[data-control="([^"]+)"\]$/.exec(n)?.[1];at("SYG104",r,`${u?`The control ${u}`:`DOM.select('${n}')`} in ${r} matches elements inside ${c} (isolated), so ${r} never receives their events`,`Handle the event in ${c}${u?` (DOM.<event>(${u}) in its intent)`:""} and send it up with PARENT (read it here with CHILD.select(${c})), or use EVENTS`,u?{selector:n,child:c,control:u}:{selector:n,child:c})})))},dt=()=>{M(),N&&C.elementCommand===su&&(C.elementCommand=void 0),--Yu||(wn(ih),C.strict=ah,uh?.(),uh=void 0)},ft=()=>{},pt=(()=>{const t={emit:ft,$:null};return t.$=Fe.create({start:e=>{t.emit=t=>e.next(t)},stop:()=>{t.emit=ft}}),t})(),mt=new Map,gt=new Set;let yt,vt;const bt=t=>{let e=mt.get(t);if(!e){const n=new Set,s=[],r=Fe.create(),o=wt(),i=Si({...f,_on:t=>(gt.add(t),()=>gt.delete(t)),_tap:(t,e,n)=>{vt=[t,e,n]},fetch:(e,n)=>new Promise(((r,o)=>{const[i,a,l]=vt||[{url:e}];vt=void 0;const c=void 0!==a?{...i,resource:a}:l?{...i,prefetch:!0}:void 0!==yt?yt:i;(void 0!==a||l)&&Tt(t).push(c);const u={value:c,req:i,category:i.category,res:a,pf:l,live:!0,settle:(t,e)=>{u.live=!1,(t?r:o)(e)}};s.push(u),n?.signal?.addEventListener?.("abort",(()=>{if(!u.live)return;u.live=!1;const t=new Error("The operation was aborted.");t.name="AbortError",o(t)}))}))})(r),a=e=>{const l=t=>s=>{let r;return Fe.create({start:o=>{n.add(r={l:o,sel:s,err:t,ns:e})},stop:()=>{n.delete(r)}})},c=e.reduce(((t,e)=>t.isolateSource(t,e)),i),u=e.reduce(((t,e)=>t.isolateSource(t,e)),o.src);return{select:t=>Fe.merge(c.select(t),l(!1)(t),u.select(t)),errors:t=>Fe.merge(c.errors(t),l(!0)(t)),subs:n,at:a,pending:s,in$:r,http:i,ws:o,__matches:i.__matches,__inspect:i.__inspect,isolateSource:(t,n)=>a(e.concat(n)),isolateSink:(t,e)=>t.map((t=>Ot(t,e))),...t==h?{__sygnalStatic:"connections"}:t==d?{__sygnalStatic:"resources"}:{},__sygnalReplies:!0,replies:t=>Fe.merge(i.replies(t),o.src.replies(t),Fe.create({start:ft,stop:()=>{o.conns.delete(t)}}))}};mt.set(t,e=a([]))}return e},wt=()=>{const t={src:null,in$:Fe.create(),conns:new Map,sockets:[],sent:[],declaring:null},e=e=>{t.sockets.push(e);const n=[...t.conns.values()].flatMap((t=>[...t.values()])).filter((t=>t.k==e.k));if(t.declaring){const n=t.declaring.find((t=>t.k==e.k&&!t.s));n&&[n,...n.own?[]:t.declaring.filter((t=>t.k==e.k&&!t.s&&!t.own))].forEach((t=>{t.s=e}))}else{const s=n.map((t=>t.s)).filter((t=>t&&!th(t))).sort(((e,n)=>t.sockets.indexOf(e)-t.sockets.indexOf(n)))[0];n.forEach((t=>{t.s===s&&(t.s=e)}))}u&&(e.auto=!0,setTimeout((()=>{0!==e.readyState||P||Et(e)})))};return t.src=xi({WebSocket:nh(!1,e),EventSource:nh(!0,e)})(t.in$),t},St=(t,e)=>{if("to"in e&&!("connections"in e))t.sent.push(e);else if(!("then"in e)&&!("catch"in e)){const n=Xo(e),s=e.connections||{},r=t.conns.get(n)||new Map,o=new Map,i=[];Object.keys(s).forEach((t=>{const a=s[t];if(!a||"object"!=typeof a||"string"!=typeof a.socket&&"string"!=typeof a.sse||"then"in a||"catch"in a)return;const l="string"==typeof a.sse,c=((t,e)=>{const n=globalThis.location;if(e||/^wss?:/i.test(t)||!n)return t;try{const e=new URL(t,n.href);return e.protocol="https:"==e.protocol?"wss:":"ws:",e.href}catch(e){return t}})(l?a.sse:a.socket,l),u=eh(l,c,l?a:a.protocols),h=!1===a.share,d=r.get(t);if(d&&d.k==u&&d.own==h)d.spec=a,o.set(t,d);else{const s={by:e.__emitterName??J.get(n),name:t,spec:a,sse:l,url:c,k:u,own:h};o.set(t,s),i.push(s)}})),t.conns.set(n,o),t.declaring=i;try{t.in$.shamefullySendNext(e)}finally{t.declaring=null}return void i.forEach((e=>{e.s||e.own||(e.s=t.sockets.filter((t=>t.k==e.k&&th(t))).pop())}))}t.in$.shamefullySendNext(e)},_t=(t,e,n)=>{try{t["on"+e]?.(n)}catch(t){console.error(t)}},Et=t=>{t.readyState=1,_t(t,"open",{type:"open"})},kt=t=>t.s&&0!=t.s.readyState?1==t.s.readyState?"open":"closed":"connecting",At=t=>({...t.spec,name:t.name,url:t.url,state:kt(t),sender:t.by}),xt="__sygnalString",Ot=(t,e)=>{if("string"!=typeof t&&(!t||"object"!=typeof t||Object.getPrototypeOf(t)!==Object.prototype&&null!==Object.getPrototypeOf(t)))return t;const n=ui(t,e),s="string"==typeof t?t:t[xt];return void 0!==s&&Object.defineProperty(n,xt,{value:s}),n},Tt=t=>$t[t]=$t[t]||[],$t={},jt=new Map;let Ct=-1,Nt=!1,Lt=0;const Mt=(t,e,n)=>{const s=e&&"object"==typeof e&&void 0!==e[xt]?e[xt]:e;if(e&&"object"==typeof e&&e.resources&&"object"==typeof e.resources){const n=jt.get(t)||new Set;Object.keys(e.resources).forEach((t=>n.add(t))),jt.set(t,n)}Oe(t).push(s);const r=!!e&&"object"==typeof e,o=!(r&&(e.abort||e.resources||e.refresh||"invalidate"in e||"prefetch"in e)),i="string"==typeof s?{url:s}:s;if(o&&Tt(t).push(i),!n)return;if(r&&(t=>!!t&&"object"==typeof t&&("connections"in t||"to"in t))(e))return St(bt(t).ws,e);const a=bt(t);yt=o?i:void 0;try{a.in$.shamefullySendNext(e)}finally{yt=vt=void 0}},It=Object.keys(g).filter((t=>"INITIALIZE"!=t)),Dt=t.uses||{};for(const t in Dt)for(const e in Dt[t]?.model||{})It.push(t+"."+e);const Gt=void 0!==n?fc(n):t.initialState,Pt=!m&&!Object.keys(g).length&&!It.length&&void 0===Gt;let Rt=!1;const Yt=(t,e,n)=>{const s=t.join("\0");if(void 0===n)D.has(s)||(D.set(s,t),ct=!0),(F[s]=F[s]||[]).push(e);else{const t=s+"\0"+e;G.set(t,(G.get(t)||0)+(n?1:-1)),n&&(Rt?Ne(0):queueMicrotask((()=>{Rt&&Ne(0)})))}};let Ft,qt=null;y&&(qt=document.createElement("div"),qt.className="sygnal-test",document.body.appendChild(qt),Ft=oa(qt));const zt=new WeakMap;let Bt,Wt,Ut,Vt=0;const Ht=[],Jt=t=>zt.get(t)??Ee.length,Kt=t=>{t&&"object"==typeof t&&zt.set(t,V||Ee.length)},Zt=()=>Ht.length?Math.min(...Ht)+1:1/0;let Xt=0;const Qt=t=>{const e=Xt;Ut?.next(t),(t?.elm||t&&Xt>e)&&(Vt=Math.max(Vt,Jt(t)),Bt=t)};let te;if($){const t=globalThis.location,n=t&&/^https?:$/.test(t.protocol)?t.origin:"http://localhost",s=oh(new URL(k??"/",n+"/").href,y,(t=>Yn(t)),!(!e.routerScroll&&!e.routerFocus)),r=E.options,o=Mi({...r,navigate:void 0,location:void 0,history:void 0,document:void 0,window:s.w,scroll:!!e.routerScroll,focus:!!e.routerFocus&&("string"==typeof e.routerFocus?e.routerFocus:r.focus)});te={mem:s,r:o,cmd$:Fe.create(),sent:[]}}const ee=i[x]?void 0:(()=>{const t=new Map,{replies:e}=ei((e=>{t.delete(e)}));return{entries:t,driver:n=>(n.addListener({next:e=>{if(!e||"object"!=typeof e)return;const n=Xo(e),s="head"in e?e.head:e;s&&"object"==typeof s?t.set(n,s):t.delete(n)},error:()=>{},complete:()=>{}}),{...e,__sygnalStatic:"head"})}})(),{timerSink:ne="TIMER"}=e,se=i[ne]?void 0:new Map,{browserSink:re="BROWSER"}=e,oe=i[re]?void 0:Bu(e.browser,y),ie=e.storage||{},ae=t.persist&&{local:zu(ie),session:zu(ie),f:new Set},le={DOM:y?(t,e)=>{const n=Ft((t=>{let e;return Fe.create({start(n){Ut=n,t.addListener(e={next:t=>{Kt(t),Jt(t)>Zt()&&Vt>=Zt()?Wt=t:(Wt=void 0,Qt(t))},error:t=>n.error(t),complete:()=>n.complete()})},stop(){t.removeListener(e),Ut=void 0}})})(t),e);return n._rootElement$.addListener({next:()=>Xt++}),Pu(n,[],pt.$,Yt)}:()=>Ba(o,pt.$,Yt),EVENTS:Wa,LOG:Ua,...ee&&{[x]:ee.driver},...se&&{[ne]:t=>pa(se)(t.filter((()=>!Object.keys(be||{}).some((t=>t!=ne&&"timers"==be[t]?.__sygnalStatic)))))},...oe&&{[re]:(t,e)=>Ia([oe.src],oe.runners)(t.filter((()=>!Object.keys(be||{}).some((t=>t!=re&&"browser"==be[t]?.__sygnalStatic)))),e)},...te&&{[A]:t=>{const e=te,n=t.map((t=>(!t||"object"!=typeof t||"route"in t&&1==Object.keys(t).length||e.sent.push(t),t)));return e.r.driver(Fe.merge(n,e.cmd$))}},...i,...e.onError&&{__e:()=>e.onError},...ae&&{__storage:()=>ae}},ce=new Set;for(const t in g){const e=g[t];for(const t of e&&"object"==typeof e?Object.keys(e):[])le[t]||/^(STATE|EFFECT|PARENT|READY|ELEMENT|PERSIST)$/.test(t)||(le[t]=()=>bt(t),ce.add(t))}for(const t of[h,d])le[t]||(le[t]=()=>bt(t),ce.add(t));let ue;const he=[],de=t=>Wu.test(t)||"PERSIST"==t,fe=new Map,pe=t=>{if(t.isRoot)return[];let e=fe.get(t.id);if(!e){const n=ue?.get(t.parentId);fe.set(t.id,e=(n?pe(n):[]).concat(t.id))}return e},me=t=>{const e=t.sources.DOM;return e&&e._hub===pt.$&&(e._path||[]).filter(iu).pop()},ge=t=>[...t.def.sinks].filter((t=>!(t in le)&&!de(t))),ye=new Map,ve=()=>{const t=function(t,e){const n=new WeakMap,o=new WeakMap;return{onCreate(n){const s=n.def;if(e&&!e(n)||void 0===s.initialState||!n.isRoot&&!s.isolated)return;const r={type:"INITIALIZE",data:s.initialState,component:n.name,instance:String(n.id),sinks:[],cause:"built-in",time:Uc()};o.set(n,r);try{t.action(r,n)}catch(t){}Vc(t,r,["STATE"],"STATE",void 0)},onAction(s,r){if(e&&!e(s))return;const i=String(r.type),a=s.def.behaviorActions,l=s.def.handlers.get(i)||[],c=l.map((t=>t[0])),u="INITIALIZE"==i&&o.get(s);if(u)return o.delete(s),void n.set(s,[u,c]);const h="simulateAction"==r.cause?r.cause:Wc.test(i)?"built-in":"next"==r.cause||"reply"==r.cause?r.cause:a&&Object.prototype.hasOwnProperty.call(a,i)?"behavior":"intent",d={type:i,data:r.data,component:s.name,instance:String(s.id),sinks:[],cause:h,time:Uc(),...void 0!==r.source&&{source:r.source}};n.set(s,[d,c]);try{t.action(d,s)}catch(t){}for(const[e,n]of l)"function"!=typeof n&&"EFFECT"!=e&&Vc(t,d,c,e,void 0)},wrapHandler(e,o,i,a){const l=n.get(e);if(!l||l[0].type!==o||"function"!=typeof a)return;const[c,u]=l,h="STATE"==i,d="EFFECT"==i;return function(e){const n=a.apply(this,arguments);return s(n)||!d&&"symbol"==typeof n||h&&n===e||Vc(t,c,u,i,a[r]||a),n}}}}(nt);return{...t,onCreate(e){t.onCreate(e),U();const n=me(e);n&&R.set(n,e.name),e.sources.DOM?._hub==pt.$&&Y.set(n||"",e.id),J.set(e.id,e.name),e.def.view?.route&&!(A in le)&&an(new Error(`[Sygnal] ${e.name} declares \`route\`, and nothing answers it: pass the app's router, renderComponent(${T}, { router }) (the object makeRouter() returns), or a ${A} driver in drivers`));const s=ge(e);if(s.length){const t=[];for(const n of s){const s=bt(n).at(pe(e)).replies(e.id),r={next:t=>t&&ue?.dispatch(e.id,t.type,t.data,"reply"),error:ft,complete:ft};s.addListener(r),t.push([s,r])}ye.set(e.id,t)}},wrapSources(t,e){const n=ge(t);if("function"!=typeof Proxy)return;let s;return new Proxy(e,{get:(e,r)=>"string"!=typeof r||r in e||!Uu.test(r)&&!n.includes(r)?e[r]:bt(r).at(s||(s=pe(t))),has:(t,e)=>e in t||"string"==typeof e&&n.includes(e)})},onRender(){U(),y&&(V=Ee.length)},onReducer(){U()},onNext(t,e,n,s){const r=Ku();H.length>50&&H.splice(0,H.length-50),H.push({type:e,delay:s,at:r,due:r+s,by:t.name})},onSink(t,e,n,s){U(),null===e||n in le||de(n)||(!s||"object"!=typeof s||Object.getPrototypeOf(s)!==Object.prototype&&null!==Object.getPrototypeOf(s)||(s=Object.defineProperties({...s},{__emitterId:{value:t.id,configurable:!0},__emitterName:{value:t.name,configurable:!0}})),Mt(n,pe(t).reduceRight(Ot,s),!0))},onDispose(t){fe.delete(t.id);const e=ye.get(t.id);e&&(ye.delete(t.id),e.forEach((([t,e])=>{try{t.removeListener(e)}catch(t){}})));const n=me(t);n&&(R.delete(n),Y.delete(n),D.forEach(((t,e)=>{t.filter(iu).pop()==n&&D.delete(e)})))},onElementCommand(t,e){U();const n={get name(){return t.name},get _disposed(){return t.disposed},get sources(){return t.sources},DOMSourceName:"DOM"};for(const t of[].concat(e))if(t){const e="object"==typeof t&&Object.keys(t)[0],s=e&&t[e];st.push(void 0!==s?.__sel?{...t,[e]:s.__sel}:t),C.__uninstallChecks||ou(n,t),y||it(n,t)}return!!y&&void 0}}};let be,we;try{m||he.push(...It);const n=Qa(t,le,{useDefaultDrivers:!1,onError:e.onError,__hooks:ve(),__override:{intent:m?t=>{const e=m(t);return e&&"object"==typeof e&&he.push(...It.filter((t=>!(t in e)))),e}:void 0,model:Pt?void 0:g,initialState:Gt,name:T,testActions:he,...p&&{context:{...Object.fromEntries(Object.keys(p).map((t=>[t,()=>p[t]]))),...t.context}}}});({sources:be,sinks:we}=n),ue=n.api}catch(t){throw dt(),qt?.remove(),t}Rt=!0;const Se=[],_e=(t,e)=>{const n={next:e,error:ft,complete:ft};t.addListener(n),Se.push([t,n])},Ee=[];let ke;const Ae=be.STATE?.stream||Fe.never();_e(Ae,(t=>{Ee.push(t),void 0===ke&&(ke=Ee.length-1,queueMicrotask((()=>{ke=void 0})));for(const e of et)tt.set(e,{s:t});et=[],U()}));const xe={},Oe=t=>xe[t]=xe[t]||[];for(const t in we)"DOM"!=t&&"STATE"!=t&&"function"==typeof we[t]?.addListener&&_e(we[t],(e=>Mt(t,"EVENTS"==t?{type:e.type,data:e.data}:"PARENT"==t?e.value:e,ce.has(t))));const Te=[];let $e,je=!1;const Ce=()=>{if(je&&!P)for(;Te.length;){const t=Te[0],e=Ku()-W;if(y){const n=Ku()-(t.at=t.at||Ku());if(e<10&&n<100)return Ne(10-e);if(!!Ve&&(Bt!==Ve||Vt<Ee.length)&&n<b||Wt)return Ne(1)}if(t.until=t.until||Ku()+(t.wait??b),!t.go(Ku()>=t.until))return Ne(5);Te.shift(),U()}},Ne=t=>{!$e&&Te.length&&($e=setTimeout((()=>{$e=0,Ce()}),t))};let Le,Me,Ie,De=!1,Ge=0,Pe=0,Re=!1,Ye=0;const qe=()=>{Ye&&(clearTimeout(Ye),Ye=0)},ze=t=>{qe(),Ye=setTimeout((()=>{Ye=0,t!=Pe||Re||(Me=void 0)}))},Be=new Promise((t=>{Le=()=>{clearTimeout(Qe),Ge=Ee.length,je=!0,Ce(),t()}})),We=new Set,Ue=(t,e)=>{const n=De&&void 0!==Me?Me:void 0;Me=Ie=void 0,Me=n??Ee.length,De||queueMicrotask((()=>{De=!1})),De=!0,Re=!1,ze(++Pe),Te.push({go:t,missing:e}),Ce()};let Ve,He,Je=0;const Ke=()=>He||(He=setTimeout((()=>Le()),12));we.DOM&&_e(we.DOM,(t=>{Ve=t,function(t){if(!t||"object"!=typeof t)return;const e=t=>{for(const n of[wu(t),wu({children:t.data?.portalChildren||[]})])for(const s of n)Su.set(s,{p:t,sibs:n}),e(s)},n=t.sel?[t]:wu(t);for(const t of n)Su.set(t,{p:void 0,sibs:n}),e(t)}(t),Je=Ee.length,y&&Kt(t),U(),ht(),Ke(),y?Ne(0):Ce()}));const Ze=Ku(),Xe=()=>{!He&&we.DOM&&Ee.length&&Ku()-Ze<S?Qe=setTimeout(Xe,10):Ke()};let Qe=setTimeout(Xe,we.DOM?30:0);const tn=t=>new Promise((e=>setTimeout(e,t))),en=async(t,e,n,s=(()=>!1))=>{const r=Ku();let o=-1;for(;!P;){const i=Ku()-W;if(Ku()-r>n)return!1;if((!we.DOM||Je>=t||Ku()-r>100)&&i>=e&&!s()){if(o===B)return!0;o=B,await tn(3)}else o=-1,await tn(Math.max(1,e-i))}return!0},nn=t=>en(t,10,250),sn=async()=>{const t=Ku();for(;!P&&Ve&&(Bt!==Ve||Wt)&&Ku()-t<=250;)await tn(1)};let rn;const on=new Set,an=t=>{if(!on.size)return void(rn=rn||t);const e=[...on];on.clear(),e.forEach((e=>e(t)))},ln=()=>{const t=rn;return rn=void 0,t},cn=()=>{const t=ln();if(t)throw t},un=(t,e,n)=>{const s=Hn();return new Error(`[Sygnal] simulateEvent('${t}', '${e}'): the selector matched nothing in the rendered output`+(n?` (waited ${b}ms for it to render; the eventWaitMs option sets this)`:"")+'. Check t.html() to see what rendered, or give the element an attribute and select it, e.g. [data-id="3"]'+` (pass { allowMissing: true } to drop the event instead).\nRendered: ${s.length>600?s.slice(0,600)+"…":s||"(nothing)"}`)},hn=()=>{const t=++Lt;Nt=!0,Promise.resolve().then(ft).then(ft).then(ft).then((()=>{t==Lt&&(Nt=!1)}))},fn=new Set,pn=["category","request","status","body","nth"],gn=(t,e)=>{const n=mt.get(t)?.pending||[],s=Tt(t).map((t=>n.find((e=>e.value===t))||{value:t,req:t,category:t?.category,res:t?.resource,live:!1,settle:ft})).filter(e.match),r=e.o.nth;return{list:s,hit:s[r<0?s.length+r:r]}},yn=(t,e,n,s,r,o)=>{if(cn(),i[e])throw new Error(`[Sygnal] t.${t}('${e}'): ${e} has a real driver (passed in drivers), so there is nothing to script. t.respond/t.fail answer the fake source renderComponent provides when no driver is passed`);const a=(t=>{const e=!!t&&"object"==typeof t&&!Array.isArray(t)&&Object.keys(t).every((t=>pn.includes(t))),n=e?t:{};if(e&&null===n.request)return{match:()=>!1,desc:"",push:!0,o:n};let s=e?n.request:t;e&&"string"==typeof s&&(s={url:s});const r="category"in n?t=>t.category===n.category:()=>!0;if("nth"in n&&!Number.isInteger(n.nth))throw new Error(`[Sygnal] t.respond/t.fail: nth must be an integer (a position in t.requests(name): 0 the first, -1 the newest; got ${sh(n.nth)})`);const o=("category"in n?` with category '${n.category}'`:"")+("nth"in n?` at nth: ${n.nth}`:"");if(void 0===s)return{match:r,desc:o,o:n};if("string"==typeof s)return{match:t=>{const e=t.value||{};return r(t)&&[e.ok,e.error,e.key,e.category,t.res,e.url].includes(s)},desc:` matching '${s}'${o}`,o:n};if("function"==typeof s)return{match:t=>{try{return r(t)&&!!s(t.value)}catch(t){return!1}},desc:` matching the predicate${o}`,o:n};if(s&&"object"==typeof s){const t=Object.keys(s);return{match:e=>r(e)&&!!e.value&&t.every((t=>Qu(s[t],e.value[t]))),exact:e?n.request:s,desc:` matching ${sh(s)}${o}`,o:n}}throw new Error(`[Sygnal] t.respond/t.fail: the target must be an action name, key, category, resource name or URL, a request object, a predicate or { request, category, status, body } options (got ${typeof s})`)})(s),l=`t.${t}('${e}'${"string"==typeof s?`, …, '${s}'`:""})`,c="string"==typeof s&&!!jt.get(e)?.has(s)&&Ee.length<=Ct||Nt&&!a.push&&!("nth"in a.o);return vn((()=>a.push?{}:((t,e)=>{if("nth"in e.o){const{hit:n}=gn(t,e);return n?.live?n:void 0}const n=(mt.get(t)?.pending||[]).filter((t=>t.live&&e.match(t)));return void 0!==e.exact&&n.filter((t=>t.value===e.exact||t.req===e.exact)).pop()||n.pop()})(e,a)),(t=>((t,e,n,s)=>{if("nth"in n.o){const{list:r,hit:o}=gn(e,n),i=Tt(e).length;return new Error(`[Sygnal] ${t}: `+(o?`t.requests('${e}')[${Tt(e).indexOf(o.value)}] (the one${n.desc}) is not pending: it was answered, aborted, or superseded by a later latest: true request or a refetch of its resource. That is what expect(() => t.respond(...)).toThrow() asserts.`:`no pending ${e} request${n.desc}${s?` after ${s}ms`:""}: t.requests('${e}') has ${r.length} request${1==r.length?"":"s"}${r.length<i?` matching (${i} in all)`:""}.`))}const r=Tt(e).length,o=mt.get(e)?.pending.filter((t=>t.live))||[];return new Error(`[Sygnal] ${t}: no pending ${e} request${n.desc}${s?` after ${s}ms`:""}. `+(o.length?`Pending: ${o.map((t=>sh(t.value))).join(", ")}. `:"")+(r?`The component sent ${r} (t.requests('${e}'))${o.length?"; the others were":","} all answered, aborted or superseded by a later latest: true request.`:`The component sent none: check the model entry that returns the ${e} request (t.requests('${e}') is empty).`)+(s?"":" t.respond/t.fail answer a request already sent, or one sent by the simulate* calls queued before them: wait for a later one first (await t.next(...) or t.settle())."))})(l,e,a,t)),(t=>{const s=bt(e),i=a.o,c=a.push?void 0:t,u="category"in i?i.category:c?.category;if(c&&(void 0!==c.res||c.pf||void 0!==Xo(c.req)&&(n?c.req.error:c.req.ok)))return r(c,i);const h=o(u,i,c);let d=!1;if(s.subs.forEach((t=>{let e=!1;try{e=t.err===n&&(!c||hi(t.ns,c.req))&&(void 0===t.sel||("function"==typeof t.sel?t.sel(h):t.sel===u))}catch(t){}e&&(d=!0,c||t.l.next(h))})),d)return c&&r(c,i);c&&(c.live=!1);const f=[...s.subs].filter((t=>t.err===n)).map((t=>`${e}.${n?"errors":"select"}(${void 0===t.sel?"":"function"==typeof t.sel?"fn":`'${t.sel}'`})`));return new Error(`[Sygnal] ${l}: nothing receives it: no intent listens to ${e}.${n?"errors":"select"}(${void 0===u?"":`'${u}'`})`+(f.length?` (listening: ${f.join(", ")})`:"")+". "+(n?`Name a reply action for the failure (error: 'FAILED' on the request), or handle it in the intent, e.g. FAILED: ${e}.errors('${u??"category"}'), so a failed request can't leave the component loading.`:`Name a reply action for the reply (ok: 'LOADED' on the request), or select it in the intent, e.g. LOADED: ${e}.select('${u??"category"}').`))}),c)},vn=(t,e,n,s=!1)=>{if(cn(),je&&!Te.length&&!P&&!s&&!t())throw e(0);let r,o,i=!1,a=!0;const l=new Promise(((t,e)=>{r=t,o=e}));l.catch(ft);const c=new Zu(((t,e)=>l.then(t,e)));Promise.prototype.then.call(c,void 0,ft),c._seen=()=>{i||(i=!0,a&&Ju()&&rh(l,(()=>P)).catch(ft))};const u=(t,e)=>{if(a){if(a=!1,fn.delete(u),!t)return r();i||e||an(t),o(t)}};fn.add(u);const h=Math.min(1e3,S/2),d={wait:h,go:s=>{const r=t();if(!r)return!!s&&(u(e(h)),!0);const o=n(r);return o?(u(o),!0):(nn(Ee.length).then((()=>y?sn():void 0)).then((()=>u()),ft),!0)}};return Me=Ie=void 0,Te.push(d),Ce(),c},bn=t=>{if(!oe)throw new Error(`[Sygnal] t.browser.${t}(): ${re} has a real driver (passed in drivers); t.browser drives the fake renderComponent provides when no driver is passed`);return oe},En=(t,e,n,s,r)=>{const o=bn(t),i=()=>{const t=[...o.live].filter((t=>t.k==e&&(void 0===n||t.s[e]===n)));return void 0===s?t:t.slice(s,s+1)},a=`${e}${void 0===n?"":` ${"string"==typeof n?`'${n}'`:n}`}`;return vn((()=>i().length?i():void 0),(e=>new Error(`[Sygnal] t.browser.${t}(): nothing declares ${a}${void 0===s?"":` at ${s}`}${e?` (waited ${e}ms)`:""}. Declared: ${[...o.live].map((t=>`${t.k} ${JSON.stringify(t.s[t.k])}`)).join(", ")||"none"}`)),(t=>{t.forEach(r)}))},kn=(t,e)=>{const n=bn(t);return vn((()=>!0),(()=>new Error("")),(()=>{e(n)}))},An={intersect:(t,e=!0,n={})=>{const{at:s,...r}=n;return En("intersect","intersection",t,s,(t=>t.c.send({visible:e,ratio:e?1:0,index:0,dataset:{},...r})))},resize:(t,e)=>{const{at:n,...s}=e||{};return En("resize","resize",t,n,(t=>t.c.send({width:0,height:0,index:0,dataset:{},...s})))},geolocation:t=>{const e=t&&"code"in t;return e||(bn("geolocation").env.pos=t),En("geolocation","geolocation",void 0,void 0,(n=>e?n.c.fail({code:t.code,message:t.message??""}):n.c.send(oe.pos(t))))},media:(t,e)=>kn("media",(n=>{n.env.media[t]=e,n.each("media",(n=>n.c.send({matches:e,media:t})),t)})),visibility:t=>kn("visibility",(e=>{e.env.visible=t,e.each("visibility",(e=>e.c.send({visible:t})))})),online:t=>kn("online",(e=>{e.env.online=t,e.each("online",(e=>e.c.send({online:t})))})),storage:function(t,e,n="local"){return arguments.length<2?bn("storage").env["session"==n?"session":"local"][t]??null:kn("storage",(s=>s.write(t,e,n)))},clipboard:function(t){return arguments.length?kn("clipboard",(e=>{e.env.clip=""+t})):bn("clipboard").env.clip},deny:(...t)=>{const e=bn("deny");t.forEach((t=>e.env.deny.add(t))),t.includes("geolocation")&&e.each("geolocation",(t=>t.c.fail(e.DENIED)))},active:()=>{const t=bn("active"),e=[];return t.runners.forEach((n=>{for(const s in n.on){const{s:r}=n.on[s];[...t.live].some((t=>t.s===r))&&e.push({name:s,...r,component:n.c})}})),e}},Tn=t=>t.value?.url??t.req.url??"",$n=(t,e)=>{const n=!(!t||"object"!=typeof t||t instanceof Error||"number"!=typeof t.status),s="number"==typeof t?t:n?t.status:e.status,r="string"==typeof t?new Error(t):t;return{status:s,x:r,resp:n,body:e.body??(r&&"object"==typeof r?r.body:void 0)}},jn=t=>[...mt.get(t)?.ws.conns.values()||[]].flatMap((t=>[...t.values()])),Cn=t=>jn(t).map(At),Nn=t=>Ue((()=>(gt.forEach((e=>e(t))),!0))),Ln=(t,e,n,s,r)=>{if(i[e])throw new Error(`[Sygnal] t.${t}('${e}'): ${e} has a real driver (passed in drivers), so there is nothing to script. t.${t} drives the fake socket source renderComponent provides when no driver is passed`);const[o,a]=(t=>{if(void 0===t)return[()=>!0,""];if("string"==typeof t)return[e=>e.name===t||e.url===t||(e.sse?e.spec.sse:e.spec.socket)===t,` matching '${t}'`];if("function"==typeof t)return[e=>{try{return!!t(At(e))}catch(t){return!1}}," matching the predicate"];if(t&&"object"==typeof t)return[e=>{const n=At(e);return Object.keys(t).every((e=>Qu(t[e],n[e])))},` matching ${sh(t)}`];throw new Error(`[Sygnal] the connection target must be a connection name or URL, a partial connection ({ socket: '/ws/a' }) or a predicate (got ${typeof t})`)})(n),l=s.length>1?"open or connecting":s[0]?"open":"connecting",c=()=>bt(e).ws;return vn((()=>{const t=new Set;jn(e).forEach((e=>{e.s&&s.includes(e.s.auto&&!e.s.readyState?1:e.s.readyState)&&o(e)&&t.add(e.s)}));const r=[...t];return r.length?void 0===n?[r.sort(((t,e)=>c().sockets.indexOf(t)-c().sockets.indexOf(e))).pop()]:r:void 0}),(n=>{const r=Cn(e);return new Error(`[Sygnal] t.${t}('${e}'${a?", …":""}): no ${l} ${e} connection${a}${n?` after ${n}ms`:""}. `+(r.length?`Connections: ${r.map((t=>`${t.name} (${t.socket??t.sse}, ${t.state})`)).join(", ")}.`:`None is declared: declare it with { connections: { room: { socket: '/ws/…' } } } on the ${e} sink first (t.connections('${e}') is empty).`)+(s.includes(1)&&r.some((t=>"connecting"==t.state))?` A connecting one (autoConnect: false) opens with t.open('${e}').`:"")+(!s.includes(1)&&u?" With autoConnect (the default) connections open by themselves: renderComponent(C, { autoConnect: false }) holds them for t.open.":"")+(n?"":" A call made while simulate* / t.* calls are still queued waits for them; otherwise the connection must be there at the call."))}),(t=>t.forEach((t=>{t.auto&&!t.readyState&&Et(t),r(t)}))))},Mn=t=>{if(te)return te;throw new Error(i[A]?`[Sygnal] t.${t}(): ${A} has a real driver (passed in drivers), so there is no in-memory history to drive. Drop it from drivers and pass the app's router: renderComponent(${T}, { router })`:`[Sygnal] t.${t}() needs the router fake: renderComponent(${T}, { router }), with the object makeRouter() returns (import { router } from './routes.js')`)},In=(t,e)=>{const n=Mn(t);return vn((()=>n.mem.index()+e>=0&&n.mem.index()+e<n.mem.size()),(s=>new Error(`[Sygnal] t.${t}(): no history entry to go ${e<0?"back":"forward"} to${s?` after ${s}ms`:""} (at ${n.mem.w.location.pathname}, entry ${n.mem.index()+1} of ${n.mem.size()}). Navigate first: await t.navigate('/…')`)),(()=>{n.mem.w.history.go(e)}))},Dn=(t,e)=>{const n=te?.mem.docLs.click;if(!n?.length)return;let s=t.length-1;for(;s>=0&&"a"!=String(t[s]?.sel||"").split(/[.#]/)[0].toLowerCase();)s--;if(s<0)return;const r=(t=>{const e=t.data||{},n={...e.attrs};for(const t in e.props||{})"className"!=t&&(n[t]=e.props[t]);for(const t in e.dataset||{})n["data-"+t.replace(/[A-Z]/g,(t=>"-"+t.toLowerCase()))]=e.dataset[t];const s=t=>null==n[t]||!1===n[t]?null:!0===n[t]?"":String(n[t]);return{localName:"a",getAttribute:s,hasAttribute:t=>null!=s(t),getAttributeNS:()=>null}})(t[s]),o={type:"click",button:0,metaKey:!1,ctrlKey:!1,shiftKey:!1,altKey:!1,...e,defaultPrevented:!!e.defaultPrevented,target:r,composedPath:()=>[r],preventDefault(){o.defaultPrevented=!0}};n.slice().forEach((t=>t(o)))},Gn=()=>{const t=[qt],e=n=>{if(!n||"object"!=typeof n)return;const s=n.data?._portalVnode?.elm;s&&!qt.contains(s)&&t.push(s);for(const t of[].concat(n.children||[],n.data?.portalChildren||[]))e(t)};return e(Ve),t},Pn=t=>{if(!je&&!(y?Bt:Ve))throw new Error(`[Sygnal] ${t} ran before the component's first render${y?" was in the DOM":""}. Wait for it first: await t.ready() (or await t.next(...))`)},Rn=t=>Au(Ve,vu(cu(t)),[],[]).map((t=>Nu(t,Vn))),Yn=t=>{for(const e of Gn()){const n=e.querySelector(t);if(n)return n}return null},Fn=t=>(t=au(t),Pn(`t.query('${t}')`),y?Yn(t):Rn(t)[0]??null),qn=(t,e,n={})=>{Ct=Ee.length,hn(),cn();const{allowMissing:s,within:r,...o}=n,i=String(au(t)),a=cu(i),l=!a||uu.test(a),c=null==r||l?"":cu(String(au(r))),u=c?`${i}' within '${c}`:i,h=l||y?[]:vu(a),d=c&&!y?vu(c):void 0;if(y&&!l)try{qt.querySelector(a),c&&qt.querySelector(c)}catch(t){throw new Error(`[Sygnal] simulateEvent('${u}', '${e}'): not a valid CSS selector`)}const f=()=>{if(!d)return ku(Ve,h);const t=ku(Ve,d);return t&&Au(t[t.length-1],h,t.slice(0,-1),[],!1)[0]},p=()=>"document"==a?document:"body"==a?document.body:a?c?Yn(c)?.querySelector(a):Yn(a.replace(uu,"")||a):qt.firstElementChild,m=()=>y?!!p():!!f();if(!l&&!s&&je&&!Te.length&&Ve&&Je>=Ee.length&&Ku()-W>=w&&!m())throw un(u,e,!1);Ue((t=>{const r=y?p():void 0,i=l?void 0:y?r&&(Du(Ve,r)||[]):f(),c=y?r:i?.[i.length-1];if(!l&&!c)return!!t&&(s?(at("SYG103",I,`simulateEvent('${u}', '${e}') matched no rendered element within ${b}ms, so the event was dropped`,"Check the selector against the view's className/id, or wait until the element is rendered (await t.next(...) or t.settle())",{selector:u,type:e}),!0):(an(un(u,e,!0)),!0));const h=t=>{let e=lu(t);if(!i)return e==a?0:void 0;let n=i;const s=uu.test(e);if(s)e=e.replace(uu,"");else{const e=t.filter(iu).pop();let s;n=i.filter((t=>{const n=Iu(t);return n&&(s=n),s==e}))}if(!e)return s||!n.length?-1:i.indexOf(n[0]);const r=bu(e);if(r)for(let t=n.length-1;t>=0;t--)if(Eu(r,n.slice(0,t+1)))return s?-1:i.indexOf(n[t])},d=t=>void 0!==h(t);if(!t)for(const[t,n]of D)if((F[t]||[]).includes(e)&&!G.get(t+"\0"+e)&&d(n))return!1;if(y)return i?.length&&ht(i[i.length-1]),function(t,e,n){const{target:s={},value:r,checked:o,dataset:i,data:a,key:l,...c}=n;"value"in n&&(t.value=r),"checked"in n&&(t.checked=o);for(const e in s)if("dataset"!=e)try{t[e]=s[e]}catch(t){}const u={...i,...a,...s.dataset};if(t.dataset)for(const e in u)t.dataset[e]=String(u[e]);const h=t.ownerDocument||t;if("focus"==e&&"function"==typeof t.focus&&(t.focus(),h.activeElement===t))return;if("blur"==e&&h.activeElement===t&&"function"==typeof t.blur)return t.blur();if("click"==e&&!Object.keys(c).length&&"function"==typeof t.click)return t.click();const d=h.defaultView||globalThis,f=new((/^key/.test(e)?d.KeyboardEvent:/^(focus|blur|focusin|focusout)$/.test(e)?d.FocusEvent:/^pointer/.test(e)?d.PointerEvent||d.MouseEvent:/click|^mouse|^contextmenu$/.test(e)?d.MouseEvent:/^(drag|drop)/.test(e)?d.DragEvent||d.MouseEvent:/^(before)?input$/.test(e)?d.InputEvent:d.Event)||d.Event)(e,{bubbles:!Ru.test(e),cancelable:!0,...void 0!==l&&{key:l},...c}),p={...c,...void 0!==l&&{key:l}};if(/^(drag|drop)/.test(e)&&!f.dataTransfer){const t={};p.dataTransfer={setData:(e,n)=>{t[e]=String(n)},getData:e=>t[e]??"",...c.dataTransfer}}for(const t in p)if(f[t]!==p[t])try{Object.defineProperty(f,t,{value:p[t]})}catch(t){}t.dispatchEvent(f)}(c,e,o),!0;c&&ht(c);const m=c?.data||{},g=m.props||{},{target:v={},value:w,checked:S,dataset:_,data:E,...k}=o,A=g.value??m.attrs?.value,x={tagName:c?.sel.split(/[.#]/)[0].toUpperCase(),...c&&{name:$u(c,"name")??"",id:$u(c,"id")??"",type:$u(c,"type")??"",getAttribute:t=>$u(c,t)},value:null==A?A:String(A),checked:g.checked??m.attrs?.checked,..."value"in n&&{value:w},..."checked"in n&&{checked:S},...v};if(x.dataset=hu({...m.dataset,..._,...E,...v.dataset}),i&&!("closest"in v)){const t=t=>{const n=i[t];return{tagName:n.sel.split(/[.#]/)[0].toUpperCase(),dataset:hu(n.data?.dataset),closest:e(t)}},e=e=>n=>{const s=vu(String(n));for(let n=e;n>=0;n--)if(Eu(s,i.slice(0,n+1)))return n==i.length-1?x:t(n);return null};x.closest=e(i.length-1)}const O=Ru.test(e),T={type:e,target:x,currentTarget:x,ownerTarget:x,dataTransfer:{},preventDefault:ft,stopPropagation:ft,bubbles:!O,...k};if(i)for(let t=i.length-1;t>=(O?i.length-1:-1);t--)pt.emit({type:e,event:T,match:e=>h(e)===t});else pt.emit({type:e,event:T,match:d});return"click"==e&&i&&Dn(i,T),!0}),l||s?void 0:()=>m()?void 0:un(u,e,!1))},zn=(t,e,n,s)=>new Promise(((r,o)=>{const i=ln();if(i)return o(i);let a=-1;const l=()=>{if(a>=0){const t=a;a=-1,setTimeout((()=>(t=>{const e=Ht.indexOf(t);if(!(e<0)&&(Ht.splice(e,1),Wt&&!P&&Jt(Wt)<=Zt())){const t=Wt;Wt=void 0,Qt(t),U()}})(t)))}},c=t=>{clearTimeout(m),Ae.removeListener(f),y?(Ht.push(a=Ee.length-1),(async t=>{const e=Ku();let n=-1;for(;!P&&Ku()-e<=250;){const s=Ku()-W,r=!Ve||Bt===Ve;if(Vt>=t&&(Wt||Ee.length>t))return;if((Vt>=t||Ku()-e>100)&&r&&s>=10){if(n===B)return;n=B,await tn(3)}else n=-1,await tn(Math.max(1,10-s))}})(a+1).then((()=>{on.delete(h),a>=0&&(Ie=a+1),r(Ee[t]),l()}))):nn(t+1).then((()=>{on.delete(h),P||(Ie=t+1),r(Ee[t])}))},u=t=>{try{return e(Ee[t])}catch(t){return!1}},h=t=>{clearTimeout(m),Ae.removeListener(f),on.delete(h),l(),o(t)};on.add(h);const d=Ee.length,f={next:()=>{Ee.length>d&&u(Ee.length-1)&&c(Ee.length-1)},error:t=>h(t),complete:()=>h(new Error(`${s}: state stream completed without matching`))},p=Ku(),m=setTimeout((()=>{let e=`${s} timed out after ${n}ms.`;const[r,o]=Bn(p);e+=r,o&&(e+=` Wait longer: t.${s}(pred, ms), or the renderComponent timeoutMs option (default for every wait).`);for(let n=t-1;n>=0;n--)if(u(n)){e+=` A state recorded before this next() call already matches the predicate (t.states[${n}]); next() only matches new states. Use t.waitForState(pred) to search the history too, or call next() before the input that causes the state.`;break}h(new Error(e))}),n);for(let e=t;e<Ee.length;e++)if(u(e))return c(e);Ae.addListener(f)})),Bn=t=>{const e=Ku(),n=new Map;for(const s of H){if(s.due<=e&&s.at<t)continue;const r=s.by+"\0"+s.type;n.set(r,{...s,n:(n.get(r)?.n||0)+1})}if(!n.size)return["",!1];let s=!1;const r=[...n.values()].map((t=>{const n=t.due-e;return n>0&&(s=!0),`next('${t.type}') scheduled by ${t.by} with a ${t.delay}ms delay`+(t.n>1?` (${t.n} times)`:"")+(n>0?` is still pending (fires in ${n}ms)`:"")}));return[` Model next() calls during the wait: ${r.join("; ")}.`,s]},Wn=t=>new Promise(((e,n)=>{Me=Ie=void 0;const s=ln();if(s)return n(s);let r;const o=t=>{clearTimeout(r),on.delete(o),t?n(t):e()};on.add(o);const i=Ku();(async()=>{await Promise.race([Be,new Promise((e=>{r=setTimeout(e,t)}))]),clearTimeout(r);if(!await en(Ee.length,w,t,(()=>!je||Te.length>0||y&&!!Ve&&(Bt!==Ve||!!Wt)))){const[e]=Bn(i);throw new Error(`settle timed out after ${t}ms: ${Te.length?`${Te.length} simulated input(s) still pending`:`the component kept rendering (it never was quiet for settleMs = ${w}ms)`}.`+e+(e?" A next() loop never goes quiet: wait for a specific state with t.next(pred) instead.":""))}})().then((()=>o()),o)})),Un=t=>t&&"object"==typeof t&&t.children?{...t,children:t.children.map(Un)}:t,Vn=t=>function(t){gc=!0;try{return Nc(t)}finally{gc=!1}}((()=>Un(t))).replace(/ class="([^"]*)"/g,((t,e)=>(e=e.split(" ").filter((t=>!t.startsWith("___"))).join(" "))?` class="${e}"`:"")),Hn=()=>Ve?Vn(Ve):"";return{state$:Ae,dom$:we.DOM||Fe.never(),events$:be.EVENTS||{select:()=>Fe.never()},sinks:we,sources:be,simulateAction:(t,e)=>{Ct=Ee.length,hn(),cn(),Ue((()=>(ue.dispatch("root",t,e,"simulateAction"),!0)))},simulateEvent:qn,ready:()=>{Me=je?Math.min(De&&void 0!==Me&&Me>=0?Me:Ee.length,ke??Ee.length):-1,De=!1,Ie=void 0;const t=++Pe;return Re=!1,Be.then((()=>{t!=Pe||Re||P||ze(t)})),rh(new Promise(((t,e)=>{We.add(e),(y?Be.then((()=>sn())):Be).then((()=>{We.delete(e),t()}))})),(()=>P))},waitForState:(t,e=S)=>(_("waitForState",e),Me=Ie=void 0,rh(zn(0,t,e,"waitForState"),(()=>P))),next:(t=(()=>!0),e=S)=>{if(_("next",e),void 0===Me&&void 0!==Ie)return rh(zn(Math.min(Ie,Ee.length),t,e,"next"),(()=>P));if(void 0===Me||Me<0&&!je)return rh(zn(void 0===Me&&void 0!==ke?ke:Ee.length,t,e,"next"),(()=>P));const n=Pe;Re=!0,qe();const s=zn(Me<0?Ge:Me,t,e,"next");return s.then((()=>{n==Pe&&(Me=void 0)}),ft),rh(s,(()=>P))},settle:t=>((t=S)=>(_("settle",t),rh(Wn(t),(()=>P))))(t).then((()=>{ae&&ae.f.forEach((t=>t()))})),states:Ee,actions:Z,explain:t=>{if("function"!=typeof t)throw new Error("[Sygnal] t.explain(predicate): pass a function of the state, e.g. t.explain(s => s.status === 'error')");for(const e of Z){const n=tt.get(e);let s=!1;if(n)try{s=!!t(n.s)}catch(t){}if(!s)continue;const r=Q.get(e);let o="";try{o=r?Function.prototype.toString.call(r):""}catch(t){}return{...e,sinks:[...e.sinks],state:n.s,...r&&{reducer:{action:e.type,sink:"STATE",fn:r,source:o.length>400?o.slice(0,400)+"…":o}}}}},get state(){return Ee[Ee.length-1]},sinkValues:Oe,requests:Tt,respond:(t,e,n)=>yn("respond",t,!1,n,((t,n)=>t.settle(!0,"function"==typeof Response&&e instanceof Response?e:Xu(n.status??200,e,Tn(t)))),((t,n,s)=>({category:t,value:e,status:n.status??200,request:s?.req}))),fail:(t,e,n)=>yn("fail",t,!0,n,((t,n)=>{const{status:s,x:r,body:o}=$n(e,n);void 0!==s?t.settle(!0,Xu(s,o,Tn(t))):t.settle(!1,r)}),((t,n,s)=>{const{status:r,x:o,resp:i,body:a}=$n(e,n);return{error:"number"==typeof e||i?Object.assign(new Error(`HTTP ${r}`),{status:r}):o,category:t,request:s?.req,status:r??o?.status,body:a}})),connections:Cn,cache:t=>bt(t).http.__inspect().cache||[],focus:()=>Nn("focus"),online:()=>Nn("online"),open:(t,e)=>Ln("open",t,e,[0],Et),push:(t,e,n)=>{const s=n&&"object"==typeof n&&!Array.isArray(n)&&Object.keys(n).length&&Object.keys(n).every((t=>"event"==t||"connection"==t))?n:{connection:n},r="string"==typeof e||e&&"object"==typeof e&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||"undefined"!=typeof Blob&&e instanceof Blob)?e:JSON.stringify(e),o=s.event;return Ln("push",t,s.connection,[1],(t=>{const e={type:o||"message",data:r};o&&"message"!=o||_t(t,"message",e),t.sse&&(t.ls[o||"message"]||[]).forEach((t=>{try{t(e)}catch(t){console.error(t)}}))}))},drop:(t,e,n)=>{const s=e&&"object"==typeof e&&!Array.isArray(e)&&Object.keys(e).every((t=>"code"==t||"reason"==t)),r=s||void 0===e?n:e,{code:o=1006,reason:i=""}=s?e:{};return Ln("drop",t,r,[0,1],(t=>{const e=0==t.readyState;if(t.sse)return t.readyState=2,_t(t,"error",{type:"error"});t.readyState=3,e&&_t(t,"error",{type:"error"}),_t(t,"close",{type:"close",code:o,reason:i,wasClean:!1})}))},sent:(t,e)=>te&&t==A?te.sent:((t,e)=>{const n=bt(t).ws.sent;return void 0===e?n:n.filter((t=>t.to===e))})(t,e),navigate:t=>{const e=Mn("navigate"),n=e.r.routes,s=e.mem.w.location;let r;if("string"==typeof t){const e=new URL(t,s.href);if(e.origin!=s.origin)throw new Error(`[Sygnal] t.navigate('${t}'): that URL is on another origin (${e.origin}, the test's is ${s.origin}); the router leaves external links to the browser. Navigate to a path: t.navigate('/tasks/2')`);r={url:e.pathname+e.search+e.hash}}else{if(!t||"object"!=typeof t||"string"!=typeof t.to)throw new Error(`[Sygnal] t.navigate(): pass a URL ('/tasks/2') or { to: 'task', params: { id: 2 }, query?, hash?, replace? } (got ${sh(t)})`);{const e=n[t.to];if(null==e||"*"==e)throw new Error(`[Sygnal] t.navigate({ to: '${t.to}' }): no route named '${t.to}'. Routes: ${Object.keys(n).filter((t=>"*"!=n[t])).join(", ")}`);const s=Ni(e).filter((e=>null==t.params?.[e]));if(s.length)throw new Error(`[Sygnal] t.navigate({ to: '${t.to}' }): route '${t.to}' (${e}) needs params: ${s.join(", ")}. t.navigate({ to: '${t.to}', params: { ${s.join(", ")} } })`);r={...t}}}return vn((()=>!0),(()=>new Error("")),(()=>{e.cmd$.shamefullySendNext(r)}))},back:()=>In("back",-1),forward:()=>In("forward",1),get location(){return(()=>{const t=Mn("location").mem.w.location;return{path:t.pathname,search:t.search,hash:t.hash,href:t.href}})()},head:()=>{if(!ee)throw new Error(`[Sygnal] t.head(): ${x} has a real driver (passed in drivers), so the fake that records the head isn't there. Read the document it writes, or drop it from drivers`);const t=ca([...ee.entries.values()],O);return{title:t.title,meta:Object.fromEntries(t.meta.map((([,t,e])=>[t,e]))),link:t.link.map((([,t])=>t))}},timers:()=>{if(!se)throw new Error(`[Sygnal] t.timers(): ${ne} has a real driver (passed in drivers); t.timers lists the timers of the fake renderComponent provides when no driver is passed`);const t=[];return se.forEach((e=>{for(const n in e.on){const{ok:s,d:r,s:o}=e.on[n];s&&!r&&t.push({name:n,...o,action:o.action??o.frame,component:e.c})}})),t},browser:An,storage:t=>ie[t],emitted:Oe("EVENTS"),diagnostics:L,commands:(t="ELEMENT")=>"ELEMENT"==t?st:Oe(t),expectNoDiagnostics:()=>{cn();const t=L.filter((t=>"info"!=t.severity));if(t.length)throw new Error(`Expected no diagnostics, got ${t.length}:\n`+t.map((t=>t.text)).join("\n"))},html:()=>(Pn("t.html()"),Hn()),dispose:()=>{if(P)return;P=!0,rt.forEach(clearTimeout),clearTimeout(He),clearTimeout(Qe),clearTimeout($e),qe();const t=Te[0];t&&t.until&&t.missing&&!rn&&(rn=t.missing()),Te.length=0,Se.forEach((([t,e])=>{try{t.removeListener(e)}catch(t){}}));try{we.__dispose?.()}catch(t){}const e=y?Gn():[];mt.forEach((t=>{t.ws.src.dispose(),t.ws.conns.clear(),t.http.dispose()})),e.forEach((t=>t.remove())),dt();const n=[...on,...We];on.clear(),We.clear();const s=new Error("[Sygnal] renderComponent was disposed while this wait was pending (t.ready/t.next/t.waitForState/t.settle). Await every wait before t.dispose()");n.forEach((t=>t(s)));const r=[...fn];fn.clear(),r.forEach((t=>t(new Error("[Sygnal] renderComponent was disposed before this t.respond/t.fail was delivered"),!0))),cn()},inspect:(t={})=>{if(!C.inspect)throw Error("[Sygnal] t.inspect() needs import 'sygnal/diagnostics'");return C.inspect({ids:[...Y.values()],diagnostics:L,mock:{listeners:D,evTypes:F,owners:R,scopeIds:Y,probe:ut,vtree:Ve},...void 0!==t.actions&&{actions:t.actions}})},container:qt,query:Fn,queryAll:t=>(t=au(t),Pn(`t.queryAll('${t}')`),y?Gn().flatMap((e=>Array.from(e.querySelectorAll(t)))):Rn(t)),widget:t=>{const e=String(au(t)),n=()=>{const t=Fn(e),n=y?t?.__sw:t?._v?.data?.ww&&{p:t._v.data.wp};if(!n)throw new Error(`[Sygnal] t.widget('${e}'): no ${t?`mounted widget is the matched <${t.localName}>`:"element matches it"}. Give the widget a className and pass its selector (t.widget('.due')), or pass its control`);return n},s=(e,n)=>qn(t,e,{detail:n});return{get props(){return n().p},get instance(){return n().i},dispatch:s,emit:s}}}},t.renderHead=function(t,e={}){const n=ca(t,e.titleTemplate),s=t=>Object.keys(t).filter((e=>"key"!=e&&null!=t[e]&&!1!==t[e])).map((e=>` ${e}="${aa(t[e])}"`)).join("");return(null!=n.title?`<title>${aa(n.title)}</title>`:"")+n.meta.map((([t,e,n])=>`<meta${s({[la(e)]:e,content:n})} data-sygnal-head="${aa(t)}">`)).join("")+n.link.map((([t,e])=>`<link${s(e)} data-sygnal-head="${aa(t)}">`)).join("")},t.renderToString=Nc,t.replyErrors=Dl,t.resizeSource=Aa,t.run=function t(e,n={},s={},r){const{diagnostics:o}=s,i="string"==typeof o?{mode:o}:o||{},{mode:a,strict:l}=i;!o&&el||wn({mode:a,ignore:i.ignore||[]});const c=globalThis.__SYGNAL_DIAGNOSTICS__,u=c.strict;void 0!==l&&(c.strict=l)&&(a||_n()||wn({mode:"warn"}),c.__uninstallChecks||tl||(tl=!0,Rn("SYG608","run","strict needs 'sygnal/diagnostics'")));const{uid:h}=s,d=Qa(e,n,{...s,__hooks:s.__hooks,__state:r?.s,__swap:!!r});el++;let f=!1;const p={sources:d.sources,sinks:d.sinks,dispose:()=>{f||(f=!0,el--,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS_APP__===p&&(window.__SYGNAL_DEVTOOLS_APP__=void 0),d.dispose(),void 0!==l&&(c.strict=u))}};p.__runtime=d.api,void 0!==h&&Object.defineProperty(p.sources,"__uid",{value:h.replace(/[^\w-]+/g,"_"),enumerable:!1,configurable:!0}),"undefined"!=typeof window&&(window.__SYGNAL_DEVTOOLS_APP__||(window.__SYGNAL_DEVTOOLS_APP__=p));let m=e;return p.hmr=(e,r)=>{const o=nl(e)||{default:m},i=void 0!==r?r:p.__runtime.getState();"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=i);const a="undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS_APP__===p;p.dispose(),m=o.default;const l=t(m,n,s,void 0===i?void 0:{u:!0,s:i});p.sources=l.sources,p.sinks=l.sinks,p.__runtime=l.__runtime,"undefined"==typeof window||window.__SYGNAL_DEVTOOLS_APP__!==l&&!a||(window.__SYGNAL_DEVTOOLS_APP__=p);const c=l.dispose;p.dispose=()=>{"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS_APP__===p&&(window.__SYGNAL_DEVTOOLS_APP__=void 0),c()}},p},t.sampleCombine=function(...t){return function(e){return new De(new Xe(e,t))}},t.selection=(t={})=>{const{multi:e=!1,attr:n="data-id",from:s,idField:r="id"}=t,o=El(zl(e,n,t.item))(t),i=o.merge;return o.merge=(t,e)=>{if(i(t,e),s)for(const n of["SELECT_ALL","TOGGLE_ALL"]){const o=t.model[e+"."+n],i=t.stateSourceName,a=o?.[i];a&&(t.model[e+"."+n]={...o,[i]:(t,e,...n)=>a(t,Array.isArray(e)?e:(t?.[s]||[]).map((t=>t?.[r])),...n)})}},o},t.set=function(t){return"function"==typeof t?(e,n,s,r)=>({...e,...t(e,n,s,r)}):e=>({...e,...t})},t.setField=Nl,t.sortable=(t={})=>{const{from:e,handle:r,axis:o="y",threshold:i=4,attr:a="data-id",idField:l="id"}=t,c=t.item||`[${a}]`,u=[].concat(e),h=r||c,d=t.label||(t=>Vl(t?.title??t?.name??t?.label??t?.[l])),f={...Xl,...t.messages},[p,m]="x"==o?["ArrowLeft","ArrowRight"]:["ArrowUp","ArrowDown"],g=t=>t?.getAttribute?.(a)??t?.dataset?.[a.slice(5).replace(/-(\w)/g,((t,e)=>e.toUpperCase()))]??null,y=(t,e)=>{for(const n of u){const s=t?.[n],r=null!=e&&Array.isArray(s)?s.findIndex((t=>Vl(t?.[l])===Vl(e))):-1;if(r>=0)return{list:n,index:r,item:s[r],size:s.length}}return null},v=(t,e,n,s)=>{const r={...t},o=[...t[e.list]];o.splice(e.index,1);const i=n==e.list?o:[...t[n]||[]];return i.splice(Math.max(0,Math.min(s,i.length)),0,e.item),r[e.list]=o,r[n]=i,r},b=(t,e,n)=>({...t,[e]:{...t[e],...n}}),w=t=>{const e={};for(const n of u)e[n]=t[n];return e},S=(t,e,n)=>{const s=b(t,e,n);return Zl.add(s[e]),s},_=(t,e,n)=>{const s=t[e],r=s.origin,o="keyboard"==s.mode&&Kl.get(r),i=o&&u.every((e=>t[e]===o.made[e])),a=i?{...t,...o.snap}:t,l=n&&"keyboard"==s.mode&&y(a,s.dragging);return S(a,e,{...Ql,message:l?i?f.cancel(d(l.item),l.index+1,l.size):f.stay(d(l.item),l.index+1,l.size,k(r,l)):""})},E=(t,e,n,s,r)=>n?n.list==e.list?{list:n.list,to:n.index,after:e.index<n.index}:{list:n.list,to:n.index+(r?1:0),after:!!r}:s&&u.includes(s)&&s!=e.list?{list:s,to:(t[s]||[]).length,after:!0}:null,k=(t,e)=>e.list!=t.list?e.list:void 0,A=(t,e,n)=>{const s=t[e],r=y(t,s.dragging),o=s.origin,i=r&&(o.list!=r.list||o.index!=r.index);return i&&n("DROPPED",{id:s.dragging,list:r.list,index:r.index,fromList:o.list,fromIndex:o.index},0),(i?b:S)(t,e,r?{...Ql,message:f.drop(d(r.item),r.index+1,r.size,k(o,r))}:Ql)},x=(t,e)=>t!==e?!e?.contains||e.contains(t):!e.nodeType,O=(t,e)=>{if(!t||!x(t,e))return!1;const n=t.parentElement?.closest?.(c);return!(n&&x(n,e))},T=(t,e,n)=>e&&Bl(435,e,t,u,l,n),$=t=>(e,n,r,o,i,a)=>{const l=e[a],c=(l.press||l.dragging)&&(l.press||l.origin)?.n!==n.n?_(e,a,1):e,u=t(c,n,r,a);return s(u)?c===e?u:c:(c!==e&&Zl.add(u[a]),u)},j={initialState:{...Ql,helpId:null},persist:!1,undoStep:["DROPPED"],undoEnd:t=>Zl.has(t),intent:({DOM:t,STATE:e,dispose$:n},s,i)=>{const l=t.select("document"),d=e.stream,f=Math.random();let p,m;const y=(t,e)=>d.map(t).compose(Je()).map((t=>t?e():Fe.empty())).flatten(),v=t=>t.press?.n===f,b=t=>{const e=t.clientX,n=t.clientY,s="undefined"!=typeof document?document:null,r="number"==typeof e&&s?.elementFromPoint?.(e,n)||t.target;let i;for(let t=r?.closest?.(c);t&&x(t,p);t=t.parentElement?.closest?.(c))i=t;const a=u.length>1&&r?.closest?.("[data-list]"),l=i?.getBoundingClientRect?.();return{x:e||0,y:n||0,over:i?g(i):null,list:a&&x(a,p)?a.getAttribute?.("data-list"):null,low:!!l?.height&&("x"==o?e>l.left+l.width/2:n>l.top+l.height/2)}},w=(t,e)=>{const n=t.target,s=t.ownerTarget||t.currentTarget;m||(m=Bl(146,s,c,r,a));const o=!Hl.has(t)&&n?.closest?.(h);if(!o||e&&o!==n)return null;const i=!r&&n!==o&&n.closest?.("button,a,input,select,textarea,label,[contenteditable]");if(i&&i!==o&&(!o.contains||o.contains(i)))return null;const l=r?o.closest?.(c):o;if(!O(l,s))return null;const u=g(l);return null==u&&Bl(145,l,c,a),u},S=(t,e)=>n=>t.test(n.key)&&(e||"Tab"!=n.key)&&null!=w(n,!0),_=S(Wl),E=S(Ul,1),k=t=>Bl(435,(()=>{const e=t.ownerTarget||t.currentTarget;return[[...e.querySelectorAll(c)].filter((t=>O(t,e))),e]}),i,u,g),A=t=>{const e=w(t,!0);return Hl.add(t),{key:"Spacebar"==t.key?" ":t.key,id:e,n:f,seen:Wl.test(t.key)&&k(t)}};return{INIT:Fe.of(0),END:n.mapTo(0),HELP:y((t=>!t.helpId),(()=>Fe.merge(t.events("focusin"),t.events("pointerdown"),t.events("keydown")).mapTo(0))),PRESS:t.events("pointerdown").filter((t=>!1!==t.isPrimary&&!t.button)).map((t=>{const e=w(t);return null==e?null:(Hl.add(t),p=t.ownerTarget||t.currentTarget,{id:e,x:t.clientX||0,y:t.clientY||0,n:f,seen:k(t)})})).filter((t=>null!=t)),MOVE:y(v,(()=>Fe.merge(l.events("pointermove").map(b),Fe.merge(l.events("selectstart",{preventDefault:!0}),l.events("dragstart",{preventDefault:!0})).filter((()=>!1))))),UP:y(v,(()=>l.events("pointerup").map(b))),CANCEL:y(v,(()=>Fe.merge(l.events("pointercancel"),l.events("keydown",{preventDefault:t=>"Escape"==t.key}).filter((t=>"Escape"==t.key))))),KEY:Fe.merge(t.events("keydown",{preventDefault:_}).filter((t=>!t.repeat&&_(t))).map(A),y((t=>"keyboard"==t.mode&&t.origin?.n===f),(()=>Fe.merge(t.events("keydown",{preventDefault:S(Ul)}).filter(E).map(A),t.events("focusout").filter((t=>t.relatedTarget)),l.events("pointerdown")).map((t=>t.key?t:{key:"Tab",n:f})))))}},model:{INIT:{HOST:(t,e,s,r,o,i)=>{for(const e of u)Array.isArray(t?.[e])||Bl(147,e,t,i);return t[i].press||t[i].dragging?_(t,i):n}},END:{HOST:(t,e,s,r,o,i)=>{const a=t[i];return a.press||a.dragging?_(t,i):n}},HELP:{HOST:(t,e,s,r,o,i)=>t[i].helpId||!r?.uid?n:b(t,i,{helpId:r.uid(i+"-help")})},PRESS:{HOST:$(((t,{seen:e,...s},r,o)=>{const i=t[o];return"pointer"!=i.mode&&y(t,s.id)?(T(t,e,o),b("keyboard"==i.mode?A(t,o,r):t,o,{press:s})):n}))},MOVE:{HOST:(t,e,s,r,o,a)=>{const c=t[a],u=c.press,h=u&&y(t,u.id);if(!h)return n;const p=!c.dragging&&{dragging:Vl(u.id),mode:"pointer",origin:{list:h.list,index:h.index},message:f.lift(d(h.item),h.index+1,h.size,!1)};if(!c.dragging&&Math.hypot(e.x-u.x,e.y-u.y)<i)return n;const m=y(t,e.over),g=E(t,h,m,e.list,e.low),v={...p,over:m?Vl(m.item[l]):null,list:g?.list??null,after:!!g?.after};return p||v.over!==c.over||v.list!==c.list||v.after!==c.after?b(t,a,v):n}},UP:{HOST:(t,e,s,r,o,i)=>{const a=t[i];if(!a.dragging)return a.press?b(t,i,Ql):n;const l=y(t,a.dragging),c=l&&E(t,l,y(t,e.over),e.list,e.low);if(!l||!c||c.list==l.list&&c.to==l.index)return b(t,i,{...Ql,message:l?f.cancel(d(l.item),l.index+1,l.size):""});const u=v(t,l,c.list,c.to),h=y(u,a.dragging);return s("DROPPED",{id:a.dragging,list:h.list,index:h.index,fromList:l.list,fromIndex:l.index},0),b(u,i,{...Ql,message:f.drop(d(l.item),h.index+1,h.size,k(l,h))})}},CANCEL:{HOST:(t,e,s,r,o,i)=>{const a=t[i],l=a.dragging&&y(t,a.dragging);return a.press?b(t,i,{...Ql,message:l?f.cancel(d(l.item),l.index+1,l.size):""}):n}},KEY:{HOST:$(((t,{key:e,id:s,n:r,seen:o},i,a)=>{const l=t[a],c=y(t,l.dragging??s);if("pointer"==l.mode||l.press)return n;if(!c)return l.dragging?S(t,a,Ql):n;const h=d(c.item),g=l.origin;if(!l.dragging){if(!Wl.test(e))return n;T(t,o,a);const i={list:c.list,index:c.index,n:r};return Kl.set(i,{snap:w(t),made:w(t)}),b(t,a,{...Ql,dragging:Vl(s),mode:"keyboard",origin:i,message:f.lift(h,c.index+1,c.size,!0)})}if(Wl.test(e)||"Tab"==e)return A(t,a,i);if("Escape"==e)return _(t,a,1);const E=(t,e)=>{const n=Kl.get(g);return n&&(n.made=w(t)),b(t,a,{message:e})},k={ArrowUp:-1,ArrowDown:1,ArrowLeft:-1,ArrowRight:1}[e];if(k&&e!=p&&e!=m){const e=u[u.indexOf(c.list)+k];if(!e)return n;const s=v(t,c,e,c.index),r=y(s,l.dragging);return E(s,f.move(h,r.index+1,r.size,e))}const x=e==p?c.index-1:e==m?c.index+1:"Home"==e?0:"End"==e?c.size-1:-1;return x<0||x>=c.size||x==c.index?n:E(v(t,c,c.list,x),f.move(h,x+1,c.size))})),ELEMENT:(t,e)=>{if("Tab"==e.key||null==e.id)return n;const s=":scope "+Jl(c)+`[${a}="${Vl(e.id).replace(/["\\]/g,"\\$&")}"]`+(r?" "+Jl(r):"");return{focus:{within:s,toString:()=>"",spec:{commands:{focus:(t,e)=>{for(const n of t.querySelectorAll?.(s)||[])if(O(r?n.closest(c):n,t))return n.focus(e)}}}}}}},DROPPED:n}};return El(j)(t)},t.storageSource=ja,t.throttle=function(t){return function(e){return new De(new We(t,e))}},t.thunk=function(t,e,n,s){return void 0===s&&(s=n,n=e,e=void 0),d(t,{key:e,hook:{init:Ya,prepatch:Fa},fn:n,args:s})},t.toggle=function(t){return e=>({...e,[t]:!e[t]})},t.undo=t=>{rc(t);const e=El({initialState:{past:[],future:[]},intent:({DOM:t},{undo:e,redo:n})=>({...e&&{UNDO:t.click(e)},...n&&{REDO:t.click(n)}}),model:{UNDO:()=>n,REDO:()=>n},calculated:{canUndo:t=>t.past.length>0,canRedo:t=>t.future.length>0}})(t),s=e.merge;return e.merge=(n,r)=>{const o=n.view?.uses,i={};nc.has(e)||(nc.add(e),oc(n.model,t,n,o));for(const t in o){const e=o[t]?.undoStep,n=Object.keys(o[t]?.model||{}).map((e=>t+"."+e));if(e)for(const s in o[t].model)i[t+"."+s]=[e.includes(s)?2:1,n,t,o[t].undoEnd]}n.model=cc(n.model||{},t,r,r+".",n.stateSourceName,i),s(n,r)},e},t.undoable=(t,e)=>(rc(e),oc(t,e),cc(t,e,"history","")),t.visibilitySource=Ca,t.xs=Fe}));
|
|
2
2
|
//# sourceMappingURL=sygnal.min.js.map
|