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,121 +1,19 @@
1
- class t{constructor(){this._events={}}on(t,s,i={}){this._events[t]=this._events[t]||[],this._events[t].push({fn:s,options:i})}off(t,s){const i=this._events[t]||[];this._events[t]=i.filter((t=>t.fn!==s))}find(t){return this._events[t]}run(t,...s){const i=this.getSubscribers(t,this._events);return console.assert(i&&i.length>0,"No subscriber for event: "+t),i.forEach((i=>{const{fn:e,options:n}=i;return n.delay?this.delay(t,e,s,n):Object.keys(n).length>0?e.apply(this,[...s,n]):e.apply(this,s),!i.options.once})),i.length}once(t,s,i={}){this.on(t,s,Object.assign(Object.assign({},i),{once:!0}))}delay(t,s,i,e){e._t&&clearTimeout(e._t),e._t=setTimeout((()=>{clearTimeout(e._t),Object.keys(e).length>0?s.apply(this,[...i,e]):s.apply(this,i)}),e.delay)}query(t,...s){const i=this.getSubscribers(t,this._events);console.assert(i&&i.length>0,"No subscriber for event: "+t);const e=i.map((t=>{const{fn:i,options:e}=t;return Object.keys(e).length>0?i.apply(this,[...s,e]):i.apply(this,s)}));return Promise.all(e)}getSubscribers(t,s){const i=s[t]||[];return s[t]=i.filter((t=>!t.options.once)),Object.keys(s).filter((s=>s.endsWith("*")&&t.startsWith(s.replace("*","")))).sort(((t,s)=>s.length-t.length)).forEach((e=>i.push(...s[e].map((s=>Object.assign(Object.assign({},s),{options:Object.assign(Object.assign({},s.options),{event:t})})))))),i}}let s;const i="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;i.app&&i._AppRunVersions?s=i.app:(s=new t,i.app=s,i._AppRunVersions="AppRun-3");var e=s;function n(t,...s){return o(s)}function o(t){const s=[],i=t=>{null!=t&&""!==t&&!1!==t&&s.push("function"==typeof t||"object"==typeof t?t:`${t}`)};return t&&t.forEach((t=>{Array.isArray(t)?t.forEach((t=>i(t))):i(t)})),s}function r(t,s,...i){const e=o(i);if("string"==typeof t)return{tag:t,props:s,children:e};if(Array.isArray(t))return t;if(void 0===t&&i)return e;if(Object.getPrototypeOf(t).t)return{tag:t,props:s,children:e};if("function"==typeof t)return t(s,e);throw new Error(`Unknown tag in vdom ${t}`)}const h=new WeakMap,c=function(t,s,i={}){if(null==s||!1===s)return;s=p(s,i);const e="SVG"===(null==t?void 0:t.nodeName);if(!t)return;Array.isArray(s)?u(t,s,e):u(t,[s],e)};function l(t,s,i){3!==s._op&&(i=i||"svg"===s.tag,!function(t,s){const i=t.nodeName,e=`${s.tag||""}`;return i.toUpperCase()===e.toUpperCase()}(t,s)?t.parentNode.replaceChild(a(s,i),t):(!(2&s._op)&&u(t,s.children,i),!(1&s._op)&&d(t,s.props,i)))}function u(t,s,i){var e;const n=(null===(e=t.childNodes)||void 0===e?void 0:e.length)||0,o=(null==s?void 0:s.length)||0,r=Math.min(n,o);for(let e=0;e<r;e++){const n=s[e];if(3===n._op)continue;const o=t.childNodes[e];if("string"==typeof n)o.textContent!==n&&(3===o.nodeType?o.nodeValue=n:t.replaceChild(f(n),o));else if(n instanceof HTMLElement||n instanceof SVGElement)t.insertBefore(n,o);else{const s=n.props&&n.props.key;if(s)if(o.key===s)l(t.childNodes[e],n,i);else{const r=h[s];if(r){const s=r.nextSibling;t.insertBefore(r,o),s?t.insertBefore(o,s):t.appendChild(o),l(t.childNodes[e],n,i)}else t.replaceChild(a(n,i),o)}else l(t.childNodes[e],n,i)}}let c=t.childNodes.length;for(;c>r;)t.removeChild(t.lastChild),c--;if(o>r){const e=document.createDocumentFragment();for(let t=r;t<s.length;t++)e.appendChild(a(s[t],i));t.appendChild(e)}}function f(t){if(0===(null==t?void 0:t.indexOf("_html:"))){const s=document.createElement("div");return s.insertAdjacentHTML("afterbegin",t.substring(6)),s}return document.createTextNode(null!=t?t:"")}function a(t,s){if(t instanceof HTMLElement||t instanceof SVGElement)return t;if("string"==typeof t)return f(t);if(!t.tag||"function"==typeof t.tag)return f(JSON.stringify(t));const i=(s=s||"svg"===t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);return d(i,t.props,s),t.children&&t.children.forEach((t=>i.appendChild(a(t,s)))),i}function d(t,s,i){const e=t._props||{};s=function(t,s){s.class=s.class||s.className,delete s.className;const i={};return t&&Object.keys(t).forEach((t=>i[t]=null)),s&&Object.keys(s).forEach((t=>i[t]=s[t])),i}(e,s||{}),t._props=s;for(const e in s){const n=s[e];if(e.startsWith("data-")){const s=e.substring(5).replace(/-(\w)/g,(t=>t[1].toUpperCase()));t.dataset[s]!==n&&(n||""===n?t.dataset[s]=n:delete t.dataset[s])}else if("style"===e)if(t.style.cssText&&(t.style.cssText=""),"string"==typeof n)t.style.cssText=n;else for(const s in n)t.style[s]!==n[s]&&(t.style[s]=n[s]);else if(e.startsWith("xlink")){const s=e.replace("xlink","").toLowerCase();null==n||!1===n?t.removeAttributeNS("http://www.w3.org/1999/xlink",s):t.setAttributeNS("http://www.w3.org/1999/xlink",s,n)}else e.startsWith("on")?n&&"function"!=typeof n?"string"==typeof n&&(n?t.setAttribute(e,n):t.removeAttribute(e)):t[e]=n:/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-/g.test(e)||i?t.getAttribute(e)!==n&&(n?t.setAttribute(e,n):t.removeAttribute(e)):t[e]!==n&&(t[e]=n);"key"===e&&n&&(h[n]=t)}s&&"function"==typeof s.ref&&window.requestAnimationFrame((()=>s.ref(t)))}function p(t,s,i=0){var e;if("string"==typeof t)return t;if(Array.isArray(t))return t.map((t=>p(t,s,i++)));let n=t;if(t&&"function"==typeof t.tag&&Object.getPrototypeOf(t.tag).t&&(n=function(t,s,i){const{tag:e,props:n,children:o}=t;let r=`_${i}`,h=n&&n.id;h?r=h:h=`_${i}${Date.now()}`;let c="section";n&&n.as&&(c=n.as,delete n.as),s.i||(s.i={});let l=s.i[r];if(!(l&&l instanceof e&&l.element)){const t=document.createElement(c);l=s.i[r]=new e(Object.assign(Object.assign({},n),{children:o})).start(t)}if(l.mounted){const t=l.mounted(n,o,l.state);void 0!==t&&l.setState(t)}return d(l.element,n,!1),l.element}(t,s,i)),n&&Array.isArray(n.children)){const t=null===(e=n.props)||void 0===e?void 0:e._component;if(t){let s=0;n.children=n.children.map((i=>p(i,t,s++)))}else n.children=n.children.map((t=>p(t,s,i++)))}return n}const m=(t,s={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(s.observedAttributes||[]).map((t=>t.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const i=s||{};this._shadowRoot=i.shadow?this.attachShadow({mode:"open"}):this;const e=i.observedAttributes||[],n=e.reduce(((t,s)=>{const i=s.toLowerCase();return i!==s&&(t[i]=s),t}),{});this._attrMap=t=>n[t]||t;const o={};Array.from(this.attributes).forEach((t=>o[this._attrMap(t.name)]=t.value)),e.forEach((t=>{void 0!==this[t]&&(o[t]=this[t]),Object.defineProperty(this,t,{get:()=>o[t],set(s){this.attributeChangedCallback(t,o[t],s)},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,i),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!==i.render&&this._component.run(".")}}disconnectedCallback(){var t,s,i,e;null===(s=null===(t=this._component)||void 0===t?void 0:t.unload)||void 0===s||s.call(t),null===(e=null===(i=this._component)||void 0===i?void 0:i.unmount)||void 0===e||e.call(i),this._component=null}attributeChangedCallback(t,i,e){if(this._component){const n=this._attrMap(t);this._component._props[n]=e,this._component.run("attributeChanged",n,i,e),e!==i&&!1!==s.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var w=(t,s,i)=>{"undefined"!=typeof customElements&&customElements.define(t,m(s,i))};const y={meta:new WeakMap,defineMetadata(t,s,i){this.meta.has(i)||this.meta.set(i,{}),this.meta.get(i)[t]=s},getMetadataKeys(t){return t=Object.getPrototypeOf(t),this.meta.get(t)?Object.keys(this.meta.get(t)):[]},getMetadata(t,s){return s=Object.getPrototypeOf(s),this.meta.get(s)?this.meta.get(s)[t]:null}};function b(t,s={}){return(i,e,n)=>{const o=t?t.toString():e;return y.defineMetadata(`apprun-update:${o}`,{name:o,key:e,options:s},i),n}}function g(t,s={}){return function(i,e){const n=t?t.toString():e;y.defineMetadata(`apprun-update:${n}`,{name:n,key:e,options:s},i)}}function v(t,s){return function(i){return w(t,i,s),i}}const x=(t,s)=>(s?t.state[s]:t.state)||"",j=(t,s,i)=>{if(s){const e=t.state||{};e[s]=i,t.setState(e)}else t.setState(i)},$=(t,s)=>{if(Array.isArray(t))return t.map((t=>$(t,s)));{let{tag:i,props:n,children:o}=t;return i?(n&&Object.keys(n).forEach((t=>{t.startsWith("$")&&(((t,s,i,n)=>{if(t.startsWith("$on")){const i=s[t];if(t=t.substring(1),"boolean"==typeof i)s[t]=s=>n.run(t,s);else if("string"==typeof i)s[t]=t=>n.run(i,t);else if("function"==typeof i)s[t]=t=>n.setState(i(n.state,t));else if(Array.isArray(i)){const[e,...o]=i;"string"==typeof e?s[t]=t=>n.run(e,...o,t):"function"==typeof e&&(s[t]=t=>n.setState(e(n.state,...o,t)))}}else if("$bind"===t){const e=s.type||"text",o="string"==typeof s[t]?s[t]:s.name;if("input"===i)switch(e){case"checkbox":s.checked=x(n,o),s.onclick=t=>j(n,o||t.target.name,t.target.checked);break;case"radio":s.checked=x(n,o)===s.value,s.onclick=t=>j(n,o||t.target.name,t.target.value);break;case"number":case"range":s.value=x(n,o),s.oninput=t=>j(n,o||t.target.name,Number(t.target.value));break;default:s.value=x(n,o),s.oninput=t=>j(n,o||t.target.name,t.target.value)}else"select"===i?(s.value=x(n,o),s.onchange=t=>{t.target.multiple||j(n,o||t.target.name,t.target.value)}):"option"===i?(s.selected=x(n,o),s.onclick=t=>j(n,o||t.target.name,t.target.selected)):"textarea"===i&&(s.innerHTML=x(n,o),s.oninput=t=>j(n,o||t.target.name,t.target.value))}else e.run("$",{key:t,tag:i,props:s,component:n})})(t,n,i,s),delete n[t])})),o&&(o=$(o,s)),{tag:i,props:n,children:o}):t}},O=new Map;e.on("get-components",(t=>t.components=O));const _=t=>t;class M{constructor(s,i,e,n){this.state=s,this.view=i,this.update=e,this.options=n,this._app=new t,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,s)=>this.mount(t,Object.assign(Object.assign({},s),{render:!0}))}renderState(t,s=null){if(!this.view)return;let i=s||this.view(t);if(e.debug&&e.run("debug",{component:this,_:i?".":"-",state:t,vdom:i,el:this.element}),"object"!=typeof document)return;const n="string"==typeof this.element?document.getElementById(this.element):this.element;if(n){const t="_c";this.unload?n._component===this&&n.getAttribute(t)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),n.setAttribute(t,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((t=>{t[0].oldValue!==this.tracking_id&&document.body.contains(n)||(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]}))):n.removeAttribute&&n.removeAttribute(t),n._component=this}!s&&i&&(i=$(i,this),e.render(n,i,this)),this.rendered&&this.rendered(this.state)}setState(t,s={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!==s.render&&this.renderState(t),!1!==s.history&&this.enable_history&&(this._history=[...this._history,t],this._history_idx=this._history.length-1),"function"==typeof s.callback&&s.callback(this.state)}}mount(t=null,s){var i,n;return console.assert(!this.element,"Component already mounted."),this.options=s=Object.assign(Object.assign({},this.options),s),this.element=t,this.global_event=s.global_event,this.enable_history=!!s.history,this.enable_history&&(this.on(s.history.prev||"history-prev",this._history_prev),this.on(s.history.next||"history-next",this._history_next)),s.route&&(this.update=this.update||{},this.update[s.route]=_),this.add_actions(),this.state=null!==(n=null!==(i=this.state)&&void 0!==i?i:this.model)&&void 0!==n?n:{},"function"==typeof this.state&&(this.state=this.state()),s.render?this.setState(this.state,{render:!0,history:!0}):this.setState(this.state,{render:!1,history:!0}),e.debug&&(O.get(t)?O.get(t).push(this):O.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,s,i={}){s&&"function"==typeof s&&(i.global&&this._global_events.push(t),this.on(t,((...n)=>{e.debug&&e.run("debug",{component:this,_:">",event:t,p:n,current_state:this.state,options:i});const o=s(this.state,...n);e.debug&&e.run("debug",{component:this,_:"<",event:t,p:n,newState:o,state:this.state,options:i}),this.setState(o,i)}),i))}add_actions(){const t=this.update||{};y.getMetadataKeys(this).forEach((s=>{if(s.startsWith("apprun-update:")){const i=y.getMetadata(s,this);t[i.name]=[this[i.key].bind(this),i.options]}}));const s={};Array.isArray(t)?t.forEach((t=>{const[i,e,n]=t;i.toString().split(",").forEach((t=>s[t.trim()]=[e,n]))})):Object.keys(t).forEach((i=>{const e=t[i];("function"==typeof e||Array.isArray(e))&&i.split(",").forEach((t=>s[t.trim()]=e))})),s["."]||(s["."]=_),Object.keys(s).forEach((t=>{const i=s[t];"function"==typeof i?this.add_action(t,i):Array.isArray(i)&&this.add_action(t,i[0],i[1])}))}run(t,...s){const i=t.toString();return this.is_global_event(i)?e.run(i,...s):this._app.run(i,...s)}on(t,s,i){const n=t.toString();return this._actions.push({name:n,fn:s}),this.is_global_event(n)?e.on(n,s,i):this._app.on(n,s,i)}unmount(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this._actions.forEach((t=>{const{name:s,fn:i}=t;this.is_global_event(s)?e.off(s,i):this._app.off(s,i)}))}}M.t=!0;const k="//",A="///",E=t=>{if(t||(t="#"),t.startsWith("#")){const[s,...i]=t.split("/");e.run(s,...i)||e.run("///",s,...i),e.run("//",s,...i)}else if(t.startsWith("/")){const[s,i,...n]=t.split("/");e.run("/"+i,...n)||e.run("///","/"+i,...n),e.run("//","/"+i,...n)}else e.run(t)||e.run("///",t),e.run("//",t)};e.h=e.createElement=r,e.render=function(t,s,i){c(t,s,i)},e.Fragment=n,e.webComponent=w,e.start=(t,s,i,e,n)=>{const o=Object.assign(Object.assign({},n),{render:!0,global_event:!0}),r=new M(s,i,e);return n&&n.rendered&&(r.rendered=n.rendered),r.mount(t,o),r};const T=t=>{};e.on("$",T),e.on("debug",(t=>T)),e.on("//",T),e.on("#",T),e.route=E,e.on("route",(t=>e.route&&e.route(t))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{e.route===E&&(window.onpopstate=()=>E(location.hash),document.body.hasAttribute("apprun-no-init")||E(location.hash))})),"object"==typeof window&&(window.Component=M,window.React=e,window.on=g,window.customElement=v)
1
+ class t{constructor(){this._events={}}on(t,i,s={}){this._events[t]=this._events[t]||[],this._events[t].push({fn:i,options:s})}off(t,i){const s=this._events[t]||[];this._events[t]=s.filter((t=>t.fn!==i))}find(t){return this._events[t]}run(t,...i){const s=this.getSubscribers(t,this._events);return console.assert(s&&s.length>0,"No subscriber for event: "+t),s.forEach((s=>{const{fn:n,options:e}=s;return e.delay?this.delay(t,n,i,e):Object.keys(e).length>0?n.apply(this,[...i,e]):n.apply(this,i),!s.options.once})),s.length}once(t,i,s={}){this.on(t,i,Object.assign(Object.assign({},s),{once:!0}))}delay(t,i,s,n){n._t&&clearTimeout(n._t),n._t=setTimeout((()=>{clearTimeout(n._t),Object.keys(n).length>0?i.apply(this,[...s,n]):i.apply(this,s)}),n.delay)}query(t,...i){const s=this.getSubscribers(t,this._events);console.assert(s&&s.length>0,"No subscriber for event: "+t);const n=s.map((t=>{const{fn:s,options:n}=t;return Object.keys(n).length>0?s.apply(this,[...i,n]):s.apply(this,i)}));return Promise.all(n)}getSubscribers(t,i){const s=i[t]||[];return i[t]=s.filter((t=>!t.options.once)),Object.keys(i).filter((i=>i.endsWith("*")&&t.startsWith(i.replace("*","")))).sort(((t,i)=>i.length-t.length)).forEach((n=>s.push(...i[n].map((i=>Object.assign(Object.assign({},i),{options:Object.assign(Object.assign({},i.options),{event:t})})))))),s}}let i;const s="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;s.app&&s._AppRunVersions?i=s.app:(i=new t,s.app=i,s._AppRunVersions="AppRun-3");var n=i;function e(t,...i){return o(i)}function o(t){const i=[],s=t=>{null!=t&&""!==t&&!1!==t&&i.push("function"==typeof t||"object"==typeof t?t:`${t}`)};return t&&t.forEach((t=>{Array.isArray(t)?t.forEach((t=>s(t))):s(t)})),i}function r(t,i,...s){const n=o(s);if("string"==typeof t)return{tag:t,props:i,children:n};if(Array.isArray(t))return t;if(void 0===t&&s)return n;if(Object.getPrototypeOf(t).t)return{tag:t,props:i,children:n};if("function"==typeof t)return t(i,n);throw new Error(`Unknown tag in vdom ${t}`)}const h=new WeakMap,c=function(t,i,s={}){if(null==i||!1===i)return;i=v(i,s);const n="SVG"===(null==t?void 0:t.nodeName);if(!t)return;Array.isArray(i)?u(t,i,n):u(t,[i],n)};function l(t,i,s){3!==i._op&&(s=s||"svg"===i.tag,!function(t,i){const s=t.nodeName,n=`${i.tag||""}`;return s.toUpperCase()===n.toUpperCase()}(t,i)?t.parentNode.replaceChild(a(i,s),t):(!(2&i._op)&&u(t,i.children,s),!(1&i._op)&&f(t,i.props,s)))}function u(t,i,s){var n;const e=(null===(n=t.childNodes)||void 0===n?void 0:n.length)||0,o=(null==i?void 0:i.length)||0,r=Math.min(e,o);for(let n=0;n<r;n++){const e=i[n];if(3===e._op)continue;const o=t.childNodes[n];if("string"==typeof e)o.textContent!==e&&(3===o.nodeType?o.nodeValue=e:t.replaceChild(d(e),o));else if(e instanceof HTMLElement||e instanceof SVGElement)t.insertBefore(e,o);else{const i=e.props&&e.props.key;if(i)if(o.key===i)l(t.childNodes[n],e,s);else{const r=h[i];if(r){const i=r.nextSibling;t.insertBefore(r,o),i?t.insertBefore(o,i):t.appendChild(o),l(t.childNodes[n],e,s)}else t.replaceChild(a(e,s),o)}else l(t.childNodes[n],e,s)}}let c=t.childNodes.length;for(;c>r;)t.removeChild(t.lastChild),c--;if(o>r){const n=document.createDocumentFragment();for(let t=r;t<i.length;t++)n.appendChild(a(i[t],s));t.appendChild(n)}}function d(t){if(0===(null==t?void 0:t.indexOf("_html:"))){const i=document.createElement("div");return i.insertAdjacentHTML("afterbegin",t.substring(6)),i}return document.createTextNode(null!=t?t:"")}function a(t,i){if(t instanceof HTMLElement||t instanceof SVGElement)return t;if("string"==typeof t)return d(t);if(!t.tag||"function"==typeof t.tag)return d(JSON.stringify(t));const s=(i=i||"svg"===t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);return f(s,t.props,i),t.children&&t.children.forEach((t=>s.appendChild(a(t,i)))),s}function f(t,i,s){const n=t._props||{};i=function(t,i){i.class=i.class||i.className,delete i.className;const s={};return t&&Object.keys(t).forEach((t=>s[t]=null)),i&&Object.keys(i).forEach((t=>s[t]=i[t])),s}(n,i||{}),t._props=i;for(const n in i){const e=i[n];if(n.startsWith("data-")){const i=n.substring(5).replace(/-(\w)/g,(t=>t[1].toUpperCase()));t.dataset[i]!==e&&(e||""===e?t.dataset[i]=e:delete t.dataset[i])}else if("style"===n)if(t.style.cssText&&(t.style.cssText=""),"string"==typeof e)t.style.cssText=e;else for(const i in e)t.style[i]!==e[i]&&(t.style[i]=e[i]);else if(n.startsWith("xlink")){const i=n.replace("xlink","").toLowerCase();null==e||!1===e?t.removeAttributeNS("http://www.w3.org/1999/xlink",i):t.setAttributeNS("http://www.w3.org/1999/xlink",i,e)}else n.startsWith("on")?e&&"function"!=typeof e?"string"==typeof e&&(e?t.setAttribute(n,e):t.removeAttribute(n)):t[n]=e:/^id$|^class$|^list$|^readonly$|^contenteditable$|^role|-/g.test(n)||s?t.getAttribute(n)!==e&&(e?t.setAttribute(n,e):t.removeAttribute(n)):t[n]!==e&&(t[n]=e);"key"===n&&e&&(h[e]=t)}i&&"function"==typeof i.ref&&window.requestAnimationFrame((()=>i.ref(t)))}function v(t,i,s=0){var n;if("string"==typeof t)return t;if(Array.isArray(t))return t.map((t=>v(t,i,s++)));let e=t;if(t&&"function"==typeof t.tag&&Object.getPrototypeOf(t.tag).t&&(e=function(t,i,s){const{tag:n,props:e,children:o}=t;let r=`_${s}`,h=e&&e.id;h?r=h:h=`_${s}${Date.now()}`;let c="section";e&&e.as&&(c=e.as,delete e.as),i.i||(i.i={});let l=i.i[r];if(!(l&&l instanceof n&&l.element)){const t=document.createElement(c);l=i.i[r]=new n(Object.assign(Object.assign({},e),{children:o})).start(t)}if(l.mounted){const t=l.mounted(e,o,l.state);void 0!==t&&l.setState(t)}return f(l.element,e,!1),l.element}(t,i,s)),e&&Array.isArray(e.children)){const t=null===(n=e.props)||void 0===n?void 0:n._component;if(t){let i=0;e.children=e.children.map((s=>v(s,t,i++)))}else e.children=e.children.map((t=>v(t,i,s++)))}return e}const p=(t,i={})=>class extends HTMLElement{constructor(){super()}get component(){return this._component}get state(){return this._component.state}static get observedAttributes(){return(i.observedAttributes||[]).map((t=>t.toLowerCase()))}connectedCallback(){if(this.isConnected&&!this._component){const s=i||{};this._shadowRoot=s.shadow?this.attachShadow({mode:"open"}):this;const n=s.observedAttributes||[],e=n.reduce(((t,i)=>{const s=i.toLowerCase();return s!==i&&(t[s]=i),t}),{});this._attrMap=t=>e[t]||t;const o={};Array.from(this.attributes).forEach((t=>o[this._attrMap(t.name)]=t.value)),n.forEach((t=>{void 0!==this[t]&&(o[t]=this[t]),Object.defineProperty(this,t,{get:()=>o[t],set(i){this.attributeChangedCallback(t,o[t],i)},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,s),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!==s.render&&this._component.run(".")}}disconnectedCallback(){var t,i,s,n;null===(i=null===(t=this._component)||void 0===t?void 0:t.unload)||void 0===i||i.call(t),null===(n=null===(s=this._component)||void 0===s?void 0:s.unmount)||void 0===n||n.call(s),this._component=null}attributeChangedCallback(t,s,n){if(this._component){const e=this._attrMap(t);this._component._props[e]=n,this._component.run("attributeChanged",e,s,n),n!==s&&!1!==i.render&&window.requestAnimationFrame((()=>{this._component.run(".")}))}}};var y=(t,i,s)=>{"undefined"!=typeof customElements&&customElements.define(t,p(i,s))};const b={meta:new WeakMap,defineMetadata(t,i,s){this.meta.has(s)||this.meta.set(s,{}),this.meta.get(s)[t]=i},getMetadataKeys(t){return t=Object.getPrototypeOf(t),this.meta.get(t)?Object.keys(this.meta.get(t)):[]},getMetadata(t,i){return i=Object.getPrototypeOf(i),this.meta.get(i)?this.meta.get(i)[t]:null}};function g(t,i={}){return(s,n,e)=>{const o=t?t.toString():n;return b.defineMetadata(`apprun-update:${o}`,{name:o,key:n,options:i},s),e}}function w(t,i={}){return function(s,n){const e=t?t.toString():n;b.defineMetadata(`apprun-update:${e}`,{name:e,key:n,options:i},s)}}function m(t,i){return function(s){return y(t,s,i),s}}const $=(t,i)=>(i?t.state[i]:t.state)||"",j=(t,i,s)=>{if(i){const n=t.state||{};n[i]=s,t.setState(n)}else t.setState(s)},O=(t,i)=>{if(Array.isArray(t))return t.map((t=>O(t,i)));{let{tag:s,props:e,children:o}=t;return s?(e&&Object.keys(e).forEach((t=>{t.startsWith("$")&&(((t,i,s,e)=>{if(t.startsWith("$on")){const s=i[t];if(t=t.substring(1),"boolean"==typeof s)i[t]=i=>e.run(t,i);else if("string"==typeof s)i[t]=t=>e.run(s,t);else if("function"==typeof s)i[t]=t=>e.setState(s(e.state,t));else if(Array.isArray(s)){const[n,...o]=s;"string"==typeof n?i[t]=t=>e.run(n,...o,t):"function"==typeof n&&(i[t]=t=>e.setState(n(e.state,...o,t)))}}else if("$bind"===t){const n=i.type||"text",o="string"==typeof i[t]?i[t]:i.name;if("input"===s)switch(n){case"checkbox":i.checked=$(e,o),i.onclick=t=>j(e,o||t.target.name,t.target.checked);break;case"radio":i.checked=$(e,o)===i.value,i.onclick=t=>j(e,o||t.target.name,t.target.value);break;case"number":case"range":i.value=$(e,o),i.oninput=t=>j(e,o||t.target.name,Number(t.target.value));break;default:i.value=$(e,o),i.oninput=t=>j(e,o||t.target.name,t.target.value)}else"select"===s?(i.value=$(e,o),i.onchange=t=>{t.target.multiple||j(e,o||t.target.name,t.target.value)}):"option"===s?(i.selected=$(e,o),i.onclick=t=>j(e,o||t.target.name,t.target.selected)):"textarea"===s&&(i.innerHTML=$(e,o),i.oninput=t=>j(e,o||t.target.name,t.target.value))}else n.run("$",{key:t,tag:s,props:i,component:e})})(t,e,s,i),delete e[t])})),o&&(o=O(o,i)),{tag:s,props:e,children:o}):t}},A=new Map;n.on("get-components",(t=>t.components=A));const _=t=>t;class k{constructor(i,s,n,e){this.state=i,this.view=s,this.update=n,this.options=e,this._app=new t,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,i)=>this.mount(t,Object.assign({render:!0},i))}renderState(t,i=null){if(!this.view)return;let s=i||this.view(t);if(n.debug&&n.run("debug",{component:this,_:s?".":"-",state:t,vdom:s,el:this.element}),"object"!=typeof document)return;const e="string"==typeof this.element?document.getElementById(this.element):this.element;if(e){const t="_c";this.unload?e._component===this&&e.getAttribute(t)===this.tracking_id||(this.tracking_id=(new Date).valueOf().toString(),e.setAttribute(t,this.tracking_id),"undefined"!=typeof MutationObserver&&(this.observer||(this.observer=new MutationObserver((t=>{t[0].oldValue!==this.tracking_id&&document.body.contains(e)||(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]}))):e.removeAttribute&&e.removeAttribute(t),e._component=this}!i&&s&&(s=O(s,this),n.render(e,s,this)),this.rendered&&this.rendered(this.state)}setState(t,i={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!==i.render&&this.renderState(t),!1!==i.history&&this.enable_history&&(this._history=[...this._history,t],this._history_idx=this._history.length-1),"function"==typeof i.callback&&i.callback(this.state)}}mount(t=null,i){var s,e;return console.assert(!this.element,"Component already mounted."),this.options=i=Object.assign(Object.assign({},this.options),i),this.element=t,this.global_event=i.global_event,this.enable_history=!!i.history,this.enable_history&&(this.on(i.history.prev||"history-prev",this._history_prev),this.on(i.history.next||"history-next",this._history_next)),i.route&&(this.update=this.update||{},this.update[i.route]=_),this.add_actions(),this.state=null!==(e=null!==(s=this.state)&&void 0!==s?s:this.model)&&void 0!==e?e:{},"function"==typeof this.state&&(this.state=this.state()),i.render?this.setState(this.state,{render:!0,history:!0}):this.setState(this.state,{render:!1,history:!0}),n.debug&&(A.get(t)?A.get(t).push(this):A.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,i,s={}){i&&"function"==typeof i&&(s.global&&this._global_events.push(t),this.on(t,((...e)=>{n.debug&&n.run("debug",{component:this,_:">",event:t,p:e,current_state:this.state,options:s});const o=i(this.state,...e);n.debug&&n.run("debug",{component:this,_:"<",event:t,p:e,newState:o,state:this.state,options:s}),this.setState(o,s)}),s))}add_actions(){const t=this.update||{};b.getMetadataKeys(this).forEach((i=>{if(i.startsWith("apprun-update:")){const s=b.getMetadata(i,this);t[s.name]=[this[s.key].bind(this),s.options]}}));const i={};Array.isArray(t)?t.forEach((t=>{const[s,n,e]=t;s.toString().split(",").forEach((t=>i[t.trim()]=[n,e]))})):Object.keys(t).forEach((s=>{const n=t[s];("function"==typeof n||Array.isArray(n))&&s.split(",").forEach((t=>i[t.trim()]=n))})),i["."]||(i["."]=_),Object.keys(i).forEach((t=>{const s=i[t];"function"==typeof s?this.add_action(t,s):Array.isArray(s)&&this.add_action(t,s[0],s[1])}))}run(t,...i){const s=t.toString();return this.is_global_event(s)?n.run(s,...i):this._app.run(s,...i)}on(t,i,s){const e=t.toString();return this._actions.push({name:e,fn:i}),this.is_global_event(e)?n.on(e,i,s):this._app.on(e,i,s)}unmount(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this._actions.forEach((t=>{const{name:i,fn:s}=t;this.is_global_event(i)?n.off(i,s):this._app.off(i,s)}))}}k.t=!0;const x="//",M="///",T=t=>{if(t||(t="#"),t.startsWith("#")){const[i,...s]=t.split("/");n.run(i,...s)||n.run("///",i,...s),n.run("//",i,...s)}else if(t.startsWith("/")){const[i,s,...e]=t.split("/");n.run("/"+s,...e)||n.run("///","/"+s,...e),n.run("//","/"+s,...e)}else n.run(t)||n.run("///",t),n.run("//",t)};n.h=n.createElement=r,n.render=function(t,i,s){c(t,i,s)},n.Fragment=e,n.webComponent=y,n.start=(t,i,s,n,e)=>{const o=Object.assign({render:!0,global_event:!0},e),r=new k(i,s,n);return e&&e.rendered&&(r.rendered=e.rendered),r.mount(t,o),r};const E=t=>{};
2
2
  /**
3
3
  * @license
4
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
5
- * This code may only be used under the BSD style license found at
6
- * http://polymer.github.io/LICENSE.txt
7
- * The complete set of authors may be found at
8
- * http://polymer.github.io/AUTHORS.txt
9
- * The complete set of contributors may be found at
10
- * http://polymer.github.io/CONTRIBUTORS.txt
11
- * Code distributed by Google as part of the polymer project is also
12
- * subject to an additional IP rights grant found at
13
- * http://polymer.github.io/PATENTS.txt
14
- */;const S=new WeakMap,L=t=>(...s)=>{const i=t(...s);return S.set(i,!0),i},V=t=>"function"==typeof t&&S.has(t),P="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,C=(t,s,i=null)=>{for(;s!==i;){const i=s.nextSibling;t.removeChild(s),s=i}},N={},H={},W=`{{lit-${String(Math.random()).slice(2)}}}`,F=`\x3c!--${W}--\x3e`,D=new RegExp(`${W}|${F}`);class G{constructor(t,s){this.parts=[],this.element=s;const i=[],e=[],n=document.createTreeWalker(s.content,133,null,!1);let o=0,r=-1,h=0;const{strings:c,values:{length:l}}=t;for(;h<l;){const t=n.nextNode();if(null!==t){if(r++,1===t.nodeType){if(t.hasAttributes()){const s=t.attributes,{length:i}=s;let e=0;for(let t=0;t<i;t++)I(s[t].name,"$lit$")&&e++;for(;e-- >0;){const s=c[h],i=B.exec(s)[2],e=i.toLowerCase()+"$lit$",n=t.getAttribute(e);t.removeAttribute(e);const o=n.split(D);this.parts.push({type:"attribute",index:r,name:i,strings:o}),h+=o.length-1}}"TEMPLATE"===t.tagName&&(e.push(t),n.currentNode=t.content)}else if(3===t.nodeType){const s=t.data;if(s.indexOf(W)>=0){const e=t.parentNode,n=s.split(D),o=n.length-1;for(let s=0;s<o;s++){let i,o=n[s];if(""===o)i=q();else{const t=B.exec(o);null!==t&&I(t[2],"$lit$")&&(o=o.slice(0,t.index)+t[1]+t[2].slice(0,-"$lit$".length)+t[3]),i=document.createTextNode(o)}e.insertBefore(i,t),this.parts.push({type:"node",index:++r})}""===n[o]?(e.insertBefore(q(),t),i.push(t)):t.data=n[o],h+=o}}else if(8===t.nodeType)if(t.data===W){const s=t.parentNode;null!==t.previousSibling&&r!==o||(r++,s.insertBefore(q(),t)),o=r,this.parts.push({type:"node",index:r}),null===t.nextSibling?t.data="":(i.push(t),r--),h++}else{let s=-1;for(;-1!==(s=t.data.indexOf(W,s+1));)this.parts.push({type:"node",index:-1}),h++}}else n.currentNode=e.pop()}for(const t of i)t.parentNode.removeChild(t)}}const I=(t,s)=>{const i=t.length-s.length;return i>=0&&t.slice(i)===s},R=t=>-1!==t.index,q=()=>document.createComment(""),B=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;
15
- /**
16
- * @license
17
- * Copyright (c) 2017 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
27
- */
28
- class J{constructor(t,s,i){this.o=[],this.template=t,this.processor=s,this.options=i}update(t){let s=0;for(const i of this.o)void 0!==i&&i.setValue(t[s]),s++;for(const t of this.o)void 0!==t&&t.commit()}_clone(){const t=P?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),s=[],i=this.template.parts,e=document.createTreeWalker(t,133,null,!1);let n,o=0,r=0,h=e.nextNode();for(;o<i.length;)if(n=i[o],R(n)){for(;r<n.index;)r++,"TEMPLATE"===h.nodeName&&(s.push(h),e.currentNode=h.content),null===(h=e.nextNode())&&(e.currentNode=s.pop(),h=e.nextNode());if("node"===n.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(h.previousSibling),this.o.push(t)}else this.o.push(...this.processor.handleAttributeExpressions(h,n.name,n.strings,this.options));o++}else this.o.push(void 0),o++;return P&&(document.adoptNode(t),customElements.upgrade(t)),t}}
29
- /**
30
- * @license
31
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
32
- * This code may only be used under the BSD style license found at
33
- * http://polymer.github.io/LICENSE.txt
34
- * The complete set of authors may be found at
35
- * http://polymer.github.io/AUTHORS.txt
36
- * The complete set of contributors may be found at
37
- * http://polymer.github.io/CONTRIBUTORS.txt
38
- * Code distributed by Google as part of the polymer project is also
39
- * subject to an additional IP rights grant found at
40
- * http://polymer.github.io/PATENTS.txt
41
- */const K=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),U=` ${W} `;class z{constructor(t,s,i,e){this.strings=t,this.values=s,this.type=i,this.processor=e}getHTML(){const t=this.strings.length-1;let s="",i=!1;for(let e=0;e<t;e++){const t=this.strings[e],n=t.lastIndexOf("\x3c!--");i=(n>-1||i)&&-1===t.indexOf("--\x3e",n+1);const o=B.exec(t);s+=null===o?t+(i?U:F):t.substr(0,o.index)+o[1]+o[2]+"$lit$"+o[3]+W}return s+=this.strings[t],s}getTemplateElement(){const t=document.createElement("template");let s=this.getHTML();return void 0!==K&&(s=K.createHTML(s)),t.innerHTML=s,t}}class Q extends z{getHTML(){return`<svg>${super.getHTML()}</svg>`}getTemplateElement(){const t=super.getTemplateElement(),s=t.content,i=s.firstChild;return s.removeChild(i),((t,s,i=null,e=null)=>{for(;s!==i;){const i=s.nextSibling;t.insertBefore(s,e),s=i}})(s,i.firstChild),t}}
42
- /**
43
- * @license
44
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
45
- * This code may only be used under the BSD style license found at
46
- * http://polymer.github.io/LICENSE.txt
47
- * The complete set of authors may be found at
48
- * http://polymer.github.io/AUTHORS.txt
49
- * The complete set of contributors may be found at
50
- * http://polymer.github.io/CONTRIBUTORS.txt
51
- * Code distributed by Google as part of the polymer project is also
52
- * subject to an additional IP rights grant found at
53
- * http://polymer.github.io/PATENTS.txt
54
- */const X=t=>null===t||!("object"==typeof t||"function"==typeof t),Y=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class Z{constructor(t,s,i){this.dirty=!0,this.element=t,this.name=s,this.strings=i,this.parts=[];for(let t=0;t<i.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new tt(this)}_getValue(){const t=this.strings,s=t.length-1,i=this.parts;if(1===s&&""===t[0]&&""===t[1]){const t=i[0].value;if("symbol"==typeof t)return String(t);if("string"==typeof t||!Y(t))return t}let e="";for(let n=0;n<s;n++){e+=t[n];const s=i[n];if(void 0!==s){const t=s.value;if(X(t)||!Y(t))e+="string"==typeof t?t:String(t);else for(const s of t)e+="string"==typeof s?s:String(s)}}return e+=t[s],e}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class tt{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===N||X(t)&&t===this.value||(this.value=t,V(t)||(this.committer.dirty=!0))}commit(){for(;V(this.value);){const t=this.value;this.value=N,t(this)}this.value!==N&&this.committer.commit()}}class st{constructor(t){this.value=void 0,this.l=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild(q()),this.endNode=t.appendChild(q())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.u(this.startNode=q()),t.u(this.endNode=q())}insertAfterPart(t){t.u(this.startNode=q()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.l=t}commit(){if(null===this.startNode.parentNode)return;for(;V(this.l);){const t=this.l;this.l=N,t(this)}const t=this.l;t!==N&&(X(t)?t!==this.value&&this.m(t):t instanceof z?this.g(t):t instanceof Node?this.v(t):Y(t)?this.j(t):t===H?(this.value=H,this.clear()):this.m(t))}u(t){this.endNode.parentNode.insertBefore(t,this.endNode)}v(t){this.value!==t&&(this.clear(),this.u(t),this.value=t)}m(t){const s=this.startNode.nextSibling,i="string"==typeof(t=null==t?"":t)?t:String(t);s===this.endNode.previousSibling&&3===s.nodeType?s.data=i:this.v(document.createTextNode(i)),this.value=t}g(t){const s=this.options.templateFactory(t);if(this.value instanceof J&&this.value.template===s)this.value.update(t.values);else{const i=new J(s,t.processor,this.options),e=i._clone();i.update(t.values),this.v(e),this.value=i}}j(t){Array.isArray(this.value)||(this.value=[],this.clear());const s=this.value;let i,e=0;for(const n of t)i=s[e],void 0===i&&(i=new st(this.options),s.push(i),0===e?i.appendIntoPart(this):i.insertAfterPart(s[e-1])),i.setValue(n),i.commit(),e++;e<s.length&&(s.length=e,this.clear(i&&i.endNode))}clear(t=this.startNode){C(this.startNode.parentNode,t.nextSibling,this.endNode)}}class it{constructor(t,s,i){if(this.value=void 0,this.l=void 0,2!==i.length||""!==i[0]||""!==i[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=s,this.strings=i}setValue(t){this.l=t}commit(){for(;V(this.l);){const t=this.l;this.l=N,t(this)}if(this.l===N)return;const t=!!this.l;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.l=N}}class et extends Z{constructor(t,s,i){super(t,s,i),this.single=2===i.length&&""===i[0]&&""===i[1]}_createPart(){return new nt(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class nt extends tt{}let ot=!1;(()=>{try{const t={get capture(){return ot=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class rt{constructor(t,s,i){this.value=void 0,this.l=void 0,this.element=t,this.eventName=s,this.eventContext=i,this.$=t=>this.handleEvent(t)}setValue(t){this.l=t}commit(){for(;V(this.l);){const t=this.l;this.l=N,t(this)}if(this.l===N)return;const t=this.l,s=this.value,i=null==t||null!=s&&(t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive),e=null!=t&&(null==s||i);i&&this.element.removeEventListener(this.eventName,this.$,this.O),e&&(this.O=ht(t),this.element.addEventListener(this.eventName,this.$,this.O)),this.value=t,this.l=N}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const ht=t=>t&&(ot?{capture:t.capture,passive:t.passive,once:t.once}:t.capture)
55
- /**
56
- * @license
57
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
58
- * This code may only be used under the BSD style license found at
59
- * http://polymer.github.io/LICENSE.txt
60
- * The complete set of authors may be found at
61
- * http://polymer.github.io/AUTHORS.txt
62
- * The complete set of contributors may be found at
63
- * http://polymer.github.io/CONTRIBUTORS.txt
64
- * Code distributed by Google as part of the polymer project is also
65
- * subject to an additional IP rights grant found at
66
- * http://polymer.github.io/PATENTS.txt
67
- */;const ct=new class{handleAttributeExpressions(t,s,i,e){const n=s[0];if("."===n){return new et(t,s.slice(1),i).parts}if("@"===n)return[new rt(t,s.slice(1),e.eventContext)];if("?"===n)return[new it(t,s.slice(1),i)];return new Z(t,s,i).parts}handleTextExpression(t){return new st(t)}};
68
- /**
69
- * @license
70
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
71
- * This code may only be used under the BSD style license found at
72
- * http://polymer.github.io/LICENSE.txt
73
- * The complete set of authors may be found at
74
- * http://polymer.github.io/AUTHORS.txt
75
- * The complete set of contributors may be found at
76
- * http://polymer.github.io/CONTRIBUTORS.txt
77
- * Code distributed by Google as part of the polymer project is also
78
- * subject to an additional IP rights grant found at
79
- * http://polymer.github.io/PATENTS.txt
80
- */function lt(t){let s=ut.get(t.type);void 0===s&&(s={stringsArray:new WeakMap,keyString:new Map},ut.set(t.type,s));let i=s.stringsArray.get(t.strings);if(void 0!==i)return i;const e=t.strings.join(W);return i=s.keyString.get(e),void 0===i&&(i=new G(t,t.getTemplateElement()),s.keyString.set(e,i)),s.stringsArray.set(t.strings,i),i}const ut=new Map,ft=new WeakMap,at=(t,s,i)=>{let e=ft.get(s);void 0===e&&(C(s,s.firstChild),ft.set(s,e=new st(Object.assign({templateFactory:lt},i))),e.appendInto(s)),e.setValue(t),e.commit()};
81
- /**
82
- * @license
83
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
84
- * This code may only be used under the BSD style license found at
85
- * http://polymer.github.io/LICENSE.txt
86
- * The complete set of authors may be found at
87
- * http://polymer.github.io/AUTHORS.txt
88
- * The complete set of contributors may be found at
89
- * http://polymer.github.io/CONTRIBUTORS.txt
90
- * Code distributed by Google as part of the polymer project is also
91
- * subject to an additional IP rights grant found at
92
- * http://polymer.github.io/PATENTS.txt
4
+ * Copyright 2017 Google LLC
5
+ * SPDX-License-Identifier: BSD-3-Clause
93
6
  */
7
+ var S;n.on("$",E),n.on("debug",(t=>E)),n.on("//",E),n.on("#",E),n.route=T,n.on("route",(t=>n.route&&n.route(t))),"object"==typeof document&&document.addEventListener("DOMContentLoaded",(()=>{n.route===T&&(window.onpopstate=()=>T(location.hash),document.body.hasAttribute("apprun-no-init")||T(location.hash))})),"object"==typeof window&&(window.Component=k,window.React=n,window.on=w,window.customElement=m);const C=globalThis.trustedTypes,N=C?C.createPolicy("lit-html",{createHTML:t=>t}):void 0,L=`lit$${(Math.random()+"").slice(9)}$`,U="?"+L,H=`<${U}>`,D=document,I=(t="")=>D.createComment(t),V=t=>null===t||"object"!=typeof t&&"function"!=typeof t,G=Array.isArray,P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,W=/>/g,z=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,Z=/'/g,q=/"/g,F=/^(?:script|style|textarea|title)$/i,J=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),K=J(1),B=J(2),Q=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),Y=new WeakMap,tt=(t,i,s)=>{var n,e;const o=null!==(n=null==s?void 0:s.renderBefore)&&void 0!==n?n:i;let r=o._$litPart$;if(void 0===r){const t=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:null;o._$litPart$=r=new rt(i.insertBefore(I(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r},it=D.createTreeWalker(D,129,null,!1),st=(t,i)=>{const s=t.length-1,n=[];let e,o=2===i?"<svg>":"",r=P;for(let i=0;i<s;i++){const s=t[i];let h,c,l=-1,u=0;for(;u<s.length&&(r.lastIndex=u,c=r.exec(s),null!==c);)u=r.lastIndex,r===P?"!--"===c[1]?r=R:void 0!==c[1]?r=W:void 0!==c[2]?(F.test(c[2])&&(e=RegExp("</"+c[2],"g")),r=z):void 0!==c[3]&&(r=z):r===z?">"===c[0]?(r=null!=e?e:P,l=-1):void 0===c[1]?l=-2:(l=r.lastIndex-c[2].length,h=c[1],r=void 0===c[3]?z:'"'===c[3]?q:Z):r===q||r===Z?r=z:r===R||r===W?r=P:(r=z,e=void 0);const d=r===z&&t[i+1].startsWith("/>")?" ":"";o+=r===P?s+H:l>=0?(n.push(h),s.slice(0,l)+"$lit$"+s.slice(l)+L+d):s+L+(-2===l?(n.push(void 0),i):d)}const h=o+(t[s]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==N?N.createHTML(h):h,n]};class nt{constructor({strings:t,_$litType$:i},s){let n;this.parts=[];let e=0,o=0;const r=t.length-1,h=this.parts,[c,l]=st(t,i);if(this.el=nt.createElement(c,s),it.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(n=it.nextNode())&&h.length<r;){if(1===n.nodeType){if(n.hasAttributes()){const t=[];for(const i of n.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(L)){const s=l[o++];if(t.push(i),void 0!==s){const t=n.getAttribute(s.toLowerCase()+"$lit$").split(L),i=/([.?@])?(.*)/.exec(s);h.push({type:1,index:e,name:i[2],strings:t,ctor:"."===i[1]?ct:"?"===i[1]?ut:"@"===i[1]?dt:ht})}else h.push({type:6,index:e})}for(const i of t)n.removeAttribute(i)}if(F.test(n.tagName)){const t=n.textContent.split(L),i=t.length-1;if(i>0){n.textContent=C?C.emptyScript:"";for(let s=0;s<i;s++)n.append(t[s],I()),it.nextNode(),h.push({type:2,index:++e});n.append(t[i],I())}}}else if(8===n.nodeType)if(n.data===U)h.push({type:2,index:e});else{let t=-1;for(;-1!==(t=n.data.indexOf(L,t+1));)h.push({type:7,index:e}),t+=L.length-1}e++}}static createElement(t,i){const s=D.createElement("template");return s.innerHTML=t,s}}function et(t,i,s=t,n){var e,o,r,h;if(i===Q)return i;let c=void 0!==n?null===(e=s._$Cl)||void 0===e?void 0:e[n]:s._$Cu;const l=V(i)?void 0:i._$litDirective$;return(null==c?void 0:c.constructor)!==l&&(null===(o=null==c?void 0:c._$AO)||void 0===o||o.call(c,!1),void 0===l?c=void 0:(c=new l(t),c._$AT(t,s,n)),void 0!==n?(null!==(r=(h=s)._$Cl)&&void 0!==r?r:h._$Cl=[])[n]=c:s._$Cu=c),void 0!==c&&(i=et(t,c._$AS(t,i.values),c,n)),i}class ot{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:n}=this._$AD,e=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:D).importNode(s,!0);it.currentNode=e;let o=it.nextNode(),r=0,h=0,c=n[0];for(;void 0!==c;){if(r===c.index){let i;2===c.type?i=new rt(o,o.nextSibling,this,t):1===c.type?i=new c.ctor(o,c.name,c.strings,this,t):6===c.type&&(i=new at(o,this,t)),this.v.push(i),c=n[++h]}r!==(null==c?void 0:c.index)&&(o=it.nextNode(),r++)}return e}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class rt{constructor(t,i,s,n){var e;this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=n,this._$Cg=null===(e=null==n?void 0:n.isConnected)||void 0===e||e}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=et(this,t,i),V(t)?t===X||null==t||""===t?(this._$AH!==X&&this._$AR(),this._$AH=X):t!==this._$AH&&t!==Q&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):(t=>{var i;return G(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])})(t)?this.A(t):this.$(t)}M(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==X&&V(this._$AH)?this._$AA.nextSibling.data=t:this.S(D.createTextNode(t)),this._$AH=t}T(t){var i;const{values:s,_$litType$:n}=t,e="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=nt.createElement(n.h,this.options)),n);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===e)this._$AH.m(s);else{const t=new ot(e,this),i=t.p(this.options);t.m(s),this.S(i),this._$AH=t}}_$AC(t){let i=Y.get(t.strings);return void 0===i&&Y.set(t.strings,i=new nt(t)),i}A(t){G(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,n=0;for(const e of t)n===i.length?i.push(s=new rt(this.M(I()),this.M(I()),this,this.options)):s=i[n],s._$AI(e),n++;n<i.length&&(this._$AR(s&&s._$AB.nextSibling,n),i.length=n)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class ht{constructor(t,i,s,n,e){this.type=1,this._$AH=X,this._$AN=void 0,this.element=t,this.name=i,this._$AM=n,this.options=e,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=X}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,n){const e=this.strings;let o=!1;if(void 0===e)t=et(this,t,i,0),o=!V(t)||t!==this._$AH&&t!==Q,o&&(this._$AH=t);else{const n=t;let r,h;for(t=e[0],r=0;r<e.length-1;r++)h=et(this,n[s+r],i,r),h===Q&&(h=this._$AH[r]),o||(o=!V(h)||h!==this._$AH[r]),h===X?t=X:t!==X&&(t+=(null!=h?h:"")+e[r+1]),this._$AH[r]=h}o&&!n&&this.k(t)}k(t){t===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class ct extends ht{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===X?void 0:t}}const lt=C?C.emptyScript:"";class ut extends ht{constructor(){super(...arguments),this.type=4}k(t){t&&t!==X?this.element.setAttribute(this.name,lt):this.element.removeAttribute(this.name)}}class dt extends ht{constructor(t,i,s,n,e){super(t,i,s,n,e),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=et(this,t,i,0))&&void 0!==s?s:X)===Q)return;const n=this._$AH,e=t===X&&n!==X||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==X&&(n===X||e);e&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class at{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){et(this,t)}}const ft=window.litHtmlPolyfillSupport;null==ft||ft(nt,rt),(null!==(S=globalThis.litHtmlVersions)&&void 0!==S?S:globalThis.litHtmlVersions=[]).push("2.1.3");
94
8
  /**
95
9
  * @license
96
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
97
- * This code may only be used under the BSD style license found at
98
- * http://polymer.github.io/LICENSE.txt
99
- * The complete set of authors may be found at
100
- * http://polymer.github.io/AUTHORS.txt
101
- * The complete set of contributors may be found at
102
- * http://polymer.github.io/CONTRIBUTORS.txt
103
- * Code distributed by Google as part of the polymer project is also
104
- * subject to an additional IP rights grant found at
105
- * http://polymer.github.io/PATENTS.txt
10
+ * Copyright 2017 Google LLC
11
+ * SPDX-License-Identifier: BSD-3-Clause
106
12
  */
107
- "undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const dt=(t,...s)=>new z(t,s,"html",ct),pt=(t,...s)=>new Q(t,s,"svg",ct)
13
+ const vt=2,pt=5,yt=t=>(...i)=>({_$litDirective$:t,values:i});class bt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,s){this._$Ct=t,this._$AM=i,this._$Ci=s}_$AS(t,i){return this.update(t,i)}update(t,i){return this.render(...i)}}
108
14
  /**
109
15
  * @license
110
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
111
- * This code may only be used under the BSD style license found at
112
- * http://polymer.github.io/LICENSE.txt
113
- * The complete set of authors may be found at
114
- * http://polymer.github.io/AUTHORS.txt
115
- * The complete set of contributors may be found at
116
- * http://polymer.github.io/CONTRIBUTORS.txt
117
- * Code distributed by Google as part of the polymer project is also
118
- * subject to an additional IP rights grant found at
119
- * http://polymer.github.io/PATENTS.txt
120
- */,mt=new WeakMap,wt=L((t=>s=>{if(!(s instanceof st))throw new Error("unsafeHTML can only be used in text bindings");const i=mt.get(s);if(void 0!==i&&X(t)&&t===i.value&&s.value===i.fragment)return;const e=document.createElement("template");e.innerHTML=t;const n=document.importNode(e.content,!0);s.setValue(n),mt.set(s,{value:t,fragment:n})}));function yt(t,s,i){"string"==typeof s?at(dt`${wt(s)}`,t):s instanceof z?at(s,t):(c(t,s,i),ft.delete(t))}const bt=L(((t,...s)=>i=>{if(!(i instanceof rt))throw new Error("${run} can only be used in event handlers");let{element:e,eventName:n}=i;const o=()=>{let t=e._component;for(;!t&&e;)e=e.parentElement,t=e&&e._component;return console.assert(!!t,"Component not found."),t};"string"==typeof t?e[`on${n}`]=i=>o().run(t,...s,i):"function"==typeof t&&(e[`on${n}`]=i=>o().setState(t(o().state,...s,i)))}));e.createElement=r,e.render=yt,e.Fragment=n,"object"==typeof window&&(window.html=dt,window.svg=pt,window.run=bt);export default e;export{M as Component,A as ROUTER_404_EVENT,k as ROUTER_EVENT,e as app,v as customElement,b as event,dt as html,g as on,yt as render,bt as run,pt as svg,b as update};
16
+ * Copyright 2017 Google LLC
17
+ * SPDX-License-Identifier: BSD-3-Clause
18
+ */class gt extends bt{constructor(t){if(super(t),this.it=X,t.type!==vt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===X||null==t)return this.vt=void 0,this.it=t;if(t===Q)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 i=[t];return i.raw=i,this.vt={_$litType$:this.constructor.resultType,strings:i,values:[]}}}gt.directiveName="unsafeHTML",gt.resultType=1;const wt=yt(gt);function mt(t,i,s){i&&("string"==typeof i?tt(K`${wt(i)}`,t):"_$litType$"in i?(t._$litPart$||t.replaceChildren(),tt(i,t)):(c(t,i,s),t._$litPart$=void 0))}const $t=yt(class extends bt{constructor(t){if(super(t),t.type!==pt)throw new Error("${run} can only be used in event handlers")}update(t,i){let{element:s,name:n}=t;const e=()=>{let t=s._component;for(;!t&&s;)s=s.parentElement,t=s&&s._component;return console.assert(!!t,"Component not found."),t},[o,...r]=i;return"string"==typeof o?s[`on${n}`]=t=>e().run(o,...r,t):"function"==typeof o&&(s[`on${n}`]=t=>e().setState(o(e().state,...r,t))),this.render()}render(){return Q}});n.createElement=r,n.render=mt,n.Fragment=e,"object"==typeof window&&(window.html=K,window.svg=B,window.run=$t);export{k as Component,M as ROUTER_404_EVENT,x as ROUTER_EVENT,n as app,m as customElement,n as default,g as event,K as html,w as on,mt as render,$t as run,B as svg,g as update};
121
19
  //# sourceMappingURL=apprun-html.esm.js.map