jq79 0.4.2 → 0.4.4

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