jq79 0.5.3 → 0.5.4

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.cjs CHANGED
@@ -1,14 +1,14 @@
1
- var te=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var At=Object.prototype.hasOwnProperty;var _t=(e,t,n)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Nt=(e,t)=>{for(var n in t)te(e,n,{get:t[n],enumerable:!0})},jt=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ct(t))!At.call(e,r)&&r!==n&&te(e,r,{get:()=>t[r],enumerable:!(s=xt(t,r))||s.enumerable});return e};var Ot=e=>jt(te({},"__esModule",{value:!0}),e);var _=(e,t,n)=>_t(e,typeof t!="symbol"?t+"":t,n);var es={};Nt(es,{$:()=>Z,$$:()=>ne,$create:()=>se,$reactive:()=>Q,C79:()=>W,Component79:()=>W,PendingComponent79:()=>me,enableHotReload:()=>$t,hotUpdate:()=>Rt,parseComponent:()=>Yn,renderComponent:()=>xn});module.exports=Ot(es);function Z(e,t){return typeof e=="string"?document.querySelector(e):e.querySelector(t)}function ne(e,t){return Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t))}var se=(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},vt=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),qe={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},Lt=new Set(["http:","https:","mailto:"]);function Pt(e){try{let t=new URL(e,"https://example.com");return Lt.has(t.protocol)}catch{return!1}}var Mt={"https:":"443","http:":"80"};function Dt(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 ke=e=>{let t=(Array.isArray(e)?e:e.split(",")).map(Dt).filter(n=>n!==null);return n=>{let s=n.hostname.toLowerCase(),r=n.port||Mt[n.protocol]||"";return t.some(o=>o.host.test(s)&&(o.port===null||o.port===r))}};function qt(e,t,n,s){try{return!!e(new URL(t,document.baseURI),n,s)}catch{return!1}}var We=512;function Ue(e,t,n,s){if(n>We)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${We} elements`);for(let r of Array.from(e.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let o=Wt(r,n,s);o&&t.appendChild(o)}else r.nodeType===Node.TEXT_NODE&&t.appendChild(r.cloneNode())}function Wt(e,t,n){let s=e.tagName.toLowerCase();if(!vt.has(s))return null;let r=document.createElement(s);for(let o of Array.from(e.attributes)){let i=o.name.toLowerCase(),a=qe[s]?.has(i),c=qe["*"]?.has(i);!a&&!c||(i==="href"||i==="src")&&(!Pt(o.value)||n&&!qt(n,o.value,s,i))||r.setAttribute(i,o.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),Ue(e,r,t+1,n),r}function Ie(e,t){let n=document.createElement("template");n.innerHTML=e;let s=document.createElement("div");return Ue(n.content,s,0,t?.allowUrl),s.innerHTML}var kt=(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},He=(e,t,n)=>{Object.entries(e).forEach(([s,r])=>{let o=t?`${t}.${s}`:s;r&&typeof r=="object"&&Be(r)?He(r,o,n):n(o,r)})},Ut=(e,t)=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`),be=Symbol("jq79.raw"),re=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[be];)t=t[be];return t},ze=Symbol("jq79.store"),J=e=>e!==null&&typeof e=="object"&&e[ze]===!0,K=[],X=e=>{K.push(new Set);try{return e()}finally{K.pop()}},Fe="$__attach",oe=Symbol("jq79.alsoWakenBy"),Q=e=>{let t=new Map,n=new Set,s=new Set,r=new WeakMap,o=Object.create(null),i=(h,b,$=!1)=>{t.get(h)?.forEach(E=>E(b,h)),n.forEach(E=>E(h,b)),s.forEach(E=>{($||Array.from(E.deps).some(j=>Ut(j,h)))&&E.run()})},a=h=>h!==null&&typeof h=="object"&&Be(h),c=new Map,d=(h,b)=>{let $=c.get(b);$?.store!==h&&($?.unsubscribe(),c.set(b,{store:h,unsubscribe:h.$onAny((E,j)=>i(`${b}.${E}`,j))}))},u=h=>{c.get(h)?.unsubscribe(),c.delete(h)},m=(h,b)=>{let $=r.get(h);if($)return $;let E=null,j=new Proxy(h,{has(f,l){return Reflect.has(f,l)||typeof l=="string"&&E?.has(l)===!0},get(f,l,p){if(l===be)return f;if(l===ze)return b==="";if(typeof l!="string")return Reflect.get(f,l,p);if(b===""&&l in o)return o[l];let g=b?`${b}.${l}`:l;K[K.length-1]?.add(g);let x=Reflect.get(f,l,p);if(J(x))return d(x,g),x;let R=re(x);return a(R)?m(R,g):R},set(f,l,p,g){if(g!==j&&!Object.prototype.hasOwnProperty.call(f,l))return Reflect.set(f,l,p,g);let x=b?`${b}.${l}`:l,R=J(p)?p:re(p),P=!Object.prototype.hasOwnProperty.call(f,l);if(!P&&Object.is(f[l],R)&&(R===null||typeof R!="object"))return!0;f[l]=R,E?.delete(l),J(R)?d(R,x):u(x);let v=J(R)||!a(R)?R:m(R,x);return i(x,v,P),!0},deleteProperty(f,l){if(typeof l!="string")return Reflect.deleteProperty(f,l);let p=Object.prototype.hasOwnProperty.call(f,l),g=Reflect.deleteProperty(f,l);if(g&&p){let x=b?`${b}.${l}`:l;(E??(E=new Set)).add(l),u(x),i(x,void 0)}return g}});return r.set(h,j),j},S=m(re(e),"");Object.entries(re(e)).forEach(([h,b])=>{J(b)&&d(b,h)});let A=(h,b,{immediate:$=!1}={})=>(t.has(h)||t.set(h,new Set),t.get(h).add(b),$&&b(kt(S,h),h),()=>t.get(h)?.delete(b)),O=(h,{immediate:b=!1}={})=>(n.add(h),b&&He(S,"",($,E)=>h($,E)),()=>n.delete(h)),N=(h,b)=>{let $=!1,E=!1,j={deps:new Set,run:()=>{if($){E=!0;return}$=!0;try{let f=0;do{E=!1;let l=new Set;K.push(l);try{h()}finally{K.pop(),j.deps=l}}while(E&&++f<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{$=!1}}};return s.add(j),b?.length?y(j,b):(j.run(),()=>{s.delete(j)})},y=(h,b)=>{let $=b.map(E=>E?.[Fe]?.(h)).filter(Boolean);return h.run(),()=>{s.delete(h),$.forEach(E=>E())}},w=h=>(s.add(h),()=>{s.delete(h)}),T=()=>{c.forEach(({unsubscribe:h})=>h()),c.clear()};return o.$on=A,o.$onAny=O,o.$effect=N,o.$dispose=T,o[Fe]=w,S},H=e=>{let t=[],n=[],s=e[oe];return{effect:r=>{t.push(e.$effect(r,s)),n.push(r)},onDispose:r=>{t.push(r)},refresh:()=>{n.forEach(r=>r())},dispose:()=>{t.splice(0).forEach(r=>r()),n.length=0}}};var Ge=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,Ze=/\$:\s*/y,ae=/import(?=\s*\()/y,Ke=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,U=(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},D=(e,t)=>{let n=e.indexOf(`
1
+ var te=Object.defineProperty;var xt=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var _t=Object.prototype.hasOwnProperty;var At=(e,t,n)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Nt=(e,t)=>{for(var n in t)te(e,n,{get:t[n],enumerable:!0})},jt=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ct(t))!_t.call(e,r)&&r!==n&&te(e,r,{get:()=>t[r],enumerable:!(s=xt(t,r))||s.enumerable});return e};var Ot=e=>jt(te({},"__esModule",{value:!0}),e);var A=(e,t,n)=>At(e,typeof t!="symbol"?t+"":t,n);var ts={};Nt(ts,{$:()=>Z,$$:()=>ne,$create:()=>se,$reactive:()=>Q,C79:()=>W,Component79:()=>W,PendingComponent79:()=>me,enableHotReload:()=>$t,hotUpdate:()=>wt,parseComponent:()=>es,renderComponent:()=>xn});module.exports=Ot(ts);function Z(e,t){return typeof e=="string"?document.querySelector(e):e.querySelector(t)}function ne(e,t){return Array.from(typeof e=="string"?document.querySelectorAll(e):e.querySelectorAll(t))}var se=(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},vt=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),qe={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},Lt=new Set(["http:","https:","mailto:"]);function Pt(e){try{let t=new URL(e,"https://example.com");return Lt.has(t.protocol)}catch{return!1}}var Mt={"https:":"443","http:":"80"};function Dt(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 ke=e=>{let t=(Array.isArray(e)?e:e.split(",")).map(Dt).filter(n=>n!==null);return n=>{let s=n.hostname.toLowerCase(),r=n.port||Mt[n.protocol]||"";return t.some(o=>o.host.test(s)&&(o.port===null||o.port===r))}};function qt(e,t,n,s){try{return!!e(new URL(t,document.baseURI),n,s)}catch{return!1}}var We=512;function Ue(e,t,n,s){if(n>We)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${We} elements`);for(let r of Array.from(e.childNodes))if(r.nodeType===Node.ELEMENT_NODE){let o=Wt(r,n,s);o&&t.appendChild(o)}else r.nodeType===Node.TEXT_NODE&&t.appendChild(r.cloneNode())}function Wt(e,t,n){let s=e.tagName.toLowerCase();if(!vt.has(s))return null;let r=document.createElement(s);for(let o of Array.from(e.attributes)){let i=o.name.toLowerCase(),a=qe[s]?.has(i),c=qe["*"]?.has(i);!a&&!c||(i==="href"||i==="src")&&(!Pt(o.value)||n&&!qt(n,o.value,s,i))||r.setAttribute(i,o.value)}return s==="a"&&r.setAttribute("rel","noopener noreferrer"),Ue(e,r,t+1,n),r}function Ie(e,t){let n=document.createElement("template");n.innerHTML=e;let s=document.createElement("div");return Ue(n.content,s,0,t?.allowUrl),s.innerHTML}var kt=(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},He=(e,t,n)=>{Object.entries(e).forEach(([s,r])=>{let o=t?`${t}.${s}`:s;r&&typeof r=="object"&&Be(r)?He(r,o,n):n(o,r)})},Ut=(e,t)=>e===t||e.startsWith(`${t}.`)||t.startsWith(`${e}.`),Ee=Symbol("jq79.raw"),re=e=>{let t=e;for(;t!==null&&typeof t=="object"&&t[Ee];)t=t[Ee];return t},ze=Symbol("jq79.store"),J=e=>e!==null&&typeof e=="object"&&e[ze]===!0,K=[],X=e=>{K.push(new Set);try{return e()}finally{K.pop()}},Fe="$__attach",oe=Symbol("jq79.alsoWakenBy"),Q=e=>{let t=new Map,n=new Set,s=new Set,r=new WeakMap,o=Object.create(null),i=(h,E,$=!1)=>{t.get(h)?.forEach(b=>b(E,h)),n.forEach(b=>b(h,E)),s.forEach(b=>{($||Array.from(b.deps).some(j=>Ut(j,h)))&&b.run()})},a=h=>h!==null&&typeof h=="object"&&Be(h),c=new Map,d=(h,E)=>{let $=c.get(E);$?.store!==h&&($?.unsubscribe(),c.set(E,{store:h,unsubscribe:h.$onAny((b,j)=>i(`${E}.${b}`,j))}))},u=h=>{c.get(h)?.unsubscribe(),c.delete(h)},m=(h,E)=>{let $=r.get(h);if($)return $;let b=null,j=new Proxy(h,{has(f,l){return Reflect.has(f,l)||typeof l=="string"&&b?.has(l)===!0},get(f,l,p){if(l===Ee)return f;if(l===ze)return E==="";if(typeof l!="string")return Reflect.get(f,l,p);if(E===""&&l in o)return o[l];let g=E?`${E}.${l}`:l;K[K.length-1]?.add(g);let x=Reflect.get(f,l,p);if(J(x))return d(x,g),x;let w=re(x);return a(w)?m(w,g):w},set(f,l,p,g){if(g!==j&&!Object.prototype.hasOwnProperty.call(f,l))return Reflect.set(f,l,p,g);let x=E?`${E}.${l}`:l,w=J(p)?p:re(p),P=!Object.prototype.hasOwnProperty.call(f,l);if(!P&&Object.is(f[l],w)&&(w===null||typeof w!="object"))return!0;f[l]=w,b?.delete(l),J(w)?d(w,x):u(x);let v=J(w)||!a(w)?w:m(w,x);return i(x,v,P),!0},deleteProperty(f,l){if(typeof l!="string")return Reflect.deleteProperty(f,l);let p=Object.prototype.hasOwnProperty.call(f,l),g=Reflect.deleteProperty(f,l);if(g&&p){let x=E?`${E}.${l}`:l;(b??(b=new Set)).add(l),u(x),i(x,void 0)}return g}});return r.set(h,j),j},S=m(re(e),"");Object.entries(re(e)).forEach(([h,E])=>{J(E)&&d(E,h)});let _=(h,E,{immediate:$=!1}={})=>(t.has(h)||t.set(h,new Set),t.get(h).add(E),$&&E(kt(S,h),h),()=>t.get(h)?.delete(E)),O=(h,{immediate:E=!1}={})=>(n.add(h),E&&He(S,"",($,b)=>h($,b)),()=>n.delete(h)),N=(h,E)=>{let $=!1,b=!1,j={deps:new Set,run:()=>{if($){b=!0;return}$=!0;try{let f=0;do{b=!1;let l=new Set;K.push(l);try{h()}finally{K.pop(),j.deps=l}}while(b&&++f<100);b&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{$=!1}}};return s.add(j),E?.length?y(j,E):(j.run(),()=>{s.delete(j)})},y=(h,E)=>{let $=E.map(b=>b?.[Fe]?.(h)).filter(Boolean);return h.run(),()=>{s.delete(h),$.forEach(b=>b())}},R=h=>(s.add(h),()=>{s.delete(h)}),T=()=>{c.forEach(({unsubscribe:h})=>h()),c.clear()};return o.$on=_,o.$onAny=O,o.$effect=N,o.$dispose=T,o[Fe]=R,S},H=e=>{let t=[],n=[],s=e[oe];return{effect:r=>{t.push(e.$effect(r,s)),n.push(r)},onDispose:r=>{t.push(r)},refresh:()=>{n.forEach(r=>r())},dispose:()=>{t.splice(0).forEach(r=>r()),n.length=0}}};var Ge=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,Ze=/\$:\s*/y,ae=/import(?=\s*\()/y,Ke=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,U=(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},D=(e,t)=>{let n=e.indexOf(`
2
2
  `,t);return n===-1?e.length:n},q=(e,t)=>{let n=e.indexOf("*/",t+2);return n===-1?e.length:n+2},ie=(e,t)=>{let n=t;for(;n<e.length;){if(/\s/.test(e[n])){n++;continue}if(e[n]==="/"&&e[n+1]==="/"){n=D(e,n);continue}if(e[n]==="/"&&e[n+1]==="*"){n=q(e,n);continue}break}return n},It=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),I=(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 It.has(e.slice(r,n+1))}return(s==="+"||s==="-")&&e[n-1]===s?!1:!")]}\"'`.".includes(s)},F=(e,t)=>{let n=t+1,s=!1;for(;n<e.length;){let r=e[n];if(r==="\\"){n+=2;continue}if(r===`
3
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},Ft=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,Bt=(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""},Ve=(e,t)=>{let n=0,s=t;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=U(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=D(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=q(e,s);continue}if(r==="/"&&I(e,s)){s=F(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=ie(e,s+1);if(!(o<e.length&&(Ft.test(e.slice(o,o+2))||[",","="].includes(Bt(e,s)))))return s;s=o;continue}}s++}return e.length},Ht=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=U(e,i),r=i;continue}if(a==="/"&&e[i+1]==="/"){i=D(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=q(e,i);continue}if(a==="/"&&I(e,i)){i=F(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},Ee=e=>{let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return ce.test(t)?[t]:[];let n=[];for(let s of we(t.slice(1,Xe(t)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=Re(s);if(r!==-1&&(s=s.slice(0,r).trim()),t.startsWith("{")){let o=Se(s,":");if(o!==-1){n.push(...Ee(s.slice(o+1)));continue}}n.push(...Ee(s))}return n},zt=e=>{let t=[],n=Ht(e).map(({raw:o,codeEnd:i})=>{let a=o.match(/^\s*/)[0];if(i<=a.length)return{text:o,empty:!0};let c=o.slice(a.length,i),d=o.slice(i),u=Re(c),m=(u===-1?c:c.slice(0,u)).trim(),S=c[0]==="{"||c[0]==="[";S?t.push(...Ee(m)):ce.test(m)&&t.push(m);let A=ue(c).code;return{text:`${a}${S?`(${A})`:A}${d}`,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}},ue=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 c=U(e,s);n+=e.slice(s,c),s=c,o=!1;continue}if(i==="/"&&(a==="/"||a==="*")){let c=a==="/"?D(e,s):q(e,s);n+=e.slice(s,c),s=c;continue}if(i==="/"&&I(e,s)){let c=F(e,s);n+=e.slice(s,c),s=c,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(ae.lastIndex=s,ae.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){Ge.lastIndex=s;let c=Ge.exec(e);if(c){let u=s+c[0].length,m=Ve(e,u),{vars:S,code:A}=zt(e.slice(u,m));t.push(...S),n+=A,s=m,o=!1;continue}Ze.lastIndex=s;let d=Ze.exec(e);if(d){Ke.lastIndex=s;let u=Ke.exec(e);u&&t.push(u[1]);let m=s+d[0].length,S=Ve(e,m);n+=`$__effect(() => { ${ue(e.slice(m,S)).code} });`,s=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}},le=/export\s+default(?![\w$])/y,Je=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,Gt=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},Zt=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=Gt(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(", ")}`},ce=/^[A-Za-z_$][\w$]*$/,Xe=e=>{let t=0,n=0;for(;n<e.length;){let s=e[n];if(s==="'"||s==='"'||s==="`"){n=U(e,n);continue}if(s==="/"&&e[n+1]==="/"){n=D(e,n);continue}if(s==="/"&&e[n+1]==="*"){n=q(e,n);continue}if(s==="/"&&I(e,n)){n=F(e,n);continue}if("([{".includes(s))t++;else if(")]}".includes(s)&&--t===0)return n;n++}return e.length},Se=(e,t)=>{let n=0,s=0;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=U(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=D(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=q(e,s);continue}if(r==="/"&&r!==t&&I(e,s)){s=F(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===t)return s;s++}return-1},we=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let o=e[r];if(o==="'"||o==='"'||o==="`"){r=U(e,r);continue}if(o==="/"&&e[r+1]==="/"){r=D(e,r);continue}if(o==="/"&&e[r+1]==="*"){r=q(e,r);continue}if(o==="/"&&I(e,r)){r=F(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},Re=e=>{let t=0;for(;t<e.length;){let n=Se(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},fe=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=Xe(t);if(n>=t.length)return null;let s=[];for(let r of we(t.slice(1,n))){if(r.startsWith("..."))continue;let o=Re(r),i=o===-1?r:r.slice(0,o),a=o===-1?void 0:r.slice(o+1).trim(),c=Se(i,":"),d=(c===-1?i:i.slice(0,c)).trim();if(!ce.test(d))continue;let u={name:d};a!==void 0&&(u.default=a);let m=c===-1?"":i.slice(c+1).trim();ce.test(m)&&(u.as=m),s.push(u)}return s},Kt=e=>{let t=0,n=0,s=!0;for(;t<e.length;){let r=e[t];if(r==="'"||r==='"'||r==="`"){t=U(e,t),s=!1;continue}if(r==="/"&&e[t+1]==="/"){t=D(e,t);continue}if(r==="/"&&e[t+1]==="*"){t=q(e,t);continue}if(r==="/"&&I(e,t)){t=F(e,t),s=!1;continue}if(r==="e"&&n===0&&s&&(t===0||!/[\w$.]/.test(e[t-1]))){le.lastIndex=t;let o=le.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},Vt=/^async(?![\w$])/,Jt=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,Xt=e=>{let t=Kt(e);if(t===-1)return null;let n=ie(e,t),s=e.slice(n);Vt.test(s)&&(n=ie(e,n+5));let r=Jt.exec(e.slice(n));if(r&&(n=ie(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=U(e,i);continue}if(a==="/"&&e[i+1]==="/"){i=D(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=q(e,i);continue}if(a==="/"&&I(e,i)){i=F(e,i);continue}if("([{".includes(a))o++;else if(")]}".includes(a)&&--o===0)break;i++}return we(e.slice(n+1,i))[0]??""},de=e=>{let t=Xt(e);if(t===null)return null;let n=fe(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},Qe=e=>{let t="",n=0,s=0,r=!0,o=!1,i=0;for(;n<e.length;){let a=e[n],c=e[n+1],d=n===0||!/[\w$.]/.test(e[n-1]);if(a==="'"||a==='"'||a==="`"){let u=U(e,n);t+=e.slice(n,u),n=u,r=!1;continue}if(a==="/"&&(c==="/"||c==="*")){let u=c==="/"?D(e,n):q(e,n);t+=e.slice(n,u),n=u;continue}if(a==="/"&&I(e,n)){let u=F(e,n);t+=e.slice(n,u),n=u,r=!1;continue}if(a==="i"&&d){if(ae.lastIndex=n,ae.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){Je.lastIndex=n;let u=Je.exec(e);if(u){t+=Zt(u[1],u[3],i++),n+=u[0].length,r=!1;continue}}}if(a==="e"&&d&&s===0&&r){le.lastIndex=n;let u=le.exec(e);if(u){o=!0,t+="$__exports.default =",n+=u[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 Qt="0.5.3",ut=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),ft=e=>({tag:e.tagName.toLowerCase(),attrs:ut(e),children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(t=>{if(t.nodeType===Node.TEXT_NODE){let n=t.textContent??"";return n?[n]:[]}return t.nodeType===Node.ELEMENT_NODE?[ft(t)]:[]})}),Ye=new Map,dt=(e,t)=>{let n=`${t.join(",")}|${e}`,s=Ye.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
8
- ); }`)}catch{s=null}Ye.set(n,s)}return s},Yt=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,en=100,z=new Map,_e=new Set,pe=0,Te=!1,tn=()=>{Te=!1,!(pe>0)&&(z.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(_e.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 = () => {}".`))}),z.clear())},pt=()=>{Te||pe>0||!z.size||(Te=!0,queueMicrotask(tn))},ht=e=>{pe++;let t=()=>{pe--,pt()};e.then(t,t)},nn=(e,t,n)=>{if(!(n instanceof ReferenceError))return;let s=Yt.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let o=`${r}|${e}`;_e.has(o)||z.has(o)||z.size>=en||(z.set(o,{name:r,expr:e,scope:t}),pt())},C=(e,t,n)=>{let s=dt(e,n?Object.keys(n):[]);if(s)try{return s(t,...n?Object.values(n):[])}catch(r){nn(e,t,r);return}},sn=(e,t)=>e.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>C(s,t)??""),rn=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),Ne=e=>rn.has(e)||e.startsWith(":class.")||e.startsWith(":props.")||e===":slot"||e.startsWith(":slot."),on=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,an=(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 c=C(n,s,{$event:a});typeof c=="function"&&c.call(e,a)},{once:i.has("once"),capture:i.has("capture")})},ln=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o),a=c=>{i.has("prevent")&&c.preventDefault(),i.has("stop")&&c.stopPropagation(),i.has("once")&&e.off(r,a),X(()=>{let d=C(n,s,{$event:c});typeof d=="function"&&d(c)})};e.on(r,a)},B=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),xe=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),je=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},he=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},cn=({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}},et=(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},tt=200,$e=0,gt=Symbol("jq79.slots"),un=e=>e==="slot"||e.startsWith("slot."),mt=e=>e?B(e):"default",Oe=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),fn=e=>e==="default"?":slot":`:slot.${e}`,dn=e=>typeof e!="string"||e.trim()!=="",pn=e=>{let t={},n=[];e.children.forEach(r=>{let o=typeof r=="object"&&r.tag==="template"?Oe(r):void 0;if(typeof r=="string"||o===void 0){n.push(r);return}let i=mt(o.slice(6));if(i in t){console.warn(`jq79: two <template ${fn(i)}> in <${e.tag}>; the second was ignored`);return}t[i]={nodes:r.children,binder:r.attrs[o]||void 0}});let s=n.some(dn);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},hn=(e,t,n)=>{fe(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?C(o,e):a},set:()=>console.warn(`jq79: "${i}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},gn=e=>{let t=Oe(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}`)},mn=(e,t)=>{let n=Object.entries(pn(e));if(!n.length)return null;let s={};return n.forEach(([r,o])=>{s[r]=yn(o,t)}),s},yn=(e,t)=>(n,s,r,o)=>{let i=Object.create(t);hn(i,e.binder,n);let a=i[oe]??[];Object.defineProperty(i,oe,{value:[...a,s]});let c=H(i);return r.onDispose(()=>c.dispose()),V(e.nodes,i,c,o)},bn=(e,t,n,s)=>{let r=mt(e.tag.slice(5)),o=document.createDocumentFragment(),i=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);o.append(i,a);let c=t[gt]?.[r];if(!c)return o.insertBefore(V(e.children,t,n,s),a),o;let d={};return Object.entries(e.attrs).forEach(([u,m])=>{if(!(u===ye||Ne(u)||u.startsWith("@")))if(u.startsWith(":")){let S=m||u.slice(1);d[B(u.slice(1))]=()=>C(S,t)}else d[B(u)]=()=>m}),o.insertBefore(c(d,t,n,s),a),o},nt=(e,t,n,s,r)=>{let o=document.createComment(e),i=document.createComment(`/${e}`),a=document.createDocumentFragment();a.append(o,i);let c=mn(t,n),d={},u={},m=[],S=[],A=!1;Object.entries(t.attrs).forEach(([f,l])=>{if(f!==ye){if(f===":props"||f.startsWith(":props.")){A=!0,S.push({expr:l});return}if(!Ne(f))if(f.startsWith("@"))m.push([f,l]);else if(f===":model"||f.startsWith(":model.")){let p=f===":model"?"default":B(f.slice(7));u[p]=l||(f===":model"?"model":p)}else if(f.startsWith(":")){let p=B(f.slice(1));d[p]=l||p,S.push({name:p,expr:l||p})}else{let p=B(f),g=JSON.stringify(l);d[p]=g,S.push({name:p,expr:g})}}});let O=f=>f==="default"?":model":`:model.${f}`,N=f=>f==="default"?"model":f,y=f=>`${f}
9
- = $value`,w=new Set;Object.entries(u).forEach(([f,l])=>{let p=N(f);d[p]!==void 0&&console.warn(`jq79: <${t.tag}> binds prop "${p}" through both :${p} and ${O(f)} - ${O(f)} wins`),d[p]=l,dt(y(l),["$value"])===null&&(w.add(f),console.warn(`jq79: ${O(f)}="${l}" is not assignable - updates from <${t.tag}> will be dropped`))});let T=()=>{let f={};return S.forEach(({name:l,expr:p})=>{if(l!==void 0)f[l]=C(p,n);else{let g=C(p,n);g!==null&&typeof g=="object"&&Object.assign(f,g)}}),Object.entries(u).forEach(([l,p])=>{f[N(l)]=C(p,n)}),f},h=null,b=null,$=null,E=new Set,j=f=>{if(f==null){if(!n[wt]?.has(e)||E.has("unfilled"))return;E.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}E.has("type")||(E.add("type"),console.error(`jq79: <${t.tag}> is ${typeof f}, not a component - nothing renders here`))};return s.effect(()=>{let f=C(e,n),l=f instanceof W?f:null;if(l||j(f),l===b||($?.dispose(),$=null,h?.destroy(),h=null,b=l,!l))return;let p=new W({template:l.template,scripts:l.scripts,styles:l.styles,modules:l.modules,filename:l.filename,siblings:l.siblings,name:l.name});if(c&&(p.slots=c),Object.keys(u).length){let v=new Set;p.modelWriteback=(L,k)=>{let M=L==null?"default":B(String(L)),De=u[M];return De===void 0?(v.has(M)||(v.add(M),console.warn(`jq79: <${t.tag}> has no ${O(M)} - bound: ${Object.keys(u).map(O).join(", ")}`)),!1):w.has(M)?!1:(X(()=>C(y(De),n,{$value:k})),!0)}}m.forEach(([v,L])=>ln(p,v,L,n));let g=zn(p.scripts);Gn(t,e,Object.keys(d),g);let x=at(X(T),g),R=document.createDocumentFragment();if($e>=tt){console.error(`jq79: <${t.tag}> is ${tt} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}$e++;try{(r?p.renderShadow(x):p.render(x)).mount(R)}finally{$e--}i.parentNode.insertBefore(R,i);let P=H(n);if(A){let v=[];P.effect(()=>{let L=at(T(),g),k=Object.keys(L);v.forEach(M=>{M in L||(p.data[M]=void 0)}),k.forEach(M=>{p.data[M]=L[M]}),v=k})}else Object.entries(d).forEach(([v,L])=>{g!==null&&!g.has(v)||P.effect(()=>{p.data[v]=C(L,n)})});$=P,h=p}),s.onDispose(()=>{$?.dispose(),h?.destroy()}),a},En=(e,t)=>{let n=()=>{let s=C(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)}})},ee=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(ee):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?ee(t):[]):[],Sn=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?ke(e):()=>!1,wn=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"]),st=(e,t,n)=>{let s=wn.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},ve=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?En(r,t):t;if(un(e.tag))return bn(e,o,n,s);if(e.tag==="template"&&Oe(e)!==void 0)return gn(e);let i=et(o,e.tag);if(i)return nt(i,e,o,n,s);let a=document.createElement(e.tag),c=a instanceof HTMLUnknownElement||e.tag.includes("-");if(c){let y=!1;n.effect(()=>{if(y)return;let w=et(o,e.tag);if(!w)return;y=!0;let T=nt(w,e,o,n,s),h=je(T);n.onDispose(()=>he(h)),a.replaceWith(T)})}Object.entries(e.attrs).forEach(([y,w])=>{if(y.startsWith("@"))an(a,y,w,o);else if(y===":model"||y.startsWith(":model."))c||console.warn(`jq79: ${y} on <${e.tag}> does nothing - :model binds component tags only (for now)`);else if(!Ne(y))if(y.startsWith(":"))if(c)a.setAttribute(y,w);else{let T=y.slice(1),h=w||B(T);n.effect(()=>st(a,T,C(h,o)))}else a.setAttribute(y,w)});let d=e.attrs[":attrs"];if(d!==void 0){let y=[];n.effect(()=>{y.forEach(T=>a.removeAttribute(T));let w=C(d,o);y=w&&typeof w=="object"?Object.keys(w):[],y.forEach(T=>st(a,T,w[T]))})}let u=e.attrs[":class"],m=Object.entries(e.attrs).filter(([y])=>y.startsWith(":class.")).map(([y,w])=>[y.slice(7),w]);if(u!==void 0||m.length){let y=new Set(ee(e.attrs.class??"")),w=[];n.effect(()=>{let T=u!==void 0?ee(C(u,o)):[];m.forEach(([h,b])=>{C(b,o)&&T.push(...ee(h))}),w.forEach(h=>{!T.includes(h)&&!y.has(h)&&a.classList.remove(h)}),a.classList.add(...T),w=T})}let S=e.attrs[":text"],A=e.attrs[":html"],O=e.attrs[":html.allowed"];O!==void 0&&A===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),S!==void 0?n.effect(()=>{a.textContent=String(C(S,o)??"")}):A!==void 0?n.effect(()=>{let y=O!==void 0?{allowUrl:Sn(C(O,o))}:void 0;a.innerHTML=Ie(String(C(A,o)??""),y)}):a instanceof HTMLTemplateElement?a.content.appendChild(V(e.children,o,n,s)):a.appendChild(V(e.children,o,n,s));let N=e.attrs[":value"];return N!==void 0&&n.effect(()=>{let y=String(C(N,o)??"");a.value!==y&&(a.value=y)}),[":checked",":selected"].forEach(y=>{let w=e.attrs[y];if(w===void 0)return;let T=y.slice(1);n.effect(()=>{a[T]=!!C(w,o)})}),a},Rn=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,a=null,c=null;return n.effect(()=>{let d=e.find(m=>m.expr===void 0||C(m.expr,t))??null;if(d===a||(c?.dispose(),i&&he(i),i=null,a=d,!d))return;c=H(t);let u=ve(d.node,t,c,s);i=je(u),r.parentNode.insertBefore(u,r.nextSibling)}),o},Y=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},$n=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Tn=(e,t,n,s)=>{let r=e.attrs[":each"].match(on);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,o,i,a]=r,c=e.attrs[":key"],{[":each"]:d,[":key"]:u,...m}=e.attrs,S={...e,attrs:m},A=document.createComment("each"),O=document.createDocumentFragment();O.appendChild(A),(":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 N=[],y=!1;return n.effect(()=>{let w=C(a,t),T=Array.isArray(w)?w.map((f,l)=>[l,f]):$n(w)?Object.entries(w):[],h=new Map;N.forEach(f=>{let l=h.get(f.key);l?l.push(f):h.set(f.key,[f])});let b=new Set,$=[],E=T.map(([f,l],p)=>{let g=Object.create(t);Y(g,o,l),i&&Y(g,i,f),Y(g,"$index",p);let x=c!==void 0?C(c,g):f;b.has(x)&&!y&&(y=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),b.add(x);let R=h.get(x)?.shift();if(R&&Object.is(R.item,l))return R.scope.$index!==p&&$.push(R),Y(R.scope,"$index",p),i&&Y(R.scope,i,f),R;R&&(R.fx.dispose(),he(R.range));let P=H(t),v=je(ve(S,g,P,s));return{key:x,item:l,scope:g,fx:P,range:v}});h.forEach(f=>f.forEach(l=>{l.fx.dispose(),he(l.range)}));let j=A;E.forEach(f=>{j.nextSibling!==f.range.first&&cn(f.range,j),j=f.range.last}),$.forEach(f=>X(()=>f.fx.refresh())),N=E}),O},V=(e,t,n,s=!1)=>{let r=document.createDocumentFragment(),o=0;for(;o<e.length;){let i=e[o];if(typeof i=="string"){let a=document.createTextNode(i);i.includes("{{")&&n.effect(()=>{a.textContent=sn(i,t)}),r.appendChild(a),o++;continue}if(":each"in i.attrs){r.appendChild(Tn(i,t,n,s)),o++;continue}if(":if"in i.attrs){let a=[{expr:i.attrs[":if"],node:i}];o++;let c=u=>{let m=o;for(;m<e.length&&typeof e[m]=="string"&&!e[m].trim();)m++;let S=e[m];if(typeof S=="object"&&u in S.attrs)return o=m+1,S};for(let u=c(":elseif");u;u=c(":elseif"))a.push({expr:u.attrs[":elseif"],node:u});let d=c(":else");d&&a.push({node:d}),r.appendChild(Rn(a,t,n,s));continue}r.appendChild(ve(i,t,n,s)),o++}return r},xn=(e,t,n=!1)=>V(e.template,t,H(t),n),Cn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),An=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,Le=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,_n=e=>e.split(Le).map((t,n)=>n%2===1?t:t.replace(An,(s,r,o)=>Cn.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),yt=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,Nn=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,jn=e=>e.split(Le).map((t,n)=>n%2===1?t:t.replace(yt,(s,r,o)=>{let i=0,a=o.replace(Nn,(c,d,u)=>u===void 0?c:`${d}:props.${i++}="${u}"`);return`<${r}${a}>`})).join(""),On=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,vn=/<\/slot\.([\w.$-]+)(\s*)>/gi,Ln=/^slot\./i,Pn=e=>Ln.test(e)?`slot.${xe(e.slice(5))}`:e,Mn=e=>e.split(Le).map((t,n)=>n%2===1?t:t.replace(yt,(s,r,o)=>{let i=o.replace(On,(a,c,d)=>d===void 0?a:`${c}${xe(d)}`);return`<${Pn(r)}${i}>`}).replace(vn,(s,r,o)=>`</slot.${xe(r)}${o}>`)).join(""),ye="data-jq79",Dn=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)},bt=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[ye]=t,bt(n.children,t))})},qn=(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}[${ye}="${t}"]${i}`}).join(", "),Et=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=qn(n.selectorText,t):n instanceof CSSGroupingRule&&Et(n.cssRules,t)})},Wn=(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),Et(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
10
- `)},kn=/^[A-Z][A-Za-z0-9]*$/,Ce=e=>{let t=_n(jn(Mn(e))),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],o=[];Array.from(s.content.children).forEach(c=>{c.tagName==="TEMPLATE"?o.push(c):r.push(c)});let i=rt(r,e),a={};return o.forEach(c=>{let d=c.getAttribute("name");if(d===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!kn.test(d)){console.warn(`jq79: <template name="${d}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(d in a){console.warn(`jq79: two <template name="${d}"> in one file; the second was ignored`);return}a[d]=new W({...rt(Array.from(c.content.children),c.innerHTML),siblings:a,name:d})}),Object.keys(a).length&&(i.siblings=a),i},rt=(e,t)=>{let n=[],s=[],r=[];e.forEach(i=>{let a={attrs:ut(i),content:i.textContent??""};i.tagName==="SCRIPT"?n.push(a):i.tagName==="STYLE"?s.push(a):r.push(ft(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=Dn(t);bt(r,i),s.forEach(a=>{o(a)&&(a.scoped=Wn(a.content,i))})}return{template:r,scripts:n,styles:s}},Pe=e=>/\.html?([?#]|$)/.test(e)?Ae(e):import(e),Un=(e,t)=>{if(!/^\.\.?\//.test(e))return e;try{let n=new URL(document.baseURI),s=new URL(e,new URL(t??"",n));return s.origin!=="null"&&s.origin===n.origin?`${s.pathname}${s.search}${s.hash}`:s.href}catch{return e}},St=(e,t)=>e?`
11
- //# sourceURL=${e}?jq79-script=${t}`:"",ot=e=>e.scoped??e.content,ge=new Map,In=e=>{let t=ge.get(e);if(!t){let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0},ge.set(e,t)}t.count++},Fn=e=>{let t=ge.get(e);t&&--t.count<=0&&(t.el.remove(),ge.delete(e))},Bn=(e,t,n,s={},r=Pe,o={})=>{let i={...Tt,...s},a=new Proxy(t,{has:(d,u)=>u!=="$__effect"&&u!=="$__import"&&(Reflect.has(d,u)||!(u in globalThis)&&!(u in i))}),c=new Function("$scope","$__effect","$__import",...Object.keys(i),`return (async () => { with ($scope) { ${e} } })()${St(o.filename,o.index??0)}`)(a,n,r,...Object.values(i));c.catch(d=>console.error("jq79: error in :setup script",d)),ht(c)},it=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:C(s,e))})},Me=e=>{let t=e.attrs[":setup"];return t===void 0?null:t.trim()===""?[]:fe(t)},Hn=e=>{let t=new Set;return e.forEach(n=>{(de(n.content)??Me(n))?.forEach(({name:r})=>t.add(r))}),t},zn=e=>{let t=null;return e.forEach(n=>{let s=de(n.content)??Me(n);if(!s)return;let r=t??(t=new Set);s.forEach(({name:o})=>r.add(o))}),t},at=(e,t)=>{if(t===null)return e;let n={};return Object.keys(e).forEach(s=>{t.has(s)&&(n[s]=e[s])}),n},lt=new WeakMap,Gn=(e,t,n,s)=>{if(s===null)return;let r=lt.get(e)??new Set;lt.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`))})},Zn=(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},wt=Symbol("jq79.unfilledProps"),Kn=e=>e&&e.default!==void 0?e.default:e,Vn=(e,t,n,s={},r=Pe,o={})=>{let i={...Tt,...s},a={},c=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
4
+ `){let o=ie(e,s+1);if(!(o<e.length&&(Ft.test(e.slice(o,o+2))||[",","="].includes(Bt(e,s)))))return s;s=o;continue}}s++}return e.length},Ht=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=U(e,i),r=i;continue}if(a==="/"&&e[i+1]==="/"){i=D(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=q(e,i);continue}if(a==="/"&&I(e,i)){i=F(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},be=e=>{let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return ce.test(t)?[t]:[];let n=[];for(let s of Re(t.slice(1,Xe(t)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=we(s);if(r!==-1&&(s=s.slice(0,r).trim()),t.startsWith("{")){let o=Se(s,":");if(o!==-1){n.push(...be(s.slice(o+1)));continue}}n.push(...be(s))}return n},zt=e=>{let t=[],n=Ht(e).map(({raw:o,codeEnd:i})=>{let a=o.match(/^\s*/)[0];if(i<=a.length)return{text:o,empty:!0};let c=o.slice(a.length,i),d=o.slice(i),u=we(c),m=(u===-1?c:c.slice(0,u)).trim(),S=c[0]==="{"||c[0]==="[";S?t.push(...be(m)):ce.test(m)&&t.push(m);let _=ue(c).code;return{text:`${a}${S?`(${_})`:_}${d}`,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}},ue=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 c=U(e,s);n+=e.slice(s,c),s=c,o=!1;continue}if(i==="/"&&(a==="/"||a==="*")){let c=a==="/"?D(e,s):q(e,s);n+=e.slice(s,c),s=c;continue}if(i==="/"&&I(e,s)){let c=F(e,s);n+=e.slice(s,c),s=c,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(ae.lastIndex=s,ae.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){Ge.lastIndex=s;let c=Ge.exec(e);if(c){let u=s+c[0].length,m=Ve(e,u),{vars:S,code:_}=zt(e.slice(u,m));t.push(...S),n+=_,s=m,o=!1;continue}Ze.lastIndex=s;let d=Ze.exec(e);if(d){Ke.lastIndex=s;let u=Ke.exec(e);u&&t.push(u[1]);let m=s+d[0].length,S=Ve(e,m);n+=`$__effect(() => { ${ue(e.slice(m,S)).code} });`,s=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}},le=/export\s+default(?![\w$])/y,Je=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,Gt=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},Zt=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=Gt(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(", ")}`},ce=/^[A-Za-z_$][\w$]*$/,Xe=e=>{let t=0,n=0;for(;n<e.length;){let s=e[n];if(s==="'"||s==='"'||s==="`"){n=U(e,n);continue}if(s==="/"&&e[n+1]==="/"){n=D(e,n);continue}if(s==="/"&&e[n+1]==="*"){n=q(e,n);continue}if(s==="/"&&I(e,n)){n=F(e,n);continue}if("([{".includes(s))t++;else if(")]}".includes(s)&&--t===0)return n;n++}return e.length},Se=(e,t)=>{let n=0,s=0;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=U(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=D(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=q(e,s);continue}if(r==="/"&&r!==t&&I(e,s)){s=F(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===t)return s;s++}return-1},Re=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let o=e[r];if(o==="'"||o==='"'||o==="`"){r=U(e,r);continue}if(o==="/"&&e[r+1]==="/"){r=D(e,r);continue}if(o==="/"&&e[r+1]==="*"){r=q(e,r);continue}if(o==="/"&&I(e,r)){r=F(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},we=e=>{let t=0;for(;t<e.length;){let n=Se(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},fe=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=Xe(t);if(n>=t.length)return null;let s=[];for(let r of Re(t.slice(1,n))){if(r.startsWith("..."))continue;let o=we(r),i=o===-1?r:r.slice(0,o),a=o===-1?void 0:r.slice(o+1).trim(),c=Se(i,":"),d=(c===-1?i:i.slice(0,c)).trim();if(!ce.test(d))continue;let u={name:d};a!==void 0&&(u.default=a);let m=c===-1?"":i.slice(c+1).trim();ce.test(m)&&(u.as=m),s.push(u)}return s},Kt=e=>{let t=0,n=0,s=!0;for(;t<e.length;){let r=e[t];if(r==="'"||r==='"'||r==="`"){t=U(e,t),s=!1;continue}if(r==="/"&&e[t+1]==="/"){t=D(e,t);continue}if(r==="/"&&e[t+1]==="*"){t=q(e,t);continue}if(r==="/"&&I(e,t)){t=F(e,t),s=!1;continue}if(r==="e"&&n===0&&s&&(t===0||!/[\w$.]/.test(e[t-1]))){le.lastIndex=t;let o=le.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},Vt=/^async(?![\w$])/,Jt=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,Xt=e=>{let t=Kt(e);if(t===-1)return null;let n=ie(e,t),s=e.slice(n);Vt.test(s)&&(n=ie(e,n+5));let r=Jt.exec(e.slice(n));if(r&&(n=ie(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=U(e,i);continue}if(a==="/"&&e[i+1]==="/"){i=D(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=q(e,i);continue}if(a==="/"&&I(e,i)){i=F(e,i);continue}if("([{".includes(a))o++;else if(")]}".includes(a)&&--o===0)break;i++}return Re(e.slice(n+1,i))[0]??""},de=e=>{let t=Xt(e);if(t===null)return null;let n=fe(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},Qe=e=>{let t="",n=0,s=0,r=!0,o=!1,i=0;for(;n<e.length;){let a=e[n],c=e[n+1],d=n===0||!/[\w$.]/.test(e[n-1]);if(a==="'"||a==='"'||a==="`"){let u=U(e,n);t+=e.slice(n,u),n=u,r=!1;continue}if(a==="/"&&(c==="/"||c==="*")){let u=c==="/"?D(e,n):q(e,n);t+=e.slice(n,u),n=u;continue}if(a==="/"&&I(e,n)){let u=F(e,n);t+=e.slice(n,u),n=u,r=!1;continue}if(a==="i"&&d){if(ae.lastIndex=n,ae.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){Je.lastIndex=n;let u=Je.exec(e);if(u){t+=Zt(u[1],u[3],i++),n+=u[0].length,r=!1;continue}}}if(a==="e"&&d&&s===0&&r){le.lastIndex=n;let u=le.exec(e);if(u){o=!0,t+="$__exports.default =",n+=u[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 Qt="0.5.4",ut=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),ft=e=>({tag:e.tagName.toLowerCase(),attrs:ut(e),children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(t=>{if(t.nodeType===Node.TEXT_NODE){let n=t.textContent??"";return n?[n]:[]}return t.nodeType===Node.ELEMENT_NODE?[ft(t)]:[]})}),Ye=new Map,dt=(e,t)=>{let n=`${t.join(",")}|${e}`,s=Ye.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
8
+ ); }`)}catch{s=null}Ye.set(n,s)}return s},Yt=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,en=100,z=new Map,Ae=new Set,pe=0,Te=!1,tn=()=>{Te=!1,!(pe>0)&&(z.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(Ae.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 = () => {}".`))}),z.clear())},pt=()=>{Te||pe>0||!z.size||(Te=!0,queueMicrotask(tn))},ht=e=>{pe++;let t=()=>{pe--,pt()};e.then(t,t)},nn=(e,t,n)=>{if(!(n instanceof ReferenceError))return;let s=Yt.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let o=`${r}|${e}`;Ae.has(o)||z.has(o)||z.size>=en||(z.set(o,{name:r,expr:e,scope:t}),pt())},C=(e,t,n)=>{let s=dt(e,n?Object.keys(n):[]);if(s)try{return s(t,...n?Object.values(n):[])}catch(r){nn(e,t,r);return}},sn=(e,t)=>e.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>C(s,t)??""),rn=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),Ne=e=>rn.has(e)||e.startsWith(":class.")||e.startsWith(":props.")||e===":slot"||e.startsWith(":slot."),on=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,an=(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 c=C(n,s,{$event:a});typeof c=="function"&&c.call(e,a)},{once:i.has("once"),capture:i.has("capture")})},ln=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o),a=c=>{i.has("prevent")&&c.preventDefault(),i.has("stop")&&c.stopPropagation(),i.has("once")&&e.off(r,a),X(()=>{let d=C(n,s,{$event:c});typeof d=="function"&&d(c)})};e.on(r,a)},B=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),xe=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),je=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},he=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},cn=({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}},et=(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},tt=200,$e=0,gt=Symbol("jq79.slots"),un=e=>e==="slot"||e.startsWith("slot."),mt=e=>e?B(e):"default",Oe=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),fn=e=>e==="default"?":slot":`:slot.${e}`,dn=e=>typeof e!="string"||e.trim()!=="",pn=e=>{let t={},n=[];e.children.forEach(r=>{let o=typeof r=="object"&&r.tag==="template"?Oe(r):void 0;if(typeof r=="string"||o===void 0){n.push(r);return}let i=mt(o.slice(6));if(i in t){console.warn(`jq79: two <template ${fn(i)}> in <${e.tag}>; the second was ignored`);return}t[i]={nodes:r.children,binder:r.attrs[o]||void 0}});let s=n.some(dn);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},hn=(e,t,n)=>{fe(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?C(o,e):a},set:()=>console.warn(`jq79: "${i}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},gn=e=>{let t=Oe(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}`)},mn=(e,t)=>{let n=Object.entries(pn(e));if(!n.length)return null;let s={};return n.forEach(([r,o])=>{s[r]=yn(o,t)}),s},yn=(e,t)=>(n,s,r,o)=>{let i=Object.create(t);hn(i,e.binder,n);let a=i[oe]??[];Object.defineProperty(i,oe,{value:[...a,s]});let c=H(i);return r.onDispose(()=>c.dispose()),V(e.nodes,i,c,o)},En=(e,t,n,s)=>{let r=mt(e.tag.slice(5)),o=document.createDocumentFragment(),i=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);o.append(i,a);let c=t[gt]?.[r];if(!c)return o.insertBefore(V(e.children,t,n,s),a),o;let d={};return Object.entries(e.attrs).forEach(([u,m])=>{if(!(u===ye||Ne(u)||u.startsWith("@")))if(u.startsWith(":")){let S=m||u.slice(1);d[B(u.slice(1))]=()=>C(S,t)}else d[B(u)]=()=>m}),o.insertBefore(c(d,t,n,s),a),o},nt=(e,t,n,s,r)=>{let o=document.createComment(e),i=document.createComment(`/${e}`),a=document.createDocumentFragment();a.append(o,i);let c=mn(t,n),d={},u={},m=[],S=[],_=!1;Object.entries(t.attrs).forEach(([f,l])=>{if(f!==ye){if(f===":props"||f.startsWith(":props.")){_=!0,S.push({expr:l});return}if(!Ne(f))if(f.startsWith("@"))m.push([f,l]);else if(f===":model"||f.startsWith(":model.")){let p=f===":model"?"default":B(f.slice(7));u[p]=l||(f===":model"?"model":p)}else if(f.startsWith(":")){let p=B(f.slice(1));d[p]=l||p,S.push({name:p,expr:l||p})}else{let p=B(f),g=JSON.stringify(l);d[p]=g,S.push({name:p,expr:g})}}});let O=f=>f==="default"?":model":`:model.${f}`,N=f=>f==="default"?"model":f,y=f=>`${f}
9
+ = $value`,R=new Set;Object.entries(u).forEach(([f,l])=>{let p=N(f);d[p]!==void 0&&console.warn(`jq79: <${t.tag}> binds prop "${p}" through both :${p} and ${O(f)} - ${O(f)} wins`),d[p]=l,dt(y(l),["$value"])===null&&(R.add(f),console.warn(`jq79: ${O(f)}="${l}" is not assignable - updates from <${t.tag}> will be dropped`))});let T=()=>{let f={};return S.forEach(({name:l,expr:p})=>{if(l!==void 0)f[l]=C(p,n);else{let g=C(p,n);g!==null&&typeof g=="object"&&Object.assign(f,g)}}),Object.entries(u).forEach(([l,p])=>{f[N(l)]=C(p,n)}),f},h=null,E=null,$=null,b=new Set,j=f=>{if(f==null){if(!n[Rt]?.has(e)||b.has("unfilled"))return;b.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}b.has("type")||(b.add("type"),console.error(`jq79: <${t.tag}> is ${typeof f}, not a component - nothing renders here`))};return s.effect(()=>{let f=C(e,n),l=f instanceof W?f:null;if(l||j(f),l===E||($?.dispose(),$=null,h?.destroy(),h=null,E=l,!l))return;let p=new W({template:l.template,scripts:l.scripts,styles:l.styles,modules:l.modules,filename:l.filename,siblings:l.siblings,name:l.name});if(c&&(p.slots=c),Object.keys(u).length){let v=new Set;p.modelWriteback=(L,k)=>{let M=L==null?"default":B(String(L)),De=u[M];return De===void 0?(v.has(M)||(v.add(M),console.warn(`jq79: <${t.tag}> has no ${O(M)} - bound: ${Object.keys(u).map(O).join(", ")}`)),!1):R.has(M)?!1:(X(()=>C(y(De),n,{$value:k})),!0)}}m.forEach(([v,L])=>ln(p,v,L,n));let g=Gn(p.scripts);Zn(t,e,Object.keys(d),g);let x=at(X(T),g),w=document.createDocumentFragment();if($e>=tt){console.error(`jq79: <${t.tag}> is ${tt} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}$e++;try{(r?p.renderShadow(x):p.render(x)).mount(w)}finally{$e--}i.parentNode.insertBefore(w,i);let P=H(n);if(_){let v=[];P.effect(()=>{let L=at(T(),g),k=Object.keys(L);v.forEach(M=>{M in L||(p.data[M]=void 0)}),k.forEach(M=>{p.data[M]=L[M]}),v=k})}else Object.entries(d).forEach(([v,L])=>{g!==null&&!g.has(v)||P.effect(()=>{p.data[v]=C(L,n)})});$=P,h=p}),s.onDispose(()=>{$?.dispose(),h?.destroy()}),a},bn=(e,t)=>{let n=()=>{let s=C(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)}})},ee=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(ee):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?ee(t):[]):[],Sn=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?ke(e):()=>!1,Rn=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"]),st=(e,t,n)=>{let s=Rn.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},ve=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?bn(r,t):t;if(un(e.tag))return En(e,o,n,s);if(e.tag==="template"&&Oe(e)!==void 0)return gn(e);let i=et(o,e.tag);if(i)return nt(i,e,o,n,s);let a=document.createElement(e.tag),c=a instanceof HTMLUnknownElement||e.tag.includes("-");if(c){let y=!1;n.effect(()=>{if(y)return;let R=et(o,e.tag);if(!R)return;y=!0;let T=nt(R,e,o,n,s),h=je(T);n.onDispose(()=>he(h)),a.replaceWith(T)})}Object.entries(e.attrs).forEach(([y,R])=>{if(y.startsWith("@"))an(a,y,R,o);else if(y===":model"||y.startsWith(":model."))c||console.warn(`jq79: ${y} on <${e.tag}> does nothing - :model binds component tags only (for now)`);else if(!Ne(y))if(y.startsWith(":"))if(c)a.setAttribute(y,R);else{let T=y.slice(1),h=R||B(T);n.effect(()=>st(a,T,C(h,o)))}else a.setAttribute(y,R)});let d=e.attrs[":attrs"];if(d!==void 0){let y=[];n.effect(()=>{y.forEach(T=>a.removeAttribute(T));let R=C(d,o);y=R&&typeof R=="object"?Object.keys(R):[],y.forEach(T=>st(a,T,R[T]))})}let u=e.attrs[":class"],m=Object.entries(e.attrs).filter(([y])=>y.startsWith(":class.")).map(([y,R])=>[y.slice(7),R]);if(u!==void 0||m.length){let y=new Set(ee(e.attrs.class??"")),R=[];n.effect(()=>{let T=u!==void 0?ee(C(u,o)):[];m.forEach(([h,E])=>{C(E,o)&&T.push(...ee(h))}),R.forEach(h=>{!T.includes(h)&&!y.has(h)&&a.classList.remove(h)}),a.classList.add(...T),R=T})}let S=e.attrs[":text"],_=e.attrs[":html"],O=e.attrs[":html.allowed"];O!==void 0&&_===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),S!==void 0?n.effect(()=>{a.textContent=String(C(S,o)??"")}):_!==void 0?n.effect(()=>{let y=O!==void 0?{allowUrl:Sn(C(O,o))}:void 0;a.innerHTML=Ie(String(C(_,o)??""),y)}):a instanceof HTMLTemplateElement?a.content.appendChild(V(e.children,o,n,s)):a.appendChild(V(e.children,o,n,s));let N=e.attrs[":value"];return N!==void 0&&n.effect(()=>{let y=String(C(N,o)??"");a.value!==y&&(a.value=y)}),[":checked",":selected"].forEach(y=>{let R=e.attrs[y];if(R===void 0)return;let T=y.slice(1);n.effect(()=>{a[T]=!!C(R,o)})}),a},wn=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,a=null,c=null;return n.effect(()=>{let d=e.find(m=>m.expr===void 0||C(m.expr,t))??null;if(d===a||(c?.dispose(),i&&he(i),i=null,a=d,!d))return;c=H(t);let u=ve(d.node,t,c,s);i=je(u),r.parentNode.insertBefore(u,r.nextSibling)}),o},Y=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},$n=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Tn=(e,t,n,s)=>{let r=e.attrs[":each"].match(on);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,o,i,a]=r,c=e.attrs[":key"],{[":each"]:d,[":key"]:u,...m}=e.attrs,S={...e,attrs:m},_=document.createComment("each"),O=document.createDocumentFragment();O.appendChild(_),(":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 N=[],y=!1;return n.effect(()=>{let R=C(a,t),T=Array.isArray(R)?R.map((f,l)=>[l,f]):$n(R)?Object.entries(R):[],h=new Map;N.forEach(f=>{let l=h.get(f.key);l?l.push(f):h.set(f.key,[f])});let E=new Set,$=[],b=T.map(([f,l],p)=>{let g=Object.create(t);Y(g,o,l),i&&Y(g,i,f),Y(g,"$index",p);let x=c!==void 0?C(c,g):f;E.has(x)&&!y&&(y=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),E.add(x);let w=h.get(x)?.shift();if(w&&Object.is(w.item,l))return w.scope.$index!==p&&$.push(w),Y(w.scope,"$index",p),i&&Y(w.scope,i,f),w;w&&(w.fx.dispose(),he(w.range));let P=H(t),v=je(ve(S,g,P,s));return{key:x,item:l,scope:g,fx:P,range:v}});h.forEach(f=>f.forEach(l=>{l.fx.dispose(),he(l.range)}));let j=_;b.forEach(f=>{j.nextSibling!==f.range.first&&cn(f.range,j),j=f.range.last}),$.forEach(f=>X(()=>f.fx.refresh())),N=b}),O},V=(e,t,n,s=!1)=>{let r=document.createDocumentFragment(),o=0;for(;o<e.length;){let i=e[o];if(typeof i=="string"){let a=document.createTextNode(i);i.includes("{{")&&n.effect(()=>{a.textContent=sn(i,t)}),r.appendChild(a),o++;continue}if(":each"in i.attrs){r.appendChild(Tn(i,t,n,s)),o++;continue}if(":if"in i.attrs){let a=[{expr:i.attrs[":if"],node:i}];o++;let c=u=>{let m=o;for(;m<e.length&&typeof e[m]=="string"&&!e[m].trim();)m++;let S=e[m];if(typeof S=="object"&&u in S.attrs)return o=m+1,S};for(let u=c(":elseif");u;u=c(":elseif"))a.push({expr:u.attrs[":elseif"],node:u});let d=c(":else");d&&a.push({node:d}),r.appendChild(wn(a,t,n,s));continue}r.appendChild(ve(i,t,n,s)),o++}return r},xn=(e,t,n=!1)=>V(e.template,t,H(t),n),Cn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_n=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,Le=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,An=e=>e.split(Le).map((t,n)=>n%2===1?t:t.replace(_n,(s,r,o)=>Cn.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),yt=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,Nn=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,jn=e=>e.split(Le).map((t,n)=>n%2===1?t:t.replace(yt,(s,r,o)=>{let i=0,a=o.replace(Nn,(c,d,u)=>u===void 0?c:`${d}:props.${i++}="${u}"`);return`<${r}${a}>`})).join(""),On=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,vn=/<\/slot\.([\w.$-]+)(\s*)>/gi,Ln=/^slot\./i,Pn=e=>Ln.test(e)?`slot.${xe(e.slice(5))}`:e,Mn=e=>e.split(Le).map((t,n)=>n%2===1?t:t.replace(yt,(s,r,o)=>{let i=o.replace(On,(a,c,d)=>d===void 0?a:`${c}${xe(d)}`);return`<${Pn(r)}${i}>`}).replace(vn,(s,r,o)=>`</slot.${xe(r)}${o}>`)).join(""),ye="data-jq79",Dn=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)},Et=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[ye]=t,Et(n.children,t))})},qn=(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}[${ye}="${t}"]${i}`}).join(", "),bt=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=qn(n.selectorText,t):n instanceof CSSGroupingRule&&bt(n.cssRules,t)})},Wn=(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),bt(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
10
+ `)},kn=/^[A-Z][A-Za-z0-9]*$/,Ce=e=>{let t=An(jn(Mn(e))),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],o=[];Array.from(s.content.children).forEach(c=>{c.tagName==="TEMPLATE"?o.push(c):r.push(c)});let i=rt(r,e),a={};return o.forEach(c=>{let d=c.getAttribute("name");if(d===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!kn.test(d)){console.warn(`jq79: <template name="${d}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(d in a){console.warn(`jq79: two <template name="${d}"> in one file; the second was ignored`);return}a[d]=new W({...rt(Array.from(c.content.children),c.innerHTML),siblings:a,name:d})}),Object.keys(a).length&&(i.siblings=a),i},rt=(e,t)=>{let n=[],s=[],r=[];e.forEach(i=>{let a={attrs:ut(i),content:i.textContent??""};i.tagName==="SCRIPT"?n.push(a):i.tagName==="STYLE"?s.push(a):r.push(ft(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=Dn(t);Et(r,i),s.forEach(a=>{o(a)&&(a.scoped=Wn(a.content,i))})}return{template:r,scripts:n,styles:s}},Pe=e=>/\.html?([?#]|$)/.test(e)?_e(e):import(e),Un=/^(?:\.\.?\/|\/|[a-z][a-z0-9+.-]*:)/i,In=(e,t)=>{if(!Un.test(e))return e;try{return new URL(e,new URL(t??"",document.baseURI)).href}catch{return e}},St=(e,t)=>e?`
11
+ //# sourceURL=${e}?jq79-script=${t}`:"",ot=e=>e.scoped??e.content,ge=new Map,Fn=e=>{let t=ge.get(e);if(!t){let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0},ge.set(e,t)}t.count++},Bn=e=>{let t=ge.get(e);t&&--t.count<=0&&(t.el.remove(),ge.delete(e))},Hn=(e,t,n,s={},r=Pe,o={})=>{let i={...Tt,...s},a=new Proxy(t,{has:(d,u)=>u!=="$__effect"&&u!=="$__import"&&(Reflect.has(d,u)||!(u in globalThis)&&!(u in i))}),c=new Function("$scope","$__effect","$__import",...Object.keys(i),`return (async () => { with ($scope) { ${e} } })()${St(o.filename,o.index??0)}`)(a,n,r,...Object.values(i));c.catch(d=>console.error("jq79: error in :setup script",d)),ht(c)},it=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:C(s,e))})},Me=e=>{let t=e.attrs[":setup"];return t===void 0?null:t.trim()===""?[]:fe(t)},zn=e=>{let t=new Set;return e.forEach(n=>{(de(n.content)??Me(n))?.forEach(({name:r})=>t.add(r))}),t},Gn=e=>{let t=null;return e.forEach(n=>{let s=de(n.content)??Me(n);if(!s)return;let r=t??(t=new Set);s.forEach(({name:o})=>r.add(o))}),t},at=(e,t)=>{if(t===null)return e;let n={};return Object.keys(e).forEach(s=>{t.has(s)&&(n[s]=e[s])}),n},lt=new WeakMap,Zn=(e,t,n,s)=>{if(s===null)return;let r=lt.get(e)??new Set;lt.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`))})},Kn=(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},Rt=Symbol("jq79.unfilledProps"),Vn=e=>e&&e.default!==void 0?e.default:e,Jn=(e,t,n,s={},r=Pe,o={})=>{let i={...Tt,...s},a={},c=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
12
12
  ${e}
13
- ;$__exports.done = true })()${St(o.filename,o.index??0)}`)(a,Kn,r,...Object.values(i)),d=A=>console.error("jq79: error in factory script",A),u=!1,m,S=()=>{if(u)return m;u=!0;let A=a.default;if(typeof A!="function")return;let O=N=>{N&&typeof N=="object"&&Object.assign(t,N)};try{let N=A(t,{$data:t,$props:t,$effect:n,...s});N instanceof Promise?m=N.then(O).catch(d):O(N)}catch(N){d(N)}return m};ht(c.then(S,d)),a.done&&S()},Jn="__JQ79_HMR_ENABLED__",Xn="__JQ79_HMR__",G=null,Qn=e=>{if(!G||!e.filename)return;let t=G.get(e.filename);t||G.set(e.filename,t=new Set),t.add(new WeakRef(e))},ct=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},Rt=(e,t)=>{if(!G)return 0;let n=ct(e),s=Ce(t),r=!1,o=a=>a.name===void 0?s:s.siblings?.[a.name]??null,i=0;for(let[a,c]of G)if(ct(a)===n){for(let d of c){let u=d.deref();if(!u){c.delete(d);continue}let m=o(u);if(!m){r=!0;continue}u.hotReplace(m)&&i++}c.size||G.delete(a)}return r?0:i},$t=()=>{G??(G=new Map),globalThis[Xn]={update:Rt}},Ae=async e=>{let t=await fetch(e);if(!t.ok)throw new Error(`failed to fetch component from ${e}: ${t.status}`);return new W(await t.text(),{filename:e})},W=class{constructor(t,n={}){_(this,"template");_(this,"scripts");_(this,"styles");_(this,"modules");_(this,"filename");_(this,"siblings");_(this,"name");_(this,"slots");_(this,"modelWriteback");_(this,"data",null);_(this,"fx",null);_(this,"content",null);_(this,"startMarker",null);_(this,"endMarker",null);_(this,"styleEls",[]);_(this,"ownsSharedStyles",!1);_(this,"useShadow",!1);_(this,"mountRoot",null);_(this,"resolveMounted",null);_(this,"emitListeners",new Map);let s=typeof t=="string"?Ce(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(),Qn(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"?Ce(t):t;_e.clear(),z.clear();let s=this.startMarker,r=!!(s&&this.content),o=r&&s.isConnected,i=o?s.parentNode:null,a=o?this.endMarker.nextSibling:null,c={...this.data},d=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(c,d),!i)?!1:(d&&this.styleEls.forEach(u=>i.insertBefore(u,a)),i.insertBefore(this.content,a),this.mountRoot=i,this.resolveMounted?.(),!0)}static fetch(t){if(Array.isArray(t))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new me(Ae(t))}static fetchAll(t){return Promise.all(t.map(Ae))}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=Hn(this.scripts),r=Zn(this.siblings,s),o=r?Object.assign(Object.create(r),t):{...t},i=new Set([...s].filter(l=>!(l in t)));i.size&&Object.defineProperty(o,wt,{value:i}),this.slots&&Object.defineProperty(o,gt,{value:this.slots});let a=Q(o),c=H(a);this.data=a,this.fx=c,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let d=this.startMarker,u=!1,m=(l,p)=>{l==="model:update"&&!u&&(u=!0,console.warn("jq79: $emit('model:update', \u2026) no longer feeds :model - call $updateModel(value) or $updateModel(name, value) instead"));let g=new CustomEvent(l,{detail:p,bubbles:!0,composed:!0,cancelable:!0});return d===this.startMarker&&this.emitListeners.get(l)?.forEach(x=>x(g,p)),g.cancelBubble||d.dispatchEvent(g),!g.defaultPrevented},S,A=new Promise(l=>{S=l});this.resolveMounted=S;let O=()=>A,N=this.endMarker,y=l=>{let p=[];for(let g=d.nextSibling;g&&g!==N;g=g.nextSibling)g instanceof Element&&(g.matches(l)&&p.push(g),p.push(...Array.from(g.querySelectorAll(l))));return p},w=l=>y(l)[0]??null,T=this.modules,h=l=>T&&l in T?Promise.resolve(T[l]):Pe(Un(l,this.filename)),$=Object.assign(Object.create(null),{$emit:m,$updateModel:(...l)=>{let[p,g]=l.length>1?l:[void 0,l[0]];return d!==this.startMarker?!1:this.modelWriteback?.(p,g)??!1},$slots:Object.fromEntries(Object.keys(this.slots??{}).map(l=>[l,!0]))}),E=l=>`await $mounted();${l}`;this.scripts.forEach((l,p)=>{let g={$mounted:O,$self:w,$$self:y,...$,...r},x={filename:this.filename,index:p},R=Qe(l.content);if(R!==null){it(a,de(l.content));let k=":mounted"in l.attrs?E(R):R;Vn(k,a,c.effect,g,h,x);return}let{vars:P,code:v}=ue(l.content);it(a,Me(l)),P.forEach(k=>{k in a||(a[k]=void 0)});let L=":mounted"in l.attrs?E(v):v;Bn(L,a,c.effect,g,h,x)});let j=document.createDocumentFragment(),f=new Proxy(a,{has:(l,p)=>typeof p=="string"&&p in $||Reflect.has(l,p),get:(l,p,g)=>typeof p=="string"&&p in $&&!Reflect.has(l,p)?$[p]:Reflect.get(l,p,g)});return j.append(this.startMarker,V(this.template,f,c,n),this.endMarker),this.content=j,n?this.styleEls=this.styles.map(l=>{let p=document.createElement("style");return p.textContent=l.content,p}):(this.styles.forEach(l=>In(ot(l))),this.ownsSharedStyles=!0),this}mount(t,n){let s=typeof t=="string"?Z(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"?Z(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.resolveMounted?.(),this}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=>Fn(ot(t))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}};_(W,"version",Qt);var me=class{constructor(t){_(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 Yn=e=>new W(e),Tt={$:Z,$$:ne,$create:se,$reactive:Q,Component79:W};typeof globalThis<"u"&&globalThis[Jn]&&$t();0&&(module.exports={$,$$,$create,$reactive,C79,Component79,PendingComponent79,enableHotReload,hotUpdate,parseComponent,renderComponent});
13
+ ;$__exports.done = true })()${St(o.filename,o.index??0)}`)(a,Vn,r,...Object.values(i)),d=_=>console.error("jq79: error in factory script",_),u=!1,m,S=()=>{if(u)return m;u=!0;let _=a.default;if(typeof _!="function")return;let O=N=>{N&&typeof N=="object"&&Object.assign(t,N)};try{let N=_(t,{$data:t,$props:t,$effect:n,...s});N instanceof Promise?m=N.then(O).catch(d):O(N)}catch(N){d(N)}return m};ht(c.then(S,d)),a.done&&S()},Xn="__JQ79_HMR_ENABLED__",Qn="__JQ79_HMR__",G=null,Yn=e=>{if(!G||!e.filename)return;let t=G.get(e.filename);t||G.set(e.filename,t=new Set),t.add(new WeakRef(e))},ct=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},wt=(e,t)=>{if(!G)return 0;let n=ct(e),s=Ce(t),r=!1,o=a=>a.name===void 0?s:s.siblings?.[a.name]??null,i=0;for(let[a,c]of G)if(ct(a)===n){for(let d of c){let u=d.deref();if(!u){c.delete(d);continue}let m=o(u);if(!m){r=!0;continue}u.hotReplace(m)&&i++}c.size||G.delete(a)}return r?0:i},$t=()=>{G??(G=new Map),globalThis[Qn]={update:wt}},_e=async e=>{let t=await fetch(e);if(!t.ok)throw new Error(`failed to fetch component from ${e}: ${t.status}`);return new W(await t.text(),{filename:e})},W=class{constructor(t,n={}){A(this,"template");A(this,"scripts");A(this,"styles");A(this,"modules");A(this,"filename");A(this,"siblings");A(this,"name");A(this,"slots");A(this,"modelWriteback");A(this,"data",null);A(this,"fx",null);A(this,"content",null);A(this,"startMarker",null);A(this,"endMarker",null);A(this,"styleEls",[]);A(this,"ownsSharedStyles",!1);A(this,"useShadow",!1);A(this,"mountRoot",null);A(this,"resolveMounted",null);A(this,"emitListeners",new Map);let s=typeof t=="string"?Ce(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(),Yn(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"?Ce(t):t;Ae.clear(),z.clear();let s=this.startMarker,r=!!(s&&this.content),o=r&&s.isConnected,i=o?s.parentNode:null,a=o?this.endMarker.nextSibling:null,c={...this.data},d=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(c,d),!i)?!1:(d&&this.styleEls.forEach(u=>i.insertBefore(u,a)),i.insertBefore(this.content,a),this.mountRoot=i,this.resolveMounted?.(),!0)}static fetch(t){if(Array.isArray(t))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new me(_e(t))}static fetchAll(t){return Promise.all(t.map(_e))}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=zn(this.scripts),r=Kn(this.siblings,s),o=r?Object.assign(Object.create(r),t):{...t},i=new Set([...s].filter(l=>!(l in t)));i.size&&Object.defineProperty(o,Rt,{value:i}),this.slots&&Object.defineProperty(o,gt,{value:this.slots});let a=Q(o),c=H(a);this.data=a,this.fx=c,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let d=this.startMarker,u=!1,m=(l,p)=>{l==="model:update"&&!u&&(u=!0,console.warn("jq79: $emit('model:update', \u2026) no longer feeds :model - call $updateModel(value) or $updateModel(name, value) instead"));let g=new CustomEvent(l,{detail:p,bubbles:!0,composed:!0,cancelable:!0});return d===this.startMarker&&this.emitListeners.get(l)?.forEach(x=>x(g,p)),g.cancelBubble||d.dispatchEvent(g),!g.defaultPrevented},S,_=new Promise(l=>{S=l});this.resolveMounted=S;let O=()=>_,N=this.endMarker,y=l=>{let p=[];for(let g=d.nextSibling;g&&g!==N;g=g.nextSibling)g instanceof Element&&(g.matches(l)&&p.push(g),p.push(...Array.from(g.querySelectorAll(l))));return p},R=l=>y(l)[0]??null,T=this.modules,h=l=>T&&l in T?Promise.resolve(T[l]):Pe(In(l,this.filename)),$=Object.assign(Object.create(null),{$emit:m,$updateModel:(...l)=>{let[p,g]=l.length>1?l:[void 0,l[0]];return d!==this.startMarker?!1:this.modelWriteback?.(p,g)??!1},$slots:Object.fromEntries(Object.keys(this.slots??{}).map(l=>[l,!0]))}),b=l=>`await $mounted();${l}`;this.scripts.forEach((l,p)=>{let g={$mounted:O,$self:R,$$self:y,...$,...r},x={filename:this.filename,index:p},w=Qe(l.content);if(w!==null){it(a,de(l.content));let k=":mounted"in l.attrs?b(w):w;Jn(k,a,c.effect,g,h,x);return}let{vars:P,code:v}=ue(l.content);it(a,Me(l)),P.forEach(k=>{k in a||(a[k]=void 0)});let L=":mounted"in l.attrs?b(v):v;Hn(L,a,c.effect,g,h,x)});let j=document.createDocumentFragment(),f=new Proxy(a,{has:(l,p)=>typeof p=="string"&&p in $||Reflect.has(l,p),get:(l,p,g)=>typeof p=="string"&&p in $&&!Reflect.has(l,p)?$[p]:Reflect.get(l,p,g)});return j.append(this.startMarker,V(this.template,f,c,n),this.endMarker),this.content=j,n?this.styleEls=this.styles.map(l=>{let p=document.createElement("style");return p.textContent=l.content,p}):(this.styles.forEach(l=>Fn(ot(l))),this.ownsSharedStyles=!0),this}mount(t,n){let s=typeof t=="string"?Z(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"?Z(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.resolveMounted?.(),this}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=>Bn(ot(t))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}};A(W,"version",Qt);var me=class{constructor(t){A(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 es=e=>new W(e),Tt={$:Z,$$:ne,$create:se,$reactive:Q,Component79:W};typeof globalThis<"u"&&globalThis[Xn]&&$t();0&&(module.exports={$,$$,$create,$reactive,C79,Component79,PendingComponent79,enableHotReload,hotUpdate,parseComponent,renderComponent});
14
14
  //# sourceMappingURL=jq79.cjs.map