mates 0.0.6 → 0.0.7

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/README.md CHANGED
@@ -28,7 +28,7 @@ Mates offers several types of state management tools that work together seamless
28
28
  Views are the building blocks of your UI. They're functions that return HTML templates and automatically subscribe to state changes.
29
29
 
30
30
  ```typescript
31
- import { view, atom } from "mates";
31
+ import { view, atom, setter } from "mates";
32
32
  import { html } from "lit-html";
33
33
 
34
34
  // Create a view that uses this state
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { unit, getProps as getStoreProps } from "./units";
9
9
  import "./x-view";
10
10
  export { type Props, type Setter, getTemplateIsRunning, globalScheduler, } from "./x-view";
11
11
  import "./xProvider";
12
- export { view } from "./view";
12
+ export { view, renderView } from "./view";
13
13
  export { html, render } from "./lit-html";
14
14
  export { repeat } from "./lit-html/directives/repeat";
15
15
  export { guard } from "./lit-html/directives/guard";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EACb,iBAAiB,EACjB,EAAE,GACH,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACL,CAAC,EACD,QAAQ,EACR,MAAM,EACN,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,KAAK,gBAAgB,EACrB,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,SAAS,IAAI,cAAc,GAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,KAAK,EACV,KAAK,MAAM,EACX,oBAAoB,EACpB,eAAe,GAChB,MAAM,UAAU,CAAC;AAGlB,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EACb,iBAAiB,EACjB,EAAE,GACH,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACL,CAAC,EACD,QAAQ,EACR,MAAM,EACN,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,KAAK,gBAAgB,EACrB,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,SAAS,IAAI,cAAc,GAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,KAAK,EACV,KAAK,MAAM,EACX,oBAAoB,EACpB,eAAe,GAChB,MAAM,UAAU,CAAC;AAGlB,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC"}
package/dist/index.esm.js CHANGED
@@ -3,22 +3,17 @@
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");let P=!1;const U=()=>P;const B=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 V 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)=>(at(),B.schedule(e),t(...s))}set props(t){"function"==typeof t?this._propsFn=t:(this._props=t,this._propsFn=()=>this._props),B.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),B.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=I(this,()=>t(this._propsFn,this.setter.bind(this))),void("function"==typeof this._componentFn&&(this._xviewRender=()=>{if(console.log("render",this.lastVersion,ht),P=!0,this.lastVersion===ht)return;((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??{})}i._$AI(t)})(I(this,this._componentFn),this),this.lastVersion=ht,P=!1},this.callOnEachUpdate(),this._xviewRender(),this._hasMounted=!0))}this._xviewRender&&(this.callOnEachUpdate(),this._xviewRender())}}}customElements.define("x-view",V);const R=[];function I(t,e){R.push(t);let s=null;try{s=e()}finally{R.pop()}return s}function D(t=!0){const e=R[R.length-1];if(!e){if(t)throw new Error("getCurrentHost(): No active host context");return null}return e}function L(t,e=!0,s){const n=D(e);if(n&&t&&!n.cleanups.has(t)){const e=(s||t.subscribe)?.(()=>{B.schedule(n)});n.addToCleanUps(t,e)}}function W(t){return L(t,!0),t}function F(t){const e=t,s=D();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),at(),B.schedule(s)}]}function q(t,e){ot();const s=D();e.map(e=>e.subscribe(t)).forEach(t=>s.addToCleanUps(e,t))}function z(t){ot();const e=D();queueMicrotask(()=>{try{const s=t();e&&s&&e.addToCleanUps(t,s)}catch(t){console.error(t)}})}function K(t){let e=null;const s=new CustomEvent("request-context",{bubbles:!0,composed:!0,detail:{contextClass:t,resolve(t){e=t}}});return D().dispatchEvent(s),e}const Z=t=>{ot();D().addToCleanUps(t,t)},X=t=>{if(tt)return Q;ot();const e=new Set;try{const s=D(),n=(...n)=>{t(...n),at(),e.forEach(t=>t()),s&&B.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.")}},J=X,Y=t=>{if(ot(),"object"!=typeof t||null===t)throw new Error("state must be an object");const e=D();if(!e)throw new Error("useState must be called inside a component");return[t,t=>(at(),B.schedule(e),t?.())]},G=()=>{ot();const t=D();return e=>{e?.(),at(),B.schedule(t)}};let Q,tt=!1;const et=t=>{tt=t},st=t=>{Q=t},nt=()=>tt,it=()=>Q,ot=()=>{if(U())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 rt=!1,lt=new Set;function ct(t){let e=null,s=1;ot();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 rt&&lt.add(i),e.value}catch(t){console.error(t)}const n=lt,o=rt;let r;lt=new Set,rt=!0;let l=new Map,c=new Map;try{r=t(),lt.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++,lt=n,rt=o,t}finally{lt=n,rt=o,o&&lt.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 ht=0;const at=()=>{ht++};function ut(t,e=!1){ot();let s=t;e&&pt(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=()=>(L(h,!1),rt&&lt.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&&pt(s),at(),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),at(),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:()=>(L(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=D(),l=h.subscribe(()=>{const e=i;try{i=t(s)}catch(t){i=n}e!==i&&r&&B.schedule(r)});return r&&!r?.cleanups?.has?.(o)&&r?.addToCleanUps?.(o,l),o},h}function dt(t){return ut(t,!0)}function pt(t){try{return Object.keys(t).forEach(e=>{"object"!=typeof t[e]||null===t[e]||Object.isFrozen(t[e])||pt(t[e])}),Object.freeze(t)}catch(t){console.error(t)}}function _t(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=>{L(d,!1),rt&&lt.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 ft(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 $t=t=>{if(nt())throw new Error("you can't create a bubble in another bubble.");ot(),et(!0);let e=!1,s=1;const n=t=>(...n)=>{const i=t(...n);return e||(e=!0,queueMicrotask(()=>{e=!1,at(),s++,o.forEach(t=>t())})),i};st(n);let i=t(n);const o=new Set,r=()=>(L(r,!1),rt&&lt.add(r),i());return r.__isBubble___=!0,r.__id__=Math.random().toString(36).substring(2,15),Object.defineProperty(r,"__version__",{get:()=>(L(r,!1),s)}),r.reset=()=>{i=t(n)},r.subscribe=t=>(o.add(t),()=>o.delete(t)),et(!1),st(null),r},At={path:ut(window.location.pathname),navigateTo(t,e){e?window.history.replaceState({},"",t):window.history.pushState({},"",t),this.path.set(t)},matchPath:t=>yt(t)};window.addEventListener("popstate",()=>{At.path.set(window.location.pathname)}),window.addEventListener("hashchange",()=>{At.path.set(window.location.pathname)}),window.addEventListener("navigate",()=>{At.path.set(window.location.pathname)});const yt=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 gt(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 vt=function(t){if("function"!=typeof t)throw Error("molecule must be a class");let e=new t;gt(e).forEach(t=>{if("function"==typeof e[t]){const s=e[t];e[t]=ft((...t)=>s.apply(e,t))}});const s=()=>e;return s.reset=()=>{const s=new t;gt(s).forEach(t=>{const n=s[t];n.__isAtom___||n.__isUnit___?e[t].set(n()):n.__isBubble___?e[t].reset():e[t]=n})},s},mt=(t,e)=>{const s=D();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 bt(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 wt=function(t){if(null===t||"object"!=typeof t)throw Error("unit must be an object");ot();const e=bt(t),s=()=>(L(s,!1),rt&&lt.add(s),t),n=new Set;s.__isUnit___=!0,Object.defineProperty(s,"__version__",{get:()=>(L(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=ct(()=>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(()=>{at(),n.forEach(t=>t())}),i=!1)}catch(t){"production"!==process?.env?.NODE_ENV&&console.error(t)}}(),o}}}),Object.preventExtensions(t),s};class Ct 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",Ct);const xt=(t,e={})=>g`<x-view .view=${t} .props=${()=>e}></x-view>`,Et=globalThis,Ht=Et.trustedTypes,Mt=Ht?Ht.createPolicy("lit-html",{createHTML:t=>t}):void 0,St="$lit$",Nt=`lit$${Math.random().toFixed(9).slice(2)}$`,Tt="?"+Nt,Ot=`<${Tt}>`,jt=document,kt=()=>jt.createComment(""),Pt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Ut=Array.isArray,Bt=t=>Ut(t)||"function"==typeof t?.[Symbol.iterator],Vt="[ \t\n\f\r]",Rt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,It=/-->/g,Dt=/>/g,Lt=RegExp(`>|${Vt}(?:([^\\s"'>=/]+)(${Vt}*=${Vt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Wt=/'/g,Ft=/"/g,qt=/^(?:script|style|textarea|title)$/i,zt=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),Kt=Symbol.for("lit-noChange"),Zt=Symbol.for("lit-nothing"),Xt=new WeakMap,Jt=jt.createTreeWalker(jt,129);
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
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2017 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
- */function Yt(t,e){if(!Ut(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Mt?Mt.createHTML(e):e}const Gt=(t,e)=>{const s=t.length-1,n=[];let i,o=2===e?"<svg>":3===e?"<math>":"",r=Rt;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===Rt?"!--"===c[1]?r=It:void 0!==c[1]?r=Dt:void 0!==c[2]?(qt.test(c[2])&&(i=RegExp("</"+c[2],"g")),r=Lt):void 0!==c[3]&&(r=Lt):r===Lt?">"===c[0]?(r=i??Rt,h=-1):void 0===c[1]?h=-2:(h=r.lastIndex-c[2].length,l=c[1],r=void 0===c[3]?Lt:'"'===c[3]?Ft:Wt):r===Ft||r===Wt?r=Lt:r===It||r===Dt?r=Rt:(r=Lt,i=void 0);const u=r===Lt&&t[e+1].startsWith("/>")?" ":"";o+=r===Rt?s+Ot:h>=0?(n.push(l),s.slice(0,h)+St+s.slice(h)+Nt+u):s+Nt+(-2===h?e:u)}return[Yt(t,o+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};class Qt{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]=Gt(t,e);if(this.el=Qt.createElement(c,s),Jt.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=Jt.nextNode())&&l.length<r;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(St)){const e=h[o++],s=n.getAttribute(t).split(Nt),r=/([.?@])?(.*)/.exec(e);l.push({type:1,index:i,name:r[2],strings:s,ctor:"."===r[1]?ie:"?"===r[1]?oe:"@"===r[1]?re:ne}),n.removeAttribute(t)}else t.startsWith(Nt)&&(l.push({type:6,index:i}),n.removeAttribute(t));if(qt.test(n.tagName)){const t=n.textContent.split(Nt),e=t.length-1;if(e>0){n.textContent=Ht?Ht.emptyScript:"";for(let s=0;s<e;s++)n.append(t[s],kt()),Jt.nextNode(),l.push({type:2,index:++i});n.append(t[e],kt())}}}else if(8===n.nodeType)if(n.data===Tt)l.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(Nt,t+1));)l.push({type:7,index:i}),t+=Nt.length-1}i++}}static createElement(t,e){const s=jt.createElement("template");return s.innerHTML=t,s}}function te(t,e,s=t,n){if(e===Kt)return e;let i=void 0!==n?s._$Co?.[n]:s._$Cl;const o=Pt(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=te(t,i._$AS(t,e.values),i,n)),e}let ee=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??jt).importNode(e,!0);Jt.currentNode=n;let i=Jt.nextNode(),o=0,r=0,l=s[0];for(;void 0!==l;){if(o===l.index){let e;2===l.type?e=new se(i,i.nextSibling,this,t):1===l.type?e=new l.ctor(i,l.name,l.strings,this,t):6===l.type&&(e=new le(i,this,t)),this._$AV.push(e),l=s[++r]}o!==l?.index&&(i=Jt.nextNode(),o++)}return Jt.currentNode=jt,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 se{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=Zt,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=te(this,t,e),Pt(t)?t===Zt||null==t||""===t?(this._$AH!==Zt&&this._$AR(),this._$AH=Zt):t!==this._$AH&&t!==Kt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):Bt(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!==Zt&&Pt(this._$AH)?this._$AA.nextSibling.data=t:this.T(jt.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=Qt.createElement(Yt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new ee(n,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=Xt.get(t.strings);return void 0===e&&Xt.set(t.strings,e=new Qt(t)),e}k(t){Ut(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 se(this.O(kt()),this.O(kt()),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 ne{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,i){this.type=1,this._$AH=Zt,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=Zt}_$AI(t,e=this,s,n){const i=this.strings;let o=!1;if(void 0===i)t=te(this,t,e,0),o=!Pt(t)||t!==this._$AH&&t!==Kt,o&&(this._$AH=t);else{const n=t;let r,l;for(t=i[0],r=0;r<i.length-1;r++)l=te(this,n[s+r],e,r),l===Kt&&(l=this._$AH[r]),o||=!Pt(l)||l!==this._$AH[r],l===Zt?t=Zt:t!==Zt&&(t+=(l??"")+i[r+1]),this._$AH[r]=l}o&&!n&&this.j(t)}j(t){t===Zt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ie extends ne{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Zt?void 0:t}}class oe extends ne{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Zt)}}class re extends ne{constructor(t,e,s,n,i){super(t,e,s,n,i),this.type=5}_$AI(t,e=this){if((t=te(this,t,e,0)??Zt)===Kt)return;const s=this._$AH,n=t===Zt&&s!==Zt||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==Zt&&(s===Zt||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 le{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){te(this,t)}}const ce={M:St,P:Nt,A:Tt,C:1,L:Gt,R:ee,D:Bt,V:te,I:se,H:ne,N:oe,U:re,B:ie,F:le},he=Et.litHtmlPolyfillSupport;he?.(Qt,se),(Et.litHtmlVersions??=[]).push("3.3.1");const ae=(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 se(e.insertBefore(kt(),t),t,void 0,s??{})}return i._$AI(t),i
12
- /**
13
- * @license
14
- * Copyright 2017 Google LLC
15
- * SPDX-License-Identifier: BSD-3-Clause
16
- */},ue=1,de=2,pe=3,_e=4,fe=t=>(...e)=>({_$litDirective$:t,values:e});let $e=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
11
+ */},pe=1,_e=2,fe=3,$e=4,Ae=t=>(...e)=>({_$litDirective$:t,values:e});let ye=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
17
12
  /**
18
13
  * @license
19
14
  * Copyright 2020 Google LLC
20
15
  * SPDX-License-Identifier: BSD-3-Clause
21
- */const{I:Ae}=ce,ye=(t,e)=>void 0===e?void 0!==t?._$litType$:t?._$litType$===e,ge=t=>void 0===t.strings,ve=()=>document.createComment(""),me=(t,e,s)=>{const n=t._$AA.parentNode,i=void 0===e?t._$AB:e._$AA;if(void 0===s){const e=n.insertBefore(ve(),i),o=n.insertBefore(ve(),i);s=new Ae(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},be=(t,e,s=t)=>(t._$AI(e,s),t),we={},Ce=(t,e=we)=>t._$AH=e,xe=t=>t._$AH,Ee=t=>{t._$AR(),t._$AA.remove()},He=t=>{t._$AR()},Me=(t,e,s)=>{const n=new Map;for(let i=e;i<=s;i++)n.set(t[i],i);return n},Se=fe(class extends $e{constructor(t){if(super(t),t.type!==de)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=xe(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]=be(i[u],o[p]),u++,p++;else if(l[d]===r[_])c[_]=be(i[d],o[_]),d--,_--;else if(l[u]===r[_])c[_]=be(i[u],o[_]),me(t,c[_+1],i[u]),u++,_--;else if(l[d]===r[p])c[p]=be(i[d],o[p]),me(t,i[u],i[d]),d--,p++;else if(void 0===h&&(h=Me(r,p,_),a=Me(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=me(t,i[u]);be(e,o[p]),c[p]=e}else c[p]=be(s,o[p]),me(t,i[u],s),i[e]=null;p++}else Ee(i[d]),d--;else Ee(i[u]),u++;for(;p<=_;){const e=me(t,c[_+1]);be(e,o[p]),c[p++]=e}for(;u<=d;){const t=i[u++];null!==t&&Ee(t)}return this.ut=r,Ce(t,c),Kt}}),Ne={},Te=fe(class extends $e{constructor(){super(...arguments),this.ot=Ne}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 Kt}else if(this.ot===e)return Kt;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,s)}}),Oe="important",je=" !"+Oe,ke=fe(class extends $e{constructor(t){if(super(t),t.type!==ue||"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(je);t.includes("-")||e?s.setProperty(t,e?n.slice(0,-11):n,e?Oe:""):s[t]=n}}return Kt}}),Pe=fe(class extends $e{constructor(t){if(super(t),t.type!==ue||"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 Kt}});
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}});
22
17
  /**
23
18
  * @license
24
19
  * Copyright 2017 Google LLC
@@ -29,27 +24,27 @@ const t=globalThis,e=t.trustedTypes,s=e?e.createPolicy("lit-html",{createHTML:t=
29
24
  * Copyright 2021 Google LLC
30
25
  * SPDX-License-Identifier: BSD-3-Clause
31
26
  */
32
- function Ue(t,e,s){return t?e(t):s?.(t)}
27
+ function Ve(t,e,s){return t?e(t):s?.(t)}
33
28
  /**
34
29
  * @license
35
30
  * Copyright 2018 Google LLC
36
31
  * SPDX-License-Identifier: BSD-3-Clause
37
- */const Be=t=>t??Zt,Ve=fe(class extends $e{constructor(t){if(super(t),t.type!==pe&&t.type!==ue&&t.type!==_e)throw Error("The `live` directive is not allowed on child or event bindings");if(!ge(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===Kt||e===Zt)return e;const s=t.element,n=t.name;if(t.type===pe){if(e===s[n])return Kt}else if(t.type===_e){if(!!e===s.hasAttribute(n))return Kt}else if(t.type===ue&&s.getAttribute(n)===e+"")return Kt;return Ce(t),e}}),Re=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),Re(t,e);return!0},Ie=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},De=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),Fe(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)},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)}};
38
33
  /**
39
34
  * @license
40
35
  * Copyright 2020 Google LLC
41
36
  * SPDX-License-Identifier: BSD-3-Clause
42
- */function Le(t){void 0!==this._$AN?(Ie(this),this._$AM=t,De(this)):this._$AM=t}function We(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++)Re(n[t],!1),Ie(n[t]);else null!=n&&(Re(n,!1),Ie(n));else Re(this,t)}const Fe=t=>{t.type==de&&(t._$AP??=We,t._$AQ??=Le)};class qe extends $e{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),De(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Re(this,t),Ie(this))}setValue(t){if(ge(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 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(){}}
43
38
  /**
44
39
  * @license
45
40
  * Copyright 2021 Google LLC
46
41
  * SPDX-License-Identifier: BSD-3-Clause
47
- */class ze{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}}let Ke=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};
42
+ */class Ze{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}}let Xe=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};
48
43
  /**
49
44
  * @license
50
45
  * Copyright 2017 Google LLC
51
46
  * SPDX-License-Identifier: BSD-3-Clause
52
- */const Ze=t=>!(t=>null===t||"object"!=typeof t&&"function"!=typeof t)(t)&&"function"==typeof t.then,Xe=1073741823;const Je=fe(class extends qe{constructor(){super(...arguments),this._$Cwt=Xe,this._$Cbt=[],this._$CK=new ze(this),this._$CX=new Ke}render(...t){return t.find(t=>!Ze(t))??Kt}update(t,e){const s=this._$Cbt;let n=s.length;this._$Cbt=e;const i=this._$CK,o=this._$CX;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$Cwt);t++){const r=e[t];if(!Ze(r))return this._$Cwt=t,r;t<n&&r===s[t]||(this._$Cwt=Xe,n=0,Promise.resolve(r).then(async t=>{for(;o.get();)await o.get();const e=i.deref();if(void 0!==e){const s=e._$Cbt.indexOf(r);s>-1&&s<e._$Cwt&&(e._$Cwt=s,e.setValue(t))}}))}return Kt}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}),Ye=fe(class extends $e{constructor(){super(...arguments),this.key=Zt}render(t,e){return this.key=t,e}update(t,[e,s]){return e!==this.key&&(Ce(t),this.key=e),s}}),Ge=t=>(t=>null!=t?._$litType$?.h)(t)?t._$litType$.h:t.strings,Qe=fe(class extends $e{constructor(t){super(t),this.et=new WeakMap}render(t){return[t]}update(t,[e]){const s=ye(this.it)?Ge(this.it):null,n=ye(e)?Ge(e):null;if(null!==s&&(null===n||s!==n)){const e=xe(t).pop();let n=this.et.get(s);if(void 0===n){const t=document.createDocumentFragment();n=ae(Zt,t),n.setConnected(!1),this.et.set(s,n)}Ce(n,[e]),me(n,void 0,e)}if(null!==n){if(null===s||s!==n){const e=this.et.get(n);if(void 0!==e){const s=xe(e).pop();He(t),me(t,void 0,s),Ce(t,[s])}}this.it=e}else this.it=void 0;return this.render(e)}});
47
+ */const Je=t=>!(t=>null===t||"object"!=typeof t&&"function"!=typeof t)(t)&&"function"==typeof t.then,Ye=1073741823;const Ge=Ae(class extends Ke{constructor(){super(...arguments),this._$Cwt=Ye,this._$Cbt=[],this._$CK=new Ze(this),this._$CX=new Xe}render(...t){return t.find(t=>!Je(t))??Xt}update(t,e){const s=this._$Cbt;let n=s.length;this._$Cbt=e;const i=this._$CK,o=this._$CX;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$Cwt);t++){const r=e[t];if(!Je(r))return this._$Cwt=t,r;t<n&&r===s[t]||(this._$Cwt=Ye,n=0,Promise.resolve(r).then(async t=>{for(;o.get();)await o.get();const e=i.deref();if(void 0!==e){const s=e._$Cbt.indexOf(r);s>-1&&s<e._$Cwt&&(e._$Cwt=s,e.setValue(t))}}))}return Xt}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}}),Qe=Ae(class extends ye{constructor(){super(...arguments),this.key=Jt}render(t,e){return this.key=t,e}update(t,[e,s]){return e!==this.key&&(Ee(t),this.key=e),s}}),ts=t=>(t=>null!=t?._$litType$?.h)(t)?t._$litType$.h:t.strings,es=Ae(class extends ye{constructor(t){super(t),this.et=new WeakMap}render(t){return[t]}update(t,[e]){const s=ve(this.it)?ts(this.it):null,n=ve(e)?ts(e):null;if(null!==s&&(null===n||s!==n)){const e=He(t).pop();let n=this.et.get(s);if(void 0===n){const t=document.createDocumentFragment();n=de(Jt,t),n.setConnected(!1),this.et.set(s,n)}Ee(n,[e]),we(n,void 0,e)}if(null!==n){if(null===s||s!==n){const e=this.et.get(n);if(void 0!==e){const s=He(e).pop();Se(t),we(t,void 0,s),Ee(t,[s])}}this.it=e}else this.it=void 0;return this.render(e)}});
53
48
  /**
54
49
  * @license
55
50
  * Copyright 2021 Google LLC
@@ -60,20 +55,20 @@ function Ue(t,e,s){return t?e(t):s?.(t)}
60
55
  * Copyright 2017 Google LLC
61
56
  * SPDX-License-Identifier: BSD-3-Clause
62
57
  */
