mates 0.0.7 → 0.0.9

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.
package/dist/index.esm.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
5
  */
6
- const t=globalThis,e=t.trustedTypes,s=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,n="$lit$",i=`lit$${Math.random().toFixed(9).slice(2)}$`,o="?"+i,r=`<${o}>`,l=document,c=()=>l.createComment(""),h=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u="[ \t\n\f\r]",d=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,p=/-->/g,_=/>/g,f=RegExp(`>|${u}(?:([^\\s"'>=/]+)(${u}*=${u}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),$=/'/g,A=/"/g,y=/^(?:script|style|textarea|title)$/i,g=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),v=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),b=new WeakMap,w=l.createTreeWalker(l,129);function C(t,e){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(e):e}let x=class t{constructor({strings:s,_$litType$:l},h){let a;this.parts=[];let u=0,g=0;const v=s.length-1,m=this.parts,[b,x]=((t,e)=>{const s=t.length-1,o=[];let l,c=2===e?"<svg>":3===e?"<math>":"",h=d;for(let e=0;e<s;e++){const s=t[e];let a,u,g=-1,v=0;for(;v<s.length&&(h.lastIndex=v,u=h.exec(s),null!==u);)v=h.lastIndex,h===d?"!--"===u[1]?h=p:void 0!==u[1]?h=_:void 0!==u[2]?(y.test(u[2])&&(l=RegExp("</"+u[2],"g")),h=f):void 0!==u[3]&&(h=f):h===f?">"===u[0]?(h=l??d,g=-1):void 0===u[1]?g=-2:(g=h.lastIndex-u[2].length,a=u[1],h=void 0===u[3]?f:'"'===u[3]?A:$):h===A||h===$?h=f:h===p||h===_?h=d:(h=f,l=void 0);const m=h===f&&t[e+1].startsWith("/>")?" ":"";c+=h===d?s+r:g>=0?(o.push(a),s.slice(0,g)+n+s.slice(g)+i+m):s+i+(-2===g?e:m)}return[C(t,c+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),o]})(s,l);if(this.el=t.createElement(b,h),w.currentNode=this.el.content,2===l||3===l){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(a=w.nextNode())&&m.length<v;){if(1===a.nodeType){if(a.hasAttributes())for(const t of a.getAttributeNames())if(t.endsWith(n)){const e=x[g++],s=a.getAttribute(t).split(i),n=/([.?@])?(.*)/.exec(e);m.push({type:1,index:u,name:n[2],strings:s,ctor:"."===n[1]?N:"?"===n[1]?T:"@"===n[1]?O:S}),a.removeAttribute(t)}else t.startsWith(i)&&(m.push({type:6,index:u}),a.removeAttribute(t));if(y.test(a.tagName)){const t=a.textContent.split(i),s=t.length-1;if(s>0){a.textContent=e?e.emptyScript:"";for(let e=0;e<s;e++)a.append(t[e],c()),w.nextNode(),m.push({type:2,index:++u});a.append(t[s],c())}}}else if(8===a.nodeType)if(a.data===o)m.push({type:2,index:u});else{let t=-1;for(;-1!==(t=a.data.indexOf(i,t+1));)m.push({type:7,index:u}),t+=i.length-1}u++}}static createElement(t,e){const s=l.createElement("template");return s.innerHTML=t,s}};function E(t,e,s=t,n){if(e===v)return e;let i=void 0!==n?s._$Co?.[n]:s._$Cl;const o=h(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(t),i._$AT(t,s,n)),void 0!==n?(s._$Co??=[])[n]=i:s._$Cl=i),void 0!==i&&(e=E(t,i._$AS(t,e.values),i,n)),e}let H=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,n=(t?.creationScope??l).importNode(e,!0);w.currentNode=n;let i=w.nextNode(),o=0,r=0,c=s[0];for(;void 0!==c;){if(o===c.index){let e;2===c.type?e=new M(i,i.nextSibling,this,t):1===c.type?e=new c.ctor(i,c.name,c.strings,this,t):6===c.type&&(e=new j(i,this,t)),this._$AV.push(e),c=s[++r]}o!==c?.index&&(i=w.nextNode(),o++)}return w.currentNode=l,n}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},M=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cv=n?.isConnected??!0}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=E(this,t,e),h(t)?t===m||null==t||""===t?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==v&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>a(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==m&&h(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=x.createElement(C(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new H(n,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=b.get(t.strings);return void 0===e&&b.set(t.strings,e=new x(t)),e}k(e){a(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let n,i=0;for(const o of e)i===s.length?s.push(n=new t(this.O(c()),this.O(c()),this,this.options)):n=s[i],n._$AI(o),i++;i<s.length&&(this._$AR(n&&n._$AB.nextSibling,i),s.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},S=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,i){this.type=1,this._$AH=m,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(t,e=this,s,n){const i=this.strings;let o=!1;if(void 0===i)t=E(this,t,e,0),o=!h(t)||t!==this._$AH&&t!==v,o&&(this._$AH=t);else{const n=t;let r,l;for(t=i[0],r=0;r<i.length-1;r++)l=E(this,n[s+r],e,r),l===v&&(l=this._$AH[r]),o||=!h(l)||l!==this._$AH[r],l===m?t=m:t!==m&&(t+=(l??"")+i[r+1]),this._$AH[r]=l}o&&!n&&this.j(t)}j(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},N=class extends S{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===m?void 0:t}},T=class extends S{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==m)}},O=class extends S{constructor(t,e,s,n,i){super(t,e,s,n,i),this.type=5}_$AI(t,e=this){if((t=E(this,t,e,0)??m)===v)return;const s=this._$AH,n=t===m&&s!==m||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==m&&(s===m||n);n&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},j=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){E(this,t)}};const k=t.litHtmlPolyfillSupport;k?.(x,M),(t.litHtmlVersions??=[]).push("3.3.1");const P=(t,e,s)=>{const n=s?.renderBefore??e;let i=n._$litPart$;if(void 0===i){const t=s?.renderBefore??null;n._$litPart$=i=new M(e.insertBefore(c(),t),t,void 0,s??{})}return i._$AI(t),i};let U=!1;const B=()=>U;const V=new class{constructor(){this.pendingComponents=new Set,this.isScheduled=!1}schedule(t){this.pendingComponents.add(t),this.isScheduled||(this.isScheduled=!0,queueMicrotask(()=>{this.pendingComponents.forEach(t=>t._render()),this.pendingComponents.clear(),this.isScheduled=!1}))}};class R extends HTMLElement{onEachUpdate(t){this.onEachUpdateCallbacks.push(t)}constructor(){super(),this.lastVersion=-1,this.onEachUpdateCallbacks=[],this._isViewLoading=!1,this._props={},this._propsFn=()=>this._props,this._view=null,this._componentFn=null,this._hasMounted=!1,this._renderScheduled=!1,this.componentId=Math.random(),this.cleanups=new Map,this._xviewRender=()=>{}}setter(t){const e=this;return(...s)=>(ut(),V.schedule(e),t(...s))}set props(t){"function"==typeof t?this._propsFn=t:(this._props=t,this._propsFn=()=>this._props),V.schedule(this)}get props(){return this._props}set view(t){if("AsyncFunction"===t.constructor.name||t instanceof Promise)return this._isViewLoading=!0,void("function"==typeof t?t():t).then(t=>{this._isViewLoading=!1,this.view=t.default||t});this.oldView!==t&&(this.oldView=t,this._view=t,this._hasMounted&&(this.cleanups.forEach(t=>t()),this.cleanups.clear(),this._hasMounted=!1),V.schedule(this))}get view(){return this._view}callOnEachUpdate(){this.onEachUpdateCallbacks.forEach(t=>t())}disconnectedCallback(){this.cleanups.forEach(t=>t()),this.cleanups.clear()}addToCleanUps(t,e){this.cleanups.set(t,e)}_render(){if(this._view&&!this._isViewLoading&&!this._renderScheduled){if(!this._hasMounted){const t=this._view;return this._componentFn=D(this,()=>t(this._propsFn,this.setter.bind(this))),void("function"==typeof this._componentFn&&(this._xviewRender=()=>{if(console.log("render",this.lastVersion,at),U=!0,this.lastVersion===at)return;const t=D(this,this._componentFn);P(t,this),this.lastVersion=at,U=!1},this.callOnEachUpdate(),this._xviewRender(),this._hasMounted=!0))}this._xviewRender&&(this.callOnEachUpdate(),this._xviewRender())}}}customElements.define("x-view",R);const I=[];function D(t,e){I.push(t);let s=null;try{s=e()}finally{I.pop()}return s}function L(t=!0){const e=I[I.length-1];if(!e){if(t)throw new Error("getCurrentHost(): No active host context");return null}return e}function W(t,e=!0,s){const n=L(e);if(n&&t&&!n.cleanups.has(t)){const e=(s||t.subscribe)?.(()=>{V.schedule(n)});n.addToCleanUps(t,e)}}function F(t){return W(t,!0),t}function q(t){const e=t,s=L();if(!s)throw new Error("useStore must be called inside a component");if("object"!=typeof e||null===e)throw new Error("state must be an object");return[e,t=>{t(e),ut(),V.schedule(s)}]}function z(t,e){rt();const s=L();e.map(e=>e.subscribe(t)).forEach(t=>s.addToCleanUps(e,t))}function K(t){rt();const e=L();queueMicrotask(()=>{try{const s=t();e&&s&&e.addToCleanUps(t,s)}catch(t){console.error(t)}})}function Z(t){let e=null;const s=new CustomEvent("request-context",{bubbles:!0,composed:!0,detail:{contextClass:t,resolve(t){e=t}}});return L().dispatchEvent(s),e}const X=t=>{rt();L().addToCleanUps(t,t)},J=t=>{if(et)return tt;rt();const e=new Set;try{const s=L(),n=(...n)=>{t(...n),ut(),e.forEach(t=>t()),s&&V.schedule(s)};return n.subscribe=t=>(e.add(t),()=>e.delete(t)),n}catch(t){throw new Error("You can only use setter or _ inside a view or component.")}},Y=J,G=t=>{if(rt(),"object"!=typeof t||null===t)throw new Error("state must be an object");const e=L();if(!e)throw new Error("useState must be called inside a component");return[t,t=>(ut(),V.schedule(e),t?.())]},Q=()=>{rt();const t=L();return e=>{e?.(),ut(),V.schedule(t)}};let tt,et=!1;const st=t=>{et=t},nt=t=>{tt=t},it=()=>et,ot=()=>tt,rt=()=>{if(B())throw Error("atoms, units, bubbles, getters, setters and actions can't be created inside the template function, you can create them in view function. Because template function gets called everytime the view updates.")};let lt=!1,ct=new Set;function ht(t){let e=null,s=1;rt();const n=()=>{if(e)try{let t=!1;for(const[s,n]of e.storeDeps){if(s.__version__!==n){t=!0;break}}if(!t)for(const[s,n]of e.getterDeps){if(s.areVersionsChanged(n)){t=!0;break}}if(!t)return lt&&ct.add(i),e.value}catch(t){console.error(t)}const n=ct,o=lt;let r;ct=new Set,lt=!0;let l=new Map,c=new Map;try{r=t(),ct.forEach(t=>{"function"==typeof t&&"function"==typeof t.areVersionsChanged?c.set(t,t.version):t&&"number"==typeof t.__version__&&l.set(t,t.__version__)}),e={value:r,storeDeps:new Map(l),getterDeps:new Map(c)},s++}catch(t){throw e=null,s++,ct=n,lt=o,t}finally{ct=n,lt=o,o&&ct.add(i)}return r},i=()=>n();return Object.defineProperty(i,"val",{get:()=>n()}),Object.defineProperty(i,"version",{get:()=>s}),Object.defineProperty(i,"areVersionsChanged",{value:t=>{if(!e)return!0;if(void 0!==t){let n=!1;for(const[t,s]of e.storeDeps){if(t.__version__!==s){n=!0;break}}if(!n)for(const[t,s]of e.getterDeps){if(t.areVersionsChanged(s)){n=!0;break}}return!!n||s!==t}for(const[t,s]of e.storeDeps){if(t.__version__!==s)return!0}for(const[t,s]of e.getterDeps){if(t.areVersionsChanged(s))return!0}return!1}}),i}let at=0;const ut=()=>{at++};function dt(t,e=!1){rt();let s=t;e&&_t(s);let n=!1,i=new Set,o=!1,r=1;const l=()=>{r++,n||(n=!0,queueMicrotask(()=>{console.log("notify",i.size),[...i].forEach(t=>{try{t?.()}catch(t){console.error(t)}}),n=!1}))},c=()=>(W(h,!1),lt&&ct.add(h),s),h=()=>c();return h.get=()=>c(),h.set=t=>{if(o)return;const n="function"==typeof t?t(s):t;s=n,e&&_t(s),ut(),l()},h.update=t=>{if(!o&&"object"==typeof s&&null!==s){if(e)throw new Error("update() is not supported for iAtoms or iAtom with deepFreeze enabled");t(s),ut(),l()}},h.subscribe=t=>(i.add(t),()=>i.delete(t)),h.lock=()=>{o=!0},h.unlock=()=>{o=!1},Object.defineProperty(h,"__isAtom___",{value:!0,writable:!1}),Object.defineProperty(h,"val",{get:()=>h.get()}),Object.defineProperty(h,"__version__",{get:()=>(W(h,!1),r)}),Object.defineProperty(h,"toJSON",{value:()=>JSON.stringify(s)}),Object.defineProperty(h,"__id__",{value:Math.random().toString(36).substring(2,15),writable:!1}),h.select=(t,n=void 0)=>{if(!e)throw Error("select() can only be used with iAtoms");let i=n;try{i=t(s)}catch(t){i=n}const o=()=>i,r=L(),l=h.subscribe(()=>{const e=i;try{i=t(s)}catch(t){i=n}e!==i&&r&&V.schedule(r)});return r&&!r?.cleanups?.has?.(o)&&r?.addToCleanUps?.(o,l),o},h}function pt(t){return dt(t,!0)}function _t(t){try{return Object.keys(t).forEach(e=>{"object"!=typeof t[e]||null===t[e]||Object.isFrozen(t[e])||_t(t[e])}),Object.freeze(t)}catch(t){console.error(t)}}function ft(t,e){let s=t,n=null,i=null,o="init",r=!1,l=null;const c=new Set,h=()=>{c.forEach(t=>{try{t()}catch(t){console.error(t)}})},a=()=>{l&&(l.abort(),l=null),r=!1,o="init",h()},u=t=>{W(d,!1),lt&&ct.add(t)},d={getData:()=>(u(d),n),getError:()=>(u(d),i),getStatus:()=>(u(d),o),isLoading:()=>(u(d),r),set(t){s=t},cancel:a,run:async(...t)=>{a(),r=!0,o="loading",l=new AbortController;const c=l;h();try{const a=await s.call(e,...t,c);if(c.signal.aborted||l!==c)return;n=a,i=null,o="success",r=!1,h()}catch(t){if(c.signal.aborted||l!==c)return;n=null,i=t,o="error",r=!1,h()}finally{l===c&&(l=null)}},subscribe:t=>(c.add(t),()=>c.delete(t))};return d}function $t(t,e){let s=t;const n=new Set;let i=null,o=null,r=null,l=null,c=null,h=null,a=null,u=0,d=null,p=null;const _=t=>{n.forEach(e=>{try{e(t)}catch(t){console.error(t)}})},f=(t,e)=>{if(i){return i((...e)=>{const n=s.call(t,...e);return _(n),n},...e)}const n=s.call(t,...e);return _(n),n};function $(...t){const s=this;return e?.debounce?((t,s)=>(o&&clearTimeout(o),r||(r=new Promise(n=>{l=n,o=setTimeout(()=>{const e=f(t,s);n(e),o=null,r=null,l=null},e?.debounce||0)}),r)))(s,t):e?.throttle?((t,s)=>{const n=Date.now(),i=n-u,o=e?.throttle||0;return i>=o?(u=n,f(t,s)):(d=s,p=t,h||(h=new Promise(t=>{a=t,c=setTimeout(()=>{if(d&&p){u=Date.now();const e=f(p,d);t(e),d=null,p=null}c=null,h=null,a=null},o-i)}),h))})(s,t):f(s,t)}return $.subscribe=t=>(n.add(t),()=>n.delete(t)),$.set=t=>{s=t},$.intercept=t=>{i=t},$.cancel=()=>{o&&(clearTimeout(o),o=null),r&&l&&(l(void 0),r=null,l=null),c&&(clearTimeout(c),c=null,u=0,d=null,p=null),h&&a&&(a(void 0),h=null,a=null)},$}const At=t=>{if(it())throw new Error("you can't create a bubble in another bubble.");rt(),st(!0);let e=!1,s=1;const n=t=>(...n)=>{const i=t(...n);return e||(e=!0,queueMicrotask(()=>{e=!1,ut(),s++,o.forEach(t=>t())})),i};nt(n);let i=t(n);const o=new Set,r=()=>(W(r,!1),lt&&ct.add(r),i());return r.__isBubble___=!0,r.__id__=Math.random().toString(36).substring(2,15),Object.defineProperty(r,"__version__",{get:()=>(W(r,!1),s)}),r.reset=()=>{i=t(n)},r.subscribe=t=>(o.add(t),()=>o.delete(t)),st(!1),nt(null),r},yt={path:dt(window.location.pathname),navigateTo(t,e){e?window.history.replaceState({},"",t):window.history.pushState({},"",t),this.path.set(t)},matchPath:t=>gt(t)};window.addEventListener("popstate",()=>{yt.path.set(window.location.pathname)}),window.addEventListener("hashchange",()=>{yt.path.set(window.location.pathname)}),window.addEventListener("navigate",()=>{yt.path.set(window.location.pathname)});const gt=t=>{const e=window.location.pathname;if(e===t)return!0;const s=t.split("/").filter(Boolean),n=e.split("/").filter(Boolean);if(s.length!==n.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],i=n[t];if(e.startsWith(":")){if(!i)return!1}else if(e!==i)return!1}return!0};function vt(t){const e=new Set,s=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];for(;t&&!s.includes(t);){for(const s of Reflect.ownKeys(t))"constructor"!==s&&e.add(s);t=Object.getPrototypeOf(t)}return Array.from(e)}const mt=function(t){if("function"!=typeof t)throw Error("molecule must be a class");let e=new t;vt(e).forEach(t=>{if("function"==typeof e[t]){const s=e[t];e[t]=$t((...t)=>s.apply(e,t))}});const s=()=>e;return s.reset=()=>{const s=new t;vt(s).forEach(t=>{const n=s[t];n.__isAtom___||n.__isUnit___?e[t].set(n()):n.__isBubble___?e[t].reset():e[t]=n})},s},bt=(t,e)=>{const s=L();if(!s)throw new Error("refEffect must be called inside a component");let n=[];t(),n=e(),s.onEachUpdate(()=>{const s=e();n.some((t,e)=>t!==s[e])&&(t(),n=s)})};function wt(t){const e=new Set,s=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];for(;t&&!s.includes(t);){for(const s of Reflect.ownKeys(t))"constructor"!==s&&e.add(s);t=Object.getPrototypeOf(t)}return Array.from(e)}const Ct=function(t){if(null===t||"object"!=typeof t)throw Error("unit must be an object");rt();const e=wt(t),s=()=>(W(s,!1),lt&&ct.add(s),t),n=new Set;s.__isUnit___=!0,Object.defineProperty(s,"__version__",{get:()=>(W(s,!1),1)}),s.subscribe=t=>(n.add(t),()=>{n.delete(t)});let i=!1;return e.forEach(e=>{const s=Object.getOwnPropertyDescriptor(t,e);if(s&&s.get&&"function"==typeof s.get){const n=s.get,i=ht(()=>n.call(t));Object.defineProperty(t,e,{get:function(){return i()},enumerable:s.enumerable,configurable:s.configurable})}if("function"==typeof t[e]&&e.toString().startsWith("_")){const s=t[e];if("AsyncFunction"===s.constructor.name)throw new Error("Async method's name can't start with _. you can use "+e.toString().replace(/^_/,"")+" instead and move set operations to a setter function");t[e]=function(...e){const o=s.apply(t,e);return function(){try{i||(i=!0,queueMicrotask(()=>{ut(),n.forEach(t=>t())}),i=!1)}catch(t){"production"!==process?.env?.NODE_ENV&&console.error(t)}}(),o}}}),Object.preventExtensions(t),s};class xt extends HTMLElement{constructor(){super(...arguments),this._onRequestContext=t=>{const e=t,s=e.detail?.contextClass;if(!s||null==this._value)return;this._value.constructor===s&&(e.stopPropagation(),e.detail.resolve(this._value))}}connectedCallback(){this.addEventListener("request-context",this._onRequestContext)}disconnectedCallback(){this.removeEventListener("request-context",this._onRequestContext)}set value(t){this._value=t}get value(){return this._value}}customElements.define("x-provider",xt);const Et=(t,e={})=>g`<x-view .view=${t} .props=${()=>e}></x-view>`,Ht=(t,e)=>{const s=document.getElementById(e);if(!s)throw new Error(`Element with id ${e} not found`);return P(Et(t,{}),s)},Mt=globalThis,St=Mt.trustedTypes,Nt=St?St.createPolicy("lit-html",{createHTML:t=>t}):void 0,Tt="$lit$",Ot=`lit$${Math.random().toFixed(9).slice(2)}$`,jt="?"+Ot,kt=`<${jt}>`,Pt=document,Ut=()=>Pt.createComment(""),Bt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Vt=Array.isArray,Rt=t=>Vt(t)||"function"==typeof t?.[Symbol.iterator],It="[ \t\n\f\r]",Dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lt=/-->/g,Wt=/>/g,Ft=RegExp(`>|${It}(?:([^\\s"'>=/]+)(${It}*=${It}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),qt=/'/g,zt=/"/g,Kt=/^(?:script|style|textarea|title)$/i,Zt=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),Xt=Symbol.for("lit-noChange"),Jt=Symbol.for("lit-nothing"),Yt=new WeakMap,Gt=Pt.createTreeWalker(Pt,129);function Qt(t,e){if(!Vt(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Nt?Nt.createHTML(e):e}const te=(t,e)=>{const s=t.length-1,n=[];let i,o=2===e?"<svg>":3===e?"<math>":"",r=Dt;for(let e=0;e<s;e++){const s=t[e];let l,c,h=-1,a=0;for(;a<s.length&&(r.lastIndex=a,c=r.exec(s),null!==c);)a=r.lastIndex,r===Dt?"!--"===c[1]?r=Lt:void 0!==c[1]?r=Wt:void 0!==c[2]?(Kt.test(c[2])&&(i=RegExp("</"+c[2],"g")),r=Ft):void 0!==c[3]&&(r=Ft):r===Ft?">"===c[0]?(r=i??Dt,h=-1):void 0===c[1]?h=-2:(h=r.lastIndex-c[2].length,l=c[1],r=void 0===c[3]?Ft:'"'===c[3]?zt:qt):r===zt||r===qt?r=Ft:r===Lt||r===Wt?r=Dt:(r=Ft,i=void 0);const u=r===Ft&&t[e+1].startsWith("/>")?" ":"";o+=r===Dt?s+kt:h>=0?(n.push(l),s.slice(0,h)+Tt+s.slice(h)+Ot+u):s+Ot+(-2===h?e:u)}return[Qt(t,o+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class ee{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let i=0,o=0;const r=t.length-1,l=this.parts,[c,h]=te(t,e);if(this.el=ee.createElement(c,s),Gt.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=Gt.nextNode())&&l.length<r;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(Tt)){const e=h[o++],s=n.getAttribute(t).split(Ot),r=/([.?@])?(.*)/.exec(e);l.push({type:1,index:i,name:r[2],strings:s,ctor:"."===r[1]?re:"?"===r[1]?le:"@"===r[1]?ce:oe}),n.removeAttribute(t)}else t.startsWith(Ot)&&(l.push({type:6,index:i}),n.removeAttribute(t));if(Kt.test(n.tagName)){const t=n.textContent.split(Ot),e=t.length-1;if(e>0){n.textContent=St?St.emptyScript:"";for(let s=0;s<e;s++)n.append(t[s],Ut()),Gt.nextNode(),l.push({type:2,index:++i});n.append(t[e],Ut())}}}else if(8===n.nodeType)if(n.data===jt)l.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(Ot,t+1));)l.push({type:7,index:i}),t+=Ot.length-1}i++}}static createElement(t,e){const s=Pt.createElement("template");return s.innerHTML=t,s}}function se(t,e,s=t,n){if(e===Xt)return e;let i=void 0!==n?s._$Co?.[n]:s._$Cl;const o=Bt(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(t),i._$AT(t,s,n)),void 0!==n?(s._$Co??=[])[n]=i:s._$Cl=i),void 0!==i&&(e=se(t,i._$AS(t,e.values),i,n)),e}let ne=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,n=(t?.creationScope??Pt).importNode(e,!0);Gt.currentNode=n;let i=Gt.nextNode(),o=0,r=0,l=s[0];for(;void 0!==l;){if(o===l.index){let e;2===l.type?e=new ie(i,i.nextSibling,this,t):1===l.type?e=new l.ctor(i,l.name,l.strings,this,t):6===l.type&&(e=new he(i,this,t)),this._$AV.push(e),l=s[++r]}o!==l?.index&&(i=Gt.nextNode(),o++)}return Gt.currentNode=Pt,n}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}};class ie{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=Jt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cv=n?.isConnected??!0}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=se(this,t,e),Bt(t)?t===Jt||null==t||""===t?(this._$AH!==Jt&&this._$AR(),this._$AH=Jt):t!==this._$AH&&t!==Xt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):Rt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Jt&&Bt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Pt.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=ee.createElement(Qt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new ne(n,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=Yt.get(t.strings);return void 0===e&&Yt.set(t.strings,e=new ee(t)),e}k(t){Vt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const i of t)n===e.length?e.push(s=new ie(this.O(Ut()),this.O(Ut()),this,this.options)):s=e[n],s._$AI(i),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class oe{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,i){this.type=1,this._$AH=Jt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=Jt}_$AI(t,e=this,s,n){const i=this.strings;let o=!1;if(void 0===i)t=se(this,t,e,0),o=!Bt(t)||t!==this._$AH&&t!==Xt,o&&(this._$AH=t);else{const n=t;let r,l;for(t=i[0],r=0;r<i.length-1;r++)l=se(this,n[s+r],e,r),l===Xt&&(l=this._$AH[r]),o||=!Bt(l)||l!==this._$AH[r],l===Jt?t=Jt:t!==Jt&&(t+=(l??"")+i[r+1]),this._$AH[r]=l}o&&!n&&this.j(t)}j(t){t===Jt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class re extends oe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Jt?void 0:t}}class le extends oe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Jt)}}class ce extends oe{constructor(t,e,s,n,i){super(t,e,s,n,i),this.type=5}_$AI(t,e=this){if((t=se(this,t,e,0)??Jt)===Xt)return;const s=this._$AH,n=t===Jt&&s!==Jt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==Jt&&(s===Jt||n);n&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class he{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){se(this,t)}}const ae={M:Tt,P:Ot,A:jt,C:1,L:te,R:ne,D:Rt,V:se,I:ie,H:oe,N:le,U:ce,B:re,F:he},ue=Mt.litHtmlPolyfillSupport;ue?.(ee,ie),(Mt.litHtmlVersions??=[]).push("3.3.1");const de=(t,e,s)=>{const n=s?.renderBefore??e;let i=n._$litPart$;if(void 0===i){const t=s?.renderBefore??null;n._$litPart$=i=new ie(e.insertBefore(Ut(),t),t,void 0,s??{})}return i._$AI(t),i
6
+ const t=globalThis,e=t.trustedTypes,s=e?e.createPolicy("lit-html",{createHTML:t=>t}):void 0,n="$lit$",i=`lit$${Math.random().toFixed(9).slice(2)}$`,o="?"+i,r=`<${o}>`,l=document,c=()=>l.createComment(""),h=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u="[ \t\n\f\r]",d=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,p=/-->/g,_=/>/g,f=RegExp(`>|${u}(?:([^\\s"'>=/]+)(${u}*=${u}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),$=/'/g,A=/"/g,y=/^(?:script|style|textarea|title)$/i,g=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),v=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),b=new WeakMap,w=l.createTreeWalker(l,129);function C(t,e){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(e):e}let x=class t{constructor({strings:s,_$litType$:l},h){let a;this.parts=[];let u=0,g=0;const v=s.length-1,m=this.parts,[b,x]=((t,e)=>{const s=t.length-1,o=[];let l,c=2===e?"<svg>":3===e?"<math>":"",h=d;for(let e=0;e<s;e++){const s=t[e];let a,u,g=-1,v=0;for(;v<s.length&&(h.lastIndex=v,u=h.exec(s),null!==u);)v=h.lastIndex,h===d?"!--"===u[1]?h=p:void 0!==u[1]?h=_:void 0!==u[2]?(y.test(u[2])&&(l=RegExp("</"+u[2],"g")),h=f):void 0!==u[3]&&(h=f):h===f?">"===u[0]?(h=l??d,g=-1):void 0===u[1]?g=-2:(g=h.lastIndex-u[2].length,a=u[1],h=void 0===u[3]?f:'"'===u[3]?A:$):h===A||h===$?h=f:h===p||h===_?h=d:(h=f,l=void 0);const m=h===f&&t[e+1].startsWith("/>")?" ":"";c+=h===d?s+r:g>=0?(o.push(a),s.slice(0,g)+n+s.slice(g)+i+m):s+i+(-2===g?e:m)}return[C(t,c+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),o]})(s,l);if(this.el=t.createElement(b,h),w.currentNode=this.el.content,2===l||3===l){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(a=w.nextNode())&&m.length<v;){if(1===a.nodeType){if(a.hasAttributes())for(const t of a.getAttributeNames())if(t.endsWith(n)){const e=x[g++],s=a.getAttribute(t).split(i),n=/([.?@])?(.*)/.exec(e);m.push({type:1,index:u,name:n[2],strings:s,ctor:"."===n[1]?N:"?"===n[1]?T:"@"===n[1]?O:S}),a.removeAttribute(t)}else t.startsWith(i)&&(m.push({type:6,index:u}),a.removeAttribute(t));if(y.test(a.tagName)){const t=a.textContent.split(i),s=t.length-1;if(s>0){a.textContent=e?e.emptyScript:"";for(let e=0;e<s;e++)a.append(t[e],c()),w.nextNode(),m.push({type:2,index:++u});a.append(t[s],c())}}}else if(8===a.nodeType)if(a.data===o)m.push({type:2,index:u});else{let t=-1;for(;-1!==(t=a.data.indexOf(i,t+1));)m.push({type:7,index:u}),t+=i.length-1}u++}}static createElement(t,e){const s=l.createElement("template");return s.innerHTML=t,s}};function E(t,e,s=t,n){if(e===v)return e;let i=void 0!==n?s._$Co?.[n]:s._$Cl;const o=h(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(t),i._$AT(t,s,n)),void 0!==n?(s._$Co??=[])[n]=i:s._$Cl=i),void 0!==i&&(e=E(t,i._$AS(t,e.values),i,n)),e}let H=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,n=(t?.creationScope??l).importNode(e,!0);w.currentNode=n;let i=w.nextNode(),o=0,r=0,c=s[0];for(;void 0!==c;){if(o===c.index){let e;2===c.type?e=new M(i,i.nextSibling,this,t):1===c.type?e=new c.ctor(i,c.name,c.strings,this,t):6===c.type&&(e=new j(i,this,t)),this._$AV.push(e),c=s[++r]}o!==c?.index&&(i=w.nextNode(),o++)}return w.currentNode=l,n}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}},M=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cv=n?.isConnected??!0}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=E(this,t,e),h(t)?t===m||null==t||""===t?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==v&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>a(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==m&&h(this._$AH)?this._$AA.nextSibling.data=t:this.T(l.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=x.createElement(C(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new H(n,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=b.get(t.strings);return void 0===e&&b.set(t.strings,e=new x(t)),e}k(e){a(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let n,i=0;for(const o of e)i===s.length?s.push(n=new t(this.O(c()),this.O(c()),this,this.options)):n=s[i],n._$AI(o),i++;i<s.length&&(this._$AR(n&&n._$AB.nextSibling,i),s.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},S=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,i){this.type=1,this._$AH=m,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(t,e=this,s,n){const i=this.strings;let o=!1;if(void 0===i)t=E(this,t,e,0),o=!h(t)||t!==this._$AH&&t!==v,o&&(this._$AH=t);else{const n=t;let r,l;for(t=i[0],r=0;r<i.length-1;r++)l=E(this,n[s+r],e,r),l===v&&(l=this._$AH[r]),o||=!h(l)||l!==this._$AH[r],l===m?t=m:t!==m&&(t+=(l??"")+i[r+1]),this._$AH[r]=l}o&&!n&&this.j(t)}j(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},N=class extends S{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===m?void 0:t}},T=class extends S{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==m)}},O=class extends S{constructor(t,e,s,n,i){super(t,e,s,n,i),this.type=5}_$AI(t,e=this){if((t=E(this,t,e,0)??m)===v)return;const s=this._$AH,n=t===m&&s!==m||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==m&&(s===m||n);n&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},j=class{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){E(this,t)}};const P=t.litHtmlPolyfillSupport;P?.(x,M),(t.litHtmlVersions??=[]).push("3.3.1");const k=(t,e,s)=>{const n=s?.renderBefore??e;let i=n._$litPart$;if(void 0===i){const t=s?.renderBefore??null;n._$litPart$=i=new M(e.insertBefore(c(),t),t,void 0,s??{})}return i._$AI(t),i};let U=!1;const B=()=>U;const V=new class{constructor(){this.pendingComponents=new Set,this.isScheduled=!1}schedule(t){this.pendingComponents.add(t),this.isScheduled||(this.isScheduled=!0,requestAnimationFrame(()=>{this.pendingComponents.forEach(t=>t._render()),this.pendingComponents.clear(),this.isScheduled=!1}))}};class R extends HTMLElement{onEachUpdate(t){this.onEachUpdateCallbacks.push(t)}constructor(){super(),this.lastVersion=-1,this.onEachUpdateCallbacks=[],this._isViewLoading=!1,this._props={},this._propsFn=()=>this._props,this._view=null,this._componentFn=null,this._hasMounted=!1,this._renderScheduled=!1,this.componentId=Math.random(),this.cleanups=new Map,this._xviewRender=()=>{}}setter(t){const e=this;return(...s)=>(ut(),V.schedule(e),t(...s))}set props(t){"function"==typeof t?this._propsFn=t:(this._props=t,this._propsFn=()=>this._props),V.schedule(this)}get props(){return this._props}set view(t){if("AsyncFunction"===t.constructor.name||t instanceof Promise)return this._isViewLoading=!0,void("function"==typeof t?t():t).then(t=>{this._isViewLoading=!1,this.view=t.default||t});this.oldView!==t&&(this.oldView=t,this._view=t,this._hasMounted&&(this.cleanups.forEach(t=>t()),this.cleanups.clear(),this._hasMounted=!1),V.schedule(this))}get view(){return this._view}callOnEachUpdate(){this.onEachUpdateCallbacks.forEach(t=>t())}disconnectedCallback(){this.cleanups.forEach(t=>t()),this.cleanups.clear()}addToCleanUps(t,e){this.cleanups.set(t,e)}_render(){if(this._view&&!this._isViewLoading&&!this._renderScheduled){if(!this._hasMounted){const t=this._view;return this._componentFn=D(this,()=>t(this._propsFn,this.setter.bind(this))),void("function"==typeof this._componentFn&&(this._xviewRender=()=>{if(console.log("render",this.lastVersion,at),U=!0,this.lastVersion===at)return;const t=D(this,this._componentFn);k(t,this),this.lastVersion=at,U=!1},this.callOnEachUpdate(),this._xviewRender(),this._hasMounted=!0))}this._xviewRender&&(this.callOnEachUpdate(),this._xviewRender())}}}customElements.define("x-view",R);const I=[];function D(t,e){I.push(t);let s=null;try{s=e()}finally{I.pop()}return s}function L(t=!0){const e=I[I.length-1];if(!e){if(t)throw new Error("getCurrentHost(): No active host context");return null}return e}function F(t,e=!0,s){const n=L(e);if(n&&t&&!n.cleanups.has(t)){const e=(s||t.subscribe)?.(()=>{V.schedule(n)});n.addToCleanUps(t,e)}}function W(t){return F(t,!0),t}function q(t){const e=t,s=L();if(!s)throw new Error("useStore must be called inside a component");if("object"!=typeof e||null===e)throw new Error("state must be an object");return[e,t=>{t(e),ut(),V.schedule(s)}]}function z(t,e){rt();const s=L();e.map(e=>e.subscribe(t)).forEach(t=>s.addToCleanUps(e,t))}function K(t){rt();const e=L();queueMicrotask(()=>{try{const s=t();e&&s&&e.addToCleanUps(t,s)}catch(t){console.error(t)}})}function Z(t){let e=null;const s=new CustomEvent("request-context",{bubbles:!0,composed:!0,detail:{contextClass:t,resolve(t){e=t}}});return L().dispatchEvent(s),e}const X=t=>{rt();L().addToCleanUps(t,t)},J=t=>{if(et)return tt;rt();const e=new Set;try{const s=L(),n=(...n)=>{const i=t(...n);return ut(),e.forEach(t=>t()),s&&V.schedule(s),i};return n.subscribe=t=>(e.add(t),()=>e.delete(t)),n}catch(t){throw new Error("You can only use setter or _ inside a view or component.")}},Y=J,G=t=>{if(rt(),"object"!=typeof t||null===t)throw new Error("state must be an object");const e=L();if(!e)throw new Error("useState must be called inside a component");return[t,t=>(ut(),V.schedule(e),t?.())]},Q=()=>{rt();const t=L();return e=>{e?.(),ut(),V.schedule(t)}};let tt,et=!1;const st=t=>{et=t},nt=t=>{tt=t},it=()=>et,ot=()=>tt,rt=()=>{if(B())throw Error("atoms, units, bubbles, getters, setters and actions can't be created inside the template function, you can create them in view function. Because template function gets called everytime the view updates.")};let lt=!1,ct=new Set;function ht(t){let e=null,s=1;rt();const n=()=>{if(e)try{let t=!1;for(const[s,n]of e.storeDeps){if(s.__version__!==n){t=!0;break}}if(!t)for(const[s,n]of e.getterDeps){if(s.areVersionsChanged(n)){t=!0;break}}if(!t)return lt&&ct.add(i),e.value}catch(t){console.error(t)}const n=ct,o=lt;let r;ct=new Set,lt=!0;let l=new Map,c=new Map;try{r=t(),ct.forEach(t=>{"function"==typeof t&&"function"==typeof t.areVersionsChanged?c.set(t,t.version):t&&"number"==typeof t.__version__&&l.set(t,t.__version__)}),e={value:r,storeDeps:new Map(l),getterDeps:new Map(c)},s++}catch(t){throw e=null,s++,ct=n,lt=o,t}finally{ct=n,lt=o,o&&ct.add(i)}return r},i=()=>n();return Object.defineProperty(i,"val",{get:()=>n()}),Object.defineProperty(i,"version",{get:()=>s}),Object.defineProperty(i,"areVersionsChanged",{value:t=>{if(!e)return!0;if(void 0!==t){let n=!1;for(const[t,s]of e.storeDeps){if(t.__version__!==s){n=!0;break}}if(!n)for(const[t,s]of e.getterDeps){if(t.areVersionsChanged(s)){n=!0;break}}return!!n||s!==t}for(const[t,s]of e.storeDeps){if(t.__version__!==s)return!0}for(const[t,s]of e.getterDeps){if(t.areVersionsChanged(s))return!0}return!1}}),i}let at=0;const ut=()=>{at++};function dt(t,e=!1){rt();let s=t;e&&_t(s);let n=!1,i=new Set,o=!1,r=1;const l=()=>{r++,n||(n=!0,queueMicrotask(()=>{console.log("notify",i.size),[...i].forEach(t=>{try{t?.()}catch(t){console.error(t)}}),n=!1}))},c=()=>(F(h,!1),lt&&ct.add(h),s),h=()=>c();return h.get=()=>c(),h.set=t=>{if(o)return;const n="function"==typeof t?t(s):t;s=n,e&&_t(s),ut(),l()},h.update=t=>{if(!o&&"object"==typeof s&&null!==s){if(e)throw new Error("update() is not supported for iAtoms or iAtom with deepFreeze enabled");t(s),ut(),l()}},h.subscribe=t=>(i.add(t),()=>i.delete(t)),h.lock=()=>{o=!0},h.unlock=()=>{o=!1},Object.defineProperty(h,"__isAtom___",{value:!0,writable:!1}),Object.defineProperty(h,"val",{get:()=>h.get()}),Object.defineProperty(h,"__version__",{get:()=>(F(h,!1),r)}),Object.defineProperty(h,"toJSON",{value:()=>JSON.stringify(s)}),Object.defineProperty(h,"__id__",{value:Math.random().toString(36).substring(2,15),writable:!1}),h.select=(t,n=void 0)=>{if(!e)throw Error("select() can only be used with iAtoms");let i=n;try{i=t(s)}catch(t){i=n}const o=()=>i,r=L(),l=h.subscribe(()=>{const e=i;try{i=t(s)}catch(t){i=n}e!==i&&r&&V.schedule(r)});return r&&!r?.cleanups?.has?.(o)&&r?.addToCleanUps?.(o,l),o},h}function pt(t){return dt(t,!0)}function _t(t){try{return Object.keys(t).forEach(e=>{"object"!=typeof t[e]||null===t[e]||Object.isFrozen(t[e])||_t(t[e])}),Object.freeze(t)}catch(t){console.error(t)}}function ft(t,e){let s=t,n=null,i=null,o="init",r=!1,l=null;const c=new Set,h=()=>{c.forEach(t=>{try{t()}catch(t){console.error(t)}})},a=()=>{l&&(l.abort(),l=null),r=!1,o="init",h()},u=t=>{F(d,!1),lt&&ct.add(t)},d={getData:()=>(u(d),n),getError:()=>(u(d),i),getStatus:()=>(u(d),o),isLoading:()=>(u(d),r),set(t){s=t},cancel:a,run:async(...t)=>{a(),r=!0,o="loading",l=new AbortController;const c=l;h();try{const a=await s.call(e,...t,c);if(c.signal.aborted||l!==c)return;n=a,i=null,o="success",r=!1,h()}catch(t){if(c.signal.aborted||l!==c)return;n=null,i=t,o="error",r=!1,h()}finally{l===c&&(l=null)}},subscribe:t=>(c.add(t),()=>c.delete(t))};return d}function $t(t,e){let s=t;const n=new Set;let i=null,o=null,r=null,l=null,c=null,h=null,a=null,u=0,d=null,p=null;const _=t=>{n.forEach(e=>{try{e(t)}catch(t){console.error(t)}})},f=(t,e)=>{if(i){return i((...e)=>{const n=s.call(t,...e);return _(n),n},...e)}const n=s.call(t,...e);return _(n),n};function $(...t){const s=this;return e?.debounce?((t,s)=>(o&&clearTimeout(o),r||(r=new Promise(n=>{l=n,o=setTimeout(()=>{const e=f(t,s);n(e),o=null,r=null,l=null},e?.debounce||0)}),r)))(s,t):e?.throttle?((t,s)=>{const n=Date.now(),i=n-u,o=e?.throttle||0;return i>=o?(u=n,f(t,s)):(d=s,p=t,h||(h=new Promise(t=>{a=t,c=setTimeout(()=>{if(d&&p){u=Date.now();const e=f(p,d);t(e),d=null,p=null}c=null,h=null,a=null},o-i)}),h))})(s,t):f(s,t)}return $.subscribe=t=>(n.add(t),()=>n.delete(t)),$.set=t=>{s=t},$.intercept=t=>{i=t},$.cancel=()=>{o&&(clearTimeout(o),o=null),r&&l&&(l(void 0),r=null,l=null),c&&(clearTimeout(c),c=null,u=0,d=null,p=null),h&&a&&(a(void 0),h=null,a=null)},$}const At=t=>{if(it())throw new Error("you can't create a bubble in another bubble.");rt(),st(!0);let e=!1,s=1;const n=t=>(...n)=>{const i=t(...n);return e||(e=!0,queueMicrotask(()=>{e=!1,ut(),s++,o.forEach(t=>t())})),i};nt(n);let i=t(n);const o=new Set,r=()=>(F(r,!1),lt&&ct.add(r),i());return r.__isBubble___=!0,r.__id__=Math.random().toString(36).substring(2,15),Object.defineProperty(r,"__version__",{get:()=>(F(r,!1),s)}),r.reset=()=>{i=t(n)},r.subscribe=t=>(o.add(t),()=>o.delete(t)),st(!1),nt(null),r},yt={get path(){return this.pathAtom.get()},pathAtom:dt(window.location.pathname),navigateTo(t,e){e?window.history.replaceState({},"",t):window.history.pushState({},"",t),this.pathAtom.set(t)},matchPath:t=>gt(t)};window.addEventListener("popstate",()=>{yt.pathAtom.set(window.location.pathname)}),window.addEventListener("hashchange",()=>{yt.pathAtom.set(window.location.pathname)}),window.addEventListener("navigate",()=>{yt.pathAtom.set(window.location.pathname)});const gt=t=>{const e=window.location.pathname;if(e===t)return!0;const s=t.split("/").filter(Boolean),n=e.split("/").filter(Boolean);if(s.length!==n.length)return!1;for(let t=0;t<s.length;t++){const e=s[t],i=n[t];if(e.startsWith(":")){if(!i)return!1}else if(e!==i)return!1}return!0};function vt(t){const e=new Set,s=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];for(;t&&!s.includes(t);){for(const s of Reflect.ownKeys(t))"constructor"!==s&&e.add(s);t=Object.getPrototypeOf(t)}return Array.from(e)}const mt=function(t){if("function"!=typeof t)throw Error("molecule must be a class");let e=new t;vt(e).forEach(t=>{if("function"==typeof e[t]){const s=e[t];e[t]=$t((...t)=>s.apply(e,t))}});const s=()=>e;return s.reset=()=>{const s=new t;vt(s).forEach(t=>{const n=s[t];n.__isAtom___||n.__isUnit___?e[t].set(n()):n.__isBubble___?e[t].reset():e[t]=n})},s},bt=(t,e)=>{const s=L();if(!s)throw new Error("refEffect must be called inside a component");let n=[];t(),n=e(),s.onEachUpdate(()=>{const s=e();n.some((t,e)=>t!==s[e])&&(t(),n=s)})};function wt(t){const e=new Set,s=[Object.prototype,Array.prototype,Function.prototype,String.prototype,Number.prototype,Boolean.prototype,Symbol.prototype,Date.prototype,RegExp.prototype,Map.prototype,Set.prototype,WeakMap.prototype,WeakSet.prototype,Promise.prototype,Error.prototype];for(;t&&!s.includes(t);){for(const s of Reflect.ownKeys(t))"constructor"!==s&&e.add(s);t=Object.getPrototypeOf(t)}return Array.from(e)}const Ct=function(t){if(null===t||"object"!=typeof t)throw Error("unit must be an object");rt();const e=wt(t),s=()=>(F(s,!1),lt&&ct.add(s),t),n=new Set;s.__isUnit___=!0,Object.defineProperty(s,"__version__",{get:()=>(F(s,!1),1)}),s.subscribe=t=>(n.add(t),()=>{n.delete(t)});let i=!1;return e.forEach(e=>{const s=Object.getOwnPropertyDescriptor(t,e);if(s&&s.get&&"function"==typeof s.get){const n=s.get,i=ht(()=>n.call(t));Object.defineProperty(t,e,{get:function(){return i()},enumerable:s.enumerable,configurable:s.configurable})}if("function"==typeof t[e]&&e.toString().startsWith("_")){const s=t[e];if("AsyncFunction"===s.constructor.name)throw new Error("Async method's name can't start with _. you can use "+e.toString().replace(/^_/,"")+" instead and move set operations to a setter function");t[e]=function(...e){const o=s.apply(t,e);return function(){try{i||(i=!0,queueMicrotask(()=>{ut(),n.forEach(t=>t())}),i=!1)}catch(t){"production"!==process?.env?.NODE_ENV&&console.error(t)}}(),o}}}),Object.preventExtensions(t),s};class xt extends HTMLElement{constructor(){super(...arguments),this._onRequestContext=t=>{const e=t,s=e.detail?.contextClass;if(!s||null==this._value)return;this._value.constructor===s&&(e.stopPropagation(),e.detail.resolve(this._value))}}connectedCallback(){this.addEventListener("request-context",this._onRequestContext)}disconnectedCallback(){this.removeEventListener("request-context",this._onRequestContext)}set value(t){this._value=t}get value(){return this._value}}customElements.define("x-provider",xt);const Et=(t,e={})=>g`<x-view .view=${t} .props=${()=>e}></x-view>`,Ht=(t,e)=>{const s=document.getElementById(e);if(!s)throw new Error(`Element with id ${e} not found`);return k(Et(t,{}),s)},Mt=globalThis,St=Mt.trustedTypes,Nt=St?St.createPolicy("lit-html",{createHTML:t=>t}):void 0,Tt="$lit$",Ot=`lit$${Math.random().toFixed(9).slice(2)}$`,jt="?"+Ot,Pt=`<${jt}>`,kt=document,Ut=()=>kt.createComment(""),Bt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Vt=Array.isArray,Rt=t=>Vt(t)||"function"==typeof t?.[Symbol.iterator],It="[ \t\n\f\r]",Dt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lt=/-->/g,Ft=/>/g,Wt=RegExp(`>|${It}(?:([^\\s"'>=/]+)(${It}*=${It}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),qt=/'/g,zt=/"/g,Kt=/^(?:script|style|textarea|title)$/i,Zt=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),Xt=Symbol.for("lit-noChange"),Jt=Symbol.for("lit-nothing"),Yt=new WeakMap,Gt=kt.createTreeWalker(kt,129);function Qt(t,e){if(!Vt(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Nt?Nt.createHTML(e):e}const te=(t,e)=>{const s=t.length-1,n=[];let i,o=2===e?"<svg>":3===e?"<math>":"",r=Dt;for(let e=0;e<s;e++){const s=t[e];let l,c,h=-1,a=0;for(;a<s.length&&(r.lastIndex=a,c=r.exec(s),null!==c);)a=r.lastIndex,r===Dt?"!--"===c[1]?r=Lt:void 0!==c[1]?r=Ft:void 0!==c[2]?(Kt.test(c[2])&&(i=RegExp("</"+c[2],"g")),r=Wt):void 0!==c[3]&&(r=Wt):r===Wt?">"===c[0]?(r=i??Dt,h=-1):void 0===c[1]?h=-2:(h=r.lastIndex-c[2].length,l=c[1],r=void 0===c[3]?Wt:'"'===c[3]?zt:qt):r===zt||r===qt?r=Wt:r===Lt||r===Ft?r=Dt:(r=Wt,i=void 0);const u=r===Wt&&t[e+1].startsWith("/>")?" ":"";o+=r===Dt?s+Pt:h>=0?(n.push(l),s.slice(0,h)+Tt+s.slice(h)+Ot+u):s+Ot+(-2===h?e:u)}return[Qt(t,o+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class ee{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let i=0,o=0;const r=t.length-1,l=this.parts,[c,h]=te(t,e);if(this.el=ee.createElement(c,s),Gt.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=Gt.nextNode())&&l.length<r;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(Tt)){const e=h[o++],s=n.getAttribute(t).split(Ot),r=/([.?@])?(.*)/.exec(e);l.push({type:1,index:i,name:r[2],strings:s,ctor:"."===r[1]?re:"?"===r[1]?le:"@"===r[1]?ce:oe}),n.removeAttribute(t)}else t.startsWith(Ot)&&(l.push({type:6,index:i}),n.removeAttribute(t));if(Kt.test(n.tagName)){const t=n.textContent.split(Ot),e=t.length-1;if(e>0){n.textContent=St?St.emptyScript:"";for(let s=0;s<e;s++)n.append(t[s],Ut()),Gt.nextNode(),l.push({type:2,index:++i});n.append(t[e],Ut())}}}else if(8===n.nodeType)if(n.data===jt)l.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(Ot,t+1));)l.push({type:7,index:i}),t+=Ot.length-1}i++}}static createElement(t,e){const s=kt.createElement("template");return s.innerHTML=t,s}}function se(t,e,s=t,n){if(e===Xt)return e;let i=void 0!==n?s._$Co?.[n]:s._$Cl;const o=Bt(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(t),i._$AT(t,s,n)),void 0!==n?(s._$Co??=[])[n]=i:s._$Cl=i),void 0!==i&&(e=se(t,i._$AS(t,e.values),i,n)),e}let ne=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,n=(t?.creationScope??kt).importNode(e,!0);Gt.currentNode=n;let i=Gt.nextNode(),o=0,r=0,l=s[0];for(;void 0!==l;){if(o===l.index){let e;2===l.type?e=new ie(i,i.nextSibling,this,t):1===l.type?e=new l.ctor(i,l.name,l.strings,this,t):6===l.type&&(e=new he(i,this,t)),this._$AV.push(e),l=s[++r]}o!==l?.index&&(i=Gt.nextNode(),o++)}return Gt.currentNode=kt,n}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}};class ie{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=Jt,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cv=n?.isConnected??!0}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=se(this,t,e),Bt(t)?t===Jt||null==t||""===t?(this._$AH!==Jt&&this._$AR(),this._$AH=Jt):t!==this._$AH&&t!==Xt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):Rt(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==Jt&&Bt(this._$AH)?this._$AA.nextSibling.data=t:this.T(kt.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=ee.createElement(Qt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new ne(n,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=Yt.get(t.strings);return void 0===e&&Yt.set(t.strings,e=new ee(t)),e}k(t){Vt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const i of t)n===e.length?e.push(s=new ie(this.O(Ut()),this.O(Ut()),this,this.options)):s=e[n],s._$AI(i),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class oe{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,i){this.type=1,this._$AH=Jt,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=Jt}_$AI(t,e=this,s,n){const i=this.strings;let o=!1;if(void 0===i)t=se(this,t,e,0),o=!Bt(t)||t!==this._$AH&&t!==Xt,o&&(this._$AH=t);else{const n=t;let r,l;for(t=i[0],r=0;r<i.length-1;r++)l=se(this,n[s+r],e,r),l===Xt&&(l=this._$AH[r]),o||=!Bt(l)||l!==this._$AH[r],l===Jt?t=Jt:t!==Jt&&(t+=(l??"")+i[r+1]),this._$AH[r]=l}o&&!n&&this.j(t)}j(t){t===Jt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class re extends oe{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Jt?void 0:t}}class le extends oe{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Jt)}}class ce extends oe{constructor(t,e,s,n,i){super(t,e,s,n,i),this.type=5}_$AI(t,e=this){if((t=se(this,t,e,0)??Jt)===Xt)return;const s=this._$AH,n=t===Jt&&s!==Jt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==Jt&&(s===Jt||n);n&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class he{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){se(this,t)}}const ae={M:Tt,P:Ot,A:jt,C:1,L:te,R:ne,D:Rt,V:se,I:ie,H:oe,N:le,U:ce,B:re,F:he},ue=Mt.litHtmlPolyfillSupport;ue?.(ee,ie),(Mt.litHtmlVersions??=[]).push("3.3.1");const de=(t,e,s)=>{const n=s?.renderBefore??e;let i=n._$litPart$;if(void 0===i){const t=s?.renderBefore??null;n._$litPart$=i=new ie(e.insertBefore(Ut(),t),t,void 0,s??{})}return i._$AI(t),i
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
@@ -13,7 +13,7 @@ const t=globalThis,e=t.trustedTypes,s=e?e.createPolicy("lit-html",{createHTML:t=
13
13
  * @license
14
14
  * Copyright 2020 Google LLC
15
15
  * SPDX-License-Identifier: BSD-3-Clause
16
- */const{I:ge}=ae,ve=(t,e)=>void 0===e?void 0!==t?._$litType$:t?._$litType$===e,me=t=>void 0===t.strings,be=()=>document.createComment(""),we=(t,e,s)=>{const n=t._$AA.parentNode,i=void 0===e?t._$AB:e._$AA;if(void 0===s){const e=n.insertBefore(be(),i),o=n.insertBefore(be(),i);s=new ge(e,o,t,t.options)}else{const e=s._$AB.nextSibling,o=s._$AM,r=o!==t;if(r){let e;s._$AQ?.(t),s._$AM=t,void 0!==s._$AP&&(e=t._$AU)!==o._$AU&&s._$AP(e)}if(e!==i||r){let t=s._$AA;for(;t!==e;){const e=t.nextSibling;n.insertBefore(t,i),t=e}}}return s},Ce=(t,e,s=t)=>(t._$AI(e,s),t),xe={},Ee=(t,e=xe)=>t._$AH=e,He=t=>t._$AH,Me=t=>{t._$AR(),t._$AA.remove()},Se=t=>{t._$AR()},Ne=(t,e,s)=>{const n=new Map;for(let i=e;i<=s;i++)n.set(t[i],i);return n},Te=Ae(class extends ye{constructor(t){if(super(t),t.type!==_e)throw Error("repeat() can only be used in text expressions")}dt(t,e,s){let n;void 0===s?s=e:void 0!==e&&(n=e);const i=[],o=[];let r=0;for(const e of t)i[r]=n?n(e,r):r,o[r]=s(e,r),r++;return{values:o,keys:i}}render(t,e,s){return this.dt(t,e,s).values}update(t,[e,s,n]){const i=He(t),{values:o,keys:r}=this.dt(e,s,n);if(!Array.isArray(i))return this.ut=r,o;const l=this.ut??=[],c=[];let h,a,u=0,d=i.length-1,p=0,_=o.length-1;for(;u<=d&&p<=_;)if(null===i[u])u++;else if(null===i[d])d--;else if(l[u]===r[p])c[p]=Ce(i[u],o[p]),u++,p++;else if(l[d]===r[_])c[_]=Ce(i[d],o[_]),d--,_--;else if(l[u]===r[_])c[_]=Ce(i[u],o[_]),we(t,c[_+1],i[u]),u++,_--;else if(l[d]===r[p])c[p]=Ce(i[d],o[p]),we(t,i[u],i[d]),d--,p++;else if(void 0===h&&(h=Ne(r,p,_),a=Ne(l,u,d)),h.has(l[u]))if(h.has(l[d])){const e=a.get(r[p]),s=void 0!==e?i[e]:null;if(null===s){const e=we(t,i[u]);Ce(e,o[p]),c[p]=e}else c[p]=Ce(s,o[p]),we(t,i[u],s),i[e]=null;p++}else Me(i[d]),d--;else Me(i[u]),u++;for(;p<=_;){const e=we(t,c[_+1]);Ce(e,o[p]),c[p++]=e}for(;u<=d;){const t=i[u++];null!==t&&Me(t)}return this.ut=r,Ee(t,c),Xt}}),Oe={},je=Ae(class extends ye{constructor(){super(...arguments),this.ot=Oe}render(t,e){return e()}update(t,[e,s]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every((t,e)=>t===this.ot[e]))return Xt}else if(this.ot===e)return Xt;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,s)}}),ke="important",Pe=" !"+ke,Ue=Ae(class extends ye{constructor(t){if(super(t),t.type!==pe||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,s)=>{const n=t[s];return null==n?e:e+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(t,[e]){const{style:s}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in e){const n=e[t];if(null!=n){this.ft.add(t);const e="string"==typeof n&&n.endsWith(Pe);t.includes("-")||e?s.setProperty(t,e?n.slice(0,-11):n,e?ke:""):s[t]=n}}return Xt}}),Be=Ae(class extends ye{constructor(t){if(super(t),t.type!==pe||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const s=t.element.classList;for(const t of this.st)t in e||(s.remove(t),this.st.delete(t));for(const t in e){const n=!!e[t];n===this.st.has(t)||this.nt?.has(t)||(n?(s.add(t),this.st.add(t)):(s.remove(t),this.st.delete(t)))}return Xt}});
16
+ */const{I:ge}=ae,ve=(t,e)=>void 0===e?void 0!==t?._$litType$:t?._$litType$===e,me=t=>void 0===t.strings,be=()=>document.createComment(""),we=(t,e,s)=>{const n=t._$AA.parentNode,i=void 0===e?t._$AB:e._$AA;if(void 0===s){const e=n.insertBefore(be(),i),o=n.insertBefore(be(),i);s=new ge(e,o,t,t.options)}else{const e=s._$AB.nextSibling,o=s._$AM,r=o!==t;if(r){let e;s._$AQ?.(t),s._$AM=t,void 0!==s._$AP&&(e=t._$AU)!==o._$AU&&s._$AP(e)}if(e!==i||r){let t=s._$AA;for(;t!==e;){const e=t.nextSibling;n.insertBefore(t,i),t=e}}}return s},Ce=(t,e,s=t)=>(t._$AI(e,s),t),xe={},Ee=(t,e=xe)=>t._$AH=e,He=t=>t._$AH,Me=t=>{t._$AR(),t._$AA.remove()},Se=t=>{t._$AR()},Ne=(t,e,s)=>{const n=new Map;for(let i=e;i<=s;i++)n.set(t[i],i);return n},Te=Ae(class extends ye{constructor(t){if(super(t),t.type!==_e)throw Error("repeat() can only be used in text expressions")}dt(t,e,s){let n;void 0===s?s=e:void 0!==e&&(n=e);const i=[],o=[];let r=0;for(const e of t)i[r]=n?n(e,r):r,o[r]=s(e,r),r++;return{values:o,keys:i}}render(t,e,s){return this.dt(t,e,s).values}update(t,[e,s,n]){const i=He(t),{values:o,keys:r}=this.dt(e,s,n);if(!Array.isArray(i))return this.ut=r,o;const l=this.ut??=[],c=[];let h,a,u=0,d=i.length-1,p=0,_=o.length-1;for(;u<=d&&p<=_;)if(null===i[u])u++;else if(null===i[d])d--;else if(l[u]===r[p])c[p]=Ce(i[u],o[p]),u++,p++;else if(l[d]===r[_])c[_]=Ce(i[d],o[_]),d--,_--;else if(l[u]===r[_])c[_]=Ce(i[u],o[_]),we(t,c[_+1],i[u]),u++,_--;else if(l[d]===r[p])c[p]=Ce(i[d],o[p]),we(t,i[u],i[d]),d--,p++;else if(void 0===h&&(h=Ne(r,p,_),a=Ne(l,u,d)),h.has(l[u]))if(h.has(l[d])){const e=a.get(r[p]),s=void 0!==e?i[e]:null;if(null===s){const e=we(t,i[u]);Ce(e,o[p]),c[p]=e}else c[p]=Ce(s,o[p]),we(t,i[u],s),i[e]=null;p++}else Me(i[d]),d--;else Me(i[u]),u++;for(;p<=_;){const e=we(t,c[_+1]);Ce(e,o[p]),c[p++]=e}for(;u<=d;){const t=i[u++];null!==t&&Me(t)}return this.ut=r,Ee(t,c),Xt}}),Oe={},je=Ae(class extends ye{constructor(){super(...arguments),this.ot=Oe}render(t,e){return e()}update(t,[e,s]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every((t,e)=>t===this.ot[e]))return Xt}else if(this.ot===e)return Xt;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,s)}}),Pe="important",ke=" !"+Pe,Ue=Ae(class extends ye{constructor(t){if(super(t),t.type!==pe||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce((e,s)=>{const n=t[s];return null==n?e:e+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`},"")}update(t,[e]){const{style:s}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?s.removeProperty(t):s[t]=null);for(const t in e){const n=e[t];if(null!=n){this.ft.add(t);const e="string"==typeof n&&n.endsWith(ke);t.includes("-")||e?s.setProperty(t,e?n.slice(0,-11):n,e?Pe:""):s[t]=n}}return Xt}}),Be=Ae(class extends ye{constructor(t){if(super(t),t.type!==pe||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(t=>""!==t)));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const s=t.element.classList;for(const t of this.st)t in e||(s.remove(t),this.st.delete(t));for(const t in e){const n=!!e[t];n===this.st.has(t)||this.nt?.has(t)||(n?(s.add(t),this.st.add(t)):(s.remove(t),this.st.delete(t)))}return Xt}});
17
17
  /**
18
18
  * @license
19
19
  * Copyright 2017 Google LLC
@@ -29,12 +29,12 @@ function Ve(t,e,s){return t?e(t):s?.(t)}
29
29
  * @license
30
30
  * Copyright 2018 Google LLC
31
31
  * SPDX-License-Identifier: BSD-3-Clause
32
- */const Re=t=>t??Jt,Ie=Ae(class extends ye{constructor(t){if(super(t),t.type!==fe&&t.type!==pe&&t.type!==$e)throw Error("The `live` directive is not allowed on child or event bindings");if(!me(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===Xt||e===Jt)return e;const s=t.element,n=t.name;if(t.type===fe){if(e===s[n])return Xt}else if(t.type===$e){if(!!e===s.hasAttribute(n))return Xt}else if(t.type===pe&&s.getAttribute(n)===e+"")return Xt;return Ee(t),e}}),De=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),De(t,e);return!0},Le=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},We=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),ze(e)}};
32
+ */const Re=t=>t??Jt,Ie=Ae(class extends ye{constructor(t){if(super(t),t.type!==fe&&t.type!==pe&&t.type!==$e)throw Error("The `live` directive is not allowed on child or event bindings");if(!me(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===Xt||e===Jt)return e;const s=t.element,n=t.name;if(t.type===fe){if(e===s[n])return Xt}else if(t.type===$e){if(!!e===s.hasAttribute(n))return Xt}else if(t.type===pe&&s.getAttribute(n)===e+"")return Xt;return Ee(t),e}}),De=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),De(t,e);return!0},Le=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},Fe=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),ze(e)}};
33
33
  /**
34
34
  * @license
35
35
  * Copyright 2020 Google LLC
36
36
  * SPDX-License-Identifier: BSD-3-Clause
37
- */function Fe(t){void 0!==this._$AN?(Le(this),this._$AM=t,We(this)):this._$AM=t}function qe(t,e=!1,s=0){const n=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(e)if(Array.isArray(n))for(let t=s;t<n.length;t++)De(n[t],!1),Le(n[t]);else null!=n&&(De(n,!1),Le(n));else De(this,t)}const ze=t=>{t.type==_e&&(t._$AP??=qe,t._$AQ??=Fe)};class Ke extends ye{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),We(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(De(this,t),Le(this))}setValue(t){if(me(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}
37
+ */function We(t){void 0!==this._$AN?(Le(this),this._$AM=t,Fe(this)):this._$AM=t}function qe(t,e=!1,s=0){const n=this._$AH,i=this._$AN;if(void 0!==i&&0!==i.size)if(e)if(Array.isArray(n))for(let t=s;t<n.length;t++)De(n[t],!1),Le(n[t]);else null!=n&&(De(n,!1),Le(n));else De(this,t)}const ze=t=>{t.type==_e&&(t._$AP??=qe,t._$AQ??=We)};class Ke extends ye{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),Fe(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(De(this,t),Le(this))}setValue(t){if(me(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}
38
38
  /**
39
39
  * @license
40
40
  * Copyright 2021 Google LLC
@@ -70,5 +70,5 @@ let ss=class extends Ke{constructor(){super(...arguments),this._$CK=new Ze(this)
70
70
  * @license
71
71
  * Copyright 2017 Google LLC
72
72
  * SPDX-License-Identifier: BSD-3-Clause
73
- */const rs=Ae(class extends ss{constructor(t){if(super(t),t.type!==_e)throw Error("asyncAppend can only be used in child expressions")}update(t,e){return this._$Ctt=t,super.update(t,e)}commitValue(t,e){0===e&&Se(this._$Ctt);const s=we(this._$Ctt);Ce(s,t)}});export{J as _,$t as action,rs as asyncAppend,ft as asyncAtom,ns as asyncReplace,dt as atom,At as bubble,es as cache,Be as classMap,_t as df,L as getCurrentHost,wt as getStoreProps,B as getTemplateIsRunning,it as getbubbleInProgress,ot as getbubblesSetter,ht as getter,V as globalScheduler,at as globalVersion,je as guard,Zt as html,pt as iAtom,Re as ifDefined,ut as incrGlobalVersion,gt as isPathMatching,is as join,Qe as keyed,Ie as live,yt as location,mt as molecule,os as range,de as render,Ht as renderView,Te as repeat,rt as safetyCheck,st as setBubbleInProgress,nt as setBubblesSetter,Y as setter,Ue as styleMap,W as subscribe,Ct as unit,Ge as until,Z as useContext,Q as useForceUpdate,q as useMutable,K as useOnMount,X as useOnUnmount,bt as useRefEffect,G as useState,F as useStore,z as useSubscribe,Q as useUpdate,Et as view,Ve as when,D as withHost};
73
+ */const rs=Ae(class extends ss{constructor(t){if(super(t),t.type!==_e)throw Error("asyncAppend can only be used in child expressions")}update(t,e){return this._$Ctt=t,super.update(t,e)}commitValue(t,e){0===e&&Se(this._$Ctt);const s=we(this._$Ctt);Ce(s,t)}});export{J as _,$t as action,rs as asyncAppend,ft as asyncAtom,ns as asyncReplace,dt as atom,At as bubble,es as cache,Be as classMap,_t as df,L as getCurrentHost,wt as getStoreProps,B as getTemplateIsRunning,it as getbubbleInProgress,ot as getbubblesSetter,ht as getter,V as globalScheduler,at as globalVersion,je as guard,Zt as html,pt as iAtom,Re as ifDefined,ut as incrGlobalVersion,gt as isPathMatching,is as join,Qe as keyed,Ie as live,yt as location,mt as molecule,os as range,de as render,Ht as renderView,Te as repeat,rt as safetyCheck,st as setBubbleInProgress,nt as setBubblesSetter,Y as setter,Ue as styleMap,F as subscribe,Ct as unit,Ge as until,Z as useContext,Q as useForceUpdate,q as useMutable,K as useOnMount,X as useOnUnmount,bt as useRefEffect,G as useState,W as useStore,z as useSubscribe,Q as useUpdate,Et as view,Ve as when,D as withHost};
74
74
  //# sourceMappingURL=index.esm.js.map