@shortfuse/materialdesignweb 0.9.1 → 0.9.3

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
@@ -5,6 +5,8 @@ Material Design for Web
5
5
 
6
6
  ![Version](https://badgen.net/npm/v/@shortfuse/materialdesignweb) ![License](https://badgen.net/npm/license/@shortfuse/materialdesignweb) ![MinZip](https://badgen.net/bundlephobia/minzip/@shortfuse/materialdesignweb) ![Dependents](https://badgen.net/npm/dependents/@shortfuse/materialdesignweb)
7
7
 
8
+ [![Chromium](https://github.com/clshortfuse/materialdesignweb/actions/workflows/test-chromium.yml/badge.svg)](https://github.com/clshortfuse/materialdesignweb/actions/workflows/test-chromium.yml) [![Firefox](https://github.com/clshortfuse/materialdesignweb/actions/workflows/test-firefox.yml/badge.svg)](https://github.com/clshortfuse/materialdesignweb/actions/workflows/test-firefox.yml) [![Webkit](https://github.com/clshortfuse/materialdesignweb/actions/workflows/test-webkit.yml/badge.svg)](https://github.com/clshortfuse/materialdesignweb/actions/workflows/test-webkit.yml)
9
+
8
10
  Live demo: https://clshortfuse.github.io/materialdesignweb/
9
11
 
10
12
  Quick links
@@ -87,7 +87,7 @@ export default Box
87
87
  display: grid;
88
88
  column-gap: 16px; /* Gutters */
89
89
  grid-auto-flow: row;
90
- grid-template-columns: repeat(1fr, 4);
90
+ grid-template-columns: repeat(4, 1fr);
91
91
  }
92
92
 
93
93
  :host([y="start"]) { align-items: flex-start; }
@@ -19,6 +19,8 @@ export default Box
19
19
  --mdw-ink: var(--mdw-color__on-surface);
20
20
  background-color: rgb(var(--mdw-bg));
21
21
  color: rgb(var(--mdw-ink));
22
+
23
+ overflow: auto;
22
24
  }
23
25
  `
24
26
  .autoRegister('mdw-pane');
@@ -744,6 +744,7 @@ export default class Composition {
744
744
  * @param {T} data
745
745
  */
746
746
  const draw = (changes, data) => {
747
+ if (!changes) return;
747
748
  let ranSearch = false;
748
749
  for (const prop of this.props) {
749
750
  if (!this.actionsByPropsUsed?.has(prop)) continue;
@@ -1,2 +1,2 @@
1
- var Pt,_t;function lt(){return(Pt??=new Text).cloneNode()}function F(){return(_t??=new Comment).cloneNode()}var D=class{constructor(t){this.anchorNode=t.anchorNode,this.metadata=[],this.keys=[],this.needsArrayKeyFastPath=!1,this.composition=t.composition,this.renderOptions=t.renderOptions,this.metadataCache=null,this.queuedElements=[],this.batchStartIndex=null,this.batchEndIndex=null}render(t,e){return this.composition.render(t,e,this.renderOptions)}startBatch(){this.needsArrayKeyFastPath=!0}writeBatch(){var e;if(!this.queuedElements.length)return;(((e=this.metadata[this.batchStartIndex-1])==null?void 0:e.domNode)??this.anchorNode).after(...this.queuedElements),this.queuedElements.length=0}stopBatch(){if(this.writeBatch(),this.needsArrayKeyFastPath=!1,this.batchStartIndex=null,this.batchEndIndex=null,this.metadataCache){for(let{domNode:t}of this.metadataCache.values())t.remove();this.metadataCache.clear()}}removeByIndex(t){let[e]=this.metadata.splice(t,1),{domNode:s,key:n}=e;this.keys.splice(t,1),s.remove(),this.metadataCache?this.metadataCache.set(n,e):this.metadataCache=new Map([[n,e]])}renderData(t,e,s,n,i,o){var h;if(t<this.metadata.length){let c=this.metadata[t],u=c.key,p=u===n,m=i!==n;if(p){m?c.render(e,s):o||c.render(e,s);return}let b=this.metadataCache??=new Map,g=!1;this.needsArrayKeyFastPath&&(g=!this.keys.includes(n),this.needsArrayFastPath=!1);let S=g?-1:this.keys.indexOf(n,t+1);if(S===-1){if(b.has(n)){let d=b.get(n);this.metadata.splice(t,0,d),this.keys.splice(t,0,n),(((h=this.metadata[t-1])==null?void 0:h.domNode)??this.anchorNode).after(d.domNode),b.delete(n);return}b.set(u,c)}else{if(t-S===-1){this.removeByIndex(t);return}let d=this.metadata[S];this.metadata[t]=d,this.metadata.splice(S,1);let{domNode:f}=c;f.replaceWith(d.domNode),o||d.render(e,s),this.keys[t]=n,this.keys.splice(S,1),f.remove(),b.set(u,c);return}}let a=this.render(e,s),l=a.target;this.metadata[t]={render:a,element:l,key:n,domNode:l},this.keys[t]=n,(this.batchEndIndex===null||this.batchEndIndex!==t-1)&&(this.writeBatch(),this.batchStartIndex=t),this.batchEndIndex=t,this.queuedElements.push(l)}removeEntries(t=0){let{length:e}=this.metadata;for(let s=e-1;s>=t;s--)this.metadata[s].domNode.remove();this.metadata.length=t,this.keys.length=t}hide(t,e,s){if(!e&&(t==null&&(t=this.keys.indexOf(s)),e=this.metadata[t],!e)||e.hidden)return!1;let{comment:n,element:i}=e;return n||(n=F(),e.comment=n),i.replaceWith(n),e.domNode=n,e.hidden=!0,!0}show(t,e,s){if(!e&&(t==null&&(t=this.keys.indexOf(s)),e=this.metadata[t],!e)||!e.hidden)return!1;let{comment:n,element:i}=e;return n.replaceWith(i),e.domNode=i,e.hidden=!1,!0}};var G=new Map;function V(r,t=!0){if(t&&G.has(r))return G.get(r);let e=new CSSStyleSheet;return e.replaceSync(r),t&&G.set(r,e),e}var X=new Map,ct;function At(r,t=!0){let e;return t&&X.has(r)?e=X.get(r):(ct??=document.implementation.createHTMLDocument(),e=ct.createElement("style"),e.textContent=r,t&&X.set(r,e)),e.cloneNode(!0)}var q;function ht(r,t=!0){if(q==null)try{let e=V(r,t);return q=!0,e}catch{q=!1}return q?V(r,t):At(r,t)}function*ut(r,t=!0){for(let e of r)e instanceof HTMLStyleElement?yield V(e.textContent,t):e.ownerNode?yield V([...e.cssRules].map(s=>s.cssText).join(""),t):yield e}var z=new WeakMap;function*dt(r,t=!0){for(let e of r)if(e instanceof HTMLStyleElement)yield e;else if(e.ownerNode instanceof HTMLStyleElement)yield e.ownerNode.cloneNode(!0);else if(t&&z.has(e))yield z.get(e).cloneNode(!0);else{let s=document.createElement("style");s.textContent=[...e.cssRules].map(n=>n.cssText).join(""),t&&z.set(e,s),yield s.cloneNode(!0)}}function ft(r,...t){return ht(typeof r=="string"?r:String.raw({raw:r},...t))}function gt(r){switch(r){case void 0:case null:case!1:return null;case!0:return"";default:return`${r}`}}var $;function j(r){if($??=new Map,$.has(r))return $.get(r);let t=r.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);return $.set(r,t),t}var pt,Ot=Number.parseFloat((pt=navigator.userAgent.match(/Chrome\/([\d.]+)/))==null?void 0:pt[1]),mt,Gt=Number.parseFloat((mt=navigator.userAgent.match(/Firefox\/([\d.]+)/))==null?void 0:mt[1]),bt,Xt=Ot||!navigator.userAgent.includes("AppleWebKit")?Number.NaN:Number.parseFloat((bt=navigator.userAgent.match(/Version\/([\d.]+)/))==null?void 0:bt[1]);function Y(r,t){if(r===t)return r;if(r==null||t==null||typeof t!="object")return t;typeof r!="object"&&(r={});for(let[e,s]of Object.entries(t))s==null?e in r&&delete r[e]:r[e]=Y(r[e],s);return r}function H(r,t,e="reference"){if(r===t)return null;if(t==null||typeof t!="object")return t;if(r==null||typeof r!="object")return structuredClone(t);let s={};if(Array.isArray(t)){if(e==="reference")return t;if(e==="clone")return structuredClone(t);for(let[i,o]of t.entries()){if(o===null){s[i]=null;continue}if(o==null)continue;let a=H(r[i],o,e);a!==null&&(s[i]=a)}return t.length!==r.length&&(s.length=t.length),s}let n=new Set(Object.keys(r));for(let[i,o]of Object.entries(t)){if(n.delete(i),o===null){s[i]=null;continue}if(o==null)continue;let a=H(r[i],o,e);a!==null&&(s[i]=a)}for(let i of n)s[i]=null;return s}function Z(r,t){if(r===t)return!1;if(t==null||typeof t!="object"||r!=null&&typeof r!="object")return!0;for(let[e,s]of Object.entries(t))if(s==null){if(e in r)return!0}else if(Z(r[e],s))return!0;return!1}function yt(r){switch(r){case"boolean":return!1;case"integer":case"float":return 0;case"map":return new Map;case"set":return new Set;case"array":return[];case"object":return null;default:case"string":return""}}function tt(r,t,e,s){return r??={},new Proxy(r,{get(n,i){let o=n[i];if(typeof i!="symbol"){let a=s?`${s}.${i}`:i;if(s?e.add(a):t.add(a),typeof o=="object"&&o!=null)return tt(o,t,e,a)}return o},has(n,i){let o=Reflect.has(n,i);if(typeof i!="symbol"){let a=s?`${s}.p`:i;s?e.add(a):t.add(a)}return o}})}function Mt(r){switch(r){case"boolean":return t=>!!t;case"integer":return Math.round;case"float":return t=>+t;case"map":return Map;case"set":return Set;case"object":case"array":return t=>t;default:case"string":return t=>`${t}`}}function et(r,...t){let e=new Set,s=new Set,n=t.map(l=>{let h=new Set,c=new Set,u=tt(l,h,c);return{poked:h,pokedDeep:c,proxy:u}}),i=tt(this??{},e,s),o=r.apply(i,n.map(l=>l.proxy)),a=r.name?!0:!e.size;return{props:{this:[...e],args:n.map(l=>[...l.poked])},deepPropStrings:{this:[...s],args:n.map(l=>[...l.pokedDeep])},deepProps:{this:[...s].map(l=>l.split(".")),args:n.map(l=>[...l.pokedDeep].map(h=>h.split(".")))},defaultValue:o,reusable:a}}function Tt(){return null}function Ft(r,t,e){let s=typeof t=="string"?{type:t}:t,{watchers:n,value:i,readonly:o,empty:a,type:l,enumerable:h,reflect:c,attr:u,nullable:p,parser:m,nullParser:b,get:g,is:S,diff:d,props:f}=s;if(n??=[],o??=!1,a===void 0&&(a=null),i??=a,g&&!f){let E=et(g.bind(e),e,()=>i);i??=E.defaultValue,f=new Set([...E.props.this,...E.props.args[0]])}if(!l)if(i==null)l="string";else{let E=typeof i;l=E==="number"?Number.isInteger(i)?"integer":"number":E}return h??=r[0]!=="_",p??=l==="boolean"?!1:a==null,p||(a??=yt(l),i??=a),c??=h?l!=="object":u?"write":!1,u??=c?j(r):null,m??=Mt(l),b||(p?b=Tt:b=a===null?()=>yt(l):()=>a),S??=l==="object"?(E,N)=>!Z(E,N):l==="array"?()=>!1:Object.is,d===void 0&&(d=l==="object"?(E,N)=>H(E,N,"reference"):null),{...s,type:l,is:S,diff:d,attr:u,reflect:c,readonly:o,enumerable:h,value:i,parser:m,nullParser:b,key:r,props:f,watchers:n}}function J(r,t,e){var i,o;r.get;let s=e==null?r.nullParser.call(this,e):r.parser.call(this,e),n=s;if(t==null){if(s==null)return!1}else if(s!=null){if(r.diff){if(n=r.diff.call(this,t,s),n==null)return!1}else if(r.is.call(this,t,s))return!1}return r.values?r.values.set(this,s):r.values=new WeakMap([[this,s]]),(i=r.propChangedCallback)==null||i.call(this,r.key,t,s,n),(o=r.changedCallback)==null||o.call(this,t,s,n),!0}function st(r,t,e){let s=Ft(t,e,r);function n(){var c;return(c=s.values)!=null&&c.has(this)?s.values.get(this):s.value}function i(c){let u=this[t];J.call(this,s,u,c)}function o(){var p,m;let c=(p=s.computedValues)==null?void 0:p.get(this),u=this[t];(m=s.needsSelfInvalidation)==null||m.delete(this),J.call(this,s,c,u)}if(s.props)for(let c of s.props)s.watchers.push([c,o]);function a(){let c=s.get.call(this,this,n.bind(this));return(s.computedValues??=new WeakMap).set(this,c),c}function l(c){s.needsSelfInvalidation?s.needsSelfInvalidation.add(this):s.needsSelfInvalidation=new WeakSet([this]);let u=this[t];s.set.call(this,c,i.bind(this));let p=this[t];s.needsSelfInvalidation.has(this)&&(s.needsSelfInvalidation.delete(this),J.call(this,s,u,p))}let h={enumerable:s.enumerable,configurable:!0,get:s.get?a:n,set:s.set?l:i};return Object.defineProperty(r,t,h),s}var Ct=new Set;function U(r="mdw_",t=4){let e;for(;Ct.has(e=Math.random().toString(36).slice(2,t+2)););return Ct.add(e),`${r}${e}`}var nt,St,xt;function B(r){return nt??=document.implementation.createHTMLDocument(),r?(xt??=nt.createRange(),xt.createContextualFragment(r)):(St??=nt.createDocumentFragment(),St.cloneNode())}var K=new Map;function rt(r){let t=`#${U()}`;return K.set(t,{fn:r}),`{${t}}`}var it=new Map;function ot(r,...t){let e,s=t.map(o=>{switch(typeof o){case"string":return o;case"function":return rt(o);case"object":{if(o==null)return"";let a=U();return e??=new Map,e.set(a,o),`<div id="${a}"></div>`}default:throw new Error(`Unexpected substitution: ${o}`)}}),n=String.raw({raw:r},...s);if(e){let o=B(n);for(let[a,l]of e)o.getElementById(a).replaceWith(l);return o}let i;return it.has(n)?i=it.get(n):(i=B(n),it.set(n,i)),i.cloneNode(!0)}function jt({nodes:r},t){let{nodeIndex:e,attrName:s}=this,n=r[e];switch(t){case void 0:case null:case!1:return n.removeAttribute(s),!1;case!0:return n.setAttribute(s,""),"";default:return n.setAttribute(s,t),t}}function Bt({nodeStates:r,comments:t,nodes:e},s){let{commentIndex:n,nodeIndex:i}=this,o=r[i],a=o&1;if(!(s!=null&&s!==!1)){if(a)return;let u=t[n];u||(u=F(),t[n]=u),e[i].replaceWith(u),r[i]|=1;return}let h=e[i],c=o&2;if(typeof s!="object")if(c){let u=new Text(s);h.replaceWith(u),e[i]=u,r[i]&=-3}else h.data=s;a&&(t[n].replaceWith(h),r[i]&=-2)}function Rt({nodeStates:r,nodes:t,comments:e},s){let{commentIndex:n,nodeIndex:i}=this,o=r[i]&1,a=s!=null&&s!==!1;if(a===!o)return;let l=t[i],h=e[n];h||(h=F(),e[n]=h),a?(h.replaceWith(l),r[i]&=-2):(l.replaceWith(h),r[i]|=1)}function Lt({comments:r,nodeStates:t,nodes:e}){let{commentIndex:s,nodeIndex:n}=this,i=F();r[s]=i,t[n]|=1,e[n].replaceWith(i)}function at(r,...t){let[{caches:e,searchStates:s}]=t,{cacheIndex:n,searchIndex:i,subSearch:o,invocation:a}=r,l=e[n],h=s[i];if(h&1)return{value:l,dirty:(h&2)===2};s[i]|=1;let c;if(a){if(o){let u=at(o,...t);if(!u.dirty&&l!==void 0)return s[i]&=-3,{value:l,dirty:!1};c=r.invocation(u.value)}else c=r.invocation(...t);if(c===void 0||l===c)return{value:c,dirty:!1}}return e[n]=c,s[i]|=2,{value:c,dirty:!0}}function wt({options:{context:r,store:t,injections:e}},s,n){return this.expression.call(r,t??n,e)}function Wt(r,t){return t[this.prop]}function Dt(r,t,e){let s=t;for(let n of this.deepProp){if(s===null)return null;if(!(n in s))return;s=s[n]}return s}var Ut=/{([^}]*)}/g;function qt(r,t){if(t)return t[r]}function Et(r,t){if(!t)return;let e=t,s;for(s of r)if(typeof e=="object"){if(e===null)return null;if(!(s in e))return;e=e[s]}else return e[s];return e}function Vt(r,t){let e=t;for(let s of r.split("."))if(!s||(e=e[s],e==null))return null;return e===t?null:e}var Nt=new Map,R=class r{static EVENT_PREFIX_REGEX=/^([*1~]+)?(.*)$/;_interpolationState={nodeIndex:-1,searchIndex:0,cacheIndex:0,commentIndex:0,nodeEntry:null};static shadowRootTag=Symbol();nodesToBind=[];props=[];searches=[];initCache=[];searchByQuery;actionsByPropsUsed;postInitActions=[];tagsWithBindings;tags=[];adapter;events;cloneable;styles=[];adoptedStyleSheets=[];stylesFragment;allIds=[];temporaryIds;interpolated=!1;constructor(...t){this.template=B(),this.append(...t)}*[Symbol.iterator](){for(let t of this.styles)yield t;yield this.template}static compose(...t){for(let[s,n]of Nt)if(s.length===t.length&&t.every((i,o)=>i===s[o]))return n;let e=new r(...t);return Nt.set(t,e),e}append(...t){for(let e of t)typeof e=="string"?this.append(B(e.trim())):e instanceof r?this.append(...e):e instanceof DocumentFragment?this.template.append(e):(e instanceof CSSStyleSheet||e instanceof HTMLStyleElement)&&this.styles.push(e);return this}addCompositionEventListener(t){let e=t.tag??"",s=this.events??=new Map;return s.has(e)?s.get(e).push(t):s.set(e,[t]),this}#n(t,e,s){var n;if((n=this.events)!=null&&n.has(t))for(let i of this.events.get(t)){let o;i.handleEvent?o=i.handleEvent:i.deepProp.length?o=Et(i.deepProp,this.interpolateOptions.defaults):o=qt(i.prop,this.interpolateOptions.defaults),e.addEventListener(i.type,s?o.bind(s):o,i)}}render(t,e,s={}){this.interpolated||this.interpolate({defaults:e??t,...s});let n=this.cloneable.cloneNode(!0),i=s.shadowRoot,o=i??s.target??n.firstElementChild,a={lastChildNode:null,lastChildNodeIndex:0,lastElement:null,nodeStates:new Uint8Array(this._interpolationState.nodeIndex+1),searchStates:new Uint8Array(this._interpolationState.searchIndex),comments:[],nodes:[],caches:this.initCache.slice(),refs:[],options:s},{nodes:l,refs:h,searchStates:c,caches:u}=a;for(let{tag:m,textNodes:b}of this.nodesToBind){let g;if(m===""){if(!b.length)continue;h.push(null),l.push(null),g=n.firstChild}else{let d=n.getElementById(m);if(h.push(d),l.push(d),this.#n(m,d,s.context),!b.length)continue;g=d.firstChild}let S=0;for(let d of b){for(;d!==S;)g=g.nextSibling,S++;l.push(g)}}this.#n("",s.context),this.#n(r.shadowRootTag,s.context.shadowRoot,s.context);for(let m of this.postInitActions)m.invocation(a);let p=(m,b)=>{var S;let g=!1;for(let d of this.props){if(!((S=this.actionsByPropsUsed)!=null&&S.has(d))||!(d in m))continue;let f=this.actionsByPropsUsed.get(d);for(let E of f){g=!0;let{dirty:N,value:P}=at(E.search,a,m,b);N&&E.invocation(a,P,m,b)}}g&&c.fill(0)};return i?(s.context??=i.host,"adoptedStyleSheets"in i?this.adoptedStyleSheets.length&&(i.adoptedStyleSheets=[...i.adoptedStyleSheets,...this.adoptedStyleSheets]):this.stylesFragment.hasChildNodes()&&n.prepend(this.stylesFragment.cloneNode(!0))):s.context??=o,t!==this.interpolateOptions.defaults&&p(t,e),i&&(i.append(n),customElements.upgrade(i)),p.target=o,p.byProp=(m,b,g)=>{var E,N;if(!((E=this.actionsByPropsUsed)!=null&&E.has(m)))return;let S=!1;if((N=this.searchByQuery)!=null&&N.has(m)){S=!0;let P=this.searchByQuery.get(m);if(u[P.cacheIndex]===b)return;u[P.cacheIndex]=b,c[P.searchIndex]=3}let d,f=this.actionsByPropsUsed.get(m);for(let P of f)if(P.search.query===m)P.invocation(a,b);else{d??={[m]:b},g??=d,S=!0;let _=at(P.search,a,d,g);_.dirty&&P.invocation(a,_.value,d,g)}S&&c.fill(0)},p.state=a,p}#s(t,e,s,n){var _,T;let{nodeValue:i,nodeName:o,nodeType:a}=t,l,h;if(a===Node.ATTRIBUTE_NODE?l=t:h=t,n==null){if(!i)return;let y=i.trim();if(!y)return;if(l||(e==null?void 0:e.tagName)==="STYLE"){if(y[0]!=="{")return;let{length:I}=y;if(y[I-1]!=="}")return;n=y.slice(1,-1)}else{let I=y.split(Ut);if(I.length<3)return;if(I.length===3&&!I[0]&&!I[2])n=I[1];else{for(let[C,k]of I.entries())if(C%2){let x=lt();h.before(x),this.#s(x,e,s,k)}else k&&h.before(k);return!0}}}let c=n,u=n[0]==="!",p=!1;u&&(n=n.slice(1),p=n[0]==="!",p&&(n=n.slice(1)));let m,b;if(h){e!==h.parentElement&&(e=h.parentElement),b=0;let y=h;for(;y=y.previousSibling;)b++}else if(e!==l.ownerElement&&(e=l.ownerElement),o.startsWith("on")){let y=o.indexOf("-");if(y===-1)return;m=y===2}if(m){e.removeAttribute(o);let y=this.#e(e),I=o.slice(3),[,C,k]=I.match(/^([*1~]+)?(.*)$/),x,v,w=[];if(n.startsWith("#"))x=K.get(n).fn;else{let O=n.split(".");O.length===1?(v=n,w=[]):(v=O[0],w=O)}this.addCompositionEventListener({tag:y,type:k,handleEvent:x,prop:v,deepProp:w,once:C==null?void 0:C.includes("1"),passive:C==null?void 0:C.includes("~"),capture:C==null?void 0:C.includes("*")});return}let g;if((_=this.searchByQuery)!=null&&_.has(c))g=this.searchByQuery.get(c);else{let y=n,I=y!==c,C;if(I&&((T=this.searchByQuery)!=null&&T.has(y)))C=this.searchByQuery.get(y);else{let k,x,v,w,O,L,W,A;if(n.startsWith("#")){if(A=K.get(n),!A)return;k=A.fn,W=wt,A.props?(x=A.props,v=A.deepProps,w=A.defaultValue??null):w=A.fn}else w=null,s!=null&&s.defaults&&(w=Et(n.split("."),s.defaults)??null),w==null&&(s!=null&&s.injections)&&(w=Vt(n,s.injections));if(!x)if(typeof w=="function"){let M=et.call(this,w,s==null?void 0:s.defaults,s==null?void 0:s.injections),It=new Set([...M.props.this,...M.props.args[0],...M.props.args[1]]),vt=new Set([...M.deepPropStrings.this,...M.deepPropStrings.args[0]]);k=w,w=M.defaultValue,x=[...It],v=[...vt].map(kt=>kt.split(".")),W=wt}else{let M=n.split(".");M.length===1?(O=n,x=[O],W=Wt):(x=[M[0]],L=M,v=[M],W=Dt)}A&&(A.defaultValue=w,A.props=x,A.deepProps=v),C={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:y,defaultValue:w,subSearch:null,prop:O,propsUsed:x,deepProp:L,deepPropsUsed:v,invocation:W,expression:k},this.addSearch(C)}I?(g={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:c,subSearch:C,negate:u,doubleNegate:p,prop:C.prop,deepProp:C.deepProp,propsUsed:C.propsUsed,deepPropsUsed:C.deepPropsUsed,defaultValue:p?!!C.defaultValue:u?!C.defaultValue:C.defaultValue,invocation(k){return this.doubleNegate?!!k:this.negate?!k:k}},this.addSearch(g)):g=C}let S,d=null,f=g.defaultValue;h?d=b:o==="mdw-if"?(S=this.#e(e),e.removeAttribute(o),f=f!=null&&f!==!1):(d=o,o==="id"||f==null||f===!1?e.removeAttribute(o):e.setAttribute(o,f===!0?"":f)),S??=this.#e(e);let E=this._interpolationState.nodeEntry;(!E||E.tag!==S)&&(E={tag:S,textNodes:[]},this._interpolationState.nodeEntry=E,this.nodesToBind.push(E),this._interpolationState.nodeIndex++);let N;if(h)switch(E.textNodes.push(b),this._interpolationState.nodeIndex++,N={nodeIndex:this._interpolationState.nodeIndex,commentIndex:this._interpolationState.commentIndex++,invocation:Bt,defaultValue:f,search:g},typeof f){case"string":h.data=f;break;case"number":h.data=`${f}`;break;default:h.data="";break}else d?N={nodeIndex:this._interpolationState.nodeIndex,attrName:d,defaultValue:f,invocation:jt,search:g}:(N={nodeIndex:this._interpolationState.nodeIndex,commentIndex:this._interpolationState.commentIndex++,defaultValue:f,invocation:Rt,search:g},f||this.postInitActions.push({...N,invocation:Lt}));this.addAction(N),(this.tagsWithBindings??=new Set).add(S)}#e(t){if(!t)return"";let e=t.id;return e?this.allIds.includes(e)||this.allIds.push(e):(e=U(),(this.temporaryIds??=new Set).add(e),this.allIds.push(e),t.id=e),e}#t(t,e){let s=t.getAttribute("mdw-for"),n=s==null?void 0:s.trim();if(!n||n[0]!=="{")return null;let{length:i}=n;if(n[i-1]!=="}")return null;let o=n.slice(1,-1),[a,l]=o.split(/\s+of\s+/);t.removeAttribute("mdw-for");let h=t.ownerDocument.createElement("template");t.replaceWith(h);let c=this.#e(h),u=this._interpolationState.nodeEntry;(!u||u.tag!==c)&&(u={tag:c,textNodes:[]},this._interpolationState.nodeEntry=u,this.nodesToBind.push(u),this._interpolationState.nodeIndex++);let p=new r;p.template.append(t);let m={...e.injections,[a]:null,index:null},b=[l],g={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:null,prop:null,deepProp:null,propsUsed:b,deepPropsUsed:[[l]],defaultValue:{},invocation:null},S={defaultValue:null,nodeIndex:this._interpolationState.nodeIndex,search:g,commentIndex:this._interpolationState.commentIndex++,injections:m,invocation(f,E,N,P){if(!p.adapter){let x=f.nodes[this.nodeIndex],v=F();f.comments[this.commentIndex]=v,x.replaceWith(v),p.adapter=new D({anchorNode:v,composition:p,renderOptions:{target:null,context:f.options.context,store:f.options.store,injections:this.injections}})}let{adapter:_}=p,T=(P??f.options.store)[l];if(!T||T.length===0){_.removeEntries();return}let y=N[l],I={...N},C=p.props.some(x=>x!==l&&x in N);_.startBatch();let k;if(!C&&!(k=Array.isArray(y))){let x=k?y.entries():Object.entries(y);for(let[v,w]of x){if(v==="length"||w===null)continue;let O=+v,L=T[O];I[a]=w,this.injections[a]=L,this.injections.index=O,_.renderData(O,I,P,L,w)}}else{y||delete I[a];for(let[x,v]of T.entries()){let w;if(y){if(!C&&!(x in y)||(w=y[x],w===null))continue;I[a]=w}this.injections[a]=v,this.injections.index=x,_.renderData(x,I,P,v,w)}}_.stopBatch(),_.removeEntries(T.length)}};return p.interpolate({defaults:e.defaults,injections:m}),b.push(...p.props),this.addSearch(g),this.addAction(S),(this.tagsWithBindings??=new Set).add(c),p}interpolate(t){var i;this.interpolateOptions=t,this.cloneable=this.template.cloneNode(!0);let s=document.createTreeWalker(this.cloneable,5),n=s.nextNode();for(;n;){let o=null;switch(n.nodeType){case Node.ELEMENT_NODE:if(o=n,o.tagName==="TEMPLATE"){for(;o.contains(n=s.nextNode()););continue}if(o.tagName==="SCRIPT"){for(;o.contains(n=s.nextNode()););continue}if(o.hasAttribute("mdw-for")){for(;o.contains(n=s.nextNode()););this.#t(o,t);continue}else{let a=o.attributes.id;a&&(this.#s(a,o,t),this.#e(o));for(let l of[...o.attributes].reverse())l.nodeName!=="id"&&this.#s(l,o,t)}break;case Node.TEXT_NODE:if(o=n.parentElement,this.#s(n,o,t)){let a=s.nextNode();n.remove(),n=a;continue}break;default:throw new Error(`Unexpected node type: ${n.nodeType}`)}n=s.nextNode()}"adoptedStyleSheets"in document?this.adoptedStyleSheets=[...ut(this.styles)]:(this.stylesFragment=B(),this.stylesFragment.append(...dt(this.styles))),this.props=this.actionsByPropsUsed?[...this.actionsByPropsUsed.keys()]:[];for(let o of this.allIds)(i=this.tagsWithBindings)!=null&&i.has(o)||this.nodesToBind.push({tag:o,textNodes:[]});this.tags=this.nodesToBind.map(o=>o.tag),this.interpolated=!0}addSearch(t){return this.searches.push(t),t.query&&((this.searchByQuery??=new Map).set(t.query,t),this.initCache[t.cacheIndex]=t.defaultValue),t}addAction(t){let e=this.actionsByPropsUsed??=new Map;for(let s of t.search.propsUsed)e.has(s)?e.get(s).push(t):e.set(s,[t]);return t}};function ge(r,t){return(e,s,n)=>{s==null?n.refs[t].removeAttribute(r):n.refs[t].setAttribute(r,s)}}var Q=class r extends HTMLElement{static elementName;static get observedAttributes(){return this.attrList.keys()}compose(){return this.#t??=new R}static _composition=null;static _props=new Map;static _attrs=new Map;static _propChangedCallbacks=new Map;static _attributeChangedCallbacks=new Map;static _onComposeCallbacks=[];static _onConnectedCallbacks=[];static _onDisconnectedCallbacks=[];static _onConstructedCallbacks=[];static interpolatesTemplate=!0;static supportsElementInternals="attachInternals"in HTMLElement.prototype;static supportsElementInternalsRole=r.supportsElementInternals&&"role"in ElementInternals.prototype;static templatable=null;static defined=!1;static autoRegistration=!0;static registrations=new Map;static expressions=this.set;static methods=this.set;static overrides=this.set;static props=this.observe;static idl=this.prop;static _addCallback(t,e){if(!this.hasOwnProperty(t)){this[t]=[...this[t],e];return}this[t].push(e)}static append(...t){return this._onComposeCallbacks.push(({composition:e})=>{e.append(...t)}),this._addCallback("_onComposeCallbacks",(e=>{let{composition:s}=e;s.append(...t)})),this}static recompose(t){return this._addCallback("_onComposeCallbacks",t),this}static css(t,...e){return this._addCallback("_onComposeCallbacks",(s=>{let{composition:n}=s;typeof t=="string"||Array.isArray(t)?n.append(ft(t,...e)):n.append(t,...e)})),this}static autoRegister(t){return this.hasOwnProperty("defined")&&this.defined?this:(this.register(t),this)}static html(t,...e){return this._addCallback("_onComposeCallbacks",(s=>{let{composition:n}=s;n.append(ot(t,...e))})),this}static extend(t){return t?t(this):class extends this{}}static setStatic(t){return Object.assign(this,t),this}static readonly(t,e){return this.set(t,{...e,writable:!1})}static set(t,e){return Object.defineProperties(this.prototype,Object.fromEntries([...Object.entries(t).map(([s,n])=>(this.undefine(s),[s,{enumerable:s[0]!=="_",configurable:!0,value:n,writable:!0,...e}])),...Object.getOwnPropertySymbols(t).map(s=>[s,{enumerable:!1,configurable:!0,value:t[s],writable:!0,...e}])])),this}static mixin(t){return t(this)}static register(t){return t&&(this.elementName=t),customElements.define(this.elementName,this),r.registrations.set(this.elementName,this),this.defined=!0,this}static get propList(){return this.hasOwnProperty("_props")||(this._props=new Map(this._props)),this._props}static get attrList(){return this.hasOwnProperty("_attrs")||(this._attrs=new Map(this._attrs)),this._attrs}static get propChangedCallbacks(){return this.hasOwnProperty("_propChangedCallbacks")||(this._propChangedCallbacks=new Map([...this._propChangedCallbacks].map(([t,e])=>[t,e.slice()]))),this._propChangedCallbacks}static get attributeChangedCallbacks(){return this.hasOwnProperty("_attributeChangedCallbacks")||(this._attributeChangedCallbacks=new Map([...this._attributeChangedCallbacks].map(([t,e])=>[t,e.slice()]))),this._attributeChangedCallbacks}static prop(t,e){let s=st(this.prototype,t,e),{changedCallback:n,attr:i,reflect:o,watchers:a}=s;return n&&a.push([t,n]),s.changedCallback=function(h,c,u){this._onObserverPropertyChanged.call(this,t,h,c,u)},this.propList.set(t,s),i&&(o===!0||o==="read")&&(s.enumerable||!this.attrList.has(i)||!this.attrList.get(i).enumerable)&&this.attrList.set(i,s),this.onPropChanged(a),this}static define(t){return Object.defineProperties(this.prototype,Object.fromEntries(Object.entries(t).map(([e,s])=>(this.undefine(e),[e,{enumerable:e[0]!=="_",configurable:!0,...typeof s=="function"?{get:s}:s}])))),this}static undefine(t){if(Reflect.deleteProperty(this.prototype,t),this.propList.has(t)){let{watchers:e,attr:s,reflect:n}=this.propList.get(t);if(e.length&&this.propChangedCallbacks.has(t)){let i=this.propChangedCallbacks.get(t);for(let[o,a]of e){let l=i.indexOf(a);l!==-1&&i.splice(l,1)}}s&&(n===!0||n==="read")&&this.attrList.delete(s),this.propList.delete(t)}return this}static observe(t){for(let[e,s]of Object.entries(t??{})){let n=typeof s=="function"?{reflect:!1,get:s}:s;this.prop(e,n)}return this}static defineStatic(t){for(let[e,s]of Object.entries(t??{}))st(this,e,{reflect:!1,...typeof s=="function"?{get:s}:typeof s=="string"?{type:s}:s});return this}static events(t,e){return this.on({composed({composition:s}){for(let[n,i]of Object.entries(t)){let[,o,a]=n.match(/^([*1~]+)?(.*)$/),l,h=[];if(typeof i=="string"){let c=i.split(".");c.length===1?(l=i,h=[]):(l=c[0],h=c)}s.addCompositionEventListener({type:a,once:o==null?void 0:o.includes("1"),passive:o==null?void 0:o.includes("~"),capture:o==null?void 0:o.includes("*"),...typeof i=="function"?{handleEvent:i}:typeof i=="string"?{prop:l,deepProp:h}:i,...e})}}}),this}static childEvents(t,e){for(let[s,n]of Object.entries(t))this.events(n,{tag:j(s),...e});return this}static rootEvents(t,e){return this.events(t,{tag:R.shadowRootTag,...e})}static on(t,e){let s=typeof t=="string"?{[t]:e}:t;for(let[n,i]of Object.entries(s)){let o;switch(n){case"composed":o="_onComposeCallbacks";break;case"constructed":o="_onConstructedCallbacks";break;case"connected":o="_onConnectedCallbacks";break;case"disconnected":o="_onDisconnectedCallbacks";break;case"props":this.onPropChanged(i);continue;case"attrs":this.onAttributeChanged(i);continue;default:if(n.endsWith("Changed")){let a=n.slice(0,n.length-7);this.onPropChanged({[a]:i});continue}throw new Error("Invalid callback name")}this._addCallback(o,i)}return this}static onPropChanged(t){let e=Array.isArray(t)?t:Object.entries(t),{propChangedCallbacks:s}=this;for(let[n,i]of e)s.has(n)?s.get(n).push(i):s.set(n,[i]);return this}static onAttributeChanged(t){let e=Array.isArray(t)?t:Object.entries(t),{attributeChangedCallbacks:s}=this;for(let[n,i]of e)s.has(n)?s.get(n).push(i):s.set(n,[i]);return this}#n;#s=new Map;#e=new Map;#t;#r=!1;#i=[];_propAttributeCache;_callbackArguments=null;constructor(...t){super(),r.supportsElementInternals&&(this.elementInternals=this.attachInternals()),this.attachShadow({mode:"open",delegatesFocus:this.delegatesFocus}),this.render=this.composition.render(this.constructor.prototype,this,{defaults:this.constructor.prototype,store:this,shadowRoot:this.shadowRoot,context:this});for(let e of this.static._onConstructedCallbacks)e.call(this,this.callbackArguments)}propChangedCallback(t,e,s,n=s){this.#r?this.#i.push([t,n,this]):this.render.byProp(t,n,this);let{_propChangedCallbacks:i}=this.static;if(i.has(t))for(let o of i.get(t))o.call(this,e,s,n,this)}attributeChangedCallback(t,e,s){let{attributeChangedCallbacks:n}=this.static;if(n.has(t))for(let c of n.get(t))c.call(this,e,s,this);let{attrList:i}=this.static;if(!i.has(t))return;let o=i.get(t);if(o.attributeChangedCallback){o.attributeChangedCallback.call(this,t,e,s);return}let a;if(this.attributeCache.has(t)&&(a=this.attributeCache.get(t),a.stringValue===s))return;let l=this[o.key],h=s===null?o.nullParser(s):o.type==="boolean"?!0:o.parser(s);h!==l&&(a?(a.stringValue=s,a.parsedValue=h):this.attributeCache.set(t,{stringValue:s,parsedValue:h}),this[o.key]=h)}get#o(){var t;return(t=this.#t)==null?void 0:t.template}_onObserverPropertyChanged(t,e,s,n){let{propList:i}=this.static;if(i.has(t)){let{reflect:o,attr:a}=i.get(t);if(a&&(o===!0||o==="write")){let l,h=!1,{attributeCache:c}=this;if(c.has(a)?(l=c.get(a),h=l.parsedValue!==s):(l={},c.set(a,l),h=!0),h){let u=gt(s);l.parsedValue=s,l.stringValue=u,u==null?this.removeAttribute(a):this.setAttribute(a,u)}}}this.propChangedCallback(t,e,s,n)}patch(t){this.#r=!0,Y(this,t);for(let[e,s,n]of this.#i)e in t||this.render.byProp(e,s,n);this.#i.slice(0,this.#i.length),this.render(t),this.#r=!1}get refs(){return this.#n??=new Proxy({},{get:(t,e)=>{this.#t;let s=this.composition,n;if(!s.interpolated){if(this.#e.has(e)&&(n=this.#e.get(e).deref(),n))return n;let a=j(e);return n=s.template.getElementById(a),n?(this.#e.set(e,new WeakRef(n)),n):null}if(this.#s.has(e)&&(n=this.#s.get(e).deref(),n))return n;let i=j(e),o=this.composition.tags.indexOf(i);return n=this.render.state.refs[o],n?(this.#s.set(e,new WeakRef(n)),n):null}})}get attributeCache(){return this._propAttributeCache??=new Map}get static(){return this.constructor}get unique(){return!1}get callbackArguments(){return this._callbackArguments??={composition:this.#t,refs:this.refs,html:ot.bind(this),inline:rt,template:this.#o,element:this}}get composition(){if(this.#t)return this.#t;if(!this.unique&&this.static.hasOwnProperty("_composition"))return this.#t=this.static._composition,this.static._composition;this.compose();for(let t of this.static._onComposeCallbacks)t.call(this,this.callbackArguments);return this.unique||(this.static._composition=this.#t),this.#t}connectedCallback(){for(let t of this.static._onConnectedCallbacks)t.call(this,this.callbackArguments)}disconnectedCallback(){for(let t of this.static._onDisconnectedCallbacks)t.call(this,this.callbackArguments)}};Q.prototype.delegatesFocus=!1;export{ge as cloneAttributeCallback,Q as default};
1
+ var Pt,_t;function lt(){return(Pt??=new Text).cloneNode()}function F(){return(_t??=new Comment).cloneNode()}var D=class{constructor(t){this.anchorNode=t.anchorNode,this.metadata=[],this.keys=[],this.needsArrayKeyFastPath=!1,this.composition=t.composition,this.renderOptions=t.renderOptions,this.metadataCache=null,this.queuedElements=[],this.batchStartIndex=null,this.batchEndIndex=null}render(t,e){return this.composition.render(t,e,this.renderOptions)}startBatch(){this.needsArrayKeyFastPath=!0}writeBatch(){var e;if(!this.queuedElements.length)return;(((e=this.metadata[this.batchStartIndex-1])==null?void 0:e.domNode)??this.anchorNode).after(...this.queuedElements),this.queuedElements.length=0}stopBatch(){if(this.writeBatch(),this.needsArrayKeyFastPath=!1,this.batchStartIndex=null,this.batchEndIndex=null,this.metadataCache){for(let{domNode:t}of this.metadataCache.values())t.remove();this.metadataCache.clear()}}removeByIndex(t){let[e]=this.metadata.splice(t,1),{domNode:s,key:n}=e;this.keys.splice(t,1),s.remove(),this.metadataCache?this.metadataCache.set(n,e):this.metadataCache=new Map([[n,e]])}renderData(t,e,s,n,i,o){var h;if(t<this.metadata.length){let c=this.metadata[t],u=c.key,p=u===n,m=i!==n;if(p){m?c.render(e,s):o||c.render(e,s);return}let b=this.metadataCache??=new Map,g=!1;this.needsArrayKeyFastPath&&(g=!this.keys.includes(n),this.needsArrayFastPath=!1);let S=g?-1:this.keys.indexOf(n,t+1);if(S===-1){if(b.has(n)){let d=b.get(n);this.metadata.splice(t,0,d),this.keys.splice(t,0,n),(((h=this.metadata[t-1])==null?void 0:h.domNode)??this.anchorNode).after(d.domNode),b.delete(n);return}b.set(u,c)}else{if(t-S===-1){this.removeByIndex(t);return}let d=this.metadata[S];this.metadata[t]=d,this.metadata.splice(S,1);let{domNode:f}=c;f.replaceWith(d.domNode),o||d.render(e,s),this.keys[t]=n,this.keys.splice(S,1),f.remove(),b.set(u,c);return}}let a=this.render(e,s),l=a.target;this.metadata[t]={render:a,element:l,key:n,domNode:l},this.keys[t]=n,(this.batchEndIndex===null||this.batchEndIndex!==t-1)&&(this.writeBatch(),this.batchStartIndex=t),this.batchEndIndex=t,this.queuedElements.push(l)}removeEntries(t=0){let{length:e}=this.metadata;for(let s=e-1;s>=t;s--)this.metadata[s].domNode.remove();this.metadata.length=t,this.keys.length=t}hide(t,e,s){if(!e&&(t==null&&(t=this.keys.indexOf(s)),e=this.metadata[t],!e)||e.hidden)return!1;let{comment:n,element:i}=e;return n||(n=F(),e.comment=n),i.replaceWith(n),e.domNode=n,e.hidden=!0,!0}show(t,e,s){if(!e&&(t==null&&(t=this.keys.indexOf(s)),e=this.metadata[t],!e)||!e.hidden)return!1;let{comment:n,element:i}=e;return n.replaceWith(i),e.domNode=i,e.hidden=!1,!0}};var G=new Map;function V(r,t=!0){if(t&&G.has(r))return G.get(r);let e=new CSSStyleSheet;return e.replaceSync(r),t&&G.set(r,e),e}var X=new Map,ct;function At(r,t=!0){let e;return t&&X.has(r)?e=X.get(r):(ct??=document.implementation.createHTMLDocument(),e=ct.createElement("style"),e.textContent=r,t&&X.set(r,e)),e.cloneNode(!0)}var q;function ht(r,t=!0){if(q==null)try{let e=V(r,t);return q=!0,e}catch{q=!1}return q?V(r,t):At(r,t)}function*ut(r,t=!0){for(let e of r)e instanceof HTMLStyleElement?yield V(e.textContent,t):e.ownerNode?yield V([...e.cssRules].map(s=>s.cssText).join(""),t):yield e}var z=new WeakMap;function*dt(r,t=!0){for(let e of r)if(e instanceof HTMLStyleElement)yield e;else if(e.ownerNode instanceof HTMLStyleElement)yield e.ownerNode.cloneNode(!0);else if(t&&z.has(e))yield z.get(e).cloneNode(!0);else{let s=document.createElement("style");s.textContent=[...e.cssRules].map(n=>n.cssText).join(""),t&&z.set(e,s),yield s.cloneNode(!0)}}function ft(r,...t){return ht(typeof r=="string"?r:String.raw({raw:r},...t))}function gt(r){switch(r){case void 0:case null:case!1:return null;case!0:return"";default:return`${r}`}}var $;function j(r){if($??=new Map,$.has(r))return $.get(r);let t=r.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);return $.set(r,t),t}var pt,Ot=Number.parseFloat((pt=navigator.userAgent.match(/Chrome\/([\d.]+)/))==null?void 0:pt[1]),mt,Gt=Number.parseFloat((mt=navigator.userAgent.match(/Firefox\/([\d.]+)/))==null?void 0:mt[1]),bt,Xt=Ot||!navigator.userAgent.includes("AppleWebKit")?Number.NaN:Number.parseFloat((bt=navigator.userAgent.match(/Version\/([\d.]+)/))==null?void 0:bt[1]);function Y(r,t){if(r===t)return r;if(r==null||t==null||typeof t!="object")return t;typeof r!="object"&&(r={});for(let[e,s]of Object.entries(t))s==null?e in r&&delete r[e]:r[e]=Y(r[e],s);return r}function H(r,t,e="reference"){if(r===t)return null;if(t==null||typeof t!="object")return t;if(r==null||typeof r!="object")return structuredClone(t);let s={};if(Array.isArray(t)){if(e==="reference")return t;if(e==="clone")return structuredClone(t);for(let[i,o]of t.entries()){if(o===null){s[i]=null;continue}if(o==null)continue;let a=H(r[i],o,e);a!==null&&(s[i]=a)}return t.length!==r.length&&(s.length=t.length),s}let n=new Set(Object.keys(r));for(let[i,o]of Object.entries(t)){if(n.delete(i),o===null){s[i]=null;continue}if(o==null)continue;let a=H(r[i],o,e);a!==null&&(s[i]=a)}for(let i of n)s[i]=null;return s}function Z(r,t){if(r===t)return!1;if(t==null||typeof t!="object"||r!=null&&typeof r!="object")return!0;for(let[e,s]of Object.entries(t))if(s==null){if(e in r)return!0}else if(Z(r[e],s))return!0;return!1}function yt(r){switch(r){case"boolean":return!1;case"integer":case"float":return 0;case"map":return new Map;case"set":return new Set;case"array":return[];case"object":return null;default:case"string":return""}}function tt(r,t,e,s){return r??={},new Proxy(r,{get(n,i){let o=n[i];if(typeof i!="symbol"){let a=s?`${s}.${i}`:i;if(s?e.add(a):t.add(a),typeof o=="object"&&o!=null)return tt(o,t,e,a)}return o},has(n,i){let o=Reflect.has(n,i);if(typeof i!="symbol"){let a=s?`${s}.p`:i;s?e.add(a):t.add(a)}return o}})}function Mt(r){switch(r){case"boolean":return t=>!!t;case"integer":return Math.round;case"float":return t=>+t;case"map":return Map;case"set":return Set;case"object":case"array":return t=>t;default:case"string":return t=>`${t}`}}function et(r,...t){let e=new Set,s=new Set,n=t.map(l=>{let h=new Set,c=new Set,u=tt(l,h,c);return{poked:h,pokedDeep:c,proxy:u}}),i=tt(this??{},e,s),o=r.apply(i,n.map(l=>l.proxy)),a=r.name?!0:!e.size;return{props:{this:[...e],args:n.map(l=>[...l.poked])},deepPropStrings:{this:[...s],args:n.map(l=>[...l.pokedDeep])},deepProps:{this:[...s].map(l=>l.split(".")),args:n.map(l=>[...l.pokedDeep].map(h=>h.split(".")))},defaultValue:o,reusable:a}}function Tt(){return null}function Ft(r,t,e){let s=typeof t=="string"?{type:t}:t,{watchers:n,value:i,readonly:o,empty:a,type:l,enumerable:h,reflect:c,attr:u,nullable:p,parser:m,nullParser:b,get:g,is:S,diff:d,props:f}=s;if(n??=[],o??=!1,a===void 0&&(a=null),i??=a,g&&!f){let E=et(g.bind(e),e,()=>i);i??=E.defaultValue,f=new Set([...E.props.this,...E.props.args[0]])}if(!l)if(i==null)l="string";else{let E=typeof i;l=E==="number"?Number.isInteger(i)?"integer":"number":E}return h??=r[0]!=="_",p??=l==="boolean"?!1:a==null,p||(a??=yt(l),i??=a),c??=h?l!=="object":u?"write":!1,u??=c?j(r):null,m??=Mt(l),b||(p?b=Tt:b=a===null?()=>yt(l):()=>a),S??=l==="object"?(E,N)=>!Z(E,N):l==="array"?()=>!1:Object.is,d===void 0&&(d=l==="object"?(E,N)=>H(E,N,"reference"):null),{...s,type:l,is:S,diff:d,attr:u,reflect:c,readonly:o,enumerable:h,value:i,parser:m,nullParser:b,key:r,props:f,watchers:n}}function J(r,t,e){var i,o;r.get;let s=e==null?r.nullParser.call(this,e):r.parser.call(this,e),n=s;if(t==null){if(s==null)return!1}else if(s!=null){if(r.diff){if(n=r.diff.call(this,t,s),n==null)return!1}else if(r.is.call(this,t,s))return!1}return r.values?r.values.set(this,s):r.values=new WeakMap([[this,s]]),(i=r.propChangedCallback)==null||i.call(this,r.key,t,s,n),(o=r.changedCallback)==null||o.call(this,t,s,n),!0}function st(r,t,e){let s=Ft(t,e,r);function n(){var c;return(c=s.values)!=null&&c.has(this)?s.values.get(this):s.value}function i(c){let u=this[t];J.call(this,s,u,c)}function o(){var p,m;let c=(p=s.computedValues)==null?void 0:p.get(this),u=this[t];(m=s.needsSelfInvalidation)==null||m.delete(this),J.call(this,s,c,u)}if(s.props)for(let c of s.props)s.watchers.push([c,o]);function a(){let c=s.get.call(this,this,n.bind(this));return(s.computedValues??=new WeakMap).set(this,c),c}function l(c){s.needsSelfInvalidation?s.needsSelfInvalidation.add(this):s.needsSelfInvalidation=new WeakSet([this]);let u=this[t];s.set.call(this,c,i.bind(this));let p=this[t];s.needsSelfInvalidation.has(this)&&(s.needsSelfInvalidation.delete(this),J.call(this,s,u,p))}let h={enumerable:s.enumerable,configurable:!0,get:s.get?a:n,set:s.set?l:i};return Object.defineProperty(r,t,h),s}var Ct=new Set;function U(r="mdw_",t=4){let e;for(;Ct.has(e=Math.random().toString(36).slice(2,t+2)););return Ct.add(e),`${r}${e}`}var nt,St,xt;function B(r){return nt??=document.implementation.createHTMLDocument(),r?(xt??=nt.createRange(),xt.createContextualFragment(r)):(St??=nt.createDocumentFragment(),St.cloneNode())}var K=new Map;function rt(r){let t=`#${U()}`;return K.set(t,{fn:r}),`{${t}}`}var it=new Map;function ot(r,...t){let e,s=t.map(o=>{switch(typeof o){case"string":return o;case"function":return rt(o);case"object":{if(o==null)return"";let a=U();return e??=new Map,e.set(a,o),`<div id="${a}"></div>`}default:throw new Error(`Unexpected substitution: ${o}`)}}),n=String.raw({raw:r},...s);if(e){let o=B(n);for(let[a,l]of e)o.getElementById(a).replaceWith(l);return o}let i;return it.has(n)?i=it.get(n):(i=B(n),it.set(n,i)),i.cloneNode(!0)}function jt({nodes:r},t){let{nodeIndex:e,attrName:s}=this,n=r[e];switch(t){case void 0:case null:case!1:return n.removeAttribute(s),!1;case!0:return n.setAttribute(s,""),"";default:return n.setAttribute(s,t),t}}function Bt({nodeStates:r,comments:t,nodes:e},s){let{commentIndex:n,nodeIndex:i}=this,o=r[i],a=o&1;if(!(s!=null&&s!==!1)){if(a)return;let u=t[n];u||(u=F(),t[n]=u),e[i].replaceWith(u),r[i]|=1;return}let h=e[i],c=o&2;if(typeof s!="object")if(c){let u=new Text(s);h.replaceWith(u),e[i]=u,r[i]&=-3}else h.data=s;a&&(t[n].replaceWith(h),r[i]&=-2)}function Rt({nodeStates:r,nodes:t,comments:e},s){let{commentIndex:n,nodeIndex:i}=this,o=r[i]&1,a=s!=null&&s!==!1;if(a===!o)return;let l=t[i],h=e[n];h||(h=F(),e[n]=h),a?(h.replaceWith(l),r[i]&=-2):(l.replaceWith(h),r[i]|=1)}function Lt({comments:r,nodeStates:t,nodes:e}){let{commentIndex:s,nodeIndex:n}=this,i=F();r[s]=i,t[n]|=1,e[n].replaceWith(i)}function at(r,...t){let[{caches:e,searchStates:s}]=t,{cacheIndex:n,searchIndex:i,subSearch:o,invocation:a}=r,l=e[n],h=s[i];if(h&1)return{value:l,dirty:(h&2)===2};s[i]|=1;let c;if(a){if(o){let u=at(o,...t);if(!u.dirty&&l!==void 0)return s[i]&=-3,{value:l,dirty:!1};c=r.invocation(u.value)}else c=r.invocation(...t);if(c===void 0||l===c)return{value:c,dirty:!1}}return e[n]=c,s[i]|=2,{value:c,dirty:!0}}function wt({options:{context:r,store:t,injections:e}},s,n){return this.expression.call(r,t??n,e)}function Wt(r,t){return t[this.prop]}function Dt(r,t,e){let s=t;for(let n of this.deepProp){if(s===null)return null;if(!(n in s))return;s=s[n]}return s}var Ut=/{([^}]*)}/g;function qt(r,t){if(t)return t[r]}function Et(r,t){if(!t)return;let e=t,s;for(s of r)if(typeof e=="object"){if(e===null)return null;if(!(s in e))return;e=e[s]}else return e[s];return e}function Vt(r,t){let e=t;for(let s of r.split("."))if(!s||(e=e[s],e==null))return null;return e===t?null:e}var Nt=new Map,R=class r{static EVENT_PREFIX_REGEX=/^([*1~]+)?(.*)$/;_interpolationState={nodeIndex:-1,searchIndex:0,cacheIndex:0,commentIndex:0,nodeEntry:null};static shadowRootTag=Symbol();nodesToBind=[];props=[];searches=[];initCache=[];searchByQuery;actionsByPropsUsed;postInitActions=[];tagsWithBindings;tags=[];adapter;events;cloneable;styles=[];adoptedStyleSheets=[];stylesFragment;allIds=[];temporaryIds;interpolated=!1;constructor(...t){this.template=B(),this.append(...t)}*[Symbol.iterator](){for(let t of this.styles)yield t;yield this.template}static compose(...t){for(let[s,n]of Nt)if(s.length===t.length&&t.every((i,o)=>i===s[o]))return n;let e=new r(...t);return Nt.set(t,e),e}append(...t){for(let e of t)typeof e=="string"?this.append(B(e.trim())):e instanceof r?this.append(...e):e instanceof DocumentFragment?this.template.append(e):(e instanceof CSSStyleSheet||e instanceof HTMLStyleElement)&&this.styles.push(e);return this}addCompositionEventListener(t){let e=t.tag??"",s=this.events??=new Map;return s.has(e)?s.get(e).push(t):s.set(e,[t]),this}#n(t,e,s){var n;if((n=this.events)!=null&&n.has(t))for(let i of this.events.get(t)){let o;i.handleEvent?o=i.handleEvent:i.deepProp.length?o=Et(i.deepProp,this.interpolateOptions.defaults):o=qt(i.prop,this.interpolateOptions.defaults),e.addEventListener(i.type,s?o.bind(s):o,i)}}render(t,e,s={}){this.interpolated||this.interpolate({defaults:e??t,...s});let n=this.cloneable.cloneNode(!0),i=s.shadowRoot,o=i??s.target??n.firstElementChild,a={lastChildNode:null,lastChildNodeIndex:0,lastElement:null,nodeStates:new Uint8Array(this._interpolationState.nodeIndex+1),searchStates:new Uint8Array(this._interpolationState.searchIndex),comments:[],nodes:[],caches:this.initCache.slice(),refs:[],options:s},{nodes:l,refs:h,searchStates:c,caches:u}=a;for(let{tag:m,textNodes:b}of this.nodesToBind){let g;if(m===""){if(!b.length)continue;h.push(null),l.push(null),g=n.firstChild}else{let d=n.getElementById(m);if(h.push(d),l.push(d),this.#n(m,d,s.context),!b.length)continue;g=d.firstChild}let S=0;for(let d of b){for(;d!==S;)g=g.nextSibling,S++;l.push(g)}}this.#n("",s.context),this.#n(r.shadowRootTag,s.context.shadowRoot,s.context);for(let m of this.postInitActions)m.invocation(a);let p=(m,b)=>{var S;if(!m)return;let g=!1;for(let d of this.props){if(!((S=this.actionsByPropsUsed)!=null&&S.has(d))||!(d in m))continue;let f=this.actionsByPropsUsed.get(d);for(let E of f){g=!0;let{dirty:N,value:P}=at(E.search,a,m,b);N&&E.invocation(a,P,m,b)}}g&&c.fill(0)};return i?(s.context??=i.host,"adoptedStyleSheets"in i?this.adoptedStyleSheets.length&&(i.adoptedStyleSheets=[...i.adoptedStyleSheets,...this.adoptedStyleSheets]):this.stylesFragment.hasChildNodes()&&n.prepend(this.stylesFragment.cloneNode(!0))):s.context??=o,t!==this.interpolateOptions.defaults&&p(t,e),i&&(i.append(n),customElements.upgrade(i)),p.target=o,p.byProp=(m,b,g)=>{var E,N;if(!((E=this.actionsByPropsUsed)!=null&&E.has(m)))return;let S=!1;if((N=this.searchByQuery)!=null&&N.has(m)){S=!0;let P=this.searchByQuery.get(m);if(u[P.cacheIndex]===b)return;u[P.cacheIndex]=b,c[P.searchIndex]=3}let d,f=this.actionsByPropsUsed.get(m);for(let P of f)if(P.search.query===m)P.invocation(a,b);else{d??={[m]:b},g??=d,S=!0;let _=at(P.search,a,d,g);_.dirty&&P.invocation(a,_.value,d,g)}S&&c.fill(0)},p.state=a,p}#s(t,e,s,n){var _,T;let{nodeValue:i,nodeName:o,nodeType:a}=t,l,h;if(a===Node.ATTRIBUTE_NODE?l=t:h=t,n==null){if(!i)return;let y=i.trim();if(!y)return;if(l||(e==null?void 0:e.tagName)==="STYLE"){if(y[0]!=="{")return;let{length:I}=y;if(y[I-1]!=="}")return;n=y.slice(1,-1)}else{let I=y.split(Ut);if(I.length<3)return;if(I.length===3&&!I[0]&&!I[2])n=I[1];else{for(let[C,k]of I.entries())if(C%2){let x=lt();h.before(x),this.#s(x,e,s,k)}else k&&h.before(k);return!0}}}let c=n,u=n[0]==="!",p=!1;u&&(n=n.slice(1),p=n[0]==="!",p&&(n=n.slice(1)));let m,b;if(h){e!==h.parentElement&&(e=h.parentElement),b=0;let y=h;for(;y=y.previousSibling;)b++}else if(e!==l.ownerElement&&(e=l.ownerElement),o.startsWith("on")){let y=o.indexOf("-");if(y===-1)return;m=y===2}if(m){e.removeAttribute(o);let y=this.#e(e),I=o.slice(3),[,C,k]=I.match(/^([*1~]+)?(.*)$/),x,v,w=[];if(n.startsWith("#"))x=K.get(n).fn;else{let O=n.split(".");O.length===1?(v=n,w=[]):(v=O[0],w=O)}this.addCompositionEventListener({tag:y,type:k,handleEvent:x,prop:v,deepProp:w,once:C==null?void 0:C.includes("1"),passive:C==null?void 0:C.includes("~"),capture:C==null?void 0:C.includes("*")});return}let g;if((_=this.searchByQuery)!=null&&_.has(c))g=this.searchByQuery.get(c);else{let y=n,I=y!==c,C;if(I&&((T=this.searchByQuery)!=null&&T.has(y)))C=this.searchByQuery.get(y);else{let k,x,v,w,O,L,W,A;if(n.startsWith("#")){if(A=K.get(n),!A)return;k=A.fn,W=wt,A.props?(x=A.props,v=A.deepProps,w=A.defaultValue??null):w=A.fn}else w=null,s!=null&&s.defaults&&(w=Et(n.split("."),s.defaults)??null),w==null&&(s!=null&&s.injections)&&(w=Vt(n,s.injections));if(!x)if(typeof w=="function"){let M=et.call(this,w,s==null?void 0:s.defaults,s==null?void 0:s.injections),It=new Set([...M.props.this,...M.props.args[0],...M.props.args[1]]),vt=new Set([...M.deepPropStrings.this,...M.deepPropStrings.args[0]]);k=w,w=M.defaultValue,x=[...It],v=[...vt].map(kt=>kt.split(".")),W=wt}else{let M=n.split(".");M.length===1?(O=n,x=[O],W=Wt):(x=[M[0]],L=M,v=[M],W=Dt)}A&&(A.defaultValue=w,A.props=x,A.deepProps=v),C={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:y,defaultValue:w,subSearch:null,prop:O,propsUsed:x,deepProp:L,deepPropsUsed:v,invocation:W,expression:k},this.addSearch(C)}I?(g={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:c,subSearch:C,negate:u,doubleNegate:p,prop:C.prop,deepProp:C.deepProp,propsUsed:C.propsUsed,deepPropsUsed:C.deepPropsUsed,defaultValue:p?!!C.defaultValue:u?!C.defaultValue:C.defaultValue,invocation(k){return this.doubleNegate?!!k:this.negate?!k:k}},this.addSearch(g)):g=C}let S,d=null,f=g.defaultValue;h?d=b:o==="mdw-if"?(S=this.#e(e),e.removeAttribute(o),f=f!=null&&f!==!1):(d=o,o==="id"||f==null||f===!1?e.removeAttribute(o):e.setAttribute(o,f===!0?"":f)),S??=this.#e(e);let E=this._interpolationState.nodeEntry;(!E||E.tag!==S)&&(E={tag:S,textNodes:[]},this._interpolationState.nodeEntry=E,this.nodesToBind.push(E),this._interpolationState.nodeIndex++);let N;if(h)switch(E.textNodes.push(b),this._interpolationState.nodeIndex++,N={nodeIndex:this._interpolationState.nodeIndex,commentIndex:this._interpolationState.commentIndex++,invocation:Bt,defaultValue:f,search:g},typeof f){case"string":h.data=f;break;case"number":h.data=`${f}`;break;default:h.data="";break}else d?N={nodeIndex:this._interpolationState.nodeIndex,attrName:d,defaultValue:f,invocation:jt,search:g}:(N={nodeIndex:this._interpolationState.nodeIndex,commentIndex:this._interpolationState.commentIndex++,defaultValue:f,invocation:Rt,search:g},f||this.postInitActions.push({...N,invocation:Lt}));this.addAction(N),(this.tagsWithBindings??=new Set).add(S)}#e(t){if(!t)return"";let e=t.id;return e?this.allIds.includes(e)||this.allIds.push(e):(e=U(),(this.temporaryIds??=new Set).add(e),this.allIds.push(e),t.id=e),e}#t(t,e){let s=t.getAttribute("mdw-for"),n=s==null?void 0:s.trim();if(!n||n[0]!=="{")return null;let{length:i}=n;if(n[i-1]!=="}")return null;let o=n.slice(1,-1),[a,l]=o.split(/\s+of\s+/);t.removeAttribute("mdw-for");let h=t.ownerDocument.createElement("template");t.replaceWith(h);let c=this.#e(h),u=this._interpolationState.nodeEntry;(!u||u.tag!==c)&&(u={tag:c,textNodes:[]},this._interpolationState.nodeEntry=u,this.nodesToBind.push(u),this._interpolationState.nodeIndex++);let p=new r;p.template.append(t);let m={...e.injections,[a]:null,index:null},b=[l],g={cacheIndex:this._interpolationState.cacheIndex++,searchIndex:this._interpolationState.searchIndex++,query:null,prop:null,deepProp:null,propsUsed:b,deepPropsUsed:[[l]],defaultValue:{},invocation:null},S={defaultValue:null,nodeIndex:this._interpolationState.nodeIndex,search:g,commentIndex:this._interpolationState.commentIndex++,injections:m,invocation(f,E,N,P){if(!p.adapter){let x=f.nodes[this.nodeIndex],v=F();f.comments[this.commentIndex]=v,x.replaceWith(v),p.adapter=new D({anchorNode:v,composition:p,renderOptions:{target:null,context:f.options.context,store:f.options.store,injections:this.injections}})}let{adapter:_}=p,T=(P??f.options.store)[l];if(!T||T.length===0){_.removeEntries();return}let y=N[l],I={...N},C=p.props.some(x=>x!==l&&x in N);_.startBatch();let k;if(!C&&!(k=Array.isArray(y))){let x=k?y.entries():Object.entries(y);for(let[v,w]of x){if(v==="length"||w===null)continue;let O=+v,L=T[O];I[a]=w,this.injections[a]=L,this.injections.index=O,_.renderData(O,I,P,L,w)}}else{y||delete I[a];for(let[x,v]of T.entries()){let w;if(y){if(!C&&!(x in y)||(w=y[x],w===null))continue;I[a]=w}this.injections[a]=v,this.injections.index=x,_.renderData(x,I,P,v,w)}}_.stopBatch(),_.removeEntries(T.length)}};return p.interpolate({defaults:e.defaults,injections:m}),b.push(...p.props),this.addSearch(g),this.addAction(S),(this.tagsWithBindings??=new Set).add(c),p}interpolate(t){var i;this.interpolateOptions=t,this.cloneable=this.template.cloneNode(!0);let s=document.createTreeWalker(this.cloneable,5),n=s.nextNode();for(;n;){let o=null;switch(n.nodeType){case Node.ELEMENT_NODE:if(o=n,o.tagName==="TEMPLATE"){for(;o.contains(n=s.nextNode()););continue}if(o.tagName==="SCRIPT"){for(;o.contains(n=s.nextNode()););continue}if(o.hasAttribute("mdw-for")){for(;o.contains(n=s.nextNode()););this.#t(o,t);continue}else{let a=o.attributes.id;a&&(this.#s(a,o,t),this.#e(o));for(let l of[...o.attributes].reverse())l.nodeName!=="id"&&this.#s(l,o,t)}break;case Node.TEXT_NODE:if(o=n.parentElement,this.#s(n,o,t)){let a=s.nextNode();n.remove(),n=a;continue}break;default:throw new Error(`Unexpected node type: ${n.nodeType}`)}n=s.nextNode()}"adoptedStyleSheets"in document?this.adoptedStyleSheets=[...ut(this.styles)]:(this.stylesFragment=B(),this.stylesFragment.append(...dt(this.styles))),this.props=this.actionsByPropsUsed?[...this.actionsByPropsUsed.keys()]:[];for(let o of this.allIds)(i=this.tagsWithBindings)!=null&&i.has(o)||this.nodesToBind.push({tag:o,textNodes:[]});this.tags=this.nodesToBind.map(o=>o.tag),this.interpolated=!0}addSearch(t){return this.searches.push(t),t.query&&((this.searchByQuery??=new Map).set(t.query,t),this.initCache[t.cacheIndex]=t.defaultValue),t}addAction(t){let e=this.actionsByPropsUsed??=new Map;for(let s of t.search.propsUsed)e.has(s)?e.get(s).push(t):e.set(s,[t]);return t}};function ge(r,t){return(e,s,n)=>{s==null?n.refs[t].removeAttribute(r):n.refs[t].setAttribute(r,s)}}var Q=class r extends HTMLElement{static elementName;static get observedAttributes(){return this.attrList.keys()}compose(){return this.#t??=new R}static _composition=null;static _props=new Map;static _attrs=new Map;static _propChangedCallbacks=new Map;static _attributeChangedCallbacks=new Map;static _onComposeCallbacks=[];static _onConnectedCallbacks=[];static _onDisconnectedCallbacks=[];static _onConstructedCallbacks=[];static interpolatesTemplate=!0;static supportsElementInternals="attachInternals"in HTMLElement.prototype;static supportsElementInternalsRole=r.supportsElementInternals&&"role"in ElementInternals.prototype;static templatable=null;static defined=!1;static autoRegistration=!0;static registrations=new Map;static expressions=this.set;static methods=this.set;static overrides=this.set;static props=this.observe;static idl=this.prop;static _addCallback(t,e){if(!this.hasOwnProperty(t)){this[t]=[...this[t],e];return}this[t].push(e)}static append(...t){return this._onComposeCallbacks.push(({composition:e})=>{e.append(...t)}),this._addCallback("_onComposeCallbacks",(e=>{let{composition:s}=e;s.append(...t)})),this}static recompose(t){return this._addCallback("_onComposeCallbacks",t),this}static css(t,...e){return this._addCallback("_onComposeCallbacks",(s=>{let{composition:n}=s;typeof t=="string"||Array.isArray(t)?n.append(ft(t,...e)):n.append(t,...e)})),this}static autoRegister(t){return this.hasOwnProperty("defined")&&this.defined?this:(this.register(t),this)}static html(t,...e){return this._addCallback("_onComposeCallbacks",(s=>{let{composition:n}=s;n.append(ot(t,...e))})),this}static extend(t){return t?t(this):class extends this{}}static setStatic(t){return Object.assign(this,t),this}static readonly(t,e){return this.set(t,{...e,writable:!1})}static set(t,e){return Object.defineProperties(this.prototype,Object.fromEntries([...Object.entries(t).map(([s,n])=>(this.undefine(s),[s,{enumerable:s[0]!=="_",configurable:!0,value:n,writable:!0,...e}])),...Object.getOwnPropertySymbols(t).map(s=>[s,{enumerable:!1,configurable:!0,value:t[s],writable:!0,...e}])])),this}static mixin(t){return t(this)}static register(t){return t&&(this.elementName=t),customElements.define(this.elementName,this),r.registrations.set(this.elementName,this),this.defined=!0,this}static get propList(){return this.hasOwnProperty("_props")||(this._props=new Map(this._props)),this._props}static get attrList(){return this.hasOwnProperty("_attrs")||(this._attrs=new Map(this._attrs)),this._attrs}static get propChangedCallbacks(){return this.hasOwnProperty("_propChangedCallbacks")||(this._propChangedCallbacks=new Map([...this._propChangedCallbacks].map(([t,e])=>[t,e.slice()]))),this._propChangedCallbacks}static get attributeChangedCallbacks(){return this.hasOwnProperty("_attributeChangedCallbacks")||(this._attributeChangedCallbacks=new Map([...this._attributeChangedCallbacks].map(([t,e])=>[t,e.slice()]))),this._attributeChangedCallbacks}static prop(t,e){let s=st(this.prototype,t,e),{changedCallback:n,attr:i,reflect:o,watchers:a}=s;return n&&a.push([t,n]),s.changedCallback=function(h,c,u){this._onObserverPropertyChanged.call(this,t,h,c,u)},this.propList.set(t,s),i&&(o===!0||o==="read")&&(s.enumerable||!this.attrList.has(i)||!this.attrList.get(i).enumerable)&&this.attrList.set(i,s),this.onPropChanged(a),this}static define(t){return Object.defineProperties(this.prototype,Object.fromEntries(Object.entries(t).map(([e,s])=>(this.undefine(e),[e,{enumerable:e[0]!=="_",configurable:!0,...typeof s=="function"?{get:s}:s}])))),this}static undefine(t){if(Reflect.deleteProperty(this.prototype,t),this.propList.has(t)){let{watchers:e,attr:s,reflect:n}=this.propList.get(t);if(e.length&&this.propChangedCallbacks.has(t)){let i=this.propChangedCallbacks.get(t);for(let[o,a]of e){let l=i.indexOf(a);l!==-1&&i.splice(l,1)}}s&&(n===!0||n==="read")&&this.attrList.delete(s),this.propList.delete(t)}return this}static observe(t){for(let[e,s]of Object.entries(t??{})){let n=typeof s=="function"?{reflect:!1,get:s}:s;this.prop(e,n)}return this}static defineStatic(t){for(let[e,s]of Object.entries(t??{}))st(this,e,{reflect:!1,...typeof s=="function"?{get:s}:typeof s=="string"?{type:s}:s});return this}static events(t,e){return this.on({composed({composition:s}){for(let[n,i]of Object.entries(t)){let[,o,a]=n.match(/^([*1~]+)?(.*)$/),l,h=[];if(typeof i=="string"){let c=i.split(".");c.length===1?(l=i,h=[]):(l=c[0],h=c)}s.addCompositionEventListener({type:a,once:o==null?void 0:o.includes("1"),passive:o==null?void 0:o.includes("~"),capture:o==null?void 0:o.includes("*"),...typeof i=="function"?{handleEvent:i}:typeof i=="string"?{prop:l,deepProp:h}:i,...e})}}}),this}static childEvents(t,e){for(let[s,n]of Object.entries(t))this.events(n,{tag:j(s),...e});return this}static rootEvents(t,e){return this.events(t,{tag:R.shadowRootTag,...e})}static on(t,e){let s=typeof t=="string"?{[t]:e}:t;for(let[n,i]of Object.entries(s)){let o;switch(n){case"composed":o="_onComposeCallbacks";break;case"constructed":o="_onConstructedCallbacks";break;case"connected":o="_onConnectedCallbacks";break;case"disconnected":o="_onDisconnectedCallbacks";break;case"props":this.onPropChanged(i);continue;case"attrs":this.onAttributeChanged(i);continue;default:if(n.endsWith("Changed")){let a=n.slice(0,n.length-7);this.onPropChanged({[a]:i});continue}throw new Error("Invalid callback name")}this._addCallback(o,i)}return this}static onPropChanged(t){let e=Array.isArray(t)?t:Object.entries(t),{propChangedCallbacks:s}=this;for(let[n,i]of e)s.has(n)?s.get(n).push(i):s.set(n,[i]);return this}static onAttributeChanged(t){let e=Array.isArray(t)?t:Object.entries(t),{attributeChangedCallbacks:s}=this;for(let[n,i]of e)s.has(n)?s.get(n).push(i):s.set(n,[i]);return this}#n;#s=new Map;#e=new Map;#t;#r=!1;#i=[];_propAttributeCache;_callbackArguments=null;constructor(...t){super(),r.supportsElementInternals&&(this.elementInternals=this.attachInternals()),this.attachShadow({mode:"open",delegatesFocus:this.delegatesFocus}),this.render=this.composition.render(this.constructor.prototype,this,{defaults:this.constructor.prototype,store:this,shadowRoot:this.shadowRoot,context:this});for(let e of this.static._onConstructedCallbacks)e.call(this,this.callbackArguments)}propChangedCallback(t,e,s,n=s){this.#r?this.#i.push([t,n,this]):this.render.byProp(t,n,this);let{_propChangedCallbacks:i}=this.static;if(i.has(t))for(let o of i.get(t))o.call(this,e,s,n,this)}attributeChangedCallback(t,e,s){let{attributeChangedCallbacks:n}=this.static;if(n.has(t))for(let c of n.get(t))c.call(this,e,s,this);let{attrList:i}=this.static;if(!i.has(t))return;let o=i.get(t);if(o.attributeChangedCallback){o.attributeChangedCallback.call(this,t,e,s);return}let a;if(this.attributeCache.has(t)&&(a=this.attributeCache.get(t),a.stringValue===s))return;let l=this[o.key],h=s===null?o.nullParser(s):o.type==="boolean"?!0:o.parser(s);h!==l&&(a?(a.stringValue=s,a.parsedValue=h):this.attributeCache.set(t,{stringValue:s,parsedValue:h}),this[o.key]=h)}get#o(){var t;return(t=this.#t)==null?void 0:t.template}_onObserverPropertyChanged(t,e,s,n){let{propList:i}=this.static;if(i.has(t)){let{reflect:o,attr:a}=i.get(t);if(a&&(o===!0||o==="write")){let l,h=!1,{attributeCache:c}=this;if(c.has(a)?(l=c.get(a),h=l.parsedValue!==s):(l={},c.set(a,l),h=!0),h){let u=gt(s);l.parsedValue=s,l.stringValue=u,u==null?this.removeAttribute(a):this.setAttribute(a,u)}}}this.propChangedCallback(t,e,s,n)}patch(t){this.#r=!0,Y(this,t);for(let[e,s,n]of this.#i)e in t||this.render.byProp(e,s,n);this.#i.slice(0,this.#i.length),this.render(t),this.#r=!1}get refs(){return this.#n??=new Proxy({},{get:(t,e)=>{this.#t;let s=this.composition,n;if(!s.interpolated){if(this.#e.has(e)&&(n=this.#e.get(e).deref(),n))return n;let a=j(e);return n=s.template.getElementById(a),n?(this.#e.set(e,new WeakRef(n)),n):null}if(this.#s.has(e)&&(n=this.#s.get(e).deref(),n))return n;let i=j(e),o=this.composition.tags.indexOf(i);return n=this.render.state.refs[o],n?(this.#s.set(e,new WeakRef(n)),n):null}})}get attributeCache(){return this._propAttributeCache??=new Map}get static(){return this.constructor}get unique(){return!1}get callbackArguments(){return this._callbackArguments??={composition:this.#t,refs:this.refs,html:ot.bind(this),inline:rt,template:this.#o,element:this}}get composition(){if(this.#t)return this.#t;if(!this.unique&&this.static.hasOwnProperty("_composition"))return this.#t=this.static._composition,this.static._composition;this.compose();for(let t of this.static._onComposeCallbacks)t.call(this,this.callbackArguments);return this.unique||(this.static._composition=this.#t),this.#t}connectedCallback(){for(let t of this.static._onConnectedCallbacks)t.call(this,this.callbackArguments)}disconnectedCallback(){for(let t of this.static._onDisconnectedCallbacks)t.call(this,this.callbackArguments)}};Q.prototype.delegatesFocus=!1;export{ge as cloneAttributeCallback,Q as default};
2
2
  //# sourceMappingURL=CustomElement.min.js.map