jq79 0.5.13 → 0.5.14

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
@@ -4,7 +4,7 @@ var ae=Object.defineProperty;var qt=Object.getOwnPropertyDescriptor;var It=Objec
4
4
  `){let o=de(e,s+1);if(!(o<e.length&&(tn.test(e.slice(o,o+2))||[",","="].includes(nn(e,s)))))return s;s=o;continue}}s++}return e.length},sn=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=I(e,i),r=i;continue}if(a==="/"&&e[i+1]==="/"){i=D(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=k(e,i);continue}if(a==="/"&&W(e,i)){i=U(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},Te=e=>{let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return he.test(t)?[t]:[];let n=[];for(let s of _e(t.slice(1,rt(t)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=Ce(s);if(r!==-1&&(s=s.slice(0,r).trim()),t.startsWith("{")){let o=xe(s,":");if(o!==-1){n.push(...Te(s.slice(o+1)));continue}}n.push(...Te(s))}return n},rn=e=>{let t=[],n=sn(e).map(({raw:o,codeEnd:i})=>{let a=o.match(/^\s*/)[0];if(i<=a.length)return{text:o,empty:!0};let l=o.slice(a.length,i),p=o.slice(i),u=Ce(l),g=(u===-1?l:l.slice(0,u)).trim(),R=l[0]==="{"||l[0]==="[";R?t.push(...Te(g)):he.test(g)&&t.push(g);let j=ge(l).code;return{text:`${a}${R?`(${j})`:j}${p}`,empty:!1}}),s=[];for(;n.length&&n[n.length-1].empty;)s.unshift(n.pop().text);let r=n.map(o=>o.text).join(",")+s.join("");return r.trimStart().startsWith("(")&&(r=`;${r}`),{vars:t,code:r}},ge=e=>{let t=[],n="",s=0,r=0,o=!0;for(;s<e.length;){let i=e[s],a=e[s+1];if(i==="'"||i==='"'||i==="`"){let l=I(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(i==="/"&&(a==="/"||a==="*")){let l=a==="/"?D(e,s):k(e,s);n+=e.slice(s,l),s=l;continue}if(i==="/"&&W(e,s)){let l=U(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(fe.lastIndex=s,fe.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){Ye.lastIndex=s;let l=Ye.exec(e);if(l){let u=s+l[0].length,g=nt(e,u),{vars:R,code:j}=rn(e.slice(u,g));t.push(...R),n+=j,s=g,o=!1;continue}et.lastIndex=s;let p=et.exec(e);if(p){tt.lastIndex=s;let u=tt.exec(e);u&&t.push(u[1]);let g=s+p[0].length,R=nt(e,g);n+=`$__effect(() => { ${ge(e.slice(g,R)).code} });`,s=R;continue}}"([{".includes(i)?r++:")]}".includes(i)&&(r=Math.max(0,r-1)),i===`
