apprun 3.28.7 → 3.28.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see apprun-html.js.LICENSE.txt */
2
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.apprun=e():t.apprun=e()}(this,(function(){return(()=>{"use strict";var t={664:(t,e,n)=>{n.d(e,{v:()=>i});var s=n(356);const i=new class{handleAttributeExpressions(t,e,n,i){const o=e[0];return"."===o?new s.m(t,e.slice(1),n).parts:"@"===o?[new s.K1(t,e.slice(1),i.eventContext)]:"?"===o?[new s.JG(t,e.slice(1),n)]:new s.QG(t,e,n).parts}handleTextExpression(t){return new s.nt(t)}}},695:(t,e,n)=>{n.d(e,{X:()=>i,w:()=>o});const s=new WeakMap,i=t=>(...e)=>{const n=t(...e);return s.set(n,!0),n},o=t=>"function"==typeof t&&s.has(t)},921:(t,e,n)=>{n.d(e,{eC:()=>s,V:()=>i,r4:()=>o});const s="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,i=(t,e,n=null,s=null)=>{for(;e!==n;){const n=e.nextSibling;t.insertBefore(e,s),e=n}},o=(t,e,n=null)=>{for(;e!==n;){const n=e.nextSibling;t.removeChild(e),e=n}}},301:(t,e,n)=>{n.d(e,{J:()=>s,L:()=>i});const s={},i={}},356:(t,e,n)=>{n.d(e,{pt:()=>c,QG:()=>u,nt:()=>p,JG:()=>m,m:()=>f,K1:()=>y});var s=n(695),i=n(921),o=n(301),r=n(122),a=n(823),l=n(560);const c=t=>null===t||!("object"==typeof t||"function"==typeof t),h=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class u{constructor(t,e,n){this.dirty=!0,this.element=t,this.name=e,this.strings=n,this.parts=[];for(let t=0;t<n.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new d(this)}_getValue(){const t=this.strings,e=t.length-1,n=this.parts;if(1===e&&""===t[0]&&""===t[1]){const t=n[0].value;if("symbol"==typeof t)return String(t);if("string"==typeof t||!h(t))return t}let s="";for(let i=0;i<e;i++){s+=t[i];const e=n[i];if(void 0!==e){const t=e.value;if(c(t)||!h(t))s+="string"==typeof t?t:String(t);else for(const e of t)s+="string"==typeof e?e:String(e)}}return s+=t[e],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class d{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===o.J||c(t)&&t===this.value||(this.value=t,(0,s.w)(t)||(this.committer.dirty=!0))}commit(){for(;(0,s.w)(this.value);){const t=this.value;this.value=o.J,t(this)}this.value!==o.J&&this.committer.commit()}}class p{constructor(t){this.value=void 0,this.__pendingValue=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild((0,l.IW)()),this.endNode=t.appendChild((0,l.IW)())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.__insert(this.startNode=(0,l.IW)()),t.__insert(this.endNode=(0,l.IW)())}insertAfterPart(t){t.__insert(this.startNode=(0,l.IW)()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.__pendingValue=t}commit(){if(null===this.startNode.parentNode)return;for(;(0,s.w)(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=o.J,t(this)}const t=this.__pendingValue;t!==o.J&&(c(t)?t!==this.value&&this.__commitText(t):t instanceof a.j?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):h(t)?this.__commitIterable(t):t===o.L?(this.value=o.L,this.clear()):this.__commitText(t))}__insert(t){this.endNode.parentNode.insertBefore(t,this.endNode)}__commitNode(t){this.value!==t&&(this.clear(),this.__insert(t),this.value=t)}__commitText(t){const e=this.startNode.nextSibling,n="string"==typeof(t=null==t?"":t)?t:String(t);e===this.endNode.previousSibling&&3===e.nodeType?e.data=n:this.__commitNode(document.createTextNode(n)),this.value=t}__commitTemplateResult(t){const e=this.options.templateFactory(t);if(this.value instanceof r.R&&this.value.template===e)this.value.update(t.values);else{const n=new r.R(e,t.processor,this.options),s=n._clone();n.update(t.values),this.__commitNode(s),this.value=n}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let n,s=0;for(const i of t)n=e[s],void 0===n&&(n=new p(this.options),e.push(n),0===s?n.appendIntoPart(this):n.insertAfterPart(e[s-1])),n.setValue(i),n.commit(),s++;s<e.length&&(e.length=s,this.clear(n&&n.endNode))}clear(t=this.startNode){(0,i.r4)(this.startNode.parentNode,t.nextSibling,this.endNode)}}class m{constructor(t,e,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=e,this.strings=n}setValue(t){this.__pendingValue=t}commit(){for(;(0,s.w)(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=o.J,t(this)}if(this.__pendingValue===o.J)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=o.J}}class f extends u{constructor(t,e,n){super(t,e,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new g(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class g extends d{}let _=!1;(()=>{try{const t={get capture(){return _=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class y{constructor(t,e,n){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=n,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;(0,s.w)(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=o.J,t(this)}if(this.__pendingValue===o.J)return;const t=this.__pendingValue,e=this.value,n=null==t||null!=e&&(t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive),i=null!=t&&(null==e||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=v(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=o.J}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const v=t=>t&&(_?{capture:t.capture,passive:t.passive,once:t.once}:t.capture)},787:(t,e,n)=>{n.d(e,{L:()=>r,s:()=>a});var s=n(921),i=n(356),o=n(432);const r=new WeakMap,a=(t,e,n)=>{let a=r.get(e);void 0===a&&((0,s.r4)(e,e.firstChild),r.set(e,a=new i.nt(Object.assign({templateFactory:o.t},n))),a.appendInto(e)),a.setValue(t),a.commit()}},432:(t,e,n)=>{n.d(e,{t:()=>i});var s=n(560);function i(t){let e=o.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},o.set(t.type,e));let n=e.stringsArray.get(t.strings);if(void 0!==n)return n;const i=t.strings.join(s.Jw);return n=e.keyString.get(i),void 0===n&&(n=new s.YS(t,t.getTemplateElement()),e.keyString.set(i,n)),e.stringsArray.set(t.strings,n),n}const o=new Map},122:(t,e,n)=>{n.d(e,{R:()=>o});var s=n(921),i=n(560);class o{constructor(t,e,n){this.__parts=[],this.template=t,this.processor=e,this.options=n}update(t){let e=0;for(const n of this.__parts)void 0!==n&&n.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const t=s.eC?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),e=[],n=this.template.parts,o=document.createTreeWalker(t,133,null,!1);let r,a=0,l=0,c=o.nextNode();for(;a<n.length;)if(r=n[a],(0,i.pC)(r)){for(;l<r.index;)l++,"TEMPLATE"===c.nodeName&&(e.push(c),o.currentNode=c.content),null===(c=o.nextNode())&&(o.currentNode=e.pop(),c=o.nextNode());if("node"===r.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(c.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(c,r.name,r.strings,this.options));a++}else this.__parts.push(void 0),a++;return s.eC&&(document.adoptNode(t),customElements.upgrade(t)),t}}},823:(t,e,n)=>{n.d(e,{j:()=>a,C:()=>l});var s=n(921),i=n(560);const o=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),r=` ${i.Jw} `;class a{constructor(t,e,n,s){this.strings=t,this.values=e,this.type=n,this.processor=s}getHTML(){const t=this.strings.length-1;let e="",n=!1;for(let s=0;s<t;s++){const t=this.strings[s],o=t.lastIndexOf("\x3c!--");n=(o>-1||n)&&-1===t.indexOf("--\x3e",o+1);const a=i.W5.exec(t);e+=null===a?t+(n?r:i.N):t.substr(0,a.index)+a[1]+a[2]+i.$E+a[3]+i.Jw}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");let e=this.getHTML();return void 0!==o&&(e=o.createHTML(e)),t.innerHTML=e,t}}class l extends a{getHTML(){return`<svg>${super.getHTML()}</svg>`}getTemplateElement(){const t=super.getTemplateElement(),e=t.content,n=e.firstChild;return e.removeChild(n),(0,s.V)(e,n.firstChild),t}}},560:(t,e,n)=>{n.d(e,{Jw:()=>s,N:()=>i,$E:()=>r,YS:()=>a,pC:()=>c,IW:()=>h,W5:()=>u});const s=`{{lit-${String(Math.random()).slice(2)}}}`,i=`\x3c!--${s}--\x3e`,o=new RegExp(`${s}|${i}`),r="$lit$";class a{constructor(t,e){this.parts=[],this.element=e;const n=[],i=[],a=document.createTreeWalker(e.content,133,null,!1);let c=0,d=-1,p=0;const{strings:m,values:{length:f}}=t;for(;p<f;){const t=a.nextNode();if(null!==t){if(d++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:n}=e;let s=0;for(let t=0;t<n;t++)l(e[t].name,r)&&s++;for(;s-- >0;){const e=m[p],n=u.exec(e)[2],s=n.toLowerCase()+r,i=t.getAttribute(s);t.removeAttribute(s);const a=i.split(o);this.parts.push({type:"attribute",index:d,name:n,strings:a}),p+=a.length-1}}"TEMPLATE"===t.tagName&&(i.push(t),a.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(s)>=0){const s=t.parentNode,i=e.split(o),a=i.length-1;for(let e=0;e<a;e++){let n,o=i[e];if(""===o)n=h();else{const t=u.exec(o);null!==t&&l(t[2],r)&&(o=o.slice(0,t.index)+t[1]+t[2].slice(0,-r.length)+t[3]),n=document.createTextNode(o)}s.insertBefore(n,t),this.parts.push({type:"node",index:++d})}""===i[a]?(s.insertBefore(h(),t),n.push(t)):t.data=i[a],p+=a}}else if(8===t.nodeType)if(t.data===s){const e=t.parentNode;null!==t.previousSibling&&d!==c||(d++,e.insertBefore(h(),t)),c=d,this.parts.push({type:"node",index:d}),null===t.nextSibling?t.data="":(n.push(t),d--),p++}else{let e=-1;for(;-1!==(e=t.data.indexOf(s,e+1));)this.parts.push({type:"node",index:-1}),p++}}else a.currentNode=i.pop()}for(const t of n)t.parentNode.removeChild(t)}}const l=(t,e)=>{const n=t.length-e.length;return n>=0&&t.slice(n)===e},c=t=>-1!==t.index,h=()=>document.createComment(""),u=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/},816:(t,e,n)=>{n.d(e,{XM:()=>o.X,K1:()=>r.K1,nt:()=>r.nt,Le:()=>a.L,sY:()=>a.s,js:()=>i.j,dy:()=>l,YP:()=>c});var s=n(664),i=n(823),o=n(695),r=(n(921),n(301),n(356)),a=n(787);n(432),n(122),n(560),"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const l=(t,...e)=>new i.j(t,e,"html",s.v),c=(t,...e)=>new i.C(t,e,"svg",s.v)},107:(t,e,n)=>{n.d(e,{Component:()=>b,ROUTER_404_EVENT:()=>x,ROUTER_EVENT:()=>w,app:()=>r,customElement:()=>p,default:()=>A,event:()=>u,on:()=>d,update:()=>u});class s{constructor(){this._events={}}on(t,e,n={}){this._events[t]=this._events[t]||[],this._events[t].push({fn:e,options:n})}off(t,e){const n=this._events[t]||[];this._events[t]=n.filter((t=>t.fn!==e))}find(t){return this._events[t]}run(t,...e){const n=this.getSubscribers(t,this._events);return console.assert(n&&n.length>0,"No subscriber for event: "+t),n.forEach((n=>{const{fn:s,options:i}=n;return i.delay?this.delay(t,s,e,i):Object.keys(i).length>0?s.apply(this,[...e,i]):s.apply(this,e),!n.options.once})),n.length}once(t,e,n={}){this.on(t,e,Object.assign(Object.assign({},n),{once:!0}))}delay(t,e,n,s){s._t&&clearTimeout(s._t),s._t=setTimeout((()=>{clearTimeout(s._t),Object.keys(s).length>0?e.apply(this,[...n,s]):e.apply(this,n)}),s.delay)}query(t,...e){const n=this.getSubscribers(t,this._events);console.assert(n&&n.length>0,"No subscriber for event: "+t);const s=n.map((t=>{const{fn:n,options:s}=t;return Object.keys(s).length>0?n.apply(this,[...e,s]):n.apply(this,e)}));return Promise.all(s)}getSubscribers(t,e){const n=e[t]||[];return e[t]=n.filter((t=>!t.options.once)),Object.keys(e).filter((e=>e.endsWith("*")&&t.startsWith(e.replace("*","")))).sort(((t,e)=>e.length-t.length)).forEach((s=>n.push(...e[s].map((e=>Object.assign(Object.assign({},e),{options:Object.assign(Object.assign({},e.options),{event:t})})))))),n}}let i;const o="object"==typeof self&&self.self===self&&self||"object"==typeof n.g&&n.g.global===n.g&&n.g;o.app&&o._AppRunVersions?i=o.app:(i=new s,o.app=i,o._AppRunVersions="AppRun-3");const r=i;var a=n(559);const l=(t,e={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(e.observedAttributes||[]).map((t=>t.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const n=e||{};this._shadowRoot=n.shadow?this.attachShadow({mode:"open"}):this;const s=n.observedAttributes||[],i=s.reduce(((t,e)=>{const n=e.toLowerCase();return n!==e&&(t[n]=e),t}),{});this._attrMap=t=>i[t]||t;const o={};Array.from(this.attributes).forEach((t=>o[this._attrMap(t.name)]=t.value)),s.forEach((t=>{void 0!==this[t]&&(o[t]=this[t]),Object.defineProperty(this,t,{get:()=>o[t],set(e){this.attributeChangedCallback(t,o[t],e)},configurable:!0,enumerable:!0})}));const r=this.children?Array.from(this.children):[];if(r.forEach((t=>t.parentElement.removeChild(t))),this._component=new t(Object.assign(Object.assign({},o),{children:r})).mount(this._shadowRoot,n),this._component._props=o,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const t=this._component.mounted(o,r,this._component.state);void 0!==t&&(this._component.state=t)}this.on=this._component.on.bind(this._component),this.run=this._component.run.bind(this._component),!1!==n.render&&this._component.run(".")}}disconnectedCallback(){var t,e,n,s;null===(e=null===(t=this._component)||void 0===t?void 0:t.unload)||void 0===e||e.call(t),null===(s=null===(n=this._component)||void 0===n?void 0:n.unmount)||void 0===s||s.call(n),this._component=null}attributeChangedCallback(t,n,s){if(this._component){const i=this._attrMap(t);this._component._props[i]=s,this._component.run("attributeChanged",i,n,s),s!==n&&!1!==e.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}},c=(t,e,n)=>{"undefined"!=typeof customElements&&customElements.define(t,l(e,n))},h={meta:new WeakMap,defineMetadata(t,e,n){this.meta.has(n)||this.meta.set(n,{}),this.meta.get(n)[t]=e},getMetadataKeys(t){return t=Object.getPrototypeOf(t),this.meta.get(t)?Object.keys(this.meta.get(t)):[]},getMetadata(t,e){return e=Object.getPrototypeOf(e),this.meta.get(e)?this.meta.get(e)[t]:null}};function u(t,e={}){return(n,s,i)=>{const o=t?t.toString():s;return h.defineMetadata(`apprun-update:${o}`,{name:o,key:s,options:e},n),i}}function d(t,e={}){return function(n,s){const i=t?t.toString():s;h.defineMetadata(`apprun-update:${i}`,{name:i,key:s,options:e},n)}}function p(t,e){return function(n){return c(t,n,e),n}}const m=(t,e)=>(e?t.state[e]:t.state)||"",f=(t,e,n)=>{if(e){const s=t.state||{};s[e]=n,t.setState(s)}else t.setState(n)},g=(t,e)=>{if(Array.isArray(t))return t.map((t=>g(t,e)));{let{tag:n,props:s,children:i}=t;return n?(s&&Object.keys(s).forEach((t=>{t.startsWith("$")&&(((t,e,n,s)=>{if(t.startsWith("$on")){const n=e[t];if(t=t.substring(1),"boolean"==typeof n)e[t]=e=>s.run(t,e);else if("string"==typeof n)e[t]=t=>s.run(n,t);else if("function"==typeof n)e[t]=t=>s.setState(n(s.state,t));else if(Array.isArray(n)){const[i,...o]=n;"string"==typeof i?e[t]=t=>s.run(i,...o,t):"function"==typeof i&&(e[t]=t=>s.setState(i(s.state,...o,t)))}}else if("$bind"===t){const i=e.type||"text",o="string"==typeof e[t]?e[t]:e.name;if("input"===n)switch(i){case"checkbox":e.checked=m(s,o),e.onclick=t=>f(s,o||t.target.name,t.target.checked);break;case"radio":e.checked=m(s,o)===e.value,e.onclick=t=>f(s,o||t.target.name,t.target.value);break;case"number":case"range":e.value=m(s,o),e.oninput=t=>f(s,o||t.target.name,Number(t.target.value));break;default:e.value=m(s,o),e.oninput=t=>f(s,o||t.target.name,t.target.value)}else"select"===n?(e.value=m(s,o),e.onchange=t=>{t.target.multiple||f(s,o||t.target.name,t.target.value)}):"option"===n?(e.selected=m(s,o),e.onclick=t=>f(s,o||t.target.name,t.target.selected)):"textarea"===n&&(e.innerHTML=m(s,o),e.oninput=t=>f(s,o||t.target.name,t.target.value))}else r.run("$",{key:t,tag:n,props:e,component:s})})(t,s,n,e),delete s[t])})),i&&(i=g(i,e)),{tag:n,props:s,children:i}):t}},_=g,y=new Map;r.on("get-components",(t=>t.components=y));const v=t=>t;class b{constructor(t,e,n,i){this.state=t,this.view=e,this.update=n,this.options=i,this._app=new s,this._actions=[],this._global_events=[],this._history=[],this._history_idx=-1,this._history_prev=()=>{this._history_idx--,this._history_idx>=0?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=0},this._history_next=()=>{this._history_idx++,this._history_idx<this._history.length?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=this._history.length-1},this.start=(t=null,e)=>this.mount(t,Object.assign(Object.assign({},e),{render:!0}))}renderState(t,e=null){if(!this.view)return;let n=e||this.view(t);if(r.debug&&r.run("debug",{component:this,_:n?".":"-",state:t,vdom:n,el:this.element}),"object"!=typeof document)return;const s="string"==typeof this.element?document.getElementById(this.element):this.element;if(s){const t="_c";this.unload?s._component===this&&s.getAttribute(t)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),s.setAttribute(t,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((t=>{t[0].oldValue!==this.tracking_id&&document.body.contains(s)||(this.unload(this.state),this.observer.disconnect(),this.observer=null)}))),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:[t]}))):s.removeAttribute&&s.removeAttribute(t),s._component=this}!e&&n&&(n=_(n,this),r.render(s,n,this)),this.rendered&&this.rendered(this.state)}setState(t,e={render:!0,history:!1}){if(t instanceof Promise)Promise.all([t,this._state]).then((t=>{t[0]&&this.setState(t[0])})).catch((t=>{throw console.error(t),t})),this._state=t;else{if(this._state=t,null==t)return;this.state=t,!1!==e.render&&this.renderState(t),!1!==e.history&&this.enable_history&&(this._history=[...this._history,t],this._history_idx=this._history.length-1),"function"==typeof e.callback&&e.callback(this.state)}}mount(t=null,e){var n,s;return console.assert(!this.element,"Component already mounted."),this.options=e=Object.assign(Object.assign({},this.options),e),this.element=t,this.global_event=e.global_event,this.enable_history=!!e.history,this.enable_history&&(this.on(e.history.prev||"history-prev",this._history_prev),this.on(e.history.next||"history-next",this._history_next)),e.route&&(this.update=this.update||{},this.update[e.route]=v),this.add_actions(),this.state=null!==(s=null!==(n=this.state)&&void 0!==n?n:this.model)&&void 0!==s?s:{},"function"==typeof this.state&&(this.state=this.state()),e.render?this.setState(this.state,{render:!0,history:!0}):this.setState(this.state,{render:!1,history:!0}),r.debug&&(y.get(t)?y.get(t).push(this):y.set(t,[this])),this}is_global_event(t){return t&&(this.global_event||this._global_events.indexOf(t)>=0||t.startsWith("#")||t.startsWith("/")||t.startsWith("@"))}add_action(t,e,n={}){e&&"function"==typeof e&&(n.global&&this._global_events.push(t),this.on(t,((...s)=>{r.debug&&r.run("debug",{component:this,_:">",event:t,p:s,current_state:this.state,options:n});const i=e(this.state,...s);r.debug&&r.run("debug",{component:this,_:"<",event:t,p:s,newState:i,state:this.state,options:n}),this.setState(i,n)}),n))}add_actions(){const t=this.update||{};h.getMetadataKeys(this).forEach((e=>{if(e.startsWith("apprun-update:")){const n=h.getMetadata(e,this);t[n.name]=[this[n.key].bind(this),n.options]}}));const e={};Array.isArray(t)?t.forEach((t=>{const[n,s,i]=t;n.toString().split(",").forEach((t=>e[t.trim()]=[s,i]))})):Object.keys(t).forEach((n=>{const s=t[n];("function"==typeof s||Array.isArray(s))&&n.split(",").forEach((t=>e[t.trim()]=s))})),e["."]||(e["."]=v),Object.keys(e).forEach((t=>{const n=e[t];"function"==typeof n?this.add_action(t,n):Array.isArray(n)&&this.add_action(t,n[0],n[1])}))}run(t,...e){const n=t.toString();return this.is_global_event(n)?r.run(n,...e):this._app.run(n,...e)}on(t,e,n){const s=t.toString();return this._actions.push({name:s,fn:e}),this.is_global_event(s)?r.on(s,e,n):this._app.on(s,e,n)}unmount(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this._actions.forEach((t=>{const{name:e,fn:n}=t;this.is_global_event(e)?r.off(e,n):this._app.off(e,n)}))}}b.__isAppRunComponent=!0;const w="//",x="///",E=t=>{if(t||(t="#"),t.startsWith("#")){const[e,...n]=t.split("/");r.run(e,...n)||r.run(x,e,...n),r.run(w,e,...n)}else if(t.startsWith("/")){const[e,n,...s]=t.split("/");r.run("/"+n,...s)||r.run(x,"/"+n,...s),r.run(w,"/"+n,...s)}else r.run(t)||r.run(x,t),r.run(w,t)};r.h=r.createElement=a.az,r.render=function(t,e,n){(0,a.yj)(t,e,n)},r.Fragment=a.HY,r.webComponent=c,r.start=(t,e,n,s,i)=>{const o=Object.assign(Object.assign({},i),{render:!0,global_event:!0}),r=new b(e,n,s);return i&&i.rendered&&(r.rendered=i.rendered),r.mount(t,o),r};const N=t=>{};r.on("$",N),r.on("debug",(t=>N)),r.on(w,N),r.on("#",N),r.route=E,r.on("route",(t=>r.route&&r.route(t))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{r.route===E&&(window.onpopstate=()=>E(location.hash),document.body.hasAttribute("apprun-no-init")||E(location.hash))}));const A=r;"object"==typeof window&&(window.Component=b,window.React=r,window.on=d,window.customElement=p)},559:(t,e,n)=>{function s(t,...e){return i(e)}function i(t){const e=[],n=t=>{null!=t&&""!==t&&!1!==t&&e.push("function"==typeof t||"object"==typeof t?t:`${t}`)};return t&&t.forEach((t=>{Array.isArray(t)?t.forEach((t=>n(t))):n(t)})),e}function o(t,e,...n){const s=i(n);if("string"==typeof t)return{tag:t,props:e,children:s};if(Array.isArray(t))return t;if(void 0===t&&n)return s;if(Object.getPrototypeOf(t).__isAppRunComponent)return{tag:t,props:e,children:s};if("function"==typeof t)return t(e,s);throw new Error(`Unknown tag in vdom ${t}`)}n.d(e,{HY:()=>s,az:()=>o,yj:()=>a});const r=new WeakMap,a=function(t,e,n={}){if(null==e||!1===e)return;e=p(e,n);const s="SVG"===(null==t?void 0:t.nodeName);t&&(Array.isArray(e)?c(t,e,s):c(t,[e],s))};function l(t,e,n){3!==e._op&&(n=n||"svg"===e.tag,function(t,e){const n=t.nodeName,s=`${e.tag||""}`;return n.toUpperCase()===s.toUpperCase()}(t,e)?(!(2&e._op)&&c(t,e.children,n),!(1&e._op)&&d(t,e.props,n)):t.parentNode.replaceChild(u(e,n),t))}function c(t,e,n){var s;const i=(null===(s=t.childNodes)||void 0===s?void 0:s.length)||0,o=(null==e?void 0:e.length)||0,a=Math.min(i,o);for(let s=0;s<a;s++){const i=e[s];if(3===i._op)continue;const o=t.childNodes[s];if("string"==typeof i)o.textContent!==i&&(3===o.nodeType?o.nodeValue=i:t.replaceChild(h(i),o));else if(i instanceof HTMLElement||i instanceof SVGElement)t.insertBefore(i,o);else{const e=i.props&&i.props.key;if(e)if(o.key===e)l(t.childNodes[s],i,n);else{const a=r[e];if(a){const e=a.nextSibling;t.insertBefore(a,o),e?t.insertBefore(o,e):t.appendChild(o),l(t.childNodes[s],i,n)}else t.replaceChild(u(i,n),o)}else l(t.childNodes[s],i,n)}}let c=t.childNodes.length;for(;c>a;)t.removeChild(t.lastChild),c--;if(o>a){const s=document.createDocumentFragment();for(let t=a;t<e.length;t++)s.appendChild(u(e[t],n));t.appendChild(s)}}function h(t){if(0===(null==t?void 0:t.indexOf("_html:"))){const e=document.createElement("div");return e.insertAdjacentHTML("afterbegin",t.substring(6)),e}return document.createTextNode(null!=t?t:"")}function u(t,e){if(t instanceof HTMLElement||t instanceof SVGElement)return t;if("string"==typeof t)return h(t);if(!t.tag||"function"==typeof t.tag)return h(JSON.stringify(t));const n=(e=e||"svg"===t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);return d(n,t.props,e),t.children&&t.children.forEach((t=>n.appendChild(u(t,e)))),n}function d(t,e,n){const s=t._props||{};e=function(t,e){e.class=e.class||e.className,delete e.className;const n={};return t&&Object.keys(t).forEach((t=>n[t]=null)),e&&Object.keys(e).forEach((t=>n[t]=e[t])),n}(s,e||{}),t._props=e;for(const s in e){const i=e[s];if(s.startsWith("data-")){const e=s.substring(5).replace(/-(\w)/g,(t=>t[1].toUpperCase()));t.dataset[e]!==i&&(i||""===i?t.dataset[e]=i:delete t.dataset[e])}else if("style"===s)if(t.style.cssText&&(t.style.cssText=""),"string"==typeof i)t.style.cssText=i;else for(const e in i)t.style[e]!==i[e]&&(t.style[e]=i[e]);else if(s.startsWith("xlink")){const e=s.replace("xlink","").toLowerCase();null==i||!1===i?t.removeAttributeNS("http://www.w3.org/1999/xlink",e):t.setAttributeNS("http://www.w3.org/1999/xlink",e,i)}else s.startsWith("on")?i&&"function"!=typeof i?"string"==typeof i&&(i?t.setAttribute(s,i):t.removeAttribute(s)):t[s]=i:/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-/g.test(s)||n?t.getAttribute(s)!==i&&(i?t.setAttribute(s,i):t.removeAttribute(s)):t[s]!==i&&(t[s]=i);"key"===s&&i&&(r[i]=t)}e&&"function"==typeof e.ref&&window.requestAnimationFrame((()=>e.ref(t)))}function p(t,e,n=0){var s;if("string"==typeof t)return t;if(Array.isArray(t))return t.map((t=>p(t,e,n++)));let i=t;if(t&&"function"==typeof t.tag&&Object.getPrototypeOf(t.tag).__isAppRunComponent&&(i=function(t,e,n){const{tag:s,props:i,children:o}=t;let r=`_${n}`,a=i&&i.id;a?r=a:a=`_${n}${Date.now()}`;let l="section";i&&i.as&&(l=i.as,delete i.as),e.__componentCache||(e.__componentCache={});let c=e.__componentCache[r];if(!(c&&c instanceof s&&c.element)){const t=document.createElement(l);c=e.__componentCache[r]=new s(Object.assign(Object.assign({},i),{children:o})).start(t)}if(c.mounted){const t=c.mounted(i,o,c.state);void 0!==t&&c.setState(t)}return d(c.element,i,!1),c.element}(t,e,n)),i&&Array.isArray(i.children)){const t=null===(s=i.props)||void 0===s?void 0:s._component;if(t){let e=0;i.children=i.children.map((n=>p(n,t,e++)))}else i.children=i.children.map((t=>p(t,e,n++)))}return i}}},e={};function n(s){var i=e[s];if(void 0!==i)return i.exports;var o=e[s]={exports:{}};return t[s](o,o.exports,n),o.exports}n.d=(t,e)=>{for(var s in e)n.o(e,s)&&!n.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return(()=>{n.r(s),n.d(s,{Component:()=>t.Component,ROUTER_404_EVENT:()=>t.ROUTER_404_EVENT,ROUTER_EVENT:()=>t.ROUTER_EVENT,app:()=>t.app,customElement:()=>t.customElement,default:()=>h,event:()=>t.event,html:()=>i.dy,on:()=>t.on,render:()=>l,run:()=>c,svg:()=>i.YP,update:()=>t.update});var t=n(107),e=n(559),i=n(816),o=n(356);const r=new WeakMap,a=(0,i.XM)((t=>e=>{if(!(e instanceof i.nt))throw new Error("unsafeHTML can only be used in text bindings");const n=r.get(e);if(void 0!==n&&(0,o.pt)(t)&&t===n.value&&e.value===n.fragment)return;const s=document.createElement("template");s.innerHTML=t;const a=document.importNode(s.content,!0);e.setValue(a),r.set(e,{value:t,fragment:a})}));function l(t,n,s){"string"==typeof n?(0,i.sY)(i.dy`${a(n)}`,t):n instanceof i.js?(0,i.sY)(n,t):((0,e.yj)(t,n,s),i.Le.delete(t))}const c=(0,i.XM)(((t,...e)=>n=>{if(!(n instanceof i.K1))throw new Error("${run} can only be used in event handlers");let{element:s,eventName:o}=n;const r=()=>{let t=s._component;for(;!t&&s;)s=s.parentElement,t=s&&s._component;return console.assert(!!t,"Component not found."),t};"string"==typeof t?s[`on${o}`]=n=>r().run(t,...e,n):"function"==typeof t&&(s[`on${o}`]=n=>r().setState(t(r().state,...e,n)))}));t.default.createElement=e.az,t.default.render=l,t.default.Fragment=e.HY;const h=t.default;"object"==typeof window&&(window.html=i.dy,window.svg=i.YP,window.run=c)})(),s})()}));
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.apprun=e():t.apprun=e()}(this,(function(){return(()=>{"use strict";var t={107:(t,e,n)=>{n.d(e,{Component:()=>b,ROUTER_404_EVENT:()=>$,ROUTER_EVENT:()=>A,app:()=>r,customElement:()=>p,default:()=>x,event:()=>u,on:()=>d,update:()=>u});class s{constructor(){this._events={}}on(t,e,n={}){this._events[t]=this._events[t]||[],this._events[t].push({fn:e,options:n})}off(t,e){const n=this._events[t]||[];this._events[t]=n.filter((t=>t.fn!==e))}find(t){return this._events[t]}run(t,...e){const n=this.getSubscribers(t,this._events);return console.assert(n&&n.length>0,"No subscriber for event: "+t),n.forEach((n=>{const{fn:s,options:i}=n;return i.delay?this.delay(t,s,e,i):Object.keys(i).length>0?s.apply(this,[...e,i]):s.apply(this,e),!n.options.once})),n.length}once(t,e,n={}){this.on(t,e,Object.assign(Object.assign({},n),{once:!0}))}delay(t,e,n,s){s._t&&clearTimeout(s._t),s._t=setTimeout((()=>{clearTimeout(s._t),Object.keys(s).length>0?e.apply(this,[...n,s]):e.apply(this,n)}),s.delay)}query(t,...e){const n=this.getSubscribers(t,this._events);console.assert(n&&n.length>0,"No subscriber for event: "+t);const s=n.map((t=>{const{fn:n,options:s}=t;return Object.keys(s).length>0?n.apply(this,[...e,s]):n.apply(this,e)}));return Promise.all(s)}getSubscribers(t,e){const n=e[t]||[];return e[t]=n.filter((t=>!t.options.once)),Object.keys(e).filter((e=>e.endsWith("*")&&t.startsWith(e.replace("*","")))).sort(((t,e)=>e.length-t.length)).forEach((s=>n.push(...e[s].map((e=>Object.assign(Object.assign({},e),{options:Object.assign(Object.assign({},e.options),{event:t})})))))),n}}let i;const o="object"==typeof self&&self.self===self&&self||"object"==typeof n.g&&n.g.global===n.g&&n.g;o.app&&o._AppRunVersions?i=o.app:(i=new s,o.app=i,o._AppRunVersions="AppRun-3");const r=i;var a=n(559);const l=(t,e={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(e.observedAttributes||[]).map((t=>t.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const n=e||{};this._shadowRoot=n.shadow?this.attachShadow({mode:"open"}):this;const s=n.observedAttributes||[],i=s.reduce(((t,e)=>{const n=e.toLowerCase();return n!==e&&(t[n]=e),t}),{});this._attrMap=t=>i[t]||t;const o={};Array.from(this.attributes).forEach((t=>o[this._attrMap(t.name)]=t.value)),s.forEach((t=>{void 0!==this[t]&&(o[t]=this[t]),Object.defineProperty(this,t,{get:()=>o[t],set(e){this.attributeChangedCallback(t,o[t],e)},configurable:!0,enumerable:!0})}));const r=this.children?Array.from(this.children):[];if(r.forEach((t=>t.parentElement.removeChild(t))),this._component=new t(Object.assign(Object.assign({},o),{children:r})).mount(this._shadowRoot,n),this._component._props=o,this._component.dispatchEvent=this.dispatchEvent.bind(this),this._component.mounted){const t=this._component.mounted(o,r,this._component.state);void 0!==t&&(this._component.state=t)}this.on=this._component.on.bind(this._component),this.run=this._component.run.bind(this._component),!1!==n.render&&this._component.run(".")}}disconnectedCallback(){var t,e,n,s;null===(e=null===(t=this._component)||void 0===t?void 0:t.unload)||void 0===e||e.call(t),null===(s=null===(n=this._component)||void 0===n?void 0:n.unmount)||void 0===s||s.call(n),this._component=null}attributeChangedCallback(t,n,s){if(this._component){const i=this._attrMap(t);this._component._props[i]=s,this._component.run("attributeChanged",i,n,s),s!==n&&!1!==e.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}},h=(t,e,n)=>{"undefined"!=typeof customElements&&customElements.define(t,l(e,n))},c={meta:new WeakMap,defineMetadata(t,e,n){this.meta.has(n)||this.meta.set(n,{}),this.meta.get(n)[t]=e},getMetadataKeys(t){return t=Object.getPrototypeOf(t),this.meta.get(t)?Object.keys(this.meta.get(t)):[]},getMetadata(t,e){return e=Object.getPrototypeOf(e),this.meta.get(e)?this.meta.get(e)[t]:null}};function u(t,e={}){return(n,s,i)=>{const o=t?t.toString():s;return c.defineMetadata(`apprun-update:${o}`,{name:o,key:s,options:e},n),i}}function d(t,e={}){return function(n,s){const i=t?t.toString():s;c.defineMetadata(`apprun-update:${i}`,{name:i,key:s,options:e},n)}}function p(t,e){return function(n){return h(t,n,e),n}}const f=(t,e)=>(e?t.state[e]:t.state)||"",_=(t,e,n)=>{if(e){const s=t.state||{};s[e]=n,t.setState(s)}else t.setState(n)},m=(t,e)=>{if(Array.isArray(t))return t.map((t=>m(t,e)));{let{tag:n,props:s,children:i}=t;return n?(s&&Object.keys(s).forEach((t=>{t.startsWith("$")&&(((t,e,n,s)=>{if(t.startsWith("$on")){const n=e[t];if(t=t.substring(1),"boolean"==typeof n)e[t]=e=>s.run(t,e);else if("string"==typeof n)e[t]=t=>s.run(n,t);else if("function"==typeof n)e[t]=t=>s.setState(n(s.state,t));else if(Array.isArray(n)){const[i,...o]=n;"string"==typeof i?e[t]=t=>s.run(i,...o,t):"function"==typeof i&&(e[t]=t=>s.setState(i(s.state,...o,t)))}}else if("$bind"===t){const i=e.type||"text",o="string"==typeof e[t]?e[t]:e.name;if("input"===n)switch(i){case"checkbox":e.checked=f(s,o),e.onclick=t=>_(s,o||t.target.name,t.target.checked);break;case"radio":e.checked=f(s,o)===e.value,e.onclick=t=>_(s,o||t.target.name,t.target.value);break;case"number":case"range":e.value=f(s,o),e.oninput=t=>_(s,o||t.target.name,Number(t.target.value));break;default:e.value=f(s,o),e.oninput=t=>_(s,o||t.target.name,t.target.value)}else"select"===n?(e.value=f(s,o),e.onchange=t=>{t.target.multiple||_(s,o||t.target.name,t.target.value)}):"option"===n?(e.selected=f(s,o),e.onclick=t=>_(s,o||t.target.name,t.target.selected)):"textarea"===n&&(e.innerHTML=f(s,o),e.oninput=t=>_(s,o||t.target.name,t.target.value))}else r.run("$",{key:t,tag:n,props:e,component:s})})(t,s,n,e),delete s[t])})),i&&(i=m(i,e)),{tag:n,props:s,children:i}):t}},g=m,v=new Map;r.on("get-components",(t=>t.components=v));const y=t=>t;class b{constructor(t,e,n,i){this.state=t,this.view=e,this.update=n,this.options=i,this._app=new s,this._actions=[],this._global_events=[],this._history=[],this._history_idx=-1,this._history_prev=()=>{this._history_idx--,this._history_idx>=0?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=0},this._history_next=()=>{this._history_idx++,this._history_idx<this._history.length?this.setState(this._history[this._history_idx],{render:!0,history:!1}):this._history_idx=this._history.length-1},this.start=(t=null,e)=>this.mount(t,Object.assign({render:!0},e))}renderState(t,e=null){if(!this.view)return;let n=e||this.view(t);if(r.debug&&r.run("debug",{component:this,_:n?".":"-",state:t,vdom:n,el:this.element}),"object"!=typeof document)return;const s="string"==typeof this.element?document.getElementById(this.element):this.element;if(s){const t="_c";this.unload?s._component===this&&s.getAttribute(t)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),s.setAttribute(t,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((t=>{t[0].oldValue!==this.tracking_id&&document.body.contains(s)||(this.unload(this.state),this.observer.disconnect(),this.observer=null)}))),this.observer.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,attributeFilter:[t]}))):s.removeAttribute&&s.removeAttribute(t),s._component=this}!e&&n&&(n=g(n,this),r.render(s,n,this)),this.rendered&&this.rendered(this.state)}setState(t,e={render:!0,history:!1}){if(t instanceof Promise)Promise.all([t,this._state]).then((t=>{t[0]&&this.setState(t[0])})).catch((t=>{throw console.error(t),t})),this._state=t;else{if(this._state=t,null==t)return;this.state=t,!1!==e.render&&this.renderState(t),!1!==e.history&&this.enable_history&&(this._history=[...this._history,t],this._history_idx=this._history.length-1),"function"==typeof e.callback&&e.callback(this.state)}}mount(t=null,e){var n,s;return console.assert(!this.element,"Component already mounted."),this.options=e=Object.assign(Object.assign({},this.options),e),this.element=t,this.global_event=e.global_event,this.enable_history=!!e.history,this.enable_history&&(this.on(e.history.prev||"history-prev",this._history_prev),this.on(e.history.next||"history-next",this._history_next)),e.route&&(this.update=this.update||{},this.update[e.route]=y),this.add_actions(),this.state=null!==(s=null!==(n=this.state)&&void 0!==n?n:this.model)&&void 0!==s?s:{},"function"==typeof this.state&&(this.state=this.state()),e.render?this.setState(this.state,{render:!0,history:!0}):this.setState(this.state,{render:!1,history:!0}),r.debug&&(v.get(t)?v.get(t).push(this):v.set(t,[this])),this}is_global_event(t){return t&&(this.global_event||this._global_events.indexOf(t)>=0||t.startsWith("#")||t.startsWith("/")||t.startsWith("@"))}add_action(t,e,n={}){e&&"function"==typeof e&&(n.global&&this._global_events.push(t),this.on(t,((...s)=>{r.debug&&r.run("debug",{component:this,_:">",event:t,p:s,current_state:this.state,options:n});const i=e(this.state,...s);r.debug&&r.run("debug",{component:this,_:"<",event:t,p:s,newState:i,state:this.state,options:n}),this.setState(i,n)}),n))}add_actions(){const t=this.update||{};c.getMetadataKeys(this).forEach((e=>{if(e.startsWith("apprun-update:")){const n=c.getMetadata(e,this);t[n.name]=[this[n.key].bind(this),n.options]}}));const e={};Array.isArray(t)?t.forEach((t=>{const[n,s,i]=t;n.toString().split(",").forEach((t=>e[t.trim()]=[s,i]))})):Object.keys(t).forEach((n=>{const s=t[n];("function"==typeof s||Array.isArray(s))&&n.split(",").forEach((t=>e[t.trim()]=s))})),e["."]||(e["."]=y),Object.keys(e).forEach((t=>{const n=e[t];"function"==typeof n?this.add_action(t,n):Array.isArray(n)&&this.add_action(t,n[0],n[1])}))}run(t,...e){const n=t.toString();return this.is_global_event(n)?r.run(n,...e):this._app.run(n,...e)}on(t,e,n){const s=t.toString();return this._actions.push({name:s,fn:e}),this.is_global_event(s)?r.on(s,e,n):this._app.on(s,e,n)}unmount(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this._actions.forEach((t=>{const{name:e,fn:n}=t;this.is_global_event(e)?r.off(e,n):this._app.off(e,n)}))}}b.__isAppRunComponent=!0;const A="//",$="///",w=t=>{if(t||(t="#"),t.startsWith("#")){const[e,...n]=t.split("/");r.run(e,...n)||r.run($,e,...n),r.run(A,e,...n)}else if(t.startsWith("/")){const[e,n,...s]=t.split("/");r.run("/"+n,...s)||r.run($,"/"+n,...s),r.run(A,"/"+n,...s)}else r.run(t)||r.run($,t),r.run(A,t)};r.h=r.createElement=a.az,r.render=function(t,e,n){(0,a.yj)(t,e,n)},r.Fragment=a.HY,r.webComponent=h,r.start=(t,e,n,s,i)=>{const o=Object.assign({render:!0,global_event:!0},i),r=new b(e,n,s);return i&&i.rendered&&(r.rendered=i.rendered),r.mount(t,o),r};const E=t=>{};r.on("$",E),r.on("debug",(t=>E)),r.on(A,E),r.on("#",E),r.route=w,r.on("route",(t=>r.route&&r.route(t))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{r.route===w&&(window.onpopstate=()=>w(location.hash),document.body.hasAttribute("apprun-no-init")||w(location.hash))}));const x=r;"object"==typeof window&&(window.Component=b,window.React=r,window.on=d,window.customElement=p)},559:(t,e,n)=>{function s(t,...e){return i(e)}function i(t){const e=[],n=t=>{null!=t&&""!==t&&!1!==t&&e.push("function"==typeof t||"object"==typeof t?t:`${t}`)};return t&&t.forEach((t=>{Array.isArray(t)?t.forEach((t=>n(t))):n(t)})),e}function o(t,e,...n){const s=i(n);if("string"==typeof t)return{tag:t,props:e,children:s};if(Array.isArray(t))return t;if(void 0===t&&n)return s;if(Object.getPrototypeOf(t).__isAppRunComponent)return{tag:t,props:e,children:s};if("function"==typeof t)return t(e,s);throw new Error(`Unknown tag in vdom ${t}`)}n.d(e,{HY:()=>s,az:()=>o,yj:()=>a});const r=new WeakMap,a=function(t,e,n={}){if(null==e||!1===e)return;e=p(e,n);const s="SVG"===(null==t?void 0:t.nodeName);t&&(Array.isArray(e)?h(t,e,s):h(t,[e],s))};function l(t,e,n){3!==e._op&&(n=n||"svg"===e.tag,function(t,e){const n=t.nodeName,s=`${e.tag||""}`;return n.toUpperCase()===s.toUpperCase()}(t,e)?(!(2&e._op)&&h(t,e.children,n),!(1&e._op)&&d(t,e.props,n)):t.parentNode.replaceChild(u(e,n),t))}function h(t,e,n){var s;const i=(null===(s=t.childNodes)||void 0===s?void 0:s.length)||0,o=(null==e?void 0:e.length)||0,a=Math.min(i,o);for(let s=0;s<a;s++){const i=e[s];if(3===i._op)continue;const o=t.childNodes[s];if("string"==typeof i)o.textContent!==i&&(3===o.nodeType?o.nodeValue=i:t.replaceChild(c(i),o));else if(i instanceof HTMLElement||i instanceof SVGElement)t.insertBefore(i,o);else{const e=i.props&&i.props.key;if(e)if(o.key===e)l(t.childNodes[s],i,n);else{const a=r[e];if(a){const e=a.nextSibling;t.insertBefore(a,o),e?t.insertBefore(o,e):t.appendChild(o),l(t.childNodes[s],i,n)}else t.replaceChild(u(i,n),o)}else l(t.childNodes[s],i,n)}}let h=t.childNodes.length;for(;h>a;)t.removeChild(t.lastChild),h--;if(o>a){const s=document.createDocumentFragment();for(let t=a;t<e.length;t++)s.appendChild(u(e[t],n));t.appendChild(s)}}function c(t){if(0===(null==t?void 0:t.indexOf("_html:"))){const e=document.createElement("div");return e.insertAdjacentHTML("afterbegin",t.substring(6)),e}return document.createTextNode(null!=t?t:"")}function u(t,e){if(t instanceof HTMLElement||t instanceof SVGElement)return t;if("string"==typeof t)return c(t);if(!t.tag||"function"==typeof t.tag)return c(JSON.stringify(t));const n=(e=e||"svg"===t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);return d(n,t.props,e),t.children&&t.children.forEach((t=>n.appendChild(u(t,e)))),n}function d(t,e,n){const s=t._props||{};e=function(t,e){e.class=e.class||e.className,delete e.className;const n={};return t&&Object.keys(t).forEach((t=>n[t]=null)),e&&Object.keys(e).forEach((t=>n[t]=e[t])),n}(s,e||{}),t._props=e;for(const s in e){const i=e[s];if(s.startsWith("data-")){const e=s.substring(5).replace(/-(\w)/g,(t=>t[1].toUpperCase()));t.dataset[e]!==i&&(i||""===i?t.dataset[e]=i:delete t.dataset[e])}else if("style"===s)if(t.style.cssText&&(t.style.cssText=""),"string"==typeof i)t.style.cssText=i;else for(const e in i)t.style[e]!==i[e]&&(t.style[e]=i[e]);else if(s.startsWith("xlink")){const e=s.replace("xlink","").toLowerCase();null==i||!1===i?t.removeAttributeNS("http://www.w3.org/1999/xlink",e):t.setAttributeNS("http://www.w3.org/1999/xlink",e,i)}else s.startsWith("on")?i&&"function"!=typeof i?"string"==typeof i&&(i?t.setAttribute(s,i):t.removeAttribute(s)):t[s]=i:/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-/g.test(s)||n?t.getAttribute(s)!==i&&(i?t.setAttribute(s,i):t.removeAttribute(s)):t[s]!==i&&(t[s]=i);"key"===s&&i&&(r[i]=t)}e&&"function"==typeof e.ref&&window.requestAnimationFrame((()=>e.ref(t)))}function p(t,e,n=0){var s;if("string"==typeof t)return t;if(Array.isArray(t))return t.map((t=>p(t,e,n++)));let i=t;if(t&&"function"==typeof t.tag&&Object.getPrototypeOf(t.tag).__isAppRunComponent&&(i=function(t,e,n){const{tag:s,props:i,children:o}=t;let r=`_${n}`,a=i&&i.id;a?r=a:a=`_${n}${Date.now()}`;let l="section";i&&i.as&&(l=i.as,delete i.as),e.__componentCache||(e.__componentCache={});let h=e.__componentCache[r];if(!(h&&h instanceof s&&h.element)){const t=document.createElement(l);h=e.__componentCache[r]=new s(Object.assign(Object.assign({},i),{children:o})).start(t)}if(h.mounted){const t=h.mounted(i,o,h.state);void 0!==t&&h.setState(t)}return d(h.element,i,!1),h.element}(t,e,n)),i&&Array.isArray(i.children)){const t=null===(s=i.props)||void 0===s?void 0:s._component;if(t){let e=0;i.children=i.children.map((n=>p(n,t,e++)))}else i.children=i.children.map((t=>p(t,e,n++)))}return i}},875:(t,e,n)=>{n.d(e,{Xe:()=>o,pX:()=>s,XM:()=>i});const s={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},i=t=>(...e)=>({_$litDirective$:t,values:e});class o{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}},692:(t,e,n)=>{var s;n.d(e,{dy:()=>A,Jb:()=>w,Ld:()=>E,sY:()=>T,YP:()=>$});const i=globalThis.trustedTypes,o=i?i.createPolicy("lit-html",{createHTML:t=>t}):void 0,r=`lit$${(Math.random()+"").slice(9)}$`,a="?"+r,l=`<${a}>`,h=document,c=(t="")=>h.createComment(t),u=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d=Array.isArray,p=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,f=/-->/g,_=/>/g,m=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,g=/'/g,v=/"/g,y=/^(?:script|style|textarea|title)$/i,b=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),A=b(1),$=b(2),w=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),x=new WeakMap,T=(t,e,n)=>{var s,i;const o=null!==(s=null==n?void 0:n.renderBefore)&&void 0!==s?s:e;let r=o._$litPart$;if(void 0===r){const t=null!==(i=null==n?void 0:n.renderBefore)&&void 0!==i?i:null;o._$litPart$=r=new j(e.insertBefore(c(),t),t,void 0,null!=n?n:{})}return r._$AI(t),r},C=h.createTreeWalker(h,129,null,!1),O=(t,e)=>{const n=t.length-1,s=[];let i,a=2===e?"<svg>":"",h=p;for(let e=0;e<n;e++){const n=t[e];let o,c,u=-1,d=0;for(;d<n.length&&(h.lastIndex=d,c=h.exec(n),null!==c);)d=h.lastIndex,h===p?"!--"===c[1]?h=f:void 0!==c[1]?h=_:void 0!==c[2]?(y.test(c[2])&&(i=RegExp("</"+c[2],"g")),h=m):void 0!==c[3]&&(h=m):h===m?">"===c[0]?(h=null!=i?i:p,u=-1):void 0===c[1]?u=-2:(u=h.lastIndex-c[2].length,o=c[1],h=void 0===c[3]?m:'"'===c[3]?v:g):h===v||h===g?h=m:h===f||h===_?h=p:(h=m,i=void 0);const b=h===m&&t[e+1].startsWith("/>")?" ":"";a+=h===p?n+l:u>=0?(s.push(o),n.slice(0,u)+"$lit$"+n.slice(u)+r+b):n+r+(-2===u?(s.push(void 0),e):b)}const c=a+(t[n]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==o?o.createHTML(c):c,s]};class S{constructor({strings:t,_$litType$:e},n){let s;this.parts=[];let o=0,l=0;const h=t.length-1,u=this.parts,[d,p]=O(t,e);if(this.el=S.createElement(d,n),C.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=C.nextNode())&&u.length<h;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(r)){const n=p[l++];if(t.push(e),void 0!==n){const t=s.getAttribute(n.toLowerCase()+"$lit$").split(r),e=/([.?@])?(.*)/.exec(n);u.push({type:1,index:o,name:e[2],strings:t,ctor:"."===e[1]?H:"?"===e[1]?P:"@"===e[1]?L:k})}else u.push({type:6,index:o})}for(const e of t)s.removeAttribute(e)}if(y.test(s.tagName)){const t=s.textContent.split(r),e=t.length-1;if(e>0){s.textContent=i?i.emptyScript:"";for(let n=0;n<e;n++)s.append(t[n],c()),C.nextNode(),u.push({type:2,index:++o});s.append(t[e],c())}}}else if(8===s.nodeType)if(s.data===a)u.push({type:2,index:o});else{let t=-1;for(;-1!==(t=s.data.indexOf(r,t+1));)u.push({type:7,index:o}),t+=r.length-1}o++}}static createElement(t,e){const n=h.createElement("template");return n.innerHTML=t,n}}function N(t,e,n=t,s){var i,o,r,a;if(e===w)return e;let l=void 0!==s?null===(i=n._$Cl)||void 0===i?void 0:i[s]:n._$Cu;const h=u(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==h&&(null===(o=null==l?void 0:l._$AO)||void 0===o||o.call(l,!1),void 0===h?l=void 0:(l=new h(t),l._$AT(t,n,s)),void 0!==s?(null!==(r=(a=n)._$Cl)&&void 0!==r?r:a._$Cl=[])[s]=l:n._$Cu=l),void 0!==l&&(e=N(t,l._$AS(t,e.values),l,s)),e}class M{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:n},parts:s}=this._$AD,i=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:h).importNode(n,!0);C.currentNode=i;let o=C.nextNode(),r=0,a=0,l=s[0];for(;void 0!==l;){if(r===l.index){let e;2===l.type?e=new j(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new U(o,this,t)),this.v.push(e),l=s[++a]}r!==(null==l?void 0:l.index)&&(o=C.nextNode(),r++)}return i}m(t){let e=0;for(const n of this.v)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class j{constructor(t,e,n,s){var i;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=s,this._$Cg=null===(i=null==s?void 0:s.isConnected)||void 0===i||i}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=N(this,t,e),u(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==w&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):(t=>{var e;return d(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.A(t):this.$(t)}M(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==E&&u(this._$AH)?this._$AA.nextSibling.data=t:this.S(h.createTextNode(t)),this._$AH=t}T(t){var e;const{values:n,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=S.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.m(n);else{const t=new M(i,this),e=t.p(this.options);t.m(n),this.S(e),this._$AH=t}}_$AC(t){let e=x.get(t.strings);return void 0===e&&x.set(t.strings,e=new S(t)),e}A(t){d(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,s=0;for(const i of t)s===e.length?e.push(n=new j(this.M(c()),this.M(c()),this,this.options)):n=e[s],n._$AI(i),s++;s<e.length&&(this._$AR(n&&n._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var n;for(null===(n=this._$AP)||void 0===n||n.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class k{constructor(t,e,n,s,i){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=i,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=E}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,n,s){const i=this.strings;let o=!1;if(void 0===i)t=N(this,t,e,0),o=!u(t)||t!==this._$AH&&t!==w,o&&(this._$AH=t);else{const s=t;let r,a;for(t=i[0],r=0;r<i.length-1;r++)a=N(this,s[n+r],e,r),a===w&&(a=this._$AH[r]),o||(o=!u(a)||a!==this._$AH[r]),a===E?t=E:t!==E&&(t+=(null!=a?a:"")+i[r+1]),this._$AH[r]=a}o&&!s&&this.k(t)}k(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class H extends k{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===E?void 0:t}}const R=i?i.emptyScript:"";class P extends k{constructor(){super(...arguments),this.type=4}k(t){t&&t!==E?this.element.setAttribute(this.name,R):this.element.removeAttribute(this.name)}}class L extends k{constructor(t,e,n,s,i){super(t,e,n,s,i),this.type=5}_$AI(t,e=this){var n;if((t=null!==(n=N(this,t,e,0))&&void 0!==n?n:E)===w)return;const s=this._$AH,i=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==E&&(s===E||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,n;"function"==typeof this._$AH?this._$AH.call(null!==(n=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==n?n:this.element,t):this._$AH.handleEvent(t)}}class U{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){N(this,t)}}const W=window.litHtmlPolyfillSupport;null==W||W(S,j),(null!==(s=globalThis.litHtmlVersions)&&void 0!==s?s:globalThis.litHtmlVersions=[]).push("2.1.3")}},e={};function n(s){var i=e[s];if(void 0!==i)return i.exports;var o=e[s]={exports:{}};return t[s](o,o.exports,n),o.exports}n.d=(t,e)=>{for(var s in e)n.o(e,s)&&!n.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return(()=>{n.r(s),n.d(s,{Component:()=>t.Component,ROUTER_404_EVENT:()=>t.ROUTER_404_EVENT,ROUTER_EVENT:()=>t.ROUTER_EVENT,app:()=>t.app,customElement:()=>t.customElement,default:()=>u,event:()=>t.event,html:()=>i.dy,on:()=>t.on,render:()=>l,run:()=>c,svg:()=>i.YP,update:()=>t.update});var t=n(107),e=n(559),i=n(692),o=n(875);class r extends o.Xe{constructor(t){if(super(t),this.it=i.Ld,t.type!==o.pX.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===i.Ld||null==t)return this.vt=void 0,this.it=t;if(t===i.Jb)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.vt;this.it=t;const e=[t];return e.raw=e,this.vt={_$litType$:this.constructor.resultType,strings:e,values:[]}}}r.directiveName="unsafeHTML",r.resultType=1;const a=(0,o.XM)(r);function l(t,n,s){n&&("string"==typeof n?(0,i.sY)(i.dy`${a(n)}`,t):"_$litType$"in n?(t._$litPart$||t.replaceChildren(),(0,i.sY)(n,t)):((0,e.yj)(t,n,s),t._$litPart$=void 0))}class h extends o.Xe{constructor(t){if(super(t),t.type!==o.pX.EVENT)throw new Error("${run} can only be used in event handlers")}update(t,e){let{element:n,name:s}=t;const i=()=>{let t=n._component;for(;!t&&n;)n=n.parentElement,t=n&&n._component;return console.assert(!!t,"Component not found."),t},[o,...r]=e;return"string"==typeof o?n[`on${s}`]=t=>i().run(o,...r,t):"function"==typeof o&&(n[`on${s}`]=t=>i().setState(o(i().state,...r,t))),this.render()}render(){return i.Jb}}const c=(0,o.XM)(h);t.default.createElement=e.az,t.default.render=l,t.default.Fragment=e.HY;const u=t.default;"object"==typeof window&&(window.html=i.dy,window.svg=i.YP,window.run=c)})(),s})()}));
3
3
  //# sourceMappingURL=apprun-html.js.map
@@ -1,27 +1,5 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4
- * This code may only be used under the BSD style license found at
5
- * http://polymer.github.io/LICENSE.txt
6
- * The complete set of authors may be found at
7
- * http://polymer.github.io/AUTHORS.txt
8
- * The complete set of contributors may be found at
9
- * http://polymer.github.io/CONTRIBUTORS.txt
10
- * Code distributed by Google as part of the polymer project is also
11
- * subject to an additional IP rights grant found at
12
- * http://polymer.github.io/PATENTS.txt
13
- */
14
-
15
- /**
16
- * @license
17
- * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
18
- * This code may only be used under the BSD style license found at
19
- * http://polymer.github.io/LICENSE.txt
20
- * The complete set of authors may be found at
21
- * http://polymer.github.io/AUTHORS.txt
22
- * The complete set of contributors may be found at
23
- * http://polymer.github.io/CONTRIBUTORS.txt
24
- * Code distributed by Google as part of the polymer project is also
25
- * subject to an additional IP rights grant found at
26
- * http://polymer.github.io/PATENTS.txt
3
+ * Copyright 2017 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
27
5
  */