jq79 0.8.1 → 0.8.2

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
@@ -14,7 +14,7 @@ ${e}
14
14
  ;$__exports.done = true })()`,is=e=>{let t=e.attrs[":setup"];return t===void 0?null:t.trim()===""?[]:je(t)},ls=(e,t,n=nt)=>{let s=new Set;return e.forEach(r=>{(n(r.content)??t(r))?.forEach(({name:o})=>s.add(o))}),s};var as="__jq79precompiled",cs="jq79-precompiled",ds=(e,t)=>`function anonymous(${e.join(",")}
15
15
  ) {
16
16
  ${t}
17
- }`;var So="0.8.1",Hs=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),qs="http://www.w3.org/1999/xhtml",Fs=e=>{let t=Hs(e),n=e.namespaceURI,s=t[Le];delete t[Le];let r=n!==null&&n!==qs;return{tag:r?e.tagName:e.tagName.toLowerCase(),attrs:t,...s===void 0?{}:{component:s},...r?{ns:n}:{},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(l=>{if(l.nodeType===Node.TEXT_NODE){let o=l.textContent??"";return o?[o]:[]}return l.nodeType===Node.ELEMENT_NODE?[Fs(l)]:[]})}},dt=new Map,ct=new Map,fn=!1,Jt,Me=class extends Error{constructor(n,s){super(`${n}. ${s}`);A(this,"reason",n);A(this,"hint",s)}},bo=()=>new Me("was not precompiled","Safe mode never builds code at runtime: the component's precompiled functions did not reach the page."),$o=(e,t)=>{let n=globalThis[as];if(Array.isArray(n)&&n.length>0)for(let[s,r,l]of n.splice(0))ct.set(it(s,r),l);return ct.size===0?void 0:ct.get(it(e,t))},wt=(e,t,n="")=>{let s=$o(e,t);if(s===null)throw new SyntaxError("jq79: this code did not compile when it was precompiled");if(s!==void 0)return s;if(Jt!==void 0)return To(e,t,n,Jt);if(fn)throw bo();return new Function(...e,t+n)},pn=()=>{if(!(typeof document>"u"))for(let e of Array.from(document.querySelectorAll("script[nonce]"))){let t=e.nonce||e.getAttribute("nonce");if(t)return t}},us="__jq79built",To=(e,t,n,s)=>{let r=document.createElement("script");r.setAttribute("nonce",s),r.textContent=`document.currentScript.${us} = ${ds(e,t)}${n}`;let l,o=a=>{l=a.error??new SyntaxError(a.message),a.preventDefault()};window.addEventListener("error",o);try{(document.head??document.documentElement).append(r)}finally{window.removeEventListener("error",o),r.remove()}let i=r[us];if(typeof i=="function")return ct.set(it(e,t),i),i;throw l!==void 0?l:new Me("could not be built","The page's CSP refused a <script> carrying the nonce jq79 read from the page.")},fs=new Set,Ro=(e,t)=>{fs.has(e)||(fs.add(e),console.error(`jq79: safeEval() is on, and "${e}" ${t.reason}, so it rendered as nothing. ${t.hint}`))},Ce=(e,t)=>{if(!(t in e)){if(t in globalThis)return globalThis[t];throw new ReferenceError(`${t} is not defined`)}},Ws=(e,t)=>{try{return wt([...Kt,...t],es(e))}catch(n){return n instanceof Me&&Ro(e,n),null}},xo=(e,t)=>{if(!X.scopedNames)return null;let n=ts(e,t);if(n===null)return null;try{return wt([...Kt,...t],n)}catch{return null}},hn=(e,t,n)=>{let s=dt.get(e);if(s===void 0){let r=xo(t,n);s=r?{fn:r,scoped:!0}:{fn:Ws(t,n),scoped:!1},dt.set(e,s)}return s},Ie=(e,t)=>`${t.join(",")}|${e}`,No=(e,t)=>hn(Ie(e,t),e,t).fn,Bs=(e,t,n)=>{let s=Ws(t,n);return dt.set(e,{fn:s,scoped:!1}),s},vo=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,Po=100,be=new Map,gn=new Set,ut=0,en=!1,tn=new Set,ko=()=>{en=!1,!(ut>0)&&(be.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(gn.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 = () => {}".`))}),be.clear())},Us=()=>{en||ut>0||!be.size||(en=!0,queueMicrotask(ko))},Ks=e=>{ut++;let t=()=>{ut--,Us()};e.then(t,t)},Co=(e,t)=>{if(tn.has(e))return;tn.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.`)},mn=(e,t,n)=>{if(!(n instanceof ReferenceError))return Co(e,n);let s=vo.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let l=`${r}|${e}`;gn.has(l)||be.has(l)||be.size>=Po||(be.set(l,{name:r,expr:e,scope:t}),Us())},zs=(e,t,n)=>{let s=n?Object.keys(n):[],r=Ie(e,s),{fn:l,scoped:o}=hn(r,e,s);if(!l)return;let i=n?Object.values(n):[];if(!o)return l(t,Ce,...i);try{return l(t,Ce,...i)}catch(a){if(!(a instanceof ReferenceError))throw a;let c=Bs(r,e,s);if(!c)throw a;return c(t,Ce,...i)}},He=[],Mo=(e,t,n)=>{try{let{fn:s,scoped:r}=hn(e,t,He);if(!s)return;if(!r)return s(n,Ce);try{return s(n,Ce)}catch(l){if(!(l instanceof ReferenceError))throw l;let o=Bs(e,t,He);if(!o)throw l;return o(n,Ce)}}catch(s){mn(t,n,s);return}},j=(e,t,n)=>{try{return zs(e,t,n)}catch(s){mn(e,t,s);return}},Gs=(e,t,n)=>{try{return zs(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;mn(e,t,s);return}},nn=(e,t)=>{if(e.length===1){let s=e[0];return typeof s=="string"?s:String(j(s.expr,t)??"")}let n="";for(let s of e)n+=typeof s=="string"?s:String(j(s.expr,t)??"");return n},yn=(e,t,n,s)=>{if(!X.cachedSetters){s.effect(()=>{let l=nn(t,n);e.textContent!==l&&(e.textContent=l)});return}let r=e.data;s.effect(()=>{let l=nn(t,n);l!==r&&(e.data=r=l)})},ps=new Map,Ao=e=>{if(!X.cachedSetters)return rt(e);let t=ps.get(e);return t||ps.set(e,t=rt(e)),t},hs=(e,t,n,s)=>{let r=Gs(t,n,{$event:s});typeof r=="function"&&r.call(e,s)},En=(e,t,n,s)=>{let[r,...l]=t.slice(1).split("."),o=new Set(l);e.addEventListener(r,i=>{o.has("self")&&i.target!==e||(o.has("prevent")&&i.preventDefault(),o.has("stop")&&i.stopPropagation(),X.batchHandlers?Ne(()=>hs(e,n,s,i)):hs(e,n,s,i))},{once:o.has("once"),capture:o.has("capture")})},Oo=(e,t,n,s)=>{let[r,...l]=t.slice(1).split("."),o=new Set(l),i=a=>{o.has("prevent")&&a.preventDefault(),o.has("stop")&&a.stopPropagation(),o.has("once")&&e.off(r,i);let c=()=>{let d=Gs(n,s,{$event:a});typeof d=="function"&&d(a)};xe(X.batchHandlers?()=>Ne(c):c)};e.on(r,i)},wn=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},St=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},_o=e=>{e.forEach(t=>{if(t.first===t.last)return St(t);if(!t.first.parentNode)return;let s=document.createRange();s.setStartBefore(t.first),s.setEndAfter(t.last),s.deleteContents()})},jo=(e,t)=>{let n=[],s=null;return e.forEach(r=>{if(!t(r)){s=null;return}s&&s.last.nextSibling===r.range.first?s.last=r.range.last:n.push(s={first:r.range.first,last:r.range.last})}),n},Lo=({first:e,last:t},n)=>{let s=n.nextSibling;for(let r=e;r;){let l=r===t?null:r.nextSibling;n.parentNode.insertBefore(r,s),r=l}},gs=(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},Se=null,ft=null,Vs=new WeakSet,Do=e=>{let t={memo:Se,base:ft};return Se=new Map,ft=e,t},Io=e=>{Se=e.memo,ft=e.base},ms=(e,t)=>e.component!==void 0?ys(t,e.component):e.tag.includes("-")?ys(t,e.tag):null,ee=e=>e.component??e.tag,ys=(e,t)=>{if(!Se)return gs(e,t);let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s)){if(s===ft){if(Se.has(t))return Se.get(t);let r=gs(s,t);return Se.set(t,r),r}if(!Vs.has(s)){for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r}}return null},Ho=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()},qo=(e,t)=>{let n=Ho(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)"}.`)},Es=100,Gt=0,Zs=Symbol("jq79.slots"),Fe=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),Fo=e=>e==="default"?":slot":`:slot.${e}`,Wo=e=>typeof e!="string"||e.trim()!=="",Bo=e=>{let t={},n=[];e.children.forEach(r=>{let l=typeof r=="object"&&r.tag==="template"?Fe(r):void 0;if(typeof r=="string"||l===void 0){n.push(r);return}let o=Bt(l.slice(6));if(o in t){console.warn(`jq79: two <template ${Fo(o)}> in <${ee(e)}>; the second was ignored`);return}t[o]={nodes:r.children,binder:r.attrs[l]||void 0}});let s=n.some(Wo);return s&&"default"in t?console.warn(`jq79: <${ee(e)}> 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},Uo=(e,t,n)=>{je(t)?.forEach(({name:s,as:r,default:l})=>{let o=r??s;Object.defineProperty(e,o,{enumerable:!0,configurable:!0,get:()=>{let i=n[s]?.();return i===void 0&&l!==void 0?j(l,e):i},set:()=>console.warn(`jq79: "${o}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},Ko=e=>{let t=Fe(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}`)},zo=(e,t)=>{let n=Object.entries(Bo(e));if(!n.length)return null;let s={};return n.forEach(([r,l])=>{s[r]=Go(l,t)}),s},Go=(e,t)=>(n,s,r,l)=>{let o=Object.create(t);Uo(o,e.binder,n);let i=o[Ge]??[];Object.defineProperty(o,Ge,{value:[...i,s]});let a=Ee(o);return a.ownedBy(s),r.onDispose(()=>a.dispose()),Te(e.nodes,o,a,l)},Vo=(e,t,n,s)=>{let r=Bt(e.tag.slice(5)),l=document.createDocumentFragment(),o=document.createComment(e.tag),i=document.createComment(`/${e.tag}`);l.append(o,i);let a=t[Zs]?.[r];if(!a)return l.insertBefore(Te(e.children,t,n,s),i),l;let c={};return Object.entries(e.attrs).forEach(([d,p])=>{if(!(d===Ae||we(d)||d.startsWith("@")))if(d.startsWith(":")){let $=p||d.slice(1);c[ce(d.slice(1))]=()=>j($,t)}else c[ce(d)]=()=>p}),l.insertBefore(a(c,t,n,s),i),l},Qs="data-c79-box",Zo=(e,t,n)=>{if(t.ns!==void 0)return document.createDocumentFragment();let s=document.createElement(De(e));s.setAttribute(Qs,"");let r=t.attrs[Ae];return r!==void 0&&s.setAttribute(Ae,r),n||Wi(),s},ws=new WeakSet,Qo=(e,t)=>{if(e.ns===void 0||ws.has(e))return;let n=t.template.find(r=>typeof r=="object");if(n===void 0||n.ns!==void 0)return;ws.add(e);let s=e.ns==="http://www.w3.org/1998/Math/MathML"?"<math>":"<svg>";console.warn(`jq79: <${ee(e)}> is used inside ${s} and its template starts with <${n.tag.toLowerCase()}>, which is parsed as HTML - it renders and never draws. A component's template decides its own namespace, so root it at ${s}`)},Ss=(e,t,n,s,r)=>{let l=Zo(e,t,r),o=!(l instanceof DocumentFragment),i=o?null:document.createComment(`/${e}`);o||l.append(document.createComment(e),i);let a=zo(t,n),c={},d={},p=[],$=[],C=!1,O;Object.entries(t.attrs).forEach(([E,T])=>{if(E!==Ae){if(E===":props"||E.startsWith(":props.")){C=!0,$.push({expr:T});return}if(we(E)){Yi.has(E)&&(O??(O=[])).push(E.slice(1));return}if(E.startsWith("@"))p.push([E,T]);else if(E===":model"||E.startsWith(":model.")){let N=E===":model"?"default":ce(E.slice(7));d[N]=T||(E===":model"?"model":N)}else if(E.startsWith(":")){let N=ce(E.slice(1));c[N]=T||N,$.push({name:N,expr:T||N})}else{let N=ce(E),q=JSON.stringify(T);c[N]=q,$.push({name:N,expr:q})}}});let D=E=>E==="default"?":model":`:model.${E}`,L=E=>E==="default"?"model":E,x=new Set;Object.entries(d).forEach(([E,T])=>{let N=L(E);c[N]!==void 0&&console.warn(`jq79: <${ee(t)}> binds prop "${N}" through both :${N} and ${D(E)} - ${D(E)} wins`),c[N]=T,No(Ut(T),["$value"])===null&&(x.add(E),console.warn(`jq79: ${D(E)}="${T}" is not assignable - updates from <${ee(t)}> will be dropped`))});let I=()=>{let E={};return $.forEach(({name:T,expr:N})=>{if(T!==void 0)E[T]=j(N,n);else{let q=j(N,n);q!==null&&typeof q=="object"&&Object.assign(E,q)}}),Object.entries(d).forEach(([T,N])=>{E[L(T)]=j(N,n)}),E},H=null,K=null,G=null,z=new Set,J=E=>{if(E==null){if(!n[gr]?.has(e)||z.has("unfilled"))return;z.add("unfilled"),console.error(`jq79: <${ee(t)}> 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}z.has("type")||(z.add("type"),console.error(`jq79: <${ee(t)}> is ${typeof E}, not a component - nothing renders here`))};return s.effect(()=>{let E=j(e,n),T=E instanceof pe?E:null;if(T||J(E),T===K||(G?.dispose(),G=null,H?.destroy(),H=null,K=T,!T))return;Qo(t,T);let N=new pe({template:T.template,scripts:T.scripts,styles:T.styles,modules:T.modules,filename:T.filename,siblings:T.siblings,name:T.name});if(a&&(N.slots=a),Object.keys(d).length){let P=new Set;N.modelWriteback=(_,B)=>{let V=_==null?"default":ce(String(_)),ne=d[V];return ne===void 0?(P.has(V)||(P.add(V),console.warn(`jq79: <${ee(t)}> has no ${D(V)} - bound: ${Object.keys(d).map(D).join(", ")}`)),!1):x.has(V)?!1:(xe(()=>j(Ut(ne),n,{$value:B})),!0)}}p.forEach(([P,_])=>Oo(N,P,_,n));let q=Qi(N.scripts);Xi(t,e,Object.keys(c),q),O&&Ji(t,e,O,q);let W=As(xe(I),q),U=document.createDocumentFragment();if(Gt>=Es){console.error(`jq79: <${ee(t)}> is ${Es} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}Gt++;try{(r?N.renderShadow(W):N.render(W)).mount(U)}finally{Gt--}let w=n[yt];w&&N.holdOwner(w.owner),i?i.parentNode.insertBefore(U,i):l.appendChild(U);let M=Ee(n,!0);if(C){let P=[];M.effect(()=>{let _=As(I(),q),B=Object.keys(_);P.forEach(V=>{V in _||(N.data[V]=void 0)}),B.forEach(V=>{N.data[V]=_[V]}),P=B})}else Object.entries(c).forEach(([P,_])=>{q!==null&&!q.has(P)||M.effect(()=>{N.data[P]=j(_,n)})});G=M,H=N}),s.onDispose(()=>{G?.dispose(),H?.destroy()}),l},Xo=(e,t)=>{let n=()=>{let s=j(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let l=n();return l!==null&&Reflect.has(l,r)||Reflect.has(s,r)},get(s,r){let l=n();return l!==null&&Reflect.has(l,r)?l[r]:Reflect.get(s,r)},set(s,r,l){let o=n();return o!==null&&Reflect.has(o,r)?(o[r]=l,!0):Reflect.set(s,r,l)}})},pt=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(pt):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?pt(t):[]):[],We=(e,t)=>{if(typeof e=="string"){if(e&&!/\s/.test(e))t.push(e);else if(e)for(let n of e.split(/\s+/))n&&t.push(n)}else if(Array.isArray(e))for(let n of e)We(n,t);else if(e!==null&&typeof e=="object")for(let n in e)e[n]&&We(n,t)},Xs=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},Ys=(e,t,n,s,r,l)=>{let o=[];l.effect(()=>{let i=[];if(t!==void 0&&We(j(t,r),i),n)for(let[a,c]of n)j(c,r)&&We(a,i);if(!X.cachedSetters)o.forEach(a=>{!i.includes(a)&&!s.has(a)&&e.classList.remove(a)}),e.classList.add(...i);else if(!Xs(o,i)){for(let a of o)!i.includes(a)&&!s.has(a)&&e.classList.remove(a);for(let a of i)o.includes(a)||e.classList.add(a)}o=i})},Yo=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?Pn(e):()=>!1,Jo=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"]),Sn=e=>e.ns===void 0?document.createElement(e.tag):document.createElementNS(e.ns,e.tag),ei={"http://www.w3.org/2000/svg":["svg","feGaussianBlur"],"http://www.w3.org/1998/Math/MathML":["math","mi"]},bs=new Map,ti=(e,t)=>{let n=`${e} ${t}`,s=bs.get(n);if(s!==void 0)return s;let r=ei[e],l=t;if(r!==void 0&&typeof DOMParser<"u"&&/^[a-z][a-z0-9]*$/.test(t)){let[o,i]=r;l=new DOMParser().parseFromString(`<${o}><${i} ${t}="x"/></${o}>`,"text/html").querySelector(i)?.getAttributeNames().find(c=>c.toLowerCase()===t)??t}return bs.set(n,l),l},Js=(e,t)=>{let n=e.namespaceURI;if(n===null||n===qs)return t;let s=t.replace(/-/g,"").toLowerCase(),r=ti(n,s);return r===s?t:r},bn=(e,t,n)=>{let s=Jo.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},X={cloneSkeletons:!0,scopedNames:!0,batchHandlers:!0,cachedSetters:!0,compileSkeletons:!0},ni=new Set([":text",":html",":value",":checked",":selected"]),si=e=>e.startsWith("@")||e===":class"||e.startsWith(":class.")||ni.has(e)?!0:e.startsWith(":")?e===":model"?!1:!we(e)&&!e.includes("."):e!==Le,er=e=>{if(e.component||e.tag.includes("-")||ot(e.tag)||e.tag==="template"||e.ns===void 0&&document.createElement(e.tag)instanceof HTMLUnknownElement)return!1;for(let t in e.attrs)if(!si(t))return!1;return e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?!0:e.children.every(t=>typeof t=="string"||er(t))},tr=(e,t,n)=>{let s=Sn(e),r,l=null;for(let p in e.attrs){let $=e.attrs[p];if(p.startsWith("@"))n.push({kind:"event",path:t,attr:p,expr:$});else if(p===":class")r=$;else if(p.startsWith(":class."))(l??(l=[])).push([p.slice(7),$]);else if(!we(p))if(p.startsWith(":")){let C=p.slice(1);n.push({kind:"attr",path:t,name:Js(s,C),expr:$||ce(C)})}else s.setAttribute(p,$)}(r!==void 0||l)&&n.push({kind:"class",path:t,classExpr:r,toggles:l,staticClasses:new Set(pt(e.attrs.class??""))});let o=e.attrs[":text"],i=e.attrs[":html"];o!==void 0?n.push({kind:"textContent",path:t,expr:o}):i!==void 0?n.push({kind:"html",path:t,expr:i}):e.children.forEach((p,$)=>{if(typeof p=="string"){p.includes("{{")?(n.push({kind:"text",path:[...t,$],parts:rt(p)}),s.appendChild(document.createTextNode(""))):s.appendChild(document.createTextNode(p));return}s.appendChild(tr(p,[...t,$],n))});let a=e.attrs[":value"];a!==void 0&&n.push({kind:"value",path:t,expr:a});let c=e.attrs[":checked"];c!==void 0&&n.push({kind:"checked",path:t,expr:c});let d=e.attrs[":selected"];return d!==void 0&&n.push({kind:"selected",path:t,expr:d}),s},ri=3,nr=e=>e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?1:1+e.children.reduce((t,n)=>t+(typeof n=="string"?0:nr(n)),0),$s=new WeakMap,Ts=new WeakSet,oi=e=>{let t=$s.get(e);if(t!==void 0)return t;if(!Ts.has(e))return Ts.add(e),null;let n=null;if(er(e)&&nr(e)>=ri){let s=[];n={skeleton:tr(e,[],s),ops:s}}return $s.set(e,n),n},ii=(e,t)=>{let n=e;for(let s=0;s<t.length;s++){n=n.firstChild;for(let r=t[s];r>0;r--)n=n.nextSibling}return n},li=["r","s","fx","o","K","h"],ai={ev:Mo,evalExpr:j,bindText:yn,bindEvent:En,renderText:nn,bindClassNames:(e,t,n,s)=>{for(let r of t)!n.includes(r)&&!s.has(r)&&e.classList.remove(r);for(let r of n)t.includes(r)||e.classList.add(r)},collectClassNames:(e,t)=>We(e,t),sameNames:(e,t)=>Xs(e,t),applyAttr:(e,t,n)=>bn(e,t,n),sanitizeHTML:e=>Be(e)},Rs=new Map,ci=e=>{let t=[],n=new Map([["","r"]]),s=0,r=o=>{let i=o.join("."),a=n.get(i);if(a)return a;let c=o.slice(0,-1),d=o[o.length-1],p=`${r(c)}.firstChild`,$=d;for(let O=d-1;O>=0;O--){let D=n.get([...c,O].join("."));if(D){p=D,$=d-O;break}}for(let O=0;O<$;O++)p+=".nextSibling";let C=`n${s++}`;return t.push(`const ${C} = ${p}`),n.set(i,C),C},l=(o,i)=>t.push(`{ ${o}; fx.effect(() => { ${i} }) }`);return e.forEach((o,i)=>{let a=r(o.path),c=`o[${i}]`;if(o.kind==="text"){let[d]=o.parts;o.parts.length===1&&typeof d!="string"?l(`const t${i} = ${a}, e${i} = ${c}.parts[0].expr, k${i} = K[${i}]; let last${i} = t${i}.data`,`{ const v = h.ev(k${i}, e${i}, s); const x = v == null ? "" : String(v); if (x !== last${i}) t${i}.data = last${i} = x }`):l(`const t${i} = ${a}, p${i} = ${c}.parts; let last${i} = t${i}.data`,`{ const x = h.renderText(p${i}, s); if (x !== last${i}) t${i}.data = last${i} = x }`)}else if(o.kind==="event")t.push(`h.bindEvent(${a}, ${c}.attr, ${c}.expr, s)`);else if(o.kind==="attr")l(`const el${i} = ${a}, c${i} = ${c}`,`h.applyAttr(el${i}, c${i}.name, h.ev(K[${i}], c${i}.expr, s))`);else if(o.kind==="class")l(`const el${i} = ${a}, c${i} = ${c}, k${i} = K[${i}]; let b${i} = []`,`{ const next = []; if (c${i}.classExpr !== undefined) h.collectClassNames(h.ev(k${i}, c${i}.classExpr, s), next); if (c${i}.toggles) for (const [n, e] of c${i}.toggles) if (h.evalExpr(e, s)) h.collectClassNames(n, next); if (!h.sameNames(b${i}, next)) h.bindClassNames(el${i}, b${i}, next, c${i}.staticClasses); b${i} = next }`);else if(o.kind==="textContent")l(`const el${i} = ${a}, c${i} = ${c}`,`{ const x = String(h.ev(K[${i}], c${i}.expr, s) ?? ""); if (el${i}.textContent !== x) el${i}.textContent = x }`);else if(o.kind==="html")l(`const el${i} = ${a}, c${i} = ${c}`,`el${i}.innerHTML = h.sanitizeHTML(String(h.ev(K[${i}], c${i}.expr, s) ?? ""))`);else if(o.kind==="value")l(`const el${i} = ${a}, c${i} = ${c}`,`{ const x = String(h.ev(K[${i}], c${i}.expr, s) ?? ""); if (el${i}.value !== x) el${i}.value = x }`);else if(o.kind==="checked")l(`const el${i} = ${a}, c${i} = ${c}`,`{ const x = !!h.ev(K[${i}], c${i}.expr, s); if (el${i}.checked !== x) el${i}.checked = x }`);else if(o.kind==="selected")l(`const el${i} = ${a}, c${i} = ${c}`,`{ const x = !!h.ev(K[${i}], c${i}.expr, s); if (el${i}.selected !== x) el${i}.selected = x }`);else{let d=o}}),`"use strict"
17
+ }`;var So="0.8.2",Hs=e=>Object.fromEntries(Array.from(e.attributes).map(t=>[t.name,t.value])),qs="http://www.w3.org/1999/xhtml",Fs=e=>{let t=Hs(e),n=e.namespaceURI,s=t[Le];delete t[Le];let r=n!==null&&n!==qs;return{tag:r?e.tagName:e.tagName.toLowerCase(),attrs:t,...s===void 0?{}:{component:s},...r?{ns:n}:{},children:Array.from((e instanceof HTMLTemplateElement?e.content:e).childNodes).flatMap(l=>{if(l.nodeType===Node.TEXT_NODE){let o=l.textContent??"";return o?[o]:[]}return l.nodeType===Node.ELEMENT_NODE?[Fs(l)]:[]})}},dt=new Map,ct=new Map,fn=!1,Jt,Me=class extends Error{constructor(n,s){super(`${n}. ${s}`);A(this,"reason",n);A(this,"hint",s)}},bo=()=>new Me("was not precompiled","Safe mode never builds code at runtime: the component's precompiled functions did not reach the page."),$o=(e,t)=>{let n=globalThis[as];if(Array.isArray(n)&&n.length>0)for(let[s,r,l]of n.splice(0))ct.set(it(s,r),l);return ct.size===0?void 0:ct.get(it(e,t))},wt=(e,t,n="")=>{let s=$o(e,t);if(s===null)throw new SyntaxError("jq79: this code did not compile when it was precompiled");if(s!==void 0)return s;if(Jt!==void 0)return To(e,t,n,Jt);if(fn)throw bo();return new Function(...e,t+n)},pn=()=>{if(!(typeof document>"u"))for(let e of Array.from(document.querySelectorAll("script[nonce]"))){let t=e.nonce||e.getAttribute("nonce");if(t)return t}},us="__jq79built",To=(e,t,n,s)=>{let r=document.createElement("script");r.setAttribute("nonce",s),r.textContent=`document.currentScript.${us} = ${ds(e,t)}${n}`;let l,o=a=>{l=a.error??new SyntaxError(a.message),a.preventDefault()};window.addEventListener("error",o);try{(document.head??document.documentElement).append(r)}finally{window.removeEventListener("error",o),r.remove()}let i=r[us];if(typeof i=="function")return ct.set(it(e,t),i),i;throw l!==void 0?l:new Me("could not be built","The page's CSP refused a <script> carrying the nonce jq79 read from the page.")},fs=new Set,Ro=(e,t)=>{fs.has(e)||(fs.add(e),console.error(`jq79: safeEval() is on, and "${e}" ${t.reason}, so it rendered as nothing. ${t.hint}`))},Ce=(e,t)=>{if(!(t in e)){if(t in globalThis)return globalThis[t];throw new ReferenceError(`${t} is not defined`)}},Ws=(e,t)=>{try{return wt([...Kt,...t],es(e))}catch(n){return n instanceof Me&&Ro(e,n),null}},xo=(e,t)=>{if(!X.scopedNames)return null;let n=ts(e,t);if(n===null)return null;try{return wt([...Kt,...t],n)}catch{return null}},hn=(e,t,n)=>{let s=dt.get(e);if(s===void 0){let r=xo(t,n);s=r?{fn:r,scoped:!0}:{fn:Ws(t,n),scoped:!1},dt.set(e,s)}return s},Ie=(e,t)=>`${t.join(",")}|${e}`,No=(e,t)=>hn(Ie(e,t),e,t).fn,Bs=(e,t,n)=>{let s=Ws(t,n);return dt.set(e,{fn:s,scoped:!1}),s},vo=/^(?:([\w$]+) is not defined|Can't find variable: ([\w$]+))/,Po=100,be=new Map,gn=new Set,ut=0,en=!1,tn=new Set,ko=()=>{en=!1,!(ut>0)&&(be.forEach(({name:e,expr:t,scope:n},s)=>{e in n||(gn.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 = () => {}".`))}),be.clear())},Us=()=>{en||ut>0||!be.size||(en=!0,queueMicrotask(ko))},Ks=e=>{ut++;let t=()=>{ut--,Us()};e.then(t,t)},Co=(e,t)=>{if(tn.has(e))return;tn.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.`)},mn=(e,t,n)=>{if(!(n instanceof ReferenceError))return Co(e,n);let s=vo.exec(n.message),r=s?.[1]??s?.[2];if(!r)return;let l=`${r}|${e}`;gn.has(l)||be.has(l)||be.size>=Po||(be.set(l,{name:r,expr:e,scope:t}),Us())},zs=(e,t,n)=>{let s=n?Object.keys(n):[],r=Ie(e,s),{fn:l,scoped:o}=hn(r,e,s);if(!l)return;let i=n?Object.values(n):[];if(!o)return l(t,Ce,...i);try{return l(t,Ce,...i)}catch(a){if(!(a instanceof ReferenceError))throw a;let c=Bs(r,e,s);if(!c)throw a;return c(t,Ce,...i)}},He=[],Mo=(e,t,n)=>{try{let{fn:s,scoped:r}=hn(e,t,He);if(!s)return;if(!r)return s(n,Ce);try{return s(n,Ce)}catch(l){if(!(l instanceof ReferenceError))throw l;let o=Bs(e,t,He);if(!o)throw l;return o(n,Ce)}}catch(s){mn(t,n,s);return}},j=(e,t,n)=>{try{return zs(e,t,n)}catch(s){mn(e,t,s);return}},Gs=(e,t,n)=>{try{return zs(e,t,n)}catch(s){if(!(s instanceof ReferenceError))throw s;mn(e,t,s);return}},nn=(e,t)=>{if(e.length===1){let s=e[0];return typeof s=="string"?s:String(j(s.expr,t)??"")}let n="";for(let s of e)n+=typeof s=="string"?s:String(j(s.expr,t)??"");return n},yn=(e,t,n,s)=>{if(!X.cachedSetters){s.effect(()=>{let l=nn(t,n);e.textContent!==l&&(e.textContent=l)});return}let r=e.data;s.effect(()=>{let l=nn(t,n);l!==r&&(e.data=r=l)})},ps=new Map,Ao=e=>{if(!X.cachedSetters)return rt(e);let t=ps.get(e);return t||ps.set(e,t=rt(e)),t},hs=(e,t,n,s)=>{let r=Gs(t,n,{$event:s});typeof r=="function"&&r.call(e,s)},En=(e,t,n,s)=>{let[r,...l]=t.slice(1).split("."),o=new Set(l);e.addEventListener(r,i=>{o.has("self")&&i.target!==e||(o.has("prevent")&&i.preventDefault(),o.has("stop")&&i.stopPropagation(),X.batchHandlers?Ne(()=>hs(e,n,s,i)):hs(e,n,s,i))},{once:o.has("once"),capture:o.has("capture")})},Oo=(e,t,n,s)=>{let[r,...l]=t.slice(1).split("."),o=new Set(l),i=a=>{o.has("prevent")&&a.preventDefault(),o.has("stop")&&a.stopPropagation(),o.has("once")&&e.off(r,i);let c=()=>{let d=Gs(n,s,{$event:a});typeof d=="function"&&d(a)};xe(X.batchHandlers?()=>Ne(c):c)};e.on(r,i)},wn=e=>e instanceof DocumentFragment?{first:e.firstChild,last:e.lastChild}:{first:e,last:e},St=({first:e,last:t})=>{for(let n=e;n;){let s=n===t?null:n.nextSibling;n.parentNode?.removeChild(n),n=s}},_o=e=>{e.forEach(t=>{if(t.first===t.last)return St(t);if(!t.first.parentNode)return;let s=document.createRange();s.setStartBefore(t.first),s.setEndAfter(t.last),s.deleteContents()})},jo=(e,t)=>{let n=[],s=null;return e.forEach(r=>{if(!t(r)){s=null;return}s&&s.last.nextSibling===r.range.first?s.last=r.range.last:n.push(s={first:r.range.first,last:r.range.last})}),n},Lo=({first:e,last:t},n)=>{let s=n.nextSibling;for(let r=e;r;){let l=r===t?null:r.nextSibling;n.parentNode.insertBefore(r,s),r=l}},gs=(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},Se=null,ft=null,Vs=new WeakSet,Do=e=>{let t={memo:Se,base:ft};return Se=new Map,ft=e,t},Io=e=>{Se=e.memo,ft=e.base},ms=(e,t)=>e.component!==void 0?ys(t,e.component):e.tag.includes("-")?ys(t,e.tag):null,ee=e=>e.component??e.tag,ys=(e,t)=>{if(!Se)return gs(e,t);let n=t.replace(/-/g,"").toLowerCase();for(let s=e;s&&s!==Object.prototype;s=Object.getPrototypeOf(s)){if(s===ft){if(Se.has(t))return Se.get(t);let r=gs(s,t);return Se.set(t,r),r}if(!Vs.has(s)){for(let r of Object.keys(s))if(/^[A-Z]/.test(r)&&r.replace(/-/g,"").toLowerCase()===n)return r}}return null},Ho=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()},qo=(e,t)=>{let n=Ho(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)"}.`)},Es=100,Gt=0,Zs=Symbol("jq79.slots"),Fe=e=>Object.keys(e.attrs).find(t=>t===":slot"||t.startsWith(":slot.")),Fo=e=>e==="default"?":slot":`:slot.${e}`,Wo=e=>typeof e!="string"||e.trim()!=="",Bo=e=>{let t={},n=[];e.children.forEach(r=>{let l=typeof r=="object"&&r.tag==="template"?Fe(r):void 0;if(typeof r=="string"||l===void 0){n.push(r);return}let o=Bt(l.slice(6));if(o in t){console.warn(`jq79: two <template ${Fo(o)}> in <${ee(e)}>; the second was ignored`);return}t[o]={nodes:r.children,binder:r.attrs[l]||void 0}});let s=n.some(Wo);return s&&"default"in t?console.warn(`jq79: <${ee(e)}> 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},Uo=(e,t,n)=>{je(t)?.forEach(({name:s,as:r,default:l})=>{let o=r??s;Object.defineProperty(e,o,{enumerable:!0,configurable:!0,get:()=>{let i=n[s]?.();return i===void 0&&l!==void 0?j(l,e):i},set:()=>console.warn(`jq79: "${o}" is a slot prop - it comes from the component, so assigning to it does nothing`)})})},Ko=e=>{let t=Fe(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}`)},zo=(e,t)=>{let n=Object.entries(Bo(e));if(!n.length)return null;let s={};return n.forEach(([r,l])=>{s[r]=Go(l,t)}),s},Go=(e,t)=>(n,s,r,l)=>{let o=Object.create(t);Uo(o,e.binder,n);let i=o[Ge]??[];Object.defineProperty(o,Ge,{value:[...i,s]});let a=Ee(o);return a.ownedBy(s),r.onDispose(()=>a.dispose()),Te(e.nodes,o,a,l)},Vo=(e,t,n,s)=>{let r=Bt(e.tag.slice(5)),l=document.createDocumentFragment(),o=document.createComment(e.tag),i=document.createComment(`/${e.tag}`);l.append(o,i);let a=t[Zs]?.[r];if(!a)return l.insertBefore(Te(e.children,t,n,s),i),l;let c={};return Object.entries(e.attrs).forEach(([d,p])=>{if(!(d===Ae||we(d)||d.startsWith("@")))if(d.startsWith(":")){let $=p||d.slice(1);c[ce(d.slice(1))]=()=>j($,t)}else c[ce(d)]=()=>p}),l.insertBefore(a(c,t,n,s),i),l},Qs="data-c79-box",Zo=(e,t,n)=>{if(t.ns!==void 0)return document.createDocumentFragment();let s=document.createElement(De(e));s.setAttribute(Qs,"");let r=t.attrs[Ae];return r!==void 0&&s.setAttribute(Ae,r),n||Wi(),s},ws=new WeakSet,Qo=(e,t)=>{if(e.ns===void 0||ws.has(e))return;let n=t.template.find(r=>typeof r=="object");if(n===void 0||n.ns!==void 0)return;ws.add(e);let s=e.ns==="http://www.w3.org/1998/Math/MathML"?"<math>":"<svg>";console.warn(`jq79: <${ee(e)}> is used inside ${s} and its template starts with <${n.tag.toLowerCase()}>, which is parsed as HTML - it renders and never draws. A component's template decides its own namespace, so root it at ${s}`)},Ss=(e,t,n,s,r)=>{let l=Zo(e,t,r),o=!(l instanceof DocumentFragment),i=o?null:document.createComment(`/${e}`);o||l.append(document.createComment(e),i);let a=zo(t,n),c={},d={},p=[],$=[],C=!1,O;Object.entries(t.attrs).forEach(([E,T])=>{if(E!==Ae){if(E===":props"||E.startsWith(":props.")){C=!0,$.push({expr:T});return}if(we(E)){Yi.has(E)&&(O??(O=[])).push(E.slice(1));return}if(E.startsWith("@"))p.push([E,T]);else if(E===":model"||E.startsWith(":model.")){let N=E===":model"?"default":ce(E.slice(7));d[N]=T||(E===":model"?"model":N)}else if(E.startsWith(":")){let N=ce(E.slice(1));c[N]=T||N,$.push({name:N,expr:T||N})}else{let N=ce(E),q=JSON.stringify(T);c[N]=q,$.push({name:N,expr:q})}}});let D=E=>E==="default"?":model":`:model.${E}`,L=E=>E==="default"?"model":E,x=new Set;Object.entries(d).forEach(([E,T])=>{let N=L(E);c[N]!==void 0&&console.warn(`jq79: <${ee(t)}> binds prop "${N}" through both :${N} and ${D(E)} - ${D(E)} wins`),c[N]=T,No(Ut(T),["$value"])===null&&(x.add(E),console.warn(`jq79: ${D(E)}="${T}" is not assignable - updates from <${ee(t)}> will be dropped`))});let I=()=>{let E={};return $.forEach(({name:T,expr:N})=>{if(T!==void 0)E[T]=j(N,n);else{let q=j(N,n);q!==null&&typeof q=="object"&&Object.assign(E,q)}}),Object.entries(d).forEach(([T,N])=>{E[L(T)]=j(N,n)}),E},H=null,K=null,G=null,z=new Set,J=E=>{if(E==null){if(!n[gr]?.has(e)||z.has("unfilled"))return;z.add("unfilled"),console.error(`jq79: <${ee(t)}> 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}z.has("type")||(z.add("type"),console.error(`jq79: <${ee(t)}> is ${typeof E}, not a component - nothing renders here`))};return s.effect(()=>{let E=j(e,n),T=E instanceof pe?E:null;if(T||J(E),T===K||(G?.dispose(),G=null,H?.destroy(),H=null,K=T,!T))return;Qo(t,T);let N=new pe({template:T.template,scripts:T.scripts,styles:T.styles,modules:T.modules,filename:T.filename,siblings:T.siblings,name:T.name});if(a&&(N.slots=a),Object.keys(d).length){let P=new Set;N.modelWriteback=(_,B)=>{let V=_==null?"default":ce(String(_)),ne=d[V];return ne===void 0?(P.has(V)||(P.add(V),console.warn(`jq79: <${ee(t)}> has no ${D(V)} - bound: ${Object.keys(d).map(D).join(", ")}`)),!1):x.has(V)?!1:(xe(()=>j(Ut(ne),n,{$value:B})),!0)}}p.forEach(([P,_])=>Oo(N,P,_,n));let q=Qi(N.scripts);Xi(t,e,Object.keys(c),q),O&&Ji(t,e,O,q);let W=As(xe(I),q),U=document.createDocumentFragment();if(Gt>=Es){console.error(`jq79: <${ee(t)}> is ${Es} levels deep inside itself; giving up here. A component that renders itself stops when its data stops - is there a cycle in it?`);return}Gt++;try{(r?N.renderShadow(W):N.render(W)).mount(U)}finally{Gt--}let w=n[yt];w&&N.holdOwner(w.owner),i?i.parentNode.insertBefore(U,i):l.appendChild(U);let M=Ee(n,!0);if(C){let P=[];M.effect(()=>{let _=As(I(),q),B=Object.keys(_);P.forEach(V=>{V in _||(N.data[V]=void 0)}),B.forEach(V=>{N.data[V]=_[V]}),P=B})}else Object.entries(c).forEach(([P,_])=>{q!==null&&!q.has(P)||M.effect(()=>{N.data[P]=j(_,n)})});G=M,H=N}),s.onDispose(()=>{G?.dispose(),H?.destroy()}),l},Xo=(e,t)=>{let n=()=>{let s=j(e,t);return s!==null&&typeof s=="object"?s:null};return new Proxy(t,{has(s,r){let l=n();return l!==null&&Reflect.has(l,r)||Reflect.has(s,r)},get(s,r){let l=n();return l!==null&&Reflect.has(l,r)?l[r]:Reflect.get(s,r)},set(s,r,l){let o=n();return o!==null&&Reflect.has(o,r)?(o[r]=l,!0):Reflect.set(s,r,l)}})},pt=e=>typeof e=="string"?e.split(/\s+/).filter(Boolean):Array.isArray(e)?e.flatMap(pt):e!==null&&typeof e=="object"?Object.entries(e).flatMap(([t,n])=>n?pt(t):[]):[],We=(e,t)=>{if(typeof e=="string"){if(e&&!/\s/.test(e))t.push(e);else if(e)for(let n of e.split(/\s+/))n&&t.push(n)}else if(Array.isArray(e))for(let n of e)We(n,t);else if(e!==null&&typeof e=="object")for(let n in e)e[n]&&We(n,t)},Xs=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},Ys=(e,t,n,s,r,l)=>{let o=[];l.effect(()=>{let i=[];if(t!==void 0&&We(j(t,r),i),n)for(let[a,c]of n)j(c,r)&&We(a,i);if(!X.cachedSetters)o.forEach(a=>{!i.includes(a)&&!s.has(a)&&e.classList.remove(a)}),e.classList.add(...i);else if(!Xs(o,i)){for(let a of o)!i.includes(a)&&!s.has(a)&&e.classList.remove(a);for(let a of i)o.includes(a)||e.classList.add(a)}o=i})},Yo=e=>typeof e=="function"?(t,n,s)=>{try{return!!e(t,n,s)}catch{return!1}}:typeof e=="string"||Array.isArray(e)?Pn(e):()=>!1,Jo=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"]),Sn=e=>e.ns===void 0?document.createElement(e.tag):document.createElementNS(e.ns,e.tag),ei={"http://www.w3.org/2000/svg":["svg","feGaussianBlur"],"http://www.w3.org/1998/Math/MathML":["math","mi"]},bs=new Map,ti=(e,t)=>{let n=`${e} ${t}`,s=bs.get(n);if(s!==void 0)return s;let r=ei[e],l=t;if(r!==void 0&&typeof DOMParser<"u"&&/^[a-z][a-z0-9]*$/.test(t)){let[o,i]=r;l=new DOMParser().parseFromString(`<${o}><${i} ${t}="x"/></${o}>`,"text/html").querySelector(i)?.getAttributeNames().find(c=>c.toLowerCase()===t)??t}return bs.set(n,l),l},Js=(e,t)=>{let n=e.namespaceURI;if(n===null||n===qs)return t;let s=t.replace(/-/g,"").toLowerCase(),r=ti(n,s);return r===s?t:r},bn=(e,t,n)=>{let s=Jo.has(t);(s?!n:n==null)?e.removeAttribute(t):e.setAttribute(t,s?"":String(n))},X={cloneSkeletons:!0,scopedNames:!0,batchHandlers:!0,cachedSetters:!0,compileSkeletons:!0},ni=new Set([":text",":html",":value",":checked",":selected"]),si=e=>e.startsWith("@")||e===":class"||e.startsWith(":class.")||ni.has(e)?!0:e.startsWith(":")?e===":model"?!1:!we(e)&&!e.includes("."):e!==Le,er=e=>{if(e.component||e.tag.includes("-")||ot(e.tag)||e.tag==="template"||e.ns===void 0&&document.createElement(e.tag)instanceof HTMLUnknownElement)return!1;for(let t in e.attrs)if(!si(t))return!1;return e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?!0:e.children.every(t=>typeof t=="string"||er(t))},tr=(e,t,n)=>{let s=Sn(e),r,l=null;for(let p in e.attrs){let $=e.attrs[p];if(p.startsWith("@"))n.push({kind:"event",path:t,attr:p,expr:$});else if(p===":class")r=$;else if(p.startsWith(":class."))(l??(l=[])).push([p.slice(7),$]);else if(!we(p))if(p.startsWith(":")){let C=p.slice(1);n.push({kind:"attr",path:t,name:Js(s,C),expr:$||ce(C)})}else s.setAttribute(p,$)}(r!==void 0||l)&&n.push({kind:"class",path:t,classExpr:r,toggles:l,staticClasses:new Set(pt(e.attrs.class??""))});let o=e.attrs[":text"],i=e.attrs[":html"];o!==void 0?n.push({kind:"textContent",path:t,expr:o}):i!==void 0?n.push({kind:"html",path:t,expr:i}):e.children.forEach((p,$)=>{if(typeof p=="string"){p.includes("{{")?(n.push({kind:"text",path:[...t,$],parts:rt(p)}),s.appendChild(document.createTextNode(""))):s.appendChild(document.createTextNode(p));return}s.appendChild(tr(p,[...t,$],n))});let a=e.attrs[":value"];a!==void 0&&n.push({kind:"value",path:t,expr:a});let c=e.attrs[":checked"];c!==void 0&&n.push({kind:"checked",path:t,expr:c});let d=e.attrs[":selected"];return d!==void 0&&n.push({kind:"selected",path:t,expr:d}),s},ri=3,nr=e=>e.attrs[":text"]!==void 0||e.attrs[":html"]!==void 0?1:1+e.children.reduce((t,n)=>t+(typeof n=="string"?0:nr(n)),0),$s=new WeakMap,Ts=new WeakSet,oi=e=>{let t=$s.get(e);if(t!==void 0)return t;if(!Ts.has(e))return Ts.add(e),null;let n=null;if(er(e)&&nr(e)>=ri){let s=[];n={skeleton:tr(e,[],s),ops:s}}return $s.set(e,n),n},ii=(e,t)=>{let n=e;for(let s=0;s<t.length;s++){n=n.firstChild;for(let r=t[s];r>0;r--)n=n.nextSibling}return n},li=["r","s","fx","o","K","h"],ai={ev:Mo,evalExpr:j,bindText:yn,bindEvent:En,renderText:nn,bindClassNames:(e,t,n,s)=>{for(let r of t)!n.includes(r)&&!s.has(r)&&e.classList.remove(r);for(let r of n)t.includes(r)||e.classList.add(r)},collectClassNames:(e,t)=>We(e,t),sameNames:(e,t)=>Xs(e,t),applyAttr:(e,t,n)=>bn(e,t,n),sanitizeHTML:e=>Be(e)},Rs=new Map,ci=e=>{let t=[],n=new Map([["","r"]]),s=0,r=o=>{let i=o.join("."),a=n.get(i);if(a)return a;let c=o.slice(0,-1),d=o[o.length-1],p=`${r(c)}.firstChild`,$=d;for(let O=d-1;O>=0;O--){let D=n.get([...c,O].join("."));if(D){p=D,$=d-O;break}}for(let O=0;O<$;O++)p+=".nextSibling";let C=`n${s++}`;return t.push(`const ${C} = ${p}`),n.set(i,C),C},l=(o,i)=>t.push(`{ ${o}; fx.effect(() => { ${i} }) }`);return e.forEach((o,i)=>{let a=r(o.path),c=`o[${i}]`;if(o.kind==="text"){let[d]=o.parts;o.parts.length===1&&typeof d!="string"?l(`const t${i} = ${a}, e${i} = ${c}.parts[0].expr, k${i} = K[${i}]; let last${i} = t${i}.data`,`{ const v = h.ev(k${i}, e${i}, s); const x = v == null ? "" : String(v); if (x !== last${i}) t${i}.data = last${i} = x }`):l(`const t${i} = ${a}, p${i} = ${c}.parts; let last${i} = t${i}.data`,`{ const x = h.renderText(p${i}, s); if (x !== last${i}) t${i}.data = last${i} = x }`)}else if(o.kind==="event")t.push(`h.bindEvent(${a}, ${c}.attr, ${c}.expr, s)`);else if(o.kind==="attr")l(`const el${i} = ${a}, c${i} = ${c}`,`h.applyAttr(el${i}, c${i}.name, h.ev(K[${i}], c${i}.expr, s))`);else if(o.kind==="class")l(`const el${i} = ${a}, c${i} = ${c}, k${i} = K[${i}]; let b${i} = []`,`{ const next = []; if (c${i}.classExpr !== undefined) h.collectClassNames(h.ev(k${i}, c${i}.classExpr, s), next); if (c${i}.toggles) for (const [n, e] of c${i}.toggles) if (h.evalExpr(e, s)) h.collectClassNames(n, next); if (!h.sameNames(b${i}, next)) h.bindClassNames(el${i}, b${i}, next, c${i}.staticClasses); b${i} = next }`);else if(o.kind==="textContent")l(`const el${i} = ${a}, c${i} = ${c}`,`{ const x = String(h.ev(K[${i}], c${i}.expr, s) ?? ""); if (el${i}.textContent !== x) el${i}.textContent = x }`);else if(o.kind==="html")l(`const el${i} = ${a}, c${i} = ${c}`,`el${i}.innerHTML = h.sanitizeHTML(String(h.ev(K[${i}], c${i}.expr, s) ?? ""))`);else if(o.kind==="value")l(`const el${i} = ${a}, c${i} = ${c}`,`{ const x = String(h.ev(K[${i}], c${i}.expr, s) ?? ""); if (el${i}.value !== x) el${i}.value = x }`);else if(o.kind==="checked")l(`const el${i} = ${a}, c${i} = ${c}`,`{ const x = !!h.ev(K[${i}], c${i}.expr, s); if (el${i}.checked !== x) el${i}.checked = x }`);else if(o.kind==="selected")l(`const el${i} = ${a}, c${i} = ${c}`,`{ const x = !!h.ev(K[${i}], c${i}.expr, s); if (el${i}.selected !== x) el${i}.selected = x }`);else{let d=o}}),`"use strict"
18
18
  ${t.join(`
19
19
  `)}`},di=e=>e.map(t=>{if(t.kind==="text"){let[n]=t.parts;return t.parts.length===1&&typeof n!="string"?Ie(n.expr,He):""}return t.kind==="class"?t.classExpr!==void 0?Ie(t.classExpr,He):"":t.kind==="event"?"":Ie(t.expr,He)}),ui=e=>{let t=ci(e.ops),n=Rs.get(t);if(n===void 0){try{n=wt(li,t)}catch{return null}Rs.set(t,n)}return e.keys=di(e.ops),n},fi=(e,t,n)=>{let s=e.skeleton.cloneNode(!0);if(X.compileSkeletons&&X.cachedSetters&&(e.factory===void 0&&(e.factory=ui(e)),e.factory))return e.factory(s,t,n,e.ops,e.keys,ai),s;for(let r of e.ops){let l=r.path.length===0?s:ii(s,r.path);if(r.kind==="text")yn(l,r.parts,t,n);else if(r.kind==="event")En(l,r.attr,r.expr,t);else if(r.kind==="attr"){let o=l,{name:i,expr:a}=r;n.effect(()=>bn(o,i,j(a,t)))}else if(r.kind==="class")Ys(l,r.classExpr,r.toggles,r.staticClasses,t,n);else if(r.kind==="textContent"){let o=l,{expr:i}=r;n.effect(()=>{let a=String(j(i,t)??"");o.textContent!==a&&(o.textContent=a)})}else if(r.kind==="html"){let o=l,{expr:i}=r;n.effect(()=>{o.innerHTML=Be(String(j(i,t)??""))})}else if(r.kind==="value"){let o=l,{expr:i}=r;n.effect(()=>{let a=String(j(i,t)??"");o.value!==a&&(o.value=a)})}else if(r.kind==="checked"){let o=l,{expr:i}=r;n.effect(()=>{let a=!!j(i,t);o.checked!==a&&(o.checked=a)})}else if(r.kind==="selected"){let o=l,{expr:i}=r;n.effect(()=>{let a=!!j(i,t);o.selected!==a&&(o.selected=a)})}else{let o=r}}return s},$n=(e,t,n,s)=>{let r=e.attrs[":with"],l=r!==void 0?Xo(r,t):t;if(ot(e.tag))return Vo(e,l,n,s);if(e.tag==="template"&&Fe(e)!==void 0)return Ko(e);let o=ms(e,l);if(o)return Ss(o,e,l,n,s);if(X.cloneSkeletons){let x=oi(e);if(x)return fi(x,l,n)}let i=Sn(e);if(e.component!==void 0&&l[yt]?.count===0)throw qo(e.component,l);let a=e.ns===void 0&&(e.component!==void 0||e.tag.includes("-"));if(a){let x=!1;n.effect(()=>{if(x)return;let I=ms(e,l);if(!I)return;x=!0;let H=Ss(I,e,l,n,s),K=wn(H);n.onDispose(()=>St(K)),i.replaceWith(H)})}for(let x in e.attrs){let I=e.attrs[x];if(x.startsWith("@"))En(i,x,I,l);else if(x===":model"||x.startsWith(":model."))a||console.warn(`jq79: ${x} on <${ee(e)}> does nothing - :model binds component tags only (for now)`);else if(!we(x))if(x.startsWith(":"))if(a)i.setAttribute(x,I);else{let H=x.slice(1),K=I||ce(H),G=Js(i,H);n.effect(()=>bn(i,G,j(K,l)))}else i.setAttribute(x,I)}let c=e.attrs[":class"],d=null;for(let x in e.attrs)x.startsWith(":class.")&&(d??(d=[])).push([x.slice(7),e.attrs[x]]);(c!==void 0||d)&&Ys(i,c,d,new Set(pt(e.attrs.class??"")),l,n);let p=e.attrs[":text"],$=e.attrs[":html"],C=e.attrs[":html.allowed"];C!==void 0&&$===void 0&&console.warn("jq79: :html.allowed without :html on the same element does nothing"),p!==void 0?n.effect(()=>{let x=String(j(p,l)??"");i.textContent!==x&&(i.textContent=x)}):$!==void 0?n.effect(()=>{let x=C!==void 0?{allowUrl:Yo(j(C,l))}:void 0;i.innerHTML=Be(String(j($,l)??""),x)}):i instanceof HTMLTemplateElement?Te(e.children,l,n,s,i.content):Te(e.children,l,n,s,i);let O=e.attrs[":value"];O!==void 0&&n.effect(()=>{let x=String(j(O,l)??"");i.value!==x&&(i.value=x)});let D=e.attrs[":checked"];D!==void 0&&n.effect(()=>{let x=!!j(D,l);i.checked!==x&&(i.checked=x)});let L=e.attrs[":selected"];return L!==void 0&&n.effect(()=>{let x=!!j(L,l);i.selected!==x&&(i.selected=x)}),i},pi=(e,t,n,s)=>{let r=document.createComment("if"),l=document.createDocumentFragment();l.appendChild(r);let o=null,i=null,a=null;return n.effect(()=>{let c=e.find(p=>p.expr===void 0||j(p.expr,t))??null;if(c===i||(a?.dispose(),o&&St(o),o=null,i=c,!c))return;a=Ee(t);let d=$n(c.node,t,a,s);o=wn(d),r.parentNode.insertBefore(d,r.nextSibling)}),n.onDispose(()=>a?.dispose()),l},Pe=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})},hi=e=>{let t=new Uint8Array(e.length),n=[],s=new Int32Array(e.length).fill(-1);for(let r=0;r<e.length;r++){let l=e[r];if(l<0)continue;let o=0,i=n.length;for(;o<i;){let a=o+i>>1;e[n[a]]<l?o=a+1:i=a}o>0&&(s[r]=n[o-1]),n[o]=r}for(let r=n.length?n[n.length-1]:-1;r!==-1;r=s[r])t[r]=1;return t},gi=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},sr=(e,t)=>typeof e=="string"?t.some(n=>Ns(e,n)):Object.values(e.attrs).some(n=>t.some(s=>Ns(n,s)))||e.children.some(n=>sr(n,t)),rr=e=>typeof e!="string"&&(":if"in e.attrs||":elseif"in e.attrs||":else"in e.attrs||":each"in e.attrs||e.component!==void 0||e.tag.includes("-")||ot(e.tag)||e.children.some(rr)),xs=/[A-Za-z0-9_$]/,mi=/^[A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*$/,Ns=(e,t)=>{for(let n=e.indexOf(t);n!==-1;n=e.indexOf(t,n+1)){let s=n===0?"":e[n-1],r=e[n+t.length]??"";if(!xs.test(s)&&!xs.test(r))return!0}return!1},Vt=new WeakMap,yi=e=>{let t=Vt.get(e);if(t!==void 0)return t;let n=e.attrs[":each"].match(Jn);if(!n)return Vt.set(e,null),null;let[,s,r,l]=n,o=e.attrs[":key"],i=o===s,a=o!==void 0&&!i&&mi.test(o)&&o.startsWith(`${s}.`)?o.slice(s.length+1):void 0,{[":each"]:c,[":key"]:d,[":window"]:p,...$}=e.attrs,C={...e,attrs:$},O=["$index",...r?[r]:[]],D=sr(C,O),L=/^[A-Z]/.test(s)||r!==void 0&&/^[A-Z]/.test(r),x=o!==void 0&&rr(C),I={itemName:s,atName:r,listExpr:l,keyExpr:o,keyIsItem:i,keyProp:a,itemNode:C,readsPosition:D,namesComponent:L,nestsScopes:x,windowExpr:p};return Vt.set(e,I),I},lt=8,Ei=/^(auto|scroll|overlay)$/,wi=e=>{for(let t=e;t;t=t instanceof ShadowRoot?t.host:t.parentNode)if(!(!(t instanceof HTMLElement)||t===document.body||t===document.documentElement)&&Ei.test(getComputedStyle(t).overflowY))return t;return null},Si=(e,t,n,s,r)=>{let l=()=>{let E=e.component!==void 0||e.tag.includes("-")?document.createElement("div"):Sn(e);return E.setAttribute("aria-hidden","true"),E.setAttribute("style","height: 0px; margin: 0; padding: 0; border: 0; list-style: none; visibility: hidden"),E},o=l(),i=l(),a=ve({start:0,count:-1}),c=0,d=0,p=null,$=!1,C=0,O=null,D=null,L=E=>Math.ceil(E/c)+1+2*lt,x=(E,T)=>{E=Math.max(0,Math.min(E,Math.max(0,d-T))),(a.start!==E||a.count!==T)&&Ne(()=>{a.start=E,a.count=T})},I=()=>{let E=o.getBoundingClientRect().top;if(p){let T=p.getBoundingClientRect(),N=p.scrollTop;return{listTop:E-T.top-p.clientTop+N,scrollTop:N,height:p.clientHeight||window.innerHeight}}return{listTop:E+window.scrollY,scrollTop:window.scrollY,height:window.innerHeight}},H=()=>{if(C=0,!(c>0)||!o.isConnected)return;let{listTop:E,scrollTop:T,height:N}=I();x(Math.floor((T-E)/c)-lt,L(N))},K=()=>{C||(C=typeof requestAnimationFrame=="function"?requestAnimationFrame(H):setTimeout(H,16))},G=(E,{block:T="nearest"}={})=>{if(z(),c>0&&o.isConnected){let{listTop:W,scrollTop:U,height:w}=I(),M=W+E*c,P=M+c,_=U;T==="start"?_=M:T==="end"?_=P-w:T==="center"?_=M-(w-c)/2:M<U?_=M:P>U+w&&(_=P-w),_!==U&&(p?p.scrollTop=_:window.scrollTo(window.scrollX,_)),H()}let N=a.count>0?a.count:L(window.innerHeight||800);(E<a.start||E>=a.start+N)&&x(E-lt,N);let q=r().find(W=>W.scope.$index===E);return q?q.range.first:null},z=()=>{$||!o.isConnected||($=!0,D=o.parentElement,p=wi(o.parentNode),(p??window).addEventListener("scroll",K,{passive:!0}),window.addEventListener("resize",K),p&&typeof ResizeObserver=="function"&&(O=new ResizeObserver(K),O.observe(p)),D&&Object.defineProperty(D,"$scrollTo",{value:G,configurable:!0,writable:!0}),H())};s.onDispose(()=>{C&&(typeof cancelAnimationFrame=="function"?cancelAnimationFrame:clearTimeout)(C),$&&((p??window).removeEventListener("scroll",K),window.removeEventListener("resize",K),O?.disconnect(),D&&D.$scrollTo===G&&delete D.$scrollTo)});let J=!1;return{top:o,bottom:i,range:E=>{d=E;let T=Number(j(t,n)),N=c;if(c=T>0?T:0,c&&c!==N&&$&&o.isConnected){let{listTop:w,scrollTop:M,height:P}=I(),_=Q(a);_.count=L(P),_.start=Math.max(0,Math.floor((M-w)/c)-lt)}if(!c)return o.style.height=i.style.height="0px",[0,E];let q=a.count>0?a.count:L(window.innerHeight||800),W=Math.max(0,Math.min(a.start,E-q)),U=Math.min(E,W+q);return o.style.height=`${W*c}px`,i.style.height=`${(E-U)*c}px`,[W,U]},settled:()=>{$||J||(J=!0,queueMicrotask(()=>{J=!1,z()}))}}},bi=(e,t,n,s)=>{let r=yi(e);if(!r)return document.createComment(`invalid :each expression "${e.attrs[":each"]}"`);let{itemName:l,atName:o,listExpr:i,keyExpr:a,keyIsItem:c,keyProp:d,itemNode:p,readsPosition:$,namesComponent:C,nestsScopes:O,windowExpr:D}=r,L=document.createComment("each"),x=document.createDocumentFragment();x.appendChild(L);let I=D===void 0?null:Si(p,D,t,n,()=>H);I&&x.append(I.top,I.bottom),(":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 H=[],K=!1;return n.effect(()=>{let G=Do(t);try{let z=j(i,t),J=Array.isArray(z),E=J?null:gi(z)?Object.keys(z):[],T=J?z.length:E.length,[N,q]=I?I.range(T):[0,T],W=new Map;H.forEach((u,g)=>{u.pos=g;let h=W.get(u.key);h?h.push(u):W.set(u.key,[u])});let U=new Set,w=[],M=[],P=[],_=[],B;for(let u=N;u<q;u++){let g=J?u:E[u],h=J?z[u]:z[g],S=g;c?S=h:d!==void 0&&h!==null&&typeof h=="object"?S=h[d]:a!==void 0&&(B===void 0?(B=Object.create(t),Pe(B,l,h),o&&Pe(B,o,g),Pe(B,"$index",u)):(B[l]=h,o&&(B[o]=g),B.$index=u),S=j(a,B)),U.has(S)&&!K&&(K=!0,console.warn(`jq79: duplicate :key in :each "${e.attrs[":each"]}"; duplicates pair up by position`)),U.add(S);let m=W.get(S)?.shift();if(m&&Object.is(m.item,h)){let k=m.scope;k.$index!==u&&($&&w.push(m),k.$index=u),o&&k[o]!==g&&(k[o]=g),P.push(m),_.push(m.pos);continue}if(m&&a!==void 0){let k=m.scope;k[l]=h,k.$index!==u&&(k.$index=u),o&&k[o]!==g&&(k[o]=g),m.item=h,M.push(m),P.push(m),_.push(m.pos);continue}m&&(m.fx.dispose(),St(m.range));let y=Object.create(t);Pe(y,l,h),o&&Pe(y,o,g),Pe(y,"$index",u),C||Vs.add(y);let b=Ee(t);O&&Object.defineProperty(y,At,{value:b});let R=wn($n(p,y,b,s));P.push({key:S,item:h,scope:y,fx:b,range:R,pos:u}),_.push(-1)}let V=new Set;W.forEach(u=>u.forEach(g=>V.add(g))),V.size&&(V.forEach(u=>{u.dead=!0,u.fx.dispose()}),_o(jo(H,u=>u.dead===!0)));let ne=I?I.top:L,f=hi(_);P.forEach((u,g)=>{!f[g]&&ne.nextSibling!==u.range.first&&Lo(u.range,ne),ne=u.range.last}),w.forEach(u=>xe(()=>u.fx.refresh())),M.forEach(u=>xe(()=>u.fx.rerun())),H=P}finally{Io(G)}I?.settled()}),n.onDispose(()=>H.forEach(G=>G.fx.dispose())),x},or=(e,t)=>{let n=t;for(;n<e.length&&typeof e[n]=="string"&&!e[n].trim();)n++;return n},Zt=e=>{let t=":if"in e.attrs,n=":elseif"in e.attrs,s=":else"in e.attrs;if((t?1:0)+(n?1:0)+(s?1:0)<2)return;let r=[t?":if":null,n?":elseif":null,s?":else":null].filter(Boolean);console.warn(`jq79: ${r.join(" and ")} on the same <${ee(e)}> - only ${r[0]} applies; the branches of a chain are sibling elements, one directive each`)},$i=(e,t)=>{let n=":elseif"in e.attrs?":elseif":":else";console.warn(t?`jq79: a second ${n} on <${ee(e)}> - the chain before it already ended with :else, which closes it. One :if, any number of :elseif, at most one :else`:`jq79: ${n} on <${ee(e)}> continues no :if - it renders unconditionally. A chain is :if, then :elseif, then :else, on adjacent siblings: anything but whitespace between them breaks it`)},Ti=[":if",":elseif",":else",":each"],Ri=(e,t)=>{if(e.tag!=="template"||e.ns!==void 0)return;let n=Ti.find(s=>s in e.attrs);if(n!==void 0){if(Fe(e)!==void 0){if(t?.component===void 0)return;console.warn(`jq79: ${n} on <template ${Fe(e)}> is ignored - a slot is filled with its children as written. Put ${n} on the elements inside it, or on the component's tag`);return}console.warn(`jq79: ${n} on a nested <template> shows nothing - a <template>'s children live in its .content and never reach the page. Put ${n} on the elements themselves`)}},xi=[...Wt,":model",":slot"].map(e=>e.slice(1)),Ni={":attrs":':attrs was removed in 0.7 - it now binds an attribute called "attrs". Bind them one at a time (:disabled="x", :title="y"), or :class for classes'},vi=e=>{for(let t in e.attrs){let n=Ni[t];n!==void 0&&console.warn(`jq79: ${n}`)}},Pi=e=>{if(!(e.component!==void 0||e.tag.includes("-")))for(let t in e.attrs){if(!t.startsWith(":")||we(t)||t===":model"||t.startsWith(":model."))continue;let n=t.slice(1);if(n.includes(".")){console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". Dotted modifiers belong to an event: if you meant @${n}, that is the spelling`);continue}let s=xi.find(r=>n!==r&&n.startsWith(r));s!==void 0&&console.warn(`jq79: ${t} is not a directive - it bound an attribute named "${n}". A ":name" jq79 does not recognize binds that attribute (which is what :src and :disabled are). If you meant :${s}, that is the spelling`)}},ir=(e,t)=>{e.forEach(s=>{typeof s!="string"&&(Ri(s,t),vi(s),Pi(s),ir(s.children,s))});let n=!1;for(let s=0;s<e.length;){let r=e[s];if(typeof r=="string"){r.trim()&&(n=!1),s++;continue}if(":each"in r.attrs){n=!1,s++;continue}if(Zt(r),":if"in r.attrs){s++;let l=i=>{let a=or(e,s),c=e[a];if(typeof c=="object"&&i in c.attrs)return s=a+1,c};for(let i=l(":elseif");i;i=l(":elseif"))Zt(i);let o=l(":else");o&&Zt(o),n=o!==void 0;continue}(":elseif"in r.attrs||":else"in r.attrs)&&$i(r,n),n=!1,s++}},vs=new WeakMap,ki=(e,t,n)=>{let s=vs.get(t);if(s)return s;let r=[{expr:t.attrs[":if"],node:t}],l=n+1,o=c=>{let d=or(e,l),p=e[d];if(typeof p=="object"&&c in p.attrs)return l=d+1,p};for(let c=o(":elseif");c;c=o(":elseif"))r.push({expr:c.attrs[":elseif"],node:c});let i=o(":else");i&&r.push({node:i});let a={branches:r,next:l};return vs.set(t,a),a},Te=(e,t,n,s=!1,r)=>{let l=r??document.createDocumentFragment(),o=0;for(;o<e.length;){let i=e[o];if(typeof i=="string"){let a=document.createTextNode(i);i.includes("{{")&&yn(a,Ao(i),t,n),l.appendChild(a),o++;continue}if(":each"in i.attrs){l.appendChild(bi(i,t,n,s)),o++;continue}if(":if"in i.attrs){let a=ki(e,i,o);l.appendChild(pi(a.branches,t,n,s)),o=a.next;continue}l.appendChild($n(i,t,n,s)),o++}return l},vl=(e,t,n=!1)=>Te(e.template,t,Ee(t),n),Ae="data-jq79",Ci=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)},lr=(e,t)=>{e.forEach(n=>{typeof n!="string"&&(n.attrs[Ae]=t,lr(n.children,t))})},Mi=/^:(before|after|first-line|first-letter)(?![\w-])/i,ar=(e,t)=>{let n=0;for(let s=0;s<e.length;s++){let r=e[s];if(r==="\\")s++;else if(r==='"'||r==="'")for(s++;s<e.length&&e[s]!==r;)s+=e[s]==="\\"?2:1;else if(r==="("||r==="[")n++;else if(r===")"||r==="]")n--;else if(n===0&&t(s))return}},Ai=(e,t)=>{let n=e.length;return ar(e,s=>e[s]!==":"||e[s+1]!==":"&&!Mi.test(e.slice(s))?!1:(n=s,!0)),`${e.slice(0,n)}[${Ae}="${t}"]${e.slice(n)}`},Oi=(e,t)=>{let n=cr(e),s=n.match(/^\s*/)[0],r=n.match(/\s*$/)[0],l=n.slice(s.length,n.length-r.length);if(!l)return e;let o=[],i=0;return ar(l,a=>{l[a]===","&&(o.push(l.slice(i,a)),i=a+1)}),o.push(l.slice(i)),s+o.map(a=>a.trim()&&Ai(a.trim(),t)).join(", ")+r},cr=e=>{let t="";for(let n=0;n<e.length;){let s=e[n];if(s==="/"&&e[n+1]==="*"){let r=e.indexOf("*/",n+2);n=r===-1?e.length:r+2}else if(s==='"'||s==="'"){let r=n+1;for(;r<e.length&&e[r]!==s;)r+=e[r]==="\\"?2:1;t+=e.slice(n,r+1),n=r+1}else s==="\\"?(t+=e.slice(n,n+2),n+=2):(t+=s,n++)}return t},_i=/(^|[\s>+~,(])([A-Z][A-Za-z0-9]*)(?![\w-])/g,ji=/[a-z]/,Li=e=>e.replace(_i,(t,n,s)=>ji.test(s)?`${n}${De(s)}`:t),dr=/^\s*@(media|supports|container|layer|scope|document)\b/i,ur=/^\s*@/,Di=e=>{let t="",n="",s="",r=[],l=()=>r.length===0||r[r.length-1],o=()=>{t+=l()&&!ur.test(s)?Li(n):n,n=""},i=c=>{o(),t+=c,s+=c},a=(c,d)=>{o(),t+=c,s="",d!==void 0?r.push(d):c==="}"&&r.pop()};for(let c=0;c<e.length;){let d=e[c];if(d==="/"&&e[c+1]==="*"){let p=e.indexOf("*/",c+2),$=p===-1?e.length:p+2;i(e.slice(c,$)),c=$}else if(d==='"'||d==="'"){let p=c+1;for(;p<e.length&&e[p]!==d;)p+=e[p]==="\\"?2:1;i(e.slice(c,Math.min(p+1,e.length))),c=p+1}else d==="{"?(a("{",dr.test(s)),c++):d==="}"||d===";"?(a(d),c++):(n+=d,s+=d,c++)}return o(),t},Ii=(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="",s="",r=[],l=()=>r.length===0||r[r.length-1];for(let o=0;o<e.length;){let i=e[o],a=i;if(i==="/"&&e[o+1]==="*"){let c=e.indexOf("*/",o+2);a=e.slice(o,c===-1?e.length:c+2)}else if(i==='"'||i==="'"){let c=o+1;for(;c<e.length&&e[c]!==i;)c+=e[c]==="\\"?2:1;a=e.slice(o,c+1)}else i==="\\"&&(a=e.slice(o,o+2));if(o+=a.length,!l())n+=a,a==="{"?r.push(!1):a==="}"&&r.pop();else if(a==="{"){let c=cr(s),d=ur.test(c);n+=(d?s:Oi(s,t))+"{",r.push(d&&dr.test(c)),s=""}else a==="}"||a===";"?(n+=s+a,s="",a==="}"&&r.pop()):s+=a}return n+s},sn=e=>{let t=Xn(e),s=new DOMParser().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template"),r=[],l=[];Array.from(s.content.children).forEach(a=>{a.tagName==="TEMPLATE"?l.push(a):r.push(a)});let o=Ps(r,e),i={};return l.forEach(a=>{let c=a.getAttribute("name");if(c===null){console.warn("jq79: a top-level <template> without a name declares nothing and was ignored");return}if(!Yn.test(c)){console.warn(`jq79: <template name="${c}"> was ignored - a component name has to be PascalCase, or no tag could ever reference it (only capitalized names resolve as components)`);return}if(c in i){console.warn(`jq79: two <template name="${c}"> in one file; the second was ignored`);return}i[c]=new pe({...Ps(Array.from(a.content.children),a.innerHTML),siblings:i,name:c})}),Object.keys(i).length&&(o.siblings=i),o},Hi=/^(?:text|application)\/(?:x-)?typescript$/i,qi=e=>"lang"in e?`lang="${e.lang}"`:Hi.test(e.type?.trim()??"")?`type="${e.type}"`:null,Ps=(e,t)=>{let n=[],s=[],r=[];e.forEach(o=>{let i={attrs:Hs(o),content:o.textContent??""};o.tagName==="SCRIPT"?n.push(i):o.tagName==="STYLE"?s.push(i):r.push(Fs(o))}),n.forEach(o=>{let i=qi(o.attrs);i&&console.warn(`jq79: <script ${i}> needs the jq79/vite plugin to compile it. This component didn't go through the bundler, so its types were never stripped: the script will throw, or - for a plain \`let x: T = ...\` - silently fail to declare x.`)}),s.forEach(o=>{"lang"in o.attrs&&console.warn(`jq79: <style lang="${o.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.`)}),s.forEach(o=>{"lang"in o.attrs||(o.content=Di(o.content))});let l=o=>"scoped"in o.attrs&&!("lang"in o.attrs);if(s.some(l)){let o=Ci(t);lr(r,o),s.forEach(i=>{l(i)&&(i.scoped=Ii(i.content,o))})}return ir(r),{template:r,scripts:n,styles:s}},fr=/\.html?([?#]|$)/,ht=e=>fr.test(e)?dn(e):import(e),Tn=/^(?:\.\.?\/|\/|[a-z][a-z0-9+.-]*:)/i,rn=(e,t)=>{if(!Tn.test(e))return e;try{return new URL(e,new URL(t??"",document.baseURI)).href}catch{return e}},Fi=(e,t)=>e?`
20
20
  //# sourceURL=${e}?jq79-script=${t}`:"",pr=(e,t,n)=>{try{return wt(e,t,Fi(n.filename,n.index??0))}catch(s){throw s instanceof Me?new Error(`jq79: safeEval() is on, and script ${n.index??0} of ${n.filename??"a component built from a string"} ${s.reason}. ${s.hint}`):s}},ks=e=>e.scoped??e.content,qe=`:where([${Qs}]) { display: contents }`,Rn=()=>fn&&typeof Document<"u"&&"adoptedStyleSheets"in Document.prototype,gt=e=>{let t=new CSSStyleSheet;return t.replaceSync(e),t},xn=(e,t)=>{e.adoptedStyleSheets.includes(t)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,t])},on=(e,t)=>{e.adoptedStyleSheets=e.adoptedStyleSheets.filter(n=>n!==t)},at=null,ln=null,Wi=()=>{if(Rn()){xn(document,ln??(ln=gt(qe)));return}at?.isConnected||(at=document.createElement("style"),at.textContent=qe,document.head.appendChild(at))},mt=new Map,Bi=e=>{let t=mt.get(e);if(!t){if(Rn()){let n=gt(e);xn(document,n),t={sheet:n,count:0}}else{let n=document.createElement("style");n.textContent=e,document.head.appendChild(n),t={el:n,count:0}}mt.set(e,t)}t.count++},Ui=e=>{let t=mt.get(e);t&&--t.count<=0&&(t.sheet?on(document,t.sheet):t.el?.remove(),mt.delete(e))},Ki=(e,t,n,s={},r=ht,l={})=>{let o={...br,...s},i=new Proxy(t,{has:(d,p)=>p!=="$__effect"&&p!=="$__import"&&p!=="$__state"&&(Reflect.has(d,p)||!(p in globalThis)&&!(p in o))}),a={},c=pr(ns(Object.keys(o)),ss(e),l)(i,n,r,a,...Object.values(o));return c.catch(d=>console.error("jq79: error in :setup script",d)),Ks(c),{settled:c,sync:a.done===!0}},Cs=(e,t)=>{t?.forEach(({name:n,default:s})=>{e[n]===void 0&&(e[n]=s===void 0?void 0:j(s,e))})},bt=e=>{let t=new Map;return n=>{if(t.has(n))return t.get(n);let s=e(n);return t.set(n,s),s}},hr=e=>(e?.forEach(t=>Object.freeze(t)),e&&Object.freeze(e),e),zi=bt(zn),an=bt(e=>hr(nt(e))),Gi=bt(e=>{let t=et(e);return Object.freeze(t.vars),Object.freeze(t)}),Vi=bt(e=>hr(is({attrs:{":setup":e},content:""}))),cn=e=>{let t=e.attrs[":setup"],n=t===void 0?null:Vi(t);return!n&&e.attrs[":setup"]!==void 0&&Zi(e,e.attrs[":setup"]),n},Ms=new WeakSet,Zi=(e,t)=>{t.trim()==="_"||Ms.has(e)||(Ms.add(e),console.warn(`jq79: :setup="${t}" is not a props pattern, so this component declares no signature and takes whatever a parent passes - write the props it takes ("{ a, b }"), a bare :setup for none, or "_" to stay open on purpose`))},Qi=e=>{let t=null;return e.forEach(n=>{let s=an(n.content)??cn(n);if(!s)return;let r=t??(t=new Set);s.forEach(({name:l})=>r.add(l))}),t},As=(e,t)=>{if(t===null)return e;let n={};return Object.keys(e).forEach(s=>{t.has(s)&&(n[s]=e[s])}),n},Os=new WeakMap,Xi=(e,t,n,s)=>{if(s===null)return;let r=Os.get(e)??new Set;Os.set(e,r),n.forEach(l=>{s.has(l)||r.has(l)||(r.add(l),console.warn(`jq79: :${l} is not declared by <${t}> - add it to the :setup signature, or drop it`))})},Yi=new Set([":value",":checked",":selected",":text",":html",":class"]),_s=new WeakSet,Ji=(e,t,n,s)=>{if(s===null||_s.has(e))return;let r=n.filter(l=>s.has(l));r.length&&(_s.add(e),r.forEach(l=>console.warn(`jq79: :${l} on <${t}> is a directive, not a prop - <${t}> never receives its "${l}". Rename the prop (${r.map(o=>`:${o}`).join(", ")} are reserved on a component tag), or use :model for a value that goes both ways`)))},el=(e,t)=>{if(!e)return null;let n=Object.create(null),s=!1;return Object.entries(e).forEach(([r,l])=>{t.has(r)||(n[r]=l,s=!0)}),s?n:null},gr=Symbol("jq79.unfilledProps"),yt=Symbol("jq79.pendingScripts"),tl=e=>e&&e.default!==void 0?e.default:e,nl=(e,t,n,s={},r=ht,l={})=>{let o={...br,...s},i={},a=pr(rs(Object.keys(o)),os(e),l)(i,tl,r,...Object.values(o)),c=O=>console.error("jq79: error in factory script",O),d=!1,p,$=()=>{if(d)return p;d=!0;let O=i.default;if(typeof O!="function")return;let D=L=>{L&&typeof L=="object"&&Object.assign(t,L)};try{let L=O(t,{$data:t,$props:t,$effect:n,...s});L instanceof Promise?p=L.then(D).catch(c):D(L)}catch(L){c(L)}return p},C=a.then($,c);return Ks(C),i.done&&$(),{settled:C,sync:i.done===!0&&p===void 0}},sl="__JQ79_HMR_ENABLED__",rl="__JQ79_HMR__",$e=null,ol=e=>{if(!$e||!e.filename)return;let t=$e.get(e.filename);t||$e.set(e.filename,t=new Set),t.add(new WeakRef(e))},Qt=e=>{try{return new URL(e,document.baseURI).pathname}catch{return e}},il=(e,t)=>{if(!$e)return 0;let n=Qt(e),s=sn(t);te?.forEach((i,a)=>{Qt(a)===n&&te.set(a,Promise.resolve(t))});let r=!1,l=i=>i.name===void 0?s:s.siblings?.[i.name]??null,o=0;for(let[i,a]of $e)if(Qt(i)===n){for(let c of a){let d=c.deref();if(!d){a.delete(c);continue}let p=l(d);if(!p){r=!0;continue}d.hotReplace(p)&&o++}a.size||$e.delete(i)}return r?0:o},ll=()=>{$e??($e=new Map),globalThis[rl]={update:il}},js=3e3,al=(e,t)=>{let n=setTimeout(()=>{console.warn(`jq79: ${e.name?`<${e.name}>`:"a component"}${e.filename?` (${e.filename})`:""} has been waiting ${js/1e3}s for a :setup script and has rendered nothing. The template waits until every script returns or calls $mounted() - add an await $mounted() above the slow part to render first and fill in after.`)},js);n?.unref?.(),Promise.all(t).then(()=>clearTimeout(n))},mr=e=>{if(Tn.test(e))return e;let t=import.meta.resolve;if(typeof t!="function")return e;try{return t(e)}catch{return e}},te=new Map,yr=e=>{try{return new URL(e,document.baseURI).href.replace(/#.*$/,"")}catch{return e}},Ls=e=>Promise.all([fetch(e).then(t=>{if(!t.ok)throw new Error(`failed to fetch component from ${e}: ${t.status}`);return t.text()}),Sr?.then(()=>gl(e))]).then(([t])=>t),Er=e=>{if(!te)return Ls(e);let t=yr(e),n=te.get(t);if(!n){n=Ls(e),te.set(t,n);let s=n;s.catch(()=>{te?.get(t)===s&&te.delete(t)})}return n},dn=async e=>{let t=mr(e),n=await Er(t);return new pe(n,{filename:t})},Ds=new WeakSet,Is=new Set,cl=e=>{if(Is.has(e))return;Is.add(e);let t=document.createElement("link");t.rel="modulepreload";let n=pn();n&&t.setAttribute("nonce",n),t.href=e,document.head.append(t)},dl=/<script\b(?:"[^"]*"|'[^']*'|[^>"'])*>([\s\S]*?)<\/script\s*>/gi,Et=new Set,wr=(e,t,n)=>{for(let{spec:s,kind:r}of Gn(e)){if(r==="component"&&n&&s in n)continue;let l=mr(r==="fetch"?s:rn(s,r==="component"?t:void 0));r==="fetch"||fr.test(l)?te&&Er(l).then(o=>ul(o,l),()=>{}):Tn.test(l)&&cl(l)}},ul=(e,t)=>{let n=yr(t);if(!Et.has(n)){Et.add(n);for(let[,s]of e.matchAll(dl))wr(s,t,void 0)}},fl=(e,t,n)=>{for(let s of e)Ds.has(s)||(Ds.add(s),wr(s.content,t,n))},Sr,pl="/jq79-sw.js",hl=async e=>{let t=typeof navigator>"u"?void 0:navigator.serviceWorker;if(!t)throw new Error("jq79: safeEval() compiles components in a service worker, and this page can't have one - service workers need https (or localhost). Precompile with the jq79/vite plugin instead, or use safeEval({ nonce: true }) on a page whose server issues a nonce.");let n;try{n=await t.register(e)}catch(s){throw new Error(`jq79: safeEval() couldn't register its service worker at ${e} (${s.message}). Serve jq79-sw.js from the jq79 package at your site's root, or pass its URL: safeEval({ worker: "/path/jq79-sw.js" }).`)}await t.ready,!t.controller&&await new Promise(s=>{t.addEventListener("controllerchange",()=>s(),{once:!0}),t.controller?s():n.active?.postMessage("jq79:claim")})},gl=e=>{let t=new URL(e,document.baseURI);return t.hash="",t.searchParams.set(cs,""),new Promise((n,s)=>{let r=document.createElement("script"),l=pn();l&&r.setAttribute("nonce",l),r.src=t.href,r.onload=()=>{r.remove(),n()},r.onerror=()=>{r.remove(),s(new Error(`jq79: the precompiled functions of ${e} did not load, and safeEval() can't render it without them`))},document.head.append(r)})},fe=class fe{constructor(t,n={}){A(this,"template");A(this,"scripts");A(this,"styles");A(this,"modules");A(this,"filename");A(this,"siblings");A(this,"name");A(this,"slots");A(this,"modelWriteback");A(this,"data",null);A(this,"fx",null);A(this,"content",null);A(this,"startMarker",null);A(this,"endMarker",null);A(this,"styleEls",[]);A(this,"shadowCss",null);A(this,"shadowSheets",[]);A(this,"sheetRoot",null);A(this,"ownsSharedStyles",!1);A(this,"useShadow",!1);A(this,"mountRoot",null);A(this,"resolveMounted",null);A(this,"renderDone",!1);A(this,"held",0);A(this,"onPaint",null);A(this,"destroyHooks",null);A(this,"attachHooks",null);A(this,"detachHooks",null);A(this,"onPage",!1);A(this,"emitListeners",new Map);let s=typeof t=="string"?sn(t):t;this.template=s.template,this.scripts=s.scripts,this.styles=s.styles,this.modules=n.modules??(typeof t=="string"?void 0:t.modules),this.filename=n.filename??(typeof t=="string"?void 0:t.filename),this.siblings=s.siblings,this.name=s.name,this.adoptSiblings(),ol(this)}adoptSiblings(){this.siblings&&Object.entries(this.siblings).forEach(([t,n])=>{n.filename??(n.filename=this.filename),n.modules??(n.modules=this.modules),this.name||(this[t]=n)})}hotReplace(t){let n=typeof t=="string"?sn(t):t;gn.clear(),be.clear(),tn.clear();let s=this.startMarker,r=!!(s&&this.content),l=r&&s.isConnected,o=l?s.parentNode:null,i=l?this.endMarker.nextSibling:null,a={...this.data},c=this.useShadow;return r&&this.destroy(),this.template=n.template,this.scripts=n.scripts,this.styles=n.styles,this.siblings=n.siblings,this.adoptSiblings(),!r||(this.renderWith(a,c),!o)?!1:(c&&this.placeShadowStyles(o,i),o.insertBefore(this.content,i),this.mountRoot=o,this.settleMounted(),!0)}static debug(t){if(t){let n=X.scopedNames;for(let s in t){let r=t[s];Object.prototype.hasOwnProperty.call(X,s)?typeof r=="boolean"?X[s]=r:console.warn(`jq79: Component79.debug ignored "${s}" - the flags are booleans, and the ones it knows are: ${Object.keys(X).join(", ")}`):console.warn(`jq79: Component79.debug does not know "${s}" - the flags it has are: ${Object.keys(X).join(", ")}`)}X.scopedNames!==n&&dt.clear()}return{...X}}static safeEval(t={}){fn=!0;let n=[];if(t.nonce){let r=pn();r===void 0?n.push(Promise.reject(new Error("jq79: safeEval({ nonce: true }) found no nonce on this page - no <script> carries one. The nonce belongs on the script that loads the page, the one the CSP names."))):Jt=r}let s=t.worker??(t.nonce?!1:pl);return s!==!1&&n.push(Sr??(Sr=hl(s))),Promise.all(n).then(()=>{})}static cache(t){return t===!1?(te=null,Et.clear()):t===!0&&(te??(te=new Map)),!!te}static clearCache(){te?.clear(),Et.clear()}static fetch(t){if(Array.isArray(t))throw new TypeError("Component79.fetch takes one URL; use fetchAll for an array");return new un(dn(t))}static fetchAll(t){return Promise.all(t.map(dn))}static importAll(t){if(!Array.isArray(t))throw new TypeError("Component79.importAll takes an array; use import() for one");return Promise.all(t.map(n=>ht(rn(n,void 0))))}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=ls(this.scripts,cn,an),r=el(this.siblings,s),l=r?Object.assign(Object.create(r),t):{...t},o=new Set([...s].filter(w=>!(w in t)));o.size&&Object.defineProperty(l,gr,{value:o}),this.slots&&Object.defineProperty(l,Zs,{value:this.slots}),Object.defineProperty(l,yt,{value:{count:0,owner:this}});let i=ve(l),a=Ee(i);this.data=i,this.fx=a,this.useShadow=n,this.startMarker=document.createComment("jq79"),this.endMarker=document.createComment("/jq79");let c=this.startMarker,d=!1,p=(w,M)=>{w==="model:update"&&!d&&(d=!0,console.warn("jq79: $emit('model:update', \u2026) no longer feeds :model - call $updateModel(value) or $updateModel(name, value) instead"));let P=new CustomEvent(w,{detail:M,bubbles:!0,composed:!0,cancelable:!0});return c===this.startMarker&&this.emitListeners.get(w)?.forEach(_=>_(P,M)),P.cancelBubble||c.dispatchEvent(P),!P.defaultPrevented},$,C=new Promise(w=>{$=w});this.resolveMounted=$,this.renderDone=!1,this.held=0;let O=w=>{if(typeof w!="function")throw new TypeError("jq79: $destroyed expects a function");return c!==this.startMarker?(ke(w,"$destroyed"),()=>{}):Xt(this.destroyHooks??(this.destroyHooks=[]),w)},D=(w,{immediate:M=!0}={})=>{if(typeof w!="function")throw new TypeError("jq79: $attached expects a function");if(c!==this.startMarker)return()=>{};this.watchPage();let P=Xt(this.attachHooks??(this.attachHooks=[]),w);return M&&this.onPage&&ke(w,"$attached"),P},L=w=>{if(typeof w!="function")throw new TypeError("jq79: $detached expects a function");return c!==this.startMarker?(ke(w,"$detached"),()=>{}):(this.watchPage(),Xt(this.detachHooks??(this.detachHooks=[]),w))},x=w=>{let M=Ot(w);return O(()=>M.$dispose()),M},I=this.endMarker,H=(w=>{let M=[];for(let P=c.nextSibling;P&&P!==I;P=P.nextSibling)P instanceof Element&&(P.matches(w)&&M.push(P),M.push(...Array.from(P.querySelectorAll(w))));return M}),K=(w=>H(w)[0]??null),G=this.modules,z=w=>G&&w in G?Promise.resolve(G[w]):ht(rn(w,this.filename)),J=w=>{if(!Array.isArray(w))throw new TypeError("$importAll takes an array; use import() for one");return Promise.all(w.map(z))},T=Object.assign(Object.create(null),{$emit:p,$updateModel:(...w)=>{let[M,P]=w.length>1?w:[void 0,w[0]];return c!==this.startMarker?!1:this.modelWriteback?.(M,P)??!1},$slots:Object.fromEntries(Object.keys(this.slots??{}).map(w=>[w,!0]))}),N=[],q=!0;fl(this.scripts,this.filename,this.modules),this.scripts.forEach((w,M)=>{let P;N.push(new Promise(S=>{P=S}));let _=!1,B=()=>{_=!0,P()},ne={$mounted:()=>(B(),C),$destroyed:O,$attached:D,$detached:L,$computed:x,$self:K,$$self:H,...T,$importAll:J,...r},f={filename:this.filename,index:M},u=":mounted"in w.attrs,g=zi(w.content),h=(()=>{if(g!==null){u&&console.warn("jq79: :mounted on a factory script renders the template before the factory has returned, so none of its bindings exist yet - await $mounted() inside the factory instead."),Cs(i,an(w.content));let b=u?zt(g):g;return nl(b,i,R=>a.effect(R),ne,z,f)}let{vars:S,code:m}=Gi(w.content);Cs(i,cn(w)),S.forEach(b=>{b in i||(i[b]=void 0)});let y=u?zt(m):m;return Ki(y,i,b=>a.effect(b),ne,z,f)})();if(h.sync)h.settled.then(B,B);else{let S=l[yt];S.count++;let m=()=>{S.count--,B()};h.settled.then(m,m)}!h.sync&&!_&&(q=!1)});let W=document.createDocumentFragment(),U=new Proxy(i,{has:(w,M)=>typeof M=="string"&&M in T||Reflect.has(w,M),get:(w,M,P)=>typeof M=="string"&&M in T&&!Reflect.has(w,M)?T[M]:Reflect.get(w,M,P)});if(W.append(this.startMarker,this.endMarker),this.content=W,q?(this.endMarker.parentNode.insertBefore(Te(this.template,U,a,n),this.endMarker),this.renderDone=!0,this.settleMounted()):(Promise.all(N).then(()=>{c===this.startMarker&&(this.endMarker.parentNode.insertBefore(Te(this.template,U,a,n),this.endMarker),this.renderDone=!0,this.settleMounted(),fe.settleAttached())}),al(this,N)),n)if(Rn())this.shadowCss=[...this.styles.map(w=>w.content),qe];else{let w=document.createElement("style");w.textContent=qe,this.styleEls=[...this.styles.map(M=>{let P=document.createElement("style");return P.textContent=M.content,P}),w]}else this.styles.forEach(w=>Bi(ks(w))),this.ownsSharedStyles=!0;return this}mount(t,n){let s=typeof t=="string"?Oe(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"?Oe(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.placeShadowStyles(n,null),n.appendChild(this.content),this.mountRoot=n,this.settleMounted(),fe.settleAttached(),this}isOnPage(){return this.renderDone&&this.startMarker?.isConnected===!0}watchPage(){me.has(this)||(me.add(this),this.onPage=this.isOnPage(),this.onPage||fe.queueSettle())}static queueSettle(){Yt||(Yt=!0,queueMicrotask(()=>{Yt=!1,fe.settleAttached()}))}static settleAttached(){if(me.size===0)return;let t=[...me].filter(n=>!n.onPage&&n.isOnPage());fe.inDocumentOrder(t).forEach(n=>{n.onPage||!me.has(n)||(n.onPage=!0,n.attachHooks?.slice().forEach(s=>ke(s,"$attached")))})}notifyDetached(){if(me.size===0)return;let t=[];if(this.startMarker?.isConnected){let n=new Set;for(let r=this.startMarker;r&&(n.add(r),r!==this.endMarker);r=r.nextSibling);let s=r=>{for(;r;r=r.parentNode)if(n.has(r))return!0;return!1};t=fe.inDocumentOrder([...me].filter(r=>r.onPage&&s(r.startMarker)))}else this.onPage&&(t=[this]);t.forEach(n=>{n.onPage&&(n.onPage=!1,n.detachHooks?.slice().forEach(s=>ke(s,"$detached")))})}static inDocumentOrder(t){return t.sort((n,s)=>n.startMarker.compareDocumentPosition(s.startMarker)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)}placeShadowStyles(t,n){if(this.shadowCss&&typeof ShadowRoot<"u"&&t instanceof ShadowRoot){this.sheetRoot&&this.sheetRoot!==t&&this.shadowSheets.forEach(s=>on(this.sheetRoot,s)),this.shadowSheets.length===0&&(this.shadowSheets=this.shadowCss.map(s=>s===qe?ln??(ln=gt(s)):gt(s))),this.shadowSheets.forEach(s=>xn(t,s)),this.sheetRoot=t;return}this.shadowCss&&this.styleEls.length===0&&(this.styleEls=this.shadowCss.map(s=>{let r=document.createElement("style");return r.textContent=s,r})),this.styleEls.forEach(s=>t.insertBefore(s,n))}settleMounted(){if(!this.renderDone||this.held>0)return;let t=this.onPaint;this.onPaint=null,t?.(),this.mountRoot&&this.resolveMounted?.()}holdOwner(t){this.renderDone&&this.held===0||(t.held++,this.onPaint=()=>{t.held--,t.settleMounted()})}detach(){if(!this.mountRoot||!this.content||!this.startMarker||!this.endMarker)return this;this.notifyDetached();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(){this.notifyDetached(),me.delete(this),this.attachHooks=null,this.detachHooks=null,this.onPage=!1;let t=this.destroyHooks;this.destroyHooks=null,t?.forEach(s=>ke(s,"$destroyed")),this.resolveMounted=null;let n=this.onPaint;return this.onPaint=null,n?.(),this.detach(),this.fx?.dispose(),this.fx=null,this.data?.$dispose(),this.styleEls.forEach(s=>s.parentNode?.removeChild(s)),this.styleEls=[],this.sheetRoot&&this.shadowSheets.forEach(s=>{s!==ln&&on(this.sheetRoot,s)}),this.shadowCss=null,this.shadowSheets=[],this.sheetRoot=null,this.ownsSharedStyles&&(this.styles.forEach(s=>Ui(ks(s))),this.ownsSharedStyles=!1),this.content=null,this.startMarker=null,this.endMarker=null,this.renderDone=!1,this.data=null,this.resolveMounted=null,this}};A(fe,"version",So);var pe=fe,un=class{constructor(t){A(this,"chain");this.chain=t}queue(t){return this.chain=this.chain.then(n=>(t(n),n)),this}then(t,n){return this.chain.then(t,n)}catch(t){return this.chain.catch(t)}finally(t){return this.chain.finally(t)}mount(t,n){return this.queue(s=>s.mount(t,n))}mountShadow(t,n){return this.queue(s=>s.mountShadow(t,n))}render(t={}){return this.queue(n=>n.render(t))}renderShadow(t={}){return this.queue(n=>n.renderShadow(t))}on(t,n){return this.queue(s=>s.on(t,n))}off(t,n){return this.queue(s=>s.off(t,n))}detach(){return this.queue(t=>t.detach())}destroy(){return this.queue(t=>t.destroy())}};var Pl=e=>new pe(e),ke=(e,t)=>{try{e()}catch(n){console.error(`jq79: error in a ${t} hook`,n)}},Xt=(e,t)=>(e.push(t),()=>{let n=e.indexOf(t);n!==-1&&e.splice(n,1)}),me=new Set,Yt=!1,br={$:Oe,$$:Tt,$create:Rt,$reactive:ve,$toRaw:Q,$raw:Ct,$batch:Ne,$tick:Mt,Component79:pe,C79:pe};typeof globalThis<"u"&&globalThis[sl]&&ll();export{Oe as $,Tt as $$,Ne as $batch,Ot as $computed,Rt as $create,Ct as $raw,ve as $reactive,Mt as $tick,Q as $toRaw,pe as C79,pe as Component79,un as PendingComponent79,ll as enableHotReload,il as hotUpdate,Pl as parseComponent,vl as renderComponent};
package/dist/vite.cjs CHANGED
@@ -263,21 +263,55 @@ var declaredComponents = (source) => {
263
263
  return names;
264
264
  };
265
265
  var STYLE_BLOCK_RE = /<style((?:"[^"]*"|'[^']*'|[^>"'])*)>([\s\S]*?)<\/style\s*>/gi;
266
- var LANG_ATTR_RE = /\blang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i;
267
- var TYPE_ATTR_RE = /\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i;
268
- var attrValue = (attrs, re) => {
269
- const found = attrs.match(re);
270
- return found ? found[1] ?? found[2] ?? found[3] : null;
266
+ var readAttrs = (attrs) => {
267
+ const spans = [];
268
+ const space = /[\s/]/;
269
+ let i = 0;
270
+ while (i < attrs.length) {
271
+ const start = i;
272
+ while (i < attrs.length && space.test(attrs[i])) i++;
273
+ const nameStart = i;
274
+ while (i < attrs.length && !/[\s/=>]/.test(attrs[i])) i++;
275
+ if (i === nameStart) {
276
+ if (i >= attrs.length) break;
277
+ i++;
278
+ continue;
279
+ }
280
+ const name = attrs.slice(nameStart, i).toLowerCase();
281
+ let j = i;
282
+ while (j < attrs.length && /\s/.test(attrs[j])) j++;
283
+ let value = null;
284
+ if (attrs[j] === "=") {
285
+ j++;
286
+ while (j < attrs.length && /\s/.test(attrs[j])) j++;
287
+ const quote = attrs[j];
288
+ if (quote === '"' || quote === "'") {
289
+ const close = attrs.indexOf(quote, j + 1);
290
+ const end = close === -1 ? attrs.length : close;
291
+ value = attrs.slice(j + 1, end);
292
+ i = close === -1 ? end : end + 1;
293
+ } else {
294
+ const valueStart = j;
295
+ while (j < attrs.length && !/[\s>]/.test(attrs[j])) j++;
296
+ value = attrs.slice(valueStart, j);
297
+ i = j;
298
+ }
299
+ }
300
+ spans.push({ name, value, start, end: i });
301
+ }
302
+ return spans;
271
303
  };
304
+ var findAttr = (attrs, name) => readAttrs(attrs).find((a) => a.name === name);
305
+ var dropAttr = (attrs, span) => attrs.slice(0, span.start) + attrs.slice(span.end);
272
306
  var compileStyleBlocks = async (source, file, config, addWatchFile) => {
273
307
  const blocks = [...source.matchAll(STYLE_BLOCK_RE)];
274
308
  const compiled = await Promise.all(
275
309
  blocks.map(async ([, attrs, content]) => {
276
- const extension = attrValue(attrs, LANG_ATTR_RE);
277
- if (extension === null) return null;
278
- const result = await (0, import_vite.preprocessCSS)(content, `${file}.${extension}`, config);
310
+ const lang = findAttr(attrs, "lang");
311
+ if (!lang?.value) return null;
312
+ const result = await (0, import_vite.preprocessCSS)(content, `${file}.${lang.value}`, config);
279
313
  result.deps?.forEach(addWatchFile);
280
- return { attrs: attrs.replace(LANG_ATTR_RE, "").trimEnd(), css: result.code };
314
+ return { attrs: dropAttr(attrs, lang).trimEnd(), css: result.code };
281
315
  })
282
316
  );
283
317
  let out = "";
@@ -293,10 +327,10 @@ var compileStyleBlocks = async (source, file, config, addWatchFile) => {
293
327
  var TS_LANGS = /* @__PURE__ */ new Set(["ts", "typescript"]);
294
328
  var TS_TYPE_RE = /^(?:text|application)\/(?:x-)?typescript$/;
295
329
  var typescriptAttr = (attrs) => {
296
- const lang = attrValue(attrs, LANG_ATTR_RE);
297
- if (lang !== null) return TS_LANGS.has(lang.trim().toLowerCase()) ? LANG_ATTR_RE : null;
298
- const type = attrValue(attrs, TYPE_ATTR_RE);
299
- return type !== null && TS_TYPE_RE.test(type.trim().toLowerCase()) ? TYPE_ATTR_RE : null;
330
+ const lang = findAttr(attrs, "lang");
331
+ if (lang?.value != null) return TS_LANGS.has(lang.value.trim().toLowerCase()) ? lang : null;
332
+ const type = findAttr(attrs, "type");
333
+ return type?.value != null && TS_TYPE_RE.test(type.value.trim().toLowerCase()) ? type : null;
300
334
  };
301
335
  var stripTypes = async (ts, file) => {
302
336
  const vite = await import("vite");
@@ -306,7 +340,6 @@ var stripTypes = async (ts, file) => {
306
340
  });
307
341
  return code.replace(/^[ \t]*export\s*\{\s*\}\s*;?[ \t]*$/m, "");
308
342
  };
309
- var SETUP_ATTR_RE = /(:setup\s*=\s*)(?:"([^"]*)"|'([^']*)')/i;
310
343
  var SIGNATURE_MARKER = "__jq79_signature__";
311
344
  var stripSignatureTypes = async (value, file) => {
312
345
  const compiled = await stripTypes(`(${value}) => ${SIGNATURE_MARKER}`, file);
@@ -323,11 +356,12 @@ var compileScriptBlocks = async (source, file) => {
323
356
  blocks.map(async ([, attrs, content]) => {
324
357
  const marker = typescriptAttr(attrs);
325
358
  if (!marker) return null;
326
- let rest = attrs.replace(marker, "").trimEnd();
327
- const setup = rest.match(SETUP_ATTR_RE);
328
- if (setup) {
329
- const signature = await stripSignatureTypes(setup[2] ?? setup[3], `${file}.signature.ts`);
330
- rest = rest.replace(SETUP_ATTR_RE, () => `${setup[1]}"${quoteAttrValue(signature)}"`);
359
+ let rest = dropAttr(attrs, marker).trimEnd();
360
+ const setup = findAttr(rest, ":setup");
361
+ if (setup?.value != null) {
362
+ const signature = await stripSignatureTypes(setup.value, `${file}.signature.ts`);
363
+ const before = rest.slice(setup.start, setup.end).match(/^\s*/)[0];
364
+ rest = rest.slice(0, setup.start) + `${before}:setup="${quoteAttrValue(signature)}"` + rest.slice(setup.end);
331
365
  }
332
366
  return { attrs: rest, js: await stripTypes(content, `${file}.ts`) };
333
367
  })
package/dist/vite.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../dev/vite.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\"\nimport { posix, relative } from \"node:path\"\nimport { preprocessCSS, transformWithEsbuild } from \"vite\"\nimport type { Plugin, ResolvedConfig } from \"vite\"\n// by package name rather than ../src: this file's types are emitted with dev/\n// as their root, and the generator is the runtime's own code - resolved through\n// the package's exports (external in the build, aliased to src in the tests)\nimport { precompile, precompiledScript } from \"jq79/precompile\"\n\n// Vite plugin: import .html single-file components as modules.\n//\n// import { jq79 } from \"jq79/vite\" // vite.config\n// import UserCard from \"./UserCard.html\" // app code\n//\n// The imported value is a Component79 built from the file's source - the same\n// thing `await Component79.fetch(url)` resolves to, but bundled at build time\n// instead of fetched at runtime. The component source is inlined verbatim, so\n// a file keeps working unchanged if it's ever served from public/ and loaded\n// with fetch instead - with one deliberate exception, a block that says it is\n// written in something else: <style lang=\"scss\"> (or less/stylus/sass) is\n// compiled to plain CSS here, and a TypeScript script - <script lang=\"ts\">, or\n// the same mark spelled <script type=\"text/typescript\"> - to plain JS. Such a\n// component only works through the bundler; loaded with fetch() it would reach\n// the runtime uncompiled, which the runtime warns about.\n//\n// Only .html files imported from other modules are claimed; entry points\n// (index.html) have no importer and imports carrying an explicit query\n// (?raw, ?url) keep their built-in Vite meaning.\n\nexport interface Jq79PluginOptions {\n // which import specifiers are treated as components (default: any .html)\n include?: RegExp\n // resolved absolute paths to skip even when `include` matches\n exclude?: RegExp\n // run the app without eval, for a CSP with no 'unsafe-eval' - the value\n // Component79.safeEval() takes, and meaning the same thing\n // (RECORD/2026-09-23.no-unsafe-eval.md). Every component is precompiled, and\n // their functions ship as one script beside the bundle. `true`: those and\n // nothing else - whatever the build couldn't see is reported, never evaluated.\n // `{ nonce: true }`: whatever it couldn't see (a component built from a\n // string, an edit during HMR) is built as a <script> carrying the page's nonce\n safeEval?: boolean | { nonce?: boolean }\n}\n\n// claimed modules get this suffix so their id no longer ends in \".html\" and\n// Vite's own html handling (entries, asset pipeline) leaves them alone\nconst COMPONENT_QUERY = \"?jq79\"\n\n// safeEval. Precompiled functions travel as a classic script, and not inside\n// a module: they compile under `with`, which is a SyntaxError in strict code,\n// and every module is strict. In a build it is one script for every component\n// - jq79-precompiled-[hash].js, an asset beside the chunks - and the pages that\n// need it preload it (RECORD/2026-11-04.one-precompiled-script.md); in dev each\n// component has its own, which the server hands out (PRECOMPILED_PATH). Either\n// way it pushes its functions onto the queue the runtime drains (see \"safe\n// eval\" in src/jq79.ts).\n//\n// The component's module waits for it - a top-level await - before it builds\n// anything, through a module every component module imports. That module\n// evaluates once, so safe mode is turned on once per app, and a page with no\n// nonce is reported once rather than once per component; and it loads each\n// script once, however many modules ask - in a build they all ask for the\n// same one, so the first await downloads it and the rest resolve at once. The\n// <script> carries the page's nonce when there is one, so a CSP that works by\n// nonce admits it; under `script-src 'self'` the URL is what admits it.\n//\n// Component79 is passed in rather than imported, so the module resolves\n// nothing: a bare \"jq79\" from a virtual importer is the one resolution that\n// would depend on how the app is laid out.\n//\n// A component built from a string *before* any .html module is imported runs\n// in the default mode; such an app calls Component79.safeEval itself. The\n// await needs a build target with top-level await in it - Vite 7 and later\n// have one by default; on Vite 5 or 6, raise build.target to es2022\nconst SAFE_EVAL_ID = \"virtual:jq79/safe-eval\"\nconst RESOLVED_SAFE_EVAL_ID = `\\0${SAFE_EVAL_ID}`\nconst safeEvalModule = (options: { nonce?: boolean; worker: false }) => `\nlet started = null\nconst loading = new Map()\nconst pageNonce = () => {\n for (const script of document.querySelectorAll(\"script[nonce]\")) {\n const nonce = script.nonce || script.getAttribute(\"nonce\")\n if (nonce) return nonce\n }\n}\nexport const safeEval = (Component79, url) => {\n if (!started) started = Component79.safeEval(${JSON.stringify(options)}).catch(error => console.error(error))\n let loaded = loading.get(url)\n if (!loaded) {\n loaded = new Promise((resolve, reject) => {\n const script = document.createElement(\"script\")\n const nonce = pageNonce()\n if (nonce) script.setAttribute(\"nonce\", nonce)\n script.src = url\n script.onload = () => { script.remove(); resolve() }\n script.onerror = () => {\n script.remove()\n reject(new Error(\"jq79: the precompiled functions at \" + url + \" did not load, and safeEval can't render without them\"))\n }\n document.head.append(script)\n })\n loading.set(url, loaded)\n }\n return loaded\n}\n`\n\n// where the dev server hands out a component's precompiled script\nconst PRECOMPILED_PATH = \"/@jq79/precompiled.js\"\n\n// a build's one precompiled script, named as an asset: assets/jq79-precompiled-[hash].js\nconst PRECOMPILED_ASSET = \"jq79-precompiled.js\"\n// what a component's module passes for that script's URL in a build. The asset\n// is emitted in buildEnd, once every component is known - Rolldown has no\n// setAssetSource to fill it in later, and a module is loaded before the build\n// knows the rest - so a module can't name it by reference when it's loaded;\n// renderChunk writes the URL over this\nconst PRECOMPILED_URL_PLACEHOLDER = \"__JQ79_PRECOMPILED_URL__\"\nconst PRECOMPILED_URL_PLACEHOLDER_RE = /([\"'`])__JQ79_PRECOMPILED_URL__\\1/g\n\n// the plugin's safeEval option, as what the modules pass the runtime: null\n// for off, or Component79.safeEval's own options\nconst safeEvalOptions = (option: Jq79PluginOptions[\"safeEval\"]): { nonce?: boolean } | null => {\n if (option === undefined || option === false) return null\n return typeof option === \"object\" && option !== null && option.nonce === true ? { nonce: true } : {}\n}\n\n// a scoped-form body: the runtime falls back to the `with` form when one\n// doesn't compile, so only the `with` form's failure is worth a word\nconst SCOPED_BODY_RE = /^(?:let \\$t;| return \\()/\n\n// one precompiled function, and whether it parses\ntype CheckedFunction = [params: string[], body: string, parses: boolean]\n\n// a component's precompiled functions, each compiled here first - node can,\n// where the page may not - so a script holds only functions that parse; one\n// that doesn't ships as null, and the build says so, once, with its file\nconst componentFunctions = (source: string, warn: (message: string) => void): CheckedFunction[] =>\n precompile(source).map(([params, body]) => {\n try {\n new Function(...params, body)\n return [params, body, true]\n } catch (error) {\n if (!SCOPED_BODY_RE.test(body)) warn(`${(error as Error).message}, in: ${body.length > 120 ? `${body.slice(0, 120)}…` : body}`)\n return [params, body, false]\n }\n })\n\n// the classic script that registers functions (precompiledScript, in\n// jq79/precompile): one component's in dev, every component's in a build. One\n// push, each function once - the runtime keys them by (params, body), so\n// `{{ name }}` written in ten components is one function, and a second entry\n// would only replace the first with itself\nconst registeringScript = (functions: CheckedFunction[]): string => {\n const unique = new Map<string, CheckedFunction>()\n for (const fn of functions) {\n const key = JSON.stringify([fn[0], fn[1]])\n if (!unique.has(key)) unique.set(key, fn)\n }\n return precompiledScript(\n [...unique.values()].map(([params, body]) => [params, body]),\n (params, body) => unique.get(JSON.stringify([params, body]))?.[2] ?? false\n )\n}\n\ntype BundleFile = { type: string; fileName: string; moduleIds?: string[]; imports?: string[] }\n\n// whether a page's entry chunk waits for the precompiled script as it loads:\n// it, or a chunk it imports statically, holds a component module. A component\n// behind import() asks for the script when it is imported, and a preload the\n// page doesn't use straight away only earns a warning in the console\nconst reachesComponent = (entry: BundleFile, bundle: Record<string, BundleFile>): boolean => {\n const seen = new Set<string>()\n const visit = (chunk: BundleFile | undefined): boolean => {\n if (!chunk || chunk.type !== \"chunk\" || seen.has(chunk.fileName)) return false\n seen.add(chunk.fileName)\n return (chunk.moduleIds ?? []).some(id => id.endsWith(COMPONENT_QUERY)) || (chunk.imports ?? []).some(file => visit(bundle[file]))\n }\n return visit(entry)\n}\n\n// a <script src>, quote-aware, and not a data-src\nconst SCRIPT_SRC_RE = /<script\\b(?:\"[^\"]*\"|'[^']*'|[^>\"'])*?\\ssrc\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s>]+))/gi\n\n// `file` as the page has to write it to get the URL a module asks for: the\n// file relative to the module's chunk, against that chunk's own URL - which\n// is what new URL(..., import.meta.url) resolves. The chunk's URL is read off\n// the page, from the <script src> Vite wrote for it, so `base`, a relative\n// base and renderBuiltUrl are already in it. Any of the bundle's chunks will\n// do, because chunks import each other by relative path - and it has to be\n// any: an entry that is nothing but imports gets no <script> of its own, only\n// its imports do. null when no script on the page loads one of them: no\n// preload is better than one at the wrong URL, which downloads twice\nconst precompiledHref = (html: string, bundle: Record<string, BundleFile>, file: string): string | null => {\n const chunks = Object.values(bundle).filter(out => out.type === \"chunk\").map(out => out.fileName)\n for (const match of html.matchAll(SCRIPT_SRC_RE)) {\n const src = (match[1] ?? match[2] ?? match[3]).replace(/[?#].*$/, \"\")\n const chunk = chunks.find(name => src === name || src.endsWith(`/${name}`))\n if (chunk === undefined) continue\n const path = posix.relative(posix.dirname(chunk), file)\n // a full URL, or a protocol-relative one\n if (/^(?:[a-z][a-z\\d+.-]*:)?\\/\\//i.test(src)) {\n const scheme = src.startsWith(\"//\") ? \"https:\" : \"\"\n return new URL(path, scheme + src).href.slice(scheme.length)\n }\n const href = posix.join(posix.dirname(src), path)\n return src.startsWith(\"/\") || href.startsWith(\".\") ? href : `./${href}`\n }\n return null\n}\n\n// a <script> block with its attribute string, so `lang` can be read and the\n// body replaced - the same shape as STYLE_BLOCK_RE below, quote-aware so a\n// \">\" inside an attribute value (`:setup=\"{ n = a > 1 }\"`) doesn't end the tag\nconst SCRIPT_BLOCK_RE = /<script((?:\"[^\"]*\"|'[^']*'|[^>\"'])*)>([\\s\\S]*?)<\\/script\\s*>/gi\n// import(\"...\") with a literal specifier, tried at word boundaries the\n// scanner below reaches (which is what skips $__import and foo.import(...))\nconst IMPORT_CALL_RE = /import\\s*\\(\\s*([\"'])([^\"'\\n]+?)\\1\\s*\\)/y\n// static import statements (factory scripts): optional clause + literal\n// specifier. The clause can't contain parens/quotes, so dynamic import()\n// and import.meta never match\nconst STATIC_IMPORT_RE = /import\\s*(?:[\\w$\\s,{}*]+?\\s*from\\s*)?([\"'])([^\"'\\n]+)\\1/y\n// the opening of $importAll([...]), the plural of import(): its string\n// entries are import()'s specifiers, one by one (importAllSpecifiers)\nconst IMPORT_ALL_RE = /\\$importAll\\s*\\(\\s*\\[/y\n// what may sit between the entries of that array (whitespace, comments), and\n// an entry the bundle can answer: a string literal\nconst ARRAY_GAP_RE = /(?:\\s|\\/\\/[^\\n]*|\\/\\*[\\s\\S]*?\\*\\/)*/y\nconst ARRAY_ENTRY_RE = /([\"'])([^\"'\\n]+?)\\1/y\n\nconst skipString = (src: string, start: number): number => {\n const quote = src[start]\n let i = start + 1\n while (i < src.length) {\n if (src[i] === \"\\\\\") { i += 2; continue }\n if (src[i] === quote) return i + 1\n i++\n }\n return src.length\n}\n\n// the literal import specifiers in one script body. A scanner rather than a\n// bare matchAll, because a specifier mentioned in a comment or a string is\n// not an import: hoisting a commented-out `import(\"./old.html\")` would pull\n// dead files into the bundle - or break the build once the file is gone\n// the literal entries of a $importAll([...]) whose \"[\" ends at `at`, and\n// where the scan goes on from. A literal is hoisted until the first entry that\n// isn't one: from there the array is the runtime's, as a computed import() is\nconst importAllSpecifiers = (script: string, at: number): { specs: string[]; end: number } => {\n const specs: string[] = []\n const gap = (i: number) => { ARRAY_GAP_RE.lastIndex = i; ARRAY_GAP_RE.exec(script); return ARRAY_GAP_RE.lastIndex }\n let i = gap(at)\n for (;;) {\n ARRAY_ENTRY_RE.lastIndex = i\n const entry = ARRAY_ENTRY_RE.exec(script)\n if (!entry) return { specs, end: i }\n const next = gap(ARRAY_ENTRY_RE.lastIndex)\n // a literal is an entry only when it's all of one: `\"./a\" + x` isn't\n if (script[next] !== \",\" && script[next] !== \"]\") return { specs, end: i }\n specs.push(entry[2])\n if (script[next] === \"]\") return { specs, end: next + 1 }\n i = gap(next + 1)\n }\n}\n\nconst importSpecifiers = (script: string): string[] => {\n const specs: string[] = []\n let i = 0\n while (i < script.length) {\n const ch = script[i]\n if (ch === \"'\" || ch === '\"' || ch === \"`\") { i = skipString(script, i); continue }\n if (ch === \"/\" && script[i + 1] === \"/\") {\n const end = script.indexOf(\"\\n\", i)\n i = end === -1 ? script.length : end + 1\n continue\n }\n if (ch === \"/\" && script[i + 1] === \"*\") {\n const end = script.indexOf(\"*/\", i + 2)\n i = end === -1 ? script.length : end + 2\n continue\n }\n if (ch === \"i\" && (i === 0 || !/[\\w$.]/.test(script[i - 1]))) {\n IMPORT_CALL_RE.lastIndex = i\n const call = IMPORT_CALL_RE.exec(script)\n if (call) { specs.push(call[2]); i = IMPORT_CALL_RE.lastIndex; continue }\n STATIC_IMPORT_RE.lastIndex = i\n const staticImport = STATIC_IMPORT_RE.exec(script)\n if (staticImport) { specs.push(staticImport[2]); i = STATIC_IMPORT_RE.lastIndex; continue }\n }\n // $importAll, not C79.importAll: the static one means the page, so it\n // stays the runtime's (the \".\" before it is what the guard skips)\n if (ch === \"$\" && (i === 0 || !/[\\w$.]/.test(script[i - 1]))) {\n IMPORT_ALL_RE.lastIndex = i\n if (IMPORT_ALL_RE.exec(script)) {\n const { specs: entries, end } = importAllSpecifiers(script, IMPORT_ALL_RE.lastIndex)\n specs.push(...entries)\n i = end\n continue\n }\n }\n i++\n }\n return specs\n}\n\nconst isHtmlUrl = (spec: string) => /\\.html?([?#]|$)/.test(spec)\nconst isExternalUrl = (spec: string) => /^[a-z][a-z0-9+.-]*:/i.test(spec) || spec.startsWith(\"/\")\n\n// literal import specifiers in the component's script blocks - dynamic\n// `import(\"...\")` calls, the entries of `$importAll([...])` and static\n// factory-script imports - that should\n// resolve from the bundle instead of at runtime. Absolute paths and full\n// URLs are left alone (they point at served files, e.g. public/), and so\n// are .html specifiers the plugin wouldn't claim as components\nconst hoistableImports = (source: string, include: RegExp): string[] => {\n const specifiers = new Set<string>()\n for (const [, , script] of source.matchAll(SCRIPT_BLOCK_RE)) {\n for (const spec of importSpecifiers(script)) {\n if (isExternalUrl(spec)) continue\n if (isHtmlUrl(spec) && !include.test(spec)) continue // html left to runtime fetch\n specifiers.add(spec) // a claimed component, a source file or an npm package\n }\n }\n return [...specifiers]\n}\n\n// any start or end tag, quote-aware so a \">\" inside an attribute value doesn't\n// end it early\nconst TAG_RE = /<(\\/?)([A-Za-z][\\w-]*)((?:\"[^\"]*\"|'[^']*'|[^>\"'])*)>/g\nconst NAME_ATTR_RE = /\\bname\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')/i\nconst COMPONENT_NAME_RE = /^[A-Z][A-Za-z0-9]*$/\nconst VOID_ELEMENTS = new Set([\n \"area\", \"base\", \"br\", \"col\", \"embed\", \"hr\", \"img\", \"input\",\n \"link\", \"meta\", \"param\", \"source\", \"track\", \"wbr\",\n])\n\n// the components a file declares: its *top-level* <template name=\"…\"> blocks,\n// which the emitted module re-exports by name. Depth is tracked because only\n// the top level declares - a <template> nested in the markup is a plain inert\n// element the runtime leaves alone, and exporting it would name something that\n// never exists. Script and style bodies are cut out first, so a \"<\" in JS or a\n// selector can't be read as a tag\nconst declaredComponents = (source: string): string[] => {\n const markup = source.replace(SCRIPT_BLOCK_RE, \"\").replace(STYLE_BLOCK_RE, \"\")\n const names: string[] = []\n let depth = 0\n\n for (const [, closing, tag, attrs] of markup.matchAll(TAG_RE)) {\n if (closing) {\n depth = Math.max(0, depth - 1)\n continue\n }\n const selfClosing = /\\/\\s*$/.test(attrs) || VOID_ELEMENTS.has(tag.toLowerCase())\n if (depth === 0 && !selfClosing && tag.toLowerCase() === \"template\") {\n const declared = attrs.match(NAME_ATTR_RE)\n const name = declared?.[1] ?? declared?.[2]\n // the runtime warns about the ones this skips (nameless, not PascalCase)\n if (name && COMPONENT_NAME_RE.test(name)) names.push(name)\n }\n if (!selfClosing) depth++\n }\n return names\n}\n\n// a <style> block with its attribute string, so `lang` can be read and the\n// content replaced. Attribute values are matched as quoted chunks so a \">\"\n// inside one doesn't end the tag early\nconst STYLE_BLOCK_RE = /<style((?:\"[^\"]*\"|'[^']*'|[^>\"'])*)>([\\s\\S]*?)<\\/style\\s*>/gi\nconst LANG_ATTR_RE = /\\blang\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s>]+))/i\nconst TYPE_ATTR_RE = /\\btype\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s>]+))/i\n\n// one attribute's value out of a tag's attribute string, whichever way it was\n// quoted - null when the attribute isn't there at all\nconst attrValue = (attrs: string, re: RegExp): string | null => {\n const found = attrs.match(re)\n return found ? found[1] ?? found[2] ?? found[3] : null\n}\n\n// compiles <style lang=\"scss|less|styl|sass\"> blocks to plain CSS with Vite's\n// own preprocessing (the same call @vitejs/plugin-vue makes), so the runtime\n// only ever sees CSS. The preprocessor picks its parser from the extension,\n// and resolving relative @use/@import against a filename in the component's\n// own directory is what makes `@use \"./vars\"` work. Files the preprocessor\n// pulls in are registered as watch deps, so editing a partial re-runs HMR for\n// every component that uses it. `lang` is dropped from the emitted tag: what\n// the runtime parses is a plain <style> (with `scoped` and the rest intact)\nconst compileStyleBlocks = async (\n source: string,\n file: string,\n config: ResolvedConfig,\n addWatchFile: (id: string) => void\n): Promise<string> => {\n const blocks = [...source.matchAll(STYLE_BLOCK_RE)]\n const compiled = await Promise.all(\n blocks.map(async ([, attrs, content]) => {\n const extension = attrValue(attrs, LANG_ATTR_RE)\n if (extension === null) return null\n const result = await preprocessCSS(content, `${file}.${extension}`, config)\n result.deps?.forEach(addWatchFile)\n return { attrs: attrs.replace(LANG_ATTR_RE, \"\").trimEnd(), css: result.code }\n })\n )\n\n let out = \"\"\n let last = 0\n blocks.forEach((block, i) => {\n const done = compiled[i]\n if (!done) return\n out += source.slice(last, block.index) + `<style${done.attrs}>${done.css}</style>`\n last = block.index + block[0].length\n })\n return out + source.slice(last)\n}\n\n// languages a <script lang> is compiled from. Anything else is left as written\n// for the runtime to warn about, rather than guessed at\nconst TS_LANGS = new Set([\"ts\", \"typescript\"])\n// the other spelling of the same mark. A component is a plain .html file, not\n// an SFC, so nothing in an editor knows what `lang` means there, and each mark\n// gets half of one: VS Code's HTML language service checks a `type` of\n// text/typescript as TypeScript (and `lang=\"ts\"` as JavaScript), while its\n// grammar colors that `type` not at all (and `lang=\"ts\"` as JavaScript). See\n// docs/vite-plugin.md#which-mark-in-vs-code. The `x-` forms are the historical\n// spelling of the same two media types\nconst TS_TYPE_RE = /^(?:text|application)\\/(?:x-)?typescript$/\n\n// what marks a script block as TypeScript, given back as the attribute to drop\n// from the emitted tag - the block is compiled to JS, so the mark goes with the\n// types whichever one carried it. A `lang` answers on its own: `lang=\"coffee\"`\n// is a language this plugin doesn't compile, and reading `type` past it would\n// compile a block the author said was something else\nconst typescriptAttr = (attrs: string): RegExp | null => {\n const lang = attrValue(attrs, LANG_ATTR_RE)\n if (lang !== null) return TS_LANGS.has(lang.trim().toLowerCase()) ? LANG_ATTR_RE : null\n const type = attrValue(attrs, TYPE_ATTR_RE)\n return type !== null && TS_TYPE_RE.test(type.trim().toLowerCase()) ? TYPE_ATTR_RE : null\n}\n\ntype ViteTransform = (code: string, id: string, options?: unknown) => Promise<{ code: string }>\n\n// what strips the types: vite's own transform, so the plugin carries no\n// compiler of its own. *Which* transform is a version question, and neither\n// answer covers the peer range (vite >= 5) alone - transformWithOxc is the one\n// vite is moving to but only exists from vite 7, while transformWithEsbuild is\n// deprecated under vite 8 and throws there unless esbuild is installed\n// separately. So it is looked up at call time: oxc where it exists, esbuild on\n// the older versions that ship it.\n//\n// Both drop unused value imports by default, because a TS transform can't tell\n// a type-only import from an unused one. That would be silent damage here: a\n// factory script's `import Row from \"./row.html\"` would vanish, taking with it\n// the specifier hoistableImports needs to pull the child into the bundle. The\n// flags below are what keep it - only `import type` is erased\nconst stripTypes = async (ts: string, file: string): Promise<string> => {\n const vite = (await import(\"vite\")) as unknown as { transformWithOxc?: ViteTransform }\n const { code } = vite.transformWithOxc\n ? await vite.transformWithOxc(ts, file, { lang: \"ts\", typescript: { onlyRemoveTypeImports: true } })\n : await transformWithEsbuild(ts, file, {\n loader: \"ts\",\n tsconfigRaw: { compilerOptions: { verbatimModuleSyntax: true } },\n })\n // a script whose only imports were `import type` comes back marked as a\n // module. `export {}` exports nothing, and it is a SyntaxError inside the\n // Function body the runtime compiles a script into\n return code.replace(/^[ \\t]*export\\s*\\{\\s*\\}\\s*;?[ \\t]*$/m, \"\")\n}\n\n// the `:setup` attribute, when it carries a value (a bare `:setup` is the\n// closed signature and can't be typed)\nconst SETUP_ATTR_RE = /(:setup\\s*=\\s*)(?:\"([^\"]*)\"|'([^']*)')/i\n// the arrow body the signature is wrapped in, so the parameter list can be\n// found again in the output without matching brackets\nconst SIGNATURE_MARKER = \"__jq79_signature__\"\n\n// a component's props signature lives in the `:setup` *attribute*, not in the\n// script body, so the body's transform never sees it - and the TypeScript mark\n// has to mean the same thing on both halves of the block, or a typed signature\n// either survives into a component the plugin just promised was JS or, for\n// `_: Props`, stops reading as a signature at all.\n//\n// It goes through the same transform as everything else, wrapped as a\n// parameter list, rather than being cut with a scanner of its own: the\n// annotation can sit on the pattern (`{ a }: Props`), on the permissive `_`, or\n// inside a default (`{ step = 1 as number }`, which the runtime would evaluate\n// and silently drop), and telling those apart is a parser's job. Both transforms\n// hand back `(<params>) => <marker>` on one line, parens intact\nconst stripSignatureTypes = async (value: string, file: string): Promise<string> => {\n const compiled = await stripTypes(`(${value}) => ${SIGNATURE_MARKER}`, file)\n const marker = compiled.indexOf(SIGNATURE_MARKER)\n if (marker === -1) return value // not the shape expected: leave it as written\n const head = compiled.slice(0, marker).trimEnd()\n const params = (head.endsWith(\"=>\") ? head.slice(0, -2) : head).trim()\n return params.startsWith(\"(\") && params.endsWith(\")\") ? params.slice(1, -1).trim() : params\n}\n\n// the signature back into a double-quoted attribute. Only `\"` needs escaping:\n// the transforms normalize string literals to double quotes, so a default the\n// author wrote as `'x'` comes back as `\"x\"` and would end the attribute early.\n// `&` is deliberately left alone - `&&` in a default is not an entity and\n// survives the parse, while escaping it would double-encode a source that\n// already wrote `&quot;`\nconst quoteAttrValue = (value: string) => value.replace(/\"/g, \"&quot;\")\n\n// compiles TypeScript script blocks to plain JS, so the runtime only ever sees\n// JS - the same deal <style lang=\"scss\"> gets, for a sharper reason. The setup\n// scanner is not a parser: `let count: number = 0` reaching it is not a syntax\n// error but a labeled statement that assigns to `number`, so it runs and leaves\n// `count` undeclared. Whichever attribute marked the block (`lang=\"ts\"` or\n// `type=\"text/typescript\"`) is dropped from the emitted tag and every other one\n// (`:setup`, `:mounted`) is left as written.\n//\n// This runs before hoistableImports reads the source, so an `import type`\n// specifier is already gone by the time the plugin decides what to bundle\nconst compileScriptBlocks = async (source: string, file: string): Promise<string> => {\n const blocks = [...source.matchAll(SCRIPT_BLOCK_RE)]\n const compiled = await Promise.all(\n blocks.map(async ([, attrs, content]) => {\n const marker = typescriptAttr(attrs)\n if (!marker) return null\n\n let rest = attrs.replace(marker, \"\").trimEnd()\n const setup = rest.match(SETUP_ATTR_RE)\n if (setup) {\n const signature = await stripSignatureTypes(setup[2] ?? setup[3], `${file}.signature.ts`)\n // a function replacement, not a string: `$&` and friends are live in a\n // replacement string and a default value is arbitrary source\n rest = rest.replace(SETUP_ATTR_RE, () => `${setup[1]}\"${quoteAttrValue(signature)}\"`)\n }\n\n return { attrs: rest, js: await stripTypes(content, `${file}.ts`) }\n })\n )\n\n let out = \"\"\n let last = 0\n blocks.forEach((block, i) => {\n const done = compiled[i]\n if (!done) return\n out += source.slice(last, block.index) + `<script${done.attrs}>${done.js}</script>`\n last = block.index + block[0].length\n })\n return out + source.slice(last)\n}\n\n// the emitted module. Literal import(\"...\") specifiers found in the\n// component's scripts become real module imports, handed to Component79 as a\n// resolution map: at runtime $__import checks the map before falling back to\n// fetch, so bundled components ship with their imports and nothing changes\n// for unbundled ones. Claimed components import as their default (a\n// Component79, matching what runtime fetch resolves to); everything else as\n// a namespace (matching native import()).\n//\n// A file's <template name=\"…\"> components are re-exported by name, so the\n// module shape is the one the file already has: default plus named. They read\n// off the instance, which is where the runtime hangs them - so in dev they are\n// bound to the *first* evaluation's definitions and a module that imports one\n// by name keeps the pre-edit child until the page reloads. The file's own\n// component patches in place, and its rendered children come from the reparse,\n// so this only shows in a component imported by name from another file.\n//\n// In dev, `hot.data` carries the exported instance across updates: importers\n// hold a reference to the *first* module evaluation's instance, so later\n// evaluations patch that same instance in place instead of exporting a new one\n// nobody sees. The patching itself is the runtime's `hotReplace` - the same\n// swap the jq79/dev server drives, from the one place that can reach a\n// component's markers. An instance only used as a definition has nothing to\n// re-render (nested clones can't be reached from this module), so it falls\n// back to a full reload.\n// `precompiled` is the precompiled script's URL, as a JS expression - present\n// only in safeEval mode\nconst componentModule = (source: string, include: RegExp, filename: string, precompiled?: string): string => {\n const hoisted = hoistableImports(source, include)\n const imports = hoisted\n .map((spec, i) =>\n include.test(spec)\n ? `import __jq79_${i} from ${JSON.stringify(spec)}`\n : `import * as __jq79_${i} from ${JSON.stringify(spec)}`\n )\n .join(\"\\n\")\n const modulesMap = `{ ${hoisted.map((spec, i) => `${JSON.stringify(spec)}: __jq79_${i}`).join(\", \")} }`\n\n // without safeEval, the module is exactly what it always was\n const safeEvalImport = precompiled ? `\\nimport { safeEval } from \"${SAFE_EVAL_ID}\"` : \"\"\n const safeEvalCall = precompiled ? `\\nawait safeEval(Component79, ${precompiled})` : \"\"\n\n return `\nimport { Component79 } from \"jq79\"${safeEvalImport}\n${imports}${safeEvalCall}\n\nconst src = ${JSON.stringify(source)}\nconst modules = ${modulesMap}\nconst filename = ${JSON.stringify(filename)}\n\nlet component\n\nif (import.meta.hot && import.meta.hot.data.component) {\n const prior = import.meta.hot.data.component\n prior.modules = modules\n prior.filename = filename\n // re-renders it where it stands, keeping its data. false means it was never\n // rendered - a definition used only as a nested component - and a reload is\n // the only way to reach the clones made from it\n if (!prior.hotReplace(src) && !prior.data) import.meta.hot.invalidate()\n component = prior\n} else {\n component = new Component79(src, { modules, filename })\n}\n\nif (import.meta.hot) {\n import.meta.hot.data.component = component\n import.meta.hot.accept()\n}\n\nexport default component\n${declaredComponents(source).map(name => `export const ${name} = component.${name}`).join(\"\\n\")}\n`\n}\n\nexport function jq79(options: Jq79PluginOptions = {}): Plugin {\n const include = options.include ?? /\\.html$/\n const { exclude } = options\n const safeEval = safeEvalOptions(options.safeEval)\n // dev only: each component's precompiled script, by the id its module asks\n // for - so the server hands out what the plugin compiled and nothing else\n const devScripts = new Map<string, string>()\n const devIds = new Map<string, number>()\n // build only: each component's functions, by file, for the one script\n // buildEnd emits - its reference, and the file name renderChunk resolves it to\n const buildFunctions = new Map<string, CheckedFunction[]>()\n let precompiledRef: string | undefined\n let precompiledFile: string | undefined\n\n let config: ResolvedConfig | null = null\n\n return {\n name: \"jq79\",\n enforce: \"pre\",\n\n configResolved(resolved) {\n config = resolved\n },\n\n configureServer(server) {\n if (!safeEval) return\n server.middlewares.use((req, res, next) => {\n const url = new URL(req.url ?? \"/\", \"http://localhost\")\n if (!url.pathname.endsWith(PRECOMPILED_PATH)) return next()\n const script = devScripts.get(url.searchParams.get(\"id\") ?? \"\")\n if (script === undefined) return next()\n res.setHeader(\"Content-Type\", \"text/javascript\")\n res.setHeader(\"Cache-Control\", \"no-cache\")\n res.end(script)\n })\n },\n\n async resolveId(source, importer) {\n if (source === SAFE_EVAL_ID) return RESOLVED_SAFE_EVAL_ID\n if (!importer) return null // entry points are never components\n if (source.includes(\"?\")) return null // ?raw, ?url, ... keep their meaning\n if (!include.test(source)) return null\n\n const resolved = await this.resolve(source, importer, { skipSelf: true })\n if (!resolved || resolved.external) return null\n if (exclude?.test(resolved.id)) return null\n return resolved.id + COMPONENT_QUERY\n },\n\n async load(id) {\n // a Vite page's functions come from the build, so it never registers the worker\n if (id === RESOLVED_SAFE_EVAL_ID) return safeEvalModule({ ...safeEval, worker: false })\n if (!id.endsWith(COMPONENT_QUERY)) return null\n const file = id.slice(0, -COMPONENT_QUERY.length)\n\n let source = await readFile(file, \"utf8\")\n source = await compileScriptBlocks(source, file)\n if (config) source = await compileStyleBlocks(source, file, config, dep => this.addWatchFile(dep))\n\n // the runtime names the component's setup scripts after this, so devtools\n // shows a path the user recognizes instead of an anonymous VM script\n const filename = config ? relative(config.root, file) : file\n\n if (!safeEval) return { code: componentModule(source, include, filename), map: null }\n\n // the component's functions, compiled after its TypeScript and styles are:\n // the runtime compiles what reaches it, and this is what reaches it\n const functions = componentFunctions(source, message => this.warn(`jq79: ${filename}: ${message}`))\n let url: string\n if (config?.command === \"serve\") {\n let devId = devIds.get(file)\n if (devId === undefined) devIds.set(file, devId = devIds.size)\n devScripts.set(String(devId), registeringScript(functions))\n // versioned, so an edit loads the new functions rather than a cached copy\n url = JSON.stringify(`${config.base}${PRECOMPILED_PATH.slice(1)}?id=${devId}&v=${Date.now()}`)\n } else {\n buildFunctions.set(file, functions)\n url = JSON.stringify(PRECOMPILED_URL_PLACEHOLDER)\n }\n return { code: componentModule(source, include, filename, url), map: null }\n },\n\n buildStart() {\n precompiledRef = undefined\n precompiledFile = undefined\n },\n\n // the build's one precompiled script, from every component still in the\n // module graph. What earlier builds recorded is kept and pruned rather than\n // cleared in buildStart, so a watch rebuild that doesn't load a module again\n // keeps its functions. Sorted by file, so the same sources make the same\n // bytes, and the same hash\n buildEnd(error) {\n if (!safeEval || error || config?.command === \"serve\") return\n const inGraph = new Set<string>()\n for (const id of this.getModuleIds()) if (id.endsWith(COMPONENT_QUERY)) inGraph.add(id.slice(0, -COMPONENT_QUERY.length))\n for (const file of buildFunctions.keys()) if (!inGraph.has(file)) buildFunctions.delete(file)\n if (buildFunctions.size === 0) return\n const functions = [...buildFunctions.keys()].sort().flatMap(file => buildFunctions.get(file)!)\n precompiledRef = this.emitFile({ type: \"asset\", name: PRECOMPILED_ASSET, source: registeringScript(functions) })\n },\n\n // the placeholder, as what import.meta.ROLLUP_FILE_URL_<ref> renders to:\n // the asset's path relative to the chunk, against the chunk's own URL - so\n // `base` doesn't matter. Before minification, and part of the chunk's hash.\n // The source map is left as it is: the placeholder sits on a line of its\n // own with only `)` after it\n renderChunk(code, chunk) {\n if (precompiledRef === undefined || !code.includes(PRECOMPILED_URL_PLACEHOLDER)) return null\n precompiledFile = this.getFileName(precompiledRef)\n const path = JSON.stringify(posix.relative(posix.dirname(chunk.fileName), precompiledFile))\n return { code: code.replace(PRECOMPILED_URL_PLACEHOLDER_RE, () => `new URL(${path}, import.meta.url).href`), map: null }\n },\n\n // a page that waits for the script asks for it as it parses, rather than\n // once its entry has loaded and run. Same URL as the module's\n // (precompiledHref), and no crossorigin, as the <script> has none: a\n // preload is only reused by a request that matches it. Vite's html.cspNonce\n // stamps it with the nonce, after this hook - without it,\n // `script-src 'nonce-…'` refuses a preload. Build only: dev has one script\n // per component, versioned per edit. Vite writes the page's <script> tags\n // before it runs this hook, in every version the plugin supports\n transformIndexHtml(html, ctx) {\n if (!safeEval || !precompiledFile || !ctx.bundle || !ctx.chunk) return\n const bundle = ctx.bundle as Record<string, BundleFile>\n if (!reachesComponent(ctx.chunk as BundleFile, bundle)) return\n const href = precompiledHref(html, bundle, precompiledFile)\n if (href === null) return\n return [{ tag: \"link\", attrs: { rel: \"preload\", as: \"script\", href }, injectTo: \"head\" }]\n },\n }\n}\n\nexport default jq79\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,uBAAgC;AAChC,kBAAoD;AAKpD,wBAA8C;AAuC9C,IAAM,kBAAkB;AA4BxB,IAAM,eAAe;AACrB,IAAM,wBAAwB,KAAK,YAAY;AAC/C,IAAM,iBAAiB,CAAC,YAAgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iDAUvB,KAAK,UAAU,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AACjD,YAAM,OAAO,KAAK,UAAU,uBAAM,SAAS,uBAAM,QAAQ,MAAM,QAAQ,GAAG,eAAe,CAAC;AAC1F,aAAO,EAAE,MAAM,KAAK,QAAQ,gCAAgC,MAAM,WAAW,IAAI,yBAAyB,GAAG,KAAK,KAAK;AAAA,IACzH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUA,mBAAmB,MAAM,KAAK;AAC5B,UAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,IAAI,UAAU,CAAC,IAAI,MAAO;AAChE,YAAM,SAAS,IAAI;AACnB,UAAI,CAAC,iBAAiB,IAAI,OAAqB,MAAM,EAAG;AACxD,YAAM,OAAO,gBAAgB,MAAM,QAAQ,eAAe;AAC1D,UAAI,SAAS,KAAM;AACnB,aAAO,CAAC,EAAE,KAAK,QAAQ,OAAO,EAAE,KAAK,WAAW,IAAI,UAAU,KAAK,GAAG,UAAU,OAAO,CAAC;AAAA,IAC1F;AAAA,EACF;AACF;AAEA,IAAO,eAAQ;","names":["i"]}
1
+ {"version":3,"sources":["../dev/vite.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\"\nimport { posix, relative } from \"node:path\"\nimport { preprocessCSS, transformWithEsbuild } from \"vite\"\nimport type { Plugin, ResolvedConfig } from \"vite\"\n// by package name rather than ../src: this file's types are emitted with dev/\n// as their root, and the generator is the runtime's own code - resolved through\n// the package's exports (external in the build, aliased to src in the tests)\nimport { precompile, precompiledScript } from \"jq79/precompile\"\n\n// Vite plugin: import .html single-file components as modules.\n//\n// import { jq79 } from \"jq79/vite\" // vite.config\n// import UserCard from \"./UserCard.html\" // app code\n//\n// The imported value is a Component79 built from the file's source - the same\n// thing `await Component79.fetch(url)` resolves to, but bundled at build time\n// instead of fetched at runtime. The component source is inlined verbatim, so\n// a file keeps working unchanged if it's ever served from public/ and loaded\n// with fetch instead - with one deliberate exception, a block that says it is\n// written in something else: <style lang=\"scss\"> (or less/stylus/sass) is\n// compiled to plain CSS here, and a TypeScript script - <script lang=\"ts\">, or\n// the same mark spelled <script type=\"text/typescript\"> - to plain JS. Such a\n// component only works through the bundler; loaded with fetch() it would reach\n// the runtime uncompiled, which the runtime warns about.\n//\n// Only .html files imported from other modules are claimed; entry points\n// (index.html) have no importer and imports carrying an explicit query\n// (?raw, ?url) keep their built-in Vite meaning.\n\nexport interface Jq79PluginOptions {\n // which import specifiers are treated as components (default: any .html)\n include?: RegExp\n // resolved absolute paths to skip even when `include` matches\n exclude?: RegExp\n // run the app without eval, for a CSP with no 'unsafe-eval' - the value\n // Component79.safeEval() takes, and meaning the same thing\n // (RECORD/2026-09-23.no-unsafe-eval.md). Every component is precompiled, and\n // their functions ship as one script beside the bundle. `true`: those and\n // nothing else - whatever the build couldn't see is reported, never evaluated.\n // `{ nonce: true }`: whatever it couldn't see (a component built from a\n // string, an edit during HMR) is built as a <script> carrying the page's nonce\n safeEval?: boolean | { nonce?: boolean }\n}\n\n// claimed modules get this suffix so their id no longer ends in \".html\" and\n// Vite's own html handling (entries, asset pipeline) leaves them alone\nconst COMPONENT_QUERY = \"?jq79\"\n\n// safeEval. Precompiled functions travel as a classic script, and not inside\n// a module: they compile under `with`, which is a SyntaxError in strict code,\n// and every module is strict. In a build it is one script for every component\n// - jq79-precompiled-[hash].js, an asset beside the chunks - and the pages that\n// need it preload it (RECORD/2026-11-04.one-precompiled-script.md); in dev each\n// component has its own, which the server hands out (PRECOMPILED_PATH). Either\n// way it pushes its functions onto the queue the runtime drains (see \"safe\n// eval\" in src/jq79.ts).\n//\n// The component's module waits for it - a top-level await - before it builds\n// anything, through a module every component module imports. That module\n// evaluates once, so safe mode is turned on once per app, and a page with no\n// nonce is reported once rather than once per component; and it loads each\n// script once, however many modules ask - in a build they all ask for the\n// same one, so the first await downloads it and the rest resolve at once. The\n// <script> carries the page's nonce when there is one, so a CSP that works by\n// nonce admits it; under `script-src 'self'` the URL is what admits it.\n//\n// Component79 is passed in rather than imported, so the module resolves\n// nothing: a bare \"jq79\" from a virtual importer is the one resolution that\n// would depend on how the app is laid out.\n//\n// A component built from a string *before* any .html module is imported runs\n// in the default mode; such an app calls Component79.safeEval itself. The\n// await needs a build target with top-level await in it - Vite 7 and later\n// have one by default; on Vite 5 or 6, raise build.target to es2022\nconst SAFE_EVAL_ID = \"virtual:jq79/safe-eval\"\nconst RESOLVED_SAFE_EVAL_ID = `\\0${SAFE_EVAL_ID}`\nconst safeEvalModule = (options: { nonce?: boolean; worker: false }) => `\nlet started = null\nconst loading = new Map()\nconst pageNonce = () => {\n for (const script of document.querySelectorAll(\"script[nonce]\")) {\n const nonce = script.nonce || script.getAttribute(\"nonce\")\n if (nonce) return nonce\n }\n}\nexport const safeEval = (Component79, url) => {\n if (!started) started = Component79.safeEval(${JSON.stringify(options)}).catch(error => console.error(error))\n let loaded = loading.get(url)\n if (!loaded) {\n loaded = new Promise((resolve, reject) => {\n const script = document.createElement(\"script\")\n const nonce = pageNonce()\n if (nonce) script.setAttribute(\"nonce\", nonce)\n script.src = url\n script.onload = () => { script.remove(); resolve() }\n script.onerror = () => {\n script.remove()\n reject(new Error(\"jq79: the precompiled functions at \" + url + \" did not load, and safeEval can't render without them\"))\n }\n document.head.append(script)\n })\n loading.set(url, loaded)\n }\n return loaded\n}\n`\n\n// where the dev server hands out a component's precompiled script\nconst PRECOMPILED_PATH = \"/@jq79/precompiled.js\"\n\n// a build's one precompiled script, named as an asset: assets/jq79-precompiled-[hash].js\nconst PRECOMPILED_ASSET = \"jq79-precompiled.js\"\n// what a component's module passes for that script's URL in a build. The asset\n// is emitted in buildEnd, once every component is known - Rolldown has no\n// setAssetSource to fill it in later, and a module is loaded before the build\n// knows the rest - so a module can't name it by reference when it's loaded;\n// renderChunk writes the URL over this\nconst PRECOMPILED_URL_PLACEHOLDER = \"__JQ79_PRECOMPILED_URL__\"\nconst PRECOMPILED_URL_PLACEHOLDER_RE = /([\"'`])__JQ79_PRECOMPILED_URL__\\1/g\n\n// the plugin's safeEval option, as what the modules pass the runtime: null\n// for off, or Component79.safeEval's own options\nconst safeEvalOptions = (option: Jq79PluginOptions[\"safeEval\"]): { nonce?: boolean } | null => {\n if (option === undefined || option === false) return null\n return typeof option === \"object\" && option !== null && option.nonce === true ? { nonce: true } : {}\n}\n\n// a scoped-form body: the runtime falls back to the `with` form when one\n// doesn't compile, so only the `with` form's failure is worth a word\nconst SCOPED_BODY_RE = /^(?:let \\$t;| return \\()/\n\n// one precompiled function, and whether it parses\ntype CheckedFunction = [params: string[], body: string, parses: boolean]\n\n// a component's precompiled functions, each compiled here first - node can,\n// where the page may not - so a script holds only functions that parse; one\n// that doesn't ships as null, and the build says so, once, with its file\nconst componentFunctions = (source: string, warn: (message: string) => void): CheckedFunction[] =>\n precompile(source).map(([params, body]) => {\n try {\n new Function(...params, body)\n return [params, body, true]\n } catch (error) {\n if (!SCOPED_BODY_RE.test(body)) warn(`${(error as Error).message}, in: ${body.length > 120 ? `${body.slice(0, 120)}…` : body}`)\n return [params, body, false]\n }\n })\n\n// the classic script that registers functions (precompiledScript, in\n// jq79/precompile): one component's in dev, every component's in a build. One\n// push, each function once - the runtime keys them by (params, body), so\n// `{{ name }}` written in ten components is one function, and a second entry\n// would only replace the first with itself\nconst registeringScript = (functions: CheckedFunction[]): string => {\n const unique = new Map<string, CheckedFunction>()\n for (const fn of functions) {\n const key = JSON.stringify([fn[0], fn[1]])\n if (!unique.has(key)) unique.set(key, fn)\n }\n return precompiledScript(\n [...unique.values()].map(([params, body]) => [params, body]),\n (params, body) => unique.get(JSON.stringify([params, body]))?.[2] ?? false\n )\n}\n\ntype BundleFile = { type: string; fileName: string; moduleIds?: string[]; imports?: string[] }\n\n// whether a page's entry chunk waits for the precompiled script as it loads:\n// it, or a chunk it imports statically, holds a component module. A component\n// behind import() asks for the script when it is imported, and a preload the\n// page doesn't use straight away only earns a warning in the console\nconst reachesComponent = (entry: BundleFile, bundle: Record<string, BundleFile>): boolean => {\n const seen = new Set<string>()\n const visit = (chunk: BundleFile | undefined): boolean => {\n if (!chunk || chunk.type !== \"chunk\" || seen.has(chunk.fileName)) return false\n seen.add(chunk.fileName)\n return (chunk.moduleIds ?? []).some(id => id.endsWith(COMPONENT_QUERY)) || (chunk.imports ?? []).some(file => visit(bundle[file]))\n }\n return visit(entry)\n}\n\n// a <script src>, quote-aware, and not a data-src\nconst SCRIPT_SRC_RE = /<script\\b(?:\"[^\"]*\"|'[^']*'|[^>\"'])*?\\ssrc\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s>]+))/gi\n\n// `file` as the page has to write it to get the URL a module asks for: the\n// file relative to the module's chunk, against that chunk's own URL - which\n// is what new URL(..., import.meta.url) resolves. The chunk's URL is read off\n// the page, from the <script src> Vite wrote for it, so `base`, a relative\n// base and renderBuiltUrl are already in it. Any of the bundle's chunks will\n// do, because chunks import each other by relative path - and it has to be\n// any: an entry that is nothing but imports gets no <script> of its own, only\n// its imports do. null when no script on the page loads one of them: no\n// preload is better than one at the wrong URL, which downloads twice\nconst precompiledHref = (html: string, bundle: Record<string, BundleFile>, file: string): string | null => {\n const chunks = Object.values(bundle).filter(out => out.type === \"chunk\").map(out => out.fileName)\n for (const match of html.matchAll(SCRIPT_SRC_RE)) {\n const src = (match[1] ?? match[2] ?? match[3]).replace(/[?#].*$/, \"\")\n const chunk = chunks.find(name => src === name || src.endsWith(`/${name}`))\n if (chunk === undefined) continue\n const path = posix.relative(posix.dirname(chunk), file)\n // a full URL, or a protocol-relative one\n if (/^(?:[a-z][a-z\\d+.-]*:)?\\/\\//i.test(src)) {\n const scheme = src.startsWith(\"//\") ? \"https:\" : \"\"\n return new URL(path, scheme + src).href.slice(scheme.length)\n }\n const href = posix.join(posix.dirname(src), path)\n return src.startsWith(\"/\") || href.startsWith(\".\") ? href : `./${href}`\n }\n return null\n}\n\n// a <script> block with its attribute string, so `lang` can be read and the\n// body replaced - the same shape as STYLE_BLOCK_RE below, quote-aware so a\n// \">\" inside an attribute value (`:setup=\"{ n = a > 1 }\"`) doesn't end the tag\nconst SCRIPT_BLOCK_RE = /<script((?:\"[^\"]*\"|'[^']*'|[^>\"'])*)>([\\s\\S]*?)<\\/script\\s*>/gi\n// import(\"...\") with a literal specifier, tried at word boundaries the\n// scanner below reaches (which is what skips $__import and foo.import(...))\nconst IMPORT_CALL_RE = /import\\s*\\(\\s*([\"'])([^\"'\\n]+?)\\1\\s*\\)/y\n// static import statements (factory scripts): optional clause + literal\n// specifier. The clause can't contain parens/quotes, so dynamic import()\n// and import.meta never match\nconst STATIC_IMPORT_RE = /import\\s*(?:[\\w$\\s,{}*]+?\\s*from\\s*)?([\"'])([^\"'\\n]+)\\1/y\n// the opening of $importAll([...]), the plural of import(): its string\n// entries are import()'s specifiers, one by one (importAllSpecifiers)\nconst IMPORT_ALL_RE = /\\$importAll\\s*\\(\\s*\\[/y\n// what may sit between the entries of that array (whitespace, comments), and\n// an entry the bundle can answer: a string literal\nconst ARRAY_GAP_RE = /(?:\\s|\\/\\/[^\\n]*|\\/\\*[\\s\\S]*?\\*\\/)*/y\nconst ARRAY_ENTRY_RE = /([\"'])([^\"'\\n]+?)\\1/y\n\nconst skipString = (src: string, start: number): number => {\n const quote = src[start]\n let i = start + 1\n while (i < src.length) {\n if (src[i] === \"\\\\\") { i += 2; continue }\n if (src[i] === quote) return i + 1\n i++\n }\n return src.length\n}\n\n// the literal import specifiers in one script body. A scanner rather than a\n// bare matchAll, because a specifier mentioned in a comment or a string is\n// not an import: hoisting a commented-out `import(\"./old.html\")` would pull\n// dead files into the bundle - or break the build once the file is gone\n// the literal entries of a $importAll([...]) whose \"[\" ends at `at`, and\n// where the scan goes on from. A literal is hoisted until the first entry that\n// isn't one: from there the array is the runtime's, as a computed import() is\nconst importAllSpecifiers = (script: string, at: number): { specs: string[]; end: number } => {\n const specs: string[] = []\n const gap = (i: number) => { ARRAY_GAP_RE.lastIndex = i; ARRAY_GAP_RE.exec(script); return ARRAY_GAP_RE.lastIndex }\n let i = gap(at)\n for (;;) {\n ARRAY_ENTRY_RE.lastIndex = i\n const entry = ARRAY_ENTRY_RE.exec(script)\n if (!entry) return { specs, end: i }\n const next = gap(ARRAY_ENTRY_RE.lastIndex)\n // a literal is an entry only when it's all of one: `\"./a\" + x` isn't\n if (script[next] !== \",\" && script[next] !== \"]\") return { specs, end: i }\n specs.push(entry[2])\n if (script[next] === \"]\") return { specs, end: next + 1 }\n i = gap(next + 1)\n }\n}\n\nconst importSpecifiers = (script: string): string[] => {\n const specs: string[] = []\n let i = 0\n while (i < script.length) {\n const ch = script[i]\n if (ch === \"'\" || ch === '\"' || ch === \"`\") { i = skipString(script, i); continue }\n if (ch === \"/\" && script[i + 1] === \"/\") {\n const end = script.indexOf(\"\\n\", i)\n i = end === -1 ? script.length : end + 1\n continue\n }\n if (ch === \"/\" && script[i + 1] === \"*\") {\n const end = script.indexOf(\"*/\", i + 2)\n i = end === -1 ? script.length : end + 2\n continue\n }\n if (ch === \"i\" && (i === 0 || !/[\\w$.]/.test(script[i - 1]))) {\n IMPORT_CALL_RE.lastIndex = i\n const call = IMPORT_CALL_RE.exec(script)\n if (call) { specs.push(call[2]); i = IMPORT_CALL_RE.lastIndex; continue }\n STATIC_IMPORT_RE.lastIndex = i\n const staticImport = STATIC_IMPORT_RE.exec(script)\n if (staticImport) { specs.push(staticImport[2]); i = STATIC_IMPORT_RE.lastIndex; continue }\n }\n // $importAll, not C79.importAll: the static one means the page, so it\n // stays the runtime's (the \".\" before it is what the guard skips)\n if (ch === \"$\" && (i === 0 || !/[\\w$.]/.test(script[i - 1]))) {\n IMPORT_ALL_RE.lastIndex = i\n if (IMPORT_ALL_RE.exec(script)) {\n const { specs: entries, end } = importAllSpecifiers(script, IMPORT_ALL_RE.lastIndex)\n specs.push(...entries)\n i = end\n continue\n }\n }\n i++\n }\n return specs\n}\n\nconst isHtmlUrl = (spec: string) => /\\.html?([?#]|$)/.test(spec)\nconst isExternalUrl = (spec: string) => /^[a-z][a-z0-9+.-]*:/i.test(spec) || spec.startsWith(\"/\")\n\n// literal import specifiers in the component's script blocks - dynamic\n// `import(\"...\")` calls, the entries of `$importAll([...])` and static\n// factory-script imports - that should\n// resolve from the bundle instead of at runtime. Absolute paths and full\n// URLs are left alone (they point at served files, e.g. public/), and so\n// are .html specifiers the plugin wouldn't claim as components\nconst hoistableImports = (source: string, include: RegExp): string[] => {\n const specifiers = new Set<string>()\n for (const [, , script] of source.matchAll(SCRIPT_BLOCK_RE)) {\n for (const spec of importSpecifiers(script)) {\n if (isExternalUrl(spec)) continue\n if (isHtmlUrl(spec) && !include.test(spec)) continue // html left to runtime fetch\n specifiers.add(spec) // a claimed component, a source file or an npm package\n }\n }\n return [...specifiers]\n}\n\n// any start or end tag, quote-aware so a \">\" inside an attribute value doesn't\n// end it early\nconst TAG_RE = /<(\\/?)([A-Za-z][\\w-]*)((?:\"[^\"]*\"|'[^']*'|[^>\"'])*)>/g\nconst NAME_ATTR_RE = /\\bname\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')/i\nconst COMPONENT_NAME_RE = /^[A-Z][A-Za-z0-9]*$/\nconst VOID_ELEMENTS = new Set([\n \"area\", \"base\", \"br\", \"col\", \"embed\", \"hr\", \"img\", \"input\",\n \"link\", \"meta\", \"param\", \"source\", \"track\", \"wbr\",\n])\n\n// the components a file declares: its *top-level* <template name=\"…\"> blocks,\n// which the emitted module re-exports by name. Depth is tracked because only\n// the top level declares - a <template> nested in the markup is a plain inert\n// element the runtime leaves alone, and exporting it would name something that\n// never exists. Script and style bodies are cut out first, so a \"<\" in JS or a\n// selector can't be read as a tag\nconst declaredComponents = (source: string): string[] => {\n const markup = source.replace(SCRIPT_BLOCK_RE, \"\").replace(STYLE_BLOCK_RE, \"\")\n const names: string[] = []\n let depth = 0\n\n for (const [, closing, tag, attrs] of markup.matchAll(TAG_RE)) {\n if (closing) {\n depth = Math.max(0, depth - 1)\n continue\n }\n const selfClosing = /\\/\\s*$/.test(attrs) || VOID_ELEMENTS.has(tag.toLowerCase())\n if (depth === 0 && !selfClosing && tag.toLowerCase() === \"template\") {\n const declared = attrs.match(NAME_ATTR_RE)\n const name = declared?.[1] ?? declared?.[2]\n // the runtime warns about the ones this skips (nameless, not PascalCase)\n if (name && COMPONENT_NAME_RE.test(name)) names.push(name)\n }\n if (!selfClosing) depth++\n }\n return names\n}\n\n// a <style> block with its attribute string, so `lang` can be read and the\n// content replaced. Attribute values are matched as quoted chunks so a \">\"\n// inside one doesn't end the tag early\nconst STYLE_BLOCK_RE = /<style((?:\"[^\"]*\"|'[^']*'|[^>\"'])*)>([\\s\\S]*?)<\\/style\\s*>/gi\n// one attribute of a tag's attribute string: its name (lowercased, as the HTML\n// parser reads it), its value (null for a bare `scoped`), and where it sits -\n// `start` at the whitespace before it, so cutting [start, end) removes it cleanly\ntype AttrSpan = { name: string; value: string | null; start: number; end: number }\n\n// a tag's attribute string read the way the HTML parser reads it: name, then an\n// optional `=` and a double-quoted, single-quoted or bare value. A regex over the\n// whole string can't do this - `\\blang\\s*=` also matches *inside* a value, and a\n// prop with a default (`:setup=\"{ lang = 'en' }\"`) then reads as the script's\n// language, ahead of the real `lang=\"ts\"`\nconst readAttrs = (attrs: string): AttrSpan[] => {\n const spans: AttrSpan[] = []\n const space = /[\\s/]/\n let i = 0\n while (i < attrs.length) {\n const start = i\n while (i < attrs.length && space.test(attrs[i])) i++\n const nameStart = i\n while (i < attrs.length && !/[\\s/=>]/.test(attrs[i])) i++\n if (i === nameStart) {\n if (i >= attrs.length) break\n i++ // a stray `=` or `>`: skip it\n continue\n }\n const name = attrs.slice(nameStart, i).toLowerCase()\n let j = i\n while (j < attrs.length && /\\s/.test(attrs[j])) j++\n let value: string | null = null\n if (attrs[j] === \"=\") {\n j++\n while (j < attrs.length && /\\s/.test(attrs[j])) j++\n const quote = attrs[j]\n if (quote === '\"' || quote === \"'\") {\n const close = attrs.indexOf(quote, j + 1)\n const end = close === -1 ? attrs.length : close\n value = attrs.slice(j + 1, end)\n i = close === -1 ? end : end + 1\n } else {\n const valueStart = j\n while (j < attrs.length && !/[\\s>]/.test(attrs[j])) j++\n value = attrs.slice(valueStart, j)\n i = j\n }\n }\n spans.push({ name, value, start, end: i })\n }\n return spans\n}\n\nconst findAttr = (attrs: string, name: string): AttrSpan | undefined =>\n readAttrs(attrs).find(a => a.name === name)\n\n// the attribute string without one attribute (and the whitespace before it)\nconst dropAttr = (attrs: string, span: AttrSpan): string => attrs.slice(0, span.start) + attrs.slice(span.end)\n\n// compiles <style lang=\"scss|less|styl|sass\"> blocks to plain CSS with Vite's\n// own preprocessing (the same call @vitejs/plugin-vue makes), so the runtime\n// only ever sees CSS. The preprocessor picks its parser from the extension,\n// and resolving relative @use/@import against a filename in the component's\n// own directory is what makes `@use \"./vars\"` work. Files the preprocessor\n// pulls in are registered as watch deps, so editing a partial re-runs HMR for\n// every component that uses it. `lang` is dropped from the emitted tag: what\n// the runtime parses is a plain <style> (with `scoped` and the rest intact)\nconst compileStyleBlocks = async (\n source: string,\n file: string,\n config: ResolvedConfig,\n addWatchFile: (id: string) => void\n): Promise<string> => {\n const blocks = [...source.matchAll(STYLE_BLOCK_RE)]\n const compiled = await Promise.all(\n blocks.map(async ([, attrs, content]) => {\n const lang = findAttr(attrs, \"lang\")\n if (!lang?.value) return null\n const result = await preprocessCSS(content, `${file}.${lang.value}`, config)\n result.deps?.forEach(addWatchFile)\n return { attrs: dropAttr(attrs, lang).trimEnd(), css: result.code }\n })\n )\n\n let out = \"\"\n let last = 0\n blocks.forEach((block, i) => {\n const done = compiled[i]\n if (!done) return\n out += source.slice(last, block.index) + `<style${done.attrs}>${done.css}</style>`\n last = block.index + block[0].length\n })\n return out + source.slice(last)\n}\n\n// languages a <script lang> is compiled from. Anything else is left as written\n// for the runtime to warn about, rather than guessed at\nconst TS_LANGS = new Set([\"ts\", \"typescript\"])\n// the other spelling of the same mark. A component is a plain .html file, not\n// an SFC, so nothing in an editor knows what `lang` means there, and each mark\n// gets half of one: VS Code's HTML language service checks a `type` of\n// text/typescript as TypeScript (and `lang=\"ts\"` as JavaScript), while its\n// grammar colors that `type` not at all (and `lang=\"ts\"` as JavaScript). See\n// docs/vite-plugin.md#which-mark-in-vs-code. The `x-` forms are the historical\n// spelling of the same two media types\nconst TS_TYPE_RE = /^(?:text|application)\\/(?:x-)?typescript$/\n\n// what marks a script block as TypeScript, given back as the attribute to drop\n// from the emitted tag - the block is compiled to JS, so the mark goes with the\n// types whichever one carried it. A `lang` answers on its own: `lang=\"coffee\"`\n// is a language this plugin doesn't compile, and reading `type` past it would\n// compile a block the author said was something else\nconst typescriptAttr = (attrs: string): AttrSpan | null => {\n const lang = findAttr(attrs, \"lang\")\n if (lang?.value != null) return TS_LANGS.has(lang.value.trim().toLowerCase()) ? lang : null\n const type = findAttr(attrs, \"type\")\n return type?.value != null && TS_TYPE_RE.test(type.value.trim().toLowerCase()) ? type : null\n}\n\ntype ViteTransform = (code: string, id: string, options?: unknown) => Promise<{ code: string }>\n\n// what strips the types: vite's own transform, so the plugin carries no\n// compiler of its own. *Which* transform is a version question, and neither\n// answer covers the peer range (vite >= 5) alone - transformWithOxc is the one\n// vite is moving to but only exists from vite 7, while transformWithEsbuild is\n// deprecated under vite 8 and throws there unless esbuild is installed\n// separately. So it is looked up at call time: oxc where it exists, esbuild on\n// the older versions that ship it.\n//\n// Both drop unused value imports by default, because a TS transform can't tell\n// a type-only import from an unused one. That would be silent damage here: a\n// factory script's `import Row from \"./row.html\"` would vanish, taking with it\n// the specifier hoistableImports needs to pull the child into the bundle. The\n// flags below are what keep it - only `import type` is erased\nconst stripTypes = async (ts: string, file: string): Promise<string> => {\n const vite = (await import(\"vite\")) as unknown as { transformWithOxc?: ViteTransform }\n const { code } = vite.transformWithOxc\n ? await vite.transformWithOxc(ts, file, { lang: \"ts\", typescript: { onlyRemoveTypeImports: true } })\n : await transformWithEsbuild(ts, file, {\n loader: \"ts\",\n tsconfigRaw: { compilerOptions: { verbatimModuleSyntax: true } },\n })\n // a script whose only imports were `import type` comes back marked as a\n // module. `export {}` exports nothing, and it is a SyntaxError inside the\n // Function body the runtime compiles a script into\n return code.replace(/^[ \\t]*export\\s*\\{\\s*\\}\\s*;?[ \\t]*$/m, \"\")\n}\n\n// the arrow body the signature is wrapped in, so the parameter list can be\n// found again in the output without matching brackets\nconst SIGNATURE_MARKER = \"__jq79_signature__\"\n\n// a component's props signature lives in the `:setup` *attribute*, not in the\n// script body, so the body's transform never sees it - and the TypeScript mark\n// has to mean the same thing on both halves of the block, or a typed signature\n// either survives into a component the plugin just promised was JS or, for\n// `_: Props`, stops reading as a signature at all.\n//\n// It goes through the same transform as everything else, wrapped as a\n// parameter list, rather than being cut with a scanner of its own: the\n// annotation can sit on the pattern (`{ a }: Props`), on the permissive `_`, or\n// inside a default (`{ step = 1 as number }`, which the runtime would evaluate\n// and silently drop), and telling those apart is a parser's job. Both transforms\n// hand back `(<params>) => <marker>` on one line, parens intact\nconst stripSignatureTypes = async (value: string, file: string): Promise<string> => {\n const compiled = await stripTypes(`(${value}) => ${SIGNATURE_MARKER}`, file)\n const marker = compiled.indexOf(SIGNATURE_MARKER)\n if (marker === -1) return value // not the shape expected: leave it as written\n const head = compiled.slice(0, marker).trimEnd()\n const params = (head.endsWith(\"=>\") ? head.slice(0, -2) : head).trim()\n return params.startsWith(\"(\") && params.endsWith(\")\") ? params.slice(1, -1).trim() : params\n}\n\n// the signature back into a double-quoted attribute. Only `\"` needs escaping:\n// the transforms normalize string literals to double quotes, so a default the\n// author wrote as `'x'` comes back as `\"x\"` and would end the attribute early.\n// `&` is deliberately left alone - `&&` in a default is not an entity and\n// survives the parse, while escaping it would double-encode a source that\n// already wrote `&quot;`\nconst quoteAttrValue = (value: string) => value.replace(/\"/g, \"&quot;\")\n\n// compiles TypeScript script blocks to plain JS, so the runtime only ever sees\n// JS - the same deal <style lang=\"scss\"> gets, for a sharper reason. The setup\n// scanner is not a parser: `let count: number = 0` reaching it is not a syntax\n// error but a labeled statement that assigns to `number`, so it runs and leaves\n// `count` undeclared. Whichever attribute marked the block (`lang=\"ts\"` or\n// `type=\"text/typescript\"`) is dropped from the emitted tag and every other one\n// (`:setup`, `:mounted`) is left as written.\n//\n// This runs before hoistableImports reads the source, so an `import type`\n// specifier is already gone by the time the plugin decides what to bundle\nconst compileScriptBlocks = async (source: string, file: string): Promise<string> => {\n const blocks = [...source.matchAll(SCRIPT_BLOCK_RE)]\n const compiled = await Promise.all(\n blocks.map(async ([, attrs, content]) => {\n const marker = typescriptAttr(attrs)\n if (!marker) return null\n\n let rest = dropAttr(attrs, marker).trimEnd()\n // the `:setup` attribute, when it carries a value (a bare `:setup` is the\n // closed signature and can't be typed)\n const setup = findAttr(rest, \":setup\")\n if (setup?.value != null) {\n const signature = await stripSignatureTypes(setup.value, `${file}.signature.ts`)\n const before = rest.slice(setup.start, setup.end).match(/^\\s*/)![0]\n rest = rest.slice(0, setup.start) + `${before}:setup=\"${quoteAttrValue(signature)}\"` + rest.slice(setup.end)\n }\n\n return { attrs: rest, js: await stripTypes(content, `${file}.ts`) }\n })\n )\n\n let out = \"\"\n let last = 0\n blocks.forEach((block, i) => {\n const done = compiled[i]\n if (!done) return\n out += source.slice(last, block.index) + `<script${done.attrs}>${done.js}</script>`\n last = block.index + block[0].length\n })\n return out + source.slice(last)\n}\n\n// the emitted module. Literal import(\"...\") specifiers found in the\n// component's scripts become real module imports, handed to Component79 as a\n// resolution map: at runtime $__import checks the map before falling back to\n// fetch, so bundled components ship with their imports and nothing changes\n// for unbundled ones. Claimed components import as their default (a\n// Component79, matching what runtime fetch resolves to); everything else as\n// a namespace (matching native import()).\n//\n// A file's <template name=\"…\"> components are re-exported by name, so the\n// module shape is the one the file already has: default plus named. They read\n// off the instance, which is where the runtime hangs them - so in dev they are\n// bound to the *first* evaluation's definitions and a module that imports one\n// by name keeps the pre-edit child until the page reloads. The file's own\n// component patches in place, and its rendered children come from the reparse,\n// so this only shows in a component imported by name from another file.\n//\n// In dev, `hot.data` carries the exported instance across updates: importers\n// hold a reference to the *first* module evaluation's instance, so later\n// evaluations patch that same instance in place instead of exporting a new one\n// nobody sees. The patching itself is the runtime's `hotReplace` - the same\n// swap the jq79/dev server drives, from the one place that can reach a\n// component's markers. An instance only used as a definition has nothing to\n// re-render (nested clones can't be reached from this module), so it falls\n// back to a full reload.\n// `precompiled` is the precompiled script's URL, as a JS expression - present\n// only in safeEval mode\nconst componentModule = (source: string, include: RegExp, filename: string, precompiled?: string): string => {\n const hoisted = hoistableImports(source, include)\n const imports = hoisted\n .map((spec, i) =>\n include.test(spec)\n ? `import __jq79_${i} from ${JSON.stringify(spec)}`\n : `import * as __jq79_${i} from ${JSON.stringify(spec)}`\n )\n .join(\"\\n\")\n const modulesMap = `{ ${hoisted.map((spec, i) => `${JSON.stringify(spec)}: __jq79_${i}`).join(\", \")} }`\n\n // without safeEval, the module is exactly what it always was\n const safeEvalImport = precompiled ? `\\nimport { safeEval } from \"${SAFE_EVAL_ID}\"` : \"\"\n const safeEvalCall = precompiled ? `\\nawait safeEval(Component79, ${precompiled})` : \"\"\n\n return `\nimport { Component79 } from \"jq79\"${safeEvalImport}\n${imports}${safeEvalCall}\n\nconst src = ${JSON.stringify(source)}\nconst modules = ${modulesMap}\nconst filename = ${JSON.stringify(filename)}\n\nlet component\n\nif (import.meta.hot && import.meta.hot.data.component) {\n const prior = import.meta.hot.data.component\n prior.modules = modules\n prior.filename = filename\n // re-renders it where it stands, keeping its data. false means it was never\n // rendered - a definition used only as a nested component - and a reload is\n // the only way to reach the clones made from it\n if (!prior.hotReplace(src) && !prior.data) import.meta.hot.invalidate()\n component = prior\n} else {\n component = new Component79(src, { modules, filename })\n}\n\nif (import.meta.hot) {\n import.meta.hot.data.component = component\n import.meta.hot.accept()\n}\n\nexport default component\n${declaredComponents(source).map(name => `export const ${name} = component.${name}`).join(\"\\n\")}\n`\n}\n\nexport function jq79(options: Jq79PluginOptions = {}): Plugin {\n const include = options.include ?? /\\.html$/\n const { exclude } = options\n const safeEval = safeEvalOptions(options.safeEval)\n // dev only: each component's precompiled script, by the id its module asks\n // for - so the server hands out what the plugin compiled and nothing else\n const devScripts = new Map<string, string>()\n const devIds = new Map<string, number>()\n // build only: each component's functions, by file, for the one script\n // buildEnd emits - its reference, and the file name renderChunk resolves it to\n const buildFunctions = new Map<string, CheckedFunction[]>()\n let precompiledRef: string | undefined\n let precompiledFile: string | undefined\n\n let config: ResolvedConfig | null = null\n\n return {\n name: \"jq79\",\n enforce: \"pre\",\n\n configResolved(resolved) {\n config = resolved\n },\n\n configureServer(server) {\n if (!safeEval) return\n server.middlewares.use((req, res, next) => {\n const url = new URL(req.url ?? \"/\", \"http://localhost\")\n if (!url.pathname.endsWith(PRECOMPILED_PATH)) return next()\n const script = devScripts.get(url.searchParams.get(\"id\") ?? \"\")\n if (script === undefined) return next()\n res.setHeader(\"Content-Type\", \"text/javascript\")\n res.setHeader(\"Cache-Control\", \"no-cache\")\n res.end(script)\n })\n },\n\n async resolveId(source, importer) {\n if (source === SAFE_EVAL_ID) return RESOLVED_SAFE_EVAL_ID\n if (!importer) return null // entry points are never components\n if (source.includes(\"?\")) return null // ?raw, ?url, ... keep their meaning\n if (!include.test(source)) return null\n\n const resolved = await this.resolve(source, importer, { skipSelf: true })\n if (!resolved || resolved.external) return null\n if (exclude?.test(resolved.id)) return null\n return resolved.id + COMPONENT_QUERY\n },\n\n async load(id) {\n // a Vite page's functions come from the build, so it never registers the worker\n if (id === RESOLVED_SAFE_EVAL_ID) return safeEvalModule({ ...safeEval, worker: false })\n if (!id.endsWith(COMPONENT_QUERY)) return null\n const file = id.slice(0, -COMPONENT_QUERY.length)\n\n let source = await readFile(file, \"utf8\")\n source = await compileScriptBlocks(source, file)\n if (config) source = await compileStyleBlocks(source, file, config, dep => this.addWatchFile(dep))\n\n // the runtime names the component's setup scripts after this, so devtools\n // shows a path the user recognizes instead of an anonymous VM script\n const filename = config ? relative(config.root, file) : file\n\n if (!safeEval) return { code: componentModule(source, include, filename), map: null }\n\n // the component's functions, compiled after its TypeScript and styles are:\n // the runtime compiles what reaches it, and this is what reaches it\n const functions = componentFunctions(source, message => this.warn(`jq79: ${filename}: ${message}`))\n let url: string\n if (config?.command === \"serve\") {\n let devId = devIds.get(file)\n if (devId === undefined) devIds.set(file, devId = devIds.size)\n devScripts.set(String(devId), registeringScript(functions))\n // versioned, so an edit loads the new functions rather than a cached copy\n url = JSON.stringify(`${config.base}${PRECOMPILED_PATH.slice(1)}?id=${devId}&v=${Date.now()}`)\n } else {\n buildFunctions.set(file, functions)\n url = JSON.stringify(PRECOMPILED_URL_PLACEHOLDER)\n }\n return { code: componentModule(source, include, filename, url), map: null }\n },\n\n buildStart() {\n precompiledRef = undefined\n precompiledFile = undefined\n },\n\n // the build's one precompiled script, from every component still in the\n // module graph. What earlier builds recorded is kept and pruned rather than\n // cleared in buildStart, so a watch rebuild that doesn't load a module again\n // keeps its functions. Sorted by file, so the same sources make the same\n // bytes, and the same hash\n buildEnd(error) {\n if (!safeEval || error || config?.command === \"serve\") return\n const inGraph = new Set<string>()\n for (const id of this.getModuleIds()) if (id.endsWith(COMPONENT_QUERY)) inGraph.add(id.slice(0, -COMPONENT_QUERY.length))\n for (const file of buildFunctions.keys()) if (!inGraph.has(file)) buildFunctions.delete(file)\n if (buildFunctions.size === 0) return\n const functions = [...buildFunctions.keys()].sort().flatMap(file => buildFunctions.get(file)!)\n precompiledRef = this.emitFile({ type: \"asset\", name: PRECOMPILED_ASSET, source: registeringScript(functions) })\n },\n\n // the placeholder, as what import.meta.ROLLUP_FILE_URL_<ref> renders to:\n // the asset's path relative to the chunk, against the chunk's own URL - so\n // `base` doesn't matter. Before minification, and part of the chunk's hash.\n // The source map is left as it is: the placeholder sits on a line of its\n // own with only `)` after it\n renderChunk(code, chunk) {\n if (precompiledRef === undefined || !code.includes(PRECOMPILED_URL_PLACEHOLDER)) return null\n precompiledFile = this.getFileName(precompiledRef)\n const path = JSON.stringify(posix.relative(posix.dirname(chunk.fileName), precompiledFile))\n return { code: code.replace(PRECOMPILED_URL_PLACEHOLDER_RE, () => `new URL(${path}, import.meta.url).href`), map: null }\n },\n\n // a page that waits for the script asks for it as it parses, rather than\n // once its entry has loaded and run. Same URL as the module's\n // (precompiledHref), and no crossorigin, as the <script> has none: a\n // preload is only reused by a request that matches it. Vite's html.cspNonce\n // stamps it with the nonce, after this hook - without it,\n // `script-src 'nonce-…'` refuses a preload. Build only: dev has one script\n // per component, versioned per edit. Vite writes the page's <script> tags\n // before it runs this hook, in every version the plugin supports\n transformIndexHtml(html, ctx) {\n if (!safeEval || !precompiledFile || !ctx.bundle || !ctx.chunk) return\n const bundle = ctx.bundle as Record<string, BundleFile>\n if (!reachesComponent(ctx.chunk as BundleFile, bundle)) return\n const href = precompiledHref(html, bundle, precompiledFile)\n if (href === null) return\n return [{ tag: \"link\", attrs: { rel: \"preload\", as: \"script\", href }, injectTo: \"head\" }]\n },\n }\n}\n\nexport default jq79\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,uBAAgC;AAChC,kBAAoD;AAKpD,wBAA8C;AAuC9C,IAAM,kBAAkB;AA4BxB,IAAM,eAAe;AACrB,IAAM,wBAAwB,KAAK,YAAY;AAC/C,IAAM,iBAAiB,CAAC,YAAgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iDAUvB,KAAK,UAAU,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBxE,IAAM,mBAAmB;AAGzB,IAAM,oBAAoB;AAM1B,IAAM,8BAA8B;AACpC,IAAM,iCAAiC;AAIvC,IAAM,kBAAkB,CAAC,WAAsE;AAC7F,MAAI,WAAW,UAAa,WAAW,MAAO,QAAO;AACrD,SAAO,OAAO,WAAW,YAAY,WAAW,QAAQ,OAAO,UAAU,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAC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