sygnal 5.1.0 → 5.1.1

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.
@@ -4,7 +4,7 @@ var h = require('snabbdom/build/h');
4
4
  var init = require('snabbdom/build/init');
5
5
  var tovnode = require('snabbdom/build/tovnode');
6
6
  var vnode = require('snabbdom/build/vnode');
7
- require('snabbdom/build/jsx');
7
+ var jsx = require('snabbdom/build/jsx');
8
8
  var _class = require('snabbdom/build/modules/class');
9
9
  var props = require('snabbdom/build/modules/props');
10
10
  var attributes = require('snabbdom/build/modules/attributes');
@@ -3570,6 +3570,20 @@ function withState(main, name = 'state') {
3570
3570
  };
3571
3571
  }
3572
3572
 
3573
+ /**
3574
+ * Local snabbdom re-export barrel.
3575
+ *
3576
+ * Imports from specific snabbdom subpaths instead of the main barrel to avoid
3577
+ * triggering the broken `styleModule` top-level `window` reference in
3578
+ * snabbdom 3.6.3 (which causes ReferenceError in Node.js environments).
3579
+ *
3580
+ * The styleModule is provided separately by ./styleModule.ts with a fixed
3581
+ * window guard.
3582
+ */
3583
+ // Core
3584
+ // Tag Fragment so we can identify it even after minification mangles Function.name
3585
+ jsx.Fragment.__sygnalFragment = true;
3586
+
3573
3587
  function fromEvent(element, eventName, useCapture = false, preventDefault = false, passive = false) {
3574
3588
  let next = null;
3575
3589
  return Stream_1.create({
@@ -2,7 +2,7 @@ import { h } from 'snabbdom/build/h';
2
2
  import { init } from 'snabbdom/build/init';
3
3
  import { toVNode } from 'snabbdom/build/tovnode';
4
4
  import { vnode } from 'snabbdom/build/vnode';
5
- import 'snabbdom/build/jsx';
5
+ import { Fragment } from 'snabbdom/build/jsx';
6
6
  import { classModule } from 'snabbdom/build/modules/class';
7
7
  import { propsModule } from 'snabbdom/build/modules/props';
8
8
  import { attributesModule } from 'snabbdom/build/modules/attributes';
@@ -3568,6 +3568,20 @@ function withState(main, name = 'state') {
3568
3568
  };
3569
3569
  }
3570
3570
 
3571
+ /**
3572
+ * Local snabbdom re-export barrel.
3573
+ *
3574
+ * Imports from specific snabbdom subpaths instead of the main barrel to avoid
3575
+ * triggering the broken `styleModule` top-level `window` reference in
3576
+ * snabbdom 3.6.3 (which causes ReferenceError in Node.js environments).
3577
+ *
3578
+ * The styleModule is provided separately by ./styleModule.ts with a fixed
3579
+ * window guard.
3580
+ */
3581
+ // Core
3582
+ // Tag Fragment so we can identify it even after minification mangles Function.name
3583
+ Fragment.__sygnalFragment = true;
3584
+
3571
3585
  function fromEvent(element, eventName, useCapture = false, preventDefault = false, passive = false) {
3572
3586
  let next = null;
3573
3587
  return Stream_1.create({
package/dist/index.cjs.js CHANGED
@@ -7,7 +7,7 @@ var h = require('snabbdom/build/h');
7
7
  var init$1 = require('snabbdom/build/init');
8
8
  var tovnode = require('snabbdom/build/tovnode');
9
9
  var vnode$1 = require('snabbdom/build/vnode');
10
- require('snabbdom/build/jsx');
10
+ var jsx = require('snabbdom/build/jsx');
11
11
  var _class = require('snabbdom/build/modules/class');
12
12
  var props = require('snabbdom/build/modules/props');
13
13
  var attributes = require('snabbdom/build/modules/attributes');
@@ -624,6 +624,20 @@ function withState(main, name = 'state') {
624
624
  };
625
625
  }
626
626
 
627
+ /**
628
+ * Local snabbdom re-export barrel.
629
+ *
630
+ * Imports from specific snabbdom subpaths instead of the main barrel to avoid
631
+ * triggering the broken `styleModule` top-level `window` reference in
632
+ * snabbdom 3.6.3 (which causes ReferenceError in Node.js environments).
633
+ *
634
+ * The styleModule is provided separately by ./styleModule.ts with a fixed
635
+ * window guard.
636
+ */
637
+ // Core
638
+ // Tag Fragment so we can identify it even after minification mangles Function.name
639
+ jsx.Fragment.__sygnalFragment = true;
640
+
627
641
  function copyToThunk(vnode, thunkVNode) {
628
642
  thunkVNode.elm = vnode.elm;
629
643
  vnode.data.fn = thunkVNode.data.fn;
@@ -5536,7 +5550,7 @@ const createElementWithModules = (modules) => {
5536
5550
  console.error('JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.');
5537
5551
  }
5538
5552
  if (fun(sel)) {
5539
- if (sel.name === 'Fragment') {
5553
+ if (sel.__sygnalFragment || sel.name === 'Fragment') {
5540
5554
  return sel(data || {}, children);
5541
5555
  }
5542
5556
  data || (data = {});
package/dist/index.esm.js CHANGED
@@ -9,7 +9,7 @@ export { h } from 'snabbdom/build/h';
9
9
  import { init as init$1 } from 'snabbdom/build/init';
10
10
  import { toVNode } from 'snabbdom/build/tovnode';
11
11
  import { vnode as vnode$1 } from 'snabbdom/build/vnode';
12
- import 'snabbdom/build/jsx';
12
+ import { Fragment } from 'snabbdom/build/jsx';
13
13
  import { classModule } from 'snabbdom/build/modules/class';
14
14
  import { propsModule } from 'snabbdom/build/modules/props';
15
15
  import { attributesModule } from 'snabbdom/build/modules/attributes';
@@ -603,6 +603,20 @@ function withState(main, name = 'state') {
603
603
  };
604
604
  }
605
605
 
606
+ /**
607
+ * Local snabbdom re-export barrel.
608
+ *
609
+ * Imports from specific snabbdom subpaths instead of the main barrel to avoid
610
+ * triggering the broken `styleModule` top-level `window` reference in
611
+ * snabbdom 3.6.3 (which causes ReferenceError in Node.js environments).
612
+ *
613
+ * The styleModule is provided separately by ./styleModule.ts with a fixed
614
+ * window guard.
615
+ */
616
+ // Core
617
+ // Tag Fragment so we can identify it even after minification mangles Function.name
618
+ Fragment.__sygnalFragment = true;
619
+
606
620
  function copyToThunk(vnode, thunkVNode) {
607
621
  thunkVNode.elm = vnode.elm;
608
622
  vnode.data.fn = thunkVNode.data.fn;
@@ -5515,7 +5529,7 @@ const createElementWithModules = (modules) => {
5515
5529
  console.error('JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.');
5516
5530
  }
5517
5531
  if (fun(sel)) {
5518
- if (sel.name === 'Fragment') {
5532
+ if (sel.__sygnalFragment || sel.name === 'Fragment') {
5519
5533
  return sel(data || {}, children);
5520
5534
  }
5521
5535
  data || (data = {});
@@ -227,7 +227,7 @@ const createElementWithModules = (modules) => {
227
227
  console.error('JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.');
228
228
  }
229
229
  if (fun(sel)) {
230
- if (sel.name === 'Fragment') {
230
+ if (sel.__sygnalFragment || sel.name === 'Fragment') {
231
231
  return sel(data || {}, children);
232
232
  }
233
233
  data || (data = {});
@@ -276,7 +276,7 @@ function vnode(sel, data, children, text, elm) {
276
276
  }
277
277
 
278
278
  /* eslint-disable @typescript-eslint/no-namespace, import/export */
279
- function Fragment(data, ...children) {
279
+ function Fragment$1(data, ...children) {
280
280
  const flatChildren = flattenAndFilter(children, []);
281
281
  if (flatChildren.length === 1 &&
282
282
  !flatChildren[0].sel &&
@@ -311,6 +311,21 @@ function flattenAndFilter(children, flattened) {
311
311
  return flattened;
312
312
  }
313
313
 
314
+ /**
315
+ * Local snabbdom re-export barrel.
316
+ *
317
+ * Imports from specific snabbdom subpaths instead of the main barrel to avoid
318
+ * triggering the broken `styleModule` top-level `window` reference in
319
+ * snabbdom 3.6.3 (which causes ReferenceError in Node.js environments).
320
+ *
321
+ * The styleModule is provided separately by ./styleModule.ts with a fixed
322
+ * window guard.
323
+ */
324
+ // Core
325
+ // Tag Fragment so we can identify it even after minification mangles Function.name
326
+ Fragment$1.__sygnalFragment = true;
327
+ const Fragment = Fragment$1;
328
+
314
329
  function jsx(type, props, key) {
315
330
  if (props == null)
316
331
  return createElement(type, null);
@@ -225,7 +225,7 @@ const createElementWithModules = (modules) => {
225
225
  console.error('JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.');
226
226
  }
227
227
  if (fun(sel)) {
228
- if (sel.name === 'Fragment') {
228
+ if (sel.__sygnalFragment || sel.name === 'Fragment') {
229
229
  return sel(data || {}, children);
230
230
  }
231
231
  data || (data = {});
@@ -274,7 +274,7 @@ function vnode(sel, data, children, text, elm) {
274
274
  }
275
275
 
276
276
  /* eslint-disable @typescript-eslint/no-namespace, import/export */
277
- function Fragment(data, ...children) {
277
+ function Fragment$1(data, ...children) {
278
278
  const flatChildren = flattenAndFilter(children, []);
279
279
  if (flatChildren.length === 1 &&
280
280
  !flatChildren[0].sel &&
@@ -309,6 +309,21 @@ function flattenAndFilter(children, flattened) {
309
309
  return flattened;
310
310
  }
311
311
 
312
+ /**
313
+ * Local snabbdom re-export barrel.
314
+ *
315
+ * Imports from specific snabbdom subpaths instead of the main barrel to avoid
316
+ * triggering the broken `styleModule` top-level `window` reference in
317
+ * snabbdom 3.6.3 (which causes ReferenceError in Node.js environments).
318
+ *
319
+ * The styleModule is provided separately by ./styleModule.ts with a fixed
320
+ * window guard.
321
+ */
322
+ // Core
323
+ // Tag Fragment so we can identify it even after minification mangles Function.name
324
+ Fragment$1.__sygnalFragment = true;
325
+ const Fragment = Fragment$1;
326
+
312
327
  function jsx(type, props, key) {
313
328
  if (props == null)
314
329
  return createElement(type, null);
@@ -227,7 +227,7 @@ const createElementWithModules = (modules) => {
227
227
  console.error('JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.');
228
228
  }
229
229
  if (fun(sel)) {
230
- if (sel.name === 'Fragment') {
230
+ if (sel.__sygnalFragment || sel.name === 'Fragment') {
231
231
  return sel(data || {}, children);
232
232
  }
233
233
  data || (data = {});
@@ -276,7 +276,7 @@ function vnode(sel, data, children, text, elm) {
276
276
  }
277
277
 
278
278
  /* eslint-disable @typescript-eslint/no-namespace, import/export */
279
- function Fragment(data, ...children) {
279
+ function Fragment$1(data, ...children) {
280
280
  const flatChildren = flattenAndFilter(children, []);
281
281
  if (flatChildren.length === 1 &&
282
282
  !flatChildren[0].sel &&
@@ -311,6 +311,21 @@ function flattenAndFilter(children, flattened) {
311
311
  return flattened;
312
312
  }
313
313
 
314
+ /**
315
+ * Local snabbdom re-export barrel.
316
+ *
317
+ * Imports from specific snabbdom subpaths instead of the main barrel to avoid
318
+ * triggering the broken `styleModule` top-level `window` reference in
319
+ * snabbdom 3.6.3 (which causes ReferenceError in Node.js environments).
320
+ *
321
+ * The styleModule is provided separately by ./styleModule.ts with a fixed
322
+ * window guard.
323
+ */
324
+ // Core
325
+ // Tag Fragment so we can identify it even after minification mangles Function.name
326
+ Fragment$1.__sygnalFragment = true;
327
+ const Fragment = Fragment$1;
328
+
314
329
  function jsx(type, props, key) {
315
330
  if (props == null)
316
331
  return createElement(type, null);
@@ -225,7 +225,7 @@ const createElementWithModules = (modules) => {
225
225
  console.error('JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.');
226
226
  }
227
227
  if (fun(sel)) {
228
- if (sel.name === 'Fragment') {
228
+ if (sel.__sygnalFragment || sel.name === 'Fragment') {
229
229
  return sel(data || {}, children);
230
230
  }
231
231
  data || (data = {});
@@ -274,7 +274,7 @@ function vnode(sel, data, children, text, elm) {
274
274
  }
275
275
 
276
276
  /* eslint-disable @typescript-eslint/no-namespace, import/export */
277
- function Fragment(data, ...children) {
277
+ function Fragment$1(data, ...children) {
278
278
  const flatChildren = flattenAndFilter(children, []);
279
279
  if (flatChildren.length === 1 &&
280
280
  !flatChildren[0].sel &&
@@ -309,6 +309,21 @@ function flattenAndFilter(children, flattened) {
309
309
  return flattened;
310
310
  }
311
311
 
312
+ /**
313
+ * Local snabbdom re-export barrel.
314
+ *
315
+ * Imports from specific snabbdom subpaths instead of the main barrel to avoid
316
+ * triggering the broken `styleModule` top-level `window` reference in
317
+ * snabbdom 3.6.3 (which causes ReferenceError in Node.js environments).
318
+ *
319
+ * The styleModule is provided separately by ./styleModule.ts with a fixed
320
+ * window guard.
321
+ */
322
+ // Core
323
+ // Tag Fragment so we can identify it even after minification mangles Function.name
324
+ Fragment$1.__sygnalFragment = true;
325
+ const Fragment = Fragment$1;
326
+
312
327
  function jsx(type, props, key) {
313
328
  if (props == null)
314
329
  return createElement(type, null);
package/dist/jsx.cjs.js CHANGED
@@ -227,7 +227,7 @@ const createElementWithModules = (modules) => {
227
227
  console.error('JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.');
228
228
  }
229
229
  if (fun(sel)) {
230
- if (sel.name === 'Fragment') {
230
+ if (sel.__sygnalFragment || sel.name === 'Fragment') {
231
231
  return sel(data || {}, children);
232
232
  }
233
233
  data || (data = {});
package/dist/jsx.esm.js CHANGED
@@ -225,7 +225,7 @@ const createElementWithModules = (modules) => {
225
225
  console.error('JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.');
226
226
  }
227
227
  if (fun(sel)) {
228
- if (sel.name === 'Fragment') {
228
+ if (sel.__sygnalFragment || sel.name === 'Fragment') {
229
229
  return sel(data || {}, children);
230
230
  }
231
231
  data || (data = {});
@@ -1 +1 @@
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={},i={};!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}}(i);var s,a,c=i,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,p=u,h=Object.keys,f=h?function(t){return h(t)}:function(){if(a)return s;var t;if(a=1,!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,o=u,r=Object.prototype.propertyIsEnumerable,i=!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},p={$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},h=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!p["$"+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,s="[object Function]"===n.call(t),a=o(t),u=r&&"[object String]"===n.call(t),p=[];if(!r&&!s&&!a)throw new TypeError("Object.keys called on a non-object");var f=c&&s;if(u&&t.length>0&&!e.call(t,0))for(var m=0;m<t.length;++m)p.push(String(m));if(a&&t.length>0)for(var y=0;y<t.length;++y)p.push(String(y));else for(var _ in t)f&&"prototype"===_||!e.call(t,_)||p.push(String(_));if(i)for(var v=function(t){if("undefined"==typeof window||!h)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])||p.push(l[g]);return p}}return s=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 p(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},b={foo:{}},w=Object,S=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=S.call(arguments,1),r=Math.max(0,e.length-o.length),i=[],s=0;s<r;s++)i.push("$"+s);if(n=Function("binder","return function ("+i.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var r=e.apply(this,o.concat(S.call(arguments)));return Object(r)===r?r:this}return e.apply(t,o.concat(S.call(arguments)))})),e.prototype){var a=function(){};a.prototype=e.prototype,n.prototype=new a,a.prototype=null}return n},O=Function.prototype.bind||E,N=O.call(Function.call,Object.prototype.hasOwnProperty),C=SyntaxError,$=Function,T=TypeError,x=function(t){try{return $('"use strict"; return ('+t+").constructor;")()}catch(t){}},k=Object.getOwnPropertyDescriptor;if(k)try{k({},"")}catch(t){k=null}var L=function(){throw new T},j=k?function(){try{return L}catch(t){try{return k(arguments,"callee").get}catch(t){return L}}}():L,D="function"==typeof v&&"function"==typeof Symbol&&"symbol"==typeof v("foo")&&"symbol"==typeof Symbol("bar")&&g(),I={__proto__:b}.foo===b.foo&&!({__proto__:null}instanceof w),M=Object.getPrototypeOf||(I?function(t){return t.__proto__}:null),P={},R="undefined"!=typeof Uint8Array&&M?M(Uint8Array):y,F={"%AggregateError%":"undefined"==typeof AggregateError?y:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?y:ArrayBuffer,"%ArrayIteratorPrototype%":D&&M?M([][Symbol.iterator]()):y,"%AsyncFromSyncIteratorPrototype%":y,"%AsyncFunction%":P,"%AsyncGenerator%":P,"%AsyncGeneratorFunction%":P,"%AsyncIteratorPrototype%":P,"%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%":$,"%GeneratorFunction%":P,"%Int8Array%":"undefined"==typeof Int8Array?y:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?y:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":D&&M?M(M([][Symbol.iterator]())):y,"%JSON%":"object"==typeof JSON?JSON:y,"%Map%":"undefined"==typeof Map?y:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&D&&M?M((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&&D&&M?M((new Set)[Symbol.iterator]()):y,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":D&&M?M(""[Symbol.iterator]()):y,"%Symbol%":D?Symbol:y,"%SyntaxError%":C,"%ThrowTypeError%":j,"%TypedArray%":R,"%TypeError%":T,"%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(M)try{null.error}catch(t){var B=M(M(t));F["%Error.prototype%"]=B}var G=function t(e){var n;if("%AsyncFunction%"===e)n=x("async function () {}");else if("%GeneratorFunction%"===e)n=x("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=x("async function* () {}");else if("%AsyncGenerator%"===e){var o=t("%AsyncGeneratorFunction%");o&&(n=o.prototype)}else if("%AsyncIteratorPrototype%"===e){var r=t("%AsyncGenerator%");r&&M&&(n=M(r.prototype))}return F[e]=n,n},U={"%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"]},V=O,H=N,W=V.call(Function.call,Array.prototype.concat),z=V.call(Function.apply,Array.prototype.splice),Y=V.call(Function.call,String.prototype.replace),q=V.call(Function.call,String.prototype.slice),J=V.call(Function.call,RegExp.prototype.exec),Z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,X=/\\(\\)?/g,K=function(t,e){var n,o=t;if(H(U,o)&&(o="%"+(n=U[o])[0]+"%"),H(F,o)){var r=F[o];if(r===P&&(r=G(o)),void 0===r&&!e)throw new T("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 T("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new T('"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 Y(t,Z,(function(t,e,n,r){o[o.length]=n?Y(r,X,"$1"):e||t})),o}(t),o=n.length>0?n[0]:"",r=K("%"+o+"%",e),i=r.name,s=r.value,a=!1,c=r.alias;c&&(o=c[0],z(n,W([0,1],c)));for(var l=1,u=!0;l<n.length;l+=1){var d=n[l],p=q(d,0,1),h=q(d,-1);if(('"'===p||"'"===p||"`"===p||'"'===h||"'"===h||"`"===h)&&p!==h)throw new C("property names with quotes must have matching quotes");if("constructor"!==d&&u||(a=!0),H(F,i="%"+(o+="."+d)+"%"))s=F[i];else if(null!=s){if(!(d in s)){if(!e)throw new T("base intrinsic for "+t+" exists, but the property is not available.");return}if(k&&l+1>=n.length){var f=k(s,d);s=(u=!!f)&&"get"in f&&!("originalValue"in f.get)?f.get:s[d]}else u=H(s,d),s=s[d];u&&!a&&(F[i]=s)}}return s},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"),it=Object.prototype.toString,st=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]"!==it.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=st.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 pt=n,ht=function(){return"object"==typeof n&&n&&n.Math===Math&&n.Array===Array?n:pt},ft=dt,mt=ht,yt=dt,_t=n,vt=ht,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},bt=vt(),wt=function(){return bt};yt(wt,{getPolyfill:vt,implementation:_t,shim:gt});var St,At=wt,Et=n&&n.__extends||(St=function(t,e){return St=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])},St(t,e)},function(t,e){function n(){this.constructor=t}St(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(r,"__esModule",{value:!0});var Ot=r.NO_IL=r.NO=r.MemoryStream=re=r.Stream=void 0,Nt=c.default(At.getPolyfill()),Ct={},$t=r.NO=Ct;function Tt(){}function xt(t){for(var e=t.length,n=Array(e),o=0;o<e;++o)n[o]=t[o];return n}function kt(t,e,n){try{return t.f(e)}catch(t){return n._e(t),Ct}}var Lt={_n:Tt,_e:Tt,_c:Tt};function jt(t){t._start=function(t){t.next=t._n,t.error=t._e,t.complete=t._c,this.start(t)},t._stop=t.stop}Ot=r.NO_IL=Lt;var Dt=function(){function t(t,e){this._stream=t,this._listener=e}return t.prototype.unsubscribe=function(){this._stream._remove(this._listener)},t}(),It=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}(),Mt=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 It(t)),this.active||this._sub.unsubscribe()},t.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},t}(),Pt=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}(),Rt=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=xt(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}(),Ft=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 Rt(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}(),Bt=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}(),Gt=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(Tt,(function(t){setTimeout((function(){throw t}))}))},t.prototype._stop=function(){this.on=!1},t}(),Ut=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}(),Vt=function(){function t(t,e){this.type="debug",this.ins=t,this.out=Ct,this.s=Tt,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!==Tt)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}(),Ht=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}(),zt=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}(),Yt=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=kt(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=kt(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=kt(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=xt(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=xt(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=xt(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 ie?ie:t},t.prototype.addListener=function(t){t._n=t.next||Tt,t._e=t.error||Tt,t._c=t.complete||Tt,this._add(t)},t.prototype.removeListener=function(t){this._remove(t)},t.prototype.subscribe=function(t){return this.addListener(t),new Dt(this,t)},t.prototype[Nt]=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");jt(e)}return new t(e)},t.createWithMemory=function(t){return t&&jt(t),new ie(t)},t.never=function(){return new t({_start:Tt,_stop:Tt})},t.empty=function(){return new t({_start:function(t){t._c()},_stop:Tt})},t.throw=function(e){return new t({_start:function(t){t._e(e)},_stop:Tt})},t.from=function(e){if("function"==typeof e[Nt])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 Bt(e))},t.fromPromise=function(e){return new t(new Gt(e))},t.fromObservable=function(e){if(void 0!==e.endWhen)return e;var n="function"==typeof e[Nt]?e[Nt]():e;return new t(new Mt(n))},t.periodic=function(e){return new t(new Ut(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 Yt?new Yt((n=r.f,o=e,function(t){return n(t)&&o(t)}),r.ins):new Yt(e,this))},t.prototype.take=function(t){return new(this.ctor())(new ne(t,this))},t.prototype.drop=function(e){return new t(new Ht(e,this))},t.prototype.last=function(){return new t(new Xt(this))},t.prototype.startWith=function(t){return new ie(new ee(this,t))},t.prototype.endWhen=function(t){return new(this.ctor())(new zt(t,this))},t.prototype.fold=function(t,e){return new ie(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 ie(new Qt(this))},t.prototype.debug=function(t){return new(this.ctor())(new Vt(this,t))},t.prototype.imitate=function(t){if(t instanceof ie)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||Tt,t._e=t.error||Tt,t._c=t.complete||Tt,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 Pt(e))},t.combine=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Ft(e))},t}(),re=r.Stream=oe,ie=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),se=r.MemoryStream=ie,ae=oe,ce=r.default=ae,le=e({__proto__:null,get MemoryStream(){return se},get NO(){return $t},get NO_IL(){return Ot},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 pe(){return"cycle"+ ++de}function he(t,e=pe()){!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?pe():"",o="string"==typeof e||"object"==typeof e?e:e.toString();return function(e,...r){const i=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 i=e["*"];o[t]=void 0===i?n:i})),o}(e,o,n),s=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,i),a=function(t,e,n){const o={};for(const r in e){const i=t[r],s=e[r];Object.prototype.hasOwnProperty.call(e,r)&&i&&null!==n[r]&&"function"==typeof i.isolateSink?o[r]=ue(i.isolateSink(ce.fromObservable(s),n[r])):Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r])}return o}(e,t(s,...r),i);return a}}he.reset=()=>de=0;var fe={};Object.defineProperty(fe,"__esModule",{value:!0});var me=fe.DropRepeatsOperator=void 0,ye=r,_e={},ve=function(){function t(t,e){this.ins=t,this.type="dropRepeats",this.out=null,this.v=_e,this.isEq=e||function(t,e){return t===e}}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.v=_e},t.prototype._n=function(t){var e=this.out;if(e){var n=this.v;n!==_e&&this.isEq(t,n)||(this.v=t,e._n(t))}},t.prototype._e=function(t){var e=this.out;e&&e._e(t)},t.prototype._c=function(){var t=this.out;t&&t._c()},t}();me=fe.DropRepeatsOperator=ve;var ge=fe.default=function(t){return void 0===t&&(t=void 0),function(e){return new ye.Stream(new ve(e,t))}},be=e({__proto__:null,get DropRepeatsOperator(){return me},default:ge},[fe]);function we(t){return"string"==typeof t||"number"==typeof t?function(e){return null==e?void 0:e[t]}:t.get}function Se(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 Ae(t,e){return t.select(e)}function Ee(t,e){const n=we(e),o=Se(e);return t.map((t=>function(e){const r=n(e),i=t(r);return r===i?e:o(e,i)}))}class Oe{constructor(t,e){this.isolateSource=Ae,this.isolateSink=Ee,this._stream=t.filter((t=>void 0!==t)).compose(ge()).remember(),this._name=e,this.stream=ue(this._stream),this._stream._isCycleSource=e}select(t){const e=we(t);return new Oe(this._stream.map(e),this._name)}}class Ne{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 Ce{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,i=e.length;for(let t=0;t<i;++t){const i=e[t],s=i._key,a=ce.fromObservable(i[r]||ce.never());n.has(s)||(n.set(s,new Ne(o,this,a)),a._add(n.get(s)))}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 $e{constructor(t,e,n,o){this.key=t,this.out=e,this.p=n,this.val=$t,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 Te{constructor(t,e){this.type="combine",this.ins=e,this.sel=t,this.out=null,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((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}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 i=n.get(e).val;if(i===$t)return;o[r]=i}this.out._n(o)}_n(t){this.inst=t;const e=t.arr,n=this.ils,o=this.out,r=this.sel,i=t.dict,s=e.length;let a=!1;if(n.forEach(((t,e)=>{i.has(e)||(t.ins._remove(t),t.ins=null,t.out=null,t.val=null,n.delete(e),a=!0)})),0!==s){for(let t=0;t<s;++t){const i=e[t],s=i._key;if(!i[r])throw new Error("pickCombine found an undefined child sink stream");const a=ce.fromObservable(i[r]);n.has(s)||(n.set(s,new $e(s,o,this,a)),a._add(n.get(s)))}a&&this.up()}else o._n([])}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){const t=this.out;null!==t&&t._c()}}class xe{constructor(t){this._instances$=t}pickMerge(t){return ue(this._instances$.compose(function(t){return function(e){return new re(new Ce(t,e))}}(t)))}pickCombine(t){return ue(this._instances$.compose(function(t){return function(e){return new re(new Te(t,e))}}(t)))}}function ke(t){return{"*":null}}function Le(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 je={get:t=>t,set:(t,e)=>e};var De={};Object.defineProperty(De,"__esModule",{value:!0});var Ie=r,Me=function(){function t(t){this.streams=t,this.type="concat",this.out=null,this.i=0}return t.prototype._start=function(t){this.out=t,this.streams[this.i]._add(this)},t.prototype._stop=function(){var t=this.streams;this.i<t.length&&t[this.i]._remove(this),this.i=0,this.out=null},t.prototype._n=function(t){var e=this.out;e&&e._n(t)},t.prototype._e=function(t){var e=this.out;e&&e._e(t)},t.prototype._c=function(){var t=this.out;if(t){var e=this.streams;e[this.i]._remove(this),++this.i<e.length?e[this.i]._add(this):t._c()}},t}();var Pe=De.default=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Ie.Stream(new Me(t))},Re=e({__proto__:null,default:Pe},[De]);function Fe(t,e="state"){return function(n){const o=ce.create(),r=o.fold(((t,e)=>e(t)),void 0).drop(1),i=n;i[e]=new Oe(r,e);const s=t(i);if(s[e]){Pe(ce.fromObservable(s[e]),ce.never()).subscribe({next:t=>queueMicrotask((()=>o._n(t))),error:t=>queueMicrotask((()=>o._e(t))),complete:()=>queueMicrotask((()=>o._c()))})}return s}}function Be(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 Ge=Array.isArray;function Ue(t){return"string"==typeof t||"number"==typeof t||t instanceof String||t instanceof Number}function Ve(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&&Ve(o,n.children,n.sel)}}function He(t,e,n){let o,r,i,s={};if(void 0!==n?(null!==e&&(s=e),Ge(n)?o=n:Ue(n)?r=n.toString():n&&n.sel&&(o=[n])):null!=e&&(Ge(e)?o=e:Ue(e)?r=e.toString():e&&e.sel?o=[e]:s=e),void 0!==o)for(i=0;i<o.length;++i)Ue(o[i])&&(o[i]=Be(void 0,void 0,void 0,o[i],void 0));return!t.startsWith("svg")||3!==t.length&&"."!==t[3]&&"#"!==t[3]||Ve(s,o,t),Be(t,s,o,r,void 0)}function We(t){if(ze(t)){for(;t&&ze(t);){t=Ye(t).parent}return null!=t?t:null}return t.parentNode}function ze(t){return 11===t.nodeType}function Ye(t,e){var n,o,r;const i=t;return null!==(n=i.parent)&&void 0!==n||(i.parent=null!=e?e:null),null!==(o=i.firstChildNode)&&void 0!==o||(i.firstChildNode=t.firstChild),null!==(r=i.lastChildNode)&&void 0!==r||(i.lastChildNode=t.lastChild),i}const qe={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 Ye(document.createDocumentFragment())},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){if(ze(t)){let e=t;for(;e&&ze(e);){e=Ye(e).parent}t=null!=e?e:t}ze(e)&&(e=Ye(e,t)),n&&ze(n)&&(n=Ye(n).firstChildNode),t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){ze(e)&&(e=Ye(e,t)),t.appendChild(e)},parentNode:We,nextSibling:function(t){var e;if(ze(t)){const n=Ye(t),o=We(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:ze},Je=Be("",{},[],void 0,void 0);function Ze(t,e){var n,o;const r=t.key===e.key,i=(null===(n=t.data)||void 0===n?void 0:n.is)===(null===(o=e.data)||void 0===o?void 0:o.is),s=t.sel===e.sel,a=!(!t.sel&&t.sel===e.sel)||typeof t.text==typeof e.text;return s&&r&&i&&a}function Xe(){throw new Error("The document fragment is not supported on this platform.")}function Ke(t,e,n){var o;const r={};for(let i=e;i<=n;++i){const e=null===(o=t[i])||void 0===o?void 0:o.key;void 0!==e&&(r[e]=i)}return r}const Qe=["create","update","remove","destroy","pre","post"];function tn(t,e,n){const o={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},r=void 0!==e?e:qe;for(const e of Qe)for(const n of t){const t=n[e];void 0!==t&&o[e].push(t)}function i(t,e){return function(){if(0==--e){const e=r.parentNode(t);null!==e&&r.removeChild(e,t)}}}function s(t,e){var i,a,c,l,u;let d;const p=t.data,h=null==p?void 0:p.hook;null===(i=null==h?void 0:h.init)||void 0===i||i.call(h,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("#"),i=m.indexOf(".",n),a=n>0?n:m.length,l=i>0?i:m.length,u=-1!==n||-1!==i?m.slice(0,Math.min(a,l)):m,y=null==p?void 0:p.ns,_=void 0===y?r.createElement(u,p):r.createElementNS(y,u,p);for(t.elm=_,a<l&&_.setAttribute("id",m.slice(a+1,l)),i>0&&_.setAttribute("class",m.slice(l+1).replace(/\./g," ")),d=0;d<o.create.length;++d)o.create[d](Je,t);if(!Ue(t.text)||Ge(f)&&0!==f.length||r.appendChild(_,r.createTextNode(t.text)),Ge(f))for(d=0;d<f.length;++d){const t=f[d];null!=t&&r.appendChild(_,s(t,e))}void 0!==h&&(null===(c=h.create)||void 0===c||c.call(h,Je,t),void 0!==h.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:Xe)(),d=0;d<o.create.length;++d)o.create[d](Je,t);for(d=0;d<t.children.length;++d){const n=t.children[d];null!=n&&r.appendChild(t.elm,s(n,e))}}else t.elm=r.createTextNode(t.text);return t.elm}function a(t,e,n,o,i,a){for(;o<=i;++o){const i=n[o];null!=i&&r.insertBefore(t,s(i,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,s){for(var a,u;n<=s;++n){let s;const d=e[n];if(null!=d)if(void 0!==d.sel){c(d),s=o.remove.length+1;const t=i(d.elm,s);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 i,c,d,p,h,f,m,y;const _=null===(i=e.data)||void 0===i?void 0:i.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!==(p=t.data)&&void 0!==p||(t.data={});for(let n=0;n<o.update.length;++n)o.update[n](t,e);null===(m=null===(f=null===(h=e.data)||void 0===h?void 0:h.hook)||void 0===f?void 0:f.update)||void 0===m||m.call(f,t,e)}const g=t.children,b=e.children;void 0===e.text?void 0!==g&&void 0!==b?g!==b&&function(t,e,n,o){let i,c,d,p,h=0,f=0,m=e.length-1,y=e[0],_=e[m],v=n.length-1,g=n[0],b=n[v];for(;h<=m&&f<=v;)null==y?y=e[++h]:null==_?_=e[--m]:null==g?g=n[++f]:null==b?b=n[--v]:Ze(y,g)?(u(y,g,o),y=e[++h],g=n[++f]):Ze(_,b)?(u(_,b,o),_=e[--m],b=n[--v]):Ze(y,b)?(u(y,b,o),r.insertBefore(t,y.elm,r.nextSibling(_.elm)),y=e[++h],b=n[--v]):Ze(_,g)?(u(_,g,o),r.insertBefore(t,_.elm,y.elm),_=e[--m],g=n[++f]):(void 0===i&&(i=Ke(e,h,m)),c=i[g.key],void 0===c?(r.insertBefore(t,s(g,o),y.elm),g=n[++f]):void 0===i[b.key]?(r.insertBefore(t,s(b,o),r.nextSibling(_.elm)),b=n[--v]):(d=e[c],d.sel!==g.sel?r.insertBefore(t,s(g,o),y.elm):(u(d,g,o),e[c]=void 0,r.insertBefore(t,d.elm,y.elm)),g=n[++f]));f<=v&&(p=null==n[v+1]?null:n[v+1].elm,a(t,p,n,f,v,o)),h<=m&&l(t,e,h,m)}(v,g,b,n):void 0!==b?(void 0!==t.text&&r.setTextContent(v,""),a(v,null,b,0,b.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,i,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=Be(void 0,{},[],void 0,t)):t=function(t){const e=t.id?"#"+t.id:"",n=t.getAttribute("class"),o=n?"."+n.split(" ").join("."):"";return Be(r.tagName(t).toLowerCase()+e+o,{},[],void 0,t)}(t),Ze(t,e)?u(t,e,c):(i=t.elm,a=r.parentNode(i),s(e,c),null!==a&&(r.insertBefore(a,e.elm,r.nextSibling(i)),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 en(t,e){var n;const o=void 0!==e?e:qe;let r;if(o.isElement(t)){const r=t.id?"#"+t.id:"",s=null===(n=t.getAttribute("class"))||void 0===n?void 0:n.match(/[^\t\r\n\f ]+/g),a=s?"."+s.join("."):"",c=o.tagName(t).toLowerCase()+r+a,l={},u={},d={},p=[];let h,f,m;const y=t.attributes,_=t.childNodes;for(f=0,m=y.length;f<m;f++)h=y[f].nodeName,h.startsWith("data-")?u[(i=h,i.slice(5).replace(/-([a-z])/g,((t,e)=>e.toUpperCase())))]=y[f].nodeValue||"":"id"!==h&&"class"!==h&&(l[h]=y[f].nodeValue);for(f=0,m=_.length;f<m;f++)p.push(en(_[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]||Ve(d,p,c),Be(c,d,p,void 0,t)}return o.isText(t)?(r=o.getTextContent(t),Be(void 0,void 0,void 0,r,t)):o.isComment(t)?(r=o.getTextContent(t),Be("!",{},[],r,t)):Be("",{},[],void 0,t);var i}function nn(t,e){let n,o;const r=e.elm;let i=t.data.class,s=e.data.class;if((i||s)&&i!==s){for(o in i=i||{},s=s||{},i)i[o]&&!Object.prototype.hasOwnProperty.call(s,o)&&r.classList.remove(o);for(o in s)n=s[o],n!==i[o]&&r.classList[n?"add":"remove"](o)}}const on={create:nn,update:nn};function rn(t,e){let n,o,r;const i=e.elm;let s=t.data.props,a=e.data.props;if((s||a)&&s!==a)for(n in s=s||{},a=a||{},a)o=a[n],r=s[n],r===o||"value"===n&&i[n]===o||(i[n]=o)}const sn={create:rn,update:rn};function an(t,e){let n;const o=e.elm;let r=t.data.attrs,i=e.data.attrs;if((r||i)&&r!==i){for(n in r=r||{},i=i||{},i){const t=i[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 i||o.removeAttribute(n)}}const cn={create:an,update:an},ln=/[A-Z]/g;function un(t,e){const n=e.elm;let o,r=t.data.dataset,i=e.data.dataset;if(!r&&!i)return;if(r===i)return;r=r||{},i=i||{};const s=n.dataset;for(o in r)o in i||(s?o in s&&delete s[o]:n.removeAttribute("data-"+o.replace(ln,"-$&").toLowerCase()));for(o in i)r[o]!==i[o]&&(s?s[o]=i[o]:n.setAttribute("data-"+o.replace(ln,"-$&").toLowerCase(),i[o]))}const dn={create:un,update:un};function pn(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 hn(t){const e=t.data;pn(e.fn.apply(void 0,e.args),t)}function fn(t,e){const n=t.data,o=e.data;let r;const i=n.args,s=o.args;for(n.fn===o.fn&&i.length===s.length||pn(o.fn.apply(void 0,s),e),r=0;r<s.length;++r)if(i[r]!==s[r])return void pn(o.fn.apply(void 0,s),e);pn(t,e)}function mn(t,e,n=!1,o=!1,r=!1){let i=null;return re.create({start:function(s){i=o?function(t){_n(t,o),s.next(t)}:function(t){s.next(t)},t.addEventListener(e,i,{capture:n,passive:r})},stop:function(){t.removeEventListener(e,i,n),i=null}})}function yn(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(!yn(t[o],e[o]))return!1}else if(t[o]!==e[o])return!1}return!0}function _n(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");yn(e,t)&&t.preventDefault()}}function vn(t){return t.value=function(e){return vn(t.map((t=>{const n=t?.target?.value;return e?e(n):n})))},t.checked=function(e){return vn(t.map((t=>{const n=!!t?.target?.checked;return e?e(n):n})))},t.data=function(e,n){return vn(t.map((t=>{const o=t?.target instanceof Element?t.target.closest(`[data-${e}]`)||t.target:t?.target,r=o?.dataset?.[e];return n?n(r):r})))},t.target=function(e){return vn(t.map((t=>{const n=t?.target;return e?e(n):n})))},t.key=function(e){return vn(t.map((t=>{const n=t?.key;return e?e(n):n})))},t}class gn{constructor(t,e){this._name=t,this._selector=e||null}select(t){return new gn(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=mn(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=vn(ue(o));return r._isCycleSource=this._name,r}}class bn{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=mn(document.body,t,e.useCapture,e.preventDefault);const r=ue(o);return r._isCycleSource=this._name,r}}function wn(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 Sn(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 An(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 En{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||!An(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 On{constructor(t,e){this.namespace=t,this.isolateModule=e}call(){const t=this.namespace,e=Sn(t),n=new En(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 Nn(t){return{type:(e=t,e.length>1&&("."===e[0]||"#"===e[0])?"sibling":"total"),scope:t};var e}class Cn{constructor(t,e,n=[],o,r,i){var s;this._rootElement$=t,this._sanitation$=e,this._namespace=n,this._isolateModule=o,this._eventDelegator=r,this._name=i,this.isolateSource=(t,e)=>new Cn(t._rootElement$,t._sanitation$,t._namespace.concat(Nn(e)),t._isolateModule,t._eventDelegator,t._name),this.isolateSink=(s=this._namespace,(t,e)=>":root"===e?t:t.map((t=>{if(!t)return t;const n=Nn(e),o={...t,data:{...t.data,isolate:t.data&&Array.isArray(t.data.isolate)?t.data.isolate:s.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 On(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 gn(this._name);if("body"===t)return new bn(this._name);const e=":root"===t?[]:this._namespace.concat({type:"selector",scope:t.trim()});return new Cn(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=vn(ue(this._eventDelegator.addEventListener(t,this._namespace,e,n)));return o._isCycleSource=this._name,o}dispose(){this._sanitation$.shamefullySendNext(null)}}var $n={},Tn=n&&n.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var o=Array(t),r=0;for(e=0;e<n;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,r++)o[r]=i[s];return o};Object.defineProperty($n,"__esModule",{value:!0}),$n.SampleCombineOperator=$n.SampleCombineListener=void 0;var xn=r,kn={},Ln=function(){function t(t,e){this.i=t,this.p=e,e.ils[t]=this}return t.prototype._n=function(t){var e=this.p;e.out!==kn&&e.up(t,this.i)},t.prototype._e=function(t){this.p._e(t)},t.prototype._c=function(){this.p.down(this.i,this)},t}();$n.SampleCombineListener=Ln;var jn,Dn=function(){function t(t,e){this.type="sampleCombine",this.ins=t,this.others=e,this.out=kn,this.ils=[],this.Nn=0,this.vals=[]}return t.prototype._start=function(t){this.out=t;for(var e=this.others,n=this.Nn=e.length,o=this.vals=new Array(n),r=0;r<n;r++)o[r]=kn,e[r]._add(new Ln(r,this));this.ins._add(this)},t.prototype._stop=function(){var t=this.others,e=t.length,n=this.ils;this.ins._remove(this);for(var o=0;o<e;o++)t[o]._remove(n[o]);this.out=kn,this.vals=[],this.ils=[]},t.prototype._n=function(t){var e=this.out;e!==kn&&(this.Nn>0||e._n(Tn([t],this.vals)))},t.prototype._e=function(t){var e=this.out;e!==kn&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==kn&&t._c()},t.prototype.up=function(t,e){var n=this.vals[e];this.Nn>0&&n===kn&&this.Nn--,this.vals[e]=t},t.prototype.down=function(t,e){this.others[t]._remove(e)},t}();$n.SampleCombineOperator=Dn,jn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return new xn.Stream(new Dn(e,t))}};var In=$n.default=jn;function Mn(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,i=o>0?o:e.length;return{tagName:-1!==n||-1!==o?e.slice(0,Math.min(r,i)):e,id:r<i?e.slice(r+1,i):void 0,className:o>0?e.slice(i+1).replace(/\./g," "):void 0}}class Pn{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}=Mn(t),o=function(t){let{className:e=""}=Mn(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:i=n}=r;return"string"==typeof i&&i.toUpperCase()===this.rootElement.id.toUpperCase()&&e.toUpperCase()===this.rootElement.tagName.toUpperCase()&&o.toUpperCase()===this.rootElement.className.toUpperCase()?t:this.wrap([t])}wrapDocFrag(t){return Be("",{isolate:[]},t,void 0,this.rootElement)}wrap(t){const{tagName:e,id:n,className:o}=this.rootElement,r=n?`#${n}`:"",i=o?`.${o.split(" ").join(".")}`:"",s=He(`${e.toLowerCase()}${r}${i}`,{},t);return s.data=s.data||{},s.data.isolate=s.data.isolate||[],s}}const Rn="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||setTimeout,Fn=t=>{Rn((()=>{Rn(t)}))};let Bn=!1;function Gn(t,e,n){Fn((()=>{t[e]=n}))}function Un(t,e){let n,o;const r=e.elm;let i=t.data.style,s=e.data.style;if(!i&&!s)return;if(i===s)return;i=i||{},s=s||{};const a="delayed"in i;for(o in i)o in s||("-"===o[0]&&"-"===o[1]?r.style.removeProperty(o):r.style[o]="");for(o in s)if(n=s[o],"delayed"===o&&s.delayed)for(const t in s.delayed)n=s.delayed[t],a&&n===i.delayed[t]||Gn(r.style,t,n);else"remove"!==o&&n!==i[o]&&("-"===o[0]&&"-"===o[1]?r.style.setProperty(o,n):r.style[o]=n)}const Vn={pre:function(){Bn=!1},create:Un,update:Un,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;Bn||(t.elm.offsetLeft,Bn=!0);const r=t.elm;let i=0;const s=n.remove;let a=0;const c=[];for(o in s)c.push(o),r.style[o]=s[o];const l=getComputedStyle(r)["transition-property"].split(", ");for(;i<l.length;++i)-1!==c.indexOf(l[i])&&a++;r.addEventListener("transitionend",(t=>{t.target===r&&--a,0===a&&e()}))}},Hn=[Vn,on,sn,cn,dn];class Wn{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 i=o[1][r];if(!i){if(!e)return;i=[void 0,{}],o[1][r]=i}o=i}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 zn{constructor(){this.namespaceTree=new Wn((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,i=r.isolate;Array.isArray(i)&&t.insertElement(i,o)},update(e,n){const{elm:o,data:r={}}=e,{elm:i,data:s={}}=n,a=r.isolate,c=s.isolate;An(a,c)||Array.isArray(a)&&t.removeElement(o),Array.isArray(c)&&t.insertElement(c,i)},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 Yn{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 qn=["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 Jn{constructor(t,e){this.rootElement$=t,this.isolateModule=e,this.virtualListeners=new Wn((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 i;const s=new En(e,this.isolateModule);if(void 0===o?-1===qn.indexOf(t):o)return this.domListeners.has(t)||this.setupDOMListener(t,!!n.passive),i=this.insertListener(r,s,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,i,s]=n;return t===r&&An(i.namespace,e)};for(;!a&&c<l;){const t=o[c];a=u(t)?t:a,c++}let d,p=a;if(p){const[t]=p;d=t}else{const o=new On(e,this.isolateModule);i=this.insertListener(r,s,t,n),p=[r,t,o,i],d=r,this.nonBubblingListenersToAdd.add(p),this.setupNonBubblingListener(p)}const h=this;let f=null;return ce.create({start:t=>{f=d.subscribe(t)},stop:()=>{const[t,e,n,o]=p;n.call().forEach((function(t){const n=t.subs;n&&n[e]&&(n[e].unsubscribe(),delete n[e])})),h.nonBubblingListenersToAdd.delete(p),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=[],i=e._namespace;let s=i.length;do{r.push(this.getVirtualListeners(n,i,!0,s)),s--}while(s>=0&&"total"!==i[s].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,i.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 i=this.virtualListeners.getDefault(e,(()=>new Map),r);return i.has(t)||i.set(t,new Yn),i.get(t)}setupDOMListener(t,e){if(this.origin){const n=mn(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 i=o.call();if(i.length){const t=this;i.forEach((e=>{const o=e.subs;if(!o||!o[n]){const i=mn(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 s=t.nonBubblingListeners.get(n);if(!s)return;s.set(e,{sub:i,destination:r}),e.subs={...o,[n]:i}}}))}}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 i=r.get(e);i&&i.destination.passive===o&&i.destination.useCapture===n&&(this.virtualNonBubblingListener[0]=i.destination)}onEvent(t,e,n,o=!0){const r=this.patchEvent(e),i=this.isolateModule.getRootElement(e.target);if(o){const o=this.isolateModule.getNamespace(e.target);if(!o)return;const s=this.getVirtualListeners(t,o);this.bubble(t,e.target,i,r,s,o,o.length-1,!0,n),this.bubble(t,e.target,i,r,s,o,o.length-1,!1,n)}else this.putNonBubblingListener(t,e.target,!0,n),this.doBubbleStep(t,e.target,i,r,this.virtualNonBubblingListener,!0,n),this.putNonBubblingListener(t,e.target,!1,n),this.doBubbleStep(t,e.target,i,r,this.virtualNonBubblingListener,!1,n),e.stopPropagation()}bubble(t,e,n,o,r,i,s,a,c){a||o.propagationHasBeenStopped||this.doBubbleStep(t,e,n,o,r,a,c);let l=n,u=s;if(e===n){if(!(s>=0&&"sibling"===i[s].type))return;l=this.isolateModule.getElement(i,s),u--}e.parentNode&&l&&this.bubble(t,e.parentNode,l,o,r,i,u,a,c),a&&!o.propagationHasBeenStopped&&this.doBubbleStep(t,e,n,o,r,a,c)}doBubbleStep(t,e,n,o,r,i,s){n&&(this.mutateEventCurrentTarget(o,e),r.forEach((t=>{if(t.passive===s&&t.useCapture===i){const r=Sn(t.scopeChecker.namespace);!o.propagationHasBeenStopped&&t.scopeChecker.isDirectlyInScope(e)&&(""!==r&&e.matches(r)||""===r&&e===n)&&(_n(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 Zn(t){return ce.merge(t,ce.never())}function Xn(t){return t.elm}function Kn(t){(console.error||console.log)(t)}function Qn(t,e={}){wn(t);const n=e.modules||Hn;!function(t){if(!Array.isArray(t))throw new Error("Optional modules option must be an array for snabbdom modules")}(n);const o=new zn,r=e&&e.snabbdomOptions||void 0,i=tn([o.createModule()].concat(n),void 0,r),s=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=s.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 Pn(e),e})),p=n.remember();p.addListener({}),l.addListener({});const h=d.map((t=>ce.merge(p.endWhen(u),u).map((t=>a.call(t))).startWith(function(t){return t.data=t.data||{},t.data.isolate=[],t}(en(t))).fold(i,en(t)).drop(1).map(Xn).startWith(t).map((t=>(c.observe(t,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),t))).compose(Zn))).flatten(),f=Pe(s,l).endWhen(u).compose(In(h)).map((t=>t[1])).remember();f.addListener({error:e.reportSnabbdomError||Kn});const m=new Jn(f,o);return new Cn(f,u,[],o,m,r)}}const to="___";class eo{constructor(t){this._mockConfig=t,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=ue(this._mockConfig[t]||ce.empty());return o._isCycleSource="MockedDOM",o}select(t){const e=this._mockConfig[t]||{};return new eo(e)}isolateSource(t,e){return t.select("."+to+e)}isolateSink(t,e){return ue(ce.fromObservable(t).map((t=>(t.sel&&-1!==t.sel.indexOf(to+e)||(t.sel+=`.${to}${e}`),t))))}}function no(t){return new eo(t)}let oo=0;function ro(t,e,n={}){if("function"!=typeof t)throw new Error("collection: first argument (component) must be a function");const{combineList:o=["DOM"],globalList:r=["EVENTS"],stateSourceName:i="STATE",domSourceName:s="DOM",container:a="div",containerClass:c}=n;return n=>{const l="sygnal-collection-"+oo++,u={item:t,itemKey:(t,e)=>void 0!==t.id?t.id:e,itemScope:t=>t,channel:i,collectSinks:t=>Object.entries(n).reduce(((e,[n])=>{if(o.includes(n)){const o=t.pickCombine(n);n===s&&a?e[s]=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={[i]:e};return r.forEach((t=>d[t]=null)),o.forEach((t=>d[t]=null)),function(t,e,n){return he(function(t){return function(e){const n=t.channel||"state",o=t.itemKey,r=t.itemScope||ke,i=ce.fromObservable(e[n].stream).fold(((i,s)=>{const a=i.dict;if(Array.isArray(s)){const i=Array(s.length),c=new Set;for(let l=0,u=s.length;l<u;++l){const u=`${o?o(s[l],l):l}`;if(c.add(u),a.has(u))i[l]=a.get(u);else{const c=o?Le(o,u):`${l}`,d=r(u),p="string"==typeof d?{"*":d,[n]:c}:{...d,[n]:c},h=he(t.itemFactory?t.itemFactory(s[l],l):t.item,p)(e);a.set(u,h),i[l]=h}i[l]._key=u}return a.forEach(((t,e)=>{c.has(e)||(t&&"function"==typeof t.__dispose&&t.__dispose(),a.delete(e))})),c.clear(),{dict:a,arr:i}}{a.forEach((t=>{t&&"function"==typeof t.__dispose&&t.__dispose()})),a.clear();const i=`${o?o(s,0):"this"}`,c=je,l=r(i),u="string"==typeof l?{"*":l,[n]:c}:{...l,[n]:c},d=he(t.itemFactory?t.itemFactory(s,0):t.item,u)(e);return a.set(i,d),{dict:a,arr:[d]}}}),{dict:new Map,arr:[]});return t.collectSinks(new xe(i))}}(t),e)(n)}(u,d,n)}}const io=t=>{const{children:e,...n}=t;return He("collection",{props:n},e)};function so(t){return t&&t.default&&t.default.default&&"function"==typeof t.default.default?t.default.default:t&&t.default?t.default:t}io.label="collection",io.preventInstantiation=!0;const ao=function(t){const e=so(t);return e&&e.default&&"function"==typeof e.default.create?e.default:e}(le),co=re||ce&&ce.Stream||ao&&ao.Stream,lo=so(be);function uo(t,e,n,o={}){const{switched:r=["DOM"],stateSourceName:i="STATE"}=o,s=typeof e;if(!e)throw new Error("Missing 'name$' parameter for switchable()");if(!("string"===s||"function"===s||e instanceof co))throw new Error("Invalid 'name$' parameter for switchable(): expects Stream, String, or Function");if(e instanceof co){const o=e.compose(lo()).startWith(n).remember();return e=>po(t,e,o,r)}{const o="function"===s&&e||(t=>t[e]);return e=>{const s=e&&("string"==typeof i&&e[i]||e.STATE||e.state).stream;if(!(s instanceof co))throw new Error(`Could not find the state source: ${i}`);const a=s.map(o).filter((t=>"string"==typeof t)).compose(lo()).startWith(n).remember();return po(t,e,a,r,i)}}}function po(t,e,n,o=["DOM"],r="STATE"){"string"==typeof o&&(o=[o]);const i=Object.entries(t).map((([t,o])=>{if(e[r]){const i=e[r].stream,s=ao.combine(n,i).filter((([e])=>e==t)).map((([,t])=>t)).remember(),a=new e[r].constructor(s,e[r]._name);return[t,o({...e,state:a})]}return[t,o(e)]}));return Object.keys(e).reduce(((t,e)=>{if(o.includes(e))t[e]=n.map((t=>{const n=i.find((([e])=>e===t));return n&&n[1][e]||ao.never()})).flatten().remember().startWith(void 0);else{const n=i.filter((([,t])=>void 0!==t[e])).map((([,t])=>t[e]));t[e]=ao.merge(...n)}return t}),{})}const ho=t=>{const{children:e,...n}=t;return He("switchable",{props:n},e)};function fo(t){return{select:e=>t._stream.filter((t=>t.type===e)).map((t=>t.data))}}ho.label="switchable",ho.preventInstantiation=!0;var mo={};Object.defineProperty(mo,"__esModule",{value:!0});var yo=r,_o=function(){function t(t,e){this.dt=t,this.ins=e,this.type="delay",this.out=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null},t.prototype._n=function(t){var e=this.out;if(e)var n=setInterval((function(){e._n(t),clearInterval(n)}),this.dt)},t.prototype._e=function(t){var e=this.out;if(e)var n=setInterval((function(){e._e(t),clearInterval(n)}),this.dt)},t.prototype._c=function(){var t=this.out;if(t)var e=setInterval((function(){t._c(),clearInterval(e)}),this.dt)},t}();var vo=mo.default=function(t){return function(e){return new yo.Stream(new _o(t,e))}},go=e({__proto__:null,default:vo},[mo]),bo={};Object.defineProperty(bo,"__esModule",{value:!0});var wo=r,So=function(){function t(t,e){this.dt=t,this.ins=e,this.type="debounce",this.out=null,this.id=null,this.t=wo.NO}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.clearInterval()},t.prototype.clearInterval=function(){var t=this.id;null!==t&&clearInterval(t),this.id=null},t.prototype._n=function(t){var e=this,n=this.out;n&&(this.clearInterval(),this.t=t,this.id=setInterval((function(){e.clearInterval(),n._n(t),e.t=wo.NO}),this.dt))},t.prototype._e=function(t){var e=this.out;e&&(this.clearInterval(),e._e(t))},t.prototype._c=function(){var t=this.out;t&&(this.clearInterval(),this.t!=wo.NO&&t._n(this.t),this.t=wo.NO,t._c())},t}();var Ao=bo.default=function(t){return function(e){return new wo.Stream(new So(t,e))}},Eo=e({__proto__:null,default:Ao},[bo]);const Oo=so(go),No=so(Re),Co=so(Eo),$o=so(be),To="undefined"!=typeof window&&window||"undefined"!=typeof process&&process.env||{},xo="BOOTSTRAP",ko="INITIALIZE",Lo="PARENT",jo="READY",Do="EFFECT";let Io=0;const Mo=Symbol("ABORT");function Po(t,e){if("function"==typeof e)return{fn:e,deps:null};if(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&"function"==typeof e[1])return{fn:e[1],deps:e[0]};throw new Error(`Invalid calculated field '${t}': expected a function or [depsArray, function]`)}function Ro(t){const{name:e,sources:n,isolateOpts:o,stateSourceName:r="STATE"}=t;if(n&&!tr(n))throw new Error(`[${e}] Sources must be a Cycle.js sources object`);let i;i="string"==typeof o?{[r]:o}:!0===o?{}:o;const s=void 0===n;let a;if(tr(i)){const e=e=>{const n={...t,sources:e},o=new Fo(n);return o.sinks.__dispose=()=>o.dispose(),o.sinks};a=s?he(e,i):he(e,i)(n)}else if(s)a=e=>{const n=new Fo({...t,sources:e});return n.sinks.__dispose=()=>n.dispose(),n.sinks};else{const e=new Fo(t);e.sinks.__dispose=()=>e.dispose(),a=e.sinks}return a.componentName=e,a.isSygnalComponent=!0,a}class Fo{constructor({name:t="NO NAME",sources:e,intent:n,model:o,hmrActions:r,context:i,response:s,view:a,peers:c={},components:l={},initialState:u,calculated:d,storeCalculatedInState:p=!0,DOMSourceName:h="DOM",stateSourceName:f="STATE",requestSourceName:m="HTTP",onError:y,debug:_=!1}){if(!e||!tr(e))throw new Error(`[${t}] Missing or invalid sources`);if(this._componentNumber=Io++,this.name=t,this.sources=e,this.intent=n,this.model=o,this.hmrActions=r,this.context=i,this.response=s,this.view=a,this.peers=c,this.components=l,this.initialState=u,this.calculated=d,this.storeCalculatedInState=p,this.DOMSourceName=h,this.stateSourceName=f,this.requestSourceName=m,this.sourceNames=Object.keys(e),this.onError=y,this._debug=_,this.calculated&&this.initialState&&tr(this.calculated)&&tr(this.initialState))for(const e of Object.keys(this.calculated))e in this.initialState&&console.warn(`[${t}] Calculated field '${e}' shadows a key in initialState. The initialState value will be overwritten on every state update.`);if(this.calculated&&tr(this.calculated)){const e=Object.entries(this.calculated);this._calculatedNormalized={};for(const[t,n]of e)this._calculatedNormalized[t]=Po(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||console.warn(`[${t}] Calculated field '${e}' declares dependency '${o}' which is not in initialState or calculated fields`);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 i=[];for(const[t,e]of Object.entries(o))0===e&&i.push(t);const s=[];for(;i.length>0;){const t=i.shift();s.push(t);for(const e of r[t])o[e]--,0===o[e]&&i.push(e)}if(s.length!==this._calculatedFieldNames.size){const t=[...this._calculatedFieldNames].filter((t=>!s.includes(t))),e=new Set,o=[],r=i=>{if(e.has(i))return o.push(i),!0;e.add(i),o.push(i);for(const e of n[i])if(t.includes(e)&&r(e))return!0;return o.pop(),e.delete(i),!1};r(t[0]);const i=o[o.length-1],a=o.slice(o.indexOf(i));throw new Error(`Circular calculated dependency: ${a.join(" → ")}`)}this._calculatedOrder=s.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 v=e[f]&&e[f].stream;this.currentSlots={},v&&(this.currentState=u||{},this.sources[f]=new Oe(v.map((t=>(this.currentState=t,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onStateChanged(this._componentNumber,this.name,t),t))),f));const g=e.props$;g&&(this.sources.props$=g.map((t=>{const{sygnalFactory:e,sygnalOptions:n,...o}=t;return this.currentProps=o,t})));const b=e.children$;var w;if(b&&(this.sources.children$=b.map((t=>{if(Array.isArray(t)){const{slots:e,defaultChildren:n}=rr(t);this.currentSlots=e,this.currentChildren=n}else this.currentSlots={},this.currentChildren=t;return t}))),this.sources[h]&&(this.sources[h]=(w=this.sources[h],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__:ao.never()}),this.model={__NOOP_ACTION__:t=>t}),this._subscriptions=[],this._activeSubComponents=new Map,this._childReadyState={},this._readyChangedListener=null,this._readyChanged$=ao.create({start:t=>{this._readyChangedListener=t},stop:()=>{}}),this._disposeListener=null,this._dispose$=ao.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._disposeListener){try{this._disposeListener.next(!0),this._disposeListener.complete()}catch(t){}this._disposeListener=null}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=[],this._activeSubComponents.forEach((t=>{t?.sink$?.__dispose&&t.sink$.__dispose()})),this._activeSubComponents.clear()}),0)}get debug(){return this._debug||"true"===To.SYGNAL_DEBUG||!0===To.SYGNAL_DEBUG}initIntent$(){if(this.intent){if("function"!=typeof this.intent)throw new Error(`[${this.name}] Intent must be a function`);if(this.intent$=this.intent(this.sources),!(this.intent$ instanceof co||tr(this.intent$)))throw new Error(`[${this.name}] Intent must return either an action$ stream or map of event streams`)}}initHmrActions(){if(void 0!==this.hmrActions){if("string"==typeof this.hmrActions&&(this.hmrActions=[this.hmrActions]),!Array.isArray(this.hmrActions))throw new Error(`[${this.name}] hmrActions must be the name of an action or an array of names of actions to run when a component is hot-reloaded`);if(this.hmrActions.some((t=>"string"!=typeof t)))throw new Error(`[${this.name}] hmrActions must be the name of an action or an array of names of actions to run when a component is hot-reloaded`);this.hmrAction$=ao.fromArray(this.hmrActions.map((t=>({type:t}))))}else this.hmrAction$=ao.of().filter((t=>!1))}initAction$(){const t=this.sources&&this.sources[this.requestSourceName]||null;if(!this.intent$)return void(this.action$=ao.never());let e;if(this.intent$ instanceof co)e=this.intent$;else{for(const t of Object.keys(this.intent$))if(t.includes("|"))throw new Error(`[${this.name}] Intent action name '${t}' contains '|', which is reserved for the model shorthand syntax (e.g., 'ACTION | DRIVER'). Rename this action.`);const t=Object.entries(this.intent$).map((([t,e])=>e.map((e=>({type:t,data:e})))));e=ao.merge(ao.never(),...t)}const n=e instanceof co?e:e.apply&&e(this.sources)||ao.never(),o=ao.of({type:xo}).compose(Oo(10)),r="undefined"!=typeof window&&!0===window.__SYGNAL_HMR_UPDATING,i=r?this.hmrAction$:ao.of().filter((t=>!1)),s=this.model[xo]&&!r?No(o,n):No(ao.of().compose(Oo(1)).filter((t=>!1)),i,n);let a;a=!r&&t&&"function"==typeof t.select?t.select("initial").flatten():ao.never();const c=a.map((t=>({type:"HYDRATE",data:t})));this.action$=ao.merge(s,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[ko]?this.model[ko]={[this.stateSourceName]:(t,e)=>({...this.addCalculated(e)})}:tr(this.model[ko])&&Object.keys(this.model[ko]).forEach((t=>{t!==this.stateSourceName&&(console.warn(`${ko} can only be used with the ${this.stateSourceName} source... disregarding ${t}`),delete this.model[ko][t])})))}initContext(){if(!this.context&&!this.sources.__parentContext$)return void(this.context$=ao.of({}));const t=this.sources[this.stateSourceName]?.stream.startWith({}).compose($o(Ko))||ao.never(),e=this.sources.__parentContext$?.startWith({}).compose($o(Ko))||ao.of({});this.context&&!tr(this.context)&&console.error(`[${this.name}] Context must be an object mapping names to values of functions: ignoring provided ${typeof this.context}`),this.context$=ao.combine(t,e).map((([t,e])=>{const n=tr(e)?e:{},o=tr(this.context)?this.context:{},r=this.currentState,i={...n,...Object.entries(o).reduce(((t,e)=>{const[n,o]=e;let i;const s=typeof o;if("string"===s)i=r[o];else if("boolean"===s)i=r[n];else{if("function"!==s)return console.error(`[${this.name}] Invalid context entry '${n}': must be the name of a state property or a function returning a value to use`),t;i=o(r)}return t[n]=i,t}),{})};return this.currentContext=i,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onContextChanged(this._componentNumber,this.name,i),i})).compose($o(Ko)).startWith({}),this._subscriptions.push(this.context$.subscribe({next:t=>t,error:t=>console.error(`[${this.name}] Error in context stream:`,t)}))}initModel$(){if(void 0===this.model)return void(this.model$=this.sourceNames.reduce(((t,e)=>(t[e]=ao.never(),t)),{}));const t=To?.__SYGNAL_HMR_STATE,e=void 0!==t?t:this.initialState,n={type:ko,data:e};this.isSubComponent&&this.initialState&&console.warn(`[${this.name}] Initial state provided to sub-component. This will overwrite any state provided by the parent component.`);const o=void 0!==e&&(!0!==To?.__SYGNAL_HMR_UPDATING||void 0!==t)?No(ao.of(n),this.action$).compose(Oo(0)):this.action$,r=()=>this.makeOnAction(o,!0,this.action$),i=()=>this.makeOnAction(this.action$,!1,this.action$),s=Object.entries(this.model),a={},c=new Set;s.forEach((t=>{let[e,n]=t;if(e.includes("|")){const t=e.split("|").map((t=>t.trim()));if(2!==t.length||!t[0]||!t[1])throw new Error(`[${this.name}] Invalid shorthand model entry '${e}'. Expected 'ACTION | DRIVER' format.`);e=t[0],n={[t[1]]:n}}if("function"==typeof n&&(n={[this.stateSourceName]:n}),!tr(n))throw new Error(`[${this.name}] Entry for each action must be an object: ${e}`);Object.entries(n).forEach((t=>{const[n,o]=t,s=`${e}::${n}`;if(c.has(s)&&console.warn(`[${this.name}] Duplicate model entry for action '${e}' on sink '${n}'. Only the last definition will take effect.`),c.add(s),n===Do){const t=this.makeEffectHandler(this.action$,e,o);return void(Array.isArray(a[n])?a[n].push(t):a[n]=[t])}const l=n===this.stateSourceName,u=n===Lo,d=l?r():i(),p=(u?d(e,o).map((t=>({name:this.name,component:this.view,value:t}))):d(e,o)).compose(this.log((t=>{if(l)return`<${e}> State reducer added`;if(u)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(a[n])?a[n].push(p):a[n]=[p]}))}));const l=Object.entries(a).reduce(((t,e)=>{const[n,o]=e;return t[n]=ao.merge(ao.never(),...o),t}),{});this.model$=l}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=ao.create({start:e=>{t=e.next.bind(e)},stop:t=>{}}).map((t=>ao.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=ao.create({start:t=>{this.newSubComponentSinks=t.next.bind(t)},stop:t=>{}});this._subscriptions.push(t.subscribe({next:t=>t,error:t=>console.error(`[${this.name}] Error in sub-component sink stream:`,t)})),this.subComponentSink$=t.filter((t=>Object.keys(t).length>0))}initSubComponentsRendered$(){const t=ao.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$=ao.of(null));const t=this.collectRenderParameters();this.vdom$=t.map((t=>{const{props:e,state:n,children:o,slots:r,context:i,...s}=t,{sygnalFactory:a,sygnalOptions:c,...l}=e||{};try{return this.view({...l,state:n,children:o,slots:r||{},context:i,peers:s},n,i,s)}catch(t){const e=t instanceof Error?t:new Error(String(t));if(console.error(`[${this.name}] Error in view:`,e),"function"==typeof this.onError)try{return this.onError(e,{componentName:this.name})}catch(t){console.error(`[${this.name}] Error in onError handler:`,t)}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=>qo(t,this))).map(zo).map(Yo).compose(this.instantiateSubComponents.bind(this)).filter((t=>void 0!==t)).compose(this.renderVdom.bind(this))}initSinks(){if(this.sinks=this.sourceNames.reduce(((t,e)=>{if(e==this.DOMSourceName)return t;const n=this.subComponentSink$&&e!==Lo?this.subComponentSink$.map((t=>t[e])).filter((t=>!!t)).flatten():ao.never();return e===this.stateSourceName?t[e]=ao.merge(this.model$[e]||ao.never(),n,this.sources[this.stateSourceName].stream.filter((t=>!1)),...this.peers$[e]||[]):t[e]=ao.merge(this.model$[e]||ao.never(),n,...this.peers$[e]||[]),t}),{}),this.sinks[this.DOMSourceName]=this.vdom$,this.sinks[Lo]=this.model$[Lo]||ao.never(),this.model$[Do]){const t=this.model$[Do].subscribe({next:()=>{},error:t=>console.error(`[${this.name}] Uncaught error in EFFECT stream:`,t)});this._subscriptions.push(t),delete this.sinks[Do]}this.model&&tr(this.model)&&Object.values(this.model).some((t=>!(!tr(t)||!(jo in t))))?(this.sinks[jo]=this.model$[jo],this.sinks[jo].__explicitReady=!0):this.sinks[jo]=ao.of(!0)}makeOnAction(t,e=!0,n){return n=n||t,(o,r)=>{const i=t.filter((({type:t})=>t==o));let s;if("function"==typeof r)s=i.map((t=>{const i=(t,e,r=10)=>{if("number"!=typeof r)throw new Error(`[${this.name}] Invalid delay value provided to next() function in model action '${o}'. Must be a number in ms.`);setTimeout((()=>{n.shamefullySendNext({type:t,data:e})}),r),this.log(`<${o}> Triggered a next() action: <${t}> ${r}ms delay`,!0)},s={...this.currentProps,children:this.currentChildren,slots:this.currentSlots||{},context:this.currentContext};let a=t.data;if(e)return t=>{const e=this.isSubComponent?this.currentState:t;try{const t=this.addCalculated(e);s.state=t;const n=r(t,a,i,s);return n===Mo?e:this.cleanupCalculated(n)}catch(t){return console.error(`[${this.name}] Error in model reducer '${o}':`,t),e}};try{const t=this.addCalculated(this.currentState);s.state=t;const e=r(t,a,i,s),n=typeof e;if(tr(e)||["string","number","boolean","function"].includes(n))return e;if("undefined"===n)return console.warn(`[${this.name}] 'undefined' value sent to ${o}`),e;throw new Error(`[${this.name}] Invalid reducer type for action '${o}': ${n}`)}catch(t){return console.error(`[${this.name}] Error in model reducer '${o}':`,t),Mo}})).filter((t=>t!==Mo));else if(void 0===r||!0===r)s=i.map((({data:t})=>t));else{const t=r;s=i.mapTo(t)}return s}}makeEffectHandler(t,e,n){return t.filter((({type:t})=>t==e)).map((o=>{if("function"==typeof n){const r=(n,o,r=10)=>{if("number"!=typeof r)throw new Error(`[${this.name}] Invalid delay value provided to next() function in EFFECT handler '${e}'. Must be a number in ms.`);setTimeout((()=>{t.shamefullySendNext({type:n,data:o})}),r),this.log(`<${e}> EFFECT triggered a next() action: <${n}> ${r}ms delay`,!0)};try{const t=this.addCalculated(this.currentState),i={...this.currentProps,children:this.currentChildren,slots:this.currentSlots||{},context:this.currentContext,state:t};void 0!==n(t,o.data,r,i)&&console.warn(`[${this.name}] EFFECT handler '${e}' returned a value. EFFECT handlers are for side effects only — return values are ignored.`)}catch(t){console.error(`[${this.name}] Error in EFFECT handler '${e}':`,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;if(!tr(this.calculated))throw new Error(`[${this.name}] 'calculated' parameter must be an object mapping calculated state field names to functions`);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 i=this._calculatedFieldCache[t],s=r.map((t=>e[t]));if(void 0!==i.lastDepValues){let o=!0;for(let t=0;t<s.length;t++)if(s[t]!==i.lastDepValues[t]){o=!1;break}if(o){n[t]=i.lastResult,e[t]=i.lastResult;continue}}try{const r=o(e);i.lastDepValues=s,i.lastResult=r,n[t]=r,e[t]=r}catch(e){console.warn(`Calculated field '${t}' threw an error during calculation: ${e instanceof Error?e.message:e}`)}}else try{const r=o(e);n[t]=r,e[t]=r}catch(e){console.warn(`Calculated field '${t}' threw an error during calculation: ${e instanceof Error?e.message:e}`)}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||ao.never();if(e.state=o.compose($o(Ko)),this.sources.props$&&(e.props=this.sources.props$.compose($o(Xo))),this.sources.children$){const t=this.sources.children$.map((t=>{if(!Array.isArray(t))return{children:t,slots:{}};const{slots:e,defaultChildren:n}=rr(t);return{children:n,slots:e}}));e.children=t.map((t=>t.children)).compose($o(Ko)),e.slots=t.map((t=>t.slots)).compose($o(Ko))}this.context$&&(e.context=this.context$.compose($o(Ko)));const r=[],i=[];Object.entries(e).forEach((([t,e])=>{r.push(t),i.push(e)}));return ao.combine(...i).compose(Co(1)).map((t=>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)),{})))}instantiateSubComponents(t){return t.fold(((t,e)=>{const n=Bo(e,Object.keys(this.components)),o=Object.entries(n),r={"::ROOT::":e};if(0===o.length)return this._activeSubComponents.forEach((t=>{t?.sink$?.__dispose&&t.sink$.__dispose()})),this._activeSubComponents.clear(),r;const i={},s=[];let a=0;const c=o.reduce(((e,[n,o])=>{const r=o.data,c=r.props||{},l=o.children||[],u=r.isCollection||!1,d=r.isSwitchable||!1,p=t=>{Object.entries(t).forEach((([t,e])=>{i[t]||(i[t]=[]),t===Lo?s.push(e):t!==this.DOMSourceName&&t!==jo&&i[t].push(e)}))};if(t[n]){const o=t[n];return e[n]=o,o.props$.shamefullySendNext(c),o.children$.shamefullySendNext(l),p(o.sink$),e}const h=ao.create().startWith(c),f=ao.create().startWith(l);let m,y;m=u?this.instantiateCollection.bind(this):d?this.instantiateSwitchable.bind(this):this.instantiateCustomComponent.bind(this),a++;try{y=m(o,h,f)}catch(t){const e=t instanceof Error?t:new Error(String(t));console.error(`[${this.name}] Error instantiating sub-component:`,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){console.error(`[${this.name}] Error in onError handler:`,t)}y={[this.DOMSourceName]:ao.of(n)}}return y[this.DOMSourceName]=y[this.DOMSourceName]?this.makeCoordinatedSubComponentDomSink(y[this.DOMSourceName]):ao.never(),e[n]={sink$:y,props$:h,children$:f},this._activeSubComponents.set(n,e[n]),p(y),e}),r),l=Object.entries(i).reduce(((t,[e,n])=>(0===n.length||(t[e]=1===n.length?n[0]:ao.merge(...n)),t)),{}),u=new Set(Object.keys(c));return this._activeSubComponents.forEach(((t,e)=>{u.has(e)||(t?.sink$?.__dispose&&t.sink$.__dispose(),this._activeSubComponents.delete(e),delete this._childReadyState[e])})),this.newSubComponentSinks(l),this.newChildSources(s),a>0&&this.log(`New sub components instantiated: ${a}`,!0),c}),{})}makeCoordinatedSubComponentDomSink(t){const e=t.remember();return this.sources[this.stateSourceName].stream.compose($o(Ko)).map((t=>e)).flatten().debug((t=>this.triggerSubComponentsRendered())).remember()}instantiateCollection(t,e,n){const o=t.data.props||{};const r={filter:"function"==typeof o.filter?o.filter:void 0,sort:or(o.sort)},i=ao.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState),e.startWith(o)).compose(Co(1)).map((([t,e])=>(e.filter!==r.filter&&(r.filter="function"==typeof e.filter?e.filter:void 0),e.sort!==r.sort&&(r.sort=or(e.sort)),tr(t)?this.addCalculated(t):t))),s=new Oe(i,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:i,peers:s,components:a,initialState:l,calculated:u,storeCalculatedInState:p,DOMSourceName:h,stateSourceName:f,onError:m,debug:y}=c;d=Ro({name:t,view:e,model:n,intent:o,hmrActions:r,context:i,peers:s,components:a,initialState:l,calculated:u,storeCalculatedInState:p,DOMSourceName:h,stateSourceName:f,onError:m,debug:y})}else{if(!this.components[c])throw new Error(`[${this.name}] Invalid 'of' property in collection: ${c}`);d=this.components[c]}const p={get:t=>{if(!Array.isArray(t[a]))return[];const e=t[a],n="function"==typeof r.filter?e.filter(r.filter):e;return("function"==typeof r.sort?n.sort(r.sort):n).map(((t,e)=>tr(t)?{...t,[l]:t[l]||e}:{value:t,[l]:e}))},set:(t,e)=>{if(this.calculated&&a in this.calculated)return console.warn(`Collection sub-component of ${this.name} attempted to update state on a calculated field '${a}': Update ignored`),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}}};void 0===a?u={get:t=>!(t instanceof Array)&&t.value&&t.value instanceof Array?t.value:t,set:(t,e)=>e}:"string"==typeof a?tr(this.currentState)?this.currentState&&a in this.currentState||this.calculated&&a in this.calculated?(Array.isArray(this.currentState[a])||console.warn(`[${this.name}] State property '${a}' in collection component is not an array: No components will be instantiated in the collection.`),u=p):(console.error(`Collection component in ${this.name} is attempting to use non-existent state property '${a}': To fix this error, specify a valid array property on the state. Attempting to use parent component state.`),u=void 0):(Array.isArray(this.currentState[a])||console.warn(`[${this.name}] State property '${a}' in collection component is not an array: No components will be instantiated in the collection.`),u=p):tr(a)?"function"!=typeof a.get?(console.error(`Collection component in ${this.name} has an invalid 'from' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting child state from the current state. Attempting to use parent component state.`),u=void 0):u={get:t=>{const e=a.get(t);return Array.isArray(e)?e:(console.warn(`State getter function in collection component of ${this.name} did not return an array: No components will be instantiated in the collection. Returned value:`,e),[])},set:a.set}:(console.error(`Collection component in ${this.name} has an invalid 'from' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting child state from the current state. Attempting to use parent component state.`),u=void 0);const h=["of","from","filter","sort","idfield","className"],f=e.map((t=>{if(!t||"object"!=typeof t)return{};const e={};for(const n in t)h.includes(n)||(e[n]=t[n]);return e})),m={...this.sources,[this.stateSourceName]:s,props$:f,children$:n,__parentContext$:this.context$,PARENT:null,__parentComponentNumber:this._componentNumber},y=ro(d,u,{container:null})(m);if(!tr(y))throw new Error(`[${this.name}] Invalid sinks returned from component factory of collection element`);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)),i=new Oe(r,this.stateSourceName),s=o.state;let a;const c={get:t=>t,set:(t,e)=>e};void 0===s?a=c:"string"==typeof s?a={get:t=>t[s],set:(t,e)=>this.calculated&&s in this.calculated?(console.warn(`Switchable sub-component of ${this.name} attempted to update state on a calculated field '${s}': Update ignored`),t):!tr(e)||Array.isArray(e)?{...t,[s]:e}:{...t,[s]:e}}:tr(s)?"function"!=typeof s.get?(console.error(`Switchable component in ${this.name} has an invalid 'state' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting sub-component state from the current state. Attempting to use parent component state.`),a=c):a={get:s.get,set:s.set}:(console.error(`Invalid state provided to switchable sub-component of ${this.name}: Expecting string, object, or undefined, but found ${typeof s}. Attempting to use parent component state.`),a=c);const l=o.of;Object.keys(l).forEach((t=>{const e=l[t];if(!e.isSygnalComponent){const n=e.componentName||e.label||e.name||"FUNCTION_COMPONENT",o=e,{model:r,intent:i,hmrActions:s,context:a,peers:c,components:u,initialState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_}=e,v={name:n,view:o,model:r,intent:i,hmrActions:s,context:a,peers:c,components:u,initialState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_};l[t]=Ro(v)}}));const u={...this.sources,[this.stateSourceName]:i,props$:e,children$:n,__parentContext$:this.context$,__parentComponentNumber:this._componentNumber},d=he(uo(l,e.map((t=>t.current)),""),{[this.stateSourceName]:a})(u);if(!tr(d))throw new Error(`[${this.name}] Invalid sinks returned from component factory of switchable element`);return d}instantiateCustomComponent(t,e,n){const o=t.sel,r=t.data.props||{},i=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>tr(t)?this.addCalculated(t):t)),s=new Oe(i,this.stateSourceName),a=r.state;"function"!=typeof r.sygnalFactory&&tr(r.sygnalOptions)&&(r.sygnalFactory=Ro(r.sygnalOptions));const c="sygnal-factory"===o?r.sygnalFactory:this.components[o]||r.sygnalFactory;if(!c){if("sygnal-factory"===o)throw new Error("Component not found on element with Capitalized selector and nameless function: JSX transpilation replaces selectors starting with upper case letters with functions in-scope with the same name, Sygnal cannot see the name of the resulting component.");throw new Error(`Component not found: ${o}`)}const l=r.sygnalOptions?.initialState,u=r.sygnalOptions?.isolatedState;if(l&&!u){const t=r.sygnalOptions?.name||o;throw new Error(`[${t}] Sub-component has .initialState but no .isolatedState = true. This will overwrite parent state. If this is intentional, add .isolatedState = true to the component.`)}let d;const p=u?l:void 0,h={get:t=>{const e=t[a];return void 0===e&&p?p:e},set:(t,e)=>this.calculated&&a in this.calculated?(console.warn(`Sub-component of ${this.name} attempted to update state on a calculated field '${a}': Update ignored`),t):{...t,[a]:e}},f={get:t=>t,set:(t,e)=>e};void 0===a?d=f:"string"==typeof a?d=h:tr(a)?"function"!=typeof a.get?(console.error(`Sub-component in ${this.name} has an invalid 'state' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting sub-component state from the current state. Attempting to use parent component state.`),d=f):d={get:a.get,set:a.set}:(console.error(`Invalid state provided to sub-component of ${this.name}: Expecting string, object, or undefined, but found ${typeof a}. Attempting to use parent component state.`),d=f);const m={...this.sources,[this.stateSourceName]:s,props$:e,children$:n,__parentContext$:this.context$,__parentComponentNumber:this._componentNumber};for(const t of Object.keys(r)){const e=r[t];if(e&&e.__sygnalCommand){m.commands$=fo(e);break}}const y=he(c,{[this.stateSourceName]:d})(m);if(!tr(y)){throw new Error(`Invalid sinks returned from component factory: ${"sygnal-factory"===o?"custom element":o}`)}return y}renderVdom(t){return ao.combine(this.subComponentsRendered$,t,this._readyChanged$.startWith(null)).compose(Co(1)).map((([t,e])=>{const n=Object.keys(this.components),o=e["::ROOT::"],r=Object.entries(e).filter((([t])=>"::ROOT::"!==t));if(0===r.length)return ao.of(Ho(o));const i=[],s=r.map((([t,e])=>(i.push(t),e.sink$[this.DOMSourceName].startWith(void 0))));if(0===s.length)return ao.of(o);for(const[t,e]of r){if(void 0!==this._childReadyState[t])continue;const n=e.sink$[jo];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)},error:()=>{},complete:()=>{}})}else this._childReadyState[t]=!0}return ao.combine(...s).compose(Co(1)).map((t=>{const e=t.reduce(((t,e,n)=>(t[i[n]]=e,t)),{});return Ho(Go(Zo(o),e,n,"r",void 0,this._childReadyState))}))})).flatten().filter((t=>!!t)).remember()}}function Bo(t,e,n="r",o){var r;if(!t)return{};if(t.data?.componentsProcessed)return{};"r"===n&&(t.data.componentsProcessed=!0);const i=t.sel,s=i&&"collection"===i.toLowerCase(),a=i&&"switchable"===i.toLowerCase(),c=i&&["collection","switchable","sygnal-factory",...e].includes(i)||"function"==typeof t.data?.props?.sygnalFactory||tr(t.data?.props?.sygnalOptions),l=t.data&&t.data.props||{};t.data&&t.data.attrs;const u=t.children||[];let d={},p=o;if(c){if(p=Uo(t,n,o),s){if(!l.of)throw new Error("Collection element missing required 'component' property");if("string"!=typeof l.of&&"function"!=typeof l.of)throw new Error(`Invalid 'component' property of collection element: found ${typeof l.of} requires string or component factory function`);if("function"!=typeof l.of&&!e.includes(l.of))throw new Error(`Specified component for collection not found: ${l.of}`);void 0===l.from||"string"==typeof l.from||Array.isArray(l.from)||"function"==typeof l.from.get||console.warn(`No valid array found for collection ${"string"==typeof l.of?l.of:"function component"}: no collection components will be created`,l.from),t.data.isCollection=!0,(r=t.data).props||(r.props={})}else if(a){if(!l.of)throw new Error("Switchable element missing required 'of' property");if(!tr(l.of))throw new Error(`Invalid 'of' property of switchable element: found ${typeof l.of} requires object mapping names to component factories`);if(!Object.values(l.of).every((t=>"function"==typeof t)))throw new Error("One or more components provided to switchable element is not a valid component factory");if(!l.current||"string"!=typeof l.current&&"function"!=typeof l.current)throw new Error(`Missing or invalid 'current' property for switchable element: found '${typeof l.current}' requires string or function`);if(!Object.keys(l.of).includes(l.current))throw new Error(`Component '${l.current}' not found in switchable element`);t.data.isSwitchable=!0}void 0===l.key&&(t.data.props.key=p),d[p]=t}return u.length>0&&u.map(((t,o)=>Bo(t,e,`${n}.${o}`,p))).forEach((t=>{Object.entries(t).forEach((([t,e])=>d[t]=e))})),d}function Go(t,e,n,o="r",r,i){if(!t)return;if(t.data?.componentsInjected)return t;"r"===o&&t.data&&(t.data.componentsInjected=!0);const s=t.sel||"NO SELECTOR",a=["collection","switchable","sygnal-factory",...n].includes(s)||"function"==typeof t.data?.props?.sygnalFactory||tr(t.data?.props?.sygnalOptions),c=t?.data?.isCollection;t.data&&t.data.props;const l=t.children||[];let u=r;if(a){u=Uo(t,o,r);let n=e[u];return i&&u&&n&&"object"==typeof n&&n.sel&&(n.data=n.data||{},n.data.attrs=n.data.attrs||{},n.data.attrs["data-sygnal-ready"]=!1!==i[u]?"true":"false"),c?(t.sel="div",t.children=Array.isArray(n)?n:[n],t):n}return l.length>0?(t.children=l.map(((t,r)=>Go(t,e,n,`${o}.${r}`,u,i))).flat(),t):t}function Uo(t,e,n){const o=t.sel,r="string"==typeof o?o:"functionComponent",i=t.data?.props||{};return`${n?`${n}|`:""}${r}::${i.id&&JSON.stringify(i.id).replaceAll('"',"")||e}`}function Vo(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(Vo(e))return!0;return!1}function Ho(t){if(!t||!t.sel)return t;if("suspense"===t.sel){const e=(t.data?.props||{}).fallback,n=t.children||[];return n.some(Vo)&&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?Ho(n[0]):{sel:"div",data:{attrs:{"data-sygnal-suspense":"resolved"}},children:n.map((t=>Ho(t))),text:void 0,elm:void 0,key:void 0}}return t.children&&t.children.length>0&&(t.children=t.children.map((t=>Ho(t)))),t}const Wo=tn(Hn);function zo(t){if(!t||!t.sel)return t;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=>{const o=document.querySelector(t);if(!o)return void console.warn(`[Portal] Target "${t}" not found in DOM`);const r=document.createElement("div");o.appendChild(r),e.data._portalVnode=Wo(r,{sel:"div",data:{},children:n,text:void 0,elm:void 0,key:void 0}),e.data._portalContainer=o},postpatch:(t,e)=>{const n=t.data?._portalVnode,o=t.data?._portalContainer;if(!n||!o)return;const r=e.data?.portalChildren||[];e.data._portalVnode=Wo(n,{sel:"div",data:{},children:r,text:void 0,elm:void 0,key:void 0}),e.data._portalContainer=o},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||[])}return t.children&&t.children.length>0&&(t.children=t.children.map(zo)),t}function Yo(t){if(!t||!t.sel)return t;if("transition"===t.sel){const e=t.data?.props||{},n=e.name||"v",o=e.duration,r=(t.children||[])[0];return r&&r.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`),Jo(r,n,(()=>{r.classList.remove(`${e}-enter-active`,`${e}-enter-to`)}))}))})))},t.data.hook.remove=(t,o)=>{r&&r(t,(()=>{}));const i=t.elm;i&&i.classList?(i.classList.add(`${e}-leave-from`,`${e}-leave-active`),requestAnimationFrame((()=>{requestAnimationFrame((()=>{i.classList.remove(`${e}-leave-from`),i.classList.add(`${e}-leave-to`),Jo(i,n,(()=>{i.classList.remove(`${e}-leave-active`,`${e}-leave-to`),o()}))}))}))):o()},t}(Yo(r),n,o):r||t}return t.children&&t.children.length>0&&(t.children=t.children.map(Yo)),t}function qo(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:i,hmrActions:s,context:a,peers:c,components:l,initialState:u,isolatedState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_}=e,v={name:o,view:e,model:r,intent:i,hmrActions:s,context:a,peers:c,components:l,initialState:u,isolatedState:d,calculated:p,storeCalculatedInState:h,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)})));return t.children&&t.children.length>0&&(t.children=t.children.map((t=>qo(t,e)))),t}function Jo(t,e,n){if("number"==typeof e)setTimeout(n,e);else{const e=()=>{t.removeEventListener("transitionend",e),n()};t.addEventListener("transitionend",e)}}function Zo(t){return void 0===t?t:{...t,children:Array.isArray(t.children)?t.children.map(Zo):void 0,data:t.data&&{...t.data,componentsInjected:!1}}}function Xo(t,e){return Ko(Qo(t),Qo(e))}function Ko(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(!Ko(t[r],e[r],n,o+1))return!1;return!0}const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(const s of r){if(!i.includes(s))return!1;if(!Ko(t[s],e[s],n,o+1))return!1}return!0}function Qo(t){if(!tr(t))return t;const{state:e,of:n,from:o,filter:r,...i}=t;return i}function tr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function er(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 nr(t){const e=Object.entries(t);if(e.length>1)return void console.error("Sort objects can only have one key:",t);const n=e[0],[o,r]=n;if(!["string","number"].includes(typeof r))return void console.error("Sort object properties must be a string or number:",t);let i=!0;if("string"==typeof r){if(!["asc","dec"].includes(r.toLowerCase()))return void console.error("Sort object string values must be asc or dec:",t);i="asc"===r.toLowerCase()}if("number"==typeof r){if(1!==r&&-1!==r)return void console.error("Sort object number values must be 1 or -1:",t);i=1===r}return(t,e)=>er(t[o],e[o],i)}function or(t){if(!t)return;const e=typeof t;if("function"===e)return t;if("string"===e){if("asc"===t.toLowerCase()||"dec"===t.toLowerCase()){const e="asc"===t.toLowerCase();return(t,n)=>er(t,n,e)}const e=t;return(t,n)=>er(t[e],n[e],!0)}if(Array.isArray(t)){const e=t.map((t=>"function"==typeof t?t:"string"!=typeof t||["asc","dec"].includes(t.toLowerCase())?tr(t)?nr(t):void 0:(e,n)=>er(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)?nr(t):void console.error("Invalid sort option (ignoring):",t)}function rr(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);return n.length>0&&(e.default||(e.default=[]),e.default.push(...n)),{slots:e,defaultChildren:e.default||[]}}const ir=t=>{const{children:e,...n}=t;return He("portal",{props:n},e)};ir.label="portal",ir.preventInstantiation=!0;const sr=t=>{const{children:e,...n}=t;return He("transition",{props:n},e)};sr.label="transition",sr.preventInstantiation=!0;const ar=t=>{const{children:e,...n}=t;return He("suspense",{props:n},e)};ar.label="suspense",ar.preventInstantiation=!0;const cr=t=>{const{children:e,...n}=t;return He("slot",{props:n},e)};function lr(t){return 0===Object.keys(t).length}function ur(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(lr(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(lr(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 i=n.map((e=>ce.fromObservable(t[e]).subscribe(r[e])));return n.forEach((t=>{const n=e[t],i=t=>{queueMicrotask((()=>n._n(t)))},s=t=>{queueMicrotask((()=>{(console.error||console.log)(t),n._e(t)}))};o[t]._n.forEach(i),o[t]._e.forEach(s),r[t].next=i,r[t].error=s,r[t]._n=i,r[t]._e=s})),o=null,function(){i.forEach((t=>t.unsubscribe()))}}(t,e)}function i(){!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:i}}(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 dr(t){const e=new EventTarget;return t.subscribe({next:t=>e.dispatchEvent(new CustomEvent("data",{detail:t})),error:t=>console.error("[EVENTS driver] Error in sink stream:",t)}),{select:t=>{const n=!t,o=Array.isArray(t)?t:[t];let r;return ue(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)}}))}}}function pr(t){t.addListener({next:t=>{console.log(t)},error:t=>{console.error("[LOG driver] Error in sink stream:",t)}})}cr.label="slot",cr.preventInstantiation=!0;class hr{constructor(){this._connected=!1,this._components=new Map,this._stateHistory=[],this._maxHistory=200}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"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(),_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,historyIndex:this._stateHistory.length-1})}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)})}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({historyIndex:t}){const e=this._stateHistory[t];if(!e)return;if("undefined"==typeof window)return;const n=window.__SYGNAL_DEVTOOLS_APP__;n?.sinks?.STATE?.shamefullySendNext&&(n.sinks.STATE.shamefullySendNext((()=>({...e.state}))),this._post("TIME_TRAVEL_APPLIED",{historyIndex:t,state:e.state}))}_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),props:this._safeClone(n.currentProps)})}}_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]"}}_serializeMeta(t){const{_instanceRef:e,...n}=t;return n}}let fr=null;function mr(){return fr||(fr=new hr),fr}function yr(t){if(!t)return null;const e=t.default||t;return"function"!=typeof e?null:t.default?t:{default:e}}function _r(t){return/^[a-zA-Z0-9-_]+$/.test(t)}function vr(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(!_r(e))throw new Error(`${e} is not a valid CSS class name`);return t.push(e),t}),[])}const gr=t=>(t=>"string"==typeof t)(t)||(t=>"number"==typeof t)(t),br={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 wr=Object.prototype.hasOwnProperty,Sr=Object.prototype.toString,Ar=Object.defineProperty,Er=Object.getOwnPropertyDescriptor,Or=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Sr.call(t)},Nr=function(t){if(!t||"[object Object]"!==Sr.call(t))return!1;var e,n=wr.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&wr.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!o)return!1;for(e in t);return void 0===e||wr.call(t,e)},Cr=function(t,e){Ar&&"__proto__"===e.name?Ar(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},$r=function(t,e){if("__proto__"===e){if(!wr.call(t,e))return;if(Er)return Er(t,e).value}return t[e]},Tr=function t(){var e,n,o,r,i,s,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=$r(a,n),a!==(r=$r(e,n))&&(u&&r&&(Nr(r)||(i=Or(r)))?(i?(i=!1,s=o&&Or(o)?o:[]):s=o&&Nr(o)?o:{},Cr(a,{name:n,newValue:t(u,s,r)})):void 0!==r&&Cr(a,{name:n,newValue:r}));return a},xr=o(Tr);const kr=(...t)=>xr(!1,...t),Lr=(t,e,n)=>{let o=n;for(let n=0;n<t.length;n++){const i=t[n];r=i,o=Array.isArray(r)?Lr(i,e,o):e(o,i)}var r;return o},jr=(t,e)=>Object.keys(t).map((n=>e(n,t[n]))).reduce(((t,e)=>((...t)=>xr(!0,...t))(t,e)),{}),Dr=(t,e)=>jr(e,((e,n)=>e!==t?{[e]:n}:{})),Ir=t=>gr(t)?{text:t,sel:void 0,data:void 0,children:void 0,elm:void 0,key:void 0}:void 0,Mr=t=>{if(!t||void 0===t.sel)return t;const e=t.data||{},n=e.props||{},o=Dr("className",n),r=void 0!==n.className?{class:n.className}:{},i=kr({},o,r,e.attrs||{});return kr(t,{data:Dr("props",kr({},e,{ns:"http://www.w3.org/2000/svg",attrs:i}))},{children:Array.isArray(t.children)&&"foreignObject"!==t.sel?t.children.map((t=>Mr(t))):t.children})},Pr=t=>t.sel in br?Mr(t):t,Rr={for:"attrs",role:"attrs",tabindex:"attrs","aria-*":"attrs",key:null},Fr=(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()}))},i=t.hook?.insert,s=t.hook?.postpatch;return t.hook={...t.hook,insert:t=>{i&&i(t),(e||n)&&r(t.elm)},postpatch:(t,e)=>{s&&s(t,e);const n=t.data?._autoFocus,o=e.data?._autoFocus;!n&&o&&r(e.elm)}},t})(((t,e)=>jr(t,((t,n)=>{const o={[t]:n};if(Rr[t]&&void 0!==e[Rr[t]])return{[Rr[t]]:o};if(null===Rr[t])return{};const r=Object.keys(Rr);for(let n=0;n<r.length;n++){const i=r[n];if("*"===i.charAt(i.length-1)&&0===t.indexOf(i.slice(0,-1))&&void 0!==e[Rr[i]])return{[Rr[i]]:o}}return void 0!==e[t]?{[e[t]?e[t]:t]:n}:void 0!==e.props?{props:o}:o})))(((t,e)=>jr(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,i=t.hook?.postpatch;return t.hook={...t.hook,insert:t=>{o&&o(t),n(t.elm)},postpatch:(t,e)=>{i&&i(t,e),n(e.elm)},destroy:t=>{r&&r(t),n(null)}},t})(r,n)},Br=t=>t.length>1||!gr(t[0])?void 0:t[0].toString(),Gr=t=>Lr(t,((t,e)=>{const n=(t=>"object"==typeof t&&null!==t)(o=e)&&"sel"in o&&"data"in o&&"children"in o&&"text"in o?e:Ir(e);var o;return t.push(n),t}),[]),Ur=(t=>(e,n,...o)=>{if(void 0===e&&(e="UNDEFINED",console.error("JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component's file scope.")),"function"==typeof e){if("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",i=e,{model:s,intent:a,hmrActions:c,context:l,peers:u,components:d,initialState:p,isolatedState:h,calculated:f,storeCalculatedInState:m,DOMSourceName:y,stateSourceName:_,onError:v,debug:g,preventInstantiation:b}=e;if(b){const e=Br(o),i=n?Fr(n,t):{};return Pr({sel:r,data:i,children:void 0!==e?Ir(e):Gr(o),text:e,elm:void 0,key:n?n.key:void 0})}const w={name:r,view:i,model:s,intent:a,hmrActions:c,context:l,peers:u,components:d,initialState:p,isolatedState:h,calculated:f,storeCalculatedInState:m,DOMSourceName:y,stateSourceName:_,onError:v,debug:g};n.sygnalOptions=w,e=r}}const r=Br(o);return Pr({sel:e,data:n?Fr(n,t):{},children:void 0!==r?Ir(r):Gr(o),text:r,elm:void 0,key:n?n.key:void 0})})({attrs:"",props:"",class:"",data:"dataset",style:"",hook:"",on:""});const Vr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Hr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Wr(t){return String(t).replace(/[&<>"']/g,(t=>Hr[t]))}function zr(t){return t.replace(/^(Webkit|Moz|Ms|O)/,(t=>"-"+t.toLowerCase())).replace(/([A-Z])/g,"-$1").toLowerCase()}function Yr(t,e,n){if(!t)return t;if("string"==typeof t||null!=t.text)return t;const o=t.sel;if("portal"===o){const o=t.children||[];return 0===o.length?null:1===o.length?Yr(o[0],e,n):{sel:"div",data:{attrs:{"data-sygnal-portal":""}},children:o.map((t=>Yr(t,e,n))),text:void 0,elm:void 0,key:void 0}}if("transition"===o){const o=(t.children||[])[0];return o?Yr(o,e,n):null}if("suspense"===o){const o=t.children||[];return 0===o.length?null:1===o.length?Yr(o[0],e,n):{sel:"div",data:{attrs:{"data-sygnal-suspense":"resolved"}},children:o.map((t=>Yr(t,e,n))),text:void 0,elm:void 0,key:void 0}}if("slot"===o){const o=t.children||[];return 0===o.length?null:1===o.length?Yr(o[0],e,n):{sel:"div",data:{},children:o.map((t=>Yr(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:i,...s}=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(i&&i.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=s.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 p={},h=[],f=t.children||[];for(const t of f)if(t&&"slot"===t.sel){const e=t.data?.props?.name||"default";p[e]||(p[e]=[]);const n=t.children||[];p[e].push(...n)}else h.push(t);h.length>0&&(p.default||(p.default=[]),p.default.push(...h));let m;try{m=a({...s,state:c,children:p.default||f,slots:p,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 Yr(m,u,c)}(t,e,n):"collection"===o?function(t,e,n){const o=t.data?.props||{},{of:r,from:i,className:s}=o;if(!r||!i||!n)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};const a=n[i];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},i=r.context||{};for(const e of Object.keys(i)){const n=i[e];if("function"==typeof n)try{o[e]=n(t)}catch(t){}}let s;try{s=r({state:t,children:[],slots:{},context:o,peers:{}},t,o,{})}catch(t){if("function"==typeof r.onError)try{s=r.onError(t,{componentName:r.name||"CollectionItem"})}catch(t){s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}else s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}return Yr(s,o,t)})).filter((t=>null!=t)),l={};s&&(l.props={className:s});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:i,initial:s}=o;if(!r)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};let a;"string"==typeof i&&(r[i]?a=i:n&&"string"==typeof n[i]&&(a=n[i]));!a&&s&&(a=s);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||{},i={...n};for(const t of Object.keys(r)){const e=r[t];if("function"==typeof e&&null!=o)try{i[t]=e(o)}catch(t){}}let s;try{s=t({state:o,children:[],slots:{},context:i,peers:{}},o,i,{})}catch(e){if("function"==typeof t.onError)try{s=t.onError(e,{componentName:t.name||"Component"})}catch(t){s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}else s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}s||(s={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0});return Yr(s,i,o)}(c,n,e)}(t,e,n):(t.children&&(Array.isArray(t.children)?t.children.length>0&&(t.children=t.children.map((t=>Yr(t,e,n))).filter((t=>null!=t))):t.children&&"object"==typeof t.children&&(t.children=Yr(t.children,e,n))),t)}function qr(t){if(null==t)return"";if("string"==typeof t)return Wr(t);if(null!=t.text&&!t.sel)return Wr(String(t.text));const e=t.sel;if(!e)return null!=t.text?Wr(String(t.text)):"";const{tag:n,id:o,selectorClasses:r}=function(t){let e=t,n=null;const o=[],r=t.indexOf("#");if(-1!==r){const i=t.slice(r+1),s=i.indexOf(".");if(-1!==s){n=i.slice(0,s),e=t.slice(0,r);const a=i.slice(s+1);a&&o.push(...a.split("."))}else n=i,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),i=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-${zr(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=zr(n);e.push(`${r}: ${o}`)}return e.join("; ")}(t.style);e&&o.push(["style",e])}return o}(t.data||{},o,r);let s=`<${n}`;for(const[t,e]of i)!0===e?s+=` ${t}`:!1!==e&&null!=e&&(s+=` ${t}="${Wr(String(e))}"`);if(s+=">",Vr.has(n))return s;if(null!=t.text)s+=Wr(String(t.text));else if(t.children){const e=Array.isArray(t.children)?t.children:[t.children];for(const t of e)s+=qr(t)}return s+=`</${n}>`,s}var Jr={};Object.defineProperty(Jr,"__esModule",{value:!0});var Zr=r,Xr=function(){function t(t,e){this.dt=t,this.ins=e,this.type="throttle",this.out=null,this.id=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.id=null},t.prototype.clearInterval=function(){var t=this.id;null!==t&&clearInterval(t),this.id=null},t.prototype._n=function(t){var e=this,n=this.out;n&&(this.id||(n._n(t),this.id=setInterval((function(){e.clearInterval()}),this.dt)))},t.prototype._e=function(t){var e=this.out;e&&(this.clearInterval(),e._e(t))},t.prototype._c=function(){var t=this.out;t&&(this.clearInterval(),t._c())},t}();var Kr=Jr.default=function(t){return function(e){return new Zr.Stream(new Xr(t,e))}};t.ABORT=Mo,t.Collection=io,t.MainDOMSource=Cn,t.MockedDOMSource=eo,t.Portal=ir,t.Slot=cr,t.Suspense=ar,t.Switchable=ho,t.Transition=sr,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(vr).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(!_r(n))throw new Error(`${n} is not a valid CSS class name`);return n})))):t.push(...vr(e)),t}),[]).join(" ")},t.collection=ro,t.component=Ro,t.createCommand=function(){const t={next:()=>{}};return{send:(e,n)=>t.next({type:e,data:n}),_stream:ao.create({start(e){t.next=t=>e.next(t)},stop(){t.next=()=>{}}}),__sygnalCommand:!0}},t.createElement=Ur,t.createRef=function(){return{current:null}},t.createRef$=function(){const t={next:()=>{}},e=ao.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=Ao,t.delay=vo,t.driverFromAsync=function(t,e={}){const{selector:n="category",args:o="value",return:r="value",pre:i=(t=>t),post:s=(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:()=>{}});return e.addListener({next:e=>{const l=i(e);let u=[];if("object"==typeof l&&null!==l){if("function"==typeof o){const t=o(l);u=Array.isArray(t)?t:[t]}"string"==typeof o&&(u=[l[o]]),Array.isArray(o)&&(u=o.map((t=>l[t])))}const d=`Error in driver created using driverFromAsync(${a})`;t(...u).then((t=>{const o=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};if("function"==typeof t.then)t.then((t=>{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(o(t))})).catch((t=>console.error(`${d}: ${t}`))):c(o(n))})).catch((t=>console.error(`${d}: ${t}`)));else{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(o(t))})).catch((t=>console.error(`${d}: ${t}`))):c(o(n))}})).catch((t=>console.error(`${d}: ${t}`)))},error:t=>{console.error(`Error received from sink stream in driver created using driverFromAsync(${a}):`,t)},complete:()=>{console.warn(`Unexpected completion of sink stream to driver created using driverFromAsync(${a})`)}}),{select:t=>void 0===t?l:"function"==typeof t?l.filter(t):l.filter((e=>e?.[n]===t))}}},t.dropRepeats=ge,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 i=e=>{Promise.resolve((async e=>{if(r)return;r=!0;const o=Array.isArray(e)?e.find(Boolean):e;try{let e=yr(o);if(e||"function"!=typeof n||(e=yr(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,i),e.accept(i),"function"==typeof e.dispose&&"function"==typeof t.dispose&&e.dispose((()=>t.dispose())),t},t.exactState=function(){return t=>t},t.getDevTools=mr,t.h=He,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=Qn,t.makeDragDriver=function(){return function(t){const e=new Map,n=new EventTarget,o=[];let r=null;const i=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(i)},error(){},complete(){}});const s=(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 s(`${t}:dragstart`,{element:e,dataset:{...e.dataset}})}}})),a("dragend",(()=>{r&&(s(`${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 i=n.target.closest(o.dropZone);if(!i)continue;n.preventDefault();let a=null;const c=r?e.get(r):null;return c?.draggable&&(a=n.target.closest(c.draggable)??null),void s(`${t}:drop`,{dropZone:i,insertBefore:a})}}));const c={select:t=>({events(e){const o=`${t}:${e}`;let r;return 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.mockDOMSource=no,t.portal=ir,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},i=e.querySelector("input[type=submit]:focus");if(i){const{name:t,value:e}=i;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={}}=e,i=t.name||t.componentName||"TestComponent",s=t,{intent:a,model:c,context:l,calculated:u,storeCalculatedInState:d,onError:p}=t,h=void 0!==n?n:t.initialState,f={next:()=>{}},m=ao.create({start(t){f.next=e=>t.next(e)},stop(){f.next=()=>{}}}),y={...c||{},__TEST_ACTION__:{STATE:(t,e)=>{if(!e||!e.type)return t;const{type:n,data:o}=e;let r=c?.[n];if(!r)for(const t of Object.keys(c||{}))if(t.includes("|")){const e=t.split("|").map((t=>t.trim()));if(e[0]===n){r={[e[1]]:c[t]};break}}if(!r)return t;if("function"==typeof r){const e=r(t,o);return"symbol"==typeof e?t:void 0!==e?e:t}if("object"==typeof r){const e=r.STATE||r[_];if("function"==typeof e){const n=e(t,o);return"symbol"==typeof n?t:void 0!==n?n:t}const n=r.EFFECT;if("function"==typeof n){n(t,o,((t,e)=>{setTimeout((()=>f.next({type:t,data:e})),10)}),{})}}return t}}},_="STATE",v=Fe(Ro({name:i,view:s,intent:a?t=>({...a(t),__TEST_ACTION__:m}):t=>({__TEST_ACTION__:m}),model:y,context:l,initialState:h,calculated:u,storeCalculatedInState:d,onError:p}),_),g={DOM:()=>no(o),EVENTS:dr,LOG:pr,...r},{sources:b,sinks:w,run:S}=ur(v,g),A=S(),E=[];let O=null;const N=b.STATE&&b.STATE.stream?b.STATE.stream:ao.never();return O={next:t=>E.push(t),error:()=>{},complete:()=>{}},N.addListener(O),{state$:N,dom$:w.DOM||ao.never(),events$:b.EVENTS||{select:()=>ao.never()},sinks:w,sources:b,simulateAction:(t,e)=>{f.next({type:t,data:e})},waitForState:(t,e=2e3)=>new Promise(((n,o)=>{for(const e of E)try{if(t(e))return n(e)}catch(t){}const r=setTimeout((()=>{try{N.removeListener(i)}catch(t){}o(new Error(`waitForState timed out after ${e}ms`))}),e),i={next:e=>{try{t(e)&&(clearTimeout(r),N.removeListener(i),n(e))}catch(t){}},error:t=>{clearTimeout(r),o(t)},complete:()=>{clearTimeout(r),o(new Error("waitForState: state stream completed without matching"))}};N.addListener(i)})),states:E,dispose:()=>{if(O){try{N.removeListener(O)}catch(t){}O=null}A()}}},t.renderToString=function(t,e={}){const{state:n,props:o={},context:r={},hydrateState:i}=e,s=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!=s)try{c[t]=e(s)}catch(t){}}let l;try{l=t({...o,state:s,children:o.children||[],slots:o.slots||{},context:c,peers:{}},s,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=Yr(l,c,s);let u=qr(l);if(i&&null!=s){const t="string"==typeof i?i:"__SYGNAL_STATE__";Wr(JSON.stringify(s)),u+=`<script>window.${t}=${JSON.stringify(s)}<\/script>`}return u},t.run=function t(e,n={},o={}){if("undefined"!=typeof window){mr().init()}const{mountPoint:r="#root",fragments:i=!0,useDefaultDrivers:s=!0}=o;if(!e.isSygnalComponent){const t=e.name||e.componentName||e.label||"FUNCTIONAL_COMPONENT",n=e,{model:o,intent:r,hmrActions:i,context:s,peers:a,components:c,initialState:l,calculated:u,storeCalculatedInState:d,DOMSourceName:p,stateSourceName:h,onError:f,debug:m}=e;e=Ro({name:t,view:n,model:o,intent:r,hmrActions:i,context:s,peers:a,components:c,initialState:l,calculated:u,storeCalculatedInState:d,DOMSourceName:p,stateSourceName:h,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 a=Fe(e,"STATE"),c={...s?{EVENTS:dr,DOM:Qn(r,{snabbdomOptions:{experimental:{fragments:i}}}),LOG:pr}:{},...n},{sources:l,sinks:u,run:d}=ur(a,c),p=d();let h=null;"undefined"!=typeof window&&l?.STATE?.stream&&"function"==typeof l.STATE.stream.addListener&&(h={next:t=>{window.__SYGNAL_HMR_PERSISTED_STATE=t},error:()=>{},complete:()=>{}},l.STATE.stream.addListener(h));const f={sources:l,sinks:u,dispose:()=>{h&&l?.STATE?.stream&&"function"==typeof l.STATE.stream.removeListener&&(l.STATE.stream.removeListener(h),h=null),p()}};"undefined"!=typeof window&&(window.__SYGNAL_DEVTOOLS_APP__=f);const m=(r,i)=>{const s="undefined"!=typeof window?window.__SYGNAL_HMR_PERSISTED_STATE:void 0,a=void 0!==s?s:e.initialState,c=void 0===i?a:i;"undefined"!=typeof window&&(window.__SYGNAL_HMR_UPDATING=!0,window.__SYGNAL_HMR_STATE=c,window.__SYGNAL_HMR_PERSISTED_STATE=c),f.dispose();const l=r.default||r;l.initialState=c;const u=t(l,n,o);if(f.sources=u.sources,f.sinks=u.sinks,f.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)},y=t=>t?Array.isArray(t)?y(t.find(Boolean)):t.default&&"function"==typeof t.default?t:"function"==typeof t?{default:t}:null:null;return f.hmr=(t,n)=>{const o=y(t)||{default:e};if(void 0!==n)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=n),void m(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 m(o,r);const i=f?.sources?.STATE?.stream?._v;if(void 0!==i)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=i),void m(o,i);f?.sinks?.STATE&&"function"==typeof f.sinks.STATE.shamefullySendNext?f.sinks.STATE.shamefullySendNext((t=>("undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=t),m(o,t),Mo))):m(o)},f},t.sampleCombine=In,t.switchable=uo,t.throttle=Kr,t.thunk=function(t,e,n,o){return void 0===o&&(o=n,n=e,e=void 0),He(t,{key:e,hook:{init:hn,prepatch:fn},fn:n,args:o})},t.xs=ao}));
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={},i={};!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}}(i);var s,a,c=i,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,p=u,h=Object.keys,f=h?function(t){return h(t)}:function(){if(a)return s;var t;if(a=1,!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,o=u,r=Object.prototype.propertyIsEnumerable,i=!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},p={$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},h=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!p["$"+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,s="[object Function]"===n.call(t),a=o(t),u=r&&"[object String]"===n.call(t),p=[];if(!r&&!s&&!a)throw new TypeError("Object.keys called on a non-object");var f=c&&s;if(u&&t.length>0&&!e.call(t,0))for(var m=0;m<t.length;++m)p.push(String(m));if(a&&t.length>0)for(var y=0;y<t.length;++y)p.push(String(y));else for(var _ in t)f&&"prototype"===_||!e.call(t,_)||p.push(String(_));if(i)for(var v=function(t){if("undefined"==typeof window||!h)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])||p.push(l[g]);return p}}return s=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 p(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},b={foo:{}},w=Object,S=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=S.call(arguments,1),r=Math.max(0,e.length-o.length),i=[],s=0;s<r;s++)i.push("$"+s);if(n=Function("binder","return function ("+i.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var r=e.apply(this,o.concat(S.call(arguments)));return Object(r)===r?r:this}return e.apply(t,o.concat(S.call(arguments)))})),e.prototype){var a=function(){};a.prototype=e.prototype,n.prototype=new a,a.prototype=null}return n},O=Function.prototype.bind||E,N=O.call(Function.call,Object.prototype.hasOwnProperty),C=SyntaxError,$=Function,T=TypeError,x=function(t){try{return $('"use strict"; return ('+t+").constructor;")()}catch(t){}},k=Object.getOwnPropertyDescriptor;if(k)try{k({},"")}catch(t){k=null}var L=function(){throw new T},j=k?function(){try{return L}catch(t){try{return k(arguments,"callee").get}catch(t){return L}}}():L,D="function"==typeof v&&"function"==typeof Symbol&&"symbol"==typeof v("foo")&&"symbol"==typeof Symbol("bar")&&g(),I={__proto__:b}.foo===b.foo&&!({__proto__:null}instanceof w),M=Object.getPrototypeOf||(I?function(t){return t.__proto__}:null),P={},R="undefined"!=typeof Uint8Array&&M?M(Uint8Array):y,F={"%AggregateError%":"undefined"==typeof AggregateError?y:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?y:ArrayBuffer,"%ArrayIteratorPrototype%":D&&M?M([][Symbol.iterator]()):y,"%AsyncFromSyncIteratorPrototype%":y,"%AsyncFunction%":P,"%AsyncGenerator%":P,"%AsyncGeneratorFunction%":P,"%AsyncIteratorPrototype%":P,"%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%":$,"%GeneratorFunction%":P,"%Int8Array%":"undefined"==typeof Int8Array?y:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?y:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":D&&M?M(M([][Symbol.iterator]())):y,"%JSON%":"object"==typeof JSON?JSON:y,"%Map%":"undefined"==typeof Map?y:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&D&&M?M((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&&D&&M?M((new Set)[Symbol.iterator]()):y,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":D&&M?M(""[Symbol.iterator]()):y,"%Symbol%":D?Symbol:y,"%SyntaxError%":C,"%ThrowTypeError%":j,"%TypedArray%":R,"%TypeError%":T,"%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(M)try{null.error}catch(t){var B=M(M(t));F["%Error.prototype%"]=B}var G=function t(e){var n;if("%AsyncFunction%"===e)n=x("async function () {}");else if("%GeneratorFunction%"===e)n=x("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=x("async function* () {}");else if("%AsyncGenerator%"===e){var o=t("%AsyncGeneratorFunction%");o&&(n=o.prototype)}else if("%AsyncIteratorPrototype%"===e){var r=t("%AsyncGenerator%");r&&M&&(n=M(r.prototype))}return F[e]=n,n},U={"%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"]},V=O,H=N,W=V.call(Function.call,Array.prototype.concat),z=V.call(Function.apply,Array.prototype.splice),Y=V.call(Function.call,String.prototype.replace),q=V.call(Function.call,String.prototype.slice),J=V.call(Function.call,RegExp.prototype.exec),Z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,X=/\\(\\)?/g,K=function(t,e){var n,o=t;if(H(U,o)&&(o="%"+(n=U[o])[0]+"%"),H(F,o)){var r=F[o];if(r===P&&(r=G(o)),void 0===r&&!e)throw new T("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 T("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new T('"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 Y(t,Z,(function(t,e,n,r){o[o.length]=n?Y(r,X,"$1"):e||t})),o}(t),o=n.length>0?n[0]:"",r=K("%"+o+"%",e),i=r.name,s=r.value,a=!1,c=r.alias;c&&(o=c[0],z(n,W([0,1],c)));for(var l=1,u=!0;l<n.length;l+=1){var d=n[l],p=q(d,0,1),h=q(d,-1);if(('"'===p||"'"===p||"`"===p||'"'===h||"'"===h||"`"===h)&&p!==h)throw new C("property names with quotes must have matching quotes");if("constructor"!==d&&u||(a=!0),H(F,i="%"+(o+="."+d)+"%"))s=F[i];else if(null!=s){if(!(d in s)){if(!e)throw new T("base intrinsic for "+t+" exists, but the property is not available.");return}if(k&&l+1>=n.length){var f=k(s,d);s=(u=!!f)&&"get"in f&&!("originalValue"in f.get)?f.get:s[d]}else u=H(s,d),s=s[d];u&&!a&&(F[i]=s)}}return s},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"),it=Object.prototype.toString,st=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]"!==it.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=st.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 pt=n,ht=function(){return"object"==typeof n&&n&&n.Math===Math&&n.Array===Array?n:pt},ft=dt,mt=ht,yt=dt,_t=n,vt=ht,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},bt=vt(),wt=function(){return bt};yt(wt,{getPolyfill:vt,implementation:_t,shim:gt});var St,At=wt,Et=n&&n.__extends||(St=function(t,e){return St=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])},St(t,e)},function(t,e){function n(){this.constructor=t}St(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(r,"__esModule",{value:!0});var Ot=r.NO_IL=r.NO=r.MemoryStream=re=r.Stream=void 0,Nt=c.default(At.getPolyfill()),Ct={},$t=r.NO=Ct;function Tt(){}function xt(t){for(var e=t.length,n=Array(e),o=0;o<e;++o)n[o]=t[o];return n}function kt(t,e,n){try{return t.f(e)}catch(t){return n._e(t),Ct}}var Lt={_n:Tt,_e:Tt,_c:Tt};function jt(t){t._start=function(t){t.next=t._n,t.error=t._e,t.complete=t._c,this.start(t)},t._stop=t.stop}Ot=r.NO_IL=Lt;var Dt=function(){function t(t,e){this._stream=t,this._listener=e}return t.prototype.unsubscribe=function(){this._stream._remove(this._listener)},t}(),It=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}(),Mt=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 It(t)),this.active||this._sub.unsubscribe()},t.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},t}(),Pt=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}(),Rt=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=xt(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}(),Ft=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 Rt(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}(),Bt=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}(),Gt=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(Tt,(function(t){setTimeout((function(){throw t}))}))},t.prototype._stop=function(){this.on=!1},t}(),Ut=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}(),Vt=function(){function t(t,e){this.type="debug",this.ins=t,this.out=Ct,this.s=Tt,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!==Tt)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}(),Ht=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}(),zt=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}(),Yt=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=kt(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=kt(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=kt(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=xt(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=xt(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=xt(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 ie?ie:t},t.prototype.addListener=function(t){t._n=t.next||Tt,t._e=t.error||Tt,t._c=t.complete||Tt,this._add(t)},t.prototype.removeListener=function(t){this._remove(t)},t.prototype.subscribe=function(t){return this.addListener(t),new Dt(this,t)},t.prototype[Nt]=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");jt(e)}return new t(e)},t.createWithMemory=function(t){return t&&jt(t),new ie(t)},t.never=function(){return new t({_start:Tt,_stop:Tt})},t.empty=function(){return new t({_start:function(t){t._c()},_stop:Tt})},t.throw=function(e){return new t({_start:function(t){t._e(e)},_stop:Tt})},t.from=function(e){if("function"==typeof e[Nt])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 Bt(e))},t.fromPromise=function(e){return new t(new Gt(e))},t.fromObservable=function(e){if(void 0!==e.endWhen)return e;var n="function"==typeof e[Nt]?e[Nt]():e;return new t(new Mt(n))},t.periodic=function(e){return new t(new Ut(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 Yt?new Yt((n=r.f,o=e,function(t){return n(t)&&o(t)}),r.ins):new Yt(e,this))},t.prototype.take=function(t){return new(this.ctor())(new ne(t,this))},t.prototype.drop=function(e){return new t(new Ht(e,this))},t.prototype.last=function(){return new t(new Xt(this))},t.prototype.startWith=function(t){return new ie(new ee(this,t))},t.prototype.endWhen=function(t){return new(this.ctor())(new zt(t,this))},t.prototype.fold=function(t,e){return new ie(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 ie(new Qt(this))},t.prototype.debug=function(t){return new(this.ctor())(new Vt(this,t))},t.prototype.imitate=function(t){if(t instanceof ie)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||Tt,t._e=t.error||Tt,t._c=t.complete||Tt,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 Pt(e))},t.combine=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Ft(e))},t}(),re=r.Stream=oe,ie=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),se=r.MemoryStream=ie,ae=oe,ce=r.default=ae,le=e({__proto__:null,get MemoryStream(){return se},get NO(){return $t},get NO_IL(){return Ot},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 pe(){return"cycle"+ ++de}function he(t,e=pe()){!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?pe():"",o="string"==typeof e||"object"==typeof e?e:e.toString();return function(e,...r){const i=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 i=e["*"];o[t]=void 0===i?n:i})),o}(e,o,n),s=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,i),a=function(t,e,n){const o={};for(const r in e){const i=t[r],s=e[r];Object.prototype.hasOwnProperty.call(e,r)&&i&&null!==n[r]&&"function"==typeof i.isolateSink?o[r]=ue(i.isolateSink(ce.fromObservable(s),n[r])):Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r])}return o}(e,t(s,...r),i);return a}}he.reset=()=>de=0;var fe={};Object.defineProperty(fe,"__esModule",{value:!0});var me=fe.DropRepeatsOperator=void 0,ye=r,_e={},ve=function(){function t(t,e){this.ins=t,this.type="dropRepeats",this.out=null,this.v=_e,this.isEq=e||function(t,e){return t===e}}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.v=_e},t.prototype._n=function(t){var e=this.out;if(e){var n=this.v;n!==_e&&this.isEq(t,n)||(this.v=t,e._n(t))}},t.prototype._e=function(t){var e=this.out;e&&e._e(t)},t.prototype._c=function(){var t=this.out;t&&t._c()},t}();me=fe.DropRepeatsOperator=ve;var ge=fe.default=function(t){return void 0===t&&(t=void 0),function(e){return new ye.Stream(new ve(e,t))}},be=e({__proto__:null,get DropRepeatsOperator(){return me},default:ge},[fe]);function we(t){return"string"==typeof t||"number"==typeof t?function(e){return null==e?void 0:e[t]}:t.get}function Se(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 Ae(t,e){return t.select(e)}function Ee(t,e){const n=we(e),o=Se(e);return t.map((t=>function(e){const r=n(e),i=t(r);return r===i?e:o(e,i)}))}class Oe{constructor(t,e){this.isolateSource=Ae,this.isolateSink=Ee,this._stream=t.filter((t=>void 0!==t)).compose(ge()).remember(),this._name=e,this.stream=ue(this._stream),this._stream._isCycleSource=e}select(t){const e=we(t);return new Oe(this._stream.map(e),this._name)}}class Ne{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 Ce{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,i=e.length;for(let t=0;t<i;++t){const i=e[t],s=i._key,a=ce.fromObservable(i[r]||ce.never());n.has(s)||(n.set(s,new Ne(o,this,a)),a._add(n.get(s)))}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 $e{constructor(t,e,n,o){this.key=t,this.out=e,this.p=n,this.val=$t,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 Te{constructor(t,e){this.type="combine",this.ins=e,this.sel=t,this.out=null,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((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}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 i=n.get(e).val;if(i===$t)return;o[r]=i}this.out._n(o)}_n(t){this.inst=t;const e=t.arr,n=this.ils,o=this.out,r=this.sel,i=t.dict,s=e.length;let a=!1;if(n.forEach(((t,e)=>{i.has(e)||(t.ins._remove(t),t.ins=null,t.out=null,t.val=null,n.delete(e),a=!0)})),0!==s){for(let t=0;t<s;++t){const i=e[t],s=i._key;if(!i[r])throw new Error("pickCombine found an undefined child sink stream");const a=ce.fromObservable(i[r]);n.has(s)||(n.set(s,new $e(s,o,this,a)),a._add(n.get(s)))}a&&this.up()}else o._n([])}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){const t=this.out;null!==t&&t._c()}}class xe{constructor(t){this._instances$=t}pickMerge(t){return ue(this._instances$.compose(function(t){return function(e){return new re(new Ce(t,e))}}(t)))}pickCombine(t){return ue(this._instances$.compose(function(t){return function(e){return new re(new Te(t,e))}}(t)))}}function ke(t){return{"*":null}}function Le(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 je={get:t=>t,set:(t,e)=>e};var De={};Object.defineProperty(De,"__esModule",{value:!0});var Ie=r,Me=function(){function t(t){this.streams=t,this.type="concat",this.out=null,this.i=0}return t.prototype._start=function(t){this.out=t,this.streams[this.i]._add(this)},t.prototype._stop=function(){var t=this.streams;this.i<t.length&&t[this.i]._remove(this),this.i=0,this.out=null},t.prototype._n=function(t){var e=this.out;e&&e._n(t)},t.prototype._e=function(t){var e=this.out;e&&e._e(t)},t.prototype._c=function(){var t=this.out;if(t){var e=this.streams;e[this.i]._remove(this),++this.i<e.length?e[this.i]._add(this):t._c()}},t}();var Pe=De.default=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Ie.Stream(new Me(t))},Re=e({__proto__:null,default:Pe},[De]);function Fe(t,e="state"){return function(n){const o=ce.create(),r=o.fold(((t,e)=>e(t)),void 0).drop(1),i=n;i[e]=new Oe(r,e);const s=t(i);if(s[e]){Pe(ce.fromObservable(s[e]),ce.never()).subscribe({next:t=>queueMicrotask((()=>o._n(t))),error:t=>queueMicrotask((()=>o._e(t))),complete:()=>queueMicrotask((()=>o._c()))})}return s}}function Be(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 Ge=Array.isArray;function Ue(t){return"string"==typeof t||"number"==typeof t||t instanceof String||t instanceof Number}function Ve(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&&Ve(o,n.children,n.sel)}}function He(t,e,n){let o,r,i,s={};if(void 0!==n?(null!==e&&(s=e),Ge(n)?o=n:Ue(n)?r=n.toString():n&&n.sel&&(o=[n])):null!=e&&(Ge(e)?o=e:Ue(e)?r=e.toString():e&&e.sel?o=[e]:s=e),void 0!==o)for(i=0;i<o.length;++i)Ue(o[i])&&(o[i]=Be(void 0,void 0,void 0,o[i],void 0));return!t.startsWith("svg")||3!==t.length&&"."!==t[3]&&"#"!==t[3]||Ve(s,o,t),Be(t,s,o,r,void 0)}function We(t){if(ze(t)){for(;t&&ze(t);){t=Ye(t).parent}return null!=t?t:null}return t.parentNode}function ze(t){return 11===t.nodeType}function Ye(t,e){var n,o,r;const i=t;return null!==(n=i.parent)&&void 0!==n||(i.parent=null!=e?e:null),null!==(o=i.firstChildNode)&&void 0!==o||(i.firstChildNode=t.firstChild),null!==(r=i.lastChildNode)&&void 0!==r||(i.lastChildNode=t.lastChild),i}const qe={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 Ye(document.createDocumentFragment())},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){if(ze(t)){let e=t;for(;e&&ze(e);){e=Ye(e).parent}t=null!=e?e:t}ze(e)&&(e=Ye(e,t)),n&&ze(n)&&(n=Ye(n).firstChildNode),t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){ze(e)&&(e=Ye(e,t)),t.appendChild(e)},parentNode:We,nextSibling:function(t){var e;if(ze(t)){const n=Ye(t),o=We(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:ze},Je=Be("",{},[],void 0,void 0);function Ze(t,e){var n,o;const r=t.key===e.key,i=(null===(n=t.data)||void 0===n?void 0:n.is)===(null===(o=e.data)||void 0===o?void 0:o.is),s=t.sel===e.sel,a=!(!t.sel&&t.sel===e.sel)||typeof t.text==typeof e.text;return s&&r&&i&&a}function Xe(){throw new Error("The document fragment is not supported on this platform.")}function Ke(t,e,n){var o;const r={};for(let i=e;i<=n;++i){const e=null===(o=t[i])||void 0===o?void 0:o.key;void 0!==e&&(r[e]=i)}return r}const Qe=["create","update","remove","destroy","pre","post"];function tn(t,e,n){const o={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},r=void 0!==e?e:qe;for(const e of Qe)for(const n of t){const t=n[e];void 0!==t&&o[e].push(t)}function i(t,e){return function(){if(0==--e){const e=r.parentNode(t);null!==e&&r.removeChild(e,t)}}}function s(t,e){var i,a,c,l,u;let d;const p=t.data,h=null==p?void 0:p.hook;null===(i=null==h?void 0:h.init)||void 0===i||i.call(h,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("#"),i=m.indexOf(".",n),a=n>0?n:m.length,l=i>0?i:m.length,u=-1!==n||-1!==i?m.slice(0,Math.min(a,l)):m,y=null==p?void 0:p.ns,_=void 0===y?r.createElement(u,p):r.createElementNS(y,u,p);for(t.elm=_,a<l&&_.setAttribute("id",m.slice(a+1,l)),i>0&&_.setAttribute("class",m.slice(l+1).replace(/\./g," ")),d=0;d<o.create.length;++d)o.create[d](Je,t);if(!Ue(t.text)||Ge(f)&&0!==f.length||r.appendChild(_,r.createTextNode(t.text)),Ge(f))for(d=0;d<f.length;++d){const t=f[d];null!=t&&r.appendChild(_,s(t,e))}void 0!==h&&(null===(c=h.create)||void 0===c||c.call(h,Je,t),void 0!==h.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:Xe)(),d=0;d<o.create.length;++d)o.create[d](Je,t);for(d=0;d<t.children.length;++d){const n=t.children[d];null!=n&&r.appendChild(t.elm,s(n,e))}}else t.elm=r.createTextNode(t.text);return t.elm}function a(t,e,n,o,i,a){for(;o<=i;++o){const i=n[o];null!=i&&r.insertBefore(t,s(i,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,s){for(var a,u;n<=s;++n){let s;const d=e[n];if(null!=d)if(void 0!==d.sel){c(d),s=o.remove.length+1;const t=i(d.elm,s);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 i,c,d,p,h,f,m,y;const _=null===(i=e.data)||void 0===i?void 0:i.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!==(p=t.data)&&void 0!==p||(t.data={});for(let n=0;n<o.update.length;++n)o.update[n](t,e);null===(m=null===(f=null===(h=e.data)||void 0===h?void 0:h.hook)||void 0===f?void 0:f.update)||void 0===m||m.call(f,t,e)}const g=t.children,b=e.children;void 0===e.text?void 0!==g&&void 0!==b?g!==b&&function(t,e,n,o){let i,c,d,p,h=0,f=0,m=e.length-1,y=e[0],_=e[m],v=n.length-1,g=n[0],b=n[v];for(;h<=m&&f<=v;)null==y?y=e[++h]:null==_?_=e[--m]:null==g?g=n[++f]:null==b?b=n[--v]:Ze(y,g)?(u(y,g,o),y=e[++h],g=n[++f]):Ze(_,b)?(u(_,b,o),_=e[--m],b=n[--v]):Ze(y,b)?(u(y,b,o),r.insertBefore(t,y.elm,r.nextSibling(_.elm)),y=e[++h],b=n[--v]):Ze(_,g)?(u(_,g,o),r.insertBefore(t,_.elm,y.elm),_=e[--m],g=n[++f]):(void 0===i&&(i=Ke(e,h,m)),c=i[g.key],void 0===c?(r.insertBefore(t,s(g,o),y.elm),g=n[++f]):void 0===i[b.key]?(r.insertBefore(t,s(b,o),r.nextSibling(_.elm)),b=n[--v]):(d=e[c],d.sel!==g.sel?r.insertBefore(t,s(g,o),y.elm):(u(d,g,o),e[c]=void 0,r.insertBefore(t,d.elm,y.elm)),g=n[++f]));f<=v&&(p=null==n[v+1]?null:n[v+1].elm,a(t,p,n,f,v,o)),h<=m&&l(t,e,h,m)}(v,g,b,n):void 0!==b?(void 0!==t.text&&r.setTextContent(v,""),a(v,null,b,0,b.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,i,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=Be(void 0,{},[],void 0,t)):t=function(t){const e=t.id?"#"+t.id:"",n=t.getAttribute("class"),o=n?"."+n.split(" ").join("."):"";return Be(r.tagName(t).toLowerCase()+e+o,{},[],void 0,t)}(t),Ze(t,e)?u(t,e,c):(i=t.elm,a=r.parentNode(i),s(e,c),null!==a&&(r.insertBefore(a,e.elm,r.nextSibling(i)),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 en(t,e){var n;const o=void 0!==e?e:qe;let r;if(o.isElement(t)){const r=t.id?"#"+t.id:"",s=null===(n=t.getAttribute("class"))||void 0===n?void 0:n.match(/[^\t\r\n\f ]+/g),a=s?"."+s.join("."):"",c=o.tagName(t).toLowerCase()+r+a,l={},u={},d={},p=[];let h,f,m;const y=t.attributes,_=t.childNodes;for(f=0,m=y.length;f<m;f++)h=y[f].nodeName,h.startsWith("data-")?u[(i=h,i.slice(5).replace(/-([a-z])/g,((t,e)=>e.toUpperCase())))]=y[f].nodeValue||"":"id"!==h&&"class"!==h&&(l[h]=y[f].nodeValue);for(f=0,m=_.length;f<m;f++)p.push(en(_[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]||Ve(d,p,c),Be(c,d,p,void 0,t)}return o.isText(t)?(r=o.getTextContent(t),Be(void 0,void 0,void 0,r,t)):o.isComment(t)?(r=o.getTextContent(t),Be("!",{},[],r,t)):Be("",{},[],void 0,t);var i}function nn(t,e){let n,o;const r=e.elm;let i=t.data.class,s=e.data.class;if((i||s)&&i!==s){for(o in i=i||{},s=s||{},i)i[o]&&!Object.prototype.hasOwnProperty.call(s,o)&&r.classList.remove(o);for(o in s)n=s[o],n!==i[o]&&r.classList[n?"add":"remove"](o)}}const on={create:nn,update:nn};function rn(t,e){let n,o,r;const i=e.elm;let s=t.data.props,a=e.data.props;if((s||a)&&s!==a)for(n in s=s||{},a=a||{},a)o=a[n],r=s[n],r===o||"value"===n&&i[n]===o||(i[n]=o)}const sn={create:rn,update:rn};function an(t,e){let n;const o=e.elm;let r=t.data.attrs,i=e.data.attrs;if((r||i)&&r!==i){for(n in r=r||{},i=i||{},i){const t=i[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 i||o.removeAttribute(n)}}const cn={create:an,update:an},ln=/[A-Z]/g;function un(t,e){const n=e.elm;let o,r=t.data.dataset,i=e.data.dataset;if(!r&&!i)return;if(r===i)return;r=r||{},i=i||{};const s=n.dataset;for(o in r)o in i||(s?o in s&&delete s[o]:n.removeAttribute("data-"+o.replace(ln,"-$&").toLowerCase()));for(o in i)r[o]!==i[o]&&(s?s[o]=i[o]:n.setAttribute("data-"+o.replace(ln,"-$&").toLowerCase(),i[o]))}const dn={create:un,update:un};function pn(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 hn(t){const e=t.data;pn(e.fn.apply(void 0,e.args),t)}function fn(t,e){const n=t.data,o=e.data;let r;const i=n.args,s=o.args;for(n.fn===o.fn&&i.length===s.length||pn(o.fn.apply(void 0,s),e),r=0;r<s.length;++r)if(i[r]!==s[r])return void pn(o.fn.apply(void 0,s),e);pn(t,e)}function mn(t,e,n=!1,o=!1,r=!1){let i=null;return re.create({start:function(s){i=o?function(t){_n(t,o),s.next(t)}:function(t){s.next(t)},t.addEventListener(e,i,{capture:n,passive:r})},stop:function(){t.removeEventListener(e,i,n),i=null}})}function yn(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(!yn(t[o],e[o]))return!1}else if(t[o]!==e[o])return!1}return!0}function _n(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");yn(e,t)&&t.preventDefault()}}function vn(t){return t.value=function(e){return vn(t.map((t=>{const n=t?.target?.value;return e?e(n):n})))},t.checked=function(e){return vn(t.map((t=>{const n=!!t?.target?.checked;return e?e(n):n})))},t.data=function(e,n){return vn(t.map((t=>{const o=t?.target instanceof Element?t.target.closest(`[data-${e}]`)||t.target:t?.target,r=o?.dataset?.[e];return n?n(r):r})))},t.target=function(e){return vn(t.map((t=>{const n=t?.target;return e?e(n):n})))},t.key=function(e){return vn(t.map((t=>{const n=t?.key;return e?e(n):n})))},t}class gn{constructor(t,e){this._name=t,this._selector=e||null}select(t){return new gn(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=mn(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=vn(ue(o));return r._isCycleSource=this._name,r}}class bn{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=mn(document.body,t,e.useCapture,e.preventDefault);const r=ue(o);return r._isCycleSource=this._name,r}}function wn(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 Sn(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 An(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 En{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||!An(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 On{constructor(t,e){this.namespace=t,this.isolateModule=e}call(){const t=this.namespace,e=Sn(t),n=new En(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 Nn(t){return{type:(e=t,e.length>1&&("."===e[0]||"#"===e[0])?"sibling":"total"),scope:t};var e}class Cn{constructor(t,e,n=[],o,r,i){var s;this._rootElement$=t,this._sanitation$=e,this._namespace=n,this._isolateModule=o,this._eventDelegator=r,this._name=i,this.isolateSource=(t,e)=>new Cn(t._rootElement$,t._sanitation$,t._namespace.concat(Nn(e)),t._isolateModule,t._eventDelegator,t._name),this.isolateSink=(s=this._namespace,(t,e)=>":root"===e?t:t.map((t=>{if(!t)return t;const n=Nn(e),o={...t,data:{...t.data,isolate:t.data&&Array.isArray(t.data.isolate)?t.data.isolate:s.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 On(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 gn(this._name);if("body"===t)return new bn(this._name);const e=":root"===t?[]:this._namespace.concat({type:"selector",scope:t.trim()});return new Cn(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=vn(ue(this._eventDelegator.addEventListener(t,this._namespace,e,n)));return o._isCycleSource=this._name,o}dispose(){this._sanitation$.shamefullySendNext(null)}}var $n={},Tn=n&&n.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var o=Array(t),r=0;for(e=0;e<n;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,r++)o[r]=i[s];return o};Object.defineProperty($n,"__esModule",{value:!0}),$n.SampleCombineOperator=$n.SampleCombineListener=void 0;var xn=r,kn={},Ln=function(){function t(t,e){this.i=t,this.p=e,e.ils[t]=this}return t.prototype._n=function(t){var e=this.p;e.out!==kn&&e.up(t,this.i)},t.prototype._e=function(t){this.p._e(t)},t.prototype._c=function(){this.p.down(this.i,this)},t}();$n.SampleCombineListener=Ln;var jn,Dn=function(){function t(t,e){this.type="sampleCombine",this.ins=t,this.others=e,this.out=kn,this.ils=[],this.Nn=0,this.vals=[]}return t.prototype._start=function(t){this.out=t;for(var e=this.others,n=this.Nn=e.length,o=this.vals=new Array(n),r=0;r<n;r++)o[r]=kn,e[r]._add(new Ln(r,this));this.ins._add(this)},t.prototype._stop=function(){var t=this.others,e=t.length,n=this.ils;this.ins._remove(this);for(var o=0;o<e;o++)t[o]._remove(n[o]);this.out=kn,this.vals=[],this.ils=[]},t.prototype._n=function(t){var e=this.out;e!==kn&&(this.Nn>0||e._n(Tn([t],this.vals)))},t.prototype._e=function(t){var e=this.out;e!==kn&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==kn&&t._c()},t.prototype.up=function(t,e){var n=this.vals[e];this.Nn>0&&n===kn&&this.Nn--,this.vals[e]=t},t.prototype.down=function(t,e){this.others[t]._remove(e)},t}();$n.SampleCombineOperator=Dn,jn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return new xn.Stream(new Dn(e,t))}};var In=$n.default=jn;function Mn(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,i=o>0?o:e.length;return{tagName:-1!==n||-1!==o?e.slice(0,Math.min(r,i)):e,id:r<i?e.slice(r+1,i):void 0,className:o>0?e.slice(i+1).replace(/\./g," "):void 0}}class Pn{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}=Mn(t),o=function(t){let{className:e=""}=Mn(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:i=n}=r;return"string"==typeof i&&i.toUpperCase()===this.rootElement.id.toUpperCase()&&e.toUpperCase()===this.rootElement.tagName.toUpperCase()&&o.toUpperCase()===this.rootElement.className.toUpperCase()?t:this.wrap([t])}wrapDocFrag(t){return Be("",{isolate:[]},t,void 0,this.rootElement)}wrap(t){const{tagName:e,id:n,className:o}=this.rootElement,r=n?`#${n}`:"",i=o?`.${o.split(" ").join(".")}`:"",s=He(`${e.toLowerCase()}${r}${i}`,{},t);return s.data=s.data||{},s.data.isolate=s.data.isolate||[],s}}const Rn="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||setTimeout,Fn=t=>{Rn((()=>{Rn(t)}))};let Bn=!1;function Gn(t,e,n){Fn((()=>{t[e]=n}))}function Un(t,e){let n,o;const r=e.elm;let i=t.data.style,s=e.data.style;if(!i&&!s)return;if(i===s)return;i=i||{},s=s||{};const a="delayed"in i;for(o in i)o in s||("-"===o[0]&&"-"===o[1]?r.style.removeProperty(o):r.style[o]="");for(o in s)if(n=s[o],"delayed"===o&&s.delayed)for(const t in s.delayed)n=s.delayed[t],a&&n===i.delayed[t]||Gn(r.style,t,n);else"remove"!==o&&n!==i[o]&&("-"===o[0]&&"-"===o[1]?r.style.setProperty(o,n):r.style[o]=n)}const Vn={pre:function(){Bn=!1},create:Un,update:Un,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;Bn||(t.elm.offsetLeft,Bn=!0);const r=t.elm;let i=0;const s=n.remove;let a=0;const c=[];for(o in s)c.push(o),r.style[o]=s[o];const l=getComputedStyle(r)["transition-property"].split(", ");for(;i<l.length;++i)-1!==c.indexOf(l[i])&&a++;r.addEventListener("transitionend",(t=>{t.target===r&&--a,0===a&&e()}))}},Hn=[Vn,on,sn,cn,dn];class Wn{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 i=o[1][r];if(!i){if(!e)return;i=[void 0,{}],o[1][r]=i}o=i}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 zn{constructor(){this.namespaceTree=new Wn((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,i=r.isolate;Array.isArray(i)&&t.insertElement(i,o)},update(e,n){const{elm:o,data:r={}}=e,{elm:i,data:s={}}=n,a=r.isolate,c=s.isolate;An(a,c)||Array.isArray(a)&&t.removeElement(o),Array.isArray(c)&&t.insertElement(c,i)},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 Yn{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 qn=["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 Jn{constructor(t,e){this.rootElement$=t,this.isolateModule=e,this.virtualListeners=new Wn((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 i;const s=new En(e,this.isolateModule);if(void 0===o?-1===qn.indexOf(t):o)return this.domListeners.has(t)||this.setupDOMListener(t,!!n.passive),i=this.insertListener(r,s,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,i,s]=n;return t===r&&An(i.namespace,e)};for(;!a&&c<l;){const t=o[c];a=u(t)?t:a,c++}let d,p=a;if(p){const[t]=p;d=t}else{const o=new On(e,this.isolateModule);i=this.insertListener(r,s,t,n),p=[r,t,o,i],d=r,this.nonBubblingListenersToAdd.add(p),this.setupNonBubblingListener(p)}const h=this;let f=null;return ce.create({start:t=>{f=d.subscribe(t)},stop:()=>{const[t,e,n,o]=p;n.call().forEach((function(t){const n=t.subs;n&&n[e]&&(n[e].unsubscribe(),delete n[e])})),h.nonBubblingListenersToAdd.delete(p),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=[],i=e._namespace;let s=i.length;do{r.push(this.getVirtualListeners(n,i,!0,s)),s--}while(s>=0&&"total"!==i[s].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,i.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 i=this.virtualListeners.getDefault(e,(()=>new Map),r);return i.has(t)||i.set(t,new Yn),i.get(t)}setupDOMListener(t,e){if(this.origin){const n=mn(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 i=o.call();if(i.length){const t=this;i.forEach((e=>{const o=e.subs;if(!o||!o[n]){const i=mn(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 s=t.nonBubblingListeners.get(n);if(!s)return;s.set(e,{sub:i,destination:r}),e.subs={...o,[n]:i}}}))}}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 i=r.get(e);i&&i.destination.passive===o&&i.destination.useCapture===n&&(this.virtualNonBubblingListener[0]=i.destination)}onEvent(t,e,n,o=!0){const r=this.patchEvent(e),i=this.isolateModule.getRootElement(e.target);if(o){const o=this.isolateModule.getNamespace(e.target);if(!o)return;const s=this.getVirtualListeners(t,o);this.bubble(t,e.target,i,r,s,o,o.length-1,!0,n),this.bubble(t,e.target,i,r,s,o,o.length-1,!1,n)}else this.putNonBubblingListener(t,e.target,!0,n),this.doBubbleStep(t,e.target,i,r,this.virtualNonBubblingListener,!0,n),this.putNonBubblingListener(t,e.target,!1,n),this.doBubbleStep(t,e.target,i,r,this.virtualNonBubblingListener,!1,n),e.stopPropagation()}bubble(t,e,n,o,r,i,s,a,c){a||o.propagationHasBeenStopped||this.doBubbleStep(t,e,n,o,r,a,c);let l=n,u=s;if(e===n){if(!(s>=0&&"sibling"===i[s].type))return;l=this.isolateModule.getElement(i,s),u--}e.parentNode&&l&&this.bubble(t,e.parentNode,l,o,r,i,u,a,c),a&&!o.propagationHasBeenStopped&&this.doBubbleStep(t,e,n,o,r,a,c)}doBubbleStep(t,e,n,o,r,i,s){n&&(this.mutateEventCurrentTarget(o,e),r.forEach((t=>{if(t.passive===s&&t.useCapture===i){const r=Sn(t.scopeChecker.namespace);!o.propagationHasBeenStopped&&t.scopeChecker.isDirectlyInScope(e)&&(""!==r&&e.matches(r)||""===r&&e===n)&&(_n(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 Zn(t){return ce.merge(t,ce.never())}function Xn(t){return t.elm}function Kn(t){(console.error||console.log)(t)}function Qn(t,e={}){wn(t);const n=e.modules||Hn;!function(t){if(!Array.isArray(t))throw new Error("Optional modules option must be an array for snabbdom modules")}(n);const o=new zn,r=e&&e.snabbdomOptions||void 0,i=tn([o.createModule()].concat(n),void 0,r),s=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=s.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 Pn(e),e})),p=n.remember();p.addListener({}),l.addListener({});const h=d.map((t=>ce.merge(p.endWhen(u),u).map((t=>a.call(t))).startWith(function(t){return t.data=t.data||{},t.data.isolate=[],t}(en(t))).fold(i,en(t)).drop(1).map(Xn).startWith(t).map((t=>(c.observe(t,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),t))).compose(Zn))).flatten(),f=Pe(s,l).endWhen(u).compose(In(h)).map((t=>t[1])).remember();f.addListener({error:e.reportSnabbdomError||Kn});const m=new Jn(f,o);return new Cn(f,u,[],o,m,r)}}const to="___";class eo{constructor(t){this._mockConfig=t,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=ue(this._mockConfig[t]||ce.empty());return o._isCycleSource="MockedDOM",o}select(t){const e=this._mockConfig[t]||{};return new eo(e)}isolateSource(t,e){return t.select("."+to+e)}isolateSink(t,e){return ue(ce.fromObservable(t).map((t=>(t.sel&&-1!==t.sel.indexOf(to+e)||(t.sel+=`.${to}${e}`),t))))}}function no(t){return new eo(t)}let oo=0;function ro(t,e,n={}){if("function"!=typeof t)throw new Error("collection: first argument (component) must be a function");const{combineList:o=["DOM"],globalList:r=["EVENTS"],stateSourceName:i="STATE",domSourceName:s="DOM",container:a="div",containerClass:c}=n;return n=>{const l="sygnal-collection-"+oo++,u={item:t,itemKey:(t,e)=>void 0!==t.id?t.id:e,itemScope:t=>t,channel:i,collectSinks:t=>Object.entries(n).reduce(((e,[n])=>{if(o.includes(n)){const o=t.pickCombine(n);n===s&&a?e[s]=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={[i]:e};return r.forEach((t=>d[t]=null)),o.forEach((t=>d[t]=null)),function(t,e,n){return he(function(t){return function(e){const n=t.channel||"state",o=t.itemKey,r=t.itemScope||ke,i=ce.fromObservable(e[n].stream).fold(((i,s)=>{const a=i.dict;if(Array.isArray(s)){const i=Array(s.length),c=new Set;for(let l=0,u=s.length;l<u;++l){const u=`${o?o(s[l],l):l}`;if(c.add(u),a.has(u))i[l]=a.get(u);else{const c=o?Le(o,u):`${l}`,d=r(u),p="string"==typeof d?{"*":d,[n]:c}:{...d,[n]:c},h=he(t.itemFactory?t.itemFactory(s[l],l):t.item,p)(e);a.set(u,h),i[l]=h}i[l]._key=u}return a.forEach(((t,e)=>{c.has(e)||(t&&"function"==typeof t.__dispose&&t.__dispose(),a.delete(e))})),c.clear(),{dict:a,arr:i}}{a.forEach((t=>{t&&"function"==typeof t.__dispose&&t.__dispose()})),a.clear();const i=`${o?o(s,0):"this"}`,c=je,l=r(i),u="string"==typeof l?{"*":l,[n]:c}:{...l,[n]:c},d=he(t.itemFactory?t.itemFactory(s,0):t.item,u)(e);return a.set(i,d),{dict:a,arr:[d]}}}),{dict:new Map,arr:[]});return t.collectSinks(new xe(i))}}(t),e)(n)}(u,d,n)}}const io=t=>{const{children:e,...n}=t;return He("collection",{props:n},e)};function so(t){return t&&t.default&&t.default.default&&"function"==typeof t.default.default?t.default.default:t&&t.default?t.default:t}io.label="collection",io.preventInstantiation=!0;const ao=function(t){const e=so(t);return e&&e.default&&"function"==typeof e.default.create?e.default:e}(le),co=re||ce&&ce.Stream||ao&&ao.Stream,lo=so(be);function uo(t,e,n,o={}){const{switched:r=["DOM"],stateSourceName:i="STATE"}=o,s=typeof e;if(!e)throw new Error("Missing 'name$' parameter for switchable()");if(!("string"===s||"function"===s||e instanceof co))throw new Error("Invalid 'name$' parameter for switchable(): expects Stream, String, or Function");if(e instanceof co){const o=e.compose(lo()).startWith(n).remember();return e=>po(t,e,o,r)}{const o="function"===s&&e||(t=>t[e]);return e=>{const s=e&&("string"==typeof i&&e[i]||e.STATE||e.state).stream;if(!(s instanceof co))throw new Error(`Could not find the state source: ${i}`);const a=s.map(o).filter((t=>"string"==typeof t)).compose(lo()).startWith(n).remember();return po(t,e,a,r,i)}}}function po(t,e,n,o=["DOM"],r="STATE"){"string"==typeof o&&(o=[o]);const i=Object.entries(t).map((([t,o])=>{if(e[r]){const i=e[r].stream,s=ao.combine(n,i).filter((([e])=>e==t)).map((([,t])=>t)).remember(),a=new e[r].constructor(s,e[r]._name);return[t,o({...e,state:a})]}return[t,o(e)]}));return Object.keys(e).reduce(((t,e)=>{if(o.includes(e))t[e]=n.map((t=>{const n=i.find((([e])=>e===t));return n&&n[1][e]||ao.never()})).flatten().remember().startWith(void 0);else{const n=i.filter((([,t])=>void 0!==t[e])).map((([,t])=>t[e]));t[e]=ao.merge(...n)}return t}),{})}const ho=t=>{const{children:e,...n}=t;return He("switchable",{props:n},e)};function fo(t){return{select:e=>t._stream.filter((t=>t.type===e)).map((t=>t.data))}}ho.label="switchable",ho.preventInstantiation=!0;var mo={};Object.defineProperty(mo,"__esModule",{value:!0});var yo=r,_o=function(){function t(t,e){this.dt=t,this.ins=e,this.type="delay",this.out=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null},t.prototype._n=function(t){var e=this.out;if(e)var n=setInterval((function(){e._n(t),clearInterval(n)}),this.dt)},t.prototype._e=function(t){var e=this.out;if(e)var n=setInterval((function(){e._e(t),clearInterval(n)}),this.dt)},t.prototype._c=function(){var t=this.out;if(t)var e=setInterval((function(){t._c(),clearInterval(e)}),this.dt)},t}();var vo=mo.default=function(t){return function(e){return new yo.Stream(new _o(t,e))}},go=e({__proto__:null,default:vo},[mo]),bo={};Object.defineProperty(bo,"__esModule",{value:!0});var wo=r,So=function(){function t(t,e){this.dt=t,this.ins=e,this.type="debounce",this.out=null,this.id=null,this.t=wo.NO}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.clearInterval()},t.prototype.clearInterval=function(){var t=this.id;null!==t&&clearInterval(t),this.id=null},t.prototype._n=function(t){var e=this,n=this.out;n&&(this.clearInterval(),this.t=t,this.id=setInterval((function(){e.clearInterval(),n._n(t),e.t=wo.NO}),this.dt))},t.prototype._e=function(t){var e=this.out;e&&(this.clearInterval(),e._e(t))},t.prototype._c=function(){var t=this.out;t&&(this.clearInterval(),this.t!=wo.NO&&t._n(this.t),this.t=wo.NO,t._c())},t}();var Ao=bo.default=function(t){return function(e){return new wo.Stream(new So(t,e))}},Eo=e({__proto__:null,default:Ao},[bo]);const Oo=so(go),No=so(Re),Co=so(Eo),$o=so(be),To="undefined"!=typeof window&&window||"undefined"!=typeof process&&process.env||{},xo="BOOTSTRAP",ko="INITIALIZE",Lo="PARENT",jo="READY",Do="EFFECT";let Io=0;const Mo=Symbol("ABORT");function Po(t,e){if("function"==typeof e)return{fn:e,deps:null};if(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&"function"==typeof e[1])return{fn:e[1],deps:e[0]};throw new Error(`Invalid calculated field '${t}': expected a function or [depsArray, function]`)}function Ro(t){const{name:e,sources:n,isolateOpts:o,stateSourceName:r="STATE"}=t;if(n&&!tr(n))throw new Error(`[${e}] Sources must be a Cycle.js sources object`);let i;i="string"==typeof o?{[r]:o}:!0===o?{}:o;const s=void 0===n;let a;if(tr(i)){const e=e=>{const n={...t,sources:e},o=new Fo(n);return o.sinks.__dispose=()=>o.dispose(),o.sinks};a=s?he(e,i):he(e,i)(n)}else if(s)a=e=>{const n=new Fo({...t,sources:e});return n.sinks.__dispose=()=>n.dispose(),n.sinks};else{const e=new Fo(t);e.sinks.__dispose=()=>e.dispose(),a=e.sinks}return a.componentName=e,a.isSygnalComponent=!0,a}class Fo{constructor({name:t="NO NAME",sources:e,intent:n,model:o,hmrActions:r,context:i,response:s,view:a,peers:c={},components:l={},initialState:u,calculated:d,storeCalculatedInState:p=!0,DOMSourceName:h="DOM",stateSourceName:f="STATE",requestSourceName:m="HTTP",onError:y,debug:_=!1}){if(!e||!tr(e))throw new Error(`[${t}] Missing or invalid sources`);if(this._componentNumber=Io++,this.name=t,this.sources=e,this.intent=n,this.model=o,this.hmrActions=r,this.context=i,this.response=s,this.view=a,this.peers=c,this.components=l,this.initialState=u,this.calculated=d,this.storeCalculatedInState=p,this.DOMSourceName=h,this.stateSourceName=f,this.requestSourceName=m,this.sourceNames=Object.keys(e),this.onError=y,this._debug=_,this.calculated&&this.initialState&&tr(this.calculated)&&tr(this.initialState))for(const e of Object.keys(this.calculated))e in this.initialState&&console.warn(`[${t}] Calculated field '${e}' shadows a key in initialState. The initialState value will be overwritten on every state update.`);if(this.calculated&&tr(this.calculated)){const e=Object.entries(this.calculated);this._calculatedNormalized={};for(const[t,n]of e)this._calculatedNormalized[t]=Po(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||console.warn(`[${t}] Calculated field '${e}' declares dependency '${o}' which is not in initialState or calculated fields`);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 i=[];for(const[t,e]of Object.entries(o))0===e&&i.push(t);const s=[];for(;i.length>0;){const t=i.shift();s.push(t);for(const e of r[t])o[e]--,0===o[e]&&i.push(e)}if(s.length!==this._calculatedFieldNames.size){const t=[...this._calculatedFieldNames].filter((t=>!s.includes(t))),e=new Set,o=[],r=i=>{if(e.has(i))return o.push(i),!0;e.add(i),o.push(i);for(const e of n[i])if(t.includes(e)&&r(e))return!0;return o.pop(),e.delete(i),!1};r(t[0]);const i=o[o.length-1],a=o.slice(o.indexOf(i));throw new Error(`Circular calculated dependency: ${a.join(" → ")}`)}this._calculatedOrder=s.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 v=e[f]&&e[f].stream;this.currentSlots={},v&&(this.currentState=u||{},this.sources[f]=new Oe(v.map((t=>(this.currentState=t,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onStateChanged(this._componentNumber,this.name,t),t))),f));const g=e.props$;g&&(this.sources.props$=g.map((t=>{const{sygnalFactory:e,sygnalOptions:n,...o}=t;return this.currentProps=o,t})));const b=e.children$;var w;if(b&&(this.sources.children$=b.map((t=>{if(Array.isArray(t)){const{slots:e,defaultChildren:n}=rr(t);this.currentSlots=e,this.currentChildren=n}else this.currentSlots={},this.currentChildren=t;return t}))),this.sources[h]&&(this.sources[h]=(w=this.sources[h],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__:ao.never()}),this.model={__NOOP_ACTION__:t=>t}),this._subscriptions=[],this._activeSubComponents=new Map,this._childReadyState={},this._readyChangedListener=null,this._readyChanged$=ao.create({start:t=>{this._readyChangedListener=t},stop:()=>{}}),this._disposeListener=null,this._dispose$=ao.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._disposeListener){try{this._disposeListener.next(!0),this._disposeListener.complete()}catch(t){}this._disposeListener=null}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=[],this._activeSubComponents.forEach((t=>{t?.sink$?.__dispose&&t.sink$.__dispose()})),this._activeSubComponents.clear()}),0)}get debug(){return this._debug||"true"===To.SYGNAL_DEBUG||!0===To.SYGNAL_DEBUG}initIntent$(){if(this.intent){if("function"!=typeof this.intent)throw new Error(`[${this.name}] Intent must be a function`);if(this.intent$=this.intent(this.sources),!(this.intent$ instanceof co||tr(this.intent$)))throw new Error(`[${this.name}] Intent must return either an action$ stream or map of event streams`)}}initHmrActions(){if(void 0!==this.hmrActions){if("string"==typeof this.hmrActions&&(this.hmrActions=[this.hmrActions]),!Array.isArray(this.hmrActions))throw new Error(`[${this.name}] hmrActions must be the name of an action or an array of names of actions to run when a component is hot-reloaded`);if(this.hmrActions.some((t=>"string"!=typeof t)))throw new Error(`[${this.name}] hmrActions must be the name of an action or an array of names of actions to run when a component is hot-reloaded`);this.hmrAction$=ao.fromArray(this.hmrActions.map((t=>({type:t}))))}else this.hmrAction$=ao.of().filter((t=>!1))}initAction$(){const t=this.sources&&this.sources[this.requestSourceName]||null;if(!this.intent$)return void(this.action$=ao.never());let e;if(this.intent$ instanceof co)e=this.intent$;else{for(const t of Object.keys(this.intent$))if(t.includes("|"))throw new Error(`[${this.name}] Intent action name '${t}' contains '|', which is reserved for the model shorthand syntax (e.g., 'ACTION | DRIVER'). Rename this action.`);const t=Object.entries(this.intent$).map((([t,e])=>e.map((e=>({type:t,data:e})))));e=ao.merge(ao.never(),...t)}const n=e instanceof co?e:e.apply&&e(this.sources)||ao.never(),o=ao.of({type:xo}).compose(Oo(10)),r="undefined"!=typeof window&&!0===window.__SYGNAL_HMR_UPDATING,i=r?this.hmrAction$:ao.of().filter((t=>!1)),s=this.model[xo]&&!r?No(o,n):No(ao.of().compose(Oo(1)).filter((t=>!1)),i,n);let a;a=!r&&t&&"function"==typeof t.select?t.select("initial").flatten():ao.never();const c=a.map((t=>({type:"HYDRATE",data:t})));this.action$=ao.merge(s,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[ko]?this.model[ko]={[this.stateSourceName]:(t,e)=>({...this.addCalculated(e)})}:tr(this.model[ko])&&Object.keys(this.model[ko]).forEach((t=>{t!==this.stateSourceName&&(console.warn(`${ko} can only be used with the ${this.stateSourceName} source... disregarding ${t}`),delete this.model[ko][t])})))}initContext(){if(!this.context&&!this.sources.__parentContext$)return void(this.context$=ao.of({}));const t=this.sources[this.stateSourceName]?.stream.startWith({}).compose($o(Ko))||ao.never(),e=this.sources.__parentContext$?.startWith({}).compose($o(Ko))||ao.of({});this.context&&!tr(this.context)&&console.error(`[${this.name}] Context must be an object mapping names to values of functions: ignoring provided ${typeof this.context}`),this.context$=ao.combine(t,e).map((([t,e])=>{const n=tr(e)?e:{},o=tr(this.context)?this.context:{},r=this.currentState,i={...n,...Object.entries(o).reduce(((t,e)=>{const[n,o]=e;let i;const s=typeof o;if("string"===s)i=r[o];else if("boolean"===s)i=r[n];else{if("function"!==s)return console.error(`[${this.name}] Invalid context entry '${n}': must be the name of a state property or a function returning a value to use`),t;i=o(r)}return t[n]=i,t}),{})};return this.currentContext=i,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onContextChanged(this._componentNumber,this.name,i),i})).compose($o(Ko)).startWith({}),this._subscriptions.push(this.context$.subscribe({next:t=>t,error:t=>console.error(`[${this.name}] Error in context stream:`,t)}))}initModel$(){if(void 0===this.model)return void(this.model$=this.sourceNames.reduce(((t,e)=>(t[e]=ao.never(),t)),{}));const t=To?.__SYGNAL_HMR_STATE,e=void 0!==t?t:this.initialState,n={type:ko,data:e};this.isSubComponent&&this.initialState&&console.warn(`[${this.name}] Initial state provided to sub-component. This will overwrite any state provided by the parent component.`);const o=void 0!==e&&(!0!==To?.__SYGNAL_HMR_UPDATING||void 0!==t)?No(ao.of(n),this.action$).compose(Oo(0)):this.action$,r=()=>this.makeOnAction(o,!0,this.action$),i=()=>this.makeOnAction(this.action$,!1,this.action$),s=Object.entries(this.model),a={},c=new Set;s.forEach((t=>{let[e,n]=t;if(e.includes("|")){const t=e.split("|").map((t=>t.trim()));if(2!==t.length||!t[0]||!t[1])throw new Error(`[${this.name}] Invalid shorthand model entry '${e}'. Expected 'ACTION | DRIVER' format.`);e=t[0],n={[t[1]]:n}}if("function"==typeof n&&(n={[this.stateSourceName]:n}),!tr(n))throw new Error(`[${this.name}] Entry for each action must be an object: ${e}`);Object.entries(n).forEach((t=>{const[n,o]=t,s=`${e}::${n}`;if(c.has(s)&&console.warn(`[${this.name}] Duplicate model entry for action '${e}' on sink '${n}'. Only the last definition will take effect.`),c.add(s),n===Do){const t=this.makeEffectHandler(this.action$,e,o);return void(Array.isArray(a[n])?a[n].push(t):a[n]=[t])}const l=n===this.stateSourceName,u=n===Lo,d=l?r():i(),p=(u?d(e,o).map((t=>({name:this.name,component:this.view,value:t}))):d(e,o)).compose(this.log((t=>{if(l)return`<${e}> State reducer added`;if(u)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(a[n])?a[n].push(p):a[n]=[p]}))}));const l=Object.entries(a).reduce(((t,e)=>{const[n,o]=e;return t[n]=ao.merge(ao.never(),...o),t}),{});this.model$=l}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=ao.create({start:e=>{t=e.next.bind(e)},stop:t=>{}}).map((t=>ao.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=ao.create({start:t=>{this.newSubComponentSinks=t.next.bind(t)},stop:t=>{}});this._subscriptions.push(t.subscribe({next:t=>t,error:t=>console.error(`[${this.name}] Error in sub-component sink stream:`,t)})),this.subComponentSink$=t.filter((t=>Object.keys(t).length>0))}initSubComponentsRendered$(){const t=ao.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$=ao.of(null));const t=this.collectRenderParameters();this.vdom$=t.map((t=>{const{props:e,state:n,children:o,slots:r,context:i,...s}=t,{sygnalFactory:a,sygnalOptions:c,...l}=e||{};try{return this.view({...l,state:n,children:o,slots:r||{},context:i,peers:s},n,i,s)}catch(t){const e=t instanceof Error?t:new Error(String(t));if(console.error(`[${this.name}] Error in view:`,e),"function"==typeof this.onError)try{return this.onError(e,{componentName:this.name})}catch(t){console.error(`[${this.name}] Error in onError handler:`,t)}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=>qo(t,this))).map(zo).map(Yo).compose(this.instantiateSubComponents.bind(this)).filter((t=>void 0!==t)).compose(this.renderVdom.bind(this))}initSinks(){if(this.sinks=this.sourceNames.reduce(((t,e)=>{if(e==this.DOMSourceName)return t;const n=this.subComponentSink$&&e!==Lo?this.subComponentSink$.map((t=>t[e])).filter((t=>!!t)).flatten():ao.never();return e===this.stateSourceName?t[e]=ao.merge(this.model$[e]||ao.never(),n,this.sources[this.stateSourceName].stream.filter((t=>!1)),...this.peers$[e]||[]):t[e]=ao.merge(this.model$[e]||ao.never(),n,...this.peers$[e]||[]),t}),{}),this.sinks[this.DOMSourceName]=this.vdom$,this.sinks[Lo]=this.model$[Lo]||ao.never(),this.model$[Do]){const t=this.model$[Do].subscribe({next:()=>{},error:t=>console.error(`[${this.name}] Uncaught error in EFFECT stream:`,t)});this._subscriptions.push(t),delete this.sinks[Do]}this.model&&tr(this.model)&&Object.values(this.model).some((t=>!(!tr(t)||!(jo in t))))?(this.sinks[jo]=this.model$[jo],this.sinks[jo].__explicitReady=!0):this.sinks[jo]=ao.of(!0)}makeOnAction(t,e=!0,n){return n=n||t,(o,r)=>{const i=t.filter((({type:t})=>t==o));let s;if("function"==typeof r)s=i.map((t=>{const i=(t,e,r=10)=>{if("number"!=typeof r)throw new Error(`[${this.name}] Invalid delay value provided to next() function in model action '${o}'. Must be a number in ms.`);setTimeout((()=>{n.shamefullySendNext({type:t,data:e})}),r),this.log(`<${o}> Triggered a next() action: <${t}> ${r}ms delay`,!0)},s={...this.currentProps,children:this.currentChildren,slots:this.currentSlots||{},context:this.currentContext};let a=t.data;if(e)return t=>{const e=this.isSubComponent?this.currentState:t;try{const t=this.addCalculated(e);s.state=t;const n=r(t,a,i,s);return n===Mo?e:this.cleanupCalculated(n)}catch(t){return console.error(`[${this.name}] Error in model reducer '${o}':`,t),e}};try{const t=this.addCalculated(this.currentState);s.state=t;const e=r(t,a,i,s),n=typeof e;if(tr(e)||["string","number","boolean","function"].includes(n))return e;if("undefined"===n)return console.warn(`[${this.name}] 'undefined' value sent to ${o}`),e;throw new Error(`[${this.name}] Invalid reducer type for action '${o}': ${n}`)}catch(t){return console.error(`[${this.name}] Error in model reducer '${o}':`,t),Mo}})).filter((t=>t!==Mo));else if(void 0===r||!0===r)s=i.map((({data:t})=>t));else{const t=r;s=i.mapTo(t)}return s}}makeEffectHandler(t,e,n){return t.filter((({type:t})=>t==e)).map((o=>{if("function"==typeof n){const r=(n,o,r=10)=>{if("number"!=typeof r)throw new Error(`[${this.name}] Invalid delay value provided to next() function in EFFECT handler '${e}'. Must be a number in ms.`);setTimeout((()=>{t.shamefullySendNext({type:n,data:o})}),r),this.log(`<${e}> EFFECT triggered a next() action: <${n}> ${r}ms delay`,!0)};try{const t=this.addCalculated(this.currentState),i={...this.currentProps,children:this.currentChildren,slots:this.currentSlots||{},context:this.currentContext,state:t};void 0!==n(t,o.data,r,i)&&console.warn(`[${this.name}] EFFECT handler '${e}' returned a value. EFFECT handlers are for side effects only — return values are ignored.`)}catch(t){console.error(`[${this.name}] Error in EFFECT handler '${e}':`,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;if(!tr(this.calculated))throw new Error(`[${this.name}] 'calculated' parameter must be an object mapping calculated state field names to functions`);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 i=this._calculatedFieldCache[t],s=r.map((t=>e[t]));if(void 0!==i.lastDepValues){let o=!0;for(let t=0;t<s.length;t++)if(s[t]!==i.lastDepValues[t]){o=!1;break}if(o){n[t]=i.lastResult,e[t]=i.lastResult;continue}}try{const r=o(e);i.lastDepValues=s,i.lastResult=r,n[t]=r,e[t]=r}catch(e){console.warn(`Calculated field '${t}' threw an error during calculation: ${e instanceof Error?e.message:e}`)}}else try{const r=o(e);n[t]=r,e[t]=r}catch(e){console.warn(`Calculated field '${t}' threw an error during calculation: ${e instanceof Error?e.message:e}`)}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||ao.never();if(e.state=o.compose($o(Ko)),this.sources.props$&&(e.props=this.sources.props$.compose($o(Xo))),this.sources.children$){const t=this.sources.children$.map((t=>{if(!Array.isArray(t))return{children:t,slots:{}};const{slots:e,defaultChildren:n}=rr(t);return{children:n,slots:e}}));e.children=t.map((t=>t.children)).compose($o(Ko)),e.slots=t.map((t=>t.slots)).compose($o(Ko))}this.context$&&(e.context=this.context$.compose($o(Ko)));const r=[],i=[];Object.entries(e).forEach((([t,e])=>{r.push(t),i.push(e)}));return ao.combine(...i).compose(Co(1)).map((t=>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)),{})))}instantiateSubComponents(t){return t.fold(((t,e)=>{const n=Bo(e,Object.keys(this.components)),o=Object.entries(n),r={"::ROOT::":e};if(0===o.length)return this._activeSubComponents.forEach((t=>{t?.sink$?.__dispose&&t.sink$.__dispose()})),this._activeSubComponents.clear(),r;const i={},s=[];let a=0;const c=o.reduce(((e,[n,o])=>{const r=o.data,c=r.props||{},l=o.children||[],u=r.isCollection||!1,d=r.isSwitchable||!1,p=t=>{Object.entries(t).forEach((([t,e])=>{i[t]||(i[t]=[]),t===Lo?s.push(e):t!==this.DOMSourceName&&t!==jo&&i[t].push(e)}))};if(t[n]){const o=t[n];return e[n]=o,o.props$.shamefullySendNext(c),o.children$.shamefullySendNext(l),p(o.sink$),e}const h=ao.create().startWith(c),f=ao.create().startWith(l);let m,y;m=u?this.instantiateCollection.bind(this):d?this.instantiateSwitchable.bind(this):this.instantiateCustomComponent.bind(this),a++;try{y=m(o,h,f)}catch(t){const e=t instanceof Error?t:new Error(String(t));console.error(`[${this.name}] Error instantiating sub-component:`,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){console.error(`[${this.name}] Error in onError handler:`,t)}y={[this.DOMSourceName]:ao.of(n)}}return y[this.DOMSourceName]=y[this.DOMSourceName]?this.makeCoordinatedSubComponentDomSink(y[this.DOMSourceName]):ao.never(),e[n]={sink$:y,props$:h,children$:f},this._activeSubComponents.set(n,e[n]),p(y),e}),r),l=Object.entries(i).reduce(((t,[e,n])=>(0===n.length||(t[e]=1===n.length?n[0]:ao.merge(...n)),t)),{}),u=new Set(Object.keys(c));return this._activeSubComponents.forEach(((t,e)=>{u.has(e)||(t?.sink$?.__dispose&&t.sink$.__dispose(),this._activeSubComponents.delete(e),delete this._childReadyState[e])})),this.newSubComponentSinks(l),this.newChildSources(s),a>0&&this.log(`New sub components instantiated: ${a}`,!0),c}),{})}makeCoordinatedSubComponentDomSink(t){const e=t.remember();return this.sources[this.stateSourceName].stream.compose($o(Ko)).map((t=>e)).flatten().debug((t=>this.triggerSubComponentsRendered())).remember()}instantiateCollection(t,e,n){const o=t.data.props||{};const r={filter:"function"==typeof o.filter?o.filter:void 0,sort:or(o.sort)},i=ao.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState),e.startWith(o)).compose(Co(1)).map((([t,e])=>(e.filter!==r.filter&&(r.filter="function"==typeof e.filter?e.filter:void 0),e.sort!==r.sort&&(r.sort=or(e.sort)),tr(t)?this.addCalculated(t):t))),s=new Oe(i,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:i,peers:s,components:a,initialState:l,calculated:u,storeCalculatedInState:p,DOMSourceName:h,stateSourceName:f,onError:m,debug:y}=c;d=Ro({name:t,view:e,model:n,intent:o,hmrActions:r,context:i,peers:s,components:a,initialState:l,calculated:u,storeCalculatedInState:p,DOMSourceName:h,stateSourceName:f,onError:m,debug:y})}else{if(!this.components[c])throw new Error(`[${this.name}] Invalid 'of' property in collection: ${c}`);d=this.components[c]}const p={get:t=>{if(!Array.isArray(t[a]))return[];const e=t[a],n="function"==typeof r.filter?e.filter(r.filter):e;return("function"==typeof r.sort?n.sort(r.sort):n).map(((t,e)=>tr(t)?{...t,[l]:t[l]||e}:{value:t,[l]:e}))},set:(t,e)=>{if(this.calculated&&a in this.calculated)return console.warn(`Collection sub-component of ${this.name} attempted to update state on a calculated field '${a}': Update ignored`),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}}};void 0===a?u={get:t=>!(t instanceof Array)&&t.value&&t.value instanceof Array?t.value:t,set:(t,e)=>e}:"string"==typeof a?tr(this.currentState)?this.currentState&&a in this.currentState||this.calculated&&a in this.calculated?(Array.isArray(this.currentState[a])||console.warn(`[${this.name}] State property '${a}' in collection component is not an array: No components will be instantiated in the collection.`),u=p):(console.error(`Collection component in ${this.name} is attempting to use non-existent state property '${a}': To fix this error, specify a valid array property on the state. Attempting to use parent component state.`),u=void 0):(Array.isArray(this.currentState[a])||console.warn(`[${this.name}] State property '${a}' in collection component is not an array: No components will be instantiated in the collection.`),u=p):tr(a)?"function"!=typeof a.get?(console.error(`Collection component in ${this.name} has an invalid 'from' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting child state from the current state. Attempting to use parent component state.`),u=void 0):u={get:t=>{const e=a.get(t);return Array.isArray(e)?e:(console.warn(`State getter function in collection component of ${this.name} did not return an array: No components will be instantiated in the collection. Returned value:`,e),[])},set:a.set}:(console.error(`Collection component in ${this.name} has an invalid 'from' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting child state from the current state. Attempting to use parent component state.`),u=void 0);const h=["of","from","filter","sort","idfield","className"],f=e.map((t=>{if(!t||"object"!=typeof t)return{};const e={};for(const n in t)h.includes(n)||(e[n]=t[n]);return e})),m={...this.sources,[this.stateSourceName]:s,props$:f,children$:n,__parentContext$:this.context$,PARENT:null,__parentComponentNumber:this._componentNumber},y=ro(d,u,{container:null})(m);if(!tr(y))throw new Error(`[${this.name}] Invalid sinks returned from component factory of collection element`);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)),i=new Oe(r,this.stateSourceName),s=o.state;let a;const c={get:t=>t,set:(t,e)=>e};void 0===s?a=c:"string"==typeof s?a={get:t=>t[s],set:(t,e)=>this.calculated&&s in this.calculated?(console.warn(`Switchable sub-component of ${this.name} attempted to update state on a calculated field '${s}': Update ignored`),t):!tr(e)||Array.isArray(e)?{...t,[s]:e}:{...t,[s]:e}}:tr(s)?"function"!=typeof s.get?(console.error(`Switchable component in ${this.name} has an invalid 'state' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting sub-component state from the current state. Attempting to use parent component state.`),a=c):a={get:s.get,set:s.set}:(console.error(`Invalid state provided to switchable sub-component of ${this.name}: Expecting string, object, or undefined, but found ${typeof s}. Attempting to use parent component state.`),a=c);const l=o.of;Object.keys(l).forEach((t=>{const e=l[t];if(!e.isSygnalComponent){const n=e.componentName||e.label||e.name||"FUNCTION_COMPONENT",o=e,{model:r,intent:i,hmrActions:s,context:a,peers:c,components:u,initialState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_}=e,v={name:n,view:o,model:r,intent:i,hmrActions:s,context:a,peers:c,components:u,initialState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_};l[t]=Ro(v)}}));const u={...this.sources,[this.stateSourceName]:i,props$:e,children$:n,__parentContext$:this.context$,__parentComponentNumber:this._componentNumber},d=he(uo(l,e.map((t=>t.current)),""),{[this.stateSourceName]:a})(u);if(!tr(d))throw new Error(`[${this.name}] Invalid sinks returned from component factory of switchable element`);return d}instantiateCustomComponent(t,e,n){const o=t.sel,r=t.data.props||{},i=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>tr(t)?this.addCalculated(t):t)),s=new Oe(i,this.stateSourceName),a=r.state;"function"!=typeof r.sygnalFactory&&tr(r.sygnalOptions)&&(r.sygnalFactory=Ro(r.sygnalOptions));const c="sygnal-factory"===o?r.sygnalFactory:this.components[o]||r.sygnalFactory;if(!c){if("sygnal-factory"===o)throw new Error("Component not found on element with Capitalized selector and nameless function: JSX transpilation replaces selectors starting with upper case letters with functions in-scope with the same name, Sygnal cannot see the name of the resulting component.");throw new Error(`Component not found: ${o}`)}const l=r.sygnalOptions?.initialState,u=r.sygnalOptions?.isolatedState;if(l&&!u){const t=r.sygnalOptions?.name||o;throw new Error(`[${t}] Sub-component has .initialState but no .isolatedState = true. This will overwrite parent state. If this is intentional, add .isolatedState = true to the component.`)}let d;const p=u?l:void 0,h={get:t=>{const e=t[a];return void 0===e&&p?p:e},set:(t,e)=>this.calculated&&a in this.calculated?(console.warn(`Sub-component of ${this.name} attempted to update state on a calculated field '${a}': Update ignored`),t):{...t,[a]:e}},f={get:t=>t,set:(t,e)=>e};void 0===a?d=f:"string"==typeof a?d=h:tr(a)?"function"!=typeof a.get?(console.error(`Sub-component in ${this.name} has an invalid 'state' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting sub-component state from the current state. Attempting to use parent component state.`),d=f):d={get:a.get,set:a.set}:(console.error(`Invalid state provided to sub-component of ${this.name}: Expecting string, object, or undefined, but found ${typeof a}. Attempting to use parent component state.`),d=f);const m={...this.sources,[this.stateSourceName]:s,props$:e,children$:n,__parentContext$:this.context$,__parentComponentNumber:this._componentNumber};for(const t of Object.keys(r)){const e=r[t];if(e&&e.__sygnalCommand){m.commands$=fo(e);break}}const y=he(c,{[this.stateSourceName]:d})(m);if(!tr(y)){throw new Error(`Invalid sinks returned from component factory: ${"sygnal-factory"===o?"custom element":o}`)}return y}renderVdom(t){return ao.combine(this.subComponentsRendered$,t,this._readyChanged$.startWith(null)).compose(Co(1)).map((([t,e])=>{const n=Object.keys(this.components),o=e["::ROOT::"],r=Object.entries(e).filter((([t])=>"::ROOT::"!==t));if(0===r.length)return ao.of(Ho(o));const i=[],s=r.map((([t,e])=>(i.push(t),e.sink$[this.DOMSourceName].startWith(void 0))));if(0===s.length)return ao.of(o);for(const[t,e]of r){if(void 0!==this._childReadyState[t])continue;const n=e.sink$[jo];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)},error:()=>{},complete:()=>{}})}else this._childReadyState[t]=!0}return ao.combine(...s).compose(Co(1)).map((t=>{const e=t.reduce(((t,e,n)=>(t[i[n]]=e,t)),{});return Ho(Go(Zo(o),e,n,"r",void 0,this._childReadyState))}))})).flatten().filter((t=>!!t)).remember()}}function Bo(t,e,n="r",o){var r;if(!t)return{};if(t.data?.componentsProcessed)return{};"r"===n&&(t.data.componentsProcessed=!0);const i=t.sel,s=i&&"collection"===i.toLowerCase(),a=i&&"switchable"===i.toLowerCase(),c=i&&["collection","switchable","sygnal-factory",...e].includes(i)||"function"==typeof t.data?.props?.sygnalFactory||tr(t.data?.props?.sygnalOptions),l=t.data&&t.data.props||{};t.data&&t.data.attrs;const u=t.children||[];let d={},p=o;if(c){if(p=Uo(t,n,o),s){if(!l.of)throw new Error("Collection element missing required 'component' property");if("string"!=typeof l.of&&"function"!=typeof l.of)throw new Error(`Invalid 'component' property of collection element: found ${typeof l.of} requires string or component factory function`);if("function"!=typeof l.of&&!e.includes(l.of))throw new Error(`Specified component for collection not found: ${l.of}`);void 0===l.from||"string"==typeof l.from||Array.isArray(l.from)||"function"==typeof l.from.get||console.warn(`No valid array found for collection ${"string"==typeof l.of?l.of:"function component"}: no collection components will be created`,l.from),t.data.isCollection=!0,(r=t.data).props||(r.props={})}else if(a){if(!l.of)throw new Error("Switchable element missing required 'of' property");if(!tr(l.of))throw new Error(`Invalid 'of' property of switchable element: found ${typeof l.of} requires object mapping names to component factories`);if(!Object.values(l.of).every((t=>"function"==typeof t)))throw new Error("One or more components provided to switchable element is not a valid component factory");if(!l.current||"string"!=typeof l.current&&"function"!=typeof l.current)throw new Error(`Missing or invalid 'current' property for switchable element: found '${typeof l.current}' requires string or function`);if(!Object.keys(l.of).includes(l.current))throw new Error(`Component '${l.current}' not found in switchable element`);t.data.isSwitchable=!0}void 0===l.key&&(t.data.props.key=p),d[p]=t}return u.length>0&&u.map(((t,o)=>Bo(t,e,`${n}.${o}`,p))).forEach((t=>{Object.entries(t).forEach((([t,e])=>d[t]=e))})),d}function Go(t,e,n,o="r",r,i){if(!t)return;if(t.data?.componentsInjected)return t;"r"===o&&t.data&&(t.data.componentsInjected=!0);const s=t.sel||"NO SELECTOR",a=["collection","switchable","sygnal-factory",...n].includes(s)||"function"==typeof t.data?.props?.sygnalFactory||tr(t.data?.props?.sygnalOptions),c=t?.data?.isCollection;t.data&&t.data.props;const l=t.children||[];let u=r;if(a){u=Uo(t,o,r);let n=e[u];return i&&u&&n&&"object"==typeof n&&n.sel&&(n.data=n.data||{},n.data.attrs=n.data.attrs||{},n.data.attrs["data-sygnal-ready"]=!1!==i[u]?"true":"false"),c?(t.sel="div",t.children=Array.isArray(n)?n:[n],t):n}return l.length>0?(t.children=l.map(((t,r)=>Go(t,e,n,`${o}.${r}`,u,i))).flat(),t):t}function Uo(t,e,n){const o=t.sel,r="string"==typeof o?o:"functionComponent",i=t.data?.props||{};return`${n?`${n}|`:""}${r}::${i.id&&JSON.stringify(i.id).replaceAll('"',"")||e}`}function Vo(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(Vo(e))return!0;return!1}function Ho(t){if(!t||!t.sel)return t;if("suspense"===t.sel){const e=(t.data?.props||{}).fallback,n=t.children||[];return n.some(Vo)&&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?Ho(n[0]):{sel:"div",data:{attrs:{"data-sygnal-suspense":"resolved"}},children:n.map((t=>Ho(t))),text:void 0,elm:void 0,key:void 0}}return t.children&&t.children.length>0&&(t.children=t.children.map((t=>Ho(t)))),t}const Wo=tn(Hn);function zo(t){if(!t||!t.sel)return t;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=>{const o=document.querySelector(t);if(!o)return void console.warn(`[Portal] Target "${t}" not found in DOM`);const r=document.createElement("div");o.appendChild(r),e.data._portalVnode=Wo(r,{sel:"div",data:{},children:n,text:void 0,elm:void 0,key:void 0}),e.data._portalContainer=o},postpatch:(t,e)=>{const n=t.data?._portalVnode,o=t.data?._portalContainer;if(!n||!o)return;const r=e.data?.portalChildren||[];e.data._portalVnode=Wo(n,{sel:"div",data:{},children:r,text:void 0,elm:void 0,key:void 0}),e.data._portalContainer=o},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||[])}return t.children&&t.children.length>0&&(t.children=t.children.map(zo)),t}function Yo(t){if(!t||!t.sel)return t;if("transition"===t.sel){const e=t.data?.props||{},n=e.name||"v",o=e.duration,r=(t.children||[])[0];return r&&r.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`),Jo(r,n,(()=>{r.classList.remove(`${e}-enter-active`,`${e}-enter-to`)}))}))})))},t.data.hook.remove=(t,o)=>{r&&r(t,(()=>{}));const i=t.elm;i&&i.classList?(i.classList.add(`${e}-leave-from`,`${e}-leave-active`),requestAnimationFrame((()=>{requestAnimationFrame((()=>{i.classList.remove(`${e}-leave-from`),i.classList.add(`${e}-leave-to`),Jo(i,n,(()=>{i.classList.remove(`${e}-leave-active`,`${e}-leave-to`),o()}))}))}))):o()},t}(Yo(r),n,o):r||t}return t.children&&t.children.length>0&&(t.children=t.children.map(Yo)),t}function qo(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:i,hmrActions:s,context:a,peers:c,components:l,initialState:u,isolatedState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_}=e,v={name:o,view:e,model:r,intent:i,hmrActions:s,context:a,peers:c,components:l,initialState:u,isolatedState:d,calculated:p,storeCalculatedInState:h,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)})));return t.children&&t.children.length>0&&(t.children=t.children.map((t=>qo(t,e)))),t}function Jo(t,e,n){if("number"==typeof e)setTimeout(n,e);else{const e=()=>{t.removeEventListener("transitionend",e),n()};t.addEventListener("transitionend",e)}}function Zo(t){return void 0===t?t:{...t,children:Array.isArray(t.children)?t.children.map(Zo):void 0,data:t.data&&{...t.data,componentsInjected:!1}}}function Xo(t,e){return Ko(Qo(t),Qo(e))}function Ko(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(!Ko(t[r],e[r],n,o+1))return!1;return!0}const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(const s of r){if(!i.includes(s))return!1;if(!Ko(t[s],e[s],n,o+1))return!1}return!0}function Qo(t){if(!tr(t))return t;const{state:e,of:n,from:o,filter:r,...i}=t;return i}function tr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function er(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 nr(t){const e=Object.entries(t);if(e.length>1)return void console.error("Sort objects can only have one key:",t);const n=e[0],[o,r]=n;if(!["string","number"].includes(typeof r))return void console.error("Sort object properties must be a string or number:",t);let i=!0;if("string"==typeof r){if(!["asc","dec"].includes(r.toLowerCase()))return void console.error("Sort object string values must be asc or dec:",t);i="asc"===r.toLowerCase()}if("number"==typeof r){if(1!==r&&-1!==r)return void console.error("Sort object number values must be 1 or -1:",t);i=1===r}return(t,e)=>er(t[o],e[o],i)}function or(t){if(!t)return;const e=typeof t;if("function"===e)return t;if("string"===e){if("asc"===t.toLowerCase()||"dec"===t.toLowerCase()){const e="asc"===t.toLowerCase();return(t,n)=>er(t,n,e)}const e=t;return(t,n)=>er(t[e],n[e],!0)}if(Array.isArray(t)){const e=t.map((t=>"function"==typeof t?t:"string"!=typeof t||["asc","dec"].includes(t.toLowerCase())?tr(t)?nr(t):void 0:(e,n)=>er(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)?nr(t):void console.error("Invalid sort option (ignoring):",t)}function rr(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);return n.length>0&&(e.default||(e.default=[]),e.default.push(...n)),{slots:e,defaultChildren:e.default||[]}}const ir=t=>{const{children:e,...n}=t;return He("portal",{props:n},e)};ir.label="portal",ir.preventInstantiation=!0;const sr=t=>{const{children:e,...n}=t;return He("transition",{props:n},e)};sr.label="transition",sr.preventInstantiation=!0;const ar=t=>{const{children:e,...n}=t;return He("suspense",{props:n},e)};ar.label="suspense",ar.preventInstantiation=!0;const cr=t=>{const{children:e,...n}=t;return He("slot",{props:n},e)};function lr(t){return 0===Object.keys(t).length}function ur(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(lr(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(lr(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 i=n.map((e=>ce.fromObservable(t[e]).subscribe(r[e])));return n.forEach((t=>{const n=e[t],i=t=>{queueMicrotask((()=>n._n(t)))},s=t=>{queueMicrotask((()=>{(console.error||console.log)(t),n._e(t)}))};o[t]._n.forEach(i),o[t]._e.forEach(s),r[t].next=i,r[t].error=s,r[t]._n=i,r[t]._e=s})),o=null,function(){i.forEach((t=>t.unsubscribe()))}}(t,e)}function i(){!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:i}}(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 dr(t){const e=new EventTarget;return t.subscribe({next:t=>e.dispatchEvent(new CustomEvent("data",{detail:t})),error:t=>console.error("[EVENTS driver] Error in sink stream:",t)}),{select:t=>{const n=!t,o=Array.isArray(t)?t:[t];let r;return ue(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)}}))}}}function pr(t){t.addListener({next:t=>{console.log(t)},error:t=>{console.error("[LOG driver] Error in sink stream:",t)}})}cr.label="slot",cr.preventInstantiation=!0;class hr{constructor(){this._connected=!1,this._components=new Map,this._stateHistory=[],this._maxHistory=200}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"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(),_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,historyIndex:this._stateHistory.length-1})}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)})}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({historyIndex:t}){const e=this._stateHistory[t];if(!e)return;if("undefined"==typeof window)return;const n=window.__SYGNAL_DEVTOOLS_APP__;n?.sinks?.STATE?.shamefullySendNext&&(n.sinks.STATE.shamefullySendNext((()=>({...e.state}))),this._post("TIME_TRAVEL_APPLIED",{historyIndex:t,state:e.state}))}_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),props:this._safeClone(n.currentProps)})}}_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]"}}_serializeMeta(t){const{_instanceRef:e,...n}=t;return n}}let fr=null;function mr(){return fr||(fr=new hr),fr}function yr(t){if(!t)return null;const e=t.default||t;return"function"!=typeof e?null:t.default?t:{default:e}}function _r(t){return/^[a-zA-Z0-9-_]+$/.test(t)}function vr(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(!_r(e))throw new Error(`${e} is not a valid CSS class name`);return t.push(e),t}),[])}const gr=t=>(t=>"string"==typeof t)(t)||(t=>"number"==typeof t)(t),br={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 wr=Object.prototype.hasOwnProperty,Sr=Object.prototype.toString,Ar=Object.defineProperty,Er=Object.getOwnPropertyDescriptor,Or=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Sr.call(t)},Nr=function(t){if(!t||"[object Object]"!==Sr.call(t))return!1;var e,n=wr.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&wr.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!o)return!1;for(e in t);return void 0===e||wr.call(t,e)},Cr=function(t,e){Ar&&"__proto__"===e.name?Ar(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},$r=function(t,e){if("__proto__"===e){if(!wr.call(t,e))return;if(Er)return Er(t,e).value}return t[e]},Tr=function t(){var e,n,o,r,i,s,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=$r(a,n),a!==(r=$r(e,n))&&(u&&r&&(Nr(r)||(i=Or(r)))?(i?(i=!1,s=o&&Or(o)?o:[]):s=o&&Nr(o)?o:{},Cr(a,{name:n,newValue:t(u,s,r)})):void 0!==r&&Cr(a,{name:n,newValue:r}));return a},xr=o(Tr);const kr=(...t)=>xr(!1,...t),Lr=(t,e,n)=>{let o=n;for(let n=0;n<t.length;n++){const i=t[n];r=i,o=Array.isArray(r)?Lr(i,e,o):e(o,i)}var r;return o},jr=(t,e)=>Object.keys(t).map((n=>e(n,t[n]))).reduce(((t,e)=>((...t)=>xr(!0,...t))(t,e)),{}),Dr=(t,e)=>jr(e,((e,n)=>e!==t?{[e]:n}:{})),Ir=t=>gr(t)?{text:t,sel:void 0,data:void 0,children:void 0,elm:void 0,key:void 0}:void 0,Mr=t=>{if(!t||void 0===t.sel)return t;const e=t.data||{},n=e.props||{},o=Dr("className",n),r=void 0!==n.className?{class:n.className}:{},i=kr({},o,r,e.attrs||{});return kr(t,{data:Dr("props",kr({},e,{ns:"http://www.w3.org/2000/svg",attrs:i}))},{children:Array.isArray(t.children)&&"foreignObject"!==t.sel?t.children.map((t=>Mr(t))):t.children})},Pr=t=>t.sel in br?Mr(t):t,Rr={for:"attrs",role:"attrs",tabindex:"attrs","aria-*":"attrs",key:null},Fr=(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()}))},i=t.hook?.insert,s=t.hook?.postpatch;return t.hook={...t.hook,insert:t=>{i&&i(t),(e||n)&&r(t.elm)},postpatch:(t,e)=>{s&&s(t,e);const n=t.data?._autoFocus,o=e.data?._autoFocus;!n&&o&&r(e.elm)}},t})(((t,e)=>jr(t,((t,n)=>{const o={[t]:n};if(Rr[t]&&void 0!==e[Rr[t]])return{[Rr[t]]:o};if(null===Rr[t])return{};const r=Object.keys(Rr);for(let n=0;n<r.length;n++){const i=r[n];if("*"===i.charAt(i.length-1)&&0===t.indexOf(i.slice(0,-1))&&void 0!==e[Rr[i]])return{[Rr[i]]:o}}return void 0!==e[t]?{[e[t]?e[t]:t]:n}:void 0!==e.props?{props:o}:o})))(((t,e)=>jr(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,i=t.hook?.postpatch;return t.hook={...t.hook,insert:t=>{o&&o(t),n(t.elm)},postpatch:(t,e)=>{i&&i(t,e),n(e.elm)},destroy:t=>{r&&r(t),n(null)}},t})(r,n)},Br=t=>t.length>1||!gr(t[0])?void 0:t[0].toString(),Gr=t=>Lr(t,((t,e)=>{const n=(t=>"object"==typeof t&&null!==t)(o=e)&&"sel"in o&&"data"in o&&"children"in o&&"text"in o?e:Ir(e);var o;return t.push(n),t}),[]),Ur=(t=>(e,n,...o)=>{if(void 0===e&&(e="UNDEFINED",console.error("JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component's file scope.")),"function"==typeof e){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",i=e,{model:s,intent:a,hmrActions:c,context:l,peers:u,components:d,initialState:p,isolatedState:h,calculated:f,storeCalculatedInState:m,DOMSourceName:y,stateSourceName:_,onError:v,debug:g,preventInstantiation:b}=e;if(b){const e=Br(o),i=n?Fr(n,t):{};return Pr({sel:r,data:i,children:void 0!==e?Ir(e):Gr(o),text:e,elm:void 0,key:n?n.key:void 0})}const w={name:r,view:i,model:s,intent:a,hmrActions:c,context:l,peers:u,components:d,initialState:p,isolatedState:h,calculated:f,storeCalculatedInState:m,DOMSourceName:y,stateSourceName:_,onError:v,debug:g};n.sygnalOptions=w,e=r}}const r=Br(o);return Pr({sel:e,data:n?Fr(n,t):{},children:void 0!==r?Ir(r):Gr(o),text:r,elm:void 0,key:n?n.key:void 0})})({attrs:"",props:"",class:"",data:"dataset",style:"",hook:"",on:""});const Vr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Hr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Wr(t){return String(t).replace(/[&<>"']/g,(t=>Hr[t]))}function zr(t){return t.replace(/^(Webkit|Moz|Ms|O)/,(t=>"-"+t.toLowerCase())).replace(/([A-Z])/g,"-$1").toLowerCase()}function Yr(t,e,n){if(!t)return t;if("string"==typeof t||null!=t.text)return t;const o=t.sel;if("portal"===o){const o=t.children||[];return 0===o.length?null:1===o.length?Yr(o[0],e,n):{sel:"div",data:{attrs:{"data-sygnal-portal":""}},children:o.map((t=>Yr(t,e,n))),text:void 0,elm:void 0,key:void 0}}if("transition"===o){const o=(t.children||[])[0];return o?Yr(o,e,n):null}if("suspense"===o){const o=t.children||[];return 0===o.length?null:1===o.length?Yr(o[0],e,n):{sel:"div",data:{attrs:{"data-sygnal-suspense":"resolved"}},children:o.map((t=>Yr(t,e,n))),text:void 0,elm:void 0,key:void 0}}if("slot"===o){const o=t.children||[];return 0===o.length?null:1===o.length?Yr(o[0],e,n):{sel:"div",data:{},children:o.map((t=>Yr(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:i,...s}=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(i&&i.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=s.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 p={},h=[],f=t.children||[];for(const t of f)if(t&&"slot"===t.sel){const e=t.data?.props?.name||"default";p[e]||(p[e]=[]);const n=t.children||[];p[e].push(...n)}else h.push(t);h.length>0&&(p.default||(p.default=[]),p.default.push(...h));let m;try{m=a({...s,state:c,children:p.default||f,slots:p,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 Yr(m,u,c)}(t,e,n):"collection"===o?function(t,e,n){const o=t.data?.props||{},{of:r,from:i,className:s}=o;if(!r||!i||!n)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};const a=n[i];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},i=r.context||{};for(const e of Object.keys(i)){const n=i[e];if("function"==typeof n)try{o[e]=n(t)}catch(t){}}let s;try{s=r({state:t,children:[],slots:{},context:o,peers:{}},t,o,{})}catch(t){if("function"==typeof r.onError)try{s=r.onError(t,{componentName:r.name||"CollectionItem"})}catch(t){s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}else s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}return Yr(s,o,t)})).filter((t=>null!=t)),l={};s&&(l.props={className:s});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:i,initial:s}=o;if(!r)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};let a;"string"==typeof i&&(r[i]?a=i:n&&"string"==typeof n[i]&&(a=n[i]));!a&&s&&(a=s);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||{},i={...n};for(const t of Object.keys(r)){const e=r[t];if("function"==typeof e&&null!=o)try{i[t]=e(o)}catch(t){}}let s;try{s=t({state:o,children:[],slots:{},context:i,peers:{}},o,i,{})}catch(e){if("function"==typeof t.onError)try{s=t.onError(e,{componentName:t.name||"Component"})}catch(t){s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}else s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}s||(s={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0});return Yr(s,i,o)}(c,n,e)}(t,e,n):(t.children&&(Array.isArray(t.children)?t.children.length>0&&(t.children=t.children.map((t=>Yr(t,e,n))).filter((t=>null!=t))):t.children&&"object"==typeof t.children&&(t.children=Yr(t.children,e,n))),t)}function qr(t){if(null==t)return"";if("string"==typeof t)return Wr(t);if(null!=t.text&&!t.sel)return Wr(String(t.text));const e=t.sel;if(!e)return null!=t.text?Wr(String(t.text)):"";const{tag:n,id:o,selectorClasses:r}=function(t){let e=t,n=null;const o=[],r=t.indexOf("#");if(-1!==r){const i=t.slice(r+1),s=i.indexOf(".");if(-1!==s){n=i.slice(0,s),e=t.slice(0,r);const a=i.slice(s+1);a&&o.push(...a.split("."))}else n=i,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),i=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-${zr(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=zr(n);e.push(`${r}: ${o}`)}return e.join("; ")}(t.style);e&&o.push(["style",e])}return o}(t.data||{},o,r);let s=`<${n}`;for(const[t,e]of i)!0===e?s+=` ${t}`:!1!==e&&null!=e&&(s+=` ${t}="${Wr(String(e))}"`);if(s+=">",Vr.has(n))return s;if(null!=t.text)s+=Wr(String(t.text));else if(t.children){const e=Array.isArray(t.children)?t.children:[t.children];for(const t of e)s+=qr(t)}return s+=`</${n}>`,s}var Jr={};Object.defineProperty(Jr,"__esModule",{value:!0});var Zr=r,Xr=function(){function t(t,e){this.dt=t,this.ins=e,this.type="throttle",this.out=null,this.id=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.id=null},t.prototype.clearInterval=function(){var t=this.id;null!==t&&clearInterval(t),this.id=null},t.prototype._n=function(t){var e=this,n=this.out;n&&(this.id||(n._n(t),this.id=setInterval((function(){e.clearInterval()}),this.dt)))},t.prototype._e=function(t){var e=this.out;e&&(this.clearInterval(),e._e(t))},t.prototype._c=function(){var t=this.out;t&&(this.clearInterval(),t._c())},t}();var Kr=Jr.default=function(t){return function(e){return new Zr.Stream(new Xr(t,e))}};t.ABORT=Mo,t.Collection=io,t.MainDOMSource=Cn,t.MockedDOMSource=eo,t.Portal=ir,t.Slot=cr,t.Suspense=ar,t.Switchable=ho,t.Transition=sr,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(vr).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(!_r(n))throw new Error(`${n} is not a valid CSS class name`);return n})))):t.push(...vr(e)),t}),[]).join(" ")},t.collection=ro,t.component=Ro,t.createCommand=function(){const t={next:()=>{}};return{send:(e,n)=>t.next({type:e,data:n}),_stream:ao.create({start(e){t.next=t=>e.next(t)},stop(){t.next=()=>{}}}),__sygnalCommand:!0}},t.createElement=Ur,t.createRef=function(){return{current:null}},t.createRef$=function(){const t={next:()=>{}},e=ao.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=Ao,t.delay=vo,t.driverFromAsync=function(t,e={}){const{selector:n="category",args:o="value",return:r="value",pre:i=(t=>t),post:s=(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:()=>{}});return e.addListener({next:e=>{const l=i(e);let u=[];if("object"==typeof l&&null!==l){if("function"==typeof o){const t=o(l);u=Array.isArray(t)?t:[t]}"string"==typeof o&&(u=[l[o]]),Array.isArray(o)&&(u=o.map((t=>l[t])))}const d=`Error in driver created using driverFromAsync(${a})`;t(...u).then((t=>{const o=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};if("function"==typeof t.then)t.then((t=>{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(o(t))})).catch((t=>console.error(`${d}: ${t}`))):c(o(n))})).catch((t=>console.error(`${d}: ${t}`)));else{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(o(t))})).catch((t=>console.error(`${d}: ${t}`))):c(o(n))}})).catch((t=>console.error(`${d}: ${t}`)))},error:t=>{console.error(`Error received from sink stream in driver created using driverFromAsync(${a}):`,t)},complete:()=>{console.warn(`Unexpected completion of sink stream to driver created using driverFromAsync(${a})`)}}),{select:t=>void 0===t?l:"function"==typeof t?l.filter(t):l.filter((e=>e?.[n]===t))}}},t.dropRepeats=ge,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 i=e=>{Promise.resolve((async e=>{if(r)return;r=!0;const o=Array.isArray(e)?e.find(Boolean):e;try{let e=yr(o);if(e||"function"!=typeof n||(e=yr(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,i),e.accept(i),"function"==typeof e.dispose&&"function"==typeof t.dispose&&e.dispose((()=>t.dispose())),t},t.exactState=function(){return t=>t},t.getDevTools=mr,t.h=He,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=Qn,t.makeDragDriver=function(){return function(t){const e=new Map,n=new EventTarget,o=[];let r=null;const i=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(i)},error(){},complete(){}});const s=(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 s(`${t}:dragstart`,{element:e,dataset:{...e.dataset}})}}})),a("dragend",(()=>{r&&(s(`${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 i=n.target.closest(o.dropZone);if(!i)continue;n.preventDefault();let a=null;const c=r?e.get(r):null;return c?.draggable&&(a=n.target.closest(c.draggable)??null),void s(`${t}:drop`,{dropZone:i,insertBefore:a})}}));const c={select:t=>({events(e){const o=`${t}:${e}`;let r;return 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.mockDOMSource=no,t.portal=ir,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},i=e.querySelector("input[type=submit]:focus");if(i){const{name:t,value:e}=i;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={}}=e,i=t.name||t.componentName||"TestComponent",s=t,{intent:a,model:c,context:l,calculated:u,storeCalculatedInState:d,onError:p}=t,h=void 0!==n?n:t.initialState,f={next:()=>{}},m=ao.create({start(t){f.next=e=>t.next(e)},stop(){f.next=()=>{}}}),y={...c||{},__TEST_ACTION__:{STATE:(t,e)=>{if(!e||!e.type)return t;const{type:n,data:o}=e;let r=c?.[n];if(!r)for(const t of Object.keys(c||{}))if(t.includes("|")){const e=t.split("|").map((t=>t.trim()));if(e[0]===n){r={[e[1]]:c[t]};break}}if(!r)return t;if("function"==typeof r){const e=r(t,o);return"symbol"==typeof e?t:void 0!==e?e:t}if("object"==typeof r){const e=r.STATE||r[_];if("function"==typeof e){const n=e(t,o);return"symbol"==typeof n?t:void 0!==n?n:t}const n=r.EFFECT;if("function"==typeof n){n(t,o,((t,e)=>{setTimeout((()=>f.next({type:t,data:e})),10)}),{})}}return t}}},_="STATE",v=Fe(Ro({name:i,view:s,intent:a?t=>({...a(t),__TEST_ACTION__:m}):t=>({__TEST_ACTION__:m}),model:y,context:l,initialState:h,calculated:u,storeCalculatedInState:d,onError:p}),_),g={DOM:()=>no(o),EVENTS:dr,LOG:pr,...r},{sources:b,sinks:w,run:S}=ur(v,g),A=S(),E=[];let O=null;const N=b.STATE&&b.STATE.stream?b.STATE.stream:ao.never();return O={next:t=>E.push(t),error:()=>{},complete:()=>{}},N.addListener(O),{state$:N,dom$:w.DOM||ao.never(),events$:b.EVENTS||{select:()=>ao.never()},sinks:w,sources:b,simulateAction:(t,e)=>{f.next({type:t,data:e})},waitForState:(t,e=2e3)=>new Promise(((n,o)=>{for(const e of E)try{if(t(e))return n(e)}catch(t){}const r=setTimeout((()=>{try{N.removeListener(i)}catch(t){}o(new Error(`waitForState timed out after ${e}ms`))}),e),i={next:e=>{try{t(e)&&(clearTimeout(r),N.removeListener(i),n(e))}catch(t){}},error:t=>{clearTimeout(r),o(t)},complete:()=>{clearTimeout(r),o(new Error("waitForState: state stream completed without matching"))}};N.addListener(i)})),states:E,dispose:()=>{if(O){try{N.removeListener(O)}catch(t){}O=null}A()}}},t.renderToString=function(t,e={}){const{state:n,props:o={},context:r={},hydrateState:i}=e,s=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!=s)try{c[t]=e(s)}catch(t){}}let l;try{l=t({...o,state:s,children:o.children||[],slots:o.slots||{},context:c,peers:{}},s,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=Yr(l,c,s);let u=qr(l);if(i&&null!=s){const t="string"==typeof i?i:"__SYGNAL_STATE__";Wr(JSON.stringify(s)),u+=`<script>window.${t}=${JSON.stringify(s)}<\/script>`}return u},t.run=function t(e,n={},o={}){if("undefined"!=typeof window){mr().init()}const{mountPoint:r="#root",fragments:i=!0,useDefaultDrivers:s=!0}=o;if(!e.isSygnalComponent){const t=e.name||e.componentName||e.label||"FUNCTIONAL_COMPONENT",n=e,{model:o,intent:r,hmrActions:i,context:s,peers:a,components:c,initialState:l,calculated:u,storeCalculatedInState:d,DOMSourceName:p,stateSourceName:h,onError:f,debug:m}=e;e=Ro({name:t,view:n,model:o,intent:r,hmrActions:i,context:s,peers:a,components:c,initialState:l,calculated:u,storeCalculatedInState:d,DOMSourceName:p,stateSourceName:h,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 a=Fe(e,"STATE"),c={...s?{EVENTS:dr,DOM:Qn(r,{snabbdomOptions:{experimental:{fragments:i}}}),LOG:pr}:{},...n},{sources:l,sinks:u,run:d}=ur(a,c),p=d();let h=null;"undefined"!=typeof window&&l?.STATE?.stream&&"function"==typeof l.STATE.stream.addListener&&(h={next:t=>{window.__SYGNAL_HMR_PERSISTED_STATE=t},error:()=>{},complete:()=>{}},l.STATE.stream.addListener(h));const f={sources:l,sinks:u,dispose:()=>{h&&l?.STATE?.stream&&"function"==typeof l.STATE.stream.removeListener&&(l.STATE.stream.removeListener(h),h=null),p()}};"undefined"!=typeof window&&(window.__SYGNAL_DEVTOOLS_APP__=f);const m=(r,i)=>{const s="undefined"!=typeof window?window.__SYGNAL_HMR_PERSISTED_STATE:void 0,a=void 0!==s?s:e.initialState,c=void 0===i?a:i;"undefined"!=typeof window&&(window.__SYGNAL_HMR_UPDATING=!0,window.__SYGNAL_HMR_STATE=c,window.__SYGNAL_HMR_PERSISTED_STATE=c),f.dispose();const l=r.default||r;l.initialState=c;const u=t(l,n,o);if(f.sources=u.sources,f.sinks=u.sinks,f.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)},y=t=>t?Array.isArray(t)?y(t.find(Boolean)):t.default&&"function"==typeof t.default?t:"function"==typeof t?{default:t}:null:null;return f.hmr=(t,n)=>{const o=y(t)||{default:e};if(void 0!==n)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=n),void m(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 m(o,r);const i=f?.sources?.STATE?.stream?._v;if(void 0!==i)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=i),void m(o,i);f?.sinks?.STATE&&"function"==typeof f.sinks.STATE.shamefullySendNext?f.sinks.STATE.shamefullySendNext((t=>("undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=t),m(o,t),Mo))):m(o)},f},t.sampleCombine=In,t.switchable=uo,t.throttle=Kr,t.thunk=function(t,e,n,o){return void 0===o&&(o=n,n=e,e=void 0),He(t,{key:e,hook:{init:hn,prepatch:fn},fn:n,args:o})},t.xs=ao}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sygnal",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "An intuitive framework for building fast and small components or applications based on Cycle.js",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "types": "./dist/index.d.ts",
@@ -16,7 +16,11 @@ export type {Options} from 'snabbdom/build/init';
16
16
  export {toVNode} from 'snabbdom/build/tovnode';
17
17
  export {vnode} from 'snabbdom/build/vnode';
18
18
  export type {VNode, VNodeData} from 'snabbdom/build/vnode';
19
- export {Fragment} from 'snabbdom/build/jsx';
19
+ import {Fragment as _Fragment} from 'snabbdom/build/jsx';
20
+
21
+ // Tag Fragment so we can identify it even after minification mangles Function.name
22
+ (_Fragment as any).__sygnalFragment = true;
23
+ export const Fragment = _Fragment;
20
24
 
21
25
  // Module type
22
26
  export type {Module} from 'snabbdom/build/modules/module';
@@ -169,7 +169,7 @@ export const createElementWithModules = (modules: Record<string, any>) => {
169
169
  console.error('JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.')
170
170
  }
171
171
  if (is.fun(sel)) {
172
- if (sel.name === 'Fragment') {
172
+ if ((sel as any).__sygnalFragment || sel.name === 'Fragment') {
173
173
  return sel(data || {}, children)
174
174
  }
175
175
  data ||= {}