63
- let ts=class extends qe{constructor(){super(...arguments),this._$CK=new ze(this),this._$CX=new Ke}render(t,e){return Kt}update(t,[e,s]){if(this.isConnected||this.disconnected(),e===this._$CJ)return Kt;this._$CJ=e;let n=0;const{_$CK:i,_$CX:o}=this;return(async(t,e)=>{for await(const s of t)if(!1===await e(s))return})(e,async t=>{for(;o.get();)await o.get();const r=i.deref();if(void 0!==r){if(r._$CJ!==e)return!1;void 0!==s&&(t=s(t,n)),r.commitValue(t,n),n++}return!0}),Kt}commitValue(t,e){this.setValue(t)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}};const es=fe(ts);
58
+ let ss=class extends Ke{constructor(){super(...arguments),this._$CK=new Ze(this),this._$CX=new Xe}render(t,e){return Xt}update(t,[e,s]){if(this.isConnected||this.disconnected(),e===this._$CJ)return Xt;this._$CJ=e;let n=0;const{_$CK:i,_$CX:o}=this;return(async(t,e)=>{for await(const s of t)if(!1===await e(s))return})(e,async t=>{for(;o.get();)await o.get();const r=i.deref();if(void 0!==r){if(r._$CJ!==e)return!1;void 0!==s&&(t=s(t,n)),r.commitValue(t,n),n++}return!0}),Xt}commitValue(t,e){this.setValue(t)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}};const ns=Ae(ss);
64
59
  /**
65
60
  * @license
66
61
  * Copyright 2021 Google LLC
67
62
  * SPDX-License-Identifier: BSD-3-Clause
68
- */function*ss(t,e){const s="function"==typeof e;if(void 0!==t){let n=-1;for(const i of t)n>-1&&(yield s?e(n):e),n++,yield i}}
63
+ */function*is(t,e){const s="function"==typeof e;if(void 0!==t){let n=-1;for(const i of t)n>-1&&(yield s?e(n):e),n++,yield i}}
69
64
  /**
70
65
  * @license
71
66
  * Copyright 2021 Google LLC
72
67
  * SPDX-License-Identifier: BSD-3-Clause
73
- */function*ns(t,e,s=1){const n=void 0===e?0:t;e??=t;for(let t=n;s>0?t<e:e<t;t+=s)yield t}
68
+ */function*os(t,e,s=1){const n=void 0===e?0:t;e??=t;for(let t=n;s>0?t<e:e<t;t+=s)yield t}
74
69
  /**
75
70
  * @license
76
71
  * Copyright 2017 Google LLC
77
72
  * SPDX-License-Identifier: BSD-3-Clause
78
- */const is=fe(class extends ts{constructor(t){if(super(t),t.type!==de)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&&He(this._$Ctt);const s=me(this._$Ctt);be(s,t)}});export{X as _,ft as action,is as asyncAppend,_t as asyncAtom,es as asyncReplace,ut as atom,$t as bubble,Qe as cache,Pe as classMap,pt as df,D as getCurrentHost,bt as getStoreProps,U as getTemplateIsRunning,nt as getbubbleInProgress,it as getbubblesSetter,ct as getter,B as globalScheduler,ht as globalVersion,Te as guard,zt as html,dt as iAtom,Be as ifDefined,at as incrGlobalVersion,yt as isPathMatching,ss as join,Ye as keyed,Ve as live,At as location,vt as molecule,ns as range,ae as render,Se as repeat,ot as safetyCheck,et as setBubbleInProgress,st as setBubblesSetter,J as setter,ke as styleMap,L as subscribe,wt as unit,Je as until,K as useContext,G as useForceUpdate,F as useMutable,z as useOnMount,Z as useOnUnmount,mt as useRefEffect,Y as useState,W as useStore,q as useSubscribe,G as useUpdate,xt as view,Ue as when,I 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,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};
79
74
  //# sourceMappingURL=index.esm.js.map