@dinoreic/fez 0.4.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fez.js CHANGED
@@ -1,27 +1,131 @@
1
- (()=>{var Me=Object.defineProperty;var Fe=(r,e)=>()=>(r&&(e=r(r=0)),e);var Le=(r,e)=>{for(var t in e)Me(r,t,{get:e[t],enumerable:!0})};var pe={};Le(pe,{loadDefaults:()=>de});var de,he=Fe(()=>{de=()=>{Fez("fez-component",class{init(e){let t=document.createElement(e.name);for(t.props=e.props||e["data-props"]||e;this.root.firstChild;)this.root.parentNode.insertBefore(this.root.lastChild,t.nextSibling);this.root.innerHTML="",this.root.appendChild(t)}}),Fez("fez-include",class{init(e){Fez.fetch(e.src,t=>{let s=Fez.domRoot(t);Fez.head(s),this.root.innerHTML=s.innerHTML})}}),Fez("fez-inline",class{init(e){let t=this.root.innerHTML;if(this.root.innerHTML.includes("<")){let n=`inline-${Fez.fnv1(this.root.outerHTML)}`;Fez(n,class{HTML=t;init(){Object.assign(this.state,e.state||{})}});let i=document.createElement(n);this.root.after(this.root.lastChild,i),this.root.remove()}}}),Fez("fez-if",class{init(e){new Function(`return (${e.if||e.test})`)()||this.root.remove()}});let r=new Map;Fez("fez-memoize",class{init(e){if(!e.key){Fez.error("fez-memoize: key prop is required");return}if(r.has(e.key)){let t=r.get(e.key);Fez.log(`Memoize - key: "${e.key}" - restore`),this.root.innerHTML="",this.root.appendChild(t.cloneNode(!0))}}onMount(e){r.has(e.key)||requestAnimationFrame(()=>{let t=document.createElement("div");t.innerHTML=this.root.innerHTML,Fez.log(`Memoize - key: "${e.key}" - set`),r.set(e.key,t)})}})};typeof Fez<"u"&&Fez&&de()});function D(r,e={},t){if(typeof e=="string"&&([e,t]=[t,e],e||={}),e instanceof Node&&(t=e,e={}),Array.isArray(r)&&(t=r,r="div"),(typeof e!="object"||Array.isArray(e))&&(t=e,e={}),r.includes(".")){let n=r.split(".");r=n.shift()||"div";let i=n.join(" ");e.class?e.class+=` ${i}`:e.class=i}let s=document.createElement(r);for(let[n,i]of Object.entries(e))if(typeof i=="function")s[n]=i.bind(this);else{let o=String(i).replaceAll("fez.",this.fezHtmlRoot);s.setAttribute(n,o)}if(t)if(Array.isArray(t))for(let n of t)s.appendChild(n);else t instanceof Node?s.appendChild(t):s.innerHTML=String(t);return s}function xe(r,e){if(r=r.replace(/^#?raw/,"@html").replace(/^#?html/,"@html"),r.startsWith("#if")||r.startsWith("if"))return e.push(!1),r=r.replace(/^#?if/,""),`\${ ${r} ? \``;if(r.startsWith("#unless")||r.startsWith("unless"))return e.push(!1),r=r.replace(/^#?unless/,""),`\${ !(${r}) ? \``;if(r=="/block")return"`) && ''}";if(r.startsWith("#for")||r.startsWith("for")){r=r.replace(/^#?for/,"");let t=r.split(" in ",2);return"${"+t[1]+".map(("+t[0]+")=>`"}else if(r.startsWith("#each")||r.startsWith("each")){r=r.replace(/^#?each/,"");let t=r.split(" as ",2);return"${"+t[0]+".map(("+t[1]+")=>`"}else{if(r==":else"||r=="else")return e[e.length-1]=!0,"` : `";if(r=="/if"||r=="/unless")return e.pop()?"`}":"` : ``}";if(r=="/for"||r=="/each")return'`).join("")}';{let t="@html ";return r.startsWith("json ")&&(r=r.replace("json ","@html '<pre class=json>'+JSON.stringify("),r+=", null, 2) + '</pre>'"),r.startsWith(t)?r=r.replace(t,""):r=`Fez.htmlEscape(${r})`,"${"+r+"}"}}}function _(r,e={}){let t=[];r=r.replaceAll("[[","{{").replaceAll("]]","}}"),r=r.replace(/(\w+)=\{\{\s*(.*?)\s*\}\}([\s>])/g,(i,o,f,u)=>`${o}="{{ ${f} }}"${u}`);let s={};r=r.replace(/\{\{block\s+(\w+)\s*\}\}([^§]+)\{\{\/block\}\}/g,(i,o,f)=>(s[o]=f,"")),r=r.replace(/\{\{block:([\w\-]+)\s*\}\}/g,(i,o)=>s[o]||`block:${o}?`),r=r.replace(/:(\w+)="([\w\.\[\]]+)"/,(i,o,f)=>`:${o}=Fez.store.delete({{ Fez.store.set(${f}) }})`);let n=r.replace(/{{(.*?)}}/g,(i,o)=>(o=o.replaceAll("&#x60;","`"),o=o.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&"),xe(o,t)));n=n.replace(/<!\-\-.*?\-\->/g,"").replace(/>\s+</g,"><"),n="`"+n.trim()+"`";try{let i=`const fez = this;
1
+ (()=>{var Fe=Object.defineProperty;var Ne=(e,t)=>()=>(e&&(t=e(e=0)),t);var Me=(e,t)=>{for(var n in t)Fe(e,n,{get:t[n],enumerable:!0})};var Le={};Me(Le,{loadDefaults:()=>Te});var Te,_e=Ne(()=>{Te=()=>{Fez("fez-component",class{init(e){let t=document.createElement(e.name);for(t.props=e.props||e["data-props"]||e;this.root.firstChild;)this.root.parentNode.insertBefore(this.root.lastChild,t.nextSibling);this.root.innerHTML="",this.root.appendChild(t)}}),Fez("fez-include",class{init(e){Fez.fetch(e.src,t=>{let n=Fez.domRoot(t);Fez.head(n),this.root.innerHTML=n.innerHTML})}}),Fez("fez-if",class{init(e){new Function(`return (${e.if||e.test})`)()||this.root.remove()}}),Fez("fez-demo",class{init(e){this.state.ready=!1,this.state.components=[],this.state.filtered=!1,this.state.showAllUrl="";let t=new URLSearchParams(window.location.search),n=e.name||t.get("fez");if(t.get("fez")){let s=new URL(window.location.href);s.searchParams.delete("fez"),this.state.showAllUrl=s.pathname+s.search,this.state.filtered=!0}let r=()=>{if(n)Fez.index[n]?.demo?(this.state.components=[n],this.state.ready=!0):setTimeout(r,100);else{let s=Fez.index.withDemo().sort();s.length>0?(this.state.components=s,this.state.ready=!0):setTimeout(r,100)}};r()}showHtml(e){let t=Fez.index[e]?.demo||"No demo HTML";Fez.log("Demo HTML: "+e+`
2
+
3
+ `+t)}showFez(e){Fez.log("Fez source: "+e+`
4
+
5
+ `+(Fez.index[e]?.source||"Source not available"))}openSingle(e){let t=new URL(window.location.href);t.searchParams.set("fez",e),window.location.href=t.toString()}openCodePen(e){let t=Fez.index[e]?.demo||"",n=Fez.index[e]?.source||"",r=[`<link rel="stylesheet" href="//cdn.simplecss.org/simple.css" />
6
+ <script src="//dux.github.io/fez/dist/fez.js"><\/script>`,`<!-- FEZ code start -->
7
+ <xmp fez="${e}">
8
+ ${n}
9
+ </xmp>
10
+ <!-- FEZ code end -->`,`<!-- HTML code start -->
11
+ ${t}
12
+ <!-- HTML code end -->`],s={title:"Fez component - "+e,html:r.join(`
13
+
14
+ `),css:"body { padding-top: 50px; }",js:"",editors:"100"},o=document.createElement("form");o.method="POST",o.action="https://codepen.io/pen/define",o.target="_blank";let i=document.createElement("input");i.type="hidden",i.name="data",i.value=JSON.stringify(s),o.appendChild(i),document.body.appendChild(o),o.submit(),document.body.removeChild(o)}renderDemo(e){let t=e.dataset.name;Fez.index.apply(t,e)}renderInfo(e){let t=e.dataset.name,n=Fez.index.get(t);n.info?e.innerHTML=n.info.innerHTML:e.innerHTML="<em>No info available</em>"}CSS(){return`:fez {
15
+ display: block;
16
+ font-family: system-ui, -apple-system, sans-serif;
17
+ }
18
+ .fez-demo-item {
19
+ margin-bottom: 40px;
20
+ }
21
+ .fez-demo-title {
22
+ display: flex;
23
+ align-items: center;
24
+ gap: 15px;
25
+ font-size: 18px;
26
+ font-weight: 600;
27
+ margin: 0 0 25px 0;
28
+ &::before {
29
+ content: '';
30
+ flex: 1;
31
+ height: 1px;
32
+ background: #ddd;
33
+ }
34
+ &::after {
35
+ content: '';
36
+ flex: 1;
37
+ height: 1px;
38
+ background: #ddd;
39
+ }
40
+ .fez-demo-show-all, .fez-demo-open-single {
41
+ font-size: 14px;
42
+ font-weight: normal;
43
+ color: #666;
44
+ text-decoration: none;
45
+ cursor: pointer;
46
+ &:hover { text-decoration: underline; }
47
+ }
48
+ }
49
+ .fez-demo-cols {
50
+ display: flex;
51
+ gap: 40px;
52
+ @media (max-width: 768px) {
53
+ flex-direction: column;
54
+ gap: 20px;
55
+ }
56
+ }
57
+ .fez-demo-left, .fez-demo-right {
58
+ flex: 1;
59
+ min-width: 0;
60
+ overflow: visible;
61
+ }
62
+ .fez-demo-content {
63
+ min-height: 50px;
64
+ }
65
+ .fez-demo-info {
66
+ background: #fff;
67
+ border: 1px solid #ddd;
68
+ border-radius: 6px;
69
+ padding: 20px;
70
+ line-height: 1.6;
71
+ ul { margin: 0; padding-left: 20px; }
72
+ code { background: #e8e8e8; padding: 2px 5px; border-radius: 3px; font-size: 13px; }
73
+ }
74
+ .fez-demo-buttons {
75
+ margin-top: 30px;
76
+ display: flex;
77
+ gap: 10px;
78
+ }
79
+ .fez-demo-btn {
80
+ padding: 8px 16px;
81
+ border: 1px solid #ccc;
82
+ background: #fff;
83
+ border-radius: 4px;
84
+ cursor: pointer;
85
+ &:hover { background: #f0f0f0; }
86
+ }`}HTML(){return`{#if state.ready}
87
+ {#each state.components as name}
88
+ <div class="fez-demo-item">
89
+ <h2 class="fez-demo-title">{name}{#if state.filtered} <a href="{state.showAllUrl}" class="fez-demo-show-all">show all</a>{:else} <a onclick="fez.openSingle('{name}')" class="fez-demo-open-single">open</a>{/if}</h2>
90
+ <div class="fez-demo-cols">
91
+ <div class="fez-demo-left">
92
+ <div class="fez-demo-content" data-name={name} fez-use="renderDemo"></div>
93
+ </div>
94
+ <div class="fez-demo-right">
95
+ <div class="fez-demo-info" data-name={name} fez-use="renderInfo"></div>
96
+ <div class="fez-demo-buttons">
97
+ <button class="fez-demo-btn" onclick="fez.showHtml('{name}')">Demo HTML</button>
98
+ <button class="fez-demo-btn" onclick="fez.showFez('{name}')">Fez Component</button>
99
+ <button class="fez-demo-btn" onclick="fez.openCodePen('{name}')">CodePen</button>
100
+ </div>
101
+ </div>
102
+ </div>
103
+ </div>
104
+ {/each}
105
+ {:else}
106
+ <div style="padding: 40px; text-align: center; color: #888;">Loading components...</div>
107
+ {/if}`}})};typeof Fez<"u"&&Fez&&typeof document<"u"&&document.head&&Te()});function j(e,t={},n){if(typeof t=="string"&&([t,n]=[n,t],t||={}),t instanceof Node&&(n=t,t={}),Array.isArray(e)&&(n=e,e="div"),(typeof t!="object"||Array.isArray(t))&&(n=t,t={}),e.includes(".")){let o=e.split(".");e=o.shift()||"div";let i=o.join(" ");t.class?t.class+=` ${i}`:t.class=i}let r=document.createElement(e),s=["checked","disabled","selected","readonly","required","hidden","multiple","autofocus"];for(let[o,i]of Object.entries(t))if(typeof i=="function")r[o]=i.bind(this);else if(s.includes(o))i&&r.setAttribute(o,o);else{let l=String(i).replaceAll("fez.",this.fezHtmlRoot);r.setAttribute(o,l)}if(n)if(Array.isArray(n))for(let o of n)r.appendChild(o);else n instanceof Node?r.appendChild(n):r.innerHTML=String(n);return r}function N(e){if(e.startsWith("[")){let r=e.match(/^\[([^\]]+)\](?:\s*,\s*(\w+))?$/);if(r)return{params:r[1].split(",").map(s=>s.trim()),indexParam:r[2]||null,isDestructured:!0}}let n=e.split(",").map(r=>r.trim());return n.length===2?{params:n,indexParam:null,isDestructured:!0}:{params:n,indexParam:null,isDestructured:!1}}function X(e){let t=N(e),n=[...t.params];return t.indexParam&&n.push(t.indexParam),t.params.length===1&&!n.includes("i")&&n.push("i"),n}function J(e){let t=N(e);return t.isDestructured&&t.params.length===2?[t.params[0]]:t.isDestructured?t.params:t.params.length>=3?t.params.slice(0,-1):t.params.length===2?[t.params[0]]:t.params}function Q(e,t){let n=N(t);return n.isDestructured&&n.params.length===2?`Fez.toPairs(${e})`:n.isDestructured||n.params.length>=3?`((_c)=>Array.isArray(_c)?_c:(_c&&typeof _c==="object")?Object.entries(_c):[])(${e})`:`(${e}||[])`}function Y(e){let t=N(e);if(t.isDestructured){let r="["+t.params.join(", ")+"]",s=t.indexParam||(t.params.includes("i")?"_i":"i");return r+", "+s}if(t.params.length>=3){let r=[...t.params],s=r.pop();return"["+r.join(", ")+"], "+s}if(t.params.length===2)return t.params.join(", ");let n=t.params[0]==="i"?"_i":"i";return t.params[0]+", "+n}function ee(e){return/^\s*(\([^)]*\)|[a-zA-Z_$][a-zA-Z0-9_$]*)\s*=>/.test(e)}function te(e,t=[],n=[]){let r=e.match(/^\s*(?:\([^)]*\)|[a-zA-Z_$][a-zA-Z0-9_$]*)\s*=>\s*(.+)$/s);if(!r)return e;let s=r[1].trim(),i=e.match(/^\s*\(?\s*([a-zA-Z_$][a-zA-Z0-9_$]*)?\s*(?:,\s*[^)]+)?\)?\s*=>/)?.[1],l=i&&["e","event","ev"].includes(i);if(n.filter(d=>new RegExp(`\\b${d}\\b`).test(s)).length>0){if(l&&i!=="event"){let d=new RegExp(`\\b${i}\\b`,"g");s=s.replace(d,"event")}return s=s.replace(/(?<![.\w])([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/g,(d,f)=>["console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","parseInt","parseFloat","setTimeout","setInterval","clearTimeout","clearInterval","alert","confirm","prompt","fetch","event"].includes(f)?d:`fez.${f}(`),`\${'Fez(' + UID + ').fezGlobals.delete(' + fez.fezGlobals.set(() => ${s}) + ')()'}`}if(l&&i!=="event"){let d=new RegExp(`\\b${i}\\b`,"g");s=s.replace(d,"event")}for(let d of t){let f=new RegExp(`(?<!\\$\\{)\\b${d}\\b(?![^{]*\\})`,"g");s=s.replace(f,`\${${d}}`)}return s=s.replace(/(?<![.\w])([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/g,(d,f)=>["console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","parseInt","parseFloat","setTimeout","setInterval","clearTimeout","clearInterval","alert","confirm","prompt","fetch","event"].includes(f)?d:`fez.${f}(`),s}function ne(e,t){let n=0,r=t;for(;r<e.length;){let s=e[r];if(s==="{")n++;else if(s==="}"){if(n--,n===0)return{expression:e.slice(t+1,r),endIndex:r}}else if(s==='"'||s==="'"||s==="`"){let o=s;for(r++;r<e.length&&e[r]!==o;)e[r]==="\\"&&r++,r++}r++}throw new Error(`Unmatched brace at ${t}`)}function k(e,t){let n=t-1;for(;n>=0&&(e[n]==="{"||e[n]===" "||e[n]===" ");)n--;if(n>=0&&e[n]==="="){for(n--;n>=0&&(e[n]===" "||e[n]===" ");)n--;let r=n+1;for(;n>=0&&/[a-zA-Z0-9_:-]/.test(e[n]);)n--;let s=e.slice(n+1,r);if(s&&/^[a-zA-Z]/.test(s)&&(n<0||/\s/.test(e[n])))return s.toLowerCase()}return null}function se(e,t){let n=k(e,t);return n&&/^on[a-z]+$/.test(n)?n:null}function P(e,t={}){let n=t.name||"unknown";try{e=e.replaceAll("&#x60;","`").replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&"),e=e.replace(/\bfez:([a-z]+)=/gi,"fez-$1=");let r=e.match(/<([a-z]+-[a-z][a-z0-9-]*)\b[^>]*\bfez-keep=/);r&&console.error(`FEZ: fez:keep must be on plain HTML elements, not on fez components. Found on <${r[1]}> in <${n}>`);let s={};e=e.replace(/\{@block\s+(\w+)\}([\s\S]*?)\{\/block\}/g,(b,z,u)=>(s[z]=u,"")),e=e.replace(/\{@block:(\w+)\}/g,(b,z)=>s[z]||""),e=e.replace(/:(\w+)="([^"{}]+)"/g,(b,z,u)=>/^[\w.[\]]+$/.test(u.trim())?`:${z}={\`Fez(\${UID}).fezGlobals.delete(\${fez.fezGlobals.set(${u})})\`}`:b),e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/>\s+</g,"><").trim(),e=e.replace(/<([a-z][a-z0-9]*-[a-z0-9-]*)((?:=>|[^>])*)>/gi,(b,z,u)=>u.trimEnd().endsWith("/")?`<${z}${u.replace(/\s*\/$/,"")}></${z}>`:b),e=e.replace(/<slot\s*\/>/gi,"<slot></slot>");let o="",i=0,l=[],c=[],d=[],f=[],a=[],p=0;for(;i<e.length;){if(e[i]==="`"){for(o+="\\`",i++;i<e.length&&e[i]!=="`";)if(e[i]==="\\")o+="\\\\",i++,i<e.length&&(e[i]==="`"?o+="\\`":e[i]==="$"?o+="\\$":o+=e[i],i++);else if(e[i]==="$"&&e[i+1]==="{"){o+="\\${",i+=2;let b=1;for(;i<e.length&&b>0;)e[i]==="{"?b++:e[i]==="}"&&b--,b>0||e[i]!=="}"?e[i]==="`"?o+="\\`":e[i]==="\\"?o+="\\\\":o+=e[i]:o+="}",i++}else e[i]==="$"?o+="\\$":o+=e[i],i++;i<e.length&&(o+="\\`",i++);continue}if(e[i]==="\\"&&e[i+1]==="{"){o+="{",i+=2;continue}if(e[i]==="{"){let{expression:b,endIndex:z}=ne(e,i),u=b.trim();if(/^(\w+|"\w+"|'\w+')\s*:/.test(u)){o+="{"+b+"}",i=z+1;continue}if(u.startsWith("#if ")){let h=u.slice(4);o+="${Fez.isTruthy("+h+") ? `",l.push(!1)}else if(u.startsWith("#unless ")){let h=u.slice(8);o+="${!Fez.isTruthy("+h+") ? `",l.push(!1)}else if(u===":else"||u==="else")if(f.length>0&&!l.length){let h=f[f.length-1];h.hasElse=!0,o+='`).join("") : `'}else o+="` : `",l[l.length-1]=!0;else if(u.startsWith(":else if ")||u.startsWith("else if ")||u.startsWith("elsif ")||u.startsWith("elseif ")){let h=u.startsWith(":else if ")?u.slice(9):u.startsWith("else if ")?u.slice(8):u.startsWith("elseif ")?u.slice(7):u.slice(6);o+="` : Fez.isTruthy("+h+") ? `"}else if(u==="/if"||u==="/unless"){let h=l.pop();o+=h?"`}":"` : ``}"}else if(u.startsWith("#each ")||u.startsWith("#for ")){let h=u.startsWith("#each "),E,w;if(h){let T=u.slice(6),F=T.indexOf(" as ");E=T.slice(0,F).trim(),w=T.slice(F+4).trim()}else{let T=u.slice(5),F=T.indexOf(" in ");w=T.slice(0,F).trim(),E=T.slice(F+4).trim()}let A=Q(E,w),Ie=Y(w);c.push(X(w)),d.push(J(w)),f.push({collectionExpr:A,hasElse:!1}),o+="${((_arr) => _arr.length ? _arr.map(("+Ie+") => `"}else if(u==="/each"||u==="/for"){c.pop(),d.pop();let h=f.pop();h.hasElse?o+="`)("+h.collectionExpr+")}":o+='`).join("") : "")('+h.collectionExpr+")}"}else if(u.startsWith("#await ")){let h=u.slice(7).trim(),E=p++;a.push({awaitId:E,promiseExpr:h,hasThen:!1,hasCatch:!1,thenVar:"_value",catchVar:"_error"}),o+='${((_aw) => _aw.status === "pending" ? `'}else if(u.startsWith(":then")){let h=a[a.length-1];h&&(h.hasThen=!0,h.thenVar=u.slice(5).trim()||"_value",o+='` : _aw.status === "resolved" ? (('+h.thenVar+") => `")}else if(u.startsWith(":catch")){let h=a[a.length-1];h&&(h.hasCatch=!0,h.catchVar=u.slice(6).trim()||"_error",h.hasThen?o+='`)(_aw.value) : _aw.status === "rejected" ? (('+h.catchVar+") => `":o+='` : _aw.status === "rejected" ? (('+h.catchVar+") => `")}else if(u==="/await"){let h=a.pop();h&&(h.hasThen&&h.hasCatch?o+="`)(_aw.error) : ``)(Fez.fezAwait(fez, "+h.awaitId+", "+h.promiseExpr+"))}":h.hasThen?o+="`)(_aw.value) : ``)(Fez.fezAwait(fez, "+h.awaitId+", "+h.promiseExpr+"))}":h.hasCatch?o+="`)(_aw.error) : ``)(Fez.fezAwait(fez, "+h.awaitId+", "+h.promiseExpr+"))}":o+="` : ``)(Fez.fezAwait(fez, "+h.awaitId+", "+h.promiseExpr+"))}")}else if(u.startsWith("@html ")){let h=u.slice(6);o+="${"+h+"}"}else if(u.startsWith("@json ")){let h=u.slice(6);o+='${`<pre class="json">${Fez.htmlEscape(JSON.stringify('+h+", null, 2))}</pre>`}"}else if(ee(u))if(se(e,i)){let E=c.flat(),w=d.flat(),A=te(u,E,w);A=A.replace(/"/g,"&quot;"),o+='"'+A+'"'}else o+="${"+u+"}";else k(e,i)?o+='"${Fez.htmlEscape('+u+')}"':o+="${Fez.htmlEscape("+u+")}";i=z+1;continue}e[i]==="$"&&e[i+1]==="{"?o+="\\$":e[i]==="\\"?o+="\\\\":o+=e[i],i++}if(o=o.replace(/(<[a-z][a-z0-9-]*\s+)([^>]*?)(fez-this="([^"{}]+)")([^>]*?)>/gi,(b,z,u,h,E,w)=>{if(/\bid=/.test(u)||/\bid=/.test(w))return b;let A=E.replace(/[^a-zA-Z0-9]/g,"-");return`${z}${u}${h}${w} id="fez-\${UID}-${A}">`}),typeof Fez<"u"&&Fez.LOG){let b=o.match(/fez-this="[^"]*\{[^}]+\}[^"]*"/g);b&&console.warn(`Fez <${n}>: Dynamic fez-this values won't get auto-ID for DOM differ matching:`,b)}let m=`
108
+ const fez = this;
2
109
  with (this) {
3
- return ${n}
110
+ return \`${o}\`
4
111
  }
5
- `,o=new Function(i);return u=>{try{return o.bind(u)()}catch(d){d.message=`FEZ template runtime error: ${d.message}
6
-
7
- Template source: ${n}`,console.error(d)}}}catch(i){return i.message=`FEZ template compile error: ${i.message}Template source:
8
- ${n}`,console.error(i),()=>Fez.error("Template Compile Error",!0)}}var x=class{static getProps(e,t){let s={};if(e.props)return e.props;for(let n of e.attributes)s[n.name]=n.value;for(let[n,i]of Object.entries(s))if([":"].includes(n[0])){delete s[n];try{let o=new Function(`return (${i})`).bind(t)();s[n.replace(/[\:_]/,"")]=o}catch(o){console.error(`Fez: Error evaluating attribute ${n}="${i}" for ${e.tagName}: ${o.message}`)}}if(s["data-props"]){let n=s["data-props"];if(typeof n=="object")return n;n[0]!="{"&&(n=decodeURIComponent(n));try{s=JSON.parse(n)}catch(i){console.error(`Fez: Invalid JSON in data-props for ${e.tagName}: ${i.message}`)}}else if(s["data-json-template"]){let n=t.previousSibling?.textContent;if(n)try{s=JSON.parse(n),t.previousSibling.remove()}catch(i){console.error(`Fez: Invalid JSON in template for ${e.tagName}: ${i.message}`)}}return s}static formData(e){let t=e.closest("form")||e.querySelector("form");if(!t)return Fez.log("No form found for formData()"),{};let s=new FormData(t),n={};return s.forEach((i,o)=>{n[o]=i}),n}static nodeName="div";constructor(){}n=D;get fezHtmlRoot(){return`Fez(${this.UID}).`}get isConnected(){return this.root?.isConnected?!0:(this.fezOnDestroy(),!1)}prop(e){let t=this.oldRoot[e]||this.props[e];return typeof t=="function"&&(t=t.bind(this.root)),t}copy(){for(let e of Array.from(arguments)){let t=this.props[e];if(t!==void 0){if(e=="class"){let s=this.root.getAttribute(e,t);s&&(t=[s,t].join(" "))}typeof t=="string"?this.root.setAttribute(e,t):this.root[e]=t}}}fezOnDestroy(){this._onDestroyCallbacks&&(this._onDestroyCallbacks.forEach(e=>{try{e()}catch(t){console.error("Fez: Error in cleanup callback:",t)}}),this._onDestroyCallbacks=[]),this.onDestroy(),this.onDestroy=()=>{},this.root&&(this.root.fez=void 0),this.root=void 0}addOnDestroy(e){this._onDestroyCallbacks=this._onDestroyCallbacks||[],this._onDestroyCallbacks.push(e)}on(e,t,s=200){this._eventHandlers=this._eventHandlers||{},this._eventHandlers[e]&&window.removeEventListener(e,this._eventHandlers[e]);let n=Fez.throttle(()=>{this.isConnected&&t.call(this)},s);this._eventHandlers[e]=n,window.addEventListener(e,n),this.addOnDestroy(()=>{window.removeEventListener(e,n),delete this._eventHandlers[e]})}onWindowResize(e,t){this.on("resize",e,t),e()}onWindowScroll(e,t){this.on("scroll",e,t),e()}onElementResize(e,t,s=200){let n=Fez.throttle(()=>{this.isConnected&&t.call(this,e.getBoundingClientRect(),e)},s),i=new ResizeObserver(n);i.observe(e),t.call(this,e.getBoundingClientRect(),e),this.addOnDestroy(()=>{i.disconnect()})}slot(e,t){t||=document.createElement("template");let s=t.nodeName=="SLOT";for(;e.firstChild;)s?t.parentNode.insertBefore(e.lastChild,t.nextSibling):t.appendChild(e.firstChild);return s?t.parentNode.removeChild(t):e.innerHTML="",t}setStyle(e,t){this.root.style.setProperty(e,t)}connect(){}onMount(){}beforeRender(){}afterRender(){}onDestroy(){}onStateChange(){}onGlobalStateChange(){}publish(e,...t){let s=i=>{if(Fez._subs&&Fez._subs[e]){let o=Fez._subs[e].find(([f])=>f===i);if(o)return o[1].bind(i)(...t),!0}return!1};if(s(this))return!0;let n=this.root.parentElement;for(;n;){if(n.fez&&s(n.fez))return!0;n=n.parentElement}return!1}fezBlocks={};parseHtml(e){let t=this.fezHtmlRoot.replaceAll('"',"&quot;");return e=e.replace(/([!'"\s;])fez\.(\w)/g,`$1${t}$2`).replace(/>\s+</g,"><"),e.trim()}nextTick(e,t){t?(this._nextTicks||={},this._nextTicks[t]||=window.requestAnimationFrame(()=>{e.bind(this)(),this._nextTicks[t]=null},t)):window.requestAnimationFrame(e.bind(this))}render(e){if(e||=this?.class?.fezHtmlFunc,!e||!this.root)return;this.beforeRender();let t=typeof this.class.nodeName=="function"?this.class.nodeName(this.root):this.class.nodeName,s=document.createElement(t||"div"),n;Array.isArray(e)?e[0]instanceof Node?e.forEach(i=>s.appendChild(i)):n=e.join(""):typeof e=="string"?n=_(e)(this):typeof e=="function"&&(n=e(this)),n&&(n=n.replace(/\s\w+="undefined"/g,""),s.innerHTML=this.parseHtml(n)),this.fezKeepNode(s),this.fezMemoization(s),Fez.morphdom(this.root,s),this.fezRenderPostProcess(),this.afterRender()}fezRenderPostProcess(){let e=(t,s)=>{this.root.querySelectorAll(`*[${t}]`).forEach(n=>{let i=n.getAttribute(t);n.removeAttribute(t),i&&s.bind(this)(i,n)})};e("fez-this",(t,s)=>{new Function("n",`this.${t} = n`).bind(this)(s)}),e("fez-use",(t,s)=>{if(t.includes("=>"))Fez.getFunction(t)(s);else if(t.includes("."))Fez.getFunction(t).bind(s)();else{let n=this[t];typeof n=="function"?n(s):console.error(`Fez error: "${t}" is not a function in ${this.fezName}`)}}),e("fez-class",(t,s)=>{let n=t.split(/\s+/),i=n.pop();n.forEach(o=>s.classList.add(o)),i&&setTimeout(()=>{s.classList.add(i)},1)}),e("fez-bind",(t,s)=>{if(["INPUT","SELECT","TEXTAREA"].includes(s.nodeName)){let n=new Function(`return this.${t}`).bind(this)(),i=s.type.toLowerCase()=="checkbox",o=["SELECT"].includes(s.nodeName)||i?"onchange":"onkeyup";s.setAttribute(o,`${this.fezHtmlRoot}${t} = this.${i?"checked":"value"}`),this.val(s,n)}else console.error(`Cant fez-bind="${t}" to ${s.nodeName} (needs INPUT, SELECT or TEXTAREA. Want to use fez-this?).`)}),this.root.querySelectorAll("*[disabled]").forEach(t=>{let s=t.getAttribute("disabled");["false"].includes(s)?t.removeAttribute("disabled"):t.setAttribute("disabled","true")})}fezKeepNode(e){e.querySelectorAll("[fez-keep]").forEach(t=>{let s=t.getAttribute("fez-keep"),n=this.root.querySelector(`[fez-keep="${s}"]`);if(n)t.parentNode.replaceChild(n,t);else if(s==="default-slot")if(t.getAttribute("hide")){this.state=null;let i=t.parentNode;Array.from(this.root.childNodes).forEach(o=>{i.insertBefore(o,t)}),t.remove()}else Array.from(this.root.childNodes).forEach(i=>{t.appendChild(i)})})}fezMemoization(e){let t=e.querySelector("[fez-memoize]:not(.fez)");if(!t)return;this.fezMemoStore||=new Map;let s=t.getAttribute("fez-memoize"),n=this.fezMemoStore.get(s);if(n)Fez.log(`Memoize restore ${this.fezName}: ${s}`),t.parentNode.replaceChild(n.cloneNode(!0),t);else{let i=this.root.querySelector("[fez-memoize]:not(.fez)");if(i){let o=i.getAttribute("fez-memoize");this.fezMemoStore.set(o,i.cloneNode(!0))}}}refresh(e){if(alert("NEEDS FIX and remove htmlTemplate"),e){let s=Fez.domRoot(this.class.htmlTemplate).querySelector(e).innerHTML;this.render(e,s)}else this.render()}setInterval(e,t,s){typeof e=="number"&&([t,e]=[e,t]),s||=Fez.fnv1(String(e)),this._setIntervalCache||={},clearInterval(this._setIntervalCache[s]);let n=setInterval(()=>{this.isConnected&&e()},t);return this._setIntervalCache[s]=n,this.addOnDestroy(()=>{clearInterval(n),delete this._setIntervalCache[s]}),n}find(e){return typeof e=="string"?this.root.querySelector(e):e}val(e,t){let s=this.find(e);if(s)if(["INPUT","TEXTAREA","SELECT"].includes(s.nodeName))if(typeof t<"u")s.type=="checkbox"?s.checked=!!t:s.value=t;else return s.value;else if(typeof t<"u")s.innerHTML=t;else return s.innerHTML}formData(e){return this.class.formData(e||this.root)}attr(e,t){return typeof t>"u"?this.root.getAttribute(e):(this.root.setAttribute(e,t),t)}childNodes(e){let t=Array.from(this.root.children);if(e){let s=document.createElement("div");s.style.display="none",document.body.appendChild(s),t.forEach(n=>s.appendChild(n)),t=Array.from(s.children).map(e),document.body.removeChild(s)}return t}subscribe(e,t){Fez._subs||={},Fez._subs[e]||=[],Fez._subs[e]=Fez._subs[e].filter(s=>s[0].isConnected),Fez._subs[e].push([this,t])}rootId(){return this.root.id||=`fez_${this.UID}`,this.root.id}fezRegister(){this.css&&(this.css=Fez.globalCss(this.css,{name:this.fezName,wrap:!0})),this.class.css&&(this.class.css=Fez.globalCss(this.class.css,{name:this.fezName})),this.state||=this.reactiveStore(),this.globalState=Fez.state.createProxy(this),this.fezRegisterBindMethods()}fezRegisterBindMethods(){Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(t=>t!=="constructor"&&typeof this[t]=="function").forEach(t=>this[t]=this[t].bind(this))}dissolve(e){e&&(e.classList.add("fez"),e.classList.add(`fez-${this.fezName}`),e.fez=this,this.attr("id")&&e.setAttribute("id",this.attr("id")),this.root.innerHTML="",this.root.appendChild(e));let t=this.root,s=this.childNodes(),n=this.root.parentNode;return s.reverse().forEach(i=>n.insertBefore(i,t.nextSibling)),this.root.remove(),this.root=void 0,e&&(this.root=e),s}reactiveStore(e,t){e||={},t||=(n,i,o,f)=>{o!=f&&(this.onStateChange(i,o,f),this.nextTick(this.render,"render"))},t.bind(this);function s(n,i){return typeof n!="object"||n===null?n:new Proxy(n,{set(o,f,u,d){let y=Reflect.get(o,f,d);if(y!==u){typeof u=="object"&&u!==null&&(u=s(u,i));let S=Reflect.set(o,f,u,d);return i(o,f,u,y),S}return!0},get(o,f,u){let d=Reflect.get(o,f,u);return typeof d=="object"&&d!==null?s(d,i):d}})}return s(e,t)}};var Oe={data:""},Z=r=>typeof window=="object"?((r?r.querySelector("#_goober"):window._goober)||Object.assign((r||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:r||Oe,Ie=r=>{let e=Z(r),t=e.data;return e.data="",t},_e=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,ke=/\/\*[^]*?\*\/| +/g,J=/\n+/g,T=(r,e)=>{let t="",s="",n="";for(let i in r){let o=r[i];i[0]=="@"?i[1]=="i"?t=i+" "+o+";":s+=i[1]=="f"?T(o,i):i+"{"+T(o,i[1]=="k"?"":e)+"}":typeof o=="object"?s+=T(o,e?e.replace(/([^,])+/g,f=>i.replace(/(^:.*)|([^,])+/g,u=>/&/.test(u)?u.replace(/&/g,f):f?f+" "+u:u)):i):o!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),n+=T.p?T.p(i,o):i+":"+o+";")}return t+(e&&n?e+"{"+n+"}":n)+s},w={},Y=r=>{if(typeof r=="object"){let e="";for(let t in r)e+=t+Y(r[t]);return e}return r},Ne=(r,e,t,s,n)=>{let i=Y(r),o=w[i]||(w[i]=(u=>{let d=0,y=11;for(;d<u.length;)y=101*y+u.charCodeAt(d++)>>>0;return"go"+y})(i));if(!w[o]){let u=i!==r?r:(d=>{let y,S,M=[{}];for(;y=_e.exec(d.replace(ke,""));)y[4]?M.shift():y[3]?(S=y[3].replace(J," ").trim(),M.unshift(M[0][S]=M[0][S]||{})):M[0][y[1]]=y[2].replace(J," ").trim();return M[0]})(r);w[o]=T(n?{["@keyframes "+o]:u}:u,t?"":"."+o)}let f=t&&w.g?w.g:null;return t&&(w.g=w[o]),((u,d,y,S)=>{S?d.data=d.data.replace(S,u):d.data.indexOf(u)===-1&&(d.data=y?u+d.data:d.data+u)})(w[o],e,s,f),o},Re=(r,e,t)=>r.reduce((s,n,i)=>{let o=e[i];if(o&&o.call){let f=o(t),u=f&&f.props&&f.props.className||/^go/.test(f)&&f;o=u?"."+u:f&&typeof f=="object"?f.props?"":T(f,""):f===!1?"":f}return s+n+(o??"")},"");function N(r){let e=this||{},t=r.call?r(e.p):r;return Ne(t.unshift?t.raw?Re(t,[].slice.call(arguments,1),e.p):t.reduce((s,n)=>Object.assign(s,n&&n.call?n(e.p):n),{}):t,Z(e.target),e.g,e.o,e.k)}var Q,H,B,je=N.bind({g:1}),De=N.bind({k:1});function He(r,e,t,s){T.p=e,Q=r,H=t,B=s}function Be(r,e){let t=this||{};return function(){let s=arguments;function n(i,o){let f=Object.assign({},i),u=f.className||n.className;t.p=Object.assign({theme:H&&H()},f),t.o=/ *go\d+/.test(u),f.className=N.apply(t,s)+(u?" "+u:""),e&&(f.ref=o);let d=r;return r[0]&&(d=f.as||r,delete f.as),B&&d[0]&&B(f),Q(d,f)}return e?e(n):n}}var ee={css:N,extractCss:Ie,glob:je,keyframes:De,setup:He,styled:Be};var te=function(){"use strict";let r=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:A,afterNodeAdded:A,beforeNodeMorphed:A,afterNodeMorphed:A,beforeNodeRemoved:A,afterNodeRemoved:A,beforeAttributeUpdated:A},head:{style:"merge",shouldPreserve:function(l){return l.getAttribute("im-preserve")==="true"},shouldReAppend:function(l){return l.getAttribute("im-re-append")==="true"},shouldRemove:A,afterHeadMorphed:A}};function t(l,c,a={}){l instanceof Document&&(l=l.documentElement),typeof c=="string"&&(c=ze(c));let p=ve(c),h=be(l,p,a);return s(l,p,h)}function s(l,c,a){if(a.head.block){let p=l.querySelector("head"),h=c.querySelector("head");if(p&&h){let m=S(h,p,a);Promise.all(m).then(function(){s(l,c,Object.assign(a,{head:{block:!1,ignore:!0}}))});return}}if(a.morphStyle==="innerHTML")return o(c,l,a),l.children;if(a.morphStyle==="outerHTML"||a.morphStyle==null){let p=Ee(c,l,a),h=p?.previousSibling,m=p?.nextSibling,g=i(l,p,a);return p?Se(h,g,m):[]}else throw"Do not understand how to morph style "+a.morphStyle}function n(l,c){return c.ignoreActiveValue&&l===document.activeElement&&l!==document.body}function i(l,c,a){if(!(a.ignoreActive&&l===document.activeElement))return c==null?a.callbacks.beforeNodeRemoved(l)===!1?l:(l.remove(),a.callbacks.afterNodeRemoved(l),null):k(l,c)?(a.callbacks.beforeNodeMorphed(l,c)===!1||(l instanceof HTMLHeadElement&&a.head.ignore||(l instanceof HTMLHeadElement&&a.head.style!=="morph"?S(c,l,a):(u(c,l,a),n(l,a)||o(c,l,a))),a.callbacks.afterNodeMorphed(l,c)),l):a.callbacks.beforeNodeRemoved(l)===!1||a.callbacks.beforeNodeAdded(c)===!1?l:(l.parentElement.replaceChild(c,l),a.callbacks.afterNodeAdded(c),a.callbacks.afterNodeRemoved(l),c)}function o(l,c,a){let p=l.firstChild,h=c.firstChild,m;for(;p;){if(m=p,p=m.nextSibling,h==null){if(a.callbacks.beforeNodeAdded(m)===!1)return;c.appendChild(m),a.callbacks.afterNodeAdded(m),F(a,m);continue}if(W(m,h,a)){i(h,m,a),h=h.nextSibling,F(a,m);continue}let g=ye(l,c,m,h,a);if(g){h=V(h,g,a),i(g,m,a),F(a,m);continue}let z=ge(l,c,m,h,a);if(z){h=V(h,z,a),i(z,m,a),F(a,m);continue}if(a.callbacks.beforeNodeAdded(m)===!1)return;c.insertBefore(m,h),a.callbacks.afterNodeAdded(m),F(a,m)}for(;h!==null;){let g=h;h=h.nextSibling,U(g,a)}}function f(l,c,a,p){return l==="value"&&p.ignoreActiveValue&&c===document.activeElement?!0:p.callbacks.beforeAttributeUpdated(l,c,a)===!1}function u(l,c,a){let p=l.nodeType;if(p===1){let h=l.attributes,m=c.attributes;for(let g of h)if(!f(g.name,c,"update",a))try{c.getAttribute(g.name)!==g.value&&c.setAttribute(g.name,g.value)}catch(z){console.error("Error setting attribute:",{badNode:c,badAttribute:g,error:z.message})}for(let g=m.length-1;0<=g;g--){let z=m[g];f(z.name,c,"remove",a)||l.hasAttribute(z.name)||c.removeAttribute(z.name)}}(p===8||p===3)&&c.nodeValue!==l.nodeValue&&(c.nodeValue=l.nodeValue),n(c,a)||y(l,c,a)}function d(l,c,a,p){if(l[a]!==c[a]){let h=f(a,c,"update",p);h||(c[a]=l[a]),l[a]?h||c.setAttribute(a,l[a]):f(a,c,"remove",p)||c.removeAttribute(a)}}function y(l,c,a){if(l instanceof HTMLInputElement&&c instanceof HTMLInputElement&&l.type!=="file"){let p=l.value,h=c.value;d(l,c,"checked",a),d(l,c,"disabled",a),l.hasAttribute("value")?p!==h&&(f("value",c,"update",a)||(c.setAttribute("value",p),c.value=p)):f("value",c,"remove",a)||(c.value="",c.removeAttribute("value"))}else if(l instanceof HTMLOptionElement)d(l,c,"selected",a);else if(l instanceof HTMLTextAreaElement&&c instanceof HTMLTextAreaElement){let p=l.value,h=c.value;if(f("value",c,"update",a))return;p!==h&&(c.value=p),c.firstChild&&c.firstChild.nodeValue!==p&&(c.firstChild.nodeValue=p)}}function S(l,c,a){let p=[],h=[],m=[],g=[],z=a.head.style,L=new Map;for(let v of l.children)L.set(v.outerHTML,v);for(let v of c.children){let E=L.has(v.outerHTML),I=a.head.shouldReAppend(v),j=a.head.shouldPreserve(v);E||j?I?h.push(v):(L.delete(v.outerHTML),m.push(v)):z==="append"?I&&(h.push(v),g.push(v)):a.head.shouldRemove(v)!==!1&&h.push(v)}g.push(...L.values());let K=[];for(let v of g){let E=document.createRange().createContextualFragment(v.outerHTML).firstChild;if(a.callbacks.beforeNodeAdded(E)!==!1){if(E.href||E.src){let I=null,j=new Promise(function(Ce){I=Ce});E.addEventListener("load",function(){I()}),K.push(j)}c.appendChild(E),a.callbacks.afterNodeAdded(E),p.push(E)}}for(let v of h)a.callbacks.beforeNodeRemoved(v)!==!1&&(c.removeChild(v),a.callbacks.afterNodeRemoved(v));return a.head.afterHeadMorphed(c,{added:p,kept:m,removed:h}),K}function M(){}function A(){}function me(l){let c={};return Object.assign(c,e),Object.assign(c,l),c.callbacks={},Object.assign(c.callbacks,e.callbacks),Object.assign(c.callbacks,l.callbacks),c.head={},Object.assign(c.head,e.head),Object.assign(c.head,l.head),c}function be(l,c,a){return a=me(a),{target:l,newContent:c,config:a,morphStyle:a.morphStyle,ignoreActive:a.ignoreActive,ignoreActiveValue:a.ignoreActiveValue,idMap:$e(l,c),deadIds:new Set,callbacks:a.callbacks,head:a.head}}function W(l,c,a){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName?l.id!==""&&l.id===c.id?!0:O(a,l,c)>0:!1}function k(l,c){return l==null||c==null?!1:l.nodeType===c.nodeType&&l.tagName===c.tagName}function V(l,c,a){for(;l!==c;){let p=l;l=l.nextSibling,U(p,a)}return F(a,c),c.nextSibling}function ye(l,c,a,p,h){let m=O(h,a,c),g=null;if(m>0){let z=p,L=0;for(;z!=null;){if(W(a,z,h))return z;if(L+=O(h,z,l),L>m)return null;z=z.nextSibling}}return g}function ge(l,c,a,p,h){let m=p,g=a.nextSibling,z=0;for(;m!=null;){if(O(h,m,l)>0)return null;if(k(a,m))return m;if(k(g,m)&&(z++,g=g.nextSibling,z>=2))return null;m=m.nextSibling}return m}function ze(l){let c=new DOMParser,a=l.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(a.match(/<\/html>/)||a.match(/<\/head>/)||a.match(/<\/body>/)){let p=c.parseFromString(l,"text/html");if(a.match(/<\/html>/))return p.generatedByIdiomorph=!0,p;{let h=p.firstChild;return h?(h.generatedByIdiomorph=!0,h):null}}else{let h=c.parseFromString("<body><template>"+l+"</template></body>","text/html").body.querySelector("template").content;return h.generatedByIdiomorph=!0,h}}function ve(l){if(l==null)return document.createElement("div");if(l.generatedByIdiomorph)return l;if(l instanceof Node){let c=document.createElement("div");return c.append(l),c}else{let c=document.createElement("div");for(let a of[...l])c.append(a);return c}}function Se(l,c,a){let p=[],h=[];for(;l!=null;)p.push(l),l=l.previousSibling;for(;p.length>0;){let m=p.pop();h.push(m),c.parentElement.insertBefore(m,c)}for(h.push(c);a!=null;)p.push(a),h.push(a),a=a.nextSibling;for(;p.length>0;)c.parentElement.insertBefore(p.pop(),c.nextSibling);return h}function Ee(l,c,a){let p;p=l.firstChild;let h=p,m=0;for(;p;){let g=Ae(p,c,a);g>m&&(h=p,m=g),p=p.nextSibling}return h}function Ae(l,c,a){return k(l,c)?.5+O(a,l,c):0}function U(l,c){F(c,l),c.callbacks.beforeNodeRemoved(l)!==!1&&(l.remove(),c.callbacks.afterNodeRemoved(l))}function we(l,c){return!l.deadIds.has(c)}function Te(l,c,a){return(l.idMap.get(a)||r).has(c)}function F(l,c){let a=l.idMap.get(c)||r;for(let p of a)l.deadIds.add(p)}function O(l,c,a){let p=l.idMap.get(c)||r,h=0;for(let m of p)we(l,m)&&Te(l,m,a)&&++h;return h}function X(l,c){let a=l.parentElement,p=l.querySelectorAll("[id]");for(let h of p){let m=h;for(;m!==a&&m!=null;){let g=c.get(m);g==null&&(g=new Set,c.set(m,g)),g.add(h.id),m=m.parentElement}}}function $e(l,c){let a=new Map;return X(l,a),X(c,a),a}return{morph:t,defaults:e}}();var Pe=r=>{let e=r.split(/(<\/?[^>]+>)/g).map(n=>n.trim()).filter(n=>n),t=0,s=[];for(let n=0;n<e.length;n++){let i=e[n],o=e[n+1],f=e[n+2];if(i.startsWith("<"))if(!i.startsWith("</")&&!i.endsWith("/>")&&o&&!o.startsWith("<")&&f&&f.startsWith("</")){let u=Math.max(0,t);s.push(" ".repeat(u)+i+o+f),n+=2}else if(i.startsWith("</")){t--;let u=Math.max(0,t);s.push(" ".repeat(u)+i)}else if(i.endsWith("/>")||i.includes(" />")){let u=Math.max(0,t);s.push(" ".repeat(u)+i)}else{let u=Math.max(0,t);s.push(" ".repeat(u)+i),t++}else if(i){let u=Math.max(0,t);s.push(" ".repeat(u)+i)}}return s.join(`
9
- `)},P=(()=>{let r=[],e=[],t=0,s=null;document.addEventListener("keydown",o=>{if(o.key==="Escape"){o.preventDefault();let f=document.getElementById("dump-dialog"),u=document.getElementById("log-reopen-button");f?(f.remove(),n()):u&&(u.remove(),i())}else(o.key==="ArrowLeft"||o.key==="ArrowRight"||o.key==="ArrowUp"||o.key==="ArrowDown")&&document.getElementById("dump-dialog")&&r.length>0&&(o.preventDefault(),o.key==="ArrowLeft"&&t>0?(t--,localStorage.setItem("_LOG_INDEX",t),s()):o.key==="ArrowRight"&&t<r.length-1?(t++,localStorage.setItem("_LOG_INDEX",t),s()):o.key==="ArrowUp"&&t>0?(t=Math.max(0,t-5),localStorage.setItem("_LOG_INDEX",t),s()):o.key==="ArrowDown"&&t<r.length-1&&(t=Math.min(r.length-1,t+5),localStorage.setItem("_LOG_INDEX",t),s()))});let n=()=>{let o=document.getElementById("log-reopen-button");o||(o=document.body.appendChild(document.createElement("button")),o.id="log-reopen-button",o.innerHTML='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;margin-right:4px"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>LOG',o.style.cssText="position:fixed; top: 10px; right: 10px;padding:10px 20px;background:#ff3333;color:#fff;border:none;cursor:pointer;font:14px/1.4 monospace;z-index:2147483647;border-radius:8px;display:flex;align-items:center;opacity:1;visibility:visible;box-shadow:0 4px 12px rgba(255,51,51,0.3)",o.onclick=()=>{o.remove(),i()})},i=()=>{let o=document.getElementById("dump-dialog");if(!o){o=document.body.appendChild(document.createElement("div")),o.id="dump-dialog";let u=window.pageYOffset||document.documentElement.scrollTop;o.style.cssText="position:absolute; top:"+(u+20)+"px; left: 20px; right:20px;background:#fff; border:1px solid #333; box-shadow:0 0 10px rgba(0,0,0,0.5);padding:20px; overflow:auto; z-index:2147483646; font:13px/1.4 monospace;white-space:pre; display:block; opacity:1; visibility:visible"}let f=parseInt(localStorage.getItem("_LOG_INDEX"));!isNaN(f)&&f>=0&&f<r.length?t=f:t=r.length-1,s=()=>{let u=r.map((d,y)=>{let S="#f0f0f0";return y!==t&&(e[y]==="object"?S="#d6e3ef":e[y]==="array"&&(S="#d8d5ef")),`<button style="font-size: 14px; font-weight: 400; padding:2px 6px; margin: 0 2px 2px 0;cursor:pointer;background:${y===t?"#333":S};color:${y===t?"#fff":"#000"}" data-index="${y}">${y+1}</button>`}).join("");o.innerHTML='<div style="display:flex;flex-direction:column;height:100%"><div style="display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:10px"><div style="display:flex;flex-wrap:wrap;gap:4px;flex:1;margin-right:10px">'+u+'</div><button style="padding:4px 8px;cursor:pointer;flex-shrink:0">&times;</button></div><xmp style="font-family:monospace;flex:1;overflow:auto;margin:0;padding:0;color:#000;background:#fff;font-size:14px;line-height:22px">'+r[t]+"</xmp></div>",o.querySelector('button[style*="flex-shrink:0"]').onclick=()=>{o.remove(),n()},o.querySelectorAll("button[data-index]").forEach(d=>{d.onclick=()=>{t=parseInt(d.dataset.index),localStorage.setItem("_LOG_INDEX",t),s()}})},s()};return o=>{if(!document.body){window.requestAnimationFrame(()=>P(o));return}let f=typeof o;o instanceof Node&&(o.nodeType===Node.TEXT_NODE?o=o.textContent||String(o):o=Pe(o.outerHTML)),o===void 0&&(o="undefined"),o===null&&(o="null"),Array.isArray(o)?f="array":typeof o=="object"&&o!==null&&(f="object"),typeof o!="string"&&(o=JSON.stringify(o,(d,y)=>typeof y=="function"?String(y):y,2).replaceAll("<","&lt;")),o=o.trim(),r.push(o+`
112
+ `,y=new Function(m);return b=>{try{return y.bind(b)()}catch(z){return console.error(`FEZ svelte template runtime error in <${b.fezName||n}>:`,z.message),console.error("Template source:",o.substring(0,500)),""}}}catch(r){return console.error(`FEZ svelte template compile error in <${n}>:`,r.message),console.error("Template:",e.substring(0,200)),()=>""}}var H=new Map;function L(e,t={}){if(H.has(e))return H.get(e);De(e)&&(e=Oe(e,t.name));let n=P(e,t);return H.set(e,n),n}function De(e){return e.includes("{{")&&e.includes("}}")||e.includes("[[")&&e.includes("]]")}function Oe(e,t){return e=e.replaceAll("[[","{{").replaceAll("]]","}}"),e=e.replace(/\{\{block\s+(\w+)\s*\}\}/g,"{@block $1}"),e=e.replace(/\{\{\/block\}\}/g,"{/block}"),e=e.replace(/\{\{block:([\w\-]+)\s*\}\}/g,"{@block:$1}"),e=e.replace(/\{\{#?if\s+(.*?)\}\}/g,"{#if $1}"),e=e.replace(/\{\{\/if\}\}/g,"{/if}"),e=e.replace(/\{\{#?unless\s+(.*?)\}\}/g,"{#unless $1}"),e=e.replace(/\{\{\/unless\}\}/g,"{/unless}"),e=e.replace(/\{\{:?else\s+if\s+(.*?)\}\}/g,"{:else if $1}"),e=e.replace(/\{\{:?elsif\s+(.*?)\}\}/g,"{:else if $1}"),e=e.replace(/\{\{:?elseif\s+(.*?)\}\}/g,"{:else if $1}"),e=e.replace(/\{\{:?else\}\}/g,"{:else}"),e=e.replace(/\{\{#?for\s+(.*?)\}\}/g,"{#for $1}"),e=e.replace(/\{\{\/for\}\}/g,"{/for}"),e=e.replace(/\{\{#?each\s+(.*?)\}\}/g,"{#each $1}"),e=e.replace(/\{\{\/each\}\}/g,"{/each}"),e=e.replace(/\{\{#?(?:raw|html)\s+(.*?)\}\}/g,"{@html $1}"),e=e.replace(/\{\{json\s+(.*?)\}\}/g,"{@json $1}"),e=e.replace(/\{\{\s*(.*?)\s*\}\}/g,"{$1}"),t&&console.warn(`Fez component "${t}" uses old {{ ... }} notation, converting.`),e}var M=new Map,v={};function re(e,t,n){let r=null,s=null,o;typeof t=="function"?(o=e,n=t):(o=t,typeof e=="string"?r=e:s=e),M.has(o)||M.set(o,new Set);let i=M.get(o);for(let c of i)c.callback===n&&c.selector===r&&c.node===s&&i.delete(c);let l={selector:r,node:s,callback:n};return i.add(l),()=>i.delete(l)}function oe(e,...t){let n=M.get(e);if(n)for(let r of n){let s=null;if(r.selector){if(s=document.querySelector(r.selector),!s)continue}else if(r.node){if(!r.node.isConnected){n.delete(r);continue}s=r.node}try{r.callback.call(s,...t)}catch(o){console.error(`Fez pubsub error on "${e}":`,o)}}v[e]&&v[e].forEach(([r,s])=>{r.isConnected&&s.bind(r)(...t)})}function ie(e,t,n){return v[t]||=[],v[t]=v[t].filter(([r])=>r.isConnected),v[t].push([e,n]),()=>{v[t]=v[t].filter(([r,s])=>!(r===e&&s===n))}}function le(e,t,...n){let r=o=>{if(v[t]){let i=v[t].find(([l])=>l===o);if(i)return i[1].bind(o)(...n),!0}return!1};if(r(e))return!0;let s=e.root?.parentElement;for(;s;){if(s.fez&&r(s.fez))return!0;s=s.parentElement}return!1}var C=class{static nodeName="div";static getProps(t,n){let r={};if(t.props)return t.props;for(let s of t.attributes)r[s.name]=s.value;for(let[s,o]of Object.entries(r))if([":"].includes(s[0])){delete r[s];try{let i=new Function(`return (${o})`).bind(n)();r[s.replace(/[\:_]/,"")]=i}catch(i){Fez.onError("attr",`<${t.tagName.toLowerCase()}> Error evaluating ${s}="${o}": ${i.message}`)}}if(r["data-props"]){let s=r["data-props"];if(typeof s=="object")return s;s[0]!="{"&&(s=decodeURIComponent(s));try{r=JSON.parse(s)}catch(o){Fez.onError("props",`<${t.tagName.toLowerCase()}> Invalid JSON in data-props: ${o.message}`)}}else if(r["data-json-template"]){let s=n.previousSibling?.textContent;if(s)try{r=JSON.parse(s),n.previousSibling.remove()}catch(o){Fez.onError("props",`<${t.tagName.toLowerCase()}> Invalid JSON in template: ${o.message}`)}}return r}static formData(t){let n=t.closest("form")||t.querySelector("form");if(!n)return Fez.consoleLog("No form found for formData()"),{};let r=new FormData(n),s={};return r.forEach((o,i)=>{s[i]=o}),s}constructor(){}n=j;fezBlocks={};fezGlobals={_data:new Map,_counter:0,set(t){let n=this._counter++;return this._data.set(n,t),n},delete(t){let n=this._data.get(t);return this._data.delete(t),n}};fezError(t,n,r){let s=this.fezName||this.root?.tagName?.toLowerCase()||"unknown",o=r?{...r,componentName:s}:{componentName:s};return Fez.onError(t,`<${s}> ${n}`,o)}get fezHtmlRoot(){return`Fez(${this.UID}).`}get isConnected(){return!!this.root?.isConnected}prop(t){let n=this.oldRoot[t]||this.props[t];return typeof n=="function"&&(n=n.bind(this.root)),n}connect(){}onMount(){}beforeRender(){}afterRender(){}onDestroy(){}onStateChange(){}onGlobalStateChange(){}onPropsChange(){}fezOnDestroy(){this._destroyed||(this._destroyed=!0,this._onDestroyCallbacks&&(this._onDestroyCallbacks.forEach(t=>{try{t()}catch(n){this.fezError("destroy","Error in cleanup callback",n)}}),this._onDestroyCallbacks=[]),this.onDestroy(),this.onDestroy=()=>{},this.root&&(this.root.fez=void 0),this.root=void 0)}addOnDestroy(t){this._onDestroyCallbacks=this._onDestroyCallbacks||[],this._onDestroyCallbacks.push(t)}fezParseHtml(t){let n=this.fezHtmlRoot.replaceAll('"',"&quot;");return t=t.replace(/([!'"\s;])fez\.(\w)/g,`$1${n}$2`).replace(/>\s+</g,"><"),t.trim()}fezNextTick(t,n){n?(this._nextTicks||={},this._nextTicks[n]||=window.requestAnimationFrame(()=>{t.bind(this)(),this._nextTicks[n]=null},n)):window.requestAnimationFrame(t.bind(this))}fezRefresh(){this.fezNextTick(()=>this.fezRender(),"refresh")}refresh(){this.fezRefresh()}fezRender(t){if(t||=this.fezHtmlFunc||this?.class?.fezHtmlFunc,!t||!this.root)return;this._isRendering=!0,this.beforeRender();let n=typeof this.class.nodeName=="function"?this.class.nodeName(this.root):this.class.nodeName,r=document.createElement(n||"div"),s;if(Array.isArray(t))t[0]instanceof Node?t.forEach(i=>r.appendChild(i)):s=t.join("");else if(typeof t=="string"){let i=this.root?.tagName?.toLowerCase();s=L(t,{name:i})(this)}else typeof t=="function"&&(s=t(this));if(s)if(s instanceof DocumentFragment||s instanceof Node)r.appendChild(s);else{s=s.replace(/\s\w+="undefined"/g,"");let i=this.fezParseHtml(s),l=Fez.fnv1(i);if(l===this._fezHash){this._isRendering=!1;return}this._fezHash=l,r.innerHTML=i}this.fezKeepNode(r);let o=new Map;this.root.querySelectorAll("input, textarea, select").forEach(i=>{i._fezThisName&&o.set(i._fezThisName,{value:i.value,checked:i.checked})}),Fez.morphdom(this.root,r),o.forEach((i,l)=>{let c=null;this.root.querySelectorAll("input, textarea, select").forEach(d=>{d._fezThisName===l&&(c=d)}),c&&(c.value=i.value,i.checked!==void 0&&(c.checked=i.checked))}),this.fezRenderPostProcess(),this.afterRender(),this._isRendering=!1}fezRenderPostProcess(){let t=(n,r)=>{this.root.querySelectorAll(`*[${n}]`).forEach(s=>{let o=s.getAttribute(n);s.removeAttribute(n),o&&r.bind(this)(o,s)})};t("fez-this",(n,r)=>{new Function("n",`this.${n} = n`).bind(this)(r),r._fezThisName=n}),t("fez-use",(n,r)=>{if(n.includes("=>"))Fez.getFunction(n)(r);else if(n.includes("."))Fez.getFunction(n).bind(r)();else{let s=this[n];typeof s=="function"?s(r):this.fezError("fez-use",`"${n}" is not a function`)}}),t("fez-class",(n,r)=>{let s=n.split(/\s+/),o=s.pop();s.forEach(i=>r.classList.add(i)),o&&setTimeout(()=>{r.classList.add(o)},1)}),t("fez-bind",(n,r)=>{if(["INPUT","SELECT","TEXTAREA"].includes(r.nodeName)){let s=new Function(`return this.${n}`).bind(this)(),o=r.type.toLowerCase()=="checkbox",i=["SELECT"].includes(r.nodeName)||o?"onchange":"onkeyup";r.setAttribute(i,`${this.fezHtmlRoot}${n} = this.${o?"checked":"value"}`),this.val(r,s),r._fezThisName=n}else this.fezError("fez-bind",`Can't bind "${n}" to ${r.nodeName} (needs INPUT, SELECT or TEXTAREA)`)});for(let n of["checked","disabled","selected"])this.root.querySelectorAll(`*[${n}]`).forEach(r=>{let s=r.getAttribute(n);["false","null","undefined"].includes(s)?(r.removeAttribute(n),r[n]=!1):r.setAttribute(n,n)})}fezKeepNode(t){if(this._fezSlotInitialized)return;let n=t.querySelector(".fez-slot");n&&this._fezSlotNodes&&(this._fezSlotInitialized=!0,this._fezSlotNodes.forEach(r=>{n.appendChild(r)}))}fezRegister(){this.css&&(this.css=Fez.globalCss(this.css,{name:this.fezName,wrap:!0})),this.class.css&&(this.class.css=Fez.globalCss(this.class.css,{name:this.fezName})),this.state||=this.fezReactiveStore(),this.globalState=Fez.state.createProxy(this),this.fezRegisterBindMethods()}fezRegisterBindMethods(){Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(n=>n!=="constructor"&&typeof this[n]=="function").forEach(n=>this[n]=this[n].bind(this))}fezReactiveStore(t,n){t||={},n||=(o,i,l,c)=>{l!=c&&(this.onStateChange(i,l,c),!this._isRendering&&!this._isInitializing&&this.fezNextTick(this.fezRender,"fezRender"))},n.bind(this);function r(o){return typeof o=="object"&&o!==null&&!(o instanceof Promise)&&!o.nodeType}function s(o,i){return r(o)?new Proxy(o,{set(l,c,d,f){let a=Reflect.get(l,c,f);if(a!==d){r(d)&&(d=s(d,i));let p=Reflect.set(l,c,d,f);return i(l,c,d,a),p}return!0},get(l,c,d){let f=Reflect.get(l,c,d);return r(f)?s(f,i):f}}):o}return s(t,n)}find(t){return typeof t=="string"?this.root.querySelector(t):t}addClass(t,n){(n||this.root).classList.add(...t.split(/\s+/).filter(Boolean))}toggleClass(t,n,r){(r||this.root).classList.toggle(t,n)}val(t,n){let r=this.find(t);if(r)if(["INPUT","TEXTAREA","SELECT"].includes(r.nodeName))if(typeof n<"u")r.type=="checkbox"?r.checked=!!n:r.value=n;else return r.value;else if(typeof n<"u")r.innerHTML=n;else return r.innerHTML}formData(t){return this.class.formData(t||this.root)}attr(t,n){return typeof n>"u"?this.root.getAttribute(t):(this.root.setAttribute(t,n),n)}childNodes(t){let n=this._fezChildNodes||Array.from(this.root.children);return t===!0?n=n.map(r=>{let s={html:r.innerHTML,ROOT:r};for(let o of r.attributes)s[o.name]=o.value;return s}):t&&(n=n.map(t)),n}setStyle(t,n){t&&typeof t=="object"?Object.entries(t).forEach(([r,s])=>{this.root.style.setProperty(r,s)}):this.root.style.setProperty(t,n)}copy(){for(let t of Array.from(arguments)){let n=this.props[t];if(n!==void 0){if(t=="class"){let r=this.root.getAttribute(t,n);r&&(n=[r,n].join(" "))}typeof n=="string"?this.root.setAttribute(t,n):this.root[t]=n}}}rootId(){return this.root.id||=`fez_${this.UID}`,this.root.id}dissolve(t){t&&(t.classList.add("fez"),t.classList.add(`fez-${this.fezName}`),t.fez=this,this.attr("id")&&t.setAttribute("id",this.attr("id")),this.root.innerHTML="",this.root.appendChild(t));let n=this.root,r=this.childNodes(),s=this.root.parentNode;return r.reverse().forEach(o=>s.insertBefore(o,n.nextSibling)),this.root.remove(),this.root=void 0,t&&(this.root=t),r}on(t,n,r=200){this._eventHandlers=this._eventHandlers||{},this._eventHandlers[t]&&window.removeEventListener(t,this._eventHandlers[t]);let s=Fez.throttle(()=>{this.isConnected&&n.call(this)},r);this._eventHandlers[t]=s,window.addEventListener(t,s),this.addOnDestroy(()=>{window.removeEventListener(t,s),delete this._eventHandlers[t]})}onWindowResize(t,n){this.on("resize",t,n),t()}onWindowScroll(t,n){this.on("scroll",t,n),t()}onElementResize(t,n,r=200){let s=Fez.throttle(()=>{this.isConnected&&n.call(this,t.getBoundingClientRect(),t)},r),o=new ResizeObserver(s);o.observe(t),n.call(this,t.getBoundingClientRect(),t),this.addOnDestroy(()=>{o.disconnect()})}setTimeout(t,n){let r=setTimeout(()=>{this.isConnected&&t()},n);return this.addOnDestroy(()=>clearTimeout(r)),r}setInterval(t,n,r){typeof t=="number"&&([n,t]=[t,n]),r||=Fez.fnv1(String(t)),this._setIntervalCache||={},clearInterval(this._setIntervalCache[r]);let s=setInterval(()=>{this.isConnected&&t()},n);return this._setIntervalCache[r]=s,this.addOnDestroy(()=>{clearInterval(s),delete this._setIntervalCache[r]}),s}publish(t,...n){return le(this,t,...n)}subscribe(t,n){let r=ie(this,t,n);return this.addOnDestroy(r),r}fezSlot(t,n){n||=document.createElement("template");let r=n.nodeName=="SLOT";for(;t.firstChild;)r?n.parentNode.insertBefore(t.lastChild,n.nextSibling):n.appendChild(t.firstChild);return r?n.parentNode.removeChild(n):t.innerHTML="",n}};var Re={data:""},ae=e=>typeof window=="object"?((e?e.querySelector("#_goober"):window._goober)||Object.assign((e||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:e||Re,je=e=>{let t=ae(e),n=t.data;return t.data="",n},ke=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Pe=/\/\*[^]*?\*\/| +/g,ce=/\n+/g,S=(e,t)=>{let n="",r="",s="";for(let o in e){let i=e[o];o[0]=="@"?o[1]=="i"?n=o+" "+i+";":r+=o[1]=="f"?S(i,o):o+"{"+S(i,o[1]=="k"?"":t)+"}":typeof i=="object"?r+=S(i,t?t.replace(/([^,])+/g,l=>o.replace(/(^:.*)|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,l):l?l+" "+c:c)):o):i!=null&&(o=/^--/.test(o)?o:o.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=S.p?S.p(o,i):o+":"+i+";")}return n+(t&&s?t+"{"+s+"}":s)+r},x={},fe=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+fe(e[n]);return t}return e},He=(e,t,n,r,s)=>{let o=fe(e),i=x[o]||(x[o]=(c=>{let d=0,f=11;for(;d<c.length;)f=101*f+c.charCodeAt(d++)>>>0;return"go"+f})(o));if(!x[i]){let c=o!==e?e:(d=>{let f,a,p=[{}];for(;f=ke.exec(d.replace(Pe,""));)f[4]?p.shift():f[3]?(a=f[3].replace(ce," ").trim(),p.unshift(p[0][a]=p[0][a]||{})):p[0][f[1]]=f[2].replace(ce," ").trim();return p[0]})(e);x[i]=S(s?{["@keyframes "+i]:c}:c,n?"":"."+i)}let l=n&&x.g?x.g:null;return n&&(x.g=x[i]),((c,d,f,a)=>{a?d.data=d.data.replace(a,c):d.data.indexOf(c)===-1&&(d.data=f?c+d.data:d.data+c)})(x[i],t,r,l),i},We=(e,t,n)=>e.reduce((r,s,o)=>{let i=t[o];if(i&&i.call){let l=i(n),c=l&&l.props&&l.props.className||/^go/.test(l)&&l;i=c?"."+c:l&&typeof l=="object"?l.props?"":S(l,""):l===!1?"":l}return r+s+(i??"")},"");function D(e){let t=this||{},n=e.call?e(t.p):e;return He(n.unshift?n.raw?We(n,[].slice.call(arguments,1),t.p):n.reduce((r,s)=>Object.assign(r,s&&s.call?s(t.p):s),{}):n,ae(t.target),t.g,t.o,t.k)}var de,W,B,Be=D.bind({g:1}),qe=D.bind({k:1});function Ge(e,t,n,r){S.p=t,de=e,W=n,B=r}function Ue(e,t){let n=this||{};return function(){let r=arguments;function s(o,i){let l=Object.assign({},o),c=l.className||s.className;n.p=Object.assign({theme:W&&W()},l),n.o=/ *go\d+/.test(c),l.className=D.apply(n,r)+(c?" "+c:""),t&&(l.ref=i);let d=e;return e[0]&&(d=l.as||e,delete l.as),B&&d[0]&&B(l),de(d,l)}return t?t(s):s}}var ue={css:D,extractCss:je,glob:Be,keyframes:qe,setup:Ge,styled:Ue};function pe(e,t,n={}){he(e,t,n);let r=e.nextSibling;r?.nodeType===3&&!r.textContent.trim()&&r.remove()}function Ze(e,t){let n=e.attributes,r=t.attributes,s=e===document.activeElement&&Ve(e);for(let o=n.length-1;o>=0;o--){let i=n[o].name;t.hasAttribute(i)||e.removeAttribute(i)}for(let o=0;o<r.length;o++){let i=r[o];if(!(s&&(i.name==="value"||i.name==="checked"))&&e.getAttribute(i.name)!==i.value)if(i.name==="class")Ke(e,t);else try{e.setAttribute(i.name,i.value)}catch(l){console.error("Error setting attribute:",{node:e,attribute:i.name,error:l.message})}}}function Ke(e,t){let n=new Set((e.getAttribute("class")||"").split(/\s+/).filter(Boolean)),r=new Set((t.getAttribute("class")||"").split(/\s+/).filter(Boolean));for(let s of n)r.has(s)||e.classList.remove(s);for(let s of r)n.has(s)||e.classList.add(s)}function Ve(e){let t=e.nodeName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"}function Xe(e){if(e.nodeType!==1)return null;if(e.classList?.contains("fez")&&e.fez)return"fez-uid-"+e.fez.UID;let t=e.getAttribute?.("fez-keep");if(t)return"keep-"+t;let n=e.id;return n?"id-"+n:null}function q(e){if(e.nodeType!==1)return null;let t=e.getAttribute?.("fez-keep");if(t)return"keep-"+t;let n=e.id;if(n)return"id-"+n;if(e.classList?.contains("fez")){for(let r of e.classList)if(r.startsWith("fez-")&&r!=="fez")return"fez-class-"+r}return null}function he(e,t,n){let r=Array.from(e.childNodes),s=Array.from(t.childNodes);if(r.length===0&&s.length===0)return;if(r.length===0){for(let a of s)e.appendChild(a);return}if(s.length===0){for(let a of r)n.beforeRemove&&a.nodeType===1&&O(a,n),e.removeChild(a);return}let o=new Map;for(let a of r){let p=Xe(a);if(p&&(o.set(p,a),p.startsWith("fez-uid-")&&(a.id&&o.set("id-"+a.id,a),a.classList))){for(let m of a.classList)if(m.startsWith("fez-")&&m!=="fez"){o.set("fez-class-"+m,a);break}}}let i=[],l=new Set;for(let a=0;a<s.length;a++){let p=s[a],m=q(p);if(m&&o.has(m)){let y=o.get(m),b=m.startsWith("keep-")||m.startsWith("fez-uid-");i.push({old:y,new:p,preserve:b}),l.add(y)}else i.push({old:null,new:p,preserve:!1})}let c=r.filter(a=>!l.has(a)),d=0;for(let a=0;a<i.length;a++){if(i[a].old)continue;let p=i[a].new;if(!(q(p)&&q(p).startsWith("keep-")))for(;d<c.length;){let m=c[d];if(d++,!(m.nodeType===1&&(m.getAttribute?.("fez-keep")||m.classList?.contains("fez")&&m.fez))&&Je(m,p)){i[a].old=m,l.add(m);break}}}for(let a of r)l.has(a)||(a.nodeType===1&&O(a,n),e.removeChild(a));let f=e.firstChild;for(let a of i)if(a.old){let p=a.old,m=a.new;if(a.preserve){p!==f?e.insertBefore(p,f):f=f.nextSibling;continue}if(p.nodeType===3&&m.nodeType===3)p.textContent!==m.textContent&&(p.textContent=m.textContent);else if(p.nodeType===8&&m.nodeType===8)p.textContent!==m.textContent&&(p.textContent=m.textContent);else if(p.nodeType===1&&m.nodeType===1){if(!(n.skipNode&&n.skipNode(p)))if(p.nodeName===m.nodeName)Ze(p,m),he(p,m,n);else{O(p,n);let y=m;e.insertBefore(y,p),e.removeChild(p),f=y.nextSibling;continue}}else{p.nodeType===1&&O(p,n),e.insertBefore(m,p),e.removeChild(p),f=m.nextSibling;continue}p!==f?e.insertBefore(p,f):f=f.nextSibling}else e.insertBefore(a.new,f)}function Je(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===1?e.nodeName===t.nodeName:!0}function O(e,t){t.beforeRemove&&(t.beforeRemove(e),e.querySelectorAll&&e.querySelectorAll(".fez").forEach(n=>{t.beforeRemove(n)}))}var Qe=e=>{let t=e.split(/(<\/?[^>]+>)/g).map(s=>s.trim()).filter(s=>s),n=0,r=[];for(let s=0;s<t.length;s++){let o=t[s],i=t[s+1],l=t[s+2];if(o.startsWith("<"))if(!o.startsWith("</")&&!o.endsWith("/>")&&i&&!i.startsWith("<")&&l&&l.startsWith("</")){let c=Math.max(0,n);r.push(" ".repeat(c)+o+i+l),s+=2}else if(o.startsWith("</")){n--;let c=Math.max(0,n);r.push(" ".repeat(c)+o)}else if(o.endsWith("/>")||o.includes(" />")){let c=Math.max(0,n);r.push(" ".repeat(c)+o)}else{let c=Math.max(0,n);r.push(" ".repeat(c)+o),n++}else if(o){let c=Math.max(0,n);r.push(" ".repeat(c)+o)}}return r.join(`
113
+ `)},G=(()=>{let e=[],t=[],n=0,r=null;document.addEventListener("keydown",i=>{if(i.key==="Escape"){i.preventDefault();let l=document.getElementById("dump-dialog"),c=document.getElementById("log-reopen-button");l?(l.remove(),s()):c&&(c.remove(),o())}else(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown")&&document.getElementById("dump-dialog")&&e.length>0&&(i.preventDefault(),i.key==="ArrowLeft"&&n>0?(n--,localStorage.setItem("_LOG_INDEX",n),r()):i.key==="ArrowRight"&&n<e.length-1?(n++,localStorage.setItem("_LOG_INDEX",n),r()):i.key==="ArrowUp"&&n>0?(n=Math.max(0,n-5),localStorage.setItem("_LOG_INDEX",n),r()):i.key==="ArrowDown"&&n<e.length-1&&(n=Math.min(e.length-1,n+5),localStorage.setItem("_LOG_INDEX",n),r()))});let s=()=>{let i=document.getElementById("log-reopen-button");i||(i=document.body.appendChild(document.createElement("button")),i.id="log-reopen-button",i.innerHTML='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle;margin-right:4px"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>LOG',i.style.cssText="position:fixed; top: 10px; right: 10px;padding:10px 20px;background:#ff3333;color:#fff;border:none;cursor:pointer;font:14px/1.4 monospace;z-index:2147483647;border-radius:8px;display:flex;align-items:center;opacity:1;visibility:visible;box-shadow:0 4px 12px rgba(255,51,51,0.3)",i.onclick=()=>{i.remove(),o()})},o=()=>{let i=document.getElementById("log-reopen-button");i&&i.remove();let l=document.getElementById("dump-dialog");l||(l=document.body.appendChild(document.createElement("div")),l.id="dump-dialog",l.style.cssText="position:fixed; top:20px; left:20px; right:20px; max-height:calc(100vh - 40px);background:#fff; border:1px solid #333; box-shadow:0 0 10px rgba(0,0,0,0.5);padding:20px; overflow:auto; z-index:2147483646; font:13px/1.4 monospace;white-space:pre; display:block; opacity:1; visibility:visible");let c=parseInt(localStorage.getItem("_LOG_INDEX"));!isNaN(c)&&c>=0&&c<e.length?n=c:n=e.length-1,r=()=>{let d=e.map((f,a)=>{let p="#f0f0f0";return a!==n&&(t[a]==="object"?p="#d6e3ef":t[a]==="array"&&(p="#d8d5ef")),`<button style="font-size: 14px; font-weight: 400; padding:2px 6px; margin: 0 2px 2px 0;cursor:pointer;background:${a===n?"#333":p};color:${a===n?"#fff":"#000"}" data-index="${a}">${a+1}</button>`}).join("");l.innerHTML='<div style="display:flex;flex-direction:column;height:100%"><div style="display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:10px"><div style="display:flex;flex-wrap:wrap;gap:4px;flex:1;margin-right:10px">'+d+'</div><button style="padding:4px 8px;cursor:pointer;flex-shrink:0">&times;</button></div><xmp style="font-family:monospace;flex:1;overflow:auto;margin:0;padding:0;color:#000;background:#fff;font-size:14px;line-height:22px">'+e[n]+"</xmp></div>",l.querySelector('button[style*="flex-shrink:0"]').onclick=()=>{l.remove(),s()},l.querySelectorAll("button[data-index]").forEach(f=>{f.onclick=()=>{n=parseInt(f.dataset.index),localStorage.setItem("_LOG_INDEX",n),r()}})},r()};return i=>{if(!document.body){window.requestAnimationFrame(()=>G(i));return}let l=typeof i;i instanceof Node&&(i.nodeType===Node.TEXT_NODE?i=i.textContent||String(i):i=Qe(i.outerHTML)),i===void 0&&(i="undefined"),i===null&&(i="null"),Array.isArray(i)?l="array":typeof i=="object"&&i!==null&&(l="object"),typeof i!="string"&&(i=JSON.stringify(i,(d,f)=>typeof f=="function"?String(f):f,2).replaceAll("<","&lt;")),i=i.trim(),e.push(i+`
10
114
 
11
- type: ${f}`),e.push(f),!!document.getElementById("dump-dialog")?(t=r.length-1,localStorage.setItem("_LOG_INDEX",t),s&&s()):i()}})();typeof window<"u"&&!window.LOG&&(window.LOG=P);var re=P;var se=()=>{let r=parseInt(window.location.port)||80;if(!(Fez.DEV===!0||r>2999&&Fez.DEV!==!1))return;let e=document.querySelectorAll(".fez-highlight-overlay");if(e.length>0){e.forEach(s=>s.remove());return}document.querySelectorAll(".fez, .svelte").forEach(s=>{let n=null,i=null;if(s.classList.contains("fez")&&s.fez&&s.fez.fezName?(n=s.fez.fezName,i="fez"):s.classList.contains("svelte")&&s.svelte&&s.svelte.svelteName&&(n=s.svelte.svelteName,i="svelte"),n){let o=document.createElement("div");o.className="fez-highlight-overlay";let f=s.getBoundingClientRect(),u=window.pageYOffset||document.documentElement.scrollTop,d=window.pageXOffset||document.documentElement.scrollLeft;o.style.cssText=`
115
+ type: ${l}`),t.push(l),!!document.getElementById("dump-dialog")?(n=e.length-1,localStorage.setItem("_LOG_INDEX",n),r&&r()):o()}})();typeof window<"u"&&!window.LOG&&(window.LOG=G);var me=G;var ge=()=>{let e=parseInt(window.location.port)||80;if(!(Fez.DEV===!0||e>2999&&Fez.DEV!==!1))return;let t=document.querySelectorAll(".fez-highlight-overlay");if(t.length>0){t.forEach(r=>r.remove());return}document.querySelectorAll(".fez, .svelte").forEach(r=>{let s=null,o=null;if(r.classList.contains("fez")&&r.fez&&r.fez.fezName?(s=r.fez.fezName,o="fez"):r.classList.contains("svelte")&&r.svelte&&r.svelte.svelteName&&(s=r.svelte.svelteName,o="svelte"),s){let i=document.createElement("div");i.className="fez-highlight-overlay";let l=r.getBoundingClientRect(),c=window.pageYOffset||document.documentElement.scrollTop,d=window.pageXOffset||document.documentElement.scrollLeft;i.style.cssText=`
12
116
  position: absolute;
13
- top: ${f.top+u}px;
14
- left: ${f.left+d}px;
15
- width: ${f.width}px;
16
- height: ${f.height}px;
17
- border: 1px solid ${i==="svelte"?"blue":"red"};
117
+ top: ${l.top+c}px;
118
+ left: ${l.left+d}px;
119
+ width: ${l.width}px;
120
+ height: ${l.height}px;
121
+ border: 1px solid ${o==="svelte"?"blue":"red"};
18
122
  pointer-events: none;
19
123
  z-index: 9999;
20
- `;let y=document.createElement("div");y.textContent=n,y.style.cssText=`
124
+ `;let f=document.createElement("div");f.textContent=s,f.style.cssText=`
21
125
  position: absolute;
22
126
  top: -20px;
23
127
  left: 0;
24
- background: ${i==="svelte"?"blue":"red"};
128
+ background: ${o==="svelte"?"blue":"red"};
25
129
  color: white;
26
130
  padding: 4px 6px 2px 6px;
27
131
  font-size: 14px;
@@ -31,24 +135,29 @@ type: ${f}`),e.push(f),!!document.getElementById("dump-dialog")?(t=r.length-1,lo
31
135
  cursor: pointer;
32
136
  pointer-events: auto;
33
137
  text-transform: uppercase;
34
- `,y.addEventListener("click",S=>{S.stopPropagation(),Fez.dump(s)}),o.appendChild(y),document.body.appendChild(o)}})};document.addEventListener("keydown",r=>{(r.ctrlKey||r.metaKey)&&r.key==="e"&&(r.target.closest("form")||(r.preventDefault(),se()))});var ne=se;var qe=new MutationObserver((r,e)=>{for(let t of r)if(t.type==="attributes"){let s=t.target.fez,n=t.attributeName,i=t.target.getAttribute(n);s&&(s.props[n]=i,s.onPropsChange(n,i))}});function q(r,e){let t=globalThis.window?.Fez||globalThis.Fez;if(r.includes("-")||console.error(`Fez: Invalid custom element name "${r}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`),e.fezHtmlRoot)e.html&&(e.html=oe(e.html));else{let s=new e,n=class extends x{};Object.getOwnPropertyNames(s).concat(Object.getOwnPropertyNames(e.prototype)).filter(o=>!["constructor","prototype"].includes(o)).forEach(o=>n.prototype[o]=s[o]),s.FAST&&(n.FAST=s.FAST),s.GLOBAL&&(n.GLOBAL=s.GLOBAL),s.CSS&&(n.css=s.CSS),s.HTML&&(n.html=oe(s.HTML)),s.NAME&&(n.nodeName=s.NAME),s.GLOBAL&&document.body.appendChild(document.createElement(r)),e=n,t.log(`${r} compiled`)}if(e.html){let s=e.SLOT||"div";e.html=e.html.replace("<slot",`<${s} class="fez-slot" fez-keep="default-slot"`).replace("</slot>",`</${s}>`),e.fezHtmlFunc=_(e.html)}e.css&&(e.css=t.globalCss(e.css,{name:r})),t.classes[r]=e,customElements.get(r)||customElements.define(r,class extends HTMLElement{connectedCallback(){Ge(this,e)?ie(r,this):requestAnimationFrame(()=>{ie(r,this)})}})}function Ge(r,e){let t=r.getAttribute("fez-fast");var s=typeof e.FAST=="function"?e.FAST(r):e.FAST;return t||s||r.childNodes[0]||r.nextSibling?!0:(t=="false",!1)}function oe(r){let e=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);return r.replace(/<([a-z-]+)\b([^>]*)\/>/g,(t,s,n)=>e.has(s)?t:`<${s}${n}></${s}>`)}function ie(r,e){let t=Fez.classes[r],s=e.parentNode;if(e.isConnected){let n=typeof t.nodeName=="function"?t.nodeName(e):t.nodeName,i=document.createElement(n||"div");i.classList.add("fez"),i.classList.add(`fez-${r}`),s.replaceChild(i,e);let o=new t;if(o.UID=++Fez.instanceCount,Fez.instances.set(o.UID,o),o.oldRoot=e,o.fezName=r,o.root=i,o.props=t.getProps(e,i),o.class=t,o.slot(e,i),i.fez=o,t.GLOBAL&&t.GLOBAL!=!0&&(window[t.GLOBAL]=o),window.$&&(o.$root=$(i)),o.props.id&&i.setAttribute("id",o.props.id),o.fezRegister(),(o.init||o.created||o.connect).bind(o)(o.props),o.render(),o.firstRender=!0,o.onMount(o.props),o.onSubmit){let f=o.root.nodeName=="FORM"?o.root:o.find("form");f.onsubmit=u=>{u.preventDefault(),o.onSubmit(o.formData())}}if(o.onPropsChange){qe.observe(i,{attributes:!0});for(let[f,u]of Object.entries(o.props))o.onPropsChange(f,u)}}}var We=r=>{let e={script:"",style:"",html:"",head:""},t=r.split(`
35
- `),s=[],n="";for(var i of t)i=i.trim(),i.startsWith("<script")&&!e.script&&n!="head"?n="script":i.startsWith("<head")&&!e.script?n="head":i.startsWith("<style")?n="style":i.endsWith("<\/script>")&&n==="script"&&!e.script?(e.script=s.join(`
36
- `),s=[],n=null):i.endsWith("</style>")&&n==="style"?(e.style=s.join(`
37
- `),s=[],n=null):(i.endsWith("</head>")||i.endsWith("</header>"))&&n==="head"?(e.head=s.join(`
38
- `),s=[],n=null):n?s.push(i):e.html+=i+`
39
- `;if(e.head){let f=Fez.domRoot(e.head);Array.from(f.children).forEach(u=>{if(u.tagName==="SCRIPT"){let d=document.createElement("script");Array.from(u.attributes).forEach(y=>{d.setAttribute(y.name,y.value)}),d.type||="text/javascript",u.src?document.head.appendChild(d):(d.type.includes("javascript")||d.type=="module")&&(d.textContent=u.textContent,document.head.appendChild(d))}else document.head.appendChild(u.cloneNode(!0))})}let o=e.script;return/class\s+\{/.test(o)||(o=`class {
138
+ `,f.addEventListener("click",a=>{a.stopPropagation(),Fez.log(r)}),i.appendChild(f),document.body.appendChild(i)}})};document.addEventListener("keydown",e=>{(e.ctrlKey||e.metaKey)&&e.key==="e"&&(e.target.closest("form")||(e.preventDefault(),ge()))});var be=ge;var Ye=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]),et=new MutationObserver(e=>{for(let t of e)if(t.type==="attributes"){let n=t.target.fez;if(n){let r=t.attributeName,s=t.target.getAttribute(r);n.props[r]=s,n.onPropsChange(r,s)}}});function U(e,t){let n=globalThis.window?.Fez||globalThis.Fez;if(!e.includes("-")){console.error(`Fez: Invalid name "${e}". Must contain a dash.`);return}t=tt(n,e,t),t.html&&(t.html=t.html.replace(/<slot(\s[^>]*)?>/,'<div class="fez-slot" fez-keep="default-slot"$1>').replace("</slot>","</div>"),t.fezHtmlFunc=L(t.html,{name:e})),t.css&&(t.css=n.globalCss(t.css,{name:e})),n.index.ensure(e).class=t,customElements.get(e)||customElements.define(e,class extends HTMLElement{connectedCallback(){nt(this,t)?ze(e,this):requestAnimationFrame(()=>ze(e,this))}})}function tt(e,t,n){if(n.prototype instanceof C)return n.html&&(n.html=ye(n.html)),n;let r=new n,s=class extends C{},o=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertyNames(n.prototype)].filter(l=>l!=="constructor"&&l!=="prototype");for(let l of o)s.prototype[l]=r[l];let i={FAST:"FAST",GLOBAL:"GLOBAL",NAME:"nodeName"};for(let[l,c]of Object.entries(i))r[l]&&(s[c]=r[l]);if(r.CSS&&(s.css=typeof r.CSS=="function"?r.CSS():r.CSS),r.HTML){let l=typeof r.HTML=="function"?r.HTML():r.HTML;s.html=ye(l)}return r.META&&(s.META=r.META,e.index.ensure(t).meta=r.META),r.GLOBAL&&e.onReady(()=>document.body.appendChild(document.createElement(t))),e.consoleLog(`${t} compiled`),s}function ye(e){return e.replace(/<([a-z][a-z-]*)\b((?:=>|[^>])*)>/g,(t,n,r)=>!r.trimEnd().endsWith("/")||Ye.has(n)?t:`<${n}${r.replace(/\s*\/$/,"")}></${n}>`)}function nt(e,t){let n=e.getAttribute("fez-fast");if(n==="false")return!1;let r=typeof t.FAST=="function"?t.FAST(e):t.FAST;return!!(n||r||e.childNodes[0]||e.nextSibling)}function ze(e,t){if(!t.isConnected||t.classList?.contains("fez"))return;let n=Fez.index[e]?.class,r=typeof n.nodeName=="function"?n.nodeName(t):n.nodeName,s=document.createElement(r||"div");if(s.classList.add("fez",`fez-${e}`),!t.parentNode){console.warn(`Fez: ${e} has no parent, skipping`);return}t.parentNode.replaceChild(s,t);let o=new n;o.UID=++Fez.instanceCount,Fez.instances.set(o.UID,o),o.oldRoot=t,o.fezName=e,o.root=s,o.props=n.getProps(t,s),o.class=n,o.fezSlot(t,s),s.fez=o,n.GLOBAL&&n.GLOBAL!==!0&&(window[n.GLOBAL]||=o),window.$&&(o.$root=$(s)),o.props.id&&s.setAttribute("id",o.props.id);let i=t.getAttribute("fez-keep");if(i&&s.setAttribute("fez-keep",i),o.fezRegister(),o.root.childNodes.length&&(o._fezSlotNodes=Array.from(o.root.childNodes),o._fezChildNodes=o._fezSlotNodes.filter(c=>c.nodeType===1)),o._isInitializing=!0,(o.onInit||o.init||o.created||o.connect).call(o,o.props),o.fezRender(),o._isInitializing=!1,o.onMount(o.props),o.onSubmit){let c=o.root.nodeName==="FORM"?o.root:o.find("form");c&&(c.onsubmit=d=>{d.preventDefault(),o.onSubmit(o.formData())})}if(o.onPropsChange){et.observe(s,{attributes:!0});for(let[c,d]of Object.entries(o.props))o.onPropsChange(c,d)}}function we(e){let t=e.split(`
139
+ `),n=t.filter(s=>s.trim());if(!n.length)return e;let r=Math.min(...n.map(s=>s.match(/^(\s*)/)[1].length));return r===0?e:t.map(s=>s.slice(r)).join(`
140
+ `)}function st(e){if(!e)return!1;let t=e.replace(/<demo>[\s\S]*?<\/demo>/gi,"");return/<(xmp|template)\s+fez\s*=/i.test(t)}function _(e,t){if(arguments.length===1)return Z(e);if(st(t)){if(e){let r=K(t);r.info?.trim()&&(Fez.index.ensure(e).info=r.info),r.demo?.trim()&&(Fez.index.ensure(e).demo=r.demo)}return Z(t)}if(e&&!e.includes("-")&&!e.includes(".")&&!e.includes("/")){console.error(`Fez: Invalid name "${e}". Must contain a dash (e.g., 'my-element').`);return}Fez.index.ensure(e).source=t;let n=it(e,K(t));ct(e),lt(e,n)}function Z(e){if(e instanceof Node){let n=e;n.remove();let r=n.getAttribute("fez");if(r?.includes(".")||r?.includes("/"))return rt(r);if(r&&!r.includes("-")){console.error(`Fez: Invalid name "${r}". Must contain a dash.`);return}return _(r,n.innerHTML)}(e?Fez.domRoot(e):document.body).querySelectorAll("template[fez], xmp[fez]").forEach(n=>Z(n))}function rt(e){if(Fez.consoleLog(`Loading from ${e}`),e.endsWith(".txt")){Fez.head({fez:e});return}Fez.fetch(e).then(t=>{let r=new DOMParser().parseFromString(t,"text/html").querySelectorAll("template[fez], xmp[fez]");if(r.length>0){let s=e.split("/").pop().split(".")[0],o=K(t);o.info?.trim()&&(Fez.index.ensure(s).info=o.info),o.demo?.trim()&&(Fez.index.ensure(s).demo=o.demo),r.forEach(i=>{let l=i.getAttribute("fez");if(l&&!l.includes("-")&&!l.includes(".")&&!l.includes("/")){console.error(`Fez: Invalid name "${l}". Must contain a dash.`);return}_(l,i.innerHTML)})}else{let s=e.split("/").pop().split(".")[0];_(s,t)}}).catch(t=>{Fez.onError("compile",`Load error for "${e}": ${t.message}`)})}function K(e){let t={script:"",style:"",html:"",head:"",demo:"",info:""},n=e.split(`
141
+ `),r=[],s="";for(let o of n){let i=o.trim();i.startsWith("<demo")&&!t.demo&&!s?s="demo":i.startsWith("<info")&&!t.info&&!s?s="info":i.startsWith("<script")&&!t.script&&s!=="head"&&s!=="demo"&&s!=="info"?s="script":i.startsWith("<head")&&!t.script&&s!=="demo"&&s!=="info"?s="head":i.startsWith("<style")&&s!=="demo"&&s!=="info"?s="style":i.endsWith("</demo>")&&s==="demo"?(t.demo=we(r.join(`
142
+ `)),r=[],s=""):i.endsWith("</info>")&&s==="info"?(t.info=we(r.join(`
143
+ `)),r=[],s=""):i.endsWith("<\/script>")&&s==="script"&&!t.script?(t.script=r.join(`
144
+ `),r=[],s=""):i.endsWith("</style>")&&s==="style"?(t.style=r.join(`
145
+ `),r=[],s=""):(i.endsWith("</head>")||i.endsWith("</header>"))&&s==="head"?(t.head=r.join(`
146
+ `),r=[],s=""):s?r.push(s==="demo"||s==="info"?o:i):t.html+=i+`
147
+ `}return t.head&&ot(t.head),t}function ot(e){let t=Fez.domRoot(e);Array.from(t.children).forEach(n=>{if(n.tagName==="SCRIPT"){let r=document.createElement("script");Array.from(n.attributes).forEach(s=>{r.setAttribute(s.name,s.value)}),r.type||="text/javascript",n.src?document.head.appendChild(r):(r.type.includes("javascript")||r.type==="module")&&(r.textContent=n.textContent,document.head.appendChild(r))}else document.head.appendChild(n.cloneNode(!0))})}function it(e,t){let n=t.script;if(/class\s+\{/.test(n)||(n=`class {
148
+ ${n}
149
+ }`),String(t.style).includes(":")){let o=Fez.cssMixin(t.style);o=o.includes(":fez")||/(?:^|\s)body\s*\{/.test(o)?o:`:fez {
40
150
  ${o}
41
- }`),String(e.style).includes(":")&&(e.style=Fez.cssMixin(e.style),e.style=e.style.includes(":fez")||/(?:^|\s)body\s*\{/.test(e.style)?e.style:`:fez {
42
- ${e.style}
43
- }`,o=o.replace(/\}\s*$/,`
44
- CSS = \`${e.style}\`
45
- }`)),/\w/.test(String(e.html))&&(e.html=e.html.replaceAll("`","&#x60;"),e.html=e.html.replaceAll("$","\\$"),o=o.replace(/\}\s*$/,`
46
- HTML = \`${e.html}\`
47
- }`)),o};function G(r){if(r instanceof Node){let e=r;e.remove();let t=e.getAttribute("fez");if(t&&(t.includes(".")||t.includes("/"))){Ve(t);return}else{t&&!t.includes("-")&&console.error(`Fez: Invalid custom element name "${t}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`),R(t,e.innerHTML);return}}else{(r?Fez.domRoot(r):document.body).querySelectorAll("template[fez], xmp[fez]").forEach(t=>{G(t)});return}}function Ve(r){Fez.log(`Loading from ${r}`),Fez.fetch(r).then(e=>{let n=new DOMParser().parseFromString(e,"text/html").querySelectorAll("template[fez], xmp[fez]");if(n.length>0)n.forEach(i=>{let o=i.getAttribute("fez");o&&!o.includes("-")&&!o.includes(".")&&!o.includes("/")&&console.error(`Fez: Invalid custom element name "${o}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`);let f=i.innerHTML;R(o,f)});else{let i=r.split("/").pop().split(".")[0];R(i,e)}}).catch(e=>{console.error(`FEZ template load error for "${r}": ${e.message}`)})}function R(r,e){if(arguments.length===1)return G(r);if(e&&e.includes("</xmp>"))return G(e);r&&!r.includes("-")&&!r.includes(".")&&!r.includes("/")&&console.error(`Fez: Invalid custom element name "${r}". Custom element names must contain a dash (e.g., 'my-element', 'ui-button').`);let t=We(e),s=t.split(/class\s+\{/,2);if(t=`${s[0]};
151
+ }`,n=n.replace(/\}\s*$/,`
152
+ CSS = \`${o}\`
153
+ }`)}if(/\w/.test(String(t.html))){let o=t.html.replaceAll("`","&#x60;").replaceAll("$","\\$");n=n.replace(/\}\s*$/,`
154
+ HTML = \`${o}\`
155
+ }`)}t.demo?.trim()&&(Fez.index.ensure(e).demo=t.demo),t.info?.trim()&&(Fez.index.ensure(e).info=t.info);let[r,s]=n.split(/class\s+\{/,2);return`${r};
48
156
 
49
- window.Fez('${r}', class {
50
- ${s[1]})`,r){let n=document.getElementById("fez-hidden-styles");n||(n=document.createElement("style"),n.id="fez-hidden-styles",document.head.appendChild(n));let i=[...Object.keys(Fez.classes),r].sort().join(", ");n.textContent=`${i} { display: none; }
51
- `}if(t.includes("import "))Fez.head({script:t}),setTimeout(()=>{Fez.classes[r]||Fez.error(`Template "${r}" possible compile error. (can be a false positive, it imports are not loaded)`)},2e3);else try{new Function(t)()}catch(n){Fez.error(`Template "${r}" compile error: ${n.message}`),console.log(t)}}var le=R;var Ue={data:{},listeners:new Map,subscribers:new Map,globalSubscribers:new Set,notify(r,e,t){Fez.log(`Global state change for ${r}: ${e} (from ${t})`);let s=this.listeners.get(r);s&&s.forEach(i=>{i.isConnected?(i.onGlobalStateChange(r,e,t),i.render()):s.delete(i)});let n=this.subscribers.get(r);n&&n.forEach(i=>{try{i(e,t,r)}catch(o){console.error(`Error in subscriber for key ${r}:`,o)}}),this.globalSubscribers.forEach(i=>{try{i(r,e,t)}catch(o){console.error("Error in global subscriber:",o)}})},createProxy(r){return new Proxy({},{get:(e,t)=>(r._globalStateKeys||=new Set,r._globalStateKeys.has(t)||(r._globalStateKeys.add(t),this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r)),this.data[t]),set:(e,t,s)=>{let n=this.data[t];return n!==s&&(this.data[t]=s,this.notify(t,s,n)),!0}})},set(r,e){let t=this.data[r];t!==e&&(this.data[r]=e,this.notify(r,e,t))},get(r){return this.data[r]},forEach(r,e){let t=this.listeners.get(r);t&&t.forEach(s=>{s.isConnected?e(s):t.delete(s)})},subscribe(r,e){if(typeof r=="function")return this.globalSubscribers.add(r),()=>this.globalSubscribers.delete(r);{let t=r;return this.subscribers.has(t)||this.subscribers.set(t,new Set),this.subscribers.get(t).add(e),()=>{let s=this.subscribers.get(t);s&&(s.delete(e),s.size===0&&this.subscribers.delete(t))}}}},ce=Ue;var ae=r=>{r.head=(e,t)=>{if(e.nodeName){e.nodeName=="SCRIPT"?(r.head({script:e.innerText}),e.remove()):(e.querySelectorAll("script").forEach(u=>r.head(u)),e.querySelectorAll("template[fez], xmp[fez], script[fez]").forEach(u=>r.compile(u)));return}if(typeof e!="object"||e===null)throw new Error("head requires an object parameter");let s,n={},i;if(e.script){if(e.script.includes("import ")){t&&r.error("Fez.head callback is not supported when script with import is passed (module context).");let u=document.createElement("script");u.type="module",u.textContent=e.script,document.head.appendChild(u),requestAnimationFrame(()=>u.remove())}else try{new Function(e.script)(),t&&t()}catch(u){r.error("Error executing script:",u),console.log(e.script)}return}else if(e.js){s=e.js,i="script";for(let[u,d]of Object.entries(e))u!=="js"&&u!=="module"&&(n[u]=d);e.module&&(n.type="module")}else if(e.css){s=e.css,i="link",n.rel="stylesheet";for(let[u,d]of Object.entries(e))u!=="css"&&(n[u]=d)}else throw new Error('head requires either "script", "js" or "css" property');let o=document.querySelector(`${i}[src="${s}"], ${i}[href="${s}"]`);if(o)return t&&t(),o;let f=document.createElement(i);i==="link"?f.href=s:f.src=s;for(let[u,d]of Object.entries(n))f.setAttribute(u,d);return(t||e.module)&&(f.onload=()=>{e.module&&i==="script"&&import(s).then(u=>{window[e.module]=u.default||u[e.module]||u}).catch(u=>{console.error(`Error importing module ${e.module}:`,u)}),t&&t()}),document.head.appendChild(f),f},r.fetch=function(...e){r._fetchCache||={};let t="GET",s,n;typeof e[0]=="string"&&/^[A-Z]+$/.test(e[0])&&(t=e.shift()),s=e.shift();let i={},o=null;if(typeof e[0]=="object"&&(o=e.shift()),typeof e[0]=="function"&&(n=e.shift()),o){if(t==="GET"){let d=new URLSearchParams(o);s+=(s.includes("?")?"&":"?")+d.toString()}else if(t==="POST"){let d=new FormData;for(let[y,S]of Object.entries(o))d.append(y,S);i.body=d}}i.method=t;let f=`${t}:${s}:${JSON.stringify(i)}`;if(r._fetchCache[f]){let d=r._fetchCache[f];if(r.log(`fetch cache hit: ${t} ${s}`),n){n(d);return}return Promise.resolve(d)}r.log(`fetch live: ${t} ${s}`);let u=d=>d.headers.get("content-type")?.includes("application/json")?d.json():d.text();if(n){fetch(s,i).then(u).then(d=>{r._fetchCache[f]=d,n(d)}).catch(d=>r.onError("fetch",d));return}return fetch(s,i).then(u).then(d=>(r._fetchCache[f]=d,d))},r.darkenColor=(e,t=20)=>{let s=parseInt(e.replace("#",""),16),n=Math.round(2.55*t),i=(s>>16)-n,o=(s>>8&255)-n,f=(s&255)-n;return"#"+(16777216+(i<255?i<1?0:i:255)*65536+(o<255?o<1?0:o:255)*256+(f<255?f<1?0:f:255)).toString(16).slice(1)},r.lightenColor=(e,t=20)=>{let s=parseInt(e.replace("#",""),16),n=Math.round(2.55*t),i=(s>>16)+n,o=(s>>8&255)+n,f=(s&255)+n;return"#"+(16777216+(i<255?i<1?0:i:255)*65536+(o<255?o<1?0:o:255)*256+(f<255?f<1?0:f:255)).toString(16).slice(1)},r.htmlEscape=e=>typeof e=="string"?(e=e.replace(/font-family\s*:\s*(?:&[^;]+;|[^;])*?;/gi,"").replaceAll("&","&amp;").replaceAll("'","&apos;").replaceAll('"',"&quot;").replaceAll("<","&lt;").replaceAll(">","&gt;"),e):e===void 0?"":e,r.domRoot=(e,t="div")=>{if(e instanceof Node)return e;{let s=document.createElement(t);return s.innerHTML=e,s}},r.activateNode=(e,t="active")=>{Array.from(e.parentElement.children).forEach(s=>{s.classList.remove(t)}),e.classList.add(t)},r.isTrue=e=>["1","true","on"].includes(String(e).toLowerCase()),r.getFunction=e=>{if(e){if(typeof e=="function")return e;if(typeof e=="string"){let t=/^\s*\(?\s*\w+(\s*,\s*\w+)*\s*\)?\s*=>/,s=/^\s*function\s*\(/;return t.test(e)||s.test(e)?new Function("return "+e)():e.includes(".")&&!e.includes("(")?new Function(`return function() { return ${e}(); }`):new Function(e)}}else return()=>{}},r.onReady=e=>{document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{e()},{once:!0}):e()},r.fnv1=e=>{var t,s,n,i,o,f;for(t=2166136261,s=16777619,n=t,i=o=0,f=e.length-1;0<=f?o<=f:o>=f;i=0<=f?++o:--o)n^=e.charCodeAt(i),n*=s;return n.toString(36).replaceAll("-","")},r.tag=(e,t={},s="")=>{let n=encodeURIComponent(JSON.stringify(t));return`<${e} data-props="${n}">${s}</${e}>`},r.untilTrue=(e,t)=>{t||=200,e()||setTimeout(()=>{r.untilTrue(e,t)},t)},r.throttle=(e,t=200)=>{let s=0,n;return function(...i){let o=Date.now();o-s>=t?(e.apply(this,i),s=o):(clearTimeout(n),n=setTimeout(()=>{e.apply(this,i),s=Date.now()},t-(o-s)))}}};var fe={},ue=r=>{r.cssMixin=(e,t)=>{if(t)fe[e]=t;else return Object.entries(fe).forEach(([s,n])=>{e=e.replaceAll(`:${s} `,`${n} `),e=e.replaceAll(`@include ${s} `,`${n} `)}),e},r.cssMixin("mobile","@media (max-width: 767px)"),r.cssMixin("tablet","@media (min-width: 768px) and (max-width: 1023px)"),r.cssMixin("desktop","@media (min-width: 1200px)")};var b=(r,e)=>{if(typeof r=="number"){let t=b.instances.get(r);if(t)return t;b.error(`Instance with UID "${r}" not found.`)}else if(r)if(e)if(typeof e=="function"&&!/^\s*class/.test(e.toString())&&!/\b(this|new)\b/.test(e.toString())){let s=Array.from(document.querySelectorAll(`.fez.fez-${r}`)).filter(n=>n.fez);return s.forEach(n=>e(n.fez)),s}else return typeof e!="function"?b.find(r,e):q(r,e);else{let t=r.nodeName?r.closest(".fez"):document.querySelector(r.includes("#")?r:`.fez.fez-${r}`);if(t){if(t.fez)return t.fez;b.error(`node "${r}" has no Fez attached.`)}else b.error(`node "${r}" not found.`)}else b.error("Fez() ?")};b.classes={};b.instanceCount=0;b.instances=new Map;b.find=(r,e)=>{let t=r;typeof t=="string"&&(t=document.body.querySelector(t)),typeof t.val=="function"&&(t=t[0]);let s=e?`.fez.fez-${e}`:".fez",n=t.closest(s);if(n&&n.fez)return n.fez;console.error("Fez node connector not found",r,t)};b.cssClass=r=>ee.css(r);b.globalCss=(r,e={})=>{if(typeof r=="function"&&(r=r()),r.includes(":")){let t=r.split(`
52
- `).filter(s=>!/^\s*\/\//.test(s)).join(`
53
- `);e.wrap&&(t=`:fez { ${t} }`),t=t.replace(/\:fez|\:host/,`.fez.fez-${e.name}`),r=b.cssClass(t)}return b.onReady(()=>{document.body.parentElement.classList.add(r)}),r};b.info=()=>{console.log("Fez components:",Object.keys(b.classes||{}))};b.morphdom=(r,e,t={})=>{Array.from(r.attributes).forEach(n=>{e.setAttribute(n.name,n.value)}),te.morph(r,e,{morphStyle:"outerHTML"});let s=r.nextSibling;s?.nodeType===Node.TEXT_NODE&&s.textContent.trim()===""&&s.remove()};b._globalSubs||=new Map;b.publish=(r,...e)=>{b._subs||={},b._subs[r]||=[],b._subs[r].forEach(s=>{s[1].bind(s[0])(...e)});let t=b._globalSubs.get(r);t&&t.forEach(s=>{s.node.isConnected?s.callback.call(s.node,...e):t.delete(s)})};b.subscribe=(r,e,t)=>{typeof e=="function"&&(t=e,e=r,r=document.body),typeof r=="string"&&(r=document.querySelector(r)),b._globalSubs.has(e)||b._globalSubs.set(e,new Set);let s=b._globalSubs.get(e);s.forEach(i=>{i.node===r&&i.callback===t&&s.delete(i)});let n={node:r,callback:t};return s.add(n),()=>{s.delete(n)}};b.error=(r,e)=>{if(r=`Fez: ${r}`,console.error(r),e)return`<span style="border: 1px solid red; font-size: 14px; padding: 3px 7px; background: #fee; border-radius: 4px;">${r}</span>`};b.log=r=>{b.LOG===!0&&(r=String(r).substring(0,180),console.log(`Fez: ${r}`))};b.onError=(r,e)=>{if(typeof r!="string")throw new Error("Fez.onError: kind must be a string");console.error(`${r}: ${e.toString()}`)};b.store={store:new Map,counter:0,set(r){let e=this.counter++;return this.store.set(e,r),e},get(r){return this.store.get(r)},delete(r){let e=this.store.get(r);return this.store.delete(r),e}};ae(b);ue(b);b.compile=le;b.state=ce;b.dump=re;b.highlightAll=ne;b.onReady(()=>{b.log("Fez.LOG === true, logging enabled.")});var C=b;typeof window<"u"&&(window.FezBase=x);typeof window<"u"&&(window.Fez=C);Promise.resolve().then(()=>he());setInterval(()=>{for(let[r,e]of C.instances)e?.isConnected||(e.fez?.fezOnDestroy(),C.instances.delete(r))},5e3);var Xe=new MutationObserver(r=>{for(let{addedNodes:e,removedNodes:t}of r)e.forEach(s=>{s.nodeType===1&&(s.matches("template[fez], xmp[fez], script[fez]")&&(C.compile(s),s.remove()),s.querySelectorAll&&s.querySelectorAll("template[fez], xmp[fez], script[fez]").forEach(i=>{C.compile(i),i.remove()}))}),t.forEach(s=>{s.nodeType===1&&s.querySelectorAll&&s.querySelectorAll(".fez, :scope.fez").forEach(i=>{i.fez&&i.root&&(C.instances.delete(i.fez.UID),i.fez.fezOnDestroy())})})});Xe.observe(document.documentElement,{childList:!0,subtree:!0});var Ot=C;})();
157
+ window.Fez('${e}', class {
158
+ ${s})`}function lt(e,t){if(t.includes("import ")){let n=/Fez\.head\(\s*\{\s*importmap\s*:\s*(\{[\s\S]*?\})\s*\}\s*\)\s*;?/g,r;for(;(r=n.exec(t))!==null;)try{let s=new Function(`return ${r[1]}`)(),o=Object.entries(s).sort((i,l)=>l[0].length-i[0].length);for(let[i,l]of o){let c=i.replace(/[.*+?^${}()|[\]\\\/]/g,"\\$&");t=t.replace(new RegExp(`(from\\s+['"])${c}`,"g"),`$1${l}`)}}catch(s){Fez.consoleError(`importmap parse error: ${s.message}`)}t=t.replace(n,""),Fez.head({script:t}),setTimeout(()=>{Fez.index[e]?.class||Fez.consoleError(`Template "${e}" possible compile error.`)},2e3)}else try{new Function(t)()}catch(n){Fez.consoleError(`Template "${e}" compile error: ${n.message}`),console.log(t)}}function ct(e){if(!e)return;let t=document.getElementById("fez-hidden-styles");t||(t=document.createElement("style"),t.id="fez-hidden-styles",document.head.appendChild(t));let n=[...Fez.index.names(),e].sort().join(", ");t.textContent=`${n} { display: none; }
159
+ `}var at={data:{},listeners:new Map,subscribers:new Map,globalSubscribers:new Set,notify(e,t,n){Fez.consoleLog(`Global state change for ${e}: ${t} (from ${n})`);let r=this.listeners.get(e);r&&r.forEach(o=>{if(o.isConnected)try{o.onGlobalStateChange(e,t,n),o.fezRender()}catch(i){console.error(`Error in component listener for key ${e}:`,i)}else r.delete(o)});let s=this.subscribers.get(e);s&&s.forEach(o=>{try{o(t,n,e)}catch(i){console.error(`Error in subscriber for key ${e}:`,i)}}),this.globalSubscribers.forEach(o=>{try{o(e,t,n)}catch(i){console.error("Error in global subscriber:",i)}})},createProxy(e){return e.addOnDestroy(()=>{for(let[t,n]of this.listeners)n.delete(e);e._globalStateKeys?.clear()}),new Proxy({},{get:(t,n)=>{if(typeof n!="symbol")return e._globalStateKeys||=new Set,e._globalStateKeys.has(n)||(e._globalStateKeys.add(n),this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e)),this.data[n]},set:(t,n,r)=>{if(typeof n=="symbol")return!0;let s=this.data[n];return s!==r&&(this.data[n]=r,this.notify(n,r,s)),!0}})},set(e,t){let n=this.data[e];n!==t&&(this.data[e]=t,this.notify(e,t,n))},get(e){return this.data[e]},forEach(e,t){let n=this.listeners.get(e);n&&n.forEach(r=>{r.isConnected?t(r):n.delete(r)})},subscribe(e,t){if(typeof e=="function")return this.globalSubscribers.add(e),()=>this.globalSubscribers.delete(e);{let n=e;return this.subscribers.has(n)||this.subscribers.set(n,new Set),this.subscribers.get(n).add(t),()=>{let r=this.subscribers.get(n);r&&(r.delete(t),r.size===0&&this.subscribers.delete(n))}}}},Ee=at;var R=()=>globalThis.localStorage||window.localStorage;function ft(e,t){try{R().setItem(e,JSON.stringify(t))}catch(n){console.error(`Fez localStorage: Failed to set "${e}"`,n)}}function dt(e,t=null){try{let n=R().getItem(e);return n===null?t:JSON.parse(n)}catch(n){return console.error(`Fez localStorage: Failed to get "${e}"`,n),t}}function ut(e){R().removeItem(e)}function pt(){R().clear()}var $e={set:ft,get:dt,remove:ut,clear:pt};function V(e,t,n){e._awaitStates||=new Map;let r=e._awaitStates.get(t);if(!n||typeof n.then!="function")return{status:"resolved",value:n,error:null};if(r&&r.promise===n)return r;let s={status:"pending",value:null,error:null,promise:n};return e._awaitStates.set(t,s),n.then(o=>{let i=e._awaitStates.get(t);i&&i.promise===n&&(i.status="resolved",i.value=o,e.isConnected&&e.fezNextTick(e.fezRender,"fezRender"))}).catch(o=>{let i=e._awaitStates.get(t);i&&i.promise===n&&(i.status="rejected",i.error=o,e.isConnected&&e.fezNextTick(e.fezRender,"fezRender"))}),s}function ve(e){let t=document.createElement("div");return t.innerHTML=e,t}var ht={ensure(e){return(!this[e]||typeof this[e]!="object"||!("class"in this[e]))&&(this[e]={class:null,meta:null,demo:null,info:null,source:null}),this[e]},get(e){let t=this[e];return!t||typeof t!="object"||!("class"in t)?{class:null,meta:null,demo:null,info:null,source:null}:{class:t.class,meta:t.meta,source:t.source,demo:t.demo?ve(t.demo):null,info:t.info?ve(t.info):null}},apply(e,t){let n=this[e];if(!n?.demo||!t)return!1;let r=document.createElement("div");return r.innerHTML=n.demo,r.querySelectorAll(":scope > script").forEach(s=>{let o=s.textContent;if(o.trim())try{new Function(o)()}catch(i){console.error(`Fez.index.apply("${e}") script error:`,i.message)}s.remove()}),t.innerHTML=r.innerHTML,!0},names(){return Object.keys(this).filter(e=>typeof this[e]=="object"&&this[e]!==null&&"class"in this[e])},withDemo(){return this.names().filter(e=>this[e].demo)},all(){let e={};for(let t of this.names())e[t]=this.get(t);return e},info(){console.log("Fez components:",this.names())}},xe=ht;var Ce=e=>{e.head=(s,o)=>{if(s.nodeName){s.nodeName=="SCRIPT"?(e.head({script:s.innerText}),s.remove()):(s.querySelectorAll("script").forEach(a=>e.head(a)),s.querySelectorAll("template[fez], xmp[fez], script[fez]").forEach(a=>e.compile(a)));return}if(typeof s!="object"||s===null)throw new Error("head requires an object parameter");let i,l={},c;if(s.fez){let a=s.fez;if(a.endsWith(".txt")){e.fetch(a).then(p=>{let m=a.substring(0,a.lastIndexOf("/")+1),y=p.split(`
160
+ `).map(u=>u.trim()).filter(u=>u&&!u.startsWith("#")),b=0,z=y.length;y.forEach(u=>{let h;if(u.startsWith("/"))h=u;else{let w=u.endsWith(".fez")?u:u+".fez";h=m+w}let E=h.split("/").pop().split(".")[0];e.fetch(h).then(w=>{e.compile(E,w),b++,b===z&&o&&o()})})});return}e.fetch(a).then(p=>{let m=a.split("/").pop().split(".")[0];e.compile(m,p),o&&o()});return}if(s.script){if(s.script.includes("import ")){o&&e.consoleError("Fez.head callback is not supported when script with import is passed (module context).");let a=document.createElement("script");a.type="module",a.textContent=s.script,document.head.appendChild(a),requestAnimationFrame(()=>a.remove())}else try{new Function(s.script)(),o&&o()}catch(a){e.consoleError("Error executing script:",a),console.log(s.script)}return}else if(s.js){i=s.js,c="script";for(let[a,p]of Object.entries(s))a!=="js"&&a!=="module"&&(l[a]=p);s.module&&(l.type="module")}else if(s.css){i=s.css,c="link",l.rel="stylesheet";for(let[a,p]of Object.entries(s))a!=="css"&&(l[a]=p)}else throw new Error('head requires either "script", "js" or "css" property');let d=document.querySelector(`${c}[src="${i}"], ${c}[href="${i}"]`);if(d)return o&&o(),d;let f=document.createElement(c);c==="link"?f.href=i:f.src=i;for(let[a,p]of Object.entries(l))f.setAttribute(a,p);return(o||s.module)&&(f.onload=()=>{s.module&&c==="script"&&import(i).then(a=>{window[s.module]=a.default||a[s.module]||a}).catch(a=>{console.error(`Error importing module ${s.module}:`,a)}),o&&o()}),document.head.appendChild(f),f};let t=5*60*1e3,n=100;e.fetch=function(...s){e._fetchCache||=new Map;let o="GET",i,l;typeof s[0]=="string"&&/^[A-Z]+$/.test(s[0])&&(o=s.shift()),i=s.shift();let c={},d=null;if(typeof s[0]=="object"&&(d=s.shift()),typeof s[0]=="function"&&(l=s.shift()),d){if(o==="GET"){let y=new URLSearchParams(d);i+=(i.includes("?")?"&":"?")+y.toString()}else if(o==="POST"){let y=new FormData;for(let[b,z]of Object.entries(d))y.append(b,z);c.body=y}}c.method=o;let f=`${o}:${i}:${JSON.stringify(c)}`,a=e._fetchCache.get(f);if(a&&Date.now()-a.timestamp<t){if(e.consoleLog(`fetch cache hit: ${o} ${i}`),l){l(a.data);return}return Promise.resolve(a.data)}e.consoleLog(`fetch live: ${o} ${i}`);let p=y=>y.headers.get("content-type")?.includes("application/json")?y.json():y.text(),m=(y,b)=>{if(e._fetchCache.size>=n){let z=e._fetchCache.keys().next().value;e._fetchCache.delete(z)}e._fetchCache.set(y,{data:b,timestamp:Date.now()})};if(l){fetch(i,c).then(p).then(y=>{m(f,y),l(y)}).catch(y=>e.onError("fetch",y));return}return fetch(i,c).then(p).then(y=>(m(f,y),y))},e.clearFetchCache=()=>{e._fetchCache?.clear()},e.darkenColor=(s,o=20)=>{let i=parseInt(s.replace("#",""),16),l=Math.round(2.55*o),c=(i>>16)-l,d=(i>>8&255)-l,f=(i&255)-l;return"#"+(16777216+(c<255?c<1?0:c:255)*65536+(d<255?d<1?0:d:255)*256+(f<255?f<1?0:f:255)).toString(16).slice(1)},e.lightenColor=(s,o=20)=>{let i=parseInt(s.replace("#",""),16),l=Math.round(2.55*o),c=(i>>16)+l,d=(i>>8&255)+l,f=(i&255)+l;return"#"+(16777216+(c<255?c<1?0:c:255)*65536+(d<255?d<1?0:d:255)*256+(f<255?f<1?0:f:255)).toString(16).slice(1)},e.htmlEscape=s=>typeof s=="string"?s.replace(/font-family\s*:\s*(?:&[^;]+;|[^;])*?;/gi,"").replaceAll("&","&amp;").replaceAll("'","&apos;").replaceAll('"',"&quot;").replaceAll("<","&lt;").replaceAll(">","&gt;"):s===void 0?"":s,e.domRoot=(s,o="div")=>{if(s instanceof Node)return s;{let i=document.createElement(o);return i.innerHTML=s,i}},e.activateNode=(s,o="active")=>{!s||!s.parentElement||(Array.from(s.parentElement.children).forEach(i=>{i.classList.remove(o)}),s.classList.add(o))},e.isTrue=s=>["1","true","on"].includes(String(s).toLowerCase()),e.UID=111,e.uid=()=>"fez_uid_"+(++e.UID).toString(32),e.POINTER_SEQ=0,e.POINTER={},e.pointer=(s,o={})=>{if(typeof s=="function"){let i=++e.POINTER_SEQ;return o.persist?e.POINTER[i]=s:e.POINTER[i]=(...l)=>{let c=s(...l);return delete e.POINTER[i],c},`Fez.POINTER[${i}]`}},e.clearPointers=()=>{e.POINTER={}},e.getFunction=s=>{if(s){if(typeof s=="function")return s;if(typeof s=="string"){let o=/^\s*\(?\s*\w+(\s*,\s*\w+)*\s*\)?\s*=>/,i=/^\s*function\s*\(/;return o.test(s)||i.test(s)?new Function("return "+s)():s.includes(".")&&!s.includes("(")?new Function(`return function() { return ${s}(); }`):new Function(s)}}else return()=>{}},e.onReady=s=>{document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{s()},{once:!0}):s()},e.fnv1=s=>{let o=2166136261,i=16777619,l=o;for(let c=0;c<s.length;c++)l^=s.charCodeAt(c),l*=i;return l.toString(36).replaceAll("-","")},e.tag=(s,o={},i="")=>{let l=encodeURIComponent(JSON.stringify(o));return`<${s} data-props="${l}">${i}</${s}>`},e.untilTrue=(s,o)=>{o||=200,s()||setTimeout(()=>{e.untilTrue(s,o)},o)};let r=200;e.throttle=(s,o=r)=>{let i=0,l;return function(...c){let d=Date.now();d-i>=o?(s.apply(this,c),i=d):(clearTimeout(l),l=setTimeout(()=>{s.apply(this,c),i=Date.now()},o-(d-i)))}},e.isTruthy=s=>Array.isArray(s)?s.length>0:s&&typeof s=="object"?Object.keys(s).length>0:!!s,e.toPairs=s=>Array.isArray(s)?s.map((o,i)=>[o,i]):s&&typeof s=="object"?Object.entries(s):[],e.typeof=s=>{if(s==null)return"u";if(Array.isArray(s))return"a";let o=typeof s;return o==="function"?"f":o==="string"?"s":o==="number"?Number.isInteger(s)?"i":"n":o==="object"?"o":o[0]}};var Se={},Ae=e=>{e.cssMixin=(t,n)=>{if(n)Se[t]=n;else return Object.entries(Se).forEach(([r,s])=>{t=t.replaceAll(`:${r} `,`${s} `),t=t.replaceAll(`@include ${r} `,`${s} `)}),t},e.cssMixin("mobile","@media (max-width: 767px)"),e.cssMixin("tablet","@media (min-width: 768px) and (max-width: 1023px)"),e.cssMixin("desktop","@media (min-width: 1200px)")};var g=(e,t)=>{if(typeof e=="number"){let r=g.instances.get(e);if(r)return r;g.onError("lookup",`Instance with UID "${e}" not found. Component may have been destroyed or never created.`,{uid:e});return}if(!e){g.onError("lookup","Fez() called without arguments. Expected component name, UID, or DOM node.");return}if(t){if(typeof t=="function"&&!/^\s*class/.test(t.toString())&&!/\b(this|new)\b/.test(t.toString())){let s=Array.from(document.querySelectorAll(`.fez.fez-${e}`)).filter(o=>o.fez);return s.forEach(o=>t(o.fez)),s}return typeof t!="function"?g.find(e,t):U(e,t)}let n=e.nodeName?e.closest(".fez"):document.querySelector(e.includes("#")?e:`.fez.fez-${e}`);if(!n){g.onError("lookup",`Component "${e}" not found in DOM. Ensure the component is defined and rendered.`,{componentName:e});return}if(!n.fez){g.onError("lookup",`DOM node "${e}" exists but has no Fez instance attached. Component may not be initialized yet.`,{node:n,tagName:e});return}return n.fez};g.index=xe;g.instanceCount=0;g.instances=new Map;g.find=(e,t)=>{let n=typeof e=="string"?document.body.querySelector(e):e;typeof n.val=="function"&&(n=n[0]);let r=t?`.fez.fez-${t}`:".fez",s=n.closest(r);if(s?.fez)return s.fez;g.onError("find",`Node connector not found. Selector: "${r}", node: ${e}`,{original:e,resolved:n,selector:r})};g.cssClass=e=>{try{return ue.css(e)}catch{let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return"fez-"+Math.abs(t).toString(36)}};g.globalCss=(e,t={})=>{if(typeof e=="function"&&(e=e()),e.includes(":")){let n=e.split(`
161
+ `).filter(r=>!/^\s*\/\//.test(r)).join(`
162
+ `);t.wrap&&(n=`:fez { ${n} }`),n=n.replace(/\:fez|\:host/,`.fez.fez-${t.name}`),e=g.cssClass(n)}return g.onReady(()=>document.body.parentElement.classList.add(e)),e};g.morphdom=(e,t)=>{pe(e,t,{skipNode:n=>n.classList?.contains("fez")&&n.fez&&!n.fez._destroyed?(g.LOG&&console.log(`Fez: preserved child component ${n.fez.fezName} (UID ${n.fez.UID})`),!0):!1,beforeRemove:n=>{n.classList?.contains("fez")&&n.fez&&n.fez.fezOnDestroy()}})};g.subscribe=re;g.publish=oe;g.localStorage=$e;g.fezAwait=V;g.consoleError=(e,t)=>{if(e=`Fez: ${e}`,console.error(e),t)return`<span style="border: 1px solid red; font-size: 14px; padding: 3px 7px; background: #fee; border-radius: 4px;">${e}</span>`};g.consoleLog=e=>{g.LOG&&console.log(`Fez: ${String(e).substring(0,180)}`)};g.onError=(e,t,n)=>{let r=n?.componentName||n?.name;if(!r&&typeof t=="string"){let l=t.match(/<([^>]+)>/);l&&(r=l[1])}let s=r?` [${r}]`:"",o=typeof t=="string"?t:t?.message||String(t),i=`Fez ${e}:${s} ${o}`;return n&&g.LOG?console.error(i,n):console.error(i),t instanceof Error&&t.stack&&g.LOG&&console.error(t.stack),i};Ce(g);Ae(g);g.compile=_;g.createTemplate=L;g.state=Ee;g.log=me;g.highlightAll=be;g.onReady(()=>g.consoleLog("Fez.LOG === true, logging enabled."));var I=g;typeof window<"u"&&(window.FezBase=C,window.Fez=I);Promise.resolve().then(()=>_e());var mt=new MutationObserver(e=>{for(let{addedNodes:t,removedNodes:n}of e)t.forEach(r=>{r.nodeType===1&&(r.matches?.("template[fez], xmp[fez], script[fez]")&&(I.compile(r),r.remove()),r.querySelectorAll?.("template[fez], xmp[fez], script[fez]").forEach(s=>{I.compile(s),s.remove()}))}),n.forEach(r=>{if(r.nodeType!==1)return;let s=o=>{o.fez&&!o.fez._destroyed&&queueMicrotask(()=>{!o.isConnected&&o.fez&&!o.fez._destroyed&&(I.instances.delete(o.fez.UID),o.fez.fezOnDestroy())})};s(r),r.querySelectorAll?.(".fez")?.forEach(s)})});mt.observe(document.documentElement,{childList:!0,subtree:!0});var un=I;})();
54
163
  //# sourceMappingURL=fez.js.map