Comparing version 0.5.0 to 0.5.1
@@ -8,2 +8,3 @@ export * from './rendering/aurum_element'; | ||
export * from './stream/object_data_source'; | ||
export * from './stream/stream'; | ||
export * from './utilities/aurum'; | ||
@@ -10,0 +11,0 @@ export * from './utilities/cancellation_token'; |
@@ -8,2 +8,3 @@ export * from './rendering/aurum_element'; | ||
export * from './stream/object_data_source'; | ||
export * from './stream/stream'; | ||
export * from './utilities/aurum'; | ||
@@ -10,0 +11,0 @@ export * from './utilities/cancellation_token'; |
@@ -20,3 +20,2 @@ import { DataSource, ArrayDataSource } from '../stream/data_source'; | ||
constructor(dataSource, api) { | ||
AurumElement.id++; | ||
this.children = []; | ||
@@ -23,0 +22,0 @@ this.api = api; |
{ | ||
"name": "aurumjs", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"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=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}(),h=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 d(e,t,n){if(!e.s){if(n instanceof f){if(!n.s)return void(n.o=d.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(d.bind(null,e,t),d.bind(null,e,2));e.s=t,e.v=n;var i=e.o;i&&i(e)}}var f=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{d(i,1,r(this.v))}catch(e){d(i,2,e)}return i}return this}return this.o=function(e){try{var a=e.v;1&e.s?d(i,1,t?t(a):a):n?d(i,1,n(a)):d(i,2,a)}catch(e){d(i,2,e)}},i},e}();function p(e){return e instanceof f&&1&e.s}var v,m=function(){function e(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new h}e.fromMultipleSources=function(t,n){for(var i,a=new e,r=l(t);!(i=r()).done;)i.value.pipe(a,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 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.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 c;var n=new w(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.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 c,n=this.primed?new w(t,e(this.value)):new w(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 c;var t=new w(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 c;var t=[],n=new w(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(p(a)&&(a=a.v),!a)return r;if(a.then){i=0;break}var r=n();if(r&&r.then){if(!p(r)){i=1;break}r=r.s}}var o=new f,s=d.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):d(o,1,r)})).then(void 0,s),o;function u(t){r=t;do{if(!(a=e())||p(a)&&!a.v)return void d(o,1,r);if(a.then)return void a.then(l).then(void 0,s);p(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):d(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 c;var n=new w(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 c;var t=new w(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 c;var t=new w(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 c;var i=new w(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 c;var a=new w(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 c;var r=new w(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 c;var o=new w(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 c;var n=new w(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 c;var n=new w(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 c;var n=new w(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 c;var n=new w(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 c;var n,i=new w(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 c;var n=new w(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 c;var n,i=new w(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 g;return this.listen(function(e){t.push(e)},e),t},t.pick=function(e,t){var n;t=null!=t?t:new c;var i=new w(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}(),w=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}(m),g=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new m(this.data.length),this.updateEvent=new h}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 y(this,e,n),a=new c;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 b(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 k(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}(),b=function(e){function t(t,n,i){var a;void 0===i&&(i=new c);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}(g),y=function(e){function t(t,n,i){var a;void 0===i&&(i=new c);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}(g),k=function(e){function t(t,n,i){var a;void 0===i&&(i=new c),Array.isArray(t)&&(t=new g(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}(g);!function(e){e[e.UPSTREAM=0]="UPSTREAM",e[e.DOWNSTREAM=1]="DOWNSTREAM"}(v||(v={}));var S=function(){function e(e,t){void 0===t&&(t=!0),this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new h,this.updateUpstreamEvent=new h,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=v.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 m(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 c;var a=new w(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 c;var r=new w(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 c;var o=new w(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 m;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 m(t(this.value)):new m,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 c;var t=new w(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 c;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=v.DOWNSTREAM);var a=new e(this.value,!1);return t===v.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 m(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 E(){var e={attachCalls:[],sessionToken:new c(function(){for(var t,n=l(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var A=Symbol("AurumElementModel"),D=new WeakMap,x=function(){function e(t,n){var i=this;e.id++,this.children=[],this.api=n,this.api.onAttach(function(){if(void 0===i.hostNode)throw new Error("illegal state: Attach fired but not actually attached");i.render(t)})}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 C(e,t,n){if(void 0===n&&(n=!1),null!=e){if(T.has(e)){var i,a=T.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),T.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 r=new m;return e.then(function(e){r.update(e)}),new R(r,N(t))}if(e instanceof m||e instanceof S)return new R(e,N(t));if(e instanceof g)return new I(e,N(t));var o=typeof e;if("string"===o||"number"===o||"bigint"===o||"boolean"===o)return document.createTextNode(e.toString())}return e[A]?C(e.factory(e.props||{},e.children,N(t)),t,n):e}}x.id=1;var T=new WeakMap;function N(e){var t=void 0,n={renderSession:e,onAttach:function(t){e.attachCalls.push(t)},onDetach:function(n){t||(t=new c,e.tokens.push(t)),t.addCancelable(n)},onError:function(e){throw new Error("not implemented")},get cancellationToken(){return t||(t=new c,e.tokens.push(t)),t},prerender:function(e){var t=E(),n=C(e,t,!0);if(Array.isArray(n))for(var i,a=l(n);!(i=a()).done;){var r=i.value;"object"==typeof r&&T.set(r,t)}else T.set(n,t);return n},get style(){return function(e){for(var t,i=[].slice.call(arguments,1),a=new m,r=l(i);!(t=r()).done;){var o=t.value;(o instanceof m||o instanceof S)&&o.listen(function(){return a.update(O(e,i))},n.cancellationToken)}return a.update(O(e,i)),a}}};return n}function O(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 b,y=l(e.items);!(b=y()).done;){var k=this.renderItem(b.value);if(Array.isArray(k))throw new Error("illegal state");this.children.unshift(k)}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=E(),i=C(e,n),a=l(n.attachCalls);!(t=a()).done;)(0,t.value)();return this.renderSessions.set(i,n),i},t}(x),R=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=E();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 a=n.value;a instanceof x&&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}(x);function M(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[A]||!(e.factory===L||e.factory===F)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===F}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var i=new m(U());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){i.update(U())}),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===F}))||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===F}))||void 0===i?void 0:i.children}(e,t)})}function U(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function L(e,t){}function F(e,t){}function P(e,t,n){var i=new m(null==e?void 0:e.fallback),a=new c;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 j(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[A]||!(e.factory===q||e.factory===W)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===W}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");var i=new c;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===W}))||void 0===a?void 0:a.children}(e,t)})}function q(e,t){}function W(e,t){}var K=function(){function e(e){e&&(this.data=e),this.updateEvent=new h,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n,i=new m(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 h),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 m(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),V={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"},_=["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,V,t),a&&H(e,a,t);var r=Object.keys(t).filter(function(e){return e.includes("-")});z(e,_,t,r),i&&z(e,i,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof m||t instanceof S)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 m&&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=C(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 x)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 m?e.addEventListener(i,function(e){return n[t[i]].update(e)}):n[t[i]]instanceof S?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 m||t instanceof S))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 m?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof S?(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 m?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.update(i.checked)})):t.checked instanceof S?(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 m?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.update(i.value)})):t.value instanceof S?(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 m?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.update(i.selectedIndex)})):t.selectedIndex instanceof S?(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"),Y=B("a",["href","target"]),Z=B("abbr"),ee=B("h1"),te=B("h2"),ne=B("h3"),ie=B("h4"),ae=B("h5"),re=B("h6"),oe=B("area",["alt","coors"]),se=B("article"),ue=B("aside"),le=B("span"),ce=B("noscript"),he=B("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),de=B("ul"),fe=B("ol"),pe=B("li"),ve=B("tr"),me=B("b"),we=B("title"),ge=B("summary"),be=B("thead"),ye=B("template"),ke=B("q"),Se=B("pre"),Ee=B("p"),Ae=B("hr"),De=B("audio",["controls","autoplay","loop","muted","preload","src"]),xe=B("br"),Ce=B("button",["disabled"]),Te=B("canvas",["width","height"]),Ne=B("data",["value"]),Oe=B("details"),Ie=B("em"),Re=B("footer"),Me=B("form"),Ue=B("head"),Le=B("header"),Fe=B("heading"),Pe=B("i"),je=B("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),qe=B("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),We=B("label",["for"]),Ke=B("link",["href","rel","media","as","disabled","type"]),Ve=B("nav"),_e=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"]),Ye=B("source",["src","srcSet","media","sizes","type"]),Ze=B("script",["src","async","defer","integrity","noModule","type"]),et=B("svg",["width","height"]),tt=B("progress",["max","value"]),nt=B("option",["value"]),it=B("slot",["name"]),at={button:Ce,code:Q,hr:Ae,div:X,input:G,li:pe,span:le,style:Xe,ul:de,p:Ee,img:qe,link:Ke,canvas:Te,a:Y,article:se,br:xe,form:Me,label:We,ol:fe,pre:Se,progress:tt,table:He,td:Ge,tr:ve,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 m?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof S?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value)}),h1:ee,h2:te,h3:ne,h4:ie,h5:ae,h6:re,head:Ue,header:Le,footer:Re,nav:Ve,b:me,i:Pe,script:Ze,abbr:Z,area:oe,aside:ue,audio:De,em:Ie,heading:Fe,iframe:je,noscript:ce,option:nt,q:ke,select:J,source:Ye,title:we,video:he,tbody:ze,tfoot:$e,thead:be,summary:ge,details:Oe,sub:_e,sup:Be,svg:et,data:Ne,time:Qe,template:ye,slot:it},rt=function(){function e(){}return e.attach=function(e,t){var n=E(),i=C(e,n);if(i instanceof x)i.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(function(){return i.dispose()});else if(Array.isArray(i)){var a=new I(new g(i),N(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;if("string"==typeof e){var i=e;if(void 0===(e=at[e]))throw new Error("Node "+i+" does not exist or is not supported")}return(n={})[A]=!0,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();function ot(e,t){var n=[],i=function(i){if(e[i])if(e[i]instanceof m||e[i]instanceof S){var a=e[i],r=new m(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 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 m;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=E(),this.api=N(this.session);for(var a,r=i(this.props,this.api),o=l(this.session.attachCalls);!(a=o()).done;)(0,a.value)();rt.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])})}export{I as ArrayAurumElement,g as ArrayDataSource,rt as Aurum,x as AurumElement,M as AurumRouter,c as CancellationToken,v as DataFlow,m as DataSource,F as DefaultRoute,W as DefaultSwitchCase,S as DuplexDataSource,k as FilteredArrayView,b as MappedArrayView,K as ObjectDataSource,L as Route,R as SingularAurumElement,y as SortedArrayView,P as Suspense,j as Switch,q as SwitchCase,w as TransientDataSource,st as Webcomponent,ot as aurumClassName,A as aurumElementModelIdentitiy,N as createAPI,E as createRenderSession,D as nodeData,T as pendingSessions,C 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=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}(),h=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 d(e,t,n){if(!e.s){if(n instanceof f){if(!n.s)return void(n.o=d.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(d.bind(null,e,t),d.bind(null,e,2));e.s=t,e.v=n;var i=e.o;i&&i(e)}}var f=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{d(i,1,r(this.v))}catch(e){d(i,2,e)}return i}return this}return this.o=function(e){try{var a=e.v;1&e.s?d(i,1,t?t(a):a):n?d(i,1,n(a)):d(i,2,a)}catch(e){d(i,2,e)}},i},e}();function p(e){return e instanceof f&&1&e.s}var v,m=function(){function e(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new h}e.fromMultipleSources=function(t,n){for(var i,a=new e,r=l(t);!(i=r()).done;)i.value.pipe(a,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 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.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 c;var n=new w(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.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 c,n=this.primed?new w(t,e(this.value)):new w(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 c;var t=new w(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 c;var t=[],n=new w(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(p(a)&&(a=a.v),!a)return r;if(a.then){i=0;break}var r=n();if(r&&r.then){if(!p(r)){i=1;break}r=r.s}}var o=new f,s=d.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):d(o,1,r)})).then(void 0,s),o;function u(t){r=t;do{if(!(a=e())||p(a)&&!a.v)return void d(o,1,r);if(a.then)return void a.then(l).then(void 0,s);p(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):d(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 c;var n=new w(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 c;var t=new w(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 c;var t=new w(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 c;var i=new w(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 c;var a=new w(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 c;var r=new w(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 c;var o=new w(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 c;var n=new w(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 c;var n=new w(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 c;var n=new w(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 c;var n=new w(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 c;var n,i=new w(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 c;var n=new w(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 c;var n,i=new w(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 g;return this.listen(function(e){t.push(e)},e),t},t.pick=function(e,t){var n;t=null!=t?t:new c;var i=new w(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}(),w=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}(m),g=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new m(this.data.length),this.updateEvent=new h}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 y(this,e,n),a=new c;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 b(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 k(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}(),b=function(e){function t(t,n,i){var a;void 0===i&&(i=new c);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}(g),y=function(e){function t(t,n,i){var a;void 0===i&&(i=new c);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}(g),k=function(e){function t(t,n,i){var a;void 0===i&&(i=new c),Array.isArray(t)&&(t=new g(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}(g);!function(e){e[e.UPSTREAM=0]="UPSTREAM",e[e.DOWNSTREAM=1]="DOWNSTREAM"}(v||(v={}));var S=function(){function e(e,t){void 0===t&&(t=!0),this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new h,this.updateUpstreamEvent=new h,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=v.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 m(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 c;var a=new w(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 c;var r=new w(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 c;var o=new w(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 m;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 m(t(this.value)):new m,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 c;var t=new w(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 c;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=v.DOWNSTREAM);var a=new e(this.value,!1);return t===v.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 m(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 E(){var e={attachCalls:[],sessionToken:new c(function(){for(var t,n=l(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var A=Symbol("AurumElementModel"),D=new WeakMap,x=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 C(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 C(e,t,n)}));if(!n){if(e instanceof Promise){var r=new m;return e.then(function(e){r.update(e)}),new I(r,T(t))}if(e instanceof m||e instanceof S)return new I(e,T(t));if(e instanceof g)return new R(e,T(t));var o=typeof e;if("string"===o||"number"===o||"bigint"===o||"boolean"===o)return document.createTextNode(e.toString())}return e[A]?C(e.factory(e.props||{},e.children,T(t)),t,n):e}}x.id=1;var N=new WeakMap;function T(e){var t=void 0,n={renderSession:e,onAttach:function(t){e.attachCalls.push(t)},onDetach:function(n){t||(t=new c,e.tokens.push(t)),t.addCancelable(n)},onError:function(e){throw new Error("not implemented")},get cancellationToken(){return t||(t=new c,e.tokens.push(t)),t},prerender:function(e){var t=E(),n=C(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 m,r=l(i);!(t=r()).done;){var o=t.value;(o instanceof m||o instanceof S)&&o.listen(function(){return a.update(O(e,i))},n.cancellationToken)}return a.update(O(e,i)),a}}};return n}function O(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 R=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 k=this.renderItem(b.value);if(Array.isArray(k))throw new Error("illegal state");this.children.unshift(k)}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=E(),i=C(e,n),a=l(n.attachCalls);!(t=a()).done;)(0,t.value)();return this.renderSessions.set(i,n),i},t}(x),I=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=E();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 a=n.value;a instanceof x&&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}(x);function M(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[A]||!(e.factory===L||e.factory===F)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===F}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var i=new m(U());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){i.update(U())}),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===F}))||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===F}))||void 0===i?void 0:i.children}(e,t)})}function U(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function L(e,t){}function F(e,t){}function P(e,t,n){var i=new m(null==e?void 0:e.fallback),a=new c;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 j(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[A]||!(e.factory===q||e.factory===W)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===W}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");var i=new c;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===W}))||void 0===a?void 0:a.children}(e,t)})}function q(e,t){}function W(e,t){}var K=function(){function e(e){e&&(this.data=e),this.updateEvent=new h,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n,i=new m(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 h),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 m(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),V=function(){function e(e,t){this.input=e,this.output=t}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))},t(e,[{key:"value",get:function(){return this.output.value}}]),e}(),_={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"},B=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function H(e,t,n,i){return function(a,r,o){var s=document.createElement(e);a&&function(e,t,n,i,a){z(e,_,t),a&&z(e,a,t);var r=Object.keys(t).filter(function(e){return e.includes("-")});$(e,B,t,r),i&&$(e,i,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof m||t instanceof S)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 m&&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=C(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 x)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 z(e,t,n){var i=function(i){n[t[i]]&&(n[t[i]]instanceof m?e.addEventListener(i,function(e){return n[t[i]].update(e)}):n[t[i]]instanceof S?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 $(e,t,n,i){for(var a,r=l(t);!(a=r()).done;){var o=a.value;n[o]&&G(e,n[o],o)}if(i)for(var s,u=l(i);!(s=u()).done;){var c=s.value;n[c]&&G(e,n[c],c)}}function G(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof m||t instanceof S))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 J=H("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 m?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof S?(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 m?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.update(i.checked)})):t.checked instanceof S?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.updateUpstream(i.checked)})):i.checked=t.checked)}),Q=H("select",void 0,{change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof m?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.update(i.value)})):t.value instanceof S?(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 m?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.update(i.selectedIndex)})):t.selectedIndex instanceof S?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.updateUpstream(i.selectedIndex)})):i.selectedIndex=t.selectedIndex)}),X=H("code"),Y=H("div"),Z=H("a",["href","target"]),ee=H("abbr"),te=H("h1"),ne=H("h2"),ie=H("h3"),ae=H("h4"),re=H("h5"),oe=H("h6"),se=H("area",["alt","coors"]),ue=H("article"),le=H("aside"),ce=H("span"),he=H("noscript"),de=H("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),fe=H("ul"),pe=H("ol"),ve=H("li"),me=H("tr"),we=H("b"),ge=H("title"),be=H("summary"),ye=H("thead"),ke=H("template"),Se=H("q"),Ee=H("pre"),Ae=H("p"),De=H("hr"),xe=H("audio",["controls","autoplay","loop","muted","preload","src"]),Ce=H("br"),Ne=H("button",["disabled"]),Te=H("canvas",["width","height"]),Oe=H("data",["value"]),Re=H("details"),Ie=H("em"),Me=H("footer"),Ue=H("form"),Le=H("head"),Fe=H("header"),Pe=H("heading"),je=H("i"),qe=H("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),We=H("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),Ke=H("label",["for"]),Ve=H("link",["href","rel","media","as","disabled","type"]),_e=H("nav"),Be=H("sub"),He=H("sup"),ze=H("table"),$e=H("tbody"),Ge=H("tfoot"),Je=H("td"),Qe=H("th"),Xe=H("time",["datetime"]),Ye=H("style",["media"]),Ze=H("source",["src","srcSet","media","sizes","type"]),et=H("script",["src","async","defer","integrity","noModule","type"]),tt=H("svg",["width","height"]),nt=H("progress",["max","value"]),it=H("option",["value"]),at=H("slot",["name"]),rt={button:Ne,code:X,hr:De,div:Y,input:J,li:ve,span:ce,style:Ye,ul:fe,p:Ae,img:We,link:Ve,canvas:Te,a:Z,article:ue,br:Ce,form:Ue,label:Ke,ol:pe,pre:Ee,progress:nt,table:ze,td:Je,tr:me,th:Qe,textarea:H("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 m?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof S?(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:Le,header:Fe,footer:Me,nav:_e,b:we,i:je,script:et,abbr:ee,area:se,aside:le,audio:xe,em:Ie,heading:Pe,iframe:qe,noscript:he,option:it,q:Se,select:Q,source:Ze,title:ge,video:de,tbody:$e,tfoot:Ge,thead:ye,summary:be,details:Re,sub:Be,sup:He,svg:tt,data:Oe,time:Xe,template:ke,slot:at},ot=function(){function e(){}return e.attach=function(e,t){var n=E(),i=C(e,n);if(i instanceof x)i.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(function(){return i.dispose()});else if(Array.isArray(i)){var a=new R(new g(i),T(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;if("string"==typeof e){var i=e;if(void 0===(e=rt[e]))throw new Error("Node "+i+" does not exist or is not supported")}return(n={})[A]=!0,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();function st(e,t){var n=[],i=function(i){if(e[i])if(e[i]instanceof m||e[i]instanceof S){var a=e[i],r=new m(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 ut(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 m;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=E(),this.api=T(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))),H(e.name,e.observedAttributes,void 0,function(e,t){for(var n in t)n in e.props||(e.props[n]=t[n])})}export{R as ArrayAurumElement,g as ArrayDataSource,ot as Aurum,x as AurumElement,M as AurumRouter,c as CancellationToken,v as DataFlow,m as DataSource,F as DefaultRoute,W as DefaultSwitchCase,S as DuplexDataSource,k as FilteredArrayView,b as MappedArrayView,K as ObjectDataSource,L as Route,I as SingularAurumElement,y as SortedArrayView,V as Stream,P as Suspense,j as Switch,q as SwitchCase,w as TransientDataSource,ut as Webcomponent,st as aurumClassName,A as aurumElementModelIdentitiy,T as createAPI,E as createRenderSession,D as nodeData,N as pendingSessions,C as render}; | ||
//# sourceMappingURL=aurumjs.esm.js.map |
@@ -1,2 +0,2 @@ | ||
function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function t(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}function n(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 i(e,t){return(i=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 a=[null];a.push.apply(a,t);var r=new(Function.bind.apply(e,a));return n&&i(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,a(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),i(n,e)})(e)}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}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=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 a=setTimeout(function(){n.removeCancelable(i),e()},t),i=function(){return clearTimeout(a)};this.addCancelable(i)}),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(a),e()}),a=function(){return cancelAnimationFrame(n)};this.addCancelable(a)}),n.animationLoop=function(e){var t=requestAnimationFrame(function n(a){e(a),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}(),h=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 a=0;a<t;a++)try{this.subscribeOnceChannel[a].callback(e)}catch(e){console.error(e)}this.subscribeOnceChannel.length=0}this.isFiring=!1,this.afterFire()},n.createSubscription=function(e,t,n){var a=this,i={callback:e},r={cancel:function(){a.cancel(i,t)}};return void 0!==n&&n.addCancelable(function(){return a.cancel(i,t)}),t.push(i),{subscription:i,facade:r}},n.cancel=function(e,t){var n,a=this,i=t.indexOf(e);i>=0&&(this.isFiring?this.onAfterFire.push(function(){return a.cancel(e,t)}):(t.splice(i,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 d(e,t,n){if(!e.s){if(n instanceof f){if(!n.s)return void(n.o=d.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(d.bind(null,e,t),d.bind(null,e,2));e.s=t,e.v=n;var a=e.o;a&&a(e)}}var f=function(){function e(){}return e.prototype.then=function(t,n){var a=new e,i=this.s;if(i){var r=1&i?t:n;if(r){try{d(a,1,r(this.v))}catch(e){d(a,2,e)}return a}return this}return this.o=function(e){try{var i=e.v;1&e.s?d(a,1,t?t(i):i):n?d(a,1,n(i)):d(a,2,i)}catch(e){d(a,2,e)}},a},e}();function p(e){return e instanceof f&&1&e.s}var v,m=function(){function e(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new h}e.fromMultipleSources=function(t,n){for(var a,i=new e,r=l(t);!(a=r()).done;)a.value.pipe(i,n);return i};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 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.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 c;var n=new w(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.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 c,n=this.primed?new w(t,e(this.value)):new w(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 c;var t=new w(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 c;var t=[],n=new w(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var a=!1,i=function(){if(!(e instanceof Promise)){var i=n.update;return Promise.resolve(e).then(function(e){i.call(n,e)})}t.push(e),function(){try{var e=function(){a=!1};a||(a=!0);var i=function(e,t,n){for(var a;;){var i=e();if(p(i)&&(i=i.v),!i)return r;if(i.then){a=0;break}var r=n();if(r&&r.then){if(!p(r)){a=1;break}r=r.s}}var o=new f,s=d.bind(null,o,2);return(0===a?i.then(l):1===a?r.then(u):(void 0).then(function(){(i=e())?i.then?i.then(l).then(void 0,s):l(i):d(o,1,r)})).then(void 0,s),o;function u(t){r=t;do{if(!(i=e())||p(i)&&!i.v)return void d(o,1,r);if(i.then)return void i.then(l).then(void 0,s);p(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):d(o,1,r)}}(function(){return!!t.length},0,function(){var e=n.update;return Promise.resolve(t[0]).then(function(a){e.call(n,a),t.shift()})});Promise.resolve(i&&i.then?i.then(e):e())}catch(e){return Promise.reject(e)}}()}();return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e),n},t.awaitLatest=function(e){var t;e=null!=e?e:new c;var n=new w(e);return(this.primed?this.listenAndRepeat:this.listen).call(this,function(e){try{var a=t=Date.now();return Promise.resolve(e).then(function(e){t===a&&n.update(e)})}catch(e){return Promise.reject(e)}},e),n},t.unique=function(e){e=null!=e?e:new c;var t=new w(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 c;var t=new w(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 c;var a=new w(n,t);return this.listen(function(t){return a.update(e(a.value,t))},n),a},t.aggregate=function(e,t,n){var a=this;n=null!=n?n:new c;var i=new w(n,t(this.value,e.value));return this.listen(function(){return i.update(t(a.value,e.value))},n),e.listen(function(){return i.update(t(a.value,e.value))},n),i},t.aggregateThree=function(e,t,n,a){var i=this;a=null!=a?a:new c;var r=new w(a,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(i.value,e.value,t.value))},a),e.listen(function(){return r.update(n(i.value,e.value,t.value))},a),t.listen(function(){return r.update(n(i.value,e.value,t.value))},a),r},t.aggregateFour=function(e,t,n,a,i){var r=this;i=null!=i?i:new c;var o=new w(i,a(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(a(r.value,e.value,t.value,n.value))},i),e.listen(function(){return o.update(a(r.value,e.value,t.value,n.value))},i),t.listen(function(){return o.update(a(r.value,e.value,t.value,n.value))},i),n.listen(function(){return o.update(a(r.value,e.value,t.value,n.value))},i),o},t.combine=function(e,t){t=null!=t?t:new c;var n=new w(t);this.pipe(n,t);for(var a,i=l(e);!(a=i()).done;)a.value.pipe(n,t);return n},t.delay=function(e,t){t=null!=t?t:new c;var n=new w(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 c;var n=new w(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 c;var n=new w(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 c;var n,a=new w(t,this.value);return this.listen(function(t){clearTimeout(n),n=setTimeout(function(){a.update(t)},e)},t),a},t.throttle=function(e,t){t=null!=t?t:new c;var n=new w(t,this.value),a=!1;return this.listen(function(t){a||(n.update(t),a=!0,setTimeout(function(){a=!1},e))},t),n},t.buffer=function(e,t){t=null!=t?t:new c;var n,a=new w(t),i=[];return this.listen(function(t){i.push(t),n||(n=setTimeout(function(){n=void 0,a.update(i),i=[]},e))},t),a},t.accumulate=function(e){var t=new g;return this.listen(function(e){t.push(e)},e),t},t.pick=function(e,t){var n;t=null!=t?t:new c;var a=new w(t,null===(n=this.value)||void 0===n?void 0:n[e]);return this.listen(function(t){a.update(null!=t?t[e]:t)},t),a},t.cancelAll=function(){this.updateEvent.cancelAll()},e}(),w=function(e){function t(t,n){var a;return(a=e.call(this,n)||this).disposeToken=t,a.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}(a),"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')}})},a}n(t,e);var a=t.prototype;return a.persist=function(){return this.updateEvent.onEmpty=void 0,this},a.listen=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},a.listenAndRepeat=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listenAndRepeat.call(this,t,n)},a.listenOnce=function(t,n){return this.disposeToken.throwIfCancelled("Transient data source has expired. Listening not possible"),e.prototype.listen.call(this,t,n)},t}(m),g=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new m(this.data.length),this.updateEvent=new h}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],a=this.data[t];this.data[t]=n,this.data[e]=a,this.update({operation:"swap",operationDetailed:"swap",index:e,index2:t,items:[n,a],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),a=this.data.indexOf(t);-1!==n&&-1!==a&&(this.data[a]=e,this.data[n]=t),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:a,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 a=new y(this,e,n),i=new c;return n&&n.addCancelable(function(){return i.cancel()}),t.forEach(function(e){e.listen(function(){return a.refresh()})},i),a},n.map=function(e,t,n){void 0===t&&(t=[]);var a=new b(this,e,n);return t.forEach(function(e){e.listen(function(){return a.refresh()})},n),a},n.filter=function(e,t,n){void 0===t&&(t=[]);var a=new S(this,e,n);return t.forEach(function(e){e.listen(function(){return a.refresh()},n)}),a},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}(),b=function(e){function t(t,n,a){var i;void 0===a&&(a=new c);var r=t.getData().map(n);return(i=e.call(this,r)||this).parent=t,i.mapper=n,t.listen(function(e){var t,n;switch(e.operationDetailed){case"removeLeft":i.removeLeft(e.count);break;case"removeRight":i.removeRight(e.count);break;case"remove":i.remove(i.data[e.index]);break;case"clear":i.clear();break;case"prepend":(t=i).unshift.apply(t,e.items.map(i.mapper));break;case"append":i.appendArray(e.items.map(i.mapper));break;case"insert":(n=i).insertAt.apply(n,[e.index].concat(e.items.map(i.mapper)));break;case"swap":i.swap(e.index,e.index2);break;case"replace":i.set(e.index,i.mapper(e.items[0]));break;case"merge":for(var a=i.data.slice(),r=e.previousState.slice(),o=0;o<e.newState.length;o++)if(i.data.length<=o&&i.data.push(i.mapper(e.newState[o])),r[o]!==e.newState[o]){var s=r.indexOf(e.newState[o]);if(-1!==s){var u=i.data[o];i.data[o]=i.data[s],i.data[s]=u;var l=r[o];r[o]=r[s],r[s]=l}else i.data.splice(o,0,i.mapper(e.newState[o])),r.splice(o,0,e.newState[o])}i.data.length>e.newState.length&&(i.data.length=e.newState.length),i.update({operation:"merge",operationDetailed:"merge",previousState:a,index:0,items:i.data,newState:i.data})}},a),i}return n(t,e),t.prototype.refresh=function(){this.merge(this.parent.data.map(this.mapper))},t}(g),y=function(e){function t(t,n,a){var i;void 0===a&&(a=new c);var r=t.getData().slice().sort(n);return(i=e.call(this,r)||this).parent=t,i.comparator=n,t.listen(function(e){var t;switch(e.operationDetailed){case"removeLeft":case"removeRight":for(var n,a=l(e.items);!(n=a()).done;)i.remove(n.value);break;case"remove":i.remove(e.items[0]);break;case"clear":i.clear();break;case"prepend":(t=i).unshift.apply(t,e.items),i.data.sort(i.comparator);break;case"append":case"insert":i.appendSorted(e.items);break;case"merge":i.merge(e.items.slice().sort(i.comparator));break;case"swap":break;case"replace":i.remove(e.target),i.appendSorted(e.items)}},a),i}n(t,e);var a=t.prototype;return a.appendSorted=function(e){this.merge(this.data.concat(e).sort(this.comparator))},a.refresh=function(){this.merge(this.parent.getData().slice().sort(this.comparator))},t}(g),S=function(e){function t(t,n,a){var i;void 0===a&&(a=new c),Array.isArray(t)&&(t=new g(t));var r=t.data.filter(n=null!=n?n:function(){return!0});return(i=e.call(this,r)||this).parent=t,i.viewFilter=n,t.listen(function(e){var t,n,a;switch(e.operationDetailed){case"clear":i.clear();break;case"removeLeft":case"removeRight":case"remove":for(var r,o=l(e.items);!(r=o()).done;)i.remove(r.value);break;case"prepend":a=e.items.filter(i.viewFilter),(t=i).unshift.apply(t,a);break;case"append":a=e.items.filter(i.viewFilter),i.appendArray(a);break;case"insert":a=e.items.filter(i.viewFilter),(n=i).insertAt.apply(n,[e.index].concat(a));break;case"merge":i.merge(e.items.filter(i.viewFilter));break;case"swap":var s=i.data.indexOf(e.items[0]),u=i.data.indexOf(e.items[1]);-1!==s&&-1!==u&&i.swap(s,u);break;case"replace":var c=i.data.indexOf(e.target);-1!==c&&(i.viewFilter(e.items[0])?i.set(c,e.items[0]):i.remove(e.target))}},a),i}n(t,e);var a=t.prototype;return a.updateFilter=function(e){if(this.viewFilter!==e)return this.viewFilter=e,this.refresh(),this.data.length},a.refresh=function(){this.merge(this.parent.data.filter(this.viewFilter))},t}(g);(v=exports.DataFlow||(exports.DataFlow={}))[v.UPSTREAM=0]="UPSTREAM",v[v.DOWNSTREAM=1]="DOWNSTREAM";var k=function(){function e(e,t){void 0===t&&(t=!0),this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new h,this.updateUpstreamEvent=new h,this.propagateWritesToReadStream=t}e.fromTwoDataSource=function(t,n,a,i){void 0===i&&(i=!0);var r=new e(a,i);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 m(this.value);return this.listenDownstream(function(e){t.update(e)},e),t},t.aggregate=function(e,t,n){var a=this;n=null!=n?n:new c;var i=new w(n,t(this.value,e.value));return this.listen(function(){return i.update(t(a.value,e.value))},n),e.listen(function(){return i.update(t(a.value,e.value))},n),i},t.aggregateThree=function(e,t,n,a){var i=this;a=null!=a?a:new c;var r=new w(a,n(this.value,e.value,t.value));return this.listen(function(){return r.update(n(i.value,e.value,t.value))},a),e.listen(function(){return r.update(n(i.value,e.value,t.value))},a),t.listen(function(){return r.update(n(i.value,e.value,t.value))},a),r},t.aggregateFour=function(e,t,n,a,i){var r=this;i=null!=i?i:new c;var o=new w(i,a(this.value,e.value,t.value,n.value));return this.listen(function(){return o.update(a(r.value,e.value,t.value,n.value))},i),e.listen(function(){return o.update(a(r.value,e.value,t.value,n.value))},i),t.listen(function(){return o.update(a(r.value,e.value,t.value,n.value))},i),n.listen(function(){return o.update(a(r.value,e.value,t.value,n.value))},i),o},t.filter=function(t,n,a){var i=this;if("function"==typeof n){var r=new e(void 0,!1);return this.listenDownstream(function(e){t(e,r.value)&&r.updateDownstream(e)},a),r.listenUpstream(function(e){n(e,i.value)&&i.updateUpstream(e)},a),r}var o=new m;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,a){var i,r,o=this;return"function"==typeof n?(i=new e(this.primed?t(this.value):void 0,!1),this.listenDownstream(function(e){return i.updateDownstream(t(e))},a),i.listenUpstream(function(e){return o.updateUpstream(n(e))},a),i):(r=this.primed?new m(t(this.value)):new m,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 a,i=this,r=new e(this.value);return r.listenUpstream(function(e){clearTimeout(a),a=setTimeout(function(){i.updateUpstream(e)},t)},n),this.listenDownstream(function(e){r.updateDownstream(e)},n),r},t.debounceDownstream=function(t,n){var a,i=this,r=new e(this.value);return this.listenDownstream(function(e){clearTimeout(a),a=setTimeout(function(){r.updateDownstream(e)},t)},n),r.listenUpstream(function(e){i.updateUpstream(e)},n),r},t.diff=function(e){e=null!=e?e:new c;var t=new w(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 c;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,a=new e(this.value,!1),i=this.value,r=this.value;return this.listenDownstream(function(e){r!==e&&(r=e,a.updateDownstream(e))},t),a.listenUpstream(function(e){i!==e&&(i=e,n.updateUpstream(e))},t),a},t.oneWayFlow=function(t,n){var a=this;void 0===t&&(t=exports.DataFlow.DOWNSTREAM);var i=new e(this.value,!1);return t===exports.DataFlow.DOWNSTREAM?(this.listenDownstream(function(e){return i.updateDownstream(e)},n),i.updateUpstream=function(){}):(i.listenUpstream(function(e){return a.updateUpstream(e)}),i.updateDownstream=function(){}),i},t.reduce=function(e,t,n){var a=new m(t);return this.listen(function(t){return a.update(e(a.value,t))},n),a},t.cancelAll=function(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()},e}();function E(){var e={attachCalls:[],sessionToken:new c(function(){for(var t,n=l(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var x=Symbol("AurumElementModel"),A=new WeakMap,D=function(){function e(t,n){var a=this;e.id++,this.children=[],this.api=n,this.api.onAttach(function(){if(void 0===a.hostNode)throw new Error("illegal state: Attach fired but not actually attached");a.render(t)})}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 a=e.id++;this.hostNode=t,this.contentStartMarker=document.createComment("START Aurum Node "+a),this.contentEndMarker=document.createComment("END Aurum Node "+a),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(),a=0;for(t=0;t<this.children.length;t++){var i=this.children[t];if(i instanceof e)a+=i.getLastIndex()-t-a-n;else if(this.hostNode.childNodes[t+n+a]!==this.contentEndMarker&&this.hostNode.childNodes[t+n+a]!==this.children[t]){if(!(i instanceof HTMLElement||i instanceof Text))throw new Error("not implemented");this.hostNode.removeChild(this.hostNode.childNodes[t+n+a]),this.hostNode.childNodes[t+n+a]?this.hostNode.insertBefore(i,this.hostNode.childNodes[t+n+a]):this.hostNode.appendChild(i)}else{if(!(i instanceof HTMLElement||i instanceof Text))throw new Error("not implemented");this.hostNode.childNodes[t+n+a]?this.hostNode.insertBefore(i,this.hostNode.childNodes[t+n+a]):this.hostNode.appendChild(i)}}for(;this.hostNode.childNodes[t+n+a]!==this.contentEndMarker;)this.hostNode.removeChild(this.hostNode.childNodes[t+n+a])},e}();function C(e,t,n){if(void 0===n&&(n=!1),null!=e){if(T.has(e)){var a,i=T.get(e);i.sessionToken&&((a=t.attachCalls).push.apply(a,i.attachCalls),t.sessionToken.chain(i.sessionToken),i.attachCalls=void 0,i.sessionToken=void 0),T.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 r=new m;return e.then(function(e){r.update(e)}),new I(r,N(t))}if(e instanceof m||e instanceof k)return new I(e,N(t));if(e instanceof g)return new R(e,N(t));var o=typeof e;if("string"===o||"number"===o||"bigint"===o||"boolean"===o)return document.createTextNode(e.toString())}return e[x]?C(e.factory(e.props||{},e.children,N(t)),t,n):e}}D.id=1;var T=new WeakMap;function N(e){var t=void 0,n={renderSession:e,onAttach:function(t){e.attachCalls.push(t)},onDetach:function(n){t||(t=new c,e.tokens.push(t)),t.addCancelable(n)},onError:function(e){throw new Error("not implemented")},get cancellationToken(){return t||(t=new c,e.tokens.push(t)),t},prerender:function(e){var t=E(),n=C(e,t,!0);if(Array.isArray(n))for(var a,i=l(n);!(a=i()).done;){var r=a.value;"object"==typeof r&&T.set(r,t)}else T.set(n,t);return n},get style(){return function(e){for(var t,a=[].slice.call(arguments,1),i=new m,r=l(a);!(t=r()).done;){var o=t.value;(o instanceof m||o instanceof k)&&o.listen(function(){return i.update(O(e,a))},n.cancellationToken)}return i.update(O(e,a)),i}}};return n}function O(e,t){for(var n="",a=0;a<e.length;a++)n+=e[a],t[a]&&(n+="string"==typeof t[a]?t[a]:t[a].value);return n}var R=function(e){function t(t,n){var a;return(a=e.call(this,t,n)||this).renderSessions=new WeakMap,a.dataSource=t,a}n(t,e);var a=t.prototype;return a.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},a.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},a.spliceChildren=function(e,t,n){for(var a,i=l(n?this.children.splice(e,t,n):this.children.splice(e,t));!(a=i()).done;)this.renderSessions.get(a.value).sessionToken.cancel()},a.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 a=t.indexOf(e.newState[n]);if(-1!==a){var i=this.children[n];this.children[n]=this.children[a],this.children[a]=i;var r=t[n];t[n]=t[a],t[a]=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 S=this.renderItem(b.value);if(Array.isArray(S))throw new Error("illegal state");this.children.unshift(S)}break;case"clear":this.children.length=0,this.renderSessions=new WeakMap;break;default:throw new Error("not implemented")}this.updateDom()},a.renderItem=function(e){for(var t,n=E(),a=C(e,n),i=l(n.attachCalls);!(t=i()).done;)(0,t.value)();return this.renderSessions.set(a,n),a},t}(D),I=function(e){function t(t,n){var a;return(a=e.call(this,t,n)||this).api.cancellationToken.addCancelable(function(){var e;return null===(e=a.renderSession)||void 0===e?void 0:e.sessionToken.cancel()}),a.dataSource=t,a}n(t,e);var a=t.prototype;return a.attachToDom=function(t,n){e.prototype.attachToDom.call(this,t,n),this.contentStartMarker.dataSource=this.dataSource,this.contentEndMarker.dataSource=this.dataSource},a.render=function(e){var t=this;e.listenAndRepeat(function(e){t.handleNewContent(e),t.updateDom()},this.api.cancellationToken)},a.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}},a.fullRebuild=function(e){this.clearContent(),this.endSession(),this.renderSession=E();var t=C(e,this.renderSession);if(void 0!==t){Array.isArray(t)||(t=[t]);for(var n,a=l(t);!(n=a()).done;){var i=n.value;i instanceof D&&i.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=[]},a.endSession=function(){this.renderSession&&(this.renderSession.sessionToken.cancel(),this.renderSession=void 0)},t}(D);function M(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function U(e,t){}function F(e,t){}function L(e,t){}function P(e,t){}var j=function(){function e(e){e&&(this.data=e),this.updateEvent=new h,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n,a=new m(null===(n=this.data)||void 0===n?void 0:n[e]);return this.listenOnKey(e,function(e){a.update(e.newValue)},t),a},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 h),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,a=l(t.keys());!(n=a()).done;){var i=n.value;this.set(i,t.data[i])}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 m(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),W={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"},q=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function V(e,t,n,a){return function(i,r,o){var s=document.createElement(e);i&&function(e,t,n,a,i){K(e,W,t),i&&K(e,i,t);var r=Object.keys(t).filter(function(e){return e.includes("-")});_(e,q,t,r),a&&_(e,a,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof m||t instanceof k)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 a=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=a;for(var i,r=l(t);!(i=r()).done;){var o=i.value;o instanceof m&&o.unique(n).listen(function(n){var a=t.reduce(function(e,t){return"string"==typeof t?e+" "+t:t.value?e+" "+t.value:e},"");e.className=a})}}}(e,t.class,n)}(s,i,o.cancellationToken,t,n);var u=C(r,o.renderSession);return function e(t,n){if(null!=n)if(Array.isArray(n))for(var a,i=l(n);!(a=i()).done;)e(t,a.value);else if(n instanceof D)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),i.onAttach&&o.onAttach(function(){return i.onAttach(s)}),i.onDetach&&o.onDetach(function(){s.isConnected&&s.parentElement.removeChild(s),i.onDetach(s)}),null==a||a(s,i,o.cancellationToken),s}}function K(e,t,n){var a=function(a){n[t[a]]&&(n[t[a]]instanceof m?e.addEventListener(a,function(e){return n[t[a]].update(e)}):n[t[a]]instanceof k?e.addEventListener(a,function(e){return n[t[a]].updateDownstream(e)}):"function"==typeof n[t[a]]&&e.addEventListener(a,function(e){return n[t[a]](e)}))};for(var i in t)a(i)}function _(e,t,n,a){for(var i,r=l(t);!(i=r()).done;){var o=i.value;n[o]&&B(e,n[o],o)}if(a)for(var s,u=l(a);!(s=u()).done;){var c=s.value;n[c]&&B(e,n[c],c)}}function B(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof m||t instanceof k))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 H=V("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 a=e;t.value&&(t.value instanceof m?(t.value.listenAndRepeat(function(e){a.value=e},n),a.addEventListener("input",function(){t.value.update(a.value)})):t.value instanceof k?(t.value.listenAndRepeat(function(e){a.value=e},n),a.addEventListener("input",function(){t.value.updateUpstream(a.value)})):a.value=t.value),t.checked&&(t.checked instanceof m?(t.checked.listenAndRepeat(function(e){a.checked=e},n),a.addEventListener("change",function(){t.checked.update(a.checked)})):t.checked instanceof k?(t.checked.listenAndRepeat(function(e){a.checked=e},n),a.addEventListener("change",function(){t.checked.updateUpstream(a.checked)})):a.checked=t.checked)}),z=V("select",void 0,{change:"onChange"},function(e,t,n){var a=e;t.value&&(t.value instanceof m?(t.value.listenAndRepeat(function(e){a.value=e},n),a.addEventListener("change",function(){t.value.update(a.value)})):t.value instanceof k?(t.value.listenAndRepeat(function(e){a.value=e},n),a.addEventListener("change",function(){t.value.updateUpstream(a.value)})):a.value=t.value),t.selectedIndex&&(t.selectedIndex instanceof m?(t.selectedIndex.listenAndRepeat(function(e){a.selectedIndex=e},n),a.addEventListener("change",function(){t.selectedIndex.update(a.selectedIndex)})):t.selectedIndex instanceof k?(t.selectedIndex.listenAndRepeat(function(e){a.selectedIndex=e},n),a.addEventListener("change",function(){t.selectedIndex.updateUpstream(a.selectedIndex)})):a.selectedIndex=t.selectedIndex)}),$=V("code"),G=V("div"),J=V("a",["href","target"]),Q=V("abbr"),X=V("h1"),Y=V("h2"),Z=V("h3"),ee=V("h4"),te=V("h5"),ne=V("h6"),ae=V("area",["alt","coors"]),ie=V("article"),re=V("aside"),oe=V("span"),se=V("noscript"),ue=V("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),le=V("ul"),ce=V("ol"),he=V("li"),de=V("tr"),fe=V("b"),pe=V("title"),ve=V("summary"),me=V("thead"),we=V("template"),ge=V("q"),be=V("pre"),ye=V("p"),Se=V("hr"),ke=V("audio",["controls","autoplay","loop","muted","preload","src"]),Ee=V("br"),xe=V("button",["disabled"]),Ae=V("canvas",["width","height"]),De=V("data",["value"]),Ce=V("details"),Te=V("em"),Ne=V("footer"),Oe=V("form"),Re=V("head"),Ie=V("header"),Me=V("heading"),Ue=V("i"),Fe=V("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),Le=V("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),Pe=V("label",["for"]),je=V("link",["href","rel","media","as","disabled","type"]),We=V("nav"),qe=V("sub"),Ve=V("sup"),Ke=V("table"),_e=V("tbody"),Be=V("tfoot"),He=V("td"),ze=V("th"),$e=V("time",["datetime"]),Ge=V("style",["media"]),Je=V("source",["src","srcSet","media","sizes","type"]),Qe=V("script",["src","async","defer","integrity","noModule","type"]),Xe=V("svg",["width","height"]),Ye=V("progress",["max","value"]),Ze=V("option",["value"]),et=V("slot",["name"]),tt={button:xe,code:$,hr:Se,div:G,input:H,li:he,span:oe,style:Ge,ul:le,p:ye,img:Le,link:je,canvas:Ae,a:J,article:ie,br:Ee,form:Oe,label:Pe,ol:ce,pre:be,progress:Ye,table:Ke,td:He,tr:de,th:ze,textarea:V("textArea",["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],{input:"onInput",change:"onChange"},function(e,t,n){var a=e;t.value&&(t.value instanceof m?(t.value.listenAndRepeat(function(e){a.value=e},n),a.addEventListener("input",function(){t.value.update(a.value)})):t.value instanceof k?(t.value.listenAndRepeat(function(e){a.value=e},n),a.addEventListener("input",function(){t.value.updateUpstream(a.value)})):a.value=t.value)}),h1:X,h2:Y,h3:Z,h4:ee,h5:te,h6:ne,head:Re,header:Ie,footer:Ne,nav:We,b:fe,i:Ue,script:Qe,abbr:Q,area:ae,aside:re,audio:ke,em:Te,heading:Me,iframe:Fe,noscript:se,option:Ze,q:ge,select:z,source:Je,title:pe,video:ue,tbody:_e,tfoot:Be,thead:me,summary:ve,details:Ce,sub:qe,sup:Ve,svg:Xe,data:De,time:$e,template:we,slot:et},nt=function(){function e(){}return e.attach=function(e,t){var n=E(),a=C(e,n);if(a instanceof D)a.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(function(){return a.dispose()});else if(Array.isArray(a)){var i=new R(new g(a),N(n));n.sessionToken.addCancelable(function(){return i.dispose()}),i.attachToDom(t,t.childNodes.length)}else t.appendChild(a),n.sessionToken.addCancelable(function(){t.removeChild(a)});for(var r=n.attachCalls.length-1;r>=0;r--)n.attachCalls[r]();return n.sessionToken},e.factory=function(e,t){var n;if("string"==typeof e){var a=e;if(void 0===(e=tt[e]))throw new Error("Node "+a+" does not exist or is not supported")}return(n={})[x]=!0,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();exports.ArrayAurumElement=R,exports.ArrayDataSource=g,exports.Aurum=nt,exports.AurumElement=D,exports.AurumRouter=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[x]||!(e.factory===U||e.factory===F)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===F}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var a=new m(M());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){a.update(M())}),a.unique(n.cancellationToken).withInitial(a.value).map(function(e){return function(e,t){var n,a;if(null==e)return null===(n=t.find(function(e){return e.factory===F}))||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 i=e.split("/");i.pop();for(var r=function(){var e=i.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};i.pop()};i.length;){var o=r();if("object"==typeof o)return o.v}return null===(a=t.find(function(e){return e.factory===F}))||void 0===a?void 0:a.children}(e,t)})},exports.CancellationToken=c,exports.DataSource=m,exports.DefaultRoute=F,exports.DefaultSwitchCase=P,exports.DuplexDataSource=k,exports.FilteredArrayView=S,exports.MappedArrayView=b,exports.ObjectDataSource=j,exports.Route=U,exports.SingularAurumElement=I,exports.SortedArrayView=y,exports.Suspense=function(e,t,n){var a=new m(null==e?void 0:e.fallback),i=new c;return n.onDetach(function(){i.cancel()}),Promise.all(n.prerender(t,i)).then(function(e){i.isCanceled||a.update(e)},function(e){return i.cancel(),Promise.reject(e)}),a},exports.Switch=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[x]||!(e.factory===L||e.factory===P)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===P}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");var a=new c;return n.onDetach(function(){a.cancel()}),e.state.unique(a).withInitial(e.state.value).map(function(e){return function(e,t){var n,a,i;return null!==(a=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!==a?a:null===(i=t.find(function(e){return e.factory===P}))||void 0===i?void 0:i.children}(e,t)})},exports.SwitchCase=L,exports.TransientDataSource=w,exports.Webcomponent=function(e,a){return customElements.define(e.name,function(i){function r(){var t;t=i.call(this)||this,void 0===e.observedAttributes&&(e.observedAttributes=[]),t.props={};for(var n,a=l(e.observedAttributes);!(n=a()).done;)t.props[n.value]=new m;return t}n(r,i);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=E(),this.api=N(this.session);for(var i,r=a(this.props,this.api),o=l(this.session.attachCalls);!(i=o()).done;)(0,i.value)();nt.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))),V(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=[],a=function(a){if(e[a])if(e[a]instanceof m||e[a]instanceof k){var i=e[a],r=new m(i.value?a:"");i.listen(function(e){r.update(e?a:"")},t),n.push(r)}else n.push(a)};for(var i in e)a(i);return n},exports.aurumElementModelIdentitiy=x,exports.createAPI=N,exports.createRenderSession=E,exports.nodeData=A,exports.pendingSessions=T,exports.render=C; | ||
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=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}(),h=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 d(e,t,n){if(!e.s){if(n instanceof f){if(!n.s)return void(n.o=d.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(d.bind(null,e,t),d.bind(null,e,2));e.s=t,e.v=n;var i=e.o;i&&i(e)}}var f=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{d(i,1,r(this.v))}catch(e){d(i,2,e)}return i}return this}return this.o=function(e){try{var a=e.v;1&e.s?d(i,1,t?t(a):a):n?d(i,1,n(a)):d(i,2,a)}catch(e){d(i,2,e)}},i},e}();function p(e){return e instanceof f&&1&e.s}var v,m=function(){function e(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new h}e.fromMultipleSources=function(t,n){for(var i,a=new e,r=l(t);!(i=r()).done;)i.value.pipe(a,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 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.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 c;var n=new w(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.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 c,n=this.primed?new w(t,e(this.value)):new w(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 c;var t=new w(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 c;var t=[],n=new w(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(p(a)&&(a=a.v),!a)return r;if(a.then){i=0;break}var r=n();if(r&&r.then){if(!p(r)){i=1;break}r=r.s}}var o=new f,s=d.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):d(o,1,r)})).then(void 0,s),o;function u(t){r=t;do{if(!(a=e())||p(a)&&!a.v)return void d(o,1,r);if(a.then)return void a.then(l).then(void 0,s);p(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):d(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 c;var n=new w(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 c;var t=new w(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 c;var t=new w(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 c;var i=new w(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 c;var a=new w(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 c;var r=new w(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 c;var o=new w(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 c;var n=new w(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 c;var n=new w(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 c;var n=new w(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 c;var n=new w(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 c;var n,i=new w(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 c;var n=new w(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 c;var n,i=new w(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 g;return this.listen(function(e){t.push(e)},e),t},t.pick=function(e,t){var n;t=null!=t?t:new c;var i=new w(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}(),w=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}(m),g=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new m(this.data.length),this.updateEvent=new h}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 y(this,e,n),a=new c;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 b(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}(),b=function(e){function t(t,n,i){var a;void 0===i&&(i=new c);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}(g),y=function(e){function t(t,n,i){var a;void 0===i&&(i=new c);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}(g),S=function(e){function t(t,n,i){var a;void 0===i&&(i=new c),Array.isArray(t)&&(t=new g(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}(g);(v=exports.DataFlow||(exports.DataFlow={}))[v.UPSTREAM=0]="UPSTREAM",v[v.DOWNSTREAM=1]="DOWNSTREAM";var k=function(){function e(e,t){void 0===t&&(t=!0),this.value=e,this.primed=void 0!==e,this.updateDownstreamEvent=new h,this.updateUpstreamEvent=new h,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 m(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 c;var a=new w(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 c;var r=new w(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 c;var o=new w(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 m;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 m(t(this.value)):new m,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 c;var t=new w(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 c;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 m(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 E(){var e={attachCalls:[],sessionToken:new c(function(){for(var t,n=l(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var x=Symbol("AurumElementModel"),A=new WeakMap,D=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 C(e,t,n){if(void 0===n&&(n=!1),null!=e){if(T.has(e)){var i,a=T.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),T.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 r=new m;return e.then(function(e){r.update(e)}),new I(r,N(t))}if(e instanceof m||e instanceof k)return new I(e,N(t));if(e instanceof g)return new R(e,N(t));var o=typeof e;if("string"===o||"number"===o||"bigint"===o||"boolean"===o)return document.createTextNode(e.toString())}return e[x]?C(e.factory(e.props||{},e.children,N(t)),t,n):e}}D.id=1;var T=new WeakMap;function N(e){var t=void 0,n={renderSession:e,onAttach:function(t){e.attachCalls.push(t)},onDetach:function(n){t||(t=new c,e.tokens.push(t)),t.addCancelable(n)},onError:function(e){throw new Error("not implemented")},get cancellationToken(){return t||(t=new c,e.tokens.push(t)),t},prerender:function(e){var t=E(),n=C(e,t,!0);if(Array.isArray(n))for(var i,a=l(n);!(i=a()).done;){var r=i.value;"object"==typeof r&&T.set(r,t)}else T.set(n,t);return n},get style(){return function(e){for(var t,i=[].slice.call(arguments,1),a=new m,r=l(i);!(t=r()).done;){var o=t.value;(o instanceof m||o instanceof k)&&o.listen(function(){return a.update(O(e,i))},n.cancellationToken)}return a.update(O(e,i)),a}}};return n}function O(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 R=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 S=this.renderItem(b.value);if(Array.isArray(S))throw new Error("illegal state");this.children.unshift(S)}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=E(),i=C(e,n),a=l(n.attachCalls);!(t=a()).done;)(0,t.value)();return this.renderSessions.set(i,n),i},t}(D),I=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=E();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 a=n.value;a instanceof D&&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}(D);function M(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function U(e,t){}function L(e,t){}function F(e,t){}function P(e,t){}var j=function(){function e(e){e&&(this.data=e),this.updateEvent=new h,this.updateEventOnKey=new Map}var t=e.prototype;return t.pick=function(e,t){var n,i=new m(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 h),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 m(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),q=function(){function e(e,t){this.input=e,this.output=t}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))},t(e,[{key:"value",get:function(){return this.output.value}}]),e}(),W={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"},V=["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){_(e,W,t),a&&_(e,a,t);var r=Object.keys(t).filter(function(e){return e.includes("-")});B(e,V,t,r),i&&B(e,i,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof m||t instanceof k)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 m&&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=C(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 D)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 _(e,t,n){var i=function(i){n[t[i]]&&(n[t[i]]instanceof m?e.addEventListener(i,function(e){return n[t[i]].update(e)}):n[t[i]]instanceof k?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 B(e,t,n,i){for(var a,r=l(t);!(a=r()).done;){var o=a.value;n[o]&&H(e,n[o],o)}if(i)for(var s,u=l(i);!(s=u()).done;){var c=s.value;n[c]&&H(e,n[c],c)}}function H(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof m||t instanceof k))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 z=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 m?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof k?(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 m?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.update(i.checked)})):t.checked instanceof k?(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 m?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.update(i.value)})):t.value instanceof k?(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 m?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.update(i.selectedIndex)})):t.selectedIndex instanceof k?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.updateUpstream(i.selectedIndex)})):i.selectedIndex=t.selectedIndex)}),G=K("code"),J=K("div"),Q=K("a",["href","target"]),X=K("abbr"),Y=K("h1"),Z=K("h2"),ee=K("h3"),te=K("h4"),ne=K("h5"),ie=K("h6"),ae=K("area",["alt","coors"]),re=K("article"),oe=K("aside"),se=K("span"),ue=K("noscript"),le=K("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),ce=K("ul"),he=K("ol"),de=K("li"),fe=K("tr"),pe=K("b"),ve=K("title"),me=K("summary"),we=K("thead"),ge=K("template"),be=K("q"),ye=K("pre"),Se=K("p"),ke=K("hr"),Ee=K("audio",["controls","autoplay","loop","muted","preload","src"]),xe=K("br"),Ae=K("button",["disabled"]),De=K("canvas",["width","height"]),Ce=K("data",["value"]),Te=K("details"),Ne=K("em"),Oe=K("footer"),Re=K("form"),Ie=K("head"),Me=K("header"),Ue=K("heading"),Le=K("i"),Fe=K("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),Pe=K("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),je=K("label",["for"]),qe=K("link",["href","rel","media","as","disabled","type"]),We=K("nav"),Ve=K("sub"),Ke=K("sup"),_e=K("table"),Be=K("tbody"),He=K("tfoot"),ze=K("td"),$e=K("th"),Ge=K("time",["datetime"]),Je=K("style",["media"]),Qe=K("source",["src","srcSet","media","sizes","type"]),Xe=K("script",["src","async","defer","integrity","noModule","type"]),Ye=K("svg",["width","height"]),Ze=K("progress",["max","value"]),et=K("option",["value"]),tt=K("slot",["name"]),nt={button:Ae,code:G,hr:ke,div:J,input:z,li:de,span:se,style:Je,ul:ce,p:Se,img:Pe,link:qe,canvas:De,a:Q,article:re,br:xe,form:Re,label:je,ol:he,pre:ye,progress:Ze,table:_e,td:ze,tr:fe,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 m?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof k?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value)}),h1:Y,h2:Z,h3:ee,h4:te,h5:ne,h6:ie,head:Ie,header:Me,footer:Oe,nav:We,b:pe,i:Le,script:Xe,abbr:X,area:ae,aside:oe,audio:Ee,em:Ne,heading:Ue,iframe:Fe,noscript:ue,option:et,q:be,select:$,source:Qe,title:ve,video:le,tbody:Be,tfoot:He,thead:we,summary:me,details:Te,sub:Ve,sup:Ke,svg:Ye,data:Ce,time:Ge,template:ge,slot:tt},it=function(){function e(){}return e.attach=function(e,t){var n=E(),i=C(e,n);if(i instanceof D)i.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(function(){return i.dispose()});else if(Array.isArray(i)){var a=new R(new g(i),N(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;if("string"==typeof e){var i=e;if(void 0===(e=nt[e]))throw new Error("Node "+i+" does not exist or is not supported")}return(n={})[x]=!0,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();exports.ArrayAurumElement=R,exports.ArrayDataSource=g,exports.Aurum=it,exports.AurumElement=D,exports.AurumRouter=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[x]||!(e.factory===U||e.factory===L)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===L}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var i=new m(M());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){i.update(M())}),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===L}))||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===L}))||void 0===i?void 0:i.children}(e,t)})},exports.CancellationToken=c,exports.DataSource=m,exports.DefaultRoute=L,exports.DefaultSwitchCase=P,exports.DuplexDataSource=k,exports.FilteredArrayView=S,exports.MappedArrayView=b,exports.ObjectDataSource=j,exports.Route=U,exports.SingularAurumElement=I,exports.SortedArrayView=y,exports.Stream=q,exports.Suspense=function(e,t,n){var i=new m(null==e?void 0:e.fallback),a=new c;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[x]||!(e.factory===F||e.factory===P)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===P}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");var i=new c;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===P}))||void 0===a?void 0:a.children}(e,t)})},exports.SwitchCase=F,exports.TransientDataSource=w,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 m;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=E(),this.api=N(this.session);for(var a,r=i(this.props,this.api),o=l(this.session.attachCalls);!(a=o()).done;)(0,a.value)();it.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])})},exports.aurumClassName=function(e,t){var n=[],i=function(i){if(e[i])if(e[i]instanceof m||e[i]instanceof k){var a=e[i],r=new m(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=x,exports.createAPI=N,exports.createRenderSession=E,exports.nodeData=A,exports.pendingSessions=T,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)))}}class n{constructor(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new t}static fromMultipleSources(e,t){const s=new n;for(const n of e)n.pipe(s,t);return s}repeatLast(){return this.update(this.value),this}update(e){if(this.primed=!0,this.updating)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.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 a=new s(n);return this.listen(e=>{t(e,a.value)&&a.update(e)},n),a}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)}pipe(e,t){return this.listen(t=>e.update(t),t),this}map(t,n){let a;return n=null!=n?n:new e,a=this.primed?new s(n,t(this.value)):new s(n),this.listen(e=>{a.update(t(e))},n),a}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 s(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=[],a=new s(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];a.update(await e),n.shift()}}()):a.update(await e)},t),a}awaitLatest(t){let n;t=null!=t?t:new e;const a=new s(t);return(this.primed?this.listenAndRepeat:this.listen).call(this,async function(e){n=Date.now();const t=n,s=await e;n===t&&a.update(s)},t),a}unique(t){t=null!=t?t:new e;const n=new s(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 s(t,{new:this.value,old:void 0});return this.listen(e=>{n.update({new:e,old:n.value.new})},t),n}reduce(t,n,a){a=null!=a?a:new e;const i=new s(a,n);return this.listen(e=>i.update(t(i.value,e)),a),i}aggregate(t,n,a){a=null!=a?a:new e;const i=new s(a,n(this.value,t.value));return this.listen(()=>i.update(n(this.value,t.value)),a),t.listen(()=>i.update(n(this.value,t.value)),a),i}aggregateThree(t,n,a,i){i=null!=i?i:new e;const r=new s(i,a(this.value,t.value,n.value));return this.listen(()=>r.update(a(this.value,t.value,n.value)),i),t.listen(()=>r.update(a(this.value,t.value,n.value)),i),n.listen(()=>r.update(a(this.value,t.value,n.value)),i),r}aggregateFour(t,n,a,i,r){r=null!=r?r:new e;const o=new s(r,i(this.value,t.value,n.value,a.value));return this.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),t.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),n.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),a.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),o}combine(t,n){n=null!=n?n:new e;const a=new s(n);this.pipe(a,n);for(const e of t)e.pipe(a,n);return a}delay(t,n){n=null!=n?n:new e;const a=new s(n,this.value);return this.listen(e=>{setTimeout(()=>{a.update(e)},t)},n),a}skip(t,n){n=null!=n?n:new e;const a=new s(n,this.value);return this.listen(e=>{0===t?a.update(e):t--},n),a}cutoff(t,n){n=null!=n?n:new e;const a=new s(n,this.value);return this.listen(e=>{t-- >0&&a.update(e)},n),a}awaitNextUpdate(e){return new Promise(t=>{this.listenOnce(e=>t(e),e)})}debounce(t,n){n=null!=n?n:new e;const a=new s(n,this.value);let i;return this.listen(e=>{clearTimeout(i),i=setTimeout(()=>{a.update(e)},t)},n),a}throttle(t,n){n=null!=n?n:new e;const a=new s(n,this.value);let i=!1;return this.listen(e=>{i||(a.update(e),i=!0,setTimeout(()=>{i=!1},t))},n),a}buffer(t,n){n=null!=n?n:new e;const a=new s(n);let i,r=[];return this.listen(e=>{r.push(e),i||(i=setTimeout(()=>{i=void 0,a.update(r),r=[]},t))},n),a}accumulate(e){const t=new a;return this.listen(e=>{t.push(e)},e),t}pick(t,n){var a;n=null!=n?n:new e;const i=new s(n,null===(a=this.value)||void 0===a?void 0:a[t]);return this.listen(e=>{i.update(null!=e?e[t]:e)},n),i}cancelAll(){this.updateEvent.cancelAll()}}class s extends n{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 a{constructor(e){this.data=e?e.slice():[],this.lengthSource=new n(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 r(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 i(this,e,n);return t.forEach(e=>{e.listen(()=>s.refresh())},n),s}filter(e,t=[],n){const s=new o(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 i extends a{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 r extends a{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 o extends a{constructor(t,n,s=new e){Array.isArray(t)&&(t=new a(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))}}var l;!function(e){e[e.UPSTREAM=0]="UPSTREAM",e[e.DOWNSTREAM=1]="DOWNSTREAM"}(l||(l={}));class h{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 h(n,s);return a.updateDownstreamEvent=e.updateEvent,a.updateUpstreamEvent=t.updateEvent,a}withInitial(e){return this.primed||this.updateDownstream(e),this}static createOneWay(e=l.DOWNSTREAM,t){return new h(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 n(this.value);return this.listenDownstream(e=>{t.update(e)},e),t}aggregate(t,n,a){a=null!=a?a:new e;const i=new s(a,n(this.value,t.value));return this.listen(()=>i.update(n(this.value,t.value)),a),t.listen(()=>i.update(n(this.value,t.value)),a),i}aggregateThree(t,n,a,i){i=null!=i?i:new e;const r=new s(i,a(this.value,t.value,n.value));return this.listen(()=>r.update(a(this.value,t.value,n.value)),i),t.listen(()=>r.update(a(this.value,t.value,n.value)),i),n.listen(()=>r.update(a(this.value,t.value,n.value)),i),r}aggregateFour(t,n,a,i,r){r=null!=r?r:new e;const o=new s(r,i(this.value,t.value,n.value,a.value));return this.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),t.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),n.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),a.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),o}filter(e,t,s){if("function"==typeof t){const n=new h(void 0,!1);return this.listenDownstream(t=>{e(t,n.value)&&n.updateDownstream(t)},s),n.listenUpstream(e=>{t(e,this.value)&&this.updateUpstream(e)},s),n}{const s=new n;return this.listenDownstream(t=>{e(t,s.value)&&s.update(t)},t),s}}pipe(e,t){return this.listenDownstream(t=>e.updateDownstream(t),t),e.listenUpstream(e=>this.updateUpstream(e),t),this}map(e,t,s){if("function"==typeof t){let n;return n=new h(this.primed?e(this.value):void 0,!1),this.listenDownstream(t=>n.updateDownstream(e(t)),s),n.listenUpstream(e=>this.updateUpstream(t(e)),s),n}{let s;return s=this.primed?new n(e(this.value)):new n,this.listenDownstream(t=>s.update(e(t)),t),s}}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 h(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 h(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 s(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 h(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 h(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=l.DOWNSTREAM,t){const n=new h(this.value,!1);return e===l.DOWNSTREAM?(this.listenDownstream(e=>n.updateDownstream(e),t),n.updateUpstream=()=>{}):(n.listenUpstream(e=>this.updateUpstream(e)),n.updateDownstream=()=>{}),n}reduce(e,t,s){const a=new n(t);return this.listen(t=>a.update(e(a.value,t)),s),a}cancelAll(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()}}function d(){const t={attachCalls:[],sessionToken:new e(()=>{for(const e of t.tokens)e.cancel()}),tokens:[]};return t}const c=Symbol("AurumElementModel"),u=new WeakMap;class p{constructor(e,t){p.id++,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=p.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 p)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 v(e,t,s=!1){if(null!=e){if(m.has(e)){const n=m.get(e);n.sessionToken&&(t.attachCalls.push(...n.attachCalls),t.sessionToken.chain(n.sessionToken),n.attachCalls=void 0,n.sessionToken=void 0),m.delete(e)}if(Array.isArray(e))return Array.prototype.concat.apply([],e.map(e=>v(e,t,s)));if(!s){if(e instanceof Promise){const s=new n;return e.then(e=>{s.update(e)}),new b(s,f(t))}if(e instanceof n||e instanceof h)return new b(e,f(t));if(e instanceof a)return new g(e,f(t));const s=typeof e;if("string"===s||"number"===s||"bigint"===s||"boolean"===s)return document.createTextNode(e.toString())}return e[c]?v(e.factory(e.props||{},e.children,f(t)),t,s):e}}p.id=1;const m=new WeakMap;function f(t){let s=void 0;const a={renderSession:t,onAttach:e=>{t.attachCalls.push(e)},onDetach:n=>{s||(s=new e,t.tokens.push(s)),s.addCancelable(n)},onError:e=>{throw new Error("not implemented")},get cancellationToken(){return s||(s=new e,t.tokens.push(s)),s},prerender(e){const t=d(),n=v(e,t,!0);if(Array.isArray(n))for(const e of n)"object"==typeof e&&m.set(e,t);else m.set(n,t);return n},get style(){return function(e,...t){const s=new n;for(const i of t)(i instanceof n||i instanceof h)&&i.listen(()=>s.update(w(e,t)),a.cancellationToken);return s.update(w(e,t)),s}}};return a}function w(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 g extends p{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=d(),n=v(e,t);for(const e of t.attachCalls)e();return this.renderSessions.set(n,t),n}}class b extends p{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=d();let t=v(e,this.renderSession);if(void 0!==t){Array.isArray(t)||(t=[t]);for(const e of t)e instanceof p&&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)}}function y(e,t,s){if((t=[].concat.apply([],t.filter(e=>!!e))).some(e=>!e[c]||!(e.factory===E||e.factory===S)))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(e=>e.factory===S).length>1)throw new Error("Too many default routes only 0 or 1 allowed");const a=new n(k());return s.cancellationToken.registerDomEvent(window,"hashchange",()=>{a.update(k())}),a.unique(s.cancellationToken).withInitial(a.value).map(e=>function(e,t){var n,s;if(null==e)return null===(n=t.find(e=>e.factory===S))||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===S))||void 0===s?void 0:s.children}}(e,t))}function k(){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 S(e,t){}function A(t,s,a){const i=new n(null==t?void 0:t.fallback),r=new e;return a.onDetach(()=>{r.cancel()}),Promise.all(a.prerender(s,r)).then(e=>{r.isCanceled||i.update(e)},e=>(r.cancel(),Promise.reject(e))),i}function x(t,n,s){if((n=[].concat.apply([],n.filter(e=>!!e))).some(e=>!e[c]||!(e.factory===D||e.factory===C)))throw new Error("Switch only accepts SwitchCase as children");if(n.filter(e=>e.factory===C).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===C))||void 0===a?void 0:a.children}(e,n))}function D(e,t){}function C(e,t){}class N{constructor(e){e&&(this.data=e),this.updateEvent=new t,this.updateEventOnKey=new Map}pick(e,t){var s;const a=new n(null===(s=this.data)||void 0===s?void 0:s[e]);return this.listenOnKey(e,e=>{a.update(e.newValue)},t),a}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 N)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 n(this.data);return this.listen(t=>{e.update(this.data)}),e}}const T={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"},O=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function I(e,t,s,a){return function(i,r,o){const l=document.createElement(e);i&&function(e,t,s,a,i){R(e,T,t),i&&R(e,i,t);const r=Object.keys(t).filter(e=>e.includes("-"));M(e,O,t,r),a&&M(e,a,t),t.class&&function(e,t,s){if("string"==typeof t)e.className=t;else if(t instanceof n||t instanceof h)t.value&&(Array.isArray(t.value)?(e.className=t.value.join(" "),t.unique(s).listen(()=>{e.className=t.value.join(" ")})):(e.className=t.value,t.unique(s).listen(()=>{e.className=t.value}))),t.unique(s).listen(t=>e.className=t);else{const a=t.reduce((e,t)=>"string"==typeof t?`${e} ${t}`:t.value?`${e} ${t.value}`:e,"");e.className=a;for(const a of t)a instanceof n&&a.unique(s).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,s)}(l,i,o.cancellationToken,t,s);const d=v(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 p)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,d),i.onAttach&&o.onAttach(()=>i.onAttach(l)),i.onDetach&&o.onDetach(()=>{l.isConnected&&l.parentElement.removeChild(l),i.onDetach(l)}),null==a||a(l,i,o.cancellationToken),l}}function R(e,t,s){for(const a in t)s[t[a]]&&(s[t[a]]instanceof n?e.addEventListener(a,e=>s[t[a]].update(e)):s[t[a]]instanceof h?e.addEventListener(a,e=>s[t[a]].updateDownstream(e)):"function"==typeof s[t[a]]&&e.addEventListener(a,e=>s[t[a]](e)))}function M(e,t,n,s){for(const s of t)n[s]&&U(e,n[s],s);if(s)for(const t of s)n[t]&&U(e,n[t],t)}function U(e,t,s){if("string"==typeof t)e.setAttribute(s,t);else if("boolean"==typeof t)t&&e.setAttribute(s,"");else{if(!(t instanceof n||t instanceof h))throw new Error("Attributes only support types boolean, string, number and data sources");"string"==typeof t.value?e.setAttribute(s,t.value):"boolean"==typeof t.value&&t.value&&e.setAttribute(s,""),t.unique().listen(t=>{"string"==typeof t?e.setAttribute(s,t):"boolean"==typeof t&&(t?e.setAttribute(s,""):e.removeAttribute(s))})}}const L=I("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,s)=>{const a=e;t.value&&(t.value instanceof n?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("input",()=>{t.value.update(a.value)})):t.value instanceof h?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("input",()=>{t.value.updateUpstream(a.value)})):a.value=t.value),t.checked&&(t.checked instanceof n?(t.checked.listenAndRepeat(e=>{a.checked=e},s),a.addEventListener("change",()=>{t.checked.update(a.checked)})):t.checked instanceof h?(t.checked.listenAndRepeat(e=>{a.checked=e},s),a.addEventListener("change",()=>{t.checked.updateUpstream(a.checked)})):a.checked=t.checked)}),F=I("select",void 0,{change:"onChange"},(e,t,s)=>{const a=e;t.value&&(t.value instanceof n?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("change",()=>{t.value.update(a.value)})):t.value instanceof h?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("change",()=>{t.value.updateUpstream(a.value)})):a.value=t.value),t.selectedIndex&&(t.selectedIndex instanceof n?(t.selectedIndex.listenAndRepeat(e=>{a.selectedIndex=e},s),a.addEventListener("change",()=>{t.selectedIndex.update(a.selectedIndex)})):t.selectedIndex instanceof h?(t.selectedIndex.listenAndRepeat(e=>{a.selectedIndex=e},s),a.addEventListener("change",()=>{t.selectedIndex.updateUpstream(a.selectedIndex)})):a.selectedIndex=t.selectedIndex)}),q=I("code"),W=I("div"),K=I("a",["href","target"]),P=I("abbr"),V=I("h1"),j=I("h2"),$=I("h3"),B=I("h4"),H=I("h5"),_=I("h6"),z=I("area",["alt","coors"]),G=I("article"),J=I("aside"),Q=I("span"),X=I("noscript"),Y=I("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),Z=I("ul"),ee=I("ol"),te=I("li"),ne=I("tr"),se=I("b"),ae=I("title"),ie=I("summary"),re=I("thead"),oe=I("template"),le=I("q"),he=I("pre"),de=I("p"),ce=I("hr"),ue=I("audio",["controls","autoplay","loop","muted","preload","src"]),pe=I("br"),ve=I("button",["disabled"]),me=I("canvas",["width","height"]),fe=I("data",["value"]),we=I("details"),ge=I("em"),be=I("footer"),ye=I("form"),ke=I("head"),Ee=I("header"),Se=I("heading"),Ae=I("i"),xe=I("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),De=I("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),Ce=I("label",["for"]),Ne=I("link",["href","rel","media","as","disabled","type"]),Te=I("nav"),Oe=I("sub"),Ie=I("sup"),Re=I("table"),Me=I("tbody"),Ue=I("tfoot"),Le=I("td"),Fe=I("th"),qe=I("time",["datetime"]),We=I("style",["media"]),Ke=I("source",["src","srcSet","media","sizes","type"]),Pe=I("script",["src","async","defer","integrity","noModule","type"]),Ve=I("svg",["width","height"]),je=I("progress",["max","value"]),$e=I("option",["value"]),Be=I("slot",["name"]),He={button:ve,code:q,hr:ce,div:W,input:L,li:te,span:Q,style:We,ul:Z,p:de,img:De,link:Ne,canvas:me,a:K,article:G,br:pe,form:ye,label:Ce,ol:ee,pre:he,progress:je,table:Re,td:Le,tr:ne,th:Fe,textarea:I("textArea",["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],{input:"onInput",change:"onChange"},(e,t,s)=>{const a=e;t.value&&(t.value instanceof n?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("input",()=>{t.value.update(a.value)})):t.value instanceof h?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("input",()=>{t.value.updateUpstream(a.value)})):a.value=t.value)}),h1:V,h2:j,h3:$,h4:B,h5:H,h6:_,head:ke,header:Ee,footer:be,nav:Te,b:se,i:Ae,script:Pe,abbr:P,area:z,aside:J,audio:ue,em:ge,heading:Se,iframe:xe,noscript:X,option:$e,q:le,select:F,source:Ke,title:ae,video:Y,tbody:Me,tfoot:Ue,thead:re,summary:ie,details:we,sub:Oe,sup:Ie,svg:Ve,data:fe,time:qe,template:oe,slot:Be};class _e{static attach(e,t){const n=d(),s=v(e,n);if(s instanceof p)s.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(()=>s.dispose());else if(Array.isArray(s)){const e=new g(new a(s),f(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){if("string"==typeof e){const t=e;if(void 0===(e=He[e]))throw new Error(`Node ${t} does not exist or is not supported`)}return{[c]:!0,factory:e,props:t,children:n}}}function ze(e,t){const s=[];for(const a in e)if(e[a])if(e[a]instanceof n||e[a]instanceof h){const i=e[a],r=new n(i.value?a:"");i.listen(e=>{r.update(e?a:"")},t),s.push(r)}else s.push(a);return s}function Ge(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 n}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=d(),this.api=f(this.session);const a=t(this.props,this.api);for(const e of this.session.attachCalls)e();_e.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()}}),I(e.name,e.observedAttributes,void 0,(e,t)=>{for(const n in t)n in e.props||(e.props[n]=t[n])})}export{g as ArrayAurumElement,a as ArrayDataSource,_e as Aurum,p as AurumElement,y as AurumRouter,e as CancellationToken,l as DataFlow,n as DataSource,S as DefaultRoute,C as DefaultSwitchCase,h as DuplexDataSource,o as FilteredArrayView,i as MappedArrayView,N as ObjectDataSource,E as Route,b as SingularAurumElement,r as SortedArrayView,A as Suspense,x as Switch,D as SwitchCase,s as TransientDataSource,Ge as Webcomponent,ze as aurumClassName,c as aurumElementModelIdentitiy,f as createAPI,d as createRenderSession,u as nodeData,m as pendingSessions,v 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)))}}class n{constructor(e){this.value=e,this.primed=void 0!==e,this.updateEvent=new t}static fromMultipleSources(e,t){const s=new n;for(const n of e)n.pipe(s,t);return s}repeatLast(){return this.update(this.value),this}update(e){if(this.primed=!0,this.updating)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.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 a=new s(n);return this.listen(e=>{t(e,a.value)&&a.update(e)},n),a}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)}pipe(e,t){return this.listen(t=>e.update(t),t),this}map(t,n){let a;return n=null!=n?n:new e,a=this.primed?new s(n,t(this.value)):new s(n),this.listen(e=>{a.update(t(e))},n),a}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 s(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=[],a=new s(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];a.update(await e),n.shift()}}()):a.update(await e)},t),a}awaitLatest(t){let n;t=null!=t?t:new e;const a=new s(t);return(this.primed?this.listenAndRepeat:this.listen).call(this,async function(e){n=Date.now();const t=n,s=await e;n===t&&a.update(s)},t),a}unique(t){t=null!=t?t:new e;const n=new s(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 s(t,{new:this.value,old:void 0});return this.listen(e=>{n.update({new:e,old:n.value.new})},t),n}reduce(t,n,a){a=null!=a?a:new e;const i=new s(a,n);return this.listen(e=>i.update(t(i.value,e)),a),i}aggregate(t,n,a){a=null!=a?a:new e;const i=new s(a,n(this.value,t.value));return this.listen(()=>i.update(n(this.value,t.value)),a),t.listen(()=>i.update(n(this.value,t.value)),a),i}aggregateThree(t,n,a,i){i=null!=i?i:new e;const r=new s(i,a(this.value,t.value,n.value));return this.listen(()=>r.update(a(this.value,t.value,n.value)),i),t.listen(()=>r.update(a(this.value,t.value,n.value)),i),n.listen(()=>r.update(a(this.value,t.value,n.value)),i),r}aggregateFour(t,n,a,i,r){r=null!=r?r:new e;const o=new s(r,i(this.value,t.value,n.value,a.value));return this.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),t.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),n.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),a.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),o}combine(t,n){n=null!=n?n:new e;const a=new s(n);this.pipe(a,n);for(const e of t)e.pipe(a,n);return a}delay(t,n){n=null!=n?n:new e;const a=new s(n,this.value);return this.listen(e=>{setTimeout(()=>{a.update(e)},t)},n),a}skip(t,n){n=null!=n?n:new e;const a=new s(n,this.value);return this.listen(e=>{0===t?a.update(e):t--},n),a}cutoff(t,n){n=null!=n?n:new e;const a=new s(n,this.value);return this.listen(e=>{t-- >0&&a.update(e)},n),a}awaitNextUpdate(e){return new Promise(t=>{this.listenOnce(e=>t(e),e)})}debounce(t,n){n=null!=n?n:new e;const a=new s(n,this.value);let i;return this.listen(e=>{clearTimeout(i),i=setTimeout(()=>{a.update(e)},t)},n),a}throttle(t,n){n=null!=n?n:new e;const a=new s(n,this.value);let i=!1;return this.listen(e=>{i||(a.update(e),i=!0,setTimeout(()=>{i=!1},t))},n),a}buffer(t,n){n=null!=n?n:new e;const a=new s(n);let i,r=[];return this.listen(e=>{r.push(e),i||(i=setTimeout(()=>{i=void 0,a.update(r),r=[]},t))},n),a}accumulate(e){const t=new a;return this.listen(e=>{t.push(e)},e),t}pick(t,n){var a;n=null!=n?n:new e;const i=new s(n,null===(a=this.value)||void 0===a?void 0:a[t]);return this.listen(e=>{i.update(null!=e?e[t]:e)},n),i}cancelAll(){this.updateEvent.cancelAll()}}class s extends n{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 a{constructor(e){this.data=e?e.slice():[],this.lengthSource=new n(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 r(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 i(this,e,n);return t.forEach(e=>{e.listen(()=>s.refresh())},n),s}filter(e,t=[],n){const s=new o(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 i extends a{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 r extends a{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 o extends a{constructor(t,n,s=new e){Array.isArray(t)&&(t=new a(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))}}var l;!function(e){e[e.UPSTREAM=0]="UPSTREAM",e[e.DOWNSTREAM=1]="DOWNSTREAM"}(l||(l={}));class h{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 h(n,s);return a.updateDownstreamEvent=e.updateEvent,a.updateUpstreamEvent=t.updateEvent,a}withInitial(e){return this.primed||this.updateDownstream(e),this}static createOneWay(e=l.DOWNSTREAM,t){return new h(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 n(this.value);return this.listenDownstream(e=>{t.update(e)},e),t}aggregate(t,n,a){a=null!=a?a:new e;const i=new s(a,n(this.value,t.value));return this.listen(()=>i.update(n(this.value,t.value)),a),t.listen(()=>i.update(n(this.value,t.value)),a),i}aggregateThree(t,n,a,i){i=null!=i?i:new e;const r=new s(i,a(this.value,t.value,n.value));return this.listen(()=>r.update(a(this.value,t.value,n.value)),i),t.listen(()=>r.update(a(this.value,t.value,n.value)),i),n.listen(()=>r.update(a(this.value,t.value,n.value)),i),r}aggregateFour(t,n,a,i,r){r=null!=r?r:new e;const o=new s(r,i(this.value,t.value,n.value,a.value));return this.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),t.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),n.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),a.listen(()=>o.update(i(this.value,t.value,n.value,a.value)),r),o}filter(e,t,s){if("function"==typeof t){const n=new h(void 0,!1);return this.listenDownstream(t=>{e(t,n.value)&&n.updateDownstream(t)},s),n.listenUpstream(e=>{t(e,this.value)&&this.updateUpstream(e)},s),n}{const s=new n;return this.listenDownstream(t=>{e(t,s.value)&&s.update(t)},t),s}}pipe(e,t){return this.listenDownstream(t=>e.updateDownstream(t),t),e.listenUpstream(e=>this.updateUpstream(e),t),this}map(e,t,s){if("function"==typeof t){let n;return n=new h(this.primed?e(this.value):void 0,!1),this.listenDownstream(t=>n.updateDownstream(e(t)),s),n.listenUpstream(e=>this.updateUpstream(t(e)),s),n}{let s;return s=this.primed?new n(e(this.value)):new n,this.listenDownstream(t=>s.update(e(t)),t),s}}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 h(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 h(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 s(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 h(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 h(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=l.DOWNSTREAM,t){const n=new h(this.value,!1);return e===l.DOWNSTREAM?(this.listenDownstream(e=>n.updateDownstream(e),t),n.updateUpstream=()=>{}):(n.listenUpstream(e=>this.updateUpstream(e)),n.updateDownstream=()=>{}),n}reduce(e,t,s){const a=new n(t);return this.listen(t=>a.update(e(a.value,t)),s),a}cancelAll(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()}}function d(){const t={attachCalls:[],sessionToken:new e(()=>{for(const e of t.tokens)e.cancel()}),tokens:[]};return t}const c=Symbol("AurumElementModel"),u=new WeakMap;class p{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=p.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 p)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 v(e,t,s=!1){if(null!=e){if(m.has(e)){const n=m.get(e);n.sessionToken&&(t.attachCalls.push(...n.attachCalls),t.sessionToken.chain(n.sessionToken),n.attachCalls=void 0,n.sessionToken=void 0),m.delete(e)}if(Array.isArray(e))return Array.prototype.concat.apply([],e.map(e=>v(e,t,s)));if(!s){if(e instanceof Promise){const s=new n;return e.then(e=>{s.update(e)}),new b(s,f(t))}if(e instanceof n||e instanceof h)return new b(e,f(t));if(e instanceof a)return new g(e,f(t));const s=typeof e;if("string"===s||"number"===s||"bigint"===s||"boolean"===s)return document.createTextNode(e.toString())}return e[c]?v(e.factory(e.props||{},e.children,f(t)),t,s):e}}p.id=1;const m=new WeakMap;function f(t){let s=void 0;const a={renderSession:t,onAttach:e=>{t.attachCalls.push(e)},onDetach:n=>{s||(s=new e,t.tokens.push(s)),s.addCancelable(n)},onError:e=>{throw new Error("not implemented")},get cancellationToken(){return s||(s=new e,t.tokens.push(s)),s},prerender(e){const t=d(),n=v(e,t,!0);if(Array.isArray(n))for(const e of n)"object"==typeof e&&m.set(e,t);else m.set(n,t);return n},get style(){return function(e,...t){const s=new n;for(const i of t)(i instanceof n||i instanceof h)&&i.listen(()=>s.update(w(e,t)),a.cancellationToken);return s.update(w(e,t)),s}}};return a}function w(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 g extends p{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=d(),n=v(e,t);for(const e of t.attachCalls)e();return this.renderSessions.set(n,t),n}}class b extends p{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=d();let t=v(e,this.renderSession);if(void 0!==t){Array.isArray(t)||(t=[t]);for(const e of t)e instanceof p&&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)}}function y(e,t,s){if((t=[].concat.apply([],t.filter(e=>!!e))).some(e=>!e[c]||!(e.factory===E||e.factory===S)))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(e=>e.factory===S).length>1)throw new Error("Too many default routes only 0 or 1 allowed");const a=new n(k());return s.cancellationToken.registerDomEvent(window,"hashchange",()=>{a.update(k())}),a.unique(s.cancellationToken).withInitial(a.value).map(e=>function(e,t){var n,s;if(null==e)return null===(n=t.find(e=>e.factory===S))||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===S))||void 0===s?void 0:s.children}}(e,t))}function k(){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 S(e,t){}function A(t,s,a){const i=new n(null==t?void 0:t.fallback),r=new e;return a.onDetach(()=>{r.cancel()}),Promise.all(a.prerender(s,r)).then(e=>{r.isCanceled||i.update(e)},e=>(r.cancel(),Promise.reject(e))),i}function x(t,n,s){if((n=[].concat.apply([],n.filter(e=>!!e))).some(e=>!e[c]||!(e.factory===D||e.factory===C)))throw new Error("Switch only accepts SwitchCase as children");if(n.filter(e=>e.factory===C).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===C))||void 0===a?void 0:a.children}(e,n))}function D(e,t){}function C(e,t){}class N{constructor(e){e&&(this.data=e),this.updateEvent=new t,this.updateEventOnKey=new Map}pick(e,t){var s;const a=new n(null===(s=this.data)||void 0===s?void 0:s[e]);return this.listenOnKey(e,e=>{a.update(e.newValue)},t),a}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 N)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 n(this.data);return this.listen(t=>{e.update(this.data)}),e}}class T{constructor(e,t){this.input=e,this.output=t}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 T(this.input,this.output.filter(e,t))}unique(e){return new T(this.input,this.output.unique(e))}map(e,t){return new T(this.input,this.output.map(e,t))}reduce(e,t,n){return new T(this.input,this.output.reduce(e,t,n))}awaitNextUpdate(e){return this.output.awaitNextUpdate(e)}await(e){return new T(this.input,this.output.await(e))}awaitLatest(e){return new T(this.input,this.output.awaitLatest(e))}awaitOrdered(e){return new T(this.input,this.output.awaitOrdered(e))}}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"},I=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function R(e,t,s,a){return function(i,r,o){const l=document.createElement(e);i&&function(e,t,s,a,i){U(e,O,t),i&&U(e,i,t);const r=Object.keys(t).filter(e=>e.includes("-"));M(e,I,t,r),a&&M(e,a,t),t.class&&function(e,t,s){if("string"==typeof t)e.className=t;else if(t instanceof n||t instanceof h)t.value&&(Array.isArray(t.value)?(e.className=t.value.join(" "),t.unique(s).listen(()=>{e.className=t.value.join(" ")})):(e.className=t.value,t.unique(s).listen(()=>{e.className=t.value}))),t.unique(s).listen(t=>e.className=t);else{const a=t.reduce((e,t)=>"string"==typeof t?`${e} ${t}`:t.value?`${e} ${t.value}`:e,"");e.className=a;for(const a of t)a instanceof n&&a.unique(s).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,s)}(l,i,o.cancellationToken,t,s);const d=v(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 p)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,d),i.onAttach&&o.onAttach(()=>i.onAttach(l)),i.onDetach&&o.onDetach(()=>{l.isConnected&&l.parentElement.removeChild(l),i.onDetach(l)}),null==a||a(l,i,o.cancellationToken),l}}function U(e,t,s){for(const a in t)s[t[a]]&&(s[t[a]]instanceof n?e.addEventListener(a,e=>s[t[a]].update(e)):s[t[a]]instanceof h?e.addEventListener(a,e=>s[t[a]].updateDownstream(e)):"function"==typeof s[t[a]]&&e.addEventListener(a,e=>s[t[a]](e)))}function M(e,t,n,s){for(const s of t)n[s]&&L(e,n[s],s);if(s)for(const t of s)n[t]&&L(e,n[t],t)}function L(e,t,s){if("string"==typeof t)e.setAttribute(s,t);else if("boolean"==typeof t)t&&e.setAttribute(s,"");else{if(!(t instanceof n||t instanceof h))throw new Error("Attributes only support types boolean, string, number and data sources");"string"==typeof t.value?e.setAttribute(s,t.value):"boolean"==typeof t.value&&t.value&&e.setAttribute(s,""),t.unique().listen(t=>{"string"==typeof t?e.setAttribute(s,t):"boolean"==typeof t&&(t?e.setAttribute(s,""):e.removeAttribute(s))})}}const F=R("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,s)=>{const a=e;t.value&&(t.value instanceof n?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("input",()=>{t.value.update(a.value)})):t.value instanceof h?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("input",()=>{t.value.updateUpstream(a.value)})):a.value=t.value),t.checked&&(t.checked instanceof n?(t.checked.listenAndRepeat(e=>{a.checked=e},s),a.addEventListener("change",()=>{t.checked.update(a.checked)})):t.checked instanceof h?(t.checked.listenAndRepeat(e=>{a.checked=e},s),a.addEventListener("change",()=>{t.checked.updateUpstream(a.checked)})):a.checked=t.checked)}),q=R("select",void 0,{change:"onChange"},(e,t,s)=>{const a=e;t.value&&(t.value instanceof n?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("change",()=>{t.value.update(a.value)})):t.value instanceof h?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("change",()=>{t.value.updateUpstream(a.value)})):a.value=t.value),t.selectedIndex&&(t.selectedIndex instanceof n?(t.selectedIndex.listenAndRepeat(e=>{a.selectedIndex=e},s),a.addEventListener("change",()=>{t.selectedIndex.update(a.selectedIndex)})):t.selectedIndex instanceof h?(t.selectedIndex.listenAndRepeat(e=>{a.selectedIndex=e},s),a.addEventListener("change",()=>{t.selectedIndex.updateUpstream(a.selectedIndex)})):a.selectedIndex=t.selectedIndex)}),W=R("code"),K=R("div"),P=R("a",["href","target"]),V=R("abbr"),j=R("h1"),$=R("h2"),B=R("h3"),H=R("h4"),_=R("h5"),z=R("h6"),G=R("area",["alt","coors"]),J=R("article"),Q=R("aside"),X=R("span"),Y=R("noscript"),Z=R("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),ee=R("ul"),te=R("ol"),ne=R("li"),se=R("tr"),ae=R("b"),ie=R("title"),re=R("summary"),oe=R("thead"),le=R("template"),he=R("q"),de=R("pre"),ce=R("p"),ue=R("hr"),pe=R("audio",["controls","autoplay","loop","muted","preload","src"]),ve=R("br"),me=R("button",["disabled"]),fe=R("canvas",["width","height"]),we=R("data",["value"]),ge=R("details"),be=R("em"),ye=R("footer"),ke=R("form"),Ee=R("head"),Se=R("header"),Ae=R("heading"),xe=R("i"),De=R("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),Ce=R("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),Ne=R("label",["for"]),Te=R("link",["href","rel","media","as","disabled","type"]),Oe=R("nav"),Ie=R("sub"),Re=R("sup"),Ue=R("table"),Me=R("tbody"),Le=R("tfoot"),Fe=R("td"),qe=R("th"),We=R("time",["datetime"]),Ke=R("style",["media"]),Pe=R("source",["src","srcSet","media","sizes","type"]),Ve=R("script",["src","async","defer","integrity","noModule","type"]),je=R("svg",["width","height"]),$e=R("progress",["max","value"]),Be=R("option",["value"]),He=R("slot",["name"]),_e={button:me,code:W,hr:ue,div:K,input:F,li:ne,span:X,style:Ke,ul:ee,p:ce,img:Ce,link:Te,canvas:fe,a:P,article:J,br:ve,form:ke,label:Ne,ol:te,pre:de,progress:$e,table:Ue,td:Fe,tr:se,th:qe,textarea:R("textArea",["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],{input:"onInput",change:"onChange"},(e,t,s)=>{const a=e;t.value&&(t.value instanceof n?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("input",()=>{t.value.update(a.value)})):t.value instanceof h?(t.value.listenAndRepeat(e=>{a.value=e},s),a.addEventListener("input",()=>{t.value.updateUpstream(a.value)})):a.value=t.value)}),h1:j,h2:$,h3:B,h4:H,h5:_,h6:z,head:Ee,header:Se,footer:ye,nav:Oe,b:ae,i:xe,script:Ve,abbr:V,area:G,aside:Q,audio:pe,em:be,heading:Ae,iframe:De,noscript:Y,option:Be,q:he,select:q,source:Pe,title:ie,video:Z,tbody:Me,tfoot:Le,thead:oe,summary:re,details:ge,sub:Ie,sup:Re,svg:je,data:we,time:We,template:le,slot:He};class ze{static attach(e,t){const n=d(),s=v(e,n);if(s instanceof p)s.attachToDom(t,t.childNodes.length),n.sessionToken.addCancelable(()=>s.dispose());else if(Array.isArray(s)){const e=new g(new a(s),f(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){if("string"==typeof e){const t=e;if(void 0===(e=_e[e]))throw new Error(`Node ${t} does not exist or is not supported`)}return{[c]:!0,factory:e,props:t,children:n}}}function Ge(e,t){const s=[];for(const a in e)if(e[a])if(e[a]instanceof n||e[a]instanceof h){const i=e[a],r=new n(i.value?a:"");i.listen(e=>{r.update(e?a:"")},t),s.push(r)}else s.push(a);return s}function Je(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 n}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=d(),this.api=f(this.session);const a=t(this.props,this.api);for(const e of this.session.attachCalls)e();ze.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()}}),R(e.name,e.observedAttributes,void 0,(e,t)=>{for(const n in t)n in e.props||(e.props[n]=t[n])})}export{g as ArrayAurumElement,a as ArrayDataSource,ze as Aurum,p as AurumElement,y as AurumRouter,e as CancellationToken,l as DataFlow,n as DataSource,S as DefaultRoute,C as DefaultSwitchCase,h as DuplexDataSource,o as FilteredArrayView,i as MappedArrayView,N as ObjectDataSource,E as Route,b as SingularAurumElement,r as SortedArrayView,T as Stream,A as Suspense,x as Switch,D as SwitchCase,s as TransientDataSource,Je as Webcomponent,Ge as aurumClassName,c as aurumElementModelIdentitiy,f as createAPI,d as createRenderSession,u as nodeData,m as pendingSessions,v 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=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}(),d=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 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)}}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}();function v(e){return e instanceof p&&1&e.s}var m,w=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=c(t);!(i=r()).done;)i.value.pipe(a,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 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.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 g(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.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 g(t,e(this.value)):new g(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 g(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 g(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(v(a)&&(a=a.v),!a)return r;if(a.then){i=0;break}var r=n();if(r&&r.then){if(!v(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())||v(a)&&!a.v)return void f(o,1,r);if(a.then)return void a.then(l).then(void 0,s);v(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 g(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 g(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 g(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 g(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 g(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 g(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 g(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 g(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 h;var n=new g(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 g(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 g(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 g(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 g(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 g(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 g(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}(),g=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}(w),b=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new w(this.data.length),this.updateEvent=new d}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 h;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 y(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 k(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}(),y=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 i(t,e),t.prototype.refresh=function(){this.merge(this.parent.data.map(this.mapper))},t}(b),S=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=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}(b),k=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=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}(b);(m=e.DataFlow||(e.DataFlow={}))[m.UPSTREAM=0]="UPSTREAM",m[m.DOWNSTREAM=1]="DOWNSTREAM";var E=function(){function t(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}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 w(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 h;var a=new g(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 h;var r=new g(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 h;var o=new g(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 w;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 w(e(this.value)):new w,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 h;var t=new g(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 h;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 w(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 A(){var e={attachCalls:[],sessionToken:new h(function(){for(var t,n=c(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var D=Symbol("AurumElementModel"),x=new WeakMap,C=function(){function e(t,n){var i=this;e.id++,this.children=[],this.api=n,this.api.onAttach(function(){if(void 0===i.hostNode)throw new Error("illegal state: Attach fired but not actually attached");i.render(t)})}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 w;return e.then(function(e){r.update(e)}),new M(r,O(t))}if(e instanceof w||e instanceof E)return new M(e,O(t));if(e instanceof b)return new I(e,O(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,O(t)),t,n):e}}C.id=1;var N=new WeakMap;function O(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=T(e,t,!0);if(Array.isArray(n))for(var i,a=c(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 w,r=c(i);!(t=r()).done;){var o=t.value;(o instanceof w||o instanceof E)&&o.listen(function(){return a.update(R(e,i))},n.cancellationToken)}return a.update(R(e,i)),a}}};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}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 b,y=c(e.items);!(b=y()).done;){var S=this.renderItem(b.value);if(Array.isArray(S))throw new Error("illegal state");this.children.unshift(S)}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=A(),i=T(e,n),a=c(n.attachCalls);!(t=a()).done;)(0,t.value)();return this.renderSessions.set(i,n),i},t}(C),M=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=A();var t=T(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);function U(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function F(e,t){}function L(e,t){}function P(e,t){}function j(e,t){}var W=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 w(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=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 w(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),q={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"},V=["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){_(e,q,t),a&&_(e,a,t);var r=Object.keys(t).filter(function(e){return e.includes("-")});B(e,V,t,r),i&&B(e,i,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof w||t instanceof E)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 w&&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=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 _(e,t,n){var i=function(i){n[t[i]]&&(n[t[i]]instanceof w?e.addEventListener(i,function(e){return n[t[i]].update(e)}):n[t[i]]instanceof E?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 B(e,t,n,i){for(var a,r=c(t);!(a=r()).done;){var o=a.value;n[o]&&H(e,n[o],o)}if(i)for(var s,u=c(i);!(s=u()).done;){var l=s.value;n[l]&&H(e,n[l],l)}}function H(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof w||t instanceof E))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 z=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 w?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof E?(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 w?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.update(i.checked)})):t.checked instanceof E?(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 w?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.update(i.value)})):t.value instanceof E?(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 w?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.update(i.selectedIndex)})):t.selectedIndex instanceof E?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.updateUpstream(i.selectedIndex)})):i.selectedIndex=t.selectedIndex)}),G=K("code"),J=K("div"),Q=K("a",["href","target"]),X=K("abbr"),Y=K("h1"),Z=K("h2"),ee=K("h3"),te=K("h4"),ne=K("h5"),ie=K("h6"),ae=K("area",["alt","coors"]),re=K("article"),oe=K("aside"),se=K("span"),ue=K("noscript"),le=K("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),ce=K("ul"),he=K("ol"),de=K("li"),fe=K("tr"),pe=K("b"),ve=K("title"),me=K("summary"),we=K("thead"),ge=K("template"),be=K("q"),ye=K("pre"),Se=K("p"),ke=K("hr"),Ee=K("audio",["controls","autoplay","loop","muted","preload","src"]),Ae=K("br"),De=K("button",["disabled"]),xe=K("canvas",["width","height"]),Ce=K("data",["value"]),Te=K("details"),Ne=K("em"),Oe=K("footer"),Re=K("form"),Ie=K("head"),Me=K("header"),Ue=K("heading"),Fe=K("i"),Le=K("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),Pe=K("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),je=K("label",["for"]),We=K("link",["href","rel","media","as","disabled","type"]),qe=K("nav"),Ve=K("sub"),Ke=K("sup"),_e=K("table"),Be=K("tbody"),He=K("tfoot"),ze=K("td"),$e=K("th"),Ge=K("time",["datetime"]),Je=K("style",["media"]),Qe=K("source",["src","srcSet","media","sizes","type"]),Xe=K("script",["src","async","defer","integrity","noModule","type"]),Ye=K("svg",["width","height"]),Ze=K("progress",["max","value"]),et=K("option",["value"]),tt=K("slot",["name"]),nt={button:De,code:G,hr:ke,div:J,input:z,li:de,span:se,style:Je,ul:ce,p:Se,img:Pe,link:We,canvas:xe,a:Q,article:re,br:Ae,form:Re,label:je,ol:he,pre:ye,progress:Ze,table:_e,td:ze,tr:fe,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 w?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof E?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.updateUpstream(i.value)})):i.value=t.value)}),h1:Y,h2:Z,h3:ee,h4:te,h5:ne,h6:ie,head:Ie,header:Me,footer:Oe,nav:qe,b:pe,i:Fe,script:Xe,abbr:X,area:ae,aside:oe,audio:Ee,em:Ne,heading:Ue,iframe:Le,noscript:ue,option:et,q:be,select:$,source:Qe,title:ve,video:le,tbody:Be,tfoot:He,thead:we,summary:me,details:Te,sub:Ve,sup:Ke,svg:Ye,data:Ce,time:Ge,template:ge,slot:tt},it=function(){function e(){}return e.attach=function(e,t){var n=A(),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),O(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;if("string"==typeof e){var i=e;if(void 0===(e=nt[e]))throw new Error("Node "+i+" does not exist or is not supported")}return(n={})[D]=!0,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();e.ArrayAurumElement=I,e.ArrayDataSource=b,e.Aurum=it,e.AurumElement=C,e.AurumRouter=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[D]||!(e.factory===F||e.factory===L)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===L}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var i=new w(U());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){i.update(U())}),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===L}))||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===L}))||void 0===i?void 0:i.children}(e,t)})},e.CancellationToken=h,e.DataSource=w,e.DefaultRoute=L,e.DefaultSwitchCase=j,e.DuplexDataSource=E,e.FilteredArrayView=k,e.MappedArrayView=y,e.ObjectDataSource=W,e.Route=F,e.SingularAurumElement=M,e.SortedArrayView=S,e.Suspense=function(e,t,n){var i=new w(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},e.Switch=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[D]||!(e.factory===P||e.factory===j)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===j}).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===j}))||void 0===a?void 0:a.children}(e,t)})},e.SwitchCase=P,e.TransientDataSource=g,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 w;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=A(),this.api=O(this.session);for(var a,r=t(this.props,this.api),o=c(this.session.attachCalls);!(a=o()).done;)(0,a.value)();it.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 w||e[i]instanceof E){var a=e[i],r=new w(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=D,e.createAPI=O,e.createRenderSession=A,e.nodeData=x,e.pendingSessions=N,e.render=T}); | ||
!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=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}(),d=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 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)}}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}();function v(e){return e instanceof p&&1&e.s}var m,w=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=c(t);!(i=r()).done;)i.value.pipe(a,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 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.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 g(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.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 g(t,e(this.value)):new g(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 g(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 g(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(v(a)&&(a=a.v),!a)return r;if(a.then){i=0;break}var r=n();if(r&&r.then){if(!v(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())||v(a)&&!a.v)return void f(o,1,r);if(a.then)return void a.then(l).then(void 0,s);v(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 g(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 g(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 g(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 g(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 g(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 g(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 g(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 g(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 h;var n=new g(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 g(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 g(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 g(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 g(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 g(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 g(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}(),g=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}(w),b=function(){function e(e){this.data=e?e.slice():[],this.lengthSource=new w(this.data.length),this.updateEvent=new d}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 h;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 y(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 k(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}(),y=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 i(t,e),t.prototype.refresh=function(){this.merge(this.parent.data.map(this.mapper))},t}(b),S=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=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}(b),k=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=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}(b);(m=e.DataFlow||(e.DataFlow={}))[m.UPSTREAM=0]="UPSTREAM",m[m.DOWNSTREAM=1]="DOWNSTREAM";var E=function(){function t(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}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 w(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 h;var a=new g(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 h;var r=new g(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 h;var o=new g(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 w;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 w(e(this.value)):new w,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 h;var t=new g(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 h;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 w(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 A(){var e={attachCalls:[],sessionToken:new h(function(){for(var t,n=c(e.tokens);!(t=n()).done;)t.value.cancel()}),tokens:[]};return e}var D=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 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 w;return e.then(function(e){r.update(e)}),new M(r,O(t))}if(e instanceof w||e instanceof E)return new M(e,O(t));if(e instanceof b)return new I(e,O(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,O(t)),t,n):e}}C.id=1;var N=new WeakMap;function O(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=T(e,t,!0);if(Array.isArray(n))for(var i,a=c(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 w,r=c(i);!(t=r()).done;){var o=t.value;(o instanceof w||o instanceof E)&&o.listen(function(){return a.update(R(e,i))},n.cancellationToken)}return a.update(R(e,i)),a}}};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}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 b,y=c(e.items);!(b=y()).done;){var S=this.renderItem(b.value);if(Array.isArray(S))throw new Error("illegal state");this.children.unshift(S)}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=A(),i=T(e,n),a=c(n.attachCalls);!(t=a()).done;)(0,t.value)();return this.renderSessions.set(i,n),i},t}(C),M=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=A();var t=T(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);function U(){var e=location.hash.substring(1);return e.includes("?")?e.substring(0,e.indexOf("?")):e.includes("#")?e.substring(0,e.indexOf("#")):e}function L(e,t){}function F(e,t){}function P(e,t){}function j(e,t){}var q=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 w(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=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 w(this.data);return this.listen(function(n){t.update(e.data)}),t},e}(),W=function(){function e(e,t){this.input=e,this.output=t}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))},n(e,[{key:"value",get:function(){return this.output.value}}]),e}(),V={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"},K=["id","name","draggable","tabindex","style","role","contentEditable","slot","title"];function _(e,t,n,i){return function(a,r,o){var s=document.createElement(e);a&&function(e,t,n,i,a){B(e,V,t),a&&B(e,a,t);var r=Object.keys(t).filter(function(e){return e.includes("-")});H(e,K,t,r),i&&H(e,i,t),t.class&&function(e,t,n){if("string"==typeof t)e.className=t;else if(t instanceof w||t instanceof E)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 w&&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=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 B(e,t,n){var i=function(i){n[t[i]]&&(n[t[i]]instanceof w?e.addEventListener(i,function(e){return n[t[i]].update(e)}):n[t[i]]instanceof E?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 H(e,t,n,i){for(var a,r=c(t);!(a=r()).done;){var o=a.value;n[o]&&z(e,n[o],o)}if(i)for(var s,u=c(i);!(s=u()).done;){var l=s.value;n[l]&&z(e,n[l],l)}}function z(e,t,n){if("string"==typeof t)e.setAttribute(n,t);else if("boolean"==typeof t)t&&e.setAttribute(n,"");else{if(!(t instanceof w||t instanceof E))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 $=_("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 w?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof E?(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 w?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.update(i.checked)})):t.checked instanceof E?(t.checked.listenAndRepeat(function(e){i.checked=e},n),i.addEventListener("change",function(){t.checked.updateUpstream(i.checked)})):i.checked=t.checked)}),G=_("select",void 0,{change:"onChange"},function(e,t,n){var i=e;t.value&&(t.value instanceof w?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("change",function(){t.value.update(i.value)})):t.value instanceof E?(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 w?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.update(i.selectedIndex)})):t.selectedIndex instanceof E?(t.selectedIndex.listenAndRepeat(function(e){i.selectedIndex=e},n),i.addEventListener("change",function(){t.selectedIndex.updateUpstream(i.selectedIndex)})):i.selectedIndex=t.selectedIndex)}),J=_("code"),Q=_("div"),X=_("a",["href","target"]),Y=_("abbr"),Z=_("h1"),ee=_("h2"),te=_("h3"),ne=_("h4"),ie=_("h5"),ae=_("h6"),re=_("area",["alt","coors"]),oe=_("article"),se=_("aside"),ue=_("span"),le=_("noscript"),ce=_("video",["controls","autoplay","loop","muted","preload","src","poster","width","height"]),he=_("ul"),de=_("ol"),fe=_("li"),pe=_("tr"),ve=_("b"),me=_("title"),we=_("summary"),ge=_("thead"),be=_("template"),ye=_("q"),Se=_("pre"),ke=_("p"),Ee=_("hr"),Ae=_("audio",["controls","autoplay","loop","muted","preload","src"]),De=_("br"),xe=_("button",["disabled"]),Ce=_("canvas",["width","height"]),Te=_("data",["value"]),Ne=_("details"),Oe=_("em"),Re=_("footer"),Ie=_("form"),Me=_("head"),Ue=_("header"),Le=_("heading"),Fe=_("i"),Pe=_("iframe",["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"]),je=_("img",["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"]),qe=_("label",["for"]),We=_("link",["href","rel","media","as","disabled","type"]),Ve=_("nav"),Ke=_("sub"),_e=_("sup"),Be=_("table"),He=_("tbody"),ze=_("tfoot"),$e=_("td"),Ge=_("th"),Je=_("time",["datetime"]),Qe=_("style",["media"]),Xe=_("source",["src","srcSet","media","sizes","type"]),Ye=_("script",["src","async","defer","integrity","noModule","type"]),Ze=_("svg",["width","height"]),et=_("progress",["max","value"]),tt=_("option",["value"]),nt=_("slot",["name"]),it={button:xe,code:J,hr:Ee,div:Q,input:$,li:fe,span:ue,style:Qe,ul:he,p:ke,img:je,link:We,canvas:Ce,a:X,article:oe,br:De,form:Ie,label:qe,ol:de,pre:Se,progress:et,table:Be,td:$e,tr:pe,th:Ge,textarea:_("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 w?(t.value.listenAndRepeat(function(e){i.value=e},n),i.addEventListener("input",function(){t.value.update(i.value)})):t.value instanceof E?(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:ee,h3:te,h4:ne,h5:ie,h6:ae,head:Me,header:Ue,footer:Re,nav:Ve,b:ve,i:Fe,script:Ye,abbr:Y,area:re,aside:se,audio:Ae,em:Oe,heading:Le,iframe:Pe,noscript:le,option:tt,q:ye,select:G,source:Xe,title:me,video:ce,tbody:He,tfoot:ze,thead:ge,summary:we,details:Ne,sub:Ke,sup:_e,svg:Ze,data:Te,time:Je,template:be,slot:nt},at=function(){function e(){}return e.attach=function(e,t){var n=A(),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),O(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;if("string"==typeof e){var i=e;if(void 0===(e=it[e]))throw new Error("Node "+i+" does not exist or is not supported")}return(n={})[D]=!0,n.factory=e,n.props=t,n.children=[].slice.call(arguments,2),n},e}();e.ArrayAurumElement=I,e.ArrayDataSource=b,e.Aurum=at,e.AurumElement=C,e.AurumRouter=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[D]||!(e.factory===L||e.factory===F)}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(t.filter(function(e){return e.factory===F}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var i=new w(U());return n.cancellationToken.registerDomEvent(window,"hashchange",function(){i.update(U())}),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===F}))||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===F}))||void 0===i?void 0:i.children}(e,t)})},e.CancellationToken=h,e.DataSource=w,e.DefaultRoute=F,e.DefaultSwitchCase=j,e.DuplexDataSource=E,e.FilteredArrayView=k,e.MappedArrayView=y,e.ObjectDataSource=q,e.Route=L,e.SingularAurumElement=M,e.SortedArrayView=S,e.Stream=W,e.Suspense=function(e,t,n){var i=new w(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},e.Switch=function(e,t,n){if((t=[].concat.apply([],t.filter(function(e){return!!e}))).some(function(e){return!e[D]||!(e.factory===P||e.factory===j)}))throw new Error("Switch only accepts SwitchCase as children");if(t.filter(function(e){return e.factory===j}).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===j}))||void 0===a?void 0:a.children}(e,t)})},e.SwitchCase=P,e.TransientDataSource=g,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 w;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=A(),this.api=O(this.session);for(var a,r=t(this.props,this.api),o=c(this.session.attachCalls);!(a=o()).done;)(0,a.value)();at.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))),_(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 w||e[i]instanceof E){var a=e[i],r=new w(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=D,e.createAPI=O,e.createRenderSession=A,e.nodeData=x,e.pendingSessions=N,e.render=T}); | ||
//# sourceMappingURL=aurumjs.umd.js.map |
@@ -12,3 +12,3 @@ <p align="center"> | ||
## What is Aurum | ||
Aurumjs is a DOM rendering library inspired by react and angular. | ||
Aurum.js is a DOM rendering library inspired by react and angular. | ||
In Aurum you use stream based programing (Similar to rx.js) for data management. You link your streams directly to the DOM be it into attributes, inner text or inner html, you keep your UI up to date all through streams. | ||
@@ -22,4 +22,5 @@ Components in aurum never "rerender" react style, there is no reconciliation, no watching no dirty checking and no guesswork on what will and will cause things to render because all DOM changes are directly tied to a data stream. | ||
* Aurum.js has very few concepts and a small API, you can get a full understanding of Aurum.js in record time. | ||
* Aurum has very few concepts and a small API, you can get a full understanding of Aurum.js in record time. | ||
* Aurum is completely built around the stream pattern, pipe your data from the backend over adapters all the way into the DOM | ||
@@ -26,0 +27,0 @@ ## Browser support |
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 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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5235215
89033
89