sygnal 2.2.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,187 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _extend = require('extend');
6
+ var snabbdom = require('snabbdom');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var _extend__default = /*#__PURE__*/_interopDefaultLegacy(_extend);
11
+
12
+ const undefinedv = (v) => v === undefined;
13
+
14
+ const number = (v) => typeof v === 'number';
15
+
16
+ const string = (v) => typeof v === 'string';
17
+
18
+ const text = (v) => string(v) || number(v);
19
+
20
+ const array = (v) => Array.isArray(v);
21
+
22
+ const object = (v) => typeof v === 'object' && v !== null;
23
+
24
+ const fun = (v) => typeof v === 'function';
25
+
26
+ const vnode = (v) => object(v) && 'sel' in v && 'data' in v && 'children' in v && 'text' in v;
27
+
28
+ const svgPropsMap = { svg: 1, circle: 1, ellipse: 1, line: 1, polygon: 1,
29
+ polyline: 1, rect: 1, g: 1, path: 1, text: 1 };
30
+
31
+ const svg = (v) => v.sel in svgPropsMap;
32
+
33
+ // TODO: stop using extend here
34
+
35
+ const extend = (...objs) => _extend__default["default"](true, ...objs);
36
+
37
+ const assign = (...objs) => _extend__default["default"](false, ...objs);
38
+
39
+ const reduceDeep = (arr, fn, initial) => {
40
+ let result = initial;
41
+ for (let i = 0; i < arr.length; i++) {
42
+ const value = arr[i];
43
+ if (array(value)) {
44
+ result = reduceDeep(value, fn, result);
45
+ } else {
46
+ result = fn(result, value);
47
+ }
48
+ }
49
+ return result
50
+ };
51
+
52
+ const mapObject = (obj, fn) => Object.keys(obj).map(
53
+ (key) => fn(key, obj[key])
54
+ ).reduce(
55
+ (acc, curr) => extend(acc, curr),
56
+ {}
57
+ );
58
+
59
+ const deepifyKeys = (obj, modules) => mapObject(obj,
60
+ (key, val) => {
61
+ const dashIndex = key.indexOf('-');
62
+ if (dashIndex > -1 && modules[key.slice(0, dashIndex)] !== undefined) {
63
+ const moduleData = {
64
+ [key.slice(dashIndex + 1)]: val
65
+ };
66
+ return {
67
+ [key.slice(0, dashIndex)]: moduleData
68
+ }
69
+ }
70
+ return { [key]: val }
71
+ }
72
+ );
73
+
74
+ const omit = (key, obj) => mapObject(obj,
75
+ (mod, data) => mod !== key ? ({ [mod]: data }) : {}
76
+ );
77
+
78
+ // Const fnName = (...params) => guard ? default : ...
79
+
80
+ const createTextElement = (text$1) => !text(text$1) ? undefined : {
81
+ text: text$1,
82
+ sel: undefined,
83
+ data: undefined,
84
+ children: undefined,
85
+ elm: undefined,
86
+ key: undefined
87
+ };
88
+
89
+ const considerSvg = (vnode) => !svg(vnode) ? vnode :
90
+ assign(vnode,
91
+ { data: omit('props', extend(vnode.data,
92
+ { ns: 'http://www.w3.org/2000/svg', attrs: omit('className', extend(vnode.data.props,
93
+ { class: vnode.data.props ? vnode.data.props.className : undefined }
94
+ )) }
95
+ )) },
96
+ { children: undefinedv(vnode.children) ? undefined :
97
+ vnode.children.map((child) => considerSvg(child))
98
+ }
99
+ );
100
+
101
+ const rewrites = {
102
+ for: 'attrs',
103
+ role: 'attrs',
104
+ tabindex: 'attrs',
105
+ 'aria-*': 'attrs',
106
+ key: null
107
+ };
108
+
109
+ const rewriteModules = (data, modules) => mapObject(data, (key, val) => {
110
+ const inner = { [key]: val };
111
+ if (rewrites[key] && modules[rewrites[key]] !== undefined) {
112
+ return { [rewrites[key]]: inner }
113
+ }
114
+ if (rewrites[key] === null) {
115
+ return {}
116
+ }
117
+ const keys = Object.keys(rewrites);
118
+ for (let i = 0; i < keys.length; i++) {
119
+ const k = keys[i];
120
+ if (k.charAt(k.length - 1) === '*' && key.indexOf(k.slice(0, -1)) === 0 && modules[rewrites[k]] !== undefined) {
121
+ return { [rewrites[k]]: inner }
122
+ }
123
+ }
124
+ if (modules[key] !== undefined) {
125
+ return { [modules[key] ? modules[key] : key]: val }
126
+ }
127
+ if (modules.props !== undefined) {
128
+ return { props: inner }
129
+ }
130
+ return inner
131
+ });
132
+
133
+ const sanitizeData = (data, modules) => considerSvg(rewriteModules(deepifyKeys(data, modules), modules));
134
+
135
+ const sanitizeText = (children) => children.length > 1 || !text(children[0]) ? undefined : children[0].toString();
136
+
137
+ const sanitizeChildren = (children) => reduceDeep(children, (acc, child) => {
138
+ const vnode$1 = vnode(child) ? child : createTextElement(child);
139
+ acc.push(vnode$1);
140
+ return acc
141
+ }
142
+ , []);
143
+
144
+ const defaultModules = {
145
+ attrs: '',
146
+ props: '',
147
+ class: '',
148
+ data: 'dataset',
149
+ style: '',
150
+ hook: '',
151
+ on: ''
152
+ };
153
+
154
+ const createElementWithModules = (modules) => {
155
+ return (sel, data, ...children) => {
156
+ if (typeof sel === 'undefined') {
157
+ sel = 'UNDEFINED';
158
+ cnosole.error('JSX Error: Capitalized HTML element without corresponding Sygnal factory. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.');
159
+ }
160
+ if (fun(sel)) {
161
+ if (sel.name === 'Fragment') {
162
+ return sel(data || {}, children)
163
+ }
164
+ const factory = sel;
165
+ sel = sel.name || 'sygnal-factory';
166
+ data ||= {};
167
+ data.sygnalFactory = factory;
168
+ }
169
+ const text = sanitizeText(children);
170
+ return considerSvg({
171
+ sel,
172
+ data: data ? sanitizeData(data, modules) : {},
173
+ children: typeof text !== 'undefined' ? undefined : sanitizeChildren(children),
174
+ text,
175
+ elm: undefined,
176
+ key: data ? data.key : undefined
177
+ })
178
+ }
179
+ };
180
+
181
+ const createElement = createElementWithModules(defaultModules);
182
+
183
+ Object.defineProperty(exports, 'Fragment', {
184
+ enumerable: true,
185
+ get: function () { return snabbdom.Fragment; }
186
+ });
187
+ exports.jsx = createElement;
@@ -0,0 +1,175 @@
1
+ import _extend from 'extend';
2
+ export { Fragment } from 'snabbdom';
3
+
4
+ const undefinedv = (v) => v === undefined;
5
+
6
+ const number = (v) => typeof v === 'number';
7
+
8
+ const string = (v) => typeof v === 'string';
9
+
10
+ const text = (v) => string(v) || number(v);
11
+
12
+ const array = (v) => Array.isArray(v);
13
+
14
+ const object = (v) => typeof v === 'object' && v !== null;
15
+
16
+ const fun = (v) => typeof v === 'function';
17
+
18
+ const vnode = (v) => object(v) && 'sel' in v && 'data' in v && 'children' in v && 'text' in v;
19
+
20
+ const svgPropsMap = { svg: 1, circle: 1, ellipse: 1, line: 1, polygon: 1,
21
+ polyline: 1, rect: 1, g: 1, path: 1, text: 1 };
22
+
23
+ const svg = (v) => v.sel in svgPropsMap;
24
+
25
+ // TODO: stop using extend here
26
+
27
+ const extend = (...objs) => _extend(true, ...objs);
28
+
29
+ const assign = (...objs) => _extend(false, ...objs);
30
+
31
+ const reduceDeep = (arr, fn, initial) => {
32
+ let result = initial;
33
+ for (let i = 0; i < arr.length; i++) {
34
+ const value = arr[i];
35
+ if (array(value)) {
36
+ result = reduceDeep(value, fn, result);
37
+ } else {
38
+ result = fn(result, value);
39
+ }
40
+ }
41
+ return result
42
+ };
43
+
44
+ const mapObject = (obj, fn) => Object.keys(obj).map(
45
+ (key) => fn(key, obj[key])
46
+ ).reduce(
47
+ (acc, curr) => extend(acc, curr),
48
+ {}
49
+ );
50
+
51
+ const deepifyKeys = (obj, modules) => mapObject(obj,
52
+ (key, val) => {
53
+ const dashIndex = key.indexOf('-');
54
+ if (dashIndex > -1 && modules[key.slice(0, dashIndex)] !== undefined) {
55
+ const moduleData = {
56
+ [key.slice(dashIndex + 1)]: val
57
+ };
58
+ return {
59
+ [key.slice(0, dashIndex)]: moduleData
60
+ }
61
+ }
62
+ return { [key]: val }
63
+ }
64
+ );
65
+
66
+ const omit = (key, obj) => mapObject(obj,
67
+ (mod, data) => mod !== key ? ({ [mod]: data }) : {}
68
+ );
69
+
70
+ // Const fnName = (...params) => guard ? default : ...
71
+
72
+ const createTextElement = (text$1) => !text(text$1) ? undefined : {
73
+ text: text$1,
74
+ sel: undefined,
75
+ data: undefined,
76
+ children: undefined,
77
+ elm: undefined,
78
+ key: undefined
79
+ };
80
+
81
+ const considerSvg = (vnode) => !svg(vnode) ? vnode :
82
+ assign(vnode,
83
+ { data: omit('props', extend(vnode.data,
84
+ { ns: 'http://www.w3.org/2000/svg', attrs: omit('className', extend(vnode.data.props,
85
+ { class: vnode.data.props ? vnode.data.props.className : undefined }
86
+ )) }
87
+ )) },
88
+ { children: undefinedv(vnode.children) ? undefined :
89
+ vnode.children.map((child) => considerSvg(child))
90
+ }
91
+ );
92
+
93
+ const rewrites = {
94
+ for: 'attrs',
95
+ role: 'attrs',
96
+ tabindex: 'attrs',
97
+ 'aria-*': 'attrs',
98
+ key: null
99
+ };
100
+
101
+ const rewriteModules = (data, modules) => mapObject(data, (key, val) => {
102
+ const inner = { [key]: val };
103
+ if (rewrites[key] && modules[rewrites[key]] !== undefined) {
104
+ return { [rewrites[key]]: inner }
105
+ }
106
+ if (rewrites[key] === null) {
107
+ return {}
108
+ }
109
+ const keys = Object.keys(rewrites);
110
+ for (let i = 0; i < keys.length; i++) {
111
+ const k = keys[i];
112
+ if (k.charAt(k.length - 1) === '*' && key.indexOf(k.slice(0, -1)) === 0 && modules[rewrites[k]] !== undefined) {
113
+ return { [rewrites[k]]: inner }
114
+ }
115
+ }
116
+ if (modules[key] !== undefined) {
117
+ return { [modules[key] ? modules[key] : key]: val }
118
+ }
119
+ if (modules.props !== undefined) {
120
+ return { props: inner }
121
+ }
122
+ return inner
123
+ });
124
+
125
+ const sanitizeData = (data, modules) => considerSvg(rewriteModules(deepifyKeys(data, modules), modules));
126
+
127
+ const sanitizeText = (children) => children.length > 1 || !text(children[0]) ? undefined : children[0].toString();
128
+
129
+ const sanitizeChildren = (children) => reduceDeep(children, (acc, child) => {
130
+ const vnode$1 = vnode(child) ? child : createTextElement(child);
131
+ acc.push(vnode$1);
132
+ return acc
133
+ }
134
+ , []);
135
+
136
+ const defaultModules = {
137
+ attrs: '',
138
+ props: '',
139
+ class: '',
140
+ data: 'dataset',
141
+ style: '',
142
+ hook: '',
143
+ on: ''
144
+ };
145
+
146
+ const createElementWithModules = (modules) => {
147
+ return (sel, data, ...children) => {
148
+ if (typeof sel === 'undefined') {
149
+ sel = 'UNDEFINED';
150
+ cnosole.error('JSX Error: Capitalized HTML element without corresponding Sygnal factory. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.');
151
+ }
152
+ if (fun(sel)) {
153
+ if (sel.name === 'Fragment') {
154
+ return sel(data || {}, children)
155
+ }
156
+ const factory = sel;
157
+ sel = sel.name || 'sygnal-factory';
158
+ data ||= {};
159
+ data.sygnalFactory = factory;
160
+ }
161
+ const text = sanitizeText(children);
162
+ return considerSvg({
163
+ sel,
164
+ data: data ? sanitizeData(data, modules) : {},
165
+ children: typeof text !== 'undefined' ? undefined : sanitizeChildren(children),
166
+ text,
167
+ elm: undefined,
168
+ key: data ? data.key : undefined
169
+ })
170
+ }
171
+ };
172
+
173
+ const createElement = createElementWithModules(defaultModules);
174
+
175
+ export { createElement as jsx };
@@ -0,0 +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";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},r={exports:{}},o={};!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}}(o),function(t){t.exports=o}(r);var i,s,a=Object.prototype.toString,u=function(t){var e=a.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]"===a.call(t.callee)),n};var c=Array.prototype.slice,p=u,l=Object.keys,f=l?function(t){return l(t)}:function(){if(s)return i;var t;if(s=1,!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=u,o=Object.prototype.propertyIsEnumerable,a=!o.call({toString:null},"toString"),c=o.call((function(){}),"prototype"),p=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=t.constructor;return e&&e.prototype===t},f={$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(!f["$"+t]&&e.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{l(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();t=function(t){var o=null!==t&&"object"==typeof t,i="[object Function]"===n.call(t),s=r(t),u=o&&"[object String]"===n.call(t),f=[];if(!o&&!i&&!s)throw new TypeError("Object.keys called on a non-object");var d=c&&i;if(u&&t.length>0&&!e.call(t,0))for(var y=0;y<t.length;++y)f.push(String(y));if(s&&t.length>0)for(var m=0;m<t.length;++m)f.push(String(m));else for(var v in t)d&&"prototype"===v||!e.call(t,v)||f.push(String(v));if(a)for(var g=function(t){if("undefined"==typeof window||!h)return l(t);try{return l(t)}catch(t){return!1}}(t),b=0;b<p.length;++b)g&&"constructor"===p[b]||!e.call(t,p[b])||f.push(p[b]);return f}}return i=t}(),h=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)?h(c.call(t)):h(t)})}else Object.keys=f;return Object.keys||f};var d,y=f,m="undefined"!=typeof Symbol&&Symbol,v=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 r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0},g="Function.prototype.bind called on incompatible ",b=Array.prototype.slice,_=Object.prototype.toString,w="[object Function]",S=function(t){var e=this;if("function"!=typeof e||_.call(e)!==w)throw new TypeError(g+e);for(var n,r=b.call(arguments,1),o=function(){if(this instanceof n){var o=e.apply(this,r.concat(b.call(arguments)));return Object(o)===o?o:this}return e.apply(t,r.concat(b.call(arguments)))},i=Math.max(0,e.length-r.length),s=[],a=0;a<i;a++)s.push("$"+a);if(n=Function("binder","return function ("+s.join(",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var u=function(){};u.prototype=e.prototype,n.prototype=new u,u.prototype=null}return n},O=Function.prototype.bind||S,E=O.call(Function.call,Object.prototype.hasOwnProperty),A=SyntaxError,j=Function,N=TypeError,$=function(t){try{return j('"use strict"; return ('+t+").constructor;")()}catch(t){}},C=Object.getOwnPropertyDescriptor;if(C)try{C({},"")}catch(t){C=null}var k=function(){throw new N},I=C?function(){try{return k}catch(t){try{return C(arguments,"callee").get}catch(t){return k}}}():k,x="function"==typeof m&&"function"==typeof Symbol&&"symbol"==typeof m("foo")&&"symbol"==typeof Symbol("bar")&&v(),P=Object.getPrototypeOf||function(t){return t.__proto__},M={},T="undefined"==typeof Uint8Array?d:P(Uint8Array),D={"%AggregateError%":"undefined"==typeof AggregateError?d:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?d:ArrayBuffer,"%ArrayIteratorPrototype%":x?P([][Symbol.iterator]()):d,"%AsyncFromSyncIteratorPrototype%":d,"%AsyncFunction%":M,"%AsyncGenerator%":M,"%AsyncGeneratorFunction%":M,"%AsyncIteratorPrototype%":M,"%Atomics%":"undefined"==typeof Atomics?d:Atomics,"%BigInt%":"undefined"==typeof BigInt?d:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?d:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?d:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?d:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?d:FinalizationRegistry,"%Function%":j,"%GeneratorFunction%":M,"%Int8Array%":"undefined"==typeof Int8Array?d:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?d:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?d:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":x?P(P([][Symbol.iterator]())):d,"%JSON%":"object"==typeof JSON?JSON:d,"%Map%":"undefined"==typeof Map?d:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&x?P((new Map)[Symbol.iterator]()):d,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?d:Promise,"%Proxy%":"undefined"==typeof Proxy?d:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?d:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?d:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&x?P((new Set)[Symbol.iterator]()):d,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?d:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":x?P(""[Symbol.iterator]()):d,"%Symbol%":x?Symbol:d,"%SyntaxError%":A,"%ThrowTypeError%":I,"%TypedArray%":T,"%TypeError%":N,"%Uint8Array%":"undefined"==typeof Uint8Array?d:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?d:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?d:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?d:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?d:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?d:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?d:WeakSet},L=function t(e){var n;if("%AsyncFunction%"===e)n=$("async function () {}");else if("%GeneratorFunction%"===e)n=$("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=$("async function* () {}");else if("%AsyncGenerator%"===e){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var o=t("%AsyncGenerator%");o&&(n=P(o.prototype))}return D[e]=n,n},F={"%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"]},B=O,q=E,R=B.call(Function.call,Array.prototype.concat),U=B.call(Function.apply,Array.prototype.splice),W=B.call(Function.call,String.prototype.replace),G=B.call(Function.call,String.prototype.slice),V=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,H=/\\(\\)?/g,J=function(t){var e=G(t,0,1),n=G(t,-1);if("%"===e&&"%"!==n)throw new A("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new A("invalid intrinsic syntax, expected opening `%`");var r=[];return W(t,V,(function(t,e,n,o){r[r.length]=n?W(o,H,"$1"):e||t})),r},z=function(t,e){var n,r=t;if(q(F,r)&&(r="%"+(n=F[r])[0]+"%"),q(D,r)){var o=D[r];if(o===M&&(o=L(r)),void 0===o&&!e)throw new N("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:o}}throw new A("intrinsic "+t+" does not exist!")},Z=function(t,e){if("string"!=typeof t||0===t.length)throw new N("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new N('"allowMissing" argument must be a boolean');var n=J(t),r=n.length>0?n[0]:"",o=z("%"+r+"%",e),i=o.name,s=o.value,a=!1,u=o.alias;u&&(r=u[0],U(n,R([0,1],u)));for(var c=1,p=!0;c<n.length;c+=1){var l=n[c],f=G(l,0,1),h=G(l,-1);if(('"'===f||"'"===f||"`"===f||'"'===h||"'"===h||"`"===h)&&f!==h)throw new A("property names with quotes must have matching quotes");if("constructor"!==l&&p||(a=!0),q(D,i="%"+(r+="."+l)+"%"))s=D[i];else if(null!=s){if(!(l in s)){if(!e)throw new N("base intrinsic for "+t+" exists, but the property is not available.");return}if(C&&c+1>=n.length){var d=C(s,l);s=(p=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:s[l]}else p=q(s,l),s=s[l];p&&!a&&(D[i]=s)}}return s},X=Z("%Object.defineProperty%",!0),Y=function(){if(X)try{return X({},"a",{value:1}),!0}catch(t){return!1}return!1};Y.hasArrayLengthDefineBug=function(){if(!Y())return null;try{return 1!==X([],"length",{value:1}).length}catch(t){return!0}};var K=Y,Q=y,tt="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),et=Object.prototype.toString,nt=Array.prototype.concat,rt=Object.defineProperty,ot=K(),it=rt&&ot,st=function(t,e,n,r){var o;(!(e in t)||"function"==typeof(o=r)&&"[object Function]"===et.call(o)&&r())&&(it?rt(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n)},at=function(t,e){var n=arguments.length>2?arguments[2]:{},r=Q(e);tt&&(r=nt.call(r,Object.getOwnPropertySymbols(e)));for(var o=0;o<r.length;o+=1)st(t,r[o],e[r[o]],n[r[o]])};at.supportsDescriptors=!!it;var ut=e,ct=function(){return"object"==typeof e&&e&&e.Math===Math&&e.Array===Array?e:ut},pt=at,lt=ct,ft=at,ht=e,dt=ct,yt=function(){var t=lt();if(pt.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},mt=dt(),vt=function(){return mt};ft(vt,{getPolyfill:dt,implementation:ht,shim:yt});var gt,bt=vt,_t=e&&e.__extends||(gt=function(t,e){return gt=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])},gt(t,e)},function(t,e){function n(){this.constructor=t}gt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0}),n.NO_IL=n.NO=n.MemoryStream=te=n.Stream=void 0;var wt=bt,St=r.exports.default(wt.getPolyfill()),Ot={},Et=n.NO=Ot;function At(){}function jt(t){for(var e=t.length,n=Array(e),r=0;r<e;++r)n[r]=t[r];return n}function Nt(t,e,n){try{return t.f(e)}catch(t){return n._e(t),Ot}}var $t={_n:At,_e:At,_c:At};function Ct(t){t._start=function(t){t.next=t._n,t.error=t._e,t.complete=t._c,this.start(t)},t._stop=t.stop}n.NO_IL=$t;var kt=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}(),xt=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=Ot,this.ac=0}return t.prototype._start=function(t){this.out=t;var e=this.insArr,n=e.length;this.ac=n;for(var r=0;r<n;r++)e[r]._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=Ot},t.prototype._n=function(t){var e=this.out;e!==Ot&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){if(--this.ac<=0){var t=this.out;if(t===Ot)return;t._c()}},t}(),Mt=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!==Ot&&e.up(t,this.i)){var r=jt(e.vals);n._n(r)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.p;t.out!==Ot&&0==--t.Nc&&t.out._c()},t}(),Tt=function(){function t(t){this.type="combine",this.insArr=t,this.out=Ot,this.ils=[],this.Nc=this.Nn=0,this.vals=[]}return t.prototype.up=function(t,e){var n=this.vals[e],r=this.Nn?n===Ot?--this.Nn:this.Nn:0;return this.vals[e]=t,0===r},t.prototype._start=function(t){this.out=t;var e=this.insArr,n=this.Nc=this.Nn=e.length,r=this.vals=new Array(n);if(0===n)t._n([]),t._c();else for(var o=0;o<n;o++)r[o]=Ot,e[o]._add(new Mt(o,t,this))},t.prototype._stop=function(){for(var t=this.insArr,e=t.length,n=this.ils,r=0;r<e;r++)t[r]._remove(n[r]);this.out=Ot,this.ils=[],this.vals=[]},t}(),Dt=function(){function t(t){this.type="fromArray",this.a=t}return t.prototype._start=function(t){for(var e=this.a,n=0,r=e.length;n<r;n++)t._n(e[n]);t._c()},t.prototype._stop=function(){},t}(),Lt=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(At,(function(t){setTimeout((function(){throw t}))}))},t.prototype._stop=function(){this.on=!1},t}(),Ft=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}(),Bt=function(){function t(t,e){this.type="debug",this.ins=t,this.out=Ot,this.s=At,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=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=this.s,r=this.l;if(n!==At)try{n(t)}catch(t){e._e(t)}else r?console.log(r+":",t):console.log(t);e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),qt=function(){function t(t,e){this.type="drop",this.ins=e,this.out=Ot,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=Ot},t.prototype._n=function(t){var e=this.out;e!==Ot&&this.dropped++>=this.max&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Rt=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}(),Ut=function(){function t(t,e){this.type="endWhen",this.ins=e,this.out=Ot,this.o=t,this.oil=$t}return t.prototype._start=function(t){this.out=t,this.o._add(this.oil=new Rt(t,this)),this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.o._remove(this.oil),this.out=Ot,this.oil=$t},t.prototype.end=function(){var t=this.out;t!==Ot&&t._c()},t.prototype._n=function(t){var e=this.out;e!==Ot&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){this.end()},t}(),Wt=function(){function t(t,e){this.type="filter",this.ins=e,this.out=Ot,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=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=Nt(this,t,e);n!==Ot&&n&&e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Gt=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=Ot,this.op.less()},t}(),Vt=function(){function t(t){this.type="flatten",this.ins=t,this.out=Ot,this.open=!0,this.inner=Ot,this.il=$t}return t.prototype._start=function(t){this.out=t,this.open=!0,this.inner=Ot,this.il=$t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.inner!==Ot&&this.inner._remove(this.il),this.out=Ot,this.open=!0,this.inner=Ot,this.il=$t},t.prototype.less=function(){var t=this.out;t!==Ot&&(this.open||this.inner!==Ot||t._c())},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=this.inner,r=this.il;n!==Ot&&r!==$t&&n._remove(r),(this.inner=t)._add(this.il=new Gt(e,this))}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){this.open=!1,this.less()},t}(),Ht=function(){function t(t,e,n){var r=this;this.type="fold",this.ins=n,this.out=Ot,this.f=function(e){return t(r.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=Ot,this.acc=this.seed},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=Nt(this,t,e);n!==Ot&&e._n(this.acc=n)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Jt=function(){function t(t){this.type="last",this.ins=t,this.out=Ot,this.has=!1,this.val=Ot}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=Ot,this.val=Ot},t.prototype._n=function(t){this.has=!0,this.val=t},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&(this.has?(t._n(this.val),t._c()):t._e(new Error("last() failed because input stream completed")))},t}(),zt=function(){function t(t,e){this.type="map",this.ins=e,this.out=Ot,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=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=Nt(this,t,e);n!==Ot&&e._n(n)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Zt=function(){function t(t){this.type="remember",this.ins=t,this.out=Ot}return t.prototype._start=function(t){this.out=t,this.ins._add(t)},t.prototype._stop=function(){this.ins._remove(this.out),this.out=Ot},t}(),Xt=function(){function t(t,e){this.type="replaceError",this.ins=e,this.out=Ot,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=Ot},t.prototype._n=function(t){var e=this.out;e!==Ot&&e._n(t)},t.prototype._e=function(t){var e=this.out;if(e!==Ot)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!==Ot&&t._c()},t}(),Yt=function(){function t(t,e){this.type="startWith",this.ins=t,this.out=Ot,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=Ot},t}(),Kt=function(){function t(t,e){this.type="take",this.ins=e,this.out=Ot,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=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){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!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Qt=function(){function t(t){this._prod=t||Ot,this._ils=[],this._stopID=Ot,this._dl=Ot,this._d=!1,this._target=null,this._err=Ot}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 r=jt(e),o=0;o<n;o++)r[o]._n(t)}},t.prototype._e=function(t){if(this._err===Ot){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 r=jt(e),o=0;o<n;o++)r[o]._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=jt(t),r=0;r<e;r++)n[r]._c()}},t.prototype._x=function(){0!==this._ils.length&&(this._prod!==Ot&&this._prod._stop(),this._err=Ot,this._ils=[])},t.prototype._stopNow=function(){this._prod._stop(),this._err=Ot,this._stopID=Ot},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!==Ot)clearTimeout(this._stopID),this._stopID=Ot;else{var r=this._prod;r!==Ot&&r._start(this)}},t.prototype._remove=function(t){var e=this,n=this._target;if(n)return n._remove(t);var r=this._ils,o=r.indexOf(t);o>-1&&(r.splice(o,1),this._prod!==Ot&&r.length<=0?(this._err=Ot,this._stopID=setTimeout((function(){return e._stopNow()}))):1===r.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!==Ot)return this._hasNoSinks(t.out,e.concat(t));if(t._ils){for(var n=0,r=t._ils.length;n<r;n++)if(!this._hasNoSinks(t._ils[n],e.concat(t)))return!1;return!0}return!1},t.prototype.ctor=function(){return this instanceof ee?ee:t},t.prototype.addListener=function(t){t._n=t.next||At,t._e=t.error||At,t._c=t.complete||At,this._add(t)},t.prototype.removeListener=function(t){this._remove(t)},t.prototype.subscribe=function(t){return this.addListener(t),new kt(this,t)},t.prototype[St]=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");Ct(e)}return new t(e)},t.createWithMemory=function(t){return t&&Ct(t),new ee(t)},t.never=function(){return new t({_start:At,_stop:At})},t.empty=function(){return new t({_start:function(t){t._c()},_stop:At})},t.throw=function(e){return new t({_start:function(t){t._e(e)},_stop:At})},t.from=function(e){if("function"==typeof e[St])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 Dt(e))},t.fromPromise=function(e){return new t(new Lt(e))},t.fromObservable=function(e){if(void 0!==e.endWhen)return e;var n="function"==typeof e[St]?e[St]():e;return new t(new xt(n))},t.periodic=function(e){return new t(new Ft(e))},t.prototype._map=function(t){return new(this.ctor())(new zt(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,r,o=this._prod;return new t(o instanceof Wt?new Wt((n=o.f,r=e,function(t){return n(t)&&r(t)}),o.ins):new Wt(e,this))},t.prototype.take=function(t){return new(this.ctor())(new Kt(t,this))},t.prototype.drop=function(e){return new t(new qt(e,this))},t.prototype.last=function(){return new t(new Jt(this))},t.prototype.startWith=function(t){return new ee(new Yt(this,t))},t.prototype.endWhen=function(t){return new(this.ctor())(new Ut(t,this))},t.prototype.fold=function(t,e){return new ee(new Ht(t,e,this))},t.prototype.replaceError=function(t){return new(this.ctor())(new Xt(t,this))},t.prototype.flatten=function(){return new t(new Vt(this))},t.prototype.compose=function(t){return t(this)},t.prototype.remember=function(){return new ee(new Zt(this))},t.prototype.debug=function(t){return new(this.ctor())(new Bt(this,t))},t.prototype.imitate=function(t){if(t instanceof ee)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,r=0;r<n;r++)t._add(e[r]);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||At,t._e=t.error||At,t._c=t.complete||At,this._dl=t):(this._d=!1,this._dl=Ot)},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 Tt(e))},t}(),te=n.Stream=Qt,ee=function(t){function e(e){var n=t.call(this,e)||this;return n._has=!1,n}return _t(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!==Ot)this._has&&t._n(this._v),clearTimeout(this._stopID),this._stopID=Ot;else if(this._has)t._n(this._v);else{var r=this._prod;r!==Ot&&r._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}(Qt);n.MemoryStream=ee;var ne=Qt,re=n.default=ne,oe={};function ie(){var t;return(t="undefined"!=typeof window?window:void 0!==e?e:this).Cyclejs=t.Cyclejs||{},(t=t.Cyclejs).adaptStream=t.adaptStream||function(t){return t},t}Object.defineProperty(oe,"__esModule",{value:!0}),oe.setAdapt=function(t){ie().adaptStream=t};var se=oe.adapt=function(t){return ie().adaptStream(t)};function ae(t,e,n){var r={};return Object.keys(t).forEach((function(t){if("string"!=typeof e){var o=e[t];if(void 0===o){var i=e["*"];r[t]=void 0===i?n:i}else r[t]=o}else r[t]=e})),r}function ue(t,e){var n={};for(var r in t){var o=t[r];t.hasOwnProperty(r)&&o&&null!==e[r]&&"function"==typeof o.isolateSource?n[r]=o.isolateSource(o,e[r]):t.hasOwnProperty(r)&&(n[r]=t[r])}return n}function ce(t,e,n){var r={};for(var o in e){var i=t[o],s=e[o];e.hasOwnProperty(o)&&i&&null!==n[o]&&"function"==typeof i.isolateSink?r[o]=se(i.isolateSink(re.fromObservable(s),n[o])):e.hasOwnProperty(o)&&(r[o]=e[o])}return r}var pe=0;function le(){return"cycle"+ ++pe}function fe(t,e){void 0===e&&(e=le()),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);var n="object"==typeof e?le():"",r="string"==typeof e||"object"==typeof e?e:e.toString();return function(e){for(var o=[],i=1;i<arguments.length;i++)o[i-1]=arguments[i];var s=ae(e,r,n),a=ue(e,s),u=t.apply(void 0,[a].concat(o)),c=ce(e,u,s);return c}}fe.reset=function(){return pe=0};var he={};Object.defineProperty(he,"__esModule",{value:!0}),he.DropRepeatsOperator=void 0;var de=n,ye={},me=function(){function t(t,e){this.ins=t,this.type="dropRepeats",this.out=null,this.v=ye,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=ye},t.prototype._n=function(t){var e=this.out;if(e){var n=this.v;n!==ye&&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}();he.DropRepeatsOperator=me;var ve=he.default=function(t){return void 0===t&&(t=void 0),function(e){return new de.Stream(new me(e,t))}},ge=function(){return ge=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},ge.apply(this,arguments)};function be(t){return"string"==typeof t||"number"==typeof t?function(e){return void 0===e?void 0:e[t]}:t.get}function _e(t){return"string"==typeof t||"number"==typeof t?function(e,n){var r,o;return Array.isArray(e)?function(t,e,n){if(n===t[e])return t;var r=parseInt(e);return void 0===n?t.filter((function(t,e){return e!==r})):t.map((function(t,e){return e===r?n:t}))}(e,t,n):void 0===e?((r={})[t]=n,r):ge({},e,((o={})[t]=n,o))}:t.set}function we(t,e){return t.select(e)}function Se(t,e){var n=be(e),r=_e(e);return t.map((function(t){return function(e){var o=n(e),i=t(o);return o===i?e:r(e,i)}}))}var Oe=function(){function t(t,e){this.isolateSource=we,this.isolateSink=Se,this._stream=t.filter((function(t){return void 0!==t})).compose(ve()).remember(),this._name=e,this.stream=se(this._stream),this._stream._isCycleSource=e}return t.prototype.select=function(e){var n=be(e);return new t(this._stream.map(n),this._name)},t}(),Ee=function(){function t(t,e,n){this.ins=n,this.out=t,this.p=e}return t.prototype._n=function(t){this.p;var e=this.out;null!==e&&e._n(t)},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){},t}(),Ae=function(){function t(t,e){this.type="pickMerge",this.ins=e,this.out=null,this.sel=t,this.ils=new Map,this.inst=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this);var t=this.ils;t.forEach((function(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},t.prototype._n=function(t){this.inst=t;for(var e=t.arr,n=this.ils,r=this.out,o=this.sel,i=e.length,s=0;s<i;++s){var a=e[s],u=a._key,c=re.fromObservable(a[o]||re.never());n.has(u)||(n.set(u,new Ee(r,this,c)),c._add(n.get(u)))}n.forEach((function(e,r){t.dict.has(r)&&t.dict.get(r)||(e.ins._remove(e),e.ins=null,e.out=null,n.delete(r))}))},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){var t=this.out;null!==t&&t._c()},t}();var je=function(){function t(t,e,n,r){this.key=t,this.out=e,this.p=n,this.val=Et,this.ins=r}return t.prototype._n=function(t){this.p;var e=this.out;this.val=t,null!==e&&this.p.up()},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){},t}(),Ne=function(){function t(t,e){this.type="combine",this.ins=e,this.sel=t,this.out=null,this.ils=new Map,this.inst=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this);var t=this.ils;t.forEach((function(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},t.prototype.up=function(){for(var t=this.inst.arr,e=t.length,n=this.ils,r=Array(e),o=0;o<e;++o){var i=t[o]._key;if(!n.has(i))return;var s=n.get(i).val;if(s===Et)return;r[o]=s}this.out._n(r)},t.prototype._n=function(t){this.inst=t;var e=t.arr,n=this.ils,r=this.out,o=this.sel,i=t.dict,s=e.length,a=!1;if(n.forEach((function(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(var u=0;u<s;++u){var c=e[u],p=c._key;if(!c[o])throw new Error("pickCombine found an undefined child sink stream");var l=re.fromObservable(c[o]);n.has(p)||(n.set(p,new je(p,r,this,l)),l._add(n.get(p)))}a&&this.up()}else r._n([])},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){var t=this.out;null!==t&&t._c()},t}();var $e=function(){return $e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},$e.apply(this,arguments)},Ce=function(){function t(t){this._instances$=t}return t.prototype.pickMerge=function(t){return se(this._instances$.compose(function(t){return function(e){return new te(new Ae(t,e))}}(t)))},t.prototype.pickCombine=function(t){return se(this._instances$.compose(function(t){return function(e){return new te(new Ne(t,e))}}(t)))},t}();function ke(t){return{"*":null}}function Ie(t,e){return{get:function(n){if(void 0!==n)for(var r=0,o=n.length;r<o;++r)if(""+t(n[r],r)===e)return n[r]},set:function(n,r){return void 0===n?[r]:void 0===r?n.filter((function(n,r){return""+t(n,r)!==e})):n.map((function(n,o){return""+t(n,o)===e?r:n}))}}}var xe={get:function(t){return t},set:function(t,e){return e}};var Pe={};Object.defineProperty(Pe,"__esModule",{value:!0});var Me=n,Te=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 De=Pe.default=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Me.Stream(new Te(t))},Le={};Object.defineProperty(Le,"__esModule",{value:!0});var Fe=Le.default=function(){return"undefined"!=typeof queueMicrotask?queueMicrotask:"undefined"!=typeof setImmediate?setImmediate:"undefined"!=typeof process?process.nextTick:setTimeout},Be=Fe();function qe(t,e,n={}){const{combineList:r=["DOM"],globalList:o=["EVENTS"],stateSourceName:i="STATE",domSourceName:s="DOM",container:a="div",containerClass:u}=n;return n=>{const c=Date.now(),p={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,o])=>{if(r.includes(n)){const r=t.pickCombine(n);n===s&&a?e.DOM=r.map((t=>({sel:a,data:u?{props:{className:u}}:{},children:t,key:c,text:void 0,elm:void 0}))):(console.warn("Collections without wrapping containers will fail in unpredictable ways when used inside JSX fragments"),e[n]=r)}else e[n]=t.pickMerge(n);return e}),{})},l={[i]:e};return o.forEach((t=>l[t]=null)),r.forEach((t=>l[t]=null)),function(t,e,n){return fe(function(t){return function(e){var n=t.channel||"state",r=t.itemKey,o=t.itemScope||ke,i=re.fromObservable(e[n].stream).fold((function(i,s){var a,u,c,p,l,f=i.dict;if(Array.isArray(s)){for(var h=Array(s.length),d=new Set,y=0,m=s.length;y<m;++y){var v=""+(r?r(s[y],y):y);if(d.add(v),f.has(v))h[y]=f.get(v);else{var g=r?Ie(r,v):""+y,b="string"==typeof(l=o(v))?((a={"*":l})[n]=g,a):$e({},l,((u={})[n]=g,u)),_=fe(t.itemFactory?t.itemFactory(s[y],y):t.item,b)(e);f.set(v,_),h[y]=_}h[y]._key=v}return f.forEach((function(t,e){d.has(e)||f.delete(e)})),d.clear(),{dict:f,arr:h}}return f.clear(),v=""+(r?r(s,0):"this"),g=xe,b="string"==typeof(l=o(v))?((c={"*":l})[n]=g,c):$e({},l,((p={})[n]=g,p)),_=fe(t.itemFactory?t.itemFactory(s,0):t.item,b)(e),f.set(v,_),{dict:f,arr:[_]}}),{dict:new Map,arr:[]});return t.collectSinks(new Ce(i))}}(t),e)(n)}(p,l,n)}}function Re(t,e,n,r={}){const{switched:o=["DOM"],stateSourceName:i="STATE"}=r,s=typeof e;if(!e)throw new Error("Missing 'name$' parameter for switchable()");if(!("string"===s||"function"===s||e instanceof te))throw new Error("Invalid 'name$' parameter for switchable(): expects Stream, String, or Function");if(e instanceof te){const r=e.compose(ve()).startWith(n).remember();return e=>Ue(t,e,r,o)}{const r="function"===s&&e||(t=>t[e]);return e=>{const s=e&&("string"==typeof i&&e[i]||e.STATE||e.state).stream;if(!s instanceof te)throw new Error(`Could not find the state source: ${i}`);const a=s.map(r).filter((t=>"string"==typeof t)).compose(ve()).startWith(n).remember();return Ue(t,e,a,o,i)}}}function Ue(t,e,n,r=["DOM"],o="STATE"){"string"==typeof r&&(r=[r]);const i=Object.entries(t).map((([t,r])=>{if(e[o]){const i=e[o].stream,s=re.combine(n,i).filter((([e,n])=>e==t)).map((([t,e])=>e)).remember(),a=new e[o].constructor(s,e[o]._name);return[t,r({...e,state:a})]}return[t,r(e)]}));return Object.keys(e).reduce(((t,e)=>{if(r.includes(e))t[e]=n.map((t=>{const n=i.find((([e,n])=>e===t));return n&&n[1][e]||re.never()})).flatten().remember().startWith(void 0);else{const n=i.filter((([t,n])=>void 0!==n[e])).map((([t,n])=>n[e]));t[e]=re.merge(...n)}return t}),{})}var We={};Object.defineProperty(We,"__esModule",{value:!0});var Ge=n,Ve=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 He=We.default=function(t){return function(e){return new Ge.Stream(new Ve(t,e))}},Je={};Object.defineProperty(Je,"__esModule",{value:!0});var ze=n,Ze=function(){function t(t,e){this.dt=t,this.ins=e,this.type="debounce",this.out=null,this.id=null,this.t=ze.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=ze.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!=ze.NO&&t._n(this.t),this.t=ze.NO,t._c())},t}();var Xe=Je.default=function(t){return function(e){return new ze.Stream(new Ze(t,e))}};const Ye="undefined"!=typeof window&&window||process&&process.env||{},Ke="INITIALIZE";let Qe=!0;const tn="~#~#~ABORT~#~#~";class en{constructor({name:t="NO NAME",sources:e,intent:n,request:r,model:o,response:i,view:s,children:a={},components:u={},initialState:c,calculated:p,storeCalculatedInState:l=!0,DOMSourceName:f="DOM",stateSourceName:h="STATE",requestSourceName:d="HTTP"}){if(!e||"object"!=typeof e)throw new Error("Missing or invalid sources");this.name=t,this.sources=e,this.intent=n,this.request=r,this.model=o,this.response=i,this.view=s,this.children=a,this.components=u,this.initialState=c,this.calculated=p,this.storeCalculatedInState=l,this.DOMSourceName=f,this.stateSourceName=h,this.requestSourceName=d,this.sourceNames=Object.keys(e),this.isSubComponent=this.sourceNames.includes("props$");const y=e[h]&&e[h].stream;var m;y&&(this.currentState=c||{},this.sources[this.stateSourceName]=new Oe(y.map((t=>(this.currentState=t,t))))),Qe&&void 0===this.intent&&void 0===this.model&&(this.initialState=c||!0,this.intent=t=>({__NOOP_ACTION__:re.never()}),this.model={__NOOP_ACTION__:t=>t}),Qe=!1,this.log=(m=t,function(t){const e="function"==typeof t?t:e=>t;return t=>t.debug((t=>{"true"!=Ye.DEBUG&&!0!==Ye.DEBUG||console.log(`[${m}] ${e(t)}`)}))}),this.initIntent$(),this.initAction$(),this.initResponse$(),this.initState(),this.initModel$(),this.initSendResponse$(),this.initChildren$(),this.initSubComponentSink$(),this.initVdom$(),this.initSinks()}initIntent$(){if(this.intent){if("function"!=typeof this.intent)throw new Error("Intent must be a function");if(this.intent$=this.intent(this.sources),!(this.intent$ instanceof te)&&"object"!=typeof this.intent$)throw new Error("Intent must return either an action$ stream or map of event streams")}}initAction$(){const t=this.sources&&this.sources[this.requestSourceName]||null;if(!this.intent$)return void(this.action$=re.never());let e;if(this.intent$ instanceof te)e=this.intent$;else{const t=Object.entries(this.intent$).map((([t,e])=>e.map((e=>({type:t,data:e})))));e=re.merge(re.never(),...t)}const n=e instanceof te?e:e.apply&&e(this.sources)||re.never(),r=De(re.of({type:"BOOTSTRAP"}),n).compose(He(10));let o;o=t&&"function"==typeof t.select?t.select("initial").flatten():re.never();const i=o.map((t=>({type:"HYDRATE",data:t})));this.action$=re.merge(r,i).compose(this.log((({type:t})=>`Action triggered: <${t}>`)))}initResponse$(){if(void 0===this.request)return;if("object"!=typeof this.request)throw new Error("The request parameter must be an object");const t=this.sources[this.requestSourceName],e=Object.entries(this.request).reduce(((e,[n,r])=>{const o=n.toLowerCase();if("function"!=typeof t[o])throw new Error("Invalid method in request object:",n);const i=Object.entries(r).reduce(((e,[n,r])=>{const i=`[${o.toUpperCase()}]:${n||"none"}`,s=typeof r;if("undefined"===s)throw new Error(`Action for '${n}' route in request object not specified`);if("string"!==s&&"function"!==s)throw new Error(`Invalid action for '${n}' route: expecting string or function`);const a="function"===s?"[ FUNCTION ]":`< ${r} >`;console.log(`[${this.name}] Adding ${this.requestSourceName} route:`,o.toUpperCase(),`'${n}' <${a}>`);const u=t[o](n).compose(ve(((t,e)=>t.id==e.id))).map((t=>{if(!t||!t.id)throw new Error(`No id found in request: ${i}`);try{const e=t.id,n=(t.params,t.body),o=(t.cookies,"function"===s?"FUNCTION":r),i={type:o,data:n,req:t,_reqId:e,_action:o},a=(new Date).toISOString(),u=t.get?t.get("host"):"0.0.0.0";if(console.log(`${a} ${u} ${t.method} ${t.url}`),Ye.DEBUG&&this.action$.setDebugListener({next:({type:t})=>console.log(`[${this.name}] Action from ${this.requestSourceName} request: <${t}>`)}),"function"===s){const e=this.addCalculated(this.currentState),n=r(e,t);return re.of({...i,data:n})}{this.action$.shamefullySendNext(i);const t=Object.entries(this.sources).reduce(((t,[n,r])=>{if(!r||"function"!=typeof r.request)return t;const o=r.request(e);return[...t,o]}),[]);return re.merge(...t)}}catch(t){console.error(t)}})).flatten();return[...e,u]}),[]);return[...e,re.merge(...i)]}),[]);if(this.response$=re.merge(...e).compose(this.log((t=>t._action?`[${this.requestSourceName}] response data received for Action: <${t._action}>`:`[${this.requestSourceName}] response data received from FUNCTION`))),void 0!==this.response&&void 0===this.response$)throw new Error("Cannot have a response parameter without a request parameter")}initState(){null!=this.model&&(void 0===this.model.INITIALIZE?this.model.INITIALIZE={[this.stateSourceName]:(t,e)=>({...this.addCalculated(e)})}:Object.keys(this.model.INITIALIZE).forEach((t=>{t!==this.stateSourceName&&(console.warn(`INITIALIZE can only be used with the ${this.stateSourceName} source... disregarding ${t}`),delete this.model.INITIALIZE[t])})))}initModel$(){if(void 0===this.model)return void(this.model$=this.sourceNames.reduce(((t,e)=>(t[e]=re.never(),t)),{}));const t={type:Ke,data:this.initialState},e=this.initialState?De(re.of(t),this.action$).compose(He(0)):this.action$,n=this.makeOnAction(e,!0,this.action$),r=this.makeOnAction(this.action$,!1,this.action$),o=Object.entries(this.model),i={};o.forEach((t=>{let[e,o]=t;if("function"==typeof o&&(o={[this.stateSourceName]:o}),"object"!=typeof o)throw new Error(`Entry for each action must be an object: ${this.name} ${e}`);Object.entries(o).forEach((t=>{const[o,s]=t,a=o==this.stateSourceName,u=(a?n:r)(e,s).compose(this.log((t=>{if(a)return`State reducer added: <${e}>`;{const n=t&&(t.type||t.command||t.name||t.key||Array.isArray(t)&&"Array"||t);return`Data sent to [${o}]: <${e}> ${n}`}})));Array.isArray(i[o])?i[o].push(u):i[o]=[u]}))}));const s=Object.entries(i).reduce(((t,e)=>{const[n,r]=e;return t[n]=re.merge(re.never(),...r),t}),{});this.model$=s}initSendResponse$(){const t=typeof this.response;if("function"!=t&&"undefined"!=t)throw new Error("The response parameter must be a function");if("undefined"==t)return this.response$&&this.response$.subscribe({next:this.log((({_reqId:t,_action:e})=>`Unhandled response for request: ${e} ${t}`))}),void(this.sendResponse$=re.never());const e={select:t=>void 0===t?this.response$:(Array.isArray(t)||(t=[t]),this.response$.filter((({_action:e})=>!(t.length>0)||("FUNCTION"===e||t.includes(e)))))},n=this.response(e);if("object"!=typeof n)throw new Error("The response function must return an object");const r=Object.entries(n).reduce(((t,[e,n])=>[...t,n.map((({_reqId:t,_action:n,data:r})=>{if(!t)throw new Error(`No request id found for response for: ${e}`);return{_reqId:t,_action:n,command:e,data:r}}))]),[]);this.sendResponse$=re.merge(...r).compose(this.log((({_reqId:t,_action:e})=>`[${this.requestSourceName}] response sent for: <${e}>`)))}initChildren$(){const t=this.sourceNames.reduce(((t,e)=>(e==this.DOMSourceName?t[e]={}:t[e]=[],t)),{});this.children$=Object.entries(this.children).reduce(((t,[e,n])=>{const r=n(this.sources);return this.sourceNames.forEach((n=>{n==this.DOMSourceName?t[n][e]=r[n]:t[n].push(r[n])})),t}),t)}initSubComponentSink$(){const t=re.create({start:t=>{this.newSubComponentSinks=t.next.bind(t)},stop:t=>{}});t.subscribe({next:t=>t}),this.subComponentSink$=t.filter((t=>Object.keys(t).length>0))}initVdom$(){if("function"!=typeof this.view)return void(this.vdom$=re.of(null));const t=this.sources[this.stateSourceName],e={...this.children$[this.DOMSourceName]},n=t&&t.isolateSource(t,{get:t=>this.addCalculated(t)}),r=n&&n.stream||re.never();e.state=r,e[this.stateSourceName]=r,this.sources.props$&&(e.props=this.sources.props$),this.sources.children$&&(e.children=this.sources.children$);const o=Object.entries(e).reduce(((t,[e,n])=>(t.names.push(e),t.streams.push(n),t)),{names:[],streams:[]}),i=re.combine(...o.streams).compose(Xe(5)).map((t=>o.names.reduce(((e,n,r)=>(e[n]=t[r],e)),{}))),s=Object.keys(this.components),a=re.create(),u=i.map((t=>t)).map(this.view).map((t=>t||{sel:"div",data:{},children:[]})).fold(((t,e)=>{const n=nn(e,s),r=Object.entries(n),o={"::ROOT::":e};if(0===r.length)return o;const i={},u=r.reduce(((e,[n,r])=>{const o=r.sel,s=r.data,u=s.props||{},c=r.children||[],p=s.isCollection||!1,l=s.isSwitchable||!1;if(t[n]){const r=t[n];return e[n]=r,r.props$.shamefullySendNext(u),r.children$.shamefullySendNext(c),e}const f="sygnal-factory"===o?u.sygnalFactory:this.components[o]||u.sygnalFactory;if(!f&&!p&&!l){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 h=re.create().startWith(u),d=re.create().startWith(c);let y,m=new Oe(this.sources[this.stateSourceName].stream.startWith(this.currentState)),v=!0;if(p){let t,e;const n=e=>{const n=e[t];if(void 0!==n){if(!Array.isArray(n)){const t="string"==typeof s.props.of?s.props.of:"components";return console.warn(`Collection of ${t} does not have a valid array in the 'for' property: expects either an array or a string of the name of an array property on the state`),[]}return n}};void 0===u.for?(e={get:t=>Array.isArray(t)?t:(console.warn(`Collection sub-component of ${this.name} has no 'for' attribute and the parent state is not an array: Provide a 'for' attribute with either an array or the name of a state property containing an array`),[]),set:(t,e)=>e},v=!1):"string"==typeof u.for?(t=u.for,e={get:n,set:(e,n)=>this.calculated&&t in this.calculated?(console.warn(`Collection sub-component of ${this.name} attempted to update state on a calculated field '${t}': Update ignored`),e):{...e,[t]:n}},v=!1):(t="for",m=new Oe(h.remember()),e={get:n,set:(t,e)=>t});const r={...this.sources,[this.stateSourceName]:m,props$:h,children$:d};if(y=qe("function"==typeof s.props.of?s.props.of:this.components[s.props.of],e,{container:null})(r),"object"!=typeof y)throw new Error("Invalid sinks returned from component factory of collection element")}else if(l){const t=s.props.state;let e,n=!1;if("string"==typeof t)n=!0,e={get:e=>e[t],set:(e,n)=>this.calculated&&t in this.calculated?(console.warn(`Switchable sub-component of ${this.name} attempted to update state on a calculated field '${t}': Update ignored`),e):{...e,[t]:n}},v=!1;else if(void 0===t)n=!0,e={get:t=>t,set:(t,e)=>e},v=!1;else{if("object"!=typeof t)throw new Error(`Invalid state provided to collection sub-component of ${this.name}: Expecting string, object, or none, but found ${typeof t}`);m=new Oe(h.map((t=>t.state)))}const r=s.props.of,o={...this.sources,[this.stateSourceName]:m,props$:h,children$:d};if(y=n?fe(Re(r,h.map((t=>t.current))),{[this.stateSourceName]:e})(o):Re(r,h.map((t=>t.current)))(o),"object"!=typeof y)throw new Error("Invalid sinks returned from component factory of switchable element")}else{const{state:t,sygnalFactory:e,id:n,...r}=u;if(void 0!==t||"object"==typeof r&&0!==Object.keys(r).length){const t=t=>{const e=t.state;if(void 0===e)return t;if("object"!=typeof e)return e;const n={...t};return delete n.state,{...n,...e}};m=new Oe(h.map(t));y=f({...this.sources,[this.stateSourceName]:m,props$:h,children$:d})}else{y=f({...this.sources,[this.stateSourceName]:m,props$:re.never().startWith(null),children$:d}),v=!1}if("object"!=typeof y){throw new Error("Invalid sinks returned from component factory:","sygnal-factory"===o?"custom element":o)}}if(v){const t=y[this.stateSourceName];y[this.stateSourceName]=t.filter((t=>(console.warn("State update attempt from component with inderect link to state: Components with state set through HTML properties/attributes cannot update application state directly"),!1)))}const g=y[this.DOMSourceName].remember();return y[this.DOMSourceName]=m.stream.compose(ve(((t,e)=>JSON.stringify(t)===JSON.stringify(e)))).map((t=>(a.shamefullySendNext(null),g))).compose(Xe(10)).flatten().remember(),e[n]={sink$:y,props$:h,children$:d},Object.entries(y).map((([t,e])=>{i[t]||=[],t!==this.DOMSourceName&&i[t].push(e)})),e}),o),c=Object.entries(i).reduce(((t,[e,n])=>(0===n.length||(t[e]=1===n.length?n[0]:re.merge(...n)),t)),{});return this.newSubComponentSinks(c),u}),{});this.vdom$=re.combine(a.startWith(null),u).map((([t,e])=>{const n=e["::ROOT::"];let r=[];const o=Object.entries(e).filter((([t])=>"::ROOT::"!==t));if(0===o.length)return re.of(n);const i=o.map((([t,e])=>(r.push(t),e.sink$[this.DOMSourceName].startWith(void 0))));return 0===i.length?re.of(n):re.combine(...i).compose(Xe(5)).map((t=>{const e=t.reduce(((t,e,n)=>(t[r[n]]=e,t)),{});return rn(an(n),e,s)}))})).flatten().filter((t=>!!t)).compose(Xe(5)).remember().compose(this.log("View Rendered"))}initSinks(){this.sinks=this.sourceNames.reduce(((t,e)=>{if(e==this.DOMSourceName)return t;const n=this.subComponentSink$?this.subComponentSink$.map((t=>t[e])).filter((t=>!!t)).flatten():re.never();return e===this.stateSourceName?t[e]=re.merge(this.model$[e]||re.never(),n,this.sources[this.stateSourceName].stream.filter((t=>!1)),...this.children$[e]):t[e]=re.merge(this.model$[e]||re.never(),n,...this.children$[e]),t}),{}),this.sinks[this.DOMSourceName]=this.vdom$,this.sinks[this.requestSourceName]=re.merge(this.sendResponse$,this.sinks[this.requestSourceName])}makeOnAction(t,e=!0,n){return n=n||t,(r,o)=>{const i=t.filter((({type:t})=>t==r));let s;if("function"==typeof o)s=i.map((t=>{const i=(e,o)=>{const i=t._reqId||t.req&&t.req.id,s=i?"object"==typeof o?{...o,_reqId:i,_action:r}:{data:o,_reqId:i,_action:r}:o;setTimeout((()=>{n.shamefullySendNext({type:e,data:s})}),10)};let s=t.data;if(s&&s.data&&s._reqId&&(s=s.data),e)return e=>{const n=this.isSubComponent?this.currentState:e,r=this.addCalculated(n),a=o(r,s,i,t.req);return a==tn?n:this.cleanupCalculated(a)};{const e=this.addCalculated(this.currentState),n=o(e,s,i,t.req),a=typeof n,u=t._reqId||t.req&&t.req.id;if(["string","number","boolean","function"].includes(a))return n;if("object"==a)return{...n,_reqId:u,_action:r};if("undefined"==a)return console.warn(`'undefined' value sent to ${r}`),n;throw new Error(`Invalid reducer type for ${r} ${a}`)}})).filter((t=>t!=tn));else if(void 0===o||!0===o)s=i.map((({data:t})=>t));else{const t=o;s=i.mapTo(t)}return s}}addCalculated(t){if(!this.calculated||"object"!=typeof t)return t;if("object"!=typeof this.calculated)throw new Error("'calculated' parameter must be an object mapping calculated state field named to functions");const e=Object.entries(this.calculated).reduce(((e,[n,r])=>{if("function"!=typeof r)throw new Error(`Missing or invalid calculator function for calculated field '${n}`);try{e[n]=r(t)}catch(t){console.warn(`Calculated field '${n}' threw an error during calculation: ${t.message}`)}return e}),{});return{...t,...e}}cleanupCalculated(t){if(this.storeCalculatedInState)return this.addCalculated(t);if(!this.calculated||!t||"object"!=typeof t)return t;const e=Object.keys(this.calculated),n={...t};return e.forEach((t=>{this.initialState&&void 0!==this.initialState[t]?n[t]=this.initialState[t]:delete n[t]})),n}}function nn(t,e,n=0,r=0){if(!t)return{};if(t.data?.componentsProcessed)return{};0===n&&(t.data.componentsProcessed=!0);const o=t.sel,i=o&&"collection"===o.toLowerCase(),s=o&&"switchable"===o.toLowerCase(),a=o&&["collection","switchable","sygnal-factory",...e].includes(t.sel)||"function"==typeof t.data?.props?.sygnalFactory,u=t.data&&t.data.props||{},c=t.data&&t.data.attrs||{},p=t.children||[];let l={};if(a){const o=sn(t,n,r);if(i){if(!u.of)throw new Error("Collection element missing required 'component' property");if("string"!=typeof u.of&&"function"!=typeof u.of)throw new Error(`Invalid 'component' property of collection element: found ${typeof u.of} requires string or component factory function`);if("function"!=typeof u.of&&!e.includes(u.of))throw new Error(`Specified component for collection not found: ${u.of}`);void 0===c.for||"string"==typeof c.for||Array.isArray(c.for)||console.warn(`No valid array found in the 'value' property of collection ${"string"==typeof u.of?u.of:"function component"}: no collection components will be created`),t.data.isCollection=!0,t.data.props||={},t.data.props.for=c.for,t.data.attrs=void 0}else if(s){if(!u.of)throw new Error("Switchable element missing required 'of' property");if("object"!=typeof u.of)throw new Error(`Invalid 'components' property of switchable element: found ${typeof u.of} requires object mapping names to component factories`);if(!Object.values(u.of).every((t=>"function"==typeof t)))throw new Error("One or more components provided to switchable element is not a valid component factory");if(!u.current||"string"!=typeof u.current&&"function"!=typeof u.current)throw new Error(`Missing or invalid 'current' property for switchable element: found '${typeof u.current}' requires string or function`);if(!Object.keys(u.of).includes(u.current))throw new Error(`Component '${u.current}' not found in switchable element`);t.data.isSwitchable=!0}l[o]=t}return p.length>0&&p.map(((t,r)=>nn(t,e,n+1,r))).forEach((t=>{Object.entries(t).forEach((([t,e])=>l[t]=e))})),l}function rn(t,e,n,r=0,o){if(!t)return;if(t.data?.componentsInjected)return t;0===r&&t.data&&(t.data.componentsInjected=!0);const i=t.sel||"NO SELECTOR",s=["collection","switchable","sygnal-factory",...n].includes(i)||"function"==typeof t.data?.props?.sygnalFactory,a=t?.data?.isCollection;t?.data?.isSwitchable;t.data&&t.data.props;const u=t.children||[];if(s){const n=sn(t,r,o),i=e[n];return a?(t.sel="div",t.children=Array.isArray(i)?i:[i],t):i}return u.length>0?(t.children=u.map(((t,o)=>rn(t,e,n,r+1,o))).flat(),t):t}const on=new Map;function sn(t,e,n){const r=t.sel,o="string"==typeof r?r:"functionComponent";let i=on.get(r);if(!i){i=`${Date.now()}-${Math.floor(1e4*Math.random())}`,on.set(r,i)}const s=`${i}-${e}-${n}`,a=t.data&&t.data.props||{};return`${o}::${a.id&&JSON.stringify(a.id)||s}`}function an(t){return void 0===t?t:{...t,children:Array.isArray(t.children)?t.children.map(an):void 0,data:t.data&&{...t.data,componentsInjected:!1}}}function un(t){return function(){var t;return(t="undefined"!=typeof window?window:"undefined"!=typeof global?global:this).Cyclejs=t.Cyclejs||{},(t=t.Cyclejs).adaptStream=t.adaptStream||function(t){return t},t}().adaptStream(t)}function cn(t){return 0===Object.keys(t).length}function pn(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(cn(e))throw new Error("Second argument given to Cycle must be an object with at least one driver function declared as a property.");var 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(cn(t))throw new Error("Argument given to setupReusable must be an object with at least one driver function declared as a property.");var e=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=re.create());return e}(t),n=function(t){for(var e in t)t.hasOwnProperty(e)&&t[e]&&"function"==typeof t[e].shamefullySendNext&&(t[e]=un(t[e]));return t}(function(t,e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r](e[r],r),n[r]&&"object"==typeof n[r]&&(n[r]._isCycleSource=r));return n}(t,e));function r(t){return function(t,e){var n=Fe(),r=Object.keys(t).filter((function(t){return!!e[t]})),o={},i={};r.forEach((function(t){o[t]={_n:[],_e:[]},i[t]={next:function(e){return o[t]._n.push(e)},error:function(e){return o[t]._e.push(e)},complete:function(){}}}));var s=r.map((function(e){return re.fromObservable(t[e]).subscribe(i[e])}));return r.forEach((function(t){var r=e[t],s=function(t){n((function(){return r._n(t)}))},a=function(t){n((function(){(console.error||console.log)(t),r._e(t)}))};o[t]._n.forEach(s),o[t]._e.forEach(a),i[t].next=s,i[t].error=a,i[t]._n=s,i[t]._e=a})),o=null,function(){s.forEach((function(t){return t.unsubscribe()}))}}(t,e)}function o(){!function(t){for(var e in t)t.hasOwnProperty(e)&&t[e]&&t[e].dispose&&t[e].dispose()}(n),function(t){Object.keys(t).forEach((function(e){return t[e]._c()}))}(e)}return{sources:n,run:r,dispose:o}}(e),r=t(n.sources);return"undefined"!=typeof window&&(window.Cyclejs=window.Cyclejs||{},window.Cyclejs.sinks=r),{sinks:r,sources:n.sources,run:function(){var t=n.run(r);return function(){t(),n.dispose()}}}}const ln={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 document.createDocumentFragment()},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){t.appendChild(e)},parentNode:function(t){return t.parentNode},nextSibling:function(t){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:function(t){return 11===t.nodeType}};function fn(t,e,n,r,o){return{sel:t,data:e,children:n,text:r,elm:o,key:void 0===e?void 0:e.key}}const hn=Array.isArray;function dn(t){return"string"==typeof t||"number"==typeof t||t instanceof String||t instanceof Number}function yn(t){return void 0===t}function mn(t){return void 0!==t}const vn=fn("",{},[],void 0,void 0);function gn(t,e){var n,r;const o=t.key===e.key,i=(null===(n=t.data)||void 0===n?void 0:n.is)===(null===(r=e.data)||void 0===r?void 0:r.is);return t.sel===e.sel&&o&&i}function bn(){throw new Error("The document fragment is not supported on this platform.")}function _n(t,e,n){var r;const o={};for(let i=e;i<=n;++i){const e=null===(r=t[i])||void 0===r?void 0:r.key;void 0!==e&&(o[e]=i)}return o}const wn=["create","update","remove","destroy","pre","post"];function Sn(t,e,n){const r={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},o=void 0!==e?e:ln;for(const e of wn)for(const n of t){const t=n[e];void 0!==t&&r[e].push(t)}function i(t){const e=t.id?"#"+t.id:"",n=t.getAttribute("class"),r=n?"."+n.split(" ").join("."):"";return fn(o.tagName(t).toLowerCase()+e+r,{},[],void 0,t)}function s(t){return fn(void 0,{},[],void 0,t)}function a(t,e){return function(){if(0==--e){const e=o.parentNode(t);o.removeChild(e,t)}}}function u(t,e){var i,s,a,c;let p,l=t.data;if(void 0!==l){const e=null===(i=l.hook)||void 0===i?void 0:i.init;mn(e)&&(e(t),l=t.data)}const f=t.children,h=t.sel;if("!"===h)yn(t.text)&&(t.text=""),t.elm=o.createComment(t.text);else if(void 0!==h){const n=h.indexOf("#"),i=h.indexOf(".",n),a=n>0?n:h.length,c=i>0?i:h.length,d=-1!==n||-1!==i?h.slice(0,Math.min(a,c)):h,y=t.elm=mn(l)&&mn(p=l.ns)?o.createElementNS(p,d,l):o.createElement(d,l);for(a<c&&y.setAttribute("id",h.slice(a+1,c)),i>0&&y.setAttribute("class",h.slice(c+1).replace(/\./g," ")),p=0;p<r.create.length;++p)r.create[p](vn,t);if(hn(f))for(p=0;p<f.length;++p){const t=f[p];null!=t&&o.appendChild(y,u(t,e))}else dn(t.text)&&o.appendChild(y,o.createTextNode(t.text));const m=t.data.hook;mn(m)&&(null===(s=m.create)||void 0===s||s.call(m,vn,t),m.insert&&e.push(t))}else if((null===(a=null==n?void 0:n.experimental)||void 0===a?void 0:a.fragments)&&t.children){const n=t.children;for(t.elm=(null!==(c=o.createDocumentFragment)&&void 0!==c?c:bn)(),p=0;p<r.create.length;++p)r.create[p](vn,t);for(p=0;p<n.length;++p){const r=n[p];null!=r&&o.appendChild(t.elm,u(r,e))}}else t.elm=o.createTextNode(t.text);return t.elm}function c(t,e,n,r,i,s){for(;r<=i;++r){const i=n[r];null!=i&&o.insertBefore(t,u(i,s),e)}}function p(t){var e,n;const o=t.data;if(void 0!==o){null===(n=null===(e=null==o?void 0:o.hook)||void 0===e?void 0:e.destroy)||void 0===n||n.call(e,t);for(let e=0;e<r.destroy.length;++e)r.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&&p(n)}}}function l(t,e,n,i){for(var s,u;n<=i;++n){let i,c;const l=e[n];if(null!=l)if(mn(l.sel)){p(l),i=r.remove.length+1,c=a(l.elm,i);for(let t=0;t<r.remove.length;++t)r.remove[t](l,c);const t=null===(u=null===(s=null==l?void 0:l.data)||void 0===s?void 0:s.hook)||void 0===u?void 0:u.remove;mn(t)?t(l,c):c()}else o.removeChild(t,l.elm)}}function f(t,e,n){var i,s,a,p,h,d,y,m;const v=null===(i=e.data)||void 0===i?void 0:i.hook;null===(s=null==v?void 0:v.prepatch)||void 0===s||s.call(v,t,e);const g=e.elm=t.elm,b=t.children,_=e.children;if(t!==e){if(void 0!==e.data||mn(e.text)&&e.text!==t.text){null!==(a=e.data)&&void 0!==a||(e.data={}),null!==(p=t.data)&&void 0!==p||(t.data={});for(let n=0;n<r.update.length;++n)r.update[n](t,e);null===(y=null===(d=null===(h=e.data)||void 0===h?void 0:h.hook)||void 0===d?void 0:d.update)||void 0===y||y.call(d,t,e)}yn(e.text)?mn(b)&&mn(_)?b!==_&&function(t,e,n,r){let i,s,a,p,h=0,d=0,y=e.length-1,m=e[0],v=e[y],g=n.length-1,b=n[0],_=n[g];for(;h<=y&&d<=g;)null==m?m=e[++h]:null==v?v=e[--y]:null==b?b=n[++d]:null==_?_=n[--g]:gn(m,b)?(f(m,b,r),m=e[++h],b=n[++d]):gn(v,_)?(f(v,_,r),v=e[--y],_=n[--g]):gn(m,_)?(f(m,_,r),o.insertBefore(t,m.elm,o.nextSibling(v.elm)),m=e[++h],_=n[--g]):gn(v,b)?(f(v,b,r),o.insertBefore(t,v.elm,m.elm),v=e[--y],b=n[++d]):(void 0===i&&(i=_n(e,h,y)),s=i[b.key],yn(s)?o.insertBefore(t,u(b,r),m.elm):(a=e[s],a.sel!==b.sel?o.insertBefore(t,u(b,r),m.elm):(f(a,b,r),e[s]=void 0,o.insertBefore(t,a.elm,m.elm))),b=n[++d]);d<=g&&(p=null==n[g+1]?null:n[g+1].elm,c(t,p,n,d,g,r)),h<=y&&l(t,e,h,y)}(g,b,_,n):mn(_)?(mn(t.text)&&o.setTextContent(g,""),c(g,null,_,0,_.length-1,n)):mn(b)?l(g,b,0,b.length-1):mn(t.text)&&o.setTextContent(g,""):t.text!==e.text&&(mn(b)&&l(g,b,0,b.length-1),o.setTextContent(g,e.text)),null===(m=null==v?void 0:v.postpatch)||void 0===m||m.call(v,t,e)}}return function(t,e){let n,a,c;const p=[];for(n=0;n<r.pre.length;++n)r.pre[n]();for(!function(t,e){return t.isElement(e)}(o,t)?function(t,e){return t.isDocumentFragment(e)}(o,t)&&(t=s(t)):t=i(t),gn(t,e)?f(t,e,p):(a=t.elm,c=o.parentNode(a),u(e,p),null!==c&&(o.insertBefore(c,e.elm,o.nextSibling(a)),l(c,[t],0,0))),n=0;n<p.length;++n)p[n].data.hook.insert(p[n]);for(n=0;n<r.post.length;++n)r.post[n]();return e}}function On(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 r=n.data;void 0!==r&&On(r,n.children,n.sel)}}function En(t,e,n){let r,o,i,s={};if(void 0!==n?(null!==e&&(s=e),hn(n)?r=n:dn(n)?o=n.toString():n&&n.sel&&(r=[n])):null!=e&&(hn(e)?r=e:dn(e)?o=e.toString():e&&e.sel?r=[e]:s=e),void 0!==r)for(i=0;i<r.length;++i)dn(r[i])&&(r[i]=fn(void 0,void 0,void 0,r[i],void 0));return"s"!==t[0]||"v"!==t[1]||"g"!==t[2]||3!==t.length&&"."!==t[3]&&"#"!==t[3]||On(s,r,t),fn(t,s,r,o,void 0)}function An(t,e){const n=void 0!==e?e:ln;let r;if(n.isElement(t)){const r=t.id?"#"+t.id:"",o=t.getAttribute("class"),i=o?"."+o.split(" ").join("."):"",s=n.tagName(t).toLowerCase()+r+i,a={},u={},c={},p=[];let l,f,h;const d=t.attributes,y=t.childNodes;for(f=0,h=d.length;f<h;f++)l=d[f].nodeName,"d"===l[0]&&"a"===l[1]&&"t"===l[2]&&"a"===l[3]&&"-"===l[4]?u[l.slice(5)]=d[f].nodeValue||"":"id"!==l&&"class"!==l&&(a[l]=d[f].nodeValue);for(f=0,h=y.length;f<h;f++)p.push(An(y[f],e));return Object.keys(a).length>0&&(c.attrs=a),Object.keys(u).length>0&&(c.datasets=u),"s"!==s[0]||"v"!==s[1]||"g"!==s[2]||3!==s.length&&"."!==s[3]&&"#"!==s[3]||On(c,p,s),fn(s,c,p,void 0,t)}return n.isText(t)?(r=n.getTextContent(t),fn(void 0,void 0,void 0,r,t)):n.isComment(t)?(r=n.getTextContent(t),fn("!",{},[],r,t)):fn("",{},[],void 0,t)}function jn(t,e){let n;const r=e.elm;let o=t.data.attrs,i=e.data.attrs;if((o||i)&&o!==i){for(n in o=o||{},i=i||{},i){const t=i[n];o[n]!==t&&(!0===t?r.setAttribute(n,""):!1===t?r.removeAttribute(n):120!==n.charCodeAt(0)?r.setAttribute(n,t):58===n.charCodeAt(3)?r.setAttributeNS("http://www.w3.org/XML/1998/namespace",n,t):58===n.charCodeAt(5)?r.setAttributeNS("http://www.w3.org/1999/xlink",n,t):r.setAttribute(n,t))}for(n in o)n in i||r.removeAttribute(n)}}const Nn={create:jn,update:jn};function $n(t,e){let n,r;const o=e.elm;let i=t.data.class,s=e.data.class;if((i||s)&&i!==s){for(r in i=i||{},s=s||{},i)i[r]&&!Object.prototype.hasOwnProperty.call(s,r)&&o.classList.remove(r);for(r in s)n=s[r],n!==i[r]&&o.classList[n?"add":"remove"](r)}}const Cn={create:$n,update:$n},kn=/[A-Z]/g;function In(t,e){const n=e.elm;let r,o=t.data.dataset,i=e.data.dataset;if(!o&&!i)return;if(o===i)return;o=o||{},i=i||{};const s=n.dataset;for(r in o)i[r]||(s?r in s&&delete s[r]:n.removeAttribute("data-"+r.replace(kn,"-$&").toLowerCase()));for(r in i)o[r]!==i[r]&&(s?s[r]=i[r]:n.setAttribute("data-"+r.replace(kn,"-$&").toLowerCase(),i[r]))}const xn={create:In,update:In};function Pn(t,e){let n,r,o;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)r=a[n],o=s[n],o===r||"value"===n&&i[n]===r||(i[n]=r)}const Mn={create:Pn,update:Pn},Tn="undefined"!=typeof window&&window.requestAnimationFrame.bind(window)||setTimeout;let Dn=!1;function Ln(t,e,n){var r;r=function(){t[e]=n},Tn((function(){Tn(r)}))}function Fn(t,e){let n,r;const o=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(r in i)s[r]||("-"===r[0]&&"-"===r[1]?o.style.removeProperty(r):o.style[r]="");for(r in s)if(n=s[r],"delayed"===r&&s.delayed)for(const t in s.delayed)n=s.delayed[t],a&&n===i.delayed[t]||Ln(o.style,t,n);else"remove"!==r&&n!==i[r]&&("-"===r[0]&&"-"===r[1]?o.style.setProperty(r,n):o.style[r]=n)}const Bn={pre:function(){Dn=!1},create:Fn,update:Fn,destroy:function(t){let e,n;const r=t.elm,o=t.data.style;if(o&&(e=o.destroy))for(n in e)r.style[n]=e[n]},remove:function(t,e){const n=t.data.style;if(!n||!n.remove)return void e();let r;Dn||(t.elm.offsetLeft,Dn=!0);const o=t.elm;let i=0;const s=n.remove;let a=0;const u=[];for(r in s)u.push(r),o.style[r]=s[r];const c=getComputedStyle(o)["transition-property"].split(", ");for(;i<c.length;++i)-1!==u.indexOf(c[i])&&a++;o.addEventListener("transitionend",(function(t){t.target===o&&--a,0===a&&e()}))}};function qn(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 Rn(t){var e=t.data;qn(e.fn.apply(void 0,e.args),t)}function Un(t,e){var n,r=t.data,o=e.data,i=r.args,s=o.args;for(r.fn===o.fn&&i.length===s.length||qn(o.fn.apply(void 0,s),e),n=0;n<s.length;++n)if(i[n]!==s[n])return void qn(o.fn.apply(void 0,s),e);qn(t,e)}function Wn(t,e,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1);var i=null;return te.create({start:function(s){i=r?function(t){Vn(t,r),s.next(t)}:function(t){s.next(t)},t.addEventListener(e,i,{capture:n,passive:o})},stop:function(){t.removeEventListener(e,i,n),i=null}})}function Gn(t,e){for(var n=Object.keys(t),r=n.length,o=0;o<r;o++){var i=n[o];if("object"==typeof t[i]&&"object"==typeof e[i]){if(!Gn(t[i],e[i]))return!1}else if(t[i]!==e[i])return!1}return!0}function Vn(t,e){if(e)if("boolean"==typeof e)t.preventDefault();else if("function"==typeof e)e(t)&&t.preventDefault();else{if("object"!=typeof e)throw new Error("preventDefault has to be either a boolean, predicate function or object");Gn(e,t)&&t.preventDefault()}}var Hn=function(){function t(t){this._name=t}return t.prototype.select=function(t){return this},t.prototype.elements=function(){var t=se(re.of([document]));return t._isCycleSource=this._name,t},t.prototype.element=function(){var t=se(re.of(document));return t._isCycleSource=this._name,t},t.prototype.events=function(t,e,n){var r;void 0===e&&(e={}),r=Wn(document,t,e.useCapture,e.preventDefault);var o=se(r);return o._isCycleSource=this._name,o},t}(),Jn=function(){function t(t){this._name=t}return t.prototype.select=function(t){return this},t.prototype.elements=function(){var t=se(re.of([document.body]));return t._isCycleSource=this._name,t},t.prototype.element=function(){var t=se(re.of(document.body));return t._isCycleSource=this._name,t},t.prototype.events=function(t,e,n){var r;void 0===e&&(e={}),r=Wn(document.body,t,e.useCapture,e.preventDefault);var o=se(r);return o._isCycleSource=this._name,o},t}();function zn(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 Zn(t){for(var e="",n=t.length-1;n>=0&&"selector"===t[n].type;n--)e=t[n].scope+" "+e;return e.trim()}function Xn(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n].type!==e[n].type||t[n].scope!==e[n].scope)return!1;return!0}var Yn=function(){function t(t,e){this.namespace=t,this.isolateModule=e,this._namespace=t.filter((function(t){return"selector"!==t.type}))}return t.prototype.isDirectlyInScope=function(t){var e=this.isolateModule.getNamespace(t);if(!e)return!1;if(this._namespace.length>e.length||!Xn(this._namespace,e.slice(0,this._namespace.length)))return!1;for(var n=this._namespace.length;n<e.length;n++)if("total"===e[n].type)return!1;return!0},t}();var Kn=function(){function t(t,e){this.namespace=t,this.isolateModule=e}return t.prototype.call=function(){var t=this.namespace,e=Zn(t),n=new Yn(t,this.isolateModule),r=this.isolateModule.getElement(t.filter((function(t){return"selector"!==t.type})));return void 0===r?[]:""===e?[r]:function(t){return Array.prototype.slice.call(t)}(r.querySelectorAll(e)).filter(n.isDirectlyInScope,n).concat(r.matches(e)?[r]:[])},t}(),Qn=function(){return Qn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Qn.apply(this,arguments)};function tr(t){return{type:(e=t,e.length>1&&("."===e[0]||"#"===e[0])?"sibling":"total"),scope:t};var e}var er=function(){function t(e,n,r,o,i,s){var a;void 0===r&&(r=[]),this._rootElement$=e,this._sanitation$=n,this._namespace=r,this._isolateModule=o,this._eventDelegator=i,this._name=s,this.isolateSource=function(e,n){return new t(e._rootElement$,e._sanitation$,e._namespace.concat(tr(n)),e._isolateModule,e._eventDelegator,e._name)},this.isolateSink=(a=this._namespace,function(t,e){return":root"===e?t:t.map((function(t){if(!t)return t;var n=tr(e),r=Qn({},t,{data:Qn({},t.data,{isolate:t.data&&Array.isArray(t.data.isolate)?t.data.isolate:a.concat([n])})});return Qn({},r,{key:void 0!==r.key?r.key:JSON.stringify(r.data.isolate)})}))})}return t.prototype._elements=function(){if(0===this._namespace.length)return this._rootElement$.map((function(t){return[t]}));var t=new Kn(this._namespace,this._isolateModule);return this._rootElement$.map((function(){return t.call()}))},t.prototype.elements=function(){var t=se(this._elements().remember());return t._isCycleSource=this._name,t},t.prototype.element=function(){var t=se(this._elements().filter((function(t){return t.length>0})).map((function(t){return t[0]})).remember());return t._isCycleSource=this._name,t},Object.defineProperty(t.prototype,"namespace",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),t.prototype.select=function(e){if("string"!=typeof e)throw new Error("DOM driver's select() expects the argument to be a string as a CSS selector");if("document"===e)return new Hn(this._name);if("body"===e)return new Jn(this._name);var n=":root"===e?[]:this._namespace.concat({type:"selector",scope:e.trim()});return new t(this._rootElement$,this._sanitation$,n,this._isolateModule,this._eventDelegator,this._name)},t.prototype.events=function(t,e,n){if(void 0===e&&(e={}),"string"!=typeof t)throw new Error("DOM driver's events() expects argument to be a string representing the event type to listen for.");var r=this._eventDelegator.addEventListener(t,this._namespace,e,n),o=se(r);return o._isCycleSource=this._name,o},t.prototype.dispose=function(){this._sanitation$.shamefullySendNext(null)},t}(),nr={},rr=e&&e.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r};Object.defineProperty(nr,"__esModule",{value:!0}),nr.SampleCombineOperator=nr.SampleCombineListener=void 0;var or=n,ir={},sr=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!==ir&&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}();nr.SampleCombineListener=sr;var ar,ur=function(){function t(t,e){this.type="sampleCombine",this.ins=t,this.others=e,this.out=ir,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,r=this.vals=new Array(n),o=0;o<n;o++)r[o]=ir,e[o]._add(new sr(o,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 r=0;r<e;r++)t[r]._remove(n[r]);this.out=ir,this.vals=[],this.ils=[]},t.prototype._n=function(t){var e=this.out;e!==ir&&(this.Nn>0||e._n(rr([t],this.vals)))},t.prototype._e=function(t){var e=this.out;e!==ir&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==ir&&t._c()},t.prototype.up=function(t,e){var n=this.vals[e];this.Nn>0&&n===ir&&this.Nn--,this.vals[e]=t},t.prototype.down=function(t,e){this.others[t]._remove(e)},t}();nr.SampleCombineOperator=ur,ar=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return new or.Stream(new ur(e,t))}};var cr=nr.default=ar;function pr(t){if(!t.sel)return{tagName:"",id:"",className:""};var e=t.sel,n=e.indexOf("#"),r=e.indexOf(".",n),o=n>0?n:e.length,i=r>0?r:e.length;return{tagName:-1!==n||-1!==r?e.slice(0,Math.min(o,i)):e,id:o<i?e.slice(o+1,i):void 0,className:r>0?e.slice(i+1).replace(/\./g," "):void 0}}Object.assign;var lr=("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")()).Symbol;"function"==typeof lr&&lr("parent");var fr=function(){function t(t){this.rootElement=t}return t.prototype.call=function(t){if(11===this.rootElement.nodeType)return this.wrapDocFrag(null===t?[]:[t]);if(null===t)return this.wrap([]);var e=pr(t),n=e.tagName,r=e.id,o=function(t){var e=pr(t).className,n=void 0===e?"":e;if(!t.data)return n;var r=t.data,o=r.class,i=r.props;return o&&(n+=" "+Object.keys(o).filter((function(t){return o[t]})).join(" ")),i&&i.className&&(n+=" "+i.className),n&&n.trim()}(t),i=((t.data||{}).props||{}).id,s=void 0===i?r:i;return"string"==typeof s&&s.toUpperCase()===this.rootElement.id.toUpperCase()&&n.toUpperCase()===this.rootElement.tagName.toUpperCase()&&o.toUpperCase()===this.rootElement.className.toUpperCase()?t:this.wrap([t])},t.prototype.wrapDocFrag=function(t){return fn("",{isolate:[]},t,void 0,this.rootElement)},t.prototype.wrap=function(t){var e=this.rootElement,n=e.tagName,r=e.id,o=e.className,i=r?"#"+r:"",s=o?"."+o.split(" ").join("."):"",a=En(""+n.toLowerCase()+i+s,{},t);return a.data=a.data||{},a.data.isolate=a.data.isolate||[],a},t}(),hr=[Bn,Cn,Mn,Nn,xn],dr=function(){function t(t){this.mapper=t,this.tree=[void 0,{}]}return t.prototype.set=function(t,e,n){for(var r=this.tree,o=void 0!==n?n:t.length,i=0;i<o;i++){var s=this.mapper(t[i]),a=r[1][s];a||(a=[void 0,{}],r[1][s]=a),r=a}r[0]=e},t.prototype.getDefault=function(t,e,n){return this.get(t,e,n)},t.prototype.get=function(t,e,n){for(var r=this.tree,o=void 0!==n?n:t.length,i=0;i<o;i++){var s=this.mapper(t[i]),a=r[1][s];if(!a){if(!e)return;a=[void 0,{}],r[1][s]=a}r=a}return e&&!r[0]&&(r[0]=e()),r[0]},t.prototype.delete=function(t){for(var e=this.tree,n=0;n<t.length-1;n++){var r=e[1][this.mapper(t[n])];if(!r)return;e=r}delete e[1][this.mapper(t[t.length-1])]},t}(),yr=function(){function t(){this.namespaceTree=new dr((function(t){return t.scope})),this.namespaceByElement=new Map,this.vnodesBeingRemoved=[]}return t.prototype.setEventDelegator=function(t){this.eventDelegator=t},t.prototype.insertElement=function(t,e){this.namespaceByElement.set(e,t),this.namespaceTree.set(t,e)},t.prototype.removeElement=function(t){this.namespaceByElement.delete(t);var e=this.getNamespace(t);e&&this.namespaceTree.delete(e)},t.prototype.getElement=function(t,e){return this.namespaceTree.get(t,void 0,e)},t.prototype.getRootElement=function(t){if(this.namespaceByElement.has(t))return t;for(var e=t;!this.namespaceByElement.has(e);){if(!(e=e.parentNode))return;if("HTML"===e.tagName)throw new Error("No root element found, this should not happen at all")}return e},t.prototype.getNamespace=function(t){var e=this.getRootElement(t);if(e)return this.namespaceByElement.get(e)},t.prototype.createModule=function(){var t=this;return{create:function(e,n){var r=n.elm,o=n.data,i=(void 0===o?{}:o).isolate;Array.isArray(i)&&t.insertElement(i,r)},update:function(e,n){var r=e.elm,o=e.data,i=void 0===o?{}:o,s=n.elm,a=n.data,u=void 0===a?{}:a,c=i.isolate,p=u.isolate;Xn(c,p)||Array.isArray(c)&&t.removeElement(r),Array.isArray(p)&&t.insertElement(p,s)},destroy:function(e){t.vnodesBeingRemoved.push(e)},remove:function(e,n){t.vnodesBeingRemoved.push(e),n()},post:function(){for(var e=t.vnodesBeingRemoved,n=e.length-1;n>=0;n--){var r=e[n],o=void 0!==r.data?r.data.isolation:void 0;void 0!==o&&t.removeElement(o),t.eventDelegator.removeElement(r.elm,o)}t.vnodesBeingRemoved=[]}}},t}(),mr=function(){function t(){this.arr=[],this.prios=[]}return t.prototype.add=function(t,e){for(var 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)},t.prototype.forEach=function(t){for(var e=0;e<this.arr.length;e++)t(this.arr[e],e,this.arr)},t.prototype.delete=function(t){for(var e=0;e<this.arr.length;e++)if(this.arr[e]===t)return this.arr.splice(e,1),void this.prios.splice(e,1)},t}(),vr=function(){return vr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},vr.apply(this,arguments)},gr=["blur","canplay","canplaythrough","durationchange","emptied","ended","focus","load","loadeddata","loadedmetadata","mouseenter","mouseleave","pause","play","playing","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","unload","volumechange","waiting"],br=function(){function t(t,e){var n=this;this.rootElement$=t,this.isolateModule=e,this.virtualListeners=new dr((function(t){return 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:function(t){n.origin!==t&&(n.origin=t,n.resetEventListeners(),n.domListenersToAdd.forEach((function(t,e){return n.setupDOMListener(e,t)})),n.domListenersToAdd.clear()),n.nonBubblingListenersToAdd.forEach((function(t){n.setupNonBubblingListener(t)}))}})}return t.prototype.addEventListener=function(t,e,n,r){var o,i=re.never(),s=new Yn(e,this.isolateModule);if(void 0===r?-1===gr.indexOf(t):r)return this.domListeners.has(t)||this.setupDOMListener(t,!!n.passive),o=this.insertListener(i,s,t,n),i;var a=[];this.nonBubblingListenersToAdd.forEach((function(t){return a.push(t)}));for(var u=void 0,c=0,p=a.length,l=function(n){n[0];var r=n[1],o=n[2];return n[3],t===r&&Xn(o.namespace,e)};!u&&c<p;){var f=a[c];u=l(f)?f:u,c++}var h,d=u;if(d){var y=d[0];h=y}else{var m=new Kn(e,this.isolateModule);o=this.insertListener(i,s,t,n),d=[i,t,m,o],h=i,this.nonBubblingListenersToAdd.add(d),this.setupNonBubblingListener(d)}var v=this,g=null;return re.create({start:function(t){g=h.subscribe(t)},stop:function(){d[0];var t=d[1],e=d[2];d[3],e.call().forEach((function(e){var n=e.subs;n&&n[t]&&(n[t].unsubscribe(),delete n[t])})),v.nonBubblingListenersToAdd.delete(d),g.unsubscribe()}})},t.prototype.removeElement=function(t,e){void 0!==e&&this.virtualListeners.delete(e);var n=[];this.nonBubblingListeners.forEach((function(e,r){if(e.has(t)){n.push([r,t]);var o=t.subs;o&&Object.keys(o).forEach((function(t){o[t].unsubscribe()}))}}));for(var r=0;r<n.length;r++){var o=this.nonBubblingListeners.get(n[r][0]);o&&(o.delete(n[r][1]),0===o.size?this.nonBubblingListeners.delete(n[r][0]):this.nonBubblingListeners.set(n[r][0],o))}},t.prototype.insertListener=function(t,e,n,r){var o=[],i=e._namespace,s=i.length;do{o.push(this.getVirtualListeners(n,i,!0,s)),s--}while(s>=0&&"total"!==i[s].type);for(var a=vr({},r,{scopeChecker:e,subject:t,bubbles:!!r.bubbles,useCapture:!!r.useCapture,passive:!!r.passive}),u=0;u<o.length;u++)o[u].add(a,i.length);return a},t.prototype.getVirtualListeners=function(t,e,n,r){void 0===n&&(n=!1);var o=void 0!==r?r:e.length;if(!n)for(var i=o-1;i>=0;i--){if("total"===e[i].type){o=i+1;break}o=i}var s=this.virtualListeners.getDefault(e,(function(){return new Map}),o);return s.has(t)||s.set(t,new mr),s.get(t)},t.prototype.setupDOMListener=function(t,e){var n=this;if(this.origin){var r=Wn(this.origin,t,!1,!1,e).subscribe({next:function(r){return n.onEvent(t,r,e)},error:function(){},complete:function(){}});this.domListeners.set(t,{sub:r,passive:e})}else this.domListenersToAdd.set(t,e)},t.prototype.setupNonBubblingListener=function(t){t[0];var e=t[1],n=t[2],r=t[3];if(this.origin){var o=n.call();if(o.length){var i=this;o.forEach((function(t){var n,o=t.subs;if(!o||!o[e]){var s=Wn(t,e,!1,!1,r.passive).subscribe({next:function(t){return i.onEvent(e,t,!!r.passive,!1)},error:function(){},complete:function(){}});i.nonBubblingListeners.has(e)||i.nonBubblingListeners.set(e,new Map);var a=i.nonBubblingListeners.get(e);if(!a)return;a.set(t,{sub:s,destination:r}),t.subs=vr({},o,((n={})[e]=s,n))}}))}}},t.prototype.resetEventListeners=function(){for(var t=this.domListeners.entries(),e=t.next();!e.done;){var n=e.value,r=n[0],o=n[1],i=o.sub,s=o.passive;i.unsubscribe(),this.setupDOMListener(r,s),e=t.next()}},t.prototype.putNonBubblingListener=function(t,e,n,r){var o=this.nonBubblingListeners.get(t);if(o){var i=o.get(e);i&&i.destination.passive===r&&i.destination.useCapture===n&&(this.virtualNonBubblingListener[0]=i.destination)}},t.prototype.onEvent=function(t,e,n,r){void 0===r&&(r=!0);var o=this.patchEvent(e),i=this.isolateModule.getRootElement(e.target);if(r){var s=this.isolateModule.getNamespace(e.target);if(!s)return;var a=this.getVirtualListeners(t,s);this.bubble(t,e.target,i,o,a,s,s.length-1,!0,n),this.bubble(t,e.target,i,o,a,s,s.length-1,!1,n)}else this.putNonBubblingListener(t,e.target,!0,n),this.doBubbleStep(t,e.target,i,o,this.virtualNonBubblingListener,!0,n),this.putNonBubblingListener(t,e.target,!1,n),this.doBubbleStep(t,e.target,i,o,this.virtualNonBubblingListener,!1,n),e.stopPropagation()},t.prototype.bubble=function(t,e,n,r,o,i,s,a,u){a||r.propagationHasBeenStopped||this.doBubbleStep(t,e,n,r,o,a,u);var c=n,p=s;if(e===n){if(!(s>=0&&"sibling"===i[s].type))return;c=this.isolateModule.getElement(i,s),p--}e.parentNode&&c&&this.bubble(t,e.parentNode,c,r,o,i,p,a,u),a&&!r.propagationHasBeenStopped&&this.doBubbleStep(t,e,n,r,o,a,u)},t.prototype.doBubbleStep=function(t,e,n,r,o,i,s){n&&(this.mutateEventCurrentTarget(r,e),o.forEach((function(t){if(t.passive===s&&t.useCapture===i){var o=Zn(t.scopeChecker.namespace);!r.propagationHasBeenStopped&&t.scopeChecker.isDirectlyInScope(e)&&(""!==o&&e.matches(o)||""===o&&e===n)&&(Vn(r,t.preventDefault),t.subject.shamefullySendNext(r))}})))},t.prototype.patchEvent=function(t){var e=t;e.propagationHasBeenStopped=!1;var n=e.stopPropagation;return e.stopPropagation=function(){n.call(this),this.propagationHasBeenStopped=!0},e},t.prototype.mutateEventCurrentTarget=function(t,e){try{Object.defineProperty(t,"currentTarget",{value:e,configurable:!0})}catch(t){console.log("please use event.ownerTarget")}t.ownerTarget=e},t}();function _r(t){return re.merge(t,re.never())}function wr(t){return t.elm}function Sr(t){(console.error||console.log)(t)}function Or(t,e){void 0===e&&(e={}),zn(t);var n=e.modules||hr;!function(t){if(!Array.isArray(t))throw new Error("Optional modules option must be an array for snabbdom modules")}(n);var r,o,i=new yr,s=e&&e.snabbdomOptions||void 0,a=Sn([i.createModule()].concat(n),void 0,s),u=re.create({start:function(t){"loading"===document.readyState?document.addEventListener("readystatechange",(function(){var e=document.readyState;"interactive"!==e&&"complete"!==e||(t.next(null),t.complete())})):(t.next(null),t.complete())},stop:function(){}}),c=re.create({start:function(t){o=new MutationObserver((function(){return t.next(null)}))},stop:function(){o.disconnect()}});return function(n,s){void 0===s&&(s="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);var p=re.create(),l=u.map((function(){var e=function(t){var 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 r=new fr(e),e})),f=n.remember();f.addListener({}),c.addListener({});var h=l.map((function(t){return re.merge(f.endWhen(p),p).map((function(t){return r.call(t)})).startWith(function(t){return t.data=t.data||{},t.data.isolate=[],t}(An(t))).fold(a,An(t)).drop(1).map(wr).startWith(t).map((function(t){return o.observe(t,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),t})).compose(_r)})).flatten(),d=De(u,c).endWhen(p).compose(cr(h)).map((function(t){return t[1]})).remember();d.addListener({error:e.reportSnabbdomError||Sr});var y=new br(d,i);return new er(d,p,[],i,y,s)}}var Er="___",Ar=function(){function t(t){this._mockConfig=t,t.elements?this._elements=t.elements:this._elements=se(re.empty())}return t.prototype.elements=function(){var t=this._elements;return t._isCycleSource="MockedDOM",t},t.prototype.element=function(){var t=this.elements().filter((function(t){return t.length>0})).map((function(t){return t[0]})).remember(),e=se(t);return e._isCycleSource="MockedDOM",e},t.prototype.events=function(t,e,n){var r=this._mockConfig[t],o=se(r||re.empty());return o._isCycleSource="MockedDOM",o},t.prototype.select=function(e){return new t(this._mockConfig[e]||{})},t.prototype.isolateSource=function(t,e){return t.select(".___"+e)},t.prototype.isolateSink=function(t,e){return se(re.fromObservable(t).map((function(t){return t.sel&&-1!==t.sel.indexOf(Er+e)||(t.sel+=".___"+e),t})))},t}();function jr(t){return function(t){return"string"==typeof t&&t.length>0}(t)&&("."===t[0]||"#"===t[0])}function Nr(t){return function(e,n,r){var o=void 0!==e,i=void 0!==n,s=void 0!==r;return jr(e)?i&&s?En(t+e,n,r):En(t+e,i?n:{}):s?En(t+e,n,r):i?En(t,e,n):En(t,o?e:{})}}var $r=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","colorProfile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotlight","feTile","feTurbulence","filter","font","fontFace","fontFaceFormat","fontFaceName","fontFaceSrc","fontFaceUri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missingGlyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Cr=Nr("svg");$r.forEach((function(t){Cr[t]=Nr(t)}));var kr=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","meta","nav","noscript","object","ol","optgroup","option","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","u","ul","video"],Ir={SVG_TAG_NAMES:$r,TAG_NAMES:kr,svg:Cr,isSelector:jr,createTagFunction:Nr};kr.forEach((function(t){Ir[t]=Nr(t)}));var xr=Ir.svg,Pr=Ir.a,Mr=Ir.abbr,Tr=Ir.address,Dr=Ir.area,Lr=Ir.article,Fr=Ir.aside,Br=Ir.audio,qr=Ir.b,Rr=Ir.base,Ur=Ir.bdi,Wr=Ir.bdo,Gr=Ir.blockquote,Vr=Ir.body,Hr=Ir.br,Jr=Ir.button,zr=Ir.canvas,Zr=Ir.caption,Xr=Ir.cite,Yr=Ir.code,Kr=Ir.col,Qr=Ir.colgroup,to=Ir.dd,eo=Ir.del,no=Ir.dfn,ro=Ir.dir,oo=Ir.div,io=Ir.dl,so=Ir.dt,ao=Ir.em,uo=Ir.embed,co=Ir.fieldset,po=Ir.figcaption,lo=Ir.figure,fo=Ir.footer,ho=Ir.form,yo=Ir.h1,mo=Ir.h2,vo=Ir.h3,go=Ir.h4,bo=Ir.h5,_o=Ir.h6,wo=Ir.head,So=Ir.header,Oo=Ir.hgroup,Eo=Ir.hr,Ao=Ir.html,jo=Ir.i,No=Ir.iframe,$o=Ir.img,Co=Ir.input,ko=Ir.ins,Io=Ir.kbd,xo=Ir.keygen,Po=Ir.label,Mo=Ir.legend,To=Ir.li,Do=Ir.link,Lo=Ir.main,Fo=Ir.map,Bo=Ir.mark,qo=Ir.menu,Ro=Ir.meta,Uo=Ir.nav,Wo=Ir.noscript,Go=Ir.object,Vo=Ir.ol,Ho=Ir.optgroup,Jo=Ir.option,zo=Ir.p,Zo=Ir.param,Xo=Ir.pre,Yo=Ir.progress,Ko=Ir.q,Qo=Ir.rp,ti=Ir.rt,ei=Ir.ruby,ni=Ir.s,ri=Ir.samp,oi=Ir.script,ii=Ir.section,si=Ir.select,ai=Ir.small,ui=Ir.source,ci=Ir.span,pi=Ir.strong,li=Ir.style,fi=Ir.sub,hi=Ir.sup,di=Ir.table,yi=Ir.tbody,mi=Ir.td,vi=Ir.textarea,gi=Ir.tfoot,bi=Ir.th,_i=Ir.thead,wi=Ir.title,Si=Ir.tr,Oi=Ir.u,Ei=Ir.ul,Ai=Ir.video;function ji(t){const e=new EventTarget;return t.subscribe({next:t=>e.dispatchEvent(new CustomEvent("data",{detail:t}))}),{select:t=>{const n=!t,r=Array.isArray(t)?t:[t];let o;const i=re.create({start:t=>{o=({detail:e})=>{const o=e&&e.data||null;(n||r.includes(e.type))&&t.next(o)},e.addEventListener("data",o)},stop:t=>e.removeEventListener("data",o)});return se(i)}}}function Ni(t){t.addListener({next:t=>{console.log(t)}})}function $i(t){return/^[a-zA-Z0-9-_]+$/.test(t)}function Ci(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(!$i(e))throw new Error(`${e} is not a valid CSS class name`);return t.push(e),t}),[])}var ki={};Object.defineProperty(ki,"__esModule",{value:!0});var Ii=n,xi=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 Pi=ki.default=function(t){return function(e){return new Ii.Stream(new xi(t,e))}};t.ABORT=tn,t.MainDOMSource=er,t.MockedDOMSource=Ar,t.a=Pr,t.abbr=Mr,t.address=Tr,t.area=Dr,t.article=Lr,t.aside=Fr,t.audio=Br,t.b=qr,t.base=Rr,t.bdi=Ur,t.bdo=Wr,t.blockquote=Gr,t.body=Vr,t.br=Hr,t.button=Jr,t.canvas=zr,t.caption=Zr,t.cite=Xr,t.classes=function(...t){return t.reduce(((t,e)=>{var n,r;return"string"!=typeof e||t.includes(e)?Array.isArray(e)?t.push(...(r=e,r.map(Ci).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(!$i(n))throw new Error(`${n} is not a valid CSS class name`);return n})))):t.push(...Ci(e)),t}),[]).join(" ")},t.code=Yr,t.col=Kr,t.colgroup=Qr,t.collection=qe,t.component=function(t){const{name:e,sources:n,isolateOpts:r,stateSourceName:o="STATE"}=t;if(n&&"object"!=typeof n)throw new Error("Sources must be a Cycle.js sources object:",e);let i;i="string"==typeof r?{[o]:r}:!0===r?{}:r;const s=void 0===n;if("object"==typeof i){const e=e=>{const n={...t,sources:e};return new en(n).sinks};return s?fe(e,i):fe(e,i)(n)}return s?e=>new en({...t,sources:e}).sinks:new en(t).sinks},t.dd=to,t.debounce=Xe,t.del=eo,t.delay=He,t.dfn=no,t.dir=ro,t.div=oo,t.dl=io,t.dropRepeats=ve,t.dt=so,t.em=ao,t.embed=uo,t.fieldset=co,t.figcaption=po,t.figure=lo,t.footer=fo,t.form=ho,t.h=En,t.h1=yo,t.h2=mo,t.h3=vo,t.h4=go,t.h5=bo,t.h6=_o,t.head=wo,t.header=So,t.hgroup=Oo,t.hr=Eo,t.html=Ao,t.i=jo,t.iframe=No,t.img=$o,t.input=Co,t.ins=ko,t.kbd=Io,t.keygen=xo,t.label=Po,t.legend=Mo,t.li=To,t.link=Do,t.main=Lo,t.makeDOMDriver=Or,t.map=Fo,t.mark=Bo,t.menu=qo,t.meta=Ro,t.mockDOMSource=function(t){return new Ar(t)},t.nav=Uo,t.noscript=Wo,t.object=Go,t.ol=Vo,t.optgroup=Ho,t.option=Jo,t.p=zo,t.param=Zo,t.pre=Xo,t.processForm=function(t,e={}){let{events:n=["input","submit"],preventDefault:r=!0}=e;"string"==typeof n&&(n=[n]);const o=n.map((e=>t.events(e)));return re.merge(...o).map((t=>{r&&t.preventDefault();const e="submit"===t.type?t.srcElement:t.currentTarget,n=new FormData(e);let o={};o.event=t,o.eventType=t.type;const i=e.querySelector("input[type=submit]:focus");if(i){const{name:t,value:e}=i;o[t||"submit"]=e}for(let[t,e]of n.entries())o[t]=e;return o}))},t.progress=Yo,t.q=Ko,t.rp=Qo,t.rt=ti,t.ruby=ei,t.run=function(t,e={},n={}){const{mountPoint:r="#root",fragments:o=!0}=n,i=function(t,e){return void 0===e&&(e="state"),function(n){var r=re.create(),o=r.fold((function(t,e){return e(t)}),void 0).drop(1),i=n;i[e]=new Oe(o,e);var s=t(i);return s[e]&&De(re.fromObservable(s[e]),re.never()).subscribe({next:function(t){return Be((function(){return r._n(t)}))},error:function(t){return Be((function(){return r._e(t)}))},complete:function(){return Be((function(){return r._c()}))}}),s}}(t,"STATE");return function(t,e){var n=pn(t,e);return"undefined"!=typeof window&&window.CyclejsDevTool_startGraphSerializer&&window.CyclejsDevTool_startGraphSerializer(n.sinks),n.run()}(i,{...{EVENTS:ji,DOM:Or(r,{snabbdomOptions:{experimental:{fragments:o}}}),LOG:Ni},...e})},t.s=ni,t.samp=ri,t.sampleCombine=cr,t.script=oi,t.section=ii,t.select=si,t.small=ai,t.source=ui,t.span=ci,t.strong=pi,t.style=li,t.sub=fi,t.sup=hi,t.svg=xr,t.switchable=Re,t.table=di,t.tbody=yi,t.td=mi,t.textarea=vi,t.tfoot=gi,t.th=bi,t.thead=_i,t.throttle=Pi,t.thunk=function(t,e,n,r){return void 0===r&&(r=n,n=e,e=void 0),En(t,{key:e,hook:{init:Rn,prepatch:Un},fn:n,args:r})},t.title=wi,t.tr=Si,t.u=Oi,t.ul=Ei,t.video=Ai,t.xs=re,Object.defineProperty(t,"__esModule",{value:!0})}));