5
5
  `||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),n+=i,s++}return{vars:t,code:n}},pe=/export\s+default(?![\w$])/y,st=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,on=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},an=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=on(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(", ")}`},he=/^[A-Za-z_$][\w$]*$/,rt=e=>{let t=0,n=0;for(;n<e.length;){let s=e[n];if(s==="'"||s==='"'||s==="`"){n=I(e,n);continue}if(s==="/"&&e[n+1]==="/"){n=D(e,n);continue}if(s==="/"&&e[n+1]==="*"){n=k(e,n);continue}if(s==="/"&&W(e,n)){n=U(e,n);continue}if("([{".includes(s))t++;else if(")]}".includes(s)&&--t===0)return n;n++}return e.length},xe=(e,t)=>{let n=0,s=0;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=I(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=D(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=k(e,s);continue}if(r==="/"&&r!==t&&W(e,s)){s=U(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===t)return s;s++}return-1},_e=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let o=e[r];if(o==="'"||o==='"'||o==="`"){r=I(e,r);continue}if(o==="/"&&e[r+1]==="/"){r=D(e,r);continue}if(o==="/"&&e[r+1]==="*"){r=k(e,r);continue}if(o==="/"&&W(e,r)){r=U(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},Ce=e=>{let t=0;for(;t<e.length;){let n=xe(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},me=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=rt(t);if(n>=t.length)return null;let s=[];for(let r of _e(t.slice(1,n))){if(r.startsWith("..."))continue;let o=Ce(r),i=o===-1?r:r.slice(0,o),a=o===-1?void 0:r.slice(o+1).trim(),l=xe(i,":"),p=(l===-1?i:i.slice(0,l)).trim();if(!he.test(p))continue;let u={name:p};a!==void 0&&(u.default=a);let g=l===-1?"":i.slice(l+1).trim();he.test(g)&&(u.as=g),s.push(u)}return s},ln=e=>{let t=0,n=0,s=!0;for(;t<e.length;){let r=e[t];if(r==="'"||r==='"'||r==="`"){t=I(e,t),s=!1;continue}if(r==="/"&&e[t+1]==="/"){t=D(e,t);continue}if(r==="/"&&e[t+1]==="*"){t=k(e,t);continue}if(r==="/"&&W(e,t)){t=U(e,t),s=!1;continue}if(r==="e"&&n===0&&s&&(t===0||!/[\w$.]/.test(e[t-1]))){pe.lastIndex=t;let o=pe.exec(e);if(o)return t+o[0].length}"([{".includes(r)?n++:")]}".includes(r)&&(n=Math.max(0,n-1)),r===`
6
6
  `||r===";"||r==="}"?s=!0:/\s/.test(r)||(s=!1),t++}return-1},cn=/^async(?![\w$])/,un=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,dn=e=>{let t=ln(e);if(t===-1)return null;let n=de(e,t),s=e.slice(n);cn.test(s)&&(n=de(e,n+5));let r=un.exec(e.slice(n));if(r&&(n=de(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=I(e,i);continue}if(a==="/"&&e[i+1]==="/"){i=D(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=k(e,i);continue}if(a==="/"&&W(e,i)){i=U(e,i);continue}if("([{".includes(a))o++;else if(")]}".includes(a)&&--o===0)break;i++}return _e(e.slice(n+1,i))[0]??""},ye=e=>{let t=dn(e);if(t===null)return null;let n=me(t),s=n?.find(r=>r.name.startsWith("$"))?.name;if(s)throw new Error(`jq79: the factory signature is (props, ctx), so \`${s}\` can't be destructured from the first parameter. Write \`export default (props, { ${s} }) => \u2026\`, or \`_\` in place of props if the component takes none.`);return n},ot=e=>{let t="",n=0,s=0,r=!0,o=!1,i=0;for(;n<e.length;){let a=e[n],l=e[n+1],p=n===0||!/[\w$.]/.test(e[n-1]);if(a==="'"||a==='"'||a==="`"){let u=I(e,n);t+=e.slice(n,u),n=u,r=!1;continue}if(a==="/"&&(l==="/"||l==="*")){let u=l==="/"?D(e,n):k(e,n);t+=e.slice(n,u),n=u;continue}if(a==="/"&&W(e,n)){let u=U(e,n);t+=e.slice(n,u),n=u,r=!1;continue}if(a==="i"&&p){if(fe.lastIndex=n,fe.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){st.lastIndex=n;let u=st.exec(e);if(u){t+=an(u[1],u[3],i++),n+=u[0].length,r=!1;continue}}}if(a==="e"&&p&&s===0&&r){pe.lastIndex=n;let u=pe.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 fn="0.5.13",Et=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),St=e=>{let t=Et(e),n=t[ve];return delete t[ve],{tag:e.tagName.toLowerCase(),attrs:t,...n===void 0?{}:{component:n},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(s=>{if(s.nodeType===Node.TEXT_NODE){let r=s.textContent??"";return r?[r]:[]}return s.nodeType===Node.ELEMENT_NODE?[St(s)]:[]})}},it=new Map,wt=(e,t)=>{let n=`${t.join(",")}|${e}`,s=it.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
7
+ `||a===";"||a==="}"?r=!0:/\s/.test(a)||(r=!1),t+=a,n++}return o?t:null};var fn="0.5.14",Et=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),St=e=>{let t=Et(e),n=t[ve];return delete t[ve],{tag:e.tagName.toLowerCase(),attrs:t,...n===void 0?{}:{component:n},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(s=>{if(s.nodeType===Node.TEXT_NODE){let r=s.textContent??"";return r?[r]:[]}return s.nodeType===Node.ELEMENT_NODE?[St(s)]:[]})}},it=new Map,wt=(e,t)=>{let n=`${t.join(",")}|${e}`,s=it.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
8
8
  ); }`)}catch{s=null}it.set(n,s)}return s},pn=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,hn=100,G=new Map,De=new Set,be=0,je=!1,Ne=new Set,gn=()=>{je=!1,!(be>0)&&(G.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(De.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 = () => {}".`))}),G.clear())},Rt=()=>{je||be>0||!G.size||(je=!0,queueMicrotask(gn))},$t=e=>{be++;let t=()=>{be--,Rt()};e.then(t,t)},mn=(e,t)=>{if(Ne.has(e))return;Ne.add(e);let n=t?.message||String(t);console.error(`jq79: ${n} - evaluating "${e}". The expression rendered as nothing. If the value arrives later, guard it - "a?.b", or :if on the element.`)},Tt=(e,t,n)=>{if(!(n instanceof ReferenceError))return mn(e,n);let s=pn.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let o=`${r}|${e}`;De.has(o)||G.has(o)||G.size>=hn||(G.set(o,{name:r,expr:e,scope:t}),Rt())},xt=(e,t,n)=>{let s=wt(e,n?Object.keys(n):[]);if(s)return s(t,...n?Object.values(n):[])},C=(e,t,n)=>{try{return xt(e,t,n)}catch(s){Tt(e,t,s);return}},_t=(e,t,n)=>{try{return xt(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;Tt(e,t,s);return}},yn=(e,t)=>e.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>C(s,t)??""),bn=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),ke=e=>bn.has(e)||e.startsWith(":class.")||e.startsWith(":props.")||e===":slot"||e.startsWith(":slot."),En=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,Sn=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o);e.addEventListener(r,a=>{if(i.has("self")&&a.target!==e)return;i.has("prevent")&&a.preventDefault(),i.has("stop")&&a.stopPropagation();let l=_t(n,s,{$event:a});typeof l=="function"&&l.call(e,a)},{once:i.has("once"),capture:i.has("capture")})},wn=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o),a=l=>{i.has("prevent")&&l.preventDefault(),i.has("stop")&&l.stopPropagation(),i.has("once")&&e.off(r,a),te(()=>{let p=_t(n,s,{$event:l});typeof p=="function"&&p(l)})};e.on(r,a)},B=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),Oe=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),qe=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},Ee=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},Rn=({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}},at=(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},$n=e=>{let t=new Set;for(let n=e;n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let s of Object.keys(n))/^[A-Z]/.test(s)&&t.add(s);return[...t].sort()},Tn=(e,t)=>{let n=$n(t);return new Error(`jq79: <${e}> is not defined - no component of that name is in scope, and nothing renders here. Import it in a :setup script, declare it as a prop, or add a <template name="${e}"> to this file. In scope: ${n.length?n.join(", "):"(none)"}.`)},lt=200,Ae=0,Ct=Symbol("jq79.slots"),xn=e=>e==="slot"||e.startsWith("slot."),At=e=>e?B(e):"default",Ie=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),_n=e=>e==="default"?":slot":`:slot.${e}`,Cn=e=>typeof e!="string"||e.trim()!=="",An=e=>{let t={},n=[];e.children.forEach(r=>{let o=typeof r=="object"&&r.tag==="template"?Ie(r):void 0;if(typeof r=="string"||o===void 0){n.push(r);return}let i=At(o.slice(6));if(i in t){console.warn(`jq79: two <template ${_n(i)}> in <${e.tag}>; the second was ignored`);return}t[i]={nodes:r.children,binder:r.attrs[o]||void 0}});let s=n.some(Cn);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},jn=(e,t,n)=>{me(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`)})})},Nn=e=>{let t=Ie(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}`)},On=(e,t)=>{let n=Object.entries(An(e));if(!n.length)return null;let s={};return n.forEach(([r,o])=>{s[r]=vn(o,t)}),s},vn=(e,t)=>(n,s,r,o)=>{let i=Object.create(t);jn(i,e.binder,n);let a=i[ue]??[];Object.defineProperty(i,ue,{value:[...a,s]});let l=z(i);return r.onDispose(()=>l.dispose()),K(e.nodes,i,l,o)},Pn=(e,t,n,s)=>{let r=At(e.tag.slice(5)),o=document.createDocumentFragment(),i=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);o.append(i,a);let l=t[Ct]?.[r];if(!l)return o.insertBefore(K(e.children,t,n,s),a),o;let p={};return Object.entries(e.attrs).forEach(([u,g])=>{if(!(u===Re||ke(u)||u.startsWith("@")))if(u.startsWith(":")){let R=g||u.slice(1);p[B(u.slice(1))]=()=>C(R,t)}else p[B(u)]=()=>g}),o.insertBefore(l(p,t,n,s),a),o},ct=(e,t,n,s,r)=>{let o=document.createComment(e),i=document.createComment(`/${e}`),a=document.createDocumentFragment();a.append(o,i);let l=On(t,n),p={},u={},g=[],R=[],j=!1;Object.entries(t.attrs).forEach(([d,f])=>{if(d!==Re){if(d===":props"||d.startsWith(":props.")){j=!0,R.push({expr:f});return}if(!ke(d))if(d.startsWith("@"))g.push([d,f]);else if(d===":model"||d.startsWith(":model.")){let c=d===":model"?"default":B(d.slice(7));u[c]=f||(d===":model"?"model":c)}else if(d.startsWith(":")){let c=B(d.slice(1));p[c]=f||c,R.push({name:c,expr:f||c})}else{let c=B(d),m=JSON.stringify(f);p[c]=m,R.push({name:c,expr:m})}}});let N=d=>d==="default"?":model":`:model.${d}`,O=d=>d==="default"?"model":d,y=d=>`${d}
9
9
  = $value`,w=new Set;Object.entries(u).forEach(([d,f])=>{let c=O(d);p[c]!==void 0&&console.warn(`jq79: <${t.tag}> binds prop "${c}" through both :${c} and ${N(d)} - ${N(d)} wins`),p[c]=f,wt(y(f),["$value"])===null&&(w.add(d),console.warn(`jq79: ${N(d)}="${f}" is not assignable - updates from <${t.tag}> will be dropped`))});let x=()=>{let d={};return R.forEach(({name:f,expr:c})=>{if(f!==void 0)d[f]=C(c,n);else{let m=C(c,n);m!==null&&typeof m=="object"&&Object.assign(d,m)}}),Object.entries(u).forEach(([f,c])=>{d[O(f)]=C(c,n)}),d},h=null,b=null,T=null,S=new Set,A=d=>{if(d==null){if(!n[Pt]?.has(e)||S.has("unfilled"))return;S.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}S.has("type")||(S.add("type"),console.error(`jq79: <${t.tag}> is ${typeof d}, not a component - nothing renders here`))};return s.effect(()=>{let d=C(e,n),f=d instanceof q?d:null;if(f||A(d),f===b||(T?.dispose(),T=null,h?.destroy(),h=null,b=f,!f))return;let c=new q({template:f.template,scripts:f.scripts,styles:f.styles,modules:f.modules,filename:f.filename,siblings:f.siblings,name:f.name});if(l&&(c.slots=l),Object.keys(u).length){let v=new Set;c.modelWriteback=(M,H)=>{let P=M==null?"default":B(String(M)),V=u[P];return V===void 0?(v.has(P)||(v.add(P),console.warn(`jq79: <${t.tag}> has no ${N(P)} - bound: ${Object.keys(u).map(N).join(", ")}`)),!1):w.has(P)?!1:(te(()=>C(y(V),n,{$value:H})),!0)}}g.forEach(([v,M])=>wn(c,v,M,n));let m=ds(c.scripts);fs(t,e,Object.keys(p),m);let E=gt(te(x),m),$=document.createDocumentFragment();if(Ae>=lt){console.error(`jq79: <${t.tag}> is ${lt} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}Ae++;try{(r?c.renderShadow(E):c.render(E)).mount($)}finally{Ae--}i.parentNode.insertBefore($,i);let L=z(n);if(j){let v=[];L.effect(()=>{let M=gt(x(),m),H=Object.keys(M);v.forEach(P=>{P in M||(c.data[P]=void 0)}),H.forEach(P=>{c.data[P]=M[P]}),v=H})}else Object.entries(p).forEach(([v,M])=>{m!==null&&!m.has(v)||L.effect(()=>{c.data[v]=C(M,n)})});T=L,h=c}),s.onDispose(()=>{T?.dispose(),h?.destroy()}),a},Ln=(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)}})},re=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(re):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?re(t):[]):[],Mn=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?Ge(e):()=>!1,Dn=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"]),ut=(e,t,n)=>{let s=Dn.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},We=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?Ln(r,t):t;if(xn(e.tag))return Pn(e,o,n,s);if(e.tag==="template"&&Ie(e)!==void 0)return Nn(e);let i=at(o,e.tag);if(i)return ct(i,e,o,n,s);let a=document.createElement(e.tag);if(e.component&&a instanceof HTMLUnknownElement&&o[Le]?.count===0)throw Tn(e.component,o);let l=a instanceof HTMLUnknownElement||e.tag.includes("-");if(l){let y=!1;n.effect(()=>{if(y)return;let w=at(o,e.tag);if(!w)return;y=!0;let x=ct(w,e,o,n,s),h=qe(x);n.onDispose(()=>Ee(h)),a.replaceWith(x)})}Object.entries(e.attrs).forEach(([y,w])=>{if(y.startsWith("@"))Sn(a,y,w,o);else if(y===":model"||y.startsWith(":model."))l||console.warn(`jq79: ${y} on <${e.tag}> does nothing - :model binds component tags only (for now)`);else if(!ke(y))if(y.startsWith(":"))if(l)a.setAttribute(y,w);else{let x=y.slice(1),h=w||B(x);n.effect(()=>ut(a,x,C(h,o)))}else a.setAttribute(y,w)});let p=e.attrs[":attrs"];if(p!==void 0){let y=[];n.effect(()=>{y.forEach(x=>a.removeAttribute(x));let w=C(p,o);y=w&&typeof w=="object"?Object.keys(w):[],y.forEach(x=>ut(a,x,w[x]))})}let u=e.attrs[":class"],g=Object.entries(e.attrs).filter(([y])=>y.startsWith(":class.")).map(([y,w])=>[y.slice(7),w]);if(u!==void 0||g.length){let y=new Set(re(e.attrs.class??"")),w=[];n.effect(()=>{let x=u!==void 0?re(C(u,o)):[];g.forEach(([h,b])=>{C(b,o)&&x.push(...re(h))}),w.forEach(h=>{!x.includes(h)&&!y.has(h)&&a.classList.remove(h)}),a.classList.add(...x),w=x})}let R=e.attrs[":text"],j=e.attrs[":html"],N=e.attrs[":html.allowed"];N!==void 0&&j===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),R!==void 0?n.effect(()=>{a.textContent=String(C(R,o)??"")}):j!==void 0?n.effect(()=>{let y=N!==void 0?{allowUrl:Mn(C(N,o))}:void 0;a.innerHTML=Ke(String(C(j,o)??""),y)}):a instanceof HTMLTemplateElement?a.content.appendChild(K(e.children,o,n,s)):a.appendChild(K(e.children,o,n,s));let O=e.attrs[":value"];return O!==void 0&&n.effect(()=>{let y=String(C(O,o)??"");a.value!==y&&(a.value=y)}),[":checked",":selected"].forEach(y=>{let w=e.attrs[y];if(w===void 0)return;let x=y.slice(1);n.effect(()=>{a[x]=!!C(w,o)})}),a},kn=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,a=null,l=null;return n.effect(()=>{let p=e.find(g=>g.expr===void 0||C(g.expr,t))??null;if(p===a||(l?.dispose(),i&&Ee(i),i=null,a=p,!p))return;l=z(t);let u=We(p.node,t,l,s);i=qe(u),r.parentNode.insertBefore(u,r.nextSibling)}),o},se=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},qn=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},In=(e,t,n,s)=>{let r=e.attrs[":each"].match(En);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,o,i,a]=r,l=e.attrs[":key"],{[":each"]:p,[":key"]:u,...g}=e.attrs,R={...e,attrs:g},j=document.createComment("each"),N=document.createDocumentFragment();N.appendChild(j),(":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 O=[],y=!1;return n.effect(()=>{let w=C(a,t),x=Array.isArray(w)?w.map((d,f)=>[f,d]):qn(w)?Object.entries(w):[],h=new Map;O.forEach(d=>{let f=h.get(d.key);f?f.push(d):h.set(d.key,[d])});let b=new Set,T=[],S=x.map(([d,f],c)=>{let m=Object.create(t);se(m,o,f),i&&se(m,i,d),se(m,"$index",c);let E=l!==void 0?C(l,m):d;b.has(E)&&!y&&(y=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),b.add(E);let $=h.get(E)?.shift();if($&&Object.is($.item,f))return $.scope.$index!==c&&T.push($),se($.scope,"$index",c),i&&se($.scope,i,d),$;$&&($.fx.dispose(),Ee($.range));let L=z(t),v=qe(We(R,m,L,s));return{key:E,item:f,scope:m,fx:L,range:v}});h.forEach(d=>d.forEach(f=>{f.fx.dispose(),Ee(f.range)}));let A=j;S.forEach(d=>{A.nextSibling!==d.range.first&&Rn(d.range,A),A=d.range.last}),T.forEach(d=>te(()=>d.fx.refresh())),O=S}),N},K=(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=yn(i,t)}),r.appendChild(a),o++;continue}if(":each"in i.attrs){r.appendChild(In(i,t,n,s)),o++;continue}if(":if"in i.attrs){let a=[{expr:i.attrs[":if"],node:i}];o++;let l=u=>{let g=o;for(;g<e.length&&typeof e[g]=="string"&&!e[g].trim();)g++;let R=e[g];if(typeof R=="object"&&u in R.attrs)return o=g+1,R};for(let u=l(":elseif");u;u=l(":elseif"))a.push({expr:u.attrs[":elseif"],node:u});let p=l(":else");p&&a.push({node:p}),r.appendChild(kn(a,t,n,s));continue}r.appendChild(We(i,t,n,s)),o++}return r},Wn=(e,t,n=!1)=>K(e.template,t,z(t),n),Un=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Fn=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,Ue=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Bn=e=>e.split(Ue).map((t,n)=>n%2===1?t:t.replace(Fn,(s,r,o)=>Un.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),jt=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,Hn=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,zn=e=>e.split(Ue).map((t,n)=>n%2===1?t:t.replace(jt,(s,r,o)=>{let i=0,a=o.replace(Hn,(l,p,u)=>u===void 0?l:`${p}:props.${i++}="${u}"`);return`<${r}${a}>`})).join(""),Gn=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,Zn=/<\/slot\.([\w.$-]+)(\s*)>/gi,Kn=/^slot\./i,Vn=e=>Kn.test(e)?`slot.${Oe(e.slice(5))}`:e,ve=":jq79-component",Jn=/^[A-Z]/,Xn=/\/\s*$/,Qn=(e,t)=>{if(!Jn.test(e))return t;let n=` ${ve}="${e}"`,s=Xn.exec(t);return s?`${t.slice(0,s.index)}${n}${s[0]}`:`${t}${n}`},Yn=e=>e.split(Ue).map((t,n)=>n%2===1?t:t.replace(jt,(s,r,o)=>{let i=o.replace(Gn,(a,l,p)=>p===void 0?a:`${l}${Oe(p)}`);return`<${Vn(r)}${Qn(r,i)}>`}).replace(Zn,(s,r,o)=>`</slot.${Oe(r)}${o}>`)).join(""),Re="data-jq79",es=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)},Nt=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[Re]=t,Nt(n.children,t))})},ts=(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}[${Re}="${t}"]${i}`}).join(", "),Ot=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=ts(n.selectorText,t):n instanceof CSSGroupingRule&&Ot(n.cssRules,t)})},ns=(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),Ot(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
10
10
  `)},ss=/^[A-Z][A-Za-z0-9]*$/,Pe=e=>{let t=Bn(zn(Yn(e))),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],o=[];Array.from(s.content.children).forEach(l=>{l.tagName==="TEMPLATE"?o.push(l):r.push(l)});let i=dt(r,e),a={};return o.forEach(l=>{let p=l.getAttribute("name");if(p===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!ss.test(p)){console.warn(`jq79: <template name="${p}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(p in a){console.warn(`jq79: two <template name="${p}"> in one file; the second was ignored`);return}a[p]=new q({...dt(Array.from(l.content.children),l.innerHTML),siblings:a,name:p})}),Object.keys(a).length&&(i.siblings=a),i},dt=(e,t)=>{let n=[],s=[],r=[];e.forEach(i=>{let a={attrs:Et(i),content:i.textContent??""};i.tagName==="SCRIPT"?n.push(a):i.tagName==="STYLE"?s.push(a):r.push(St(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=es(t);Nt(r,i),s.forEach(a=>{o(a)&&(a.scoped=ns(a.content,i))})}return{template:r,scripts:n,styles:s}},Fe=e=>/\.html?([?#]|$)/.test(e)?Me(e):import(e),rs=/^(?:\.\.?\/|\/|[a-z][a-z0-9+.-]*:)/i,os=(e,t)=>{if(!rs.test(e))return e;try{return new URL(e,new URL(t??"",document.baseURI)).href}catch{return e}},vt=(e,t)=>e?`
@@ -4,7 +4,7 @@ var jq79=(()=>{var ae=Object.defineProperty;var qt=Object.getOwnPropertyDescript
4
4
  `){let o=de(e,s+1);if(!(o<e.length&&(tn.test(e.slice(o,o+2))||[",","="].includes(nn(e,s)))))return s;s=o;continue}}s++}return e.length},sn=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=I(e,i),r=i;continue}if(a==="/"&&e[i+1]==="/"){i=D(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=k(e,i);continue}if(a==="/"&&W(e,i)){i=U(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},Te=e=>{let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return he.test(t)?[t]:[];let n=[];for(let s of _e(t.slice(1,rt(t)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=Ce(s);if(r!==-1&&(s=s.slice(0,r).trim()),t.startsWith("{")){let o=xe(s,":");if(o!==-1){n.push(...Te(s.slice(o+1)));continue}}n.push(...Te(s))}return n},rn=e=>{let t=[],n=sn(e).map(({raw:o,codeEnd:i})=>{let a=o.match(/^\s*/)[0];if(i<=a.length)return{text:o,empty:!0};let l=o.slice(a.length,i),p=o.slice(i),u=Ce(l),g=(u===-1?l:l.slice(0,u)).trim(),R=l[0]==="{"||l[0]==="[";R?t.push(...Te(g)):he.test(g)&&t.push(g);let j=ge(l).code;return{text:`${a}${R?`(${j})`:j}${p}`,empty:!1}}),s=[];for(;n.length&&n[n.length-1].empty;)s.unshift(n.pop().text);let r=n.map(o=>o.text).join(",")+s.join("");return r.trimStart().startsWith("(")&&(r=`;${r}`),{vars:t,code:r}},ge=e=>{let t=[],n="",s=0,r=0,o=!0;for(;s<e.length;){let i=e[s],a=e[s+1];if(i==="'"||i==='"'||i==="`"){let l=I(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(i==="/"&&(a==="/"||a==="*")){let l=a==="/"?D(e,s):k(e,s);n+=e.slice(s,l),s=l;continue}if(i==="/"&&W(e,s)){let l=U(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(fe.lastIndex=s,fe.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){Ye.lastIndex=s;let l=Ye.exec(e);if(l){let u=s+l[0].length,g=nt(e,u),{vars:R,code:j}=rn(e.slice(u,g));t.push(...R),n+=j,s=g,o=!1;continue}et.lastIndex=s;let p=et.exec(e);if(p){tt.lastIndex=s;let u=tt.exec(e);u&&t.push(u[1]);let g=s+p[0].length,R=nt(e,g);n+=`$__effect(() => { ${ge(e.slice(g,R)).code} });`,s=R;continue}}"([{".includes(i)?r++:")]}".includes(i)&&(r=Math.max(0,r-1)),i===`
5
5
  `||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),n+=i,s++}return{vars:t,code:n}},pe=/export\s+default(?![\w$])/y,st=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,on=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},an=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=on(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(", ")}`},he=/^[A-Za-z_$][\w$]*$/,rt=e=>{let t=0,n=0;for(;n<e.length;){let s=e[n];if(s==="'"||s==='"'||s==="`"){n=I(e,n);continue}if(s==="/"&&e[n+1]==="/"){n=D(e,n);continue}if(s==="/"&&e[n+1]==="*"){n=k(e,n);continue}if(s==="/"&&W(e,n)){n=U(e,n);continue}if("([{".includes(s))t++;else if(")]}".includes(s)&&--t===0)return n;n++}return e.length},xe=(e,t)=>{let n=0,s=0;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=I(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=D(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=k(e,s);continue}if(r==="/"&&r!==t&&W(e,s)){s=U(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===t)return s;s++}return-1},_e=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let o=e[r];if(o==="'"||o==='"'||o==="`"){r=I(e,r);continue}if(o==="/"&&e[r+1]==="/"){r=D(e,r);continue}if(o==="/"&&e[r+1]==="*"){r=k(e,r);continue}if(o==="/"&&W(e,r)){r=U(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},Ce=e=>{let t=0;for(;t<e.length;){let n=xe(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},me=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=rt(t);if(n>=t.length)return null;let s=[];for(let r of _e(t.slice(1,n))){if(r.startsWith("..."))continue;let o=Ce(r),i=o===-1?r:r.slice(0,o),a=o===-1?void 0:r.slice(o+1).trim(),l=xe(i,":"),p=(l===-1?i:i.slice(0,l)).trim();if(!he.test(p))continue;let u={name:p};a!==void 0&&(u.default=a);let g=l===-1?"":i.slice(l+1).trim();he.test(g)&&(u.as=g),s.push(u)}return s},ln=e=>{let t=0,n=0,s=!0;for(;t<e.length;){let r=e[t];if(r==="'"||r==='"'||r==="`"){t=I(e,t),s=!1;continue}if(r==="/"&&e[t+1]==="/"){t=D(e,t);continue}if(r==="/"&&e[t+1]==="*"){t=k(e,t);continue}if(r==="/"&&W(e,t)){t=U(e,t),s=!1;continue}if(r==="e"&&n===0&&s&&(t===0||!/[\w$.]/.test(e[t-1]))){pe.lastIndex=t;let o=pe.exec(e);if(o)return t+o[0].length}"([{".includes(r)?n++:")]}".includes(r)&&(n=Math.max(0,n-1)),r===`
6
6
  `||r===";"||r==="}"?s=!0:/\s/.test(r)||(s=!1),t++}return-1},cn=/^async(?![\w$])/,un=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,dn=e=>{let t=ln(e);if(t===-1)return null;let n=de(e,t),s=e.slice(n);cn.test(s)&&(n=de(e,n+5));let r=un.exec(e.slice(n));if(r&&(n=de(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=I(e,i);continue}if(a==="/"&&e[i+1]==="/"){i=D(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=k(e,i);continue}if(a==="/"&&W(e,i)){i=U(e,i);continue}if("([{".includes(a))o++;else if(")]}".includes(a)&&--o===0)break;i++}return _e(e.slice(n+1,i))[0]??""},ye=e=>{let t=dn(e);if(t===null)return null;let n=me(t),s=n?.find(r=>r.name.startsWith("$"))?.name;if(s)throw new Error(`jq79: the factory signature is (props, ctx), so \`${s}\` can't be destructured from the first parameter. Write \`export default (props, { ${s} }) => \u2026\`, or \`_\` in place of props if the component takes none.`);return n},ot=e=>{let t="",n=0,s=0,r=!0,o=!1,i=0;for(;n<e.length;){let a=e[n],l=e[n+1],p=n===0||!/[\w$.]/.test(e[n-1]);if(a==="'"||a==='"'||a==="`"){let u=I(e,n);t+=e.slice(n,u),n=u,r=!1;continue}if(a==="/"&&(l==="/"||l==="*")){let u=l==="/"?D(e,n):k(e,n);t+=e.slice(n,u),n=u;continue}if(a==="/"&&W(e,n)){let u=U(e,n);t+=e.slice(n,u),n=u,r=!1;continue}if(a==="i"&&p){if(fe.lastIndex=n,fe.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){st.lastIndex=n;let u=st.exec(e);if(u){t+=an(u[1],u[3],i++),n+=u[0].length,r=!1;continue}}}if(a==="e"&&p&&s===0&&r){pe.lastIndex=n;let u=pe.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 fn="0.5.13",Et=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),St=e=>{let t=Et(e),n=t[ve];return delete t[ve],{tag:e.tagName.toLowerCase(),attrs:t,...n===void 0?{}:{component:n},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(s=>{if(s.nodeType===Node.TEXT_NODE){let r=s.textContent??"";return r?[r]:[]}return s.nodeType===Node.ELEMENT_NODE?[St(s)]:[]})}},it=new Map,wt=(e,t)=>{let n=`${t.join(",")}|${e}`,s=it.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
7
+ `||a===";"||a==="}"?r=!0:/\s/.test(a)||(r=!1),t+=a,n++}return o?t:null};var fn="0.5.14",Et=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),St=e=>{let t=Et(e),n=t[ve];return delete t[ve],{tag:e.tagName.toLowerCase(),attrs:t,...n===void 0?{}:{component:n},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(s=>{if(s.nodeType===Node.TEXT_NODE){let r=s.textContent??"";return r?[r]:[]}return s.nodeType===Node.ELEMENT_NODE?[St(s)]:[]})}},it=new Map,wt=(e,t)=>{let n=`${t.join(",")}|${e}`,s=it.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
8
8
  ); }`)}catch{s=null}it.set(n,s)}return s},pn=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,hn=100,G=new Map,De=new Set,be=0,je=!1,Ne=new Set,gn=()=>{je=!1,!(be>0)&&(G.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(De.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 = () => {}".`))}),G.clear())},Rt=()=>{je||be>0||!G.size||(je=!0,queueMicrotask(gn))},$t=e=>{be++;let t=()=>{be--,Rt()};e.then(t,t)},mn=(e,t)=>{if(Ne.has(e))return;Ne.add(e);let n=t?.message||String(t);console.error(`jq79: ${n} - evaluating "${e}". The expression rendered as nothing. If the value arrives later, guard it - "a?.b", or :if on the element.`)},Tt=(e,t,n)=>{if(!(n instanceof ReferenceError))return mn(e,n);let s=pn.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let o=`${r}|${e}`;De.has(o)||G.has(o)||G.size>=hn||(G.set(o,{name:r,expr:e,scope:t}),Rt())},xt=(e,t,n)=>{let s=wt(e,n?Object.keys(n):[]);if(s)return s(t,...n?Object.values(n):[])},C=(e,t,n)=>{try{return xt(e,t,n)}catch(s){Tt(e,t,s);return}},_t=(e,t,n)=>{try{return xt(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;Tt(e,t,s);return}},yn=(e,t)=>e.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>C(s,t)??""),bn=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),ke=e=>bn.has(e)||e.startsWith(":class.")||e.startsWith(":props.")||e===":slot"||e.startsWith(":slot."),En=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,Sn=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o);e.addEventListener(r,a=>{if(i.has("self")&&a.target!==e)return;i.has("prevent")&&a.preventDefault(),i.has("stop")&&a.stopPropagation();let l=_t(n,s,{$event:a});typeof l=="function"&&l.call(e,a)},{once:i.has("once"),capture:i.has("capture")})},wn=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o),a=l=>{i.has("prevent")&&l.preventDefault(),i.has("stop")&&l.stopPropagation(),i.has("once")&&e.off(r,a),te(()=>{let p=_t(n,s,{$event:l});typeof p=="function"&&p(l)})};e.on(r,a)},B=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),Oe=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),qe=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},Ee=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},Rn=({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}},at=(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},$n=e=>{let t=new Set;for(let n=e;n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let s of Object.keys(n))/^[A-Z]/.test(s)&&t.add(s);return[...t].sort()},Tn=(e,t)=>{let n=$n(t);return new Error(`jq79: <${e}> is not defined - no component of that name is in scope, and nothing renders here. Import it in a :setup script, declare it as a prop, or add a <template name="${e}"> to this file. In scope: ${n.length?n.join(", "):"(none)"}.`)},lt=200,Ae=0,Ct=Symbol("jq79.slots"),xn=e=>e==="slot"||e.startsWith("slot."),At=e=>e?B(e):"default",Ie=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),_n=e=>e==="default"?":slot":`:slot.${e}`,Cn=e=>typeof e!="string"||e.trim()!=="",An=e=>{let t={},n=[];e.children.forEach(r=>{let o=typeof r=="object"&&r.tag==="template"?Ie(r):void 0;if(typeof r=="string"||o===void 0){n.push(r);return}let i=At(o.slice(6));if(i in t){console.warn(`jq79: two <template ${_n(i)}> in <${e.tag}>; the second was ignored`);return}t[i]={nodes:r.children,binder:r.attrs[o]||void 0}});let s=n.some(Cn);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},jn=(e,t,n)=>{me(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`)})})},Nn=e=>{let t=Ie(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}`)},On=(e,t)=>{let n=Object.entries(An(e));if(!n.length)return null;let s={};return n.forEach(([r,o])=>{s[r]=vn(o,t)}),s},vn=(e,t)=>(n,s,r,o)=>{let i=Object.create(t);jn(i,e.binder,n);let a=i[ue]??[];Object.defineProperty(i,ue,{value:[...a,s]});let l=z(i);return r.onDispose(()=>l.dispose()),K(e.nodes,i,l,o)},Pn=(e,t,n,s)=>{let r=At(e.tag.slice(5)),o=document.createDocumentFragment(),i=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);o.append(i,a);let l=t[Ct]?.[r];if(!l)return o.insertBefore(K(e.children,t,n,s),a),o;let p={};return Object.entries(e.attrs).forEach(([u,g])=>{if(!(u===Re||ke(u)||u.startsWith("@")))if(u.startsWith(":")){let R=g||u.slice(1);p[B(u.slice(1))]=()=>C(R,t)}else p[B(u)]=()=>g}),o.insertBefore(l(p,t,n,s),a),o},ct=(e,t,n,s,r)=>{let o=document.createComment(e),i=document.createComment(`/${e}`),a=document.createDocumentFragment();a.append(o,i);let l=On(t,n),p={},u={},g=[],R=[],j=!1;Object.entries(t.attrs).forEach(([d,f])=>{if(d!==Re){if(d===":props"||d.startsWith(":props.")){j=!0,R.push({expr:f});return}if(!ke(d))if(d.startsWith("@"))g.push([d,f]);else if(d===":model"||d.startsWith(":model.")){let c=d===":model"?"default":B(d.slice(7));u[c]=f||(d===":model"?"model":c)}else if(d.startsWith(":")){let c=B(d.slice(1));p[c]=f||c,R.push({name:c,expr:f||c})}else{let c=B(d),m=JSON.stringify(f);p[c]=m,R.push({name:c,expr:m})}}});let N=d=>d==="default"?":model":`:model.${d}`,O=d=>d==="default"?"model":d,y=d=>`${d}
9
9
  = $value`,w=new Set;Object.entries(u).forEach(([d,f])=>{let c=O(d);p[c]!==void 0&&console.warn(`jq79: <${t.tag}> binds prop "${c}" through both :${c} and ${N(d)} - ${N(d)} wins`),p[c]=f,wt(y(f),["$value"])===null&&(w.add(d),console.warn(`jq79: ${N(d)}="${f}" is not assignable - updates from <${t.tag}> will be dropped`))});let x=()=>{let d={};return R.forEach(({name:f,expr:c})=>{if(f!==void 0)d[f]=C(c,n);else{let m=C(c,n);m!==null&&typeof m=="object"&&Object.assign(d,m)}}),Object.entries(u).forEach(([f,c])=>{d[O(f)]=C(c,n)}),d},h=null,b=null,T=null,S=new Set,A=d=>{if(d==null){if(!n[Pt]?.has(e)||S.has("unfilled"))return;S.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}S.has("type")||(S.add("type"),console.error(`jq79: <${t.tag}> is ${typeof d}, not a component - nothing renders here`))};return s.effect(()=>{let d=C(e,n),f=d instanceof q?d:null;if(f||A(d),f===b||(T?.dispose(),T=null,h?.destroy(),h=null,b=f,!f))return;let c=new q({template:f.template,scripts:f.scripts,styles:f.styles,modules:f.modules,filename:f.filename,siblings:f.siblings,name:f.name});if(l&&(c.slots=l),Object.keys(u).length){let v=new Set;c.modelWriteback=(M,H)=>{let P=M==null?"default":B(String(M)),V=u[P];return V===void 0?(v.has(P)||(v.add(P),console.warn(`jq79: <${t.tag}> has no ${N(P)} - bound: ${Object.keys(u).map(N).join(", ")}`)),!1):w.has(P)?!1:(te(()=>C(y(V),n,{$value:H})),!0)}}g.forEach(([v,M])=>wn(c,v,M,n));let m=ds(c.scripts);fs(t,e,Object.keys(p),m);let E=gt(te(x),m),$=document.createDocumentFragment();if(Ae>=lt){console.error(`jq79: <${t.tag}> is ${lt} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}Ae++;try{(r?c.renderShadow(E):c.render(E)).mount($)}finally{Ae--}i.parentNode.insertBefore($,i);let L=z(n);if(j){let v=[];L.effect(()=>{let M=gt(x(),m),H=Object.keys(M);v.forEach(P=>{P in M||(c.data[P]=void 0)}),H.forEach(P=>{c.data[P]=M[P]}),v=H})}else Object.entries(p).forEach(([v,M])=>{m!==null&&!m.has(v)||L.effect(()=>{c.data[v]=C(M,n)})});T=L,h=c}),s.onDispose(()=>{T?.dispose(),h?.destroy()}),a},Ln=(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)}})},re=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(re):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?re(t):[]):[],Mn=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?Ge(e):()=>!1,Dn=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"]),ut=(e,t,n)=>{let s=Dn.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},We=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?Ln(r,t):t;if(xn(e.tag))return Pn(e,o,n,s);if(e.tag==="template"&&Ie(e)!==void 0)return Nn(e);let i=at(o,e.tag);if(i)return ct(i,e,o,n,s);let a=document.createElement(e.tag);if(e.component&&a instanceof HTMLUnknownElement&&o[Le]?.count===0)throw Tn(e.component,o);let l=a instanceof HTMLUnknownElement||e.tag.includes("-");if(l){let y=!1;n.effect(()=>{if(y)return;let w=at(o,e.tag);if(!w)return;y=!0;let x=ct(w,e,o,n,s),h=qe(x);n.onDispose(()=>Ee(h)),a.replaceWith(x)})}Object.entries(e.attrs).forEach(([y,w])=>{if(y.startsWith("@"))Sn(a,y,w,o);else if(y===":model"||y.startsWith(":model."))l||console.warn(`jq79: ${y} on <${e.tag}> does nothing - :model binds component tags only (for now)`);else if(!ke(y))if(y.startsWith(":"))if(l)a.setAttribute(y,w);else{let x=y.slice(1),h=w||B(x);n.effect(()=>ut(a,x,C(h,o)))}else a.setAttribute(y,w)});let p=e.attrs[":attrs"];if(p!==void 0){let y=[];n.effect(()=>{y.forEach(x=>a.removeAttribute(x));let w=C(p,o);y=w&&typeof w=="object"?Object.keys(w):[],y.forEach(x=>ut(a,x,w[x]))})}let u=e.attrs[":class"],g=Object.entries(e.attrs).filter(([y])=>y.startsWith(":class.")).map(([y,w])=>[y.slice(7),w]);if(u!==void 0||g.length){let y=new Set(re(e.attrs.class??"")),w=[];n.effect(()=>{let x=u!==void 0?re(C(u,o)):[];g.forEach(([h,b])=>{C(b,o)&&x.push(...re(h))}),w.forEach(h=>{!x.includes(h)&&!y.has(h)&&a.classList.remove(h)}),a.classList.add(...x),w=x})}let R=e.attrs[":text"],j=e.attrs[":html"],N=e.attrs[":html.allowed"];N!==void 0&&j===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),R!==void 0?n.effect(()=>{a.textContent=String(C(R,o)??"")}):j!==void 0?n.effect(()=>{let y=N!==void 0?{allowUrl:Mn(C(N,o))}:void 0;a.innerHTML=Ke(String(C(j,o)??""),y)}):a instanceof HTMLTemplateElement?a.content.appendChild(K(e.children,o,n,s)):a.appendChild(K(e.children,o,n,s));let O=e.attrs[":value"];return O!==void 0&&n.effect(()=>{let y=String(C(O,o)??"");a.value!==y&&(a.value=y)}),[":checked",":selected"].forEach(y=>{let w=e.attrs[y];if(w===void 0)return;let x=y.slice(1);n.effect(()=>{a[x]=!!C(w,o)})}),a},kn=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,a=null,l=null;return n.effect(()=>{let p=e.find(g=>g.expr===void 0||C(g.expr,t))??null;if(p===a||(l?.dispose(),i&&Ee(i),i=null,a=p,!p))return;l=z(t);let u=We(p.node,t,l,s);i=qe(u),r.parentNode.insertBefore(u,r.nextSibling)}),o},se=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},qn=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},In=(e,t,n,s)=>{let r=e.attrs[":each"].match(En);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,o,i,a]=r,l=e.attrs[":key"],{[":each"]:p,[":key"]:u,...g}=e.attrs,R={...e,attrs:g},j=document.createComment("each"),N=document.createDocumentFragment();N.appendChild(j),(":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 O=[],y=!1;return n.effect(()=>{let w=C(a,t),x=Array.isArray(w)?w.map((d,f)=>[f,d]):qn(w)?Object.entries(w):[],h=new Map;O.forEach(d=>{let f=h.get(d.key);f?f.push(d):h.set(d.key,[d])});let b=new Set,T=[],S=x.map(([d,f],c)=>{let m=Object.create(t);se(m,o,f),i&&se(m,i,d),se(m,"$index",c);let E=l!==void 0?C(l,m):d;b.has(E)&&!y&&(y=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),b.add(E);let $=h.get(E)?.shift();if($&&Object.is($.item,f))return $.scope.$index!==c&&T.push($),se($.scope,"$index",c),i&&se($.scope,i,d),$;$&&($.fx.dispose(),Ee($.range));let L=z(t),v=qe(We(R,m,L,s));return{key:E,item:f,scope:m,fx:L,range:v}});h.forEach(d=>d.forEach(f=>{f.fx.dispose(),Ee(f.range)}));let A=j;S.forEach(d=>{A.nextSibling!==d.range.first&&Rn(d.range,A),A=d.range.last}),T.forEach(d=>te(()=>d.fx.refresh())),O=S}),N},K=(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=yn(i,t)}),r.appendChild(a),o++;continue}if(":each"in i.attrs){r.appendChild(In(i,t,n,s)),o++;continue}if(":if"in i.attrs){let a=[{expr:i.attrs[":if"],node:i}];o++;let l=u=>{let g=o;for(;g<e.length&&typeof e[g]=="string"&&!e[g].trim();)g++;let R=e[g];if(typeof R=="object"&&u in R.attrs)return o=g+1,R};for(let u=l(":elseif");u;u=l(":elseif"))a.push({expr:u.attrs[":elseif"],node:u});let p=l(":else");p&&a.push({node:p}),r.appendChild(kn(a,t,n,s));continue}r.appendChild(We(i,t,n,s)),o++}return r},Wn=(e,t,n=!1)=>K(e.template,t,z(t),n),Un=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Fn=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,Ue=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Bn=e=>e.split(Ue).map((t,n)=>n%2===1?t:t.replace(Fn,(s,r,o)=>Un.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),jt=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,Hn=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,zn=e=>e.split(Ue).map((t,n)=>n%2===1?t:t.replace(jt,(s,r,o)=>{let i=0,a=o.replace(Hn,(l,p,u)=>u===void 0?l:`${p}:props.${i++}="${u}"`);return`<${r}${a}>`})).join(""),Gn=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,Zn=/<\/slot\.([\w.$-]+)(\s*)>/gi,Kn=/^slot\./i,Vn=e=>Kn.test(e)?`slot.${Oe(e.slice(5))}`:e,ve=":jq79-component",Jn=/^[A-Z]/,Xn=/\/\s*$/,Qn=(e,t)=>{if(!Jn.test(e))return t;let n=` ${ve}="${e}"`,s=Xn.exec(t);return s?`${t.slice(0,s.index)}${n}${s[0]}`:`${t}${n}`},Yn=e=>e.split(Ue).map((t,n)=>n%2===1?t:t.replace(jt,(s,r,o)=>{let i=o.replace(Gn,(a,l,p)=>p===void 0?a:`${l}${Oe(p)}`);return`<${Vn(r)}${Qn(r,i)}>`}).replace(Zn,(s,r,o)=>`</slot.${Oe(r)}${o}>`)).join(""),Re="data-jq79",es=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)},Nt=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[Re]=t,Nt(n.children,t))})},ts=(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}[${Re}="${t}"]${i}`}).join(", "),Ot=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=ts(n.selectorText,t):n instanceof CSSGroupingRule&&Ot(n.cssRules,t)})},ns=(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),Ot(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
10
10
  `)},ss=/^[A-Z][A-Za-z0-9]*$/,Pe=e=>{let t=Bn(zn(Yn(e))),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],o=[];Array.from(s.content.children).forEach(l=>{l.tagName==="TEMPLATE"?o.push(l):r.push(l)});let i=dt(r,e),a={};return o.forEach(l=>{let p=l.getAttribute("name");if(p===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!ss.test(p)){console.warn(`jq79: <template name="${p}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(p in a){console.warn(`jq79: two <template name="${p}"> in one file; the second was ignored`);return}a[p]=new q({...dt(Array.from(l.content.children),l.innerHTML),siblings:a,name:p})}),Object.keys(a).length&&(i.siblings=a),i},dt=(e,t)=>{let n=[],s=[],r=[];e.forEach(i=>{let a={attrs:Et(i),content:i.textContent??""};i.tagName==="SCRIPT"?n.push(a):i.tagName==="STYLE"?s.push(a):r.push(St(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=es(t);Nt(r,i),s.forEach(a=>{o(a)&&(a.scoped=ns(a.content,i))})}return{template:r,scripts:n,styles:s}},Fe=e=>/\.html?([?#]|$)/.test(e)?Me(e):import(e),rs=/^(?:\.\.?\/|\/|[a-z][a-z0-9+.-]*:)/i,os=(e,t)=>{if(!rs.test(e))return e;try{return new URL(e,new URL(t??"",document.baseURI)).href}catch{return e}},vt=(e,t)=>e?`
package/dist/jq79.js CHANGED
@@ -4,7 +4,7 @@ var Mt=Object.defineProperty;var Dt=(e,t,n)=>t in e?Mt(e,t,{enumerable:!0,config
4
4
  `){let o=le(e,s+1);if(!(o<e.length&&(Zt.test(e.slice(o,o+2))||[",","="].includes(Kt(e,s)))))return s;s=o;continue}}s++}return e.length},Vt=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=q(e,i),r=i;continue}if(a==="/"&&e[i+1]==="/"){i=D(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=k(e,i);continue}if(a==="/"&&I(e,i)){i=W(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},Re=e=>{let t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return de.test(t)?[t]:[];let n=[];for(let s of Te(t.slice(1,st(t)))){s.startsWith("...")&&(s=s.slice(3).trim());let r=xe(s);if(r!==-1&&(s=s.slice(0,r).trim()),t.startsWith("{")){let o=$e(s,":");if(o!==-1){n.push(...Re(s.slice(o+1)));continue}}n.push(...Re(s))}return n},Jt=e=>{let t=[],n=Vt(e).map(({raw:o,codeEnd:i})=>{let a=o.match(/^\s*/)[0];if(i<=a.length)return{text:o,empty:!0};let l=o.slice(a.length,i),p=o.slice(i),u=xe(l),g=(u===-1?l:l.slice(0,u)).trim(),R=l[0]==="{"||l[0]==="[";R?t.push(...Re(g)):de.test(g)&&t.push(g);let j=fe(l).code;return{text:`${a}${R?`(${j})`:j}${p}`,empty:!1}}),s=[];for(;n.length&&n[n.length-1].empty;)s.unshift(n.pop().text);let r=n.map(o=>o.text).join(",")+s.join("");return r.trimStart().startsWith("(")&&(r=`;${r}`),{vars:t,code:r}},fe=e=>{let t=[],n="",s=0,r=0,o=!0;for(;s<e.length;){let i=e[s],a=e[s+1];if(i==="'"||i==='"'||i==="`"){let l=q(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(i==="/"&&(a==="/"||a==="*")){let l=a==="/"?D(e,s):k(e,s);n+=e.slice(s,l),s=l;continue}if(i==="/"&&I(e,s)){let l=W(e,s);n+=e.slice(s,l),s=l,o=!1;continue}if(i==="i"&&(s===0||!/[\w$.]/.test(e[s-1]))&&(ce.lastIndex=s,ce.test(e))){n+="$__import",s+=6,o=!1;continue}if(r===0&&o){Qe.lastIndex=s;let l=Qe.exec(e);if(l){let u=s+l[0].length,g=tt(e,u),{vars:R,code:j}=Jt(e.slice(u,g));t.push(...R),n+=j,s=g,o=!1;continue}Ye.lastIndex=s;let p=Ye.exec(e);if(p){et.lastIndex=s;let u=et.exec(e);u&&t.push(u[1]);let g=s+p[0].length,R=tt(e,g);n+=`$__effect(() => { ${fe(e.slice(g,R)).code} });`,s=R;continue}}"([{".includes(i)?r++:")]}".includes(i)&&(r=Math.max(0,r-1)),i===`
5
5
  `||i===";"||i==="}"?o=!0:/\s/.test(i)||(o=!1),n+=i,s++}return{vars:t,code:n}},ue=/export\s+default(?![\w$])/y,nt=/import\s*(?:([\w$\s,{}*]+?)\s*from\s*)?(["'])([^"'\n]+)\2/y,Xt=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},Qt=(e,t,n)=>{let s=`await $__import(${JSON.stringify(t)})`;if(e===void 0)return s;let r=Xt(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(", ")}`},de=/^[A-Za-z_$][\w$]*$/,st=e=>{let t=0,n=0;for(;n<e.length;){let s=e[n];if(s==="'"||s==='"'||s==="`"){n=q(e,n);continue}if(s==="/"&&e[n+1]==="/"){n=D(e,n);continue}if(s==="/"&&e[n+1]==="*"){n=k(e,n);continue}if(s==="/"&&I(e,n)){n=W(e,n);continue}if("([{".includes(s))t++;else if(")]}".includes(s)&&--t===0)return n;n++}return e.length},$e=(e,t)=>{let n=0,s=0;for(;s<e.length;){let r=e[s];if(r==="'"||r==='"'||r==="`"){s=q(e,s);continue}if(r==="/"&&e[s+1]==="/"){s=D(e,s);continue}if(r==="/"&&e[s+1]==="*"){s=k(e,s);continue}if(r==="/"&&r!==t&&I(e,s)){s=W(e,s);continue}if("([{".includes(r))n++;else if(")]}".includes(r))n--;else if(n===0&&r===t)return s;s++}return-1},Te=e=>{let t=[],n=0,s=0,r=0;for(;r<=e.length;){let o=e[r];if(o==="'"||o==='"'||o==="`"){r=q(e,r);continue}if(o==="/"&&e[r+1]==="/"){r=D(e,r);continue}if(o==="/"&&e[r+1]==="*"){r=k(e,r);continue}if(o==="/"&&I(e,r)){r=W(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},xe=e=>{let t=0;for(;t<e.length;){let n=$e(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},pe=e=>{let t=(e??"").trim();if(!t.startsWith("{"))return null;let n=st(t);if(n>=t.length)return null;let s=[];for(let r of Te(t.slice(1,n))){if(r.startsWith("..."))continue;let o=xe(r),i=o===-1?r:r.slice(0,o),a=o===-1?void 0:r.slice(o+1).trim(),l=$e(i,":"),p=(l===-1?i:i.slice(0,l)).trim();if(!de.test(p))continue;let u={name:p};a!==void 0&&(u.default=a);let g=l===-1?"":i.slice(l+1).trim();de.test(g)&&(u.as=g),s.push(u)}return s},Yt=e=>{let t=0,n=0,s=!0;for(;t<e.length;){let r=e[t];if(r==="'"||r==='"'||r==="`"){t=q(e,t),s=!1;continue}if(r==="/"&&e[t+1]==="/"){t=D(e,t);continue}if(r==="/"&&e[t+1]==="*"){t=k(e,t);continue}if(r==="/"&&I(e,t)){t=W(e,t),s=!1;continue}if(r==="e"&&n===0&&s&&(t===0||!/[\w$.]/.test(e[t-1]))){ue.lastIndex=t;let o=ue.exec(e);if(o)return t+o[0].length}"([{".includes(r)?n++:")]}".includes(r)&&(n=Math.max(0,n-1)),r===`
6
6
  `||r===";"||r==="}"?s=!0:/\s/.test(r)||(s=!1),t++}return-1},en=/^async(?![\w$])/,tn=/^function(?![\w$])\s*\*?\s*[A-Za-z_$][\w$]*|^function(?![\w$])\s*\*?/,nn=e=>{let t=Yt(e);if(t===-1)return null;let n=le(e,t),s=e.slice(n);en.test(s)&&(n=le(e,n+5));let r=tn.exec(e.slice(n));if(r&&(n=le(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=q(e,i);continue}if(a==="/"&&e[i+1]==="/"){i=D(e,i);continue}if(a==="/"&&e[i+1]==="*"){i=k(e,i);continue}if(a==="/"&&I(e,i)){i=W(e,i);continue}if("([{".includes(a))o++;else if(")]}".includes(a)&&--o===0)break;i++}return Te(e.slice(n+1,i))[0]??""},he=e=>{let t=nn(e);if(t===null)return null;let n=pe(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},rt=e=>{let t="",n=0,s=0,r=!0,o=!1,i=0;for(;n<e.length;){let a=e[n],l=e[n+1],p=n===0||!/[\w$.]/.test(e[n-1]);if(a==="'"||a==='"'||a==="`"){let u=q(e,n);t+=e.slice(n,u),n=u,r=!1;continue}if(a==="/"&&(l==="/"||l==="*")){let u=l==="/"?D(e,n):k(e,n);t+=e.slice(n,u),n=u;continue}if(a==="/"&&I(e,n)){let u=W(e,n);t+=e.slice(n,u),n=u,r=!1;continue}if(a==="i"&&p){if(ce.lastIndex=n,ce.test(e)){t+="$__import",n+=6,r=!1;continue}if(s===0&&r){nt.lastIndex=n;let u=nt.exec(e);if(u){t+=Qt(u[1],u[3],i++),n+=u[0].length,r=!1;continue}}}if(a==="e"&&p&&s===0&&r){ue.lastIndex=n;let u=ue.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 sn="0.5.13",bt=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),Et=e=>{let t=bt(e),n=t[Ne];return delete t[Ne],{tag:e.tagName.toLowerCase(),attrs:t,...n===void 0?{}:{component:n},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(s=>{if(s.nodeType===Node.TEXT_NODE){let r=s.textContent??"";return r?[r]:[]}return s.nodeType===Node.ELEMENT_NODE?[Et(s)]:[]})}},ot=new Map,St=(e,t)=>{let n=`${t.join(",")}|${e}`,s=ot.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
7
+ `||a===";"||a==="}"?r=!0:/\s/.test(a)||(r=!1),t+=a,n++}return o?t:null};var sn="0.5.14",bt=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),Et=e=>{let t=bt(e),n=t[Ne];return delete t[Ne],{tag:e.tagName.toLowerCase(),attrs:t,...n===void 0?{}:{component:n},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(s=>{if(s.nodeType===Node.TEXT_NODE){let r=s.textContent??"";return r?[r]:[]}return s.nodeType===Node.ELEMENT_NODE?[Et(s)]:[]})}},ot=new Map,St=(e,t)=>{let n=`${t.join(",")}|${e}`,s=ot.get(n);if(s===void 0){try{s=new Function("$scope",...t,`with ($scope) { return (${e}
8
8
  ); }`)}catch{s=null}ot.set(n,s)}return s},rn=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,on=100,G=new Map,Me=new Set,ge=0,Ce=!1,Ae=new Set,an=()=>{Ce=!1,!(ge>0)&&(G.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(Me.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 = () => {}".`))}),G.clear())},wt=()=>{Ce||ge>0||!G.size||(Ce=!0,queueMicrotask(an))},Rt=e=>{ge++;let t=()=>{ge--,wt()};e.then(t,t)},ln=(e,t)=>{if(Ae.has(e))return;Ae.add(e);let n=t?.message||String(t);console.error(`jq79: ${n} - evaluating "${e}". The expression rendered as nothing. If the value arrives later, guard it - "a?.b", or :if on the element.`)},$t=(e,t,n)=>{if(!(n instanceof ReferenceError))return ln(e,n);let s=rn.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let o=`${r}|${e}`;Me.has(o)||G.has(o)||G.size>=on||(G.set(o,{name:r,expr:e,scope:t}),wt())},Tt=(e,t,n)=>{let s=St(e,n?Object.keys(n):[]);if(s)return s(t,...n?Object.values(n):[])},C=(e,t,n)=>{try{return Tt(e,t,n)}catch(s){$t(e,t,s);return}},xt=(e,t,n)=>{try{return Tt(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;$t(e,t,s);return}},cn=(e,t)=>e.replace(/{{\s*([\s\S]+?)\s*}}/g,(n,s)=>C(s,t)??""),un=new Set([":attrs",":class",":value",":checked",":selected",":if",":elseif",":else",":each",":key",":with",":text",":html",":html.allowed",":props"]),De=e=>un.has(e)||e.startsWith(":class.")||e.startsWith(":props.")||e===":slot"||e.startsWith(":slot."),dn=/^\s*\(?\s*(\w+)\s*(?:,\s*(\w+))?\s*\)?\s+in\s+([\s\S]+)$/,fn=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o);e.addEventListener(r,a=>{if(i.has("self")&&a.target!==e)return;i.has("prevent")&&a.preventDefault(),i.has("stop")&&a.stopPropagation();let l=xt(n,s,{$event:a});typeof l=="function"&&l.call(e,a)},{once:i.has("once"),capture:i.has("capture")})},pn=(e,t,n,s)=>{let[r,...o]=t.slice(1).split("."),i=new Set(o),a=l=>{i.has("prevent")&&l.preventDefault(),i.has("stop")&&l.stopPropagation(),i.has("once")&&e.off(r,a),te(()=>{let p=xt(n,s,{$event:l});typeof p=="function"&&p(l)})};e.on(r,a)},F=e=>e.replace(/-(\w)/g,(t,n)=>n.toUpperCase()),je=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),ke=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},me=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},hn=({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}},it=(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},gn=e=>{let t=new Set;for(let n=e;n&&n!==Object.prototype;n=Object.getPrototypeOf(n))for(let s of Object.keys(n))/^[A-Z]/.test(s)&&t.add(s);return[...t].sort()},mn=(e,t)=>{let n=gn(t);return new Error(`jq79: <${e}> is not defined - no component of that name is in scope, and nothing renders here. Import it in a :setup script, declare it as a prop, or add a <template name="${e}"> to this file. In scope: ${n.length?n.join(", "):"(none)"}.`)},at=200,_e=0,_t=Symbol("jq79.slots"),yn=e=>e==="slot"||e.startsWith("slot."),Ct=e=>e?F(e):"default",qe=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),bn=e=>e==="default"?":slot":`:slot.${e}`,En=e=>typeof e!="string"||e.trim()!=="",Sn=e=>{let t={},n=[];e.children.forEach(r=>{let o=typeof r=="object"&&r.tag==="template"?qe(r):void 0;if(typeof r=="string"||o===void 0){n.push(r);return}let i=Ct(o.slice(6));if(i in t){console.warn(`jq79: two <template ${bn(i)}> in <${e.tag}>; the second was ignored`);return}t[i]={nodes:r.children,binder:r.attrs[o]||void 0}});let s=n.some(En);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},wn=(e,t,n)=>{pe(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`)})})},Rn=e=>{let t=qe(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}`)},$n=(e,t)=>{let n=Object.entries(Sn(e));if(!n.length)return null;let s={};return n.forEach(([r,o])=>{s[r]=Tn(o,t)}),s},Tn=(e,t)=>(n,s,r,o)=>{let i=Object.create(t);wn(i,e.binder,n);let a=i[ie]??[];Object.defineProperty(i,ie,{value:[...a,s]});let l=z(i);return r.onDispose(()=>l.dispose()),K(e.nodes,i,l,o)},xn=(e,t,n,s)=>{let r=Ct(e.tag.slice(5)),o=document.createDocumentFragment(),i=document.createComment(e.tag),a=document.createComment(`/${e.tag}`);o.append(i,a);let l=t[_t]?.[r];if(!l)return o.insertBefore(K(e.children,t,n,s),a),o;let p={};return Object.entries(e.attrs).forEach(([u,g])=>{if(!(u===be||De(u)||u.startsWith("@")))if(u.startsWith(":")){let R=g||u.slice(1);p[F(u.slice(1))]=()=>C(R,t)}else p[F(u)]=()=>g}),o.insertBefore(l(p,t,n,s),a),o},lt=(e,t,n,s,r)=>{let o=document.createComment(e),i=document.createComment(`/${e}`),a=document.createDocumentFragment();a.append(o,i);let l=$n(t,n),p={},u={},g=[],R=[],j=!1;Object.entries(t.attrs).forEach(([d,f])=>{if(d!==be){if(d===":props"||d.startsWith(":props.")){j=!0,R.push({expr:f});return}if(!De(d))if(d.startsWith("@"))g.push([d,f]);else if(d===":model"||d.startsWith(":model.")){let c=d===":model"?"default":F(d.slice(7));u[c]=f||(d===":model"?"model":c)}else if(d.startsWith(":")){let c=F(d.slice(1));p[c]=f||c,R.push({name:c,expr:f||c})}else{let c=F(d),m=JSON.stringify(f);p[c]=m,R.push({name:c,expr:m})}}});let N=d=>d==="default"?":model":`:model.${d}`,O=d=>d==="default"?"model":d,y=d=>`${d}
9
9
  = $value`,w=new Set;Object.entries(u).forEach(([d,f])=>{let c=O(d);p[c]!==void 0&&console.warn(`jq79: <${t.tag}> binds prop "${c}" through both :${c} and ${N(d)} - ${N(d)} wins`),p[c]=f,St(y(f),["$value"])===null&&(w.add(d),console.warn(`jq79: ${N(d)}="${f}" is not assignable - updates from <${t.tag}> will be dropped`))});let x=()=>{let d={};return R.forEach(({name:f,expr:c})=>{if(f!==void 0)d[f]=C(c,n);else{let m=C(c,n);m!==null&&typeof m=="object"&&Object.assign(d,m)}}),Object.entries(u).forEach(([f,c])=>{d[O(f)]=C(c,n)}),d},h=null,b=null,T=null,S=new Set,A=d=>{if(d==null){if(!n[vt]?.has(e)||S.has("unfilled"))return;S.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}S.has("type")||(S.add("type"),console.error(`jq79: <${t.tag}> is ${typeof d}, not a component - nothing renders here`))};return s.effect(()=>{let d=C(e,n),f=d instanceof U?d:null;if(f||A(d),f===b||(T?.dispose(),T=null,h?.destroy(),h=null,b=f,!f))return;let c=new U({template:f.template,scripts:f.scripts,styles:f.styles,modules:f.modules,filename:f.filename,siblings:f.siblings,name:f.name});if(l&&(c.slots=l),Object.keys(u).length){let v=new Set;c.modelWriteback=(M,B)=>{let P=M==null?"default":F(String(M)),V=u[P];return V===void 0?(v.has(P)||(v.add(P),console.warn(`jq79: <${t.tag}> has no ${N(P)} - bound: ${Object.keys(u).map(N).join(", ")}`)),!1):w.has(P)?!1:(te(()=>C(y(V),n,{$value:B})),!0)}}g.forEach(([v,M])=>pn(c,v,M,n));let m=ns(c.scripts);ss(t,e,Object.keys(p),m);let E=ht(te(x),m),$=document.createDocumentFragment();if(_e>=at){console.error(`jq79: <${t.tag}> is ${at} 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?c.renderShadow(E):c.render(E)).mount($)}finally{_e--}i.parentNode.insertBefore($,i);let L=z(n);if(j){let v=[];L.effect(()=>{let M=ht(x(),m),B=Object.keys(M);v.forEach(P=>{P in M||(c.data[P]=void 0)}),B.forEach(P=>{c.data[P]=M[P]}),v=B})}else Object.entries(p).forEach(([v,M])=>{m!==null&&!m.has(v)||L.effect(()=>{c.data[v]=C(M,n)})});T=L,h=c}),s.onDispose(()=>{T?.dispose(),h?.destroy()}),a},_n=(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)}})},se=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(se):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?se(t):[]):[],Cn=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?ze(e):()=>!1,An=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"]),ct=(e,t,n)=>{let s=An.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},Ie=(e,t,n,s)=>{let r=e.attrs[":with"],o=r!==void 0?_n(r,t):t;if(yn(e.tag))return xn(e,o,n,s);if(e.tag==="template"&&qe(e)!==void 0)return Rn(e);let i=it(o,e.tag);if(i)return lt(i,e,o,n,s);let a=document.createElement(e.tag);if(e.component&&a instanceof HTMLUnknownElement&&o[ve]?.count===0)throw mn(e.component,o);let l=a instanceof HTMLUnknownElement||e.tag.includes("-");if(l){let y=!1;n.effect(()=>{if(y)return;let w=it(o,e.tag);if(!w)return;y=!0;let x=lt(w,e,o,n,s),h=ke(x);n.onDispose(()=>me(h)),a.replaceWith(x)})}Object.entries(e.attrs).forEach(([y,w])=>{if(y.startsWith("@"))fn(a,y,w,o);else if(y===":model"||y.startsWith(":model."))l||console.warn(`jq79: ${y} on <${e.tag}> does nothing - :model binds component tags only (for now)`);else if(!De(y))if(y.startsWith(":"))if(l)a.setAttribute(y,w);else{let x=y.slice(1),h=w||F(x);n.effect(()=>ct(a,x,C(h,o)))}else a.setAttribute(y,w)});let p=e.attrs[":attrs"];if(p!==void 0){let y=[];n.effect(()=>{y.forEach(x=>a.removeAttribute(x));let w=C(p,o);y=w&&typeof w=="object"?Object.keys(w):[],y.forEach(x=>ct(a,x,w[x]))})}let u=e.attrs[":class"],g=Object.entries(e.attrs).filter(([y])=>y.startsWith(":class.")).map(([y,w])=>[y.slice(7),w]);if(u!==void 0||g.length){let y=new Set(se(e.attrs.class??"")),w=[];n.effect(()=>{let x=u!==void 0?se(C(u,o)):[];g.forEach(([h,b])=>{C(b,o)&&x.push(...se(h))}),w.forEach(h=>{!x.includes(h)&&!y.has(h)&&a.classList.remove(h)}),a.classList.add(...x),w=x})}let R=e.attrs[":text"],j=e.attrs[":html"],N=e.attrs[":html.allowed"];N!==void 0&&j===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),R!==void 0?n.effect(()=>{a.textContent=String(C(R,o)??"")}):j!==void 0?n.effect(()=>{let y=N!==void 0?{allowUrl:Cn(C(N,o))}:void 0;a.innerHTML=Ze(String(C(j,o)??""),y)}):a instanceof HTMLTemplateElement?a.content.appendChild(K(e.children,o,n,s)):a.appendChild(K(e.children,o,n,s));let O=e.attrs[":value"];return O!==void 0&&n.effect(()=>{let y=String(C(O,o)??"");a.value!==y&&(a.value=y)}),[":checked",":selected"].forEach(y=>{let w=e.attrs[y];if(w===void 0)return;let x=y.slice(1);n.effect(()=>{a[x]=!!C(w,o)})}),a},jn=(e,t,n,s)=>{let r=document.createComment("if"),o=document.createDocumentFragment();o.appendChild(r);let i=null,a=null,l=null;return n.effect(()=>{let p=e.find(g=>g.expr===void 0||C(g.expr,t))??null;if(p===a||(l?.dispose(),i&&me(i),i=null,a=p,!p))return;l=z(t);let u=Ie(p.node,t,l,s);i=ke(u),r.parentNode.insertBefore(u,r.nextSibling)}),o},ne=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},Nn=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},On=(e,t,n,s)=>{let r=e.attrs[":each"].match(dn);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let[,o,i,a]=r,l=e.attrs[":key"],{[":each"]:p,[":key"]:u,...g}=e.attrs,R={...e,attrs:g},j=document.createComment("each"),N=document.createDocumentFragment();N.appendChild(j),(":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 O=[],y=!1;return n.effect(()=>{let w=C(a,t),x=Array.isArray(w)?w.map((d,f)=>[f,d]):Nn(w)?Object.entries(w):[],h=new Map;O.forEach(d=>{let f=h.get(d.key);f?f.push(d):h.set(d.key,[d])});let b=new Set,T=[],S=x.map(([d,f],c)=>{let m=Object.create(t);ne(m,o,f),i&&ne(m,i,d),ne(m,"$index",c);let E=l!==void 0?C(l,m):d;b.has(E)&&!y&&(y=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),b.add(E);let $=h.get(E)?.shift();if($&&Object.is($.item,f))return $.scope.$index!==c&&T.push($),ne($.scope,"$index",c),i&&ne($.scope,i,d),$;$&&($.fx.dispose(),me($.range));let L=z(t),v=ke(Ie(R,m,L,s));return{key:E,item:f,scope:m,fx:L,range:v}});h.forEach(d=>d.forEach(f=>{f.fx.dispose(),me(f.range)}));let A=j;S.forEach(d=>{A.nextSibling!==d.range.first&&hn(d.range,A),A=d.range.last}),T.forEach(d=>te(()=>d.fx.refresh())),O=S}),N},K=(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=cn(i,t)}),r.appendChild(a),o++;continue}if(":each"in i.attrs){r.appendChild(On(i,t,n,s)),o++;continue}if(":if"in i.attrs){let a=[{expr:i.attrs[":if"],node:i}];o++;let l=u=>{let g=o;for(;g<e.length&&typeof e[g]=="string"&&!e[g].trim();)g++;let R=e[g];if(typeof R=="object"&&u in R.attrs)return o=g+1,R};for(let u=l(":elseif");u;u=l(":elseif"))a.push({expr:u.attrs[":elseif"],node:u});let p=l(":else");p&&a.push({node:p}),r.appendChild(jn(a,t,n,s));continue}r.appendChild(Ie(i,t,n,s)),o++}return r},Ss=(e,t,n=!1)=>K(e.template,t,z(t),n),vn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Pn=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*?)\/>/g,We=/(<script[\s\S]*?<\/script\s*>|<style[\s\S]*?<\/style\s*>)/gi,Ln=e=>e.split(We).map((t,n)=>n%2===1?t:t.replace(Pn,(s,r,o)=>vn.has(r.toLowerCase())?s:`<${r}${o}></${r}>`)).join(""),At=/<([A-Za-z][\w.-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,Mn=/"[^"]*"|'[^']*'|(^|\s)\.\.\.([A-Za-z_$][\w$.]*)/g,Dn=e=>e.split(We).map((t,n)=>n%2===1?t:t.replace(At,(s,r,o)=>{let i=0,a=o.replace(Mn,(l,p,u)=>u===void 0?l:`${p}:props.${i++}="${u}"`);return`<${r}${a}>`})).join(""),kn=/"[^"]*"|'[^']*'|(^|\s)(:[\w.$-]+)/g,qn=/<\/slot\.([\w.$-]+)(\s*)>/gi,In=/^slot\./i,Wn=e=>In.test(e)?`slot.${je(e.slice(5))}`:e,Ne=":jq79-component",Un=/^[A-Z]/,Fn=/\/\s*$/,Bn=(e,t)=>{if(!Un.test(e))return t;let n=` ${Ne}="${e}"`,s=Fn.exec(t);return s?`${t.slice(0,s.index)}${n}${s[0]}`:`${t}${n}`},Hn=e=>e.split(We).map((t,n)=>n%2===1?t:t.replace(At,(s,r,o)=>{let i=o.replace(kn,(a,l,p)=>p===void 0?a:`${l}${je(p)}`);return`<${Wn(r)}${Bn(r,i)}>`}).replace(qn,(s,r,o)=>`</slot.${je(r)}${o}>`)).join(""),be="data-jq79",zn=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)},jt=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[be]=t,jt(n.children,t))})},Gn=(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}[${be}="${t}"]${i}`}).join(", "),Nt=(e,t)=>{Array.from(e).forEach(n=>{n instanceof CSSStyleRule?n.selectorText=Gn(n.selectorText,t):n instanceof CSSGroupingRule&&Nt(n.cssRules,t)})},Zn=(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),Nt(n.cssRules,t),Array.from(n.cssRules).map(s=>s.cssText).join(`
10
10
  `)},Kn=/^[A-Z][A-Za-z0-9]*$/,Oe=e=>{let t=Ln(Dn(Hn(e))),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],o=[];Array.from(s.content.children).forEach(l=>{l.tagName==="TEMPLATE"?o.push(l):r.push(l)});let i=ut(r,e),a={};return o.forEach(l=>{let p=l.getAttribute("name");if(p===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!Kn.test(p)){console.warn(`jq79: <template name="${p}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(p in a){console.warn(`jq79: two <template name="${p}"> in one file; the second was ignored`);return}a[p]=new U({...ut(Array.from(l.content.children),l.innerHTML),siblings:a,name:p})}),Object.keys(a).length&&(i.siblings=a),i},ut=(e,t)=>{let n=[],s=[],r=[];e.forEach(i=>{let a={attrs:bt(i),content:i.textContent??""};i.tagName==="SCRIPT"?n.push(a):i.tagName==="STYLE"?s.push(a):r.push(Et(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=zn(t);jt(r,i),s.forEach(a=>{o(a)&&(a.scoped=Zn(a.content,i))})}return{template:r,scripts:n,styles:s}},Ue=e=>/\.html?([?#]|$)/.test(e)?Pe(e):import(e),Vn=/^(?:\.\.?\/|\/|[a-z][a-z0-9+.-]*:)/i,Jn=(e,t)=>{if(!Vn.test(e))return e;try{return new URL(e,new URL(t??"",document.baseURI)).href}catch{return e}},Ot=(e,t)=>e?`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jq79",
3
- "version": "0.5.13",
3
+ "version": "0.5.14",
4
4
  "description": "Mini reactive component library: single-file components, Svelte-style setup scripts, fine-grained proxy reactivity. Single-file build, zero dependencies.",
5
5
  "keywords": [
6
6
  "reactive",
@@ -65,6 +65,7 @@
65
65
  "site": "node scripts/build-site.mjs",
66
66
  "site.dev": "node scripts/site-dev.mjs",
67
67
  "benchmark": "node scripts/run-benchmark.mjs",
68
+ "benchmark:comparison": "node scripts/run-comparison.mjs",
68
69
  "prepublishOnly": "npm test && npm run build"
69
70
  },
70
71
  "peerDependencies": {