Comparing version 0.5.5 to 0.5.6
@@ -12,2 +12,3 @@ export * from './rendering/classname'; | ||
export * from './stream/set_data_source'; | ||
export * from './stream/data_source_operators'; | ||
export * from './stream/stream'; | ||
@@ -14,0 +15,0 @@ export * from './utilities/aurum'; |
@@ -12,2 +12,3 @@ export * from './rendering/classname'; | ||
export * from './stream/set_data_source'; | ||
export * from './stream/data_source_operators'; | ||
export * from './stream/stream'; | ||
@@ -14,0 +15,0 @@ export * from './utilities/aurum'; |
{ | ||
"name": "aurumjs", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"description": "Fast and concise declarative DOM rendering library for javascript", | ||
@@ -5,0 +5,0 @@ "main": "prebuilt/aurumjs.js", |
@@ -1,2 +0,2 @@ | ||
function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function t(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function o(e,t,n){return(o=r()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&a(r,n.prototype),r}).apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return o(e,arguments,i(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)})(e)}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function l(e){var t=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return u(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,void 0):void 0}}(e)))return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}var c,h=function(){function e(){var e=[].slice.call(arguments);this.cancelables=null!=e?e:[],this._isCancelled=!1}var n=e.prototype;return n.hasCancellables=function(){return this.cancelables.length>0},n.addCancelable=function(e){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.push(e),200===this.cancelables.length&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this},n.removeCancelable=function(e){this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled");var t=this.cancelables.indexOf(e);return-1!==t&&this.cancelables.splice(t,1),this},n.setTimeout=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=this;void 0===t&&(t=0);var i=setTimeout(function(){n.removeCancelable(a),e()},t),a=function(){return clearTimeout(i)};this.addCancelable(a)}),n.setInterval=function(e){function t(t,n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=setInterval(e,t);this.addCancelable(function(){return clearInterval(n)})}),n.requestAnimationFrame=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){var t=this,n=requestAnimationFrame(function(){t.removeCancelable(i),e()}),i=function(){return cancelAnimationFrame(n)};this.addCancelable(i)}),n.animationLoop=function(e){var t=requestAnimationFrame(function n(i){e(i),t=requestAnimationFrame(n)});this.addCancelable(function(){return cancelAnimationFrame(t)})},n.throwIfCancelled=function(e){if(this.isCanceled)throw new Error(e||"cancellation token is cancelled")},n.chain=function(e,t){return void 0===t&&(t=!1),t&&e.chain(this,!1),this.addCancelable(function(){return e.cancel()}),this},n.registerDomEvent=function(e,t,n){return e.addEventListener(t,n),this.addCancelable(function(){return e.removeEventListener(t,n)}),this},n.cancel=function(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(function(e){return e()}),this.cancelables=void 0)},t(e,[{key:"isCanceled",get:function(){return this._isCancelled}}]),e}(),d=function(){function e(){this.subscribeChannel=[],this.subscribeOnceChannel=[],this.onAfterFire=[]}var n=e.prototype;return n.subscribe=function(e,t){return this.createSubscription(e,this.subscribeChannel,t).facade},n.subscribeOnce=function(e,t){return this.createSubscription(e,this.subscribeOnceChannel,t).facade},n.hasSubscriptions=function(){return this.subscriptions>0},n.cancelAll=function(){var e,t=this;this.isFiring?this.onAfterFire.push(function(){var e;t.subscribeChannel.length=0,t.subscribeOnceChannel.length=0,null===(e=t.onEmpty)||void 0===e||e.call(t)}):(this.subscribeChannel.length=0,this.subscribeOnceChannel.length=0,null===(e=this.onEmpty)||void 0===e||e.call(this))},n.afterFire=function(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(function(e){return e()}),this.onAfterFire.length=0)},n.fire=function(e){this.isFiring=!0;for(var t=this.subscribeChannel.length,n=0;n<t;n++)try{this.subscribeChannel[n].callback(e)}catch(e){console.error(e)}if(this.subscribeOnceChannel.length>0){t=this.subscribeOnceChannel.length;for(var i=0;i<t;i++)try{this.subscribeOnceChannel[i].callback(e)}catch(e){console.error(e)}this.subscribeOnceChannel.length=0}this.isFiring=!1,this.afterFire()},n.createSubscription=function(e,t,n){var i=this,a={callback:e},r={cancel:function(){i.cancel(a,t)}};return void 0!==n&&n.addCancelable(function(){return i.cancel(a,t)}),t.push(a),{subscription:a,facade:r}},n.cancel=function(e,t){var n,i=this,a=t.indexOf(e);a>=0&&(this.isFiring?this.onAfterFire.push(function(){return i.cancel(e,t)}):(t.splice(a,1),this.hasSubscriptions()||null===(n=this.onEmpty)||void 0===n||n.call(this)))},t(e,[{key:"subscriptions",get:function(){return this.subscribeChannel.length+this.subscribeOnceChannel.length}}]),e}();function f(e,t,n){if(!e.s){if(n instanceof p){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;var i=e.o;i&&i(e)}}!function(e){e[e.FILTER=0]="FILTER",e[e.MAP=1]="MAP",e[e.DELAY=2]="DELAY",e[e.MAP_DELAY=3]="MAP_DELAY"}(c||(c={}));var p=function(){function e(){}return e.prototype.then=function(t,n){var i=new e,a=this.s;if(a){var r=1&a?t:n;if(r){try{f(i,1,r(this.v))}catch(e){f(i,2,e)}return i}return this}return this.o=function(e){try{var a=e.v;1&e.s?f(i,1,t?t(a):a):n?f(i,1,n(a)):f(i,2,a)}catch(e){f(i,2,e)}},i},e}(),v="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function m(e){return e instanceof p&&1&e.s}var w,g=function(){function e(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new d}e.fromMultipleSources=function(t,n){for(var i,a=new e,r=l(t);!(i=r()).done;)i.value.listen(function(e){return a.update(e)},n);return a};var t=e.prototype;return t.repeatLast=function(){return this.update(this.value),this},t.update=function(e){if(this.primed=!0,this.updating)throw new Error("Problem in data source: Unstable value propagation. When updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=e,this.updateEvent.fire(e),this.updating=!1},t.withInitial=function(e){return this.primed||this.update(e),this},t.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},t.filter=function(e,t){t=null!=t?t:new h;var n=new b(t);return this.listen(function(t){e(t,n.value)&&n.update(t)},t),n},t.max=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)>0:e>t},e)},t.min=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)<0:e<t},e)},t.transform=function(t,n,i,a,r,o,s,u,l,d,w,g){var b,y=[t,n,i,a,r,o,s,u,l,d,w].filter(function(e){return!(e&&e instanceof h&&(b=e,1))});g&&(b=g);var E=new e;return this.listen(function(e){try{var n,i=function(t){if(n)return t;E.update(e)},a=function(e,t,n){if("function"==typeof e[v]){var i,a,r,o=e[v]();if(function e(s){try{for(;!((i=o.next()).done||n&&n());)if((s=t(i.value))&&s.then){if(!m(s))return void s.then(e,r||(r=f.bind(null,a=new p,2)));s=s.v}a?f(a,1,s):a=s}catch(e){f(a||(a=new p),2,e)}}(),o.return){var s=function(e){try{i.done||o.return()}catch(e){}return e};if(a&&a.then)return a.then(s,function(e){throw s(e)});s()}return a}if(!("length"in e))throw new TypeError("Object is not iterable");for(var u=[],l=0;l<e.length;l++)u.push(e[l]);return function(e,t,n){var i,a,r=-1;return function o(s){try{for(;++r<e.length&&(!n||!n());)if((s=t(r))&&s.then){if(!m(s))return void s.then(o,a||(a=f.bind(null,i=new p,2)));s=s.v}i?f(i,1,s):i=s}catch(e){f(i||(i=new p),2,e)}}(),i}(u,function(e){return t(u[e])},n)}(y,function(i){return function(e,t){var n,i=-1;e:{for(var a=0;a<t.length;a++){var r=t[a][0];if(r){var o=r();if(o&&o.then)break e;if(o===e){i=a;break}}else i=a}if(-1!==i){do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then){n=!0;break e}var l=t[i][2];i++}while(l&&!l());return u}}var c=new p,h=f.bind(null,c,2);return(n?u.then(d):o.then(function n(o){for(;;){if(o===e){i=a;break}if(++a===t.length){if(-1!==i)break;return void f(c,1,u)}if(r=t[a][0]){if((o=r())&&o.then)return void o.then(n).then(void 0,h)}else i=a}do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then)return void u.then(d).then(void 0,h);var l=t[i][2];i++}while(l&&!l());f(c,1,u)})).then(void 0,h),c;function d(e){for(;;){var n=t[i][2];if(!n||n())break;i++;for(var a=t[i][1];!a;)i++,a=t[i][1];if((e=a())&&e.then)return void e.then(d).then(void 0,h)}f(c,1,e)}}(t.operationType,[[function(){return c.MAP},function(){e=i.operation(e)}],[function(){return c.DELAY}],[function(){return c.MAP_DELAY},function(){return Promise.resolve(i.operation(e)).then(function(t){e=t})}],[function(){return c.FILTER},function(){i.operation(e)||(n=1)}]])},function(){return n});return Promise.resolve(a&&a.then?a.then(i):i(a))}catch(e){return Promise.reject(e)}},b),E},t.pipe=function(e,t){return this.listen(function(t){return e.update(t)},t),this},t.map=function(e,t){var n;return t=null!=t?t:new h,n=this.primed?new b(t,e(this.value)):new b(t),this.listen(function(t){n.update(e(t))},t),n},t.tap=function(e,t){return this.listen(function(t){e(t)},t),this},t.loadBalance=function(e,t){var n=0;this.listen(function(t){e[n++].update(t),n>=e.length&&(n=0)},t)},t.await=function(e){e=null!=e?e:new h;var t=new b(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var n=t.update;return Promise.resolve(e).then(function(e){n.call(t,e)})}catch(e){return Promise.reject(e)}},e),t},t.awaitOrdered=function(e){e=null!=e?e:new h;var t=[],n=new b(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=!1,a=function(){if(!(e instanceof Promise)){var a=n.update;return Promise.resolve(e).then(function(e){a.call(n,e)})}t.push(e),function(){try{var e=function(){i=!1};i||(i=!0);var a=function(e,t,n){for(var i;;){var a=e();if(m(a)&&(a=a.v),!a)return r;if(a.then){i=0;break}var r=n();if(r&&r.then){if(!m(r)){i=1;break}r=r.s}}var o=new p,s=f.bind(null,o,2);return(0===i?a.then(l):1===i?r.then(u):(void 0).then(function(){(a=e())?a.then?a.then(l).then(void 0,s):l(a):f(o,1,r)})).then(void 0,s),o;function u(t){r=t;do{if(!(a=e())||m(a)&&!a.v)return void f(o,1,r);if(a.then)return void a.then(l).then(void 0,s);m(r=n())&&(r=r.v)}while(!r||!r.then);r.then(u).then(void 0,s)}function l(e){e?(r=n())&&r.then?r.then(u).then(void 0,s):u(r):f(o,1,r)}}(function(){return!!t.length},0,function(){var e=n.update;return Promise.resolve(t[0]).then(function(i){e.call(n,i),t.shift()})});Promise.resolve(a&&a.then?a.then(e):e())}catch(e){return Promise.reject(e)}}()}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e),n},t.awaitLatest=function(e){var t;e=null!=e?e:new h;var n=new b(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=t=Date.now();return Promise.resolve(e).then(function(e){t===i&&n.update(e)})}catch(e){return Promise.reject(e)}},e),n},t.unique=function(e){e=null!=e?e:new h;var t=new b(e,this.value);return this.listen(function(e){e!==t.value&&t.update(e)},e),t},t.diff=function(e){e=null!=e?e:new h;var t=new b(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},t.reduce=function(e,t,n){n=null!=n?n:new h;var i=new b(n,t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},t.aggregate=function(e,t,n){var i=this;n=null!=n?n:new h;var a=new b(n,t(this.value,e.value));return this.listen(function(){return a.update(t(i.value,e.value))},n),e.listen(function(){return a.update(t(i.value,e.value))},n),a},t.aggregateThree=function(e,t,n,i){var a=this;i=null!=i?i:new h;var r=new b(i,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(a.value,e.value,t.value))},i),e.listen(function(){return r.update(n(a.value,e.value,t.value))},i),t.listen(function(){return r.update(n(a.value,e.value,t.value))},i),r},t.aggregateFour=function(e,t,n,i,a){var r=this;a=null!=a?a:new h;var o=new b(a,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),e.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),t.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),n.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),o},t.combine=function(e,t){t=null!=t?t:new h;var n=new b(t);this.pipe(n,t);for(var i,a=l(e);!(i=a()).done;)i.value.pipe(n,t);return n},t.delay=function(e,t){t=null!=t?t:new h;var n=new b(t,this.value);return this.listen(function(t){setTimeout(function(){n.update(t)},e)},t),n},t.skip=function(e,t){t=null!=t?t:new h;var n=new b(t,this.value);return this.listen(function(t){0===e?n.update(t):e--},t),n},t.cutoff=function(e,t){t=null!=t?t:new h;var n=new b(t,this.value);return this.listen(function(t){e-- >0&&n.update(t)},t),n},t.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},t.debounce=function(e,t){t=null!=t?t:new h;var n,i=new b(t,this.value);return this.listen(function(t){clearTimeout(n),n=setTimeout(function(){i.update(t)},e)},t),i},t.throttle=function(e,t){t=null!=t?t:new h;var n=new b(t,this.value),i=!1;return this.listen(function(t){i||(n.update(t),i=!0,setTimeout(function(){i=!1},e))},t),n},t.buffer=function(e,t){t=null!=t?t:new h;var n,i=new b(t),a=[];return this.listen(function(t){a.push(t),n||(n=setTimeout(function(){n=void 0,i.update(a),a=[]},e))},t),i},t.accumulate=function(e){var t=new y;return this.listen(function(e){t.push(e)},e),t},t.pick=function(e,t){var n;t=null!=t?t:new h;var i=new b(t,null===(n=this.value)||void 0===n?void 0:n[e]);return this.listen(function(t){i.update(null!=t?t[e]:t)},t),i},t.cancelAll=function(){this.updateEvent.cancelAll()},e}(),b=function(e){function t(t,n){var i;return(i=e.call(this,n)||this).disposeToken=t,i.updateEvent.onEmpty=function(){t.cancel(),Object.defineProperty(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i),"value",{get:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')},set:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')}})},i}n(t,e);var i=t.prototype;return i.persist=function(){return this.updateEvent.onEmpty=void 0,this},i.listen=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},i.listenAndRepeat=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listenAndRepeat.call(this,t,n)},i.listenOnce=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},t}(g),y=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new g(this.data.length),this.updateEvent=new d}var n=e.prototype;return n.listenAndRepeat=function(e,t){return e({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(e,t)},n.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},n.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},n.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},n.getData=function(){return this.data},n.get=function(e){return this.data[e]},n.set=function(e,t){var n=this.data[e];n!==t&&(this.data[e]=t,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:e,items:[t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},n.swap=function(e,t){if(e!==t){var n=this.data[e],i=this.data[t];this.data[t]=n,this.data[e]=i,this.update({operation:"swap",operationDetailed:"swap",index:e,index2:t,items:[n,i],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.swapItems=function(e,t){if(e!==t){var n=this.data.indexOf(e),i=this.data.indexOf(t);-1!==n&&-1!==i&&(this.data[i]=e,this.data[n]=t),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:i,items:[e,t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.appendArray=function(e){this.data=this.data.concat(e),this.update({operation:"add",operationDetailed:"append",count:e.length,index:this.data.length-e.length,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.insertAt=function(e){var t,n=[].slice.call(arguments,1);0!==n.length&&((t=this.data).splice.apply(t,[e,0].concat(n)),this.update({operation:"add",operationDetailed:"insert",count:n.length,index:e,items:n,newState:this.data}),this.lengthSource.update(this.data.length))},n.push=function(){this.appendArray([].slice.call(arguments))},n.unshift=function(){var e,t=[].slice.call(arguments);(e=this.data).unshift.apply(e,t),this.update({operation:"add",operationDetailed:"prepend",count:t.length,items:t,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.pop=function(){var e=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},n.merge=function(e){var t=this.data;this.data=e.slice(),this.update({operation:"merge",operationDetailed:"merge",previousState:t,index:0,items:this.data,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.removeRight=function(e){var t=this.data.length,n=this.data.splice(t-e,e);this.update({operation:"remove",operationDetailed:"removeRight",count:e,index:t-e,items:n,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.removeLeft=function(e){var t=this.data.splice(0,e);this.update({operation:"remove",operationDetailed:"removeLeft",count:e,index:0,items:t,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.remove=function(e){var t=this.data.indexOf(e);-1!==t&&(this.data.splice(t,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:t,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},n.clear=function(){if(0!==this.data.length){var e=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:e.length,index:0,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.shift=function(){var e=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[e],count:1,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},n.toArray=function(){return this.data.slice()},n.sort=function(e,t,n){void 0===t&&(t=[]);var i=new k(this,e,n),a=new h;return n&&n.addCancelable(function(){return a.cancel()}),t.forEach(function(e){e.listen(function(){return i.refresh()})},a),i},n.map=function(e,t,n){void 0===t&&(t=[]);var i=new E(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()})},n),i},n.filter=function(e,t,n){void 0===t&&(t=[]);var i=new S(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()},n)}),i},n.forEach=function(e){return this.data.forEach(e)},n.update=function(e){this.updateEvent.fire(e)},t(e,[{key:"length",get:function(){return this.lengthSource}}]),e}(),E=function(e){function t(t,n,i){var a;void 0===i&&(i=new h);var r=t.getData().map(n);return(a=e.call(this,r)||this).parent=t,a.mapper=n,t.listen(function(e){var t,n;switch(e.operationDetailed){case"removeLeft":a.removeLeft(e.count);break;case"removeRight":a.removeRight(e.count);break;case"remove":a.remove(a.data[e.index]);break;case"clear":a.clear();break;case"prepend":(t=a).unshift.apply(t,e.items.map(a.mapper));break;case"append":a.appendArray(e.items.map(a.mapper));break;case"insert":(n=a).insertAt.apply(n,[e.index].concat(e.items.map(a.mapper)));break;case"swap":a.swap(e.index,e.index2);break;case"replace":a.set(e.index,a.mapper(e.items[0]));break;case"merge":for(var i=a.data.slice(),r=e.previousState.slice(),o=0;o<e.newState.length;o++)if(a.data.length<=o&&a.data.push(a.mapper(e.newState[o])),r[o]!==e.newState[o]){var s=r.indexOf(e.newState[o]);if(-1!==s){var u=a.data[o];a.data[o]=a.data[s],a.data[s]=u;var l=r[o];r[o]=r[s],r[s]=l}else a.data.splice(o,0,a.mapper(e.newState[o])),r.splice(o,0,e.newState[o])}a.data.length>e.newState.length&&(a.data.length=e.newState.length),a.update({operation:"merge",operationDetailed:"merge",previousState:i,index:0,items:a.data,newState:a.data})}},i),a}return n(t,e),t.prototype.refresh=function(){this.merge(this.parent.data.map(this.mapper))},t}(y),k=function(e){function t(t,n,i){var a;void 0===i&&(i=new h);var r=t.getData().slice().sort(n);return(a=e.call(this,r)||this).parent=t,a.comparator=n,t.listen(function(e){var t;switch(e.operationDetailed){case"removeLeft":case"removeRight":for(var n,i=l(e.items);!(n=i()).done;)a.remove(n.value);break;case"remove":a.remove(e.items[0]);break;case"clear":a.clear();break;case"prepend":(t=a).unshift.apply(t,e.items),a.data.sort(a.comparator);break;case"append":case"insert":a.appendSorted(e.items);break;case"merge":a.merge(e.items.slice().sort(a.comparator));break;case"swap":break;case"replace":a.remove(e.target),a.appendSorted(e.items)}},i),a}n(t,e);var i=t.prototype;return i.appendSorted=function(e){this.merge(this.data.concat(e).sort(this.comparator))},i.refresh=function(){this.merge(this.parent.getData().slice().sort(this.comparator))},t}(y),S=function(e){function t(t,n,i){var a;void 0===i&&(i=new h),Array.isArray(t)&&(t=new y(t));var r=t.data.filter(n=null!=n?n:function(){return!0});return(a=e.call(this,r)||this).parent=t,a.viewFilter=n,t.listen(function(e){var t,n,i;switch(e.operationDetailed){case"clear":a.clear();break;case"removeLeft":case"removeRight":case"remove":for(var r,o=l(e.items);!(r=o()).done;)a.remove(r.value);break;case"prepend":i=e.items.filter(a.viewFilter),(t=a).unshift.apply(t,i);break;case"append":i=e.items.filter(a.viewFilter),a.appendArray(i);break;case"insert":i=e.items.filter(a.viewFilter),(n=a).insertAt.apply(n,[e.index].concat(i));break;case"merge":a.merge(e.items.filter(a.viewFilter));break;case"swap":var s=a.data.indexOf(e.items[0]),u=a.data.indexOf(e.items[1]);-1!==s&&-1!==u&&a.swap(s,u);break;case"replace":var c=a.data.indexOf(e.target);-1!==c&&(a.viewFilter(e.items[0])?a.set(c,e.items[0]):a.remove(e.target))}},i),a}n(t,e);var i=t.prototype;return i.updateFilter=function(e){if(this.viewFilter!==e)return this.viewFilter=e,this.refresh(),this.data.length},i.refresh=function(){this.merge(this.parent.data.filter(this.viewFilter))},t}(y);!function(e){e[e.UPSTREAM=0]="UPSTREAM",e[e.DOWNSTREAM=1]="DOWNSTREAM"}(w||(w={}));var A=function(){function e(e,t){void 0===t&&(t=!0),this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new d,this.updateUpstreamEvent=new d,this.propagateWritesToReadStream=t}e.fromTwoDataSource=function(t,n,i,a){void 0===a&&(a=!0);var r=new e(i,a);return r.updateDownstreamEvent=t.updateEvent,r.updateUpstreamEvent=n.updateEvent,r};var t=e.prototype;return t.withInitial=function(e){return this.primed||this.updateDownstream(e),this},e.createOneWay=function(t,n){return void 0===t&&(t=w.DOWNSTREAM),new e(n,!1).oneWayFlow(t)},t.updateDownstream=function(e){if(this.updatingDownstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingDownstream=!0,this.value=e,this.updateDownstreamEvent.fire(e),this.updatingDownstream=!1},t.updateUpstream=function(e){if(this.updatingUpstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingUpstream=!0,this.value=e,this.updateUpstreamEvent.fire(e),this.propagateWritesToReadStream&&this.updateDownstreamEvent.fire(e),this.updatingUpstream=!1},t.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},t.listen=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},t.listenUpstream=function(e,t){return this.updateUpstreamEvent.subscribe(e,t).cancel},t.listenUpstreamOnce=function(e,t){return this.updateUpstreamEvent.subscribeOnce(e,t).cancel},t.listenDownstream=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},t.downStreamToDataSource=function(e){var t=new g(this.value);return this.listenDownstream(function(e){t.update(e)},e),t},t.aggregate=function(e,t,n){var i=this;n=null!=n?n:new h;var a=new b(n,t(this.value,e.value));return this.listen(function(){return a.update(t(i.value,e.value))},n),e.listen(function(){return a.update(t(i.value,e.value))},n),a},t.aggregateThree=function(e,t,n,i){var a=this;i=null!=i?i:new h;var r=new b(i,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(a.value,e.value,t.value))},i),e.listen(function(){return r.update(n(a.value,e.value,t.value))},i),t.listen(function(){return r.update(n(a.value,e.value,t.value))},i),r},t.aggregateFour=function(e,t,n,i,a){var r=this;a=null!=a?a:new h;var o=new b(a,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),e.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),t.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),n.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),o},t.filter=function(t,n,i){var a=this;if("function"==typeof n){var r=new e(void 0,!1);return this.listenDownstream(function(e){t(e,r.value)&&r.updateDownstream(e)},i),r.listenUpstream(function(e){n(e,a.value)&&a.updateUpstream(e)},i),r}var o=new g;return this.listenDownstream(function(e){t(e,o.value)&&o.update(e)},n),o},t.pipe=function(e,t){var n=this;return this.listenDownstream(function(t){return e.updateDownstream(t)},t),e.listenUpstream(function(e){return n.updateUpstream(e)},t),this},t.map=function(t,n,i){var a,r,o=this;return"function"==typeof n?(a=new e(this.primed?t(this.value):void 0,!1),this.listenDownstream(function(e){return a.updateDownstream(t(e))},i),a.listenUpstream(function(e){return o.updateUpstream(n(e))},i),a):(r=this.primed?new g(t(this.value)):new g,this.listenDownstream(function(e){return r.update(t(e))},n),r)},t.listenOnce=function(e,t){return this.updateDownstreamEvent.subscribeOnce(e,t).cancel},t.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},t.debounceUpstream=function(t,n){var i,a=this,r=new e(this.value);return r.listenUpstream(function(e){clearTimeout(i),i=setTimeout(function(){a.updateUpstream(e)},t)},n),this.listenDownstream(function(e){r.updateDownstream(e)},n),r},t.debounceDownstream=function(t,n){var i,a=this,r=new e(this.value);return this.listenDownstream(function(e){clearTimeout(i),i=setTimeout(function(){r.updateDownstream(e)},t)},n),r.listenUpstream(function(e){a.updateUpstream(e)},n),r},t.diff=function(e){e=null!=e?e:new h;var t=new b(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},t.await=function(t){t=null!=t?t:new h;var n=new e(void 0,!1);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var t=n.updateDownstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},t),this.listenUpstream(function(e){try{var t=n.updateUpstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},t),n},t.awaitLatest=function(e){throw new Error("not implemented")},t.awaitOrdered=function(e){throw new Error("not implemented")},t.unique=function(t){var n=this,i=new e(this.value,!1),a=this.value,r=this.value;return this.listenDownstream(function(e){r!==e&&(r=e,i.updateDownstream(e))},t),i.listenUpstream(function(e){a!==e&&(a=e,n.updateUpstream(e))},t),i},t.oneWayFlow=function(t,n){var i=this;void 0===t&&(t=w.DOWNSTREAM);var a=new e(this.value,!1);return t===w.DOWNSTREAM?(this.listenDownstream(function(e){return a.updateDownstream(e)},n),a.updateUpstream=function(){}):(a.listenUpstream(function(e){return i.updateUpstream(e)}),a.updateDownstream=function(){}),a},t.reduce=function(e,t,n){var i=new g(t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},t.cancelAll=function(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()},e}();function D(e,t){var n=[],i=function(i){if(e[i])if(e[i]instanceof g||e[i]instanceof A){var a=e[i],r=new g(a.value?i:"");a.listen(function(e){r.update(e?i:"")},t),n.push(r)}else n.push(i)};for(var a in e)i(a);return n}function O(){var e={attachCalls:[],sessionToken:new h(function(){for(var t,n=l(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var x=Symbol("AurumElementModel"),C=new WeakMap,T=function(){function e(e,t){var n=this;this.children=[],this.api=t,this.api.onAttach(function(){if(void 0===n.hostNode)throw new Error("illegal state: Attach fired but not actually attached");n.render(e)})}var t=e.prototype;return t.dispose=function(){this.clearContent()},t.attachToDom=function(t,n){if(this.hostNode)throw new Error("Aurum Element is already attached");var i=e.id++;this.hostNode=t,this.contentStartMarker=document.createComment("START Aurum Node "+i),this.contentEndMarker=document.createComment("END Aurum Node "+i),n>=t.childNodes.length?(t.appendChild(this.contentStartMarker),t.appendChild(this.contentEndMarker)):(t.insertBefore(this.contentStartMarker,t.childNodes[n]),t.insertBefore(this.contentEndMarker,t.childNodes[n+1]))},t.getWorkIndex=function(){if(void 0!==this.lastStartIndex&&this.hostNode.childNodes[this.lastStartIndex]===this.contentStartMarker)return this.lastStartIndex+1;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentStartMarker)return this.lastStartIndex=e,e+1},t.getLastIndex=function(){if(void 0!==this.lastEndIndex&&this.hostNode.childNodes[this.lastEndIndex]===this.contentEndMarker)return this.lastEndIndex;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentEndMarker)return this.lastEndIndex=e,e},t.clearContent=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");for(var e=this.getWorkIndex();this.hostNode.childNodes[e]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[e])},t.updateDom=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");var t,n=this.getWorkIndex(),i=0;for(t=0;t<this.children.length;t++){var a=this.children[t];if(a instanceof e)i+=a.getLastIndex()-t-i-n;else if(this.hostNode.childNodes[t+n+i]!==this.contentEndMarker&&this.hostNode.childNodes[t+n+i]!==this.children[t]){if(!(a instanceof HTMLElement||a instanceof Text))throw new Error("not implemented");this.hostNode.removeChild(this.hostNode.childNodes[t+n+i]),this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(a,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(a)}else{if(!(a instanceof HTMLElement||a instanceof Text))throw new Error("not implemented");this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(a,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(a)}}for(;this.hostNode.childNodes[t+n+i]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[t+n+i])},e}();function N(e,t,n){if(void 0===n&&(n=!1),null!=e){if(R.has(e)){var i,a=R.get(e);a.sessionToken&&((i=t.attachCalls).push.apply(i,a.attachCalls),t.sessionToken.chain(a.sessionToken),a.attachCalls=void 0,a.sessionToken=void 0),R.delete(e)}if(Array.isArray(e))return Array.prototype.concat.apply([],e.map(function(e){return N(e,t,n)}));if(!n){if(e instanceof Promise){var r=new g;return e.then(function(e){r.update(e)}),new U(r,M(t))}if(e instanceof g||e instanceof A)return new U(e,M(t));if(e instanceof y)return new L(e,M(t));var o=typeof e;if("string"===o||"number"===o||"bigint"===o||"boolean"===o)return document.createTextNode(e.toString())}return e[x]?N(e.factory(e.props||{},e.children,M(t)),t,n):e}}T.id=1;var R=new WeakMap;function M(e){var t=void 0,n={renderSession:e,onAttach:function(t){e.attachCalls.push(t)},onDetach:function(n){t||(t=new h,e.tokens.push(t)),t.addCancelable(n)},onError:function(e){throw new Error("not implemented")},get cancellationToken(){return t||(t=new h,e.tokens.push(t)),t},prerender:function(e){var t=O(),n=N(e,t,!0);if(Array.isArray(n))for(var i,a=l(n);!(i=a()).done;){var r=i.value;"object"==typeof r&&R.set(r,t)}else R.set(n,t);return n},get style(){return function(e){for(var t,i=[].slice.call(arguments,1),a=new g,r=l(i);!(t=r()).done;){var o=t.value;(o instanceof g||o instanceof A)&&o.listen(function(){return a.update(I(e,i))},n.cancellationToken)}return a.update(I(e,i)),a}}};return n}function I(e,t){for(var n="",i=0;i<e.length;i++)n+=e[i],t[i]&&(n+="string"==typeof t[i]?t[i]:t[i].value);return n}var L=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).renderSessions=new WeakMap,i.dataSource=t,i}n(t,e);var i=t.prototype;return i.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},i.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},i.spliceChildren=function(e,t,n){for(var i,a=l(n?this.children.splice(e,t,n):this.children.splice(e,t));!(i=a()).done;)this.renderSessions.get(i.value).sessionToken.cancel()},i.handleNewContent=function(e){switch(e.operationDetailed){case"merge":for(var t=e.previousState.slice(),n=0;n<e.newState.length;n++)if(this.children.length<=n&&this.children.push(this.renderItem(e.newState[n])),t[n]!==e.newState[n]){var i=t.indexOf(e.newState[n]);if(-1!==i){var a=this.children[n];this.children[n]=this.children[i],this.children[i]=a;var r=t[n];t[n]=t[i],t[i]=r}else this.spliceChildren(n,0,this.renderItem(e.newState[n])),t.splice(n,0,e.newState[n])}this.children.length>e.newState.length&&(this.children.length=e.newState.length);break;case"remove":case"removeLeft":case"removeRight":this.spliceChildren(e.index,e.count);break;case"append":for(var o,s=l(e.items);!(o=s()).done;){var u=this.renderItem(o.value);Array.isArray(u)?this.children=this.children.concat(u):this.children.push(u)}break;case"replace":var c=this.renderItem(e.items[0]);if(Array.isArray(c))throw new Error("illegal state");this.children[e.index]=c;break;case"swap":var h=this.children[e.index2];this.children[e.index2]=this.children[e.index],this.children[e.index]=h;break;case"prepend":for(var d,f=l(e.items);!(d=f()).done;){var p=this.renderItem(d.value);if(Array.isArray(p))throw new Error("illegal state");this.children.unshift(p)}break;case"insert":for(var v,m=e.index,w=l(e.items);!(v=w()).done;){var g=this.renderItem(v.value);if(Array.isArray(g))throw new Error("illegal state");this.children.splice(m,0,g),m+=1}break;case"remove":for(var b,y=l(e.items);!(b=y()).done;){var E=this.renderItem(b.value);if(Array.isArray(E))throw new Error("illegal state");this.children.unshift(E)}break;case"clear":this.children.length=0,this.renderSessions=new WeakMap;break;default:throw new Error("not implemented")}this.updateDom()},i.renderItem=function(e){for(var t,n=O(),i=N(e,n),a=l(n.attachCalls);!(t=a()).done;)(0,t.value)();return this.renderSessions.set(i,n),i},t}(T),U=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).api.cancellationToken.addCancelable(function(){var e;return null===(e=i.renderSession)||void 0===e?void 0:e.sessionToken.cancel()}),i.dataSource=t,i}n(t,e);var i=t.prototype;return i.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},i.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},i.handleNewContent=function(e){if(this.lastValue!==e){var t=!1;if(1===this.children.length&&this.children[0]instanceof Text){var n=typeof e;"string"!==n&&"bigint"!==n&&"number"!==n||(this.children[0].nodeValue=e,t=!0)}t||this.fullRebuild(e),this.lastValue=e}},i.fullRebuild=function(e){this.clearContent(),this.endSession(),this.renderSession=O();var t=N(e,this.renderSession);if(void 0!==t){Array.isArray(t)||(t=[t]);for(var n,i=l(t);!(n=i()).done;){var a=n.value;a instanceof T&&a.attachToDom(this.hostNode,this.getLastIndex())}for(var r,o=l(this.renderSession.attachCalls);!(r=o()).done;)(0,r.value)();Array.isArray(t)&&(this.children=t)}else this.children=[]},i.endSession=function(){this.renderSession&&(this.renderSession.sessionToken.cancel(),this.renderSession=void 0)},t}(T),P={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},F=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function K(e,t,n,i){return function(a,r,o){var s=document.createElement(e);a&&function(e,t,n,i,a){j(e,P,t),a&&j(e,a,t);var r=Object.keys(t).filter(function(e){return e.includes("-")});V(e,F,t,r),i&&V(e,i,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof g||t instanceof A)t.value&&(Array.isArray(t.value)?(e.className=t.value.join(" "),t.unique(n).listen(function(){e.className=t.value.join(" ")})):(e.className=t.value,t.unique(n).listen(function(){e.className=t.value}))),t.unique(n).listen(function(t){return e.className=t});else{var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i;for(var a,r=l(t);!(a=r()).done;){var o=a.value;o instanceof g&&o.unique(n).listen(function(n){var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i})}}}(e,t.class,n)}(s,a,o.cancellationToken,t,n);var u=N(r,o.renderSession);return function e(t,n){if(null!=n)if(Array.isArray(n))for(var i,a=l(n);!(i=a()).done;)e(t,i.value);else if(n instanceof T)n.attachToDom(t,t.childNodes.length);else{if(!(n instanceof HTMLElement||n instanceof Text))throw new Error("Unexpected child type passed to DOM Node: "+n);t.appendChild(n)}}(s,u),a.onAttach&&o.onAttach(function(){return a.onAttach(s)}),a.onDetach&&o.onDetach(function(){s.isConnected&&s.parentElement.removeChild(s),a.onDetach(s)}),null==i||i(s,a,o.cancellationToken),s}}function j(e,t,n){var i=function(i){n[t[i]]&&(n[t[i]]instanceof g?e.addEventListener(i,function(e){return n[t[i]].update(e)}):n[t[i]]instanceof A?e.addEventListener(i,function(e){return n[t[i]].updateDownstream(e)}):"function"==typeof n[t[i]]&&e.addEventListener(i,function(e){return n[t[i]](e)}))};for(var a in t)i(a)}function V(e,t,n,i){for(var a,r=l(t);!(a=r()).done;){var o=a.value;n[o]&&q(e,n[o],o)}if(i)for(var s,u=l(i);!(s=u()).done;){var c=s.value;n[c]&&q(e,n[c],c)}}function q(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof g||t instanceof A))throw new Error("Attributes only support types boolean, string, number and data sources");"string"==typeof t.value?e.setAttribute(n,t.value):"boolean"==typeof t.value&&t.value&&e.setAttribute(n,""),t.unique().listen(function(t){"string"==typeof t?e.setAttribute(n,t):"boolean"==typeof t&&(t?e.setAttribute(n,""):e.removeAttribute(n))})}}var W=K("input",["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof g?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof A?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.checked&&(t.checked instanceof g?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.update(i.checked)})):t.checked instanceof A?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.updateUpstream(i.checked)})):i.checked=t.checked)}),_=K("select",void 0,{change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof g?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.update(i.value)})):t.value instanceof A?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.selectedIndex&&(t.selectedIndex instanceof g?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.update(i.selectedIndex)})):t.selectedIndex instanceof A?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.updateUpstream(i.selectedIndex)})):i.selectedIndex=t.selectedIndex)}),B=K("code"),Y=K("div"),H=K("a",["href","target"]),z=K("abbr"),$=K("h1"),G=K("h2"),J=K("h3"),Q=K("h4"),X=K("h5"),Z=K("h6"),ee=K("area",["alt","coors"]),te=K("article"),ne=K("aside"),ie=K("span"),ae=K("noscript"),re=K("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),oe=K("ul"),se=K("ol"),ue=K("li"),le=K("tr"),ce=K("b"),he=K("title"),de=K("summary"),fe=K("thead"),pe=K("template"),ve=K("q"),me=K("pre"),we=K("p"),ge=K("hr"),be=K("audio",["controls","autoplay","loop","muted","preload","src"]),ye=K("br"),Ee=K("button",["disabled"]),ke=K("canvas",["width","height"]),Se=K("data",["value"]),Ae=K("details"),De=K("em"),Oe=K("footer"),xe=K("form"),Ce=K("head"),Te=K("header"),Ne=K("heading"),Re=K("i"),Me=K("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),Ie=K("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),Le=K("label",["for"]),Ue=K("link",["href","rel","media","as","disabled","type"]),Pe=K("nav"),Fe=K("sub"),Ke=K("sup"),je=K("table"),Ve=K("tbody"),qe=K("tfoot"),We=K("td"),_e=K("th"),Be=K("time",["datetime"]),Ye=K("style",["media"]),He=K("source",["src","srcSet","media","sizes","type"]),ze=K("script",["src","async","defer","integrity","noModule","type"]),$e=K("svg",["width","height"]),Ge=K("progress",["max","value"]),Je=K("option",["value"]),Qe=K("slot",["name"]),Xe={button:Ee,code:B,hr:ge,div:Y,input:W,li:ue,span:ie,style:Ye,ul:oe,p:we,img:Ie,link:Ue,canvas:ke,a:H,article:te,br:ye,form:xe,label:Le,ol:se,pre:me,progress:Ge,table:je,td:We,tr:le,th:_e,textarea:K("textArea",["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof g?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof A?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value)}),h1:$,h2:G,h3:J,h4:Q,h5:X,h6:Z,head:Ce,header:Te,footer:Oe,nav:Pe,b:ce,i:Re,script:ze,abbr:z,area:ee,aside:ne,audio:be,em:De,heading:Ne,iframe:Me,noscript:ae,option:Je,q:ve,select:_,source:He,title:he,video:re,tbody:Ve,tfoot:qe,thead:fe,summary:de,details:Ae,sub:Fe,sup:Ke,svg:$e,data:Se,time:Be,template:pe,slot:Qe},Ze=function(){function e(){}return e.attach=function(e,t){var n=O(),i=N(e,n);if(i instanceof T)i.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(function(){return i.dispose()});else if(Array.isArray(i)){var a=new L(new y(i),M(n));n.sessionToken.addCancelable(function(){return a.dispose()}),a.attachToDom(t,t.childNodes.length)}else t.appendChild(i),n.sessionToken.addCancelable(function(){t.removeChild(i)});for(var r=n.attachCalls.length-1;r>=0;r--)n.attachCalls[r]();return n.sessionToken},e.factory=function(e,t){var n,i;if("string"==typeof e){i=e;var a=e;if(void 0===(e=Xe[e]))throw new Error("Node "+a+" does not exist or is not supported")}return(n={})[x]=!0,n.name=i,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();function et(e,i){return customElements.define(e.name,function(a){function r(){var t;t=a.call(this)||this,void 0===e.observedAttributes&&(e.observedAttributes=[]),t.props={};for(var n,i=l(e.observedAttributes);!(n=i()).done;)t.props[n.value]=new g;return t}n(r,a);var o=r.prototype;return o.attributeChangedCallback=function(e,t,n){t!==n&&this.props[e].update(n)},o.connectedCallback=function(){var t,n=document.createDocumentFragment();this.session=O(),this.api=M(this.session);for(var a,r=i(this.props,this.api),o=l(this.session.attachCalls);!(a=o()).done;)(0,a.value)();Ze.attach(r,n),this.attachShadow({mode:null!==(t=e.shadowRootMode)&&void 0!==t?t:"open",delegatesFocus:e.shadowRootDelegatesFocus}).appendChild(n)},o.disconnectedCallback=function(){this.session.sessionToken.cancel()},t(r,null,[{key:"observedAttributes",get:function(){return e.observedAttributes}}]),r}(s(HTMLElement))),K(e.name,e.observedAttributes,void 0,function(e,t){for(var n in t)n in e.props||(e.props[n]=t[n])})}function tt(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[x]||!(e.factory===it||e.factory===at)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===at}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var i=new g(nt());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){i.update(nt())}),i.unique(n.cancellationToken).withInitial(i.value).map(function(e){return function(e,t){var n,i;if(null==e)return null===(n=t.find(function(e){return e.factory===at}))||void 0===n?void 0:n.children;if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children;var a=e.split("/");a.pop();for(var r=function(){var e=a.join("/");if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return{v:t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children};a.pop()};a.length;){var o=r();if("object"==typeof o)return o.v}return null===(i=t.find(function(e){return e.factory===at}))||void 0===i?void 0:i.children}(e,t)})}function nt(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function it(e,t){}function at(e,t){}function rt(e,t,n){var i=new g(null==e?void 0:e.fallback),a=new h;return n.onDetach(function(){a.cancel()}),Promise.all(n.prerender(t,a)).then(function(e){a.isCanceled||i.update(e)},function(e){return a.cancel(),Promise.reject(e)}),i}function ot(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[x]||!(e.factory===st||e.factory===ut)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===ut}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");var i=new h;return n.onDetach(function(){i.cancel()}),e.state.unique(i).withInitial(e.state.value).map(function(e){return function(e,t){var n,i,a;return null!==(i=null===(n=t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.when)===e}))||void 0===n?void 0:n.children)&&void 0!==i?i:null===(a=t.find(function(e){return e.factory===ut}))||void 0===a?void 0:a.children}(e,t)})}function st(e,t){}function ut(e,t){}var lt=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n,i=new g(null===(n=this.data)||void 0===n?void 0:n[e]);return this.listenOnKey(e,function(e){i.update(e.newValue)},t),i},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data[e],oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return Object.keys(this.data)},t.values=function(){return Object.values(this.data)},t.get=function(e){return this.data[e]},t.delete=function(e){var t=this.data[e];delete this.data[e],this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data[e]!==t){var n=this.data[e];this.data[e]=t,this.updateEvent.fire({oldValue:n,key:e,newValue:this.data[e]}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data[e]})}},t.assign=function(t){if(t instanceof e)for(var n,i=l(t.keys());!(n=i()).done;){var a=n.value;this.set(a,t.data[a])}else for(var r=0,o=Object.keys(t);r<o.length;r++){var s=o[r];this.set(s,t[s])}},t.toObject=function(){return Object.assign({},this.data)},t.toDataSource=function(){var e=this,t=new g(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),ct=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new g(this.data.get(e));return this.listenOnKey(e,function(e){n.update(e.newValue)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data.get(e),oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.values=function(){return this.data.values()},t.get=function(e){return this.data.get(e)},t.has=function(e){return this.data.has(e)},t.delete=function(e){var t=this.data.get(e);this.data.delete(e),this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data.get(e)!==t){var n=this.data.get(e);this.data.set(e,t),this.updateEvent.fire({oldValue:n,key:e,newValue:this.data.get(e)}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data.get(e)})}},t.assign=function(e){for(var t,n=l(e.keys());!(t=n()).done;){var i=t.value;this.set(i,e.get(i))}},t.toMap=function(){return new Map(this.data.entries())},e}(),ht=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new g(this.data.has(e));return this.listenOnKey(e,function(e){n.update(e)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t(this.has(e)),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.has=function(e){return this.data.has(e)},t.delete=function(e){this.data.delete(e),this.updateEvent.fire({key:e,exists:!1}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!1)},t.add=function(e){this.data.has(e)||(this.data.add(e),this.updateEvent.fire({key:e,exists:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!0))},t.assign=function(e){for(var t,n=l(e.keys());!(t=n()).done;)this.add(t.value)},t.toSet=function(){return new Set(this.data.keys())},e}(),dt=function(){function e(e,t){this.input=null!=e?e:new g,this.output=null!=t?t:this.input}var n=e.prototype;return n.update=function(e){this.input.update(e)},n.listen=function(e,t){return this.output.listen(e,t)},n.listenAndRepeat=function(e,t){return this.output.listenAndRepeat(e,t)},n.listenOnce=function(e,t){return this.output.listenOnce(e,t)},n.filter=function(t,n){return new e(this.input,this.output.filter(t,n))},n.unique=function(t){return new e(this.input,this.output.unique(t))},n.map=function(t,n){return new e(this.input,this.output.map(t,n))},n.reduce=function(t,n,i){return new e(this.input,this.output.reduce(t,n,i))},n.awaitNextUpdate=function(e){return this.output.awaitNextUpdate(e)},n.await=function(t){return new e(this.input,this.output.await(t))},n.awaitLatest=function(t){return new e(this.input,this.output.awaitLatest(t))},n.awaitOrdered=function(t){return new e(this.input,this.output.awaitOrdered(t))},n.cancelAll=function(){this.input.cancelAll(),this.output.cancelAll()},t(e,[{key:"value",get:function(){return this.output.value}}]),e}();export{L as ArrayAurumElement,y as ArrayDataSource,Ze as Aurum,T as AurumElement,tt as AurumRouter,h as CancellationToken,w as DataFlow,g as DataSource,at as DefaultRoute,ut as DefaultSwitchCase,A as DuplexDataSource,d as EventEmitter,S as FilteredArrayView,ct as MapDataSource,E as MappedArrayView,lt as ObjectDataSource,it as Route,ht as SetDataSource,U as SingularAurumElement,k as SortedArrayView,dt as Stream,rt as Suspense,ot as Switch,st as SwitchCase,b as TransientDataSource,et as Webcomponent,D as aurumClassName,x as aurumElementModelIdentitiy,M as createAPI,O as createRenderSession,C as nodeData,R as pendingSessions,N as render}; | ||
function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function t(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function o(e,t,n){return(o=r()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&a(r,n.prototype),r}).apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return o(e,arguments,i(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)})(e)}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function l(e){var t=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return u(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,void 0):void 0}}(e)))return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}var c,h=function(){function e(){var e=[].slice.call(arguments);this.cancelables=null!=e?e:[],this._isCancelled=!1}var n=e.prototype;return n.hasCancellables=function(){return this.cancelables.length>0},n.addCancelable=function(e){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.push(e),200===this.cancelables.length&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this},n.removeCancelable=function(e){this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled");var t=this.cancelables.indexOf(e);return-1!==t&&this.cancelables.splice(t,1),this},n.setTimeout=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=this;void 0===t&&(t=0);var i=setTimeout(function(){n.removeCancelable(a),e()},t),a=function(){return clearTimeout(i)};this.addCancelable(a)}),n.setInterval=function(e){function t(t,n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=setInterval(e,t);this.addCancelable(function(){return clearInterval(n)})}),n.requestAnimationFrame=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){var t=this,n=requestAnimationFrame(function(){t.removeCancelable(i),e()}),i=function(){return cancelAnimationFrame(n)};this.addCancelable(i)}),n.animationLoop=function(e){var t=requestAnimationFrame(function n(i){e(i),t=requestAnimationFrame(n)});this.addCancelable(function(){return cancelAnimationFrame(t)})},n.throwIfCancelled=function(e){if(this.isCanceled)throw new Error(e||"cancellation token is cancelled")},n.chain=function(e,t){return void 0===t&&(t=!1),t&&e.chain(this,!1),this.addCancelable(function(){return e.cancel()}),this},n.registerDomEvent=function(e,t,n){return e.addEventListener(t,n),this.addCancelable(function(){return e.removeEventListener(t,n)}),this},n.cancel=function(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(function(e){return e()}),this.cancelables=void 0)},t(e,[{key:"isCanceled",get:function(){return this._isCancelled}}]),e}(),d=function(){function e(){this.subscribeChannel=[],this.subscribeOnceChannel=[],this.onAfterFire=[]}var n=e.prototype;return n.subscribe=function(e,t){return this.createSubscription(e,this.subscribeChannel,t).facade},n.subscribeOnce=function(e,t){return this.createSubscription(e,this.subscribeOnceChannel,t).facade},n.hasSubscriptions=function(){return this.subscriptions>0},n.cancelAll=function(){var e,t=this;this.isFiring?this.onAfterFire.push(function(){var e;t.subscribeChannel.length=0,t.subscribeOnceChannel.length=0,null===(e=t.onEmpty)||void 0===e||e.call(t)}):(this.subscribeChannel.length=0,this.subscribeOnceChannel.length=0,null===(e=this.onEmpty)||void 0===e||e.call(this))},n.afterFire=function(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(function(e){return e()}),this.onAfterFire.length=0)},n.fire=function(e){this.isFiring=!0;for(var t=this.subscribeChannel.length,n=0;n<t;n++)try{this.subscribeChannel[n].callback(e)}catch(e){console.error(e)}if(this.subscribeOnceChannel.length>0){t=this.subscribeOnceChannel.length;for(var i=0;i<t;i++)try{this.subscribeOnceChannel[i].callback(e)}catch(e){console.error(e)}this.subscribeOnceChannel.length=0}this.isFiring=!1,this.afterFire()},n.createSubscription=function(e,t,n){var i=this,a={callback:e},r={cancel:function(){i.cancel(a,t)}};return void 0!==n&&n.addCancelable(function(){return i.cancel(a,t)}),t.push(a),{subscription:a,facade:r}},n.cancel=function(e,t){var n,i=this,a=t.indexOf(e);a>=0&&(this.isFiring?this.onAfterFire.push(function(){return i.cancel(e,t)}):(t.splice(a,1),this.hasSubscriptions()||null===(n=this.onEmpty)||void 0===n||n.call(this)))},t(e,[{key:"subscriptions",get:function(){return this.subscribeChannel.length+this.subscribeOnceChannel.length}}]),e}();function f(e){return{operationType:c.MAP,operation:function(t){return e(t)}}}function p(e){return{operationType:c.FILTER,operation:function(t){return e(t)}}}function v(){var e;return{operationType:c.FILTER,operation:function(t){return t!==e&&(e=t,!0)}}}function m(e,t){var n=t;return{operationType:c.MAP,operation:function(t){return n=e(n,t)}}}function w(e){return{operationType:c.DELAY,operation:function(t){return new Promise(function(n){setTimeout(function(){n(t)},e)})}}}function g(e){var t,n=[];return{operationType:c.MAP_DELAY,operation:function(i){return n.push(i),t||(t=new Promise(function(i){setTimeout(function(){t=void 0,i(n),n=[]},e)})),t}}}function y(e){return{operationType:c.MAP,operation:function(t){return null!=t?t[e]:t}}}function b(e,t,n){if(!e.s){if(n instanceof E){if(!n.s)return void(n.o=b.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(b.bind(null,e,t),b.bind(null,e,2));e.s=t,e.v=n;var i=e.o;i&&i(e)}}!function(e){e[e.FILTER=0]="FILTER",e[e.MAP=1]="MAP",e[e.DELAY=2]="DELAY",e[e.MAP_DELAY=3]="MAP_DELAY"}(c||(c={}));var E=function(){function e(){}return e.prototype.then=function(t,n){var i=new e,a=this.s;if(a){var r=1&a?t:n;if(r){try{b(i,1,r(this.v))}catch(e){b(i,2,e)}return i}return this}return this.o=function(e){try{var a=e.v;1&e.s?b(i,1,t?t(a):a):n?b(i,1,n(a)):b(i,2,a)}catch(e){b(i,2,e)}},i},e}(),k="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function S(e){return e instanceof E&&1&e.s}var A,D=function(){function e(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new d}e.fromMultipleSources=function(t,n){for(var i,a=new e,r=l(t);!(i=r()).done;)i.value.listen(function(e){return a.update(e)},n);return a};var t=e.prototype;return t.repeatLast=function(){return this.update(this.value),this},t.update=function(e){if(this.primed=!0,this.updating)throw new Error("Problem in data source: Unstable value propagation. When updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=e,this.updateEvent.fire(e),this.updating=!1},t.withInitial=function(e){return this.primed||this.update(e),this},t.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},t.filter=function(e,t){t=null!=t?t:new h;var n=new O(t);return this.listen(function(t){e(t,n.value)&&n.update(t)},t),n},t.max=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)>0:e>t},e)},t.min=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)<0:e<t},e)},t.transform=function(t,n,i,a,r,o,s,u,l,d,f,p){var v,m=[t,n,i,a,r,o,s,u,l,d,f].filter(function(e){return!(e&&e instanceof h&&(v=e,1))});p&&(v=p);var w=new e;return this.listen(function(e){try{var n,i=function(t){if(n)return t;w.update(e)},a=function(e,t,n){if("function"==typeof e[k]){var i,a,r,o=e[k]();if(function e(s){try{for(;!((i=o.next()).done||n&&n());)if((s=t(i.value))&&s.then){if(!S(s))return void s.then(e,r||(r=b.bind(null,a=new E,2)));s=s.v}a?b(a,1,s):a=s}catch(e){b(a||(a=new E),2,e)}}(),o.return){var s=function(e){try{i.done||o.return()}catch(e){}return e};if(a&&a.then)return a.then(s,function(e){throw s(e)});s()}return a}if(!("length"in e))throw new TypeError("Object is not iterable");for(var u=[],l=0;l<e.length;l++)u.push(e[l]);return function(e,t,n){var i,a,r=-1;return function o(s){try{for(;++r<e.length&&(!n||!n());)if((s=t(r))&&s.then){if(!S(s))return void s.then(o,a||(a=b.bind(null,i=new E,2)));s=s.v}i?b(i,1,s):i=s}catch(e){b(i||(i=new E),2,e)}}(),i}(u,function(e){return t(u[e])},n)}(m,function(i){return function(e,t){var n,i=-1;e:{for(var a=0;a<t.length;a++){var r=t[a][0];if(r){var o=r();if(o&&o.then)break e;if(o===e){i=a;break}}else i=a}if(-1!==i){do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then){n=!0;break e}var l=t[i][2];i++}while(l&&!l());return u}}var c=new E,h=b.bind(null,c,2);return(n?u.then(d):o.then(function n(o){for(;;){if(o===e){i=a;break}if(++a===t.length){if(-1!==i)break;return void b(c,1,u)}if(r=t[a][0]){if((o=r())&&o.then)return void o.then(n).then(void 0,h)}else i=a}do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then)return void u.then(d).then(void 0,h);var l=t[i][2];i++}while(l&&!l());b(c,1,u)})).then(void 0,h),c;function d(e){for(;;){var n=t[i][2];if(!n||n())break;i++;for(var a=t[i][1];!a;)i++,a=t[i][1];if((e=a())&&e.then)return void e.then(d).then(void 0,h)}b(c,1,e)}}(t.operationType,[[function(){return c.MAP},function(){e=i.operation(e)}],[function(){return c.DELAY}],[function(){return c.MAP_DELAY},function(){return Promise.resolve(i.operation(e)).then(function(t){e=t})}],[function(){return c.FILTER},function(){i.operation(e)||(n=1)}]])},function(){return n});return Promise.resolve(a&&a.then?a.then(i):i(a))}catch(e){return Promise.reject(e)}},v),w},t.pipe=function(e,t){return this.listen(function(t){return e.update(t)},t),this},t.map=function(e,t){var n;return t=null!=t?t:new h,n=this.primed?new O(t,e(this.value)):new O(t),this.listen(function(t){n.update(e(t))},t),n},t.tap=function(e,t){return this.listen(function(t){e(t)},t),this},t.loadBalance=function(e,t){var n=0;this.listen(function(t){e[n++].update(t),n>=e.length&&(n=0)},t)},t.await=function(e){e=null!=e?e:new h;var t=new O(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var n=t.update;return Promise.resolve(e).then(function(e){n.call(t,e)})}catch(e){return Promise.reject(e)}},e),t},t.awaitOrdered=function(e){e=null!=e?e:new h;var t=[],n=new O(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=!1,a=function(){if(!(e instanceof Promise)){var a=n.update;return Promise.resolve(e).then(function(e){a.call(n,e)})}t.push(e),function(){try{var e=function(){i=!1};i||(i=!0);var a=function(e,t,n){for(var i;;){var a=e();if(S(a)&&(a=a.v),!a)return r;if(a.then){i=0;break}var r=n();if(r&&r.then){if(!S(r)){i=1;break}r=r.s}}var o=new E,s=b.bind(null,o,2);return(0===i?a.then(l):1===i?r.then(u):(void 0).then(function(){(a=e())?a.then?a.then(l).then(void 0,s):l(a):b(o,1,r)})).then(void 0,s),o;function u(t){r=t;do{if(!(a=e())||S(a)&&!a.v)return void b(o,1,r);if(a.then)return void a.then(l).then(void 0,s);S(r=n())&&(r=r.v)}while(!r||!r.then);r.then(u).then(void 0,s)}function l(e){e?(r=n())&&r.then?r.then(u).then(void 0,s):u(r):b(o,1,r)}}(function(){return!!t.length},0,function(){var e=n.update;return Promise.resolve(t[0]).then(function(i){e.call(n,i),t.shift()})});Promise.resolve(a&&a.then?a.then(e):e())}catch(e){return Promise.reject(e)}}()}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e),n},t.awaitLatest=function(e){var t;e=null!=e?e:new h;var n=new O(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=t=Date.now();return Promise.resolve(e).then(function(e){t===i&&n.update(e)})}catch(e){return Promise.reject(e)}},e),n},t.unique=function(e){e=null!=e?e:new h;var t=new O(e,this.value);return this.listen(function(e){e!==t.value&&t.update(e)},e),t},t.diff=function(e){e=null!=e?e:new h;var t=new O(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},t.reduce=function(e,t,n){n=null!=n?n:new h;var i=new O(n,t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},t.aggregate=function(e,t,n){var i=this;n=null!=n?n:new h;var a=new O(n,t(this.value,e.value));return this.listen(function(){return a.update(t(i.value,e.value))},n),e.listen(function(){return a.update(t(i.value,e.value))},n),a},t.aggregateThree=function(e,t,n,i){var a=this;i=null!=i?i:new h;var r=new O(i,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(a.value,e.value,t.value))},i),e.listen(function(){return r.update(n(a.value,e.value,t.value))},i),t.listen(function(){return r.update(n(a.value,e.value,t.value))},i),r},t.aggregateFour=function(e,t,n,i,a){var r=this;a=null!=a?a:new h;var o=new O(a,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),e.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),t.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),n.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),o},t.combine=function(e,t){t=null!=t?t:new h;var n=new O(t);this.pipe(n,t);for(var i,a=l(e);!(i=a()).done;)i.value.pipe(n,t);return n},t.delay=function(e,t){t=null!=t?t:new h;var n=new O(t,this.value);return this.listen(function(t){setTimeout(function(){n.update(t)},e)},t),n},t.skip=function(e,t){t=null!=t?t:new h;var n=new O(t,this.value);return this.listen(function(t){0===e?n.update(t):e--},t),n},t.cutoff=function(e,t){t=null!=t?t:new h;var n=new O(t,this.value);return this.listen(function(t){e-- >0&&n.update(t)},t),n},t.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},t.debounce=function(e,t){t=null!=t?t:new h;var n,i=new O(t,this.value);return this.listen(function(t){clearTimeout(n),n=setTimeout(function(){i.update(t)},e)},t),i},t.throttle=function(e,t){t=null!=t?t:new h;var n=new O(t,this.value),i=!1;return this.listen(function(t){i||(n.update(t),i=!0,setTimeout(function(){i=!1},e))},t),n},t.buffer=function(e,t){t=null!=t?t:new h;var n,i=new O(t),a=[];return this.listen(function(t){a.push(t),n||(n=setTimeout(function(){n=void 0,i.update(a),a=[]},e))},t),i},t.accumulate=function(e){var t=new x;return this.listen(function(e){t.push(e)},e),t},t.pick=function(e,t){var n;t=null!=t?t:new h;var i=new O(t,null===(n=this.value)||void 0===n?void 0:n[e]);return this.listen(function(t){i.update(null!=t?t[e]:t)},t),i},t.cancelAll=function(){this.updateEvent.cancelAll()},e}(),O=function(e){function t(t,n){var i;return(i=e.call(this,n)||this).disposeToken=t,i.updateEvent.onEmpty=function(){t.cancel(),Object.defineProperty(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i),"value",{get:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')},set:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')}})},i}n(t,e);var i=t.prototype;return i.persist=function(){return this.updateEvent.onEmpty=void 0,this},i.listen=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},i.listenAndRepeat=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listenAndRepeat.call(this,t,n)},i.listenOnce=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},t}(D),x=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new D(this.data.length),this.updateEvent=new d}var n=e.prototype;return n.listenAndRepeat=function(e,t){return e({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(e,t)},n.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},n.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},n.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},n.getData=function(){return this.data},n.get=function(e){return this.data[e]},n.set=function(e,t){var n=this.data[e];n!==t&&(this.data[e]=t,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:e,items:[t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},n.swap=function(e,t){if(e!==t){var n=this.data[e],i=this.data[t];this.data[t]=n,this.data[e]=i,this.update({operation:"swap",operationDetailed:"swap",index:e,index2:t,items:[n,i],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.swapItems=function(e,t){if(e!==t){var n=this.data.indexOf(e),i=this.data.indexOf(t);-1!==n&&-1!==i&&(this.data[i]=e,this.data[n]=t),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:i,items:[e,t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.appendArray=function(e){this.data=this.data.concat(e),this.update({operation:"add",operationDetailed:"append",count:e.length,index:this.data.length-e.length,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.insertAt=function(e){var t,n=[].slice.call(arguments,1);0!==n.length&&((t=this.data).splice.apply(t,[e,0].concat(n)),this.update({operation:"add",operationDetailed:"insert",count:n.length,index:e,items:n,newState:this.data}),this.lengthSource.update(this.data.length))},n.push=function(){this.appendArray([].slice.call(arguments))},n.unshift=function(){var e,t=[].slice.call(arguments);(e=this.data).unshift.apply(e,t),this.update({operation:"add",operationDetailed:"prepend",count:t.length,items:t,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.pop=function(){var e=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},n.merge=function(e){var t=this.data;this.data=e.slice(),this.update({operation:"merge",operationDetailed:"merge",previousState:t,index:0,items:this.data,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.removeRight=function(e){var t=this.data.length,n=this.data.splice(t-e,e);this.update({operation:"remove",operationDetailed:"removeRight",count:e,index:t-e,items:n,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.removeLeft=function(e){var t=this.data.splice(0,e);this.update({operation:"remove",operationDetailed:"removeLeft",count:e,index:0,items:t,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.remove=function(e){var t=this.data.indexOf(e);-1!==t&&(this.data.splice(t,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:t,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},n.clear=function(){if(0!==this.data.length){var e=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:e.length,index:0,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.shift=function(){var e=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[e],count:1,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},n.toArray=function(){return this.data.slice()},n.sort=function(e,t,n){void 0===t&&(t=[]);var i=new C(this,e,n),a=new h;return n&&n.addCancelable(function(){return a.cancel()}),t.forEach(function(e){e.listen(function(){return i.refresh()})},a),i},n.map=function(e,t,n){void 0===t&&(t=[]);var i=new T(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()})},n),i},n.filter=function(e,t,n){void 0===t&&(t=[]);var i=new N(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()},n)}),i},n.forEach=function(e){return this.data.forEach(e)},n.update=function(e){this.updateEvent.fire(e)},t(e,[{key:"length",get:function(){return this.lengthSource}}]),e}(),T=function(e){function t(t,n,i){var a;void 0===i&&(i=new h);var r=t.getData().map(n);return(a=e.call(this,r)||this).parent=t,a.mapper=n,t.listen(function(e){var t,n;switch(e.operationDetailed){case"removeLeft":a.removeLeft(e.count);break;case"removeRight":a.removeRight(e.count);break;case"remove":a.remove(a.data[e.index]);break;case"clear":a.clear();break;case"prepend":(t=a).unshift.apply(t,e.items.map(a.mapper));break;case"append":a.appendArray(e.items.map(a.mapper));break;case"insert":(n=a).insertAt.apply(n,[e.index].concat(e.items.map(a.mapper)));break;case"swap":a.swap(e.index,e.index2);break;case"replace":a.set(e.index,a.mapper(e.items[0]));break;case"merge":for(var i=a.data.slice(),r=e.previousState.slice(),o=0;o<e.newState.length;o++)if(a.data.length<=o&&a.data.push(a.mapper(e.newState[o])),r[o]!==e.newState[o]){var s=r.indexOf(e.newState[o]);if(-1!==s){var u=a.data[o];a.data[o]=a.data[s],a.data[s]=u;var l=r[o];r[o]=r[s],r[s]=l}else a.data.splice(o,0,a.mapper(e.newState[o])),r.splice(o,0,e.newState[o])}a.data.length>e.newState.length&&(a.data.length=e.newState.length),a.update({operation:"merge",operationDetailed:"merge",previousState:i,index:0,items:a.data,newState:a.data})}},i),a}return n(t,e),t.prototype.refresh=function(){this.merge(this.parent.data.map(this.mapper))},t}(x),C=function(e){function t(t,n,i){var a;void 0===i&&(i=new h);var r=t.getData().slice().sort(n);return(a=e.call(this,r)||this).parent=t,a.comparator=n,t.listen(function(e){var t;switch(e.operationDetailed){case"removeLeft":case"removeRight":for(var n,i=l(e.items);!(n=i()).done;)a.remove(n.value);break;case"remove":a.remove(e.items[0]);break;case"clear":a.clear();break;case"prepend":(t=a).unshift.apply(t,e.items),a.data.sort(a.comparator);break;case"append":case"insert":a.appendSorted(e.items);break;case"merge":a.merge(e.items.slice().sort(a.comparator));break;case"swap":break;case"replace":a.remove(e.target),a.appendSorted(e.items)}},i),a}n(t,e);var i=t.prototype;return i.appendSorted=function(e){this.merge(this.data.concat(e).sort(this.comparator))},i.refresh=function(){this.merge(this.parent.getData().slice().sort(this.comparator))},t}(x),N=function(e){function t(t,n,i){var a;void 0===i&&(i=new h),Array.isArray(t)&&(t=new x(t));var r=t.data.filter(n=null!=n?n:function(){return!0});return(a=e.call(this,r)||this).parent=t,a.viewFilter=n,t.listen(function(e){var t,n,i;switch(e.operationDetailed){case"clear":a.clear();break;case"removeLeft":case"removeRight":case"remove":for(var r,o=l(e.items);!(r=o()).done;)a.remove(r.value);break;case"prepend":i=e.items.filter(a.viewFilter),(t=a).unshift.apply(t,i);break;case"append":i=e.items.filter(a.viewFilter),a.appendArray(i);break;case"insert":i=e.items.filter(a.viewFilter),(n=a).insertAt.apply(n,[e.index].concat(i));break;case"merge":a.merge(e.items.filter(a.viewFilter));break;case"swap":var s=a.data.indexOf(e.items[0]),u=a.data.indexOf(e.items[1]);-1!==s&&-1!==u&&a.swap(s,u);break;case"replace":var c=a.data.indexOf(e.target);-1!==c&&(a.viewFilter(e.items[0])?a.set(c,e.items[0]):a.remove(e.target))}},i),a}n(t,e);var i=t.prototype;return i.updateFilter=function(e){if(this.viewFilter!==e)return this.viewFilter=e,this.refresh(),this.data.length},i.refresh=function(){this.merge(this.parent.data.filter(this.viewFilter))},t}(x);!function(e){e[e.UPSTREAM=0]="UPSTREAM",e[e.DOWNSTREAM=1]="DOWNSTREAM"}(A||(A={}));var M=function(){function e(e,t){void 0===t&&(t=!0),this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new d,this.updateUpstreamEvent=new d,this.propagateWritesToReadStream=t}e.fromTwoDataSource=function(t,n,i,a){void 0===a&&(a=!0);var r=new e(i,a);return r.updateDownstreamEvent=t.updateEvent,r.updateUpstreamEvent=n.updateEvent,r};var t=e.prototype;return t.withInitial=function(e){return this.primed||this.updateDownstream(e),this},e.createOneWay=function(t,n){return void 0===t&&(t=A.DOWNSTREAM),new e(n,!1).oneWayFlow(t)},t.updateDownstream=function(e){if(this.updatingDownstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingDownstream=!0,this.value=e,this.updateDownstreamEvent.fire(e),this.updatingDownstream=!1},t.updateUpstream=function(e){if(this.updatingUpstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingUpstream=!0,this.value=e,this.updateUpstreamEvent.fire(e),this.propagateWritesToReadStream&&this.updateDownstreamEvent.fire(e),this.updatingUpstream=!1},t.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},t.listen=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},t.listenUpstream=function(e,t){return this.updateUpstreamEvent.subscribe(e,t).cancel},t.listenUpstreamOnce=function(e,t){return this.updateUpstreamEvent.subscribeOnce(e,t).cancel},t.listenDownstream=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},t.downStreamToDataSource=function(e){var t=new D(this.value);return this.listenDownstream(function(e){t.update(e)},e),t},t.aggregate=function(e,t,n){var i=this;n=null!=n?n:new h;var a=new O(n,t(this.value,e.value));return this.listen(function(){return a.update(t(i.value,e.value))},n),e.listen(function(){return a.update(t(i.value,e.value))},n),a},t.aggregateThree=function(e,t,n,i){var a=this;i=null!=i?i:new h;var r=new O(i,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(a.value,e.value,t.value))},i),e.listen(function(){return r.update(n(a.value,e.value,t.value))},i),t.listen(function(){return r.update(n(a.value,e.value,t.value))},i),r},t.aggregateFour=function(e,t,n,i,a){var r=this;a=null!=a?a:new h;var o=new O(a,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),e.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),t.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),n.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),o},t.filter=function(t,n,i){var a=this;if("function"==typeof n){var r=new e(void 0,!1);return this.listenDownstream(function(e){t(e,r.value)&&r.updateDownstream(e)},i),r.listenUpstream(function(e){n(e,a.value)&&a.updateUpstream(e)},i),r}var o=new D;return this.listenDownstream(function(e){t(e,o.value)&&o.update(e)},n),o},t.pipe=function(e,t){var n=this;return this.listenDownstream(function(t){return e.updateDownstream(t)},t),e.listenUpstream(function(e){return n.updateUpstream(e)},t),this},t.map=function(t,n,i){var a,r,o=this;return"function"==typeof n?(a=new e(this.primed?t(this.value):void 0,!1),this.listenDownstream(function(e){return a.updateDownstream(t(e))},i),a.listenUpstream(function(e){return o.updateUpstream(n(e))},i),a):(r=this.primed?new D(t(this.value)):new D,this.listenDownstream(function(e){return r.update(t(e))},n),r)},t.listenOnce=function(e,t){return this.updateDownstreamEvent.subscribeOnce(e,t).cancel},t.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},t.debounceUpstream=function(t,n){var i,a=this,r=new e(this.value);return r.listenUpstream(function(e){clearTimeout(i),i=setTimeout(function(){a.updateUpstream(e)},t)},n),this.listenDownstream(function(e){r.updateDownstream(e)},n),r},t.debounceDownstream=function(t,n){var i,a=this,r=new e(this.value);return this.listenDownstream(function(e){clearTimeout(i),i=setTimeout(function(){r.updateDownstream(e)},t)},n),r.listenUpstream(function(e){a.updateUpstream(e)},n),r},t.diff=function(e){e=null!=e?e:new h;var t=new O(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},t.await=function(t){t=null!=t?t:new h;var n=new e(void 0,!1);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var t=n.updateDownstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},t),this.listenUpstream(function(e){try{var t=n.updateUpstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},t),n},t.awaitLatest=function(e){throw new Error("not implemented")},t.awaitOrdered=function(e){throw new Error("not implemented")},t.unique=function(t){var n=this,i=new e(this.value,!1),a=this.value,r=this.value;return this.listenDownstream(function(e){r!==e&&(r=e,i.updateDownstream(e))},t),i.listenUpstream(function(e){a!==e&&(a=e,n.updateUpstream(e))},t),i},t.oneWayFlow=function(t,n){var i=this;void 0===t&&(t=A.DOWNSTREAM);var a=new e(this.value,!1);return t===A.DOWNSTREAM?(this.listenDownstream(function(e){return a.updateDownstream(e)},n),a.updateUpstream=function(){}):(a.listenUpstream(function(e){return i.updateUpstream(e)}),a.updateDownstream=function(){}),a},t.reduce=function(e,t,n){var i=new D(t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},t.cancelAll=function(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()},e}();function R(e,t){var n=[],i=function(i){if(e[i])if(e[i]instanceof D||e[i]instanceof M){var a=e[i],r=new D(a.value?i:"");a.listen(function(e){r.update(e?i:"")},t),n.push(r)}else n.push(i)};for(var a in e)i(a);return n}function I(){var e={attachCalls:[],sessionToken:new h(function(){for(var t,n=l(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var L=Symbol("AurumElementModel"),P=new WeakMap,U=function(){function e(e,t){var n=this;this.children=[],this.api=t,this.api.onAttach(function(){if(void 0===n.hostNode)throw new Error("illegal state: Attach fired but not actually attached");n.render(e)})}var t=e.prototype;return t.dispose=function(){this.clearContent()},t.attachToDom=function(t,n){if(this.hostNode)throw new Error("Aurum Element is already attached");var i=e.id++;this.hostNode=t,this.contentStartMarker=document.createComment("START Aurum Node "+i),this.contentEndMarker=document.createComment("END Aurum Node "+i),n>=t.childNodes.length?(t.appendChild(this.contentStartMarker),t.appendChild(this.contentEndMarker)):(t.insertBefore(this.contentStartMarker,t.childNodes[n]),t.insertBefore(this.contentEndMarker,t.childNodes[n+1]))},t.getWorkIndex=function(){if(void 0!==this.lastStartIndex&&this.hostNode.childNodes[this.lastStartIndex]===this.contentStartMarker)return this.lastStartIndex+1;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentStartMarker)return this.lastStartIndex=e,e+1},t.getLastIndex=function(){if(void 0!==this.lastEndIndex&&this.hostNode.childNodes[this.lastEndIndex]===this.contentEndMarker)return this.lastEndIndex;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentEndMarker)return this.lastEndIndex=e,e},t.clearContent=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");for(var e=this.getWorkIndex();this.hostNode.childNodes[e]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[e])},t.updateDom=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");var t,n=this.getWorkIndex(),i=0;for(t=0;t<this.children.length;t++){var a=this.children[t];if(a instanceof e)i+=a.getLastIndex()-t-i-n;else if(this.hostNode.childNodes[t+n+i]!==this.contentEndMarker&&this.hostNode.childNodes[t+n+i]!==this.children[t]){if(!(a instanceof HTMLElement||a instanceof Text))throw new Error("not implemented");this.hostNode.removeChild(this.hostNode.childNodes[t+n+i]),this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(a,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(a)}else{if(!(a instanceof HTMLElement||a instanceof Text))throw new Error("not implemented");this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(a,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(a)}}for(;this.hostNode.childNodes[t+n+i]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[t+n+i])},e}();function F(e,t,n){if(void 0===n&&(n=!1),null!=e){if(K.has(e)){var i,a=K.get(e);a.sessionToken&&((i=t.attachCalls).push.apply(i,a.attachCalls),t.sessionToken.chain(a.sessionToken),a.attachCalls=void 0,a.sessionToken=void 0),K.delete(e)}if(Array.isArray(e))return Array.prototype.concat.apply([],e.map(function(e){return F(e,t,n)}));if(!n){if(e instanceof Promise){var r=new D;return e.then(function(e){r.update(e)}),new W(r,j(t))}if(e instanceof D||e instanceof M)return new W(e,j(t));if(e instanceof x)return new q(e,j(t));var o=typeof e;if("string"===o||"number"===o||"bigint"===o||"boolean"===o)return document.createTextNode(e.toString())}return e[L]?F(e.factory(e.props||{},e.children,j(t)),t,n):e}}U.id=1;var K=new WeakMap;function j(e){var t=void 0,n={renderSession:e,onAttach:function(t){e.attachCalls.push(t)},onDetach:function(n){t||(t=new h,e.tokens.push(t)),t.addCancelable(n)},onError:function(e){throw new Error("not implemented")},get cancellationToken(){return t||(t=new h,e.tokens.push(t)),t},prerender:function(e){var t=I(),n=F(e,t,!0);if(Array.isArray(n))for(var i,a=l(n);!(i=a()).done;){var r=i.value;"object"==typeof r&&K.set(r,t)}else K.set(n,t);return n},get style(){return function(e){for(var t,i=[].slice.call(arguments,1),a=new D,r=l(i);!(t=r()).done;){var o=t.value;(o instanceof D||o instanceof M)&&o.listen(function(){return a.update(V(e,i))},n.cancellationToken)}return a.update(V(e,i)),a}}};return n}function V(e,t){for(var n="",i=0;i<e.length;i++)n+=e[i],t[i]&&(n+="string"==typeof t[i]?t[i]:t[i].value);return n}var q=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).renderSessions=new WeakMap,i.dataSource=t,i}n(t,e);var i=t.prototype;return i.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},i.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},i.spliceChildren=function(e,t,n){for(var i,a=l(n?this.children.splice(e,t,n):this.children.splice(e,t));!(i=a()).done;)this.renderSessions.get(i.value).sessionToken.cancel()},i.handleNewContent=function(e){switch(e.operationDetailed){case"merge":for(var t=e.previousState.slice(),n=0;n<e.newState.length;n++)if(this.children.length<=n&&this.children.push(this.renderItem(e.newState[n])),t[n]!==e.newState[n]){var i=t.indexOf(e.newState[n]);if(-1!==i){var a=this.children[n];this.children[n]=this.children[i],this.children[i]=a;var r=t[n];t[n]=t[i],t[i]=r}else this.spliceChildren(n,0,this.renderItem(e.newState[n])),t.splice(n,0,e.newState[n])}this.children.length>e.newState.length&&(this.children.length=e.newState.length);break;case"remove":case"removeLeft":case"removeRight":this.spliceChildren(e.index,e.count);break;case"append":for(var o,s=l(e.items);!(o=s()).done;){var u=this.renderItem(o.value);Array.isArray(u)?this.children=this.children.concat(u):this.children.push(u)}break;case"replace":var c=this.renderItem(e.items[0]);if(Array.isArray(c))throw new Error("illegal state");this.children[e.index]=c;break;case"swap":var h=this.children[e.index2];this.children[e.index2]=this.children[e.index],this.children[e.index]=h;break;case"prepend":for(var d,f=l(e.items);!(d=f()).done;){var p=this.renderItem(d.value);if(Array.isArray(p))throw new Error("illegal state");this.children.unshift(p)}break;case"insert":for(var v,m=e.index,w=l(e.items);!(v=w()).done;){var g=this.renderItem(v.value);if(Array.isArray(g))throw new Error("illegal state");this.children.splice(m,0,g),m+=1}break;case"remove":for(var y,b=l(e.items);!(y=b()).done;){var E=this.renderItem(y.value);if(Array.isArray(E))throw new Error("illegal state");this.children.unshift(E)}break;case"clear":this.children.length=0,this.renderSessions=new WeakMap;break;default:throw new Error("not implemented")}this.updateDom()},i.renderItem=function(e){for(var t,n=I(),i=F(e,n),a=l(n.attachCalls);!(t=a()).done;)(0,t.value)();return this.renderSessions.set(i,n),i},t}(U),W=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).api.cancellationToken.addCancelable(function(){var e;return null===(e=i.renderSession)||void 0===e?void 0:e.sessionToken.cancel()}),i.dataSource=t,i}n(t,e);var i=t.prototype;return i.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},i.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},i.handleNewContent=function(e){if(this.lastValue!==e){var t=!1;if(1===this.children.length&&this.children[0]instanceof Text){var n=typeof e;"string"!==n&&"bigint"!==n&&"number"!==n||(this.children[0].nodeValue=e,t=!0)}t||this.fullRebuild(e),this.lastValue=e}},i.fullRebuild=function(e){this.clearContent(),this.endSession(),this.renderSession=I();var t=F(e,this.renderSession);if(void 0!==t){Array.isArray(t)||(t=[t]);for(var n,i=l(t);!(n=i()).done;){var a=n.value;a instanceof U&&a.attachToDom(this.hostNode,this.getLastIndex())}for(var r,o=l(this.renderSession.attachCalls);!(r=o()).done;)(0,r.value)();Array.isArray(t)&&(this.children=t)}else this.children=[]},i.endSession=function(){this.renderSession&&(this.renderSession.sessionToken.cancel(),this.renderSession=void 0)},t}(U),_={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},Y=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function B(e,t,n,i){return function(a,r,o){var s=document.createElement(e);a&&function(e,t,n,i,a){H(e,_,t),a&&H(e,a,t);var r=Object.keys(t).filter(function(e){return e.includes("-")});z(e,Y,t,r),i&&z(e,i,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof D||t instanceof M)t.value&&(Array.isArray(t.value)?(e.className=t.value.join(" "),t.unique(n).listen(function(){e.className=t.value.join(" ")})):(e.className=t.value,t.unique(n).listen(function(){e.className=t.value}))),t.unique(n).listen(function(t){return e.className=t});else{var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i;for(var a,r=l(t);!(a=r()).done;){var o=a.value;o instanceof D&&o.unique(n).listen(function(n){var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i})}}}(e,t.class,n)}(s,a,o.cancellationToken,t,n);var u=F(r,o.renderSession);return function e(t,n){if(null!=n)if(Array.isArray(n))for(var i,a=l(n);!(i=a()).done;)e(t,i.value);else if(n instanceof U)n.attachToDom(t,t.childNodes.length);else{if(!(n instanceof HTMLElement||n instanceof Text))throw new Error("Unexpected child type passed to DOM Node: "+n);t.appendChild(n)}}(s,u),a.onAttach&&o.onAttach(function(){return a.onAttach(s)}),a.onDetach&&o.onDetach(function(){s.isConnected&&s.parentElement.removeChild(s),a.onDetach(s)}),null==i||i(s,a,o.cancellationToken),s}}function H(e,t,n){var i=function(i){n[t[i]]&&(n[t[i]]instanceof D?e.addEventListener(i,function(e){return n[t[i]].update(e)}):n[t[i]]instanceof M?e.addEventListener(i,function(e){return n[t[i]].updateDownstream(e)}):"function"==typeof n[t[i]]&&e.addEventListener(i,function(e){return n[t[i]](e)}))};for(var a in t)i(a)}function z(e,t,n,i){for(var a,r=l(t);!(a=r()).done;){var o=a.value;n[o]&&$(e,n[o],o)}if(i)for(var s,u=l(i);!(s=u()).done;){var c=s.value;n[c]&&$(e,n[c],c)}}function $(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof D||t instanceof M))throw new Error("Attributes only support types boolean, string, number and data sources");"string"==typeof t.value?e.setAttribute(n,t.value):"boolean"==typeof t.value&&t.value&&e.setAttribute(n,""),t.unique().listen(function(t){"string"==typeof t?e.setAttribute(n,t):"boolean"==typeof t&&(t?e.setAttribute(n,""):e.removeAttribute(n))})}}var G=B("input",["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof D?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof M?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.checked&&(t.checked instanceof D?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.update(i.checked)})):t.checked instanceof M?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.updateUpstream(i.checked)})):i.checked=t.checked)}),J=B("select",void 0,{change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof D?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.update(i.value)})):t.value instanceof M?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.selectedIndex&&(t.selectedIndex instanceof D?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.update(i.selectedIndex)})):t.selectedIndex instanceof M?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.updateUpstream(i.selectedIndex)})):i.selectedIndex=t.selectedIndex)}),Q=B("code"),X=B("div"),Z=B("a",["href","target"]),ee=B("abbr"),te=B("h1"),ne=B("h2"),ie=B("h3"),ae=B("h4"),re=B("h5"),oe=B("h6"),se=B("area",["alt","coors"]),ue=B("article"),le=B("aside"),ce=B("span"),he=B("noscript"),de=B("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),fe=B("ul"),pe=B("ol"),ve=B("li"),me=B("tr"),we=B("b"),ge=B("title"),ye=B("summary"),be=B("thead"),Ee=B("template"),ke=B("q"),Se=B("pre"),Ae=B("p"),De=B("hr"),Oe=B("audio",["controls","autoplay","loop","muted","preload","src"]),xe=B("br"),Te=B("button",["disabled"]),Ce=B("canvas",["width","height"]),Ne=B("data",["value"]),Me=B("details"),Re=B("em"),Ie=B("footer"),Le=B("form"),Pe=B("head"),Ue=B("header"),Fe=B("heading"),Ke=B("i"),je=B("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),Ve=B("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),qe=B("label",["for"]),We=B("link",["href","rel","media","as","disabled","type"]),_e=B("nav"),Ye=B("sub"),Be=B("sup"),He=B("table"),ze=B("tbody"),$e=B("tfoot"),Ge=B("td"),Je=B("th"),Qe=B("time",["datetime"]),Xe=B("style",["media"]),Ze=B("source",["src","srcSet","media","sizes","type"]),et=B("script",["src","async","defer","integrity","noModule","type"]),tt=B("svg",["width","height"]),nt=B("progress",["max","value"]),it=B("option",["value"]),at=B("slot",["name"]),rt={button:Te,code:Q,hr:De,div:X,input:G,li:ve,span:ce,style:Xe,ul:fe,p:Ae,img:Ve,link:We,canvas:Ce,a:Z,article:ue,br:xe,form:Le,label:qe,ol:pe,pre:Se,progress:nt,table:He,td:Ge,tr:me,th:Je,textarea:B("textArea",["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof D?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof M?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value)}),h1:te,h2:ne,h3:ie,h4:ae,h5:re,h6:oe,head:Pe,header:Ue,footer:Ie,nav:_e,b:we,i:Ke,script:et,abbr:ee,area:se,aside:le,audio:Oe,em:Re,heading:Fe,iframe:je,noscript:he,option:it,q:ke,select:J,source:Ze,title:ge,video:de,tbody:ze,tfoot:$e,thead:be,summary:ye,details:Me,sub:Ye,sup:Be,svg:tt,data:Ne,time:Qe,template:Ee,slot:at},ot=function(){function e(){}return e.attach=function(e,t){var n=I(),i=F(e,n);if(i instanceof U)i.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(function(){return i.dispose()});else if(Array.isArray(i)){var a=new q(new x(i),j(n));n.sessionToken.addCancelable(function(){return a.dispose()}),a.attachToDom(t,t.childNodes.length)}else t.appendChild(i),n.sessionToken.addCancelable(function(){t.removeChild(i)});for(var r=n.attachCalls.length-1;r>=0;r--)n.attachCalls[r]();return n.sessionToken},e.factory=function(e,t){var n,i;if("string"==typeof e){i=e;var a=e;if(void 0===(e=rt[e]))throw new Error("Node "+a+" does not exist or is not supported")}return(n={})[L]=!0,n.name=i,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();function st(e,i){return customElements.define(e.name,function(a){function r(){var t;t=a.call(this)||this,void 0===e.observedAttributes&&(e.observedAttributes=[]),t.props={};for(var n,i=l(e.observedAttributes);!(n=i()).done;)t.props[n.value]=new D;return t}n(r,a);var o=r.prototype;return o.attributeChangedCallback=function(e,t,n){t!==n&&this.props[e].update(n)},o.connectedCallback=function(){var t,n=document.createDocumentFragment();this.session=I(),this.api=j(this.session);for(var a,r=i(this.props,this.api),o=l(this.session.attachCalls);!(a=o()).done;)(0,a.value)();ot.attach(r,n),this.attachShadow({mode:null!==(t=e.shadowRootMode)&&void 0!==t?t:"open",delegatesFocus:e.shadowRootDelegatesFocus}).appendChild(n)},o.disconnectedCallback=function(){this.session.sessionToken.cancel()},t(r,null,[{key:"observedAttributes",get:function(){return e.observedAttributes}}]),r}(s(HTMLElement))),B(e.name,e.observedAttributes,void 0,function(e,t){for(var n in t)n in e.props||(e.props[n]=t[n])})}function ut(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[L]||!(e.factory===ct||e.factory===ht)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===ht}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var i=new D(lt());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){i.update(lt())}),i.unique(n.cancellationToken).withInitial(i.value).map(function(e){return function(e,t){var n,i;if(null==e)return null===(n=t.find(function(e){return e.factory===ht}))||void 0===n?void 0:n.children;if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children;var a=e.split("/");a.pop();for(var r=function(){var e=a.join("/");if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return{v:t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children};a.pop()};a.length;){var o=r();if("object"==typeof o)return o.v}return null===(i=t.find(function(e){return e.factory===ht}))||void 0===i?void 0:i.children}(e,t)})}function lt(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function ct(e,t){}function ht(e,t){}function dt(e,t,n){var i=new D(null==e?void 0:e.fallback),a=new h;return n.onDetach(function(){a.cancel()}),Promise.all(n.prerender(t,a)).then(function(e){a.isCanceled||i.update(e)},function(e){return a.cancel(),Promise.reject(e)}),i}function ft(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[L]||!(e.factory===pt||e.factory===vt)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===vt}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");var i=new h;return n.onDetach(function(){i.cancel()}),e.state.unique(i).withInitial(e.state.value).map(function(e){return function(e,t){var n,i,a;return null!==(i=null===(n=t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.when)===e}))||void 0===n?void 0:n.children)&&void 0!==i?i:null===(a=t.find(function(e){return e.factory===vt}))||void 0===a?void 0:a.children}(e,t)})}function pt(e,t){}function vt(e,t){}var mt=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n,i=new D(null===(n=this.data)||void 0===n?void 0:n[e]);return this.listenOnKey(e,function(e){i.update(e.newValue)},t),i},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data[e],oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return Object.keys(this.data)},t.values=function(){return Object.values(this.data)},t.get=function(e){return this.data[e]},t.delete=function(e){var t=this.data[e];delete this.data[e],this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data[e]!==t){var n=this.data[e];this.data[e]=t,this.updateEvent.fire({oldValue:n,key:e,newValue:this.data[e]}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data[e]})}},t.assign=function(t){if(t instanceof e)for(var n,i=l(t.keys());!(n=i()).done;){var a=n.value;this.set(a,t.data[a])}else for(var r=0,o=Object.keys(t);r<o.length;r++){var s=o[r];this.set(s,t[s])}},t.toObject=function(){return Object.assign({},this.data)},t.toDataSource=function(){var e=this,t=new D(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),wt=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new D(this.data.get(e));return this.listenOnKey(e,function(e){n.update(e.newValue)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data.get(e),oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.values=function(){return this.data.values()},t.get=function(e){return this.data.get(e)},t.has=function(e){return this.data.has(e)},t.delete=function(e){var t=this.data.get(e);this.data.delete(e),this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data.get(e)!==t){var n=this.data.get(e);this.data.set(e,t),this.updateEvent.fire({oldValue:n,key:e,newValue:this.data.get(e)}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data.get(e)})}},t.assign=function(e){for(var t,n=l(e.keys());!(t=n()).done;){var i=t.value;this.set(i,e.get(i))}},t.toMap=function(){return new Map(this.data.entries())},e}(),gt=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new D(this.data.has(e));return this.listenOnKey(e,function(e){n.update(e)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t(this.has(e)),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.has=function(e){return this.data.has(e)},t.delete=function(e){this.data.delete(e),this.updateEvent.fire({key:e,exists:!1}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!1)},t.add=function(e){this.data.has(e)||(this.data.add(e),this.updateEvent.fire({key:e,exists:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!0))},t.assign=function(e){for(var t,n=l(e.keys());!(t=n()).done;)this.add(t.value)},t.toSet=function(){return new Set(this.data.keys())},e}(),yt=function(){function e(e,t){this.input=null!=e?e:new D,this.output=null!=t?t:this.input}var n=e.prototype;return n.update=function(e){this.input.update(e)},n.listen=function(e,t){return this.output.listen(e,t)},n.listenAndRepeat=function(e,t){return this.output.listenAndRepeat(e,t)},n.listenOnce=function(e,t){return this.output.listenOnce(e,t)},n.filter=function(t,n){return new e(this.input,this.output.filter(t,n))},n.unique=function(t){return new e(this.input,this.output.unique(t))},n.map=function(t,n){return new e(this.input,this.output.map(t,n))},n.reduce=function(t,n,i){return new e(this.input,this.output.reduce(t,n,i))},n.awaitNextUpdate=function(e){return this.output.awaitNextUpdate(e)},n.await=function(t){return new e(this.input,this.output.await(t))},n.awaitLatest=function(t){return new e(this.input,this.output.awaitLatest(t))},n.awaitOrdered=function(t){return new e(this.input,this.output.awaitOrdered(t))},n.cancelAll=function(){this.input.cancelAll(),this.output.cancelAll()},t(e,[{key:"value",get:function(){return this.output.value}}]),e}();export{q as ArrayAurumElement,x as ArrayDataSource,ot as Aurum,U as AurumElement,ut as AurumRouter,h as CancellationToken,A as DataFlow,D as DataSource,ht as DefaultRoute,vt as DefaultSwitchCase,M as DuplexDataSource,d as EventEmitter,N as FilteredArrayView,wt as MapDataSource,T as MappedArrayView,mt as ObjectDataSource,c as OperationType,ct as Route,gt as SetDataSource,W as SingularAurumElement,C as SortedArrayView,yt as Stream,dt as Suspense,ft as Switch,pt as SwitchCase,O as TransientDataSource,st as Webcomponent,R as aurumClassName,L as aurumElementModelIdentitiy,j as createAPI,I as createRenderSession,g as dsBuffer,w as dsDelay,p as dsFilter,f as dsMap,y as dsPick,m as dsReduce,v as dsUnique,P as nodeData,K as pendingSessions,F as render}; | ||
//# sourceMappingURL=aurumjs.esm.js.map |
@@ -1,2 +0,2 @@ | ||
function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function t(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function o(e,t,n){return(o=r()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var r=new(Function.bind.apply(e,i));return n&&a(r,n.prototype),r}).apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return o(e,arguments,i(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),a(n,e)})(e)}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function l(e){var t=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return u(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,void 0):void 0}}(e)))return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}var c,h=function(){function e(){var e=[].slice.call(arguments);this.cancelables=null!=e?e:[],this._isCancelled=!1}var n=e.prototype;return n.hasCancellables=function(){return this.cancelables.length>0},n.addCancelable=function(e){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.push(e),200===this.cancelables.length&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this},n.removeCancelable=function(e){this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled");var t=this.cancelables.indexOf(e);return-1!==t&&this.cancelables.splice(t,1),this},n.setTimeout=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=this;void 0===t&&(t=0);var i=setTimeout(function(){n.removeCancelable(a),e()},t),a=function(){return clearTimeout(i)};this.addCancelable(a)}),n.setInterval=function(e){function t(t,n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=setInterval(e,t);this.addCancelable(function(){return clearInterval(n)})}),n.requestAnimationFrame=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){var t=this,n=requestAnimationFrame(function(){t.removeCancelable(i),e()}),i=function(){return cancelAnimationFrame(n)};this.addCancelable(i)}),n.animationLoop=function(e){var t=requestAnimationFrame(function n(i){e(i),t=requestAnimationFrame(n)});this.addCancelable(function(){return cancelAnimationFrame(t)})},n.throwIfCancelled=function(e){if(this.isCanceled)throw new Error(e||"cancellation token is cancelled")},n.chain=function(e,t){return void 0===t&&(t=!1),t&&e.chain(this,!1),this.addCancelable(function(){return e.cancel()}),this},n.registerDomEvent=function(e,t,n){return e.addEventListener(t,n),this.addCancelable(function(){return e.removeEventListener(t,n)}),this},n.cancel=function(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(function(e){return e()}),this.cancelables=void 0)},t(e,[{key:"isCanceled",get:function(){return this._isCancelled}}]),e}(),d=function(){function e(){this.subscribeChannel=[],this.subscribeOnceChannel=[],this.onAfterFire=[]}var n=e.prototype;return n.subscribe=function(e,t){return this.createSubscription(e,this.subscribeChannel,t).facade},n.subscribeOnce=function(e,t){return this.createSubscription(e,this.subscribeOnceChannel,t).facade},n.hasSubscriptions=function(){return this.subscriptions>0},n.cancelAll=function(){var e,t=this;this.isFiring?this.onAfterFire.push(function(){var e;t.subscribeChannel.length=0,t.subscribeOnceChannel.length=0,null===(e=t.onEmpty)||void 0===e||e.call(t)}):(this.subscribeChannel.length=0,this.subscribeOnceChannel.length=0,null===(e=this.onEmpty)||void 0===e||e.call(this))},n.afterFire=function(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(function(e){return e()}),this.onAfterFire.length=0)},n.fire=function(e){this.isFiring=!0;for(var t=this.subscribeChannel.length,n=0;n<t;n++)try{this.subscribeChannel[n].callback(e)}catch(e){console.error(e)}if(this.subscribeOnceChannel.length>0){t=this.subscribeOnceChannel.length;for(var i=0;i<t;i++)try{this.subscribeOnceChannel[i].callback(e)}catch(e){console.error(e)}this.subscribeOnceChannel.length=0}this.isFiring=!1,this.afterFire()},n.createSubscription=function(e,t,n){var i=this,a={callback:e},r={cancel:function(){i.cancel(a,t)}};return void 0!==n&&n.addCancelable(function(){return i.cancel(a,t)}),t.push(a),{subscription:a,facade:r}},n.cancel=function(e,t){var n,i=this,a=t.indexOf(e);a>=0&&(this.isFiring?this.onAfterFire.push(function(){return i.cancel(e,t)}):(t.splice(a,1),this.hasSubscriptions()||null===(n=this.onEmpty)||void 0===n||n.call(this)))},t(e,[{key:"subscriptions",get:function(){return this.subscribeChannel.length+this.subscribeOnceChannel.length}}]),e}();function f(e,t,n){if(!e.s){if(n instanceof p){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;var i=e.o;i&&i(e)}}!function(e){e[e.FILTER=0]="FILTER",e[e.MAP=1]="MAP",e[e.DELAY=2]="DELAY",e[e.MAP_DELAY=3]="MAP_DELAY"}(c||(c={}));var p=function(){function e(){}return e.prototype.then=function(t,n){var i=new e,a=this.s;if(a){var r=1&a?t:n;if(r){try{f(i,1,r(this.v))}catch(e){f(i,2,e)}return i}return this}return this.o=function(e){try{var a=e.v;1&e.s?f(i,1,t?t(a):a):n?f(i,1,n(a)):f(i,2,a)}catch(e){f(i,2,e)}},i},e}(),v="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function m(e){return e instanceof p&&1&e.s}var w,g=function(){function e(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new d}e.fromMultipleSources=function(t,n){for(var i,a=new e,r=l(t);!(i=r()).done;)i.value.listen(function(e){return a.update(e)},n);return a};var t=e.prototype;return t.repeatLast=function(){return this.update(this.value),this},t.update=function(e){if(this.primed=!0,this.updating)throw new Error("Problem in data source: Unstable value propagation. When updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=e,this.updateEvent.fire(e),this.updating=!1},t.withInitial=function(e){return this.primed||this.update(e),this},t.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},t.filter=function(e,t){t=null!=t?t:new h;var n=new y(t);return this.listen(function(t){e(t,n.value)&&n.update(t)},t),n},t.max=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)>0:e>t},e)},t.min=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)<0:e<t},e)},t.transform=function(t,n,i,a,r,o,s,u,l,d,w,g){var y,b=[t,n,i,a,r,o,s,u,l,d,w].filter(function(e){return!(e&&e instanceof h&&(y=e,1))});g&&(y=g);var E=new e;return this.listen(function(e){try{var n,i=function(t){if(n)return t;E.update(e)},a=function(e,t,n){if("function"==typeof e[v]){var i,a,r,o=e[v]();if(function e(s){try{for(;!((i=o.next()).done||n&&n());)if((s=t(i.value))&&s.then){if(!m(s))return void s.then(e,r||(r=f.bind(null,a=new p,2)));s=s.v}a?f(a,1,s):a=s}catch(e){f(a||(a=new p),2,e)}}(),o.return){var s=function(e){try{i.done||o.return()}catch(e){}return e};if(a&&a.then)return a.then(s,function(e){throw s(e)});s()}return a}if(!("length"in e))throw new TypeError("Object is not iterable");for(var u=[],l=0;l<e.length;l++)u.push(e[l]);return function(e,t,n){var i,a,r=-1;return function o(s){try{for(;++r<e.length&&(!n||!n());)if((s=t(r))&&s.then){if(!m(s))return void s.then(o,a||(a=f.bind(null,i=new p,2)));s=s.v}i?f(i,1,s):i=s}catch(e){f(i||(i=new p),2,e)}}(),i}(u,function(e){return t(u[e])},n)}(b,function(i){return function(e,t){var n,i=-1;e:{for(var a=0;a<t.length;a++){var r=t[a][0];if(r){var o=r();if(o&&o.then)break e;if(o===e){i=a;break}}else i=a}if(-1!==i){do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then){n=!0;break e}var l=t[i][2];i++}while(l&&!l());return u}}var c=new p,h=f.bind(null,c,2);return(n?u.then(d):o.then(function n(o){for(;;){if(o===e){i=a;break}if(++a===t.length){if(-1!==i)break;return void f(c,1,u)}if(r=t[a][0]){if((o=r())&&o.then)return void o.then(n).then(void 0,h)}else i=a}do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then)return void u.then(d).then(void 0,h);var l=t[i][2];i++}while(l&&!l());f(c,1,u)})).then(void 0,h),c;function d(e){for(;;){var n=t[i][2];if(!n||n())break;i++;for(var a=t[i][1];!a;)i++,a=t[i][1];if((e=a())&&e.then)return void e.then(d).then(void 0,h)}f(c,1,e)}}(t.operationType,[[function(){return c.MAP},function(){e=i.operation(e)}],[function(){return c.DELAY}],[function(){return c.MAP_DELAY},function(){return Promise.resolve(i.operation(e)).then(function(t){e=t})}],[function(){return c.FILTER},function(){i.operation(e)||(n=1)}]])},function(){return n});return Promise.resolve(a&&a.then?a.then(i):i(a))}catch(e){return Promise.reject(e)}},y),E},t.pipe=function(e,t){return this.listen(function(t){return e.update(t)},t),this},t.map=function(e,t){var n;return t=null!=t?t:new h,n=this.primed?new y(t,e(this.value)):new y(t),this.listen(function(t){n.update(e(t))},t),n},t.tap=function(e,t){return this.listen(function(t){e(t)},t),this},t.loadBalance=function(e,t){var n=0;this.listen(function(t){e[n++].update(t),n>=e.length&&(n=0)},t)},t.await=function(e){e=null!=e?e:new h;var t=new y(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var n=t.update;return Promise.resolve(e).then(function(e){n.call(t,e)})}catch(e){return Promise.reject(e)}},e),t},t.awaitOrdered=function(e){e=null!=e?e:new h;var t=[],n=new y(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=!1,a=function(){if(!(e instanceof Promise)){var a=n.update;return Promise.resolve(e).then(function(e){a.call(n,e)})}t.push(e),function(){try{var e=function(){i=!1};i||(i=!0);var a=function(e,t,n){for(var i;;){var a=e();if(m(a)&&(a=a.v),!a)return r;if(a.then){i=0;break}var r=n();if(r&&r.then){if(!m(r)){i=1;break}r=r.s}}var o=new p,s=f.bind(null,o,2);return(0===i?a.then(l):1===i?r.then(u):(void 0).then(function(){(a=e())?a.then?a.then(l).then(void 0,s):l(a):f(o,1,r)})).then(void 0,s),o;function u(t){r=t;do{if(!(a=e())||m(a)&&!a.v)return void f(o,1,r);if(a.then)return void a.then(l).then(void 0,s);m(r=n())&&(r=r.v)}while(!r||!r.then);r.then(u).then(void 0,s)}function l(e){e?(r=n())&&r.then?r.then(u).then(void 0,s):u(r):f(o,1,r)}}(function(){return!!t.length},0,function(){var e=n.update;return Promise.resolve(t[0]).then(function(i){e.call(n,i),t.shift()})});Promise.resolve(a&&a.then?a.then(e):e())}catch(e){return Promise.reject(e)}}()}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e),n},t.awaitLatest=function(e){var t;e=null!=e?e:new h;var n=new y(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=t=Date.now();return Promise.resolve(e).then(function(e){t===i&&n.update(e)})}catch(e){return Promise.reject(e)}},e),n},t.unique=function(e){e=null!=e?e:new h;var t=new y(e,this.value);return this.listen(function(e){e!==t.value&&t.update(e)},e),t},t.diff=function(e){e=null!=e?e:new h;var t=new y(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},t.reduce=function(e,t,n){n=null!=n?n:new h;var i=new y(n,t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},t.aggregate=function(e,t,n){var i=this;n=null!=n?n:new h;var a=new y(n,t(this.value,e.value));return this.listen(function(){return a.update(t(i.value,e.value))},n),e.listen(function(){return a.update(t(i.value,e.value))},n),a},t.aggregateThree=function(e,t,n,i){var a=this;i=null!=i?i:new h;var r=new y(i,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(a.value,e.value,t.value))},i),e.listen(function(){return r.update(n(a.value,e.value,t.value))},i),t.listen(function(){return r.update(n(a.value,e.value,t.value))},i),r},t.aggregateFour=function(e,t,n,i,a){var r=this;a=null!=a?a:new h;var o=new y(a,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),e.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),t.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),n.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),o},t.combine=function(e,t){t=null!=t?t:new h;var n=new y(t);this.pipe(n,t);for(var i,a=l(e);!(i=a()).done;)i.value.pipe(n,t);return n},t.delay=function(e,t){t=null!=t?t:new h;var n=new y(t,this.value);return this.listen(function(t){setTimeout(function(){n.update(t)},e)},t),n},t.skip=function(e,t){t=null!=t?t:new h;var n=new y(t,this.value);return this.listen(function(t){0===e?n.update(t):e--},t),n},t.cutoff=function(e,t){t=null!=t?t:new h;var n=new y(t,this.value);return this.listen(function(t){e-- >0&&n.update(t)},t),n},t.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},t.debounce=function(e,t){t=null!=t?t:new h;var n,i=new y(t,this.value);return this.listen(function(t){clearTimeout(n),n=setTimeout(function(){i.update(t)},e)},t),i},t.throttle=function(e,t){t=null!=t?t:new h;var n=new y(t,this.value),i=!1;return this.listen(function(t){i||(n.update(t),i=!0,setTimeout(function(){i=!1},e))},t),n},t.buffer=function(e,t){t=null!=t?t:new h;var n,i=new y(t),a=[];return this.listen(function(t){a.push(t),n||(n=setTimeout(function(){n=void 0,i.update(a),a=[]},e))},t),i},t.accumulate=function(e){var t=new b;return this.listen(function(e){t.push(e)},e),t},t.pick=function(e,t){var n;t=null!=t?t:new h;var i=new y(t,null===(n=this.value)||void 0===n?void 0:n[e]);return this.listen(function(t){i.update(null!=t?t[e]:t)},t),i},t.cancelAll=function(){this.updateEvent.cancelAll()},e}(),y=function(e){function t(t,n){var i;return(i=e.call(this,n)||this).disposeToken=t,i.updateEvent.onEmpty=function(){t.cancel(),Object.defineProperty(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i),"value",{get:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')},set:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')}})},i}n(t,e);var i=t.prototype;return i.persist=function(){return this.updateEvent.onEmpty=void 0,this},i.listen=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},i.listenAndRepeat=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listenAndRepeat.call(this,t,n)},i.listenOnce=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},t}(g),b=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new g(this.data.length),this.updateEvent=new d}var n=e.prototype;return n.listenAndRepeat=function(e,t){return e({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(e,t)},n.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},n.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},n.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},n.getData=function(){return this.data},n.get=function(e){return this.data[e]},n.set=function(e,t){var n=this.data[e];n!==t&&(this.data[e]=t,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:e,items:[t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},n.swap=function(e,t){if(e!==t){var n=this.data[e],i=this.data[t];this.data[t]=n,this.data[e]=i,this.update({operation:"swap",operationDetailed:"swap",index:e,index2:t,items:[n,i],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.swapItems=function(e,t){if(e!==t){var n=this.data.indexOf(e),i=this.data.indexOf(t);-1!==n&&-1!==i&&(this.data[i]=e,this.data[n]=t),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:i,items:[e,t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.appendArray=function(e){this.data=this.data.concat(e),this.update({operation:"add",operationDetailed:"append",count:e.length,index:this.data.length-e.length,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.insertAt=function(e){var t,n=[].slice.call(arguments,1);0!==n.length&&((t=this.data).splice.apply(t,[e,0].concat(n)),this.update({operation:"add",operationDetailed:"insert",count:n.length,index:e,items:n,newState:this.data}),this.lengthSource.update(this.data.length))},n.push=function(){this.appendArray([].slice.call(arguments))},n.unshift=function(){var e,t=[].slice.call(arguments);(e=this.data).unshift.apply(e,t),this.update({operation:"add",operationDetailed:"prepend",count:t.length,items:t,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.pop=function(){var e=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},n.merge=function(e){var t=this.data;this.data=e.slice(),this.update({operation:"merge",operationDetailed:"merge",previousState:t,index:0,items:this.data,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.removeRight=function(e){var t=this.data.length,n=this.data.splice(t-e,e);this.update({operation:"remove",operationDetailed:"removeRight",count:e,index:t-e,items:n,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.removeLeft=function(e){var t=this.data.splice(0,e);this.update({operation:"remove",operationDetailed:"removeLeft",count:e,index:0,items:t,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.remove=function(e){var t=this.data.indexOf(e);-1!==t&&(this.data.splice(t,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:t,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},n.clear=function(){if(0!==this.data.length){var e=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:e.length,index:0,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.shift=function(){var e=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[e],count:1,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},n.toArray=function(){return this.data.slice()},n.sort=function(e,t,n){void 0===t&&(t=[]);var i=new k(this,e,n),a=new h;return n&&n.addCancelable(function(){return a.cancel()}),t.forEach(function(e){e.listen(function(){return i.refresh()})},a),i},n.map=function(e,t,n){void 0===t&&(t=[]);var i=new E(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()})},n),i},n.filter=function(e,t,n){void 0===t&&(t=[]);var i=new S(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()},n)}),i},n.forEach=function(e){return this.data.forEach(e)},n.update=function(e){this.updateEvent.fire(e)},t(e,[{key:"length",get:function(){return this.lengthSource}}]),e}(),E=function(e){function t(t,n,i){var a;void 0===i&&(i=new h);var r=t.getData().map(n);return(a=e.call(this,r)||this).parent=t,a.mapper=n,t.listen(function(e){var t,n;switch(e.operationDetailed){case"removeLeft":a.removeLeft(e.count);break;case"removeRight":a.removeRight(e.count);break;case"remove":a.remove(a.data[e.index]);break;case"clear":a.clear();break;case"prepend":(t=a).unshift.apply(t,e.items.map(a.mapper));break;case"append":a.appendArray(e.items.map(a.mapper));break;case"insert":(n=a).insertAt.apply(n,[e.index].concat(e.items.map(a.mapper)));break;case"swap":a.swap(e.index,e.index2);break;case"replace":a.set(e.index,a.mapper(e.items[0]));break;case"merge":for(var i=a.data.slice(),r=e.previousState.slice(),o=0;o<e.newState.length;o++)if(a.data.length<=o&&a.data.push(a.mapper(e.newState[o])),r[o]!==e.newState[o]){var s=r.indexOf(e.newState[o]);if(-1!==s){var u=a.data[o];a.data[o]=a.data[s],a.data[s]=u;var l=r[o];r[o]=r[s],r[s]=l}else a.data.splice(o,0,a.mapper(e.newState[o])),r.splice(o,0,e.newState[o])}a.data.length>e.newState.length&&(a.data.length=e.newState.length),a.update({operation:"merge",operationDetailed:"merge",previousState:i,index:0,items:a.data,newState:a.data})}},i),a}return n(t,e),t.prototype.refresh=function(){this.merge(this.parent.data.map(this.mapper))},t}(b),k=function(e){function t(t,n,i){var a;void 0===i&&(i=new h);var r=t.getData().slice().sort(n);return(a=e.call(this,r)||this).parent=t,a.comparator=n,t.listen(function(e){var t;switch(e.operationDetailed){case"removeLeft":case"removeRight":for(var n,i=l(e.items);!(n=i()).done;)a.remove(n.value);break;case"remove":a.remove(e.items[0]);break;case"clear":a.clear();break;case"prepend":(t=a).unshift.apply(t,e.items),a.data.sort(a.comparator);break;case"append":case"insert":a.appendSorted(e.items);break;case"merge":a.merge(e.items.slice().sort(a.comparator));break;case"swap":break;case"replace":a.remove(e.target),a.appendSorted(e.items)}},i),a}n(t,e);var i=t.prototype;return i.appendSorted=function(e){this.merge(this.data.concat(e).sort(this.comparator))},i.refresh=function(){this.merge(this.parent.getData().slice().sort(this.comparator))},t}(b),S=function(e){function t(t,n,i){var a;void 0===i&&(i=new h),Array.isArray(t)&&(t=new b(t));var r=t.data.filter(n=null!=n?n:function(){return!0});return(a=e.call(this,r)||this).parent=t,a.viewFilter=n,t.listen(function(e){var t,n,i;switch(e.operationDetailed){case"clear":a.clear();break;case"removeLeft":case"removeRight":case"remove":for(var r,o=l(e.items);!(r=o()).done;)a.remove(r.value);break;case"prepend":i=e.items.filter(a.viewFilter),(t=a).unshift.apply(t,i);break;case"append":i=e.items.filter(a.viewFilter),a.appendArray(i);break;case"insert":i=e.items.filter(a.viewFilter),(n=a).insertAt.apply(n,[e.index].concat(i));break;case"merge":a.merge(e.items.filter(a.viewFilter));break;case"swap":var s=a.data.indexOf(e.items[0]),u=a.data.indexOf(e.items[1]);-1!==s&&-1!==u&&a.swap(s,u);break;case"replace":var c=a.data.indexOf(e.target);-1!==c&&(a.viewFilter(e.items[0])?a.set(c,e.items[0]):a.remove(e.target))}},i),a}n(t,e);var i=t.prototype;return i.updateFilter=function(e){if(this.viewFilter!==e)return this.viewFilter=e,this.refresh(),this.data.length},i.refresh=function(){this.merge(this.parent.data.filter(this.viewFilter))},t}(b);(w=exports.DataFlow||(exports.DataFlow={}))[w.UPSTREAM=0]="UPSTREAM",w[w.DOWNSTREAM=1]="DOWNSTREAM";var A=function(){function e(e,t){void 0===t&&(t=!0),this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new d,this.updateUpstreamEvent=new d,this.propagateWritesToReadStream=t}e.fromTwoDataSource=function(t,n,i,a){void 0===a&&(a=!0);var r=new e(i,a);return r.updateDownstreamEvent=t.updateEvent,r.updateUpstreamEvent=n.updateEvent,r};var t=e.prototype;return t.withInitial=function(e){return this.primed||this.updateDownstream(e),this},e.createOneWay=function(t,n){return void 0===t&&(t=exports.DataFlow.DOWNSTREAM),new e(n,!1).oneWayFlow(t)},t.updateDownstream=function(e){if(this.updatingDownstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingDownstream=!0,this.value=e,this.updateDownstreamEvent.fire(e),this.updatingDownstream=!1},t.updateUpstream=function(e){if(this.updatingUpstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingUpstream=!0,this.value=e,this.updateUpstreamEvent.fire(e),this.propagateWritesToReadStream&&this.updateDownstreamEvent.fire(e),this.updatingUpstream=!1},t.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},t.listen=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},t.listenUpstream=function(e,t){return this.updateUpstreamEvent.subscribe(e,t).cancel},t.listenUpstreamOnce=function(e,t){return this.updateUpstreamEvent.subscribeOnce(e,t).cancel},t.listenDownstream=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},t.downStreamToDataSource=function(e){var t=new g(this.value);return this.listenDownstream(function(e){t.update(e)},e),t},t.aggregate=function(e,t,n){var i=this;n=null!=n?n:new h;var a=new y(n,t(this.value,e.value));return this.listen(function(){return a.update(t(i.value,e.value))},n),e.listen(function(){return a.update(t(i.value,e.value))},n),a},t.aggregateThree=function(e,t,n,i){var a=this;i=null!=i?i:new h;var r=new y(i,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(a.value,e.value,t.value))},i),e.listen(function(){return r.update(n(a.value,e.value,t.value))},i),t.listen(function(){return r.update(n(a.value,e.value,t.value))},i),r},t.aggregateFour=function(e,t,n,i,a){var r=this;a=null!=a?a:new h;var o=new y(a,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),e.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),t.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),n.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),o},t.filter=function(t,n,i){var a=this;if("function"==typeof n){var r=new e(void 0,!1);return this.listenDownstream(function(e){t(e,r.value)&&r.updateDownstream(e)},i),r.listenUpstream(function(e){n(e,a.value)&&a.updateUpstream(e)},i),r}var o=new g;return this.listenDownstream(function(e){t(e,o.value)&&o.update(e)},n),o},t.pipe=function(e,t){var n=this;return this.listenDownstream(function(t){return e.updateDownstream(t)},t),e.listenUpstream(function(e){return n.updateUpstream(e)},t),this},t.map=function(t,n,i){var a,r,o=this;return"function"==typeof n?(a=new e(this.primed?t(this.value):void 0,!1),this.listenDownstream(function(e){return a.updateDownstream(t(e))},i),a.listenUpstream(function(e){return o.updateUpstream(n(e))},i),a):(r=this.primed?new g(t(this.value)):new g,this.listenDownstream(function(e){return r.update(t(e))},n),r)},t.listenOnce=function(e,t){return this.updateDownstreamEvent.subscribeOnce(e,t).cancel},t.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},t.debounceUpstream=function(t,n){var i,a=this,r=new e(this.value);return r.listenUpstream(function(e){clearTimeout(i),i=setTimeout(function(){a.updateUpstream(e)},t)},n),this.listenDownstream(function(e){r.updateDownstream(e)},n),r},t.debounceDownstream=function(t,n){var i,a=this,r=new e(this.value);return this.listenDownstream(function(e){clearTimeout(i),i=setTimeout(function(){r.updateDownstream(e)},t)},n),r.listenUpstream(function(e){a.updateUpstream(e)},n),r},t.diff=function(e){e=null!=e?e:new h;var t=new y(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},t.await=function(t){t=null!=t?t:new h;var n=new e(void 0,!1);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var t=n.updateDownstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},t),this.listenUpstream(function(e){try{var t=n.updateUpstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},t),n},t.awaitLatest=function(e){throw new Error("not implemented")},t.awaitOrdered=function(e){throw new Error("not implemented")},t.unique=function(t){var n=this,i=new e(this.value,!1),a=this.value,r=this.value;return this.listenDownstream(function(e){r!==e&&(r=e,i.updateDownstream(e))},t),i.listenUpstream(function(e){a!==e&&(a=e,n.updateUpstream(e))},t),i},t.oneWayFlow=function(t,n){var i=this;void 0===t&&(t=exports.DataFlow.DOWNSTREAM);var a=new e(this.value,!1);return t===exports.DataFlow.DOWNSTREAM?(this.listenDownstream(function(e){return a.updateDownstream(e)},n),a.updateUpstream=function(){}):(a.listenUpstream(function(e){return i.updateUpstream(e)}),a.updateDownstream=function(){}),a},t.reduce=function(e,t,n){var i=new g(t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},t.cancelAll=function(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()},e}();function x(){var e={attachCalls:[],sessionToken:new h(function(){for(var t,n=l(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var D=Symbol("AurumElementModel"),O=new WeakMap,C=function(){function e(e,t){var n=this;this.children=[],this.api=t,this.api.onAttach(function(){if(void 0===n.hostNode)throw new Error("illegal state: Attach fired but not actually attached");n.render(e)})}var t=e.prototype;return t.dispose=function(){this.clearContent()},t.attachToDom=function(t,n){if(this.hostNode)throw new Error("Aurum Element is already attached");var i=e.id++;this.hostNode=t,this.contentStartMarker=document.createComment("START Aurum Node "+i),this.contentEndMarker=document.createComment("END Aurum Node "+i),n>=t.childNodes.length?(t.appendChild(this.contentStartMarker),t.appendChild(this.contentEndMarker)):(t.insertBefore(this.contentStartMarker,t.childNodes[n]),t.insertBefore(this.contentEndMarker,t.childNodes[n+1]))},t.getWorkIndex=function(){if(void 0!==this.lastStartIndex&&this.hostNode.childNodes[this.lastStartIndex]===this.contentStartMarker)return this.lastStartIndex+1;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentStartMarker)return this.lastStartIndex=e,e+1},t.getLastIndex=function(){if(void 0!==this.lastEndIndex&&this.hostNode.childNodes[this.lastEndIndex]===this.contentEndMarker)return this.lastEndIndex;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentEndMarker)return this.lastEndIndex=e,e},t.clearContent=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");for(var e=this.getWorkIndex();this.hostNode.childNodes[e]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[e])},t.updateDom=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");var t,n=this.getWorkIndex(),i=0;for(t=0;t<this.children.length;t++){var a=this.children[t];if(a instanceof e)i+=a.getLastIndex()-t-i-n;else if(this.hostNode.childNodes[t+n+i]!==this.contentEndMarker&&this.hostNode.childNodes[t+n+i]!==this.children[t]){if(!(a instanceof HTMLElement||a instanceof Text))throw new Error("not implemented");this.hostNode.removeChild(this.hostNode.childNodes[t+n+i]),this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(a,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(a)}else{if(!(a instanceof HTMLElement||a instanceof Text))throw new Error("not implemented");this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(a,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(a)}}for(;this.hostNode.childNodes[t+n+i]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[t+n+i])},e}();function T(e,t,n){if(void 0===n&&(n=!1),null!=e){if(N.has(e)){var i,a=N.get(e);a.sessionToken&&((i=t.attachCalls).push.apply(i,a.attachCalls),t.sessionToken.chain(a.sessionToken),a.attachCalls=void 0,a.sessionToken=void 0),N.delete(e)}if(Array.isArray(e))return Array.prototype.concat.apply([],e.map(function(e){return T(e,t,n)}));if(!n){if(e instanceof Promise){var r=new g;return e.then(function(e){r.update(e)}),new L(r,R(t))}if(e instanceof g||e instanceof A)return new L(e,R(t));if(e instanceof b)return new I(e,R(t));var o=typeof e;if("string"===o||"number"===o||"bigint"===o||"boolean"===o)return document.createTextNode(e.toString())}return e[D]?T(e.factory(e.props||{},e.children,R(t)),t,n):e}}C.id=1;var N=new WeakMap;function R(e){var t=void 0,n={renderSession:e,onAttach:function(t){e.attachCalls.push(t)},onDetach:function(n){t||(t=new h,e.tokens.push(t)),t.addCancelable(n)},onError:function(e){throw new Error("not implemented")},get cancellationToken(){return t||(t=new h,e.tokens.push(t)),t},prerender:function(e){var t=x(),n=T(e,t,!0);if(Array.isArray(n))for(var i,a=l(n);!(i=a()).done;){var r=i.value;"object"==typeof r&&N.set(r,t)}else N.set(n,t);return n},get style(){return function(e){for(var t,i=[].slice.call(arguments,1),a=new g,r=l(i);!(t=r()).done;){var o=t.value;(o instanceof g||o instanceof A)&&o.listen(function(){return a.update(M(e,i))},n.cancellationToken)}return a.update(M(e,i)),a}}};return n}function M(e,t){for(var n="",i=0;i<e.length;i++)n+=e[i],t[i]&&(n+="string"==typeof t[i]?t[i]:t[i].value);return n}var I=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).renderSessions=new WeakMap,i.dataSource=t,i}n(t,e);var i=t.prototype;return i.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},i.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},i.spliceChildren=function(e,t,n){for(var i,a=l(n?this.children.splice(e,t,n):this.children.splice(e,t));!(i=a()).done;)this.renderSessions.get(i.value).sessionToken.cancel()},i.handleNewContent=function(e){switch(e.operationDetailed){case"merge":for(var t=e.previousState.slice(),n=0;n<e.newState.length;n++)if(this.children.length<=n&&this.children.push(this.renderItem(e.newState[n])),t[n]!==e.newState[n]){var i=t.indexOf(e.newState[n]);if(-1!==i){var a=this.children[n];this.children[n]=this.children[i],this.children[i]=a;var r=t[n];t[n]=t[i],t[i]=r}else this.spliceChildren(n,0,this.renderItem(e.newState[n])),t.splice(n,0,e.newState[n])}this.children.length>e.newState.length&&(this.children.length=e.newState.length);break;case"remove":case"removeLeft":case"removeRight":this.spliceChildren(e.index,e.count);break;case"append":for(var o,s=l(e.items);!(o=s()).done;){var u=this.renderItem(o.value);Array.isArray(u)?this.children=this.children.concat(u):this.children.push(u)}break;case"replace":var c=this.renderItem(e.items[0]);if(Array.isArray(c))throw new Error("illegal state");this.children[e.index]=c;break;case"swap":var h=this.children[e.index2];this.children[e.index2]=this.children[e.index],this.children[e.index]=h;break;case"prepend":for(var d,f=l(e.items);!(d=f()).done;){var p=this.renderItem(d.value);if(Array.isArray(p))throw new Error("illegal state");this.children.unshift(p)}break;case"insert":for(var v,m=e.index,w=l(e.items);!(v=w()).done;){var g=this.renderItem(v.value);if(Array.isArray(g))throw new Error("illegal state");this.children.splice(m,0,g),m+=1}break;case"remove":for(var y,b=l(e.items);!(y=b()).done;){var E=this.renderItem(y.value);if(Array.isArray(E))throw new Error("illegal state");this.children.unshift(E)}break;case"clear":this.children.length=0,this.renderSessions=new WeakMap;break;default:throw new Error("not implemented")}this.updateDom()},i.renderItem=function(e){for(var t,n=x(),i=T(e,n),a=l(n.attachCalls);!(t=a()).done;)(0,t.value)();return this.renderSessions.set(i,n),i},t}(C),L=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).api.cancellationToken.addCancelable(function(){var e;return null===(e=i.renderSession)||void 0===e?void 0:e.sessionToken.cancel()}),i.dataSource=t,i}n(t,e);var i=t.prototype;return i.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},i.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},i.handleNewContent=function(e){if(this.lastValue!==e){var t=!1;if(1===this.children.length&&this.children[0]instanceof Text){var n=typeof e;"string"!==n&&"bigint"!==n&&"number"!==n||(this.children[0].nodeValue=e,t=!0)}t||this.fullRebuild(e),this.lastValue=e}},i.fullRebuild=function(e){this.clearContent(),this.endSession(),this.renderSession=x();var t=T(e,this.renderSession);if(void 0!==t){Array.isArray(t)||(t=[t]);for(var n,i=l(t);!(n=i()).done;){var a=n.value;a instanceof C&&a.attachToDom(this.hostNode,this.getLastIndex())}for(var r,o=l(this.renderSession.attachCalls);!(r=o()).done;)(0,r.value)();Array.isArray(t)&&(this.children=t)}else this.children=[]},i.endSession=function(){this.renderSession&&(this.renderSession.sessionToken.cancel(),this.renderSession=void 0)},t}(C),U={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},F=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function P(e,t,n,i){return function(a,r,o){var s=document.createElement(e);a&&function(e,t,n,i,a){K(e,U,t),a&&K(e,a,t);var r=Object.keys(t).filter(function(e){return e.includes("-")});j(e,F,t,r),i&&j(e,i,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof g||t instanceof A)t.value&&(Array.isArray(t.value)?(e.className=t.value.join(" "),t.unique(n).listen(function(){e.className=t.value.join(" ")})):(e.className=t.value,t.unique(n).listen(function(){e.className=t.value}))),t.unique(n).listen(function(t){return e.className=t});else{var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i;for(var a,r=l(t);!(a=r()).done;){var o=a.value;o instanceof g&&o.unique(n).listen(function(n){var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i})}}}(e,t.class,n)}(s,a,o.cancellationToken,t,n);var u=T(r,o.renderSession);return function e(t,n){if(null!=n)if(Array.isArray(n))for(var i,a=l(n);!(i=a()).done;)e(t,i.value);else if(n instanceof C)n.attachToDom(t,t.childNodes.length);else{if(!(n instanceof HTMLElement||n instanceof Text))throw new Error("Unexpected child type passed to DOM Node: "+n);t.appendChild(n)}}(s,u),a.onAttach&&o.onAttach(function(){return a.onAttach(s)}),a.onDetach&&o.onDetach(function(){s.isConnected&&s.parentElement.removeChild(s),a.onDetach(s)}),null==i||i(s,a,o.cancellationToken),s}}function K(e,t,n){var i=function(i){n[t[i]]&&(n[t[i]]instanceof g?e.addEventListener(i,function(e){return n[t[i]].update(e)}):n[t[i]]instanceof A?e.addEventListener(i,function(e){return n[t[i]].updateDownstream(e)}):"function"==typeof n[t[i]]&&e.addEventListener(i,function(e){return n[t[i]](e)}))};for(var a in t)i(a)}function j(e,t,n,i){for(var a,r=l(t);!(a=r()).done;){var o=a.value;n[o]&&V(e,n[o],o)}if(i)for(var s,u=l(i);!(s=u()).done;){var c=s.value;n[c]&&V(e,n[c],c)}}function V(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof g||t instanceof A))throw new Error("Attributes only support types boolean, string, number and data sources");"string"==typeof t.value?e.setAttribute(n,t.value):"boolean"==typeof t.value&&t.value&&e.setAttribute(n,""),t.unique().listen(function(t){"string"==typeof t?e.setAttribute(n,t):"boolean"==typeof t&&(t?e.setAttribute(n,""):e.removeAttribute(n))})}}var q=P("input",["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof g?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof A?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.checked&&(t.checked instanceof g?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.update(i.checked)})):t.checked instanceof A?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.updateUpstream(i.checked)})):i.checked=t.checked)}),W=P("select",void 0,{change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof g?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.update(i.value)})):t.value instanceof A?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.selectedIndex&&(t.selectedIndex instanceof g?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.update(i.selectedIndex)})):t.selectedIndex instanceof A?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.updateUpstream(i.selectedIndex)})):i.selectedIndex=t.selectedIndex)}),_=P("code"),B=P("div"),Y=P("a",["href","target"]),H=P("abbr"),z=P("h1"),$=P("h2"),G=P("h3"),J=P("h4"),Q=P("h5"),X=P("h6"),Z=P("area",["alt","coors"]),ee=P("article"),te=P("aside"),ne=P("span"),ie=P("noscript"),ae=P("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),re=P("ul"),oe=P("ol"),se=P("li"),ue=P("tr"),le=P("b"),ce=P("title"),he=P("summary"),de=P("thead"),fe=P("template"),pe=P("q"),ve=P("pre"),me=P("p"),we=P("hr"),ge=P("audio",["controls","autoplay","loop","muted","preload","src"]),ye=P("br"),be=P("button",["disabled"]),Ee=P("canvas",["width","height"]),ke=P("data",["value"]),Se=P("details"),Ae=P("em"),xe=P("footer"),De=P("form"),Oe=P("head"),Ce=P("header"),Te=P("heading"),Ne=P("i"),Re=P("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),Me=P("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),Ie=P("label",["for"]),Le=P("link",["href","rel","media","as","disabled","type"]),Ue=P("nav"),Fe=P("sub"),Pe=P("sup"),Ke=P("table"),je=P("tbody"),Ve=P("tfoot"),qe=P("td"),We=P("th"),_e=P("time",["datetime"]),Be=P("style",["media"]),Ye=P("source",["src","srcSet","media","sizes","type"]),He=P("script",["src","async","defer","integrity","noModule","type"]),ze=P("svg",["width","height"]),$e=P("progress",["max","value"]),Ge=P("option",["value"]),Je=P("slot",["name"]),Qe={button:be,code:_,hr:we,div:B,input:q,li:se,span:ne,style:Be,ul:re,p:me,img:Me,link:Le,canvas:Ee,a:Y,article:ee,br:ye,form:De,label:Ie,ol:oe,pre:ve,progress:$e,table:Ke,td:qe,tr:ue,th:We,textarea:P("textArea",["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof g?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof A?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value)}),h1:z,h2:$,h3:G,h4:J,h5:Q,h6:X,head:Oe,header:Ce,footer:xe,nav:Ue,b:le,i:Ne,script:He,abbr:H,area:Z,aside:te,audio:ge,em:Ae,heading:Te,iframe:Re,noscript:ie,option:Ge,q:pe,select:W,source:Ye,title:ce,video:ae,tbody:je,tfoot:Ve,thead:de,summary:he,details:Se,sub:Fe,sup:Pe,svg:ze,data:ke,time:_e,template:fe,slot:Je},Xe=function(){function e(){}return e.attach=function(e,t){var n=x(),i=T(e,n);if(i instanceof C)i.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(function(){return i.dispose()});else if(Array.isArray(i)){var a=new I(new b(i),R(n));n.sessionToken.addCancelable(function(){return a.dispose()}),a.attachToDom(t,t.childNodes.length)}else t.appendChild(i),n.sessionToken.addCancelable(function(){t.removeChild(i)});for(var r=n.attachCalls.length-1;r>=0;r--)n.attachCalls[r]();return n.sessionToken},e.factory=function(e,t){var n,i;if("string"==typeof e){i=e;var a=e;if(void 0===(e=Qe[e]))throw new Error("Node "+a+" does not exist or is not supported")}return(n={})[D]=!0,n.name=i,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();function Ze(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function et(e,t){}function tt(e,t){}function nt(e,t){}function it(e,t){}var at=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n,i=new g(null===(n=this.data)||void 0===n?void 0:n[e]);return this.listenOnKey(e,function(e){i.update(e.newValue)},t),i},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data[e],oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return Object.keys(this.data)},t.values=function(){return Object.values(this.data)},t.get=function(e){return this.data[e]},t.delete=function(e){var t=this.data[e];delete this.data[e],this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data[e]!==t){var n=this.data[e];this.data[e]=t,this.updateEvent.fire({oldValue:n,key:e,newValue:this.data[e]}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data[e]})}},t.assign=function(t){if(t instanceof e)for(var n,i=l(t.keys());!(n=i()).done;){var a=n.value;this.set(a,t.data[a])}else for(var r=0,o=Object.keys(t);r<o.length;r++){var s=o[r];this.set(s,t[s])}},t.toObject=function(){return Object.assign({},this.data)},t.toDataSource=function(){var e=this,t=new g(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),rt=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new g(this.data.get(e));return this.listenOnKey(e,function(e){n.update(e.newValue)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data.get(e),oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.values=function(){return this.data.values()},t.get=function(e){return this.data.get(e)},t.has=function(e){return this.data.has(e)},t.delete=function(e){var t=this.data.get(e);this.data.delete(e),this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data.get(e)!==t){var n=this.data.get(e);this.data.set(e,t),this.updateEvent.fire({oldValue:n,key:e,newValue:this.data.get(e)}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data.get(e)})}},t.assign=function(e){for(var t,n=l(e.keys());!(t=n()).done;){var i=t.value;this.set(i,e.get(i))}},t.toMap=function(){return new Map(this.data.entries())},e}(),ot=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new g(this.data.has(e));return this.listenOnKey(e,function(e){n.update(e)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t(this.has(e)),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.has=function(e){return this.data.has(e)},t.delete=function(e){this.data.delete(e),this.updateEvent.fire({key:e,exists:!1}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!1)},t.add=function(e){this.data.has(e)||(this.data.add(e),this.updateEvent.fire({key:e,exists:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!0))},t.assign=function(e){for(var t,n=l(e.keys());!(t=n()).done;)this.add(t.value)},t.toSet=function(){return new Set(this.data.keys())},e}(),st=function(){function e(e,t){this.input=null!=e?e:new g,this.output=null!=t?t:this.input}var n=e.prototype;return n.update=function(e){this.input.update(e)},n.listen=function(e,t){return this.output.listen(e,t)},n.listenAndRepeat=function(e,t){return this.output.listenAndRepeat(e,t)},n.listenOnce=function(e,t){return this.output.listenOnce(e,t)},n.filter=function(t,n){return new e(this.input,this.output.filter(t,n))},n.unique=function(t){return new e(this.input,this.output.unique(t))},n.map=function(t,n){return new e(this.input,this.output.map(t,n))},n.reduce=function(t,n,i){return new e(this.input,this.output.reduce(t,n,i))},n.awaitNextUpdate=function(e){return this.output.awaitNextUpdate(e)},n.await=function(t){return new e(this.input,this.output.await(t))},n.awaitLatest=function(t){return new e(this.input,this.output.awaitLatest(t))},n.awaitOrdered=function(t){return new e(this.input,this.output.awaitOrdered(t))},n.cancelAll=function(){this.input.cancelAll(),this.output.cancelAll()},t(e,[{key:"value",get:function(){return this.output.value}}]),e}();exports.ArrayAurumElement=I,exports.ArrayDataSource=b,exports.Aurum=Xe,exports.AurumElement=C,exports.AurumRouter=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[D]||!(e.factory===et||e.factory===tt)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===tt}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var i=new g(Ze());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){i.update(Ze())}),i.unique(n.cancellationToken).withInitial(i.value).map(function(e){return function(e,t){var n,i;if(null==e)return null===(n=t.find(function(e){return e.factory===tt}))||void 0===n?void 0:n.children;if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children;var a=e.split("/");a.pop();for(var r=function(){var e=a.join("/");if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return{v:t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children};a.pop()};a.length;){var o=r();if("object"==typeof o)return o.v}return null===(i=t.find(function(e){return e.factory===tt}))||void 0===i?void 0:i.children}(e,t)})},exports.CancellationToken=h,exports.DataSource=g,exports.DefaultRoute=tt,exports.DefaultSwitchCase=it,exports.DuplexDataSource=A,exports.EventEmitter=d,exports.FilteredArrayView=S,exports.MapDataSource=rt,exports.MappedArrayView=E,exports.ObjectDataSource=at,exports.Route=et,exports.SetDataSource=ot,exports.SingularAurumElement=L,exports.SortedArrayView=k,exports.Stream=st,exports.Suspense=function(e,t,n){var i=new g(null==e?void 0:e.fallback),a=new h;return n.onDetach(function(){a.cancel()}),Promise.all(n.prerender(t,a)).then(function(e){a.isCanceled||i.update(e)},function(e){return a.cancel(),Promise.reject(e)}),i},exports.Switch=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[D]||!(e.factory===nt||e.factory===it)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===it}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");var i=new h;return n.onDetach(function(){i.cancel()}),e.state.unique(i).withInitial(e.state.value).map(function(e){return function(e,t){var n,i,a;return null!==(i=null===(n=t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.when)===e}))||void 0===n?void 0:n.children)&&void 0!==i?i:null===(a=t.find(function(e){return e.factory===it}))||void 0===a?void 0:a.children}(e,t)})},exports.SwitchCase=nt,exports.TransientDataSource=y,exports.Webcomponent=function(e,i){return customElements.define(e.name,function(a){function r(){var t;t=a.call(this)||this,void 0===e.observedAttributes&&(e.observedAttributes=[]),t.props={};for(var n,i=l(e.observedAttributes);!(n=i()).done;)t.props[n.value]=new g;return t}n(r,a);var o=r.prototype;return o.attributeChangedCallback=function(e,t,n){t!==n&&this.props[e].update(n)},o.connectedCallback=function(){var t,n=document.createDocumentFragment();this.session=x(),this.api=R(this.session);for(var a,r=i(this.props,this.api),o=l(this.session.attachCalls);!(a=o()).done;)(0,a.value)();Xe.attach(r,n),this.attachShadow({mode:null!==(t=e.shadowRootMode)&&void 0!==t?t:"open",delegatesFocus:e.shadowRootDelegatesFocus}).appendChild(n)},o.disconnectedCallback=function(){this.session.sessionToken.cancel()},t(r,null,[{key:"observedAttributes",get:function(){return e.observedAttributes}}]),r}(s(HTMLElement))),P(e.name,e.observedAttributes,void 0,function(e,t){for(var n in t)n in e.props||(e.props[n]=t[n])})},exports.aurumClassName=function(e,t){var n=[],i=function(i){if(e[i])if(e[i]instanceof g||e[i]instanceof A){var a=e[i],r=new g(a.value?i:"");a.listen(function(e){r.update(e?i:"")},t),n.push(r)}else n.push(i)};for(var a in e)i(a);return n},exports.aurumElementModelIdentitiy=D,exports.createAPI=R,exports.createRenderSession=x,exports.nodeData=O,exports.pendingSessions=N,exports.render=T; | ||
function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function t(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function o(e,t,n){return(o=a()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&r(a,n.prototype),a}).apply(null,arguments)}function s(e){var t="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return o(e,arguments,i(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),r(n,e)})(e)}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function l(e){var t=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return u(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,void 0):void 0}}(e)))return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}var c,h=function(){function e(){var e=[].slice.call(arguments);this.cancelables=null!=e?e:[],this._isCancelled=!1}var n=e.prototype;return n.hasCancellables=function(){return this.cancelables.length>0},n.addCancelable=function(e){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.push(e),200===this.cancelables.length&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this},n.removeCancelable=function(e){this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled");var t=this.cancelables.indexOf(e);return-1!==t&&this.cancelables.splice(t,1),this},n.setTimeout=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=this;void 0===t&&(t=0);var i=setTimeout(function(){n.removeCancelable(r),e()},t),r=function(){return clearTimeout(i)};this.addCancelable(r)}),n.setInterval=function(e){function t(t,n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=setInterval(e,t);this.addCancelable(function(){return clearInterval(n)})}),n.requestAnimationFrame=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){var t=this,n=requestAnimationFrame(function(){t.removeCancelable(i),e()}),i=function(){return cancelAnimationFrame(n)};this.addCancelable(i)}),n.animationLoop=function(e){var t=requestAnimationFrame(function n(i){e(i),t=requestAnimationFrame(n)});this.addCancelable(function(){return cancelAnimationFrame(t)})},n.throwIfCancelled=function(e){if(this.isCanceled)throw new Error(e||"cancellation token is cancelled")},n.chain=function(e,t){return void 0===t&&(t=!1),t&&e.chain(this,!1),this.addCancelable(function(){return e.cancel()}),this},n.registerDomEvent=function(e,t,n){return e.addEventListener(t,n),this.addCancelable(function(){return e.removeEventListener(t,n)}),this},n.cancel=function(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(function(e){return e()}),this.cancelables=void 0)},t(e,[{key:"isCanceled",get:function(){return this._isCancelled}}]),e}(),d=function(){function e(){this.subscribeChannel=[],this.subscribeOnceChannel=[],this.onAfterFire=[]}var n=e.prototype;return n.subscribe=function(e,t){return this.createSubscription(e,this.subscribeChannel,t).facade},n.subscribeOnce=function(e,t){return this.createSubscription(e,this.subscribeOnceChannel,t).facade},n.hasSubscriptions=function(){return this.subscriptions>0},n.cancelAll=function(){var e,t=this;this.isFiring?this.onAfterFire.push(function(){var e;t.subscribeChannel.length=0,t.subscribeOnceChannel.length=0,null===(e=t.onEmpty)||void 0===e||e.call(t)}):(this.subscribeChannel.length=0,this.subscribeOnceChannel.length=0,null===(e=this.onEmpty)||void 0===e||e.call(this))},n.afterFire=function(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(function(e){return e()}),this.onAfterFire.length=0)},n.fire=function(e){this.isFiring=!0;for(var t=this.subscribeChannel.length,n=0;n<t;n++)try{this.subscribeChannel[n].callback(e)}catch(e){console.error(e)}if(this.subscribeOnceChannel.length>0){t=this.subscribeOnceChannel.length;for(var i=0;i<t;i++)try{this.subscribeOnceChannel[i].callback(e)}catch(e){console.error(e)}this.subscribeOnceChannel.length=0}this.isFiring=!1,this.afterFire()},n.createSubscription=function(e,t,n){var i=this,r={callback:e},a={cancel:function(){i.cancel(r,t)}};return void 0!==n&&n.addCancelable(function(){return i.cancel(r,t)}),t.push(r),{subscription:r,facade:a}},n.cancel=function(e,t){var n,i=this,r=t.indexOf(e);r>=0&&(this.isFiring?this.onAfterFire.push(function(){return i.cancel(e,t)}):(t.splice(r,1),this.hasSubscriptions()||null===(n=this.onEmpty)||void 0===n||n.call(this)))},t(e,[{key:"subscriptions",get:function(){return this.subscribeChannel.length+this.subscribeOnceChannel.length}}]),e}();function f(e,t,n){if(!e.s){if(n instanceof p){if(!n.s)return void(n.o=f.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(f.bind(null,e,t),f.bind(null,e,2));e.s=t,e.v=n;var i=e.o;i&&i(e)}}(c=exports.OperationType||(exports.OperationType={}))[c.FILTER=0]="FILTER",c[c.MAP=1]="MAP",c[c.DELAY=2]="DELAY",c[c.MAP_DELAY=3]="MAP_DELAY";var p=function(){function e(){}return e.prototype.then=function(t,n){var i=new e,r=this.s;if(r){var a=1&r?t:n;if(a){try{f(i,1,a(this.v))}catch(e){f(i,2,e)}return i}return this}return this.o=function(e){try{var r=e.v;1&e.s?f(i,1,t?t(r):r):n?f(i,1,n(r)):f(i,2,r)}catch(e){f(i,2,e)}},i},e}(),v="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function m(e){return e instanceof p&&1&e.s}var w,g=function(){function e(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new d}e.fromMultipleSources=function(t,n){for(var i,r=new e,a=l(t);!(i=a()).done;)i.value.listen(function(e){return r.update(e)},n);return r};var t=e.prototype;return t.repeatLast=function(){return this.update(this.value),this},t.update=function(e){if(this.primed=!0,this.updating)throw new Error("Problem in data source: Unstable value propagation. When updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=e,this.updateEvent.fire(e),this.updating=!1},t.withInitial=function(e){return this.primed||this.update(e),this},t.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},t.filter=function(e,t){t=null!=t?t:new h;var n=new y(t);return this.listen(function(t){e(t,n.value)&&n.update(t)},t),n},t.max=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)>0:e>t},e)},t.min=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)<0:e<t},e)},t.transform=function(t,n,i,r,a,o,s,u,l,c,d,w){var g,y=[t,n,i,r,a,o,s,u,l,c,d].filter(function(e){return!(e&&e instanceof h&&(g=e,1))});w&&(g=w);var b=new e;return this.listen(function(e){try{var n,i=function(t){if(n)return t;b.update(e)},r=function(e,t,n){if("function"==typeof e[v]){var i,r,a,o=e[v]();if(function e(s){try{for(;!((i=o.next()).done||n&&n());)if((s=t(i.value))&&s.then){if(!m(s))return void s.then(e,a||(a=f.bind(null,r=new p,2)));s=s.v}r?f(r,1,s):r=s}catch(e){f(r||(r=new p),2,e)}}(),o.return){var s=function(e){try{i.done||o.return()}catch(e){}return e};if(r&&r.then)return r.then(s,function(e){throw s(e)});s()}return r}if(!("length"in e))throw new TypeError("Object is not iterable");for(var u=[],l=0;l<e.length;l++)u.push(e[l]);return function(e,t,n){var i,r,a=-1;return function o(s){try{for(;++a<e.length&&(!n||!n());)if((s=t(a))&&s.then){if(!m(s))return void s.then(o,r||(r=f.bind(null,i=new p,2)));s=s.v}i?f(i,1,s):i=s}catch(e){f(i||(i=new p),2,e)}}(),i}(u,function(e){return t(u[e])},n)}(y,function(i){return function(e,t){var n,i=-1;e:{for(var r=0;r<t.length;r++){var a=t[r][0];if(a){var o=a();if(o&&o.then)break e;if(o===e){i=r;break}}else i=r}if(-1!==i){do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then){n=!0;break e}var l=t[i][2];i++}while(l&&!l());return u}}var c=new p,h=f.bind(null,c,2);return(n?u.then(d):o.then(function n(o){for(;;){if(o===e){i=r;break}if(++r===t.length){if(-1!==i)break;return void f(c,1,u)}if(a=t[r][0]){if((o=a())&&o.then)return void o.then(n).then(void 0,h)}else i=r}do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then)return void u.then(d).then(void 0,h);var l=t[i][2];i++}while(l&&!l());f(c,1,u)})).then(void 0,h),c;function d(e){for(;;){var n=t[i][2];if(!n||n())break;i++;for(var r=t[i][1];!r;)i++,r=t[i][1];if((e=r())&&e.then)return void e.then(d).then(void 0,h)}f(c,1,e)}}(t.operationType,[[function(){return exports.OperationType.MAP},function(){e=i.operation(e)}],[function(){return exports.OperationType.DELAY}],[function(){return exports.OperationType.MAP_DELAY},function(){return Promise.resolve(i.operation(e)).then(function(t){e=t})}],[function(){return exports.OperationType.FILTER},function(){i.operation(e)||(n=1)}]])},function(){return n});return Promise.resolve(r&&r.then?r.then(i):i(r))}catch(e){return Promise.reject(e)}},g),b},t.pipe=function(e,t){return this.listen(function(t){return e.update(t)},t),this},t.map=function(e,t){var n;return t=null!=t?t:new h,n=this.primed?new y(t,e(this.value)):new y(t),this.listen(function(t){n.update(e(t))},t),n},t.tap=function(e,t){return this.listen(function(t){e(t)},t),this},t.loadBalance=function(e,t){var n=0;this.listen(function(t){e[n++].update(t),n>=e.length&&(n=0)},t)},t.await=function(e){e=null!=e?e:new h;var t=new y(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var n=t.update;return Promise.resolve(e).then(function(e){n.call(t,e)})}catch(e){return Promise.reject(e)}},e),t},t.awaitOrdered=function(e){e=null!=e?e:new h;var t=[],n=new y(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=!1,r=function(){if(!(e instanceof Promise)){var r=n.update;return Promise.resolve(e).then(function(e){r.call(n,e)})}t.push(e),function(){try{var e=function(){i=!1};i||(i=!0);var r=function(e,t,n){for(var i;;){var r=e();if(m(r)&&(r=r.v),!r)return a;if(r.then){i=0;break}var a=n();if(a&&a.then){if(!m(a)){i=1;break}a=a.s}}var o=new p,s=f.bind(null,o,2);return(0===i?r.then(l):1===i?a.then(u):(void 0).then(function(){(r=e())?r.then?r.then(l).then(void 0,s):l(r):f(o,1,a)})).then(void 0,s),o;function u(t){a=t;do{if(!(r=e())||m(r)&&!r.v)return void f(o,1,a);if(r.then)return void r.then(l).then(void 0,s);m(a=n())&&(a=a.v)}while(!a||!a.then);a.then(u).then(void 0,s)}function l(e){e?(a=n())&&a.then?a.then(u).then(void 0,s):u(a):f(o,1,a)}}(function(){return!!t.length},0,function(){var e=n.update;return Promise.resolve(t[0]).then(function(i){e.call(n,i),t.shift()})});Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}}()}();return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e),n},t.awaitLatest=function(e){var t;e=null!=e?e:new h;var n=new y(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=t=Date.now();return Promise.resolve(e).then(function(e){t===i&&n.update(e)})}catch(e){return Promise.reject(e)}},e),n},t.unique=function(e){e=null!=e?e:new h;var t=new y(e,this.value);return this.listen(function(e){e!==t.value&&t.update(e)},e),t},t.diff=function(e){e=null!=e?e:new h;var t=new y(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},t.reduce=function(e,t,n){n=null!=n?n:new h;var i=new y(n,t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},t.aggregate=function(e,t,n){var i=this;n=null!=n?n:new h;var r=new y(n,t(this.value,e.value));return this.listen(function(){return r.update(t(i.value,e.value))},n),e.listen(function(){return r.update(t(i.value,e.value))},n),r},t.aggregateThree=function(e,t,n,i){var r=this;i=null!=i?i:new h;var a=new y(i,n(this.value,e.value,t.value));return this.listen(function(){return a.update(n(r.value,e.value,t.value))},i),e.listen(function(){return a.update(n(r.value,e.value,t.value))},i),t.listen(function(){return a.update(n(r.value,e.value,t.value))},i),a},t.aggregateFour=function(e,t,n,i,r){var a=this;r=null!=r?r:new h;var o=new y(r,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(a.value,e.value,t.value,n.value))},r),e.listen(function(){return o.update(i(a.value,e.value,t.value,n.value))},r),t.listen(function(){return o.update(i(a.value,e.value,t.value,n.value))},r),n.listen(function(){return o.update(i(a.value,e.value,t.value,n.value))},r),o},t.combine=function(e,t){t=null!=t?t:new h;var n=new y(t);this.pipe(n,t);for(var i,r=l(e);!(i=r()).done;)i.value.pipe(n,t);return n},t.delay=function(e,t){t=null!=t?t:new h;var n=new y(t,this.value);return this.listen(function(t){setTimeout(function(){n.update(t)},e)},t),n},t.skip=function(e,t){t=null!=t?t:new h;var n=new y(t,this.value);return this.listen(function(t){0===e?n.update(t):e--},t),n},t.cutoff=function(e,t){t=null!=t?t:new h;var n=new y(t,this.value);return this.listen(function(t){e-- >0&&n.update(t)},t),n},t.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},t.debounce=function(e,t){t=null!=t?t:new h;var n,i=new y(t,this.value);return this.listen(function(t){clearTimeout(n),n=setTimeout(function(){i.update(t)},e)},t),i},t.throttle=function(e,t){t=null!=t?t:new h;var n=new y(t,this.value),i=!1;return this.listen(function(t){i||(n.update(t),i=!0,setTimeout(function(){i=!1},e))},t),n},t.buffer=function(e,t){t=null!=t?t:new h;var n,i=new y(t),r=[];return this.listen(function(t){r.push(t),n||(n=setTimeout(function(){n=void 0,i.update(r),r=[]},e))},t),i},t.accumulate=function(e){var t=new b;return this.listen(function(e){t.push(e)},e),t},t.pick=function(e,t){var n;t=null!=t?t:new h;var i=new y(t,null===(n=this.value)||void 0===n?void 0:n[e]);return this.listen(function(t){i.update(null!=t?t[e]:t)},t),i},t.cancelAll=function(){this.updateEvent.cancelAll()},e}(),y=function(e){function t(t,n){var i;return(i=e.call(this,n)||this).disposeToken=t,i.updateEvent.onEmpty=function(){t.cancel(),Object.defineProperty(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i),"value",{get:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')},set:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')}})},i}n(t,e);var i=t.prototype;return i.persist=function(){return this.updateEvent.onEmpty=void 0,this},i.listen=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},i.listenAndRepeat=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listenAndRepeat.call(this,t,n)},i.listenOnce=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},t}(g),b=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new g(this.data.length),this.updateEvent=new d}var n=e.prototype;return n.listenAndRepeat=function(e,t){return e({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(e,t)},n.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},n.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},n.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},n.getData=function(){return this.data},n.get=function(e){return this.data[e]},n.set=function(e,t){var n=this.data[e];n!==t&&(this.data[e]=t,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:e,items:[t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},n.swap=function(e,t){if(e!==t){var n=this.data[e],i=this.data[t];this.data[t]=n,this.data[e]=i,this.update({operation:"swap",operationDetailed:"swap",index:e,index2:t,items:[n,i],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.swapItems=function(e,t){if(e!==t){var n=this.data.indexOf(e),i=this.data.indexOf(t);-1!==n&&-1!==i&&(this.data[i]=e,this.data[n]=t),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:i,items:[e,t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.appendArray=function(e){this.data=this.data.concat(e),this.update({operation:"add",operationDetailed:"append",count:e.length,index:this.data.length-e.length,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.insertAt=function(e){var t,n=[].slice.call(arguments,1);0!==n.length&&((t=this.data).splice.apply(t,[e,0].concat(n)),this.update({operation:"add",operationDetailed:"insert",count:n.length,index:e,items:n,newState:this.data}),this.lengthSource.update(this.data.length))},n.push=function(){this.appendArray([].slice.call(arguments))},n.unshift=function(){var e,t=[].slice.call(arguments);(e=this.data).unshift.apply(e,t),this.update({operation:"add",operationDetailed:"prepend",count:t.length,items:t,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.pop=function(){var e=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},n.merge=function(e){var t=this.data;this.data=e.slice(),this.update({operation:"merge",operationDetailed:"merge",previousState:t,index:0,items:this.data,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.removeRight=function(e){var t=this.data.length,n=this.data.splice(t-e,e);this.update({operation:"remove",operationDetailed:"removeRight",count:e,index:t-e,items:n,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.removeLeft=function(e){var t=this.data.splice(0,e);this.update({operation:"remove",operationDetailed:"removeLeft",count:e,index:0,items:t,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},n.remove=function(e){var t=this.data.indexOf(e);-1!==t&&(this.data.splice(t,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:t,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},n.clear=function(){if(0!==this.data.length){var e=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:e.length,index:0,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},n.shift=function(){var e=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[e],count:1,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},n.toArray=function(){return this.data.slice()},n.sort=function(e,t,n){void 0===t&&(t=[]);var i=new k(this,e,n),r=new h;return n&&n.addCancelable(function(){return r.cancel()}),t.forEach(function(e){e.listen(function(){return i.refresh()})},r),i},n.map=function(e,t,n){void 0===t&&(t=[]);var i=new E(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()})},n),i},n.filter=function(e,t,n){void 0===t&&(t=[]);var i=new S(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()},n)}),i},n.forEach=function(e){return this.data.forEach(e)},n.update=function(e){this.updateEvent.fire(e)},t(e,[{key:"length",get:function(){return this.lengthSource}}]),e}(),E=function(e){function t(t,n,i){var r;void 0===i&&(i=new h);var a=t.getData().map(n);return(r=e.call(this,a)||this).parent=t,r.mapper=n,t.listen(function(e){var t,n;switch(e.operationDetailed){case"removeLeft":r.removeLeft(e.count);break;case"removeRight":r.removeRight(e.count);break;case"remove":r.remove(r.data[e.index]);break;case"clear":r.clear();break;case"prepend":(t=r).unshift.apply(t,e.items.map(r.mapper));break;case"append":r.appendArray(e.items.map(r.mapper));break;case"insert":(n=r).insertAt.apply(n,[e.index].concat(e.items.map(r.mapper)));break;case"swap":r.swap(e.index,e.index2);break;case"replace":r.set(e.index,r.mapper(e.items[0]));break;case"merge":for(var i=r.data.slice(),a=e.previousState.slice(),o=0;o<e.newState.length;o++)if(r.data.length<=o&&r.data.push(r.mapper(e.newState[o])),a[o]!==e.newState[o]){var s=a.indexOf(e.newState[o]);if(-1!==s){var u=r.data[o];r.data[o]=r.data[s],r.data[s]=u;var l=a[o];a[o]=a[s],a[s]=l}else r.data.splice(o,0,r.mapper(e.newState[o])),a.splice(o,0,e.newState[o])}r.data.length>e.newState.length&&(r.data.length=e.newState.length),r.update({operation:"merge",operationDetailed:"merge",previousState:i,index:0,items:r.data,newState:r.data})}},i),r}return n(t,e),t.prototype.refresh=function(){this.merge(this.parent.data.map(this.mapper))},t}(b),k=function(e){function t(t,n,i){var r;void 0===i&&(i=new h);var a=t.getData().slice().sort(n);return(r=e.call(this,a)||this).parent=t,r.comparator=n,t.listen(function(e){var t;switch(e.operationDetailed){case"removeLeft":case"removeRight":for(var n,i=l(e.items);!(n=i()).done;)r.remove(n.value);break;case"remove":r.remove(e.items[0]);break;case"clear":r.clear();break;case"prepend":(t=r).unshift.apply(t,e.items),r.data.sort(r.comparator);break;case"append":case"insert":r.appendSorted(e.items);break;case"merge":r.merge(e.items.slice().sort(r.comparator));break;case"swap":break;case"replace":r.remove(e.target),r.appendSorted(e.items)}},i),r}n(t,e);var i=t.prototype;return i.appendSorted=function(e){this.merge(this.data.concat(e).sort(this.comparator))},i.refresh=function(){this.merge(this.parent.getData().slice().sort(this.comparator))},t}(b),S=function(e){function t(t,n,i){var r;void 0===i&&(i=new h),Array.isArray(t)&&(t=new b(t));var a=t.data.filter(n=null!=n?n:function(){return!0});return(r=e.call(this,a)||this).parent=t,r.viewFilter=n,t.listen(function(e){var t,n,i;switch(e.operationDetailed){case"clear":r.clear();break;case"removeLeft":case"removeRight":case"remove":for(var a,o=l(e.items);!(a=o()).done;)r.remove(a.value);break;case"prepend":i=e.items.filter(r.viewFilter),(t=r).unshift.apply(t,i);break;case"append":i=e.items.filter(r.viewFilter),r.appendArray(i);break;case"insert":i=e.items.filter(r.viewFilter),(n=r).insertAt.apply(n,[e.index].concat(i));break;case"merge":r.merge(e.items.filter(r.viewFilter));break;case"swap":var s=r.data.indexOf(e.items[0]),u=r.data.indexOf(e.items[1]);-1!==s&&-1!==u&&r.swap(s,u);break;case"replace":var c=r.data.indexOf(e.target);-1!==c&&(r.viewFilter(e.items[0])?r.set(c,e.items[0]):r.remove(e.target))}},i),r}n(t,e);var i=t.prototype;return i.updateFilter=function(e){if(this.viewFilter!==e)return this.viewFilter=e,this.refresh(),this.data.length},i.refresh=function(){this.merge(this.parent.data.filter(this.viewFilter))},t}(b);(w=exports.DataFlow||(exports.DataFlow={}))[w.UPSTREAM=0]="UPSTREAM",w[w.DOWNSTREAM=1]="DOWNSTREAM";var x=function(){function e(e,t){void 0===t&&(t=!0),this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new d,this.updateUpstreamEvent=new d,this.propagateWritesToReadStream=t}e.fromTwoDataSource=function(t,n,i,r){void 0===r&&(r=!0);var a=new e(i,r);return a.updateDownstreamEvent=t.updateEvent,a.updateUpstreamEvent=n.updateEvent,a};var t=e.prototype;return t.withInitial=function(e){return this.primed||this.updateDownstream(e),this},e.createOneWay=function(t,n){return void 0===t&&(t=exports.DataFlow.DOWNSTREAM),new e(n,!1).oneWayFlow(t)},t.updateDownstream=function(e){if(this.updatingDownstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingDownstream=!0,this.value=e,this.updateDownstreamEvent.fire(e),this.updatingDownstream=!1},t.updateUpstream=function(e){if(this.updatingUpstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingUpstream=!0,this.value=e,this.updateUpstreamEvent.fire(e),this.propagateWritesToReadStream&&this.updateDownstreamEvent.fire(e),this.updatingUpstream=!1},t.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},t.listen=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},t.listenUpstream=function(e,t){return this.updateUpstreamEvent.subscribe(e,t).cancel},t.listenUpstreamOnce=function(e,t){return this.updateUpstreamEvent.subscribeOnce(e,t).cancel},t.listenDownstream=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},t.downStreamToDataSource=function(e){var t=new g(this.value);return this.listenDownstream(function(e){t.update(e)},e),t},t.aggregate=function(e,t,n){var i=this;n=null!=n?n:new h;var r=new y(n,t(this.value,e.value));return this.listen(function(){return r.update(t(i.value,e.value))},n),e.listen(function(){return r.update(t(i.value,e.value))},n),r},t.aggregateThree=function(e,t,n,i){var r=this;i=null!=i?i:new h;var a=new y(i,n(this.value,e.value,t.value));return this.listen(function(){return a.update(n(r.value,e.value,t.value))},i),e.listen(function(){return a.update(n(r.value,e.value,t.value))},i),t.listen(function(){return a.update(n(r.value,e.value,t.value))},i),a},t.aggregateFour=function(e,t,n,i,r){var a=this;r=null!=r?r:new h;var o=new y(r,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(a.value,e.value,t.value,n.value))},r),e.listen(function(){return o.update(i(a.value,e.value,t.value,n.value))},r),t.listen(function(){return o.update(i(a.value,e.value,t.value,n.value))},r),n.listen(function(){return o.update(i(a.value,e.value,t.value,n.value))},r),o},t.filter=function(t,n,i){var r=this;if("function"==typeof n){var a=new e(void 0,!1);return this.listenDownstream(function(e){t(e,a.value)&&a.updateDownstream(e)},i),a.listenUpstream(function(e){n(e,r.value)&&r.updateUpstream(e)},i),a}var o=new g;return this.listenDownstream(function(e){t(e,o.value)&&o.update(e)},n),o},t.pipe=function(e,t){var n=this;return this.listenDownstream(function(t){return e.updateDownstream(t)},t),e.listenUpstream(function(e){return n.updateUpstream(e)},t),this},t.map=function(t,n,i){var r,a,o=this;return"function"==typeof n?(r=new e(this.primed?t(this.value):void 0,!1),this.listenDownstream(function(e){return r.updateDownstream(t(e))},i),r.listenUpstream(function(e){return o.updateUpstream(n(e))},i),r):(a=this.primed?new g(t(this.value)):new g,this.listenDownstream(function(e){return a.update(t(e))},n),a)},t.listenOnce=function(e,t){return this.updateDownstreamEvent.subscribeOnce(e,t).cancel},t.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},t.debounceUpstream=function(t,n){var i,r=this,a=new e(this.value);return a.listenUpstream(function(e){clearTimeout(i),i=setTimeout(function(){r.updateUpstream(e)},t)},n),this.listenDownstream(function(e){a.updateDownstream(e)},n),a},t.debounceDownstream=function(t,n){var i,r=this,a=new e(this.value);return this.listenDownstream(function(e){clearTimeout(i),i=setTimeout(function(){a.updateDownstream(e)},t)},n),a.listenUpstream(function(e){r.updateUpstream(e)},n),a},t.diff=function(e){e=null!=e?e:new h;var t=new y(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},t.await=function(t){t=null!=t?t:new h;var n=new e(void 0,!1);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var t=n.updateDownstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},t),this.listenUpstream(function(e){try{var t=n.updateUpstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},t),n},t.awaitLatest=function(e){throw new Error("not implemented")},t.awaitOrdered=function(e){throw new Error("not implemented")},t.unique=function(t){var n=this,i=new e(this.value,!1),r=this.value,a=this.value;return this.listenDownstream(function(e){a!==e&&(a=e,i.updateDownstream(e))},t),i.listenUpstream(function(e){r!==e&&(r=e,n.updateUpstream(e))},t),i},t.oneWayFlow=function(t,n){var i=this;void 0===t&&(t=exports.DataFlow.DOWNSTREAM);var r=new e(this.value,!1);return t===exports.DataFlow.DOWNSTREAM?(this.listenDownstream(function(e){return r.updateDownstream(e)},n),r.updateUpstream=function(){}):(r.listenUpstream(function(e){return i.updateUpstream(e)}),r.updateDownstream=function(){}),r},t.reduce=function(e,t,n){var i=new g(t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},t.cancelAll=function(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()},e}();function A(){var e={attachCalls:[],sessionToken:new h(function(){for(var t,n=l(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var D=Symbol("AurumElementModel"),O=new WeakMap,T=function(){function e(e,t){var n=this;this.children=[],this.api=t,this.api.onAttach(function(){if(void 0===n.hostNode)throw new Error("illegal state: Attach fired but not actually attached");n.render(e)})}var t=e.prototype;return t.dispose=function(){this.clearContent()},t.attachToDom=function(t,n){if(this.hostNode)throw new Error("Aurum Element is already attached");var i=e.id++;this.hostNode=t,this.contentStartMarker=document.createComment("START Aurum Node "+i),this.contentEndMarker=document.createComment("END Aurum Node "+i),n>=t.childNodes.length?(t.appendChild(this.contentStartMarker),t.appendChild(this.contentEndMarker)):(t.insertBefore(this.contentStartMarker,t.childNodes[n]),t.insertBefore(this.contentEndMarker,t.childNodes[n+1]))},t.getWorkIndex=function(){if(void 0!==this.lastStartIndex&&this.hostNode.childNodes[this.lastStartIndex]===this.contentStartMarker)return this.lastStartIndex+1;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentStartMarker)return this.lastStartIndex=e,e+1},t.getLastIndex=function(){if(void 0!==this.lastEndIndex&&this.hostNode.childNodes[this.lastEndIndex]===this.contentEndMarker)return this.lastEndIndex;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentEndMarker)return this.lastEndIndex=e,e},t.clearContent=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");for(var e=this.getWorkIndex();this.hostNode.childNodes[e]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[e])},t.updateDom=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");var t,n=this.getWorkIndex(),i=0;for(t=0;t<this.children.length;t++){var r=this.children[t];if(r instanceof e)i+=r.getLastIndex()-t-i-n;else if(this.hostNode.childNodes[t+n+i]!==this.contentEndMarker&&this.hostNode.childNodes[t+n+i]!==this.children[t]){if(!(r instanceof HTMLElement||r instanceof Text))throw new Error("not implemented");this.hostNode.removeChild(this.hostNode.childNodes[t+n+i]),this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(r,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(r)}else{if(!(r instanceof HTMLElement||r instanceof Text))throw new Error("not implemented");this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(r,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(r)}}for(;this.hostNode.childNodes[t+n+i]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[t+n+i])},e}();function C(e,t,n){if(void 0===n&&(n=!1),null!=e){if(N.has(e)){var i,r=N.get(e);r.sessionToken&&((i=t.attachCalls).push.apply(i,r.attachCalls),t.sessionToken.chain(r.sessionToken),r.attachCalls=void 0,r.sessionToken=void 0),N.delete(e)}if(Array.isArray(e))return Array.prototype.concat.apply([],e.map(function(e){return C(e,t,n)}));if(!n){if(e instanceof Promise){var a=new g;return e.then(function(e){a.update(e)}),new L(a,M(t))}if(e instanceof g||e instanceof x)return new L(e,M(t));if(e instanceof b)return new I(e,M(t));var o=typeof e;if("string"===o||"number"===o||"bigint"===o||"boolean"===o)return document.createTextNode(e.toString())}return e[D]?C(e.factory(e.props||{},e.children,M(t)),t,n):e}}T.id=1;var N=new WeakMap;function M(e){var t=void 0,n={renderSession:e,onAttach:function(t){e.attachCalls.push(t)},onDetach:function(n){t||(t=new h,e.tokens.push(t)),t.addCancelable(n)},onError:function(e){throw new Error("not implemented")},get cancellationToken(){return t||(t=new h,e.tokens.push(t)),t},prerender:function(e){var t=A(),n=C(e,t,!0);if(Array.isArray(n))for(var i,r=l(n);!(i=r()).done;){var a=i.value;"object"==typeof a&&N.set(a,t)}else N.set(n,t);return n},get style(){return function(e){for(var t,i=[].slice.call(arguments,1),r=new g,a=l(i);!(t=a()).done;){var o=t.value;(o instanceof g||o instanceof x)&&o.listen(function(){return r.update(R(e,i))},n.cancellationToken)}return r.update(R(e,i)),r}}};return n}function R(e,t){for(var n="",i=0;i<e.length;i++)n+=e[i],t[i]&&(n+="string"==typeof t[i]?t[i]:t[i].value);return n}var I=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).renderSessions=new WeakMap,i.dataSource=t,i}n(t,e);var i=t.prototype;return i.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},i.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},i.spliceChildren=function(e,t,n){for(var i,r=l(n?this.children.splice(e,t,n):this.children.splice(e,t));!(i=r()).done;)this.renderSessions.get(i.value).sessionToken.cancel()},i.handleNewContent=function(e){switch(e.operationDetailed){case"merge":for(var t=e.previousState.slice(),n=0;n<e.newState.length;n++)if(this.children.length<=n&&this.children.push(this.renderItem(e.newState[n])),t[n]!==e.newState[n]){var i=t.indexOf(e.newState[n]);if(-1!==i){var r=this.children[n];this.children[n]=this.children[i],this.children[i]=r;var a=t[n];t[n]=t[i],t[i]=a}else this.spliceChildren(n,0,this.renderItem(e.newState[n])),t.splice(n,0,e.newState[n])}this.children.length>e.newState.length&&(this.children.length=e.newState.length);break;case"remove":case"removeLeft":case"removeRight":this.spliceChildren(e.index,e.count);break;case"append":for(var o,s=l(e.items);!(o=s()).done;){var u=this.renderItem(o.value);Array.isArray(u)?this.children=this.children.concat(u):this.children.push(u)}break;case"replace":var c=this.renderItem(e.items[0]);if(Array.isArray(c))throw new Error("illegal state");this.children[e.index]=c;break;case"swap":var h=this.children[e.index2];this.children[e.index2]=this.children[e.index],this.children[e.index]=h;break;case"prepend":for(var d,f=l(e.items);!(d=f()).done;){var p=this.renderItem(d.value);if(Array.isArray(p))throw new Error("illegal state");this.children.unshift(p)}break;case"insert":for(var v,m=e.index,w=l(e.items);!(v=w()).done;){var g=this.renderItem(v.value);if(Array.isArray(g))throw new Error("illegal state");this.children.splice(m,0,g),m+=1}break;case"remove":for(var y,b=l(e.items);!(y=b()).done;){var E=this.renderItem(y.value);if(Array.isArray(E))throw new Error("illegal state");this.children.unshift(E)}break;case"clear":this.children.length=0,this.renderSessions=new WeakMap;break;default:throw new Error("not implemented")}this.updateDom()},i.renderItem=function(e){for(var t,n=A(),i=C(e,n),r=l(n.attachCalls);!(t=r()).done;)(0,t.value)();return this.renderSessions.set(i,n),i},t}(T),L=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).api.cancellationToken.addCancelable(function(){var e;return null===(e=i.renderSession)||void 0===e?void 0:e.sessionToken.cancel()}),i.dataSource=t,i}n(t,e);var i=t.prototype;return i.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},i.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},i.handleNewContent=function(e){if(this.lastValue!==e){var t=!1;if(1===this.children.length&&this.children[0]instanceof Text){var n=typeof e;"string"!==n&&"bigint"!==n&&"number"!==n||(this.children[0].nodeValue=e,t=!0)}t||this.fullRebuild(e),this.lastValue=e}},i.fullRebuild=function(e){this.clearContent(),this.endSession(),this.renderSession=A();var t=C(e,this.renderSession);if(void 0!==t){Array.isArray(t)||(t=[t]);for(var n,i=l(t);!(n=i()).done;){var r=n.value;r instanceof T&&r.attachToDom(this.hostNode,this.getLastIndex())}for(var a,o=l(this.renderSession.attachCalls);!(a=o()).done;)(0,a.value)();Array.isArray(t)&&(this.children=t)}else this.children=[]},i.endSession=function(){this.renderSession&&(this.renderSession.sessionToken.cancel(),this.renderSession=void 0)},t}(T),P={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},F=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function U(e,t,n,i){return function(r,a,o){var s=document.createElement(e);r&&function(e,t,n,i,r){K(e,P,t),r&&K(e,r,t);var a=Object.keys(t).filter(function(e){return e.includes("-")});j(e,F,t,a),i&&j(e,i,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof g||t instanceof x)t.value&&(Array.isArray(t.value)?(e.className=t.value.join(" "),t.unique(n).listen(function(){e.className=t.value.join(" ")})):(e.className=t.value,t.unique(n).listen(function(){e.className=t.value}))),t.unique(n).listen(function(t){return e.className=t});else{var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i;for(var r,a=l(t);!(r=a()).done;){var o=r.value;o instanceof g&&o.unique(n).listen(function(n){var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i})}}}(e,t.class,n)}(s,r,o.cancellationToken,t,n);var u=C(a,o.renderSession);return function e(t,n){if(null!=n)if(Array.isArray(n))for(var i,r=l(n);!(i=r()).done;)e(t,i.value);else if(n instanceof T)n.attachToDom(t,t.childNodes.length);else{if(!(n instanceof HTMLElement||n instanceof Text))throw new Error("Unexpected child type passed to DOM Node: "+n);t.appendChild(n)}}(s,u),r.onAttach&&o.onAttach(function(){return r.onAttach(s)}),r.onDetach&&o.onDetach(function(){s.isConnected&&s.parentElement.removeChild(s),r.onDetach(s)}),null==i||i(s,r,o.cancellationToken),s}}function K(e,t,n){var i=function(i){n[t[i]]&&(n[t[i]]instanceof g?e.addEventListener(i,function(e){return n[t[i]].update(e)}):n[t[i]]instanceof x?e.addEventListener(i,function(e){return n[t[i]].updateDownstream(e)}):"function"==typeof n[t[i]]&&e.addEventListener(i,function(e){return n[t[i]](e)}))};for(var r in t)i(r)}function j(e,t,n,i){for(var r,a=l(t);!(r=a()).done;){var o=r.value;n[o]&&V(e,n[o],o)}if(i)for(var s,u=l(i);!(s=u()).done;){var c=s.value;n[c]&&V(e,n[c],c)}}function V(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof g||t instanceof x))throw new Error("Attributes only support types boolean, string, number and data sources");"string"==typeof t.value?e.setAttribute(n,t.value):"boolean"==typeof t.value&&t.value&&e.setAttribute(n,""),t.unique().listen(function(t){"string"==typeof t?e.setAttribute(n,t):"boolean"==typeof t&&(t?e.setAttribute(n,""):e.removeAttribute(n))})}}var q=U("input",["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof g?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof x?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.checked&&(t.checked instanceof g?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.update(i.checked)})):t.checked instanceof x?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.updateUpstream(i.checked)})):i.checked=t.checked)}),W=U("select",void 0,{change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof g?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.update(i.value)})):t.value instanceof x?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.selectedIndex&&(t.selectedIndex instanceof g?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.update(i.selectedIndex)})):t.selectedIndex instanceof x?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.updateUpstream(i.selectedIndex)})):i.selectedIndex=t.selectedIndex)}),_=U("code"),Y=U("div"),B=U("a",["href","target"]),H=U("abbr"),z=U("h1"),$=U("h2"),G=U("h3"),J=U("h4"),Q=U("h5"),X=U("h6"),Z=U("area",["alt","coors"]),ee=U("article"),te=U("aside"),ne=U("span"),ie=U("noscript"),re=U("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),ae=U("ul"),oe=U("ol"),se=U("li"),ue=U("tr"),le=U("b"),ce=U("title"),he=U("summary"),de=U("thead"),fe=U("template"),pe=U("q"),ve=U("pre"),me=U("p"),we=U("hr"),ge=U("audio",["controls","autoplay","loop","muted","preload","src"]),ye=U("br"),be=U("button",["disabled"]),Ee=U("canvas",["width","height"]),ke=U("data",["value"]),Se=U("details"),xe=U("em"),Ae=U("footer"),De=U("form"),Oe=U("head"),Te=U("header"),Ce=U("heading"),Ne=U("i"),Me=U("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),Re=U("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),Ie=U("label",["for"]),Le=U("link",["href","rel","media","as","disabled","type"]),Pe=U("nav"),Fe=U("sub"),Ue=U("sup"),Ke=U("table"),je=U("tbody"),Ve=U("tfoot"),qe=U("td"),We=U("th"),_e=U("time",["datetime"]),Ye=U("style",["media"]),Be=U("source",["src","srcSet","media","sizes","type"]),He=U("script",["src","async","defer","integrity","noModule","type"]),ze=U("svg",["width","height"]),$e=U("progress",["max","value"]),Ge=U("option",["value"]),Je=U("slot",["name"]),Qe={button:be,code:_,hr:we,div:Y,input:q,li:se,span:ne,style:Ye,ul:ae,p:me,img:Re,link:Le,canvas:Ee,a:B,article:ee,br:ye,form:De,label:Ie,ol:oe,pre:ve,progress:$e,table:Ke,td:qe,tr:ue,th:We,textarea:U("textArea",["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof g?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof x?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value)}),h1:z,h2:$,h3:G,h4:J,h5:Q,h6:X,head:Oe,header:Te,footer:Ae,nav:Pe,b:le,i:Ne,script:He,abbr:H,area:Z,aside:te,audio:ge,em:xe,heading:Ce,iframe:Me,noscript:ie,option:Ge,q:pe,select:W,source:Be,title:ce,video:re,tbody:je,tfoot:Ve,thead:de,summary:he,details:Se,sub:Fe,sup:Ue,svg:ze,data:ke,time:_e,template:fe,slot:Je},Xe=function(){function e(){}return e.attach=function(e,t){var n=A(),i=C(e,n);if(i instanceof T)i.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(function(){return i.dispose()});else if(Array.isArray(i)){var r=new I(new b(i),M(n));n.sessionToken.addCancelable(function(){return r.dispose()}),r.attachToDom(t,t.childNodes.length)}else t.appendChild(i),n.sessionToken.addCancelable(function(){t.removeChild(i)});for(var a=n.attachCalls.length-1;a>=0;a--)n.attachCalls[a]();return n.sessionToken},e.factory=function(e,t){var n,i;if("string"==typeof e){i=e;var r=e;if(void 0===(e=Qe[e]))throw new Error("Node "+r+" does not exist or is not supported")}return(n={})[D]=!0,n.name=i,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();function Ze(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function et(e,t){}function tt(e,t){}function nt(e,t){}function it(e,t){}var rt=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n,i=new g(null===(n=this.data)||void 0===n?void 0:n[e]);return this.listenOnKey(e,function(e){i.update(e.newValue)},t),i},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data[e],oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return Object.keys(this.data)},t.values=function(){return Object.values(this.data)},t.get=function(e){return this.data[e]},t.delete=function(e){var t=this.data[e];delete this.data[e],this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data[e]!==t){var n=this.data[e];this.data[e]=t,this.updateEvent.fire({oldValue:n,key:e,newValue:this.data[e]}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data[e]})}},t.assign=function(t){if(t instanceof e)for(var n,i=l(t.keys());!(n=i()).done;){var r=n.value;this.set(r,t.data[r])}else for(var a=0,o=Object.keys(t);a<o.length;a++){var s=o[a];this.set(s,t[s])}},t.toObject=function(){return Object.assign({},this.data)},t.toDataSource=function(){var e=this,t=new g(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),at=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new g(this.data.get(e));return this.listenOnKey(e,function(e){n.update(e.newValue)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data.get(e),oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.values=function(){return this.data.values()},t.get=function(e){return this.data.get(e)},t.has=function(e){return this.data.has(e)},t.delete=function(e){var t=this.data.get(e);this.data.delete(e),this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data.get(e)!==t){var n=this.data.get(e);this.data.set(e,t),this.updateEvent.fire({oldValue:n,key:e,newValue:this.data.get(e)}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data.get(e)})}},t.assign=function(e){for(var t,n=l(e.keys());!(t=n()).done;){var i=t.value;this.set(i,e.get(i))}},t.toMap=function(){return new Map(this.data.entries())},e}(),ot=function(){function e(e){e&&(this.data=e),this.updateEvent=new d,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new g(this.data.has(e));return this.listenOnKey(e,function(e){n.update(e)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t(this.has(e)),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new d),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.has=function(e){return this.data.has(e)},t.delete=function(e){this.data.delete(e),this.updateEvent.fire({key:e,exists:!1}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!1)},t.add=function(e){this.data.has(e)||(this.data.add(e),this.updateEvent.fire({key:e,exists:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!0))},t.assign=function(e){for(var t,n=l(e.keys());!(t=n()).done;)this.add(t.value)},t.toSet=function(){return new Set(this.data.keys())},e}(),st=function(){function e(e,t){this.input=null!=e?e:new g,this.output=null!=t?t:this.input}var n=e.prototype;return n.update=function(e){this.input.update(e)},n.listen=function(e,t){return this.output.listen(e,t)},n.listenAndRepeat=function(e,t){return this.output.listenAndRepeat(e,t)},n.listenOnce=function(e,t){return this.output.listenOnce(e,t)},n.filter=function(t,n){return new e(this.input,this.output.filter(t,n))},n.unique=function(t){return new e(this.input,this.output.unique(t))},n.map=function(t,n){return new e(this.input,this.output.map(t,n))},n.reduce=function(t,n,i){return new e(this.input,this.output.reduce(t,n,i))},n.awaitNextUpdate=function(e){return this.output.awaitNextUpdate(e)},n.await=function(t){return new e(this.input,this.output.await(t))},n.awaitLatest=function(t){return new e(this.input,this.output.awaitLatest(t))},n.awaitOrdered=function(t){return new e(this.input,this.output.awaitOrdered(t))},n.cancelAll=function(){this.input.cancelAll(),this.output.cancelAll()},t(e,[{key:"value",get:function(){return this.output.value}}]),e}();exports.ArrayAurumElement=I,exports.ArrayDataSource=b,exports.Aurum=Xe,exports.AurumElement=T,exports.AurumRouter=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[D]||!(e.factory===et||e.factory===tt)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===tt}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var i=new g(Ze());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){i.update(Ze())}),i.unique(n.cancellationToken).withInitial(i.value).map(function(e){return function(e,t){var n,i;if(null==e)return null===(n=t.find(function(e){return e.factory===tt}))||void 0===n?void 0:n.children;if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children;var r=e.split("/");r.pop();for(var a=function(){var e=r.join("/");if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return{v:t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children};r.pop()};r.length;){var o=a();if("object"==typeof o)return o.v}return null===(i=t.find(function(e){return e.factory===tt}))||void 0===i?void 0:i.children}(e,t)})},exports.CancellationToken=h,exports.DataSource=g,exports.DefaultRoute=tt,exports.DefaultSwitchCase=it,exports.DuplexDataSource=x,exports.EventEmitter=d,exports.FilteredArrayView=S,exports.MapDataSource=at,exports.MappedArrayView=E,exports.ObjectDataSource=rt,exports.Route=et,exports.SetDataSource=ot,exports.SingularAurumElement=L,exports.SortedArrayView=k,exports.Stream=st,exports.Suspense=function(e,t,n){var i=new g(null==e?void 0:e.fallback),r=new h;return n.onDetach(function(){r.cancel()}),Promise.all(n.prerender(t,r)).then(function(e){r.isCanceled||i.update(e)},function(e){return r.cancel(),Promise.reject(e)}),i},exports.Switch=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[D]||!(e.factory===nt||e.factory===it)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===it}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");var i=new h;return n.onDetach(function(){i.cancel()}),e.state.unique(i).withInitial(e.state.value).map(function(e){return function(e,t){var n,i,r;return null!==(i=null===(n=t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.when)===e}))||void 0===n?void 0:n.children)&&void 0!==i?i:null===(r=t.find(function(e){return e.factory===it}))||void 0===r?void 0:r.children}(e,t)})},exports.SwitchCase=nt,exports.TransientDataSource=y,exports.Webcomponent=function(e,i){return customElements.define(e.name,function(r){function a(){var t;t=r.call(this)||this,void 0===e.observedAttributes&&(e.observedAttributes=[]),t.props={};for(var n,i=l(e.observedAttributes);!(n=i()).done;)t.props[n.value]=new g;return t}n(a,r);var o=a.prototype;return o.attributeChangedCallback=function(e,t,n){t!==n&&this.props[e].update(n)},o.connectedCallback=function(){var t,n=document.createDocumentFragment();this.session=A(),this.api=M(this.session);for(var r,a=i(this.props,this.api),o=l(this.session.attachCalls);!(r=o()).done;)(0,r.value)();Xe.attach(a,n),this.attachShadow({mode:null!==(t=e.shadowRootMode)&&void 0!==t?t:"open",delegatesFocus:e.shadowRootDelegatesFocus}).appendChild(n)},o.disconnectedCallback=function(){this.session.sessionToken.cancel()},t(a,null,[{key:"observedAttributes",get:function(){return e.observedAttributes}}]),a}(s(HTMLElement))),U(e.name,e.observedAttributes,void 0,function(e,t){for(var n in t)n in e.props||(e.props[n]=t[n])})},exports.aurumClassName=function(e,t){var n=[],i=function(i){if(e[i])if(e[i]instanceof g||e[i]instanceof x){var r=e[i],a=new g(r.value?i:"");r.listen(function(e){a.update(e?i:"")},t),n.push(a)}else n.push(i)};for(var r in e)i(r);return n},exports.aurumElementModelIdentitiy=D,exports.createAPI=M,exports.createRenderSession=A,exports.dsBuffer=function(e){var t,n=[];return{operationType:exports.OperationType.MAP_DELAY,operation:function(i){return n.push(i),t||(t=new Promise(function(i){setTimeout(function(){t=void 0,i(n),n=[]},e)})),t}}},exports.dsDelay=function(e){return{operationType:exports.OperationType.DELAY,operation:function(t){return new Promise(function(n){setTimeout(function(){n(t)},e)})}}},exports.dsFilter=function(e){return{operationType:exports.OperationType.FILTER,operation:function(t){return e(t)}}},exports.dsMap=function(e){return{operationType:exports.OperationType.MAP,operation:function(t){return e(t)}}},exports.dsPick=function(e){return{operationType:exports.OperationType.MAP,operation:function(t){return null!=t?t[e]:t}}},exports.dsReduce=function(e,t){var n=t;return{operationType:exports.OperationType.MAP,operation:function(t){return n=e(n,t)}}},exports.dsUnique=function(){var e;return{operationType:exports.OperationType.FILTER,operation:function(t){return t!==e&&(e=t,!0)}}},exports.nodeData=O,exports.pendingSessions=N,exports.render=C; | ||
//# sourceMappingURL=aurumjs.js.map |
@@ -1,2 +0,2 @@ | ||
class e{constructor(...e){this.cancelables=null!=e?e:[],this._isCancelled=!1}get isCanceled(){return this._isCancelled}hasCancellables(){return this.cancelables.length>0}addCancelable(e){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.push(e),200===this.cancelables.length&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this}removeCancelable(e){this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled");const t=this.cancelables.indexOf(e);return-1!==t&&this.cancelables.splice(t,1),this}setTimeout(e,t=0){const n=setTimeout(()=>{this.removeCancelable(s),e()},t),s=()=>clearTimeout(n);this.addCancelable(s)}setInterval(e,t){const n=setInterval(e,t);this.addCancelable(()=>clearInterval(n))}requestAnimationFrame(e){const t=requestAnimationFrame(()=>{this.removeCancelable(n),e()}),n=()=>cancelAnimationFrame(t);this.addCancelable(n)}animationLoop(e){let t=requestAnimationFrame(function n(s){e(s),t=requestAnimationFrame(n)});this.addCancelable(()=>cancelAnimationFrame(t))}throwIfCancelled(e){if(this.isCanceled)throw new Error(e||"cancellation token is cancelled")}chain(e,t=!1){return t&&e.chain(this,!1),this.addCancelable(()=>e.cancel()),this}registerDomEvent(e,t,n){return e.addEventListener(t,n),this.addCancelable(()=>e.removeEventListener(t,n)),this}cancel(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(e=>e()),this.cancelables=void 0)}}class t{constructor(){this.subscribeChannel=[],this.subscribeOnceChannel=[],this.onAfterFire=[]}get subscriptions(){return this.subscribeChannel.length+this.subscribeOnceChannel.length}subscribe(e,t){const{facade:n}=this.createSubscription(e,this.subscribeChannel,t);return n}subscribeOnce(e,t){const{facade:n}=this.createSubscription(e,this.subscribeOnceChannel,t);return n}hasSubscriptions(){return this.subscriptions>0}cancelAll(){var e;this.isFiring?this.onAfterFire.push(()=>{var e;this.subscribeChannel.length=0,this.subscribeOnceChannel.length=0,null===(e=this.onEmpty)||void 0===e||e.call(this)}):(this.subscribeChannel.length=0,this.subscribeOnceChannel.length=0,null===(e=this.onEmpty)||void 0===e||e.call(this))}afterFire(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(e=>e()),this.onAfterFire.length=0)}fire(e){this.isFiring=!0;let t=this.subscribeChannel.length;for(let n=0;n<t;n++)try{this.subscribeChannel[n].callback(e)}catch(e){console.error(e)}if(this.subscribeOnceChannel.length>0){t=this.subscribeOnceChannel.length;for(let n=0;n<t;n++)try{this.subscribeOnceChannel[n].callback(e)}catch(e){console.error(e)}this.subscribeOnceChannel.length=0}this.isFiring=!1,this.afterFire()}createSubscription(e,t,n){const s=this,a={callback:e},i={cancel(){s.cancel(a,t)}};return void 0!==n&&n.addCancelable(()=>s.cancel(a,t)),t.push(a),{subscription:a,facade:i}}cancel(e,t){var n;let s=t.indexOf(e);s>=0&&(this.isFiring?this.onAfterFire.push(()=>this.cancel(e,t)):(t.splice(s,1),this.hasSubscriptions()||null===(n=this.onEmpty)||void 0===n||n.call(this)))}}var n,s;!function(e){e[e.FILTER=0]="FILTER",e[e.MAP=1]="MAP",e[e.DELAY=2]="DELAY",e[e.MAP_DELAY=3]="MAP_DELAY"}(n||(n={}));class a{constructor(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new t}static fromMultipleSources(e,t){const n=new a;for(const s of e)s.listen(e=>n.update(e),t);return n}repeatLast(){return this.update(this.value),this}update(e){if(this.primed=!0,this.updating)throw new Error("Problem in data source: Unstable value propagation. When updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=e,this.updateEvent.fire(e),this.updating=!1}withInitial(e){return this.primed||this.update(e),this}listenAndRepeat(e,t){return e(this.value),this.listen(e,t)}listen(e,t){return this.updateEvent.subscribe(e,t).cancel}listenOnce(e,t){return this.updateEvent.subscribeOnce(e,t).cancel}filter(t,n){n=null!=n?n:new e;const s=new i(n);return this.listen(e=>{t(e,s.value)&&s.update(e)},n),s}max(e){return this.filter((e,t)=>"string"==typeof e&&"string"==typeof t?e.localeCompare(t)>0:e>t,e)}min(e){return this.filter((e,t)=>"string"==typeof e&&"string"==typeof t?e.localeCompare(t)<0:e<t,e)}transform(t,s,i,r,o,l,h,d,u,c,p,v){let f;const m=[t,s,i,r,o,l,h,d,u,c,p].filter(t=>!(t&&t instanceof e&&(f=t,1)));v&&(f=v);const w=new a;return this.listen(async function(e){for(const s of m)switch(t.operationType){case n.MAP:e=s.operation(e);break;case n.DELAY:case n.MAP_DELAY:e=await s.operation(e);break;case n.FILTER:if(!s.operation(e))return}w.update(e)},f),w}pipe(e,t){return this.listen(t=>e.update(t),t),this}map(t,n){let s;return n=null!=n?n:new e,s=this.primed?new i(n,t(this.value)):new i(n),this.listen(e=>{s.update(t(e))},n),s}tap(e,t){return this.listen(t=>{e(t)},t),this}loadBalance(e,t){let n=0;this.listen(t=>{e[n++].update(t),n>=e.length&&(n=0)},t)}await(t){t=null!=t?t:new e;const n=new i(t);return(this.primed?this.listenAndRepeat:this.listen).call(this,async function(e){n.update(await e)},t),n}awaitOrdered(t){t=null!=t?t:new e;const n=[],s=new i(t);return(this.primed?this.listenAndRepeat:this.listen).call(this,async function(e){e instanceof Promise?(n.push(e),async function(){for(;n.length;){const e=n[0];s.update(await e),n.shift()}}()):s.update(await e)},t),s}awaitLatest(t){let n;t=null!=t?t:new e;const s=new i(t);return(this.primed?this.listenAndRepeat:this.listen).call(this,async function(e){n=Date.now();const t=n,a=await e;n===t&&s.update(a)},t),s}unique(t){t=null!=t?t:new e;const n=new i(t,this.value);return this.listen(e=>{e!==n.value&&n.update(e)},t),n}diff(t){t=null!=t?t:new e;const n=new i(t,{new:this.value,old:void 0});return this.listen(e=>{n.update({new:e,old:n.value.new})},t),n}reduce(t,n,s){s=null!=s?s:new e;const a=new i(s,n);return this.listen(e=>a.update(t(a.value,e)),s),a}aggregate(t,n,s){s=null!=s?s:new e;const a=new i(s,n(this.value,t.value));return this.listen(()=>a.update(n(this.value,t.value)),s),t.listen(()=>a.update(n(this.value,t.value)),s),a}aggregateThree(t,n,s,a){a=null!=a?a:new e;const r=new i(a,s(this.value,t.value,n.value));return this.listen(()=>r.update(s(this.value,t.value,n.value)),a),t.listen(()=>r.update(s(this.value,t.value,n.value)),a),n.listen(()=>r.update(s(this.value,t.value,n.value)),a),r}aggregateFour(t,n,s,a,r){r=null!=r?r:new e;const o=new i(r,a(this.value,t.value,n.value,s.value));return this.listen(()=>o.update(a(this.value,t.value,n.value,s.value)),r),t.listen(()=>o.update(a(this.value,t.value,n.value,s.value)),r),n.listen(()=>o.update(a(this.value,t.value,n.value,s.value)),r),s.listen(()=>o.update(a(this.value,t.value,n.value,s.value)),r),o}combine(t,n){n=null!=n?n:new e;const s=new i(n);this.pipe(s,n);for(const e of t)e.pipe(s,n);return s}delay(t,n){n=null!=n?n:new e;const s=new i(n,this.value);return this.listen(e=>{setTimeout(()=>{s.update(e)},t)},n),s}skip(t,n){n=null!=n?n:new e;const s=new i(n,this.value);return this.listen(e=>{0===t?s.update(e):t--},n),s}cutoff(t,n){n=null!=n?n:new e;const s=new i(n,this.value);return this.listen(e=>{t-- >0&&s.update(e)},n),s}awaitNextUpdate(e){return new Promise(t=>{this.listenOnce(e=>t(e),e)})}debounce(t,n){n=null!=n?n:new e;const s=new i(n,this.value);let a;return this.listen(e=>{clearTimeout(a),a=setTimeout(()=>{s.update(e)},t)},n),s}throttle(t,n){n=null!=n?n:new e;const s=new i(n,this.value);let a=!1;return this.listen(e=>{a||(s.update(e),a=!0,setTimeout(()=>{a=!1},t))},n),s}buffer(t,n){n=null!=n?n:new e;const s=new i(n);let a,r=[];return this.listen(e=>{r.push(e),a||(a=setTimeout(()=>{a=void 0,s.update(r),r=[]},t))},n),s}accumulate(e){const t=new r;return this.listen(e=>{t.push(e)},e),t}pick(t,n){var s;n=null!=n?n:new e;const a=new i(n,null===(s=this.value)||void 0===s?void 0:s[t]);return this.listen(e=>{a.update(null!=e?e[t]:e)},n),a}cancelAll(){this.updateEvent.cancelAll()}}class i extends a{constructor(e,t){super(t),this.disposeToken=e,this.updateEvent.onEmpty=()=>{e.cancel(),Object.defineProperty(this,"value",{get(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')},set(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')}})}}persist(){return this.updateEvent.onEmpty=void 0,this}listen(e,t){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),super.listen(e,t)}listenAndRepeat(e,t){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),super.listenAndRepeat(e,t)}listenOnce(e,t){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),super.listen(e,t)}}class r{constructor(e){this.data=e?e.slice():[],this.lengthSource=new a(this.data.length),this.updateEvent=new t}listenAndRepeat(e,t){return e({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(e,t)}listen(e,t){return this.updateEvent.subscribe(e,t).cancel}listenOnce(e,t){return this.updateEvent.subscribeOnce(e,t).cancel}awaitNextUpdate(e){return new Promise(t=>{this.listenOnce(e=>t(e),e)})}get length(){return this.lengthSource}getData(){return this.data}get(e){return this.data[e]}set(e,t){const n=this.data[e];n!==t&&(this.data[e]=t,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:e,items:[t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))}swap(e,t){if(e===t)return;const n=this.data[e],s=this.data[t];this.data[t]=n,this.data[e]=s,this.update({operation:"swap",operationDetailed:"swap",index:e,index2:t,items:[n,s],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}swapItems(e,t){if(e===t)return;const n=this.data.indexOf(e),s=this.data.indexOf(t);-1!==n&&-1!==s&&(this.data[s]=e,this.data[n]=t),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:s,items:[e,t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}appendArray(e){this.data=this.data.concat(e),this.update({operation:"add",operationDetailed:"append",count:e.length,index:this.data.length-e.length,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}insertAt(e,...t){0!==t.length&&(this.data.splice(e,0,...t),this.update({operation:"add",operationDetailed:"insert",count:t.length,index:e,items:t,newState:this.data}),this.lengthSource.update(this.data.length))}push(...e){this.appendArray(e)}unshift(...e){this.data.unshift(...e),this.update({operation:"add",operationDetailed:"prepend",count:e.length,items:e,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}pop(){const e=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e}merge(e){const t=this.data;this.data=e.slice(),this.update({operation:"merge",operationDetailed:"merge",previousState:t,index:0,items:this.data,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}removeRight(e){const t=this.data.length,n=this.data.splice(t-e,e);this.update({operation:"remove",operationDetailed:"removeRight",count:e,index:t-e,items:n,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}removeLeft(e){const t=this.data.splice(0,e);this.update({operation:"remove",operationDetailed:"removeLeft",count:e,index:0,items:t,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}remove(e){const t=this.data.indexOf(e);-1!==t&&(this.data.splice(t,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:t,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))}clear(){if(0===this.data.length)return;const e=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:e.length,index:0,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}shift(){const e=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[e],count:1,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e}toArray(){return this.data.slice()}sort(t,n=[],s){const a=new l(this,t,s),i=new e;return s&&s.addCancelable(()=>i.cancel()),n.forEach(e=>{e.listen(()=>a.refresh())},i),a}map(e,t=[],n){const s=new o(this,e,n);return t.forEach(e=>{e.listen(()=>s.refresh())},n),s}filter(e,t=[],n){const s=new h(this,e,n);return t.forEach(e=>{e.listen(()=>s.refresh(),n)}),s}forEach(e){return this.data.forEach(e)}update(e){this.updateEvent.fire(e)}}class o extends r{constructor(t,n,s=new e){super(t.getData().map(n)),this.parent=t,this.mapper=n,t.listen(e=>{switch(e.operationDetailed){case"removeLeft":this.removeLeft(e.count);break;case"removeRight":this.removeRight(e.count);break;case"remove":this.remove(this.data[e.index]);break;case"clear":this.clear();break;case"prepend":this.unshift(...e.items.map(this.mapper));break;case"append":this.appendArray(e.items.map(this.mapper));break;case"insert":this.insertAt(e.index,...e.items.map(this.mapper));break;case"swap":this.swap(e.index,e.index2);break;case"replace":this.set(e.index,this.mapper(e.items[0]));break;case"merge":const t=this.data.slice(),n=e.previousState.slice();for(let t=0;t<e.newState.length;t++)if(this.data.length<=t&&this.data.push(this.mapper(e.newState[t])),n[t]!==e.newState[t]){const s=n.indexOf(e.newState[t]);if(-1!==s){const e=this.data[t];this.data[t]=this.data[s],this.data[s]=e;const a=n[t];n[t]=n[s],n[s]=a}else this.data.splice(t,0,this.mapper(e.newState[t])),n.splice(t,0,e.newState[t])}this.data.length>e.newState.length&&(this.data.length=e.newState.length),this.update({operation:"merge",operationDetailed:"merge",previousState:t,index:0,items:this.data,newState:this.data})}},s)}refresh(){this.merge(this.parent.data.map(this.mapper))}}class l extends r{constructor(t,n,s=new e){super(t.getData().slice().sort(n)),this.parent=t,this.comparator=n,t.listen(e=>{switch(e.operationDetailed){case"removeLeft":case"removeRight":for(const t of e.items)this.remove(t);break;case"remove":this.remove(e.items[0]);break;case"clear":this.clear();break;case"prepend":this.unshift(...e.items),this.data.sort(this.comparator);break;case"append":case"insert":this.appendSorted(e.items);break;case"merge":this.merge(e.items.slice().sort(this.comparator));break;case"swap":break;case"replace":this.remove(e.target),this.appendSorted(e.items)}},s)}appendSorted(e){this.merge(this.data.concat(e).sort(this.comparator))}refresh(){this.merge(this.parent.getData().slice().sort(this.comparator))}}class h extends r{constructor(t,n,s=new e){Array.isArray(t)&&(t=new r(t)),super(t.data.filter(n=null!=n?n:()=>!0)),this.parent=t,this.viewFilter=n,t.listen(e=>{let t;switch(e.operationDetailed){case"clear":this.clear();break;case"removeLeft":case"removeRight":case"remove":for(const t of e.items)this.remove(t);break;case"prepend":t=e.items.filter(this.viewFilter),this.unshift(...t);break;case"append":t=e.items.filter(this.viewFilter),this.appendArray(t);break;case"insert":t=e.items.filter(this.viewFilter),this.insertAt(e.index,...t);break;case"merge":this.merge(e.items.filter(this.viewFilter));break;case"swap":const n=this.data.indexOf(e.items[0]),s=this.data.indexOf(e.items[1]);-1!==n&&-1!==s&&this.swap(n,s);break;case"replace":const a=this.data.indexOf(e.target);-1!==a&&(this.viewFilter(e.items[0])?this.set(a,e.items[0]):this.remove(e.target))}},s)}updateFilter(e){if(this.viewFilter!==e)return this.viewFilter=e,this.refresh(),this.data.length}refresh(){this.merge(this.parent.data.filter(this.viewFilter))}}!function(e){e[e.UPSTREAM=0]="UPSTREAM",e[e.DOWNSTREAM=1]="DOWNSTREAM"}(s||(s={}));class d{constructor(e,n=!0){this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new t,this.updateUpstreamEvent=new t,this.propagateWritesToReadStream=n}static fromTwoDataSource(e,t,n,s=!0){const a=new d(n,s);return a.updateDownstreamEvent=e.updateEvent,a.updateUpstreamEvent=t.updateEvent,a}withInitial(e){return this.primed||this.updateDownstream(e),this}static createOneWay(e=s.DOWNSTREAM,t){return new d(t,!1).oneWayFlow(e)}updateDownstream(e){if(this.updatingDownstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingDownstream=!0,this.value=e,this.updateDownstreamEvent.fire(e),this.updatingDownstream=!1}updateUpstream(e){if(this.updatingUpstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingUpstream=!0,this.value=e,this.updateUpstreamEvent.fire(e),this.propagateWritesToReadStream&&this.updateDownstreamEvent.fire(e),this.updatingUpstream=!1}listenAndRepeat(e,t){return e(this.value),this.listen(e,t)}listen(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel}listenUpstream(e,t){return this.updateUpstreamEvent.subscribe(e,t).cancel}listenUpstreamOnce(e,t){return this.updateUpstreamEvent.subscribeOnce(e,t).cancel}listenDownstream(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel}downStreamToDataSource(e){const t=new a(this.value);return this.listenDownstream(e=>{t.update(e)},e),t}aggregate(t,n,s){s=null!=s?s:new e;const a=new i(s,n(this.value,t.value));return this.listen(()=>a.update(n(this.value,t.value)),s),t.listen(()=>a.update(n(this.value,t.value)),s),a}aggregateThree(t,n,s,a){a=null!=a?a:new e;const r=new i(a,s(this.value,t.value,n.value));return this.listen(()=>r.update(s(this.value,t.value,n.value)),a),t.listen(()=>r.update(s(this.value,t.value,n.value)),a),n.listen(()=>r.update(s(this.value,t.value,n.value)),a),r}aggregateFour(t,n,s,a,r){r=null!=r?r:new e;const o=new i(r,a(this.value,t.value,n.value,s.value));return this.listen(()=>o.update(a(this.value,t.value,n.value,s.value)),r),t.listen(()=>o.update(a(this.value,t.value,n.value,s.value)),r),n.listen(()=>o.update(a(this.value,t.value,n.value,s.value)),r),s.listen(()=>o.update(a(this.value,t.value,n.value,s.value)),r),o}filter(e,t,n){if("function"==typeof t){const s=new d(void 0,!1);return this.listenDownstream(t=>{e(t,s.value)&&s.updateDownstream(t)},n),s.listenUpstream(e=>{t(e,this.value)&&this.updateUpstream(e)},n),s}{const n=new a;return this.listenDownstream(t=>{e(t,n.value)&&n.update(t)},t),n}}pipe(e,t){return this.listenDownstream(t=>e.updateDownstream(t),t),e.listenUpstream(e=>this.updateUpstream(e),t),this}map(e,t,n){if("function"==typeof t){let s;return s=new d(this.primed?e(this.value):void 0,!1),this.listenDownstream(t=>s.updateDownstream(e(t)),n),s.listenUpstream(e=>this.updateUpstream(t(e)),n),s}{let n;return n=this.primed?new a(e(this.value)):new a,this.listenDownstream(t=>n.update(e(t)),t),n}}listenOnce(e,t){return this.updateDownstreamEvent.subscribeOnce(e,t).cancel}awaitNextUpdate(e){return new Promise(t=>{this.listenOnce(e=>t(e),e)})}debounceUpstream(e,t){const n=new d(this.value);let s;return n.listenUpstream(t=>{clearTimeout(s),s=setTimeout(()=>{this.updateUpstream(t)},e)},t),this.listenDownstream(e=>{n.updateDownstream(e)},t),n}debounceDownstream(e,t){const n=new d(this.value);let s;return this.listenDownstream(t=>{clearTimeout(s),s=setTimeout(()=>{n.updateDownstream(t)},e)},t),n.listenUpstream(e=>{this.updateUpstream(e)},t),n}diff(t){t=null!=t?t:new e;const n=new i(t,{new:this.value,old:void 0});return this.listen(e=>{n.update({new:e,old:n.value.new})},t),n}await(t){t=null!=t?t:new e;const n=new d(void 0,!1);return(this.primed?this.listenAndRepeat:this.listen).call(this,async function(e){n.updateDownstream(await e)},t),this.listenUpstream(async function(e){n.updateUpstream(await e)},t),n}awaitLatest(e){throw new Error("not implemented")}awaitOrdered(e){throw new Error("not implemented")}unique(e){const t=new d(this.value,!1);let n=this.value,s=this.value;return this.listenDownstream(e=>{s!==e&&(s=e,t.updateDownstream(e))},e),t.listenUpstream(e=>{n!==e&&(n=e,this.updateUpstream(e))},e),t}oneWayFlow(e=s.DOWNSTREAM,t){const n=new d(this.value,!1);return e===s.DOWNSTREAM?(this.listenDownstream(e=>n.updateDownstream(e),t),n.updateUpstream=()=>{}):(n.listenUpstream(e=>this.updateUpstream(e)),n.updateDownstream=()=>{}),n}reduce(e,t,n){const s=new a(t);return this.listen(t=>s.update(e(s.value,t)),n),s}cancelAll(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()}}function u(e,t){const n=[];for(const s in e)if(e[s])if(e[s]instanceof a||e[s]instanceof d){const i=e[s],r=new a(i.value?s:"");i.listen(e=>{r.update(e?s:"")},t),n.push(r)}else n.push(s);return n}function c(){const t={attachCalls:[],sessionToken:new e(()=>{for(const e of t.tokens)e.cancel()}),tokens:[]};return t}const p=Symbol("AurumElementModel"),v=new WeakMap;class f{constructor(e,t){this.children=[],this.api=t,this.api.onAttach(()=>{if(void 0===this.hostNode)throw new Error("illegal state: Attach fired but not actually attached");this.render(e)})}dispose(){this.clearContent()}attachToDom(e,t){if(this.hostNode)throw new Error("Aurum Element is already attached");const n=f.id++;this.hostNode=e,this.contentStartMarker=document.createComment("START Aurum Node "+n),this.contentEndMarker=document.createComment("END Aurum Node "+n),t>=e.childNodes.length?(e.appendChild(this.contentStartMarker),e.appendChild(this.contentEndMarker)):(e.insertBefore(this.contentStartMarker,e.childNodes[t]),e.insertBefore(this.contentEndMarker,e.childNodes[t+1]))}getWorkIndex(){if(void 0!==this.lastStartIndex&&this.hostNode.childNodes[this.lastStartIndex]===this.contentStartMarker)return this.lastStartIndex+1;for(let e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentStartMarker)return this.lastStartIndex=e,e+1}getLastIndex(){if(void 0!==this.lastEndIndex&&this.hostNode.childNodes[this.lastEndIndex]===this.contentEndMarker)return this.lastEndIndex;for(let e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentEndMarker)return this.lastEndIndex=e,e}clearContent(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");const e=this.getWorkIndex();for(;this.hostNode.childNodes[e]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[e])}updateDom(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");const e=this.getWorkIndex();let t,n=0;for(t=0;t<this.children.length;t++){const s=this.children[t];if(s instanceof f)n+=s.getLastIndex()-t-n-e;else if(this.hostNode.childNodes[t+e+n]!==this.contentEndMarker&&this.hostNode.childNodes[t+e+n]!==this.children[t]){if(!(s instanceof HTMLElement||s instanceof Text))throw new Error("not implemented");this.hostNode.removeChild(this.hostNode.childNodes[t+e+n]),this.hostNode.childNodes[t+e+n]?this.hostNode.insertBefore(s,this.hostNode.childNodes[t+e+n]):this.hostNode.appendChild(s)}else{if(!(s instanceof HTMLElement||s instanceof Text))throw new Error("not implemented");this.hostNode.childNodes[t+e+n]?this.hostNode.insertBefore(s,this.hostNode.childNodes[t+e+n]):this.hostNode.appendChild(s)}}for(;this.hostNode.childNodes[t+e+n]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[t+e+n])}}function m(e,t,n=!1){if(null!=e){if(w.has(e)){const n=w.get(e);n.sessionToken&&(t.attachCalls.push(...n.attachCalls),t.sessionToken.chain(n.sessionToken),n.attachCalls=void 0,n.sessionToken=void 0),w.delete(e)}if(Array.isArray(e))return Array.prototype.concat.apply([],e.map(e=>m(e,t,n)));if(!n){if(e instanceof Promise){const n=new a;return e.then(e=>{n.update(e)}),new E(n,g(t))}if(e instanceof a||e instanceof d)return new E(e,g(t));if(e instanceof r)return new y(e,g(t));const n=typeof e;if("string"===n||"number"===n||"bigint"===n||"boolean"===n)return document.createTextNode(e.toString())}return e[p]?m(e.factory(e.props||{},e.children,g(t)),t,n):e}}f.id=1;const w=new WeakMap;function g(t){let n=void 0;const s={renderSession:t,onAttach:e=>{t.attachCalls.push(e)},onDetach:s=>{n||(n=new e,t.tokens.push(n)),n.addCancelable(s)},onError:e=>{throw new Error("not implemented")},get cancellationToken(){return n||(n=new e,t.tokens.push(n)),n},prerender(e){const t=c(),n=m(e,t,!0);if(Array.isArray(n))for(const e of n)"object"==typeof e&&w.set(e,t);else w.set(n,t);return n},get style(){return function(e,...t){const n=new a;for(const i of t)(i instanceof a||i instanceof d)&&i.listen(()=>n.update(b(e,t)),s.cancellationToken);return n.update(b(e,t)),n}}};return s}function b(e,t){let n="";for(let s=0;s<e.length;s++)n+=e[s],t[s]&&(n+="string"==typeof t[s]?t[s]:t[s].value);return n}class y extends f{constructor(e,t){super(e,t),this.renderSessions=new WeakMap,this.dataSource=e}attachToDom(e,t){super.attachToDom(e,t),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource}render(e){e.listenAndRepeat(e=>{this.handleNewContent(e),this.updateDom()},this.api.cancellationToken)}spliceChildren(e,t,n){let s;s=n?this.children.splice(e,t,n):this.children.splice(e,t);for(const e of s)this.renderSessions.get(e).sessionToken.cancel()}handleNewContent(e){switch(e.operationDetailed){case"merge":const t=e.previousState.slice();for(let n=0;n<e.newState.length;n++)if(this.children.length<=n&&this.children.push(this.renderItem(e.newState[n])),t[n]!==e.newState[n]){const s=t.indexOf(e.newState[n]);if(-1!==s){const e=this.children[n];this.children[n]=this.children[s],this.children[s]=e;const a=t[n];t[n]=t[s],t[s]=a}else this.spliceChildren(n,0,this.renderItem(e.newState[n])),t.splice(n,0,e.newState[n])}this.children.length>e.newState.length&&(this.children.length=e.newState.length);break;case"remove":case"removeLeft":case"removeRight":this.spliceChildren(e.index,e.count);break;case"append":for(const t of e.items){const e=this.renderItem(t);Array.isArray(e)?this.children=this.children.concat(e):this.children.push(e)}break;case"replace":const n=this.renderItem(e.items[0]);if(Array.isArray(n))throw new Error("illegal state");this.children[e.index]=n;break;case"swap":const s=this.children[e.index2];this.children[e.index2]=this.children[e.index],this.children[e.index]=s;break;case"prepend":for(const t of e.items){const e=this.renderItem(t);if(Array.isArray(e))throw new Error("illegal state");this.children.unshift(e)}break;case"insert":let a=e.index;for(const t of e.items){const e=this.renderItem(t);if(Array.isArray(e))throw new Error("illegal state");this.children.splice(a,0,e),a+=1}break;case"remove":for(const t of e.items){const e=this.renderItem(t);if(Array.isArray(e))throw new Error("illegal state");this.children.unshift(e)}break;case"clear":this.children.length=0,this.renderSessions=new WeakMap;break;default:throw new Error("not implemented")}this.updateDom()}renderItem(e){const t=c(),n=m(e,t);for(const e of t.attachCalls)e();return this.renderSessions.set(n,t),n}}class E extends f{constructor(e,t){super(e,t),this.api.cancellationToken.addCancelable(()=>{var e;return null===(e=this.renderSession)||void 0===e?void 0:e.sessionToken.cancel()}),this.dataSource=e}attachToDom(e,t){super.attachToDom(e,t),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource}render(e){e.listenAndRepeat(e=>{this.handleNewContent(e),this.updateDom()},this.api.cancellationToken)}handleNewContent(e){if(this.lastValue===e)return;let t=!1;if(1===this.children.length&&this.children[0]instanceof Text){const n=typeof e;"string"!==n&&"bigint"!==n&&"number"!==n||(this.children[0].nodeValue=e,t=!0)}t||this.fullRebuild(e),this.lastValue=e}fullRebuild(e){this.clearContent(),this.endSession(),this.renderSession=c();let t=m(e,this.renderSession);if(void 0!==t){Array.isArray(t)||(t=[t]);for(const e of t)e instanceof f&&e.attachToDom(this.hostNode,this.getLastIndex());for(const e of this.renderSession.attachCalls)e();Array.isArray(t)&&(this.children=t)}else this.children=[]}endSession(){this.renderSession&&(this.renderSession.sessionToken.cancel(),this.renderSession=void 0)}}const k={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},A=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function S(e,t,n,s){return function(i,r,o){const l=document.createElement(e);i&&function(e,t,n,s,i){D(e,k,t),i&&D(e,i,t);const r=Object.keys(t).filter(e=>e.includes("-"));x(e,A,t,r),s&&x(e,s,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof a||t instanceof d)t.value&&(Array.isArray(t.value)?(e.className=t.value.join(" "),t.unique(n).listen(()=>{e.className=t.value.join(" ")})):(e.className=t.value,t.unique(n).listen(()=>{e.className=t.value}))),t.unique(n).listen(t=>e.className=t);else{const s=t.reduce((e,t)=>"string"==typeof t?`${e} ${t}`:t.value?`${e} ${t.value}`:e,"");e.className=s;for(const s of t)s instanceof a&&s.unique(n).listen(n=>{const s=t.reduce((e,t)=>"string"==typeof t?`${e} ${t}`:t.value?`${e} ${t.value}`:e,"");e.className=s})}}(e,t.class,n)}(l,i,o.cancellationToken,t,n);const h=m(r,o.renderSession);return function e(t,n){if(null!=n)if(Array.isArray(n))for(const s of n)e(t,s);else if(n instanceof f)n.attachToDom(t,t.childNodes.length);else{if(!(n instanceof HTMLElement||n instanceof Text))throw new Error("Unexpected child type passed to DOM Node: "+n);t.appendChild(n)}}(l,h),i.onAttach&&o.onAttach(()=>i.onAttach(l)),i.onDetach&&o.onDetach(()=>{l.isConnected&&l.parentElement.removeChild(l),i.onDetach(l)}),null==s||s(l,i,o.cancellationToken),l}}function D(e,t,n){for(const s in t)n[t[s]]&&(n[t[s]]instanceof a?e.addEventListener(s,e=>n[t[s]].update(e)):n[t[s]]instanceof d?e.addEventListener(s,e=>n[t[s]].updateDownstream(e)):"function"==typeof n[t[s]]&&e.addEventListener(s,e=>n[t[s]](e)))}function x(e,t,n,s){for(const s of t)n[s]&&C(e,n[s],s);if(s)for(const t of s)n[t]&&C(e,n[t],t)}function C(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof a||t instanceof d))throw new Error("Attributes only support types boolean, string, number and data sources");"string"==typeof t.value?e.setAttribute(n,t.value):"boolean"==typeof t.value&&t.value&&e.setAttribute(n,""),t.unique().listen(t=>{"string"==typeof t?e.setAttribute(n,t):"boolean"==typeof t&&(t?e.setAttribute(n,""):e.removeAttribute(n))})}}const O=S("input",["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],{input:"onInput",change:"onChange"},(e,t,n)=>{const s=e;t.value&&(t.value instanceof a?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("input",()=>{t.value.update(s.value)})):t.value instanceof d?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("input",()=>{t.value.updateUpstream(s.value)})):s.value=t.value),t.checked&&(t.checked instanceof a?(t.checked.listenAndRepeat(e=>{s.checked=e},n),s.addEventListener("change",()=>{t.checked.update(s.checked)})):t.checked instanceof d?(t.checked.listenAndRepeat(e=>{s.checked=e},n),s.addEventListener("change",()=>{t.checked.updateUpstream(s.checked)})):s.checked=t.checked)}),T=S("select",void 0,{change:"onChange"},(e,t,n)=>{const s=e;t.value&&(t.value instanceof a?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("change",()=>{t.value.update(s.value)})):t.value instanceof d?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("change",()=>{t.value.updateUpstream(s.value)})):s.value=t.value),t.selectedIndex&&(t.selectedIndex instanceof a?(t.selectedIndex.listenAndRepeat(e=>{s.selectedIndex=e},n),s.addEventListener("change",()=>{t.selectedIndex.update(s.selectedIndex)})):t.selectedIndex instanceof d?(t.selectedIndex.listenAndRepeat(e=>{s.selectedIndex=e},n),s.addEventListener("change",()=>{t.selectedIndex.updateUpstream(s.selectedIndex)})):s.selectedIndex=t.selectedIndex)}),N=S("code"),M=S("div"),L=S("a",["href","target"]),R=S("abbr"),I=S("h1"),U=S("h2"),F=S("h3"),K=S("h4"),V=S("h5"),P=S("h6"),q=S("area",["alt","coors"]),W=S("article"),j=S("aside"),$=S("span"),B=S("noscript"),Y=S("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),_=S("ul"),H=S("ol"),z=S("li"),G=S("tr"),J=S("b"),Q=S("title"),X=S("summary"),Z=S("thead"),ee=S("template"),te=S("q"),ne=S("pre"),se=S("p"),ae=S("hr"),ie=S("audio",["controls","autoplay","loop","muted","preload","src"]),re=S("br"),oe=S("button",["disabled"]),le=S("canvas",["width","height"]),he=S("data",["value"]),de=S("details"),ue=S("em"),ce=S("footer"),pe=S("form"),ve=S("head"),fe=S("header"),me=S("heading"),we=S("i"),ge=S("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),be=S("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),ye=S("label",["for"]),Ee=S("link",["href","rel","media","as","disabled","type"]),ke=S("nav"),Ae=S("sub"),Se=S("sup"),De=S("table"),xe=S("tbody"),Ce=S("tfoot"),Oe=S("td"),Te=S("th"),Ne=S("time",["datetime"]),Me=S("style",["media"]),Le=S("source",["src","srcSet","media","sizes","type"]),Re=S("script",["src","async","defer","integrity","noModule","type"]),Ie=S("svg",["width","height"]),Ue=S("progress",["max","value"]),Fe=S("option",["value"]),Ke=S("slot",["name"]),Ve={button:oe,code:N,hr:ae,div:M,input:O,li:z,span:$,style:Me,ul:_,p:se,img:be,link:Ee,canvas:le,a:L,article:W,br:re,form:pe,label:ye,ol:H,pre:ne,progress:Ue,table:De,td:Oe,tr:G,th:Te,textarea:S("textArea",["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],{input:"onInput",change:"onChange"},(e,t,n)=>{const s=e;t.value&&(t.value instanceof a?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("input",()=>{t.value.update(s.value)})):t.value instanceof d?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("input",()=>{t.value.updateUpstream(s.value)})):s.value=t.value)}),h1:I,h2:U,h3:F,h4:K,h5:V,h6:P,head:ve,header:fe,footer:ce,nav:ke,b:J,i:we,script:Re,abbr:R,area:q,aside:j,audio:ie,em:ue,heading:me,iframe:ge,noscript:B,option:Fe,q:te,select:T,source:Le,title:Q,video:Y,tbody:xe,tfoot:Ce,thead:Z,summary:X,details:de,sub:Ae,sup:Se,svg:Ie,data:he,time:Ne,template:ee,slot:Ke};class Pe{static attach(e,t){const n=c(),s=m(e,n);if(s instanceof f)s.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(()=>s.dispose());else if(Array.isArray(s)){const e=new y(new r(s),g(n));n.sessionToken.addCancelable(()=>e.dispose()),e.attachToDom(t,t.childNodes.length)}else t.appendChild(s),n.sessionToken.addCancelable(()=>{t.removeChild(s)});for(let e=n.attachCalls.length-1;e>=0;e--)n.attachCalls[e]();return n.sessionToken}static factory(e,t,...n){let s;if("string"==typeof e){s=e;const t=e;if(void 0===(e=Ve[e]))throw new Error(`Node ${t} does not exist or is not supported`)}return{[p]:!0,name:s,factory:e,props:t,children:n}}}function qe(e,t){return customElements.define(e.name,class extends HTMLElement{constructor(){super(),void 0===e.observedAttributes&&(e.observedAttributes=[]),this.props={};for(const t of e.observedAttributes)this.props[t]=new a}static get observedAttributes(){return e.observedAttributes}attributeChangedCallback(e,t,n){t!==n&&this.props[e].update(n)}connectedCallback(){var n;const s=document.createDocumentFragment();this.session=c(),this.api=g(this.session);const a=t(this.props,this.api);for(const e of this.session.attachCalls)e();Pe.attach(a,s),this.attachShadow({mode:null!==(n=e.shadowRootMode)&&void 0!==n?n:"open",delegatesFocus:e.shadowRootDelegatesFocus}).appendChild(s)}disconnectedCallback(){this.session.sessionToken.cancel()}}),S(e.name,e.observedAttributes,void 0,(e,t)=>{for(const n in t)n in e.props||(e.props[n]=t[n])})}function We(e,t,n){if((t=[].concat.apply([],t.filter(e=>!!e))).some(e=>!e[p]||!(e.factory===$e||e.factory===Be)))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(e=>e.factory===Be).length>1)throw new Error("Too many default routes only 0 or 1 allowed");const s=new a(je());return n.cancellationToken.registerDomEvent(window,"hashchange",()=>{s.update(je())}),s.unique(n.cancellationToken).withInitial(s.value).map(e=>function(e,t){var n,s;if(null==e)return null===(n=t.find(e=>e.factory===Be))||void 0===n?void 0:n.children;if(t.find(t=>{var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return t.find(t=>{var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children;{const n=e.split("/");for(n.pop();n.length;){const e=n.join("/");if(t.find(t=>{var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return t.find(t=>{var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children;n.pop()}return null===(s=t.find(e=>e.factory===Be))||void 0===s?void 0:s.children}}(e,t))}function je(){const e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function $e(e,t){}function Be(e,t){}function Ye(t,n,s){const i=new a(null==t?void 0:t.fallback),r=new e;return s.onDetach(()=>{r.cancel()}),Promise.all(s.prerender(n,r)).then(e=>{r.isCanceled||i.update(e)},e=>(r.cancel(),Promise.reject(e))),i}function _e(t,n,s){if((n=[].concat.apply([],n.filter(e=>!!e))).some(e=>!e[p]||!(e.factory===He||e.factory===ze)))throw new Error("Switch only accepts SwitchCase as children");if(n.filter(e=>e.factory===ze).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");const a=new e;return s.onDetach(()=>{a.cancel()}),t.state.unique(a).withInitial(t.state.value).map(e=>function(e,t){var n,s,a;return null!==(s=null===(n=t.find(t=>{var n;return(null===(n=t.props)||void 0===n?void 0:n.when)===e}))||void 0===n?void 0:n.children)&&void 0!==s?s:null===(a=t.find(e=>e.factory===ze))||void 0===a?void 0:a.children}(e,n))}function He(e,t){}function ze(e,t){}class Ge{constructor(e){e&&(this.data=e),this.updateEvent=new t,this.updateEventOnKey=new Map}pick(e,t){var n;const s=new a(null===(n=this.data)||void 0===n?void 0:n[e]);return this.listenOnKey(e,e=>{s.update(e.newValue)},t),s}listen(e,t){return this.updateEvent.subscribe(e,t).cancel}listenOnKeyAndRepeat(e,t,n){return t({key:e,newValue:this.data[e],oldValue:void 0}),this.listenOnKey(e,t,n)}listenOnKey(e,n,s){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new t),this.updateEventOnKey.get(e).subscribe(n,s).cancel}keys(){return Object.keys(this.data)}values(){return Object.values(this.data)}get(e){return this.data[e]}delete(e){const t=this.data[e];delete this.data[e],this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})}set(e,t){if(this.data[e]===t)return;const n=this.data[e];this.data[e]=t,this.updateEvent.fire({oldValue:n,key:e,newValue:this.data[e]}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data[e]})}assign(e){if(e instanceof Ge)for(const t of e.keys())this.set(t,e.data[t]);else for(const t of Object.keys(e))this.set(t,e[t])}toObject(){return Object.assign({},this.data)}toDataSource(){const e=new a(this.data);return this.listen(t=>{e.update(this.data)}),e}}class Je{constructor(e){e&&(this.data=e),this.updateEvent=new t,this.updateEventOnKey=new Map}pick(e,t){const n=new a(this.data.get(e));return this.listenOnKey(e,e=>{n.update(e.newValue)},t),n}listen(e,t){return this.updateEvent.subscribe(e,t).cancel}listenOnKeyAndRepeat(e,t,n){return t({key:e,newValue:this.data.get(e),oldValue:void 0}),this.listenOnKey(e,t,n)}listenOnKey(e,n,s){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new t),this.updateEventOnKey.get(e).subscribe(n,s).cancel}keys(){return this.data.keys()}values(){return this.data.values()}get(e){return this.data.get(e)}has(e){return this.data.has(e)}delete(e){const t=this.data.get(e);this.data.delete(e),this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})}set(e,t){if(this.data.get(e)===t)return;const n=this.data.get(e);this.data.set(e,t),this.updateEvent.fire({oldValue:n,key:e,newValue:this.data.get(e)}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data.get(e)})}assign(e){for(const t of e.keys())this.set(t,e.get(t))}toMap(){return new Map(this.data.entries())}}class Qe{constructor(e){e&&(this.data=e),this.updateEvent=new t,this.updateEventOnKey=new Map}pick(e,t){const n=new a(this.data.has(e));return this.listenOnKey(e,e=>{n.update(e)},t),n}listen(e,t){return this.updateEvent.subscribe(e,t).cancel}listenOnKeyAndRepeat(e,t,n){return t(this.has(e)),this.listenOnKey(e,t,n)}listenOnKey(e,n,s){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new t),this.updateEventOnKey.get(e).subscribe(n,s).cancel}keys(){return this.data.keys()}has(e){return this.data.has(e)}delete(e){this.data.delete(e),this.updateEvent.fire({key:e,exists:!1}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!1)}add(e){this.data.has(e)||(this.data.add(e),this.updateEvent.fire({key:e,exists:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!0))}assign(e){for(const t of e.keys())this.add(t)}toSet(){return new Set(this.data.keys())}}class Xe{constructor(e,t){this.input=null!=e?e:new a,this.output=null!=t?t:this.input}get value(){return this.output.value}update(e){this.input.update(e)}listen(e,t){return this.output.listen(e,t)}listenAndRepeat(e,t){return this.output.listenAndRepeat(e,t)}listenOnce(e,t){return this.output.listenOnce(e,t)}filter(e,t){return new Xe(this.input,this.output.filter(e,t))}unique(e){return new Xe(this.input,this.output.unique(e))}map(e,t){return new Xe(this.input,this.output.map(e,t))}reduce(e,t,n){return new Xe(this.input,this.output.reduce(e,t,n))}awaitNextUpdate(e){return this.output.awaitNextUpdate(e)}await(e){return new Xe(this.input,this.output.await(e))}awaitLatest(e){return new Xe(this.input,this.output.awaitLatest(e))}awaitOrdered(e){return new Xe(this.input,this.output.awaitOrdered(e))}cancelAll(){this.input.cancelAll(),this.output.cancelAll()}}export{y as ArrayAurumElement,r as ArrayDataSource,Pe as Aurum,f as AurumElement,We as AurumRouter,e as CancellationToken,s as DataFlow,a as DataSource,Be as DefaultRoute,ze as DefaultSwitchCase,d as DuplexDataSource,t as EventEmitter,h as FilteredArrayView,Je as MapDataSource,o as MappedArrayView,Ge as ObjectDataSource,$e as Route,Qe as SetDataSource,E as SingularAurumElement,l as SortedArrayView,Xe as Stream,Ye as Suspense,_e as Switch,He as SwitchCase,i as TransientDataSource,qe as Webcomponent,u as aurumClassName,p as aurumElementModelIdentitiy,g as createAPI,c as createRenderSession,v as nodeData,w as pendingSessions,m as render}; | ||
class e{constructor(...e){this.cancelables=null!=e?e:[],this._isCancelled=!1}get isCanceled(){return this._isCancelled}hasCancellables(){return this.cancelables.length>0}addCancelable(e){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.push(e),200===this.cancelables.length&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this}removeCancelable(e){this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled");const t=this.cancelables.indexOf(e);return-1!==t&&this.cancelables.splice(t,1),this}setTimeout(e,t=0){const n=setTimeout(()=>{this.removeCancelable(s),e()},t),s=()=>clearTimeout(n);this.addCancelable(s)}setInterval(e,t){const n=setInterval(e,t);this.addCancelable(()=>clearInterval(n))}requestAnimationFrame(e){const t=requestAnimationFrame(()=>{this.removeCancelable(n),e()}),n=()=>cancelAnimationFrame(t);this.addCancelable(n)}animationLoop(e){let t=requestAnimationFrame(function n(s){e(s),t=requestAnimationFrame(n)});this.addCancelable(()=>cancelAnimationFrame(t))}throwIfCancelled(e){if(this.isCanceled)throw new Error(e||"cancellation token is cancelled")}chain(e,t=!1){return t&&e.chain(this,!1),this.addCancelable(()=>e.cancel()),this}registerDomEvent(e,t,n){return e.addEventListener(t,n),this.addCancelable(()=>e.removeEventListener(t,n)),this}cancel(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(e=>e()),this.cancelables=void 0)}}class t{constructor(){this.subscribeChannel=[],this.subscribeOnceChannel=[],this.onAfterFire=[]}get subscriptions(){return this.subscribeChannel.length+this.subscribeOnceChannel.length}subscribe(e,t){const{facade:n}=this.createSubscription(e,this.subscribeChannel,t);return n}subscribeOnce(e,t){const{facade:n}=this.createSubscription(e,this.subscribeOnceChannel,t);return n}hasSubscriptions(){return this.subscriptions>0}cancelAll(){var e;this.isFiring?this.onAfterFire.push(()=>{var e;this.subscribeChannel.length=0,this.subscribeOnceChannel.length=0,null===(e=this.onEmpty)||void 0===e||e.call(this)}):(this.subscribeChannel.length=0,this.subscribeOnceChannel.length=0,null===(e=this.onEmpty)||void 0===e||e.call(this))}afterFire(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(e=>e()),this.onAfterFire.length=0)}fire(e){this.isFiring=!0;let t=this.subscribeChannel.length;for(let n=0;n<t;n++)try{this.subscribeChannel[n].callback(e)}catch(e){console.error(e)}if(this.subscribeOnceChannel.length>0){t=this.subscribeOnceChannel.length;for(let n=0;n<t;n++)try{this.subscribeOnceChannel[n].callback(e)}catch(e){console.error(e)}this.subscribeOnceChannel.length=0}this.isFiring=!1,this.afterFire()}createSubscription(e,t,n){const s=this,a={callback:e},i={cancel(){s.cancel(a,t)}};return void 0!==n&&n.addCancelable(()=>s.cancel(a,t)),t.push(a),{subscription:a,facade:i}}cancel(e,t){var n;let s=t.indexOf(e);s>=0&&(this.isFiring?this.onAfterFire.push(()=>this.cancel(e,t)):(t.splice(s,1),this.hasSubscriptions()||null===(n=this.onEmpty)||void 0===n||n.call(this)))}}var n,s;function a(e){return{operationType:n.MAP,operation:t=>e(t)}}function i(e){return{operationType:n.FILTER,operation:t=>e(t)}}function r(){let e;return{operationType:n.FILTER,operation:t=>t!==e&&(e=t,!0)}}function o(e,t){let s=t;return{operationType:n.MAP,operation:t=>(s=e(s,t),s)}}function l(e){return{operationType:n.DELAY,operation:t=>new Promise(n=>{setTimeout(()=>{n(t)},e)})}}function h(e){let t,s=[];return{operationType:n.MAP_DELAY,operation:n=>(s.push(n),t||(t=new Promise(n=>{setTimeout(()=>{t=void 0,n(s),s=[]},e)})),t)}}function d(e){return{operationType:n.MAP,operation:t=>null!=t?t[e]:t}}!function(e){e[e.FILTER=0]="FILTER",e[e.MAP=1]="MAP",e[e.DELAY=2]="DELAY",e[e.MAP_DELAY=3]="MAP_DELAY"}(n||(n={}));class u{constructor(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new t}static fromMultipleSources(e,t){const n=new u;for(const s of e)s.listen(e=>n.update(e),t);return n}repeatLast(){return this.update(this.value),this}update(e){if(this.primed=!0,this.updating)throw new Error("Problem in data source: Unstable value propagation. When updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=e,this.updateEvent.fire(e),this.updating=!1}withInitial(e){return this.primed||this.update(e),this}listenAndRepeat(e,t){return e(this.value),this.listen(e,t)}listen(e,t){return this.updateEvent.subscribe(e,t).cancel}listenOnce(e,t){return this.updateEvent.subscribeOnce(e,t).cancel}filter(t,n){n=null!=n?n:new e;const s=new c(n);return this.listen(e=>{t(e,s.value)&&s.update(e)},n),s}max(e){return this.filter((e,t)=>"string"==typeof e&&"string"==typeof t?e.localeCompare(t)>0:e>t,e)}min(e){return this.filter((e,t)=>"string"==typeof e&&"string"==typeof t?e.localeCompare(t)<0:e<t,e)}transform(t,s,a,i,r,o,l,h,d,c,p,v){let f;const m=[t,s,a,i,r,o,l,h,d,c,p].filter(t=>!(t&&t instanceof e&&(f=t,1)));v&&(f=v);const w=new u;return this.listen(async function(e){for(const s of m)switch(t.operationType){case n.MAP:e=s.operation(e);break;case n.DELAY:case n.MAP_DELAY:e=await s.operation(e);break;case n.FILTER:if(!s.operation(e))return}w.update(e)},f),w}pipe(e,t){return this.listen(t=>e.update(t),t),this}map(t,n){let s;return n=null!=n?n:new e,s=this.primed?new c(n,t(this.value)):new c(n),this.listen(e=>{s.update(t(e))},n),s}tap(e,t){return this.listen(t=>{e(t)},t),this}loadBalance(e,t){let n=0;this.listen(t=>{e[n++].update(t),n>=e.length&&(n=0)},t)}await(t){t=null!=t?t:new e;const n=new c(t);return(this.primed?this.listenAndRepeat:this.listen).call(this,async function(e){n.update(await e)},t),n}awaitOrdered(t){t=null!=t?t:new e;const n=[],s=new c(t);return(this.primed?this.listenAndRepeat:this.listen).call(this,async function(e){e instanceof Promise?(n.push(e),async function(){for(;n.length;){const e=n[0];s.update(await e),n.shift()}}()):s.update(await e)},t),s}awaitLatest(t){let n;t=null!=t?t:new e;const s=new c(t);return(this.primed?this.listenAndRepeat:this.listen).call(this,async function(e){n=Date.now();const t=n,a=await e;n===t&&s.update(a)},t),s}unique(t){t=null!=t?t:new e;const n=new c(t,this.value);return this.listen(e=>{e!==n.value&&n.update(e)},t),n}diff(t){t=null!=t?t:new e;const n=new c(t,{new:this.value,old:void 0});return this.listen(e=>{n.update({new:e,old:n.value.new})},t),n}reduce(t,n,s){s=null!=s?s:new e;const a=new c(s,n);return this.listen(e=>a.update(t(a.value,e)),s),a}aggregate(t,n,s){s=null!=s?s:new e;const a=new c(s,n(this.value,t.value));return this.listen(()=>a.update(n(this.value,t.value)),s),t.listen(()=>a.update(n(this.value,t.value)),s),a}aggregateThree(t,n,s,a){a=null!=a?a:new e;const i=new c(a,s(this.value,t.value,n.value));return this.listen(()=>i.update(s(this.value,t.value,n.value)),a),t.listen(()=>i.update(s(this.value,t.value,n.value)),a),n.listen(()=>i.update(s(this.value,t.value,n.value)),a),i}aggregateFour(t,n,s,a,i){i=null!=i?i:new e;const r=new c(i,a(this.value,t.value,n.value,s.value));return this.listen(()=>r.update(a(this.value,t.value,n.value,s.value)),i),t.listen(()=>r.update(a(this.value,t.value,n.value,s.value)),i),n.listen(()=>r.update(a(this.value,t.value,n.value,s.value)),i),s.listen(()=>r.update(a(this.value,t.value,n.value,s.value)),i),r}combine(t,n){n=null!=n?n:new e;const s=new c(n);this.pipe(s,n);for(const e of t)e.pipe(s,n);return s}delay(t,n){n=null!=n?n:new e;const s=new c(n,this.value);return this.listen(e=>{setTimeout(()=>{s.update(e)},t)},n),s}skip(t,n){n=null!=n?n:new e;const s=new c(n,this.value);return this.listen(e=>{0===t?s.update(e):t--},n),s}cutoff(t,n){n=null!=n?n:new e;const s=new c(n,this.value);return this.listen(e=>{t-- >0&&s.update(e)},n),s}awaitNextUpdate(e){return new Promise(t=>{this.listenOnce(e=>t(e),e)})}debounce(t,n){n=null!=n?n:new e;const s=new c(n,this.value);let a;return this.listen(e=>{clearTimeout(a),a=setTimeout(()=>{s.update(e)},t)},n),s}throttle(t,n){n=null!=n?n:new e;const s=new c(n,this.value);let a=!1;return this.listen(e=>{a||(s.update(e),a=!0,setTimeout(()=>{a=!1},t))},n),s}buffer(t,n){n=null!=n?n:new e;const s=new c(n);let a,i=[];return this.listen(e=>{i.push(e),a||(a=setTimeout(()=>{a=void 0,s.update(i),i=[]},t))},n),s}accumulate(e){const t=new p;return this.listen(e=>{t.push(e)},e),t}pick(t,n){var s;n=null!=n?n:new e;const a=new c(n,null===(s=this.value)||void 0===s?void 0:s[t]);return this.listen(e=>{a.update(null!=e?e[t]:e)},n),a}cancelAll(){this.updateEvent.cancelAll()}}class c extends u{constructor(e,t){super(t),this.disposeToken=e,this.updateEvent.onEmpty=()=>{e.cancel(),Object.defineProperty(this,"value",{get(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')},set(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')}})}}persist(){return this.updateEvent.onEmpty=void 0,this}listen(e,t){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),super.listen(e,t)}listenAndRepeat(e,t){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),super.listenAndRepeat(e,t)}listenOnce(e,t){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),super.listen(e,t)}}class p{constructor(e){this.data=e?e.slice():[],this.lengthSource=new u(this.data.length),this.updateEvent=new t}listenAndRepeat(e,t){return e({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(e,t)}listen(e,t){return this.updateEvent.subscribe(e,t).cancel}listenOnce(e,t){return this.updateEvent.subscribeOnce(e,t).cancel}awaitNextUpdate(e){return new Promise(t=>{this.listenOnce(e=>t(e),e)})}get length(){return this.lengthSource}getData(){return this.data}get(e){return this.data[e]}set(e,t){const n=this.data[e];n!==t&&(this.data[e]=t,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:e,items:[t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))}swap(e,t){if(e===t)return;const n=this.data[e],s=this.data[t];this.data[t]=n,this.data[e]=s,this.update({operation:"swap",operationDetailed:"swap",index:e,index2:t,items:[n,s],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}swapItems(e,t){if(e===t)return;const n=this.data.indexOf(e),s=this.data.indexOf(t);-1!==n&&-1!==s&&(this.data[s]=e,this.data[n]=t),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:s,items:[e,t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}appendArray(e){this.data=this.data.concat(e),this.update({operation:"add",operationDetailed:"append",count:e.length,index:this.data.length-e.length,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}insertAt(e,...t){0!==t.length&&(this.data.splice(e,0,...t),this.update({operation:"add",operationDetailed:"insert",count:t.length,index:e,items:t,newState:this.data}),this.lengthSource.update(this.data.length))}push(...e){this.appendArray(e)}unshift(...e){this.data.unshift(...e),this.update({operation:"add",operationDetailed:"prepend",count:e.length,items:e,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}pop(){const e=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e}merge(e){const t=this.data;this.data=e.slice(),this.update({operation:"merge",operationDetailed:"merge",previousState:t,index:0,items:this.data,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}removeRight(e){const t=this.data.length,n=this.data.splice(t-e,e);this.update({operation:"remove",operationDetailed:"removeRight",count:e,index:t-e,items:n,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}removeLeft(e){const t=this.data.splice(0,e);this.update({operation:"remove",operationDetailed:"removeLeft",count:e,index:0,items:t,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}remove(e){const t=this.data.indexOf(e);-1!==t&&(this.data.splice(t,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:t,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))}clear(){if(0===this.data.length)return;const e=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:e.length,index:0,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}shift(){const e=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[e],count:1,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e}toArray(){return this.data.slice()}sort(t,n=[],s){const a=new f(this,t,s),i=new e;return s&&s.addCancelable(()=>i.cancel()),n.forEach(e=>{e.listen(()=>a.refresh())},i),a}map(e,t=[],n){const s=new v(this,e,n);return t.forEach(e=>{e.listen(()=>s.refresh())},n),s}filter(e,t=[],n){const s=new m(this,e,n);return t.forEach(e=>{e.listen(()=>s.refresh(),n)}),s}forEach(e){return this.data.forEach(e)}update(e){this.updateEvent.fire(e)}}class v extends p{constructor(t,n,s=new e){super(t.getData().map(n)),this.parent=t,this.mapper=n,t.listen(e=>{switch(e.operationDetailed){case"removeLeft":this.removeLeft(e.count);break;case"removeRight":this.removeRight(e.count);break;case"remove":this.remove(this.data[e.index]);break;case"clear":this.clear();break;case"prepend":this.unshift(...e.items.map(this.mapper));break;case"append":this.appendArray(e.items.map(this.mapper));break;case"insert":this.insertAt(e.index,...e.items.map(this.mapper));break;case"swap":this.swap(e.index,e.index2);break;case"replace":this.set(e.index,this.mapper(e.items[0]));break;case"merge":const t=this.data.slice(),n=e.previousState.slice();for(let t=0;t<e.newState.length;t++)if(this.data.length<=t&&this.data.push(this.mapper(e.newState[t])),n[t]!==e.newState[t]){const s=n.indexOf(e.newState[t]);if(-1!==s){const e=this.data[t];this.data[t]=this.data[s],this.data[s]=e;const a=n[t];n[t]=n[s],n[s]=a}else this.data.splice(t,0,this.mapper(e.newState[t])),n.splice(t,0,e.newState[t])}this.data.length>e.newState.length&&(this.data.length=e.newState.length),this.update({operation:"merge",operationDetailed:"merge",previousState:t,index:0,items:this.data,newState:this.data})}},s)}refresh(){this.merge(this.parent.data.map(this.mapper))}}class f extends p{constructor(t,n,s=new e){super(t.getData().slice().sort(n)),this.parent=t,this.comparator=n,t.listen(e=>{switch(e.operationDetailed){case"removeLeft":case"removeRight":for(const t of e.items)this.remove(t);break;case"remove":this.remove(e.items[0]);break;case"clear":this.clear();break;case"prepend":this.unshift(...e.items),this.data.sort(this.comparator);break;case"append":case"insert":this.appendSorted(e.items);break;case"merge":this.merge(e.items.slice().sort(this.comparator));break;case"swap":break;case"replace":this.remove(e.target),this.appendSorted(e.items)}},s)}appendSorted(e){this.merge(this.data.concat(e).sort(this.comparator))}refresh(){this.merge(this.parent.getData().slice().sort(this.comparator))}}class m extends p{constructor(t,n,s=new e){Array.isArray(t)&&(t=new p(t)),super(t.data.filter(n=null!=n?n:()=>!0)),this.parent=t,this.viewFilter=n,t.listen(e=>{let t;switch(e.operationDetailed){case"clear":this.clear();break;case"removeLeft":case"removeRight":case"remove":for(const t of e.items)this.remove(t);break;case"prepend":t=e.items.filter(this.viewFilter),this.unshift(...t);break;case"append":t=e.items.filter(this.viewFilter),this.appendArray(t);break;case"insert":t=e.items.filter(this.viewFilter),this.insertAt(e.index,...t);break;case"merge":this.merge(e.items.filter(this.viewFilter));break;case"swap":const n=this.data.indexOf(e.items[0]),s=this.data.indexOf(e.items[1]);-1!==n&&-1!==s&&this.swap(n,s);break;case"replace":const a=this.data.indexOf(e.target);-1!==a&&(this.viewFilter(e.items[0])?this.set(a,e.items[0]):this.remove(e.target))}},s)}updateFilter(e){if(this.viewFilter!==e)return this.viewFilter=e,this.refresh(),this.data.length}refresh(){this.merge(this.parent.data.filter(this.viewFilter))}}!function(e){e[e.UPSTREAM=0]="UPSTREAM",e[e.DOWNSTREAM=1]="DOWNSTREAM"}(s||(s={}));class w{constructor(e,n=!0){this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new t,this.updateUpstreamEvent=new t,this.propagateWritesToReadStream=n}static fromTwoDataSource(e,t,n,s=!0){const a=new w(n,s);return a.updateDownstreamEvent=e.updateEvent,a.updateUpstreamEvent=t.updateEvent,a}withInitial(e){return this.primed||this.updateDownstream(e),this}static createOneWay(e=s.DOWNSTREAM,t){return new w(t,!1).oneWayFlow(e)}updateDownstream(e){if(this.updatingDownstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingDownstream=!0,this.value=e,this.updateDownstreamEvent.fire(e),this.updatingDownstream=!1}updateUpstream(e){if(this.updatingUpstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingUpstream=!0,this.value=e,this.updateUpstreamEvent.fire(e),this.propagateWritesToReadStream&&this.updateDownstreamEvent.fire(e),this.updatingUpstream=!1}listenAndRepeat(e,t){return e(this.value),this.listen(e,t)}listen(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel}listenUpstream(e,t){return this.updateUpstreamEvent.subscribe(e,t).cancel}listenUpstreamOnce(e,t){return this.updateUpstreamEvent.subscribeOnce(e,t).cancel}listenDownstream(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel}downStreamToDataSource(e){const t=new u(this.value);return this.listenDownstream(e=>{t.update(e)},e),t}aggregate(t,n,s){s=null!=s?s:new e;const a=new c(s,n(this.value,t.value));return this.listen(()=>a.update(n(this.value,t.value)),s),t.listen(()=>a.update(n(this.value,t.value)),s),a}aggregateThree(t,n,s,a){a=null!=a?a:new e;const i=new c(a,s(this.value,t.value,n.value));return this.listen(()=>i.update(s(this.value,t.value,n.value)),a),t.listen(()=>i.update(s(this.value,t.value,n.value)),a),n.listen(()=>i.update(s(this.value,t.value,n.value)),a),i}aggregateFour(t,n,s,a,i){i=null!=i?i:new e;const r=new c(i,a(this.value,t.value,n.value,s.value));return this.listen(()=>r.update(a(this.value,t.value,n.value,s.value)),i),t.listen(()=>r.update(a(this.value,t.value,n.value,s.value)),i),n.listen(()=>r.update(a(this.value,t.value,n.value,s.value)),i),s.listen(()=>r.update(a(this.value,t.value,n.value,s.value)),i),r}filter(e,t,n){if("function"==typeof t){const s=new w(void 0,!1);return this.listenDownstream(t=>{e(t,s.value)&&s.updateDownstream(t)},n),s.listenUpstream(e=>{t(e,this.value)&&this.updateUpstream(e)},n),s}{const n=new u;return this.listenDownstream(t=>{e(t,n.value)&&n.update(t)},t),n}}pipe(e,t){return this.listenDownstream(t=>e.updateDownstream(t),t),e.listenUpstream(e=>this.updateUpstream(e),t),this}map(e,t,n){if("function"==typeof t){let s;return s=new w(this.primed?e(this.value):void 0,!1),this.listenDownstream(t=>s.updateDownstream(e(t)),n),s.listenUpstream(e=>this.updateUpstream(t(e)),n),s}{let n;return n=this.primed?new u(e(this.value)):new u,this.listenDownstream(t=>n.update(e(t)),t),n}}listenOnce(e,t){return this.updateDownstreamEvent.subscribeOnce(e,t).cancel}awaitNextUpdate(e){return new Promise(t=>{this.listenOnce(e=>t(e),e)})}debounceUpstream(e,t){const n=new w(this.value);let s;return n.listenUpstream(t=>{clearTimeout(s),s=setTimeout(()=>{this.updateUpstream(t)},e)},t),this.listenDownstream(e=>{n.updateDownstream(e)},t),n}debounceDownstream(e,t){const n=new w(this.value);let s;return this.listenDownstream(t=>{clearTimeout(s),s=setTimeout(()=>{n.updateDownstream(t)},e)},t),n.listenUpstream(e=>{this.updateUpstream(e)},t),n}diff(t){t=null!=t?t:new e;const n=new c(t,{new:this.value,old:void 0});return this.listen(e=>{n.update({new:e,old:n.value.new})},t),n}await(t){t=null!=t?t:new e;const n=new w(void 0,!1);return(this.primed?this.listenAndRepeat:this.listen).call(this,async function(e){n.updateDownstream(await e)},t),this.listenUpstream(async function(e){n.updateUpstream(await e)},t),n}awaitLatest(e){throw new Error("not implemented")}awaitOrdered(e){throw new Error("not implemented")}unique(e){const t=new w(this.value,!1);let n=this.value,s=this.value;return this.listenDownstream(e=>{s!==e&&(s=e,t.updateDownstream(e))},e),t.listenUpstream(e=>{n!==e&&(n=e,this.updateUpstream(e))},e),t}oneWayFlow(e=s.DOWNSTREAM,t){const n=new w(this.value,!1);return e===s.DOWNSTREAM?(this.listenDownstream(e=>n.updateDownstream(e),t),n.updateUpstream=()=>{}):(n.listenUpstream(e=>this.updateUpstream(e)),n.updateDownstream=()=>{}),n}reduce(e,t,n){const s=new u(t);return this.listen(t=>s.update(e(s.value,t)),n),s}cancelAll(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()}}function g(e,t){const n=[];for(const s in e)if(e[s])if(e[s]instanceof u||e[s]instanceof w){const a=e[s],i=new u(a.value?s:"");a.listen(e=>{i.update(e?s:"")},t),n.push(i)}else n.push(s);return n}function b(){const t={attachCalls:[],sessionToken:new e(()=>{for(const e of t.tokens)e.cancel()}),tokens:[]};return t}const y=Symbol("AurumElementModel"),E=new WeakMap;class k{constructor(e,t){this.children=[],this.api=t,this.api.onAttach(()=>{if(void 0===this.hostNode)throw new Error("illegal state: Attach fired but not actually attached");this.render(e)})}dispose(){this.clearContent()}attachToDom(e,t){if(this.hostNode)throw new Error("Aurum Element is already attached");const n=k.id++;this.hostNode=e,this.contentStartMarker=document.createComment("START Aurum Node "+n),this.contentEndMarker=document.createComment("END Aurum Node "+n),t>=e.childNodes.length?(e.appendChild(this.contentStartMarker),e.appendChild(this.contentEndMarker)):(e.insertBefore(this.contentStartMarker,e.childNodes[t]),e.insertBefore(this.contentEndMarker,e.childNodes[t+1]))}getWorkIndex(){if(void 0!==this.lastStartIndex&&this.hostNode.childNodes[this.lastStartIndex]===this.contentStartMarker)return this.lastStartIndex+1;for(let e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentStartMarker)return this.lastStartIndex=e,e+1}getLastIndex(){if(void 0!==this.lastEndIndex&&this.hostNode.childNodes[this.lastEndIndex]===this.contentEndMarker)return this.lastEndIndex;for(let e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentEndMarker)return this.lastEndIndex=e,e}clearContent(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");const e=this.getWorkIndex();for(;this.hostNode.childNodes[e]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[e])}updateDom(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");const e=this.getWorkIndex();let t,n=0;for(t=0;t<this.children.length;t++){const s=this.children[t];if(s instanceof k)n+=s.getLastIndex()-t-n-e;else if(this.hostNode.childNodes[t+e+n]!==this.contentEndMarker&&this.hostNode.childNodes[t+e+n]!==this.children[t]){if(!(s instanceof HTMLElement||s instanceof Text))throw new Error("not implemented");this.hostNode.removeChild(this.hostNode.childNodes[t+e+n]),this.hostNode.childNodes[t+e+n]?this.hostNode.insertBefore(s,this.hostNode.childNodes[t+e+n]):this.hostNode.appendChild(s)}else{if(!(s instanceof HTMLElement||s instanceof Text))throw new Error("not implemented");this.hostNode.childNodes[t+e+n]?this.hostNode.insertBefore(s,this.hostNode.childNodes[t+e+n]):this.hostNode.appendChild(s)}}for(;this.hostNode.childNodes[t+e+n]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[t+e+n])}}function A(e,t,n=!1){if(null!=e){if(S.has(e)){const n=S.get(e);n.sessionToken&&(t.attachCalls.push(...n.attachCalls),t.sessionToken.chain(n.sessionToken),n.attachCalls=void 0,n.sessionToken=void 0),S.delete(e)}if(Array.isArray(e))return Array.prototype.concat.apply([],e.map(e=>A(e,t,n)));if(!n){if(e instanceof Promise){const n=new u;return e.then(e=>{n.update(e)}),new C(n,D(t))}if(e instanceof u||e instanceof w)return new C(e,D(t));if(e instanceof p)return new T(e,D(t));const n=typeof e;if("string"===n||"number"===n||"bigint"===n||"boolean"===n)return document.createTextNode(e.toString())}return e[y]?A(e.factory(e.props||{},e.children,D(t)),t,n):e}}k.id=1;const S=new WeakMap;function D(t){let n=void 0;const s={renderSession:t,onAttach:e=>{t.attachCalls.push(e)},onDetach:s=>{n||(n=new e,t.tokens.push(n)),n.addCancelable(s)},onError:e=>{throw new Error("not implemented")},get cancellationToken(){return n||(n=new e,t.tokens.push(n)),n},prerender(e){const t=b(),n=A(e,t,!0);if(Array.isArray(n))for(const e of n)"object"==typeof e&&S.set(e,t);else S.set(n,t);return n},get style(){return function(e,...t){const n=new u;for(const a of t)(a instanceof u||a instanceof w)&&a.listen(()=>n.update(x(e,t)),s.cancellationToken);return n.update(x(e,t)),n}}};return s}function x(e,t){let n="";for(let s=0;s<e.length;s++)n+=e[s],t[s]&&(n+="string"==typeof t[s]?t[s]:t[s].value);return n}class T extends k{constructor(e,t){super(e,t),this.renderSessions=new WeakMap,this.dataSource=e}attachToDom(e,t){super.attachToDom(e,t),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource}render(e){e.listenAndRepeat(e=>{this.handleNewContent(e),this.updateDom()},this.api.cancellationToken)}spliceChildren(e,t,n){let s;s=n?this.children.splice(e,t,n):this.children.splice(e,t);for(const e of s)this.renderSessions.get(e).sessionToken.cancel()}handleNewContent(e){switch(e.operationDetailed){case"merge":const t=e.previousState.slice();for(let n=0;n<e.newState.length;n++)if(this.children.length<=n&&this.children.push(this.renderItem(e.newState[n])),t[n]!==e.newState[n]){const s=t.indexOf(e.newState[n]);if(-1!==s){const e=this.children[n];this.children[n]=this.children[s],this.children[s]=e;const a=t[n];t[n]=t[s],t[s]=a}else this.spliceChildren(n,0,this.renderItem(e.newState[n])),t.splice(n,0,e.newState[n])}this.children.length>e.newState.length&&(this.children.length=e.newState.length);break;case"remove":case"removeLeft":case"removeRight":this.spliceChildren(e.index,e.count);break;case"append":for(const t of e.items){const e=this.renderItem(t);Array.isArray(e)?this.children=this.children.concat(e):this.children.push(e)}break;case"replace":const n=this.renderItem(e.items[0]);if(Array.isArray(n))throw new Error("illegal state");this.children[e.index]=n;break;case"swap":const s=this.children[e.index2];this.children[e.index2]=this.children[e.index],this.children[e.index]=s;break;case"prepend":for(const t of e.items){const e=this.renderItem(t);if(Array.isArray(e))throw new Error("illegal state");this.children.unshift(e)}break;case"insert":let a=e.index;for(const t of e.items){const e=this.renderItem(t);if(Array.isArray(e))throw new Error("illegal state");this.children.splice(a,0,e),a+=1}break;case"remove":for(const t of e.items){const e=this.renderItem(t);if(Array.isArray(e))throw new Error("illegal state");this.children.unshift(e)}break;case"clear":this.children.length=0,this.renderSessions=new WeakMap;break;default:throw new Error("not implemented")}this.updateDom()}renderItem(e){const t=b(),n=A(e,t);for(const e of t.attachCalls)e();return this.renderSessions.set(n,t),n}}class C extends k{constructor(e,t){super(e,t),this.api.cancellationToken.addCancelable(()=>{var e;return null===(e=this.renderSession)||void 0===e?void 0:e.sessionToken.cancel()}),this.dataSource=e}attachToDom(e,t){super.attachToDom(e,t),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource}render(e){e.listenAndRepeat(e=>{this.handleNewContent(e),this.updateDom()},this.api.cancellationToken)}handleNewContent(e){if(this.lastValue===e)return;let t=!1;if(1===this.children.length&&this.children[0]instanceof Text){const n=typeof e;"string"!==n&&"bigint"!==n&&"number"!==n||(this.children[0].nodeValue=e,t=!0)}t||this.fullRebuild(e),this.lastValue=e}fullRebuild(e){this.clearContent(),this.endSession(),this.renderSession=b();let t=A(e,this.renderSession);if(void 0!==t){Array.isArray(t)||(t=[t]);for(const e of t)e instanceof k&&e.attachToDom(this.hostNode,this.getLastIndex());for(const e of this.renderSession.attachCalls)e();Array.isArray(t)&&(this.children=t)}else this.children=[]}endSession(){this.renderSession&&(this.renderSession.sessionToken.cancel(),this.renderSession=void 0)}}const O={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},N=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function M(e,t,n,s){return function(a,i,r){const o=document.createElement(e);a&&function(e,t,n,s,a){L(e,O,t),a&&L(e,a,t);const i=Object.keys(t).filter(e=>e.includes("-"));R(e,N,t,i),s&&R(e,s,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof u||t instanceof w)t.value&&(Array.isArray(t.value)?(e.className=t.value.join(" "),t.unique(n).listen(()=>{e.className=t.value.join(" ")})):(e.className=t.value,t.unique(n).listen(()=>{e.className=t.value}))),t.unique(n).listen(t=>e.className=t);else{const s=t.reduce((e,t)=>"string"==typeof t?`${e} ${t}`:t.value?`${e} ${t.value}`:e,"");e.className=s;for(const s of t)s instanceof u&&s.unique(n).listen(n=>{const s=t.reduce((e,t)=>"string"==typeof t?`${e} ${t}`:t.value?`${e} ${t.value}`:e,"");e.className=s})}}(e,t.class,n)}(o,a,r.cancellationToken,t,n);const l=A(i,r.renderSession);return function e(t,n){if(null!=n)if(Array.isArray(n))for(const s of n)e(t,s);else if(n instanceof k)n.attachToDom(t,t.childNodes.length);else{if(!(n instanceof HTMLElement||n instanceof Text))throw new Error("Unexpected child type passed to DOM Node: "+n);t.appendChild(n)}}(o,l),a.onAttach&&r.onAttach(()=>a.onAttach(o)),a.onDetach&&r.onDetach(()=>{o.isConnected&&o.parentElement.removeChild(o),a.onDetach(o)}),null==s||s(o,a,r.cancellationToken),o}}function L(e,t,n){for(const s in t)n[t[s]]&&(n[t[s]]instanceof u?e.addEventListener(s,e=>n[t[s]].update(e)):n[t[s]]instanceof w?e.addEventListener(s,e=>n[t[s]].updateDownstream(e)):"function"==typeof n[t[s]]&&e.addEventListener(s,e=>n[t[s]](e)))}function R(e,t,n,s){for(const s of t)n[s]&&I(e,n[s],s);if(s)for(const t of s)n[t]&&I(e,n[t],t)}function I(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof u||t instanceof w))throw new Error("Attributes only support types boolean, string, number and data sources");"string"==typeof t.value?e.setAttribute(n,t.value):"boolean"==typeof t.value&&t.value&&e.setAttribute(n,""),t.unique().listen(t=>{"string"==typeof t?e.setAttribute(n,t):"boolean"==typeof t&&(t?e.setAttribute(n,""):e.removeAttribute(n))})}}const U=M("input",["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],{input:"onInput",change:"onChange"},(e,t,n)=>{const s=e;t.value&&(t.value instanceof u?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("input",()=>{t.value.update(s.value)})):t.value instanceof w?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("input",()=>{t.value.updateUpstream(s.value)})):s.value=t.value),t.checked&&(t.checked instanceof u?(t.checked.listenAndRepeat(e=>{s.checked=e},n),s.addEventListener("change",()=>{t.checked.update(s.checked)})):t.checked instanceof w?(t.checked.listenAndRepeat(e=>{s.checked=e},n),s.addEventListener("change",()=>{t.checked.updateUpstream(s.checked)})):s.checked=t.checked)}),F=M("select",void 0,{change:"onChange"},(e,t,n)=>{const s=e;t.value&&(t.value instanceof u?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("change",()=>{t.value.update(s.value)})):t.value instanceof w?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("change",()=>{t.value.updateUpstream(s.value)})):s.value=t.value),t.selectedIndex&&(t.selectedIndex instanceof u?(t.selectedIndex.listenAndRepeat(e=>{s.selectedIndex=e},n),s.addEventListener("change",()=>{t.selectedIndex.update(s.selectedIndex)})):t.selectedIndex instanceof w?(t.selectedIndex.listenAndRepeat(e=>{s.selectedIndex=e},n),s.addEventListener("change",()=>{t.selectedIndex.updateUpstream(s.selectedIndex)})):s.selectedIndex=t.selectedIndex)}),K=M("code"),P=M("div"),V=M("a",["href","target"]),q=M("abbr"),W=M("h1"),j=M("h2"),$=M("h3"),Y=M("h4"),_=M("h5"),B=M("h6"),H=M("area",["alt","coors"]),z=M("article"),G=M("aside"),J=M("span"),Q=M("noscript"),X=M("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),Z=M("ul"),ee=M("ol"),te=M("li"),ne=M("tr"),se=M("b"),ae=M("title"),ie=M("summary"),re=M("thead"),oe=M("template"),le=M("q"),he=M("pre"),de=M("p"),ue=M("hr"),ce=M("audio",["controls","autoplay","loop","muted","preload","src"]),pe=M("br"),ve=M("button",["disabled"]),fe=M("canvas",["width","height"]),me=M("data",["value"]),we=M("details"),ge=M("em"),be=M("footer"),ye=M("form"),Ee=M("head"),ke=M("header"),Ae=M("heading"),Se=M("i"),De=M("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),xe=M("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),Te=M("label",["for"]),Ce=M("link",["href","rel","media","as","disabled","type"]),Oe=M("nav"),Ne=M("sub"),Me=M("sup"),Le=M("table"),Re=M("tbody"),Ie=M("tfoot"),Ue=M("td"),Fe=M("th"),Ke=M("time",["datetime"]),Pe=M("style",["media"]),Ve=M("source",["src","srcSet","media","sizes","type"]),qe=M("script",["src","async","defer","integrity","noModule","type"]),We=M("svg",["width","height"]),je=M("progress",["max","value"]),$e=M("option",["value"]),Ye=M("slot",["name"]),_e={button:ve,code:K,hr:ue,div:P,input:U,li:te,span:J,style:Pe,ul:Z,p:de,img:xe,link:Ce,canvas:fe,a:V,article:z,br:pe,form:ye,label:Te,ol:ee,pre:he,progress:je,table:Le,td:Ue,tr:ne,th:Fe,textarea:M("textArea",["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],{input:"onInput",change:"onChange"},(e,t,n)=>{const s=e;t.value&&(t.value instanceof u?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("input",()=>{t.value.update(s.value)})):t.value instanceof w?(t.value.listenAndRepeat(e=>{s.value=e},n),s.addEventListener("input",()=>{t.value.updateUpstream(s.value)})):s.value=t.value)}),h1:W,h2:j,h3:$,h4:Y,h5:_,h6:B,head:Ee,header:ke,footer:be,nav:Oe,b:se,i:Se,script:qe,abbr:q,area:H,aside:G,audio:ce,em:ge,heading:Ae,iframe:De,noscript:Q,option:$e,q:le,select:F,source:Ve,title:ae,video:X,tbody:Re,tfoot:Ie,thead:re,summary:ie,details:we,sub:Ne,sup:Me,svg:We,data:me,time:Ke,template:oe,slot:Ye};class Be{static attach(e,t){const n=b(),s=A(e,n);if(s instanceof k)s.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(()=>s.dispose());else if(Array.isArray(s)){const e=new T(new p(s),D(n));n.sessionToken.addCancelable(()=>e.dispose()),e.attachToDom(t,t.childNodes.length)}else t.appendChild(s),n.sessionToken.addCancelable(()=>{t.removeChild(s)});for(let e=n.attachCalls.length-1;e>=0;e--)n.attachCalls[e]();return n.sessionToken}static factory(e,t,...n){let s;if("string"==typeof e){s=e;const t=e;if(void 0===(e=_e[e]))throw new Error(`Node ${t} does not exist or is not supported`)}return{[y]:!0,name:s,factory:e,props:t,children:n}}}function He(e,t){return customElements.define(e.name,class extends HTMLElement{constructor(){super(),void 0===e.observedAttributes&&(e.observedAttributes=[]),this.props={};for(const t of e.observedAttributes)this.props[t]=new u}static get observedAttributes(){return e.observedAttributes}attributeChangedCallback(e,t,n){t!==n&&this.props[e].update(n)}connectedCallback(){var n;const s=document.createDocumentFragment();this.session=b(),this.api=D(this.session);const a=t(this.props,this.api);for(const e of this.session.attachCalls)e();Be.attach(a,s),this.attachShadow({mode:null!==(n=e.shadowRootMode)&&void 0!==n?n:"open",delegatesFocus:e.shadowRootDelegatesFocus}).appendChild(s)}disconnectedCallback(){this.session.sessionToken.cancel()}}),M(e.name,e.observedAttributes,void 0,(e,t)=>{for(const n in t)n in e.props||(e.props[n]=t[n])})}function ze(e,t,n){if((t=[].concat.apply([],t.filter(e=>!!e))).some(e=>!e[y]||!(e.factory===Je||e.factory===Qe)))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(e=>e.factory===Qe).length>1)throw new Error("Too many default routes only 0 or 1 allowed");const s=new u(Ge());return n.cancellationToken.registerDomEvent(window,"hashchange",()=>{s.update(Ge())}),s.unique(n.cancellationToken).withInitial(s.value).map(e=>function(e,t){var n,s;if(null==e)return null===(n=t.find(e=>e.factory===Qe))||void 0===n?void 0:n.children;if(t.find(t=>{var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return t.find(t=>{var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children;{const n=e.split("/");for(n.pop();n.length;){const e=n.join("/");if(t.find(t=>{var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return t.find(t=>{var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children;n.pop()}return null===(s=t.find(e=>e.factory===Qe))||void 0===s?void 0:s.children}}(e,t))}function Ge(){const e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function Je(e,t){}function Qe(e,t){}function Xe(t,n,s){const a=new u(null==t?void 0:t.fallback),i=new e;return s.onDetach(()=>{i.cancel()}),Promise.all(s.prerender(n,i)).then(e=>{i.isCanceled||a.update(e)},e=>(i.cancel(),Promise.reject(e))),a}function Ze(t,n,s){if((n=[].concat.apply([],n.filter(e=>!!e))).some(e=>!e[y]||!(e.factory===et||e.factory===tt)))throw new Error("Switch only accepts SwitchCase as children");if(n.filter(e=>e.factory===tt).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");const a=new e;return s.onDetach(()=>{a.cancel()}),t.state.unique(a).withInitial(t.state.value).map(e=>function(e,t){var n,s,a;return null!==(s=null===(n=t.find(t=>{var n;return(null===(n=t.props)||void 0===n?void 0:n.when)===e}))||void 0===n?void 0:n.children)&&void 0!==s?s:null===(a=t.find(e=>e.factory===tt))||void 0===a?void 0:a.children}(e,n))}function et(e,t){}function tt(e,t){}class nt{constructor(e){e&&(this.data=e),this.updateEvent=new t,this.updateEventOnKey=new Map}pick(e,t){var n;const s=new u(null===(n=this.data)||void 0===n?void 0:n[e]);return this.listenOnKey(e,e=>{s.update(e.newValue)},t),s}listen(e,t){return this.updateEvent.subscribe(e,t).cancel}listenOnKeyAndRepeat(e,t,n){return t({key:e,newValue:this.data[e],oldValue:void 0}),this.listenOnKey(e,t,n)}listenOnKey(e,n,s){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new t),this.updateEventOnKey.get(e).subscribe(n,s).cancel}keys(){return Object.keys(this.data)}values(){return Object.values(this.data)}get(e){return this.data[e]}delete(e){const t=this.data[e];delete this.data[e],this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})}set(e,t){if(this.data[e]===t)return;const n=this.data[e];this.data[e]=t,this.updateEvent.fire({oldValue:n,key:e,newValue:this.data[e]}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data[e]})}assign(e){if(e instanceof nt)for(const t of e.keys())this.set(t,e.data[t]);else for(const t of Object.keys(e))this.set(t,e[t])}toObject(){return Object.assign({},this.data)}toDataSource(){const e=new u(this.data);return this.listen(t=>{e.update(this.data)}),e}}class st{constructor(e){e&&(this.data=e),this.updateEvent=new t,this.updateEventOnKey=new Map}pick(e,t){const n=new u(this.data.get(e));return this.listenOnKey(e,e=>{n.update(e.newValue)},t),n}listen(e,t){return this.updateEvent.subscribe(e,t).cancel}listenOnKeyAndRepeat(e,t,n){return t({key:e,newValue:this.data.get(e),oldValue:void 0}),this.listenOnKey(e,t,n)}listenOnKey(e,n,s){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new t),this.updateEventOnKey.get(e).subscribe(n,s).cancel}keys(){return this.data.keys()}values(){return this.data.values()}get(e){return this.data.get(e)}has(e){return this.data.has(e)}delete(e){const t=this.data.get(e);this.data.delete(e),this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})}set(e,t){if(this.data.get(e)===t)return;const n=this.data.get(e);this.data.set(e,t),this.updateEvent.fire({oldValue:n,key:e,newValue:this.data.get(e)}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data.get(e)})}assign(e){for(const t of e.keys())this.set(t,e.get(t))}toMap(){return new Map(this.data.entries())}}class at{constructor(e){e&&(this.data=e),this.updateEvent=new t,this.updateEventOnKey=new Map}pick(e,t){const n=new u(this.data.has(e));return this.listenOnKey(e,e=>{n.update(e)},t),n}listen(e,t){return this.updateEvent.subscribe(e,t).cancel}listenOnKeyAndRepeat(e,t,n){return t(this.has(e)),this.listenOnKey(e,t,n)}listenOnKey(e,n,s){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new t),this.updateEventOnKey.get(e).subscribe(n,s).cancel}keys(){return this.data.keys()}has(e){return this.data.has(e)}delete(e){this.data.delete(e),this.updateEvent.fire({key:e,exists:!1}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!1)}add(e){this.data.has(e)||(this.data.add(e),this.updateEvent.fire({key:e,exists:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!0))}assign(e){for(const t of e.keys())this.add(t)}toSet(){return new Set(this.data.keys())}}class it{constructor(e,t){this.input=null!=e?e:new u,this.output=null!=t?t:this.input}get value(){return this.output.value}update(e){this.input.update(e)}listen(e,t){return this.output.listen(e,t)}listenAndRepeat(e,t){return this.output.listenAndRepeat(e,t)}listenOnce(e,t){return this.output.listenOnce(e,t)}filter(e,t){return new it(this.input,this.output.filter(e,t))}unique(e){return new it(this.input,this.output.unique(e))}map(e,t){return new it(this.input,this.output.map(e,t))}reduce(e,t,n){return new it(this.input,this.output.reduce(e,t,n))}awaitNextUpdate(e){return this.output.awaitNextUpdate(e)}await(e){return new it(this.input,this.output.await(e))}awaitLatest(e){return new it(this.input,this.output.awaitLatest(e))}awaitOrdered(e){return new it(this.input,this.output.awaitOrdered(e))}cancelAll(){this.input.cancelAll(),this.output.cancelAll()}}export{T as ArrayAurumElement,p as ArrayDataSource,Be as Aurum,k as AurumElement,ze as AurumRouter,e as CancellationToken,s as DataFlow,u as DataSource,Qe as DefaultRoute,tt as DefaultSwitchCase,w as DuplexDataSource,t as EventEmitter,m as FilteredArrayView,st as MapDataSource,v as MappedArrayView,nt as ObjectDataSource,n as OperationType,Je as Route,at as SetDataSource,C as SingularAurumElement,f as SortedArrayView,it as Stream,Xe as Suspense,Ze as Switch,et as SwitchCase,c as TransientDataSource,He as Webcomponent,g as aurumClassName,y as aurumElementModelIdentitiy,D as createAPI,b as createRenderSession,h as dsBuffer,l as dsDelay,i as dsFilter,a as dsMap,d as dsPick,o as dsReduce,r as dsUnique,E as nodeData,S as pendingSessions,A as render}; | ||
//# sourceMappingURL=aurumjs.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).aurum={})}(this,function(e){function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function s(e,t,n){return(s=o()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&r(a,n.prototype),a}).apply(null,arguments)}function u(e){var t="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return s(e,arguments,a(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),r(n,e)})(e)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function c(e){var t=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e)))return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}var h,d=function(){function e(){var e=[].slice.call(arguments);this.cancelables=null!=e?e:[],this._isCancelled=!1}var t=e.prototype;return t.hasCancellables=function(){return this.cancelables.length>0},t.addCancelable=function(e){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.push(e),200===this.cancelables.length&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this},t.removeCancelable=function(e){this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled");var t=this.cancelables.indexOf(e);return-1!==t&&this.cancelables.splice(t,1),this},t.setTimeout=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=this;void 0===t&&(t=0);var i=setTimeout(function(){n.removeCancelable(a),e()},t),a=function(){return clearTimeout(i)};this.addCancelable(a)}),t.setInterval=function(e){function t(t,n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=setInterval(e,t);this.addCancelable(function(){return clearInterval(n)})}),t.requestAnimationFrame=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){var t=this,n=requestAnimationFrame(function(){t.removeCancelable(i),e()}),i=function(){return cancelAnimationFrame(n)};this.addCancelable(i)}),t.animationLoop=function(e){var t=requestAnimationFrame(function n(i){e(i),t=requestAnimationFrame(n)});this.addCancelable(function(){return cancelAnimationFrame(t)})},t.throwIfCancelled=function(e){if(this.isCanceled)throw new Error(e||"cancellation token is cancelled")},t.chain=function(e,t){return void 0===t&&(t=!1),t&&e.chain(this,!1),this.addCancelable(function(){return e.cancel()}),this},t.registerDomEvent=function(e,t,n){return e.addEventListener(t,n),this.addCancelable(function(){return e.removeEventListener(t,n)}),this},t.cancel=function(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(function(e){return e()}),this.cancelables=void 0)},n(e,[{key:"isCanceled",get:function(){return this._isCancelled}}]),e}(),f=function(){function e(){this.subscribeChannel=[],this.subscribeOnceChannel=[],this.onAfterFire=[]}var t=e.prototype;return t.subscribe=function(e,t){return this.createSubscription(e,this.subscribeChannel,t).facade},t.subscribeOnce=function(e,t){return this.createSubscription(e,this.subscribeOnceChannel,t).facade},t.hasSubscriptions=function(){return this.subscriptions>0},t.cancelAll=function(){var e,t=this;this.isFiring?this.onAfterFire.push(function(){var e;t.subscribeChannel.length=0,t.subscribeOnceChannel.length=0,null===(e=t.onEmpty)||void 0===e||e.call(t)}):(this.subscribeChannel.length=0,this.subscribeOnceChannel.length=0,null===(e=this.onEmpty)||void 0===e||e.call(this))},t.afterFire=function(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(function(e){return e()}),this.onAfterFire.length=0)},t.fire=function(e){this.isFiring=!0;for(var t=this.subscribeChannel.length,n=0;n<t;n++)try{this.subscribeChannel[n].callback(e)}catch(e){console.error(e)}if(this.subscribeOnceChannel.length>0){t=this.subscribeOnceChannel.length;for(var i=0;i<t;i++)try{this.subscribeOnceChannel[i].callback(e)}catch(e){console.error(e)}this.subscribeOnceChannel.length=0}this.isFiring=!1,this.afterFire()},t.createSubscription=function(e,t,n){var i=this,a={callback:e},r={cancel:function(){i.cancel(a,t)}};return void 0!==n&&n.addCancelable(function(){return i.cancel(a,t)}),t.push(a),{subscription:a,facade:r}},t.cancel=function(e,t){var n,i=this,a=t.indexOf(e);a>=0&&(this.isFiring?this.onAfterFire.push(function(){return i.cancel(e,t)}):(t.splice(a,1),this.hasSubscriptions()||null===(n=this.onEmpty)||void 0===n||n.call(this)))},n(e,[{key:"subscriptions",get:function(){return this.subscribeChannel.length+this.subscribeOnceChannel.length}}]),e}();function p(e,t,n){if(!e.s){if(n instanceof v){if(!n.s)return void(n.o=p.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(p.bind(null,e,t),p.bind(null,e,2));e.s=t,e.v=n;var i=e.o;i&&i(e)}}!function(e){e[e.FILTER=0]="FILTER",e[e.MAP=1]="MAP",e[e.DELAY=2]="DELAY",e[e.MAP_DELAY=3]="MAP_DELAY"}(h||(h={}));var v=function(){function e(){}return e.prototype.then=function(t,n){var i=new e,a=this.s;if(a){var r=1&a?t:n;if(r){try{p(i,1,r(this.v))}catch(e){p(i,2,e)}return i}return this}return this.o=function(e){try{var a=e.v;1&e.s?p(i,1,t?t(a):a):n?p(i,1,n(a)):p(i,2,a)}catch(e){p(i,2,e)}},i},e}(),m="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function w(e){return e instanceof v&&1&e.s}var g,y=function(){function e(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new f}e.fromMultipleSources=function(t,n){for(var i,a=new e,r=c(t);!(i=r()).done;)i.value.listen(function(e){return a.update(e)},n);return a};var t=e.prototype;return t.repeatLast=function(){return this.update(this.value),this},t.update=function(e){if(this.primed=!0,this.updating)throw new Error("Problem in data source: Unstable value propagation. When updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=e,this.updateEvent.fire(e),this.updating=!1},t.withInitial=function(e){return this.primed||this.update(e),this},t.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},t.filter=function(e,t){t=null!=t?t:new d;var n=new b(t);return this.listen(function(t){e(t,n.value)&&n.update(t)},t),n},t.max=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)>0:e>t},e)},t.min=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)<0:e<t},e)},t.transform=function(t,n,i,a,r,o,s,u,l,c,f,g){var y,b=[t,n,i,a,r,o,s,u,l,c,f].filter(function(e){return!(e&&e instanceof d&&(y=e,1))});g&&(y=g);var E=new e;return this.listen(function(e){try{var n,i=function(t){if(n)return t;E.update(e)},a=function(e,t,n){if("function"==typeof e[m]){var i,a,r,o=e[m]();if(function e(s){try{for(;!((i=o.next()).done||n&&n());)if((s=t(i.value))&&s.then){if(!w(s))return void s.then(e,r||(r=p.bind(null,a=new v,2)));s=s.v}a?p(a,1,s):a=s}catch(e){p(a||(a=new v),2,e)}}(),o.return){var s=function(e){try{i.done||o.return()}catch(e){}return e};if(a&&a.then)return a.then(s,function(e){throw s(e)});s()}return a}if(!("length"in e))throw new TypeError("Object is not iterable");for(var u=[],l=0;l<e.length;l++)u.push(e[l]);return function(e,t,n){var i,a,r=-1;return function o(s){try{for(;++r<e.length&&(!n||!n());)if((s=t(r))&&s.then){if(!w(s))return void s.then(o,a||(a=p.bind(null,i=new v,2)));s=s.v}i?p(i,1,s):i=s}catch(e){p(i||(i=new v),2,e)}}(),i}(u,function(e){return t(u[e])},n)}(b,function(i){return function(e,t){var n,i=-1;e:{for(var a=0;a<t.length;a++){var r=t[a][0];if(r){var o=r();if(o&&o.then)break e;if(o===e){i=a;break}}else i=a}if(-1!==i){do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then){n=!0;break e}var l=t[i][2];i++}while(l&&!l());return u}}var c=new v,h=p.bind(null,c,2);return(n?u.then(d):o.then(function n(o){for(;;){if(o===e){i=a;break}if(++a===t.length){if(-1!==i)break;return void p(c,1,u)}if(r=t[a][0]){if((o=r())&&o.then)return void o.then(n).then(void 0,h)}else i=a}do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then)return void u.then(d).then(void 0,h);var l=t[i][2];i++}while(l&&!l());p(c,1,u)})).then(void 0,h),c;function d(e){for(;;){var n=t[i][2];if(!n||n())break;i++;for(var a=t[i][1];!a;)i++,a=t[i][1];if((e=a())&&e.then)return void e.then(d).then(void 0,h)}p(c,1,e)}}(t.operationType,[[function(){return h.MAP},function(){e=i.operation(e)}],[function(){return h.DELAY}],[function(){return h.MAP_DELAY},function(){return Promise.resolve(i.operation(e)).then(function(t){e=t})}],[function(){return h.FILTER},function(){i.operation(e)||(n=1)}]])},function(){return n});return Promise.resolve(a&&a.then?a.then(i):i(a))}catch(e){return Promise.reject(e)}},y),E},t.pipe=function(e,t){return this.listen(function(t){return e.update(t)},t),this},t.map=function(e,t){var n;return t=null!=t?t:new d,n=this.primed?new b(t,e(this.value)):new b(t),this.listen(function(t){n.update(e(t))},t),n},t.tap=function(e,t){return this.listen(function(t){e(t)},t),this},t.loadBalance=function(e,t){var n=0;this.listen(function(t){e[n++].update(t),n>=e.length&&(n=0)},t)},t.await=function(e){e=null!=e?e:new d;var t=new b(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var n=t.update;return Promise.resolve(e).then(function(e){n.call(t,e)})}catch(e){return Promise.reject(e)}},e),t},t.awaitOrdered=function(e){e=null!=e?e:new d;var t=[],n=new b(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=!1,a=function(){if(!(e instanceof Promise)){var a=n.update;return Promise.resolve(e).then(function(e){a.call(n,e)})}t.push(e),function(){try{var e=function(){i=!1};i||(i=!0);var a=function(e,t,n){for(var i;;){var a=e();if(w(a)&&(a=a.v),!a)return r;if(a.then){i=0;break}var r=n();if(r&&r.then){if(!w(r)){i=1;break}r=r.s}}var o=new v,s=p.bind(null,o,2);return(0===i?a.then(l):1===i?r.then(u):(void 0).then(function(){(a=e())?a.then?a.then(l).then(void 0,s):l(a):p(o,1,r)})).then(void 0,s),o;function u(t){r=t;do{if(!(a=e())||w(a)&&!a.v)return void p(o,1,r);if(a.then)return void a.then(l).then(void 0,s);w(r=n())&&(r=r.v)}while(!r||!r.then);r.then(u).then(void 0,s)}function l(e){e?(r=n())&&r.then?r.then(u).then(void 0,s):u(r):p(o,1,r)}}(function(){return!!t.length},0,function(){var e=n.update;return Promise.resolve(t[0]).then(function(i){e.call(n,i),t.shift()})});Promise.resolve(a&&a.then?a.then(e):e())}catch(e){return Promise.reject(e)}}()}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e),n},t.awaitLatest=function(e){var t;e=null!=e?e:new d;var n=new b(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=t=Date.now();return Promise.resolve(e).then(function(e){t===i&&n.update(e)})}catch(e){return Promise.reject(e)}},e),n},t.unique=function(e){e=null!=e?e:new d;var t=new b(e,this.value);return this.listen(function(e){e!==t.value&&t.update(e)},e),t},t.diff=function(e){e=null!=e?e:new d;var t=new b(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},t.reduce=function(e,t,n){n=null!=n?n:new d;var i=new b(n,t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},t.aggregate=function(e,t,n){var i=this;n=null!=n?n:new d;var a=new b(n,t(this.value,e.value));return this.listen(function(){return a.update(t(i.value,e.value))},n),e.listen(function(){return a.update(t(i.value,e.value))},n),a},t.aggregateThree=function(e,t,n,i){var a=this;i=null!=i?i:new d;var r=new b(i,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(a.value,e.value,t.value))},i),e.listen(function(){return r.update(n(a.value,e.value,t.value))},i),t.listen(function(){return r.update(n(a.value,e.value,t.value))},i),r},t.aggregateFour=function(e,t,n,i,a){var r=this;a=null!=a?a:new d;var o=new b(a,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),e.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),t.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),n.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),o},t.combine=function(e,t){t=null!=t?t:new d;var n=new b(t);this.pipe(n,t);for(var i,a=c(e);!(i=a()).done;)i.value.pipe(n,t);return n},t.delay=function(e,t){t=null!=t?t:new d;var n=new b(t,this.value);return this.listen(function(t){setTimeout(function(){n.update(t)},e)},t),n},t.skip=function(e,t){t=null!=t?t:new d;var n=new b(t,this.value);return this.listen(function(t){0===e?n.update(t):e--},t),n},t.cutoff=function(e,t){t=null!=t?t:new d;var n=new b(t,this.value);return this.listen(function(t){e-- >0&&n.update(t)},t),n},t.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},t.debounce=function(e,t){t=null!=t?t:new d;var n,i=new b(t,this.value);return this.listen(function(t){clearTimeout(n),n=setTimeout(function(){i.update(t)},e)},t),i},t.throttle=function(e,t){t=null!=t?t:new d;var n=new b(t,this.value),i=!1;return this.listen(function(t){i||(n.update(t),i=!0,setTimeout(function(){i=!1},e))},t),n},t.buffer=function(e,t){t=null!=t?t:new d;var n,i=new b(t),a=[];return this.listen(function(t){a.push(t),n||(n=setTimeout(function(){n=void 0,i.update(a),a=[]},e))},t),i},t.accumulate=function(e){var t=new E;return this.listen(function(e){t.push(e)},e),t},t.pick=function(e,t){var n;t=null!=t?t:new d;var i=new b(t,null===(n=this.value)||void 0===n?void 0:n[e]);return this.listen(function(t){i.update(null!=t?t[e]:t)},t),i},t.cancelAll=function(){this.updateEvent.cancelAll()},e}(),b=function(e){function t(t,n){var i;return(i=e.call(this,n)||this).disposeToken=t,i.updateEvent.onEmpty=function(){t.cancel(),Object.defineProperty(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i),"value",{get:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')},set:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')}})},i}i(t,e);var n=t.prototype;return n.persist=function(){return this.updateEvent.onEmpty=void 0,this},n.listen=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},n.listenAndRepeat=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listenAndRepeat.call(this,t,n)},n.listenOnce=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},t}(y),E=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new y(this.data.length),this.updateEvent=new f}var t=e.prototype;return t.listenAndRepeat=function(e,t){return e({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(e,t)},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},t.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},t.getData=function(){return this.data},t.get=function(e){return this.data[e]},t.set=function(e,t){var n=this.data[e];n!==t&&(this.data[e]=t,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:e,items:[t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},t.swap=function(e,t){if(e!==t){var n=this.data[e],i=this.data[t];this.data[t]=n,this.data[e]=i,this.update({operation:"swap",operationDetailed:"swap",index:e,index2:t,items:[n,i],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},t.swapItems=function(e,t){if(e!==t){var n=this.data.indexOf(e),i=this.data.indexOf(t);-1!==n&&-1!==i&&(this.data[i]=e,this.data[n]=t),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:i,items:[e,t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},t.appendArray=function(e){this.data=this.data.concat(e),this.update({operation:"add",operationDetailed:"append",count:e.length,index:this.data.length-e.length,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},t.insertAt=function(e){var t,n=[].slice.call(arguments,1);0!==n.length&&((t=this.data).splice.apply(t,[e,0].concat(n)),this.update({operation:"add",operationDetailed:"insert",count:n.length,index:e,items:n,newState:this.data}),this.lengthSource.update(this.data.length))},t.push=function(){this.appendArray([].slice.call(arguments))},t.unshift=function(){var e,t=[].slice.call(arguments);(e=this.data).unshift.apply(e,t),this.update({operation:"add",operationDetailed:"prepend",count:t.length,items:t,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},t.pop=function(){var e=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},t.merge=function(e){var t=this.data;this.data=e.slice(),this.update({operation:"merge",operationDetailed:"merge",previousState:t,index:0,items:this.data,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},t.removeRight=function(e){var t=this.data.length,n=this.data.splice(t-e,e);this.update({operation:"remove",operationDetailed:"removeRight",count:e,index:t-e,items:n,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},t.removeLeft=function(e){var t=this.data.splice(0,e);this.update({operation:"remove",operationDetailed:"removeLeft",count:e,index:0,items:t,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},t.remove=function(e){var t=this.data.indexOf(e);-1!==t&&(this.data.splice(t,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:t,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},t.clear=function(){if(0!==this.data.length){var e=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:e.length,index:0,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},t.shift=function(){var e=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[e],count:1,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},t.toArray=function(){return this.data.slice()},t.sort=function(e,t,n){void 0===t&&(t=[]);var i=new S(this,e,n),a=new d;return n&&n.addCancelable(function(){return a.cancel()}),t.forEach(function(e){e.listen(function(){return i.refresh()})},a),i},t.map=function(e,t,n){void 0===t&&(t=[]);var i=new k(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()})},n),i},t.filter=function(e,t,n){void 0===t&&(t=[]);var i=new A(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()},n)}),i},t.forEach=function(e){return this.data.forEach(e)},t.update=function(e){this.updateEvent.fire(e)},n(e,[{key:"length",get:function(){return this.lengthSource}}]),e}(),k=function(e){function t(t,n,i){var a;void 0===i&&(i=new d);var r=t.getData().map(n);return(a=e.call(this,r)||this).parent=t,a.mapper=n,t.listen(function(e){var t,n;switch(e.operationDetailed){case"removeLeft":a.removeLeft(e.count);break;case"removeRight":a.removeRight(e.count);break;case"remove":a.remove(a.data[e.index]);break;case"clear":a.clear();break;case"prepend":(t=a).unshift.apply(t,e.items.map(a.mapper));break;case"append":a.appendArray(e.items.map(a.mapper));break;case"insert":(n=a).insertAt.apply(n,[e.index].concat(e.items.map(a.mapper)));break;case"swap":a.swap(e.index,e.index2);break;case"replace":a.set(e.index,a.mapper(e.items[0]));break;case"merge":for(var i=a.data.slice(),r=e.previousState.slice(),o=0;o<e.newState.length;o++)if(a.data.length<=o&&a.data.push(a.mapper(e.newState[o])),r[o]!==e.newState[o]){var s=r.indexOf(e.newState[o]);if(-1!==s){var u=a.data[o];a.data[o]=a.data[s],a.data[s]=u;var l=r[o];r[o]=r[s],r[s]=l}else a.data.splice(o,0,a.mapper(e.newState[o])),r.splice(o,0,e.newState[o])}a.data.length>e.newState.length&&(a.data.length=e.newState.length),a.update({operation:"merge",operationDetailed:"merge",previousState:i,index:0,items:a.data,newState:a.data})}},i),a}return i(t,e),t.prototype.refresh=function(){this.merge(this.parent.data.map(this.mapper))},t}(E),S=function(e){function t(t,n,i){var a;void 0===i&&(i=new d);var r=t.getData().slice().sort(n);return(a=e.call(this,r)||this).parent=t,a.comparator=n,t.listen(function(e){var t;switch(e.operationDetailed){case"removeLeft":case"removeRight":for(var n,i=c(e.items);!(n=i()).done;)a.remove(n.value);break;case"remove":a.remove(e.items[0]);break;case"clear":a.clear();break;case"prepend":(t=a).unshift.apply(t,e.items),a.data.sort(a.comparator);break;case"append":case"insert":a.appendSorted(e.items);break;case"merge":a.merge(e.items.slice().sort(a.comparator));break;case"swap":break;case"replace":a.remove(e.target),a.appendSorted(e.items)}},i),a}i(t,e);var n=t.prototype;return n.appendSorted=function(e){this.merge(this.data.concat(e).sort(this.comparator))},n.refresh=function(){this.merge(this.parent.getData().slice().sort(this.comparator))},t}(E),A=function(e){function t(t,n,i){var a;void 0===i&&(i=new d),Array.isArray(t)&&(t=new E(t));var r=t.data.filter(n=null!=n?n:function(){return!0});return(a=e.call(this,r)||this).parent=t,a.viewFilter=n,t.listen(function(e){var t,n,i;switch(e.operationDetailed){case"clear":a.clear();break;case"removeLeft":case"removeRight":case"remove":for(var r,o=c(e.items);!(r=o()).done;)a.remove(r.value);break;case"prepend":i=e.items.filter(a.viewFilter),(t=a).unshift.apply(t,i);break;case"append":i=e.items.filter(a.viewFilter),a.appendArray(i);break;case"insert":i=e.items.filter(a.viewFilter),(n=a).insertAt.apply(n,[e.index].concat(i));break;case"merge":a.merge(e.items.filter(a.viewFilter));break;case"swap":var s=a.data.indexOf(e.items[0]),u=a.data.indexOf(e.items[1]);-1!==s&&-1!==u&&a.swap(s,u);break;case"replace":var l=a.data.indexOf(e.target);-1!==l&&(a.viewFilter(e.items[0])?a.set(l,e.items[0]):a.remove(e.target))}},i),a}i(t,e);var n=t.prototype;return n.updateFilter=function(e){if(this.viewFilter!==e)return this.viewFilter=e,this.refresh(),this.data.length},n.refresh=function(){this.merge(this.parent.data.filter(this.viewFilter))},t}(E);(g=e.DataFlow||(e.DataFlow={}))[g.UPSTREAM=0]="UPSTREAM",g[g.DOWNSTREAM=1]="DOWNSTREAM";var D=function(){function t(e,t){void 0===t&&(t=!0),this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new f,this.updateUpstreamEvent=new f,this.propagateWritesToReadStream=t}t.fromTwoDataSource=function(e,n,i,a){void 0===a&&(a=!0);var r=new t(i,a);return r.updateDownstreamEvent=e.updateEvent,r.updateUpstreamEvent=n.updateEvent,r};var n=t.prototype;return n.withInitial=function(e){return this.primed||this.updateDownstream(e),this},t.createOneWay=function(n,i){return void 0===n&&(n=e.DataFlow.DOWNSTREAM),new t(i,!1).oneWayFlow(n)},n.updateDownstream=function(e){if(this.updatingDownstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingDownstream=!0,this.value=e,this.updateDownstreamEvent.fire(e),this.updatingDownstream=!1},n.updateUpstream=function(e){if(this.updatingUpstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingUpstream=!0,this.value=e,this.updateUpstreamEvent.fire(e),this.propagateWritesToReadStream&&this.updateDownstreamEvent.fire(e),this.updatingUpstream=!1},n.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},n.listen=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},n.listenUpstream=function(e,t){return this.updateUpstreamEvent.subscribe(e,t).cancel},n.listenUpstreamOnce=function(e,t){return this.updateUpstreamEvent.subscribeOnce(e,t).cancel},n.listenDownstream=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},n.downStreamToDataSource=function(e){var t=new y(this.value);return this.listenDownstream(function(e){t.update(e)},e),t},n.aggregate=function(e,t,n){var i=this;n=null!=n?n:new d;var a=new b(n,t(this.value,e.value));return this.listen(function(){return a.update(t(i.value,e.value))},n),e.listen(function(){return a.update(t(i.value,e.value))},n),a},n.aggregateThree=function(e,t,n,i){var a=this;i=null!=i?i:new d;var r=new b(i,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(a.value,e.value,t.value))},i),e.listen(function(){return r.update(n(a.value,e.value,t.value))},i),t.listen(function(){return r.update(n(a.value,e.value,t.value))},i),r},n.aggregateFour=function(e,t,n,i,a){var r=this;a=null!=a?a:new d;var o=new b(a,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),e.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),t.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),n.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),o},n.filter=function(e,n,i){var a=this;if("function"==typeof n){var r=new t(void 0,!1);return this.listenDownstream(function(t){e(t,r.value)&&r.updateDownstream(t)},i),r.listenUpstream(function(e){n(e,a.value)&&a.updateUpstream(e)},i),r}var o=new y;return this.listenDownstream(function(t){e(t,o.value)&&o.update(t)},n),o},n.pipe=function(e,t){var n=this;return this.listenDownstream(function(t){return e.updateDownstream(t)},t),e.listenUpstream(function(e){return n.updateUpstream(e)},t),this},n.map=function(e,n,i){var a,r,o=this;return"function"==typeof n?(a=new t(this.primed?e(this.value):void 0,!1),this.listenDownstream(function(t){return a.updateDownstream(e(t))},i),a.listenUpstream(function(e){return o.updateUpstream(n(e))},i),a):(r=this.primed?new y(e(this.value)):new y,this.listenDownstream(function(t){return r.update(e(t))},n),r)},n.listenOnce=function(e,t){return this.updateDownstreamEvent.subscribeOnce(e,t).cancel},n.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},n.debounceUpstream=function(e,n){var i,a=this,r=new t(this.value);return r.listenUpstream(function(t){clearTimeout(i),i=setTimeout(function(){a.updateUpstream(t)},e)},n),this.listenDownstream(function(e){r.updateDownstream(e)},n),r},n.debounceDownstream=function(e,n){var i,a=this,r=new t(this.value);return this.listenDownstream(function(t){clearTimeout(i),i=setTimeout(function(){r.updateDownstream(t)},e)},n),r.listenUpstream(function(e){a.updateUpstream(e)},n),r},n.diff=function(e){e=null!=e?e:new d;var t=new b(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},n.await=function(e){e=null!=e?e:new d;var n=new t(void 0,!1);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var t=n.updateDownstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},e),this.listenUpstream(function(e){try{var t=n.updateUpstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},e),n},n.awaitLatest=function(e){throw new Error("not implemented")},n.awaitOrdered=function(e){throw new Error("not implemented")},n.unique=function(e){var n=this,i=new t(this.value,!1),a=this.value,r=this.value;return this.listenDownstream(function(e){r!==e&&(r=e,i.updateDownstream(e))},e),i.listenUpstream(function(e){a!==e&&(a=e,n.updateUpstream(e))},e),i},n.oneWayFlow=function(n,i){var a=this;void 0===n&&(n=e.DataFlow.DOWNSTREAM);var r=new t(this.value,!1);return n===e.DataFlow.DOWNSTREAM?(this.listenDownstream(function(e){return r.updateDownstream(e)},i),r.updateUpstream=function(){}):(r.listenUpstream(function(e){return a.updateUpstream(e)}),r.updateDownstream=function(){}),r},n.reduce=function(e,t,n){var i=new y(t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},n.cancelAll=function(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()},t}();function x(){var e={attachCalls:[],sessionToken:new d(function(){for(var t,n=c(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var O=Symbol("AurumElementModel"),C=new WeakMap,T=function(){function e(e,t){var n=this;this.children=[],this.api=t,this.api.onAttach(function(){if(void 0===n.hostNode)throw new Error("illegal state: Attach fired but not actually attached");n.render(e)})}var t=e.prototype;return t.dispose=function(){this.clearContent()},t.attachToDom=function(t,n){if(this.hostNode)throw new Error("Aurum Element is already attached");var i=e.id++;this.hostNode=t,this.contentStartMarker=document.createComment("START Aurum Node "+i),this.contentEndMarker=document.createComment("END Aurum Node "+i),n>=t.childNodes.length?(t.appendChild(this.contentStartMarker),t.appendChild(this.contentEndMarker)):(t.insertBefore(this.contentStartMarker,t.childNodes[n]),t.insertBefore(this.contentEndMarker,t.childNodes[n+1]))},t.getWorkIndex=function(){if(void 0!==this.lastStartIndex&&this.hostNode.childNodes[this.lastStartIndex]===this.contentStartMarker)return this.lastStartIndex+1;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentStartMarker)return this.lastStartIndex=e,e+1},t.getLastIndex=function(){if(void 0!==this.lastEndIndex&&this.hostNode.childNodes[this.lastEndIndex]===this.contentEndMarker)return this.lastEndIndex;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentEndMarker)return this.lastEndIndex=e,e},t.clearContent=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");for(var e=this.getWorkIndex();this.hostNode.childNodes[e]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[e])},t.updateDom=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");var t,n=this.getWorkIndex(),i=0;for(t=0;t<this.children.length;t++){var a=this.children[t];if(a instanceof e)i+=a.getLastIndex()-t-i-n;else if(this.hostNode.childNodes[t+n+i]!==this.contentEndMarker&&this.hostNode.childNodes[t+n+i]!==this.children[t]){if(!(a instanceof HTMLElement||a instanceof Text))throw new Error("not implemented");this.hostNode.removeChild(this.hostNode.childNodes[t+n+i]),this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(a,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(a)}else{if(!(a instanceof HTMLElement||a instanceof Text))throw new Error("not implemented");this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(a,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(a)}}for(;this.hostNode.childNodes[t+n+i]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[t+n+i])},e}();function N(e,t,n){if(void 0===n&&(n=!1),null!=e){if(R.has(e)){var i,a=R.get(e);a.sessionToken&&((i=t.attachCalls).push.apply(i,a.attachCalls),t.sessionToken.chain(a.sessionToken),a.attachCalls=void 0,a.sessionToken=void 0),R.delete(e)}if(Array.isArray(e))return Array.prototype.concat.apply([],e.map(function(e){return N(e,t,n)}));if(!n){if(e instanceof Promise){var r=new y;return e.then(function(e){r.update(e)}),new U(r,M(t))}if(e instanceof y||e instanceof D)return new U(e,M(t));if(e instanceof E)return new L(e,M(t));var o=typeof e;if("string"===o||"number"===o||"bigint"===o||"boolean"===o)return document.createTextNode(e.toString())}return e[O]?N(e.factory(e.props||{},e.children,M(t)),t,n):e}}T.id=1;var R=new WeakMap;function M(e){var t=void 0,n={renderSession:e,onAttach:function(t){e.attachCalls.push(t)},onDetach:function(n){t||(t=new d,e.tokens.push(t)),t.addCancelable(n)},onError:function(e){throw new Error("not implemented")},get cancellationToken(){return t||(t=new d,e.tokens.push(t)),t},prerender:function(e){var t=x(),n=N(e,t,!0);if(Array.isArray(n))for(var i,a=c(n);!(i=a()).done;){var r=i.value;"object"==typeof r&&R.set(r,t)}else R.set(n,t);return n},get style(){return function(e){for(var t,i=[].slice.call(arguments,1),a=new y,r=c(i);!(t=r()).done;){var o=t.value;(o instanceof y||o instanceof D)&&o.listen(function(){return a.update(I(e,i))},n.cancellationToken)}return a.update(I(e,i)),a}}};return n}function I(e,t){for(var n="",i=0;i<e.length;i++)n+=e[i],t[i]&&(n+="string"==typeof t[i]?t[i]:t[i].value);return n}var L=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).renderSessions=new WeakMap,i.dataSource=t,i}i(t,e);var n=t.prototype;return n.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},n.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},n.spliceChildren=function(e,t,n){for(var i,a=c(n?this.children.splice(e,t,n):this.children.splice(e,t));!(i=a()).done;)this.renderSessions.get(i.value).sessionToken.cancel()},n.handleNewContent=function(e){switch(e.operationDetailed){case"merge":for(var t=e.previousState.slice(),n=0;n<e.newState.length;n++)if(this.children.length<=n&&this.children.push(this.renderItem(e.newState[n])),t[n]!==e.newState[n]){var i=t.indexOf(e.newState[n]);if(-1!==i){var a=this.children[n];this.children[n]=this.children[i],this.children[i]=a;var r=t[n];t[n]=t[i],t[i]=r}else this.spliceChildren(n,0,this.renderItem(e.newState[n])),t.splice(n,0,e.newState[n])}this.children.length>e.newState.length&&(this.children.length=e.newState.length);break;case"remove":case"removeLeft":case"removeRight":this.spliceChildren(e.index,e.count);break;case"append":for(var o,s=c(e.items);!(o=s()).done;){var u=this.renderItem(o.value);Array.isArray(u)?this.children=this.children.concat(u):this.children.push(u)}break;case"replace":var l=this.renderItem(e.items[0]);if(Array.isArray(l))throw new Error("illegal state");this.children[e.index]=l;break;case"swap":var h=this.children[e.index2];this.children[e.index2]=this.children[e.index],this.children[e.index]=h;break;case"prepend":for(var d,f=c(e.items);!(d=f()).done;){var p=this.renderItem(d.value);if(Array.isArray(p))throw new Error("illegal state");this.children.unshift(p)}break;case"insert":for(var v,m=e.index,w=c(e.items);!(v=w()).done;){var g=this.renderItem(v.value);if(Array.isArray(g))throw new Error("illegal state");this.children.splice(m,0,g),m+=1}break;case"remove":for(var y,b=c(e.items);!(y=b()).done;){var E=this.renderItem(y.value);if(Array.isArray(E))throw new Error("illegal state");this.children.unshift(E)}break;case"clear":this.children.length=0,this.renderSessions=new WeakMap;break;default:throw new Error("not implemented")}this.updateDom()},n.renderItem=function(e){for(var t,n=x(),i=N(e,n),a=c(n.attachCalls);!(t=a()).done;)(0,t.value)();return this.renderSessions.set(i,n),i},t}(T),U=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).api.cancellationToken.addCancelable(function(){var e;return null===(e=i.renderSession)||void 0===e?void 0:e.sessionToken.cancel()}),i.dataSource=t,i}i(t,e);var n=t.prototype;return n.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},n.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},n.handleNewContent=function(e){if(this.lastValue!==e){var t=!1;if(1===this.children.length&&this.children[0]instanceof Text){var n=typeof e;"string"!==n&&"bigint"!==n&&"number"!==n||(this.children[0].nodeValue=e,t=!0)}t||this.fullRebuild(e),this.lastValue=e}},n.fullRebuild=function(e){this.clearContent(),this.endSession(),this.renderSession=x();var t=N(e,this.renderSession);if(void 0!==t){Array.isArray(t)||(t=[t]);for(var n,i=c(t);!(n=i()).done;){var a=n.value;a instanceof T&&a.attachToDom(this.hostNode,this.getLastIndex())}for(var r,o=c(this.renderSession.attachCalls);!(r=o()).done;)(0,r.value)();Array.isArray(t)&&(this.children=t)}else this.children=[]},n.endSession=function(){this.renderSession&&(this.renderSession.sessionToken.cancel(),this.renderSession=void 0)},t}(T),F={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},P=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function K(e,t,n,i){return function(a,r,o){var s=document.createElement(e);a&&function(e,t,n,i,a){j(e,F,t),a&&j(e,a,t);var r=Object.keys(t).filter(function(e){return e.includes("-")});V(e,P,t,r),i&&V(e,i,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof y||t instanceof D)t.value&&(Array.isArray(t.value)?(e.className=t.value.join(" "),t.unique(n).listen(function(){e.className=t.value.join(" ")})):(e.className=t.value,t.unique(n).listen(function(){e.className=t.value}))),t.unique(n).listen(function(t){return e.className=t});else{var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i;for(var a,r=c(t);!(a=r()).done;){var o=a.value;o instanceof y&&o.unique(n).listen(function(n){var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i})}}}(e,t.class,n)}(s,a,o.cancellationToken,t,n);var u=N(r,o.renderSession);return function e(t,n){if(null!=n)if(Array.isArray(n))for(var i,a=c(n);!(i=a()).done;)e(t,i.value);else if(n instanceof T)n.attachToDom(t,t.childNodes.length);else{if(!(n instanceof HTMLElement||n instanceof Text))throw new Error("Unexpected child type passed to DOM Node: "+n);t.appendChild(n)}}(s,u),a.onAttach&&o.onAttach(function(){return a.onAttach(s)}),a.onDetach&&o.onDetach(function(){s.isConnected&&s.parentElement.removeChild(s),a.onDetach(s)}),null==i||i(s,a,o.cancellationToken),s}}function j(e,t,n){var i=function(i){n[t[i]]&&(n[t[i]]instanceof y?e.addEventListener(i,function(e){return n[t[i]].update(e)}):n[t[i]]instanceof D?e.addEventListener(i,function(e){return n[t[i]].updateDownstream(e)}):"function"==typeof n[t[i]]&&e.addEventListener(i,function(e){return n[t[i]](e)}))};for(var a in t)i(a)}function V(e,t,n,i){for(var a,r=c(t);!(a=r()).done;){var o=a.value;n[o]&&q(e,n[o],o)}if(i)for(var s,u=c(i);!(s=u()).done;){var l=s.value;n[l]&&q(e,n[l],l)}}function q(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof y||t instanceof D))throw new Error("Attributes only support types boolean, string, number and data sources");"string"==typeof t.value?e.setAttribute(n,t.value):"boolean"==typeof t.value&&t.value&&e.setAttribute(n,""),t.unique().listen(function(t){"string"==typeof t?e.setAttribute(n,t):"boolean"==typeof t&&(t?e.setAttribute(n,""):e.removeAttribute(n))})}}var W=K("input",["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof y?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof D?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.checked&&(t.checked instanceof y?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.update(i.checked)})):t.checked instanceof D?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.updateUpstream(i.checked)})):i.checked=t.checked)}),_=K("select",void 0,{change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof y?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.update(i.value)})):t.value instanceof D?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.selectedIndex&&(t.selectedIndex instanceof y?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.update(i.selectedIndex)})):t.selectedIndex instanceof D?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.updateUpstream(i.selectedIndex)})):i.selectedIndex=t.selectedIndex)}),B=K("code"),Y=K("div"),H=K("a",["href","target"]),z=K("abbr"),$=K("h1"),G=K("h2"),J=K("h3"),Q=K("h4"),X=K("h5"),Z=K("h6"),ee=K("area",["alt","coors"]),te=K("article"),ne=K("aside"),ie=K("span"),ae=K("noscript"),re=K("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),oe=K("ul"),se=K("ol"),ue=K("li"),le=K("tr"),ce=K("b"),he=K("title"),de=K("summary"),fe=K("thead"),pe=K("template"),ve=K("q"),me=K("pre"),we=K("p"),ge=K("hr"),ye=K("audio",["controls","autoplay","loop","muted","preload","src"]),be=K("br"),Ee=K("button",["disabled"]),ke=K("canvas",["width","height"]),Se=K("data",["value"]),Ae=K("details"),De=K("em"),xe=K("footer"),Oe=K("form"),Ce=K("head"),Te=K("header"),Ne=K("heading"),Re=K("i"),Me=K("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),Ie=K("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),Le=K("label",["for"]),Ue=K("link",["href","rel","media","as","disabled","type"]),Fe=K("nav"),Pe=K("sub"),Ke=K("sup"),je=K("table"),Ve=K("tbody"),qe=K("tfoot"),We=K("td"),_e=K("th"),Be=K("time",["datetime"]),Ye=K("style",["media"]),He=K("source",["src","srcSet","media","sizes","type"]),ze=K("script",["src","async","defer","integrity","noModule","type"]),$e=K("svg",["width","height"]),Ge=K("progress",["max","value"]),Je=K("option",["value"]),Qe=K("slot",["name"]),Xe={button:Ee,code:B,hr:ge,div:Y,input:W,li:ue,span:ie,style:Ye,ul:oe,p:we,img:Ie,link:Ue,canvas:ke,a:H,article:te,br:be,form:Oe,label:Le,ol:se,pre:me,progress:Ge,table:je,td:We,tr:le,th:_e,textarea:K("textArea",["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof y?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof D?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value)}),h1:$,h2:G,h3:J,h4:Q,h5:X,h6:Z,head:Ce,header:Te,footer:xe,nav:Fe,b:ce,i:Re,script:ze,abbr:z,area:ee,aside:ne,audio:ye,em:De,heading:Ne,iframe:Me,noscript:ae,option:Je,q:ve,select:_,source:He,title:he,video:re,tbody:Ve,tfoot:qe,thead:fe,summary:de,details:Ae,sub:Pe,sup:Ke,svg:$e,data:Se,time:Be,template:pe,slot:Qe},Ze=function(){function e(){}return e.attach=function(e,t){var n=x(),i=N(e,n);if(i instanceof T)i.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(function(){return i.dispose()});else if(Array.isArray(i)){var a=new L(new E(i),M(n));n.sessionToken.addCancelable(function(){return a.dispose()}),a.attachToDom(t,t.childNodes.length)}else t.appendChild(i),n.sessionToken.addCancelable(function(){t.removeChild(i)});for(var r=n.attachCalls.length-1;r>=0;r--)n.attachCalls[r]();return n.sessionToken},e.factory=function(e,t){var n,i;if("string"==typeof e){i=e;var a=e;if(void 0===(e=Xe[e]))throw new Error("Node "+a+" does not exist or is not supported")}return(n={})[O]=!0,n.name=i,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();function et(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function tt(e,t){}function nt(e,t){}function it(e,t){}function at(e,t){}var rt=function(){function e(e){e&&(this.data=e),this.updateEvent=new f,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n,i=new y(null===(n=this.data)||void 0===n?void 0:n[e]);return this.listenOnKey(e,function(e){i.update(e.newValue)},t),i},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data[e],oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new f),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return Object.keys(this.data)},t.values=function(){return Object.values(this.data)},t.get=function(e){return this.data[e]},t.delete=function(e){var t=this.data[e];delete this.data[e],this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data[e]!==t){var n=this.data[e];this.data[e]=t,this.updateEvent.fire({oldValue:n,key:e,newValue:this.data[e]}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data[e]})}},t.assign=function(t){if(t instanceof e)for(var n,i=c(t.keys());!(n=i()).done;){var a=n.value;this.set(a,t.data[a])}else for(var r=0,o=Object.keys(t);r<o.length;r++){var s=o[r];this.set(s,t[s])}},t.toObject=function(){return Object.assign({},this.data)},t.toDataSource=function(){var e=this,t=new y(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),ot=function(){function e(e){e&&(this.data=e),this.updateEvent=new f,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new y(this.data.get(e));return this.listenOnKey(e,function(e){n.update(e.newValue)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data.get(e),oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new f),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.values=function(){return this.data.values()},t.get=function(e){return this.data.get(e)},t.has=function(e){return this.data.has(e)},t.delete=function(e){var t=this.data.get(e);this.data.delete(e),this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data.get(e)!==t){var n=this.data.get(e);this.data.set(e,t),this.updateEvent.fire({oldValue:n,key:e,newValue:this.data.get(e)}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data.get(e)})}},t.assign=function(e){for(var t,n=c(e.keys());!(t=n()).done;){var i=t.value;this.set(i,e.get(i))}},t.toMap=function(){return new Map(this.data.entries())},e}(),st=function(){function e(e){e&&(this.data=e),this.updateEvent=new f,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new y(this.data.has(e));return this.listenOnKey(e,function(e){n.update(e)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t(this.has(e)),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new f),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.has=function(e){return this.data.has(e)},t.delete=function(e){this.data.delete(e),this.updateEvent.fire({key:e,exists:!1}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!1)},t.add=function(e){this.data.has(e)||(this.data.add(e),this.updateEvent.fire({key:e,exists:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!0))},t.assign=function(e){for(var t,n=c(e.keys());!(t=n()).done;)this.add(t.value)},t.toSet=function(){return new Set(this.data.keys())},e}(),ut=function(){function e(e,t){this.input=null!=e?e:new y,this.output=null!=t?t:this.input}var t=e.prototype;return t.update=function(e){this.input.update(e)},t.listen=function(e,t){return this.output.listen(e,t)},t.listenAndRepeat=function(e,t){return this.output.listenAndRepeat(e,t)},t.listenOnce=function(e,t){return this.output.listenOnce(e,t)},t.filter=function(t,n){return new e(this.input,this.output.filter(t,n))},t.unique=function(t){return new e(this.input,this.output.unique(t))},t.map=function(t,n){return new e(this.input,this.output.map(t,n))},t.reduce=function(t,n,i){return new e(this.input,this.output.reduce(t,n,i))},t.awaitNextUpdate=function(e){return this.output.awaitNextUpdate(e)},t.await=function(t){return new e(this.input,this.output.await(t))},t.awaitLatest=function(t){return new e(this.input,this.output.awaitLatest(t))},t.awaitOrdered=function(t){return new e(this.input,this.output.awaitOrdered(t))},t.cancelAll=function(){this.input.cancelAll(),this.output.cancelAll()},n(e,[{key:"value",get:function(){return this.output.value}}]),e}();e.ArrayAurumElement=L,e.ArrayDataSource=E,e.Aurum=Ze,e.AurumElement=T,e.AurumRouter=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[O]||!(e.factory===tt||e.factory===nt)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===nt}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var i=new y(et());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){i.update(et())}),i.unique(n.cancellationToken).withInitial(i.value).map(function(e){return function(e,t){var n,i;if(null==e)return null===(n=t.find(function(e){return e.factory===nt}))||void 0===n?void 0:n.children;if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children;var a=e.split("/");a.pop();for(var r=function(){var e=a.join("/");if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return{v:t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children};a.pop()};a.length;){var o=r();if("object"==typeof o)return o.v}return null===(i=t.find(function(e){return e.factory===nt}))||void 0===i?void 0:i.children}(e,t)})},e.CancellationToken=d,e.DataSource=y,e.DefaultRoute=nt,e.DefaultSwitchCase=at,e.DuplexDataSource=D,e.EventEmitter=f,e.FilteredArrayView=A,e.MapDataSource=ot,e.MappedArrayView=k,e.ObjectDataSource=rt,e.Route=tt,e.SetDataSource=st,e.SingularAurumElement=U,e.SortedArrayView=S,e.Stream=ut,e.Suspense=function(e,t,n){var i=new y(null==e?void 0:e.fallback),a=new d;return n.onDetach(function(){a.cancel()}),Promise.all(n.prerender(t,a)).then(function(e){a.isCanceled||i.update(e)},function(e){return a.cancel(),Promise.reject(e)}),i},e.Switch=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[O]||!(e.factory===it||e.factory===at)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===at}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");var i=new d;return n.onDetach(function(){i.cancel()}),e.state.unique(i).withInitial(e.state.value).map(function(e){return function(e,t){var n,i,a;return null!==(i=null===(n=t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.when)===e}))||void 0===n?void 0:n.children)&&void 0!==i?i:null===(a=t.find(function(e){return e.factory===at}))||void 0===a?void 0:a.children}(e,t)})},e.SwitchCase=it,e.TransientDataSource=b,e.Webcomponent=function(e,t){return customElements.define(e.name,function(a){function r(){var t;t=a.call(this)||this,void 0===e.observedAttributes&&(e.observedAttributes=[]),t.props={};for(var n,i=c(e.observedAttributes);!(n=i()).done;)t.props[n.value]=new y;return t}i(r,a);var o=r.prototype;return o.attributeChangedCallback=function(e,t,n){t!==n&&this.props[e].update(n)},o.connectedCallback=function(){var n,i=document.createDocumentFragment();this.session=x(),this.api=M(this.session);for(var a,r=t(this.props,this.api),o=c(this.session.attachCalls);!(a=o()).done;)(0,a.value)();Ze.attach(r,i),this.attachShadow({mode:null!==(n=e.shadowRootMode)&&void 0!==n?n:"open",delegatesFocus:e.shadowRootDelegatesFocus}).appendChild(i)},o.disconnectedCallback=function(){this.session.sessionToken.cancel()},n(r,null,[{key:"observedAttributes",get:function(){return e.observedAttributes}}]),r}(u(HTMLElement))),K(e.name,e.observedAttributes,void 0,function(e,t){for(var n in t)n in e.props||(e.props[n]=t[n])})},e.aurumClassName=function(e,t){var n=[],i=function(i){if(e[i])if(e[i]instanceof y||e[i]instanceof D){var a=e[i],r=new y(a.value?i:"");a.listen(function(e){r.update(e?i:"")},t),n.push(r)}else n.push(i)};for(var a in e)i(a);return n},e.aurumElementModelIdentitiy=O,e.createAPI=M,e.createRenderSession=x,e.nodeData=C,e.pendingSessions=R,e.render=N}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).aurum={})}(this,function(e){function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function s(e,t,n){return(s=o()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&r(a,n.prototype),a}).apply(null,arguments)}function u(e){var t="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return s(e,arguments,a(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),r(n,e)})(e)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function c(e){var t=0;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e)))return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=e[Symbol.iterator]()).next.bind(t)}var h,d=function(){function e(){var e=[].slice.call(arguments);this.cancelables=null!=e?e:[],this._isCancelled=!1}var t=e.prototype;return t.hasCancellables=function(){return this.cancelables.length>0},t.addCancelable=function(e){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.push(e),200===this.cancelables.length&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this},t.removeCancelable=function(e){this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled");var t=this.cancelables.indexOf(e);return-1!==t&&this.cancelables.splice(t,1),this},t.setTimeout=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=this;void 0===t&&(t=0);var i=setTimeout(function(){n.removeCancelable(a),e()},t),a=function(){return clearTimeout(i)};this.addCancelable(a)}),t.setInterval=function(e){function t(t,n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n=setInterval(e,t);this.addCancelable(function(){return clearInterval(n)})}),t.requestAnimationFrame=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){var t=this,n=requestAnimationFrame(function(){t.removeCancelable(i),e()}),i=function(){return cancelAnimationFrame(n)};this.addCancelable(i)}),t.animationLoop=function(e){var t=requestAnimationFrame(function n(i){e(i),t=requestAnimationFrame(n)});this.addCancelable(function(){return cancelAnimationFrame(t)})},t.throwIfCancelled=function(e){if(this.isCanceled)throw new Error(e||"cancellation token is cancelled")},t.chain=function(e,t){return void 0===t&&(t=!1),t&&e.chain(this,!1),this.addCancelable(function(){return e.cancel()}),this},t.registerDomEvent=function(e,t,n){return e.addEventListener(t,n),this.addCancelable(function(){return e.removeEventListener(t,n)}),this},t.cancel=function(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(function(e){return e()}),this.cancelables=void 0)},n(e,[{key:"isCanceled",get:function(){return this._isCancelled}}]),e}(),f=function(){function e(){this.subscribeChannel=[],this.subscribeOnceChannel=[],this.onAfterFire=[]}var t=e.prototype;return t.subscribe=function(e,t){return this.createSubscription(e,this.subscribeChannel,t).facade},t.subscribeOnce=function(e,t){return this.createSubscription(e,this.subscribeOnceChannel,t).facade},t.hasSubscriptions=function(){return this.subscriptions>0},t.cancelAll=function(){var e,t=this;this.isFiring?this.onAfterFire.push(function(){var e;t.subscribeChannel.length=0,t.subscribeOnceChannel.length=0,null===(e=t.onEmpty)||void 0===e||e.call(t)}):(this.subscribeChannel.length=0,this.subscribeOnceChannel.length=0,null===(e=this.onEmpty)||void 0===e||e.call(this))},t.afterFire=function(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(function(e){return e()}),this.onAfterFire.length=0)},t.fire=function(e){this.isFiring=!0;for(var t=this.subscribeChannel.length,n=0;n<t;n++)try{this.subscribeChannel[n].callback(e)}catch(e){console.error(e)}if(this.subscribeOnceChannel.length>0){t=this.subscribeOnceChannel.length;for(var i=0;i<t;i++)try{this.subscribeOnceChannel[i].callback(e)}catch(e){console.error(e)}this.subscribeOnceChannel.length=0}this.isFiring=!1,this.afterFire()},t.createSubscription=function(e,t,n){var i=this,a={callback:e},r={cancel:function(){i.cancel(a,t)}};return void 0!==n&&n.addCancelable(function(){return i.cancel(a,t)}),t.push(a),{subscription:a,facade:r}},t.cancel=function(e,t){var n,i=this,a=t.indexOf(e);a>=0&&(this.isFiring?this.onAfterFire.push(function(){return i.cancel(e,t)}):(t.splice(a,1),this.hasSubscriptions()||null===(n=this.onEmpty)||void 0===n||n.call(this)))},n(e,[{key:"subscriptions",get:function(){return this.subscribeChannel.length+this.subscribeOnceChannel.length}}]),e}();function p(e,t,n){if(!e.s){if(n instanceof v){if(!n.s)return void(n.o=p.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(p.bind(null,e,t),p.bind(null,e,2));e.s=t,e.v=n;var i=e.o;i&&i(e)}}(h=e.OperationType||(e.OperationType={}))[h.FILTER=0]="FILTER",h[h.MAP=1]="MAP",h[h.DELAY=2]="DELAY",h[h.MAP_DELAY=3]="MAP_DELAY";var v=function(){function e(){}return e.prototype.then=function(t,n){var i=new e,a=this.s;if(a){var r=1&a?t:n;if(r){try{p(i,1,r(this.v))}catch(e){p(i,2,e)}return i}return this}return this.o=function(e){try{var a=e.v;1&e.s?p(i,1,t?t(a):a):n?p(i,1,n(a)):p(i,2,a)}catch(e){p(i,2,e)}},i},e}(),m="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function w(e){return e instanceof v&&1&e.s}var g,y=function(){function t(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new f}t.fromMultipleSources=function(e,n){for(var i,a=new t,r=c(e);!(i=r()).done;)i.value.listen(function(e){return a.update(e)},n);return a};var n=t.prototype;return n.repeatLast=function(){return this.update(this.value),this},n.update=function(e){if(this.primed=!0,this.updating)throw new Error("Problem in data source: Unstable value propagation. When updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=e,this.updateEvent.fire(e),this.updating=!1},n.withInitial=function(e){return this.primed||this.update(e),this},n.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},n.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},n.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},n.filter=function(e,t){t=null!=t?t:new d;var n=new b(t);return this.listen(function(t){e(t,n.value)&&n.update(t)},t),n},n.max=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)>0:e>t},e)},n.min=function(e){return this.filter(function(e,t){return"string"==typeof e&&"string"==typeof t?e.localeCompare(t)<0:e<t},e)},n.transform=function(n,i,a,r,o,s,u,l,c,h,f,g){var y,b=[n,i,a,r,o,s,u,l,c,h,f].filter(function(e){return!(e&&e instanceof d&&(y=e,1))});g&&(y=g);var E=new t;return this.listen(function(t){try{var i,a=function(e){if(i)return e;E.update(t)},r=function(e,t,n){if("function"==typeof e[m]){var i,a,r,o=e[m]();if(function e(s){try{for(;!((i=o.next()).done||n&&n());)if((s=t(i.value))&&s.then){if(!w(s))return void s.then(e,r||(r=p.bind(null,a=new v,2)));s=s.v}a?p(a,1,s):a=s}catch(e){p(a||(a=new v),2,e)}}(),o.return){var s=function(e){try{i.done||o.return()}catch(e){}return e};if(a&&a.then)return a.then(s,function(e){throw s(e)});s()}return a}if(!("length"in e))throw new TypeError("Object is not iterable");for(var u=[],l=0;l<e.length;l++)u.push(e[l]);return function(e,t,n){var i,a,r=-1;return function o(s){try{for(;++r<e.length&&(!n||!n());)if((s=t(r))&&s.then){if(!w(s))return void s.then(o,a||(a=p.bind(null,i=new v,2)));s=s.v}i?p(i,1,s):i=s}catch(e){p(i||(i=new v),2,e)}}(),i}(u,function(e){return t(u[e])},n)}(b,function(a){return function(e,t){var n,i=-1;e:{for(var a=0;a<t.length;a++){var r=t[a][0];if(r){var o=r();if(o&&o.then)break e;if(o===e){i=a;break}}else i=a}if(-1!==i){do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then){n=!0;break e}var l=t[i][2];i++}while(l&&!l());return u}}var c=new v,h=p.bind(null,c,2);return(n?u.then(d):o.then(function n(o){for(;;){if(o===e){i=a;break}if(++a===t.length){if(-1!==i)break;return void p(c,1,u)}if(r=t[a][0]){if((o=r())&&o.then)return void o.then(n).then(void 0,h)}else i=a}do{for(var s=t[i][1];!s;)i++,s=t[i][1];var u=s();if(u&&u.then)return void u.then(d).then(void 0,h);var l=t[i][2];i++}while(l&&!l());p(c,1,u)})).then(void 0,h),c;function d(e){for(;;){var n=t[i][2];if(!n||n())break;i++;for(var a=t[i][1];!a;)i++,a=t[i][1];if((e=a())&&e.then)return void e.then(d).then(void 0,h)}p(c,1,e)}}(n.operationType,[[function(){return e.OperationType.MAP},function(){t=a.operation(t)}],[function(){return e.OperationType.DELAY}],[function(){return e.OperationType.MAP_DELAY},function(){return Promise.resolve(a.operation(t)).then(function(e){t=e})}],[function(){return e.OperationType.FILTER},function(){a.operation(t)||(i=1)}]])},function(){return i});return Promise.resolve(r&&r.then?r.then(a):a(r))}catch(e){return Promise.reject(e)}},y),E},n.pipe=function(e,t){return this.listen(function(t){return e.update(t)},t),this},n.map=function(e,t){var n;return t=null!=t?t:new d,n=this.primed?new b(t,e(this.value)):new b(t),this.listen(function(t){n.update(e(t))},t),n},n.tap=function(e,t){return this.listen(function(t){e(t)},t),this},n.loadBalance=function(e,t){var n=0;this.listen(function(t){e[n++].update(t),n>=e.length&&(n=0)},t)},n.await=function(e){e=null!=e?e:new d;var t=new b(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var n=t.update;return Promise.resolve(e).then(function(e){n.call(t,e)})}catch(e){return Promise.reject(e)}},e),t},n.awaitOrdered=function(e){e=null!=e?e:new d;var t=[],n=new b(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=!1,a=function(){if(!(e instanceof Promise)){var a=n.update;return Promise.resolve(e).then(function(e){a.call(n,e)})}t.push(e),function(){try{var e=function(){i=!1};i||(i=!0);var a=function(e,t,n){for(var i;;){var a=e();if(w(a)&&(a=a.v),!a)return r;if(a.then){i=0;break}var r=n();if(r&&r.then){if(!w(r)){i=1;break}r=r.s}}var o=new v,s=p.bind(null,o,2);return(0===i?a.then(l):1===i?r.then(u):(void 0).then(function(){(a=e())?a.then?a.then(l).then(void 0,s):l(a):p(o,1,r)})).then(void 0,s),o;function u(t){r=t;do{if(!(a=e())||w(a)&&!a.v)return void p(o,1,r);if(a.then)return void a.then(l).then(void 0,s);w(r=n())&&(r=r.v)}while(!r||!r.then);r.then(u).then(void 0,s)}function l(e){e?(r=n())&&r.then?r.then(u).then(void 0,s):u(r):p(o,1,r)}}(function(){return!!t.length},0,function(){var e=n.update;return Promise.resolve(t[0]).then(function(i){e.call(n,i),t.shift()})});Promise.resolve(a&&a.then?a.then(e):e())}catch(e){return Promise.reject(e)}}()}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e),n},n.awaitLatest=function(e){var t;e=null!=e?e:new d;var n=new b(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var i=t=Date.now();return Promise.resolve(e).then(function(e){t===i&&n.update(e)})}catch(e){return Promise.reject(e)}},e),n},n.unique=function(e){e=null!=e?e:new d;var t=new b(e,this.value);return this.listen(function(e){e!==t.value&&t.update(e)},e),t},n.diff=function(e){e=null!=e?e:new d;var t=new b(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},n.reduce=function(e,t,n){n=null!=n?n:new d;var i=new b(n,t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},n.aggregate=function(e,t,n){var i=this;n=null!=n?n:new d;var a=new b(n,t(this.value,e.value));return this.listen(function(){return a.update(t(i.value,e.value))},n),e.listen(function(){return a.update(t(i.value,e.value))},n),a},n.aggregateThree=function(e,t,n,i){var a=this;i=null!=i?i:new d;var r=new b(i,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(a.value,e.value,t.value))},i),e.listen(function(){return r.update(n(a.value,e.value,t.value))},i),t.listen(function(){return r.update(n(a.value,e.value,t.value))},i),r},n.aggregateFour=function(e,t,n,i,a){var r=this;a=null!=a?a:new d;var o=new b(a,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),e.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),t.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),n.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),o},n.combine=function(e,t){t=null!=t?t:new d;var n=new b(t);this.pipe(n,t);for(var i,a=c(e);!(i=a()).done;)i.value.pipe(n,t);return n},n.delay=function(e,t){t=null!=t?t:new d;var n=new b(t,this.value);return this.listen(function(t){setTimeout(function(){n.update(t)},e)},t),n},n.skip=function(e,t){t=null!=t?t:new d;var n=new b(t,this.value);return this.listen(function(t){0===e?n.update(t):e--},t),n},n.cutoff=function(e,t){t=null!=t?t:new d;var n=new b(t,this.value);return this.listen(function(t){e-- >0&&n.update(t)},t),n},n.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},n.debounce=function(e,t){t=null!=t?t:new d;var n,i=new b(t,this.value);return this.listen(function(t){clearTimeout(n),n=setTimeout(function(){i.update(t)},e)},t),i},n.throttle=function(e,t){t=null!=t?t:new d;var n=new b(t,this.value),i=!1;return this.listen(function(t){i||(n.update(t),i=!0,setTimeout(function(){i=!1},e))},t),n},n.buffer=function(e,t){t=null!=t?t:new d;var n,i=new b(t),a=[];return this.listen(function(t){a.push(t),n||(n=setTimeout(function(){n=void 0,i.update(a),a=[]},e))},t),i},n.accumulate=function(e){var t=new E;return this.listen(function(e){t.push(e)},e),t},n.pick=function(e,t){var n;t=null!=t?t:new d;var i=new b(t,null===(n=this.value)||void 0===n?void 0:n[e]);return this.listen(function(t){i.update(null!=t?t[e]:t)},t),i},n.cancelAll=function(){this.updateEvent.cancelAll()},t}(),b=function(e){function t(t,n){var i;return(i=e.call(this,n)||this).disposeToken=t,i.updateEvent.onEmpty=function(){t.cancel(),Object.defineProperty(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(i),"value",{get:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')},set:function(){throw new Error('Transient data source has expired and can no longer be used if you wish to use it even after all listeners were removed "persist". Note that persisted data sources will not be garabge collected unless you remove the subscription they have on their parent source')}})},i}i(t,e);var n=t.prototype;return n.persist=function(){return this.updateEvent.onEmpty=void 0,this},n.listen=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},n.listenAndRepeat=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listenAndRepeat.call(this,t,n)},n.listenOnce=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},t}(y),E=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new y(this.data.length),this.updateEvent=new f}var t=e.prototype;return t.listenAndRepeat=function(e,t){return e({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(e,t)},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnce=function(e,t){return this.updateEvent.subscribeOnce(e,t).cancel},t.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},t.getData=function(){return this.data},t.get=function(e){return this.data[e]},t.set=function(e,t){var n=this.data[e];n!==t&&(this.data[e]=t,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:e,items:[t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},t.swap=function(e,t){if(e!==t){var n=this.data[e],i=this.data[t];this.data[t]=n,this.data[e]=i,this.update({operation:"swap",operationDetailed:"swap",index:e,index2:t,items:[n,i],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},t.swapItems=function(e,t){if(e!==t){var n=this.data.indexOf(e),i=this.data.indexOf(t);-1!==n&&-1!==i&&(this.data[i]=e,this.data[n]=t),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:i,items:[e,t],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},t.appendArray=function(e){this.data=this.data.concat(e),this.update({operation:"add",operationDetailed:"append",count:e.length,index:this.data.length-e.length,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},t.insertAt=function(e){var t,n=[].slice.call(arguments,1);0!==n.length&&((t=this.data).splice.apply(t,[e,0].concat(n)),this.update({operation:"add",operationDetailed:"insert",count:n.length,index:e,items:n,newState:this.data}),this.lengthSource.update(this.data.length))},t.push=function(){this.appendArray([].slice.call(arguments))},t.unshift=function(){var e,t=[].slice.call(arguments);(e=this.data).unshift.apply(e,t),this.update({operation:"add",operationDetailed:"prepend",count:t.length,items:t,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},t.pop=function(){var e=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},t.merge=function(e){var t=this.data;this.data=e.slice(),this.update({operation:"merge",operationDetailed:"merge",previousState:t,index:0,items:this.data,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},t.removeRight=function(e){var t=this.data.length,n=this.data.splice(t-e,e);this.update({operation:"remove",operationDetailed:"removeRight",count:e,index:t-e,items:n,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},t.removeLeft=function(e){var t=this.data.splice(0,e);this.update({operation:"remove",operationDetailed:"removeLeft",count:e,index:0,items:t,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)},t.remove=function(e){var t=this.data.indexOf(e);-1!==t&&(this.data.splice(t,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:t,items:[e],newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length))},t.clear=function(){if(0!==this.data.length){var e=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:e.length,index:0,items:e,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length)}},t.shift=function(){var e=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[e],count:1,index:0,newState:this.data}),this.lengthSource.value!==this.data.length&&this.lengthSource.update(this.data.length),e},t.toArray=function(){return this.data.slice()},t.sort=function(e,t,n){void 0===t&&(t=[]);var i=new S(this,e,n),a=new d;return n&&n.addCancelable(function(){return a.cancel()}),t.forEach(function(e){e.listen(function(){return i.refresh()})},a),i},t.map=function(e,t,n){void 0===t&&(t=[]);var i=new k(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()})},n),i},t.filter=function(e,t,n){void 0===t&&(t=[]);var i=new A(this,e,n);return t.forEach(function(e){e.listen(function(){return i.refresh()},n)}),i},t.forEach=function(e){return this.data.forEach(e)},t.update=function(e){this.updateEvent.fire(e)},n(e,[{key:"length",get:function(){return this.lengthSource}}]),e}(),k=function(e){function t(t,n,i){var a;void 0===i&&(i=new d);var r=t.getData().map(n);return(a=e.call(this,r)||this).parent=t,a.mapper=n,t.listen(function(e){var t,n;switch(e.operationDetailed){case"removeLeft":a.removeLeft(e.count);break;case"removeRight":a.removeRight(e.count);break;case"remove":a.remove(a.data[e.index]);break;case"clear":a.clear();break;case"prepend":(t=a).unshift.apply(t,e.items.map(a.mapper));break;case"append":a.appendArray(e.items.map(a.mapper));break;case"insert":(n=a).insertAt.apply(n,[e.index].concat(e.items.map(a.mapper)));break;case"swap":a.swap(e.index,e.index2);break;case"replace":a.set(e.index,a.mapper(e.items[0]));break;case"merge":for(var i=a.data.slice(),r=e.previousState.slice(),o=0;o<e.newState.length;o++)if(a.data.length<=o&&a.data.push(a.mapper(e.newState[o])),r[o]!==e.newState[o]){var s=r.indexOf(e.newState[o]);if(-1!==s){var u=a.data[o];a.data[o]=a.data[s],a.data[s]=u;var l=r[o];r[o]=r[s],r[s]=l}else a.data.splice(o,0,a.mapper(e.newState[o])),r.splice(o,0,e.newState[o])}a.data.length>e.newState.length&&(a.data.length=e.newState.length),a.update({operation:"merge",operationDetailed:"merge",previousState:i,index:0,items:a.data,newState:a.data})}},i),a}return i(t,e),t.prototype.refresh=function(){this.merge(this.parent.data.map(this.mapper))},t}(E),S=function(e){function t(t,n,i){var a;void 0===i&&(i=new d);var r=t.getData().slice().sort(n);return(a=e.call(this,r)||this).parent=t,a.comparator=n,t.listen(function(e){var t;switch(e.operationDetailed){case"removeLeft":case"removeRight":for(var n,i=c(e.items);!(n=i()).done;)a.remove(n.value);break;case"remove":a.remove(e.items[0]);break;case"clear":a.clear();break;case"prepend":(t=a).unshift.apply(t,e.items),a.data.sort(a.comparator);break;case"append":case"insert":a.appendSorted(e.items);break;case"merge":a.merge(e.items.slice().sort(a.comparator));break;case"swap":break;case"replace":a.remove(e.target),a.appendSorted(e.items)}},i),a}i(t,e);var n=t.prototype;return n.appendSorted=function(e){this.merge(this.data.concat(e).sort(this.comparator))},n.refresh=function(){this.merge(this.parent.getData().slice().sort(this.comparator))},t}(E),A=function(e){function t(t,n,i){var a;void 0===i&&(i=new d),Array.isArray(t)&&(t=new E(t));var r=t.data.filter(n=null!=n?n:function(){return!0});return(a=e.call(this,r)||this).parent=t,a.viewFilter=n,t.listen(function(e){var t,n,i;switch(e.operationDetailed){case"clear":a.clear();break;case"removeLeft":case"removeRight":case"remove":for(var r,o=c(e.items);!(r=o()).done;)a.remove(r.value);break;case"prepend":i=e.items.filter(a.viewFilter),(t=a).unshift.apply(t,i);break;case"append":i=e.items.filter(a.viewFilter),a.appendArray(i);break;case"insert":i=e.items.filter(a.viewFilter),(n=a).insertAt.apply(n,[e.index].concat(i));break;case"merge":a.merge(e.items.filter(a.viewFilter));break;case"swap":var s=a.data.indexOf(e.items[0]),u=a.data.indexOf(e.items[1]);-1!==s&&-1!==u&&a.swap(s,u);break;case"replace":var l=a.data.indexOf(e.target);-1!==l&&(a.viewFilter(e.items[0])?a.set(l,e.items[0]):a.remove(e.target))}},i),a}i(t,e);var n=t.prototype;return n.updateFilter=function(e){if(this.viewFilter!==e)return this.viewFilter=e,this.refresh(),this.data.length},n.refresh=function(){this.merge(this.parent.data.filter(this.viewFilter))},t}(E);(g=e.DataFlow||(e.DataFlow={}))[g.UPSTREAM=0]="UPSTREAM",g[g.DOWNSTREAM=1]="DOWNSTREAM";var D=function(){function t(e,t){void 0===t&&(t=!0),this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new f,this.updateUpstreamEvent=new f,this.propagateWritesToReadStream=t}t.fromTwoDataSource=function(e,n,i,a){void 0===a&&(a=!0);var r=new t(i,a);return r.updateDownstreamEvent=e.updateEvent,r.updateUpstreamEvent=n.updateEvent,r};var n=t.prototype;return n.withInitial=function(e){return this.primed||this.updateDownstream(e),this},t.createOneWay=function(n,i){return void 0===n&&(n=e.DataFlow.DOWNSTREAM),new t(i,!1).oneWayFlow(n)},n.updateDownstream=function(e){if(this.updatingDownstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingDownstream=!0,this.value=e,this.updateDownstreamEvent.fire(e),this.updatingDownstream=!1},n.updateUpstream=function(e){if(this.updatingUpstream)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.primed=!0,this.updatingUpstream=!0,this.value=e,this.updateUpstreamEvent.fire(e),this.propagateWritesToReadStream&&this.updateDownstreamEvent.fire(e),this.updatingUpstream=!1},n.listenAndRepeat=function(e,t){return e(this.value),this.listen(e,t)},n.listen=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},n.listenUpstream=function(e,t){return this.updateUpstreamEvent.subscribe(e,t).cancel},n.listenUpstreamOnce=function(e,t){return this.updateUpstreamEvent.subscribeOnce(e,t).cancel},n.listenDownstream=function(e,t){return this.updateDownstreamEvent.subscribe(e,t).cancel},n.downStreamToDataSource=function(e){var t=new y(this.value);return this.listenDownstream(function(e){t.update(e)},e),t},n.aggregate=function(e,t,n){var i=this;n=null!=n?n:new d;var a=new b(n,t(this.value,e.value));return this.listen(function(){return a.update(t(i.value,e.value))},n),e.listen(function(){return a.update(t(i.value,e.value))},n),a},n.aggregateThree=function(e,t,n,i){var a=this;i=null!=i?i:new d;var r=new b(i,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(a.value,e.value,t.value))},i),e.listen(function(){return r.update(n(a.value,e.value,t.value))},i),t.listen(function(){return r.update(n(a.value,e.value,t.value))},i),r},n.aggregateFour=function(e,t,n,i,a){var r=this;a=null!=a?a:new d;var o=new b(a,i(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),e.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),t.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),n.listen(function(){return o.update(i(r.value,e.value,t.value,n.value))},a),o},n.filter=function(e,n,i){var a=this;if("function"==typeof n){var r=new t(void 0,!1);return this.listenDownstream(function(t){e(t,r.value)&&r.updateDownstream(t)},i),r.listenUpstream(function(e){n(e,a.value)&&a.updateUpstream(e)},i),r}var o=new y;return this.listenDownstream(function(t){e(t,o.value)&&o.update(t)},n),o},n.pipe=function(e,t){var n=this;return this.listenDownstream(function(t){return e.updateDownstream(t)},t),e.listenUpstream(function(e){return n.updateUpstream(e)},t),this},n.map=function(e,n,i){var a,r,o=this;return"function"==typeof n?(a=new t(this.primed?e(this.value):void 0,!1),this.listenDownstream(function(t){return a.updateDownstream(e(t))},i),a.listenUpstream(function(e){return o.updateUpstream(n(e))},i),a):(r=this.primed?new y(e(this.value)):new y,this.listenDownstream(function(t){return r.update(e(t))},n),r)},n.listenOnce=function(e,t){return this.updateDownstreamEvent.subscribeOnce(e,t).cancel},n.awaitNextUpdate=function(e){var t=this;return new Promise(function(n){t.listenOnce(function(e){return n(e)},e)})},n.debounceUpstream=function(e,n){var i,a=this,r=new t(this.value);return r.listenUpstream(function(t){clearTimeout(i),i=setTimeout(function(){a.updateUpstream(t)},e)},n),this.listenDownstream(function(e){r.updateDownstream(e)},n),r},n.debounceDownstream=function(e,n){var i,a=this,r=new t(this.value);return this.listenDownstream(function(t){clearTimeout(i),i=setTimeout(function(){r.updateDownstream(t)},e)},n),r.listenUpstream(function(e){a.updateUpstream(e)},n),r},n.diff=function(e){e=null!=e?e:new d;var t=new b(e,{new:this.value,old:void 0});return this.listen(function(e){t.update({new:e,old:t.value.new})},e),t},n.await=function(e){e=null!=e?e:new d;var n=new t(void 0,!1);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var t=n.updateDownstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},e),this.listenUpstream(function(e){try{var t=n.updateUpstream;return Promise.resolve(e).then(function(e){t.call(n,e)})}catch(e){return Promise.reject(e)}},e),n},n.awaitLatest=function(e){throw new Error("not implemented")},n.awaitOrdered=function(e){throw new Error("not implemented")},n.unique=function(e){var n=this,i=new t(this.value,!1),a=this.value,r=this.value;return this.listenDownstream(function(e){r!==e&&(r=e,i.updateDownstream(e))},e),i.listenUpstream(function(e){a!==e&&(a=e,n.updateUpstream(e))},e),i},n.oneWayFlow=function(n,i){var a=this;void 0===n&&(n=e.DataFlow.DOWNSTREAM);var r=new t(this.value,!1);return n===e.DataFlow.DOWNSTREAM?(this.listenDownstream(function(e){return r.updateDownstream(e)},i),r.updateUpstream=function(){}):(r.listenUpstream(function(e){return a.updateUpstream(e)}),r.updateDownstream=function(){}),r},n.reduce=function(e,t,n){var i=new y(t);return this.listen(function(t){return i.update(e(i.value,t))},n),i},n.cancelAll=function(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()},t}();function O(){var e={attachCalls:[],sessionToken:new d(function(){for(var t,n=c(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var T=Symbol("AurumElementModel"),x=new WeakMap,C=function(){function e(e,t){var n=this;this.children=[],this.api=t,this.api.onAttach(function(){if(void 0===n.hostNode)throw new Error("illegal state: Attach fired but not actually attached");n.render(e)})}var t=e.prototype;return t.dispose=function(){this.clearContent()},t.attachToDom=function(t,n){if(this.hostNode)throw new Error("Aurum Element is already attached");var i=e.id++;this.hostNode=t,this.contentStartMarker=document.createComment("START Aurum Node "+i),this.contentEndMarker=document.createComment("END Aurum Node "+i),n>=t.childNodes.length?(t.appendChild(this.contentStartMarker),t.appendChild(this.contentEndMarker)):(t.insertBefore(this.contentStartMarker,t.childNodes[n]),t.insertBefore(this.contentEndMarker,t.childNodes[n+1]))},t.getWorkIndex=function(){if(void 0!==this.lastStartIndex&&this.hostNode.childNodes[this.lastStartIndex]===this.contentStartMarker)return this.lastStartIndex+1;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentStartMarker)return this.lastStartIndex=e,e+1},t.getLastIndex=function(){if(void 0!==this.lastEndIndex&&this.hostNode.childNodes[this.lastEndIndex]===this.contentEndMarker)return this.lastEndIndex;for(var e=0;e<this.hostNode.childNodes.length;e++)if(this.hostNode.childNodes[e]===this.contentEndMarker)return this.lastEndIndex=e,e},t.clearContent=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");for(var e=this.getWorkIndex();this.hostNode.childNodes[e]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[e])},t.updateDom=function(){if(void 0===this.hostNode)throw new Error("illegal state: Aurum element was not attched to anything");var t,n=this.getWorkIndex(),i=0;for(t=0;t<this.children.length;t++){var a=this.children[t];if(a instanceof e)i+=a.getLastIndex()-t-i-n;else if(this.hostNode.childNodes[t+n+i]!==this.contentEndMarker&&this.hostNode.childNodes[t+n+i]!==this.children[t]){if(!(a instanceof HTMLElement||a instanceof Text))throw new Error("not implemented");this.hostNode.removeChild(this.hostNode.childNodes[t+n+i]),this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(a,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(a)}else{if(!(a instanceof HTMLElement||a instanceof Text))throw new Error("not implemented");this.hostNode.childNodes[t+n+i]?this.hostNode.insertBefore(a,this.hostNode.childNodes[t+n+i]):this.hostNode.appendChild(a)}}for(;this.hostNode.childNodes[t+n+i]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[t+n+i])},e}();function N(e,t,n){if(void 0===n&&(n=!1),null!=e){if(M.has(e)){var i,a=M.get(e);a.sessionToken&&((i=t.attachCalls).push.apply(i,a.attachCalls),t.sessionToken.chain(a.sessionToken),a.attachCalls=void 0,a.sessionToken=void 0),M.delete(e)}if(Array.isArray(e))return Array.prototype.concat.apply([],e.map(function(e){return N(e,t,n)}));if(!n){if(e instanceof Promise){var r=new y;return e.then(function(e){r.update(e)}),new P(r,R(t))}if(e instanceof y||e instanceof D)return new P(e,R(t));if(e instanceof E)return new L(e,R(t));var o=typeof e;if("string"===o||"number"===o||"bigint"===o||"boolean"===o)return document.createTextNode(e.toString())}return e[T]?N(e.factory(e.props||{},e.children,R(t)),t,n):e}}C.id=1;var M=new WeakMap;function R(e){var t=void 0,n={renderSession:e,onAttach:function(t){e.attachCalls.push(t)},onDetach:function(n){t||(t=new d,e.tokens.push(t)),t.addCancelable(n)},onError:function(e){throw new Error("not implemented")},get cancellationToken(){return t||(t=new d,e.tokens.push(t)),t},prerender:function(e){var t=O(),n=N(e,t,!0);if(Array.isArray(n))for(var i,a=c(n);!(i=a()).done;){var r=i.value;"object"==typeof r&&M.set(r,t)}else M.set(n,t);return n},get style(){return function(e){for(var t,i=[].slice.call(arguments,1),a=new y,r=c(i);!(t=r()).done;){var o=t.value;(o instanceof y||o instanceof D)&&o.listen(function(){return a.update(I(e,i))},n.cancellationToken)}return a.update(I(e,i)),a}}};return n}function I(e,t){for(var n="",i=0;i<e.length;i++)n+=e[i],t[i]&&(n+="string"==typeof t[i]?t[i]:t[i].value);return n}var L=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).renderSessions=new WeakMap,i.dataSource=t,i}i(t,e);var n=t.prototype;return n.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},n.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},n.spliceChildren=function(e,t,n){for(var i,a=c(n?this.children.splice(e,t,n):this.children.splice(e,t));!(i=a()).done;)this.renderSessions.get(i.value).sessionToken.cancel()},n.handleNewContent=function(e){switch(e.operationDetailed){case"merge":for(var t=e.previousState.slice(),n=0;n<e.newState.length;n++)if(this.children.length<=n&&this.children.push(this.renderItem(e.newState[n])),t[n]!==e.newState[n]){var i=t.indexOf(e.newState[n]);if(-1!==i){var a=this.children[n];this.children[n]=this.children[i],this.children[i]=a;var r=t[n];t[n]=t[i],t[i]=r}else this.spliceChildren(n,0,this.renderItem(e.newState[n])),t.splice(n,0,e.newState[n])}this.children.length>e.newState.length&&(this.children.length=e.newState.length);break;case"remove":case"removeLeft":case"removeRight":this.spliceChildren(e.index,e.count);break;case"append":for(var o,s=c(e.items);!(o=s()).done;){var u=this.renderItem(o.value);Array.isArray(u)?this.children=this.children.concat(u):this.children.push(u)}break;case"replace":var l=this.renderItem(e.items[0]);if(Array.isArray(l))throw new Error("illegal state");this.children[e.index]=l;break;case"swap":var h=this.children[e.index2];this.children[e.index2]=this.children[e.index],this.children[e.index]=h;break;case"prepend":for(var d,f=c(e.items);!(d=f()).done;){var p=this.renderItem(d.value);if(Array.isArray(p))throw new Error("illegal state");this.children.unshift(p)}break;case"insert":for(var v,m=e.index,w=c(e.items);!(v=w()).done;){var g=this.renderItem(v.value);if(Array.isArray(g))throw new Error("illegal state");this.children.splice(m,0,g),m+=1}break;case"remove":for(var y,b=c(e.items);!(y=b()).done;){var E=this.renderItem(y.value);if(Array.isArray(E))throw new Error("illegal state");this.children.unshift(E)}break;case"clear":this.children.length=0,this.renderSessions=new WeakMap;break;default:throw new Error("not implemented")}this.updateDom()},n.renderItem=function(e){for(var t,n=O(),i=N(e,n),a=c(n.attachCalls);!(t=a()).done;)(0,t.value)();return this.renderSessions.set(i,n),i},t}(C),P=function(e){function t(t,n){var i;return(i=e.call(this,t,n)||this).api.cancellationToken.addCancelable(function(){var e;return null===(e=i.renderSession)||void 0===e?void 0:e.sessionToken.cancel()}),i.dataSource=t,i}i(t,e);var n=t.prototype;return n.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},n.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},n.handleNewContent=function(e){if(this.lastValue!==e){var t=!1;if(1===this.children.length&&this.children[0]instanceof Text){var n=typeof e;"string"!==n&&"bigint"!==n&&"number"!==n||(this.children[0].nodeValue=e,t=!0)}t||this.fullRebuild(e),this.lastValue=e}},n.fullRebuild=function(e){this.clearContent(),this.endSession(),this.renderSession=O();var t=N(e,this.renderSession);if(void 0!==t){Array.isArray(t)||(t=[t]);for(var n,i=c(t);!(n=i()).done;){var a=n.value;a instanceof C&&a.attachToDom(this.hostNode,this.getLastIndex())}for(var r,o=c(this.renderSession.attachCalls);!(r=o()).done;)(0,r.value)();Array.isArray(t)&&(this.children=t)}else this.children=[]},n.endSession=function(){this.renderSession&&(this.renderSession.sessionToken.cancel(),this.renderSession=void 0)},t}(C),F={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},U=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function K(e,t,n,i){return function(a,r,o){var s=document.createElement(e);a&&function(e,t,n,i,a){j(e,F,t),a&&j(e,a,t);var r=Object.keys(t).filter(function(e){return e.includes("-")});V(e,U,t,r),i&&V(e,i,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof y||t instanceof D)t.value&&(Array.isArray(t.value)?(e.className=t.value.join(" "),t.unique(n).listen(function(){e.className=t.value.join(" ")})):(e.className=t.value,t.unique(n).listen(function(){e.className=t.value}))),t.unique(n).listen(function(t){return e.className=t});else{var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i;for(var a,r=c(t);!(a=r()).done;){var o=a.value;o instanceof y&&o.unique(n).listen(function(n){var i=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=i})}}}(e,t.class,n)}(s,a,o.cancellationToken,t,n);var u=N(r,o.renderSession);return function e(t,n){if(null!=n)if(Array.isArray(n))for(var i,a=c(n);!(i=a()).done;)e(t,i.value);else if(n instanceof C)n.attachToDom(t,t.childNodes.length);else{if(!(n instanceof HTMLElement||n instanceof Text))throw new Error("Unexpected child type passed to DOM Node: "+n);t.appendChild(n)}}(s,u),a.onAttach&&o.onAttach(function(){return a.onAttach(s)}),a.onDetach&&o.onDetach(function(){s.isConnected&&s.parentElement.removeChild(s),a.onDetach(s)}),null==i||i(s,a,o.cancellationToken),s}}function j(e,t,n){var i=function(i){n[t[i]]&&(n[t[i]]instanceof y?e.addEventListener(i,function(e){return n[t[i]].update(e)}):n[t[i]]instanceof D?e.addEventListener(i,function(e){return n[t[i]].updateDownstream(e)}):"function"==typeof n[t[i]]&&e.addEventListener(i,function(e){return n[t[i]](e)}))};for(var a in t)i(a)}function V(e,t,n,i){for(var a,r=c(t);!(a=r()).done;){var o=a.value;n[o]&&q(e,n[o],o)}if(i)for(var s,u=c(i);!(s=u()).done;){var l=s.value;n[l]&&q(e,n[l],l)}}function q(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof y||t instanceof D))throw new Error("Attributes only support types boolean, string, number and data sources");"string"==typeof t.value?e.setAttribute(n,t.value):"boolean"==typeof t.value&&t.value&&e.setAttribute(n,""),t.unique().listen(function(t){"string"==typeof t?e.setAttribute(n,t):"boolean"==typeof t&&(t?e.setAttribute(n,""):e.removeAttribute(n))})}}var W=K("input",["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof y?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof D?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.checked&&(t.checked instanceof y?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.update(i.checked)})):t.checked instanceof D?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.updateUpstream(i.checked)})):i.checked=t.checked)}),_=K("select",void 0,{change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof y?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.update(i.value)})):t.value instanceof D?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.updateUpstream(i.value)})):i.value=t.value),t.selectedIndex&&(t.selectedIndex instanceof y?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.update(i.selectedIndex)})):t.selectedIndex instanceof D?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.updateUpstream(i.selectedIndex)})):i.selectedIndex=t.selectedIndex)}),Y=K("code"),B=K("div"),H=K("a",["href","target"]),z=K("abbr"),$=K("h1"),G=K("h2"),J=K("h3"),Q=K("h4"),X=K("h5"),Z=K("h6"),ee=K("area",["alt","coors"]),te=K("article"),ne=K("aside"),ie=K("span"),ae=K("noscript"),re=K("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),oe=K("ul"),se=K("ol"),ue=K("li"),le=K("tr"),ce=K("b"),he=K("title"),de=K("summary"),fe=K("thead"),pe=K("template"),ve=K("q"),me=K("pre"),we=K("p"),ge=K("hr"),ye=K("audio",["controls","autoplay","loop","muted","preload","src"]),be=K("br"),Ee=K("button",["disabled"]),ke=K("canvas",["width","height"]),Se=K("data",["value"]),Ae=K("details"),De=K("em"),Oe=K("footer"),Te=K("form"),xe=K("head"),Ce=K("header"),Ne=K("heading"),Me=K("i"),Re=K("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),Ie=K("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),Le=K("label",["for"]),Pe=K("link",["href","rel","media","as","disabled","type"]),Fe=K("nav"),Ue=K("sub"),Ke=K("sup"),je=K("table"),Ve=K("tbody"),qe=K("tfoot"),We=K("td"),_e=K("th"),Ye=K("time",["datetime"]),Be=K("style",["media"]),He=K("source",["src","srcSet","media","sizes","type"]),ze=K("script",["src","async","defer","integrity","noModule","type"]),$e=K("svg",["width","height"]),Ge=K("progress",["max","value"]),Je=K("option",["value"]),Qe=K("slot",["name"]),Xe={button:Ee,code:Y,hr:ge,div:B,input:W,li:ue,span:ie,style:Be,ul:oe,p:we,img:Ie,link:Pe,canvas:ke,a:H,article:te,br:be,form:Te,label:Le,ol:se,pre:me,progress:Ge,table:je,td:We,tr:le,th:_e,textarea:K("textArea",["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof y?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof D?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value)}),h1:$,h2:G,h3:J,h4:Q,h5:X,h6:Z,head:xe,header:Ce,footer:Oe,nav:Fe,b:ce,i:Me,script:ze,abbr:z,area:ee,aside:ne,audio:ye,em:De,heading:Ne,iframe:Re,noscript:ae,option:Je,q:ve,select:_,source:He,title:he,video:re,tbody:Ve,tfoot:qe,thead:fe,summary:de,details:Ae,sub:Ue,sup:Ke,svg:$e,data:Se,time:Ye,template:pe,slot:Qe},Ze=function(){function e(){}return e.attach=function(e,t){var n=O(),i=N(e,n);if(i instanceof C)i.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(function(){return i.dispose()});else if(Array.isArray(i)){var a=new L(new E(i),R(n));n.sessionToken.addCancelable(function(){return a.dispose()}),a.attachToDom(t,t.childNodes.length)}else t.appendChild(i),n.sessionToken.addCancelable(function(){t.removeChild(i)});for(var r=n.attachCalls.length-1;r>=0;r--)n.attachCalls[r]();return n.sessionToken},e.factory=function(e,t){var n,i;if("string"==typeof e){i=e;var a=e;if(void 0===(e=Xe[e]))throw new Error("Node "+a+" does not exist or is not supported")}return(n={})[T]=!0,n.name=i,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();function et(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function tt(e,t){}function nt(e,t){}function it(e,t){}function at(e,t){}var rt=function(){function e(e){e&&(this.data=e),this.updateEvent=new f,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n,i=new y(null===(n=this.data)||void 0===n?void 0:n[e]);return this.listenOnKey(e,function(e){i.update(e.newValue)},t),i},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data[e],oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new f),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return Object.keys(this.data)},t.values=function(){return Object.values(this.data)},t.get=function(e){return this.data[e]},t.delete=function(e){var t=this.data[e];delete this.data[e],this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data[e]!==t){var n=this.data[e];this.data[e]=t,this.updateEvent.fire({oldValue:n,key:e,newValue:this.data[e]}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data[e]})}},t.assign=function(t){if(t instanceof e)for(var n,i=c(t.keys());!(n=i()).done;){var a=n.value;this.set(a,t.data[a])}else for(var r=0,o=Object.keys(t);r<o.length;r++){var s=o[r];this.set(s,t[s])}},t.toObject=function(){return Object.assign({},this.data)},t.toDataSource=function(){var e=this,t=new y(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),ot=function(){function e(e){e&&(this.data=e),this.updateEvent=new f,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new y(this.data.get(e));return this.listenOnKey(e,function(e){n.update(e.newValue)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t({key:e,newValue:this.data.get(e),oldValue:void 0}),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new f),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.values=function(){return this.data.values()},t.get=function(e){return this.data.get(e)},t.has=function(e){return this.data.has(e)},t.delete=function(e){var t=this.data.get(e);this.data.delete(e),this.updateEvent.fire({oldValue:t,key:e,newValue:void 0,deleted:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:t,key:e,newValue:void 0})},t.set=function(e,t){if(this.data.get(e)!==t){var n=this.data.get(e);this.data.set(e,t),this.updateEvent.fire({oldValue:n,key:e,newValue:this.data.get(e)}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire({oldValue:n,key:e,newValue:this.data.get(e)})}},t.assign=function(e){for(var t,n=c(e.keys());!(t=n()).done;){var i=t.value;this.set(i,e.get(i))}},t.toMap=function(){return new Map(this.data.entries())},e}(),st=function(){function e(e){e&&(this.data=e),this.updateEvent=new f,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n=new y(this.data.has(e));return this.listenOnKey(e,function(e){n.update(e)},t),n},t.listen=function(e,t){return this.updateEvent.subscribe(e,t).cancel},t.listenOnKeyAndRepeat=function(e,t,n){return t(this.has(e)),this.listenOnKey(e,t,n)},t.listenOnKey=function(e,t,n){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new f),this.updateEventOnKey.get(e).subscribe(t,n).cancel},t.keys=function(){return this.data.keys()},t.has=function(e){return this.data.has(e)},t.delete=function(e){this.data.delete(e),this.updateEvent.fire({key:e,exists:!1}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!1)},t.add=function(e){this.data.has(e)||(this.data.add(e),this.updateEvent.fire({key:e,exists:!0}),this.updateEventOnKey.has(e)&&this.updateEventOnKey.get(e).fire(!0))},t.assign=function(e){for(var t,n=c(e.keys());!(t=n()).done;)this.add(t.value)},t.toSet=function(){return new Set(this.data.keys())},e}(),ut=function(){function e(e,t){this.input=null!=e?e:new y,this.output=null!=t?t:this.input}var t=e.prototype;return t.update=function(e){this.input.update(e)},t.listen=function(e,t){return this.output.listen(e,t)},t.listenAndRepeat=function(e,t){return this.output.listenAndRepeat(e,t)},t.listenOnce=function(e,t){return this.output.listenOnce(e,t)},t.filter=function(t,n){return new e(this.input,this.output.filter(t,n))},t.unique=function(t){return new e(this.input,this.output.unique(t))},t.map=function(t,n){return new e(this.input,this.output.map(t,n))},t.reduce=function(t,n,i){return new e(this.input,this.output.reduce(t,n,i))},t.awaitNextUpdate=function(e){return this.output.awaitNextUpdate(e)},t.await=function(t){return new e(this.input,this.output.await(t))},t.awaitLatest=function(t){return new e(this.input,this.output.awaitLatest(t))},t.awaitOrdered=function(t){return new e(this.input,this.output.awaitOrdered(t))},t.cancelAll=function(){this.input.cancelAll(),this.output.cancelAll()},n(e,[{key:"value",get:function(){return this.output.value}}]),e}();e.ArrayAurumElement=L,e.ArrayDataSource=E,e.Aurum=Ze,e.AurumElement=C,e.AurumRouter=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[T]||!(e.factory===tt||e.factory===nt)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===nt}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var i=new y(et());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){i.update(et())}),i.unique(n.cancellationToken).withInitial(i.value).map(function(e){return function(e,t){var n,i;if(null==e)return null===(n=t.find(function(e){return e.factory===nt}))||void 0===n?void 0:n.children;if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children;var a=e.split("/");a.pop();for(var r=function(){var e=a.join("/");if(t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}))return{v:t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.href)===e}).children};a.pop()};a.length;){var o=r();if("object"==typeof o)return o.v}return null===(i=t.find(function(e){return e.factory===nt}))||void 0===i?void 0:i.children}(e,t)})},e.CancellationToken=d,e.DataSource=y,e.DefaultRoute=nt,e.DefaultSwitchCase=at,e.DuplexDataSource=D,e.EventEmitter=f,e.FilteredArrayView=A,e.MapDataSource=ot,e.MappedArrayView=k,e.ObjectDataSource=rt,e.Route=tt,e.SetDataSource=st,e.SingularAurumElement=P,e.SortedArrayView=S,e.Stream=ut,e.Suspense=function(e,t,n){var i=new y(null==e?void 0:e.fallback),a=new d;return n.onDetach(function(){a.cancel()}),Promise.all(n.prerender(t,a)).then(function(e){a.isCanceled||i.update(e)},function(e){return a.cancel(),Promise.reject(e)}),i},e.Switch=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[T]||!(e.factory===it||e.factory===at)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===at}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");var i=new d;return n.onDetach(function(){i.cancel()}),e.state.unique(i).withInitial(e.state.value).map(function(e){return function(e,t){var n,i,a;return null!==(i=null===(n=t.find(function(t){var n;return(null===(n=t.props)||void 0===n?void 0:n.when)===e}))||void 0===n?void 0:n.children)&&void 0!==i?i:null===(a=t.find(function(e){return e.factory===at}))||void 0===a?void 0:a.children}(e,t)})},e.SwitchCase=it,e.TransientDataSource=b,e.Webcomponent=function(e,t){return customElements.define(e.name,function(a){function r(){var t;t=a.call(this)||this,void 0===e.observedAttributes&&(e.observedAttributes=[]),t.props={};for(var n,i=c(e.observedAttributes);!(n=i()).done;)t.props[n.value]=new y;return t}i(r,a);var o=r.prototype;return o.attributeChangedCallback=function(e,t,n){t!==n&&this.props[e].update(n)},o.connectedCallback=function(){var n,i=document.createDocumentFragment();this.session=O(),this.api=R(this.session);for(var a,r=t(this.props,this.api),o=c(this.session.attachCalls);!(a=o()).done;)(0,a.value)();Ze.attach(r,i),this.attachShadow({mode:null!==(n=e.shadowRootMode)&&void 0!==n?n:"open",delegatesFocus:e.shadowRootDelegatesFocus}).appendChild(i)},o.disconnectedCallback=function(){this.session.sessionToken.cancel()},n(r,null,[{key:"observedAttributes",get:function(){return e.observedAttributes}}]),r}(u(HTMLElement))),K(e.name,e.observedAttributes,void 0,function(e,t){for(var n in t)n in e.props||(e.props[n]=t[n])})},e.aurumClassName=function(e,t){var n=[],i=function(i){if(e[i])if(e[i]instanceof y||e[i]instanceof D){var a=e[i],r=new y(a.value?i:"");a.listen(function(e){r.update(e?i:"")},t),n.push(r)}else n.push(i)};for(var a in e)i(a);return n},e.aurumElementModelIdentitiy=T,e.createAPI=R,e.createRenderSession=O,e.dsBuffer=function(t){var n,i=[];return{operationType:e.OperationType.MAP_DELAY,operation:function(e){return i.push(e),n||(n=new Promise(function(e){setTimeout(function(){n=void 0,e(i),i=[]},t)})),n}}},e.dsDelay=function(t){return{operationType:e.OperationType.DELAY,operation:function(e){return new Promise(function(n){setTimeout(function(){n(e)},t)})}}},e.dsFilter=function(t){return{operationType:e.OperationType.FILTER,operation:function(e){return t(e)}}},e.dsMap=function(t){return{operationType:e.OperationType.MAP,operation:function(e){return t(e)}}},e.dsPick=function(t){return{operationType:e.OperationType.MAP,operation:function(e){return null!=e?e[t]:e}}},e.dsReduce=function(t,n){var i=n;return{operationType:e.OperationType.MAP,operation:function(e){return i=t(i,e)}}},e.dsUnique=function(){var t;return{operationType:e.OperationType.FILTER,operation:function(e){return e!==t&&(t=e,!0)}}},e.nodeData=x,e.pendingSessions=M,e.render=N}); | ||
//# sourceMappingURL=aurumjs.umd.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
5618403
96218