jq79 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/jq79.js CHANGED
@@ -1,15 +1,15 @@
1
- var Yt=Object.defineProperty;var Qt=(e,t,n)=>t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var L=(e,t,n)=>Qt(e,typeof t!="symbol"?t+"":t,n);function ue(e,t){return typeof e=="string"?document.querySelector(e):e.querySelector(t)}function je(e,t){return Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t))}var Oe=(e,t={})=>{let n=document.createElement(e);for(let[s,r]of Object.entries(t))if(s==="className")n.className=Array.isArray(r)?r.join(" "):r;else if(s==="textContent")n.textContent=r;else if(s==="children")for(let o of r)n.appendChild(o);else n.setAttribute(s,r);return n},en=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),nt={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},tn=new Set(["http:","https:","mailto:"]);function nn(e){try{let t=new URL(e,"https://example.com");return tn.has(t.protocol)}catch{return!1}}var sn={"https:":"443","http:":"80"};function rn(e){let t=e.trim().toLowerCase().match(/^([a-z\d*][a-z\d.*-]*?)(?::(\d{1,5}|\*))?$/);if(!t)return null;let[,n,s]=t,r=n.split(".");return r.some(i=>i!=="*"&&!/^[a-z\d-]+$/.test(i))?null:{host:new RegExp(`^${r.map(i=>i==="*"?"[^.]+":i).join("\\.")}$`),port:!s||s==="*"?null:s}}var rt=e=>{let t=(Array.isArray(e)?e:e.split(",")).map(rn).filter(n=>n!==null);return n=>{let s=n.hostname.toLowerCase(),r=n.port||sn[n.protocol]||"";return t.some(o=>o.host.test(s)&&(o.port===null||o.port===r))}};function on(e,t,n,s){try{return!!e(new URL(t,document.baseURI),n,s)}catch{return!1}}var st=512;function ot(e,t,n,s){if(n>st)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${st} elements`);for(let r of Array.from(e.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let o=an(r,n,s);o&&t.appendChild(o)}else r.nodeType===Node.TEXT_NODE&&t.appendChild(r.cloneNode())}function an(e,t,n){let s=e.tagName.toLowerCase();if(!en.has(s))return null;let r=document.createElement(s);for(let o of Array.from(e.attributes)){let i=o.name.toLowerCase(),a=nt[s]?.has(i),d=nt["*"]?.has(i);!a&&!d||(i==="href"||i==="src")&&(!nn(o.value)||n&&!on(n,o.value,s,i))||r.setAttribute(i,o.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),ot(e,r,t+1,n),r}function it(e,t){let n=document.createElement("template");n.innerHTML=e;let s=document.createElement("div");return ot(n.content,s,0,t?.allowUrl),s.innerHTML}var ln=(e,t)=>t.split(".").reduce((n,s)=>n?.[s],e),ge=e=>{if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},dt=(e,t,n)=>{Object.entries(e).forEach(([s,r])=>{let o=t?`${t}.${s}`:s;r&&typeof r=="object"&&ge(r)?dt(r,o,n):n(o,r)})},at=" keys",Pe=e=>e?`${e}.${at}`:at,lt=(e,t)=>({children:null,own:null,deep:null,parent:e,segment:t}),cn=e=>!e.own?.size&&!e.deep?.size&&!e.children?.size,Le=Symbol("jq79.raw"),Z=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[Le];)t=t[Le];return t},ut=Symbol("jq79.store"),re=e=>e!==null&&typeof e=="object"&&e[ut]===!0,ne=[],fe=e=>{ne.push(new Set);try{return e()}finally{ne.pop()}},dn=0,ve=new Set,ct="$__attach",me=Symbol("jq79.alsoWakenBy"),ye=e=>{let t=new Map,n=new Set,s=new Set,r=new WeakMap,o=Object.create(null),i=lt(null,""),a=(c,l)=>{let f=i;return c.split(".").forEach(u=>{let y=f.children??(f.children=new Map),E=y.get(u);E||(E=lt(f,u),y.set(u,E)),f=E}),(l.deep?f.deep??(f.deep=new Set):f.own??(f.own=new Set)).add(l),f},d=(c,l)=>{(l.deep?c.deep:c.own)?.delete(l);let f=c;for(;f?.parent&&cn(f);)f.parent.children.delete(f.segment),f=f.parent},g=c=>{let l=i;for(let f of c.split("."))if(l=l.children?.get(f),!l)return;return l},h=c=>{let l=new Set,f=m=>{let R=m.children?[...m.children.values()]:[];for(;R.length;){let N=R.pop();N.own?.forEach(T=>l.add(T)),N.deep?.forEach(T=>l.add(T)),N.children?.forEach(T=>R.push(T))}},u=i,y=c.split("."),E="";for(let m=0;m<y.length-1;m++){if(u=u.children?.get(y[m]),!u)return l;E=E?`${E}.${y[m]}`:y[m],u.deep?.forEach(R=>l.add(R)),W.has(E)&&u.own?.forEach(R=>l.add(R)),m===y.length-2&&y[m+1]==="length"&&(u.own?.forEach(R=>l.add(R)),f(u))}return u=u.children?.get(y[y.length-1]),u&&(u.own?.forEach(m=>l.add(m)),u.deep?.forEach(m=>l.add(m)),f(u)),l},w=(c,l)=>{if(c.deep||l.size<2)return l;let f=new Set;if(l.forEach(y=>{for(let E=y.indexOf(".");E!==-1;E=y.indexOf(".",E+1))f.add(y.slice(0,E))}),!f.size)return l;let u=new Set;return l.forEach(y=>{f.has(y)||u.add(y)}),u},_=c=>{let l=null,f=null,u=null,y=ve,E=A=>u?u.has(A):l===A,m=A=>{let F=a(A,c);u?u.set(A,F):l===null?(l=A,f=F):(u=new Map([[l,f],[A,F]]),l=f=null)},R=A=>{if(u){u.forEach((F,V)=>{A.has(V)||(d(F,c),u.delete(V))});return}l!==null&&!A.has(l)&&(d(f,c),l=f=null)},N=()=>{u?u.forEach(A=>d(A,c)):f&&d(f,c),u=null,l=f=null},T=A=>{if(A.size===y.size){let V=!0;if(A.forEach(he=>{V&&(V=y.has(he))}),V)return}y=A;let F=w(c,A);R(F),F.forEach(V=>{E(V)||m(V)})};return c.reindex.add(T),T(c.deps),()=>{c.reindex.delete(T),N(),y=ve}},P=c=>{let l=g(c);l&&U(new Set([...l.own??[],...l.deep??[]]))},k=c=>P(Pe(c)),U=c=>{let l=Array.from(c),f=!0;for(let u=1;f&&u<l.length;u++)f=l[u-1].order<l[u].order;f||l.sort((u,y)=>u.order-y.order),l.forEach(u=>{s.has(u)&&u.run()})},b=(c,l,f=!1)=>{t.get(c)?.forEach(u=>u(l,c)),n.forEach(u=>u(c,l)),f?s.forEach(u=>u.run()):U(h(c))},C=(c,l)=>c!==l&&c!==null&&l!==null&&typeof c=="object"&&typeof l=="object"&&!re(c)&&!re(l)&&ge(c)&&ge(l)&&Array.isArray(c)===Array.isArray(l),j=c=>Array.isArray(c)?c.length:Object.keys(c).length,v=null,B=(c,l)=>{if(Array.isArray(l)){let y=c.length,E=l.length;if(!y||!E)return v;let m=Math.max(y,E),R=[];for(let N=0;N<m;N++)if(!Object.is(Z(c[N]),Z(l[N]))&&(R.push(String(N)),R.length*2>=m))return v;return R}let f=new Set([...Object.keys(c),...Object.keys(l)]);if(!f.size)return v;let u=[];return f.forEach(y=>{Object.is(Z(c[y]),Z(l[y]))||u.push(y)}),u.length*2>=f.size?v:u},K=(c,l,f,u)=>{let y=new Set,E=R=>{let N=g(R);N?.own?.forEach(T=>y.add(T)),N?.deep?.forEach(T=>y.add(T))},m=B(l,f);if(!m)return b(c,u);if(t.get(c)?.forEach(R=>R(u,c)),n.forEach(R=>R(c,u)),E(c),m.forEach(R=>{let N=Z(f[R]),T=`${c}.${R}`,A=q(N)?p(N,T):N;t.get(T)?.forEach(F=>F(A,T)),h(T).forEach(F=>y.add(F))}),j(l)!==j(f)&&E(Pe(c)),Array.isArray(f)&&l.length!==f.length){let R=`${c}.length`;t.get(R)?.forEach(N=>N(f.length,R)),E(R)}U(y)},q=c=>c!==null&&typeof c=="object"&&ge(c),W=new Map,S=(c,l)=>{let f=W.get(l);f?.store!==c&&(f?.unsubscribe(),W.set(l,{store:c,unsubscribe:c.$onAny((u,y)=>b(`${l}.${u}`,y))}))},x=c=>{W.get(c)?.unsubscribe(),W.delete(c)},p=(c,l)=>{let f=r.get(c);if(f)return f;let u=null,y=new Proxy(c,{has(E,m){return Reflect.has(E,m)||typeof m=="string"&&u?.has(m)===!0},ownKeys(E){return ne[ne.length-1]?.add(Pe(l)),Reflect.ownKeys(E)},get(E,m,R){if(m===Le)return E;if(m===ut)return l==="";if(typeof m!="string")return Reflect.get(E,m,R);if(l===""&&m in o)return o[m];let N=l?`${l}.${m}`:m;ne[ne.length-1]?.add(N);let T=Reflect.get(E,m,R);if(re(T))return S(T,N),T;let A=Z(T);return q(A)?p(A,N):A},set(E,m,R,N){if(N!==y&&!Object.prototype.hasOwnProperty.call(E,m))return Reflect.set(E,m,R,N);let T=l?`${l}.${m}`:m,A=re(R)?R:Z(R),F=!Object.prototype.hasOwnProperty.call(E,m);if(!F&&Object.is(E[m],A)&&(A===null||typeof A!="object"))return!0;let V=E[m];E[m]=A,u?.delete(m),re(A)?S(A,T):x(T);let he=re(A)||!q(A)?A:p(A,T);return!F&&C(V,A)?K(T,V,A,he):b(T,he,F),!0},deleteProperty(E,m){if(typeof m!="string")return Reflect.deleteProperty(E,m);let R=Object.prototype.hasOwnProperty.call(E,m),N=Reflect.deleteProperty(E,m);if(N&&R){let T=l?`${l}.${m}`:m;(u??(u=new Set)).add(m),x(T),b(T,void 0),k(l)}return N}});return r.set(c,y),y},$=p(Z(e),"");Object.entries(Z(e)).forEach(([c,l])=>{re(l)&&S(l,c)});let O=(c,l,{immediate:f=!1}={})=>(t.has(c)||t.set(c,new Set),t.get(c).add(l),f&&l(ln($,c),c),()=>t.get(c)?.delete(l)),z=(c,{immediate:l=!1}={})=>(n.add(c),l&&dt($,"",(f,u)=>c(f,u)),()=>n.delete(c)),H=(c,{deep:l=!1,alsoWakenBy:f}={})=>{let u=!1,y=!1,E={deps:ve,reindex:new Set,deep:l,order:dn++,run:()=>{if(u){y=!0;return}u=!0;try{let N=0;do{y=!1;let T=new Set;ne.push(T);try{c()}finally{ne.pop(),E.deps=T}}while(y&&++N<100);y&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{u=!1,E.reindex.forEach(N=>N(E.deps))}}};s.add(E);let m=_(E),R=()=>{s.delete(E),m()};return f?.length?M(E,f,R):(E.run(),R)},M=(c,l,f)=>{let u=l.map(y=>y?.[ct]?.(c)).filter(Boolean);return c.run(),()=>{f(),u.forEach(y=>y())}},I=c=>{s.add(c);let l=_(c);return()=>{s.delete(c),l()}},G=()=>{W.forEach(({unsubscribe:c})=>c()),W.clear()};return o.$on=O,o.$onAny=z,o.$effect=H,o.$dispose=G,o[ct]=I,$},oe=(e,t=!1)=>{let n=[],s=[],r=e[me];return{effect:o=>{n.push(e.$effect(o,{deep:t,alsoWakenBy:r})),s.push(o)},onDispose:o=>{n.push(o)},refresh:()=>{s.forEach(o=>o())},dispose:()=>{n.splice(0).forEach(o=>o()),s.length=0}}};var ft=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,pt=/\$:\s*/y,be=/import(?=\s*\()/y,ht=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,Y=(e,t)=>{let n=e[t],s=t+1;for(;s<e.length;){if(e[s]==="\\"){s+=2;continue}if(e[s]===n)return s+1;s++}return e.length},J=(e,t)=>{let n=e.indexOf(`
2
- `,t);return n===-1?e.length:n},X=(e,t)=>{let n=e.indexOf("*/",t+2);return n===-1?e.length:n+2},Ee=(e,t)=>{let n=t;for(;n<e.length;){if(/\s/.test(e[n])){n++;continue}if(e[n]==="/"&&e[n+1]==="/"){n=J(e,n);continue}if(e[n]==="/"&&e[n+1]==="*"){n=X(e,n);continue}break}return n},un=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),Q=(e,t)=>{let n=t-1;for(;n>=0;){let r=e[n];if(/\s/.test(r)){n--;continue}if(r==="/"&&e[n-1]==="*"){let o=e.lastIndexOf("/*",n-2);if(o===-1)return!0;n=o-1;continue}break}if(n<0)return!0;let s=e[n];if(/[\w$]/.test(s)){let r=n;for(;r>0&&/[\w$]/.test(e[r-1]);)r--;return un.has(e.slice(r,n+1))}return(s==="+"||s==="-")&&e[n-1]===s?!1:!")]}\"'`.".includes(s)},ee=(e,t)=>{let n=t+1,s=!1;for(;n<e.length;){let r=e[n];if(r==="\\"){n+=2;continue}if(r===`
3
- `)return n;if(r==="[")s=!0;else if(r==="]")s=!1;else if(r==="/"&&!s){for(n++;n<e.length&&/[a-z]/i.test(e[n]);)n++;return n}n++}return e.length},fn=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,pn=(e,t)=>{let n=t-1;for(;n>=0;){let s=e[n];if(/\s/.test(s)){n--;continue}if(s==="/"&&e[n-1]==="*"){let r=e.lastIndexOf("/*",n-2);if(r===-1)return"";n=r-1;continue}return s}return""},gt=(e,t)=>{let n=0,s=t;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=Y(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=J(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=X(e,s);continue}if(r==="/"&&Q(e,s)){s=ee(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else{if(n<=0&&r===";")return s;if(n<=0&&r===`
4
- `){let o=Ee(e,s+1);if(!(o<e.length&&(fn.test(e.slice(o,o+2))||[",","="].includes(pn(e,s)))))return s;s=o;continue}}s++}return e.length},hn=e=>{let t=[],n=0,s=0,r=0,o=a=>{t.push({raw:e.slice(s,a),codeEnd:Math.max(0,r-s)}),s=a+1,r=s},i=0;for(;i<e.length;){let a=e[i];if(a==="'"||a==='"'||a==="`"){i=Y(e,i),r=i;continue}if(a==="/"&&e[i+1]==="/"){i=J(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=X(e,i);continue}if(a==="/"&&Q(e,i)){i=ee(e,i),r=i;continue}if("([{".includes(a))n++;else if(")]}".includes(a))n--;else if(a===","&&n<=0){o(i),i++;continue}/\s/.test(a)||(r=i+1),i++}return o(e.length),t},Me=e=>{let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return Se.test(t)?[t]:[];let n=[];for(let s of ke(t.slice(1,yt(t)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=Ie(s);if(r!==-1&&(s=s.slice(0,r).trim()),t.startsWith("{")){let o=De(s,":");if(o!==-1){n.push(...Me(s.slice(o+1)));continue}}n.push(...Me(s))}return n},gn=e=>{let t=[],n=hn(e).map(({raw:o,codeEnd:i})=>{let a=o.match(/^\s*/)[0];if(i<=a.length)return{text:o,empty:!0};let d=o.slice(a.length,i),g=o.slice(i),h=Ie(d),w=(h===-1?d:d.slice(0,h)).trim(),_=d[0]==="{"||d[0]==="[";_?t.push(...Me(w)):Se.test(w)&&t.push(w);let P=Re(d).code;return{text:`${a}${_?`(${P})`:P}${g}`,empty:!1}}),s=[];for(;n.length&&n[n.length-1].empty;)s.unshift(n.pop().text);let r=n.map(o=>o.text).join(",")+s.join("");return r.trimStart().startsWith("(")&&(r=`;${r}`),{vars:t,code:r}},Re=e=>{let t=[],n="",s=0,r=0,o=!0;for(;s<e.length;){let i=e[s],a=e[s+1];if(i==="'"||i==='"'||i==="`"){let d=Y(e,s);n+=e.slice(s,d),s=d,o=!1;continue}if(i==="/"&&(a==="/"||a==="*")){let d=a==="/"?J(e,s):X(e,s);n+=e.slice(s,d),s=d;continue}if(i==="/"&&Q(e,s)){let d=ee(e,s);n+=e.slice(s,d),s=d,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(be.lastIndex=s,be.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){ft.lastIndex=s;let d=ft.exec(e);if(d){let h=s+d[0].length,w=gt(e,h),{vars:_,code:P}=gn(e.slice(h,w));t.push(..._),n+=P,s=w,o=!1;continue}pt.lastIndex=s;let g=pt.exec(e);if(g){ht.lastIndex=s;let h=ht.exec(e);h&&t.push(h[1]);let w=s+g[0].length,_=gt(e,w);n+=`$__effect(() => { ${Re(e.slice(w,_)).code} });`,s=_;continue}}"([{".includes(i)?r++:")]}".includes(i)&&(r=Math.max(0,r-1)),i===`
5
- `||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),n+=i,s++}return{vars:t,code:n}},we=/export\s+default(?![\w$])/y,mt=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,mn=e=>{let t=[],n=0,s=0;for(let r=0;r<=e.length;r++){let o=e[r];if(o==="{")n++;else if(o==="}")n--;else if(r===e.length||o===","&&n===0){let i=e.slice(s,r).trim();i&&t.push(i),s=r+1}}return t},yn=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=mn(e),o=[],i=s;if(r.length>1){let a=`$__mod${n}`;o.push(`${a} = ${s}`),i=a}for(let a of r)a.startsWith("{")?o.push(`${a.replace(/\s+as\s+/g,": ")} = ${i}`):a.startsWith("*")?o.push(`${a.replace(/^\*\s*as\s+/,"")} = ${i}`):o.push(`${a} = $__default(${i})`);return`const ${o.join(", ")}`},Se=/^[A-Za-z_$][\w$]*$/,yt=e=>{let t=0,n=0;for(;n<e.length;){let s=e[n];if(s==="'"||s==='"'||s==="`"){n=Y(e,n);continue}if(s==="/"&&e[n+1]==="/"){n=J(e,n);continue}if(s==="/"&&e[n+1]==="*"){n=X(e,n);continue}if(s==="/"&&Q(e,n)){n=ee(e,n);continue}if("([{".includes(s))t++;else if(")]}".includes(s)&&--t===0)return n;n++}return e.length},De=(e,t)=>{let n=0,s=0;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=Y(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=J(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=X(e,s);continue}if(r==="/"&&r!==t&&Q(e,s)){s=ee(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===t)return s;s++}return-1},ke=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let o=e[r];if(o==="'"||o==='"'||o==="`"){r=Y(e,r);continue}if(o==="/"&&e[r+1]==="/"){r=J(e,r);continue}if(o==="/"&&e[r+1]==="*"){r=X(e,r);continue}if(o==="/"&&Q(e,r)){r=ee(e,r);continue}if(o!==void 0&&"([{".includes(o))n++;else if(o!==void 0&&")]}".includes(o))n--;else if(r===e.length||o===","&&n===0){let i=e.slice(s,r).trim();i&&t.push(i),s=r+1}r++}return t},Ie=e=>{let t=0;for(;t<e.length;){let n=De(e.slice(t),"=");if(n===-1)return-1;let s=t+n;if(e[s+1]!=="="&&e[s+1]!==">"&&e[s-1]!=="="&&e[s-1]!=="!")return s;t=s+1}return-1},$e=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=yt(t);if(n>=t.length)return null;let s=[];for(let r of ke(t.slice(1,n))){if(r.startsWith("..."))continue;let o=Ie(r),i=o===-1?r:r.slice(0,o),a=o===-1?void 0:r.slice(o+1).trim(),d=De(i,":"),g=(d===-1?i:i.slice(0,d)).trim();if(!Se.test(g))continue;let h={name:g};a!==void 0&&(h.default=a);let w=d===-1?"":i.slice(d+1).trim();Se.test(w)&&(h.as=w),s.push(h)}return s},En=e=>{let t=0,n=0,s=!0;for(;t<e.length;){let r=e[t];if(r==="'"||r==='"'||r==="`"){t=Y(e,t),s=!1;continue}if(r==="/"&&e[t+1]==="/"){t=J(e,t);continue}if(r==="/"&&e[t+1]==="*"){t=X(e,t);continue}if(r==="/"&&Q(e,t)){t=ee(e,t),s=!1;continue}if(r==="e"&&n===0&&s&&(t===0||!/[\w$.]/.test(e[t-1]))){we.lastIndex=t;let o=we.exec(e);if(o)return t+o[0].length}"([{".includes(r)?n++:")]}".includes(r)&&(n=Math.max(0,n-1)),r===`
6
- `||r===";"||r==="}"?s=!0:/\s/.test(r)||(s=!1),t++}return-1},bn=/^async(?![\w$])/,wn=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,Sn=e=>{let t=En(e);if(t===-1)return null;let n=Ee(e,t),s=e.slice(n);bn.test(s)&&(n=Ee(e,n+5));let r=wn.exec(e.slice(n));if(r&&(n=Ee(e,n+r[0].length)),e[n]!=="(")return null;let o=0,i=n;for(;i<e.length;){let a=e[i];if(a==="'"||a==='"'||a==="`"){i=Y(e,i);continue}if(a==="/"&&e[i+1]==="/"){i=J(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=X(e,i);continue}if(a==="/"&&Q(e,i)){i=ee(e,i);continue}if("([{".includes(a))o++;else if(")]}".includes(a)&&--o===0)break;i++}return ke(e.slice(n+1,i))[0]??""},Te=e=>{let t=Sn(e);if(t===null)return null;let n=$e(t),s=n?.find(r=>r.name.startsWith("$"))?.name;if(s)throw new Error(`jq79: the factory signature is (props, ctx), so \`${s}\` can't be destructured from the first parameter. Write \`export default (props, { ${s} }) => \u2026\`, or \`_\` in place of props if the component takes none.`);return n},Et=e=>{let t="",n=0,s=0,r=!0,o=!1,i=0;for(;n<e.length;){let a=e[n],d=e[n+1],g=n===0||!/[\w$.]/.test(e[n-1]);if(a==="'"||a==='"'||a==="`"){let h=Y(e,n);t+=e.slice(n,h),n=h,r=!1;continue}if(a==="/"&&(d==="/"||d==="*")){let h=d==="/"?J(e,n):X(e,n);t+=e.slice(n,h),n=h;continue}if(a==="/"&&Q(e,n)){let h=ee(e,n);t+=e.slice(n,h),n=h,r=!1;continue}if(a==="i"&&g){if(be.lastIndex=n,be.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){mt.lastIndex=n;let h=mt.exec(e);if(h){t+=yn(h[1],h[3],i++),n+=h[0].length,r=!1;continue}}}if(a==="e"&&g&&s===0&&r){we.lastIndex=n;let h=we.exec(e);if(h){o=!0,t+="$__exports.default =",n+=h[0].length,r=!1;continue}}"([{".includes(a)?s++:")]}".includes(a)&&(s=Math.max(0,s-1)),a===`
7
- `||a===";"||a==="}"?r=!0:/\s/.test(a)||(r=!1),t+=a,n++}return o?t:null};var Rn="0.6.1",Mt=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),Dt=e=>{let t=Mt(e),n=t[Be];return delete t[Be],{tag:e.tagName.toLowerCase(),attrs:t,...n===void 0?{}:{component:n},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(s=>{if(s.nodeType===Node.TEXT_NODE){let r=s.textContent??"";return r?[r]:[]}return s.nodeType===Node.ELEMENT_NODE?[Dt(s)]:[]})}},bt=new Map,kt=(e,t)=>{let n=`${t.join(",")}|${e}`,s=bt.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
8
- ); }`)}catch{s=null}bt.set(n,s)}return s},$n=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,Tn=100,ae=new Map,Ke=new Set,xe=0,Ue=!1,We=new Set,xn=()=>{Ue=!1,!(xe>0)&&(ae.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(Ke.add(s),console.warn(`jq79: ${e} is not defined - evaluating "${t}". Template expressions resolve against the component store: a top-level let/var/const in a :setup script, a declared prop, or a global. Note a "function name() {}" declaration is not on the store - write "const name = () => {}".`))}),ae.clear())},It=()=>{Ue||xe>0||!ae.size||(Ue=!0,queueMicrotask(xn))},qt=e=>{xe++;let t=()=>{xe--,It()};e.then(t,t)},Nn=(e,t)=>{if(We.has(e))return;We.add(e);let n=t?.message||String(t);console.error(`jq79: ${n} - evaluating "${e}". The expression rendered as nothing. If the value arrives later, guard it - "a?.b", or :if on the element.`)},Ut=(e,t,n)=>{if(!(n instanceof ReferenceError))return Nn(e,n);let s=$n.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let o=`${r}|${e}`;Ke.has(o)||ae.has(o)||ae.size>=Tn||(ae.set(o,{name:r,expr:e,scope:t}),It())},Wt=(e,t,n)=>{let s=kt(e,n?Object.keys(n):[]);if(s)return s(t,...n?Object.values(n):[])},D=(e,t,n)=>{try{return Wt(e,t,n)}catch(s){Ut(e,t,s);return}},Ft=(e,t,n)=>{try{return Wt(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;Ut(e,t,s);return}},An=(e,t)=>e.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>D(s,t)??""),_n=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),Ve=e=>_n.has(e)||e.startsWith(":class.")||e.startsWith(":props.")||e===":slot"||e.startsWith(":slot."),Cn=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,jn=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o);e.addEventListener(r,a=>{if(i.has("self")&&a.target!==e)return;i.has("prevent")&&a.preventDefault(),i.has("stop")&&a.stopPropagation();let d=Ft(n,s,{$event:a});typeof d=="function"&&d.call(e,a)},{once:i.has("once"),capture:i.has("capture")})},On=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o),a=d=>{i.has("prevent")&&d.preventDefault(),i.has("stop")&&d.stopPropagation(),i.has("once")&&e.off(r,a),fe(()=>{let g=Ft(n,s,{$event:d});typeof g=="function"&&g(d)})};e.on(r,a)},se=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),Fe=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Je=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},_e=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},Pn=e=>{e.forEach(t=>{if(t.length===1)return _e(t[0]);if(!t[0].first.parentNode)return;let s=document.createRange();s.setStartBefore(t[0].first),s.setEndAfter(t[t.length-1].last),s.deleteContents()})},vn=(e,t)=>{let n=[],s=null;return e.forEach(r=>{if(!t(r)){s=null;return}s&&s[s.length-1].last.nextSibling===r.range.first?s.push(r.range):n.push(s=[r.range])}),n},Ln=({first:e,last:t},n)=>{let s=n.nextSibling;for(let r=e;r;){let o=r===t?null:r.nextSibling;n.parentNode.insertBefore(r,s),r=o}},wt=(e,t)=>{let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s))for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r;return null},ie=null,Ne=null,Mn=e=>{let t={memo:ie,base:Ne};return ie=new Map,Ne=e,t},Dn=e=>{ie=e.memo,Ne=e.base},St=(e,t)=>{if(!ie)return wt(e,t);let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s)){if(s===Ne){if(ie.has(t))return ie.get(t);let r=wt(s,t);return ie.set(t,r),r}for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r}return null},kn=e=>{let t=new Set;for(let n=e;n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let s of Object.keys(n))/^[A-Z]/.test(s)&&t.add(s);return[...t].sort()},In=(e,t)=>{let n=kn(t);return new Error(`jq79: <${e}> is not defined - no component of that name is in scope, and nothing renders here. Import it in a :setup script, declare it as a prop, or add a <template name="${e}"> to this file. In scope: ${n.length?n.join(", "):"(none)"}.`)},Rt=200,qe=0,Bt=Symbol("jq79.slots"),qn=e=>e==="slot"||e.startsWith("slot."),zt=e=>e?se(e):"default",Xe=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),Un=e=>e==="default"?":slot":`:slot.${e}`,Wn=e=>typeof e!="string"||e.trim()!=="",Fn=e=>{let t={},n=[];e.children.forEach(r=>{let o=typeof r=="object"&&r.tag==="template"?Xe(r):void 0;if(typeof r=="string"||o===void 0){n.push(r);return}let i=zt(o.slice(6));if(i in t){console.warn(`jq79: two <template ${Un(i)}> in <${e.tag}>; the second was ignored`);return}t[i]={nodes:r.children,binder:r.attrs[o]||void 0}});let s=n.some(Wn);return s&&"default"in t?console.warn(`jq79: <${e.tag}> has both a <template :slot> and content outside it - the <template> is the default slot's content, and the rest was ignored`):s&&(t.default={nodes:n,binder:e.attrs[":slot"]||void 0}),t},Bn=(e,t,n)=>{$e(t)?.forEach(({name:s,as:r,default:o})=>{let i=r??s;Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>{let a=n[s]?.();return a===void 0&&o!==void 0?D(o,e):a},set:()=>console.warn(`jq79: "${i}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},zn=e=>{let t=Xe(e);return console.warn(`jq79: <template ${t}> fills a slot only as a direct child of a component tag; here it rendered nothing`),document.createComment(`misplaced ${t}`)},Hn=(e,t)=>{let n=Object.entries(Fn(e));if(!n.length)return null;let s={};return n.forEach(([r,o])=>{s[r]=Gn(o,t)}),s},Gn=(e,t)=>(n,s,r,o)=>{let i=Object.create(t);Bn(i,e.binder,n);let a=i[me]??[];Object.defineProperty(i,me,{value:[...a,s]});let d=oe(i);return r.onDispose(()=>d.dispose()),ce(e.nodes,i,d,o)},Zn=(e,t,n,s)=>{let r=zt(e.tag.slice(5)),o=document.createDocumentFragment(),i=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);o.append(i,a);let d=t[Bt]?.[r];if(!d)return o.insertBefore(ce(e.children,t,n,s),a),o;let g={};return Object.entries(e.attrs).forEach(([h,w])=>{if(!(h===Ce||Ve(h)||h.startsWith("@")))if(h.startsWith(":")){let _=w||h.slice(1);g[se(h.slice(1))]=()=>D(_,t)}else g[se(h)]=()=>w}),o.insertBefore(d(g,t,n,s),a),o},$t=(e,t,n,s,r)=>{let o=document.createComment(e),i=document.createComment(`/${e}`),a=document.createDocumentFragment();a.append(o,i);let d=Hn(t,n),g={},h={},w=[],_=[],P=!1;Object.entries(t.attrs).forEach(([S,x])=>{if(S!==Ce){if(S===":props"||S.startsWith(":props.")){P=!0,_.push({expr:x});return}if(!Ve(S))if(S.startsWith("@"))w.push([S,x]);else if(S===":model"||S.startsWith(":model.")){let p=S===":model"?"default":se(S.slice(7));h[p]=x||(S===":model"?"model":p)}else if(S.startsWith(":")){let p=se(S.slice(1));g[p]=x||p,_.push({name:p,expr:x||p})}else{let p=se(S),$=JSON.stringify(x);g[p]=$,_.push({name:p,expr:$})}}});let k=S=>S==="default"?":model":`:model.${S}`,U=S=>S==="default"?"model":S,b=S=>`${S}
9
- = $value`,C=new Set;Object.entries(h).forEach(([S,x])=>{let p=U(S);g[p]!==void 0&&console.warn(`jq79: <${t.tag}> binds prop "${p}" through both :${p} and ${k(S)} - ${k(S)} wins`),g[p]=x,kt(b(x),["$value"])===null&&(C.add(S),console.warn(`jq79: ${k(S)}="${x}" is not assignable - updates from <${t.tag}> will be dropped`))});let j=()=>{let S={};return _.forEach(({name:x,expr:p})=>{if(x!==void 0)S[x]=D(p,n);else{let $=D(p,n);$!==null&&typeof $=="object"&&Object.assign(S,$)}}),Object.entries(h).forEach(([x,p])=>{S[U(x)]=D(p,n)}),S},v=null,B=null,K=null,q=new Set,W=S=>{if(S==null){if(!n[Jt]?.has(e)||q.has("unfilled"))return;q.add("unfilled"),console.error(`jq79: <${t.tag}> is declared as a prop and the parent passed nothing - nothing renders here. Pass it (:${e}="\u2026"), or drop it from the signature to use the one declared in this file.`);return}q.has("type")||(q.add("type"),console.error(`jq79: <${t.tag}> is ${typeof S}, not a component - nothing renders here`))};return s.effect(()=>{let S=D(e,n),x=S instanceof te?S:null;if(x||W(S),x===B||(K?.dispose(),K=null,v?.destroy(),v=null,B=x,!x))return;let p=new te({template:x.template,scripts:x.scripts,styles:x.styles,modules:x.modules,filename:x.filename,siblings:x.siblings,name:x.name});if(d&&(p.slots=d),Object.keys(h).length){let M=new Set;p.modelWriteback=(I,G)=>{let c=I==null?"default":se(String(I)),l=h[c];return l===void 0?(M.has(c)||(M.add(c),console.warn(`jq79: <${t.tag}> has no ${k(c)} - bound: ${Object.keys(h).map(k).join(", ")}`)),!1):C.has(c)?!1:(fe(()=>D(b(l),n,{$value:G})),!0)}}w.forEach(([M,I])=>On(p,M,I,n));let $=Ns(p.scripts);As(t,e,Object.keys(g),$);let O=Ot(fe(j),$),z=document.createDocumentFragment();if(qe>=Rt){console.error(`jq79: <${t.tag}> is ${Rt} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}qe++;try{(r?p.renderShadow(O):p.render(O)).mount(z)}finally{qe--}i.parentNode.insertBefore(z,i);let H=oe(n,!0);if(P){let M=[];H.effect(()=>{let I=Ot(j(),$),G=Object.keys(I);M.forEach(c=>{c in I||(p.data[c]=void 0)}),G.forEach(c=>{p.data[c]=I[c]}),M=G})}else Object.entries(g).forEach(([M,I])=>{$!==null&&!$.has(M)||H.effect(()=>{p.data[M]=D(I,n)})});K=H,v=p}),s.onDispose(()=>{K?.dispose(),v?.destroy()}),a},Kn=(e,t)=>{let n=()=>{let s=D(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let o=n();return o!==null&&Reflect.has(o,r)||Reflect.has(s,r)},get(s,r){let o=n();return o!==null&&Reflect.has(o,r)?o[r]:Reflect.get(s,r)},set(s,r,o){let i=n();return i!==null&&Reflect.has(i,r)?(i[r]=o,!0):Reflect.set(s,r,o)}})},pe=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(pe):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?pe(t):[]):[],Vn=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?rt(e):()=>!1,Jn=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),Tt=(e,t,n)=>{let s=Jn.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},Ye=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?Kn(r,t):t;if(qn(e.tag))return Zn(e,o,n,s);if(e.tag==="template"&&Xe(e)!==void 0)return zn(e);let i=St(o,e.tag);if(i)return $t(i,e,o,n,s);let a=document.createElement(e.tag);if(e.component&&a instanceof HTMLUnknownElement&&o[He]?.count===0)throw In(e.component,o);let d=a instanceof HTMLUnknownElement||e.tag.includes("-");if(d){let b=!1;n.effect(()=>{if(b)return;let C=St(o,e.tag);if(!C)return;b=!0;let j=$t(C,e,o,n,s),v=Je(j);n.onDispose(()=>_e(v)),a.replaceWith(j)})}Object.entries(e.attrs).forEach(([b,C])=>{if(b.startsWith("@"))jn(a,b,C,o);else if(b===":model"||b.startsWith(":model."))d||console.warn(`jq79: ${b} on <${e.tag}> does nothing - :model binds component tags only (for now)`);else if(!Ve(b))if(b.startsWith(":"))if(d)a.setAttribute(b,C);else{let j=b.slice(1),v=C||se(j);n.effect(()=>Tt(a,j,D(v,o)))}else a.setAttribute(b,C)});let g=e.attrs[":attrs"];if(g!==void 0){let b=[];n.effect(()=>{b.forEach(j=>a.removeAttribute(j));let C=D(g,o);b=C&&typeof C=="object"?Object.keys(C):[],b.forEach(j=>Tt(a,j,C[j]))})}let h=e.attrs[":class"],w=Object.entries(e.attrs).filter(([b])=>b.startsWith(":class.")).map(([b,C])=>[b.slice(7),C]);if(h!==void 0||w.length){let b=new Set(pe(e.attrs.class??"")),C=[];n.effect(()=>{let j=h!==void 0?pe(D(h,o)):[];w.forEach(([v,B])=>{D(B,o)&&j.push(...pe(v))}),C.forEach(v=>{!j.includes(v)&&!b.has(v)&&a.classList.remove(v)}),a.classList.add(...j),C=j})}let _=e.attrs[":text"],P=e.attrs[":html"],k=e.attrs[":html.allowed"];k!==void 0&&P===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),_!==void 0?n.effect(()=>{a.textContent=String(D(_,o)??"")}):P!==void 0?n.effect(()=>{let b=k!==void 0?{allowUrl:Vn(D(k,o))}:void 0;a.innerHTML=it(String(D(P,o)??""),b)}):a instanceof HTMLTemplateElement?ce(e.children,o,n,s,a.content):ce(e.children,o,n,s,a);let U=e.attrs[":value"];return U!==void 0&&n.effect(()=>{let b=String(D(U,o)??"");a.value!==b&&(a.value=b)}),[":checked",":selected"].forEach(b=>{let C=e.attrs[b];if(C===void 0)return;let j=b.slice(1);n.effect(()=>{a[j]=!!D(C,o)})}),a},Xn=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,a=null,d=null;return n.effect(()=>{let g=e.find(w=>w.expr===void 0||D(w.expr,t))??null;if(g===a||(d?.dispose(),i&&_e(i),i=null,a=g,!g))return;d=oe(t);let h=Ye(g.node,t,d,s);i=Je(h),r.parentNode.insertBefore(h,r.nextSibling)}),o},de=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},Yn=e=>{let t=new Uint8Array(e.length),n=[],s=new Int32Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let o=e[r];if(o<0)continue;let i=0,a=n.length;for(;i<a;){let d=i+a>>1;e[n[d]]<o?i=d+1:a=d}i>0&&(s[r]=n[i-1]),n[i]=r}for(let r=n.length?n[n.length-1]:-1;r!==-1;r=s[r])t[r]=1;return t},Qn=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Ht=(e,t)=>typeof e=="string"?t.some(n=>Nt(e,n)):Object.values(e.attrs).some(n=>t.some(s=>Nt(n,s)))||e.children.some(n=>Ht(n,t)),xt=/[A-Za-z0-9_$]/,es=/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/,Nt=(e,t)=>{for(let n=e.indexOf(t);n!==-1;n=e.indexOf(t,n+1)){let s=n===0?"":e[n-1],r=e[n+t.length]??"";if(!xt.test(s)&&!xt.test(r))return!0}return!1},ts=(e,t,n,s)=>{let r=e.attrs[":each"].match(Cn);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,o,i,a]=r,d=e.attrs[":key"],g=d===o,h=d!==void 0&&!g&&es.test(d)&&d.startsWith(`${o}.`)?d.slice(o.length+1):void 0,{[":each"]:w,[":key"]:_,...P}=e.attrs,k={...e,attrs:P},U=["$index",...i?[i]:[]],b=Ht(k,U),C=document.createComment("each"),j=document.createDocumentFragment();j.appendChild(C),(":if"in e.attrs||":elseif"in e.attrs||":else"in e.attrs)&&console.warn("jq79: :if/:elseif/:else on a :each element is ignored; filter the list expression instead");let v=[],B=!1;return n.effect(()=>{let K=Mn(t);try{let q=D(a,t),W=Array.isArray(q),S=W?null:Qn(q)?Object.keys(q):[],x=W?q.length:S.length,p=new Map;v.forEach((l,f)=>{l.pos=f;let u=p.get(l.key);u?u.push(l):p.set(l.key,[l])});let $=new Set,O=[],z=[],H=[],M;for(let l=0;l<x;l++){let f=W?l:S[l],u=W?q[l]:q[f],y=f;g?y=u:h!==void 0&&u!==null&&typeof u=="object"?y=u[h]:d!==void 0&&(M===void 0?(M=Object.create(t),de(M,o,u),i&&de(M,i,f),de(M,"$index",l)):(M[o]=u,i&&(M[i]=f),M.$index=l),y=D(d,M)),$.has(y)&&!B&&(B=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),$.add(y);let E=p.get(y)?.shift();if(E&&Object.is(E.item,u)){let T=E.scope;T.$index!==l&&(b&&O.push(E),T.$index=l),i&&T[i]!==f&&(T[i]=f),z.push(E),H.push(E.pos);continue}E&&(E.fx.dispose(),_e(E.range));let m=Object.create(t);de(m,o,u),i&&de(m,i,f),de(m,"$index",l);let R=oe(t),N=Je(Ye(k,m,R,s));z.push({key:y,item:u,scope:m,fx:R,range:N,pos:l}),H.push(-1)}let I=new Set;p.forEach(l=>l.forEach(f=>I.add(f))),I.size&&(I.forEach(l=>l.fx.dispose()),Pn(vn(v,l=>I.has(l))));let G=C,c=Yn(H);z.forEach((l,f)=>{!c[f]&&G.nextSibling!==l.range.first&&Ln(l.range,G),G=l.range.last}),O.forEach(l=>fe(()=>l.fx.refresh())),v=z}finally{Dn(K)}}),j},ce=(e,t,n,s=!1,r)=>{let o=r??document.createDocumentFragment(),i=0;for(;i<e.length;){let a=e[i];if(typeof a=="string"){let d=document.createTextNode(a);a.includes("{{")&&n.effect(()=>{d.textContent=An(a,t)}),o.appendChild(d),i++;continue}if(":each"in a.attrs){o.appendChild(ts(a,t,n,s)),i++;continue}if(":if"in a.attrs){let d=[{expr:a.attrs[":if"],node:a}];i++;let g=w=>{let _=i;for(;_<e.length&&typeof e[_]=="string"&&!e[_].trim();)_++;let P=e[_];if(typeof P=="object"&&w in P.attrs)return i=_+1,P};for(let w=g(":elseif");w;w=g(":elseif"))d.push({expr:w.attrs[":elseif"],node:w});let h=g(":else");h&&d.push({node:h}),o.appendChild(Xn(d,t,n,s));continue}o.appendChild(Ye(a,t,n,s)),i++}return o},zs=(e,t,n=!1)=>ce(e.template,t,oe(t),n),ns=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ss=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,Qe=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,rs=e=>e.split(Qe).map((t,n)=>n%2===1?t:t.replace(ss,(s,r,o)=>ns.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),Gt=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,os=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,is=e=>e.split(Qe).map((t,n)=>n%2===1?t:t.replace(Gt,(s,r,o)=>{let i=0,a=o.replace(os,(d,g,h)=>h===void 0?d:`${g}:props.${i++}="${h}"`);return`<${r}${a}>`})).join(""),as=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,ls=/<\/slot\.([\w.$-]+)(\s*)>/gi,cs=/^slot\./i,ds=e=>cs.test(e)?`slot.${Fe(e.slice(5))}`:e,Be=":jq79-component",us=/^[A-Z]/,fs=/\/\s*$/,ps=(e,t)=>{if(!us.test(e))return t;let n=` ${Be}="${e}"`,s=fs.exec(t);return s?`${t.slice(0,s.index)}${n}${s[0]}`:`${t}${n}`},hs=e=>e.split(Qe).map((t,n)=>n%2===1?t:t.replace(Gt,(s,r,o)=>{let i=o.replace(as,(a,d,g)=>g===void 0?a:`${d}${Fe(g)}`);return`<${ds(r)}${ps(r,i)}>`}).replace(ls,(s,r,o)=>`</slot.${Fe(r)}${o}>`)).join(""),Ce="data-jq79",gs=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0).toString(36)},Zt=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[Ce]=t,Zt(n.children,t))})},ms=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),o=r===-1?s:s.slice(0,r),i=r===-1?"":s.slice(r);return`${o}[${Ce}="${t}"]${i}`}).join(", "),Kt=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=ms(n.selectorText,t):n instanceof CSSGroupingRule&&Kt(n.cssRules,t)})},ys=(e,t)=>{/:deep\(|::v-deep|>>>/.test(e)&&console.warn("jq79: :deep()/::v-deep/>>> are not supported in <style scoped>; the rule will be dropped by the browser");let n=new CSSStyleSheet;return n.replaceSync(e),Kt(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
10
- `)},Es=/^[A-Z][A-Za-z0-9]*$/,ze=e=>{let t=rs(is(hs(e))),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],o=[];Array.from(s.content.children).forEach(d=>{d.tagName==="TEMPLATE"?o.push(d):r.push(d)});let i=At(r,e),a={};return o.forEach(d=>{let g=d.getAttribute("name");if(g===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!Es.test(g)){console.warn(`jq79: <template name="${g}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(g in a){console.warn(`jq79: two <template name="${g}"> in one file; the second was ignored`);return}a[g]=new te({...At(Array.from(d.content.children),d.innerHTML),siblings:a,name:g})}),Object.keys(a).length&&(i.siblings=a),i},At=(e,t)=>{let n=[],s=[],r=[];e.forEach(i=>{let a={attrs:Mt(i),content:i.textContent??""};i.tagName==="SCRIPT"?n.push(a):i.tagName==="STYLE"?s.push(a):r.push(Dt(i))}),s.forEach(i=>{"lang"in i.attrs&&console.warn(`jq79: <style lang="${i.attrs.lang}"> needs the jq79/vite plugin to compile it. This component didn't go through the bundler, so its styles were left uncompiled and the browser will ignore them.`)});let o=i=>"scoped"in i.attrs&&!("lang"in i.attrs);if(s.some(o)){let i=gs(t);Zt(r,i),s.forEach(a=>{o(a)&&(a.scoped=ys(a.content,i))})}return{template:r,scripts:n,styles:s}},et=e=>/\.html?([?#]|$)/.test(e)?Ge(e):import(e),bs=/^(?:\.\.?\/|\/|[a-z][a-z0-9+.-]*:)/i,ws=(e,t)=>{if(!bs.test(e))return e;try{return new URL(e,new URL(t??"",document.baseURI)).href}catch{return e}},Vt=(e,t)=>e?`
11
- //# sourceURL=${e}?jq79-script=${t}`:"",_t=e=>e.scoped??e.content,Ae=new Map,Ss=e=>{let t=Ae.get(e);if(!t){let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0},Ae.set(e,t)}t.count++},Rs=e=>{let t=Ae.get(e);t&&--t.count<=0&&(t.el.remove(),Ae.delete(e))},$s=(e,t,n,s={},r=et,o={})=>{let i={...Xt,...s},a=new Proxy(t,{has:(h,w)=>w!=="$__effect"&&w!=="$__import"&&w!=="$__state"&&(Reflect.has(h,w)||!(w in globalThis)&&!(w in i))}),d={},g=new Function("$scope","$__effect","$__import","$__state",...Object.keys(i),`return (async () => { with ($scope) { ${e} }
12
- ;$__state.done = true })()${Vt(o.filename,o.index??0)}`)(a,n,r,d,...Object.values(i));return g.catch(h=>console.error("jq79: error in :setup script",h)),qt(g),{settled:g,sync:d.done===!0}},Ct=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:D(s,e))})},tt=e=>{let t=e.attrs[":setup"];if(t===void 0)return null;if(t.trim()==="")return[];let n=$e(t);return n||Ts(e,t),n},jt=new WeakSet,Ts=(e,t)=>{t.trim()==="_"||jt.has(e)||(jt.add(e),console.warn(`jq79: :setup="${t}" is not a props pattern, so this component declares no signature and takes whatever a parent passes - write the props it takes ("{ a, b }"), a bare :setup for none, or "_" to stay open on purpose`))},xs=e=>{let t=new Set;return e.forEach(n=>{(Te(n.content)??tt(n))?.forEach(({name:r})=>t.add(r))}),t},Ns=e=>{let t=null;return e.forEach(n=>{let s=Te(n.content)??tt(n);if(!s)return;let r=t??(t=new Set);s.forEach(({name:o})=>r.add(o))}),t},Ot=(e,t)=>{if(t===null)return e;let n={};return Object.keys(e).forEach(s=>{t.has(s)&&(n[s]=e[s])}),n},Pt=new WeakMap,As=(e,t,n,s)=>{if(s===null)return;let r=Pt.get(e)??new Set;Pt.set(e,r),n.forEach(o=>{s.has(o)||r.has(o)||(r.add(o),console.warn(`jq79: :${o} is not declared by <${t}> - add it to the :setup signature, or drop it`))})},_s=(e,t)=>{if(!e)return null;let n=Object.create(null),s=!1;return Object.entries(e).forEach(([r,o])=>{t.has(r)||(n[r]=o,s=!0)}),s?n:null},Jt=Symbol("jq79.unfilledProps"),He=Symbol("jq79.pendingScripts"),Cs=e=>e&&e.default!==void 0?e.default:e,js=(e,t,n,s={},r=et,o={})=>{let i={...Xt,...s},a={},d=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
1
+ var wn=Object.defineProperty;var Rn=(e,t,n)=>t in e?wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var v=(e,t,n)=>Rn(e,typeof t!="symbol"?t+"":t,n);function ge(e,t){return typeof e=="string"?document.querySelector(e):e.querySelector(t)}function Me(e,t){return Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t))}var De=(e,t={})=>{let n=document.createElement(e);for(let[s,r]of Object.entries(t))if(s==="className")n.className=Array.isArray(r)?r.join(" "):r;else if(s==="textContent")n.textContent=r;else if(s==="children")for(let o of r)n.appendChild(o);else n.setAttribute(s,r);return n},$n=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),dt={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},Tn=new Set(["http:","https:","mailto:"]);function xn(e){try{let t=new URL(e,"https://example.com");return Tn.has(t.protocol)}catch{return!1}}var Nn={"https:":"443","http:":"80"};function Cn(e){let t=e.trim().toLowerCase().match(/^([a-z\d*][a-z\d.*-]*?)(?::(\d{1,5}|\*))?$/);if(!t)return null;let[,n,s]=t,r=n.split(".");return r.some(i=>i!=="*"&&!/^[a-z\d-]+$/.test(i))?null:{host:new RegExp(`^${r.map(i=>i==="*"?"[^.]+":i).join("\\.")}$`),port:!s||s==="*"?null:s}}var ht=e=>{let t=(Array.isArray(e)?e:e.split(",")).map(Cn).filter(n=>n!==null);return n=>{let s=n.hostname.toLowerCase(),r=n.port||Nn[n.protocol]||"";return t.some(o=>o.host.test(s)&&(o.port===null||o.port===r))}};function An(e,t,n,s){try{return!!e(new URL(t,document.baseURI),n,s)}catch{return!1}}var pt=512;function gt(e,t,n,s){if(n>pt)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${pt} elements`);for(let r of Array.from(e.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let o=On(r,n,s);o&&t.appendChild(o)}else r.nodeType===Node.TEXT_NODE&&t.appendChild(r.cloneNode())}function On(e,t,n){let s=e.tagName.toLowerCase();if(!$n.has(s))return null;let r=document.createElement(s);for(let o of Array.from(e.attributes)){let i=o.name.toLowerCase(),a=dt[s]?.has(i),l=dt["*"]?.has(i);!a&&!l||(i==="href"||i==="src")&&(!xn(o.value)||n&&!An(n,o.value,s,i))||r.setAttribute(i,o.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),gt(e,r,t+1,n),r}function mt(e,t){let n=document.createElement("template");n.innerHTML=e;let s=document.createElement("div");return gt(n.content,s,0,t?.allowUrl),s.innerHTML}var _n=(e,t)=>t.split(".").reduce((n,s)=>n?.[s],e),be=e=>{if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},wt=(e,t,n)=>{Object.entries(e).forEach(([s,r])=>{let o=t?`${t}.${s}`:s;r&&typeof r=="object"&&be(r)?wt(r,o,n):n(o,r)})},yt=" keys",Ie=e=>e?`${e}.${yt}`:yt,bt=".length",Et=(e,t)=>({children:null,own:null,deep:null,parent:e,segment:t}),jn=e=>!e.own?.size&&!e.deep?.size&&!e.children?.size,We=Symbol("jq79.raw"),Z=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[We];)t=t[We];return t},Rt=Symbol("jq79.store"),le=e=>e!==null&&typeof e=="object"&&e[Rt]===!0,ie=[],me=e=>{ie.push(new Set);try{return e()}finally{ie.pop()}},Pn=0,qe=new Set,St="$__attach",Ee=Symbol("jq79.alsoWakenBy"),Se=e=>{let t=new Map,n=new Set,s=new Set,r=new WeakMap,o=Object.create(null),i=Et(null,""),a=(c,u)=>{let g=i;return c.split(".").forEach(f=>{let E=g.children??(g.children=new Map),y=E.get(f);y||(y=Et(g,f),E.set(f,y)),g=y}),(u.deep?g.deep??(g.deep=new Set):g.own??(g.own=new Set)).add(u),g},l=(c,u)=>{(u.deep?c.deep:c.own)?.delete(u);let g=c;for(;g?.parent&&jn(g);)g.parent.children.delete(g.segment),g=g.parent},p=c=>{let u=i;for(let g of c.split("."))if(u=u.children?.get(g),!u)return;return u},d=c=>{let u=new Set,g=m=>{let x=m.children?[...m.children.values()]:[];for(;x.length;){let R=x.pop();R.own?.forEach(C=>u.add(C)),R.deep?.forEach(C=>u.add(C)),R.children?.forEach(C=>x.push(C))}},f=i,E=c.split("."),y="";for(let m=0;m<E.length-1;m++){if(f=f.children?.get(E[m]),!f)return u;y=y?`${y}.${E[m]}`:E[m],f.deep?.forEach(x=>u.add(x)),h.has(y)&&f.own?.forEach(x=>u.add(x)),m===E.length-2&&E[m+1]==="length"&&(f.own?.forEach(x=>u.add(x)),g(f))}return f=f.children?.get(E[E.length-1]),f&&(f.own?.forEach(m=>u.add(m)),f.deep?.forEach(m=>u.add(m)),g(f)),u},b=(c,u,g)=>{if(u===g)return!1;for(let f=u;f<g;f++){let E=c.charCodeAt(f);if(E<48||E>57)return!1}return!0},O=(c,u)=>{if(c.deep||u.size<2)return u;let g=new Set;u.forEach(y=>{y.endsWith(bt)&&g.add(y.slice(0,-bt.length))});let f=new Set;if(u.forEach(y=>{let m=0,x="";for(let R=y.indexOf(".");R!==-1;R=y.indexOf(".",R+1)){let C=y.slice(0,R);(!(m>0&&b(y,m,R))||g.has(x))&&f.add(C),x=C,m=R+1}}),!f.size)return u;let E=new Set;return u.forEach(y=>{f.has(y)||E.add(y)}),E},D=c=>{let u=null,g=null,f=null,E=qe,y=$=>f?f.has($):u===$,m=$=>{let X=a($,c);f?f.set($,X):u===null?(u=$,g=X):(f=new Map([[u,g],[$,X]]),u=g=null)},x=$=>{if(f){f.forEach((X,J)=>{$.has(J)||(l(X,c),f.delete(J))});return}u!==null&&!$.has(u)&&(l(g,c),u=g=null)},R=()=>{f?f.forEach($=>l($,c)):g&&l(g,c),f=null,u=g=null},C=$=>{if($.size===E.size){let J=!0;if($.forEach(ye=>{J&&(J=E.has(ye))}),J)return}E=$;let X=O(c,$);x(X),X.forEach(J=>{y(J)||m(J)})};return c.reindex.add(C),C(c.deps),()=>{c.reindex.delete(C),R(),E=qe}},I=c=>{let u=p(c);u&&L(new Set([...u.own??[],...u.deep??[]]))},U=c=>I(Ie(c)),L=c=>{let u=Array.from(c),g=!0;for(let f=1;g&&f<u.length;f++)g=u[f-1].order<u[f].order;g||u.sort((f,E)=>f.order-E.order),u.forEach(f=>{s.has(f)&&f.run()})},F=(c,u,g=!1)=>{t.get(c)?.forEach(f=>f(u,c)),n.forEach(f=>f(c,u)),g?s.forEach(f=>f.run()):L(d(c))},N=(c,u)=>c!==u&&c!==null&&u!==null&&typeof c=="object"&&typeof u=="object"&&!le(c)&&!le(u)&&be(c)&&be(u)&&Array.isArray(c)===Array.isArray(u),j=c=>Array.isArray(c)?c.length:Object.keys(c).length,P=null,q=-1,V=(c,u)=>{let g=u.length>c.length,f=g?c:u,E=g?u:c,y=0;for(;y<f.length&&Object.is(Z(f[y]),Z(E[y]));)y++;for(let m=y;m<f.length;m++)if(!Object.is(Z(f[m]),Z(E[m+1])))return q;return y},Y=(c,u)=>{if(Array.isArray(u)){let E=c.length,y=u.length;if(!E||!y)return P;let m=Math.max(E,y);if(Math.abs(E-y)===1){let R=V(c,u);if(R!==q){let C=[];for(let $=R;$<m;$++)C.push(String($));return{keys:C,exact:!0}}}let x=[];for(let R=0;R<m;R++)if(!Object.is(Z(c[R]),Z(u[R]))&&(x.push(String(R)),x.length*2>=m))return P;return{keys:x,exact:!1}}let g=new Set([...Object.keys(c),...Object.keys(u)]);if(!g.size)return P;let f=[];return g.forEach(E=>{Object.is(Z(c[E]),Z(u[E]))||f.push(E)}),f.length*2>=g.size?P:{keys:f,exact:!1}},S=(c,u,g,f)=>{let E=new Set,y=x=>{let R=p(x);R?.own?.forEach(C=>E.add(C)),R?.deep?.forEach(C=>E.add(C))},m=Y(u,g);if(!m)return F(c,f);if(t.get(c)?.forEach(x=>x(f,c)),n.forEach(x=>x(c,f)),y(c),m.keys.forEach(x=>{let R=`${c}.${x}`,C=t.get(R);if(C){let $=Z(g[x]),X=A($)?B($,R):$;C.forEach(J=>J(X,R))}m.exact?y(R):d(R).forEach($=>E.add($))}),j(u)!==j(g)&&y(Ie(c)),Array.isArray(g)&&u.length!==g.length){let x=`${c}.length`;t.get(x)?.forEach(R=>R(g.length,x)),y(x)}L(E)},A=c=>c!==null&&typeof c=="object"&&be(c),h=new Map,T=(c,u)=>{let g=h.get(u);g?.store!==c&&(g?.unsubscribe(),h.set(u,{store:c,unsubscribe:c.$onAny((f,E)=>F(`${u}.${f}`,E))}))},_=c=>{h.get(c)?.unsubscribe(),h.delete(c)},B=(c,u)=>{let g=r.get(c);if(g)return g;let f=null,E=new Proxy(c,{has(y,m){return Reflect.has(y,m)||typeof m=="string"&&f?.has(m)===!0},ownKeys(y){return ie[ie.length-1]?.add(Ie(u)),Reflect.ownKeys(y)},get(y,m,x){if(m===We)return y;if(m===Rt)return u==="";if(typeof m!="string")return Reflect.get(y,m,x);if(u===""&&m in o)return o[m];let R=u?`${u}.${m}`:m;ie[ie.length-1]?.add(R);let C=Reflect.get(y,m,x);if(le(C))return T(C,R),C;let $=Z(C);return A($)?B($,R):$},set(y,m,x,R){if(R!==E&&!Object.prototype.hasOwnProperty.call(y,m))return Reflect.set(y,m,x,R);let C=u?`${u}.${m}`:m,$=le(x)?x:Z(x),X=!Object.prototype.hasOwnProperty.call(y,m);if(!X&&Object.is(y[m],$)&&($===null||typeof $!="object"))return!0;let J=y[m];y[m]=$,f?.delete(m),le($)?T($,C):_(C);let ye=le($)||!A($)?$:B($,C);return!X&&N(J,$)?S(C,J,$,ye):F(C,ye,X),!0},deleteProperty(y,m){if(typeof m!="string")return Reflect.deleteProperty(y,m);let x=Object.prototype.hasOwnProperty.call(y,m),R=Reflect.deleteProperty(y,m);if(R&&x){let C=u?`${u}.${m}`:m;(f??(f=new Set)).add(m),_(C),F(C,void 0),U(u)}return R}});return r.set(c,E),E},H=B(Z(e),"");Object.entries(Z(e)).forEach(([c,u])=>{le(u)&&T(u,c)});let K=(c,u,{immediate:g=!1}={})=>(t.has(c)||t.set(c,new Set),t.get(c).add(u),g&&u(_n(H,c),c),()=>t.get(c)?.delete(u)),w=(c,{immediate:u=!1}={})=>(n.add(c),u&&wt(H,"",(g,f)=>c(g,f)),()=>n.delete(c)),W=(c,{deep:u=!1,alsoWakenBy:g}={})=>{let f=!1,E=!1,y={deps:qe,reindex:new Set,deep:u,order:Pn++,run:()=>{if(f){E=!0;return}f=!0;try{let R=0;do{E=!1;let C=new Set;ie.push(C);try{c()}finally{ie.pop(),y.deps=C}}while(E&&++R<100);E&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{f=!1,y.reindex.forEach(R=>R(y.deps))}}};s.add(y);let m=D(y),x=()=>{s.delete(y),m()};return g?.length?k(y,g,x):(y.run(),x)},k=(c,u,g)=>{let f=u.map(E=>E?.[St]?.(c)).filter(Boolean);return c.run(),()=>{g(),f.forEach(E=>E())}},z=c=>{s.add(c);let u=D(c);return()=>{s.delete(c),u()}},G=()=>{h.forEach(({unsubscribe:c})=>c()),h.clear()};return o.$on=K,o.$onAny=w,o.$effect=W,o.$dispose=G,o[St]=z,H},Ue=class{constructor(t,n){v(this,"scope",t);v(this,"disposers",null);v(this,"runs",null);v(this,"options");let s=t[Ee];this.options=n||s?{deep:n,alsoWakenBy:s}:void 0}effect(t){(this.disposers??(this.disposers=[])).push(this.scope.$effect(t,this.options)),(this.runs??(this.runs=[])).push(t)}onDispose(t){(this.disposers??(this.disposers=[])).push(t)}refresh(){this.runs?.forEach(t=>t())}dispose(){let t=this.disposers;if(this.disposers=null,this.runs=null,t)for(let n=0;n<t.length;n++)t[n]()}},ce=(e,t=!1)=>new Ue(e,t);var $t=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,Tt=/\$:\s*/y,Re=/import(?=\s*\()/y,xt=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,te=(e,t)=>{let n=e[t],s=t+1;for(;s<e.length;){if(e[s]==="\\"){s+=2;continue}if(e[s]===n)return s+1;s++}return e.length},Q=(e,t)=>{let n=e.indexOf(`
2
+ `,t);return n===-1?e.length:n},ee=(e,t)=>{let n=e.indexOf("*/",t+2);return n===-1?e.length:n+2},we=(e,t)=>{let n=t;for(;n<e.length;){if(/\s/.test(e[n])){n++;continue}if(e[n]==="/"&&e[n+1]==="/"){n=Q(e,n);continue}if(e[n]==="/"&&e[n+1]==="*"){n=ee(e,n);continue}break}return n},kn=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),ne=(e,t)=>{let n=t-1;for(;n>=0;){let r=e[n];if(/\s/.test(r)){n--;continue}if(r==="/"&&e[n-1]==="*"){let o=e.lastIndexOf("/*",n-2);if(o===-1)return!0;n=o-1;continue}break}if(n<0)return!0;let s=e[n];if(/[\w$]/.test(s)){let r=n;for(;r>0&&/[\w$]/.test(e[r-1]);)r--;return kn.has(e.slice(r,n+1))}return(s==="+"||s==="-")&&e[n-1]===s?!1:!")]}\"'`.".includes(s)},se=(e,t)=>{let n=t+1,s=!1;for(;n<e.length;){let r=e[n];if(r==="\\"){n+=2;continue}if(r===`
3
+ `)return n;if(r==="[")s=!0;else if(r==="]")s=!1;else if(r==="/"&&!s){for(n++;n<e.length&&/[a-z]/i.test(e[n]);)n++;return n}n++}return e.length},vn=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,Ln=(e,t)=>{let n=t-1;for(;n>=0;){let s=e[n];if(/\s/.test(s)){n--;continue}if(s==="/"&&e[n-1]==="*"){let r=e.lastIndexOf("/*",n-2);if(r===-1)return"";n=r-1;continue}return s}return""},Nt=(e,t)=>{let n=0,s=t;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=te(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=Q(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=ee(e,s);continue}if(r==="/"&&ne(e,s)){s=se(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else{if(n<=0&&r===";")return s;if(n<=0&&r===`
4
+ `){let o=we(e,s+1);if(!(o<e.length&&(vn.test(e.slice(o,o+2))||[",","="].includes(Ln(e,s)))))return s;s=o;continue}}s++}return e.length},Mn=e=>{let t=[],n=0,s=0,r=0,o=a=>{t.push({raw:e.slice(s,a),codeEnd:Math.max(0,r-s)}),s=a+1,r=s},i=0;for(;i<e.length;){let a=e[i];if(a==="'"||a==='"'||a==="`"){i=te(e,i),r=i;continue}if(a==="/"&&e[i+1]==="/"){i=Q(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=ee(e,i);continue}if(a==="/"&&ne(e,i)){i=se(e,i),r=i;continue}if("([{".includes(a))n++;else if(")]}".includes(a))n--;else if(a===","&&n<=0){o(i),i++;continue}/\s/.test(a)||(r=i+1),i++}return o(e.length),t},Fe=e=>{let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return Te.test(t)?[t]:[];let n=[];for(let s of He(t.slice(1,At(t)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=ze(s);if(r!==-1&&(s=s.slice(0,r).trim()),t.startsWith("{")){let o=Be(s,":");if(o!==-1){n.push(...Fe(s.slice(o+1)));continue}}n.push(...Fe(s))}return n},Dn=e=>{let t=[],n=Mn(e).map(({raw:o,codeEnd:i})=>{let a=o.match(/^\s*/)[0];if(i<=a.length)return{text:o,empty:!0};let l=o.slice(a.length,i),p=o.slice(i),d=ze(l),b=(d===-1?l:l.slice(0,d)).trim(),O=l[0]==="{"||l[0]==="[";O?t.push(...Fe(b)):Te.test(b)&&t.push(b);let D=xe(l).code;return{text:`${a}${O?`(${D})`:D}${p}`,empty:!1}}),s=[];for(;n.length&&n[n.length-1].empty;)s.unshift(n.pop().text);let r=n.map(o=>o.text).join(",")+s.join("");return r.trimStart().startsWith("(")&&(r=`;${r}`),{vars:t,code:r}},xe=e=>{let t=[],n="",s=0,r=0,o=!0;for(;s<e.length;){let i=e[s],a=e[s+1];if(i==="'"||i==='"'||i==="`"){let l=te(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(i==="/"&&(a==="/"||a==="*")){let l=a==="/"?Q(e,s):ee(e,s);n+=e.slice(s,l),s=l;continue}if(i==="/"&&ne(e,s)){let l=se(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(Re.lastIndex=s,Re.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){$t.lastIndex=s;let l=$t.exec(e);if(l){let d=s+l[0].length,b=Nt(e,d),{vars:O,code:D}=Dn(e.slice(d,b));t.push(...O),n+=D,s=b,o=!1;continue}Tt.lastIndex=s;let p=Tt.exec(e);if(p){xt.lastIndex=s;let d=xt.exec(e);d&&t.push(d[1]);let b=s+p[0].length,O=Nt(e,b);n+=`$__effect(() => { ${xe(e.slice(b,O)).code} });`,s=O;continue}}"([{".includes(i)?r++:")]}".includes(i)&&(r=Math.max(0,r-1)),i===`
5
+ `||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),n+=i,s++}return{vars:t,code:n}},$e=/export\s+default(?![\w$])/y,Ct=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,In=e=>{let t=[],n=0,s=0;for(let r=0;r<=e.length;r++){let o=e[r];if(o==="{")n++;else if(o==="}")n--;else if(r===e.length||o===","&&n===0){let i=e.slice(s,r).trim();i&&t.push(i),s=r+1}}return t},qn=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=In(e),o=[],i=s;if(r.length>1){let a=`$__mod${n}`;o.push(`${a} = ${s}`),i=a}for(let a of r)a.startsWith("{")?o.push(`${a.replace(/\s+as\s+/g,": ")} = ${i}`):a.startsWith("*")?o.push(`${a.replace(/^\*\s*as\s+/,"")} = ${i}`):o.push(`${a} = $__default(${i})`);return`const ${o.join(", ")}`},Te=/^[A-Za-z_$][\w$]*$/,At=e=>{let t=0,n=0;for(;n<e.length;){let s=e[n];if(s==="'"||s==='"'||s==="`"){n=te(e,n);continue}if(s==="/"&&e[n+1]==="/"){n=Q(e,n);continue}if(s==="/"&&e[n+1]==="*"){n=ee(e,n);continue}if(s==="/"&&ne(e,n)){n=se(e,n);continue}if("([{".includes(s))t++;else if(")]}".includes(s)&&--t===0)return n;n++}return e.length},Be=(e,t)=>{let n=0,s=0;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=te(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=Q(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=ee(e,s);continue}if(r==="/"&&r!==t&&ne(e,s)){s=se(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===t)return s;s++}return-1},He=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let o=e[r];if(o==="'"||o==='"'||o==="`"){r=te(e,r);continue}if(o==="/"&&e[r+1]==="/"){r=Q(e,r);continue}if(o==="/"&&e[r+1]==="*"){r=ee(e,r);continue}if(o==="/"&&ne(e,r)){r=se(e,r);continue}if(o!==void 0&&"([{".includes(o))n++;else if(o!==void 0&&")]}".includes(o))n--;else if(r===e.length||o===","&&n===0){let i=e.slice(s,r).trim();i&&t.push(i),s=r+1}r++}return t},ze=e=>{let t=0;for(;t<e.length;){let n=Be(e.slice(t),"=");if(n===-1)return-1;let s=t+n;if(e[s+1]!=="="&&e[s+1]!==">"&&e[s-1]!=="="&&e[s-1]!=="!")return s;t=s+1}return-1},Ne=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=At(t);if(n>=t.length)return null;let s=[];for(let r of He(t.slice(1,n))){if(r.startsWith("..."))continue;let o=ze(r),i=o===-1?r:r.slice(0,o),a=o===-1?void 0:r.slice(o+1).trim(),l=Be(i,":"),p=(l===-1?i:i.slice(0,l)).trim();if(!Te.test(p))continue;let d={name:p};a!==void 0&&(d.default=a);let b=l===-1?"":i.slice(l+1).trim();Te.test(b)&&(d.as=b),s.push(d)}return s},Wn=e=>{let t=0,n=0,s=!0;for(;t<e.length;){let r=e[t];if(r==="'"||r==='"'||r==="`"){t=te(e,t),s=!1;continue}if(r==="/"&&e[t+1]==="/"){t=Q(e,t);continue}if(r==="/"&&e[t+1]==="*"){t=ee(e,t);continue}if(r==="/"&&ne(e,t)){t=se(e,t),s=!1;continue}if(r==="e"&&n===0&&s&&(t===0||!/[\w$.]/.test(e[t-1]))){$e.lastIndex=t;let o=$e.exec(e);if(o)return t+o[0].length}"([{".includes(r)?n++:")]}".includes(r)&&(n=Math.max(0,n-1)),r===`
6
+ `||r===";"||r==="}"?s=!0:/\s/.test(r)||(s=!1),t++}return-1},Un=/^async(?![\w$])/,Fn=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,Bn=e=>{let t=Wn(e);if(t===-1)return null;let n=we(e,t),s=e.slice(n);Un.test(s)&&(n=we(e,n+5));let r=Fn.exec(e.slice(n));if(r&&(n=we(e,n+r[0].length)),e[n]!=="(")return null;let o=0,i=n;for(;i<e.length;){let a=e[i];if(a==="'"||a==='"'||a==="`"){i=te(e,i);continue}if(a==="/"&&e[i+1]==="/"){i=Q(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=ee(e,i);continue}if(a==="/"&&ne(e,i)){i=se(e,i);continue}if("([{".includes(a))o++;else if(")]}".includes(a)&&--o===0)break;i++}return He(e.slice(n+1,i))[0]??""},Ce=e=>{let t=Bn(e);if(t===null)return null;let n=Ne(t),s=n?.find(r=>r.name.startsWith("$"))?.name;if(s)throw new Error(`jq79: the factory signature is (props, ctx), so \`${s}\` can't be destructured from the first parameter. Write \`export default (props, { ${s} }) => \u2026\`, or \`_\` in place of props if the component takes none.`);return n},Ot=e=>{let t="",n=0,s=0,r=!0,o=!1,i=0;for(;n<e.length;){let a=e[n],l=e[n+1],p=n===0||!/[\w$.]/.test(e[n-1]);if(a==="'"||a==='"'||a==="`"){let d=te(e,n);t+=e.slice(n,d),n=d,r=!1;continue}if(a==="/"&&(l==="/"||l==="*")){let d=l==="/"?Q(e,n):ee(e,n);t+=e.slice(n,d),n=d;continue}if(a==="/"&&ne(e,n)){let d=se(e,n);t+=e.slice(n,d),n=d,r=!1;continue}if(a==="i"&&p){if(Re.lastIndex=n,Re.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){Ct.lastIndex=n;let d=Ct.exec(e);if(d){t+=qn(d[1],d[3],i++),n+=d[0].length,r=!1;continue}}}if(a==="e"&&p&&s===0&&r){$e.lastIndex=n;let d=$e.exec(e);if(d){o=!0,t+="$__exports.default =",n+=d[0].length,r=!1;continue}}"([{".includes(a)?s++:")]}".includes(a)&&(s=Math.max(0,s-1)),a===`
7
+ `||a===";"||a==="}"?r=!0:/\s/.test(a)||(r=!1),t+=a,n++}return o?t:null};var Hn="0.6.3",Zt=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),Kt=e=>{let t=Zt(e),n=t[je];return delete t[je],{tag:e.tagName.toLowerCase(),attrs:t,...n===void 0?{}:{component:n},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(s=>{if(s.nodeType===Node.TEXT_NODE){let r=s.textContent??"";return r?[r]:[]}return s.nodeType===Node.ELEMENT_NODE?[Kt(s)]:[]})}},_t=new Map,Vt=(e,t)=>{let n=`${t.join(",")}|${e}`,s=_t.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
8
+ ); }`)}catch{s=null}_t.set(n,s)}return s},zn=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,Gn=100,fe=new Map,ot=new Set,Oe=0,Je=!1,Ye=new Set,Zn=()=>{Je=!1,!(Oe>0)&&(fe.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(ot.add(s),console.warn(`jq79: ${e} is not defined - evaluating "${t}". Template expressions resolve against the component store: a top-level let/var/const in a :setup script, a declared prop, or a global. Note a "function name() {}" declaration is not on the store - write "const name = () => {}".`))}),fe.clear())},Xt=()=>{Je||Oe>0||!fe.size||(Je=!0,queueMicrotask(Zn))},Jt=e=>{Oe++;let t=()=>{Oe--,Xt()};e.then(t,t)},Kn=(e,t)=>{if(Ye.has(e))return;Ye.add(e);let n=t?.message||String(t);console.error(`jq79: ${n} - evaluating "${e}". The expression rendered as nothing. If the value arrives later, guard it - "a?.b", or :if on the element.`)},Yt=(e,t,n)=>{if(!(n instanceof ReferenceError))return Kn(e,n);let s=zn.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let o=`${r}|${e}`;ot.has(o)||fe.has(o)||fe.size>=Gn||(fe.set(o,{name:r,expr:e,scope:t}),Xt())},Qt=(e,t,n)=>{let s=Vt(e,n?Object.keys(n):[]);if(s)return s(t,...n?Object.values(n):[])},M=(e,t,n)=>{try{return Qt(e,t,n)}catch(s){Yt(e,t,s);return}},en=(e,t,n)=>{try{return Qt(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;Yt(e,t,s);return}},Ge=/{{\s*([\s\S]+?)\s*}}/g,jt=new Map,tn=e=>{let t=jt.get(e);if(t)return t;let n=[],s=0;Ge.lastIndex=0;for(let r=Ge.exec(e);r;r=Ge.exec(e))r.index>s&&n.push(e.slice(s,r.index)),n.push({expr:r[1]}),s=r.index+r[0].length;return s<e.length&&n.push(e.slice(s)),jt.set(e,n),n},nn=(e,t)=>{if(e.length===1){let s=e[0];return typeof s=="string"?s:String(M(s.expr,t)??"")}let n="";for(let s of e)n+=typeof s=="string"?s:String(M(s.expr,t)??"");return n},Vn=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),ke=e=>Vn.has(e)||e.startsWith(":class.")||e.startsWith(":props.")||e===":slot"||e.startsWith(":slot."),Xn=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,sn=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o);e.addEventListener(r,a=>{if(i.has("self")&&a.target!==e)return;i.has("prevent")&&a.preventDefault(),i.has("stop")&&a.stopPropagation();let l=en(n,s,{$event:a});typeof l=="function"&&l.call(e,a)},{once:i.has("once"),capture:i.has("capture")})},Jn=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o),a=l=>{i.has("prevent")&&l.preventDefault(),i.has("stop")&&l.stopPropagation(),i.has("once")&&e.off(r,a),me(()=>{let p=en(n,s,{$event:l});typeof p=="function"&&p(l)})};e.on(r,a)},re=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),Qe=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),it=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},ve=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},Yn=e=>{e.forEach(t=>{if(t.first===t.last)return ve(t);if(!t.first.parentNode)return;let s=document.createRange();s.setStartBefore(t.first),s.setEndAfter(t.last),s.deleteContents()})},Qn=(e,t)=>{let n=[],s=null;return e.forEach(r=>{if(!t(r)){s=null;return}s&&s.last.nextSibling===r.range.first?s.last=r.range.last:n.push(s={first:r.range.first,last:r.range.last})}),n},es=({first:e,last:t},n)=>{let s=n.nextSibling;for(let r=e;r;){let o=r===t?null:r.nextSibling;n.parentNode.insertBefore(r,s),r=o}},Pt=(e,t)=>{let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s))for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r;return null},ue=null,_e=null,rn=new WeakSet,ts=e=>{let t={memo:ue,base:_e};return ue=new Map,_e=e,t},ns=e=>{ue=e.memo,_e=e.base},Ze=(e,t)=>{if(!ue)return Pt(e,t);let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s)){if(s===_e){if(ue.has(t))return ue.get(t);let r=Pt(s,t);return ue.set(t,r),r}if(!rn.has(s)){for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r}}return null},ss=e=>{let t=new Set;for(let n=e;n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let s of Object.keys(n))/^[A-Z]/.test(s)&&t.add(s);return[...t].sort()},rs=(e,t)=>{let n=ss(t);return new Error(`jq79: <${e}> is not defined - no component of that name is in scope, and nothing renders here. Import it in a :setup script, declare it as a prop, or add a <template name="${e}"> to this file. In scope: ${n.length?n.join(", "):"(none)"}.`)},kt=200,Ke=0,on=Symbol("jq79.slots"),an=e=>e==="slot"||e.startsWith("slot."),ln=e=>e?re(e):"default",at=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),os=e=>e==="default"?":slot":`:slot.${e}`,is=e=>typeof e!="string"||e.trim()!=="",as=e=>{let t={},n=[];e.children.forEach(r=>{let o=typeof r=="object"&&r.tag==="template"?at(r):void 0;if(typeof r=="string"||o===void 0){n.push(r);return}let i=ln(o.slice(6));if(i in t){console.warn(`jq79: two <template ${os(i)}> in <${e.tag}>; the second was ignored`);return}t[i]={nodes:r.children,binder:r.attrs[o]||void 0}});let s=n.some(is);return s&&"default"in t?console.warn(`jq79: <${e.tag}> has both a <template :slot> and content outside it - the <template> is the default slot's content, and the rest was ignored`):s&&(t.default={nodes:n,binder:e.attrs[":slot"]||void 0}),t},ls=(e,t,n)=>{Ne(t)?.forEach(({name:s,as:r,default:o})=>{let i=r??s;Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>{let a=n[s]?.();return a===void 0&&o!==void 0?M(o,e):a},set:()=>console.warn(`jq79: "${i}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},cs=e=>{let t=at(e);return console.warn(`jq79: <template ${t}> fills a slot only as a direct child of a component tag; here it rendered nothing`),document.createComment(`misplaced ${t}`)},us=(e,t)=>{let n=Object.entries(as(e));if(!n.length)return null;let s={};return n.forEach(([r,o])=>{s[r]=fs(o,t)}),s},fs=(e,t)=>(n,s,r,o)=>{let i=Object.create(t);ls(i,e.binder,n);let a=i[Ee]??[];Object.defineProperty(i,Ee,{value:[...a,s]});let l=ce(i);return r.onDispose(()=>l.dispose()),pe(e.nodes,i,l,o)},ds=(e,t,n,s)=>{let r=ln(e.tag.slice(5)),o=document.createDocumentFragment(),i=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);o.append(i,a);let l=t[on]?.[r];if(!l)return o.insertBefore(pe(e.children,t,n,s),a),o;let p={};return Object.entries(e.attrs).forEach(([d,b])=>{if(!(d===Le||ke(d)||d.startsWith("@")))if(d.startsWith(":")){let O=b||d.slice(1);p[re(d.slice(1))]=()=>M(O,t)}else p[re(d)]=()=>b}),o.insertBefore(l(p,t,n,s),a),o},vt=(e,t,n,s,r)=>{let o=document.createComment(e),i=document.createComment(`/${e}`),a=document.createDocumentFragment();a.append(o,i);let l=us(t,n),p={},d={},b=[],O=[],D=!1;Object.entries(t.attrs).forEach(([S,A])=>{if(S!==Le){if(S===":props"||S.startsWith(":props.")){D=!0,O.push({expr:A});return}if(!ke(S))if(S.startsWith("@"))b.push([S,A]);else if(S===":model"||S.startsWith(":model.")){let h=S===":model"?"default":re(S.slice(7));d[h]=A||(S===":model"?"model":h)}else if(S.startsWith(":")){let h=re(S.slice(1));p[h]=A||h,O.push({name:h,expr:A||h})}else{let h=re(S),T=JSON.stringify(A);p[h]=T,O.push({name:h,expr:T})}}});let I=S=>S==="default"?":model":`:model.${S}`,U=S=>S==="default"?"model":S,L=S=>`${S}
9
+ = $value`,F=new Set;Object.entries(d).forEach(([S,A])=>{let h=U(S);p[h]!==void 0&&console.warn(`jq79: <${t.tag}> binds prop "${h}" through both :${h} and ${I(S)} - ${I(S)} wins`),p[h]=A,Vt(L(A),["$value"])===null&&(F.add(S),console.warn(`jq79: ${I(S)}="${A}" is not assignable - updates from <${t.tag}> will be dropped`))});let N=()=>{let S={};return O.forEach(({name:A,expr:h})=>{if(A!==void 0)S[A]=M(h,n);else{let T=M(h,n);T!==null&&typeof T=="object"&&Object.assign(S,T)}}),Object.entries(d).forEach(([A,h])=>{S[U(A)]=M(h,n)}),S},j=null,P=null,q=null,V=new Set,Y=S=>{if(S==null){if(!n[En]?.has(e)||V.has("unfilled"))return;V.add("unfilled"),console.error(`jq79: <${t.tag}> is declared as a prop and the parent passed nothing - nothing renders here. Pass it (:${e}="\u2026"), or drop it from the signature to use the one declared in this file.`);return}V.has("type")||(V.add("type"),console.error(`jq79: <${t.tag}> is ${typeof S}, not a component - nothing renders here`))};return s.effect(()=>{let S=M(e,n),A=S instanceof oe?S:null;if(A||Y(S),A===P||(q?.dispose(),q=null,j?.destroy(),j=null,P=A,!A))return;let h=new oe({template:A.template,scripts:A.scripts,styles:A.styles,modules:A.modules,filename:A.filename,siblings:A.siblings,name:A.name});if(l&&(h.slots=l),Object.keys(d).length){let K=new Set;h.modelWriteback=(w,W)=>{let k=w==null?"default":re(String(w)),z=d[k];return z===void 0?(K.has(k)||(K.add(k),console.warn(`jq79: <${t.tag}> has no ${I(k)} - bound: ${Object.keys(d).map(I).join(", ")}`)),!1):F.has(k)?!1:(me(()=>M(L(z),n,{$value:W})),!0)}}b.forEach(([K,w])=>Jn(h,K,w,n));let T=Qs(h.scripts);er(t,e,Object.keys(p),T);let _=Bt(me(N),T),B=document.createDocumentFragment();if(Ke>=kt){console.error(`jq79: <${t.tag}> is ${kt} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}Ke++;try{(r?h.renderShadow(_):h.render(_)).mount(B)}finally{Ke--}i.parentNode.insertBefore(B,i);let H=ce(n,!0);if(D){let K=[];H.effect(()=>{let w=Bt(N(),T),W=Object.keys(w);K.forEach(k=>{k in w||(h.data[k]=void 0)}),W.forEach(k=>{h.data[k]=w[k]}),K=W})}else Object.entries(p).forEach(([K,w])=>{T!==null&&!T.has(K)||H.effect(()=>{h.data[K]=M(w,n)})});q=H,j=h}),s.onDispose(()=>{q?.dispose(),j?.destroy()}),a},ps=(e,t)=>{let n=()=>{let s=M(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let o=n();return o!==null&&Reflect.has(o,r)||Reflect.has(s,r)},get(s,r){let o=n();return o!==null&&Reflect.has(o,r)?o[r]:Reflect.get(s,r)},set(s,r,o){let i=n();return i!==null&&Reflect.has(i,r)?(i[r]=o,!0):Reflect.set(s,r,o)}})},ae=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(ae):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?ae(t):[]):[],hs=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?ht(e):()=>!1,gs=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]),et=(e,t,n)=>{let s=gs.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},Ae={cloneSkeletons:!0},ms=e=>e.startsWith("@")||e===":class"||e.startsWith(":class.")?!0:e.startsWith(":")?!ke(e)&&!e.includes("."):e!==je,cn=e=>{if(e.component||e.tag.includes("-")||an(e.tag)||e.tag==="template"||document.createElement(e.tag)instanceof HTMLUnknownElement)return!1;for(let t in e.attrs)if(!ms(t))return!1;return e.children.every(t=>typeof t=="string"||cn(t))},un=(e,t,n,s)=>{s.add(e.tag);let r=document.createElement(e.tag),o,i=null;for(let a in e.attrs){let l=e.attrs[a];if(a.startsWith("@"))n.push({kind:"event",path:t,attr:a,expr:l});else if(a===":class")o=l;else if(a.startsWith(":class."))(i??(i=[])).push([a.slice(7),l]);else if(a.startsWith(":")){let p=a.slice(1);n.push({kind:"attr",path:t,name:p,expr:l||re(p)})}else r.setAttribute(a,l)}return(o!==void 0||i)&&n.push({kind:"class",path:t,classExpr:o,toggles:i,staticClasses:new Set(ae(e.attrs.class??""))}),e.children.forEach((a,l)=>{if(typeof a=="string"){a.includes("{{")?(n.push({kind:"text",path:[...t,l],parts:tn(a)}),r.appendChild(document.createTextNode(""))):r.appendChild(document.createTextNode(a));return}r.appendChild(un(a,[...t,l],n,s))}),r},ys=3,fn=e=>1+e.children.reduce((t,n)=>t+(typeof n=="string"?0:fn(n)),0),Lt=new WeakMap,bs=e=>{let t=Lt.get(e);if(t!==void 0)return t;let n=null;if(cn(e)&&fn(e)>=ys){let s=[],r=new Set;n={skeleton:un(e,[],s,r),ops:s,tags:Array.from(r)}}return Lt.set(e,n),n},Es=(e,t)=>{let n=e;for(let s=0;s<t.length;s++)n=n.childNodes[t[s]];return n},Ss=(e,t,n)=>{let s=e.skeleton.cloneNode(!0);for(let r of e.ops){let o=r.path.length===0?s:Es(s,r.path);if(r.kind==="text"){let i=o,a=r.parts;n.effect(()=>{let l=nn(a,t);i.textContent!==l&&(i.textContent=l)})}else if(r.kind==="event")sn(o,r.attr,r.expr,t);else if(r.kind==="attr"){let i=o,{name:a,expr:l}=r;n.effect(()=>et(i,a,M(l,t)))}else{let i=o,{classExpr:a,toggles:l,staticClasses:p}=r,d=[];n.effect(()=>{let b=a!==void 0?ae(M(a,t)):[];l?.forEach(([O,D])=>{M(D,t)&&b.push(...ae(O))}),d.forEach(O=>{!b.includes(O)&&!p.has(O)&&i.classList.remove(O)}),i.classList.add(...b),d=b})}}return s},lt=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?ps(r,t):t;if(an(e.tag))return ds(e,o,n,s);if(e.tag==="template"&&at(e)!==void 0)return cs(e);let i=Ze(o,e.tag);if(i)return vt(i,e,o,n,s);if(Ae.cloneSkeletons){let N=bs(e);if(N&&!N.tags.some(j=>Ze(o,j)))return Ss(N,o,n)}let a=document.createElement(e.tag);if(e.component&&a instanceof HTMLUnknownElement&&o[nt]?.count===0)throw rs(e.component,o);let l=a instanceof HTMLUnknownElement||e.tag.includes("-");if(l){let N=!1;n.effect(()=>{if(N)return;let j=Ze(o,e.tag);if(!j)return;N=!0;let P=vt(j,e,o,n,s),q=it(P);n.onDispose(()=>ve(q)),a.replaceWith(P)})}for(let N in e.attrs){let j=e.attrs[N];if(N.startsWith("@"))sn(a,N,j,o);else if(N===":model"||N.startsWith(":model."))l||console.warn(`jq79: ${N} on <${e.tag}> does nothing - :model binds component tags only (for now)`);else if(!ke(N))if(N.startsWith(":"))if(l)a.setAttribute(N,j);else{let P=N.slice(1),q=j||re(P);n.effect(()=>et(a,P,M(q,o)))}else a.setAttribute(N,j)}let p=e.attrs[":attrs"];if(p!==void 0){let N=[];n.effect(()=>{N.forEach(P=>a.removeAttribute(P));let j=M(p,o);N=j&&typeof j=="object"?Object.keys(j):[],N.forEach(P=>et(a,P,j[P]))})}let d=e.attrs[":class"],b=null;for(let N in e.attrs)N.startsWith(":class.")&&(b??(b=[])).push([N.slice(7),e.attrs[N]]);if(d!==void 0||b){let N=new Set(ae(e.attrs.class??"")),j=[];n.effect(()=>{let P=d!==void 0?ae(M(d,o)):[];b?.forEach(([q,V])=>{M(V,o)&&P.push(...ae(q))}),j.forEach(q=>{!P.includes(q)&&!N.has(q)&&a.classList.remove(q)}),a.classList.add(...P),j=P})}let O=e.attrs[":text"],D=e.attrs[":html"],I=e.attrs[":html.allowed"];I!==void 0&&D===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),O!==void 0?n.effect(()=>{a.textContent=String(M(O,o)??"")}):D!==void 0?n.effect(()=>{let N=I!==void 0?{allowUrl:hs(M(I,o))}:void 0;a.innerHTML=mt(String(M(D,o)??""),N)}):a instanceof HTMLTemplateElement?pe(e.children,o,n,s,a.content):pe(e.children,o,n,s,a);let U=e.attrs[":value"];U!==void 0&&n.effect(()=>{let N=String(M(U,o)??"");a.value!==N&&(a.value=N)});let L=e.attrs[":checked"];L!==void 0&&n.effect(()=>{a.checked=!!M(L,o)});let F=e.attrs[":selected"];return F!==void 0&&n.effect(()=>{a.selected=!!M(F,o)}),a},ws=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,a=null,l=null;return n.effect(()=>{let p=e.find(b=>b.expr===void 0||M(b.expr,t))??null;if(p===a||(l?.dispose(),i&&ve(i),i=null,a=p,!p))return;l=ce(t);let d=lt(p.node,t,l,s);i=it(d),r.parentNode.insertBefore(d,r.nextSibling)}),o},he=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},Rs=e=>{let t=new Uint8Array(e.length),n=[],s=new Int32Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let o=e[r];if(o<0)continue;let i=0,a=n.length;for(;i<a;){let l=i+a>>1;e[n[l]]<o?i=l+1:a=l}i>0&&(s[r]=n[i-1]),n[i]=r}for(let r=n.length?n[n.length-1]:-1;r!==-1;r=s[r])t[r]=1;return t},$s=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},dn=(e,t)=>typeof e=="string"?t.some(n=>Dt(e,n)):Object.values(e.attrs).some(n=>t.some(s=>Dt(n,s)))||e.children.some(n=>dn(n,t)),Mt=/[A-Za-z0-9_$]/,Ts=/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/,Dt=(e,t)=>{for(let n=e.indexOf(t);n!==-1;n=e.indexOf(t,n+1)){let s=n===0?"":e[n-1],r=e[n+t.length]??"";if(!Mt.test(s)&&!Mt.test(r))return!0}return!1},Ve=new WeakMap,xs=e=>{let t=Ve.get(e);if(t!==void 0)return t;let n=e.attrs[":each"].match(Xn);if(!n)return Ve.set(e,null),null;let[,s,r,o]=n,i=e.attrs[":key"],a=i===s,l=i!==void 0&&!a&&Ts.test(i)&&i.startsWith(`${s}.`)?i.slice(s.length+1):void 0,{[":each"]:p,[":key"]:d,...b}=e.attrs,O={...e,attrs:b},D=["$index",...r?[r]:[]],I=dn(O,D),U=/^[A-Z]/.test(s)||r!==void 0&&/^[A-Z]/.test(r),L={itemName:s,atName:r,listExpr:o,keyExpr:i,keyIsItem:a,keyProp:l,itemNode:O,readsPosition:I,namesComponent:U};return Ve.set(e,L),L},Ns=(e,t,n,s)=>{let r=xs(e);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let{itemName:o,atName:i,listExpr:a,keyExpr:l,keyIsItem:p,keyProp:d,itemNode:b,readsPosition:O,namesComponent:D}=r,I=document.createComment("each"),U=document.createDocumentFragment();U.appendChild(I),(":if"in e.attrs||":elseif"in e.attrs||":else"in e.attrs)&&console.warn("jq79: :if/:elseif/:else on a :each element is ignored; filter the list expression instead");let L=[],F=!1;return n.effect(()=>{let N=ts(t);try{let j=M(a,t),P=Array.isArray(j),q=P?null:$s(j)?Object.keys(j):[],V=P?j.length:q.length,Y=new Map;L.forEach((w,W)=>{w.pos=W;let k=Y.get(w.key);k?k.push(w):Y.set(w.key,[w])});let S=new Set,A=[],h=[],T=[],_;for(let w=0;w<V;w++){let W=P?w:q[w],k=P?j[w]:j[W],z=W;p?z=k:d!==void 0&&k!==null&&typeof k=="object"?z=k[d]:l!==void 0&&(_===void 0?(_=Object.create(t),he(_,o,k),i&&he(_,i,W),he(_,"$index",w)):(_[o]=k,i&&(_[i]=W),_.$index=w),z=M(l,_)),S.has(z)&&!F&&(F=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),S.add(z);let G=Y.get(z)?.shift();if(G&&Object.is(G.item,k)){let f=G.scope;f.$index!==w&&(O&&A.push(G),f.$index=w),i&&f[i]!==W&&(f[i]=W),h.push(G),T.push(G.pos);continue}G&&(G.fx.dispose(),ve(G.range));let c=Object.create(t);he(c,o,k),i&&he(c,i,W),he(c,"$index",w),D||rn.add(c);let u=ce(t),g=it(lt(b,c,u,s));h.push({key:z,item:k,scope:c,fx:u,range:g,pos:w}),T.push(-1)}let B=new Set;Y.forEach(w=>w.forEach(W=>B.add(W))),B.size&&(B.forEach(w=>{w.dead=!0,w.fx.dispose()}),Yn(Qn(L,w=>w.dead===!0)));let H=I,K=Rs(T);h.forEach((w,W)=>{!K[W]&&H.nextSibling!==w.range.first&&es(w.range,H),H=w.range.last}),A.forEach(w=>me(()=>w.fx.refresh())),L=h}finally{ns(N)}}),U},pn=(e,t)=>{let n=t;for(;n<e.length&&typeof e[n]=="string"&&!e[n].trim();)n++;return n},Xe=e=>{let t=":if"in e.attrs,n=":elseif"in e.attrs,s=":else"in e.attrs;if((t?1:0)+(n?1:0)+(s?1:0)<2)return;let r=[t?":if":null,n?":elseif":null,s?":else":null].filter(Boolean);console.warn(`jq79: ${r.join(" and ")} on the same <${e.tag}> - only ${r[0]} applies; the branches of a chain are sibling elements, one directive each`)},Cs=(e,t)=>{let n=":elseif"in e.attrs?":elseif":":else";console.warn(t?`jq79: a second ${n} on <${e.tag}> - the chain before it already ended with :else, which closes it. One :if, any number of :elseif, at most one :else`:`jq79: ${n} on <${e.tag}> continues no :if - it renders unconditionally. A chain is :if, then :elseif, then :else, on adjacent siblings: anything but whitespace between them breaks it`)},hn=e=>{e.forEach(n=>{typeof n!="string"&&hn(n.children)});let t=!1;for(let n=0;n<e.length;){let s=e[n];if(typeof s=="string"){s.trim()&&(t=!1),n++;continue}if(":each"in s.attrs){t=!1,n++;continue}if(Xe(s),":if"in s.attrs){n++;let r=i=>{let a=pn(e,n),l=e[a];if(typeof l=="object"&&i in l.attrs)return n=a+1,l};for(let i=r(":elseif");i;i=r(":elseif"))Xe(i);let o=r(":else");o&&Xe(o),t=o!==void 0;continue}(":elseif"in s.attrs||":else"in s.attrs)&&Cs(s,t),t=!1,n++}},It=new WeakMap,As=(e,t,n)=>{let s=It.get(t);if(s)return s;let r=[{expr:t.attrs[":if"],node:t}],o=n+1,i=p=>{let d=pn(e,o),b=e[d];if(typeof b=="object"&&p in b.attrs)return o=d+1,b};for(let p=i(":elseif");p;p=i(":elseif"))r.push({expr:p.attrs[":elseif"],node:p});let a=i(":else");a&&r.push({node:a});let l={branches:r,next:o};return It.set(t,l),l},pe=(e,t,n,s=!1,r)=>{let o=r??document.createDocumentFragment(),i=0;for(;i<e.length;){let a=e[i];if(typeof a=="string"){let l=document.createTextNode(a);if(a.includes("{{")){let p=tn(a);n.effect(()=>{let d=nn(p,t);l.textContent!==d&&(l.textContent=d)})}o.appendChild(l),i++;continue}if(":each"in a.attrs){o.appendChild(Ns(a,t,n,s)),i++;continue}if(":if"in a.attrs){let l=As(e,a,i);o.appendChild(ws(l.branches,t,n,s)),i=l.next;continue}o.appendChild(lt(a,t,n,s)),i++}return o},br=(e,t,n=!1)=>pe(e.template,t,ce(t),n),Os=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_s=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,ct=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,js=e=>e.split(ct).map((t,n)=>n%2===1?t:t.replace(_s,(s,r,o)=>Os.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),gn=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,Ps=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,ks=e=>e.split(ct).map((t,n)=>n%2===1?t:t.replace(gn,(s,r,o)=>{let i=0,a=o.replace(Ps,(l,p,d)=>d===void 0?l:`${p}:props.${i++}="${d}"`);return`<${r}${a}>`})).join(""),vs=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,Ls=/<\/slot\.([\w.$-]+)(\s*)>/gi,Ms=/^slot\./i,Ds=e=>Ms.test(e)?`slot.${Qe(e.slice(5))}`:e,je=":jq79-component",Is=/^[A-Z]/,qs=/\/\s*$/,Ws=(e,t)=>{if(!Is.test(e))return t;let n=` ${je}="${e}"`,s=qs.exec(t);return s?`${t.slice(0,s.index)}${n}${s[0]}`:`${t}${n}`},Us=e=>e.split(ct).map((t,n)=>n%2===1?t:t.replace(gn,(s,r,o)=>{let i=o.replace(vs,(a,l,p)=>p===void 0?a:`${l}${Qe(p)}`);return`<${Ds(r)}${Ws(r,i)}>`}).replace(Ls,(s,r,o)=>`</slot.${Qe(r)}${o}>`)).join(""),Le="data-jq79",Fs=e=>{let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0).toString(36)},mn=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[Le]=t,mn(n.children,t))})},Bs=(e,t)=>e.split(",").map(n=>{let s=n.trim(),r=s.indexOf("::"),o=r===-1?s:s.slice(0,r),i=r===-1?"":s.slice(r);return`${o}[${Le}="${t}"]${i}`}).join(", "),yn=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=Bs(n.selectorText,t):n instanceof CSSGroupingRule&&yn(n.cssRules,t)})},Hs=(e,t)=>{/:deep\(|::v-deep|>>>/.test(e)&&console.warn("jq79: :deep()/::v-deep/>>> are not supported in <style scoped>; the rule will be dropped by the browser");let n=new CSSStyleSheet;return n.replaceSync(e),yn(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
10
+ `)},zs=/^[A-Z][A-Za-z0-9]*$/,tt=e=>{let t=js(ks(Us(e))),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],o=[];Array.from(s.content.children).forEach(l=>{l.tagName==="TEMPLATE"?o.push(l):r.push(l)});let i=qt(r,e),a={};return o.forEach(l=>{let p=l.getAttribute("name");if(p===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!zs.test(p)){console.warn(`jq79: <template name="${p}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(p in a){console.warn(`jq79: two <template name="${p}"> in one file; the second was ignored`);return}a[p]=new oe({...qt(Array.from(l.content.children),l.innerHTML),siblings:a,name:p})}),Object.keys(a).length&&(i.siblings=a),i},qt=(e,t)=>{let n=[],s=[],r=[];e.forEach(i=>{let a={attrs:Zt(i),content:i.textContent??""};i.tagName==="SCRIPT"?n.push(a):i.tagName==="STYLE"?s.push(a):r.push(Kt(i))}),s.forEach(i=>{"lang"in i.attrs&&console.warn(`jq79: <style lang="${i.attrs.lang}"> needs the jq79/vite plugin to compile it. This component didn't go through the bundler, so its styles were left uncompiled and the browser will ignore them.`)});let o=i=>"scoped"in i.attrs&&!("lang"in i.attrs);if(s.some(o)){let i=Fs(t);mn(r,i),s.forEach(a=>{o(a)&&(a.scoped=Hs(a.content,i))})}return hn(r),{template:r,scripts:n,styles:s}},ut=e=>/\.html?([?#]|$)/.test(e)?st(e):import(e),Gs=/^(?:\.\.?\/|\/|[a-z][a-z0-9+.-]*:)/i,Zs=(e,t)=>{if(!Gs.test(e))return e;try{return new URL(e,new URL(t??"",document.baseURI)).href}catch{return e}},bn=(e,t)=>e?`
11
+ //# sourceURL=${e}?jq79-script=${t}`:"",Wt=e=>e.scoped??e.content,Pe=new Map,Ks=e=>{let t=Pe.get(e);if(!t){let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0},Pe.set(e,t)}t.count++},Vs=e=>{let t=Pe.get(e);t&&--t.count<=0&&(t.el.remove(),Pe.delete(e))},Xs=(e,t,n,s={},r=ut,o={})=>{let i={...Sn,...s},a=new Proxy(t,{has:(d,b)=>b!=="$__effect"&&b!=="$__import"&&b!=="$__state"&&(Reflect.has(d,b)||!(b in globalThis)&&!(b in i))}),l={},p=new Function("$scope","$__effect","$__import","$__state",...Object.keys(i),`return (async () => { with ($scope) { ${e} }
12
+ ;$__state.done = true })()${bn(o.filename,o.index??0)}`)(a,n,r,l,...Object.values(i));return p.catch(d=>console.error("jq79: error in :setup script",d)),Jt(p),{settled:p,sync:l.done===!0}},Ut=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:M(s,e))})},ft=e=>{let t=e.attrs[":setup"];if(t===void 0)return null;if(t.trim()==="")return[];let n=Ne(t);return n||Js(e,t),n},Ft=new WeakSet,Js=(e,t)=>{t.trim()==="_"||Ft.has(e)||(Ft.add(e),console.warn(`jq79: :setup="${t}" is not a props pattern, so this component declares no signature and takes whatever a parent passes - write the props it takes ("{ a, b }"), a bare :setup for none, or "_" to stay open on purpose`))},Ys=e=>{let t=new Set;return e.forEach(n=>{(Ce(n.content)??ft(n))?.forEach(({name:r})=>t.add(r))}),t},Qs=e=>{let t=null;return e.forEach(n=>{let s=Ce(n.content)??ft(n);if(!s)return;let r=t??(t=new Set);s.forEach(({name:o})=>r.add(o))}),t},Bt=(e,t)=>{if(t===null)return e;let n={};return Object.keys(e).forEach(s=>{t.has(s)&&(n[s]=e[s])}),n},Ht=new WeakMap,er=(e,t,n,s)=>{if(s===null)return;let r=Ht.get(e)??new Set;Ht.set(e,r),n.forEach(o=>{s.has(o)||r.has(o)||(r.add(o),console.warn(`jq79: :${o} is not declared by <${t}> - add it to the :setup signature, or drop it`))})},tr=(e,t)=>{if(!e)return null;let n=Object.create(null),s=!1;return Object.entries(e).forEach(([r,o])=>{t.has(r)||(n[r]=o,s=!0)}),s?n:null},En=Symbol("jq79.unfilledProps"),nt=Symbol("jq79.pendingScripts"),nr=e=>e&&e.default!==void 0?e.default:e,sr=(e,t,n,s={},r=ut,o={})=>{let i={...Sn,...s},a={},l=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
13
13
  ${e}
14
- ;$__exports.done = true })()${Vt(o.filename,o.index??0)}`)(a,Cs,r,...Object.values(i)),g=k=>console.error("jq79: error in factory script",k),h=!1,w,_=()=>{if(h)return w;h=!0;let k=a.default;if(typeof k!="function")return;let U=b=>{b&&typeof b=="object"&&Object.assign(t,b)};try{let b=k(t,{$data:t,$props:t,$effect:n,...s});b instanceof Promise?w=b.then(U).catch(g):U(b)}catch(b){g(b)}return w},P=d.then(_,g);return qt(P),a.done&&_(),{settled:P,sync:a.done===!0&&w===void 0}},Os="__JQ79_HMR_ENABLED__",Ps="__JQ79_HMR__",le=null,vs=e=>{if(!le||!e.filename)return;let t=le.get(e.filename);t||le.set(e.filename,t=new Set),t.add(new WeakRef(e))},vt=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},Ls=(e,t)=>{if(!le)return 0;let n=vt(e),s=ze(t),r=!1,o=a=>a.name===void 0?s:s.siblings?.[a.name]??null,i=0;for(let[a,d]of le)if(vt(a)===n){for(let g of d){let h=g.deref();if(!h){d.delete(g);continue}let w=o(h);if(!w){r=!0;continue}h.hotReplace(w)&&i++}d.size||le.delete(a)}return r?0:i},Ms=()=>{le??(le=new Map),globalThis[Ps]={update:Ls}},Lt=3e3,Ds=(e,t)=>{let n=setTimeout(()=>{console.warn(`jq79: ${e.name?`<${e.name}>`:"a component"}${e.filename?` (${e.filename})`:""} has been waiting ${Lt/1e3}s for a :setup script and has rendered nothing. The template waits until every script returns or calls $mounted() - add an await $mounted() above the slow part to render first and fill in after.`)},Lt);n?.unref?.(),Promise.all(t).then(()=>clearTimeout(n))},Ge=async e=>{let t=await fetch(e);if(!t.ok)throw new Error(`failed to fetch component from ${e}: ${t.status}`);return new te(await t.text(),{filename:e})},te=class{constructor(t,n={}){L(this,"template");L(this,"scripts");L(this,"styles");L(this,"modules");L(this,"filename");L(this,"siblings");L(this,"name");L(this,"slots");L(this,"modelWriteback");L(this,"data",null);L(this,"fx",null);L(this,"content",null);L(this,"startMarker",null);L(this,"endMarker",null);L(this,"styleEls",[]);L(this,"ownsSharedStyles",!1);L(this,"useShadow",!1);L(this,"mountRoot",null);L(this,"resolveMounted",null);L(this,"renderDone",!1);L(this,"emitListeners",new Map);let s=typeof t=="string"?ze(t):t;this.template=s.template,this.scripts=s.scripts,this.styles=s.styles,this.modules=n.modules??(typeof t=="string"?void 0:t.modules),this.filename=n.filename??(typeof t=="string"?void 0:t.filename),this.siblings=s.siblings,this.name=s.name,this.adoptSiblings(),vs(this)}adoptSiblings(){this.siblings&&Object.entries(this.siblings).forEach(([t,n])=>{n.filename??(n.filename=this.filename),n.modules??(n.modules=this.modules),this.name||(this[t]=n)})}hotReplace(t){let n=typeof t=="string"?ze(t):t;Ke.clear(),ae.clear(),We.clear();let s=this.startMarker,r=!!(s&&this.content),o=r&&s.isConnected,i=o?s.parentNode:null,a=o?this.endMarker.nextSibling:null,d={...this.data},g=this.useShadow;return r&&this.destroy(),this.template=n.template,this.scripts=n.scripts,this.styles=n.styles,this.siblings=n.siblings,this.adoptSiblings(),!r||(this.renderWith(d,g),!i)?!1:(g&&this.styleEls.forEach(h=>i.insertBefore(h,a)),i.insertBefore(this.content,a),this.mountRoot=i,this.settleMounted(),!0)}static fetch(t){if(Array.isArray(t))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new Ze(Ge(t))}static fetchAll(t){return Promise.all(t.map(Ge))}on(t,n){return this.emitListeners.has(t)||this.emitListeners.set(t,new Set),this.emitListeners.get(t).add(n),this}off(t,n){return this.emitListeners.get(t)?.delete(n),this}render(t={}){return this.renderWith(t,!1)}renderShadow(t={}){return this.renderWith(t,!0)}renderWith(t,n){this.destroy();let s=xs(this.scripts),r=_s(this.siblings,s),o=r?Object.assign(Object.create(r),t):{...t},i=new Set([...s].filter(p=>!(p in t)));i.size&&Object.defineProperty(o,Jt,{value:i}),this.slots&&Object.defineProperty(o,Bt,{value:this.slots}),Object.defineProperty(o,He,{value:{count:0}});let a=ye(o),d=oe(a);this.data=a,this.fx=d,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let g=this.startMarker,h=!1,w=(p,$)=>{p==="model:update"&&!h&&(h=!0,console.warn("jq79: $emit('model:update', \u2026) no longer feeds :model - call $updateModel(value) or $updateModel(name, value) instead"));let O=new CustomEvent(p,{detail:$,bubbles:!0,composed:!0,cancelable:!0});return g===this.startMarker&&this.emitListeners.get(p)?.forEach(z=>z(O,$)),O.cancelBubble||g.dispatchEvent(O),!O.defaultPrevented},_,P=new Promise(p=>{_=p});this.resolveMounted=_,this.renderDone=!1;let k=this.endMarker,U=p=>{let $=[];for(let O=g.nextSibling;O&&O!==k;O=O.nextSibling)O instanceof Element&&(O.matches(p)&&$.push(O),$.push(...Array.from(O.querySelectorAll(p))));return $},b=p=>U(p)[0]??null,C=this.modules,j=p=>C&&p in C?Promise.resolve(C[p]):et(ws(p,this.filename)),B=Object.assign(Object.create(null),{$emit:w,$updateModel:(...p)=>{let[$,O]=p.length>1?p:[void 0,p[0]];return g!==this.startMarker?!1:this.modelWriteback?.($,O)??!1},$slots:Object.fromEntries(Object.keys(this.slots??{}).map(p=>[p,!0]))}),K=p=>`await $mounted();${p}`,q=[],W=!0;this.scripts.forEach((p,$)=>{let O;q.push(new Promise(u=>{O=u}));let z=!1,H=()=>{z=!0,O()},I={$mounted:()=>(H(),P),$self:b,$$self:U,...B,...r},G={filename:this.filename,index:$},c=":mounted"in p.attrs,l=Et(p.content),f=(()=>{if(l!==null){c&&console.warn("jq79: :mounted on a factory script renders the template before the factory has returned, so none of its bindings exist yet - await $mounted() inside the factory instead."),Ct(a,Te(p.content));let m=c?K(l):l;return js(m,a,d.effect,I,j,G)}let{vars:u,code:y}=Re(p.content);Ct(a,tt(p)),u.forEach(m=>{m in a||(a[m]=void 0)});let E=c?K(y):y;return $s(E,a,d.effect,I,j,G)})();if(f.sync)f.settled.then(H,H);else{let u=o[He];u.count++;let y=()=>{u.count--,H()};f.settled.then(y,y)}!f.sync&&!z&&(W=!1)});let S=document.createDocumentFragment(),x=new Proxy(a,{has:(p,$)=>typeof $=="string"&&$ in B||Reflect.has(p,$),get:(p,$,O)=>typeof $=="string"&&$ in B&&!Reflect.has(p,$)?B[$]:Reflect.get(p,$,O)});return S.append(this.startMarker,this.endMarker),this.content=S,W?(this.endMarker.parentNode.insertBefore(ce(this.template,x,d,n),this.endMarker),this.renderDone=!0,this.settleMounted()):(Promise.all(q).then(()=>{g===this.startMarker&&(this.endMarker.parentNode.insertBefore(ce(this.template,x,d,n),this.endMarker),this.renderDone=!0,this.settleMounted())}),Ds(this,q)),n?this.styleEls=this.styles.map(p=>{let $=document.createElement("style");return $.textContent=p.content,$}):(this.styles.forEach(p=>Ss(_t(p))),this.ownsSharedStyles=!0),this}mount(t,n){let s=typeof t=="string"?ue(t):t;if(!s)throw new Error(`mount target not found: ${t}`);return(!this.content||n!==void 0)&&this.renderWith(n??{},this.useShadow),this.attach(s)}mountShadow(t,n){let s=typeof t=="string"?ue(t):t;if(!s)throw new Error(`mount target not found: ${t}`);return(!this.content||n!==void 0||!this.useShadow)&&this.renderWith(n??{},!0),this.attach(s)}attach(t){this.mountRoot&&this.detach();let n=this.useShadow&&t instanceof Element?t.shadowRoot??t.attachShadow({mode:"open"}):t;return this.useShadow&&this.styleEls.forEach(s=>n.appendChild(s)),n.appendChild(this.content),this.mountRoot=n,this.settleMounted(),this}settleMounted(){this.renderDone&&this.mountRoot&&this.resolveMounted?.()}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let t=this.startMarker;for(;t;){let n=t.nextSibling;if(this.content.appendChild(t),t===this.endMarker)break;t=n}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.data?.$dispose(),this.styleEls.forEach(t=>t.parentNode?.removeChild(t)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(t=>Rs(_t(t))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.renderDone=!1,this.data=null,this.resolveMounted=null,this}};L(te,"version",Rn);var Ze=class{constructor(t){L(this,"chain");this.chain=t}queue(t){return this.chain=this.chain.then(n=>(t(n),n)),this}then(t,n){return this.chain.then(t,n)}catch(t){return this.chain.catch(t)}finally(t){return this.chain.finally(t)}mount(t,n){return this.queue(s=>s.mount(t,n))}mountShadow(t,n){return this.queue(s=>s.mountShadow(t,n))}render(t={}){return this.queue(n=>n.render(t))}renderShadow(t={}){return this.queue(n=>n.renderShadow(t))}on(t,n){return this.queue(s=>s.on(t,n))}off(t,n){return this.queue(s=>s.off(t,n))}detach(){return this.queue(t=>t.detach())}destroy(){return this.queue(t=>t.destroy())}};var Hs=e=>new te(e),Xt={$:ue,$$:je,$create:Oe,$reactive:ye,$toRaw:Z,Component79:te};typeof globalThis<"u"&&globalThis[Os]&&Ms();export{ue as $,je as $$,Oe as $create,ye as $reactive,Z as $toRaw,te as C79,te as Component79,Ze as PendingComponent79,Ms as enableHotReload,Ls as hotUpdate,Hs as parseComponent,zs as renderComponent};
14
+ ;$__exports.done = true })()${bn(o.filename,o.index??0)}`)(a,nr,r,...Object.values(i)),p=I=>console.error("jq79: error in factory script",I),d=!1,b,O=()=>{if(d)return b;d=!0;let I=a.default;if(typeof I!="function")return;let U=L=>{L&&typeof L=="object"&&Object.assign(t,L)};try{let L=I(t,{$data:t,$props:t,$effect:n,...s});L instanceof Promise?b=L.then(U).catch(p):U(L)}catch(L){p(L)}return b},D=l.then(O,p);return Jt(D),a.done&&O(),{settled:D,sync:a.done===!0&&b===void 0}},rr="__JQ79_HMR_ENABLED__",or="__JQ79_HMR__",de=null,ir=e=>{if(!de||!e.filename)return;let t=de.get(e.filename);t||de.set(e.filename,t=new Set),t.add(new WeakRef(e))},zt=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},ar=(e,t)=>{if(!de)return 0;let n=zt(e),s=tt(t),r=!1,o=a=>a.name===void 0?s:s.siblings?.[a.name]??null,i=0;for(let[a,l]of de)if(zt(a)===n){for(let p of l){let d=p.deref();if(!d){l.delete(p);continue}let b=o(d);if(!b){r=!0;continue}d.hotReplace(b)&&i++}l.size||de.delete(a)}return r?0:i},lr=()=>{de??(de=new Map),globalThis[or]={update:ar}},Gt=3e3,cr=(e,t)=>{let n=setTimeout(()=>{console.warn(`jq79: ${e.name?`<${e.name}>`:"a component"}${e.filename?` (${e.filename})`:""} has been waiting ${Gt/1e3}s for a :setup script and has rendered nothing. The template waits until every script returns or calls $mounted() - add an await $mounted() above the slow part to render first and fill in after.`)},Gt);n?.unref?.(),Promise.all(t).then(()=>clearTimeout(n))},st=async e=>{let t=await fetch(e);if(!t.ok)throw new Error(`failed to fetch component from ${e}: ${t.status}`);return new oe(await t.text(),{filename:e})},oe=class{constructor(t,n={}){v(this,"template");v(this,"scripts");v(this,"styles");v(this,"modules");v(this,"filename");v(this,"siblings");v(this,"name");v(this,"slots");v(this,"modelWriteback");v(this,"data",null);v(this,"fx",null);v(this,"content",null);v(this,"startMarker",null);v(this,"endMarker",null);v(this,"styleEls",[]);v(this,"ownsSharedStyles",!1);v(this,"useShadow",!1);v(this,"mountRoot",null);v(this,"resolveMounted",null);v(this,"renderDone",!1);v(this,"emitListeners",new Map);let s=typeof t=="string"?tt(t):t;this.template=s.template,this.scripts=s.scripts,this.styles=s.styles,this.modules=n.modules??(typeof t=="string"?void 0:t.modules),this.filename=n.filename??(typeof t=="string"?void 0:t.filename),this.siblings=s.siblings,this.name=s.name,this.adoptSiblings(),ir(this)}adoptSiblings(){this.siblings&&Object.entries(this.siblings).forEach(([t,n])=>{n.filename??(n.filename=this.filename),n.modules??(n.modules=this.modules),this.name||(this[t]=n)})}hotReplace(t){let n=typeof t=="string"?tt(t):t;ot.clear(),fe.clear(),Ye.clear();let s=this.startMarker,r=!!(s&&this.content),o=r&&s.isConnected,i=o?s.parentNode:null,a=o?this.endMarker.nextSibling:null,l={...this.data},p=this.useShadow;return r&&this.destroy(),this.template=n.template,this.scripts=n.scripts,this.styles=n.styles,this.siblings=n.siblings,this.adoptSiblings(),!r||(this.renderWith(l,p),!i)?!1:(p&&this.styleEls.forEach(d=>i.insertBefore(d,a)),i.insertBefore(this.content,a),this.mountRoot=i,this.settleMounted(),!0)}static debug(t){if(t)for(let n in t){let s=t[n];typeof s=="boolean"?Ae[n]=s:console.warn(`jq79: Component79.debug ignored "${n}" - the flags are booleans, and the ones it knows are: ${Object.keys(Ae).join(", ")}`)}return{...Ae}}static fetch(t){if(Array.isArray(t))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new rt(st(t))}static fetchAll(t){return Promise.all(t.map(st))}on(t,n){return this.emitListeners.has(t)||this.emitListeners.set(t,new Set),this.emitListeners.get(t).add(n),this}off(t,n){return this.emitListeners.get(t)?.delete(n),this}render(t={}){return this.renderWith(t,!1)}renderShadow(t={}){return this.renderWith(t,!0)}renderWith(t,n){this.destroy();let s=Ys(this.scripts),r=tr(this.siblings,s),o=r?Object.assign(Object.create(r),t):{...t},i=new Set([...s].filter(h=>!(h in t)));i.size&&Object.defineProperty(o,En,{value:i}),this.slots&&Object.defineProperty(o,on,{value:this.slots}),Object.defineProperty(o,nt,{value:{count:0}});let a=Se(o),l=ce(a);this.data=a,this.fx=l,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let p=this.startMarker,d=!1,b=(h,T)=>{h==="model:update"&&!d&&(d=!0,console.warn("jq79: $emit('model:update', \u2026) no longer feeds :model - call $updateModel(value) or $updateModel(name, value) instead"));let _=new CustomEvent(h,{detail:T,bubbles:!0,composed:!0,cancelable:!0});return p===this.startMarker&&this.emitListeners.get(h)?.forEach(B=>B(_,T)),_.cancelBubble||p.dispatchEvent(_),!_.defaultPrevented},O,D=new Promise(h=>{O=h});this.resolveMounted=O,this.renderDone=!1;let I=this.endMarker,U=h=>{let T=[];for(let _=p.nextSibling;_&&_!==I;_=_.nextSibling)_ instanceof Element&&(_.matches(h)&&T.push(_),T.push(...Array.from(_.querySelectorAll(h))));return T},L=h=>U(h)[0]??null,F=this.modules,N=h=>F&&h in F?Promise.resolve(F[h]):ut(Zs(h,this.filename)),P=Object.assign(Object.create(null),{$emit:b,$updateModel:(...h)=>{let[T,_]=h.length>1?h:[void 0,h[0]];return p!==this.startMarker?!1:this.modelWriteback?.(T,_)??!1},$slots:Object.fromEntries(Object.keys(this.slots??{}).map(h=>[h,!0]))}),q=h=>`await $mounted();${h}`,V=[],Y=!0;this.scripts.forEach((h,T)=>{let _;V.push(new Promise(c=>{_=c}));let B=!1,H=()=>{B=!0,_()},w={$mounted:()=>(H(),D),$self:L,$$self:U,...P,...r},W={filename:this.filename,index:T},k=":mounted"in h.attrs,z=Ot(h.content),G=(()=>{if(z!==null){k&&console.warn("jq79: :mounted on a factory script renders the template before the factory has returned, so none of its bindings exist yet - await $mounted() inside the factory instead."),Ut(a,Ce(h.content));let f=k?q(z):z;return sr(f,a,E=>l.effect(E),w,N,W)}let{vars:c,code:u}=xe(h.content);Ut(a,ft(h)),c.forEach(f=>{f in a||(a[f]=void 0)});let g=k?q(u):u;return Xs(g,a,f=>l.effect(f),w,N,W)})();if(G.sync)G.settled.then(H,H);else{let c=o[nt];c.count++;let u=()=>{c.count--,H()};G.settled.then(u,u)}!G.sync&&!B&&(Y=!1)});let S=document.createDocumentFragment(),A=new Proxy(a,{has:(h,T)=>typeof T=="string"&&T in P||Reflect.has(h,T),get:(h,T,_)=>typeof T=="string"&&T in P&&!Reflect.has(h,T)?P[T]:Reflect.get(h,T,_)});return S.append(this.startMarker,this.endMarker),this.content=S,Y?(this.endMarker.parentNode.insertBefore(pe(this.template,A,l,n),this.endMarker),this.renderDone=!0,this.settleMounted()):(Promise.all(V).then(()=>{p===this.startMarker&&(this.endMarker.parentNode.insertBefore(pe(this.template,A,l,n),this.endMarker),this.renderDone=!0,this.settleMounted())}),cr(this,V)),n?this.styleEls=this.styles.map(h=>{let T=document.createElement("style");return T.textContent=h.content,T}):(this.styles.forEach(h=>Ks(Wt(h))),this.ownsSharedStyles=!0),this}mount(t,n){let s=typeof t=="string"?ge(t):t;if(!s)throw new Error(`mount target not found: ${t}`);return(!this.content||n!==void 0)&&this.renderWith(n??{},this.useShadow),this.attach(s)}mountShadow(t,n){let s=typeof t=="string"?ge(t):t;if(!s)throw new Error(`mount target not found: ${t}`);return(!this.content||n!==void 0||!this.useShadow)&&this.renderWith(n??{},!0),this.attach(s)}attach(t){this.mountRoot&&this.detach();let n=this.useShadow&&t instanceof Element?t.shadowRoot??t.attachShadow({mode:"open"}):t;return this.useShadow&&this.styleEls.forEach(s=>n.appendChild(s)),n.appendChild(this.content),this.mountRoot=n,this.settleMounted(),this}settleMounted(){this.renderDone&&this.mountRoot&&this.resolveMounted?.()}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let t=this.startMarker;for(;t;){let n=t.nextSibling;if(this.content.appendChild(t),t===this.endMarker)break;t=n}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.data?.$dispose(),this.styleEls.forEach(t=>t.parentNode?.removeChild(t)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(t=>Vs(Wt(t))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.renderDone=!1,this.data=null,this.resolveMounted=null,this}};v(oe,"version",Hn);var rt=class{constructor(t){v(this,"chain");this.chain=t}queue(t){return this.chain=this.chain.then(n=>(t(n),n)),this}then(t,n){return this.chain.then(t,n)}catch(t){return this.chain.catch(t)}finally(t){return this.chain.finally(t)}mount(t,n){return this.queue(s=>s.mount(t,n))}mountShadow(t,n){return this.queue(s=>s.mountShadow(t,n))}render(t={}){return this.queue(n=>n.render(t))}renderShadow(t={}){return this.queue(n=>n.renderShadow(t))}on(t,n){return this.queue(s=>s.on(t,n))}off(t,n){return this.queue(s=>s.off(t,n))}detach(){return this.queue(t=>t.detach())}destroy(){return this.queue(t=>t.destroy())}};var Er=e=>new oe(e),Sn={$:ge,$$:Me,$create:De,$reactive:Se,$toRaw:Z,Component79:oe};typeof globalThis<"u"&&globalThis[rr]&&lr();export{ge as $,Me as $$,De as $create,Se as $reactive,Z as $toRaw,oe as C79,oe as Component79,rt as PendingComponent79,lr as enableHotReload,ar as hotUpdate,Er as parseComponent,br as renderComponent};
15
15
  //# sourceMappingURL=jq79.js.map