jq79 0.4.10 → 0.4.12

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 Z=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Yt=Object.prototype.hasOwnProperty;var te=(t,n,e)=>n in t?Z(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var ee=(t,n)=>{for(var e in n)Z(t,e,{get:n[e],enumerable:!0})},ne=(t,n,e,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Qt(n))!Yt.call(t,o)&&o!==e&&Z(t,o,{get:()=>n[o],enumerable:!(s=Vt(n,o))||s.enumerable});return t};var se=t=>ne(Z({},"__esModule",{value:!0}),t);var v=(t,n,e)=>te(t,typeof n!="symbol"?n+"":n,e);var Qe={};ee(Qe,{$:()=>F,$$:()=>K,$create:()=>X,$reactive:()=>B,Component79:()=>k,enableHotReload:()=>Xt,hotUpdate:()=>Kt,parseComponent:()=>Ve,renderComponent:()=>De});module.exports=se(Qe);function F(t,n){return typeof t=="string"?document.querySelector(t):t.querySelector(n)}function K(t,n){return Array.from(typeof t=="string"?document.querySelectorAll(t):t.querySelectorAll(n))}var X=(t,n={})=>{let e=document.createElement(t);for(let[s,o]of Object.entries(n))if(s==="className")e.className=Array.isArray(o)?o.join(" "):o;else if(s==="textContent")e.textContent=o;else if(s==="children")for(let r of o)e.appendChild(r);else e.setAttribute(s,o);return e},oe=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),bt={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},re=new Set(["http:","https:","mailto:"]);function ie(t){try{let n=new URL(t,"https://example.com");return re.has(n.protocol)}catch{return!1}}var le={"https:":"443","http:":"80"};function ce(t){let n=t.trim().toLowerCase().match(/^([a-z\d*][a-z\d.*-]*?)(?::(\d{1,5}|\*))?$/);if(!n)return null;let[,e,s]=n,o=e.split(".");return o.some(i=>i!=="*"&&!/^[a-z\d-]+$/.test(i))?null:{host:new RegExp(`^${o.map(i=>i==="*"?"[^.]+":i).join("\\.")}$`),port:!s||s==="*"?null:s}}var wt=t=>{let n=(Array.isArray(t)?t:t.split(",")).map(ce).filter(e=>e!==null);return e=>{let s=e.hostname.toLowerCase(),o=e.port||le[e.protocol]||"";return n.some(r=>r.host.test(s)&&(r.port===null||r.port===o))}};function ae(t,n,e,s){try{return!!t(new URL(n,document.baseURI),e,s)}catch{return!1}}var Et=512;function $t(t,n,e,s){if(e>Et)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${Et} elements`);for(let o of Array.from(t.childNodes))if(o.nodeType===Node.ELEMENT_NODE){let r=fe(o,e,s);r&&n.appendChild(r)}else o.nodeType===Node.TEXT_NODE&&n.appendChild(o.cloneNode())}function fe(t,n,e){let s=t.tagName.toLowerCase();if(!oe.has(s))return null;let o=document.createElement(s);for(let r of Array.from(t.attributes)){let i=r.name.toLowerCase(),l=bt[s]?.has(i),f=bt["*"]?.has(i);!l&&!f||(i==="href"||i==="src")&&(!ie(r.value)||e&&!ae(e,r.value,s,i))||o.setAttribute(i,r.value)}return s==="a"&&o.setAttribute("rel","noopener noreferrer"),$t(t,o,n+1,e),o}function St(t,n){let e=document.createElement("template");e.innerHTML=t;let s=document.createElement("div");return $t(e.content,s,0,n?.allowUrl),s.innerHTML}var ue=(t,n)=>n.split(".").reduce((e,s)=>e?.[s],t),Rt=t=>{if(Array.isArray(t))return!0;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},xt=(t,n,e)=>{Object.entries(t).forEach(([s,o])=>{let r=n?`${n}.${s}`:s;o&&typeof o=="object"&&Rt(o)?xt(o,r,e):e(r,o)})},de=(t,n)=>t===n||t.startsWith(`${n}.`)||n.startsWith(`${t}.`),ot=Symbol("jq79.raw"),J=t=>{let n=t;for(;n!==null&&typeof n=="object"&&n[ot];)n=n[ot];return n},Tt=Symbol("jq79.store"),H=t=>t!==null&&typeof t=="object"&&t[Tt]===!0,I=[],q=t=>{I.push(new Set);try{return t()}finally{I.pop()}},B=t=>{let n=new Map,e=new Set,s=new Set,o=new WeakMap,r=Object.create(null),i=(a,c,u=!1)=>{n.get(a)?.forEach(m=>m(c,a)),e.forEach(m=>m(a,c)),s.forEach(m=>{(u||Array.from(m.deps).some(A=>de(A,a)))&&m.run()})},l=a=>a!==null&&typeof a=="object"&&Rt(a),f=new Map,p=(a,c)=>{let u=f.get(c);u?.store!==a&&(u?.unsubscribe(),f.set(c,{store:a,unsubscribe:a.$onAny((m,A)=>i(`${c}.${m}`,A))}))},d=a=>{f.get(a)?.unsubscribe(),f.delete(a)},g=(a,c)=>{let u=o.get(a);if(u)return u;let m=null,A=new Proxy(a,{has(S,h){return Reflect.has(S,h)||typeof h=="string"&&m?.has(h)===!0},get(S,h,y){if(h===ot)return S;if(h===Tt)return c==="";if(typeof h!="string")return Reflect.get(S,h,y);if(c===""&&h in r)return r[h];let R=c?`${c}.${h}`:h;I[I.length-1]?.add(R);let w=Reflect.get(S,h,y);if(H(w))return p(w,R),w;let T=J(w);return l(T)?g(T,R):T},set(S,h,y,R){if(R!==A&&!Object.prototype.hasOwnProperty.call(S,h))return Reflect.set(S,h,y,R);let w=c?`${c}.${h}`:h,T=H(y)?y:J(y),_=!Object.prototype.hasOwnProperty.call(S,h);if(!_&&Object.is(S[h],T)&&(T===null||typeof T!="object"))return!0;S[h]=T,m?.delete(h),H(T)?p(T,w):d(w);let L=H(T)||!l(T)?T:g(T,w);return i(w,L,_),!0},deleteProperty(S,h){if(typeof h!="string")return Reflect.deleteProperty(S,h);let y=Object.prototype.hasOwnProperty.call(S,h),R=Reflect.deleteProperty(S,h);if(R&&y){let w=c?`${c}.${h}`:h;(m??(m=new Set)).add(h),d(w),i(w,void 0)}return R}});return o.set(a,A),A},$=g(J(t),"");Object.entries(J(t)).forEach(([a,c])=>{H(c)&&p(c,a)});let C=(a,c,{immediate:u=!1}={})=>(n.has(a)||n.set(a,new Set),n.get(a).add(c),u&&c(ue($,a),a),()=>n.get(a)?.delete(c)),x=(a,{immediate:c=!1}={})=>(e.add(a),c&&xt($,"",(u,m)=>a(u,m)),()=>e.delete(a)),b=a=>{let c=!1,u=!1,m={deps:new Set,run:()=>{if(c){u=!0;return}c=!0;try{let A=0;do{u=!1;let S=new Set;I.push(S);try{a()}finally{I.pop(),m.deps=S}}while(u&&++A<100);u&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{c=!1}}};return s.add(m),m.run(),()=>{s.delete(m)}},E=()=>{f.forEach(({unsubscribe:a})=>a()),f.clear()};return r.$on=C,r.$onAny=x,r.$effect=b,r.$dispose=E,$},W=t=>{let n=[],e=[];return{effect:s=>{n.push(t.$effect(s)),e.push(s)},onDispose:s=>{n.push(s)},refresh:()=>{e.forEach(s=>s())},dispose:()=>{n.splice(0).forEach(s=>s()),e.length=0}}};var Ct=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,At=/\$:\s*/y,Q=/import(?=\s*\()/y,Nt=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,M=(t,n)=>{let e=t[n],s=n+1;for(;s<t.length;){if(t[s]==="\\"){s+=2;continue}if(t[s]===e)return s+1;s++}return t.length},j=(t,n)=>{let e=t.indexOf(`
2
- `,n);return e===-1?t.length:e},O=(t,n)=>{let e=t.indexOf("*/",n+2);return e===-1?t.length:e+2},V=(t,n)=>{let e=n;for(;e<t.length;){if(/\s/.test(t[e])){e++;continue}if(t[e]==="/"&&t[e+1]==="/"){e=j(t,e);continue}if(t[e]==="/"&&t[e+1]==="*"){e=O(t,e);continue}break}return e},pe=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),D=(t,n)=>{let e=n-1;for(;e>=0;){let o=t[e];if(/\s/.test(o)){e--;continue}if(o==="/"&&t[e-1]==="*"){let r=t.lastIndexOf("/*",e-2);if(r===-1)return!0;e=r-1;continue}break}if(e<0)return!0;let s=t[e];if(/[\w$]/.test(s)){let o=e;for(;o>0&&/[\w$]/.test(t[o-1]);)o--;return pe.has(t.slice(o,e+1))}return(s==="+"||s==="-")&&t[e-1]===s?!1:!")]}\"'`.".includes(s)},P=(t,n)=>{let e=n+1,s=!1;for(;e<t.length;){let o=t[e];if(o==="\\"){e+=2;continue}if(o===`
3
- `)return e;if(o==="[")s=!0;else if(o==="]")s=!1;else if(o==="/"&&!s){for(e++;e<t.length&&/[a-z]/i.test(t[e]);)e++;return e}e++}return t.length},he=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,me=(t,n)=>{let e=n-1;for(;e>=0;){let s=t[e];if(/\s/.test(s)){e--;continue}if(s==="/"&&t[e-1]==="*"){let o=t.lastIndexOf("/*",e-2);if(o===-1)return"";e=o-1;continue}return s}return""},vt=(t,n)=>{let e=0,s=n;for(;s<t.length;){let o=t[s];if(o==="'"||o==='"'||o==="`"){s=M(t,s);continue}if(o==="/"&&t[s+1]==="/"){s=j(t,s);continue}if(o==="/"&&t[s+1]==="*"){s=O(t,s);continue}if(o==="/"&&D(t,s)){s=P(t,s);continue}if("([{".includes(o))e++;else if(")]}".includes(o))e--;else{if(e<=0&&o===";")return s;if(e<=0&&o===`
4
- `){let r=V(t,s+1);if(!(r<t.length&&(he.test(t.slice(r,r+2))||[",","="].includes(me(t,s)))))return s;s=r;continue}}s++}return t.length},ge=t=>{let n=[],e=0,s=0,o=0,r=l=>{n.push({raw:t.slice(s,l),codeEnd:Math.max(0,o-s)}),s=l+1,o=s},i=0;for(;i<t.length;){let l=t[i];if(l==="'"||l==='"'||l==="`"){i=M(t,i),o=i;continue}if(l==="/"&&t[i+1]==="/"){i=j(t,i);continue}if(l==="/"&&t[i+1]==="*"){i=O(t,i);continue}if(l==="/"&&D(t,i)){i=P(t,i),o=i;continue}if("([{".includes(l))e++;else if(")]}".includes(l))e--;else if(l===","&&e<=0){r(i),i++;continue}/\s/.test(l)||(o=i+1),i++}return r(t.length),n},rt=t=>{let n=t.trim();if(!n.startsWith("{")&&!n.startsWith("["))return it.test(n)?[n]:[];let e=[];for(let s of ct(n.slice(1,_t(n)))){s.startsWith("...")&&(s=s.slice(3).trim());let o=at(s);if(o!==-1&&(s=s.slice(0,o).trim()),n.startsWith("{")){let r=lt(s,":");if(r!==-1){e.push(...rt(s.slice(r+1)));continue}}e.push(...rt(s))}return e},ye=t=>{let n=[],e=ge(t).map(({raw:r,codeEnd:i})=>{let l=r.match(/^\s*/)[0];if(i<=l.length)return{text:r,empty:!0};let f=r.slice(l.length,i),p=r.slice(i),d=at(f),g=(d===-1?f:f.slice(0,d)).trim(),$=f[0]==="{"||f[0]==="[";$?n.push(...rt(g)):it.test(g)&&n.push(g);let C=tt(f).code;return{text:`${l}${$?`(${C})`:C}${p}`,empty:!1}}),s=[];for(;e.length&&e[e.length-1].empty;)s.unshift(e.pop().text);let o=e.map(r=>r.text).join(",")+s.join("");return o.trimStart().startsWith("(")&&(o=`;${o}`),{vars:n,code:o}},tt=t=>{let n=[],e="",s=0,o=0,r=!0;for(;s<t.length;){let i=t[s],l=t[s+1];if(i==="'"||i==='"'||i==="`"){let f=M(t,s);e+=t.slice(s,f),s=f,r=!1;continue}if(i==="/"&&(l==="/"||l==="*")){let f=l==="/"?j(t,s):O(t,s);e+=t.slice(s,f),s=f;continue}if(i==="/"&&D(t,s)){let f=P(t,s);e+=t.slice(s,f),s=f,r=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(t[s-1]))&&(Q.lastIndex=s,Q.test(t))){e+="$__import",s+=6,r=!1;continue}if(o===0&&r){Ct.lastIndex=s;let f=Ct.exec(t);if(f){let d=s+f[0].length,g=vt(t,d),{vars:$,code:C}=ye(t.slice(d,g));n.push(...$),e+=C,s=g,r=!1;continue}At.lastIndex=s;let p=At.exec(t);if(p){Nt.lastIndex=s;let d=Nt.exec(t);d&&n.push(d[1]);let g=s+p[0].length,$=vt(t,g);e+=`$__effect(() => { ${tt(t.slice(g,$)).code} });`,s=$;continue}}"([{".includes(i)?o++:")]}".includes(i)&&(o=Math.max(0,o-1)),i===`
5
- `||i===";"||i==="}"?r=!0:/\s/.test(i)||(r=!1),e+=i,s++}return{vars:n,code:e}},Y=/export\s+default(?![\w$])/y,Lt=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,be=t=>{let n=[],e=0,s=0;for(let o=0;o<=t.length;o++){let r=t[o];if(r==="{")e++;else if(r==="}")e--;else if(o===t.length||r===","&&e===0){let i=t.slice(s,o).trim();i&&n.push(i),s=o+1}}return n},Ee=(t,n,e)=>{let s=`await $__import(${JSON.stringify(n)})`;if(t===void 0)return s;let o=be(t),r=[],i=s;if(o.length>1){let l=`$__mod${e}`;r.push(`${l} = ${s}`),i=l}for(let l of o)l.startsWith("{")?r.push(`${l.replace(/\s+as\s+/g,": ")} = ${i}`):l.startsWith("*")?r.push(`${l.replace(/^\*\s*as\s+/,"")} = ${i}`):r.push(`${l} = $__default(${i})`);return`const ${r.join(", ")}`},it=/^[A-Za-z_$][\w$]*$/,_t=t=>{let n=0,e=0;for(;e<t.length;){let s=t[e];if(s==="'"||s==='"'||s==="`"){e=M(t,e);continue}if(s==="/"&&t[e+1]==="/"){e=j(t,e);continue}if(s==="/"&&t[e+1]==="*"){e=O(t,e);continue}if(s==="/"&&D(t,e)){e=P(t,e);continue}if("([{".includes(s))n++;else if(")]}".includes(s)&&--n===0)return e;e++}return t.length},lt=(t,n)=>{let e=0,s=0;for(;s<t.length;){let o=t[s];if(o==="'"||o==='"'||o==="`"){s=M(t,s);continue}if(o==="/"&&t[s+1]==="/"){s=j(t,s);continue}if(o==="/"&&t[s+1]==="*"){s=O(t,s);continue}if(o==="/"&&o!==n&&D(t,s)){s=P(t,s);continue}if("([{".includes(o))e++;else if(")]}".includes(o))e--;else if(e===0&&o===n)return s;s++}return-1},ct=t=>{let n=[],e=0,s=0,o=0;for(;o<=t.length;){let r=t[o];if(r==="'"||r==='"'||r==="`"){o=M(t,o);continue}if(r==="/"&&t[o+1]==="/"){o=j(t,o);continue}if(r==="/"&&t[o+1]==="*"){o=O(t,o);continue}if(r==="/"&&D(t,o)){o=P(t,o);continue}if(r!==void 0&&"([{".includes(r))e++;else if(r!==void 0&&")]}".includes(r))e--;else if(o===t.length||r===","&&e===0){let i=t.slice(s,o).trim();i&&n.push(i),s=o+1}o++}return n},at=t=>{let n=0;for(;n<t.length;){let e=lt(t.slice(n),"=");if(e===-1)return-1;let s=n+e;if(t[s+1]!=="="&&t[s+1]!==">"&&t[s-1]!=="="&&t[s-1]!=="!")return s;n=s+1}return-1},ft=t=>{let n=(t??"").trim();if(!n.startsWith("{"))return null;let e=_t(n);if(e>=n.length)return null;let s=[];for(let o of ct(n.slice(1,e))){if(o.startsWith("..."))continue;let r=at(o),i=r===-1?o:o.slice(0,r),l=r===-1?void 0:o.slice(r+1).trim(),f=lt(i,":"),p=(f===-1?i:i.slice(0,f)).trim();it.test(p)&&s.push(l===void 0?{name:p}:{name:p,default:l})}return s},we=t=>{let n=0,e=0,s=!0;for(;n<t.length;){let o=t[n];if(o==="'"||o==='"'||o==="`"){n=M(t,n),s=!1;continue}if(o==="/"&&t[n+1]==="/"){n=j(t,n);continue}if(o==="/"&&t[n+1]==="*"){n=O(t,n);continue}if(o==="/"&&D(t,n)){n=P(t,n),s=!1;continue}if(o==="e"&&e===0&&s&&(n===0||!/[\w$.]/.test(t[n-1]))){Y.lastIndex=n;let r=Y.exec(t);if(r)return n+r[0].length}"([{".includes(o)?e++:")]}".includes(o)&&(e=Math.max(0,e-1)),o===`
6
- `||o===";"||o==="}"?s=!0:/\s/.test(o)||(s=!1),n++}return-1},$e=/^async(?![\w$])/,Se=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,Re=t=>{let n=we(t);if(n===-1)return null;let e=V(t,n),s=t.slice(e);$e.test(s)&&(e=V(t,e+5));let o=Se.exec(t.slice(e));if(o&&(e=V(t,e+o[0].length)),t[e]!=="(")return null;let r=0,i=e;for(;i<t.length;){let l=t[i];if(l==="'"||l==='"'||l==="`"){i=M(t,i);continue}if(l==="/"&&t[i+1]==="/"){i=j(t,i);continue}if(l==="/"&&t[i+1]==="*"){i=O(t,i);continue}if(l==="/"&&D(t,i)){i=P(t,i);continue}if("([{".includes(l))r++;else if(")]}".includes(l)&&--r===0)break;i++}return ct(t.slice(e+1,i))[0]??""},jt=t=>{let n=Re(t);if(n===null)return null;let e=ft(n),s=e?.find(o=>o.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 e},Ot=t=>{let n="",e=0,s=0,o=!0,r=!1,i=0;for(;e<t.length;){let l=t[e],f=t[e+1],p=e===0||!/[\w$.]/.test(t[e-1]);if(l==="'"||l==='"'||l==="`"){let d=M(t,e);n+=t.slice(e,d),e=d,o=!1;continue}if(l==="/"&&(f==="/"||f==="*")){let d=f==="/"?j(t,e):O(t,e);n+=t.slice(e,d),e=d;continue}if(l==="/"&&D(t,e)){let d=P(t,e);n+=t.slice(e,d),e=d,o=!1;continue}if(l==="i"&&p){if(Q.lastIndex=e,Q.test(t)){n+="$__import",e+=6,o=!1;continue}if(s===0&&o){Lt.lastIndex=e;let d=Lt.exec(t);if(d){n+=Ee(d[1],d[3],i++),e+=d[0].length,o=!1;continue}}}if(l==="e"&&p&&s===0&&o){Y.lastIndex=e;let d=Y.exec(t);if(d){r=!0,n+="$__exports.default =",e+=d[0].length,o=!1;continue}}"([{".includes(l)?s++:")]}".includes(l)&&(s=Math.max(0,s-1)),l===`
7
- `||l===";"||l==="}"?o=!0:/\s/.test(l)||(o=!1),n+=l,e++}return r?n:null};var It=t=>Object.fromEntries(Array.from(t.attributes).map(n=>[n.name,n.value])),Wt=t=>({tag:t.tagName.toLowerCase(),attrs:It(t),children:Array.from(t.childNodes).flatMap(n=>{if(n.nodeType===Node.TEXT_NODE){let e=n.textContent??"";return e?[e]:[]}return n.nodeType===Node.ELEMENT_NODE?[Wt(n)]:[]})}),Mt=new Map,Ht=(t,n)=>{let e=`${n.join(",")}|${t}`,s=Mt.get(e);if(s===void 0){try{s=new Function("$scope",...n,`with ($scope) { return (${t}
8
- ); }`)}catch{s=null}Mt.set(e,s)}return s},N=(t,n,e)=>{let s=Ht(t,e?Object.keys(e):[]);if(s)try{return s(n,...e?Object.values(e):[])}catch{return}},xe=(t,n)=>t.replace(/{{\s*([\s\S]+?)\s*}}/g,(e,s)=>N(s,n)??""),Te=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed"]),qt=t=>Te.has(t)||t.startsWith(":class."),Ce=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,Ae=(t,n,e,s)=>{let[o,...r]=n.slice(1).split("."),i=new Set(r);t.addEventListener(o,l=>{if(i.has("self")&&l.target!==t)return;i.has("prevent")&&l.preventDefault(),i.has("stop")&&l.stopPropagation();let f=N(e,s,{$event:l});typeof f=="function"&&f.call(t,l)},{once:i.has("once"),capture:i.has("capture")})},Ne=(t,n,e,s)=>{let[o,...r]=n.slice(1).split("."),i=new Set(r),l=f=>{i.has("prevent")&&f.preventDefault(),i.has("stop")&&f.stopPropagation(),i.has("once")&&t.off(o,l),q(()=>{let p=N(e,s,{$event:f});typeof p=="function"&&p(f)})};t.on(o,l)},et=t=>t.replace(/-(\w)/g,(n,e)=>e.toUpperCase()),dt=t=>t instanceof DocumentFragment?{first:t.firstChild,last:t.lastChild}:{first:t,last:t},nt=({first:t,last:n})=>{for(let e=t;e;){let s=e===n?null:e.nextSibling;e.parentNode?.removeChild(e),e=s}},ve=({first:t,last:n},e)=>{let s=e.nextSibling;for(let o=t;o;){let r=o===n?null:o.nextSibling;e.parentNode.insertBefore(o,s),o=r}},Dt=(t,n)=>{let e=n.replace(/-/g,"").toLowerCase();for(let s=t;s&&s!==Object.prototype;s=Object.getPrototypeOf(s))for(let o of Object.keys(s))if(/^[A-Z]/.test(o)&&o.replace(/-/g,"").toLowerCase()===e)return o;return null},Pt=(t,n,e,s,o)=>{let r=document.createComment(t),i=document.createComment(`/${t}`),l=document.createDocumentFragment();l.append(r,i);let f={},p={},d=[];Object.entries(n.attrs).forEach(([a,c])=>{if(!(a===mt||qt(a)))if(a.startsWith("@"))d.push([a,c]);else if(a===":model"||a.startsWith(":model.")){let u=a===":model"?"default":et(a.slice(7));p[u]=c||(a===":model"?"model":u)}else if(a.startsWith(":")){let u=et(a.slice(1));f[u]=c||u}else f[et(a)]=JSON.stringify(c)});let g=a=>a==="default"?":model":`:model.${a}`,$=a=>a==="default"?"model":a,C=a=>`${a}
9
- = $value`;Object.entries(p).forEach(([a,c])=>{let u=$(a);f[u]!==void 0&&console.warn(`jq79: <${n.tag}> binds prop "${u}" through both :${u} and ${g(a)} - ${g(a)} wins`),f[u]=c,Ht(C(c),["$value"])===null&&console.warn(`jq79: ${g(a)}="${c}" is not assignable - updates from <${n.tag}> will be dropped`)});let x=null,b=null,E=null;return s.effect(()=>{let a=N(t,e),c=a instanceof k?a:null;if(c===b||(E?.dispose(),E=null,x?.destroy(),x=null,b=c,!c))return;let u=new k({template:c.template,scripts:c.scripts,styles:c.styles,modules:c.modules,filename:c.filename});if(Object.keys(p).length){let h=new Set,y=(R,w)=>{h.has(R)||(h.add(R),console.warn(w))};u.on("model:update",(R,w)=>{if(w===null||typeof w!="object"){y("payload",`jq79: model:update expects a { name?, value } payload, got ${w===null?"null":typeof w}`);return}let T=w.name==null?"default":et(String(w.name)),_=p[T];if(_===void 0){y(T,`jq79: <${n.tag}> has no ${g(T)} - bound: ${Object.keys(p).map(g).join(", ")}`);return}q(()=>N(C(_),e,{$value:w.value}))})}d.forEach(([h,y])=>Ne(u,h,y,e));let m=q(()=>Object.fromEntries(Object.entries(f).map(([h,y])=>[h,N(y,e)]))),A=document.createDocumentFragment();(o?u.renderShadow(m):u.render(m)).mount(A),i.parentNode.insertBefore(A,i);let S=W(e);Object.entries(f).forEach(([h,y])=>{S.effect(()=>{u.data[h]=N(y,e)})}),E=S,x=u}),s.onDispose(()=>{E?.dispose(),x?.destroy()}),l},Le=(t,n)=>{let e=()=>{let s=N(t,n);return s!==null&&typeof s=="object"?s:null};return new Proxy(n,{has(s,o){let r=e();return r!==null&&Reflect.has(r,o)||Reflect.has(s,o)},get(s,o){let r=e();return r!==null&&Reflect.has(r,o)?r[o]:Reflect.get(s,o)},set(s,o,r){let i=e();return i!==null&&Reflect.has(i,o)?(i[o]=r,!0):Reflect.set(s,o,r)}})},G=t=>typeof t=="string"?t.split(/\s+/).filter(Boolean):Array.isArray(t)?t.flatMap(G):t!==null&&typeof t=="object"?Object.entries(t).flatMap(([n,e])=>e?G(n):[]):[],_e=t=>typeof t=="function"?(n,e,s)=>{try{return!!t(n,e,s)}catch{return!1}}:typeof t=="string"||Array.isArray(t)?wt(t):()=>!1,pt=(t,n,e,s)=>{let o=t.attrs[":with"],r=o!==void 0?Le(o,n):n,i=Dt(r,t.tag);if(i)return Pt(i,t,r,e,s);let l=document.createElement(t.tag);if(l instanceof HTMLUnknownElement||t.tag.includes("-")){let b=!1;e.effect(()=>{if(b)return;let E=Dt(r,t.tag);if(!E)return;b=!0;let a=Pt(E,t,r,e,s),c=dt(a);e.onDispose(()=>nt(c)),l.replaceWith(a)})}Object.entries(t.attrs).forEach(([b,E])=>{b.startsWith("@")?Ae(l,b,E,r):b===":model"||b.startsWith(":model.")?l instanceof HTMLUnknownElement||t.tag.includes("-")||console.warn(`jq79: ${b} on <${t.tag}> does nothing - :model binds component tags only (for now)`):qt(b)||l.setAttribute(b,E)});let f=t.attrs[":attrs"];if(f!==void 0){let b=[];e.effect(()=>{b.forEach(a=>l.removeAttribute(a));let E=N(f,r);b=E&&typeof E=="object"?Object.keys(E):[],b.forEach(a=>{let c=E[a];c!=null&&c!==!1&&l.setAttribute(a,String(c))})})}let p=t.attrs[":class"],d=Object.entries(t.attrs).filter(([b])=>b.startsWith(":class.")).map(([b,E])=>[b.slice(7),E]);if(p!==void 0||d.length){let b=new Set(G(t.attrs.class??"")),E=[];e.effect(()=>{let a=p!==void 0?G(N(p,r)):[];d.forEach(([c,u])=>{N(u,r)&&a.push(...G(c))}),E.forEach(c=>{!a.includes(c)&&!b.has(c)&&l.classList.remove(c)}),l.classList.add(...a),E=a})}let g=t.attrs[":text"],$=t.attrs[":html"],C=t.attrs[":html.allowed"];C!==void 0&&$===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),g!==void 0?e.effect(()=>{l.textContent=String(N(g,r)??"")}):$!==void 0?e.effect(()=>{let b=C!==void 0?{allowUrl:_e(N(C,r))}:void 0;l.innerHTML=St(String(N($,r)??""),b)}):l.appendChild(ht(t.children,r,e,s));let x=t.attrs[":value"];return x!==void 0&&e.effect(()=>{let b=String(N(x,r)??"");l.value!==b&&(l.value=b)}),[":checked",":selected"].forEach(b=>{let E=t.attrs[b];if(E===void 0)return;let a=b.slice(1);e.effect(()=>{l[a]=!!N(E,r)})}),l},je=(t,n,e,s)=>{let o=document.createComment("if"),r=document.createDocumentFragment();r.appendChild(o);let i=null,l=null,f=null;return e.effect(()=>{let p=t.find(g=>g.expr===void 0||N(g.expr,n))??null;if(p===l||(f?.dispose(),i&&nt(i),i=null,l=p,!p))return;f=W(n);let d=pt(p.node,n,f,s);i=dt(d),o.parentNode.insertBefore(d,o.nextSibling)}),r},z=(t,n,e)=>{Object.defineProperty(t,n,{value:e,writable:!0,enumerable:!0,configurable:!0})},Oe=t=>{if(t===null||typeof t!="object"||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},Me=(t,n,e,s)=>{let o=t.attrs[":each"].match(Ce);if(!o)return document.createComment(`invalid :each expression "${t.attrs[":each"]}"`);let[,r,i,l]=o,f=t.attrs[":key"],{[":each"]:p,[":key"]:d,...g}=t.attrs,$={...t,attrs:g},C=document.createComment("each"),x=document.createDocumentFragment();x.appendChild(C),(":if"in t.attrs||":elseif"in t.attrs||":else"in t.attrs)&&console.warn("jq79: :if/:elseif/:else on a :each element is ignored; filter the list expression instead");let b=[],E=!1;return e.effect(()=>{let a=N(l,n),c=Array.isArray(a)?a.map((y,R)=>[R,y]):Oe(a)?Object.entries(a):[],u=new Map;b.forEach(y=>{let R=u.get(y.key);R?R.push(y):u.set(y.key,[y])});let m=new Set,A=[],S=c.map(([y,R],w)=>{let T=Object.create(n);z(T,r,R),i&&z(T,i,y),z(T,"$index",w);let _=f!==void 0?N(f,T):y;m.has(_)&&!E&&(E=!0,console.warn(`jq79: duplicate :key in :each "${t.attrs[":each"]}"; duplicates pair up by position`)),m.add(_);let L=u.get(_)?.shift();if(L&&Object.is(L.item,R))return L.scope.$index!==w&&A.push(L),z(L.scope,"$index",w),i&&z(L.scope,i,y),L;L&&(L.fx.dispose(),nt(L.range));let yt=W(n),Jt=dt(pt($,T,yt,s));return{key:_,item:R,scope:T,fx:yt,range:Jt}});u.forEach(y=>y.forEach(R=>{R.fx.dispose(),nt(R.range)}));let h=C;S.forEach(y=>{h.nextSibling!==y.range.first&&ve(y.range,h),h=y.range.last}),A.forEach(y=>q(()=>y.fx.refresh())),b=S}),x},ht=(t,n,e,s=!1)=>{let o=document.createDocumentFragment(),r=0;for(;r<t.length;){let i=t[r];if(typeof i=="string"){let l=document.createTextNode(i);i.includes("{{")&&e.effect(()=>{l.textContent=xe(i,n)}),o.appendChild(l),r++;continue}if(":each"in i.attrs){o.appendChild(Me(i,n,e,s)),r++;continue}if(":if"in i.attrs){let l=[{expr:i.attrs[":if"],node:i}];r++;let f=d=>{let g=r;for(;g<t.length&&typeof t[g]=="string"&&!t[g].trim();)g++;let $=t[g];if(typeof $=="object"&&d in $.attrs)return r=g+1,$};for(let d=f(":elseif");d;d=f(":elseif"))l.push({expr:d.attrs[":elseif"],node:d});let p=f(":else");p&&l.push({node:p}),o.appendChild(je(l,n,e,s));continue}o.appendChild(pt(i,n,e,s)),r++}return o},De=(t,n,e=!1)=>ht(t.template,n,W(n),e),Pe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ue=/<([A-Za-z][\w-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,ke=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Fe=t=>t.split(ke).map((n,e)=>e%2===1?n:n.replace(Ue,(s,o,r)=>Pe.has(o.toLowerCase())?s:`<${o}${r}></${o}>`)).join(""),mt="data-jq79",Ie=t=>{let n=2166136261;for(let e=0;e<t.length;e++)n=Math.imul(n^t.charCodeAt(e),16777619);return(n>>>0).toString(36)},Bt=(t,n)=>{t.forEach(e=>{typeof e!="string"&&(e.attrs[mt]=n,Bt(e.children,n))})},We=(t,n)=>t.split(",").map(e=>{let s=e.trim(),o=s.indexOf("::"),r=o===-1?s:s.slice(0,o),i=o===-1?"":s.slice(o);return`${r}[${mt}="${n}"]${i}`}).join(", "),zt=(t,n)=>{Array.from(t).forEach(e=>{e instanceof CSSStyleRule?e.selectorText=We(e.selectorText,n):e instanceof CSSGroupingRule&&zt(e.cssRules,n)})},He=(t,n)=>{/:deep\(|::v-deep|>>>/.test(t)&&console.warn("jq79: :deep()/::v-deep/>>> are not supported in <style scoped>; the rule will be dropped by the browser");let e=new CSSStyleSheet;return e.replaceSync(t),zt(e.cssRules,n),Array.from(e.cssRules).map(s=>s.cssText).join(`
10
- `)},ut=t=>{let e=new DOMParser().parseFromString(`<template>${Fe(t)}</template>`,"text/html").querySelector("template"),s=[],o=[],r=[];Array.from(e.content.children).forEach(l=>{let f={attrs:It(l),content:l.textContent??""};l.tagName==="SCRIPT"?s.push(f):l.tagName==="STYLE"?o.push(f):r.push(Wt(l))}),o.forEach(l=>{"lang"in l.attrs&&console.warn(`jq79: <style lang="${l.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 i=l=>"scoped"in l.attrs&&!("lang"in l.attrs);if(o.some(i)){let l=Ie(t);Bt(r,l),o.forEach(f=>{i(f)&&(f.scoped=He(f.content,l))})}return{template:r,scripts:s,styles:o}},gt=t=>/\.html?([?#]|$)/.test(t)?k.fetch(t):import(t),Gt=(t,n)=>t?`
11
- //# sourceURL=${t}?jq79-script=${n}`:"",Ut=t=>t.scoped??t.content,st=new Map,qe=t=>{let n=st.get(t);if(!n){let e=document.createElement("style");e.textContent=t,document.head.appendChild(e),n={el:e,count:0},st.set(t,n)}n.count++},Be=t=>{let n=st.get(t);n&&--n.count<=0&&(n.el.remove(),st.delete(t))},Zt={$:F,$$:K,$create:X,$reactive:B},ze=(t,n,e,s={},o=gt,r={})=>{let i={...Zt,...s},l=new Proxy(n,{has:(p,d)=>d!=="$__effect"&&d!=="$__import"&&(Reflect.has(p,d)||!(d in globalThis)&&!(d in i))});new Function("$scope","$__effect","$__import",...Object.keys(i),`return (async () => { with ($scope) { ${t} } })()${Gt(r.filename,r.index??0)}`)(l,e,o,...Object.values(i)).catch(p=>console.error("jq79: error in :setup script",p))},kt=(t,n)=>{n?.forEach(({name:e,default:s})=>{t[e]===void 0&&(t[e]=s===void 0?void 0:N(s,t))})},Ge=t=>t&&t.default!==void 0?t.default:t,Ze=(t,n,e,s={},o=gt,r={})=>{let i={...Zt,...s},l={},f=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
1
+ var X=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var ee=(t,n,e)=>n in t?X(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var ne=(t,n)=>{for(var e in n)X(t,e,{get:n[e],enumerable:!0})},se=(t,n,e,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Yt(n))!te.call(t,o)&&o!==e&&X(t,o,{get:()=>n[o],enumerable:!(s=Qt(n,o))||s.enumerable});return t};var oe=t=>se(X({},"__esModule",{value:!0}),t);var j=(t,n,e)=>ee(t,typeof n!="symbol"?n+"":n,e);var en={};ne(en,{$:()=>k,$$:()=>J,$create:()=>V,$reactive:()=>z,C79:()=>U,Component79:()=>U,enableHotReload:()=>Jt,hotUpdate:()=>Xt,parseComponent:()=>tn,renderComponent:()=>De});module.exports=oe(en);function k(t,n){return typeof t=="string"?document.querySelector(t):t.querySelector(n)}function J(t,n){return Array.from(typeof t=="string"?document.querySelectorAll(t):t.querySelectorAll(n))}var V=(t,n={})=>{let e=document.createElement(t);for(let[s,o]of Object.entries(n))if(s==="className")e.className=Array.isArray(o)?o.join(" "):o;else if(s==="textContent")e.textContent=o;else if(s==="children")for(let r of o)e.appendChild(r);else e.setAttribute(s,o);return e},re=new Set(["a","b","i","em","strong","p","br","ul","ol","li","blockquote","code","pre","span","div","h1","h2","h3","h4","h5","h6","img"]),bt={a:new Set(["href","title"]),img:new Set(["src","alt"]),"*":new Set(["class"])},ie=new Set(["http:","https:","mailto:"]);function le(t){try{let n=new URL(t,"https://example.com");return ie.has(n.protocol)}catch{return!1}}var ce={"https:":"443","http:":"80"};function ae(t){let n=t.trim().toLowerCase().match(/^([a-z\d*][a-z\d.*-]*?)(?::(\d{1,5}|\*))?$/);if(!n)return null;let[,e,s]=n,o=e.split(".");return o.some(i=>i!=="*"&&!/^[a-z\d-]+$/.test(i))?null:{host:new RegExp(`^${o.map(i=>i==="*"?"[^.]+":i).join("\\.")}$`),port:!s||s==="*"?null:s}}var $t=t=>{let n=(Array.isArray(t)?t:t.split(",")).map(ae).filter(e=>e!==null);return e=>{let s=e.hostname.toLowerCase(),o=e.port||ce[e.protocol]||"";return n.some(r=>r.host.test(s)&&(r.port===null||r.port===o))}};function fe(t,n,e,s){try{return!!t(new URL(n,document.baseURI),e,s)}catch{return!1}}var wt=512;function St(t,n,e,s){if(e>wt)throw new RangeError(`jq79: sanitizeHTML input nests deeper than ${wt} elements`);for(let o of Array.from(t.childNodes))if(o.nodeType===Node.ELEMENT_NODE){let r=ue(o,e,s);r&&n.appendChild(r)}else o.nodeType===Node.TEXT_NODE&&n.appendChild(o.cloneNode())}function ue(t,n,e){let s=t.tagName.toLowerCase();if(!re.has(s))return null;let o=document.createElement(s);for(let r of Array.from(t.attributes)){let i=r.name.toLowerCase(),l=bt[s]?.has(i),c=bt["*"]?.has(i);!l&&!c||(i==="href"||i==="src")&&(!le(r.value)||e&&!fe(e,r.value,s,i))||o.setAttribute(i,r.value)}return s==="a"&&o.setAttribute("rel","noopener noreferrer"),St(t,o,n+1,e),o}function Rt(t,n){let e=document.createElement("template");e.innerHTML=t;let s=document.createElement("div");return St(e.content,s,0,n?.allowUrl),s.innerHTML}var de=(t,n)=>n.split(".").reduce((e,s)=>e?.[s],t),xt=t=>{if(Array.isArray(t))return!0;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},Tt=(t,n,e)=>{Object.entries(t).forEach(([s,o])=>{let r=n?`${n}.${s}`:s;o&&typeof o=="object"&&xt(o)?Tt(o,r,e):e(r,o)})},pe=(t,n)=>t===n||t.startsWith(`${n}.`)||n.startsWith(`${t}.`),it=Symbol("jq79.raw"),Q=t=>{let n=t;for(;n!==null&&typeof n=="object"&&n[it];)n=n[it];return n},Ct=Symbol("jq79.store"),q=t=>t!==null&&typeof t=="object"&&t[Ct]===!0,I=[],B=t=>{I.push(new Set);try{return t()}finally{I.pop()}},z=t=>{let n=new Map,e=new Set,s=new Set,o=new WeakMap,r=Object.create(null),i=(u,a,g=!1)=>{n.get(u)?.forEach(f=>f(a,u)),e.forEach(f=>f(u,a)),s.forEach(f=>{(g||Array.from(f.deps).some(y=>pe(y,u)))&&f.run()})},l=u=>u!==null&&typeof u=="object"&&xt(u),c=new Map,p=(u,a)=>{let g=c.get(a);g?.store!==u&&(g?.unsubscribe(),c.set(a,{store:u,unsubscribe:u.$onAny((f,y)=>i(`${a}.${f}`,y))}))},d=u=>{c.get(u)?.unsubscribe(),c.delete(u)},E=(u,a)=>{let g=o.get(u);if(g)return g;let f=null,y=new Proxy(u,{has(h,m){return Reflect.has(h,m)||typeof m=="string"&&f?.has(m)===!0},get(h,m,w){if(m===it)return h;if(m===Ct)return a==="";if(typeof m!="string")return Reflect.get(h,m,w);if(a===""&&m in r)return r[m];let C=a?`${a}.${m}`:m;I[I.length-1]?.add(C);let R=Reflect.get(h,m,w);if(q(R))return p(R,C),R;let $=Q(R);return l($)?E($,C):$},set(h,m,w,C){if(C!==y&&!Object.prototype.hasOwnProperty.call(h,m))return Reflect.set(h,m,w,C);let R=a?`${a}.${m}`:m,$=q(w)?w:Q(w),v=!Object.prototype.hasOwnProperty.call(h,m);if(!v&&Object.is(h[m],$)&&($===null||typeof $!="object"))return!0;h[m]=$,f?.delete(m),q($)?p($,R):d(R);let T=q($)||!l($)?$:E($,R);return i(R,T,v),!0},deleteProperty(h,m){if(typeof m!="string")return Reflect.deleteProperty(h,m);let w=Object.prototype.hasOwnProperty.call(h,m),C=Reflect.deleteProperty(h,m);if(C&&w){let R=a?`${a}.${m}`:m;(f??(f=new Set)).add(m),d(R),i(R,void 0)}return C}});return o.set(u,y),y},S=E(Q(t),"");Object.entries(Q(t)).forEach(([u,a])=>{q(a)&&p(a,u)});let A=(u,a,{immediate:g=!1}={})=>(n.has(u)||n.set(u,new Set),n.get(u).add(a),g&&a(de(S,u),u),()=>n.get(u)?.delete(a)),_=(u,{immediate:a=!1}={})=>(e.add(u),a&&Tt(S,"",(g,f)=>u(g,f)),()=>e.delete(u)),b=u=>{let a=!1,g=!1,f={deps:new Set,run:()=>{if(a){g=!0;return}a=!0;try{let y=0;do{g=!1;let h=new Set;I.push(h);try{u()}finally{I.pop(),f.deps=h}}while(g&&++y<100);g&&console.error("jq79: an effect re-woke itself 100 times in a row (it writes what it reads); giving up on it settling")}finally{a=!1}}};return s.add(f),f.run(),()=>{s.delete(f)}},x=()=>{c.forEach(({unsubscribe:u})=>u()),c.clear()};return r.$on=A,r.$onAny=_,r.$effect=b,r.$dispose=x,S},H=t=>{let n=[],e=[];return{effect:s=>{n.push(t.$effect(s)),e.push(s)},onDispose:s=>{n.push(s)},refresh:()=>{e.forEach(s=>s())},dispose:()=>{n.splice(0).forEach(s=>s()),e.length=0}}};var At=/(?:let|var|const)(?:\s+(?=[A-Za-z_$])|\s*(?=[{[]))/y,_t=/\$:\s*/y,tt=/import(?=\s*\()/y,Nt=/\$:\s*([A-Za-z_$][\w$]*)\s*=(?!=)/y,M=(t,n)=>{let e=t[n],s=n+1;for(;s<t.length;){if(t[s]==="\\"){s+=2;continue}if(t[s]===e)return s+1;s++}return t.length},L=(t,n)=>{let e=t.indexOf(`
2
+ `,n);return e===-1?t.length:e},O=(t,n)=>{let e=t.indexOf("*/",n+2);return e===-1?t.length:e+2},Y=(t,n)=>{let e=n;for(;e<t.length;){if(/\s/.test(t[e])){e++;continue}if(t[e]==="/"&&t[e+1]==="/"){e=L(t,e);continue}if(t[e]==="/"&&t[e+1]==="*"){e=O(t,e);continue}break}return e},he=new Set(["return","typeof","case","in","instanceof","new","delete","void","do","else","yield","await"]),P=(t,n)=>{let e=n-1;for(;e>=0;){let o=t[e];if(/\s/.test(o)){e--;continue}if(o==="/"&&t[e-1]==="*"){let r=t.lastIndexOf("/*",e-2);if(r===-1)return!0;e=r-1;continue}break}if(e<0)return!0;let s=t[e];if(/[\w$]/.test(s)){let o=e;for(;o>0&&/[\w$]/.test(t[o-1]);)o--;return he.has(t.slice(o,e+1))}return(s==="+"||s==="-")&&t[e-1]===s?!1:!")]}\"'`.".includes(s)},D=(t,n)=>{let e=n+1,s=!1;for(;e<t.length;){let o=t[e];if(o==="\\"){e+=2;continue}if(o===`
3
+ `)return e;if(o==="[")s=!0;else if(o==="]")s=!1;else if(o==="/"&&!s){for(e++;e<t.length&&/[a-z]/i.test(t[e]);)e++;return e}e++}return t.length},ge=/^(\?\.|\?\?|&&|\|\||\*\*|[.,+\-*/%&|^<>=?:([])/,me=(t,n)=>{let e=n-1;for(;e>=0;){let s=t[e];if(/\s/.test(s)){e--;continue}if(s==="/"&&t[e-1]==="*"){let o=t.lastIndexOf("/*",e-2);if(o===-1)return"";e=o-1;continue}return s}return""},jt=(t,n)=>{let e=0,s=n;for(;s<t.length;){let o=t[s];if(o==="'"||o==='"'||o==="`"){s=M(t,s);continue}if(o==="/"&&t[s+1]==="/"){s=L(t,s);continue}if(o==="/"&&t[s+1]==="*"){s=O(t,s);continue}if(o==="/"&&P(t,s)){s=D(t,s);continue}if("([{".includes(o))e++;else if(")]}".includes(o))e--;else{if(e<=0&&o===";")return s;if(e<=0&&o===`
4
+ `){let r=Y(t,s+1);if(!(r<t.length&&(ge.test(t.slice(r,r+2))||[",","="].includes(me(t,s)))))return s;s=r;continue}}s++}return t.length},ye=t=>{let n=[],e=0,s=0,o=0,r=l=>{n.push({raw:t.slice(s,l),codeEnd:Math.max(0,o-s)}),s=l+1,o=s},i=0;for(;i<t.length;){let l=t[i];if(l==="'"||l==='"'||l==="`"){i=M(t,i),o=i;continue}if(l==="/"&&t[i+1]==="/"){i=L(t,i);continue}if(l==="/"&&t[i+1]==="*"){i=O(t,i);continue}if(l==="/"&&P(t,i)){i=D(t,i),o=i;continue}if("([{".includes(l))e++;else if(")]}".includes(l))e--;else if(l===","&&e<=0){r(i),i++;continue}/\s/.test(l)||(o=i+1),i++}return r(t.length),n},lt=t=>{let n=t.trim();if(!n.startsWith("{")&&!n.startsWith("["))return ct.test(n)?[n]:[];let e=[];for(let s of ft(n.slice(1,Lt(n)))){s.startsWith("...")&&(s=s.slice(3).trim());let o=ut(s);if(o!==-1&&(s=s.slice(0,o).trim()),n.startsWith("{")){let r=at(s,":");if(r!==-1){e.push(...lt(s.slice(r+1)));continue}}e.push(...lt(s))}return e},Ee=t=>{let n=[],e=ye(t).map(({raw:r,codeEnd:i})=>{let l=r.match(/^\s*/)[0];if(i<=l.length)return{text:r,empty:!0};let c=r.slice(l.length,i),p=r.slice(i),d=ut(c),E=(d===-1?c:c.slice(0,d)).trim(),S=c[0]==="{"||c[0]==="[";S?n.push(...lt(E)):ct.test(E)&&n.push(E);let A=nt(c).code;return{text:`${l}${S?`(${A})`:A}${p}`,empty:!1}}),s=[];for(;e.length&&e[e.length-1].empty;)s.unshift(e.pop().text);let o=e.map(r=>r.text).join(",")+s.join("");return o.trimStart().startsWith("(")&&(o=`;${o}`),{vars:n,code:o}},nt=t=>{let n=[],e="",s=0,o=0,r=!0;for(;s<t.length;){let i=t[s],l=t[s+1];if(i==="'"||i==='"'||i==="`"){let c=M(t,s);e+=t.slice(s,c),s=c,r=!1;continue}if(i==="/"&&(l==="/"||l==="*")){let c=l==="/"?L(t,s):O(t,s);e+=t.slice(s,c),s=c;continue}if(i==="/"&&P(t,s)){let c=D(t,s);e+=t.slice(s,c),s=c,r=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(t[s-1]))&&(tt.lastIndex=s,tt.test(t))){e+="$__import",s+=6,r=!1;continue}if(o===0&&r){At.lastIndex=s;let c=At.exec(t);if(c){let d=s+c[0].length,E=jt(t,d),{vars:S,code:A}=Ee(t.slice(d,E));n.push(...S),e+=A,s=E,r=!1;continue}_t.lastIndex=s;let p=_t.exec(t);if(p){Nt.lastIndex=s;let d=Nt.exec(t);d&&n.push(d[1]);let E=s+p[0].length,S=jt(t,E);e+=`$__effect(() => { ${nt(t.slice(E,S)).code} });`,s=S;continue}}"([{".includes(i)?o++:")]}".includes(i)&&(o=Math.max(0,o-1)),i===`
5
+ `||i===";"||i==="}"?r=!0:/\s/.test(i)||(r=!1),e+=i,s++}return{vars:n,code:e}},et=/export\s+default(?![\w$])/y,vt=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,be=t=>{let n=[],e=0,s=0;for(let o=0;o<=t.length;o++){let r=t[o];if(r==="{")e++;else if(r==="}")e--;else if(o===t.length||r===","&&e===0){let i=t.slice(s,o).trim();i&&n.push(i),s=o+1}}return n},we=(t,n,e)=>{let s=`await $__import(${JSON.stringify(n)})`;if(t===void 0)return s;let o=be(t),r=[],i=s;if(o.length>1){let l=`$__mod${e}`;r.push(`${l} = ${s}`),i=l}for(let l of o)l.startsWith("{")?r.push(`${l.replace(/\s+as\s+/g,": ")} = ${i}`):l.startsWith("*")?r.push(`${l.replace(/^\*\s*as\s+/,"")} = ${i}`):r.push(`${l} = $__default(${i})`);return`const ${r.join(", ")}`},ct=/^[A-Za-z_$][\w$]*$/,Lt=t=>{let n=0,e=0;for(;e<t.length;){let s=t[e];if(s==="'"||s==='"'||s==="`"){e=M(t,e);continue}if(s==="/"&&t[e+1]==="/"){e=L(t,e);continue}if(s==="/"&&t[e+1]==="*"){e=O(t,e);continue}if(s==="/"&&P(t,e)){e=D(t,e);continue}if("([{".includes(s))n++;else if(")]}".includes(s)&&--n===0)return e;e++}return t.length},at=(t,n)=>{let e=0,s=0;for(;s<t.length;){let o=t[s];if(o==="'"||o==='"'||o==="`"){s=M(t,s);continue}if(o==="/"&&t[s+1]==="/"){s=L(t,s);continue}if(o==="/"&&t[s+1]==="*"){s=O(t,s);continue}if(o==="/"&&o!==n&&P(t,s)){s=D(t,s);continue}if("([{".includes(o))e++;else if(")]}".includes(o))e--;else if(e===0&&o===n)return s;s++}return-1},ft=t=>{let n=[],e=0,s=0,o=0;for(;o<=t.length;){let r=t[o];if(r==="'"||r==='"'||r==="`"){o=M(t,o);continue}if(r==="/"&&t[o+1]==="/"){o=L(t,o);continue}if(r==="/"&&t[o+1]==="*"){o=O(t,o);continue}if(r==="/"&&P(t,o)){o=D(t,o);continue}if(r!==void 0&&"([{".includes(r))e++;else if(r!==void 0&&")]}".includes(r))e--;else if(o===t.length||r===","&&e===0){let i=t.slice(s,o).trim();i&&n.push(i),s=o+1}o++}return n},ut=t=>{let n=0;for(;n<t.length;){let e=at(t.slice(n),"=");if(e===-1)return-1;let s=n+e;if(t[s+1]!=="="&&t[s+1]!==">"&&t[s-1]!=="="&&t[s-1]!=="!")return s;n=s+1}return-1},dt=t=>{let n=(t??"").trim();if(!n.startsWith("{"))return null;let e=Lt(n);if(e>=n.length)return null;let s=[];for(let o of ft(n.slice(1,e))){if(o.startsWith("..."))continue;let r=ut(o),i=r===-1?o:o.slice(0,r),l=r===-1?void 0:o.slice(r+1).trim(),c=at(i,":"),p=(c===-1?i:i.slice(0,c)).trim();ct.test(p)&&s.push(l===void 0?{name:p}:{name:p,default:l})}return s},$e=t=>{let n=0,e=0,s=!0;for(;n<t.length;){let o=t[n];if(o==="'"||o==='"'||o==="`"){n=M(t,n),s=!1;continue}if(o==="/"&&t[n+1]==="/"){n=L(t,n);continue}if(o==="/"&&t[n+1]==="*"){n=O(t,n);continue}if(o==="/"&&P(t,n)){n=D(t,n),s=!1;continue}if(o==="e"&&e===0&&s&&(n===0||!/[\w$.]/.test(t[n-1]))){et.lastIndex=n;let r=et.exec(t);if(r)return n+r[0].length}"([{".includes(o)?e++:")]}".includes(o)&&(e=Math.max(0,e-1)),o===`
6
+ `||o===";"||o==="}"?s=!0:/\s/.test(o)||(s=!1),n++}return-1},Se=/^async(?![\w$])/,Re=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,xe=t=>{let n=$e(t);if(n===-1)return null;let e=Y(t,n),s=t.slice(e);Se.test(s)&&(e=Y(t,e+5));let o=Re.exec(t.slice(e));if(o&&(e=Y(t,e+o[0].length)),t[e]!=="(")return null;let r=0,i=e;for(;i<t.length;){let l=t[i];if(l==="'"||l==='"'||l==="`"){i=M(t,i);continue}if(l==="/"&&t[i+1]==="/"){i=L(t,i);continue}if(l==="/"&&t[i+1]==="*"){i=O(t,i);continue}if(l==="/"&&P(t,i)){i=D(t,i);continue}if("([{".includes(l))r++;else if(")]}".includes(l)&&--r===0)break;i++}return ft(t.slice(e+1,i))[0]??""},Ot=t=>{let n=xe(t);if(n===null)return null;let e=dt(n),s=e?.find(o=>o.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 e},Mt=t=>{let n="",e=0,s=0,o=!0,r=!1,i=0;for(;e<t.length;){let l=t[e],c=t[e+1],p=e===0||!/[\w$.]/.test(t[e-1]);if(l==="'"||l==='"'||l==="`"){let d=M(t,e);n+=t.slice(e,d),e=d,o=!1;continue}if(l==="/"&&(c==="/"||c==="*")){let d=c==="/"?L(t,e):O(t,e);n+=t.slice(e,d),e=d;continue}if(l==="/"&&P(t,e)){let d=D(t,e);n+=t.slice(e,d),e=d,o=!1;continue}if(l==="i"&&p){if(tt.lastIndex=e,tt.test(t)){n+="$__import",e+=6,o=!1;continue}if(s===0&&o){vt.lastIndex=e;let d=vt.exec(t);if(d){n+=we(d[1],d[3],i++),e+=d[0].length,o=!1;continue}}}if(l==="e"&&p&&s===0&&o){et.lastIndex=e;let d=et.exec(t);if(d){r=!0,n+="$__exports.default =",e+=d[0].length,o=!1;continue}}"([{".includes(l)?s++:")]}".includes(l)&&(s=Math.max(0,s-1)),l===`
7
+ `||l===";"||l==="}"?o=!0:/\s/.test(l)||(o=!1),n+=l,e++}return r?n:null};var It=t=>Object.fromEntries(Array.from(t.attributes).map(n=>[n.name,n.value])),Ht=t=>({tag:t.tagName.toLowerCase(),attrs:It(t),children:Array.from(t.childNodes).flatMap(n=>{if(n.nodeType===Node.TEXT_NODE){let e=n.textContent??"";return e?[e]:[]}return n.nodeType===Node.ELEMENT_NODE?[Ht(n)]:[]})}),Pt=new Map,qt=(t,n)=>{let e=`${n.join(",")}|${t}`,s=Pt.get(e);if(s===void 0){try{s=new Function("$scope",...n,`with ($scope) { return (${t}
8
+ ); }`)}catch{s=null}Pt.set(e,s)}return s},N=(t,n,e)=>{let s=qt(t,e?Object.keys(e):[]);if(s)try{return s(n,...e?Object.values(e):[])}catch{return}},Te=(t,n)=>t.replace(/{{\s*([\s\S]+?)\s*}}/g,(e,s)=>N(s,n)??""),Ce=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),Bt=t=>Ce.has(t)||t.startsWith(":class.")||t.startsWith(":props."),Ae=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,_e=(t,n,e,s)=>{let[o,...r]=n.slice(1).split("."),i=new Set(r);t.addEventListener(o,l=>{if(i.has("self")&&l.target!==t)return;i.has("prevent")&&l.preventDefault(),i.has("stop")&&l.stopPropagation();let c=N(e,s,{$event:l});typeof c=="function"&&c.call(t,l)},{once:i.has("once"),capture:i.has("capture")})},Ne=(t,n,e,s)=>{let[o,...r]=n.slice(1).split("."),i=new Set(r),l=c=>{i.has("prevent")&&c.preventDefault(),i.has("stop")&&c.stopPropagation(),i.has("once")&&t.off(o,l),B(()=>{let p=N(e,s,{$event:c});typeof p=="function"&&p(c)})};t.on(o,l)},st=t=>t.replace(/-(\w)/g,(n,e)=>e.toUpperCase()),ht=t=>t instanceof DocumentFragment?{first:t.firstChild,last:t.lastChild}:{first:t,last:t},ot=({first:t,last:n})=>{for(let e=t;e;){let s=e===n?null:e.nextSibling;e.parentNode?.removeChild(e),e=s}},je=({first:t,last:n},e)=>{let s=e.nextSibling;for(let o=t;o;){let r=o===n?null:o.nextSibling;e.parentNode.insertBefore(o,s),o=r}},Dt=(t,n)=>{let e=n.replace(/-/g,"").toLowerCase();for(let s=t;s&&s!==Object.prototype;s=Object.getPrototypeOf(s))for(let o of Object.keys(s))if(/^[A-Z]/.test(o)&&o.replace(/-/g,"").toLowerCase()===e)return o;return null},Ut=(t,n,e,s,o)=>{let r=document.createComment(t),i=document.createComment(`/${t}`),l=document.createDocumentFragment();l.append(r,i);let c={},p={},d=[],E=[],S=!1;Object.entries(n.attrs).forEach(([f,y])=>{if(f!==yt){if(f===":props"||f.startsWith(":props.")){S=!0,E.push({expr:y});return}if(!Bt(f))if(f.startsWith("@"))d.push([f,y]);else if(f===":model"||f.startsWith(":model.")){let h=f===":model"?"default":st(f.slice(7));p[h]=y||(f===":model"?"model":h)}else if(f.startsWith(":")){let h=st(f.slice(1));c[h]=y||h,E.push({name:h,expr:y||h})}else{let h=st(f),m=JSON.stringify(y);c[h]=m,E.push({name:h,expr:m})}}});let A=f=>f==="default"?":model":`:model.${f}`,_=f=>f==="default"?"model":f,b=f=>`${f}
9
+ = $value`;Object.entries(p).forEach(([f,y])=>{let h=_(f);c[h]!==void 0&&console.warn(`jq79: <${n.tag}> binds prop "${h}" through both :${h} and ${A(f)} - ${A(f)} wins`),c[h]=y,qt(b(y),["$value"])===null&&console.warn(`jq79: ${A(f)}="${y}" is not assignable - updates from <${n.tag}> will be dropped`)});let x=()=>{let f={};return E.forEach(({name:y,expr:h})=>{if(y!==void 0)f[y]=N(h,e);else{let m=N(h,e);m!==null&&typeof m=="object"&&Object.assign(f,m)}}),Object.entries(p).forEach(([y,h])=>{f[_(y)]=N(h,e)}),f},u=null,a=null,g=null;return s.effect(()=>{let f=N(t,e),y=f instanceof U?f:null;if(y===a||(g?.dispose(),g=null,u?.destroy(),u=null,a=y,!y))return;let h=new U({template:y.template,scripts:y.scripts,styles:y.styles,modules:y.modules,filename:y.filename});if(Object.keys(p).length){let R=new Set,$=(v,T)=>{R.has(v)||(R.add(v),console.warn(T))};h.on("model:update",(v,T)=>{if(T===null||typeof T!="object"){$("payload",`jq79: model:update expects a { name?, value } payload, got ${T===null?"null":typeof T}`);return}let F=T.name==null?"default":st(String(T.name)),K=p[F];if(K===void 0){$(F,`jq79: <${n.tag}> has no ${A(F)} - bound: ${Object.keys(p).map(A).join(", ")}`);return}B(()=>N(b(K),e,{$value:T.value}))})}d.forEach(([R,$])=>Ne(h,R,$,e));let m=B(x),w=document.createDocumentFragment();(o?h.renderShadow(m):h.render(m)).mount(w),i.parentNode.insertBefore(w,i);let C=H(e);if(S){let R=[];C.effect(()=>{let $=x(),v=Object.keys($);R.forEach(T=>{T in $||(h.data[T]=void 0)}),v.forEach(T=>{h.data[T]=$[T]}),R=v})}else Object.entries(c).forEach(([R,$])=>{C.effect(()=>{h.data[R]=N($,e)})});g=C,u=h}),s.onDispose(()=>{g?.dispose(),u?.destroy()}),l},ve=(t,n)=>{let e=()=>{let s=N(t,n);return s!==null&&typeof s=="object"?s:null};return new Proxy(n,{has(s,o){let r=e();return r!==null&&Reflect.has(r,o)||Reflect.has(s,o)},get(s,o){let r=e();return r!==null&&Reflect.has(r,o)?r[o]:Reflect.get(s,o)},set(s,o,r){let i=e();return i!==null&&Reflect.has(i,o)?(i[o]=r,!0):Reflect.set(s,o,r)}})},G=t=>typeof t=="string"?t.split(/\s+/).filter(Boolean):Array.isArray(t)?t.flatMap(G):t!==null&&typeof t=="object"?Object.entries(t).flatMap(([n,e])=>e?G(n):[]):[],Le=t=>typeof t=="function"?(n,e,s)=>{try{return!!t(n,e,s)}catch{return!1}}:typeof t=="string"||Array.isArray(t)?$t(t):()=>!1,gt=(t,n,e,s)=>{let o=t.attrs[":with"],r=o!==void 0?ve(o,n):n,i=Dt(r,t.tag);if(i)return Ut(i,t,r,e,s);let l=document.createElement(t.tag);if(l instanceof HTMLUnknownElement||t.tag.includes("-")){let b=!1;e.effect(()=>{if(b)return;let x=Dt(r,t.tag);if(!x)return;b=!0;let u=Ut(x,t,r,e,s),a=ht(u);e.onDispose(()=>ot(a)),l.replaceWith(u)})}Object.entries(t.attrs).forEach(([b,x])=>{b.startsWith("@")?_e(l,b,x,r):b===":model"||b.startsWith(":model.")?l instanceof HTMLUnknownElement||t.tag.includes("-")||console.warn(`jq79: ${b} on <${t.tag}> does nothing - :model binds component tags only (for now)`):Bt(b)||l.setAttribute(b,x)});let c=t.attrs[":attrs"];if(c!==void 0){let b=[];e.effect(()=>{b.forEach(u=>l.removeAttribute(u));let x=N(c,r);b=x&&typeof x=="object"?Object.keys(x):[],b.forEach(u=>{let a=x[u];a!=null&&a!==!1&&l.setAttribute(u,String(a))})})}let p=t.attrs[":class"],d=Object.entries(t.attrs).filter(([b])=>b.startsWith(":class.")).map(([b,x])=>[b.slice(7),x]);if(p!==void 0||d.length){let b=new Set(G(t.attrs.class??"")),x=[];e.effect(()=>{let u=p!==void 0?G(N(p,r)):[];d.forEach(([a,g])=>{N(g,r)&&u.push(...G(a))}),x.forEach(a=>{!u.includes(a)&&!b.has(a)&&l.classList.remove(a)}),l.classList.add(...u),x=u})}let E=t.attrs[":text"],S=t.attrs[":html"],A=t.attrs[":html.allowed"];A!==void 0&&S===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),E!==void 0?e.effect(()=>{l.textContent=String(N(E,r)??"")}):S!==void 0?e.effect(()=>{let b=A!==void 0?{allowUrl:Le(N(A,r))}:void 0;l.innerHTML=Rt(String(N(S,r)??""),b)}):l.appendChild(mt(t.children,r,e,s));let _=t.attrs[":value"];return _!==void 0&&e.effect(()=>{let b=String(N(_,r)??"");l.value!==b&&(l.value=b)}),[":checked",":selected"].forEach(b=>{let x=t.attrs[b];if(x===void 0)return;let u=b.slice(1);e.effect(()=>{l[u]=!!N(x,r)})}),l},Oe=(t,n,e,s)=>{let o=document.createComment("if"),r=document.createDocumentFragment();r.appendChild(o);let i=null,l=null,c=null;return e.effect(()=>{let p=t.find(E=>E.expr===void 0||N(E.expr,n))??null;if(p===l||(c?.dispose(),i&&ot(i),i=null,l=p,!p))return;c=H(n);let d=gt(p.node,n,c,s);i=ht(d),o.parentNode.insertBefore(d,o.nextSibling)}),r},Z=(t,n,e)=>{Object.defineProperty(t,n,{value:e,writable:!0,enumerable:!0,configurable:!0})},Me=t=>{if(t===null||typeof t!="object"||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null},Pe=(t,n,e,s)=>{let o=t.attrs[":each"].match(Ae);if(!o)return document.createComment(`invalid :each expression "${t.attrs[":each"]}"`);let[,r,i,l]=o,c=t.attrs[":key"],{[":each"]:p,[":key"]:d,...E}=t.attrs,S={...t,attrs:E},A=document.createComment("each"),_=document.createDocumentFragment();_.appendChild(A),(":if"in t.attrs||":elseif"in t.attrs||":else"in t.attrs)&&console.warn("jq79: :if/:elseif/:else on a :each element is ignored; filter the list expression instead");let b=[],x=!1;return e.effect(()=>{let u=N(l,n),a=Array.isArray(u)?u.map((w,C)=>[C,w]):Me(u)?Object.entries(u):[],g=new Map;b.forEach(w=>{let C=g.get(w.key);C?C.push(w):g.set(w.key,[w])});let f=new Set,y=[],h=a.map(([w,C],R)=>{let $=Object.create(n);Z($,r,C),i&&Z($,i,w),Z($,"$index",R);let v=c!==void 0?N(c,$):w;f.has(v)&&!x&&(x=!0,console.warn(`jq79: duplicate :key in :each "${t.attrs[":each"]}"; duplicates pair up by position`)),f.add(v);let T=g.get(v)?.shift();if(T&&Object.is(T.item,C))return T.scope.$index!==R&&y.push(T),Z(T.scope,"$index",R),i&&Z(T.scope,i,w),T;T&&(T.fx.dispose(),ot(T.range));let F=H(n),K=ht(gt(S,$,F,s));return{key:v,item:C,scope:$,fx:F,range:K}});g.forEach(w=>w.forEach(C=>{C.fx.dispose(),ot(C.range)}));let m=A;h.forEach(w=>{m.nextSibling!==w.range.first&&je(w.range,m),m=w.range.last}),y.forEach(w=>B(()=>w.fx.refresh())),b=h}),_},mt=(t,n,e,s=!1)=>{let o=document.createDocumentFragment(),r=0;for(;r<t.length;){let i=t[r];if(typeof i=="string"){let l=document.createTextNode(i);i.includes("{{")&&e.effect(()=>{l.textContent=Te(i,n)}),o.appendChild(l),r++;continue}if(":each"in i.attrs){o.appendChild(Pe(i,n,e,s)),r++;continue}if(":if"in i.attrs){let l=[{expr:i.attrs[":if"],node:i}];r++;let c=d=>{let E=r;for(;E<t.length&&typeof t[E]=="string"&&!t[E].trim();)E++;let S=t[E];if(typeof S=="object"&&d in S.attrs)return r=E+1,S};for(let d=c(":elseif");d;d=c(":elseif"))l.push({expr:d.attrs[":elseif"],node:d});let p=c(":else");p&&l.push({node:p}),o.appendChild(Oe(l,n,e,s));continue}o.appendChild(gt(i,n,e,s)),r++}return o},De=(t,n,e=!1)=>mt(t.template,n,H(n),e),Ue=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),We=/<([A-Za-z][\w-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,zt=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Fe=t=>t.split(zt).map((n,e)=>e%2===1?n:n.replace(We,(s,o,r)=>Ue.has(o.toLowerCase())?s:`<${o}${r}></${o}>`)).join(""),ke=/<([A-Za-z][\w-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,Ie=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,He=t=>t.split(zt).map((n,e)=>e%2===1?n:n.replace(ke,(s,o,r)=>{let i=0,l=r.replace(Ie,(c,p,d)=>d===void 0?c:`${p}:props.${i++}="${d}"`);return`<${o}${l}>`})).join(""),yt="data-jq79",qe=t=>{let n=2166136261;for(let e=0;e<t.length;e++)n=Math.imul(n^t.charCodeAt(e),16777619);return(n>>>0).toString(36)},Zt=(t,n)=>{t.forEach(e=>{typeof e!="string"&&(e.attrs[yt]=n,Zt(e.children,n))})},Be=(t,n)=>t.split(",").map(e=>{let s=e.trim(),o=s.indexOf("::"),r=o===-1?s:s.slice(0,o),i=o===-1?"":s.slice(o);return`${r}[${yt}="${n}"]${i}`}).join(", "),Gt=(t,n)=>{Array.from(t).forEach(e=>{e instanceof CSSStyleRule?e.selectorText=Be(e.selectorText,n):e instanceof CSSGroupingRule&&Gt(e.cssRules,n)})},ze=(t,n)=>{/:deep\(|::v-deep|>>>/.test(t)&&console.warn("jq79: :deep()/::v-deep/>>> are not supported in <style scoped>; the rule will be dropped by the browser");let e=new CSSStyleSheet;return e.replaceSync(t),Gt(e.cssRules,n),Array.from(e.cssRules).map(s=>s.cssText).join(`
10
+ `)},pt=t=>{let n=Fe(He(t)),s=new DOMParser().parseFromString(`<template>${n}</template>`,"text/html").querySelector("template"),o=[],r=[],i=[];Array.from(s.content.children).forEach(c=>{let p={attrs:It(c),content:c.textContent??""};c.tagName==="SCRIPT"?o.push(p):c.tagName==="STYLE"?r.push(p):i.push(Ht(c))}),r.forEach(c=>{"lang"in c.attrs&&console.warn(`jq79: <style lang="${c.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 l=c=>"scoped"in c.attrs&&!("lang"in c.attrs);if(r.some(l)){let c=qe(t);Zt(i,c),r.forEach(p=>{l(p)&&(p.scoped=ze(p.content,c))})}return{template:i,scripts:o,styles:r}},Et=t=>/\.html?([?#]|$)/.test(t)?U.fetch(t):import(t),Kt=(t,n)=>t?`
11
+ //# sourceURL=${t}?jq79-script=${n}`:"",Wt=t=>t.scoped??t.content,rt=new Map,Ze=t=>{let n=rt.get(t);if(!n){let e=document.createElement("style");e.textContent=t,document.head.appendChild(e),n={el:e,count:0},rt.set(t,n)}n.count++},Ge=t=>{let n=rt.get(t);n&&--n.count<=0&&(n.el.remove(),rt.delete(t))},Ke=(t,n,e,s={},o=Et,r={})=>{let i={...Vt,...s},l=new Proxy(n,{has:(p,d)=>d!=="$__effect"&&d!=="$__import"&&(Reflect.has(p,d)||!(d in globalThis)&&!(d in i))});new Function("$scope","$__effect","$__import",...Object.keys(i),`return (async () => { with ($scope) { ${t} } })()${Kt(r.filename,r.index??0)}`)(l,e,o,...Object.values(i)).catch(p=>console.error("jq79: error in :setup script",p))},Ft=(t,n)=>{n?.forEach(({name:e,default:s})=>{t[e]===void 0&&(t[e]=s===void 0?void 0:N(s,t))})},Xe=t=>t&&t.default!==void 0?t.default:t,Je=(t,n,e,s={},o=Et,r={})=>{let i={...Vt,...s},l={},c=new Function("$__exports","$__default","$__import",...Object.keys(i),`return (async () => { "use strict";
12
12
  ${t}
13
- ;$__exports.done = true })()${Gt(r.filename,r.index??0)}`)(l,Ge,o,...Object.values(i)),p=$=>console.error("jq79: error in factory script",$),d=!1,g=()=>{if(d)return;d=!0;let $=l.default;if(typeof $!="function")return;let C=x=>{x&&typeof x=="object"&&Object.assign(n,x)};try{let x=$(n,{$data:n,$props:n,$effect:e,...s});x instanceof Promise?x.then(C).catch(p):C(x)}catch(x){p(x)}};f.then(g,p),l.done&&g()},Ke="__JQ79_HMR_ENABLED__",Xe="__JQ79_HMR__",U=null,Je=t=>{if(!U||!t.filename)return;let n=U.get(t.filename);n||U.set(t.filename,n=new Set),n.add(new WeakRef(t))},Ft=t=>{try{return new URL(t,document.baseURI).pathname}catch{return t}},Kt=(t,n)=>{if(!U)return 0;let e=Ft(t),s=ut(n),o=0;for(let[r,i]of U)if(Ft(r)===e){for(let l of i){let f=l.deref();if(!f){i.delete(l);continue}f.hotReplace(s)&&o++}i.size||U.delete(r)}return o},Xt=()=>{U??(U=new Map),globalThis[Xe]={update:Kt}},k=class t{constructor(n,e={}){v(this,"template");v(this,"scripts");v(this,"styles");v(this,"modules");v(this,"filename");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,"emitListeners",new Map);let s=typeof n=="string"?ut(n):n;this.template=s.template,this.scripts=s.scripts,this.styles=s.styles,this.modules=e.modules??(typeof n=="string"?void 0:n.modules),this.filename=e.filename??(typeof n=="string"?void 0:n.filename),Je(this)}hotReplace(n){let e=typeof n=="string"?ut(n):n,s=this.startMarker,o=!!(s&&this.content),r=o&&s.isConnected,i=r?s.parentNode:null,l=r?this.endMarker.nextSibling:null,f={...this.data},p=this.useShadow;return o&&this.destroy(),this.template=e.template,this.scripts=e.scripts,this.styles=e.styles,!o||(this.renderWith(f,p),!i)?!1:(p&&this.styleEls.forEach(d=>i.insertBefore(d,l)),i.insertBefore(this.content,l),this.mountRoot=i,this.resolveMounted?.(),!0)}static async fetch(n){let e=await fetch(n);if(!e.ok)throw new Error(`failed to fetch component from ${n}: ${e.status}`);return new t(await e.text(),{filename:n})}on(n,e){return this.emitListeners.has(n)||this.emitListeners.set(n,new Set),this.emitListeners.get(n).add(e),this}off(n,e){return this.emitListeners.get(n)?.delete(e),this}render(n={}){return this.renderWith(n,!1)}renderShadow(n={}){return this.renderWith(n,!0)}renderWith(n,e){this.destroy();let s=B({...n}),o=W(s);this.data=s,this.fx=o,this.useShadow=e,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let r=this.startMarker,i=(c,u)=>{let m=new CustomEvent(c,{detail:u,bubbles:!0,composed:!0,cancelable:!0});return r===this.startMarker&&this.emitListeners.get(c)?.forEach(A=>A(m,u)),m.cancelBubble||r.dispatchEvent(m),!m.defaultPrevented},l,f=new Promise(c=>{l=c});this.resolveMounted=l;let p=()=>f,d=this.endMarker,g=c=>{let u=[];for(let m=r.nextSibling;m&&m!==d;m=m.nextSibling)m instanceof Element&&(m.matches(c)&&u.push(m),u.push(...Array.from(m.querySelectorAll(c))));return u},$=c=>g(c)[0]??null,C=this.modules,x=c=>C&&c in C?Promise.resolve(C[c]):gt(c),b=c=>`await $mounted();${c}`;this.scripts.forEach((c,u)=>{let m={$emit:i,$mounted:p,$self:$,$$self:g},A={filename:this.filename,index:u},S=Ot(c.content);if(S!==null){kt(s,jt(c.content));let w=":mounted"in c.attrs?b(S):S;Ze(w,s,o.effect,m,x,A);return}let{vars:h,code:y}=tt(c.content);kt(s,ft(c.attrs[":setup"])),h.forEach(w=>{w in s||(s[w]=void 0)});let R=":mounted"in c.attrs?b(y):y;ze(R,s,o.effect,m,x,A)});let E=document.createDocumentFragment(),a=new Proxy(s,{has:(c,u)=>u==="$emit"||Reflect.has(c,u),get:(c,u,m)=>u==="$emit"&&!Reflect.has(c,u)?i:Reflect.get(c,u,m)});return E.append(this.startMarker,ht(this.template,a,o,e),this.endMarker),this.content=E,e?this.styleEls=this.styles.map(c=>{let u=document.createElement("style");return u.textContent=c.content,u}):(this.styles.forEach(c=>qe(Ut(c))),this.ownsSharedStyles=!0),this}mount(n,e){let s=typeof n=="string"?F(n):n;if(!s)throw new Error(`mount target not found: ${n}`);return(!this.content||e!==void 0)&&this.renderWith(e??{},this.useShadow),this.attach(s)}mountShadow(n,e){let s=typeof n=="string"?F(n):n;if(!s)throw new Error(`mount target not found: ${n}`);return(!this.content||e!==void 0||!this.useShadow)&&this.renderWith(e??{},!0),this.attach(s)}attach(n){this.mountRoot&&this.detach();let e=this.useShadow&&n instanceof Element?n.shadowRoot??n.attachShadow({mode:"open"}):n;return this.useShadow&&this.styleEls.forEach(s=>e.appendChild(s)),e.appendChild(this.content),this.mountRoot=e,this.resolveMounted?.(),this}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let n=this.startMarker;for(;n;){let e=n.nextSibling;if(this.content.appendChild(n),n===this.endMarker)break;n=e}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.data?.$dispose(),this.styleEls.forEach(n=>n.parentNode?.removeChild(n)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(n=>Be(Ut(n))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}},Ve=t=>new k(t);typeof globalThis<"u"&&globalThis[Ke]&&Xt();0&&(module.exports={$,$$,$create,$reactive,Component79,enableHotReload,hotUpdate,parseComponent,renderComponent});
13
+ ;$__exports.done = true })()${Kt(r.filename,r.index??0)}`)(l,Xe,o,...Object.values(i)),p=S=>console.error("jq79: error in factory script",S),d=!1,E=()=>{if(d)return;d=!0;let S=l.default;if(typeof S!="function")return;let A=_=>{_&&typeof _=="object"&&Object.assign(n,_)};try{let _=S(n,{$data:n,$props:n,$effect:e,...s});_ instanceof Promise?_.then(A).catch(p):A(_)}catch(_){p(_)}};c.then(E,p),l.done&&E()},Ve="__JQ79_HMR_ENABLED__",Qe="__JQ79_HMR__",W=null,Ye=t=>{if(!W||!t.filename)return;let n=W.get(t.filename);n||W.set(t.filename,n=new Set),n.add(new WeakRef(t))},kt=t=>{try{return new URL(t,document.baseURI).pathname}catch{return t}},Xt=(t,n)=>{if(!W)return 0;let e=kt(t),s=pt(n),o=0;for(let[r,i]of W)if(kt(r)===e){for(let l of i){let c=l.deref();if(!c){i.delete(l);continue}c.hotReplace(s)&&o++}i.size||W.delete(r)}return o},Jt=()=>{W??(W=new Map),globalThis[Qe]={update:Xt}},U=class t{constructor(n,e={}){j(this,"template");j(this,"scripts");j(this,"styles");j(this,"modules");j(this,"filename");j(this,"data",null);j(this,"fx",null);j(this,"content",null);j(this,"startMarker",null);j(this,"endMarker",null);j(this,"styleEls",[]);j(this,"ownsSharedStyles",!1);j(this,"useShadow",!1);j(this,"mountRoot",null);j(this,"resolveMounted",null);j(this,"emitListeners",new Map);let s=typeof n=="string"?pt(n):n;this.template=s.template,this.scripts=s.scripts,this.styles=s.styles,this.modules=e.modules??(typeof n=="string"?void 0:n.modules),this.filename=e.filename??(typeof n=="string"?void 0:n.filename),Ye(this)}hotReplace(n){let e=typeof n=="string"?pt(n):n,s=this.startMarker,o=!!(s&&this.content),r=o&&s.isConnected,i=r?s.parentNode:null,l=r?this.endMarker.nextSibling:null,c={...this.data},p=this.useShadow;return o&&this.destroy(),this.template=e.template,this.scripts=e.scripts,this.styles=e.styles,!o||(this.renderWith(c,p),!i)?!1:(p&&this.styleEls.forEach(d=>i.insertBefore(d,l)),i.insertBefore(this.content,l),this.mountRoot=i,this.resolveMounted?.(),!0)}static async fetch(n){let e=await fetch(n);if(!e.ok)throw new Error(`failed to fetch component from ${n}: ${e.status}`);return new t(await e.text(),{filename:n})}on(n,e){return this.emitListeners.has(n)||this.emitListeners.set(n,new Set),this.emitListeners.get(n).add(e),this}off(n,e){return this.emitListeners.get(n)?.delete(e),this}render(n={}){return this.renderWith(n,!1)}renderShadow(n={}){return this.renderWith(n,!0)}renderWith(n,e){this.destroy();let s=z({...n}),o=H(s);this.data=s,this.fx=o,this.useShadow=e,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let r=this.startMarker,i=(a,g)=>{let f=new CustomEvent(a,{detail:g,bubbles:!0,composed:!0,cancelable:!0});return r===this.startMarker&&this.emitListeners.get(a)?.forEach(y=>y(f,g)),f.cancelBubble||r.dispatchEvent(f),!f.defaultPrevented},l,c=new Promise(a=>{l=a});this.resolveMounted=l;let p=()=>c,d=this.endMarker,E=a=>{let g=[];for(let f=r.nextSibling;f&&f!==d;f=f.nextSibling)f instanceof Element&&(f.matches(a)&&g.push(f),g.push(...Array.from(f.querySelectorAll(a))));return g},S=a=>E(a)[0]??null,A=this.modules,_=a=>A&&a in A?Promise.resolve(A[a]):Et(a),b=a=>`await $mounted();${a}`;this.scripts.forEach((a,g)=>{let f={$emit:i,$mounted:p,$self:S,$$self:E},y={filename:this.filename,index:g},h=Mt(a.content);if(h!==null){Ft(s,Ot(a.content));let R=":mounted"in a.attrs?b(h):h;Je(R,s,o.effect,f,_,y);return}let{vars:m,code:w}=nt(a.content);Ft(s,dt(a.attrs[":setup"])),m.forEach(R=>{R in s||(s[R]=void 0)});let C=":mounted"in a.attrs?b(w):w;Ke(C,s,o.effect,f,_,y)});let x=document.createDocumentFragment(),u=new Proxy(s,{has:(a,g)=>g==="$emit"||Reflect.has(a,g),get:(a,g,f)=>g==="$emit"&&!Reflect.has(a,g)?i:Reflect.get(a,g,f)});return x.append(this.startMarker,mt(this.template,u,o,e),this.endMarker),this.content=x,e?this.styleEls=this.styles.map(a=>{let g=document.createElement("style");return g.textContent=a.content,g}):(this.styles.forEach(a=>Ze(Wt(a))),this.ownsSharedStyles=!0),this}mount(n,e){let s=typeof n=="string"?k(n):n;if(!s)throw new Error(`mount target not found: ${n}`);return(!this.content||e!==void 0)&&this.renderWith(e??{},this.useShadow),this.attach(s)}mountShadow(n,e){let s=typeof n=="string"?k(n):n;if(!s)throw new Error(`mount target not found: ${n}`);return(!this.content||e!==void 0||!this.useShadow)&&this.renderWith(e??{},!0),this.attach(s)}attach(n){this.mountRoot&&this.detach();let e=this.useShadow&&n instanceof Element?n.shadowRoot??n.attachShadow({mode:"open"}):n;return this.useShadow&&this.styleEls.forEach(s=>e.appendChild(s)),e.appendChild(this.content),this.mountRoot=e,this.resolveMounted?.(),this}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;let n=this.startMarker;for(;n;){let e=n.nextSibling;if(this.content.appendChild(n),n===this.endMarker)break;n=e}return this.mountRoot=null,this}destroy(){return this.detach(),this.fx?.dispose(),this.fx=null,this.data?.$dispose(),this.styleEls.forEach(n=>n.parentNode?.removeChild(n)),this.styleEls=[],this.ownsSharedStyles&&(this.styles.forEach(n=>Ge(Wt(n))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.data=null,this.resolveMounted=null,this}};var tn=t=>new U(t),Vt={$:k,$$:J,$create:V,$reactive:z,Component79:U};typeof globalThis<"u"&&globalThis[Ve]&&Jt();0&&(module.exports={$,$$,$create,$reactive,C79,Component79,enableHotReload,hotUpdate,parseComponent,renderComponent});
14
14
  //# sourceMappingURL=jq79.cjs.map