@stacksjs/stx 0.2.209 → 0.2.211
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/{chunk-7ry55nms.js → chunk-1306tswx.js} +1 -1
- package/dist/{chunk-1bq2xyax.js → chunk-1jeyh1e2.js} +1 -1
- package/dist/{chunk-kjr22neh.js → chunk-1nm2xrvq.js} +1 -1
- package/dist/{chunk-ycn1vnv2.js → chunk-1nnpwrqj.js} +1 -1
- package/dist/{chunk-syy7d9w2.js → chunk-1qkk4mrm.js} +1 -1
- package/dist/chunk-2bkqbmkn.js +2 -0
- package/dist/chunk-2kjp90p2.js +2 -0
- package/dist/chunk-2md83wew.js +2 -0
- package/dist/{chunk-mjt5e2jy.js → chunk-2me28xee.js} +1 -1
- package/dist/{chunk-jr5tp4ks.js → chunk-2w5d5tw1.js} +1 -1
- package/dist/chunk-2xeq5xnf.js +2 -0
- package/dist/chunk-3bgyqx5b.js +2 -0
- package/dist/{chunk-nye9brje.js → chunk-3fwn9edg.js} +1 -1
- package/dist/{chunk-zda3hvde.js → chunk-3twce5kp.js} +1 -1
- package/dist/{chunk-dtmwr674.js → chunk-3wd9kfyz.js} +1 -1
- package/dist/chunk-47mx5vng.js +2 -0
- package/dist/{chunk-wnaddtv3.js → chunk-47pge5gz.js} +1 -1
- package/dist/chunk-4vwxgmg0.js +2 -0
- package/dist/{chunk-x0ks1fer.js → chunk-53ajah3v.js} +1 -1
- package/dist/{chunk-e0bk1mqp.js → chunk-591jpt6f.js} +1 -1
- package/dist/chunk-5gb8d966.js +2 -0
- package/dist/{chunk-a2899x2t.js → chunk-5gr4vv7m.js} +1 -1
- package/dist/chunk-5ya35fex.js +2 -0
- package/dist/{chunk-whq99ytc.js → chunk-6ndvtzpk.js} +1 -1
- package/dist/{chunk-bmpkpgx2.js → chunk-6xd5p5v3.js} +10 -10
- package/dist/{chunk-x0zh76yv.js → chunk-6xg3j487.js} +1 -1
- package/dist/{chunk-h2wpnxrh.js → chunk-7mst8kqm.js} +1 -1
- package/dist/{chunk-r41nsgym.js → chunk-7zk48rd8.js} +1 -1
- package/dist/{chunk-44423f7c.js → chunk-81w2xqas.js} +1 -1
- package/dist/{chunk-n35c984x.js → chunk-85144680.js} +2 -2
- package/dist/{chunk-xp3fp266.js → chunk-8anh6d36.js} +1 -1
- package/dist/{chunk-n9eahkjg.js → chunk-8bmsw6gq.js} +85 -85
- package/dist/chunk-8xtvmwpr.js +2 -0
- package/dist/{chunk-ryjpp51z.js → chunk-96kpqgh3.js} +1 -1
- package/dist/{chunk-ygr11tgz.js → chunk-a2rj5ce0.js} +1 -1
- package/dist/{chunk-3nmpfsw5.js → chunk-aw9z3m10.js} +1 -1
- package/dist/chunk-ba18hn7n.js +2 -0
- package/dist/{chunk-cm0ykjs1.js → chunk-ba6v2wh0.js} +1 -1
- package/dist/{chunk-abpw3b39.js → chunk-bsr7yrxh.js} +1 -1
- package/dist/{chunk-5n0dt838.js → chunk-c0p9kf53.js} +1 -1
- package/dist/{chunk-5xpp3z95.js → chunk-c18nh1et.js} +1 -1
- package/dist/{chunk-dhpy0h9y.js → chunk-c7pvwvse.js} +1 -1
- package/dist/{chunk-vr3qtsj4.js → chunk-cqt6ry1e.js} +1 -1
- package/dist/{chunk-rs2fa3g1.js → chunk-cr7s8q08.js} +1 -1
- package/dist/{chunk-gcns5vw5.js → chunk-d12xfcjd.js} +1 -1
- package/dist/chunk-d9b00zcd.js +2 -0
- package/dist/{chunk-m0sd10cs.js → chunk-dt787jv4.js} +1 -1
- package/dist/chunk-evjs9zqm.js +2 -0
- package/dist/{chunk-wtengj6h.js → chunk-f6jm4hy3.js} +1 -1
- package/dist/chunk-f7fhjvbe.js +2 -0
- package/dist/{chunk-evxg9pe7.js → chunk-gyxe9fzm.js} +1 -1
- package/dist/chunk-hdg7t3zs.js +2 -0
- package/dist/{chunk-8src5smc.js → chunk-j0tfxbns.js} +2 -2
- package/dist/{chunk-nsjyn31z.js → chunk-j5vyt8wd.js} +1 -1
- package/dist/{chunk-gcnrdgrq.js → chunk-khrtzbxd.js} +1 -1
- package/dist/chunk-kjw1ha92.js +2 -0
- package/dist/chunk-kmgs48jy.js +2 -0
- package/dist/chunk-kregsntr.js +2 -0
- package/dist/{chunk-cbc56wpd.js → chunk-m2mhtpwy.js} +1 -1
- package/dist/chunk-mghyceb1.js +2 -0
- package/dist/chunk-mpt8ed9w.js +2 -0
- package/dist/{chunk-mkm91b6w.js → chunk-msjzqne1.js} +1 -1
- package/dist/{chunk-7w4c5w2b.js → chunk-ne8sygmy.js} +1 -1
- package/dist/{chunk-ndnc7k2n.js → chunk-p7qqbw2k.js} +1 -1
- package/dist/{chunk-xfp10a23.js → chunk-p8pyqr7p.js} +1 -1
- package/dist/{chunk-0ae6chzd.js → chunk-q4se9rtw.js} +1 -1
- package/dist/{chunk-jvqjh17y.js → chunk-qfsgw9by.js} +3 -3
- package/dist/{chunk-910sy8sk.js → chunk-qph3esct.js} +1 -1
- package/dist/chunk-r153ybwd.js +2 -0
- package/dist/{chunk-vydqh4xr.js → chunk-r5hnhtp1.js} +1 -1
- package/dist/{chunk-va9k88da.js → chunk-rczpw37w.js} +1 -1
- package/dist/{chunk-jpbk42j7.js → chunk-rg6v68ya.js} +1 -1
- package/dist/{chunk-1e25ksp6.js → chunk-s7dqawk0.js} +1 -1
- package/dist/{chunk-hb83d0qc.js → chunk-srdwsrnj.js} +1 -1
- package/dist/{chunk-jsndbe2q.js → chunk-td1cz8ms.js} +1 -1
- package/dist/{chunk-pw0rzgpv.js → chunk-trtm887x.js} +1 -1
- package/dist/{chunk-qz75kx6n.js → chunk-tryt2h85.js} +1 -1
- package/dist/{chunk-xm6kwq2r.js → chunk-v1v3fxq1.js} +2 -2
- package/dist/{chunk-4fe1ypxz.js → chunk-v5x6c698.js} +1 -1
- package/dist/chunk-vgr8kykv.js +2 -0
- package/dist/chunk-vhvfja74.js +2 -0
- package/dist/{chunk-vpwjr05r.js → chunk-vkpmnn26.js} +1 -1
- package/dist/{chunk-5gb0zjx0.js → chunk-vtqej9yr.js} +1 -1
- package/dist/{chunk-5s2y052b.js → chunk-w670sde5.js} +1 -1
- package/dist/{chunk-4pf61rcb.js → chunk-wbq7cp57.js} +1 -1
- package/dist/{chunk-nenge2m2.js → chunk-whxregkn.js} +1 -1
- package/dist/{chunk-12n9mz15.js → chunk-x2t441ge.js} +1 -1
- package/dist/{chunk-qpcwahse.js → chunk-x8b16v5q.js} +1 -1
- package/dist/{chunk-abzhv6v3.js → chunk-xcf62bdq.js} +1 -1
- package/dist/{chunk-q02jg1pk.js → chunk-xkd164zg.js} +1 -1
- package/dist/{chunk-e0460y7f.js → chunk-y2jr10y8.js} +1 -1
- package/dist/{chunk-9kf4q3ec.js → chunk-y8mg8dem.js} +1 -1
- package/dist/{chunk-5hpp0vzz.js → chunk-yk1smsev.js} +1 -1
- package/dist/{chunk-spn8e3b3.js → chunk-z0hkt5sk.js} +1 -1
- package/dist/{chunk-3952ykhb.js → chunk-z47tw39z.js} +2 -2
- package/dist/{chunk-nngpktr2.js → chunk-zj44h5kk.js} +1 -1
- package/dist/chunk-ztz7tdb0.js +2 -0
- package/dist/{chunk-1mhc4g86.js → chunk-zxb128xa.js} +1 -1
- package/dist/cli.js +14 -14
- package/dist/component-renderer.d.ts +22 -0
- package/dist/component-renderer.js +5 -2
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/database.js +1 -1
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +2 -2
- package/dist/visual-testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-00a028s3.js +0 -2
- package/dist/chunk-02n7khen.js +0 -2
- package/dist/chunk-0kdc3x7v.js +0 -2
- package/dist/chunk-2z6br22w.js +0 -2
- package/dist/chunk-3acgbcv6.js +0 -2
- package/dist/chunk-3vy1q9da.js +0 -2
- package/dist/chunk-5dxctm6h.js +0 -2
- package/dist/chunk-66081bkn.js +0 -2
- package/dist/chunk-6bxcjdp4.js +0 -2
- package/dist/chunk-8sx4vf6p.js +0 -2
- package/dist/chunk-bpvp21dd.js +0 -2
- package/dist/chunk-btgrvrxy.js +0 -2
- package/dist/chunk-ehfzp7xe.js +0 -2
- package/dist/chunk-g9kvpgha.js +0 -2
- package/dist/chunk-k03erdj7.js +0 -2
- package/dist/chunk-k25mqtht.js +0 -2
- package/dist/chunk-me5h5mkq.js +0 -2
- package/dist/chunk-mtr2f82n.js +0 -2
- package/dist/chunk-mz5hjxjv.js +0 -2
- package/dist/chunk-nd9d80gb.js +0 -2
- package/dist/chunk-sry9atvv.js +0 -2
- package/dist/chunk-t98920tc.js +0 -2
- package/dist/chunk-xz019t7t.js +0 -2
- package/dist/chunk-z21qzyh1.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ur as x9,cs as K6,ds as z6}from"./chunk-j0tfxbns.js";import{is as i0}from"./chunk-8anh6d36.js";import{ns as d5}from"./chunk-3fwn9edg.js";import{Hs as h9}from"./chunk-qfsgw9by.js";import{Is as H6,Ks as B6,Ls as j6,Ns as j5}from"./chunk-m2mhtpwy.js";import{Os as u9,Ss as o5,Us as s9}from"./chunk-6xg3j487.js";import{dt as d9}from"./chunk-q4se9rtw.js";import{et as q8,ft as X8,gt as l1,ht as U8,it as y4,jt as o2,kt as H2,lt as M9}from"./chunk-1nm2xrvq.js";import{Et as g3,Vt as g9,Xt as pQ,Yt as u$,_t as U5,ut as i3,xt as f2}from"./chunk-z47tw39z.js";import{du as _6}from"./chunk-3wd9kfyz.js";import{iu as h}from"./chunk-trtm887x.js";import b1 from"path";import I5 from"fs";var k4=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),E4={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},j8=new Set(["ctrl","alt","shift","meta"]),S4={left:0,middle:1,right:2};function b4($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let X of $){let J=X.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(j8.has(J))Z.systemKeys.push(J);else if(J in S4)Z.mouse=J;else if(J in E4||/^[a-z]$/.test(J))Z.keys.push(E4[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function C4($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,q]=Y,U=Y.index,W=U+Q.length,K=`__stx_evt_${X++}`,z=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,V]=B,O=_.split("."),F=O[0];if(!k4.has(F))continue;z.push({attribute:`@${_}`,event:F,handler:V,modifiers:b4(O.slice(1)),elementId:K})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,V]=B,O=_.split("."),F=O[0];if(!k4.has(F))continue;z.push({attribute:`@${_}`,event:F,handler:V,modifiers:b4(O.slice(1)),elementId:K})}if(z.length>0)Z.push({originalTag:Q,elementId:K,events:z,startIndex:U,endIndex:W})}return Z}function _8($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let J of X.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(X.keys.length>0){let J=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(X.mouse!==null){let J=S4[X.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function O8($,Z){let X=$;if(Z.debounce!==null)X=`__stx_debounce(() => { ${X} }, ${Z.debounce})`;else if(Z.throttle!==null)X=`__stx_throttle(() => { ${X} }, ${Z.throttle})`;return X}function k$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function V8($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=_8($),Y=O8(k$($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",q=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${X}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,9 +112,9 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function F8($){let Z=C4($);if(Z.length===0)return{template:$,bindings:[]};let X=$,J=[];for(let Y=Z.length-1;Y>=0;Y--){let Q=Z[Y],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let q=G.match(/id=["']([^"']+)["']/);if(q)for(let U of Q.events)U.elementId=q[1]}for(let q of Q.events){let U=q.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),K=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(K,"")}X=X.slice(0,Q.startIndex)+G+X.slice(Q.endIndex),J.push(...Q.events)}return{template:X,bindings:J}}function P4($,Z,X){if(y4($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:U}=F8($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...U],q}let J=C4($);if(J.length===0)return $;let Y=$;for(let q=J.length-1;q>=0;q--){let U=J[q],W=U.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${U.elementId}"`);else{let K=W.match(/id=["']([^"']+)["']/);if(K)for(let z of U.events)z.elementId=K[1]}for(let K of U.events){let z=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");W=W.replace(H,""),W=W.replace(B,"")}Y=Y.slice(0,U.startIndex)+W+Y.slice(U.endIndex)}let Q=E$(J.flatMap((q)=>q.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
|
|
115
|
-
`+Y.slice(G);else Y+=Q;return Y}function
|
|
115
|
+
`+Y.slice(G);else Y+=Q;return Y}function Kq($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}function r0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,Y)=>{return`const { ${Y.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
116
116
|
`});let X=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(X,(J,Y)=>{return`const { ${Y.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
117
|
-
`}),$}function
|
|
117
|
+
`}),$}function Hq($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}import bG from"fs";import g from"path";import{createHash as L8}from"crypto";var y5="__stx_component_client_factories";function v4($){let Z=$[y5];return Z instanceof Map?Z:null}function f4($){$[y5]=new Map}function x4($,Z){let X=v4($);if(!X)return null;let J=L8("sha256").update(Z).digest("hex").slice(0,16),Y=X.get(J);if(Y)Y.instances++;else X.set(J,{body:Z,instances:1});return J}function g4($,Z){let X=v4(Z);if(!X?.size)return $;let J=$;for(let[U,W]of X){if(W.instances!==1)continue;let K=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(U)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(K,(z,H)=>`(${W.body})(${H});`)}let Y=[...X].filter(([,U])=>U.instances>1);if(Y.length===0)return J;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
118
118
|
(function() {
|
|
119
119
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
120
120
|
${Y.map(([U,W])=>` try { factories[${JSON.stringify(U)}] = factories[${JSON.stringify(U)}] || ${W.body}; }
|
|
@@ -134,7 +134,7 @@ catch (e) {
|
|
|
134
134
|
}
|
|
135
135
|
throw e;
|
|
136
136
|
}
|
|
137
|
-
`),q=G([]);if(Q.length===Z.length)return h4(q,Q,G);return h4((...W)=>{let K=Array(Y.length);for(let z=0;z<Y.length;z++)K[z]=W[Y[z]];return q(...K)},Q,G,(W)=>{q=G(W)})}function h4($,Z,X,J){let Q=/^(\w+) is not defined$/,G=$,q=[],U=new Set(Z);return(...W)=>{for(let K=0;K<=8;K++)try{return G(...W)}catch(z){let H=z instanceof Error?z.message:"",B=Q.exec(H);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(U.has(j)||l4.has(j))return;U.add(j),q.push(j),G=X(q),J?.(q)}return}}function C5($){let Z=$.trim(),X=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of X)if(J.test(Z))return!1;return!0}var c4=0,P5=new Map;function Oq(){c4=0,P5.clear()}function v5($,Z){let X=c4++,J=`<!--__STX_${$.toUpperCase()}_${X}__-->`;return P5.set(J,{type:$,expression:Z}),J}function Vq(){let $={};for(let[Z,X]of P5)$[Z]={type:X.type,expression:X.expression};return $}function Fq($){let Z={},X=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=J[1].toLowerCase(),G=P5.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function Lq($,Z){let X=$;for(let[J,Y]of Z)X=X.split(J).join(Y);return X}function wq($){return $.includes("<!--__STX_")}var p4=/<script\b[^>]*>/iy,i4=/<\/script\s*>/ig,n4=/<style\b[^>]*>/iy,s4=/<\/style\s*>/ig;function o4($,Z,X,J){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)return-1;J.lastIndex=X.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function Y1($,Z){return o4($,Z,p4,i4)}function S1($,Z){return o4($,Z,n4,s4)}function Q5($,Z){if(!$.startsWith("<!--",Z))return-1;let X=$.indexOf("-->",Z+4);if(X===-1)return-1;return X+3}function I8($,Z){if($.startsWith("<!--",Z)){let X=Q5($,Z);return X===-1?$.length:X}for(let[X,J]of[[p4,i4],[n4,s4]]){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)continue;J.lastIndex=X.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function f5($,Z){let X=[],J=0,Y=$.length,Q=!1,G=null;while(J<Y){let q=$[J];if(Q){if(G){if(q===G)G=null}else if(q==='"'||q==="'")G=q;else if(q===">")Q=!1;J++;continue}if(q!=="<"){J++;continue}let U=Z($,J);if(U>J){X.push({start:J,end:U,token:$.slice(J,U)}),J=U;continue}let W=I8($,J);if(W>J){J=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return X}function c0($,Z,X){let J=f5($,Z);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((q)=>q.token),Q="",G=0;for(let q=0;q<J.length;q++){let U=J[q];Q+=$.slice(G,U.start),Q+=X(U.token,q),G=U.end}return Q+=$.slice(G),{output:Q,tokens:Y}}function p0($){let{output:Z,tokens:X}=c0($,Y1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:Z,scripts:X}}function C1($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(X,J)=>Z[+J]??"")}var G5={},r4=new Map;function k8($){let Z=r4.get($);if(!Z){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${X}(?!\\w)`,"g"),r4.set($,Z)}return Z.lastIndex=0,Z}var x5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let X=String($);return X.charAt(0).toUpperCase()+X.slice(1)},number:($,Z,X=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(X),10))}catch{return""}},fmt:($,Z,X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(X)}catch{return String($)}},join:($,Z,X=",")=>{if(!Array.isArray($))return"";return $.join(String(X))},escape:($,Z)=>{if($===void 0||$===null)return"";return t4(String($))},translate:($,Z,X={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let U of Q){if(G===void 0||G===null)break;G=G[U]}if(G===void 0||G===null)return Y?$:"";let q=String(G);return Object.entries(X).forEach(([U,W])=>{q=q.replace(k8(U),String(W))}),q},t:($,Z,X={})=>{return x5.translate($,Z,X)},truncate:($,Z,X=50,J="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=X)return Y;if(X<=J.length)return J.substring(0,X);return Y.substring(0,X-J.length)+J},date:($,Z,X="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(X==="iso")return Y.toISOString();return new Intl.DateTimeFormat(J,Q[X]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,X="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:X}).format(Y)}catch{return String($)}},pluralize:($,Z,X,J)=>{let Y=Number($);if(Number.isNaN(Y))return X;let Q=J||`${X}s`;return Y===1?X:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let X=String($);return X.charAt(X.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,X=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return X?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,X="")=>{return $===void 0||$===null||$===""?X:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,X=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(X,J);return $},replace:($,Z,X,J="")=>{if($===void 0||$===null)return"";let Y=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let X=Number($);return Number.isNaN(X)?0:Math.abs(X)},round:($,Z,X=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Y=10**X;return Math.round(J*Y)/Y}};function E8($,Z){if($ in x5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);G5[$]=Z}function kq($){for(let[Z,X]of Object.entries($))E8(Z,X)}function b8(){return{...x5,...G5}}function Eq(){for(let $ of Object.keys(G5))delete G5[$]}function y$($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function t4($){return y$($).replace(/\{{2,}/g,(Z)=>y8(Z.length)).replace(/\{(?=!)/g,`{${e4}`)}var e4="⁠";function y8($){return Array.from({length:$},()=>"{").join(e4)}function Q1($){let{scripts:Z}=p0($);for(let X of Z){let J=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let Y=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function a4($,Z){let X=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let W=0;W<J.length;W++){let K=J[W];if(!Q&&K==="`"){Q=!0,G=0;continue}if(Q){if(K==="`"&&G===0){Q=!1;continue}if(K==="$"&&J[W+1]==="{"){G++,W++,Y+=" ";continue}if(K==="}"&&G>0){G--;continue}if(G>0){Y+=K;continue}continue}Y+=K}J=Y;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,U;while((U=q.exec(J))!==null){let W=U[1];if(!J.substring(0,U.index).trimEnd().endsWith(".")){if(!X.includes(W)&&!(W in Z))return!1}}return!0}function S8($,Z){let X=Z.__stx_serverDeclared;if(!X||X.size===0)return!1;let J=i0($);for(let Y of X)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function S$($,Z){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=y0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=y0(Y,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),X}function C8($,Z){if(!$.includes("{"))return $;let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=y0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=y0(Y,Z);if(G===void 0)return J;if(G===null)return"";return String(G).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return J}}),X}function bq($,Z,X={}){let{output:J,scripts:Y}=p0($),Q=Y.map((G)=>{let q=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),U=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!q||!U||W===-1)return G;let K=q[1],z=q[2];if(/\bdata-raw\b/.test(K))return G;if(X.skipServer&&/\bserver\b/.test(K))return G;let B=`<script${C8(K,Z)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+G.slice(W);return B+S$(z,Z)+G.slice(W)});return C1(J,Q)}function _1($,Z,X){let J=$,Y=(z,H)=>{let B=S1(z,H);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(H,B))?-1:B},Q=(z,H,B,j)=>{let _=B.length,{output:V,tokens:O}=c0(z,H,(F,L)=>j(_+L));return B.push(...O),V},G=[];J=Q(J,Y,G,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];J=Q(J,Y1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let U=Z?.__stx_signals_gate===!0||Q1($),W=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),K=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,H,B)=>{try{let j=y0(H,Z);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return W0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,X,$,B,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,H,B)=>{try{let j=y0(H,Z);if(j===void 0&&Z.__stx_buildMode==="compile")return v5("raw",H.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(Z.__stx_buildMode==="compile")return v5("raw",H.trim());let _=j instanceof Error?j.message:String(j);return W0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,X,$,B,z)}}),J=Q(J,Y1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=Q(J,Y,G,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,H,B)=>{let j=H.trim();if(K.has(j))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=j.match(V)?.[1],L=F&&((F in Z)||_.includes(F)),w=Boolean(F&&W.has(F)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=j.match(R),N=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=y0(H,Z);if(w)return z;if(U&&!a4(j,Z))return z;if(Z.__stx_buildMode==="compile"&&!U&&(T===void 0||S8(j,Z)))return v5("expr",j);return T!==void 0&&T!==null?t4(String(T)):""}catch(T){if(w)return z;if(U&&!a4(j,Z))return z;if(N)return z;let A=T instanceof Error?T.message:String(T);return W0("Expression",`Error evaluating: {{ ${j} }}: ${A}`,X,$,B,z)}});for(let z=0;z<q.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>q[z]);for(let z=0;z<G.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>G[z]);return J}function P8($,Z,X){if(!Z.trim())return $;let J=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let q=G5[G]||x5[G];if(!q)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(b8()).join(", ")}`);let U=[];if(Y.startsWith(":")){let W=Y.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let z=Number(K);U=[Number.isNaN(z)?K:z]}catch{U=[K]}Y=Y.substring(W[0].length).trim()}}else if(Y.startsWith("(")){let W=1,K=1;while(W>0&&K<Y.length){if(Y[K]==="(")W++;if(Y[K]===")")W--;K++}if(W===0){let z=Y.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))U=[y0(`(${z})`,X,!0)];else{let H=[],B="",j=null,_=0,V=0,O=0,F=!1;for(let L=0;L<z.length;L++){let w=z[L];if(F){B+=w,F=!1;continue}if(w==="\\"){B+=w,F=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")V++;else if(w==="]")V--;else if(w==="{")O++;else if(w==="}")O--;if(w===","&&_===0&&V===0&&O===0){H.push(B),B="";continue}B+=w}if(B)H.push(B);U=H.map((L)=>{let w=L.trim();return y0(w,X,!0)})}}catch{U=[z]}Y=Y.substring(K).trim()}}try{J=q(J,X,...U)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${K}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function v8($){let Z=!1,X="",J=0,Y=0,Q=0,G=!1;for(let q=0;q<$.length;q++){let U=$[q],W=$[q+1];if(Z&&G){G=!1;continue}if(Z&&U==="\\"){G=!0;continue}if(G=!1,(U==='"'||U==="'"||U==="`")&&!G){if(!Z)Z=!0,X=U;else if(U===X)Z=!1,X="";continue}if(Z&&X==="`"&&U==="$"&&W==="{"){let K=1;q+=2;while(q<$.length&&K>0){if($[q]==="{")K++;else if($[q]==="}")K--;if(K>0)q++}continue}if(Z)continue;if(U==="(")J++;else if(U===")")J--;else if(U==="[")Y++;else if(U==="]")Y--;else if(U==="{")Q++;else if(U==="}")Q--;if(U==="|"&&J===0&&Y===0&&Q===0){if(W==="|"){q++;continue}if(W==="="){q++;continue}return q}}return-1}function y0($,Z,X=!1){try{let J=$.trim(),Y=v8(J);if(Y>0){let Q=J.substring(0,Y).trim(),G=J.substring(Y+1).trim(),q=y0(Q,Z,!0);return P8(q,G,Z)}if(!Q0(J)){if(!X)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return X0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return G0(J,Q)(...G)}catch{return X0(J,Z)}}catch(J){if(J instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(J.message);if(Y){let Q=Y[1],G=f8(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!X)console.error(`Error evaluating expression: ${$}`,J);throw J}}function f8($,Z){let X=null;for(let Y of Z){if(Y===$)continue;let Q=x8($,Y);if(X===null||Q<X.dist)X={key:Y,dist:Q}}if(!X)return null;let J=Math.max($.length,X.key.length);if(X.dist<=2||X.dist/J<=0.35)return X.key;return null}function x8($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[X,J]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(X.length+1),Q=Array(X.length+1);for(let G=0;G<=X.length;G++)Y[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let q=1;q<=X.length;q++){let U=X[q-1]===J[G-1]?0:1;Q[q]=Math.min(Q[q-1]+1,Y[q]+1,Y[q-1]+U)}for(let q=0;q<=X.length;q++)Y[q]=Q[q]}return Y[X.length]}function yq($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}class O1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let X=this.cache.keys().next().value;if(X!==void 0)this.cache.delete(X)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var P1=new Map,g8=500;function v1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let X=`${$}:${Z||""}`;if(!P1.has(X)){if(P1.size>=g8){let J=P1.keys().next().value;if(J)P1.delete(J)}P1.set(X,new RegExp($,Z))}return P1.get(X)}class $7{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),X=Z.sort().join(","),J=this.pool.find((q)=>q.context.join(",")===X);if(J)return J.func;let Y=this.fnCache,Q=this.fnCacheMaxSize,G=(...q)=>{return(U)=>{try{let W=`${X}:${U}`,K=Y.get(W);if(!K){if(Y.size>=Q){let z=Y.keys().next().value;if(z)Y.delete(z)}K=Function(...Z,`
|
|
137
|
+
`),q=G([]);if(Q.length===Z.length)return h4(q,Q,G);return h4((...W)=>{let K=Array(Y.length);for(let z=0;z<Y.length;z++)K[z]=W[Y[z]];return q(...K)},Q,G,(W)=>{q=G(W)})}function h4($,Z,X,J){let Q=/^(\w+) is not defined$/,G=$,q=[],U=new Set(Z);return(...W)=>{for(let K=0;K<=8;K++)try{return G(...W)}catch(z){let H=z instanceof Error?z.message:"",B=Q.exec(H);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(U.has(j)||l4.has(j))return;U.add(j),q.push(j),G=X(q),J?.(q)}return}}function C5($){let Z=$.trim(),X=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of X)if(J.test(Z))return!1;return!0}var c4=0,P5=new Map;function Vq(){c4=0,P5.clear()}function v5($,Z){let X=c4++,J=`<!--__STX_${$.toUpperCase()}_${X}__-->`;return P5.set(J,{type:$,expression:Z}),J}function Fq(){let $={};for(let[Z,X]of P5)$[Z]={type:X.type,expression:X.expression};return $}function Lq($){let Z={},X=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=J[1].toLowerCase(),G=P5.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function wq($,Z){let X=$;for(let[J,Y]of Z)X=X.split(J).join(Y);return X}function Rq($){return $.includes("<!--__STX_")}var p4=/<script\b[^>]*>/iy,i4=/<\/script\s*>/ig,n4=/<style\b[^>]*>/iy,s4=/<\/style\s*>/ig;function o4($,Z,X,J){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)return-1;J.lastIndex=X.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function Y1($,Z){return o4($,Z,p4,i4)}function S1($,Z){return o4($,Z,n4,s4)}function Q5($,Z){if(!$.startsWith("<!--",Z))return-1;let X=$.indexOf("-->",Z+4);if(X===-1)return-1;return X+3}function I8($,Z){if($.startsWith("<!--",Z)){let X=Q5($,Z);return X===-1?$.length:X}for(let[X,J]of[[p4,i4],[n4,s4]]){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)continue;J.lastIndex=X.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function f5($,Z){let X=[],J=0,Y=$.length,Q=!1,G=null;while(J<Y){let q=$[J];if(Q){if(G){if(q===G)G=null}else if(q==='"'||q==="'")G=q;else if(q===">")Q=!1;J++;continue}if(q!=="<"){J++;continue}let U=Z($,J);if(U>J){X.push({start:J,end:U,token:$.slice(J,U)}),J=U;continue}let W=I8($,J);if(W>J){J=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return X}function c0($,Z,X){let J=f5($,Z);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((q)=>q.token),Q="",G=0;for(let q=0;q<J.length;q++){let U=J[q];Q+=$.slice(G,U.start),Q+=X(U.token,q),G=U.end}return Q+=$.slice(G),{output:Q,tokens:Y}}function p0($){let{output:Z,tokens:X}=c0($,Y1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:Z,scripts:X}}function C1($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(X,J)=>Z[+J]??"")}var G5={},r4=new Map;function k8($){let Z=r4.get($);if(!Z){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${X}(?!\\w)`,"g"),r4.set($,Z)}return Z.lastIndex=0,Z}var x5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let X=String($);return X.charAt(0).toUpperCase()+X.slice(1)},number:($,Z,X=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(X),10))}catch{return""}},fmt:($,Z,X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(X)}catch{return String($)}},join:($,Z,X=",")=>{if(!Array.isArray($))return"";return $.join(String(X))},escape:($,Z)=>{if($===void 0||$===null)return"";return t4(String($))},translate:($,Z,X={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let U of Q){if(G===void 0||G===null)break;G=G[U]}if(G===void 0||G===null)return Y?$:"";let q=String(G);return Object.entries(X).forEach(([U,W])=>{q=q.replace(k8(U),String(W))}),q},t:($,Z,X={})=>{return x5.translate($,Z,X)},truncate:($,Z,X=50,J="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=X)return Y;if(X<=J.length)return J.substring(0,X);return Y.substring(0,X-J.length)+J},date:($,Z,X="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(X==="iso")return Y.toISOString();return new Intl.DateTimeFormat(J,Q[X]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,X="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:X}).format(Y)}catch{return String($)}},pluralize:($,Z,X,J)=>{let Y=Number($);if(Number.isNaN(Y))return X;let Q=J||`${X}s`;return Y===1?X:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let X=String($);return X.charAt(X.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,X=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return X?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,X="")=>{return $===void 0||$===null||$===""?X:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,X=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(X,J);return $},replace:($,Z,X,J="")=>{if($===void 0||$===null)return"";let Y=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let X=Number($);return Number.isNaN(X)?0:Math.abs(X)},round:($,Z,X=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Y=10**X;return Math.round(J*Y)/Y}};function E8($,Z){if($ in x5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);G5[$]=Z}function Eq($){for(let[Z,X]of Object.entries($))E8(Z,X)}function b8(){return{...x5,...G5}}function bq(){for(let $ of Object.keys(G5))delete G5[$]}function y$($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function t4($){return y$($).replace(/\{{2,}/g,(Z)=>y8(Z.length)).replace(/\{(?=!)/g,`{${e4}`)}var e4="⁠";function y8($){return Array.from({length:$},()=>"{").join(e4)}function Q1($){let{scripts:Z}=p0($);for(let X of Z){let J=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let Y=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function a4($,Z){let X=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let W=0;W<J.length;W++){let K=J[W];if(!Q&&K==="`"){Q=!0,G=0;continue}if(Q){if(K==="`"&&G===0){Q=!1;continue}if(K==="$"&&J[W+1]==="{"){G++,W++,Y+=" ";continue}if(K==="}"&&G>0){G--;continue}if(G>0){Y+=K;continue}continue}Y+=K}J=Y;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,U;while((U=q.exec(J))!==null){let W=U[1];if(!J.substring(0,U.index).trimEnd().endsWith(".")){if(!X.includes(W)&&!(W in Z))return!1}}return!0}function S8($,Z){let X=Z.__stx_serverDeclared;if(!X||X.size===0)return!1;let J=i0($);for(let Y of X)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function S$($,Z){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=y0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=y0(Y,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),X}function C8($,Z){if(!$.includes("{"))return $;let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=y0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=y0(Y,Z);if(G===void 0)return J;if(G===null)return"";return String(G).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return J}}),X}function yq($,Z,X={}){let{output:J,scripts:Y}=p0($),Q=Y.map((G)=>{let q=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),U=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!q||!U||W===-1)return G;let K=q[1],z=q[2];if(/\bdata-raw\b/.test(K))return G;if(X.skipServer&&/\bserver\b/.test(K))return G;let B=`<script${C8(K,Z)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+G.slice(W);return B+S$(z,Z)+G.slice(W)});return C1(J,Q)}function _1($,Z,X){let J=$,Y=(z,H)=>{let B=S1(z,H);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(H,B))?-1:B},Q=(z,H,B,j)=>{let _=B.length,{output:V,tokens:O}=c0(z,H,(F,L)=>j(_+L));return B.push(...O),V},G=[];J=Q(J,Y,G,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];J=Q(J,Y1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let U=Z?.__stx_signals_gate===!0||Q1($),W=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),K=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,H,B)=>{try{let j=y0(H,Z);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return W0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,X,$,B,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,H,B)=>{try{let j=y0(H,Z);if(j===void 0&&Z.__stx_buildMode==="compile")return v5("raw",H.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(Z.__stx_buildMode==="compile")return v5("raw",H.trim());let _=j instanceof Error?j.message:String(j);return W0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,X,$,B,z)}}),J=Q(J,Y1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=Q(J,Y,G,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,H,B)=>{let j=H.trim();if(K.has(j))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=j.match(V)?.[1],L=F&&((F in Z)||_.includes(F)),w=Boolean(F&&W.has(F)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=j.match(R),N=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=y0(H,Z);if(w)return z;if(U&&!a4(j,Z))return z;if(Z.__stx_buildMode==="compile"&&!U&&(T===void 0||S8(j,Z)))return v5("expr",j);return T!==void 0&&T!==null?t4(String(T)):""}catch(T){if(w)return z;if(U&&!a4(j,Z))return z;if(N)return z;let A=T instanceof Error?T.message:String(T);return W0("Expression",`Error evaluating: {{ ${j} }}: ${A}`,X,$,B,z)}});for(let z=0;z<q.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>q[z]);for(let z=0;z<G.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>G[z]);return J}function P8($,Z,X){if(!Z.trim())return $;let J=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let q=G5[G]||x5[G];if(!q)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(b8()).join(", ")}`);let U=[];if(Y.startsWith(":")){let W=Y.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let z=Number(K);U=[Number.isNaN(z)?K:z]}catch{U=[K]}Y=Y.substring(W[0].length).trim()}}else if(Y.startsWith("(")){let W=1,K=1;while(W>0&&K<Y.length){if(Y[K]==="(")W++;if(Y[K]===")")W--;K++}if(W===0){let z=Y.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))U=[y0(`(${z})`,X,!0)];else{let H=[],B="",j=null,_=0,V=0,O=0,F=!1;for(let L=0;L<z.length;L++){let w=z[L];if(F){B+=w,F=!1;continue}if(w==="\\"){B+=w,F=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")V++;else if(w==="]")V--;else if(w==="{")O++;else if(w==="}")O--;if(w===","&&_===0&&V===0&&O===0){H.push(B),B="";continue}B+=w}if(B)H.push(B);U=H.map((L)=>{let w=L.trim();return y0(w,X,!0)})}}catch{U=[z]}Y=Y.substring(K).trim()}}try{J=q(J,X,...U)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${K}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function v8($){let Z=!1,X="",J=0,Y=0,Q=0,G=!1;for(let q=0;q<$.length;q++){let U=$[q],W=$[q+1];if(Z&&G){G=!1;continue}if(Z&&U==="\\"){G=!0;continue}if(G=!1,(U==='"'||U==="'"||U==="`")&&!G){if(!Z)Z=!0,X=U;else if(U===X)Z=!1,X="";continue}if(Z&&X==="`"&&U==="$"&&W==="{"){let K=1;q+=2;while(q<$.length&&K>0){if($[q]==="{")K++;else if($[q]==="}")K--;if(K>0)q++}continue}if(Z)continue;if(U==="(")J++;else if(U===")")J--;else if(U==="[")Y++;else if(U==="]")Y--;else if(U==="{")Q++;else if(U==="}")Q--;if(U==="|"&&J===0&&Y===0&&Q===0){if(W==="|"){q++;continue}if(W==="="){q++;continue}return q}}return-1}function y0($,Z,X=!1){try{let J=$.trim(),Y=v8(J);if(Y>0){let Q=J.substring(0,Y).trim(),G=J.substring(Y+1).trim(),q=y0(Q,Z,!0);return P8(q,G,Z)}if(!Q0(J)){if(!X)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return X0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return G0(J,Q)(...G)}catch{return X0(J,Z)}}catch(J){if(J instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(J.message);if(Y){let Q=Y[1],G=f8(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!X)console.error(`Error evaluating expression: ${$}`,J);throw J}}function f8($,Z){let X=null;for(let Y of Z){if(Y===$)continue;let Q=x8($,Y);if(X===null||Q<X.dist)X={key:Y,dist:Q}}if(!X)return null;let J=Math.max($.length,X.key.length);if(X.dist<=2||X.dist/J<=0.35)return X.key;return null}function x8($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[X,J]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(X.length+1),Q=Array(X.length+1);for(let G=0;G<=X.length;G++)Y[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let q=1;q<=X.length;q++){let U=X[q-1]===J[G-1]?0:1;Q[q]=Math.min(Q[q-1]+1,Y[q]+1,Y[q-1]+U)}for(let q=0;q<=X.length;q++)Y[q]=Q[q]}return Y[X.length]}function Sq($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}class O1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let X=this.cache.keys().next().value;if(X!==void 0)this.cache.delete(X)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var P1=new Map,g8=500;function v1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let X=`${$}:${Z||""}`;if(!P1.has(X)){if(P1.size>=g8){let J=P1.keys().next().value;if(J)P1.delete(J)}P1.set(X,new RegExp($,Z))}return P1.get(X)}class $7{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),X=Z.sort().join(","),J=this.pool.find((q)=>q.context.join(",")===X);if(J)return J.func;let Y=this.fnCache,Q=this.fnCacheMaxSize,G=(...q)=>{return(U)=>{try{let W=`${X}:${U}`,K=Y.get(W);if(!K){if(Y.size>=Q){let z=Y.keys().next().value;if(z)Y.delete(z)}K=Function(...Z,`
|
|
138
138
|
'use strict';
|
|
139
139
|
try {
|
|
140
140
|
return ${U};
|
|
@@ -145,7 +145,7 @@ catch (e) {
|
|
|
145
145
|
}
|
|
146
146
|
throw e;
|
|
147
147
|
}
|
|
148
|
-
`),Y.set(W,K)}return K(...q)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}var
|
|
148
|
+
`),Y.set(W,K)}return K(...q)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}var Pq=new $7;class Z7{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,X]of Object.entries($))this.setBudget(Z,X)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,X]of this.budgets.entries())$[Z]=X;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let X=performance.now(),J=Z(),Y=performance.now()-X;return this.recordTime($,Y),this.checkBudget($,Y),J}async timeAsync($,Z){if(!this.enabled)return Z();let X=performance.now(),J=await Z(),Y=performance.now()-X;return this.recordTime($,Y),this.checkBudget($,Y),J}checkBudget($,Z){let X=this.budgets.get($);if(!X)return;let J=Z/X.maxTime*100,Y=X.warnThreshold!==void 0?Z>=X.maxTime*X.warnThreshold&&Z<X.maxTime:!1,Q=Z>=X.maxTime;if(!Y&&!Q)return;let G={label:$,actualTime:Z,budgetTime:X.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:Y};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let U of this.violationHandlers)try{U(G)}catch{}let q=Y?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${X.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${X.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(X.action){case"log":console.log(q);break;case"warn":console.warn(q);break;case"error":console.error(q);break;case"throw":if(Q)throw Error(q);else console.warn(q);break}}recordTime($,Z){let X=this.metrics.get($);if(X)X.count++,X.totalTime+=Z,X.maxTime=Math.max(X.maxTime,Z),X.minTime=Math.min(X.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let X=this.metrics.get($);if(!X)return{};let J=this.budgets.get($);return{count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:J?.maxTime,budgetUtilization:J?X.totalTime/X.count/J.maxTime*100:void 0}}let Z={};for(let[X,J]of this.metrics.entries()){let Y=this.budgets.get(X);Z[X]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,X=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else X++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:X}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var C$=null;function h8(){if(!C$)C$=new Z7;return C$}var X7=new Proxy({},{get($,Z){return h8()[Z]}});import iQ from"fs";import R0 from"path";var P$=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],J7=/<body\b([^>]*)>/gi;function q5($){let Z=0,X,J=P$.map(()=>{return});while(Z<$.length){if(X===void 0||X!==null&&X.index<Z)J7.lastIndex=Z,X=J7.exec($);if(!X)return null;let Y=X.index,Q=-1,G=null;for(let U=0;U<P$.length;U++){let W=P$[U],K=J[U];if(K===void 0||K!==null&&K.index<Z)W.open.lastIndex=Z,K=W.open.exec($),J[U]=K;if(!K)continue;if(K.index<Y&&(Q===-1||K.index<Q))Q=K.index,G=W.close}if(Q===-1||!G)return{index:Y,tag:X[0],attrs:X[1]??""};G.lastIndex=Q;let q=G.exec($);if(!q)return null;Z=q.index+q[0].length}return null}function g5($,Z){let X=q5($);if(!X)return $;return $.slice(0,X.index)+Z(X.tag,X.attrs)+$.slice(X.index+X.tag.length)}var Y7=null;function u8($){if(!Y7)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return Y7}function xq($){let Z=u8("onUpdate");if(Z)Z.updateHooks.push($)}function Q7(){return`
|
|
149
149
|
// STX Lifecycle Runtime
|
|
150
150
|
(function() {
|
|
151
151
|
if (typeof window === 'undefined') return;
|
|
@@ -490,7 +490,7 @@ else {
|
|
|
490
490
|
|
|
491
491
|
console.log('[stx] Lifecycle runtime initialized');
|
|
492
492
|
})();
|
|
493
|
-
`}function v$($){return Symbol($)}var
|
|
493
|
+
`}function v$($){return Symbol($)}var gq=v$("theme"),hq=v$("router"),uq=v$("i18n");import*as q7 from"crypto";function G7($){let Z=/\$(\w+)\./g,X=[],J;while((J=Z.exec($))!==null)if(!X.includes(J[1]))X.push(J[1]);return X}function d8(){return`stx-${q7.randomBytes(4).toString("hex")}`}function m8($){return/\$\w+\./.test($)}function l8($){let Z=[],X=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(Q,G,q,U)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let W=[],K=!1,z=q,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...q.matchAll(H)];for(let V of B){let O=V[0],F=V[1],L=V[2];if(m8(L)){K=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(W.push({attr:F,expr:R,fullMatch:O,originalAttr:F}),G7(R).forEach((N)=>X.add(N)),F==="text")z=z.replace(O,"");else if(F==="class")z=z.replace(O,'class=""');else if(F==="disabled"||F==="hidden")z=z.replace(O,"");else z=z.replace(O,`${F}=""`)}}}if(!K)return Q;let j=z.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=d8(),z=` id="${_}"${z}`;for(let V of W)Z.push({elementId:_,attribute:V.attr,expression:V.expr,stores:G7(V.expr)});return`<${G}${z}${U}`}),{html:Y,bindings:Z,stores:X}}function c8($,Z){if($.length===0)return"";let X=Array.from(Z),J=`
|
|
494
494
|
<script>
|
|
495
495
|
(function() {
|
|
496
496
|
'use strict';
|
|
@@ -705,7 +705,7 @@ ${Z.inlineScript}
|
|
|
705
705
|
`;if(!Z.scriptUrl)return"";let X=[];if(Z.scriptId)X.push(`id="${S0(Z.scriptId)}"`);if(Z.attributes)for(let[Y,Q]of Object.entries(Z.attributes))X.push(`${S0(Y)}="${S0(Q)}"`);return`
|
|
706
706
|
<!-- Custom Analytics -->
|
|
707
707
|
<script${X.length>0?` ${X.join(" ")}`:""} src="${S0(Z.scriptUrl)}" defer></script>
|
|
708
|
-
`}function K7($,Z){let X=W7(Z);if(!X)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}return $.replace("</head>",`${X}</head>`)}function S0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var
|
|
708
|
+
`}function K7($,Z){let X=W7(Z);if(!X)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}return $.replace("</head>",`${X}</head>`)}function S0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var lq={name:"analytics",hasEndTag:!1,handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};return W7(Y)}};var r8={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function z7($){let Z=$.heatmap;if(!Z?.enabled)return"";let X={...r8,...Z};return`
|
|
709
709
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
710
710
|
<script>
|
|
711
711
|
(function() {
|
|
@@ -1088,7 +1088,7 @@ else {
|
|
|
1088
1088
|
};
|
|
1089
1089
|
})();
|
|
1090
1090
|
</script>
|
|
1091
|
-
`}function H7($,Z){let X=z7(Z);if(!X)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}var B7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};if(Z.length>0){let Q=a8(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return z7(Y)}};function a8($){let Z={},X=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of X){let[Y,Q]=J.split("="),G=Q?.replace(/["']/g,"");switch(Y){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class j7{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let X of this.sessions.values())if(X.page===$)Z.push(...X.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((J)=>J.type==="scroll"),X=new Map;for(let J of Z)if(J.depth!==void 0)X.set(J.depth,(X.get(J.depth)||0)+1);return Array.from(X.entries()).map(([J,Y])=>({depth:J,count:Y})).sort((J,Y)=>J.depth-Y.depth)}getZoneStats($){let Z=new Map,X=this.getPageData($);for(let J of X)if(J.zone){let Y=Z.get(J.zone)||{clicks:0,hovers:0};if(J.type==="click")Y.clicks++;else if(J.type==="move")Y.hovers++;Z.set(J.zone,Y)}return Z}generateGridData($,Z=20){let X=this.getPageData($),J=[];for(let Q=0;Q<Z;Q++){J[Q]=[];for(let G=0;G<Z;G++)J[Q][G]=0}for(let Q of X){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),q=Math.min(Math.floor(Q.y/100*Z),Z-1);J[q][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of J)for(let G of Q)Y=Math.max(Y,G);return J.map((Q,G)=>Q.map((q,U)=>({x:U,y:G,intensity:Y>0?q/Y:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function
|
|
1091
|
+
`}function H7($,Z){let X=z7(Z);if(!X)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}var B7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};if(Z.length>0){let Q=a8(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return z7(Y)}};function a8($){let Z={},X=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of X){let[Y,Q]=J.split("="),G=Q?.replace(/["']/g,"");switch(Y){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class j7{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let X of this.sessions.values())if(X.page===$)Z.push(...X.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((J)=>J.type==="scroll"),X=new Map;for(let J of Z)if(J.depth!==void 0)X.set(J.depth,(X.get(J.depth)||0)+1);return Array.from(X.entries()).map(([J,Y])=>({depth:J,count:Y})).sort((J,Y)=>J.depth-Y.depth)}getZoneStats($){let Z=new Map,X=this.getPageData($);for(let J of X)if(J.zone){let Y=Z.get(J.zone)||{clicks:0,hovers:0};if(J.type==="click")Y.clicks++;else if(J.type==="move")Y.hovers++;Z.set(J.zone,Y)}return Z}generateGridData($,Z=20){let X=this.getPageData($),J=[];for(let Q=0;Q<Z;Q++){J[Q]=[];for(let G=0;G<Z;G++)J[Q][G]=0}for(let Q of X){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),q=Math.min(Math.floor(Q.y/100*Z),Z-1);J[q][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of J)for(let G of Q)Y=Math.max(Y,G);return J.map((Q,G)=>Q.map((q,U)=>({x:U,y:G,intensity:Y>0?q/Y:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function pq(){return new j7}var t8;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(t8||={});var e8;((J)=>{J.In="in";J.Out="out";J.Both="both"})(e8||={});var $Z;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})($Z||={});var a0={duration:300,delay:0,ease:"ease",direction:"both"};function ZZ($,Z={}){let{duration:X,delay:J,ease:Y,direction:Q,custom:G}={...a0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1092
1092
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1093
1093
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1094
1094
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -1364,7 +1364,7 @@ ${U}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
|
|
|
1364
1364
|
--stx-spring-stiffness: ${Q.stiffness};
|
|
1365
1365
|
--stx-spring-damping: ${Q.damping};
|
|
1366
1366
|
--stx-spring-mass: ${Q.mass};
|
|
1367
|
-
`.trim().replace(/\s+/g," ");return`<div id="${q}" class="stx-spring" style="${W}">${$}</div>`},description:"Applies spring physics animations to an element"};function
|
|
1367
|
+
`.trim().replace(/\s+/g," ");return`<div id="${q}" class="stx-spring" style="${W}">${$}</div>`},description:"Applies spring physics animations to an element"};function nq($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
|
|
1368
1368
|
<script data-stx-scoped data-stx-run="always">
|
|
1369
1369
|
(function() {
|
|
1370
1370
|
const timeline = ${JSON.stringify($)};
|
|
@@ -1401,7 +1401,7 @@ else {
|
|
|
1401
1401
|
runTimeline();
|
|
1402
1402
|
}
|
|
1403
1403
|
})();
|
|
1404
|
-
</script>`}function
|
|
1404
|
+
</script>`}function sq($,Z,X){let J=qZ($,Z),Y=`
|
|
1405
1405
|
.${$}-animation {
|
|
1406
1406
|
animation-name: ${$};
|
|
1407
1407
|
animation-duration: ${X.duration}ms;
|
|
@@ -1411,7 +1411,7 @@ else {
|
|
|
1411
1411
|
animation-direction: ${X.direction||"normal"};
|
|
1412
1412
|
animation-fill-mode: ${X.fill||"forwards"};
|
|
1413
1413
|
}`;return`${J}
|
|
1414
|
-
${Y}`}function
|
|
1414
|
+
${Y}`}function oq($){let Z=$.trim().split(/\s+/),X={duration:300};for(let J=0;J<Z.length;J++){let Y=Z[J];if(/^\d+(?:ms|s)?$/.test(Y)){let Q=Number.parseInt(Y,10);if(J===0)X.duration=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q;else X.delay=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q}else if(Y==="infinite"||/^\d+$/.test(Y))X.iterations=Y==="infinite"?"infinite":Number.parseInt(Y,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Y))X.direction=Y;else if(["none","forwards","backwards","both"].includes(Y))X.fill=Y;else X.easing=Y}return X}function rq(){return`
|
|
1415
1415
|
<script data-stx-scoped data-stx-run="once">
|
|
1416
1416
|
window.__stxAnimation = {
|
|
1417
1417
|
// Registry of animations
|
|
@@ -1483,7 +1483,7 @@ else {
|
|
|
1483
1483
|
);
|
|
1484
1484
|
}
|
|
1485
1485
|
};
|
|
1486
|
-
</script>`}function
|
|
1486
|
+
</script>`}function aq($){let Z=$.customDirectives||[];return Z.push(f$),Z.push(g$),Z.push(h$),Z.push(x$),Z.push(UZ),Z.push(KZ),Z.push(HZ),{...$,customDirectives:Z}}function V7($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function F7($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var BZ=0,jZ=0;function L7($,Z){let X=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(X)return X[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function _Z($){let Z=[],X=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=X.exec($))!==null){let[Y,Q,G]=J,q=J.index,U=L7(G,"x-data");if(!U)continue;let W=`__stx_scope_${BZ++}`,K=L7(G,"x-init"),z=OZ($,Q,q+Y.length),H=$.slice(q,z.endIndex),B=VZ(H);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:U,initExpr:K,bindings:[],refs:B})}return Z}function OZ($,Z,X){let J=1,Y=X,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),q=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,q.lastIndex=Y;let U=Q.exec($),W=G.exec($),K=q.exec($);if(K&&K.index<(U?.index??1/0)){Y=K.index+K[0].length;continue}if(!W)return{endIndex:$.length};if(U&&U.index<W.index)J++,Y=U.index+U[0].length;else{if(J--,J===0)return{endIndex:W.index+W[0].length};Y=W.index+W[0].length}}return{endIndex:$.length}}function VZ($){let Z=new Map,X=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=J.exec(X))!==null){let[,Q,G]=Y,q=FZ(Q);Z.set(G,q)}return Z}function FZ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${jZ++}`}function LZ(){return`
|
|
1487
1487
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1488
1488
|
(function() {
|
|
1489
1489
|
var style = document.createElement('style');
|
|
@@ -1721,8 +1721,8 @@ ${_}
|
|
|
1721
1721
|
`)}</p>`);if(Y=q.join(`
|
|
1722
1722
|
`),J)Y=Y.replace(/\n/g,`<br />
|
|
1723
1723
|
`);for(let K=0;K<Q.length;K++)Y=Y.replace(`\x00CODEBLOCK${K}\x00`,Q[K]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function M7($,Z,X=""){let J=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let q=G.index,U=G[0].match(/@markdown\(([^)]*)\)/),W=U?U[1]:"",K=q+G[0].length,z=1,H=K,B=-1;while(z>0&&H<$.length){let V=$.indexOf("@markdown",H),O=$.indexOf("@endmarkdown",H);if(O===-1)break;if(V!==-1&&V<O&&V!==q){let F=$[V+9];if(F==="("||F===`
|
|
1724
|
-
`||F==="\r"||F===" "||F===void 0)z++;H=V+9}else{if(z--,z===0){B=O;break}H=O+12}}if(B===-1)continue;let j=$.slice(K,B),_=$.slice(q,B+12);Y.push({fullMatch:_,options:W,content:j,index:q}),Q.lastIndex=B+12}for(let{fullMatch:q,options:U,content:W,index:K}of Y)try{let z={};if(U)U.split(",").forEach((j)=>{let _=j.trim();if(_)z[_]=!0});let H={gfm:z.gfm??!0,breaks:z.breaks??!1},B=W5(W.trim(),H);J=J.split(q).join(B)}catch(z){let H=z instanceof Error?z.message:String(z),B=W0("Markdown Directive",`Error processing markdown: ${H}`,X,$,K,q);J=J.split(q).join(B)}return J}async function T7($,Z,X,J){let Y={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")Y.breaks=!0;if(G==="no-gfm")Y.gfm=!1}),W5($.trim(),Y)}var V1=[320,480,640,768,1024,1280,1536,1920,2560],I7=[1,1.5,2,3],f1=["avif","webp","jpeg"],k7={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},AZ={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function K5($,Z=V1,X={},J){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${q1($,{...X,w:Y,fm:J})} ${Y}w`}).join(", ")}function
|
|
1725
|
-
`)}function
|
|
1724
|
+
`||F==="\r"||F===" "||F===void 0)z++;H=V+9}else{if(z--,z===0){B=O;break}H=O+12}}if(B===-1)continue;let j=$.slice(K,B),_=$.slice(q,B+12);Y.push({fullMatch:_,options:W,content:j,index:q}),Q.lastIndex=B+12}for(let{fullMatch:q,options:U,content:W,index:K}of Y)try{let z={};if(U)U.split(",").forEach((j)=>{let _=j.trim();if(_)z[_]=!0});let H={gfm:z.gfm??!0,breaks:z.breaks??!1},B=W5(W.trim(),H);J=J.split(q).join(B)}catch(z){let H=z instanceof Error?z.message:String(z),B=W0("Markdown Directive",`Error processing markdown: ${H}`,X,$,K,q);J=J.split(q).join(B)}return J}async function T7($,Z,X,J){let Y={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")Y.breaks=!0;if(G==="no-gfm")Y.gfm=!1}),W5($.trim(),Y)}var V1=[320,480,640,768,1024,1280,1536,1920,2560],I7=[1,1.5,2,3],f1=["avif","webp","jpeg"],k7={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},AZ={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function K5($,Z=V1,X={},J){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${q1($,{...X,w:Y,fm:J})} ${Y}w`}).join(", ")}function zU($,Z=320,X=2560,J=0.08,Y={},Q){let G=MZ(Z,X,J);return K5($,G,Y,Q)}function MZ($,Z,X=0.08){let J=[],Y=$;while(Y<Z)J.push(Math.round(Y)),Y*=1+X*2;if(J[J.length-1]!==Z)J.push(Z);return J}function d$($,Z,X=I7,J={},Y){return X.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${q1($,{...J,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function HU($,Z,X=I7,J=80,Y={},Q){let G={1:J,1.5:Math.round(J*0.9),2:Math.round(J*0.8),3:Math.round(J*0.7),4:Math.round(J*0.6),5:Math.round(J*0.5)};return X.sort((q,U)=>q-U).map((q)=>{let U=Math.round(Z*q),W=G[q]||Math.round(J*Math.max(0.5,1-q*0.1));return`${q1($,{...Y,w:U,q:W,dpr:q,fm:Q})} ${q}x`}).join(", ")}function m$($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([Y,Q])=>{let G=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((Y,Q)=>Y.numericBp-Q.numericBp).map(({bp:Y,size:Q})=>`(max-width: ${Y}) ${Q}`);return J.push(Z),J.join(", ")}function BU($,Z="100vw"){if(!$||$.length===0)return Z;let J=[...$].sort((Y,Q)=>(Y.maxWidth||0)-(Q.maxWidth||0)).filter((Y)=>Y.maxWidth).map((Y)=>`(max-width: ${Y.maxWidth}px) ${Y.imageWidth}`);return J.push(Z),J.join(", ")}var jU={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"};function q1($,Z={}){let X=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(X.length===0)return $;let J=X.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${J}`}function _U($){let[Z,X]=$.split("?"),J={};if(X)new URLSearchParams(X).forEach((Q,G)=>{if(/^\d+$/.test(Q))J[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))J[G]=Number.parseFloat(Q);else if(Q==="true")J[G]=!0;else if(Q==="false")J[G]=!1;else J[G]=Q});return{src:Z,params:J}}function OU($){let{src:Z,widths:X,dprValues:J,fixedWidth:Y,formats:Q=f1,baseUrl:G="",params:q={}}=$,U=[];for(let W of Q){let K,z;if(Y!==void 0&&J)K=d$(Z,Y,J,q,W),z=J.map((H)=>({path:"",url:q1(Z,{...q,w:Math.round(Y*H),fm:W}),width:Math.round(Y*H),height:0,format:W,size:0,dpr:H}));else{let H=X||V1;K=K5(Z,H,q,W),z=H.map((B)=>({path:"",url:q1(Z,{...q,w:B,fm:W}),width:B,height:0,format:W,size:0}))}U.push({srcset:K,format:W,mimeType:k7[W],variants:z})}return U}function VU($,Z="100vw"){return $.map(({srcset:X,mimeType:J})=>`<source type="${J}" srcset="${X}" sizes="${Z}" />`).join(`
|
|
1725
|
+
`)}function FU($,Z){if($.length===0)return;let X=[...$].sort((Y,Q)=>Y.width-Q.width),J=X.find((Y)=>Y.width>=Z);if(J)return J;return X[X.length-1]}function l$($){return k7[$]||"application/octet-stream"}function LU($){return AZ[$]||$}function wU($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var TZ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},c$=`
|
|
1726
1726
|
.stx-img-placeholder {
|
|
1727
1727
|
position: relative;
|
|
1728
1728
|
overflow: hidden;
|
|
@@ -1751,9 +1751,9 @@ ${_}
|
|
|
1751
1751
|
filter: blur(0);
|
|
1752
1752
|
transform: scale(1);
|
|
1753
1753
|
}
|
|
1754
|
-
`.trim();async function p$(){try{return await import("ts-images")}catch{return null}}async function E7($,Z={}){let X={...TZ,...Z},J=await p$();if(J)try{return await IZ($,X,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return b7($,X)}async function IZ($,Z,X){let{generatePlaceholder:J,generateThumbHash:Y}=X,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let q=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:q.dataURL,width:q.width,height:q.height,aspectRatio:q.aspectRatio,originalWidth:q.originalWidth,originalHeight:q.originalHeight,strategy:Z.strategy,dominantColor:q.dominantColor,css:q.css}}function b7($,Z){let X=Z.width||20,J=Z.height||X,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${J}" viewBox="0 0 ${X} ${J}"><rect fill="#e5e7eb" width="${X}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:X,height:J,aspectRatio:X/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function
|
|
1754
|
+
`.trim();async function p$(){try{return await import("ts-images")}catch{return null}}async function E7($,Z={}){let X={...TZ,...Z},J=await p$();if(J)try{return await IZ($,X,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return b7($,X)}async function IZ($,Z,X){let{generatePlaceholder:J,generateThumbHash:Y}=X,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let q=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:q.dataURL,width:q.width,height:q.height,aspectRatio:q.aspectRatio,originalWidth:q.originalWidth,originalHeight:q.originalHeight,strategy:Z.strategy,dominantColor:q.dominantColor,css:q.css}}function b7($,Z){let X=Z.width||20,J=Z.height||X,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${J}" viewBox="0 0 ${X} ${J}"><rect fill="#e5e7eb" width="${X}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:X,height:J,aspectRatio:X/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function DU($){let Z=await p$();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await b7($,{strategy:"thumbhash",width:32,height:32})).dataURL}function NU($){let Z=$[0]|$[1]<<8|$[2]<<16,X=(Z&63)/63,J=(Z>>6&63)/31.5-1,Y=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,q=$[3]|$[4]<<8,U=(q>>3&63)/63,W=(q>>9&63)/63,K=q>>15!==0,z=Math.max(3,K?G?5:7:G?5:7),H=Math.max(3,K?G?5:7:G?5:7),B=32,j=32,_=Math.max(0,Math.min(255,Math.round((X+J)*255))),V=Math.max(0,Math.min(255,Math.round(X*255))),O=Math.max(0,Math.min(255,Math.round((X-J)*255))),F=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
|
1755
1755
|
<rect fill="rgb(${_},${V},${O})" width="32" height="32"/>
|
|
1756
|
-
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(F)}`}async function
|
|
1756
|
+
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(F)}`}async function AU($,Z=20,X=50){return E7($,{strategy:"blur",width:Z,quality:X,blurLevel:40})}async function MU($){let Z=await p$();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function TU($,Z=1,X=1){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${X}"><rect fill="${$}" width="${Z}" height="${X}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`}function y7($,Z,X={}){let J=X.transitionDuration||300,Y=X.easing||"ease-out";return`
|
|
1757
1757
|
#${$} {
|
|
1758
1758
|
--stx-img-transition-duration: ${J}ms;
|
|
1759
1759
|
--stx-img-transition-easing: ${Y};
|
|
@@ -1770,7 +1770,7 @@ ${_}
|
|
|
1770
1770
|
#${$}.stx-img-loaded img {
|
|
1771
1771
|
opacity: 1;
|
|
1772
1772
|
}
|
|
1773
|
-
`.trim()}function
|
|
1773
|
+
`.trim()}function IU($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var x1=new Map;async function S7($,Z={}){let X=`${$}:${JSON.stringify(Z)}`;if(x1.has(X))return x1.get(X);let J=await E7($,Z);return x1.set(X,J),J}function kU(){x1.clear()}function EU(){return{size:x1.size,keys:Array.from(x1.keys())}}async function kZ(){try{return await import("./chunk-c0p9kf53.js")}catch($){if(!C7)console.warn("[stx-media] Image processor not available, some features disabled:",$),C7=!0;return null}}var C7=!1,i$=80,h5="async",u5="lazy",P7=!1;async function z5($,Z={}){let X=Z,J=$;if(J.process&&!J.skipOptimization){if(X.tsImagesConfig?.enabled&&!X.isDev)return CZ(J,X)}if(X.processedResult?.processed)return o$($,X.processedResult,Z);if(X.responsiveVariants)return x7($,X.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:q,sizes:U,widths:W=V1,dpr:K,formats:z=f1,quality:H=i$,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:V=!0,priority:O=!1,loading:F=O?"eager":u5,decoding:L=h5,fetchpriority:w,objectFit:R,objectPosition:D,crossorigin:N,referrerpolicy:T}=$,A=$.class,M=$.style,k=$.id,I=$.data||{},{isDev:y=!1,baseUrl:E=""}=Z;if(y&&!Z.optimize)return yZ($);let b,C,x=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!O)try{b=await S7(Y,{strategy:j,..._}),C=y7(x,b,_)}catch{}let f=K!==void 0&&G!==void 0,n;if(f)n=bZ($,x,b,Z);else n=await EZ($,x,b,Z);let m;if(O){let T0=z.includes("webp")?"webp":z[0],h0=K5(Y,W,{...B,q:H},T0),t=typeof U==="object"?m$(U):U||"100vw";m=`<link rel="preload" as="image" imagesrcset="${h0}" imagesizes="${t}" />`}let V0=[];if(!P7&&j!=="none")V0.push(c$),P7=!0;if(C)V0.push(C);let M0=V?f7(x):void 0;return{html:n,preloadLink:m,css:V0.length>0?V0.join(`
|
|
1774
1774
|
`):void 0,script:M0}}async function EZ($,Z,X,J){let{src:Y,alt:Q,width:G,height:q,sizes:U,widths:W=V1,formats:K=f1,quality:z=i$,params:H={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":u5,decoding:V=h5,fetchpriority:O,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:R}=$,D=$.class,N=$.style,T=$.data||{},A=typeof U==="object"?m$(U):U||"100vw",M=[];for(let y of K){let E=K5(Y,W,{...H,q:z},y),b=l$(y);if(B&&!j)M.push(` <source type="${b}" data-srcset="${E}" data-sizes="${A}" />`);else M.push(` <source type="${b}" srcset="${E}" sizes="${A}" />`)}let k=n$({src:q1(Y,{...H,q:z}),alt:Q,width:G,height:q,loading:j?void 0:_,decoding:V,fetchpriority:j?"high":O,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:R,className:v7(D,X),style:s$(N,F,L,X),lazy:B&&!j,data:T}),I;if(X){let y=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
|
|
1775
1775
|
<picture>
|
|
1776
1776
|
${M.join(`
|
|
@@ -1820,7 +1820,7 @@ ${M.join(`
|
|
|
1820
1820
|
|
|
1821
1821
|
observer.observe(container);
|
|
1822
1822
|
})();
|
|
1823
|
-
`.trim()}function SZ($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let X=Z[1],J={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(X))!==null){let[,G,q,U,W,K]=Q,z=U??W??K??!0;if(G===":"&&typeof z==="string")try{J[q]=JSON.parse(z)}catch{J[q]=z}else switch(q){case"src":J.src=String(z);break;case"alt":J.alt=String(z);break;case"width":J.width=Number(z)||z;break;case"height":J.height=Number(z)||z;break;case"sizes":J.sizes=String(z);break;case"quality":J.quality=Number(z);break;case"placeholder":J.placeholder=z;break;case"lazy":J.lazy=z===!0||z==="true";break;case"priority":J.priority=z===!0||z==="true";break;case"class":J.class=String(z);break;case"style":J.style=String(z);break;case"id":J.id=String(z);break;case"loading":J.loading=z;break;case"decoding":J.decoding=z;break;case"fetchpriority":J.fetchpriority=z;break;case"objectFit":J.objectFit=z;break;case"objectPosition":J.objectPosition=String(z);break;case"crossorigin":J.crossorigin=z;break}}if(!J.src||!J.alt)return null;return J}async function
|
|
1823
|
+
`.trim()}function SZ($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let X=Z[1],J={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(X))!==null){let[,G,q,U,W,K]=Q,z=U??W??K??!0;if(G===":"&&typeof z==="string")try{J[q]=JSON.parse(z)}catch{J[q]=z}else switch(q){case"src":J.src=String(z);break;case"alt":J.alt=String(z);break;case"width":J.width=Number(z)||z;break;case"height":J.height=Number(z)||z;break;case"sizes":J.sizes=String(z);break;case"quality":J.quality=Number(z);break;case"placeholder":J.placeholder=z;break;case"lazy":J.lazy=z===!0||z==="true";break;case"priority":J.priority=z===!0||z==="true";break;case"class":J.class=String(z);break;case"style":J.style=String(z);break;case"id":J.id=String(z);break;case"loading":J.loading=z;break;case"decoding":J.decoding=z;break;case"fetchpriority":J.fetchpriority=z;break;case"objectFit":J.objectFit=z;break;case"objectPosition":J.objectPosition=String(z);break;case"crossorigin":J.crossorigin=z;break}}if(!J.src||!J.alt)return null;return J}async function CU($,Z={}){let X=/<Img\s+[^>]*?\/?>/g,J=[],Y=[],Q=[],G=$,q=[],U;while((U=X.exec($))!==null)q.push({match:U[0],index:U.index});for(let W=q.length-1;W>=0;W--){let{match:K}=q[W],z=SZ(K);if(z){let H=await z5(z,Z);if(G=G.replace(K,H.html),H.preloadLink)J.push(H.preloadLink);if(H.css)Y.push(H.css);if(H.script)Q.push(H.script)}}return{html:G,preloadLinks:J,styles:Y,scripts:Q}}async function CZ($,Z){let X=await kZ();if(!X)return z5({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await X.generateResponsiveVariants($.src,$,J);if(Q)return x7($,Q,Z)}else{let Q=await X.processImage($.src,$,J);if(Q.processed)return o$($,Q,Z)}return z5({...$,process:!1},Z)}async function o$($,Z,X){let{alt:J,width:Y,height:Q,lazy:G=!0,priority:q=!1,objectFit:U,objectPosition:W,crossorigin:K,referrerpolicy:z}=$,H=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},V=Z.variants||[],O=V.find((C)=>C.format==="jpeg")||V.find((C)=>C.format==="webp")||V[0],F=O?.url||$.src,L=V.filter((C)=>C.format===(O?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of V){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],D=["avif","webp","jpeg","png"];for(let C of D){let x=w.get(C);if(x&&x.length>0){let f=x.map((m)=>`${m.url} ${m.width}w`).join(", "),n=l$(C);if(G&&!q)R.push(` <source type="${n}" data-srcset="${f}" />`);else R.push(` <source type="${n}" srcset="${f}" />`)}}let N=[];if(G&&!q){if(N.push(`data-src="${u0(F)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)N.push(`data-srcset="${L}"`)}else if(N.push(`src="${u0(F)}"`),L)N.push(`srcset="${L}"`);N.push(`alt="${u0(J)}"`);let T=Y||Z.originalWidth,A=Q||Z.originalHeight;if(T)N.push(`width="${T}"`);if(A)N.push(`height="${A}"`);if(!q)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),q)N.push('fetchpriority="high"');if(K)N.push(`crossorigin="${K}"`);if(z)N.push(`referrerpolicy="${z}"`);let M=[];if(U)M.push(`object-fit: ${U}`);if(W)M.push(`object-position: ${W}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(B)M.push(B);if(M.length>0)N.push(`style="${M.join("; ")}"`);let k=[];if(H)k.push(H);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)N.push(`class="${k.join(" ")}"`);if(G&&!q)N.push("data-stx-lazy");for(let[C,x]of Object.entries(_))N.push(`data-${C}="${u0(x)}"`);let I;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;I=`<div id="${j}" class="stx-img-placeholder" style="${C}">
|
|
1824
1824
|
<picture>
|
|
1825
1825
|
${R.join(`
|
|
1826
1826
|
`)}
|
|
@@ -1834,7 +1834,7 @@ ${R.join(`
|
|
|
1834
1834
|
`):void 0,script:E}}async function x7($,Z,X){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Y,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return o$($,J,X)}function PZ(){return d5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,X,J)=>{let{src:Y,alt:Q,options:G}=vZ($,Z,X);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let q={src:Y,alt:Q||"",widths:G.widths||V1,formats:G.formats||f1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},U=X.__isDev||!1,W=await z5(q,{isDev:U}),K=W.html;if(W.preloadLink)K=W.preloadLink+`
|
|
1835
1835
|
`+K;if(W.css)K+=`
|
|
1836
1836
|
<style>${W.css}</style>`;if(W.script)K+=`
|
|
1837
|
-
<script>${W.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function vZ($,Z,X){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=fZ(J),Q=r$(Y[0],X)||"",G=r$(Y[1],X)||"",q={};if(Y[2]){let U=r$(Y[2],X);if(typeof U==="object"&&U!==null)q=U;else if(typeof Y[2]==="string")try{q=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:q}}function fZ($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let q=0;q<$.length;q++){let U=$[q],W=q>0?$[q-1]:"";if((U==='"'||U==="'"||U==="`")&&W!=="\\"){if(!J)J=!0,Y=U;else if(U===Y)J=!1,Y="";else X+=U;continue}if(!J){if(U==="{")Q++;if(U==="}")Q--;if(U==="[")G++;if(U==="]")G--;if(U===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=U}if(X.trim())Z.push(X.trim());return Z}function r$($,Z){if(typeof $!=="string")return $;let X=$.trim();if(X.startsWith('"')&&X.endsWith('"')||X.startsWith("'")&&X.endsWith("'"))return X.slice(1,-1);if(!X.startsWith("/")&&!X.startsWith(".")&&!X.startsWith("http")&&!X.startsWith("{")){let J=Z[X];if(J!==void 0)return J}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var g7=PZ();async function u7(){try{return await import("./chunk-
|
|
1837
|
+
<script>${W.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function vZ($,Z,X){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=fZ(J),Q=r$(Y[0],X)||"",G=r$(Y[1],X)||"",q={};if(Y[2]){let U=r$(Y[2],X);if(typeof U==="object"&&U!==null)q=U;else if(typeof Y[2]==="string")try{q=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:q}}function fZ($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let q=0;q<$.length;q++){let U=$[q],W=q>0?$[q-1]:"";if((U==='"'||U==="'"||U==="`")&&W!=="\\"){if(!J)J=!0,Y=U;else if(U===Y)J=!1,Y="";else X+=U;continue}if(!J){if(U==="{")Q++;if(U==="}")Q--;if(U==="[")G++;if(U==="]")G--;if(U===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=U}if(X.trim())Z.push(X.trim());return Z}function r$($,Z){if(typeof $!=="string")return $;let X=$.trim();if(X.startsWith('"')&&X.endsWith('"')||X.startsWith("'")&&X.endsWith("'"))return X.slice(1,-1);if(!X.startsWith("/")&&!X.startsWith(".")&&!X.startsWith("http")&&!X.startsWith("{")){let J=Z[X];if(J!==void 0)return J}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var g7=PZ();async function u7(){try{return await import("./chunk-j5vyt8wd.js")}catch($){if(!h7)console.warn("[stx-media] Video processor not available, some features disabled:",$),h7=!0;return null}}var h7=!1,d7=!0,m7="metadata",xZ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function m5($,Z={}){let X=Z,J=$;if(J.process&&!J.skipProcessing){if(X.tsVideosConfig?.enabled&&!X.isDev)return mZ(J,X)}if(X.processedResult?.processed)return c7($,X.processedResult,Z);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await lZ(J,X);let{src:Q,sources:G=[],poster:q,posterPlaceholder:U,controls:W=d7,autoplay:K=!1,muted:z=!1,loop:H=!1,preload:B=m7,playsinline:j=!0,lazy:_=!0,player:V="native",type:O,width:F,height:L,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:D=!1}=$,N=Y||q,T=$.class,A=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(V==="ts-video")return hZ($,Z);if(O&&O!=="video")return gZ(Q||"",O,$);let k=G.length>0?G:Q?[{src:Q,type:l7(Q)}]:[],I=[`id="${M}"`];if(W)I.push("controls");if(K)I.push("autoplay");if(z)I.push("muted");if(H)I.push("loop");if(j)I.push("playsinline");if(R)I.push("disablepictureinpicture");if(D)I.push("disableremoteplayback");if(w)I.push(`crossorigin="${w}"`);if(_){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),N)I.push(`data-poster="${O0(N)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),N)I.push(`poster="${O0(N)}"`);if(F)I.push(`width="${F}"`);if(L)I.push(`height="${L}"`);if(T)I.push(`class="${O0(T)}"`);if(A)I.push(`style="${O0(A)}"`);let y=k.map((C)=>{return` <source ${_?`data-src="${O0(C.src)}"`:`src="${O0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
|
|
1838
1838
|
`),E=`<video ${I.join(" ")}>
|
|
1839
1839
|
${y}
|
|
1840
1840
|
Your browser does not support the video tag.
|
|
@@ -2042,7 +2042,7 @@ else {
|
|
|
2042
2042
|
.ts-video-player__play-button svg {
|
|
2043
2043
|
margin-left: 4px;
|
|
2044
2044
|
}
|
|
2045
|
-
`.trim();return{html:L,script:w,css:R}}function l7($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function uZ($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let X of Z){let J=$.match(X);if(J)return J[1]}return null}function dZ($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function O0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function
|
|
2045
|
+
`.trim();return{html:L,script:w,css:R}}function l7($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function uZ($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let X of Z){let J=$.match(X);if(J)return J[1]}return null}function dZ($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function O0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function hU($,Z,X){if(Z.src)return{src:String(Z.src),...Z};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=J.indexOf(",");if(Y===-1)return{src:J.replace(/^['"]|['"]$/g,"")};let Q=J.slice(0,Y).trim().replace(/^['"]|['"]$/g,""),G=J.slice(Y+1).trim();try{let q=JSON.parse(G);return{src:Q,...q}}catch{return{src:Q}}}async function mZ($,Z){let X=await u7();if(!X)return m5({...$,process:!1},Z);let J=Z.tsVideosConfig,Y=await X.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return c7($,Y,Z);return m5({...$,process:!1},Z)}async function lZ($,Z){let X=await u7();if(!X||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await X.generatePoster($.src,J,Y.outputDir,Y.baseUrl||"/videos"))?.url}function c7($,Z,X){let{controls:J=d7,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:q=m7,playsinline:U=!0,lazy:W=!0,width:K,height:z,crossorigin:H,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,_=$.class,V=$.style,O=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,F=$.src,L=l7(F);if(Z.transcoded)F=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)F=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)F=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let R=Z.poster?.url||$.poster,D=[`id="${O}"`];if(J)D.push("controls");if(Y)D.push("autoplay");if(Q)D.push("muted");if(G)D.push("loop");if(U)D.push("playsinline");if(B)D.push("disablepictureinpicture");if(j)D.push("disableremoteplayback");if(H)D.push(`crossorigin="${H}"`);if(W){if(D.push(`data-preload="${q}"`),D.push('preload="none"'),R)D.push(`data-poster="${O0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${q}"`),R)D.push(`poster="${O0(R)}"`);let N=K||Z.metadata?.width,T=z||Z.metadata?.height;if(N)D.push(`width="${N}"`);if(T)D.push(`height="${T}"`);if(_)D.push(`class="${O0(_)}"`);if(V)D.push(`style="${O0(V)}"`);let M=` <source ${W?`data-src="${O0(F)}"`:`src="${O0(F)}"`} type="${L}" />`,k=`<video ${D.join(" ")}>
|
|
2046
2046
|
${M}
|
|
2047
2047
|
Your browser does not support the video tag.
|
|
2048
2048
|
</video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${O0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
@@ -2164,15 +2164,15 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
2164
2164
|
`;let K=$;if(!Q)K=K.replace(/<head[^>]*>/,`$&
|
|
2165
2165
|
<title>${c(G)}</title>`);return K.replace(/<head[^>]*>/,`$&
|
|
2166
2166
|
${W}
|
|
2167
|
-
`)}function c($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var BX=["og:","article:","book:","profile:","fb:","music:","video:"];function X6($){let Z=$.trim(),X=Z[0];if((X==="'"||X==='"'||X==="`")&&Z.length>1&&Z.at(-1)===X)return{value:Z.slice(1,-1),quoted:!0};return{value:Z,quoted:!1}}var Q3={name:"meta",handler:($,Z,X,J)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",l.INVALID_DIRECTIVE_SYNTAX);let Y=X6(Z[0]).value,Q;if(Z.length>1){let U=X6(Z[1]);Q=U.quoted?U.value:String(X?.[U.value]??U.value)}else{let U=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,W=X?.openGraph;Q=String(X?.[U]??W?.[U]??"")}if(!Q)return"";let q=BX.some((U)=>Y.startsWith(U))?{property:Y,content:Q}:{name:Y,content:Q};if(X)X.__stx_runtime_head=o5(X.__stx_runtime_head??{},{meta:[q]});return""},hasEndTag:!1},G3={name:"structuredData",handler:($,Z,X,J)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",l.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return $0("StructuredData","structuredData requires @type property",l.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Y)}</script>`}catch(Y){let Q=Y instanceof Error?Y.message:String(Y);return $0("StructuredData",Q,l.EVALUATION_ERROR)}},hasEndTag:!0};function
|
|
2167
|
+
`)}function c($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var BX=["og:","article:","book:","profile:","fb:","music:","video:"];function X6($){let Z=$.trim(),X=Z[0];if((X==="'"||X==='"'||X==="`")&&Z.length>1&&Z.at(-1)===X)return{value:Z.slice(1,-1),quoted:!0};return{value:Z,quoted:!1}}var Q3={name:"meta",handler:($,Z,X,J)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",l.INVALID_DIRECTIVE_SYNTAX);let Y=X6(Z[0]).value,Q;if(Z.length>1){let U=X6(Z[1]);Q=U.quoted?U.value:String(X?.[U.value]??U.value)}else{let U=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,W=X?.openGraph;Q=String(X?.[U]??W?.[U]??"")}if(!Q)return"";let q=BX.some((U)=>Y.startsWith(U))?{property:Y,content:Q}:{name:Y,content:Q};if(X)X.__stx_runtime_head=o5(X.__stx_runtime_head??{},{meta:[q]});return""},hasEndTag:!1},G3={name:"structuredData",handler:($,Z,X,J)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",l.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return $0("StructuredData","structuredData requires @type property",l.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Y)}</script>`}catch(Y){let Q=Y instanceof Error?Y.message:String(Y);return $0("StructuredData",Q,l.EVALUATION_ERROR)}},hasEndTag:!0};function OW(){return[Q3,G3]}function VW($,Z){let X=Z.replace(/\/$/,""),J=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
|
|
2168
2168
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
2169
2169
|
${$.map((Q)=>{let G=Q.startsWith("http")?Q:`${X}${Q.startsWith("/")?"":"/"}${Q}`;return` <sitemap>
|
|
2170
2170
|
<loc>${_X(G)}</loc>
|
|
2171
2171
|
<lastmod>${J}</lastmod>
|
|
2172
2172
|
</sitemap>`}).join(`
|
|
2173
2173
|
`)}
|
|
2174
|
-
</sitemapindex>`}async function
|
|
2175
|
-
`).trim()}function
|
|
2174
|
+
</sitemapindex>`}async function FW($,Z){let{extensions:X=[".stx",".html",".htm"],ignore:J=["_*",".*","node_modules","components","partials","layouts"]}=Z,Y=[],Q=X.length===1?`*${X[0]}`:`*{${X.join(",")}}`,G=new Bun.Glob(`**/${Q}`);for await(let q of G.scan($)){if(J.some((H)=>{if(H.startsWith("*"))return q.includes(H.slice(1));return q.startsWith(H)||q.includes(`/${H}`)}))continue;let W=q.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!W.startsWith("/"))W=`/${W}`;if(W!=="/"&&W.endsWith("/"))W=W.slice(0,-1);let K=`${$}/${q}`,z;try{let H=await Bun.file(K).stat();if(H)z=new Date(H.mtime).toISOString().split("T")[0]}catch{}Y.push({loc:W||"/",lastmod:z,priority:W==="/"?1:0.5})}return Y.sort((q,U)=>q.loc.localeCompare(U.loc)),Y}function jX($){let Z=[];for(let X of $.rules){if(Z.push(`User-agent: ${X.userAgent}`),X.allow)for(let J of X.allow)Z.push(`Allow: ${J}`);if(X.disallow)for(let J of X.disallow)Z.push(`Disallow: ${J}`);if(X.crawlDelay!==void 0)Z.push(`Crawl-delay: ${X.crawlDelay}`);Z.push("")}if($.sitemap){let X=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let J of X)Z.push(`Sitemap: ${J}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
|
|
2175
|
+
`).trim()}function LW($){return jX({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function _X($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}import OX from"fs";import f0 from"path";async function MW($,Z){if(!$.webComponents?.enabled)return[];let X=$.webComponents.components||[],J=[];if(X.length>0){if($.debug)console.log(`Building ${X.length} web components...`);for(let Y of X)try{let Q=await VX(Y,$,Z);if(Q)J.push(Q)}catch(Q){if(console.error(`Error building web component ${Y.name}:`,Q),$.debug)throw Q}}return J}async function VX($,Z,X){let{name:J,file:Y,tag:Q,extends:G}=$;if(!J||!Y||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let q=null;if(f0.isAbsolute(Y)&&await r(Y))q=Y;else if(Z.componentsDir){let _=f0.join(Z.componentsDir,Y);if(await r(_))q=_}if(!q)q=await r5(Y,process.cwd(),Z,X);if(!q)return console.error(`Web component source file not found: ${Y}`),null;let U=await Bun.file(q).text();X.add(q);let K=($.outputFormat||"js")==="ts",z=K?LX({name:J,tag:Q,baseElement:G,source:U,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):FX({name:J,tag:Q,baseElement:G,source:U,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await OX.promises.mkdir(H,{recursive:!0});let B=K?"ts":"js",j=f0.join(H,`${Q}.${B}`);if(await Bun.write(j,z),Z.debug)console.log(`Built web component ${J} -> ${j}`);return j}function FX($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:q,attributes:U=[]}=$,W=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)W=W.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),W=W.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),W=W.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),W=W.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let K="";if(q)K=`<link rel="stylesheet" href="${q}">`;return`/**
|
|
2176
2176
|
* ${Z} Web Component
|
|
2177
2177
|
* Auto-generated from stx component
|
|
2178
2178
|
*/
|
|
@@ -2419,9 +2419,9 @@ declare global {
|
|
|
2419
2419
|
|
|
2420
2420
|
// Register the web component
|
|
2421
2421
|
customElements.define('${X}', ${K});
|
|
2422
|
-
`}var q3={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function U3($){let Z=$.split("").reduce((X,J)=>(X<<5)-X+J.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function wX($,Z,X={}){let J={...q3,...X},Y=U3(Z);switch(J.strategy){case"shadow":return $;case"prefix":return DX($,J.prefix||Z,J.preserveOriginal);case"attribute":return RX($,Y,J.attributeName||"data-v",J.preserveOriginal);case"bem":return NX($,Z,J.preserveOriginal);default:return $}}function RX($,Z,X,J){let Y=`[${X}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,q)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${J?`${G}${Y}`:`${G}${Y}`}${q}`})}function DX($,Z,X){return $.replace(/\.([a-z_][\w-]*)/gi,(J,Y)=>{if(Y.startsWith(Z))return J;let Q=`${Z}__${Y}`;return X?`.${Q}`:`.${Q}`})}function NX($,Z,X){let J=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(J))return`.${J}__${Q}`;return Y}let G=`${J}__${Q}`;return X?`.${G}`:`.${G}`})}function AX($,Z,X={}){let J={...q3,...X};if(J.strategy==="shadow")return $;if(J.strategy==="attribute"){let Y=U3(Z),G=`${J.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(q,U,W)=>{if(/^(?:script|style|!--)$/i.test(U))return q;let K=W.trimEnd().endsWith("/"),z=K?W.slice(0,-1):W;return`<${U}${z} ${G}${K?"/":""}>`})}if(J.strategy==="prefix"||J.strategy==="bem"){let Y=J.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):J.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((U)=>{if(!U)return U;if(U.startsWith(Y))return U;return`${Y}__${U}`}).join(" ")}"`})}return $}function
|
|
2422
|
+
`}var q3={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function U3($){let Z=$.split("").reduce((X,J)=>(X<<5)-X+J.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function wX($,Z,X={}){let J={...q3,...X},Y=U3(Z);switch(J.strategy){case"shadow":return $;case"prefix":return DX($,J.prefix||Z,J.preserveOriginal);case"attribute":return RX($,Y,J.attributeName||"data-v",J.preserveOriginal);case"bem":return NX($,Z,J.preserveOriginal);default:return $}}function RX($,Z,X,J){let Y=`[${X}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,q)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${J?`${G}${Y}`:`${G}${Y}`}${q}`})}function DX($,Z,X){return $.replace(/\.([a-z_][\w-]*)/gi,(J,Y)=>{if(Y.startsWith(Z))return J;let Q=`${Z}__${Y}`;return X?`.${Q}`:`.${Q}`})}function NX($,Z,X){let J=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(J))return`.${J}__${Q}`;return Y}let G=`${J}__${Q}`;return X?`.${G}`:`.${G}`})}function AX($,Z,X={}){let J={...q3,...X};if(J.strategy==="shadow")return $;if(J.strategy==="attribute"){let Y=U3(Z),G=`${J.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(q,U,W)=>{if(/^(?:script|style|!--)$/i.test(U))return q;let K=W.trimEnd().endsWith("/"),z=K?W.slice(0,-1):W;return`<${U}${z} ${G}${K?"/":""}>`})}if(J.strategy==="prefix"||J.strategy==="bem"){let Y=J.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):J.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((U)=>{if(!U)return U;if(U.startsWith(Y))return U;return`${Y}__${U}`}).join(" ")}"`})}return $}function TW($,Z={}){let X={...q3,...Z},J=U3($);return`${X.attributeName||"data-v"}-${J}`}function IW($,Z,X={}){let J="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,q,U)=>{if(/\bscoped\b/i.test(q)||X.strategy!=="shadow")J+=`${wX(U,Z,X)}
|
|
2423
2423
|
`;else J+=`${U}
|
|
2424
|
-
`;return""});return{html:AX(Y,Z,X),css:J.trim()}}function u1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function
|
|
2424
|
+
`;return""});return{html:AX(Y,Z,X),css:J.trim()}}function u1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function kW($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:U={},events:W={},methods:K={},state:z={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((T)=>q[T].attribute!==!1).map((T)=>q[T].attribute||u1(T)),_=B.map((T)=>{let A=q[T],M=A.default!==void 0?JSON.stringify(A.default):A.type==="string"?'""':A.type==="number"?"0":A.type==="boolean"?"false":A.type==="array"?"[]":"{}";return` this._${T} = ${M};`}).join(`
|
|
2425
2425
|
`),V=B.map((T)=>{let A=q[T],M=A.attribute!==!1?A.attribute||u1(T):null,k=A.reflect&&M?`
|
|
2426
2426
|
if (value !== null && value !== undefined) {
|
|
2427
2427
|
${A.type==="boolean"?`if (value) { this.setAttribute('${M}', ''); }
|
|
@@ -2623,7 +2623,7 @@ customElements.define('${X}', ${H});
|
|
|
2623
2623
|
// Export for module usage
|
|
2624
2624
|
export { ${H} };
|
|
2625
2625
|
export default ${H};
|
|
2626
|
-
`}function
|
|
2626
|
+
`}function EW($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:U={},events:W={},methods:K={},state:z={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((A)=>q[A].attribute!==!1).map((A)=>q[A].attribute||u1(A)),_=(A)=>{switch(A){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";case"array":return"unknown[]";default:return"unknown"}},V=B.length>0?`
|
|
2627
2627
|
/**
|
|
2628
2628
|
* Props interface for ${Z}
|
|
2629
2629
|
*/
|
|
@@ -2875,7 +2875,7 @@ declare global {
|
|
|
2875
2875
|
customElements.define('${X}', ${H});
|
|
2876
2876
|
|
|
2877
2877
|
export default ${H};
|
|
2878
|
-
`}function
|
|
2878
|
+
`}function bW(){return`/**
|
|
2879
2879
|
* ReactiveElement Mixin
|
|
2880
2880
|
* Adds reactive properties and lifecycle management to web components
|
|
2881
2881
|
*/
|
|
@@ -2997,7 +2997,7 @@ else {
|
|
|
2997
2997
|
|
|
2998
2998
|
export { ReactiveElement };
|
|
2999
2999
|
export default ReactiveElement;
|
|
3000
|
-
`}function
|
|
3000
|
+
`}function yW(){return`/**
|
|
3001
3001
|
* stx Reactive Web Components Runtime
|
|
3002
3002
|
* Provides base classes and utilities for reactive web components
|
|
3003
3003
|
*/
|
|
@@ -3267,12 +3267,12 @@ ${K}
|
|
|
3267
3267
|
customElements.define('${Z}', ${G});
|
|
3268
3268
|
`}async function q6($,Z,X,J){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",l.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(X.__stx_options||{}).componentsDir||"components",q=f0.isAbsolute(G)?[f0.join(G,`${Y}.stx`),f0.join(f0.dirname(J),`${Y}.stx`)]:[f0.join(f0.dirname(J),G,`${Y}.stx`),f0.join(process.cwd(),G,`${Y}.stx`),f0.join(f0.dirname(J),`${Y}.stx`)],U=null;for(let z of q)if(await r(z)){U=await Bun.file(z).text();break}if(!U)return $0("WebComponent",`Component file not found: ${Y}.stx`,l.FILE_NOT_FOUND);let W=MX(U,Y);return`<script type="module">
|
|
3269
3269
|
${TX(W)}
|
|
3270
|
-
</script>`}var O6={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:H6,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:T7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:q6,hasEndTag:!1,description:"Include a web component in the template"},K6,z6,Q3,G3,f$,g$,h$,x$,D7,B7,g7,a$,..._6],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function kX($,Z,X){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=X||process.cwd(),Q=N0.join(Y,"resources","views"),G=N0.join(Y,"resources","layouts");if(a5.existsSync(Q)&&a5.existsSync(G))return{root:"resources",pagesDir:"views"};let q=N0.join(Y,"resources","views","pages");if(a5.existsSync(q))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}var U6=new Set,t5=["partialsDir","componentsDir","layoutsDir"],W3=new WeakMap;function EX($,Z){let X=Z.replace(/[\\/]+$/,"");if(!X||X===".")return!0;let J=$.replace(/\\/g,"/"),Y=X.replace(/\\/g,"/");return J===Y||J.startsWith(`${Y}/`)}function bX($,Z){let X=!$.root,J=kX($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,X&&J.root!=="."){let Y=`${Z}::${J.root}`;if(!U6.has(Y))U6.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!W3.has($)){let Y={};for(let Q of t5){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}W3.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of t5){let G=$[Q];if(typeof G!=="string"||!G)continue;if(N0.isAbsolute(G)||EX(G,Y))continue;$[Q]=N0.join(Y,G)}}for(let Y of t5){let Q=$[Y];if(typeof Q!=="string"||!Q||N0.isAbsolute(Q))continue;$[Y]=N0.resolve(Z,Q)}return $}function yX($,Z){let X=W3.get($);for(let J of t5){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let Q=N0.isAbsolute(Y)?Y:N0.join(Z,Y);if(a5.existsSync(Q))continue;let G=X?.[J]??Y,q=$.root,U=!!q&&q!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(U?`, resolved under root "${q}".`:"."))}}function SX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function CX($){if(B6($.stateDir),$.stateDir=j6(),$.cachePath=j5($.cachePath),$.build)$.build.cacheDir=j5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=j5($.media.cache.directory);if($.story)$.story.outDir=j5($.story.outDir)}var d1=null,W6=new Map,e5=null;async function K3($){if(!$){if(d1)return d1;if(e5)return e5}let Z=$?N0.resolve($):process.cwd(),X=W6.get(Z);if(X)return X;let J=(async()=>{let Q=(await IX({name:"stx",alias:"ui",cwd:Z,defaultConfig:O6,verbose:!1})).config;if(SX(Q),CX(Q),bX(Q,Z),yX(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await import("./chunk-xfp10a23.js"),q=[],U=[];for(let W of Q.plugins){let K=typeof W==="string"?W:W[0],z=typeof W==="string"?{}:W[1]||{};try{let H,B;try{H=await import(K),B=N0.dirname(h.resolve(K))}catch{let _=N0.resolve(process.cwd(),K);H=await import(_),B=N0.dirname(_)}let j=H.default||H;if(!G.has(j.name))await G.register(j,Q);if(j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let V of _)q.push(N0.resolve(B,V))}if(j.pages){let _=N0.resolve(B,j.pages),V=z.path||"/";U.push({dir:_,prefix:V})}if(j.setup){let _={addDirective:(V)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(V)},addRoute:(V,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[V]=O},addMiddleware:(V)=>{Q.middleware=Q.middleware||[],Q.middleware.push(V)},pluginDir:B,config:Q};await j.setup(z,_)}console.log(`[stx] Plugin loaded: ${j.name||K}`)}catch(H){console.warn(`[stx] Failed to load plugin ${K}:`,H.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=U}return Q})();if(W6.set(Z,J),!$)e5=J,J.then((Y)=>{d1=Y}).catch(()=>{});return J}var V6=new Proxy(O6,{get($,Z){if(d1&&Z in d1)return d1[Z];if(!e5)K3().catch((X)=>{console.warn("[stx] Failed to load config file:",X?.message||X)});return $[Z]}});function iW($){return $}function nW($){let Z=[],X=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)X.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)X.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)X.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)X.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:X}}var H3=new Map;async function fX($,Z={}){try{if(!await r($))throw Error(`Markdown file not found: ${$}`);let J=(await PX.promises.stat($)).mtime.getTime();if(Z.cache&&H3.has($)){let z=H3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=A7(Y),q=Z.markdown||V6.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=W5(G,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)W=await xX(W,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:Q||{}};if(Z.cache)H3.set($,{...K,updatedAt:J});return K}catch(X){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,X);let J=X instanceof Error?X.message:String(X);return{content:W0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}var $$=null;async function xX($,Z,X){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!$$)try{$$=await vX({theme:Z||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),$}let Y=async(q,U,W,K)=>{let z=K.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),H=W||(X?"text":"");if(!H)return q;try{if(!$$.getSupportedLanguages().includes(H))return q;return(await $$.highlight(z,H,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return q},Q=$,G=$.matchAll(J);for(let q of G){let[U,W,K,z]=q,H=await Y(U,W,K,z);Q=Q.replace(U,H)}return Q}async function F6($,Z,X="",J={}){return await gX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,q,U,W)=>{try{let K=q;if(!z3.isAbsolute(q))K=z3.resolve(z3.dirname(X),q);let z={};if(U)try{try{z=JSON.parse(U)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let F=U.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),D=L.substring(w+1).trim(),N=D.startsWith('"')&&D.endsWith('"'),T=D.startsWith("'")&&D.endsWith("'");if(N||T)D=D.substring(1,D.length-1);z[R]=D}}}}catch(O){if(J.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:H,data:B}=await fX(K,J),j={...Z,...B,...z},_=H,V=/\{\{([^}]+)\}\}/g;return _=_.replace(V,(O,F)=>{let L=F.trim();return j[L]!==void 0?String(j[L]):O}),_}catch(K){let z=K instanceof Error?K.message:String(K);return W0("Markdown File",`Error including markdown file: ${z}`,X,$,W,G)}})}async function gX($,Z,X){let J=[],Y;while((Y=Z.exec($))!==null){let q=Y[0],U=Y.index,W=Y;J.push(X(...W).then((K)=>({match:q,replacement:K,index:U})))}let Q=await Promise.all(J);Q.sort((q,U)=>U.index-q.index);let G=$;for(let{match:q,replacement:U}of Q)G=G.replace(q,()=>U);return G}function U1($,Z){try{let X=$.trim();if(Q0(X))return G0(X,Object.keys(Z))(...Object.values(Z));else return X0(X,Z)}catch{return!1}}class Z${source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,X=this.column,J=this.source[this.pos];if(/\s/.test(J))return this.readWhitespace($,Z,X);if(J==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,X);if(J==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,X);if(J==='"'||J==="'")return this.readString(J,$,Z,X);if(J==="`")return this.readTemplateString($,Z,X);if(/\d/.test(J)||J==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,X);if(/[a-z_$]/i.test(J))return this.readIdentifier($,Z,X);if(J==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:X}}if(J==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:X}}if(J==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:X};if(J==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,X);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:X};if(/[+\-*/%<>=!&|^~?:]/.test(J))return this.advance(),{type:"OPERATOR",value:J,start:$,end:this.pos,line:Z,column:X};if(/[()[\]{},;.]/.test(J))return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X};return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X}}readWhitespace($,Z,X){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readLineComment($,Z,X){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
|
|
3270
|
+
</script>`}var O6={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:H6,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:T7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:q6,hasEndTag:!1,description:"Include a web component in the template"},K6,z6,Q3,G3,f$,g$,h$,x$,D7,B7,g7,a$,..._6],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function kX($,Z,X){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=X||process.cwd(),Q=N0.join(Y,"resources","views"),G=N0.join(Y,"resources","layouts");if(a5.existsSync(Q)&&a5.existsSync(G))return{root:"resources",pagesDir:"views"};let q=N0.join(Y,"resources","views","pages");if(a5.existsSync(q))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}var U6=new Set,t5=["partialsDir","componentsDir","layoutsDir"],W3=new WeakMap;function EX($,Z){let X=Z.replace(/[\\/]+$/,"");if(!X||X===".")return!0;let J=$.replace(/\\/g,"/"),Y=X.replace(/\\/g,"/");return J===Y||J.startsWith(`${Y}/`)}function bX($,Z){let X=!$.root,J=kX($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,X&&J.root!=="."){let Y=`${Z}::${J.root}`;if(!U6.has(Y))U6.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!W3.has($)){let Y={};for(let Q of t5){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}W3.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of t5){let G=$[Q];if(typeof G!=="string"||!G)continue;if(N0.isAbsolute(G)||EX(G,Y))continue;$[Q]=N0.join(Y,G)}}for(let Y of t5){let Q=$[Y];if(typeof Q!=="string"||!Q||N0.isAbsolute(Q))continue;$[Y]=N0.resolve(Z,Q)}return $}function yX($,Z){let X=W3.get($);for(let J of t5){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let Q=N0.isAbsolute(Y)?Y:N0.join(Z,Y);if(a5.existsSync(Q))continue;let G=X?.[J]??Y,q=$.root,U=!!q&&q!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(U?`, resolved under root "${q}".`:"."))}}function SX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function CX($){if(B6($.stateDir),$.stateDir=j6(),$.cachePath=j5($.cachePath),$.build)$.build.cacheDir=j5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=j5($.media.cache.directory);if($.story)$.story.outDir=j5($.story.outDir)}var d1=null,W6=new Map,e5=null;async function K3($){if(!$){if(d1)return d1;if(e5)return e5}let Z=$?N0.resolve($):process.cwd(),X=W6.get(Z);if(X)return X;let J=(async()=>{let Q=(await IX({name:"stx",alias:"ui",cwd:Z,defaultConfig:O6,verbose:!1})).config;if(SX(Q),CX(Q),bX(Q,Z),yX(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await import("./chunk-p8pyqr7p.js"),q=[],U=[];for(let W of Q.plugins){let K=typeof W==="string"?W:W[0],z=typeof W==="string"?{}:W[1]||{};try{let H,B;try{H=await import(K),B=N0.dirname(h.resolve(K))}catch{let _=N0.resolve(process.cwd(),K);H=await import(_),B=N0.dirname(_)}let j=H.default||H;if(!G.has(j.name))await G.register(j,Q);if(j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let V of _)q.push(N0.resolve(B,V))}if(j.pages){let _=N0.resolve(B,j.pages),V=z.path||"/";U.push({dir:_,prefix:V})}if(j.setup){let _={addDirective:(V)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(V)},addRoute:(V,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[V]=O},addMiddleware:(V)=>{Q.middleware=Q.middleware||[],Q.middleware.push(V)},pluginDir:B,config:Q};await j.setup(z,_)}console.log(`[stx] Plugin loaded: ${j.name||K}`)}catch(H){console.warn(`[stx] Failed to load plugin ${K}:`,H.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=U}return Q})();if(W6.set(Z,J),!$)e5=J,J.then((Y)=>{d1=Y}).catch(()=>{});return J}var V6=new Proxy(O6,{get($,Z){if(d1&&Z in d1)return d1[Z];if(!e5)K3().catch((X)=>{console.warn("[stx] Failed to load config file:",X?.message||X)});return $[Z]}});function nW($){return $}function sW($){let Z=[],X=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)X.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)X.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)X.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)X.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:X}}var H3=new Map;async function fX($,Z={}){try{if(!await r($))throw Error(`Markdown file not found: ${$}`);let J=(await PX.promises.stat($)).mtime.getTime();if(Z.cache&&H3.has($)){let z=H3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=A7(Y),q=Z.markdown||V6.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=W5(G,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)W=await xX(W,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:Q||{}};if(Z.cache)H3.set($,{...K,updatedAt:J});return K}catch(X){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,X);let J=X instanceof Error?X.message:String(X);return{content:W0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}var $$=null;async function xX($,Z,X){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!$$)try{$$=await vX({theme:Z||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),$}let Y=async(q,U,W,K)=>{let z=K.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),H=W||(X?"text":"");if(!H)return q;try{if(!$$.getSupportedLanguages().includes(H))return q;return(await $$.highlight(z,H,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return q},Q=$,G=$.matchAll(J);for(let q of G){let[U,W,K,z]=q,H=await Y(U,W,K,z);Q=Q.replace(U,H)}return Q}async function F6($,Z,X="",J={}){return await gX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,q,U,W)=>{try{let K=q;if(!z3.isAbsolute(q))K=z3.resolve(z3.dirname(X),q);let z={};if(U)try{try{z=JSON.parse(U)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let F=U.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),D=L.substring(w+1).trim(),N=D.startsWith('"')&&D.endsWith('"'),T=D.startsWith("'")&&D.endsWith("'");if(N||T)D=D.substring(1,D.length-1);z[R]=D}}}}catch(O){if(J.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:H,data:B}=await fX(K,J),j={...Z,...B,...z},_=H,V=/\{\{([^}]+)\}\}/g;return _=_.replace(V,(O,F)=>{let L=F.trim();return j[L]!==void 0?String(j[L]):O}),_}catch(K){let z=K instanceof Error?K.message:String(K);return W0("Markdown File",`Error including markdown file: ${z}`,X,$,W,G)}})}async function gX($,Z,X){let J=[],Y;while((Y=Z.exec($))!==null){let q=Y[0],U=Y.index,W=Y;J.push(X(...W).then((K)=>({match:q,replacement:K,index:U})))}let Q=await Promise.all(J);Q.sort((q,U)=>U.index-q.index);let G=$;for(let{match:q,replacement:U}of Q)G=G.replace(q,()=>U);return G}function U1($,Z){try{let X=$.trim();if(Q0(X))return G0(X,Object.keys(Z))(...Object.values(Z));else return X0(X,Z)}catch{return!1}}class Z${source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,X=this.column,J=this.source[this.pos];if(/\s/.test(J))return this.readWhitespace($,Z,X);if(J==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,X);if(J==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,X);if(J==='"'||J==="'")return this.readString(J,$,Z,X);if(J==="`")return this.readTemplateString($,Z,X);if(/\d/.test(J)||J==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,X);if(/[a-z_$]/i.test(J))return this.readIdentifier($,Z,X);if(J==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:X}}if(J==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:X}}if(J==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:X};if(J==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,X);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:X};if(/[+\-*/%<>=!&|^~?:]/.test(J))return this.advance(),{type:"OPERATOR",value:J,start:$,end:this.pos,line:Z,column:X};if(/[()[\]{},;.]/.test(J))return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X};return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X}}readWhitespace($,Z,X){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readLineComment($,Z,X){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
|
|
3271
3271
|
`)this.advance();return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readBlockComment($,Z,X){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readString($,Z,X,J){this.advance();while(this.pos<this.source.length){let Y=this.source[this.pos];if(Y==="\\"){this.advance(2);continue}if(Y===$){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:X,column:J}}readTemplateString($,Z,X){this.advance();let J=0,Y=256;while(this.pos<this.source.length){let Q=this.source[this.pos];if(Q==="\\"){this.advance(2);continue}if(Q==="$"&&this.peek(1)==="{"){if(J>=Y){this.pos=this.source.length;break}this.advance(2),J++;continue}if(Q==="{"&&J>0){J++,this.advance();continue}if(Q==="}"&&J>0){J--,this.advance();continue}if(Q==="`"&&J===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readNumber($,Z,X){if(this.source[this.pos]==="0"){let J=this.peek(1)?.toLowerCase();if(J==="x"||J==="o"||J==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readIdentifier($,Z,X){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readDirective($,Z,X){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}advance($=1){for(let Z=0;Z<$&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
|
|
3272
|
-
`)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function H0($,Z,X,J=0){let Y=0,Q=J,G=null,q=0,U=!1;while(Q<$.length){let W=$[Q];if(G&&U){U=!1,Q++;continue}if(G&&W==="\\"){U=!0,Q++;continue}if(U=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){q++,Q+=2;continue}if(q>0&&W==="}"){q--,Q++;continue}if(W==="`"&&G==="`"&&q===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)Y++;else if(W===X){if(Y--,Y===0)return Q}Q++}return-1}function L6($,Z){let X=Z,J={paren:0,bracket:0,brace:0},Y=null,Q=0;while(X<$.length){let G=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((G==='"'||G==="'")&&!Y){Y=G,X++;continue}if(G===Y&&Y!=="`"){Y=null,X++;continue}if(G==="`"&&!Y){Y="`",X++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,X++;continue}if(Y==="`"&&G==="$"&&$[X+1]==="{"){Q++,X+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;X++;continue}if(Y){X++;continue}if(J.paren===0&&J.bracket===0&&J.brace===0){if($.slice(X,X+2)==="}}"||$.slice(X,X+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")J.paren++;else if(G===")"){if(J.paren--,J.paren<0)break}else if(G==="[")J.bracket++;else if(G==="]"){if(J.bracket--,J.bracket<0)break}else if(G==="{")J.brace++;else if(G==="}"){if(J.brace--,J.brace<0)break}X++}return{expression:$.slice(Z,X),endPos:X}}function B3($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+=q+$[G+1],G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}if(q==="|"&&$[G-1]==="\\"&&!Y){X=X.slice(0,-1)+q;continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function W1($,Z){let X=hX($,Z);return X.ok?{expression:X.expression,endPos:X.endPos}:null}function hX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return{ok:!1,reason:"missing-open-paren",pos:X};let J=H0($,"(",")",X);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:X};return{ok:!0,expression:$.slice(X+1,J),endPos:J+1}}function uX($,Z){let X=$.lastIndexOf("<",Z);if(X===-1)return!1;return X>$.lastIndexOf(">",Z)}function w1($,Z,X,J){let Y=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),q=new RegExp(`@${X}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,q.lastIndex=Q;let U=G.exec($),W=q.exec($),K=U?U.index:1/0,z=W?W.index:1/0;if(K<z)Y++,Q=K+U[0].length;else if(z<1/0){if(Y--,Y===0)return z;Q=z+W[0].length}else break}return-1}function w6($,Z){let X=$.slice(Z).match(/^@if\s*/);if(!X)return null;let J=Z+X[0].length,Y=W1($,J);if(!Y)return null;let Q=Y.endPos,G=w1($,"if","endif",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,K="if",z=Y.expression,H=0,B=0;while(W<q.length){let j=q.indexOf("@",W);if(j===-1)break;W=j;let _=q.substring(j);if(uX(q,j)){W++;continue}if(/^@if\s*\(/.test(_)){B++,W++;continue}if(/^@endif(?![a-z])/.test(_)){B--,W+=6;continue}if(B===0){let V=_.match(/^@elseif\s*/);if(V){U.push({type:K,condition:z,content:q.substring(H,W),start:Q+H,end:Q+W});let O=W+V[0].length,F=W1(q,O);if(!F){W++;continue}K="elseif",z=F.expression,W=F.endPos,H=W;continue}else if(/^@else(?![a-z])/.test(_)){U.push({type:K,condition:z,content:q.substring(H,W),start:Q+H,end:Q+W}),K="else",z=void 0,W+=5,H=W;continue}}W++}return U.push({type:K,condition:z,content:q.slice(H),start:Q+H,end:Q+q.length}),{fullMatch:$.slice(Z,G+6),branches:U,start:Z,end:G+6}}function _5($){let Z=[],X=/@if\s*\(/g,J=X.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=X.exec($);continue}let Q=w6($,J.index);if(Q)Z.push(Q),X.lastIndex=Q.end;J=X.exec($)}return Z}function X$($,Z,X){let J=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(J.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=Y.exec($);continue}let q=Q.index,U=q+Q[0].length-1,W=H0($,"(",")",U);if(W===-1){Q=Y.exec($);continue}let K=$.slice(U+1,W),z=W+1,H=w1($,Z,X,z);if(H===-1){Q=Y.exec($);continue}let B=$.slice(z,H),j=H+`@${X}`.length;J.push({fullMatch:$.slice(q,j),name:Z,params:K,content:B,start:q,end:j}),Y.lastIndex=j,Q=Y.exec($)}return J}function j3($,Z){let X=$.slice(Z).match(/^@switch\s*/);if(!X)return null;let J=Z+X[0].length,Y=W1($,J);if(!Y)return null;let Q=Y.endPos,G=w1($,"switch","endswitch",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,K=null,z=0;while(W<q.length){let H=q.slice(W),B=H.match(/^@switch\s*\(/),j=H.match(/^@endswitch(?![a-z])/);if(B){if(z++,K)K.content+=B[0];W+=B[0].length;continue}if(j){if(z--,K)K.content+=j[0];W+=j[0].length;continue}if(z>0){if(K)K.content+=q[W];W++;continue}let _=H.match(/^@case\s*/),V=H.match(/^@default(?![a-z])/),O=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(K)U.push(K);let F=W+_[0].length,L=W1(q,F);if(!L){W++;continue}K={type:"case",value:L.expression,content:""},W=L.endPos}else if(V&&H.startsWith("@default")){if(K)U.push(K);K={type:"default",content:""},W+=V[0].length}else if(O&&H.startsWith("@break"))W+=O[0].length;else{if(K)K.content+=q[W];W++}}if(K)U.push(K);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:U,start:Z,end:G+10}}function dX($){let Z=[],X=0;while(X<$.length){let J=$.indexOf("{{",X),Y=$.indexOf("{!!",X),Q=!1,G;if(J===-1&&Y===-1)break;else if(J===-1)G=Y,Q=!0;else if(Y===-1)G=J,Q=!1;else if(Y<J)G=Y,Q=!0;else G=J,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let q=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",U=Q?q==="{{{"?"}}}":"!!}":"}}",W=G+q.length,K=mX($,W,U);if(K===-1){X=G+1;continue}let z=$.slice(W,K).trim(),H=K+U.length;Z.push({fullMatch:$.slice(G,H),expression:z,start:G,end:H,isRaw:Q}),X=H}return Z}function mX($,Z,X){let J=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(J<$.length){let q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((q==='"'||q==="'")&&!Y){Y=q,J++;continue}if(q===Y&&Y!=="`"){Y=null,J++;continue}if(q==="`"&&!Y){Y="`",J++;continue}if(q==="`"&&Y==="`"&&G===0){Y=null,J++;continue}if(Y==="`"&&q==="$"&&$[J+1]==="{"){G++,J+=2;continue}if(G>0){if(q==="{")G++;else if(q==="}")G--;J++;continue}if(Y){J++;continue}if(q==="(")Q.paren++;else if(q===")")Q.paren--;else if(q==="[")Q.bracket++;else if(q==="]")Q.bracket--;else if(q==="{")Q.brace++;else if(q==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(J,J+X.length)===X)return J}J++}return-1}function lX($){let Z=B3($);if(Z.length===0)return{baseExpression:"",filters:[]};let X=Z[0],J=[];for(let Y=1;Y<Z.length;Y++){let Q=cX(Z[Y]);if(Q)J.push(Q)}return{baseExpression:X,filters:J}}function cX($){let Z=$.trim();if(!Z)return null;let X=Z.indexOf("(");if(X===-1)return{name:Z,args:[]};let J=Z.slice(0,X).trim(),Y=X+1,Q=H0(Z,"(",")",X);if(Q===-1)return{name:J,args:[]};let G=Z.slice(Y,Q),q=N6(G);return{name:J,args:q}}function N6($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+="${",G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q===","&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function pX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;let J=H0($,"(",")",X);if(J===-1)return null;return{params:$.slice(X+1,J),endPos:J+1}}function iX($){let Z=[],J=new Z$($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<J.length){let Q=J[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=J.length)break}let q=J[Y];if(q.type==="IDENTIFIER"&&(q.value==="const"||q.value==="let"||q.value==="var")){let U=q.value;if(Y++,Y>=J.length)break;let W=J[Y];if(W.type==="IDENTIFIER"){let K=W.value;if(Y++,Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let z=Y<J.length?J[Y].start:$.length,H=R6(J,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:K,value:$.slice(z,H.endPos),exported:G,start:q.start,end:H.endPos})}}else if(W.type==="PUNCTUATION"&&(W.value==="{"||W.value==="[")){let K=W.start,z=W.value==="{"?"}":"]",H=H0($,W.value,z,K);if(H!==-1){let B=$.slice(K,H+1);if(Y=D6(J,H+1),Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let j=Y<J.length?J[Y].start:$.length,_=R6(J,Y,$);Y=_.nextIndex;let V=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:V,value:`${$.slice(j,_.endPos)}; ${U} ${B} = ${V}`,exported:G,start:q.start,end:_.endPos})}}}}else if(q.type==="IDENTIFIER"&&q.value==="function"){let U=G?J[Y-1].start:q.start;if(Y++,Y>=J.length)break;let W=J[Y];if(W.type==="IDENTIFIER"){let K=W.value;Y++;let z=-1;while(Y<J.length){if(J[Y].type==="PUNCTUATION"&&J[Y].value==="{"){z=J[Y].start;break}Y++}if(z!==-1){let H=H0($,"{","}",z);if(H!==-1)Z.push({type:"function",name:K,value:$.slice(U,H+1).replace(/^export\s+/,""),exported:G,start:U,end:H+1}),Y=D6(J,H+1)}}}else Y++}return Z}function R6($,Z,X){let J=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:X.length;while(J<$.length){let G=$[J];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,J++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[J-1]?.end??G.start;break}}Q=G.end,J++}return{nextIndex:J,endPos:Q}}function D6($,Z){for(let X=0;X<$.length;X++)if($[X].start>=Z)return X;return $.length}function nX($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,q=j3(J,G);if(!q)break;try{let U;if(Q0(q.expression))U=G0(q.expression,Object.keys(Z))(...Object.values(Z));else U=X0(q.expression,Z);let W="",K=!1;for(let z of q.cases)if(z.type==="default"){if(!K)W=z.content.trim()}else try{let H;if(z.value&&Q0(z.value))H=G0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)H=X0(z.value,Z);if(U===H){W=z.content.trim(),K=!0;break}}catch{continue}J=J.substring(0,G)+W+J.substring(q.end),Y=!0}catch(U){let W=U instanceof Error?U.message:String(U),K=$0("Switch",`Error evaluating @switch expression: ${W}`,l.EVALUATION_ERROR);J=J.substring(0,G)+K+J.substring(q.end);break}}return J}function sX($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return Z.push(J),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function oX($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(X,J)=>Z[Number(J)]??X)}function t0($,Z,X){let{masked:J,scripts:Y}=sX($);return oX(rX(J,Z,X),Y)}function rX($,Z,X){let J=$;J=nX(J,Z,X);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let q=G.index,U=W1(J,q+7);if(!U)break;let W=U.endPos,K=w1(J,"unless","endunless",W);if(K===-1){console.warn(`[stx] @unless directive at position ${q} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=J.slice(W,K),H=U.expression,B=-1;{let _=0,V=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=V.exec(z))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(z))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(z))!==null)L.push({pos:w.index,type:"else"});L.sort((R,D)=>R.pos-D.pos);for(let R of L)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){B=R.pos;break}}let j;if(B!==-1){let _=z.slice(0,B),V=z.slice(B+5);j=`@if (${H})${V}@else ${_}@endif`}else j=`@if (!(${H}))${z}@endif`;J=J.substring(0,q)+j+J.substring(K+10),Q=!0}}J=O3(J,Z,X),J=V3(J,Z,X),J=_3(J,Z);let Y=()=>{let Q=_5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let q=Q[G];try{let U="",W=!1;for(let K of q.branches){if(W)break;if(K.type==="else")U=K.content,W=!0;else try{let z;if(K.condition&&Q0(K.condition))z=G0(K.condition,Object.keys(Z))(...Object.values(Z));else if(K.condition)z=X0(K.condition,Z);if(z)U=K.content,W=!0}catch(z){U=$0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,l.EVALUATION_ERROR),W=!0}}J=J.substring(0,q.start)+U+J.substring(q.end)}catch(U){let W=U instanceof Error?U.message:String(U),K=$0("If",`Error processing @if block: ${W}`,l.EVALUATION_ERROR);J=J.substring(0,q.start)+K+J.substring(q.end)}}return!0};while(!0){let Q=J;if(!Y())break;if(J===Q)break}return J}function A6($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let X=$[Z];if(X!=="'"&&X!=='"')return null;Z++;let J=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(Y===X){Z++;break}J.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function _3($,Z){let X=$;function J(q,U,W,K){let z=1,H=K,B=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(H<q.length&&z>0){B.lastIndex=H,j.lastIndex=H;let _=B.exec(q),V=j.exec(q),O=_?_.index:1/0,F=V?V.index:1/0;if(O<F)z++,H=O+_[0].length;else if(F<1/0){if(z--,z===0)return F;H=F+V[0].length}else break}return-1}function Y(q,U,W){let K=0,z=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=z.exec(q))!==null)j.push({pos:_.index,type:"open"});while((_=H.exec(q))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(q))!==null)j.push({pos:_.index,type:"else"});j.sort((V,O)=>V.pos-O.pos);for(let V of j)if(V.type==="open")K++;else if(V.type==="close")K--;else if(V.type==="else"&&K===0)return V.pos;return-1}{let q=!0;while(q){q=!1;let U=X.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,K,z,H=X.slice(W+5),B=A6(H);if(B)K=B.value,z=W+5+B.consumed;else z=W+5;let j=J(X,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=X.slice(z,j),V=Y(_,"auth","endauth"),O;if(!Z.auth)O=!1;else O=K?U1(`auth?.check && auth?.user?.[${K}]`,Z):U1("auth?.check",Z);let F;if(V!==-1){let L=_.slice(0,V),w=_.slice(V+5);F=O?L:w}else F=O?_:"";X=X.substring(0,W)+F+X.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let U=X.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,K,z,H=X.slice(W+6),B=A6(H);if(B)K=B.value,z=W+6+B.consumed;else z=W+6;let j=J(X,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=X.slice(z,j),V=Y(_,"guest","endguest"),O;if(!Z.auth)O=!0;else O=K?U1(`!auth?.check || !auth?.user?.[${K}]`,Z):U1("!auth?.check",Z);let F;if(V!==-1){let L=_.slice(0,V),w=_.slice(V+5);F=O?L:w}else F=O?_:"";X=X.substring(0,W)+F+X.substring(j+9),q=!0}}function Q(q,U,W){if(Z.userCan&&typeof Z.userCan[q]==="boolean")return Z.userCan[q];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let K=[q];if(U)K.push(U);if(W){let z=U1(W,Z);K.push(z)}return Z.permissions.check(...K)}catch{return!1}return!1}function G(q){let U=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!U)return null;return{ability:U[1],type:U[2],id:U[3]?.trim(),paramsEnd:U[0].length}}for(let q of["can","cannot"]){let U=`end${q}`,W=q==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!1;let z=X.match(new RegExp(`@${q}\\s*\\(`));if(!z||z.index===void 0)break;let H=z.index,B=X.slice(H+`@${q}`.length),j=G(B);if(!j)break;let _=H+`@${q}`.length+j.paramsEnd,V=J(X,q,U,_);if(V===-1){console.warn(`[stx] @${q} directive at position ${H} has no matching @${U} \u2014 the block was skipped.`);break}let O=X.slice(_,V),F=[],L=0,w=new RegExp(`@${q}\\s*\\(`,"g"),R=new RegExp(`@${U}(?![a-z])`,"g"),D=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],A;while((A=w.exec(O))!==null)T.push({pos:A.index,type:"open"});while((A=R.exec(O))!==null)T.push({pos:A.index,type:"close"});while((A=D.exec(O))!==null)T.push({pos:A.index,type:"elseDirective"});while((A=N.exec(O))!==null)T.push({pos:A.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)F.push(b)}let M=[],k=0;for(let b=0;b<F.length;b++){let C=F[b];if(M.push({content:O.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=O.slice(C.pos+`@${W}`.length),f=G(x);if(f){M[M.length-1]={content:O.slice(k,C.pos)},k=C.pos+`@${W}`.length+f.paramsEnd,M.push({content:"",ability:f.ability,type:f.type,id:f.id}),M.pop();let n=F[b+1],m=n?n.pos:O.length;M.push({content:O.slice(k,m),ability:f.ability,type:f.type,id:f.id}),k=m}}else k=C.pos+5}if(k<O.length){let b=M[M.length-1];if(F.length>0&&F[F.length-1].type==="else")M.push({content:O.slice(k),isFinalElse:!0});else if(M.length===0)M.push({content:O.slice(k)})}let I=Q(j.ability,j.type,j.id),y=q==="can"?I:!I,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let x=M[C];if(x.isFinalElse){E=x.content,b=!0;break}if(x.ability){let f=Q(x.ability,x.type,x.id);if(q==="can"?f:!f){E=x.content,b=!0;break}}}if(!b&&M.length>0){let C=M[M.length-1];if(C.isFinalElse)E=C.content}}X=X.substring(0,H)+E+X.substring(V+`@${U}`.length),K=!0}}return X}function O3($,Z,X){let J=$;function Y(Q,G,q,U,W){let K=!0;while(K){K=!1;let z=new RegExp(`@${G}\\s*\\(`),H=Q.match(z);if(!H||H.index===void 0)break;let B=H.index,j=W1(Q,B+`@${G}`.length);if(!j)break;let _=j.endPos,V=w1(Q,G,q,_);if(V===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let O=Q.slice(_,V),F=j.expression,L=-1,w=0,R=0;while(R<O.length){let D=O.indexOf("@",R);if(D===-1)break;let N=O.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){L=D;break}R=D+1}try{let D=U(F.trim()),N;if(L!==-1){let T=O.slice(0,L),A=O.slice(L+5);N=D?T:A}else N=D?O:"";Q=Q.substring(0,B)+N+Q.substring(V+`@${q}`.length),K=!0}catch(D){let N=D instanceof Error?D.message:String(D),T=$0(W,`Error processing @${G} directive: ${N}`,l.EVALUATION_ERROR);Q=Q.substring(0,B)+T+Q.substring(V+`@${q}`.length);break}}return Q}return J=Y(J,"isset","endisset",(Q)=>{let G=U1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=Y(J,"empty","endempty",(Q)=>{let G=U1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function V3($,Z,X){let J=$,Y="development";function Q(G,q,U,W){let K=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`@${U}(?![a-z])`,"g"),H=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${U}(?![a-z])`),j=G,_=!0;while(_){_=!1,K.lastIndex=0;let V=K.exec(j);if(!V)break;let O=V.index,F=O+V[0].length;if(q==="env"){let I=j.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;F+=I[0].length,W=Y===I[2]}let L=1,w=F,R=-1;while(L>0&&w<j.length){K.lastIndex=w,z.lastIndex=w;let I=K.exec(j),y=z.exec(j),E=I?I.index:1/0,b=y?y.index:1/0;if(E<b)L++,w=E+I[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${q} directive at position ${O} has no matching @${U} \u2014 the block was skipped.`);break}let D=j.substring(F,R),N=-1,T=0,A=0;while(A<D.length){let I=D.indexOf("@",A);if(I===-1)break;let y=D.substring(I);if(H.test(y)){T++,A=I+1;continue}if(B.test(y)){T--,A=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){N=I;break}A=I+1}let M;if(N!==-1){let I=D.slice(0,N),y=D.slice(N+5);M=W?I:y}else M=W?D:"";let k=`@${U}`.length;j=j.substring(0,O)+M+j.substring(R+k),_=!0}return j}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",Y==="production"),J=Q(J,"development","enddevelopment",Y==="development"),J=Q(J,"staging","endstaging",Y==="staging"),J=Q(J,"testing","endtesting",Y==="testing"),J}var F3=new WeakMap;function M6($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function R1($,Z){if(!$)return Z?.nonceGenerator?.()??M6();let X=F3.get($);if(!X)X=Z?.nonceGenerator?.()??M6(),F3.set($,X);return X}function wK($){F3.delete($)}function T6($,Z){let X=[];for(let[J,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)X.push(J);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)X.push(`${J} ${Q.join(" ")}`)}}return X.join("; ")}function w3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${T6($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var aX={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},L3={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},tX={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},eX={"default-src":["'none'"],"frame-ancestors":["'none'"]};function RK($){return{enabled:!0,directives:{strict:aX,moderate:L3,relaxed:tX,api:eX}[$]||L3,useNonce:$==="strict",addMetaTag:!0}}function DK($,Z){let X={...$};for(let[J,Y]of Object.entries(Z)){let Q=J,G=X[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")X[Q]=G||Y;else if(Array.isArray(Y)){let q=Array.isArray(G)?G:[],U=[...new Set([...q,...Y])];X[Q]=U}}return X}function I6($,Z,X){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?R1(X,Z):void 0,Y=w3(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3273
|
-
${Y}`)}function k6($,Z){let X=$;return X=X.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<script nonce="${Z}"${Y}>`}),X=X.replace(/<style([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<style nonce="${Z}"${Y}>`}),X}function E6($,Z,X,J){let Y=$,Q=J.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?R1(Z,Q):void 0;return w3(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return R1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=R1(Z,Q);return Y}var $J={name:"csp",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?R1(X,Q):void 0;return w3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},ZJ={name:"cspNonce",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return R1(X,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function NK(){return[$J,ZJ]}function AK($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[X,J]of Object.entries($))if(Array.isArray(J)&&J.includes("http:"))Z.push(`CSP: Using http: in ${X} allows insecure resources`);return Z}function XJ($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function MK($,Z){if(!$.enabled)return{};let X=$.useNonce?R1(Z,$):void 0,J=T6($.directives,X);return{[XJ($.reportOnly)]:J}}var TK={enabled:!1,reportOnly:!1,directives:L3,useNonce:!1,addMetaTag:!0};import JJ from"crypto";var YJ=40,b6="_token",R3=null;function QJ($=YJ){let Z=JJ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return R3=Z,Z}function GJ(){if(!R3)QJ();return R3}function qJ($=b6){let Z=GJ();return`<input type="hidden" name="${$}" value="${Z}">`}function y6($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,X,J)=>{return qJ(J||b6)})}async function S6($,Z,X,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Y=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await UJ(Y,Q,Z,X,J);else Y=await WJ(Y,Q,Z,X,J)}return Y}async function UJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=`@${Q}`,U=`@end${Q}`,W=$,K=v1(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${U}`,"g"),z=[],H=K.exec(W);while(H!==null){let[B,j="",_=""]=H,V=H.index||0;try{let O=j?C6(j):[],F=_.trim(),L=await G(F,O,X,J);z.push({original:B,processed:L,startIndex:V})}catch(O){let F=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);z.push({original:B,processed:$0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${F}`,l.EVALUATION_ERROR),startIndex:V})}H=K.exec(W)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];W=W.replace(j,_)}return W}async function WJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=$,U=v1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],K=U.exec(q);while(K!==null){let[B,j=""]=K,_=K.index||0;try{let V=C6(j),O=await G("",V,X,J);W.push({original:B,processed:O,startIndex:_})}catch(V){let O=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}(${j}): ${O}`,l.EVALUATION_ERROR),startIndex:_})}K=U.exec(q)}let z=v1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=z.exec(q);while(H!==null){let[B]=H,j=H.index||0;try{let _=await G("",[],X,J);W.push({original:B,processed:_,startIndex:j})}catch(_){let V=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}: ${V}`,l.EVALUATION_ERROR),startIndex:j})}H=z.exec(q)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:_}=W[B];q=q.replace(j,_)}return q}function C6($){if(!$.trim())return[];let Z=[],X="",J=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,Y=G;else if(G===Y)J=!1;else X+=G;else if(G===","&&!J)Z.push(X.trim()),X="";else X+=G}if(X.trim())Z.push(X.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var P6=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,v6=/^[A-Za-z_$][\w$]*$/,KJ=new Set(["light","dark","system"]);function D1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function zJ($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,X=Z.appearance,J=Z.colorMode;if(D1(Z.storageKey,"storageKey"),!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(D1(X.key,"appearance.key"),D1(X.attribute,"appearance.attribute"),D1(X.default,"appearance.default"),D1(J.key,"colorMode.key"),D1(J.attribute,"colorMode.attribute"),D1(J.default,"colorMode.default"),!v6.test(X.key)||!v6.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!P6.test(X.attribute)||!P6.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(X.allowed)||X.allowed.length===0||X.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!X.allowed.includes(X.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!KJ.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:X.key,attribute:X.attribute,allowed:[...new Set(X.allowed)],default:X.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function HJ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function BJ($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${HJ($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function jJ($,Z){let X=1,J=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(J){if(G==="\\")Y=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}function f6($,Z){let X=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,G=jJ(X,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=X.slice(Q+1,G).trim(),U=X0(`(${q})`,Z),W=BJ(zJ(U));X=X.slice(0,Y.index)+W+X.slice(G+1),J.lastIndex=Y.index+W.length}return X}import _J from"crypto";function B0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var N3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function OJ($){return{...N3,...$.forms?.classes}}function J$($,Z,X,J){let Y=$||Z;return X?`${Y} ${J}`:Y}function x0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function m1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${B0(Z)}"`}function D3($,Z,X){if(!Z)return"";let J="";if(!/\baria-invalid\s*=/i.test(X))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(X))J+=` aria-describedby="${B0(`${x0($)}-error`)}"`;return J}function VJ(){return _J.randomUUID()}function xK($,Z,X,J){let Y=OJ(J),Q=$;return Q=LJ(Q,Z),Q=F5(Q,Z),Q=A3(Q,Z,Y),Q=M3(Q,Z,Y),Q}function F5($,Z){let X=$;return X=X.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=VJ();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${B0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),X=X.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${B0(Q)}">`;return J}),X}function A3($,Z,X=N3){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,q,U,W="")=>{let K=Q||G||"POST",z=q||U||"",H=K1(W),B=K.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${B0(j)}" action="${B0(z)}"${H?` ${H}`:""}>`;if(_+=`
|
|
3272
|
+
`)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function H0($,Z,X,J=0){let Y=0,Q=J,G=null,q=0,U=!1;while(Q<$.length){let W=$[Q];if(G&&U){U=!1,Q++;continue}if(G&&W==="\\"){U=!0,Q++;continue}if(U=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){q++,Q+=2;continue}if(q>0&&W==="}"){q--,Q++;continue}if(W==="`"&&G==="`"&&q===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)Y++;else if(W===X){if(Y--,Y===0)return Q}Q++}return-1}function L6($,Z){let X=Z,J={paren:0,bracket:0,brace:0},Y=null,Q=0;while(X<$.length){let G=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((G==='"'||G==="'")&&!Y){Y=G,X++;continue}if(G===Y&&Y!=="`"){Y=null,X++;continue}if(G==="`"&&!Y){Y="`",X++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,X++;continue}if(Y==="`"&&G==="$"&&$[X+1]==="{"){Q++,X+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;X++;continue}if(Y){X++;continue}if(J.paren===0&&J.bracket===0&&J.brace===0){if($.slice(X,X+2)==="}}"||$.slice(X,X+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")J.paren++;else if(G===")"){if(J.paren--,J.paren<0)break}else if(G==="[")J.bracket++;else if(G==="]"){if(J.bracket--,J.bracket<0)break}else if(G==="{")J.brace++;else if(G==="}"){if(J.brace--,J.brace<0)break}X++}return{expression:$.slice(Z,X),endPos:X}}function B3($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+=q+$[G+1],G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}if(q==="|"&&$[G-1]==="\\"&&!Y){X=X.slice(0,-1)+q;continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function W1($,Z){let X=hX($,Z);return X.ok?{expression:X.expression,endPos:X.endPos}:null}function hX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return{ok:!1,reason:"missing-open-paren",pos:X};let J=H0($,"(",")",X);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:X};return{ok:!0,expression:$.slice(X+1,J),endPos:J+1}}function uX($,Z){let X=$.lastIndexOf("<",Z);if(X===-1)return!1;return X>$.lastIndexOf(">",Z)}function w1($,Z,X,J){let Y=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),q=new RegExp(`@${X}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,q.lastIndex=Q;let U=G.exec($),W=q.exec($),K=U?U.index:1/0,z=W?W.index:1/0;if(K<z)Y++,Q=K+U[0].length;else if(z<1/0){if(Y--,Y===0)return z;Q=z+W[0].length}else break}return-1}function w6($,Z){let X=$.slice(Z).match(/^@if\s*/);if(!X)return null;let J=Z+X[0].length,Y=W1($,J);if(!Y)return null;let Q=Y.endPos,G=w1($,"if","endif",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,K="if",z=Y.expression,H=0,B=0;while(W<q.length){let j=q.indexOf("@",W);if(j===-1)break;W=j;let _=q.substring(j);if(uX(q,j)){W++;continue}if(/^@if\s*\(/.test(_)){B++,W++;continue}if(/^@endif(?![a-z])/.test(_)){B--,W+=6;continue}if(B===0){let V=_.match(/^@elseif\s*/);if(V){U.push({type:K,condition:z,content:q.substring(H,W),start:Q+H,end:Q+W});let O=W+V[0].length,F=W1(q,O);if(!F){W++;continue}K="elseif",z=F.expression,W=F.endPos,H=W;continue}else if(/^@else(?![a-z])/.test(_)){U.push({type:K,condition:z,content:q.substring(H,W),start:Q+H,end:Q+W}),K="else",z=void 0,W+=5,H=W;continue}}W++}return U.push({type:K,condition:z,content:q.slice(H),start:Q+H,end:Q+q.length}),{fullMatch:$.slice(Z,G+6),branches:U,start:Z,end:G+6}}function _5($){let Z=[],X=/@if\s*\(/g,J=X.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=X.exec($);continue}let Q=w6($,J.index);if(Q)Z.push(Q),X.lastIndex=Q.end;J=X.exec($)}return Z}function X$($,Z,X){let J=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(J.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=Y.exec($);continue}let q=Q.index,U=q+Q[0].length-1,W=H0($,"(",")",U);if(W===-1){Q=Y.exec($);continue}let K=$.slice(U+1,W),z=W+1,H=w1($,Z,X,z);if(H===-1){Q=Y.exec($);continue}let B=$.slice(z,H),j=H+`@${X}`.length;J.push({fullMatch:$.slice(q,j),name:Z,params:K,content:B,start:q,end:j}),Y.lastIndex=j,Q=Y.exec($)}return J}function j3($,Z){let X=$.slice(Z).match(/^@switch\s*/);if(!X)return null;let J=Z+X[0].length,Y=W1($,J);if(!Y)return null;let Q=Y.endPos,G=w1($,"switch","endswitch",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,K=null,z=0;while(W<q.length){let H=q.slice(W),B=H.match(/^@switch\s*\(/),j=H.match(/^@endswitch(?![a-z])/);if(B){if(z++,K)K.content+=B[0];W+=B[0].length;continue}if(j){if(z--,K)K.content+=j[0];W+=j[0].length;continue}if(z>0){if(K)K.content+=q[W];W++;continue}let _=H.match(/^@case\s*/),V=H.match(/^@default(?![a-z])/),O=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(K)U.push(K);let F=W+_[0].length,L=W1(q,F);if(!L){W++;continue}K={type:"case",value:L.expression,content:""},W=L.endPos}else if(V&&H.startsWith("@default")){if(K)U.push(K);K={type:"default",content:""},W+=V[0].length}else if(O&&H.startsWith("@break"))W+=O[0].length;else{if(K)K.content+=q[W];W++}}if(K)U.push(K);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:U,start:Z,end:G+10}}function dX($){let Z=[],X=0;while(X<$.length){let J=$.indexOf("{{",X),Y=$.indexOf("{!!",X),Q=!1,G;if(J===-1&&Y===-1)break;else if(J===-1)G=Y,Q=!0;else if(Y===-1)G=J,Q=!1;else if(Y<J)G=Y,Q=!0;else G=J,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let q=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",U=Q?q==="{{{"?"}}}":"!!}":"}}",W=G+q.length,K=mX($,W,U);if(K===-1){X=G+1;continue}let z=$.slice(W,K).trim(),H=K+U.length;Z.push({fullMatch:$.slice(G,H),expression:z,start:G,end:H,isRaw:Q}),X=H}return Z}function mX($,Z,X){let J=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(J<$.length){let q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((q==='"'||q==="'")&&!Y){Y=q,J++;continue}if(q===Y&&Y!=="`"){Y=null,J++;continue}if(q==="`"&&!Y){Y="`",J++;continue}if(q==="`"&&Y==="`"&&G===0){Y=null,J++;continue}if(Y==="`"&&q==="$"&&$[J+1]==="{"){G++,J+=2;continue}if(G>0){if(q==="{")G++;else if(q==="}")G--;J++;continue}if(Y){J++;continue}if(q==="(")Q.paren++;else if(q===")")Q.paren--;else if(q==="[")Q.bracket++;else if(q==="]")Q.bracket--;else if(q==="{")Q.brace++;else if(q==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(J,J+X.length)===X)return J}J++}return-1}function lX($){let Z=B3($);if(Z.length===0)return{baseExpression:"",filters:[]};let X=Z[0],J=[];for(let Y=1;Y<Z.length;Y++){let Q=cX(Z[Y]);if(Q)J.push(Q)}return{baseExpression:X,filters:J}}function cX($){let Z=$.trim();if(!Z)return null;let X=Z.indexOf("(");if(X===-1)return{name:Z,args:[]};let J=Z.slice(0,X).trim(),Y=X+1,Q=H0(Z,"(",")",X);if(Q===-1)return{name:J,args:[]};let G=Z.slice(Y,Q),q=N6(G);return{name:J,args:q}}function N6($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+="${",G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q===","&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function pX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;let J=H0($,"(",")",X);if(J===-1)return null;return{params:$.slice(X+1,J),endPos:J+1}}function iX($){let Z=[],J=new Z$($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<J.length){let Q=J[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=J.length)break}let q=J[Y];if(q.type==="IDENTIFIER"&&(q.value==="const"||q.value==="let"||q.value==="var")){let U=q.value;if(Y++,Y>=J.length)break;let W=J[Y];if(W.type==="IDENTIFIER"){let K=W.value;if(Y++,Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let z=Y<J.length?J[Y].start:$.length,H=R6(J,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:K,value:$.slice(z,H.endPos),exported:G,start:q.start,end:H.endPos})}}else if(W.type==="PUNCTUATION"&&(W.value==="{"||W.value==="[")){let K=W.start,z=W.value==="{"?"}":"]",H=H0($,W.value,z,K);if(H!==-1){let B=$.slice(K,H+1);if(Y=D6(J,H+1),Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let j=Y<J.length?J[Y].start:$.length,_=R6(J,Y,$);Y=_.nextIndex;let V=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:V,value:`${$.slice(j,_.endPos)}; ${U} ${B} = ${V}`,exported:G,start:q.start,end:_.endPos})}}}}else if(q.type==="IDENTIFIER"&&q.value==="function"){let U=G?J[Y-1].start:q.start;if(Y++,Y>=J.length)break;let W=J[Y];if(W.type==="IDENTIFIER"){let K=W.value;Y++;let z=-1;while(Y<J.length){if(J[Y].type==="PUNCTUATION"&&J[Y].value==="{"){z=J[Y].start;break}Y++}if(z!==-1){let H=H0($,"{","}",z);if(H!==-1)Z.push({type:"function",name:K,value:$.slice(U,H+1).replace(/^export\s+/,""),exported:G,start:U,end:H+1}),Y=D6(J,H+1)}}}else Y++}return Z}function R6($,Z,X){let J=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:X.length;while(J<$.length){let G=$[J];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,J++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[J-1]?.end??G.start;break}}Q=G.end,J++}return{nextIndex:J,endPos:Q}}function D6($,Z){for(let X=0;X<$.length;X++)if($[X].start>=Z)return X;return $.length}function nX($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,q=j3(J,G);if(!q)break;try{let U;if(Q0(q.expression))U=G0(q.expression,Object.keys(Z))(...Object.values(Z));else U=X0(q.expression,Z);let W="",K=!1;for(let z of q.cases)if(z.type==="default"){if(!K)W=z.content.trim()}else try{let H;if(z.value&&Q0(z.value))H=G0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)H=X0(z.value,Z);if(U===H){W=z.content.trim(),K=!0;break}}catch{continue}J=J.substring(0,G)+W+J.substring(q.end),Y=!0}catch(U){let W=U instanceof Error?U.message:String(U),K=$0("Switch",`Error evaluating @switch expression: ${W}`,l.EVALUATION_ERROR);J=J.substring(0,G)+K+J.substring(q.end);break}}return J}function sX($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return Z.push(J),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function oX($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(X,J)=>Z[Number(J)]??X)}function t0($,Z,X){let{masked:J,scripts:Y}=sX($);return oX(rX(J,Z,X),Y)}function rX($,Z,X){let J=$;J=nX(J,Z,X);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let q=G.index,U=W1(J,q+7);if(!U)break;let W=U.endPos,K=w1(J,"unless","endunless",W);if(K===-1){console.warn(`[stx] @unless directive at position ${q} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=J.slice(W,K),H=U.expression,B=-1;{let _=0,V=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=V.exec(z))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(z))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(z))!==null)L.push({pos:w.index,type:"else"});L.sort((R,D)=>R.pos-D.pos);for(let R of L)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){B=R.pos;break}}let j;if(B!==-1){let _=z.slice(0,B),V=z.slice(B+5);j=`@if (${H})${V}@else ${_}@endif`}else j=`@if (!(${H}))${z}@endif`;J=J.substring(0,q)+j+J.substring(K+10),Q=!0}}J=O3(J,Z,X),J=V3(J,Z,X),J=_3(J,Z);let Y=()=>{let Q=_5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let q=Q[G];try{let U="",W=!1;for(let K of q.branches){if(W)break;if(K.type==="else")U=K.content,W=!0;else try{let z;if(K.condition&&Q0(K.condition))z=G0(K.condition,Object.keys(Z))(...Object.values(Z));else if(K.condition)z=X0(K.condition,Z);if(z)U=K.content,W=!0}catch(z){U=$0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,l.EVALUATION_ERROR),W=!0}}J=J.substring(0,q.start)+U+J.substring(q.end)}catch(U){let W=U instanceof Error?U.message:String(U),K=$0("If",`Error processing @if block: ${W}`,l.EVALUATION_ERROR);J=J.substring(0,q.start)+K+J.substring(q.end)}}return!0};while(!0){let Q=J;if(!Y())break;if(J===Q)break}return J}function A6($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let X=$[Z];if(X!=="'"&&X!=='"')return null;Z++;let J=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(Y===X){Z++;break}J.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function _3($,Z){let X=$;function J(q,U,W,K){let z=1,H=K,B=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(H<q.length&&z>0){B.lastIndex=H,j.lastIndex=H;let _=B.exec(q),V=j.exec(q),O=_?_.index:1/0,F=V?V.index:1/0;if(O<F)z++,H=O+_[0].length;else if(F<1/0){if(z--,z===0)return F;H=F+V[0].length}else break}return-1}function Y(q,U,W){let K=0,z=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=z.exec(q))!==null)j.push({pos:_.index,type:"open"});while((_=H.exec(q))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(q))!==null)j.push({pos:_.index,type:"else"});j.sort((V,O)=>V.pos-O.pos);for(let V of j)if(V.type==="open")K++;else if(V.type==="close")K--;else if(V.type==="else"&&K===0)return V.pos;return-1}{let q=!0;while(q){q=!1;let U=X.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,K,z,H=X.slice(W+5),B=A6(H);if(B)K=B.value,z=W+5+B.consumed;else z=W+5;let j=J(X,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=X.slice(z,j),V=Y(_,"auth","endauth"),O;if(!Z.auth)O=!1;else O=K?U1(`auth?.check && auth?.user?.[${K}]`,Z):U1("auth?.check",Z);let F;if(V!==-1){let L=_.slice(0,V),w=_.slice(V+5);F=O?L:w}else F=O?_:"";X=X.substring(0,W)+F+X.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let U=X.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,K,z,H=X.slice(W+6),B=A6(H);if(B)K=B.value,z=W+6+B.consumed;else z=W+6;let j=J(X,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=X.slice(z,j),V=Y(_,"guest","endguest"),O;if(!Z.auth)O=!0;else O=K?U1(`!auth?.check || !auth?.user?.[${K}]`,Z):U1("!auth?.check",Z);let F;if(V!==-1){let L=_.slice(0,V),w=_.slice(V+5);F=O?L:w}else F=O?_:"";X=X.substring(0,W)+F+X.substring(j+9),q=!0}}function Q(q,U,W){if(Z.userCan&&typeof Z.userCan[q]==="boolean")return Z.userCan[q];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let K=[q];if(U)K.push(U);if(W){let z=U1(W,Z);K.push(z)}return Z.permissions.check(...K)}catch{return!1}return!1}function G(q){let U=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!U)return null;return{ability:U[1],type:U[2],id:U[3]?.trim(),paramsEnd:U[0].length}}for(let q of["can","cannot"]){let U=`end${q}`,W=q==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!1;let z=X.match(new RegExp(`@${q}\\s*\\(`));if(!z||z.index===void 0)break;let H=z.index,B=X.slice(H+`@${q}`.length),j=G(B);if(!j)break;let _=H+`@${q}`.length+j.paramsEnd,V=J(X,q,U,_);if(V===-1){console.warn(`[stx] @${q} directive at position ${H} has no matching @${U} \u2014 the block was skipped.`);break}let O=X.slice(_,V),F=[],L=0,w=new RegExp(`@${q}\\s*\\(`,"g"),R=new RegExp(`@${U}(?![a-z])`,"g"),D=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],A;while((A=w.exec(O))!==null)T.push({pos:A.index,type:"open"});while((A=R.exec(O))!==null)T.push({pos:A.index,type:"close"});while((A=D.exec(O))!==null)T.push({pos:A.index,type:"elseDirective"});while((A=N.exec(O))!==null)T.push({pos:A.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)F.push(b)}let M=[],k=0;for(let b=0;b<F.length;b++){let C=F[b];if(M.push({content:O.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=O.slice(C.pos+`@${W}`.length),f=G(x);if(f){M[M.length-1]={content:O.slice(k,C.pos)},k=C.pos+`@${W}`.length+f.paramsEnd,M.push({content:"",ability:f.ability,type:f.type,id:f.id}),M.pop();let n=F[b+1],m=n?n.pos:O.length;M.push({content:O.slice(k,m),ability:f.ability,type:f.type,id:f.id}),k=m}}else k=C.pos+5}if(k<O.length){let b=M[M.length-1];if(F.length>0&&F[F.length-1].type==="else")M.push({content:O.slice(k),isFinalElse:!0});else if(M.length===0)M.push({content:O.slice(k)})}let I=Q(j.ability,j.type,j.id),y=q==="can"?I:!I,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let x=M[C];if(x.isFinalElse){E=x.content,b=!0;break}if(x.ability){let f=Q(x.ability,x.type,x.id);if(q==="can"?f:!f){E=x.content,b=!0;break}}}if(!b&&M.length>0){let C=M[M.length-1];if(C.isFinalElse)E=C.content}}X=X.substring(0,H)+E+X.substring(V+`@${U}`.length),K=!0}}return X}function O3($,Z,X){let J=$;function Y(Q,G,q,U,W){let K=!0;while(K){K=!1;let z=new RegExp(`@${G}\\s*\\(`),H=Q.match(z);if(!H||H.index===void 0)break;let B=H.index,j=W1(Q,B+`@${G}`.length);if(!j)break;let _=j.endPos,V=w1(Q,G,q,_);if(V===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let O=Q.slice(_,V),F=j.expression,L=-1,w=0,R=0;while(R<O.length){let D=O.indexOf("@",R);if(D===-1)break;let N=O.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){L=D;break}R=D+1}try{let D=U(F.trim()),N;if(L!==-1){let T=O.slice(0,L),A=O.slice(L+5);N=D?T:A}else N=D?O:"";Q=Q.substring(0,B)+N+Q.substring(V+`@${q}`.length),K=!0}catch(D){let N=D instanceof Error?D.message:String(D),T=$0(W,`Error processing @${G} directive: ${N}`,l.EVALUATION_ERROR);Q=Q.substring(0,B)+T+Q.substring(V+`@${q}`.length);break}}return Q}return J=Y(J,"isset","endisset",(Q)=>{let G=U1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=Y(J,"empty","endempty",(Q)=>{let G=U1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function V3($,Z,X){let J=$,Y="development";function Q(G,q,U,W){let K=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`@${U}(?![a-z])`,"g"),H=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${U}(?![a-z])`),j=G,_=!0;while(_){_=!1,K.lastIndex=0;let V=K.exec(j);if(!V)break;let O=V.index,F=O+V[0].length;if(q==="env"){let I=j.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;F+=I[0].length,W=Y===I[2]}let L=1,w=F,R=-1;while(L>0&&w<j.length){K.lastIndex=w,z.lastIndex=w;let I=K.exec(j),y=z.exec(j),E=I?I.index:1/0,b=y?y.index:1/0;if(E<b)L++,w=E+I[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${q} directive at position ${O} has no matching @${U} \u2014 the block was skipped.`);break}let D=j.substring(F,R),N=-1,T=0,A=0;while(A<D.length){let I=D.indexOf("@",A);if(I===-1)break;let y=D.substring(I);if(H.test(y)){T++,A=I+1;continue}if(B.test(y)){T--,A=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){N=I;break}A=I+1}let M;if(N!==-1){let I=D.slice(0,N),y=D.slice(N+5);M=W?I:y}else M=W?D:"";let k=`@${U}`.length;j=j.substring(0,O)+M+j.substring(R+k),_=!0}return j}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",Y==="production"),J=Q(J,"development","enddevelopment",Y==="development"),J=Q(J,"staging","endstaging",Y==="staging"),J=Q(J,"testing","endtesting",Y==="testing"),J}var F3=new WeakMap;function M6($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function R1($,Z){if(!$)return Z?.nonceGenerator?.()??M6();let X=F3.get($);if(!X)X=Z?.nonceGenerator?.()??M6(),F3.set($,X);return X}function RK($){F3.delete($)}function T6($,Z){let X=[];for(let[J,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)X.push(J);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)X.push(`${J} ${Q.join(" ")}`)}}return X.join("; ")}function w3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${T6($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var aX={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},L3={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},tX={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},eX={"default-src":["'none'"],"frame-ancestors":["'none'"]};function DK($){return{enabled:!0,directives:{strict:aX,moderate:L3,relaxed:tX,api:eX}[$]||L3,useNonce:$==="strict",addMetaTag:!0}}function NK($,Z){let X={...$};for(let[J,Y]of Object.entries(Z)){let Q=J,G=X[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")X[Q]=G||Y;else if(Array.isArray(Y)){let q=Array.isArray(G)?G:[],U=[...new Set([...q,...Y])];X[Q]=U}}return X}function I6($,Z,X){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?R1(X,Z):void 0,Y=w3(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3273
|
+
${Y}`)}function k6($,Z){let X=$;return X=X.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<script nonce="${Z}"${Y}>`}),X=X.replace(/<style([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<style nonce="${Z}"${Y}>`}),X}function E6($,Z,X,J){let Y=$,Q=J.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?R1(Z,Q):void 0;return w3(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return R1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=R1(Z,Q);return Y}var $J={name:"csp",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?R1(X,Q):void 0;return w3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},ZJ={name:"cspNonce",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return R1(X,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function AK(){return[$J,ZJ]}function MK($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[X,J]of Object.entries($))if(Array.isArray(J)&&J.includes("http:"))Z.push(`CSP: Using http: in ${X} allows insecure resources`);return Z}function XJ($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function TK($,Z){if(!$.enabled)return{};let X=$.useNonce?R1(Z,$):void 0,J=T6($.directives,X);return{[XJ($.reportOnly)]:J}}var IK={enabled:!1,reportOnly:!1,directives:L3,useNonce:!1,addMetaTag:!0};import JJ from"crypto";var YJ=40,b6="_token",R3=null;function QJ($=YJ){let Z=JJ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return R3=Z,Z}function GJ(){if(!R3)QJ();return R3}function qJ($=b6){let Z=GJ();return`<input type="hidden" name="${$}" value="${Z}">`}function y6($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,X,J)=>{return qJ(J||b6)})}async function S6($,Z,X,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Y=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await UJ(Y,Q,Z,X,J);else Y=await WJ(Y,Q,Z,X,J)}return Y}async function UJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=`@${Q}`,U=`@end${Q}`,W=$,K=v1(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${U}`,"g"),z=[],H=K.exec(W);while(H!==null){let[B,j="",_=""]=H,V=H.index||0;try{let O=j?C6(j):[],F=_.trim(),L=await G(F,O,X,J);z.push({original:B,processed:L,startIndex:V})}catch(O){let F=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);z.push({original:B,processed:$0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${F}`,l.EVALUATION_ERROR),startIndex:V})}H=K.exec(W)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];W=W.replace(j,_)}return W}async function WJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=$,U=v1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],K=U.exec(q);while(K!==null){let[B,j=""]=K,_=K.index||0;try{let V=C6(j),O=await G("",V,X,J);W.push({original:B,processed:O,startIndex:_})}catch(V){let O=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}(${j}): ${O}`,l.EVALUATION_ERROR),startIndex:_})}K=U.exec(q)}let z=v1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=z.exec(q);while(H!==null){let[B]=H,j=H.index||0;try{let _=await G("",[],X,J);W.push({original:B,processed:_,startIndex:j})}catch(_){let V=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}: ${V}`,l.EVALUATION_ERROR),startIndex:j})}H=z.exec(q)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:_}=W[B];q=q.replace(j,_)}return q}function C6($){if(!$.trim())return[];let Z=[],X="",J=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,Y=G;else if(G===Y)J=!1;else X+=G;else if(G===","&&!J)Z.push(X.trim()),X="";else X+=G}if(X.trim())Z.push(X.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var P6=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,v6=/^[A-Za-z_$][\w$]*$/,KJ=new Set(["light","dark","system"]);function D1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function zJ($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,X=Z.appearance,J=Z.colorMode;if(D1(Z.storageKey,"storageKey"),!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(D1(X.key,"appearance.key"),D1(X.attribute,"appearance.attribute"),D1(X.default,"appearance.default"),D1(J.key,"colorMode.key"),D1(J.attribute,"colorMode.attribute"),D1(J.default,"colorMode.default"),!v6.test(X.key)||!v6.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!P6.test(X.attribute)||!P6.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(X.allowed)||X.allowed.length===0||X.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!X.allowed.includes(X.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!KJ.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:X.key,attribute:X.attribute,allowed:[...new Set(X.allowed)],default:X.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function HJ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function BJ($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${HJ($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function jJ($,Z){let X=1,J=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(J){if(G==="\\")Y=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}function f6($,Z){let X=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,G=jJ(X,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=X.slice(Q+1,G).trim(),U=X0(`(${q})`,Z),W=BJ(zJ(U));X=X.slice(0,Y.index)+W+X.slice(G+1),J.lastIndex=Y.index+W.length}return X}import _J from"crypto";function B0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var N3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function OJ($){return{...N3,...$.forms?.classes}}function J$($,Z,X,J){let Y=$||Z;return X?`${Y} ${J}`:Y}function x0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function m1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${B0(Z)}"`}function D3($,Z,X){if(!Z)return"";let J="";if(!/\baria-invalid\s*=/i.test(X))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(X))J+=` aria-describedby="${B0(`${x0($)}-error`)}"`;return J}function VJ(){return _J.randomUUID()}function gK($,Z,X,J){let Y=OJ(J),Q=$;return Q=LJ(Q,Z),Q=F5(Q,Z),Q=A3(Q,Z,Y),Q=M3(Q,Z,Y),Q}function F5($,Z){let X=$;return X=X.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=VJ();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${B0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),X=X.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${B0(Q)}">`;return J}),X}function A3($,Z,X=N3){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,q,U,W="")=>{let K=Q||G||"POST",z=q||U||"",H=K1(W),B=K.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${B0(j)}" action="${B0(z)}"${H?` ${H}`:""}>`;if(_+=`
|
|
3274
3274
|
${F5("@csrf",Z)}`,!["GET","POST"].includes(B))_+=`
|
|
3275
|
-
${F5(`@method('${B}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,q,U,W="")=>{let K=Q||G||"",z=q||U||"",H=K1(W),B=O5(K,Z),j=B!==void 0&&B!==null?B:z||"",_=H.match(/type=['"]([^'"]+)['"]/i),V=_?_[1]:"text",O=V5(K,Z),F=H.match(/class=['"]([^'"]+)['"]/i),L=J$(F?F[1]:"",X.input,O,X.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${B0(V)}" name="${B0(K)}"${m1(H,x0(K))} value="${B0(j)}" class="${L}"${D3(K,O,H)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",q="")=>{let U=K1(G),W=O5(Q,Z)||q.trim(),K=V5(Q,Z),z=U.match(/class=['"]([^'"]+)['"]/i),H=J$(z?z[1]:"",X.input,K,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${B0(Q)}"${m1(U,x0(Q))} class="${H}"${D3(Q,K,U)}${B?` ${B}`:""}>${B0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",q)=>{let U=K1(G),W=O5(Q,Z),K=V5(Q,Z),z=U.match(/class=['"]([^'"]+)['"]/i),H=J$(z?z[1]:"",X.input,K,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,""),j=q;if(W!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,V,O)=>{if((Array.isArray(W)?W.some((L)=>String(L)===O):String(W)===O)&&!V.includes("selected"))return V.replace(/(<option)/,"$1 selected");return _});return`<select name="${B0(Q)}"${m1(U,x0(Q))} class="${H}"${D3(Q,K,U)}${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let U=G===void 0?"1":G,W=G===void 0?x0(Q):`${x0(Q)}-${x0(U)}`,K=K1(q),z=O5(Q,Z),H=z!==void 0&&(Array.isArray(z)?z.some((V)=>String(V)===U):z===!0||String(z)===U),B=K.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:X.checkInput,_=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${B0(Q)}"${m1(K,W)} value="${B0(U)}" class="${j}"${H?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let U=K1(q),W=O5(Q,Z),K=W!==void 0&&W===G,z=U.match(/class=['"]([^'"]+)['"]/i),H=z?z[1]:X.checkInput,B=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${B0(Q)}"${m1(U,`${x0(Q)}-${x0(G)}`)} value="${B0(G)}" class="${H}"${K?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let q=K1(G),U=q.match(/accept=['"]([^'"]+)['"]/i),W=U?U[1]:"",K=q.includes("multiple"),z=V5(Q,Z),H=q.match(/class=['"]([^'"]+)['"]/i),B=J$(H?H[1]:"",X.input,z,X.inputError),j=q.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${B0(Q)}"${m1(q,x0(Q))}`,`class="${B}"`];if(W)_.push(`accept="${B0(W)}"`);if(K)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",q)=>{let U=K1(G),W=U.match(/class=['"]([^'"]+)['"]/i),K=W?W[1]:X.label,z=U.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${B0(x0(Q))}" class="${K}"${z?` ${z}`:""}>${q}</label>`}),J}function M3($,Z,X=N3){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,Q)=>{try{if(V5(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(q,U)=>{try{if(U.trim()==="$message"||U.trim()==="message")return x6(Y,Z);if(U.trim().includes("errors.first")||U.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return x6(Y,Z)}let W=U.trim();if(Q0(W)){let K=X0(W,Z);return K!==void 0?String(K):W}return W}catch{return U}});return`<div id="${B0(`${x0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function V5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function x6($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let X=Z.errors[$];return Array.isArray(X)?X[0]:String(X)}return""}function O5($,Z){let X;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(X=Z[J],X!==void 0)return X}return Z[$]}function K1($){if(!$.trim())return"";let Z=[],X=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=J.exec(X))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var g6={required:($,Z,X)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${X} field is required.`;return null},email:($,Z,X)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${X} field must be a valid email address.`;return null},min:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length<J)return`The ${X} field must be at least ${J} characters.`;if(typeof $==="number"&&$<J)return`The ${X} field must be at least ${J}.`;if(Array.isArray($)&&$.length<J)return`The ${X} field must have at least ${J} items.`;return null},max:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length>J)return`The ${X} field must not exceed ${J} characters.`;if(typeof $==="number"&&$>J)return`The ${X} field must not exceed ${J}.`;if(Array.isArray($)&&$.length>J)return`The ${X} field must not have more than ${J} items.`;return null},confirmed:($,Z,X)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${X} confirmation does not match.`;return null},numeric:($,Z,X)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${X} field must be a number.`;return null},integer:($,Z,X)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${X} field must be an integer.`;return null},alpha:($,Z,X)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${X} field must only contain letters.`;return null},alphanumeric:($,Z,X)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${X} field must only contain letters and numbers.`;return null},url:($,Z,X)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${X} field must be a valid URL.`}},regex:($,Z,X)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${X} field format is invalid.`;return null}catch{return`The ${X} field has an invalid validation pattern.`}},in:($,Z,X)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${X} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,X)=>{if(!$)return null;if(Z.includes(String($)))return`The ${X} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,X)=>{if(!$)return null;let J=new Date($);if(Number.isNaN(J.getTime()))return`The ${X} field must be a valid date.`;return null},before:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J>=Y)return`The ${X} field must be before ${Z[0]}.`;return null},after:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J<=Y)return`The ${X} field must be after ${Z[0]}.`;return null}};function gK($,Z){g6[$]=Z}function T3($){let[Z,...X]=$.split(":"),J=X.length>0?X.join(":").split(","):[];return{name:Z.trim(),params:J}}function FJ($,Z,X,J={}){let Y=[],Q=X.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let q=T3(G),U=g6[q.name];if(!U){console.warn(`Unknown validation rule: ${q.name}`);continue}if(q.name==="confirmed"){let K=`${$}_confirmation`;q.params=[J[K]]}let W=U(Z,q.params||[],$);if(W)Y.push(q.message||W)}return{field:$,valid:Y.length===0,errors:Y}}function hK($,Z){let X={};for(let[J,Y]of Object.entries(Z)){let Q=FJ(J,$[J],Y,$);if(!Q.valid)X[J]=Q.errors}return X}function LJ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(X,J,Y,Q)=>{let G=Y.split("|").map((U)=>U.trim()),q=[];for(let U of G){let W=T3(U);switch(W.name){case"required":q.push("required");break;case"email":q.push('type="email"');break;case"url":q.push('type="url"');break;case"numeric":case"integer":if(q.push('type="number"'),W.name==="integer")q.push('step="1"');break;case"min":if(W.params?.[0])q.push(`minlength="${W.params[0]}"`);break;case"max":if(W.params?.[0])q.push(`maxlength="${W.params[0]}"`);break;case"regex":if(W.params?.[0])q.push(`pattern="${W.params[0]}"`);break}}return`<!-- @validate:${J}:${Y} -->${q.length>0?`<!-- attrs:${q.join(" ")} -->`:""}`})}var h6={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length>=X||`Must be at least ${X} characters`;if(typeof $==="number")return $>=X||`Must be at least ${X}`;if(Array.isArray($))return $.length>=X||`Must have at least ${X} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length<=X||`Must be no more than ${X} characters`;if(typeof $==="number")return $<=X||`Must be no more than ${X}`;if(Array.isArray($))return $.length<=X||`Must have no more than ${X} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[X,J]=Z.map(Number);if(typeof $==="string")return $.length>=X&&$.length<=J||`Must be between ${X} and ${J} characters`;if(typeof $==="number")return $>=X&&$<=J||`Must be between ${X} and ${J}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,X)=>{let J=Object.keys(X);for(let Y of J)if(Y.endsWith("_confirmation")&&X[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X<J||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X>J||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length===X||`Must be exactly ${X} characters`;if(Array.isArray($))return $.length===X||`Must have exactly ${X} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function uK($){h6[$.name]=$}function wJ($,Z,X={}){let J=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=T3(Q),q=h6[G.name];if(!q){console.warn(`Unknown validation rule: ${G.name}`);continue}let U=q.validate($,G.params||[],X);if(U!==!0)J.push(U)}return{valid:J.length===0,errors:J}}function dK($,Z){let X={},J=!0;for(let[Y,Q]of Object.entries(Z)){let G=wJ($[Y],Q,$);if(!G.valid)J=!1,X[Y]=G.errors}return{valid:J,errors:X}}function mK($,Z){let X=JSON.stringify(Z);return`
|
|
3275
|
+
${F5(`@method('${B}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,q,U,W="")=>{let K=Q||G||"",z=q||U||"",H=K1(W),B=O5(K,Z),j=B!==void 0&&B!==null?B:z||"",_=H.match(/type=['"]([^'"]+)['"]/i),V=_?_[1]:"text",O=V5(K,Z),F=H.match(/class=['"]([^'"]+)['"]/i),L=J$(F?F[1]:"",X.input,O,X.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${B0(V)}" name="${B0(K)}"${m1(H,x0(K))} value="${B0(j)}" class="${L}"${D3(K,O,H)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",q="")=>{let U=K1(G),W=O5(Q,Z)||q.trim(),K=V5(Q,Z),z=U.match(/class=['"]([^'"]+)['"]/i),H=J$(z?z[1]:"",X.input,K,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${B0(Q)}"${m1(U,x0(Q))} class="${H}"${D3(Q,K,U)}${B?` ${B}`:""}>${B0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",q)=>{let U=K1(G),W=O5(Q,Z),K=V5(Q,Z),z=U.match(/class=['"]([^'"]+)['"]/i),H=J$(z?z[1]:"",X.input,K,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,""),j=q;if(W!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,V,O)=>{if((Array.isArray(W)?W.some((L)=>String(L)===O):String(W)===O)&&!V.includes("selected"))return V.replace(/(<option)/,"$1 selected");return _});return`<select name="${B0(Q)}"${m1(U,x0(Q))} class="${H}"${D3(Q,K,U)}${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let U=G===void 0?"1":G,W=G===void 0?x0(Q):`${x0(Q)}-${x0(U)}`,K=K1(q),z=O5(Q,Z),H=z!==void 0&&(Array.isArray(z)?z.some((V)=>String(V)===U):z===!0||String(z)===U),B=K.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:X.checkInput,_=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${B0(Q)}"${m1(K,W)} value="${B0(U)}" class="${j}"${H?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let U=K1(q),W=O5(Q,Z),K=W!==void 0&&W===G,z=U.match(/class=['"]([^'"]+)['"]/i),H=z?z[1]:X.checkInput,B=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${B0(Q)}"${m1(U,`${x0(Q)}-${x0(G)}`)} value="${B0(G)}" class="${H}"${K?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let q=K1(G),U=q.match(/accept=['"]([^'"]+)['"]/i),W=U?U[1]:"",K=q.includes("multiple"),z=V5(Q,Z),H=q.match(/class=['"]([^'"]+)['"]/i),B=J$(H?H[1]:"",X.input,z,X.inputError),j=q.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${B0(Q)}"${m1(q,x0(Q))}`,`class="${B}"`];if(W)_.push(`accept="${B0(W)}"`);if(K)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",q)=>{let U=K1(G),W=U.match(/class=['"]([^'"]+)['"]/i),K=W?W[1]:X.label,z=U.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${B0(x0(Q))}" class="${K}"${z?` ${z}`:""}>${q}</label>`}),J}function M3($,Z,X=N3){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,Q)=>{try{if(V5(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(q,U)=>{try{if(U.trim()==="$message"||U.trim()==="message")return x6(Y,Z);if(U.trim().includes("errors.first")||U.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return x6(Y,Z)}let W=U.trim();if(Q0(W)){let K=X0(W,Z);return K!==void 0?String(K):W}return W}catch{return U}});return`<div id="${B0(`${x0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function V5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function x6($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let X=Z.errors[$];return Array.isArray(X)?X[0]:String(X)}return""}function O5($,Z){let X;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(X=Z[J],X!==void 0)return X}return Z[$]}function K1($){if(!$.trim())return"";let Z=[],X=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=J.exec(X))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var g6={required:($,Z,X)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${X} field is required.`;return null},email:($,Z,X)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${X} field must be a valid email address.`;return null},min:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length<J)return`The ${X} field must be at least ${J} characters.`;if(typeof $==="number"&&$<J)return`The ${X} field must be at least ${J}.`;if(Array.isArray($)&&$.length<J)return`The ${X} field must have at least ${J} items.`;return null},max:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length>J)return`The ${X} field must not exceed ${J} characters.`;if(typeof $==="number"&&$>J)return`The ${X} field must not exceed ${J}.`;if(Array.isArray($)&&$.length>J)return`The ${X} field must not have more than ${J} items.`;return null},confirmed:($,Z,X)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${X} confirmation does not match.`;return null},numeric:($,Z,X)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${X} field must be a number.`;return null},integer:($,Z,X)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${X} field must be an integer.`;return null},alpha:($,Z,X)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${X} field must only contain letters.`;return null},alphanumeric:($,Z,X)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${X} field must only contain letters and numbers.`;return null},url:($,Z,X)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${X} field must be a valid URL.`}},regex:($,Z,X)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${X} field format is invalid.`;return null}catch{return`The ${X} field has an invalid validation pattern.`}},in:($,Z,X)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${X} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,X)=>{if(!$)return null;if(Z.includes(String($)))return`The ${X} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,X)=>{if(!$)return null;let J=new Date($);if(Number.isNaN(J.getTime()))return`The ${X} field must be a valid date.`;return null},before:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J>=Y)return`The ${X} field must be before ${Z[0]}.`;return null},after:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J<=Y)return`The ${X} field must be after ${Z[0]}.`;return null}};function hK($,Z){g6[$]=Z}function T3($){let[Z,...X]=$.split(":"),J=X.length>0?X.join(":").split(","):[];return{name:Z.trim(),params:J}}function FJ($,Z,X,J={}){let Y=[],Q=X.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let q=T3(G),U=g6[q.name];if(!U){console.warn(`Unknown validation rule: ${q.name}`);continue}if(q.name==="confirmed"){let K=`${$}_confirmation`;q.params=[J[K]]}let W=U(Z,q.params||[],$);if(W)Y.push(q.message||W)}return{field:$,valid:Y.length===0,errors:Y}}function uK($,Z){let X={};for(let[J,Y]of Object.entries(Z)){let Q=FJ(J,$[J],Y,$);if(!Q.valid)X[J]=Q.errors}return X}function LJ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(X,J,Y,Q)=>{let G=Y.split("|").map((U)=>U.trim()),q=[];for(let U of G){let W=T3(U);switch(W.name){case"required":q.push("required");break;case"email":q.push('type="email"');break;case"url":q.push('type="url"');break;case"numeric":case"integer":if(q.push('type="number"'),W.name==="integer")q.push('step="1"');break;case"min":if(W.params?.[0])q.push(`minlength="${W.params[0]}"`);break;case"max":if(W.params?.[0])q.push(`maxlength="${W.params[0]}"`);break;case"regex":if(W.params?.[0])q.push(`pattern="${W.params[0]}"`);break}}return`<!-- @validate:${J}:${Y} -->${q.length>0?`<!-- attrs:${q.join(" ")} -->`:""}`})}var h6={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length>=X||`Must be at least ${X} characters`;if(typeof $==="number")return $>=X||`Must be at least ${X}`;if(Array.isArray($))return $.length>=X||`Must have at least ${X} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length<=X||`Must be no more than ${X} characters`;if(typeof $==="number")return $<=X||`Must be no more than ${X}`;if(Array.isArray($))return $.length<=X||`Must have no more than ${X} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[X,J]=Z.map(Number);if(typeof $==="string")return $.length>=X&&$.length<=J||`Must be between ${X} and ${J} characters`;if(typeof $==="number")return $>=X&&$<=J||`Must be between ${X} and ${J}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,X)=>{let J=Object.keys(X);for(let Y of J)if(Y.endsWith("_confirmation")&&X[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X<J||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X>J||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length===X||`Must be exactly ${X} characters`;if(Array.isArray($))return $.length===X||`Must have exactly ${X} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function dK($){h6[$.name]=$}function wJ($,Z,X={}){let J=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=T3(Q),q=h6[G.name];if(!q){console.warn(`Unknown validation rule: ${G.name}`);continue}let U=q.validate($,G.params||[],X);if(U!==!0)J.push(U)}return{valid:J.length===0,errors:J}}function mK($,Z){let X={},J=!0;for(let[Y,Q]of Object.entries(Z)){let G=wJ($[Y],Q,$);if(!G.valid)J=!1,X[Y]=G.errors}return{valid:J,errors:X}}function lK($,Z){let X=JSON.stringify(Z);return`
|
|
3276
3276
|
<script>
|
|
3277
3277
|
(function() {
|
|
3278
3278
|
const form = document.getElementById('${$}');
|
|
@@ -3324,8 +3324,8 @@ catch { return 'Please enter a valid URL'; } },
|
|
|
3324
3324
|
}
|
|
3325
3325
|
});
|
|
3326
3326
|
})();
|
|
3327
|
-
</script>`.trim()}import k3 from"path";var L5;async function RJ(){if(L5!==void 0)return L5;try{L5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{L5=null}return L5}var y3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},k0={},m0={},e0={};function
|
|
3328
|
-
`),J=[{obj:Z,indent:-1}];for(let Y of X){let Q=Y.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let q=J[J.length-1].obj,U=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(U){let[,,W,K]=U,z=W.trim(),H=K.trim();if(H==="")q[z]={},J.push({obj:q[z],indent:G});else q[z]=kJ(H)}}return Z}function kJ($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let X=Number($);if(!Number.isNaN(X)&&$!=="")return X;return $}function EJ($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function bJ($,Z){return Y$($,Z)}function yJ($,Z){for(let X of $){let J=X.trim(),Y=J.match(/^\{(\d+)\}\s*(.*)$/);if(Y){let G=Number.parseInt(Y[1],10);if(Z===G)return Y[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),q=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=q)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function SJ($,Z={}){return m6($,Z)}function m6($,Z){let X="",J=0;while(J<$.length)if($[J]==="{"){let Y=CJ($,J);if(Y===-1){X+=$[J],J++;continue}let Q=$.slice(J+1,Y);X+=PJ(Q,Z),J=Y+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")X+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")X+=$[J+1],J+=2;else X+=$[J],J++;else X+=$[J],J++;return X}function CJ($,Z){let X=0;for(let J=Z;J<$.length;J++)if($[J]==="{")X++;else if($[J]==="}"){if(X--,X===0)return J}return-1}function PJ($,Z){let X=vJ($);if(X.length===0)return`{${$}}`;let J=X[0].trim(),Y=Z[J];if(X.length===1)return Y!==void 0?String(Y):`{${J}}`;switch(X[1].trim().toLowerCase()){case"plural":return fJ(Y,X.slice(2).join(","),Z);case"select":return gJ(Y,X.slice(2).join(","));case"selectordinal":return hJ(Y,X.slice(2).join(","));case"number":return dJ(Y,X[2]?.trim());case"date":return mJ(Y,X[2]?.trim());case"time":return lJ(Y,X[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function vJ($){let Z=[],X="",J=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if(Q==="{")J++,X+=Q;else if(Q==="}")J--,X+=Q;else if(Q===","&&J===0)Z.push(X),X="";else X+=Q}if(X)Z.push(X);return Z}function fJ($,Z,X){let J=Number($)||0,Y=S3(Z),Q=`=${J}`;if(Y[Q])return I3(Y[Q],J,X);let G=xJ(J);if(Y[G])return I3(Y[G],J,X);if(Y.other)return I3(Y.other,J,X);return String(J)}function I3($,Z,X){let J=$.replace(/#/g,String(Z));return m6(J,X)}function xJ($){let Z=Math.abs($),X=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(X===1&&J===0)return"one";return"other"}function gJ($,Z){let X=String($||""),J=S3(Z);if(J[X])return J[X];return J.other||String($)}function hJ($,Z){let X=Number($)||0,J=S3(Z),Y=uJ(X);if(J[Y])return J[Y].replace(/#/g,String(X));if(J.other)return J.other.replace(/#/g,String(X));return String(X)}function uJ($){let Z=Math.abs($),X=Z%10,J=Z%100;if(X===1&&J!==11)return"one";if(X===2&&J!==12)return"two";if(X===3&&J!==13)return"few";return"other"}function S3($){let Z={},X=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=X.exec($);while(J!==null)Z[J[1]]=J[2],J=X.exec($);return Z}function dJ($,Z){let X=Number($);if(Number.isNaN(X))return String($);switch(Z){case"integer":return Math.floor(X).toLocaleString();case"percent":return`${(X*100).toFixed(0)}%`;case"currency":return X.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return X.toLocaleString()}}function mJ($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return X.toLocaleDateString(void 0,J)}function lJ($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return X.toLocaleTimeString(void 0,J)}function cJ($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function b3($,Z,X=!0,J={}){let Y=$.split("."),Q=Z;for(let q of Y){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return X?$:"";let G=String(Q);if(cJ(G))return SJ(G,J);if(G.includes("|")&&"count"in J){let q=Number(J.count),U=G.split("|");G=yJ(U,q)}for(let[q,U]of Object.entries(J)){let W=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(U))}return G}async function l6($,Z,X,J){let Y=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...y3,...J.i18n},q=await bJ(G.locale,J);Z.__translations=q,Z.__locale=G.locale,Z.__i18nConfig=G,Y=await u6(Y,Q,async(K,z,H,B,j)=>{try{let _={};if(H)try{let O=[()=>JSON.parse(H),()=>{let F=`{"data":${H}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return _0(H,Z)}];for(let F of O)try{if(_=F(),Object.keys(_).length>0)break}catch{}}catch(O){if(J.debug)console.error("Error parsing parameters for @translate directive:",O)}return b3(z,q,G.fallbackToKey,_)||B.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,l.EVALUATION_ERROR)}});let U=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Y.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let K=[...Y.matchAll(U)];console.warn(`Found ${K.length} @translate matches`),K.forEach((z,H)=>console.warn(`Match ${H}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Y=await u6(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,H,B)=>{try{let j={};if(H)try{let _=[()=>JSON.parse(H),()=>{let V=`{"data":${H}}`,O=JSON.parse(V);return typeof O.data==="object"?O.data:{}},()=>{return _0(H,Z)}];for(let V of _)try{if(j=V(),Object.keys(j).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return b3(z,q,G.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,l.EVALUATION_ERROR)}}),Y}async function u6($,Z,X){let J=[];return $.replace(Z,(Q,...G)=>{let q=X(Q,...G).then((U)=>({match:Q,replacement:U}));return J.push(q),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:q})=>Q.replace(G,q),$)}function
|
|
3327
|
+
</script>`.trim()}import k3 from"path";var L5;async function RJ(){if(L5!==void 0)return L5;try{L5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{L5=null}return L5}var y3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},k0={},m0={},e0={};function sK($){if($)delete k0[$];else for(let Z of Object.keys(k0))delete k0[Z]}function oK(){let $=Object.entries(k0).map(([Z,X])=>({locale:Z,loadedAt:new Date(X.loadedAt),keyCount:d6(X.translations)}));return{size:Object.keys(k0).length,locales:Object.keys(k0),entries:$}}function d6($,Z=0){for(let X of Object.values($))if(Z++,X&&typeof X==="object"&&!Array.isArray(X))Z=d6(X,Z);return Z}function DJ($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}function rK($){if(k0[$])return"loaded";return e0[$]||"idle"}function aK($){return e0[$]==="loading"}function tK($){return!!k0[$]}async function NJ($,Z){let{locales:X,parallel:J=!0,priority:Y={},onLocaleLoaded:Q,onComplete:G,onError:q}=$,U=J?X:[...X].sort((W,K)=>(Y[K]||0)-(Y[W]||0));if(J){let W=U.map(async(K)=>{try{await Y$(K,Z),Q?.(K)}catch(z){q?.(K,z instanceof Error?z:Error(String(z)))}});await Promise.all(W)}else for(let W of U)try{await Y$(W,Z),Q?.(W)}catch(K){q?.(W,K instanceof Error?K:Error(String(K)))}G?.()}function eK($,Z){queueMicrotask(()=>{NJ($,Z).catch((X)=>{if(Z.debug)console.error("Background preload error:",X)})})}async function Y$($,Z){if({...y3,...Z.i18n}.cache&&k0[$]){let Y=k0[$],Q=Z.i18n?.cacheMaxAge??0;if(!DJ(Y,Q))return Y.translations}if(m0[$]?.state==="loading")return m0[$].promise;e0[$]="loading";let J=E3($,Z).then((Y)=>{return e0[$]="loaded",delete m0[$],Y}).catch((Y)=>{throw e0[$]="error",m0[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return m0[$]={promise:J,state:"loading"},J}function AJ($){return k0[$]?.translations}async function $z($,Z){let X=AJ($);if(X)return X;return Y$($,Z)}async function Zz($,Z){if(k0[$])return k0[$].translations;if(m0[$]){if(Z)return Promise.race([m0[$].promise,new Promise((X,J)=>setTimeout(()=>J(Error(`Timeout waiting for locale: ${$}`)),Z))]);return m0[$].promise}throw Error(`Locale "${$}" is not loading. Call loadTranslationLazy first.`)}function Xz(){return Object.entries(e0).filter(([$,Z])=>Z==="loading").map(([$])=>$)}function Jz($){if($)delete m0[$],delete e0[$];else{for(let Z of Object.keys(m0))delete m0[Z];for(let Z of Object.keys(e0))delete e0[Z]}}async function E3($,Z){let X={...y3,...Z.i18n},J=k3.isAbsolute(X.translationsDir)?X.translationsDir:k3.resolve(Z.root||process.cwd(),X.translationsDir);try{let Y=await RJ(),Q=Y?await Y($,{translationsDir:J,defaultLocale:X.defaultLocale,sources:EJ(X.format)}):await MJ($,X,J);if(Q===void 0){if($!==X.defaultLocale)return E3(X.defaultLocale,Z);return{}}let G=Q;if(X.cache)k0[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Y){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Y);if($!==X.defaultLocale)return E3(X.defaultLocale,Z);return{}}}async function MJ($,Z,X){let J=k3.join(X,`${$}${TJ(Z.format)}`);try{let Y=await import(J);return Y.default||Y}catch(Y){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return IJ(Q);if(Z.format==="json")return JSON.parse(Q);throw Y}catch{return}}}function TJ($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function IJ($){let Z={},X=$.split(`
|
|
3328
|
+
`),J=[{obj:Z,indent:-1}];for(let Y of X){let Q=Y.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let q=J[J.length-1].obj,U=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(U){let[,,W,K]=U,z=W.trim(),H=K.trim();if(H==="")q[z]={},J.push({obj:q[z],indent:G});else q[z]=kJ(H)}}return Z}function kJ($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let X=Number($);if(!Number.isNaN(X)&&$!=="")return X;return $}function EJ($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function bJ($,Z){return Y$($,Z)}function yJ($,Z){for(let X of $){let J=X.trim(),Y=J.match(/^\{(\d+)\}\s*(.*)$/);if(Y){let G=Number.parseInt(Y[1],10);if(Z===G)return Y[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),q=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=q)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function SJ($,Z={}){return m6($,Z)}function m6($,Z){let X="",J=0;while(J<$.length)if($[J]==="{"){let Y=CJ($,J);if(Y===-1){X+=$[J],J++;continue}let Q=$.slice(J+1,Y);X+=PJ(Q,Z),J=Y+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")X+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")X+=$[J+1],J+=2;else X+=$[J],J++;else X+=$[J],J++;return X}function CJ($,Z){let X=0;for(let J=Z;J<$.length;J++)if($[J]==="{")X++;else if($[J]==="}"){if(X--,X===0)return J}return-1}function PJ($,Z){let X=vJ($);if(X.length===0)return`{${$}}`;let J=X[0].trim(),Y=Z[J];if(X.length===1)return Y!==void 0?String(Y):`{${J}}`;switch(X[1].trim().toLowerCase()){case"plural":return fJ(Y,X.slice(2).join(","),Z);case"select":return gJ(Y,X.slice(2).join(","));case"selectordinal":return hJ(Y,X.slice(2).join(","));case"number":return dJ(Y,X[2]?.trim());case"date":return mJ(Y,X[2]?.trim());case"time":return lJ(Y,X[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function vJ($){let Z=[],X="",J=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if(Q==="{")J++,X+=Q;else if(Q==="}")J--,X+=Q;else if(Q===","&&J===0)Z.push(X),X="";else X+=Q}if(X)Z.push(X);return Z}function fJ($,Z,X){let J=Number($)||0,Y=S3(Z),Q=`=${J}`;if(Y[Q])return I3(Y[Q],J,X);let G=xJ(J);if(Y[G])return I3(Y[G],J,X);if(Y.other)return I3(Y.other,J,X);return String(J)}function I3($,Z,X){let J=$.replace(/#/g,String(Z));return m6(J,X)}function xJ($){let Z=Math.abs($),X=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(X===1&&J===0)return"one";return"other"}function gJ($,Z){let X=String($||""),J=S3(Z);if(J[X])return J[X];return J.other||String($)}function hJ($,Z){let X=Number($)||0,J=S3(Z),Y=uJ(X);if(J[Y])return J[Y].replace(/#/g,String(X));if(J.other)return J.other.replace(/#/g,String(X));return String(X)}function uJ($){let Z=Math.abs($),X=Z%10,J=Z%100;if(X===1&&J!==11)return"one";if(X===2&&J!==12)return"two";if(X===3&&J!==13)return"few";return"other"}function S3($){let Z={},X=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=X.exec($);while(J!==null)Z[J[1]]=J[2],J=X.exec($);return Z}function dJ($,Z){let X=Number($);if(Number.isNaN(X))return String($);switch(Z){case"integer":return Math.floor(X).toLocaleString();case"percent":return`${(X*100).toFixed(0)}%`;case"currency":return X.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return X.toLocaleString()}}function mJ($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return X.toLocaleDateString(void 0,J)}function lJ($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return X.toLocaleTimeString(void 0,J)}function cJ($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function b3($,Z,X=!0,J={}){let Y=$.split("."),Q=Z;for(let q of Y){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return X?$:"";let G=String(Q);if(cJ(G))return SJ(G,J);if(G.includes("|")&&"count"in J){let q=Number(J.count),U=G.split("|");G=yJ(U,q)}for(let[q,U]of Object.entries(J)){let W=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(U))}return G}async function l6($,Z,X,J){let Y=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...y3,...J.i18n},q=await bJ(G.locale,J);Z.__translations=q,Z.__locale=G.locale,Z.__i18nConfig=G,Y=await u6(Y,Q,async(K,z,H,B,j)=>{try{let _={};if(H)try{let O=[()=>JSON.parse(H),()=>{let F=`{"data":${H}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return _0(H,Z)}];for(let F of O)try{if(_=F(),Object.keys(_).length>0)break}catch{}}catch(O){if(J.debug)console.error("Error parsing parameters for @translate directive:",O)}return b3(z,q,G.fallbackToKey,_)||B.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,l.EVALUATION_ERROR)}});let U=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Y.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let K=[...Y.matchAll(U)];console.warn(`Found ${K.length} @translate matches`),K.forEach((z,H)=>console.warn(`Match ${H}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Y=await u6(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,H,B)=>{try{let j={};if(H)try{let _=[()=>JSON.parse(H),()=>{let V=`{"data":${H}}`,O=JSON.parse(V);return typeof O.data==="object"?O.data:{}},()=>{return _0(H,Z)}];for(let V of _)try{if(j=V(),Object.keys(j).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return b3(z,q,G.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,l.EVALUATION_ERROR)}}),Y}async function u6($,Z,X){let J=[];return $.replace(Z,(Q,...G)=>{let q=X(Q,...G).then((U)=>({match:Q,replacement:U}));return J.push(q),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:q})=>Q.replace(G,q),$)}function Yz($,Z=!0){return(X,J={})=>{return b3(X,$,Z,J)}}var w5=/<\/?template\b[^>]*>/gi,pJ=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function iJ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return pJ.test(Z)}function Q$($){w5.lastIndex=0;let Z;while((Z=w5.exec($))!==null){if(Z[0].startsWith("</")||iJ(Z[0]))continue;let X=Z.index,J=w5.lastIndex,Y=1,Q;while((Q=w5.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:X,openEnd:J,closeStart:G,end:w5.lastIndex,content:$.slice(J,G)}}}else Y++;return null}return null}import U0 from"path";function C3($,Z){let X=0;for(let J=Z;J<$.length;J++){let Y=$[J];if(Y==="("||Y==="["||Y==="{")X++;else if(Y===")"||Y==="]"||Y==="}")X--;else if(Y===","&&X===0)return J}return-1}function nJ($,Z,X){let J=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(J);while(Q){let G=Q.index,q=G+Q[0].length-1,U=1,W=q+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")")U--;W++}if(U!==0)break;let K=J.substring(q+1,W-1),z=`${X}(${K})`;J=J.substring(0,G)+z+J.substring(W),Y.lastIndex=G+z.length,Q=Y.exec(J)}return J}function sJ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function p6($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,q=(z)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===z){Q++;return}Q++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let z=1;while(Q<G&&z>0)if(Z[Q]==="{")z++,Q++;else if(Z[Q]==="}")z--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')q(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},W=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3329
3329
|
`)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},K=()=>{if(Y!==0)return;let z=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!J.has(j))X.push(j),J.add(j);return}let H=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!J.has(j))X.push(j),J.add(j);return}let B=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))X.push(j),J.add(j)}};while(Q<G){if(W())continue;if(Z[Q]==="'"||Z[Q]==='"'){q(Z[Q]);continue}if(Z[Q]==="`"){U();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))K();Q++}return X.join(", ")}function i6($,Z=""){let X=p6($).split(",").map((J)=>J.trim()).filter(Boolean);return`
|
|
3330
3330
|
(function() {
|
|
3331
3331
|
${l1("var",X)}
|
|
@@ -3360,9 +3360,9 @@ ${p6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3360
3360
|
} finally {
|
|
3361
3361
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3362
3362
|
}
|
|
3363
|
-
})();`}function rJ($,Z){let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1]};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}var c6=0,
|
|
3364
|
-
`;continue}if(V0)try{let{extractVariables:t}=await import("./chunk-
|
|
3365
|
-
`}}if(b){let f=rJ(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await P3(D,k,L,J,Y,Q);let{processLoops:C}=await import("./chunk-
|
|
3363
|
+
})();`}function rJ($,Z){let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1]};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}var c6=0,Vz=new O1(500),s6=new Set;function Fz(){s6.clear()}function aJ($){if($.__onceStore instanceof Set)return $.__onceStore;return s6}async function P3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||U0.join(U0.dirname(X),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let q=nJ($,"@partial","@include"),U=aJ(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,V,O)=>{let F=V.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),V});{let _=/@includeIf\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")")L--;w++}if(L!==0)break;let R=q.substring(F+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())Y.add(T),A=`@include(${R})`;q=q.substring(0,O)+A+q.substring(w),_.lastIndex=0}}for(let[_,V]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(q))!==null){let L=F.index,w=L+F[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let N=q.substring(w+1,D-1),T=C3(N,0);if(T===-1){O.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=C3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,x;if(Q0(C)){let m=G0(C,Object.keys(Z));x=Boolean(m(...Object.values(Z)))}else x=Boolean(X0(C,Z));let f=V?!x:x,n="";if(f){let m=W(I,G,X);if(m&&await Bun.file(m).exists())Y.add(m);n=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+n+q.substring(D),O.lastIndex=0}catch(C){let x=C instanceof Error?C.message:String(C),f=W0("Include",`Error evaluating ${_} condition: ${x}`,X,$,L);q=q.substring(0,L)+f+q.substring(D),O.lastIndex=0}}}{let _=/@each\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(O,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,T,A,M,k]=N;try{let I,y=A.trim();if(Q0(y))I=G0(y,Object.keys(Z))(...Object.values(Z));else I=X0(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},x=await H(T,C,$,O);E+=x}else if(k)E=await H(k,{},$,O);q=q.substring(0,O)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,O)+W0("Each",`Error in @each: ${y}`,X,$,O)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(F+1,w),D=q.substring(O,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let T=N[1],A=R.slice(N[0].length),M,k=A.match(/^\s*,\s*\{/);if(k){A=A.slice(k[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=_0(M,Z)}catch(x){let f=x instanceof Error?x.message:String(x);if(J.debug){let n=W0("Include",`Error parsing includeFirst variables: ${f}`,X,$,O,D);q=q.replace(D,()=>n)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let x of E){let f=W(x,G,X);if(!f)continue;if(await r(f)){let n=await H(x,b,$,O);q=q.replace(D,()=>n),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let x=W0("Include",`None of the includeFirst paths exist: ${T}`,X,$,O,D);q=q.replace(D,()=>x)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=W0("Include",`Error processing @includeFirst: ${b}`,X,$,O,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,V,O){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=U0.resolve(V),w=U0.resolve(U0.dirname(O)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(V,F);else R=U0.resolve(w,F);let D=U0.normalize(R),N=D.startsWith(L+U0.sep)||D===L,T=D.startsWith(w+U0.sep)||D===w,A=!1,M=U0.dirname(w);if(D.startsWith(M+U0.sep)){if(!U0.relative(M,D).split(U0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!T&&!A)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let K=U0.resolve(X);Q.add(K);function z(_,V,O,F){return J.onIncludeError?.({includePath:_,templatePath:X,message:V,partialsDir:G}),W0("Include",V,X,O,F)}async function H(_,V={},O,F){let L=W(_,G,X);if(!L)return z(_,`Could not resolve path for include: ${_}`,O,F);let w=U0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>U0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,O,F)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(f){let n=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${n}`,O,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-vkpmnn26.js");R=f(R,Z)}if(R&&(J.debug||!H5()&&!c5()))try{let{warnUnbalancedTags:f}=await import("./chunk-vgr8kykv.js");f(R,L)}catch{}let D=R;try{let{processESImports:f}=await import("./chunk-f7fhjvbe.js");await f(R,Z,L,J,Y)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,f instanceof Error?f.message:f)}let N=Q$(D);if(N)D=N.content.trim();let A=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(A)M=`<style${A[1]}>${A[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...Z};k.__stx_signals_gate=Q1(R);for(let[f,n]of Object.entries(V))k[f]=n;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],E="",b=null;for(let f of y){let n=f[1]||"",m=f[2]||"",V0=n.includes("server"),M0=N1(n),T0="";try{let{extractAndStripCssImports:t,renderVendorStyleTags:K0}=await import("./chunk-hdg7t3zs.js"),q0=t(m,{filePath:L,projectRoot:process.cwd()});m=q0.code,T0=K0(q0.styles)}catch(t){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,t instanceof Error?t.message:t)}if(M0&&m.trim())m=A1(m);if(!V0)try{let{hasUserImports:t,bundleClientScript:K0}=await import("./chunk-2kjp90p2.js");if(t(m))m=await K0(m,L,{projectRoot:process.cwd()})}catch(t){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,t instanceof Error?t.message:t)}let h0=sJ(m);if(h0&&!V0){b=`stx_scope_${U0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++c6}`;let t=r0(m),K0=oJ(t,b);E+=`${T0}<script data-stx-scoped data-stx-run="always">${K0}</script>
|
|
3364
|
+
`;continue}if(V0)try{let{extractVariables:t}=await import("./chunk-2bkqbmkn.js");await t(m,k,L)}catch(t){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,t)}if(!V0&&!h0){let t=n.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++c6}`;let K0=r0(m),q0=n6(K0,b),B1=i6(K0,q0);E+=`${T0}<script data-stx-scoped data-stx-run="always"${t?` ${t}`:""}>${B1}</script>
|
|
3365
|
+
`}}if(b){let f=rJ(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await P3(D,k,L,J,Y,Q);let{processLoops:C}=await import("./chunk-vhvfja74.js"),x=C(D,k,L);if(x=t0(x,k,L),x=_1(x,k,L),M)x+=`
|
|
3366
3366
|
`+M;if(E)x+=`
|
|
3367
3367
|
`+E;return x}catch(R){let D=R instanceof Error?R.message:String(R);return z(_,`Error processing include ${_}: ${D}`,O,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,V=_+j[0].length-1,O=1,F=V+1;while(F<q.length&&O>0){if(q[F]==="(")O++;else if(q[F]===")")O--;F++}if(O!==0)break;let L=q.substring(_,F),w=q.substring(V+1,F-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let D=R[1],N,T=w.substring(R[0].length),A=C3(T,0);if(A!==-1)N=T.substring(A+1).trim();let M={};if(N)try{M=_0(N,Z)}catch(I){let y=I instanceof Error?I.message:String(I);q=q.replace(L,W0("Include",`Error parsing include variables for ${D}: ${y}`,X,$,_)),B.lastIndex=0;continue}let k=await H(D,M,$,_);q=q.substring(0,_)+k+q.substring(F),B.lastIndex=0}return q}function v3($,Z){let X=$;function J(Y,Q,G,q){let U=Y,W=!0;while(W){W=!1;let K=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=U.match(K);if(!z||z.index===void 0)break;let H=z.index,B=z[1],j=H+z[0].length,_=new RegExp(`@${Q}\\(`),V=new RegExp(`@${G}(?![a-z])`),O=1,F=j,L=-1;while(O>0&&F<U.length){let R=U.slice(F),D=R.match(_),N=R.match(V),T=D?F+D.index:1/0,A=N?F+N.index:1/0;if(T<A)O++,F=T+(D[0].length||1);else if(A<1/0){if(O--,O===0){L=A;break}F=A+G.length+1}else break}if(L===-1)break;let w=U.slice(j,L);if(!Z[B])Z[B]=[];if(q)Z[B].unshift(w);else Z[B].push(w);U=U.substring(0,H)+U.substring(L+`@${G}`.length),W=!0}return U}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function f3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
|
|
3368
3368
|
`)})}import*as x3 from"path";async function o6($,Z,X=""){if(x3.basename(X)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return a6($,Z,X,"@js","@endjs")}async function r6($,Z,X=""){if(x3.basename(X)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return a6($,Z,X,"@ts","@endts")}async function a6($,Z,X,J,Y){let Q=$,G=v1(`${J}([\\s\\S]*?)${Y}`,"g"),q=[],U;while((U=G.exec($))!==null)q.push({fullMatch:U[0],content:U[1]||"",index:U.index});for(let{fullMatch:W,content:K,index:z}of q)try{let H={...Z,global:Z},B=Object.keys(H),j=Object.values(H),_=K.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let O=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
|
|
@@ -3392,7 +3392,7 @@ ${p6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3392
3392
|
return result;
|
|
3393
3393
|
`)(...j);J=J.substring(0,G)+O+J.substring(H),Y=!0}catch(B){let j=$0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,l.EVALUATION_ERROR);J=J.substring(0,G)+j+J.substring(H),Y=!0}}return J}function WY($,Z="_method"){let X=$.toUpperCase();if(X==="GET"||X==="POST")return"";return`<input type="hidden" name="${Z}" value="${X}">`}function G2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,X,J,Y,Q)=>{return WY(J,Q||"_method")})}async function q2($,Z,X,J,Y){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((q)=>q.timing===Y);if(G.length===0)return Q;for(let q of G){if(!q.name||typeof q.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",q);continue}try{let U=await q.handler(Q,Z,X,J);if(typeof U==="string")Q=U;else if(J.debug)console.warn(`Middleware ${q.name} did not return a string`)}catch(U){if(J.debug)console.error(`Error in middleware ${q.name}:`,U);if(J.debug){let W=W0("Middleware",`Error in middleware '${q.name}': ${U instanceof Error?U.message:String(U)}`,X,$);Q=Q.replace(/<body[^>]*>/,`$&
|
|
3394
3394
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${y$(W)}</div>
|
|
3395
|
-
`)}}}return Q}async function U2($,Z,X,J){return q2($,Z,X,J,"before")}async function W2($,Z,X,J){return q2($,Z,X,J,"after")}U5();U5();function K2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,X,J,Y,Q)=>{try{let G=Y?_0(Y,{}):{};return g3(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var l0={patterns:[],exact:{}};function
|
|
3395
|
+
`)}}}return Q}async function U2($,Z,X,J){return q2($,Z,X,J,"before")}async function W2($,Z,X,J){return q2($,Z,X,J,"after")}U5();U5();function K2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,X,J,Y,Q)=>{try{let G=Y?_0(Y,{}):{};return g3(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var l0={patterns:[],exact:{}};function dz($,Z){if(!l0.exact[$])l0.exact[$]=[];l0.exact[$].push(Z)}function mz($,Z){let X=typeof $==="string"?new RegExp($):$;l0.patterns.push({pattern:X,callback:Z})}async function z2($,Z){let X=$.split("/").pop()?.split(".")[0]||"";if(l0.exact[$])for(let J of l0.exact[$])await Promise.resolve(J(Z,$));if(l0.exact[X])for(let J of l0.exact[X])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:Y}of l0.patterns)if(J.test($)||J.test(X))await Promise.resolve(Y(Z,$))}function lz(){l0.patterns=[],l0.exact={}}var KY=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),zY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function HY($){let Z=[],X=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,J;while((J=X.exec($))!==null){let Y=J[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=J.index,G=Q+J[0].length,q=J[1].toLowerCase();if(J[0].endsWith("/>")||zY.has(q)){Z.push([Q,G]);continue}let U=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`<\\/?${U}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");W.lastIndex=G;let K=1,z=G,H;while((H=W.exec($))!==null)if(H[0].startsWith("</")){if(K--,K===0){z=H.index+H[0].length;break}}else if(!H[0].endsWith("/>"))K++;Z.push([Q,z])}return Z}function B2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>B2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function j2($,Z){if(!/:[\w-]+=/.test($))return $;let X=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=J.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...HY($));function G(W){return Y.some(([K,z])=>W>=K&&W<z)}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,U=[];while((Q=q.exec(X))!==null){if(G(Q.index))continue;let W=Q[0],K=Q[2];if(!K||!K.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,H,B=K,j=!1;while((H=z.exec(K))!==null){let _=H[1],V=H[2];if(H2(_))continue;if(V.includes("()")&&!V.includes(".get(")||V.includes("$store")||V.includes("$ref"))continue;try{let O=Object.keys(Z),F=Object.values(Z),L=V.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!O.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let R=Function(...O,`return (${V})`)(...F);if(_==="class"){let D=B2(R);if(D){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${D}"`);else B=B.replace(H[0],` class="${D}"`)}else B=B.replace(H[0],"");j=!0;continue}if(KY.has(_)){if(R)B=B.replace(H[0],` ${_}`);else B=B.replace(H[0],"");j=!0;continue}if(R===null||R===void 0||R===!1)B=B.replace(H[0],"");else{let D=String(R).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");B=B.replace(H[0],` ${_}="${D}"`)}j=!0}catch{continue}}if(j){let _=W.endsWith("/>")?" /":"",O=`<${Q[1]}${B}${_}>`;U.push({start:Q.index,end:Q.index+W.length,replacement:O})}}for(let W=U.length-1;W>=0;W--){let{start:K,end:z,replacement:H}=U[W];X=X.slice(0,K)+H+X.slice(z)}return X}var BY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),jY=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function M1($,Z){let X=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;X.lastIndex=Z;let J=X.exec($);if(!J)return null;let Y=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&BY.has(J[1]),Q=Y?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:Y,start:J.index,end:J.index+J[0].length}}function _Y($,Z,X){let J=1,Y=X,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y;let q=Q.exec($),U=G.exec($);if(!U)return-1;if(q&&q.index<U.index)J++,Y=q.index+q[0].length;else{if(J--,J===0)return U.index+U[0].length;Y=U.index+U[0].length}}return-1}function n0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let X=_Y($,Z.tag,Z.end);if(X===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:X,innerHTML:$.slice(Z.end,X-`</${Z.tag}>`.length)}}function _2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function c1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${X}="([^"]*)"`,"s"))||$.match(new RegExp(`${X}='([^']*)'`,"s"));return J?J[1]:null}function z1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${X}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${X}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${X}(?=\\s|$|>|/)`,"g"),"")}function H1($,Z,X){let J=Z.selfClosing?" /":"",Y=`<${Z.tag}${X}${J}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function OY($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function VY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;let Y=c1(J.attrs,"v-for");if(Y===null){X=J.end;continue}let Q=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){X=J.end;continue}let G=Q[1].trim(),q=Q[2].trim(),U;if(G.includes(",")){let V=G.split(",").map((L)=>L.trim()),O=V[0],F=V[1];U=`${q} as ${F} => ${O}`}else U=`${q} as ${G}`;let W=z1(J.attrs,"v-for"),K=z1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=n0(Z,J),H=Z.slice(z.outerStart,z.outerEnd),B=H1(H,{...J,start:0,end:J.end-J.start},K),j=`@foreach(${U})
|
|
3396
3396
|
`,_=`${j}${B}
|
|
3397
3397
|
@endforeach`;Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),X=z.outerStart+j.length}return Z}function FY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;let Y=c1(J.attrs,"v-if");if(Y===null){X=J.end;continue}let Q=[],G=n0(Z,J),q=z1(J.attrs,"v-if"),U=H1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},q);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:U,parsedTag:J});let W=G.outerEnd,K=!0;while(K){let _=Z.slice(W).match(/^\s*/),V=_?_[0].length:0,O=M1(Z,W+V);if(!O){K=!1;break}let F=c1(O.attrs,"v-else-if"),L=_2(O.attrs,"v-else");if(F!==null){let w=n0(Z,O),R=z1(O.attrs,"v-else-if"),D=H1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},R);Q.push({type:"else-if",expr:F,outerStart:W,outerEnd:w.outerEnd,element:D,parsedTag:O}),W=w.outerEnd}else if(L){let w=n0(Z,O),R=z1(O.attrs,"v-else"),D=H1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},R);Q.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:D,parsedTag:O}),K=!1}else K=!1}let z=[];for(let _ of Q)if(_.type==="if")z.push(`@if(${_.expr})
|
|
3398
3398
|
${_.element}`);else if(_.type==="else-if")z.push(`@elseif(${_.expr})
|
|
@@ -3406,10 +3406,10 @@ ${H1(G,{...J,start:0,end:J.end-J.start},Y)}
|
|
|
3406
3406
|
`)})}else Z.push({selector:`@${K} ${z.trim()}`,declarations:H.trim()})}G="",Q=!1}else if(Y.trim()){Y+=U;let W=Y.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Y=""}continue}}if(Q)G+=U;else Y+=U}return Z}function N2($,Z,X,J,Y,Q){let{selector:G,declarations:q}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let K=G.replace("@keyframes ","").trim();return`@keyframes ${Y.get(K)||K} { ${q} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=u3(`x { ${q} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>N2(H,Z,X,J,Y,Q)).join(`
|
|
3407
3407
|
`);return`${G} {
|
|
3408
3408
|
${z}
|
|
3409
|
-
}`}return`${G} { ${q} }`}let U=yY(G,Z,X,J),W=q;for(let[K,z]of Y)W=W.replace(new RegExp(`\\b${K}\\b`,"g"),z);if(Q)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${U} { ${W} }`}function yY($,Z,X,J){let Y=$.split(",").map((G)=>G.trim()),Q=[];for(let G of Y){if(G.startsWith(":host")){if(J)Q.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(W)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let q=X?`${X} .${Z}`:`.${Z}`;Q.push(`${q} ${G}`);let U=SY(G,Z);if(U)Q.push(X?`${X} ${U}`:U)}return Q.join(", ")}function SY($,Z){let X=0,J=$.length;for(let U=0;U<$.length;U++){let W=$[U];if(W==="["||W==="(")X++;else if(W==="]"||W===")")X--;else if(X===0&&(W===" "||W===">"||W==="+"||W==="~")){J=U;break}}let Y=$.slice(0,J),Q=$.slice(J);if(!Y)return"";let G=Y.length,q=0;for(let U=0;U<Y.length;U++){let W=Y[U];if(W==="["||W==="(")q++;else if(W==="]"||W===")")q--;else if(X===0&&q===0&&W===":"){G=U;break}}return`${Y.slice(0,G)}.${Z}${Y.slice(G)}${Q}`}var d3=String.raw`(?<![\w-])scoped(?![\w-])`,CY=new RegExp(`<style\\s+[^>]*${d3}`,"i");function M2($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(X)=>{let J=X.trim();if(Z.has(J))return"";return Z.add(J),X})}function K$($,Z){if(!CY.test($))return{html:$,hasScoped:!1};let X=R2(Z),J=`data-v-${X}`,Y=$,Q=new RegExp(`<style\\s+([^>]*${d3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Y=Y.replace(Q,(q,U,W)=>{G=!0;let K=PY(W,J),z=U.replace(new RegExp(d3,"gi"),"").trim(),H=z?` ${z}`:"";return`<style data-stx-scoped="${X}"${H}>${K}</style>`}),!G)return{html:$,hasScoped:!1};return Y=fY(Y,J),{html:Y,hasScoped:!0}}function PY($,Z){return D2($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}var vY=($)=>`\x00stx-scope-mask-${$}\x00`,A2=/\u0000stx-scope-mask-(\d+)\u0000/g;function fY($,Z){let X=c0($,(Y,Q)=>{let G=Y1(Y,Q);return G>Q?G:S1(Y,Q)},(Y,Q)=>vY(Q)),J=xY(X.output,Z);return A2.lastIndex=0,J.replace(A2,(Y,Q)=>X.tokens[Number(Q)])}function xY($,Z){let X=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Y,Q)=>{if(X.has(Y.toLowerCase()))return J;if(J.includes(Z))return J;if(Y.toLowerCase()==="style"||Y.toLowerCase()==="script")return J;if(Q)return J.replace(`<${Y}${Q}`,`<${Y} ${Z}${Q}`);if(J.endsWith("/>"))return`<${Y} ${Z} />`;return`<${Y} ${Z}>`})}var
|
|
3409
|
+
}`}return`${G} { ${q} }`}let U=yY(G,Z,X,J),W=q;for(let[K,z]of Y)W=W.replace(new RegExp(`\\b${K}\\b`,"g"),z);if(Q)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${U} { ${W} }`}function yY($,Z,X,J){let Y=$.split(",").map((G)=>G.trim()),Q=[];for(let G of Y){if(G.startsWith(":host")){if(J)Q.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(W)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let q=X?`${X} .${Z}`:`.${Z}`;Q.push(`${q} ${G}`);let U=SY(G,Z);if(U)Q.push(X?`${X} ${U}`:U)}return Q.join(", ")}function SY($,Z){let X=0,J=$.length;for(let U=0;U<$.length;U++){let W=$[U];if(W==="["||W==="(")X++;else if(W==="]"||W===")")X--;else if(X===0&&(W===" "||W===">"||W==="+"||W==="~")){J=U;break}}let Y=$.slice(0,J),Q=$.slice(J);if(!Y)return"";let G=Y.length,q=0;for(let U=0;U<Y.length;U++){let W=Y[U];if(W==="["||W==="(")q++;else if(W==="]"||W===")")q--;else if(X===0&&q===0&&W===":"){G=U;break}}return`${Y.slice(0,G)}.${Z}${Y.slice(G)}${Q}`}var d3=String.raw`(?<![\w-])scoped(?![\w-])`,CY=new RegExp(`<style\\s+[^>]*${d3}`,"i");function M2($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(X)=>{let J=X.trim();if(Z.has(J))return"";return Z.add(J),X})}function K$($,Z){if(!CY.test($))return{html:$,hasScoped:!1};let X=R2(Z),J=`data-v-${X}`,Y=$,Q=new RegExp(`<style\\s+([^>]*${d3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Y=Y.replace(Q,(q,U,W)=>{G=!0;let K=PY(W,J),z=U.replace(new RegExp(d3,"gi"),"").trim(),H=z?` ${z}`:"";return`<style data-stx-scoped="${X}"${H}>${K}</style>`}),!G)return{html:$,hasScoped:!1};return Y=fY(Y,J),{html:Y,hasScoped:!0}}function PY($,Z){return D2($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}var vY=($)=>`\x00stx-scope-mask-${$}\x00`,A2=/\u0000stx-scope-mask-(\d+)\u0000/g;function fY($,Z){let X=c0($,(Y,Q)=>{let G=Y1(Y,Q);return G>Q?G:S1(Y,Q)},(Y,Q)=>vY(Q)),J=xY(X.output,Z);return A2.lastIndex=0,J.replace(A2,(Y,Q)=>X.tokens[Number(Q)])}function xY($,Z){let X=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Y,Q)=>{if(X.has(Y.toLowerCase()))return J;if(J.includes(Z))return J;if(Y.toLowerCase()==="style"||Y.toLowerCase()==="script")return J;if(Q)return J.replace(`<${Y}${Q}`,`<${Y} ${Z}${Q}`);if(J.endsWith("/>"))return`<${Y} ${Z} />`;return`<${Y} ${Z}>`})}var XH="data-stx-color-mode-boot",JH="__STX_COLOR_MODE__",gY=new Set(["light","dark","auto","system"]),hY=new Set(["auto","system"]),uY=/^[a-z][\w:-]*$/i,dY=/^[\w-]+$/;function mY($){let Z=$.storageKey??"stx-color-mode",X=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!gY.has(X))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(X)}`);if(J!==null&&(typeof J!=="string"||!dY.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(Y!==null&&(typeof Y!=="string"||!uY.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!hY.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(J===null&&Y===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:X==="system"?"auto":X,darkClass:J,attribute:Y,autoValue:Q}}function lY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l3($={}){let Z=mY($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${lY(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function T2($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let X=m3($);if(X===null)return $;let J=l3(Z);return`${$.slice(0,X)}
|
|
3410
3410
|
${J}${$.slice(X)}`}function m3($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let X=Z.index+Z[0].length,J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(X));if(J)X+=J[0].length;return X}var cY=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),pY=/<meta\b[^>]*\bcharset\b[^>]*>/i;function iY($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let X=Z.index+Z[0].length,J=$.toLowerCase().indexOf("</head>",X),Y=$.slice(X,J===-1?$.length:J),Q=pY.exec(Y);if(!Q||Y.slice(0,Q.index).trim()==="")return $;let G=Y.slice(0,Q.index)+Y.slice(Q.index+Q[0].length);return $.slice(0,X)+`
|
|
3411
3411
|
${Q[0]}`+G+$.slice(X+Y.length)}function I2($){return nY(iY($))}function nY($){let Z=cY.exec($);if(!Z)return $;let X=m3($);if(X===null)return $;if(Z.index<=X||$.slice(X,Z.index).trim()==="")return $;let J=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),Y=m3(J);if(Y===null)return $;return`${J.slice(0,Y)}
|
|
3412
|
-
${Z[0]}${J.slice(Y)}`}var
|
|
3412
|
+
${Z[0]}${J.slice(Y)}`}var QH="stx-build",GH="X-STX-Build",z$=null;function sY(){if(z$===null)z$=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return z$}function qH($){z$=$}function k2($,Z=sY()){if($.includes('name="stx-build"'))return $;let X=/<head\b[^>]*>/i.exec($);if(!X)return $;let J=X.index+X[0].length;return`${$.slice(0,J)}
|
|
3413
3413
|
<meta name="stx-build" content="${Z}">${$.slice(J)}`}var E2="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",H$="data-stx-html-attrs",B$="data-stx-html-class",b2=/^[A-Za-z_:][\w:.-]*$/;function $1($){return String($).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function oY($){return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function i1($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function p1($,Z){return Object.entries($).filter(([X])=>!Z?.(X)).map(([X,J])=>`${X}="${$1(String(J))}"`).join(" ")}function rY($={},Z="en"){let X=[],J=[],Y="",Q=Z;for(let[q,U]of Object.entries($||{})){if(U==null)continue;let W=q.trim();if(!b2.test(W))continue;let K=W.toLowerCase();if(K==="lang"){Q=String(U);continue}if(K==="class"){Y=String(U).trim();continue}X.push(` ${W}="${$1(String(U))}"`),J.push(W)}let G=` lang="${$1(Q)}"`;if(Y)G+=` class="${$1(Y)}"`;if(G+=X.join(""),Y)G+=` ${B$}="${$1(Y)}"`;if(J.length)G+=` ${H$}="${$1(J.join(" "))}"`;return G}function y2($={},Z={}){let X={...$,...Z};if($.class&&Z.class){let J=$.class.split(/\s+/).filter(Boolean);for(let Y of Z.class.split(/\s+/).filter(Boolean))if(!J.includes(Y))J.push(Y);X.class=J.join(" ")}return X}function S2($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let X=$.match(/<html\b([^>]*)>/i);if(!X)return $;let J={},Y=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(X[1]))!==null){let K=G[1];if(!(K in J))Y.push(K);J[K]=G[2]??G[3]??G[4]??""}let q=[],U=[];for(let[K,z]of Object.entries(Z)){if(z==null)continue;let H=K.trim();if(!b2.test(H))continue;let B=H.toLowerCase();if(B==="class"){let j=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),q.push(_);if(!("class"in J))Y.push("class");J.class=j.join(" ");continue}if(!(H in J))Y.push(H);if(J[H]=String(z),B!=="lang")U.push(H)}if(q.length){if(!(B$ in J))Y.push(B$);J[B$]=q.join(" ")}if(U.length){if(!(H$ in J))Y.push(H$);J[H$]=U.join(" ")}let W=Y.map((K)=>` ${K}="${$1(J[K])}"`).join("");return $.replace(X[0],()=>`<html${W}>`)}function C2($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${E2}
|
|
3414
3414
|
${$.slice(Z)}`}function aY($){let Z=[],X=0;while(X<$.length){let Q=$.slice(X),G=Q.match(/^\s+/);if(G){X+=G[0].length;continue}if(Q.startsWith("<!--")){let z=$.indexOf("-->",X);if(z===-1)break;X=z+3;continue}let q=Q.match(/^<script\b[^>]*>/i);if(q){let z=$.toLowerCase().indexOf("</script>",X+q[0].length);if(z===-1)break;X=z+9;continue}let U=Q.match(/^<link\b[^>]*>/i);if(U){Z.push(U[0]),X+=U[0].length;continue}let W=Q.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),X+=W[0].length;continue}let K=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K){Z.push(K[0]),X+=K[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",Y=0;while(Y<$.length&&Y<X){let Q=$.slice(Y),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Y+=G[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q&&Z.includes(q[0])){Y+=q[0].length;continue}let U=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U&&Z.includes(U[0])){Y+=U[0].length;continue}J+=$[Y],Y++}return J+=$.slice(X),{body:J,hoisted:Z}}function tY($,Z={},X={}){let{title:J="stx App",lang:Y="en",meta:Q=[],link:G=[],script:q=[],headRaw:U="",htmlAttrs:W={},bodyClass:K="",bodyAttrs:z={}}=Z,H=X.title||J,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(Q.map(i1).filter(Boolean)),V=[...B.filter((M)=>!j.has(i1(M))),...Q].map((M)=>{return` <meta ${p1(M)}>`}).join(`
|
|
3415
3415
|
`),O=G.map((M)=>{return` <link ${p1(M)}>`}).join(`
|
|
@@ -3426,7 +3426,7 @@ ${A.join(`
|
|
|
3426
3426
|
</body>
|
|
3427
3427
|
</html>`}function c3($){let Z=0;while(Z<$.length){let X=$.slice(Z),J=X.match(/^\s+/);if(J){Z+=J[0].length;continue}if(X.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let Y=X.match(/^<(script|style)\b[^>]*>/i);if(Y){let Q=`</${Y[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+Y[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(X)||/^<html[\s>]/i.test(X)}return!1}function p3($){return c3($)}function P2($,Z={}){let X=$.lastIndexOf("</head>");if(X===-1)return $;let{meta:J=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,q=$.slice(0,X),U=[];for(let W of J){let K=i1(W);if(K&&q.includes(K))continue;U.push(` <meta ${p1(W)}>`)}for(let W of Y){if(W.href&&q.includes(`href="${W.href}"`))continue;U.push(` <link ${p1(W)}>`)}for(let W of Q)if(W.src){if(q.includes(`src="${W.src}"`))continue;U.push(` <script ${p1(W,(K)=>K==="content")}></script>`)}else if(W.content){if(q.includes(W.content))continue;U.push(` <script>${W.content}</script>`)}if(G&&!q.includes(G))U.push(` ${G}`);if(U.length===0)return $;return`${$.slice(0,X)}${U.join(`
|
|
3428
3428
|
`)}
|
|
3429
|
-
${$.slice(X)}`}function v2($,Z={},X={}){if(p3($))return $;return tY($,Z,X)}var eY=/<\/(script)/gi;function n1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(eY,"<\\/$1")}U5();U5();function x2($,Z={}){return new f2($,Z).routes}function
|
|
3429
|
+
${$.slice(X)}`}function v2($,Z={},X={}){if(p3($))return $;return tY($,Z,X)}var eY=/<\/(script)/gi;function n1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(eY,"<\\/$1")}U5();U5();function x2($,Z={}){return new f2($,Z).routes}function VH($,Z){let X=i3($,Z);return X?X.params:null}var g2=new Map;async function h2($){let Z=$;if(!Z)try{Z=(await K3())?.pagesDir||"pages"}catch{Z="pages"}let X=Z,J=g2.get(X);if(J)return J;let Y=[];try{Y=x2(".",{pagesDir:X}).map((Q)=>Q.regex.source).filter(Boolean)}catch{Y=[]}return g2.set(X,Y),Y}function $Q($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function u2($){return $Q(JSON.stringify($))}function n3(){return`
|
|
3430
3430
|
(function(){
|
|
3431
3431
|
var tip=null,hideTimer=null,currentEl=null;
|
|
3432
3432
|
|
|
@@ -3534,14 +3534,14 @@ document.addEventListener("focusout",function(e){
|
|
|
3534
3534
|
${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3535
3535
|
`+$.slice(G)}if(q5($))return g5($,(G)=>`${G}
|
|
3536
3536
|
${Z}`);return`${Z}
|
|
3537
|
-
${$}`}async function j$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return s3($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return s3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-
|
|
3537
|
+
${$}`}async function j$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return s3($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return s3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-kregsntr.js"),J=await X(Z.debug);return s3($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function ZQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function l2($){if($.includes("data-stx-tooltip-runtime")||!ZQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${n3()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
|
|
3538
3538
|
${Z}`;return`${$.slice(0,X)}${Z}
|
|
3539
3539
|
${$.slice(X)}`}async function XQ($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let X=Z?.router,J="";{let q={};if(X){if(X.container)q.container=X.container;if(X.interceptAllLinks!==void 0)q.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)q.progress=X.progress;if(X.viewTransitions!==void 0)q.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)q.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)q.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)q.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)q.prefetch=X.prefetch;if(X.cache!==void 0)q.cache=X.cache;if(X.progressColor!==void 0)q.progressColor=X.progressColor;if(X.progressHeight!==void 0)q.progressHeight=X.progressHeight}try{let U=await h2(Z?.pagesDir);if(U.length>0)q.ownedRoutes=U}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${u2(q)};</script>
|
|
3540
|
-
`}let{getCachedRouterScript:Y}=await import("./chunk-
|
|
3540
|
+
`}let{getCachedRouterScript:Y}=await import("./chunk-kregsntr.js"),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
|
|
3541
3541
|
</body>`+$.slice(G+7)}var c2=Symbol.for("stx.lazy-module-promises");function JQ(){let $=globalThis;return $[c2]??=new Map,$[c2]}function a($,Z){let X=JQ(),J=`${import.meta.url}\x00${$}`,Y=X.get(J);if(Y)return Y;let Q=Z();return X.set(J,Q),Q.catch(()=>{if(X.get(J)===Q)X.delete(J)}),Q}var YQ=0,r3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,r2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function QQ($,Z={}){let X=[];for(let J of f5($,Y1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,U=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,U),start:J.start,end:J.end})}return X}function a2($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:q}=p2(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:q}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:q}=p2(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function p2($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function t3($){return o2($)}function GQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,J;while((J=Z.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))X++;else if(Y==="endif")X--;else if(X===0)return!0}return!1}function qQ($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=X.exec($))!==null){let Q=Y[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function UQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${r3})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=f5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of J){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),U=a2(q?.[1]??q?.[2]??""),W=[U.itemVar,U.indexVar].filter(Boolean);if(W.length===0)continue;let K=G[1],H=/\/\s*>$/.test(Q.token)||O$.has(K.toLowerCase())?Q.end:e2($,Q.start,K,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(W)})}return Y}var i2=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function WQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function n2($,Z,X,J){if(!$)return!1;let Y=WQ($),Q=!1,G=!1,q=!1,U=/([a-zA-Z_$][\w$]*)/g,W;while((W=U.exec(Y))!==null){let B=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(i2.has(B))continue;if(Z.has(B)||J?.has(B))Q=!0;else if(X&&B in X)G=!0}let K=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=K.exec(Y))!==null){let B=z[1];if(Y.slice(0,z.index).trimEnd().endsWith("."))continue;if(i2.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function _$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(r2);if(Q&&KQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${J}>${U}</${G}>`}return`<template${J}>${Y}</template>`}function KQ($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=X.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function t2($,Z){let X=qQ($);function J(Y){let Q=Y,G=UQ(Y),q=(z)=>{let H=new Set;for(let B of G)if(z>B.start&&z<B.end)for(let j of B.vars)H.add(j);return H},U=/@if\s*\(/g,W,K=[];while((W=U.exec(Q))!==null){let z=W.index,H=z+W[0].length,B=1,j=H;while(j<Q.length&&B>0){if(Q[j]==="(")B++;else if(Q[j]===")")B--;j++}if(B!==0)continue;let _=Q.substring(H,j-1).trim(),V=j,O=1,F=V,L=/@(if\s*\(|endif)/g;L.lastIndex=V;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){F=w.index+w[0].length;break}}if(O!==0)continue;let R=Q.substring(V,F-6).trim(),D;if(GQ(R)){let N=_5(Q.substring(z,F));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),A=q(z);if(!(T.length>0&&T.every((I)=>n2(I.condition,X,Z,A))))continue;D=N[0].branches.map((I)=>{let y=J(I.content);if(I.type==="elseif")return _$(y,"@else-if",I.condition??"");if(I.type==="else")return _$(y,"@else");return _$(y,"@if",I.condition??"")}).join(`
|
|
3542
3542
|
`)}else{if(!n2(_,X,Z,q(z)))continue;D=_$(J(R),"@if",_)}K.push({start:z,end:F,replacement:D}),U.lastIndex=F}for(let z=K.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=K[z];Q=Q.substring(0,H)+j+Q.substring(B)}return Q}return J($)}function zQ($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}var O$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function e2($,Z,X,J){if(O$.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,U=J;while(U<G){let W=$.indexOf("<",U);if(W===-1)return-1;if(U=W,$.startsWith("<!--",U)){let B=$.indexOf("-->",U+4);if(B===-1)return-1;U=B+3;continue}let K=/^<(script|style)\b/i.exec($.slice(U,U+8));if(K){let B=$.indexOf(">",U);if(B===-1)return-1;if($[B-1]==="/"){U=B+1;continue}let j=Q.indexOf(`</${K[1].toLowerCase()}`,U);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;U=_+1;continue}if($[U+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(U,U+64));if(!B){U++;continue}if(B[1].toLowerCase()===Y){if(q--,U+=B[0].length,q===0)return U;continue}U+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(U,U+64));if(!z){U++;continue}let H=$.indexOf(">",U);if(H===-1)return-1;if(z[1].toLowerCase()===Y){let B=$.slice(U,H+1);if(!(/\/\s*>$/.test(B)||O$.has(Y)))q++}U=H+1}return-1}var HQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function BQ($,Z){let X=Z,J=$.length;for(;;){while(X<J&&$[X]!=="<")X++;if(X>=J)return!1;if($.startsWith("<!--",X)){let G=$.indexOf("-->",X+4);if(G===-1)return!1;X=G+3;continue}break}if($[X+1]==="/")return!1;let Y=$.indexOf(">",X);if(Y===-1)return!1;let Q=$.slice(X,Y+1);return HQ.test(Q)}function $9($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=X.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Y=(z)=>Z.some(([H,B])=>z>=H&&z<B),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],q;while((q=Q.exec($))!==null){if(Y(q.index))continue;let[z,H,B,j,_,V,O]=q,F=zQ(_);if(F===void 0)continue;let L=q.index,w=L+z.length,N=!!O||/\/\s*>$/.test(z)||O$.has(H.toLowerCase())?w:e2($,L,H,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&BQ($,N)){Q.lastIndex=w;continue}if(F===!0){let A=`<${H}${B}${V}${O}>`;G.push({start:L,end:w,replacement:A});continue}G.push({start:L,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((z,H)=>z.start-H.start);let U=[],W=-1;for(let z of G){if(z.start<W)continue;U.push(z),W=z.end}let K=$;for(let z=U.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=U[z];K=K.substring(0,H)+j+K.substring(B)}return K}function Z9($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let q=Y[1],U=Y.index,W=U+Y[0].length,K=1,z=W;while(z<X.length&&K>0){if(X[z]==="(")K++;else if(X[z]===")")K--;z++}if(K!==0)continue;let H=X.substring(W,z-1).trim(),B=z,j=a2(H),_=q==="for"?"@endfor":"@endforeach",V=1,O=B,F=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");F.lastIndex=B;let L;while((L=F.exec(X))!==null)if(L[1].startsWith(q))V++;else if(V--,V===0){O=L.index+L[0].length;break}if(V!==0)continue;let w=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)G.push({start:U,end:O,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){w();continue}let A=T.split(/[.[(]/)[0].trim(),M=Z?A in Z:!1,k=G.some((I)=>U>I.start&&U<I.end&&I.vars.includes(A));if(A&&(M||k)){w();continue}}if(j.style==="as")H=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let R=X.substring(B,O-_.length).trim(),D=R.match(r2),N;if(D){let[,T,A,M]=D;N=`<${T}${A} @for="${H}">${M}</${T}>`}else N=`<template @for="${H}">${R}</template>`;Q.push({start:U,end:O,replacement:N})}for(let q=Q.length-1;q>=0;q--){let{start:U,end:W,replacement:K}=Q[q];X=X.substring(0,U)+K+X.substring(W)}return X}function jQ($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(K)=>{let z=J+1;while(z<Q){let H=$[z];if(H==="\\"){z+=2;continue}if(H===K)return z+1;z++}return Q},q=()=>{let K=J+2;while(K<Q&&$[K]!==`
|
|
3543
3543
|
`)K++;return K},U=()=>{let K=J+2;while(K<Q-1){if($[K]==="*"&&$[K+1]==="/")return K+2;K++}return Q},W=(K)=>{let z=K,H=0;while(z<Q){let B=$[z];if(B==="/"&&$[z+1]==="/"){let j=z+2;while(j<Q&&$[j]!==`
|
|
3544
|
-
`)j++;z=j;continue}if(B==="/"&&$[z+1]==="*"){let j=z+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){H++,z++;continue}if(B===")"||B==="]"||B==="}"){H--,z++;continue}if(B===";"&&H===0)return z+1;z++}return Q};while(J<Q){let K=$[J];if(K==="/"&&$[J+1]==="/"){let z=q();X.push($.slice(J,z)),J=z;continue}if(K==="/"&&$[J+1]==="*"){let z=U();X.push($.slice(J,z)),J=z;continue}if(K==='"'||K==="'"||K==="`"){let z=G(K);X.push($.slice(J,z)),J=z;continue}if(K==="{"){Y++,X.push(K),J++;continue}if(K==="}"){Y--,X.push(K),J++;continue}if(Y===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(K),J++}return X.join("")}async function _Q($,Z,X){let J=QQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let V of J){let O=V.body;if(N1(V.attrs))O=A1(O);if(Y.test(O))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${YQ++}`,{hasUserImports:q,bundleClientScript:U}=await a("stx/client-script-bundler",()=>import("./chunk-
|
|
3544
|
+
`)j++;z=j;continue}if(B==="/"&&$[z+1]==="*"){let j=z+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){H++,z++;continue}if(B===")"||B==="]"||B==="}"){H--,z++;continue}if(B===";"&&H===0)return z+1;z++}return Q};while(J<Q){let K=$[J];if(K==="/"&&$[J+1]==="/"){let z=q();X.push($.slice(J,z)),J=z;continue}if(K==="/"&&$[J+1]==="*"){let z=U();X.push($.slice(J,z)),J=z;continue}if(K==='"'||K==="'"||K==="`"){let z=G(K);X.push($.slice(J,z)),J=z;continue}if(K==="{"){Y++,X.push(K),J++;continue}if(K==="}"){Y--,X.push(K),J++;continue}if(Y===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(K),J++}return X.join("")}async function _Q($,Z,X){let J=QQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let V of J){let O=V.body;if(N1(V.attrs))O=A1(O);if(Y.test(O))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${YQ++}`,{hasUserImports:q,bundleClientScript:U}=await a("stx/client-script-bundler",()=>import("./chunk-2kjp90p2.js")),W=[];for(let V=0;V<Q.length;V++){let O=Q[V].content;if(O=R5(O).code,q(O))O=await U(O,Z||"",{projectRoot:process.cwd()});O=O.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L,w)=>VQ(w));let F=r0(O);W.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
|
|
3545
3545
|
${F}`)}let K=W.join(`
|
|
3546
3546
|
|
|
3547
3547
|
`);K=jQ(K);let z=OQ(K),H=z.split(",").map((V)=>V.trim()).filter(Boolean),B=a3(K,X),j=`
|
|
@@ -3597,13 +3597,13 @@ ${I}
|
|
|
3597
3597
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
3598
3598
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
3599
3599
|
</style>`}};import{existsSync as AQ,readFileSync as MQ}from"fs";var k1=new Map,H9=new Set;function B9($){if(H9.has($))return;H9.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function j9($){let Z=process.cwd();for(let X of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(AQ(X))return X;for(let X of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return h.resolve(X)}catch{}return null}function TQ($){if(k1.has($))return k1.get($);let Z=j9($);if(!Z)return B9($),null;try{let X=JSON.parse(MQ(Z,"utf8"));return k1.set($,X.icons),X.icons}catch{return null}}async function IQ($,Z=!1){if(k1.has($))return k1.get($);let X=j9($);if(!X){if(!Z)B9($);return null}try{let J=await Bun.file(X).json();return k1.set($,J.icons),J.icons}catch{return null}}function t1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var H4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,X){let J=t1($,"name")??t1($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=J;if(J.includes(":")){let F=J.split(":");Y=F[0],Q=F[1]}let G=j0(t1($,"size")||"24"),q=j0(t1($,"color")||"currentColor"),U=j0(t1($,"class")||""),W=j0(t1($,"style")||""),K=k1.get(Y)??TQ(Y);if(!K)return`<!-- Icon: collection "${Y}" not loaded -->`;let z=K[Q];if(!z)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let H=z.width||24,B=z.height||24,j=`0 0 ${H} ${B}`,_=z.body;if(q!=="currentColor")_=_.replace(/currentColor/g,q);let V=U?` class="${U}"`:"",O=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${V}${O}>${_}</svg>`}};async function kQ($="lucide",Z={}){await IQ($,Z.speculative??!0)}function _9($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}function O9($,Z){let X=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(X);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var B4={name:"Suspense",aliases:["suspense"],render($,Z,X){let J=O9(Z,"fallback"),Y=J.rest,Q=O9(Y,"error"),G=Q.rest,q=J.region??_9($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',U=Q.region??_9($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${q}</div><div data-stx-suspense-error hidden>${U}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function L$($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}var j4={name:"TransitionGroup",aliases:["transition-group"],render($,Z,X){let J=(L$($,"name")||"v").replace(/["'<>]/g,""),Y=(L$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=L$($,"class"),G=L$($,"id"),q=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${q}>${Z}</${Y}>`}};function V9(){E0.registerBuiltin(Z4),E0.registerBuiltin(Q4),E0.registerBuiltin(G4),E0.registerBuiltin(U4),E0.registerBuiltin(W4),E0.registerBuiltin(K4),E0.registerBuiltin(z4),E0.registerBuiltin(H4),E0.registerBuiltin(B4),E0.registerBuiltin(j4)}function w$($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function F9($,Z,X){let J=[],Y=0;while(Y<$.length){let Q=$.indexOf("<",Y);if(Q===-1)break;let q=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!q){Y=Q+1;continue}let U=q[1];if(X&&X.has(U.toLowerCase())){let _=Q+1+U.length;while(_<$.length&&$[_]!==">")_++;Y=_+1;continue}let W=Q+1+U.length,K=null,z=W,H=-1,B=!1;while(W<$.length){let _=$[W];if(K){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===K)K=null;W++;continue}if(_==='"'||_==="'"){K=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){H=W+2,B=!0;break}if(_===">"){H=W+1;break}W++}if(H===-1){Y=Q+1;continue}let j=$.slice(z,B?H-2:H-1).trim();if(B)J.push({fullMatch:$.slice(Q,H),tagName:U,attributes:j,content:"",startIndex:Q,endIndex:H,isSelfClosing:!0}),Y=H;else{let _=`<${U}`,V=`</${U}>`,O=1,F=H,L=-1;while(O>0&&F<$.length){let D=$.indexOf(_,F),N=$.indexOf(V,F);if(N===-1)break;if(D!==-1&&D<N){let T=$[D+_.length];if(T===" "||T===">"||T==="/"||T===`
|
|
3600
|
-
`||T==="\t")O++;F=D+_.length}else{if(O--,O===0){L=N;break}F=N+V.length}}if(L===-1){Y=H;continue}let w=$.slice(H,L),R=L+V.length;J.push({fullMatch:$.slice(Q,R),tagName:U,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),Y=R}}return J}function L9($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function w9($,Z){try{let X=Buffer.from($,"base64").toString("utf8");return JSON.parse(X)}catch{}try{let X=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(X)}catch(X){if(Z?.debug)console.error("Error decoding __stx_ prop:",X);return $}}import D$ from"fs";import C0 from"path";var R9=!1,EQ=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function bQ($,Z,X){let J={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),Q=(W)=>{if(Y.size===0)return!1;let K=i0(W),z=K.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(z&&Y.has(z))return!0;for(let H of Y){let B=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(K))return!0}return!1},G=new Set(M9),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(K,z)=>z.toUpperCase())},U=(W,K)=>{let z=q(W);if(J.static[z]=K,z!==W)J.staticNames[z]=W};for(let[W,K]of Object.entries($)){let z=W.startsWith("x-")&&!G.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(z.startsWith("@")){J.events[z]=K;continue}if(z.startsWith("__stx_")){let H=q(z.slice(6));J.serverDynamic[H]=w9(K,X);continue}if(z.startsWith(":")){let H=q(z.slice(1)),B=K===I1?H:K;if(H==="if"||H==="for"||H==="show"){J.clientReactive[H]=B;continue}if(Q(B)){J.clientReactive[H]=B;continue}try{if(!Q0(B)){if(X.debug)console.error(`Unsafe expression in :${H} binding: ${B}`);J.clientReactive[H]=B;continue}let j=Object.keys(Z),V=G0(B,j)(...Object.values(Z));if(V===void 0){let O=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],F=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(O.some((w)=>!F.has(w)&&!j.includes(w))){J.clientReactive[H]=B;continue}}if(J.serverDynamic[H]=V,H!==z.slice(1)&&J.serverDynamicNames)J.serverDynamicNames[H]=z.slice(1)}catch{J.clientReactive[H]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let H=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(H)try{let B=H[1];if(Q0(B)){let _=G0(B,Object.keys(Z))(...Object.values(Z));U(z,_!=null?String(_):"")}else{if(X.debug)console.error(`Unsafe expression in ${z}: ${B}`);U(z,K)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${z}:`,B);U(z,K)}else{let B=K,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(K))!==null)try{let V=_[1];if(!Q0(V)){if(X.debug)console.error(`Unsafe expression in ${z}: ${V}`);continue}let F=G0(V,Object.keys(Z))(...Object.values(Z));B=B.replace(_[0],String(F??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${z}:`,V)}U(z,B)}continue}U(z,K===I1?"true":L9(K))}return J}var yQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function SQ($,Z,X){if(!$.includes("@"))return $;if(!yQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return t0($,Z,X)}catch{return $}}function CQ($){let Z={},X=0,J=$.length;while(X<J){while(X<J&&/\s/.test($[X]))X++;if(X>=J)break;let Y="";while(X<J&&!/[\s=]/.test($[X]))Y+=$[X],X++;if(!Y)break;while(X<J&&/\s/.test($[X]))X++;if(X<J&&$[X]==="="){X++;while(X<J&&/\s/.test($[X]))X++;let Q="";if(X<J&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<J){let q=$[X];if(q==="\\"&&X+1<J){X++,Q+=$[X],X++;continue}if(q===G){X++;break}Q+=q,X++}}else while(X<J&&!/\s/.test($[X]))Q+=$[X],X++;Z[Y]=Q}else Z[Y]=I1}return Z}function D9($){return Object.entries($).map(([Z,X])=>X===I1?Z:`${Z}="${PQ(X)}"`).join(" ")}function PQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function vQ($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=X.exec($))!==null){let Y=J[1];if(E0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var N9=new Map;function fQ($){let Z=N9.get($);if(Z)return Z;let X=new Map,J=[C0.join($,"src"),C0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let q;try{q=D$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let U of q){let W=C0.join(Q,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;Y(W,G+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let K=U.name.slice(0,-4);if(!X.has(K))X.set(K,W);let z=K.toLowerCase();if(!X.has(z))X.set(z,W);let H=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,W)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return N9.set($,X),X}function xQ($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=C0.join(X,"node_modules",$);try{if(D$.statSync(J).isDirectory())return J}catch{}let Y=C0.dirname(X);if(Y===X)return null;X=Y}}async function gQ($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=C0.dirname(X),q=$,U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(U,(W,K,z)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=H.exec(z))!==null){let[V,O,F,L]=j,w=null,R=null;if(L.startsWith(".")||L.startsWith("/")){let T=C0.resolve(G,L);if(T.endsWith(".stx"))R=T;else{let A=`${T}.stx`;try{if(D$.statSync(A).isFile())R=A}catch{try{if(D$.statSync(T).isDirectory())w=T}catch{}}}}else w=xQ(L,G);if(!w&&!R)continue;let D=!1,N=(T,A)=>{Q.set(T,A),Q.set(T.toLowerCase(),A);let M=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,A),Y.add(A)};if(F&&R)N(F,R),D=!0;else if(O){let T=O.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let k=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:M,local:M}}),A=w?fQ(w):null;for(let{source:M,local:k}of T){let I=null;if(R)I=R;else if(A)I=A.get(M)??A.get(M.toLowerCase())??A.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(k,I),D=!0}}if(D)_.push({start:j.index,end:j.index+V.length})}if(_.length===0)return W;for(let V=_.length-1;V>=0;V--)B=B.slice(0,_[V].start)+B.slice(_[V].end);return`<script${K}>${B}</script>`}),q}async function hQ($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,U;while((U=q.exec(Q))!==null){let[W,K]=U,z=K.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of z){let B=H.split("/"),_=B[B.length-1].replace(/\.stx$/,""),V=_.includes("-")?_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),O=null,F=[C0.resolve(C0.dirname(X),`${H}.stx`),C0.resolve(C0.dirname(X),H),C0.resolve(J.componentsDir||"components",`${H}.stx`),C0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(V,O),G.set(_,O),G.set(_.toLowerCase(),O);let L=V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Y.add(O),J.debug)console.log(`Imported component: ${V} -> ${O}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(W,""),q.lastIndex=0}return Q}async function uQ($,Z,X,J,Y){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=/@component\s*\(/g,W;while((W=U.exec(Q))!==null){let K=W.index,z=K+W[0].length-1,H=1,B=z+1;while(B<Q.length&&H>0){if(Q[B]==="(")H++;else if(Q[B]===")"){if(H--,H===0)break}B++}if(H!==0)break;let j=Q.substring(z+1,B),_=B+1,V=j.match(/^\s*['"]([^'"]+)['"]/);if(!V){U.lastIndex=0;continue}let O=V[1],F,L=j.slice(V[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let R={};if(F)try{R=_0(F,Z)}catch(k){let I=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(K,_),`[Error parsing component props: ${I}]`);continue}let D="",N=_,A=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(A)D=A[1].trim(),N=_+A[0].length;let M=await T1(O,R,D,G,Z,X,J,q,Y);Q=Q.substring(0,K)+M+Q.substring(N),U.lastIndex=0}return Q}async function dQ($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=p0(Q);return Q=U.output,Q=await H(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await H(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await H(Q,/[a-z][a-z0-9]*/,!1,EQ),Q=C1(Q,U.scripts),Q;async function H(B,j,_,V){if(!B)return B;let O=B,F=F9(O,j,V);for(let L=F.length-1;L>=0;L--){let w=F[L],R=_?w$(w.tagName):w.tagName,D=CQ(SQ(w.attributes,Z,X)),N=bQ(D,Z,J),T=E0.getBuiltin(w.tagName),A=T?await R$(R,G,Z,X,J):!1;if(T&&!A){let y={context:Z,filePath:X,options:J,dependencies:Y},E=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)E=A9(E,N.clientReactive);if(Object.keys(N.events).length>0){let b=D9(N.events);E=E.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,w.startIndex)+E+O.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await R$(R,G,Z,X,J))continue;let M={};for(let[y,E]of Object.entries(N.static))M[y]=E;for(let[y,E]of Object.entries(N.serverDynamic))M[y]=E;let I=await T1(R,M,C1(w.content,U.scripts),G,Z,X,J,q,Y);if(Object.keys(N.clientReactive).length>0)I=A9(I,N.clientReactive);if(Object.keys(N.events).length>0){let y=T9(I);if(y){let E=D9(N.events),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${E}`+I.substring(y.insertPos)}}O=O.substring(0,w.startIndex)+I+O.substring(w.endIndex)}return O}}function A9($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([K])=>!X.has(K)),Q=Y.filter(([K])=>!J.has(K)).map(([K])=>w$(K)).join(" "),G=$,q=Y.length>0?T9(G):null;if(q){let K=Y.map(([H,B])=>`:${w$(H)}="${B.replace(/"/g,""")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${z} ${K}`+G.substring(q.insertPos)}let U=Z.if;if(U)G=`<template :if="${U.replace(/"/g,""")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,""")}">${G}</template>`;return G}function T9($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let X=0;while(X<$.length){let J=$.slice(X),Y=J.match(/^\s+/);if(Y){X+=Y[0].length;continue}if(J.startsWith("<!--")){let q=$.indexOf("-->",X+4);if(q===-1)return null;X=q+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let q=`</${Q[1].toLowerCase()}>`,U=$.toLowerCase().indexOf(q,X+Q[0].length);if(U===-1)return null;X=U+q.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function _4($,Z,X,J,Y){if(!R9)V9(),R9=!0;let Q=await gQ($,Z,X,J,Y);Q=await hQ(Q,Z,X,J,Y),Q=await uQ(Q,Z,X,J,Y);let G=[];for(let q=0;q<3;q++){let U=c0(Q,Q5,(K,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...U.tokens);let W=Q;if(Q=await dQ(U.output,Z,X,J,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,U)=>G[Number(U)]??"");if(J.debug){let q=vQ(Q);if(q.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import $5 from"path";import I9 from"process";function e1($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(I9.env)){if(!J.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Y),X[J]=Y}return Z["import.meta.env"]=JSON.stringify(X),Z}function Jj($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(I9.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function k9($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function E9($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=$5.join(Y,$);if(await Bun.file(G).exists())return G;Y=$5.dirname(Y)}J=$5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=$5.resolve(Z,$);else J=$5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function b9($,Z,X){let J=$,Y=$5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[W,K,z,H]=G;if(k9(z))continue;let B=await E9(z,Y,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let V=await Bun.build({entrypoints:[B],target:"browser",minify:!0,define:e1()});if(V.outputs.length>0)j=await V.outputs[0].text()}let _=`<script>
|
|
3600
|
+
`||T==="\t")O++;F=D+_.length}else{if(O--,O===0){L=N;break}F=N+V.length}}if(L===-1){Y=H;continue}let w=$.slice(H,L),R=L+V.length;J.push({fullMatch:$.slice(Q,R),tagName:U,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),Y=R}}return J}function L9($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function w9($,Z){try{let X=Buffer.from($,"base64").toString("utf8");return JSON.parse(X)}catch{}try{let X=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(X)}catch(X){if(Z?.debug)console.error("Error decoding __stx_ prop:",X);return $}}import D$ from"fs";import C0 from"path";var R9=!1,EQ=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function bQ($,Z,X){let J={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),Q=(W)=>{if(Y.size===0)return!1;let K=i0(W),z=K.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(z&&Y.has(z))return!0;for(let H of Y){let B=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(K))return!0}return!1},G=new Set(M9),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(K,z)=>z.toUpperCase())},U=(W,K)=>{let z=q(W);if(J.static[z]=K,z!==W)J.staticNames[z]=W};for(let[W,K]of Object.entries($)){let z=W.startsWith("x-")&&!G.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(z.startsWith("@")){J.events[z]=K;continue}if(z.startsWith("__stx_")){let H=q(z.slice(6));J.serverDynamic[H]=w9(K,X);continue}if(z.startsWith(":")){let H=q(z.slice(1)),B=K===I1?H:K;if(H==="if"||H==="for"||H==="show"){J.clientReactive[H]=B;continue}if(Q(B)){J.clientReactive[H]=B;continue}try{if(!Q0(B)){if(X.debug)console.error(`Unsafe expression in :${H} binding: ${B}`);J.clientReactive[H]=B;continue}let j=Object.keys(Z),V=G0(B,j)(...Object.values(Z));if(V===void 0){let O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(mQ(B).some((L)=>!O.has(L)&&!j.includes(L))){J.clientReactive[H]=B;continue}}if(J.serverDynamic[H]=V,H!==z.slice(1)&&J.serverDynamicNames)J.serverDynamicNames[H]=z.slice(1)}catch{J.clientReactive[H]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let H=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(H)try{let B=H[1];if(Q0(B)){let _=G0(B,Object.keys(Z))(...Object.values(Z));U(z,_!=null?String(_):"")}else{if(X.debug)console.error(`Unsafe expression in ${z}: ${B}`);U(z,K)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${z}:`,B);U(z,K)}else{let B=K,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(K))!==null)try{let V=_[1];if(!Q0(V)){if(X.debug)console.error(`Unsafe expression in ${z}: ${V}`);continue}let F=G0(V,Object.keys(Z))(...Object.values(Z));B=B.replace(_[0],String(F??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${z}:`,V)}U(z,B)}continue}U(z,K===I1?"true":L9(K))}return J}var yQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function SQ($,Z,X){if(!$.includes("@"))return $;if(!yQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return t0($,Z,X)}catch{return $}}function CQ($){let Z={},X=0,J=$.length;while(X<J){while(X<J&&/\s/.test($[X]))X++;if(X>=J)break;let Y="";while(X<J&&!/[\s=]/.test($[X]))Y+=$[X],X++;if(!Y)break;while(X<J&&/\s/.test($[X]))X++;if(X<J&&$[X]==="="){X++;while(X<J&&/\s/.test($[X]))X++;let Q="";if(X<J&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<J){let q=$[X];if(q==="\\"&&X+1<J){X++,Q+=$[X],X++;continue}if(q===G){X++;break}Q+=q,X++}}else while(X<J&&!/\s/.test($[X]))Q+=$[X],X++;Z[Y]=Q}else Z[Y]=I1}return Z}function D9($){return Object.entries($).map(([Z,X])=>X===I1?Z:`${Z}="${PQ(X)}"`).join(" ")}function PQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function vQ($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=X.exec($))!==null){let Y=J[1];if(E0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var N9=new Map;function fQ($){let Z=N9.get($);if(Z)return Z;let X=new Map,J=[C0.join($,"src"),C0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let q;try{q=D$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let U of q){let W=C0.join(Q,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;Y(W,G+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let K=U.name.slice(0,-4);if(!X.has(K))X.set(K,W);let z=K.toLowerCase();if(!X.has(z))X.set(z,W);let H=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,W)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return N9.set($,X),X}function xQ($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=C0.join(X,"node_modules",$);try{if(D$.statSync(J).isDirectory())return J}catch{}let Y=C0.dirname(X);if(Y===X)return null;X=Y}}async function gQ($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=C0.dirname(X),q=$,U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(U,(W,K,z)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=H.exec(z))!==null){let[V,O,F,L]=j,w=null,R=null;if(L.startsWith(".")||L.startsWith("/")){let T=C0.resolve(G,L);if(T.endsWith(".stx"))R=T;else{let A=`${T}.stx`;try{if(D$.statSync(A).isFile())R=A}catch{try{if(D$.statSync(T).isDirectory())w=T}catch{}}}}else w=xQ(L,G);if(!w&&!R)continue;let D=!1,N=(T,A)=>{Q.set(T,A),Q.set(T.toLowerCase(),A);let M=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,A),Y.add(A)};if(F&&R)N(F,R),D=!0;else if(O){let T=O.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let k=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:M,local:M}}),A=w?fQ(w):null;for(let{source:M,local:k}of T){let I=null;if(R)I=R;else if(A)I=A.get(M)??A.get(M.toLowerCase())??A.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(k,I),D=!0}}if(D)_.push({start:j.index,end:j.index+V.length})}if(_.length===0)return W;for(let V=_.length-1;V>=0;V--)B=B.slice(0,_[V].start)+B.slice(_[V].end);return`<script${K}>${B}</script>`}),q}async function hQ($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,U;while((U=q.exec(Q))!==null){let[W,K]=U,z=K.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of z){let B=H.split("/"),_=B[B.length-1].replace(/\.stx$/,""),V=_.includes("-")?_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),O=null,F=[C0.resolve(C0.dirname(X),`${H}.stx`),C0.resolve(C0.dirname(X),H),C0.resolve(J.componentsDir||"components",`${H}.stx`),C0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(V,O),G.set(_,O),G.set(_.toLowerCase(),O);let L=V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Y.add(O),J.debug)console.log(`Imported component: ${V} -> ${O}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(W,""),q.lastIndex=0}return Q}async function uQ($,Z,X,J,Y){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=/@component\s*\(/g,W;while((W=U.exec(Q))!==null){let K=W.index,z=K+W[0].length-1,H=1,B=z+1;while(B<Q.length&&H>0){if(Q[B]==="(")H++;else if(Q[B]===")"){if(H--,H===0)break}B++}if(H!==0)break;let j=Q.substring(z+1,B),_=B+1,V=j.match(/^\s*['"]([^'"]+)['"]/);if(!V){U.lastIndex=0;continue}let O=V[1],F,L=j.slice(V[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let R={};if(F)try{R=_0(F,Z)}catch(k){let I=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(K,_),`[Error parsing component props: ${I}]`);continue}let D="",N=_,A=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(A)D=A[1].trim(),N=_+A[0].length;let M=await T1(O,R,D,G,Z,X,J,q,Y);Q=Q.substring(0,K)+M+Q.substring(N),U.lastIndex=0}return Q}async function dQ($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=p0(Q);return Q=U.output,Q=await H(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await H(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await H(Q,/[a-z][a-z0-9]*/,!1,EQ),Q=C1(Q,U.scripts),Q;async function H(B,j,_,V){if(!B)return B;let O=B,F=F9(O,j,V);for(let L=F.length-1;L>=0;L--){let w=F[L],R=_?w$(w.tagName):w.tagName,D=CQ(SQ(w.attributes,Z,X)),N=bQ(D,Z,J),T=E0.getBuiltin(w.tagName),A=T?await R$(R,G,Z,X,J):!1;if(T&&!A){let y={context:Z,filePath:X,options:J,dependencies:Y},E=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)E=A9(E,N.clientReactive);if(Object.keys(N.events).length>0){let b=D9(N.events);E=E.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,w.startIndex)+E+O.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await R$(R,G,Z,X,J))continue;let M={};for(let[y,E]of Object.entries(N.static))M[y]=E;for(let[y,E]of Object.entries(N.serverDynamic))M[y]=E;let I=await T1(R,M,C1(w.content,U.scripts),G,Z,X,J,q,Y);if(Object.keys(N.clientReactive).length>0)I=A9(I,N.clientReactive);if(Object.keys(N.events).length>0){let y=T9(I);if(y){let E=D9(N.events),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${E}`+I.substring(y.insertPos)}}O=O.substring(0,w.startIndex)+I+O.substring(w.endIndex)}return O}}function mQ($){return $.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}function A9($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([K])=>!X.has(K)),Q=Y.filter(([K])=>!J.has(K)).map(([K])=>w$(K)).join(" "),G=$,q=Y.length>0?T9(G):null;if(q){let K=Y.map(([H,B])=>`:${w$(H)}="${B.replace(/"/g,""")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${z} ${K}`+G.substring(q.insertPos)}let U=Z.if;if(U)G=`<template :if="${U.replace(/"/g,""")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,""")}">${G}</template>`;return G}function T9($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let X=0;while(X<$.length){let J=$.slice(X),Y=J.match(/^\s+/);if(Y){X+=Y[0].length;continue}if(J.startsWith("<!--")){let q=$.indexOf("-->",X+4);if(q===-1)return null;X=q+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let q=`</${Q[1].toLowerCase()}>`,U=$.toLowerCase().indexOf(q,X+Q[0].length);if(U===-1)return null;X=U+q.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function _4($,Z,X,J,Y){if(!R9)V9(),R9=!0;let Q=await gQ($,Z,X,J,Y);Q=await hQ(Q,Z,X,J,Y),Q=await uQ(Q,Z,X,J,Y);let G=[];for(let q=0;q<3;q++){let U=c0(Q,Q5,(K,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...U.tokens);let W=Q;if(Q=await dQ(U.output,Z,X,J,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,U)=>G[Number(U)]??"");if(J.debug){let q=vQ(Q);if(q.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import $5 from"path";import I9 from"process";function e1($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(I9.env)){if(!J.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Y),X[J]=Y}return Z["import.meta.env"]=JSON.stringify(X),Z}function Yj($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(I9.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function k9($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function E9($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=$5.join(Y,$);if(await Bun.file(G).exists())return G;Y=$5.dirname(Y)}J=$5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=$5.resolve(Z,$);else J=$5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function b9($,Z,X){let J=$,Y=$5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[W,K,z,H]=G;if(k9(z))continue;let B=await E9(z,Y,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let V=await Bun.build({entrypoints:[B],target:"browser",minify:!0,define:e1()});if(V.outputs.length>0)j=await V.outputs[0].text()}let _=`<script>
|
|
3601
3601
|
// Source: ${z}
|
|
3602
3602
|
${j}
|
|
3603
3603
|
</script>`;J=J.replace(W,_),Q.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,U;while((U=q.exec(J))!==null){let[W,K,z,H]=U,B=K+H;if(k9(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await E9(z,Y,Z);if(_)try{let V=await Bun.file(_).text();X.add(_);let O=`<style>
|
|
3604
3604
|
/* Source: ${z} */
|
|
3605
3605
|
${V}
|
|
3606
|
-
</style>`;J=J.replace(W,O),q.lastIndex=0}catch(V){}}}return J}function O4($,Z){let X=$,J=/@json\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index,G=Q+Y[0].length-1,q=1,U=G+1,W=null,K=!1;while(U<X.length&&q>0){let L=X[U];if(K){K=!1,U++;continue}if(L==="\\"&&W){K=!0,U++;continue}if(W){if(L===W)W=null;U++;continue}if(L==='"'||L==="'"||L==="`"){W=L,U++;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0)break}U++}if(q!==0)break;let z=X.substring(G+1,U).trim(),H=X.substring(Q,U+1),B=-1,j=0,_=null,V=!1;for(let L=0;L<z.length;L++){let w=z[L];if(V){V=!1;continue}if(w==="\\"&&_){V=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){B=L;break}}let O=B>=0?z.substring(0,B).trim():z,F=B>=0?z.substring(B+1).trim():void 0;try{let L=O.trim(),w;if(Q0(L))w=G0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(F==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let D=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");X=X.substring(0,Q)+D+X.substring(U+1),J.lastIndex=Q+D.length}catch(L){d0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),J.lastIndex=Q+H.length}}return X}function V4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function y9($){let Z=$,X=/@memo\s*\(/g,J,Y=[];while((J=X.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,q=1,U=G;while(U<Z.length&&q>0){if(Z[U]==="(")q++;else if(Z[U]===")")q--;U++}if(q!==0)continue;let W=Z.slice(G,U-1).trim(),K=U,z=Z.slice(K),H=z.indexOf("@endmemo");if(H===-1)continue;let B=z.slice(0,H),j=K+H+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),V=_?_[0].length:0,O=B.slice(V),F=B.match(/(\s*)$/),L=F?F[0].length:0,w=O.slice(0,O.length-L),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[N,T,A="",M]=R,k=`<${T}${A} data-stx-memo="${W}"${M}>`;D=B.slice(0,V)+k+w.slice(N.length)+B.slice(V+w.length)}else D=`${B.slice(0,V)}<div data-stx-memo="${W}">${w}</div>${B.slice(V+w.length)}`;Y.push({start:Q,end:j,replacement:D}),X.lastIndex=j}for(let Q=Y.length-1;Q>=0;Q--){let G=Y[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function F4($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function S9($){let X=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",Y=0,Q;while((Q=X.exec($))!==null){let G=Q.index,q=G+Q[0].length,U=!1,W=!1,K=-1;while(q<$.length){let _=$[q];if(U){if(_==="'")U=!1}else if(W){if(_==='"')W=!1}else if(_==="'")U=!0;else if(_==='"')W=!0;else if(_===">"){K=q;break}q++}if(K===-1)continue;if($.slice(G,K+1).includes("x-cloak"))continue;let H=$.slice(K+1),B=H.indexOf("</"),j=B>=0?H.slice(0,B):H.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Y,K)+" x-cloak>",Y=K+1}return J+=$.slice(Y),J}var
|
|
3606
|
+
</style>`;J=J.replace(W,O),q.lastIndex=0}catch(V){}}}return J}function O4($,Z){let X=$,J=/@json\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index,G=Q+Y[0].length-1,q=1,U=G+1,W=null,K=!1;while(U<X.length&&q>0){let L=X[U];if(K){K=!1,U++;continue}if(L==="\\"&&W){K=!0,U++;continue}if(W){if(L===W)W=null;U++;continue}if(L==='"'||L==="'"||L==="`"){W=L,U++;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0)break}U++}if(q!==0)break;let z=X.substring(G+1,U).trim(),H=X.substring(Q,U+1),B=-1,j=0,_=null,V=!1;for(let L=0;L<z.length;L++){let w=z[L];if(V){V=!1;continue}if(w==="\\"&&_){V=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){B=L;break}}let O=B>=0?z.substring(0,B).trim():z,F=B>=0?z.substring(B+1).trim():void 0;try{let L=O.trim(),w;if(Q0(L))w=G0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(F==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let D=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");X=X.substring(0,Q)+D+X.substring(U+1),J.lastIndex=Q+D.length}catch(L){d0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),J.lastIndex=Q+H.length}}return X}function V4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function y9($){let Z=$,X=/@memo\s*\(/g,J,Y=[];while((J=X.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,q=1,U=G;while(U<Z.length&&q>0){if(Z[U]==="(")q++;else if(Z[U]===")")q--;U++}if(q!==0)continue;let W=Z.slice(G,U-1).trim(),K=U,z=Z.slice(K),H=z.indexOf("@endmemo");if(H===-1)continue;let B=z.slice(0,H),j=K+H+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),V=_?_[0].length:0,O=B.slice(V),F=B.match(/(\s*)$/),L=F?F[0].length:0,w=O.slice(0,O.length-L),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[N,T,A="",M]=R,k=`<${T}${A} data-stx-memo="${W}"${M}>`;D=B.slice(0,V)+k+w.slice(N.length)+B.slice(V+w.length)}else D=`${B.slice(0,V)}<div data-stx-memo="${W}">${w}</div>${B.slice(V+w.length)}`;Y.push({start:Q,end:j,replacement:D}),X.lastIndex=j}for(let Q=Y.length-1;Q>=0;Q--){let G=Y[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function F4($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function S9($){let X=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",Y=0,Q;while((Q=X.exec($))!==null){let G=Q.index,q=G+Q[0].length,U=!1,W=!1,K=-1;while(q<$.length){let _=$[q];if(U){if(_==="'")U=!1}else if(W){if(_==='"')W=!1}else if(_==="'")U=!0;else if(_==='"')W=!0;else if(_===">"){K=q;break}q++}if(K===-1)continue;if($.slice(G,K+1).includes("x-cloak"))continue;let H=$.slice(K+1),B=H.indexOf("</"),j=B>=0?H.slice(0,B):H.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Y,K)+" x-cloak>",Y=K+1}return J+=$.slice(Y),J}var lQ=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/;function C9($){let Z=/<[a-z][\w-]*/gi,X="",J=0,Y;while((Y=Z.exec($))!==null){let Q=Y.index,G=Y[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,_=$.toLowerCase().indexOf(j,Q);if(_!==-1)Z.lastIndex=_+j.length;continue}let q=Q+Y[0].length,U=!1,W=!1,K=-1;while(q<$.length){let j=$[q];if(U){if(j==="'")U=!1}else if(W){if(j==='"')W=!1}else if(j==="'")U=!0;else if(j==='"')W=!0;else if(j===">"){K=q;break}q++}if(K===-1)continue;let z=$.slice(Q+Y[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!lQ.test(z))continue;let H=$[K-1]==="/",B=H?K-1:K;X+=`${$.slice(J,B)} x-cloak${H?" ":""}`,J=B}return X+=$.slice(J),X}var cQ=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}];function L4($,Z,X,J){let Y=typeof X==="boolean"?{enabled:X,failOnViolation:X}:X??{enabled:!1},Q=Y.allowPatterns??[],G=[],q=i0($.replace(/\{\{--[\s\S]*?--\}\}/g,(U)=>U.replace(/[^\n]/g," ")));for(let{pattern:U,message:W,suggestion:K}of cQ){if(Q.some((H)=>/\w/.test(H)&&W.includes(H)))continue;U.lastIndex=0;let z=q.match(U);if(z&&z.length>0){let H=q.split(`
|
|
3607
3607
|
`),B=$.split(`
|
|
3608
3608
|
`),j=[];H.forEach((F,L)=>{if(U.lastIndex=0,U.test(F))j.push(L+1)});let _=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",V=j.slice(0,3).map((F)=>` ${F} | ${(B[F-1]??"").trim().slice(0,100)}`).join(`
|
|
3609
3609
|
`),O=V?`
|
|
@@ -3611,65 +3611,65 @@ ${V}`:"";G.push(` \u2717 ${W}${_}
|
|
|
3611
3611
|
\u2192 ${K}${O}`)}}if(G.length>0&&Y.enabled){let U=(z)=>{let H=`${process.cwd()}/`;return z.startsWith(H)?z.slice(H.length):z},K=`[STX] DOM API violation in ${J&&J!==Z?`${U(J)} (composed into ${U(Z)})`:U(Z)}:
|
|
3612
3612
|
${G.join(`
|
|
3613
3613
|
`)}
|
|
3614
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}
|
|
3614
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}pQ();var E1="<!--PARENT_CONTENT_PLACEHOLDER-->";function P9($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function nQ($,Z){let X=$.length,J=Z,Y=!0,Q=[],G=(q)=>q+9<=X&&$[q]==="<"&&$[q+1]==="/"&&($[q+2]==="s"||$[q+2]==="S")&&($[q+3]==="c"||$[q+3]==="C")&&($[q+4]==="r"||$[q+4]==="R")&&($[q+5]==="i"||$[q+5]==="I")&&($[q+6]==="p"||$[q+6]==="P")&&($[q+7]==="t"||$[q+7]==="T")&&($[q+8]===">"||/\s/.test($[q+8]));while(J<X){let q=$[J];if(G(J))return J;if(q==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
|
|
3615
3615
|
`,J+2),J===-1)return-1;J+=1,Y=!0;continue}if(q==="/"&&$[J+1]==="*"){let U=$.indexOf("*/",J+2);if(U===-1)return-1;J=U+2,Y=!0;continue}if(q==="/"&&Y){let U=J+1,W=!1;while(U<X){let K=$[U];if(K==="\\"){U+=2;continue}if(K==="[")W=!0;else if(K==="]")W=!1;else if(K==="/"&&!W){U++;break}else if(K===`
|
|
3616
3616
|
`){U=-1;break}U++}if(U===-1){J++,Y=!1;continue}while(U<X&&/[a-z]/.test($[U]))U++;J=U,Y=!1;continue}if(q==="'"||q==='"'){let U=q;J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]===U){J++;break}if($[J]===`
|
|
3617
|
-
`)break;J++}Y=!1;continue}if(q==="`"){J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}if(Q.length===0)Y=!1;continue}if(q==="}"&&Q.length>0){Q.pop(),J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(q));else if(/[)\].\w$]/.test(q))Y=!1;else Y=!0;J++}return-1}function Z5($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${X}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let Y=J.index+J[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function v9($){let Z=0;while(Z<$.length){let X=$.indexOf("<",Z);if(X===-1)return-1;if($.startsWith("<!--",X)){let Q=$.indexOf("-->",X+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(X),Y=/^<style\b[^>]*>/i.exec(J);if(Y){let Q=$.toLowerCase().indexOf("</style>",X+Y[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return X;Z=X+1}return-1}function
|
|
3617
|
+
`)break;J++}Y=!1;continue}if(q==="`"){J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}if(Q.length===0)Y=!1;continue}if(q==="}"&&Q.length>0){Q.pop(),J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(q));else if(/[)\].\w$]/.test(q))Y=!1;else Y=!0;J++}return-1}function Z5($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${X}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let Y=J.index+J[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function v9($){let Z=0;while(Z<$.length){let X=$.indexOf("<",Z);if(X===-1)return-1;if($.startsWith("<!--",X)){let Q=$.indexOf("-->",X+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(X),Y=/^<style\b[^>]*>/i.exec(J);if(Y){let Q=$.toLowerCase().indexOf("</style>",X+Y[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return X;Z=X+1}return-1}function sQ($){let Z=Z5($,"data-stx-runtime");if(!Z)return $;let X=v9($);if(X===-1||X===Z.start)return $;let J=$.slice(Z.start,Z.end),Y=$.slice(0,Z.start)+$.slice(Z.end),Q=v9(Y);if(Q===-1)return J+`
|
|
3618
3618
|
`+Y;return Y.slice(0,Q)+J+`
|
|
3619
|
-
`+Y.slice(Q)}async function w4($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=Q1($);let Q=!Z.__stxProcessingDepth;if(Q)f4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!H5()&&!c5())&&X&&X.endsWith(".stx"))d9($,X);try{return await X7.timeAsync("template-processing",async()=>{let G=await
|
|
3619
|
+
`+Y.slice(Q)}async function w4($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=Q1($);let Q=!Z.__stxProcessingDepth;if(Q)f4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!H5()&&!c5())&&X&&X.endsWith(".stx"))d9($,X);try{return await X7.timeAsync("template-processing",async()=>{let G=await oQ($,Z,X,J,Y);if(Q)G=F4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},W=(Z.__stx_runtime_head||null)??u9(),K=(Z.__stx_head_raw||"").trim(),z,H=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)z=H[1].trim(),K=K.replace(H[0],"").trim();let B=Z.__sections?.title,j=W.title||z||B,_=!W.title&&(!!z||!!B),V=W.meta||[],O=new Set(V.map((N)=>i1(N)).filter(Boolean)),F={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!O.has(i1(N))),...V],link:[...q.link||[],...W.link||[]],script:[...q.script||[],...W.script||[]],headRaw:[q.headRaw,K].filter(Boolean).join(`
|
|
3620
3620
|
`),...W.htmlAttrs&&{htmlAttrs:y2(q.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...W.bodyAttrs}}},L=p3(G);if(G=v2(G,F,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)G=P2(G,q),G=S2(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=g9(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
|
|
3621
3621
|
<meta name="stx-layout" content="${P9(N)}">
|
|
3622
|
-
<meta name="stx-layout-group" content="${P9(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?q5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=g5(G,(T,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=C2(G);let q=J.app?.colorMode;if(q)G=T2(G,q);G=k2(G),G=
|
|
3623
|
-
`+K+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await a("stx/framework-composables",()=>import("./chunk-
|
|
3624
|
-
`+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await a("stx/composable-loader",()=>import("./chunk-
|
|
3625
|
-
`+K+G.slice(z.end)}}catch{}if(Q)G=I2(G);if(Q&&Z.__stx_inject_css!==!1)G=await h9(G,void 0,J.buildMode==="serve");if(Q)G=M2(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof n5)throw G;let q=G instanceof Error?G.message:String(G),U=new L1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(d0.log(U,{filePath:X,context:Z}),X3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),J.debug)throw U;return $3.createFallbackContent("Template Processing",U)}}async function
|
|
3622
|
+
<meta name="stx-layout-group" content="${P9(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?q5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=g5(G,(T,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=C2(G);let q=J.app?.colorMode;if(q)G=T2(G,q);G=k2(G),G=sQ(G)}if(Q)try{let{getStoreScript:q}=await a("stx/store-loader",()=>import("./chunk-2md83wew.js")),U=J.storesDir,W=await q(U);if(W){let K=`<script data-stx-stores>${W}</script>`,z=Z5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
|
|
3623
|
+
`+K+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await a("stx/framework-composables",()=>import("./chunk-591jpt6f.js")),U=await q(G);if(U){let W=Z5(G,"data-stx-stores")||Z5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
|
|
3624
|
+
`+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await a("stx/composable-loader",()=>import("./chunk-3bgyqx5b.js")),U=J.composablesDir,W=await q(U,G);if(W){let K=`<script data-stx-composables>${W}</script>`,z=Z5(G,"data-stx-stores")||Z5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
|
|
3625
|
+
`+K+G.slice(z.end)}}catch{}if(Q)G=I2(G);if(Q&&Z.__stx_inject_css!==!1)G=await h9(G,void 0,J.buildMode==="serve");if(Q)G=M2(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof n5)throw G;let q=G instanceof Error?G.message:String(G),U=new L1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(d0.log(U,{filePath:X,context:Z}),X3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),J.debug)throw U;return $3.createFallbackContent("Template Processing",U)}}async function oQ($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!R0.isAbsolute(J.partialsDir)?R0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!R0.isAbsolute(J.componentsDir)?R0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!R0.isAbsolute(J.layoutsDir)?R0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,U=$;await tQ(X,Z),aQ(Z,q),U=await h1(()=>U2(U,Z,X,q),U,(L)=>{d0.log(L,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${L.message}`)}),U=U.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=c0(U,Q5,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);U=W.output;let K=W.tokens,z=(L)=>K.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>K[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";U=U.replace(/@@/g,H),U=U.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),U=O2(U),U=await b9(U,X,Y);let B={};U=v3(U,B);let j={...Z.__sections||{}},_="",V=F7(V7($)),O=/@nolayout\b/.test(U)||V===!1;if(/@nolayout\b/.test(U))U=U.replace(/@nolayout\b\s*/g,"");let F=U.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)_=F[1],U=U.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof V==="string"){if(_=V,!/@section\s*\(/.test(U))U=`@section('content')
|
|
3626
3626
|
${U.trim()}
|
|
3627
3627
|
@endsection`}if(!_&&!O&&q.defaultLayout){let L=c3(U),w=/@section\s*\(/.test(U);if(!L||w){let R="",D=R0.dirname(X),N=q.layoutsDir?R0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let A=R0.join(D,"_layout.stx");if(await r(A)){R=A;break}let M=R0.dirname(D);if(M===D||M.length<N.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let T=R0.isAbsolute(q.layoutsDir)?q.layoutsDir:R0.resolve(process.cwd(),q.layoutsDir),A=R0.join(T,`${q.defaultLayout}.stx`);if(await r(A))_=A}if(_&&!w)U=`@section('content')
|
|
3628
3628
|
${U.trim()}
|
|
3629
3629
|
@endsection`}}if(U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return j[w]=R,""}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=X0(R.trim(),Z);if(D===void 0)return L;return j[w]=String(D??""),""}catch{return L}}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))j[w]=R.replace("@parent",E1);else j[w]=R.trim();return""}),Z.__sections=j,U=U.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return j[w]||R||""}),!("slot"in Z)||Z.slot===void 0)U=U.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(U=f3(U,B),_){let L=[],w=p0(U),R=c0(w.output,S1,(D,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(U=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,N,T)=>{let A=N==="SCRIPT"?w.scripts[Number(T)]:R.tokens[Number(T)];if(A)L.push(A);return""}),L.length>0){let D=L.join(`
|
|
3630
3630
|
`);j.content=j.content?`${j.content}
|
|
3631
|
-
${D}`:D,Z.__sections=j}}if(_)try{let L;if(R0.isAbsolute(_))L=_,Y.add(_);else L=await h1(()=>r5(_,X,G,Y),null,()=>{throw new L1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!L){let A=(I)=>{if(!I)return[];try{let y=R0.isAbsolute(I)?I:R0.resolve(process.cwd(),I);return
|
|
3632
|
-
${U}`,z(U)}catch(L){return d0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return z(await f9(U,Z,X,G,Y))}function
|
|
3631
|
+
${D}`:D,Z.__sections=j}}if(_)try{let L;if(R0.isAbsolute(_))L=_,Y.add(_);else L=await h1(()=>r5(_,X,G,Y),null,()=>{throw new L1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!L){let A=(I)=>{if(!I)return[];try{let y=R0.isAbsolute(I)?I:R0.resolve(process.cwd(),I);return iQ.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...A(G.layoutsDir),...A(G.fallbackLayoutsDir)].filter((I,y,E)=>E.indexOf(I)===y).sort(),k=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(d0.log(Error(k),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${k}`),G.debug)throw new L1(k,X);return U}let w=await h1(()=>Bun.file(L).text(),"",()=>{throw new L1(`Failed to read layout file: ${L}`,X,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let A={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return A[E]=b.trim(),""});for(let[y,E]of Object.entries(A))if(j[y]&&j[y].includes(E1)){let b=j[y].indexOf(E1);j[y]=j[y].slice(0,b)+E+j[y].slice(b+E1.length)}else if(!j[y])j[y]=E;let k={...Z,__sections:j},I=`@layout('${R[1]}')${M}`;return await w4(I,k,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=v3(D,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,M,k)=>{return T[M]=k.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(A,M,k)=>{if(j[M]){let I=j[M];if(I.includes(E1)){let y=T[M]||"",E=I.indexOf(E1);I=I.slice(0,E)+y+I.slice(E+E1.length)}return I}return k||""}),N=rQ(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=f3(N,B),Z.__originalFilePath=X,U=await f9(N,Z,L,G,Y),U=`<!-- stx-layout: ${_} -->
|
|
3632
|
+
${U}`,z(U)}catch(L){return d0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return z(await f9(U,Z,X,G,Y))}function rQ($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function aQ($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function tQ($,Z){await h1(()=>z2($,Z),void 0,(X)=>{d0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function eQ($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await a("stx/variable-extractor",()=>import("./chunk-2bkqbmkn.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));d0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function $G($,Z,X){try{let{interpolateScriptsInTemplate:J}=await a("stx/expressions",()=>import("./chunk-c18nh1et.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return d0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function f9($,Z,X,J,Y){let Q=$,G=J;if(await eQ(Q,Z,X),Q=await $G(Q,Z,X),Q=await o6(Q,Z,X),Q=await r6(Q,Z,X),Q=await S6(Q,Z,X,G),Q1(Q))Q=t2(Q,Z),Q=Z9(Q,Z);Q=$9(Q);let{processStreamDirectives:q}=await a("stx/streaming",()=>import("./chunk-vkpmnn26.js"));Q=q(Q,Z),Q=J2(Q,Z,X,G),Q=await w2(Q,Z,X,G,Y),Q=await _4(Q,Z,X,G,Y),Q=O7(Q,Z,X,G);let{processDeferDirectives:U}=await a("stx/defer",()=>import("./chunk-r153ybwd.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await a("stx/teleport",()=>import("./chunk-cr7s8q08.js"));Q=W(Q,Z,X);let{processTransitionDirectives:K,processTransitionAttributes:z}=await a("stx/transitions",()=>import("./chunk-ne8sygmy.js"));Q=K(Q,Z,X),Q=z(Q);let{processErrorBoundaryDirectives:H}=await a("stx/error-boundaries",()=>import("./chunk-tryt2h85.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await a("stx/suspense",()=>import("./chunk-2w5d5tw1.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await a("stx/async-components",()=>import("./chunk-rczpw37w.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await a("stx/keep-alive",()=>import("./chunk-c7pvwvse.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:V,processVirtualGridDirectives:O,processInfiniteListDirectives:F}=await a("stx/virtual-scrolling",()=>import("./chunk-wbq7cp57.js"));Q=V(Q,Z,X),Q=O(Q,Z,X),Q=F(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await a("stx/partial-hydration",()=>import("./chunk-f6jm4hy3.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await a("stx/computed",()=>import("./chunk-3twce5kp.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await a("stx/forms-validation",()=>import("./chunk-w670sde5.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:k}=await a("stx/head",()=>import("./chunk-rg6v68ya.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
|
|
3633
3633
|
`;if(Q=A(Q,Z),Q=M(Q,Z),Q=K2(Q),Q=_3(Q,Z),Q=y6(Q),Q=G2(Q),Q=await P3(Q,Z,X,G,Y),Q=await _4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=g4(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=F4(Q),Q=t0(Q,Z,X),Q=O3(Q,Z),Q=V3(Q,Z),Q=F5(Q,Z),Q=A3(Q,Z),Q=M3(Q,Z),Q=await F6(Q,Z,X,G),Q=await M7(Q,Z,X),Q=await l6(Q,Z,X,G),Q=x9(Q,Z,X,G),Q=J6(Q,Z,X,G),Q=Y6(Q,Z,X),Q=Q6(Q,Z,X,G),Q=E6(Q,Z,X,G),Q=O4(Q,Z),Q=V4(Q),Q=y9(Q),!G.skipEventDirectives)Q=P4(Q,Z,X);if(Q=R7(Q,Z,X),G.debug){let p=/\bx-data\s*=/.test(Q),e=t3($);if(p&&e)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3634
3634
|
Both work on the same page, but they manage separate scopes.
|
|
3635
|
-
Prefer signals (state/derived/effect) for new components.`)}Q=j2(Q,Z),Q=await _1(Q,Z,X),Q=S9(Q),Q=C9(Q),Q=U7(Q);let{processXElementDirectives:y}=await a("stx/x-element",()=>import("./chunk-
|
|
3635
|
+
Prefer signals (state/derived/effect) for new components.`)}Q=j2(Q,Z),Q=await _1(Q,Z,X),Q=S9(Q),Q=C9(Q),Q=U7(Q);let{processXElementDirectives:y}=await a("stx/x-element",()=>import("./chunk-47pge5gz.js"));Q=y(Q);let E=Z.__originalFilePath||X,b=N$(Z);if(Q=await X9(Q,G,E,b),Q=f6(Q,Z),Q=await W2(Q,Z,X,G),G.media?.image?.autoSiblings){let p=G.publicDir||"public",{rewriteImagesWithSiblings:e}=await a("stx/image-optimization/auto-sibling",()=>import("./chunk-2xeq5xnf.js"));Q=await e(Q,{publicDir:p})}if(G.seo?.enabled)Q=G6(Q,Z,G);let C=(p,e,Y0=!0)=>{if(!e)return p;let I0=e.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),F0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(I0&&F0){if(Y0)p=p.replace(F0[0],I0[0]);if(e=e.replace(I0[0],"").trim(),!e)return p}if(/<\/head>/i.test(p))return p.replace(/<\/head>/i,`${e}
|
|
3636
3636
|
</head>`);if(/<head\b[^>]*>/i.test(p))return p.replace(/(<head\b[^>]*>)/i,`$1
|
|
3637
3637
|
${e}`);if(/<html\b[^>]*>/i.test(p))return p.replace(/(<html\b[^>]*>)/i,`$1
|
|
3638
3638
|
<head>
|
|
3639
3639
|
${e}
|
|
3640
|
-
</head>`);return p},{renderHead:x,getHead:f}=await a("stx/head",()=>import("./chunk-
|
|
3640
|
+
</head>`);return p},{renderHead:x,getHead:f}=await a("stx/head",()=>import("./chunk-rg6v68ya.js")),m=Z.__stx_runtime_head??f();if(m.title||m.meta?.length||m.link?.length){let p=x(m);if(p)Q=C(Q,p)}if(I.headContent)Q=C(Q,I.headContent,!m.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=I6(Q,G.csp,Z);if(G.analytics?.enabled)Q=K7(Q,G);if(G.heatmap?.enabled)Q=H7(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:p}=await a("stx/pwa/inject",()=>import("./chunk-4vwxgmg0.js"));Q=p(Q,G)}let V0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),M0=/\bSTX\.\w+/.test(Q),T0=/window\.STX\s*=/.test(Q);if(V0&&M0&&!T0){let e=`<script data-stx-scoped data-stx-run="once">
|
|
3641
3641
|
${Q7()}
|
|
3642
3642
|
</script>`;if(Q.includes("</head>")){let Y0=Q.indexOf("</head>"),F0=Q.slice(0,Y0).indexOf("<script");if(F0!==-1){let P0=Q.slice(0,F0),S=Q.slice(F0);Q=P0+e+`
|
|
3643
3643
|
`+S}else Q=Q.replace("</head>",`${e}
|
|
3644
3644
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3645
3645
|
${e}`);else Q=e+`
|
|
3646
|
-
`+Q}{let{scanScriptTags:p}=await a("stx/signal-processing",()=>import("./chunk-
|
|
3647
|
-
`+Q.slice(Y0)}Z.__stx_event_bindings=[]}}if(!d2(Q)&&m2(Q))Q=await j$(Q,G);if(Q=l2(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=k6(Q,Z.cspNonce);return Q}var
|
|
3648
|
-
`);return{line:X.length,column:X[X.length-1].length+1}}function
|
|
3649
|
-
`);for(let Y of J){let Q=X,G=null,q=!1;for(let U=0;U<Y.length;U++){let W=Y[U];if(q){q=!1;continue}if(W==="\\"){q=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&U+1<Y.length&&Y[U+1]==="/")break;if(W==="{")X++;else if(W==="}")X--}if(Q===0){let U=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(U)Z.push(U[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((H)=>{let B=H.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...z)}}}}return[...new Set(Z)]}function
|
|
3646
|
+
`+Q}{let{scanScriptTags:p}=await a("stx/signal-processing",()=>import("./chunk-mpt8ed9w.js")),e=[];for(let Y0 of p(Q)){if(!/\bserver\b/i.test(Y0.attrs))continue;let I0=Y0.start+Y0.fullMatch.indexOf(">")+1,F0=nQ(Q,I0);if(F0===-1)continue;let P0=F0+9;while(P0<Q.length&&/\s/.test(Q[P0]))P0++;e.push({start:Y0.start,end:P0})}for(let Y0=e.length-1;Y0>=0;Y0--){let{start:I0,end:F0}=e[Y0];Q=Q.substring(0,I0)+Q.substring(F0)}}let h0=K$(Q,X);if(h0.hasScoped)Q=h0.html;let t=Z.__stx_event_bindings||[],K0=!1,q0=[],B1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:J5}=await a("stx/signal-processing",()=>import("./chunk-mpt8ed9w.js"));for(let p of J5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))q0.push({match:p.fullMatch,attrs:p.attrs,content:p.body});for(let{match:p,attrs:e,content:Y0}of q0){K0=!0;let I0=Y0;L4(Y0,X,J.strict,Z.__originalFilePath);let F0=await A$(Y0,{eventBindings:t,attrs:e,hasColonDirectives:B1,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(p,()=>F0)}if(K0)Z.__stx_event_bindings=[];if(!K0&&Z.__stxProcessingDepth===1){let p=Z.__stx_event_bindings||[];if(p.length>0){let e=E$(p);if(e){let Y0=Q.lastIndexOf("</body>");Q=Y0===-1?Q+e:Q.slice(0,Y0)+e+`
|
|
3647
|
+
`+Q.slice(Y0)}Z.__stx_event_bindings=[]}}if(!d2(Q)&&m2(Q))Q=await j$(Q,G);if(Q=l2(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=k6(Q,Z.cspNonce);return Q}var ZG=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],XG=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],JG=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function YG($){let Z=[],X=[];return QG($,Z),GG($,Z,X),qG($,X),UG($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function QG($,Z){let X=($.match(/\{\{/g)||[]).length,J=($.match(/\}\}/g)||[]).length;if(X!==J)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${J} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function GG($,Z,X){for(let J of ZG){let Y=new RegExp(`${J.open}(?:\\s|\\()`,"g"),Q=new RegExp(J.close,"g"),G=($.match(Y)||[]).length,q=($.match(Q)||[]).length;if(J.altClose){let U=new RegExp(J.altClose,"g");q+=($.match(U)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${J.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${J.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function qG($,Z){for(let X of XG)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function UG($,Z){for(let X of JG)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function WG($,Z){let X=$.slice(0,Z).split(`
|
|
3648
|
+
`);return{line:X.length,column:X[X.length-1].length+1}}function KG($,Z,X){let J=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))J.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(X.length===0)J.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)J.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)J.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return J}function zG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function HG($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let J of Z){let Y=J[1].toLowerCase();if(!Y.startsWith("end"))X.add(Y)}return Array.from(X)}import s0 from"path";import X5 from"process";var o9=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],m9=new Set(o9),BG=new Set(["props","$props","defineProps"]),jG=new Set(["stx","@stacksjs/stx"]);function _G($){let Z=[],X=0,J=$.split(`
|
|
3649
|
+
`);for(let Y of J){let Q=X,G=null,q=!1;for(let U=0;U<Y.length;U++){let W=Y[U];if(q){q=!1;continue}if(W==="\\"){q=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&U+1<Y.length&&Y[U+1]==="/")break;if(W==="{")X++;else if(W==="}")X--}if(Q===0){let U=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(U)Z.push(U[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((H)=>{let B=H.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...z)}}}}return[...new Set(Z)]}function OG($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function X(J){if(!J.includes(":"))return J;let Y=[],Q="",G=0,q=0,U=null;for(let W=0;W<J.length;W++){let K=J[W];if(U){if(Q+=K,K===U)U=null;continue}if(K==='"'||K==="'"||K==="`"){U=K,Q+=K;continue}if(K==="<")G++;else if(K===">"&&G>0)G--;else if(K==="(")q++;else if(K===")")q--;if(K===","&&G===0&&q===0){Y.push(Q),Q="";continue}Q+=K}if(Q)Y.push(Q);return Y.map((W)=>{let K=W.trim(),z=K.startsWith("..."),H=z?K.slice(3):K,B=-1,j=0;for(let R=0;R<H.length;R++)if(H[R]==="<")j++;else if(H[R]===">")j--;else if(H[R]===":"&&j===0){B=R;break}if(B===-1)return W;let V=H.substring(0,B).trim().replace(/\?$/,""),O=H.substring(B+1),F=-1,L=0;for(let R=0;R<O.length;R++)if(O[R]==="<")L++;else if(O[R]===">")L--;else if(O[R]==="="&&L===0){F=R;break}let w=z?"...":"";if(F!==-1)return`${w}${V} = ${O.substring(F+1).trim()}`;return`${w}${V}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,Q)=>{if(!Q.includes(":"))return J;return`${Y}(${X(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,q=1,U=G+1,W=0,K=null;while(U<Z.length&&q>0){let B=Z[U];if(K){if(B===K)K=null;U++;continue}if(B==='"'||B==="'"||B==="`"){K=B,U++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")q++;else if(B===")")q--}if(q>0)U++}if(q!==0)continue;let z=Z.substring(G+1,U);if(!z.includes(":"))continue;let H=X(z);Q.push({start:G+1,end:U,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:U,replacement:W}=Q[G];Z=Z.substring(0,q)+W+Z.substring(U)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((G)=>{let[q,...U]=G.split("="),W=q.split(":")[0].trim();if(U.length>0)return`${W} = ${U.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
3650
3650
|
|
|
3651
|
-
`),Z}function
|
|
3651
|
+
`),Z}function VG($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function FG($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function LG($,Z,X,J={}){if(!$.trim())return;let Y;try{let S=D4({loader:"ts",target:"browser",define:e1()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=S.transformSync(v)}catch{Y=OG($)}let Q={exports:{}},G=Q.exports,q=X5.cwd(),U={},W=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),K=new Map;for(let S of W)try{if(S.startsWith(".")){U[S]=await import(s0.resolve(s0.dirname(X),S));continue}let v=s0.resolve(q,"node_modules",S),d=s0.join(v,"package.json"),P=JSON.parse(h("fs").readFileSync(d,"utf8")),u=P.main||"index.js";if(P.exports){let s=typeof P.exports==="string"?P.exports:P.exports["."];if(typeof s==="string")u=s;else if(s?.bun)u=s.bun;else if(s?.import)u=s.import;else if(s?.default)u=s.default}U[S]=await import(s0.resolve(v,u))}catch(v){if(S.startsWith("."))K.set(S,v instanceof Error?v.message:String(v))}let z=(S)=>{if(U[S])return U[S];let v=K.get(S);if(v!==void 0)throw Error(`Cannot require '${S}' from ${X}: ${v}`);return h(S)},H=Z.props||{},B=(S)=>{if(!S)return H;let v={};for(let[d,P]of Object.entries(S)){let u=H[d];if(u!==void 0)v[d]=u;else if(typeof P==="function")v[d]=P();else v[d]=P}return v};for(let[S,v]of Object.entries(H))Object.defineProperty(B,S,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(H,S))continue;try{Object.defineProperty(B,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let j=(S)=>{if(!S)return H;let v={...H};for(let[d,P]of Object.entries(S)){let u=P&&typeof P==="object"&&!Array.isArray(P)?P:{type:P};if(v[d]===void 0&&u.default!==void 0)v[d]=typeof u.default==="function"?u.default():u.default}return v},_=()=>Z.slots||{},V=(S,v)=>{let d={...S};for(let[P,u]of Object.entries(v))if(d[P]===void 0)if(typeof u==="function")d[P]=u();else d[P]=u;return d},O=(S)=>{let v=()=>S;return v.set=(d)=>{},v.update=(d)=>{},v},F=(S)=>{let v,d=!1;return()=>{if(!d)try{v=S(),d=!0}catch{v=void 0}return v}},L=(S)=>{},w=(S)=>S(),R=(S)=>{},D=(S)=>{};function N(S){let v=S||{};if(v.title!==void 0||v.description!==void 0)I({title:v.title,description:v.description})}function T(S){if(!S||typeof S!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,S),Z.__stxClientPayload=v}let A=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",d=S?.path??"",P=Object.fromEntries(new URLSearchParams(v)),u=Z.query,s=Object.keys(P).length>0?P:u??{},o=v||(Object.keys(s).length>0?`?${new URLSearchParams(s).toString()}`:"");return{params:Z.params??{},query:s,path:d,name:"",fullPath:d+o,hash:"",matched:[]}},M=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),k=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=o5(v,S||{})},I=(S)=>{k(s9(S||{}))},y=(S)=>({value:S}),E=(S)=>S,b=(S)=>({value:typeof S==="function"?S():S}),C=(S,v)=>{},x=(S)=>{},f=(S)=>{},n=(S)=>S?S():Promise.resolve(),m=(S)=>(v,...d)=>{},V0=(S)=>{},M0=(S,v)=>{},T0=(S,v)=>v,h0=()=>({value:"light"}),t=()=>O(!1),K0=(S)=>O(!1),q0=()=>O(!1),B1=()=>K0("(prefers-color-scheme: dark)"),J5=()=>K0("(prefers-color-scheme: light)"),p=()=>K0("(prefers-reduced-motion: reduce)"),e=()=>K0("(prefers-contrast: more)"),Y0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},I0=new Proxy(Y0,{get(S,v){if(v in S)return S[v];return},set(S,v,d){return S[v]=d,!0}}),F0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},P0=console;try{let S=r9(Y,X),v=new Set(Object.keys(H)),d=(i)=>/^[a-z_$][\w$]*$/i.test(i),P=Object.keys(Z).filter((i)=>!v.has(i)&&!BG.has(i)&&d(i)),u=P.map((i)=>Z[i]);if(!P.includes("__stxServeContext"))P.push("__stxServeContext"),u.push(void 0);let s=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),o=[],z0=[];for(let[i,J0]of Object.entries(H)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(s.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(S))continue;o.push(i),z0.push(J0)}let Z1=_G(S).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
|
|
3652
3652
|
`),b0=Z.params??{},D0=[],v0=[];for(let i=0;i<P.length;i++){if(P[i]==="params")continue;D0.push(P[i]),v0.push(u[i])}let X1=await Function(...o9,...o,...D0,`return (async () => {
|
|
3653
3653
|
${S}
|
|
3654
3654
|
${Z1}
|
|
3655
3655
|
return module.exports
|
|
3656
|
-
})()`)(Q,G,z,H,B,j,V,T,O,F,L,w,R,D,N,A,M,k,I,y,E,b,C,x,f,n,m,V0,_,M0,T0,h0,t,K0,q0,B1,J5,p,e,I0,F0,P0,Y0.confirm,Y0.alert,Y0.fetch,b0,...z0,...v0);if(J.preserveExisting){for(let[i,J0]of Object.entries(X1))if(!(i in Z)||Z[i]===void 0)Z[i]=J0}else Object.assign(Z,X1);for(let[i,J0]of Object.entries(H))if(!(i in Z))Z[i]=J0}catch(S){let v=S instanceof Error?S.message:String(S);if(
|
|
3656
|
+
})()`)(Q,G,z,H,B,j,V,T,O,F,L,w,R,D,N,A,M,k,I,y,E,b,C,x,f,n,m,V0,_,M0,T0,h0,t,K0,q0,B1,J5,p,e,I0,F0,P0,Y0.confirm,Y0.alert,Y0.fetch,b0,...z0,...v0);if(J.preserveExisting){for(let[i,J0]of Object.entries(X1))if(!(i in Z)||Z[i]===void 0)Z[i]=J0}else Object.assign(Z,X1);for(let[i,J0]of Object.entries(H))if(!(i in Z))Z[i]=J0}catch(S){let v=S instanceof Error?S.message:String(S);if(VG(v))console.warn(`[stx] server <script> in ${X??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(FG(v))console.warn(`[stx] server <script> in ${X??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(X5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${X??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await IG(Y,Z,X)}catch(d){if(X5.env.STX_DEBUG){let P=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${X??"<unknown>"}: ${P}`)}}}}function wG($){let Z=0,X=null,J=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G===X){if(X=null,J||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){X=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return X===null&&Z===0&&Y}var RG=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function r9($,Z){let X=Z?s0.dirname(Z):X5.cwd(),J=X5.cwd(),Y=$.split(`
|
|
3657
3657
|
`),Q=[],G=0;while(G<Y.length){let q=Y[G].trim();if(q.startsWith("interface ")||q.startsWith("export interface ")||q.startsWith("type ")||q.startsWith("export type ")){if(q.includes("{")&&!q.includes("}")){let U=0;for(;G<Y.length;G++){for(let W of Y[G])if(W==="{")U++;else if(W==="}")U--;if(U<=0)break}}G++;continue}if(q.startsWith("definePageMeta(")){let U=0,W=!1,K=G;for(let B=G;B<Y.length&&!W;B++){let j=null,_=!1,V=Y[B];for(let O=0;O<V.length;O++){let F=V[O];if(_){_=!1;continue}if(F==="\\"){_=!0;continue}if(j){if(F===j)j=null;continue}if(F==='"'||F==="'"||F==="`"){j=F;continue}if(F==="(")U++;else if(F===")"){if(U--,U===0){G=B+1,W=!0;break}}}}if(!W)G=Y.length;let z=Y.slice(K,G).join(`
|
|
3658
|
-
`),H=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(j)H.push(`${B}: ${JSON.stringify(j[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(q.startsWith("import ")||q==="import"||q.startsWith("import{")){let U=q,W=0;while(!
|
|
3659
|
-
`+B;if(z<=0&&H>=G)break}Q.push(K),Q.push(`module.exports.${W} = ${W};`),G=H+1}else Q.push(q),G++}else if(q.includes("module.exports"))Q.push(q),G++;else if(q.trim()&&!q.startsWith("//"))Q.push(q),G++;else G++}return
|
|
3660
|
-
`),X,J)}function
|
|
3661
|
-
`)q=!1;Q++;continue}if(U){if(Y+=K,K==="*"&&z==="/"){Y+=z,Q+=2,U=!1;continue}Q++;continue}if(!G&&K==="/"&&z==="/"){q=!0,Y+=K,Q++;continue}if(!G&&K==="/"&&z==="*"){U=!0,Y+=K,Q++;continue}if(G){if(Y+=K,K==="\\"){Y+=z,Q+=2;continue}if(K===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(K==="$"&&z==="{"){W++,Y+=z,Q+=2;continue}if(K==="`"){G=null,Q++;continue}}Q++;continue}if(W>0){if(K==="{")W++;else if(K==="}")W--}if(K==='"'||K==="'"||K==="`"){G=K,Y+=K,Q++;continue}if(K==="a"&&$.startsWith("await",Q)){let H=
|
|
3658
|
+
`),H=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(j)H.push(`${B}: ${JSON.stringify(j[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(q.startsWith("import ")||q==="import"||q.startsWith("import{")){let U=q,W=0;while(!wG(U)&&G+W+1<Y.length)W++,U=`${U} ${Y[G+W].trim()}`;G+=W;let K=U.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=U.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=U.match(/^import\s+['"](.+?)['"]/),B=U,j=(_)=>{if(_.startsWith("."))return s0.resolve(X,_);if(_.startsWith("~/")||_.startsWith("@/"))return s0.resolve(J,_.slice(2));return _};if(K){let[,_,V]=K,O=j(V);Q.push(`const ${_} = (await import('${O}')).default`),Q.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,V]=z,O=j(V),F=[],L=[],w=jG.has(V);for(let R of _.split(",")){let D=R.trim();if(!D)continue;let N=D.split(/\s+as\s+/);if(N.length===2){let[T,A]=[N[0].trim(),N[1].trim()];if(w&&m9.has(T)){Q.push(`const ${A} = ${T};`);continue}F.push(`${T}: ${A}`),L.push(A)}else{if(w&&m9.has(D))continue;F.push(D),L.push(D)}}if(F.length>0)Q.push(`const { ${F.join(", ")} } = await import('${O}')`);for(let R of L)Q.push(`module.exports.${R} = ${R};`)}else if(H){let _=j(H[1]);Q.push(`await import('${_}')`)}else Q.push(B);G++;continue}if(RG.test(q))Q.push(Y[G]),G++;else if(q.startsWith("export const ")||q.startsWith("export let ")||q.startsWith("export var ")){let U=c9(Y,G),{type:W,name:K,value:z}=U;Q.push(`${W} ${K} = ${z};`),Q.push(`module.exports.${K} = ${K};`),G=U.nextIndex}else if(q.startsWith("export function ")||q.startsWith("export async function ")){let U=R4(Y,G);Q.push(U.functionCode),Q.push(`module.exports.${U.name} = ${U.name};`),G=U.nextIndex}else if(q.startsWith("const ")||q.startsWith("let ")||q.startsWith("var ")){let U=c9(Y,G),{type:W,name:K,value:z}=U;Q.push(`${W} ${K} = ${z};`),Q.push(`module.exports.${K} = ${K};`),G=U.nextIndex}else if(q.startsWith("function ")||q.startsWith("async function ")){let U=R4(Y,G);Q.push(U.functionCode),Q.push(`module.exports.${U.name} = ${U.name};`),G=U.nextIndex}else if(q.startsWith("export default function ")||q.startsWith("export default async function ")){let U=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Y];W[G]=U;let K=R4(W,G);if(Q.push(K.functionCode),K.name)Q.push(`module.exports.default = ${K.name};`);G=K.nextIndex}else if(q.startsWith("export default ")){let U=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${U};`),G++}else if(q.startsWith("class ")||q.startsWith("export class ")){let U=q.match(/(?:export\s+)?class\s+(\w+)/);if(U){let W=U[1],K=Y[G].replace(/^export\s+/,""),z=0,H=G;for(;H<Y.length;H++){let B=Y[H];for(let j of B)if(j==="{")z++;else if(j==="}")z--;if(H>G)K+=`
|
|
3659
|
+
`+B;if(z<=0&&H>=G)break}Q.push(K),Q.push(`module.exports.${W} = ${W};`),G=H+1}else Q.push(q),G++}else if(q.includes("module.exports"))Q.push(q),G++;else if(q.trim()&&!q.startsWith("//"))Q.push(q),G++;else G++}return DG(Q.join(`
|
|
3660
|
+
`),X,J)}function DG($,Z,X){let J=$.length,Y="",Q=0,G=null,q=!1,U=!1,W=0;while(Q<J){let K=$[Q],z=$[Q+1];if(q){if(Y+=K,K===`
|
|
3661
|
+
`)q=!1;Q++;continue}if(U){if(Y+=K,K==="*"&&z==="/"){Y+=z,Q+=2,U=!1;continue}Q++;continue}if(!G&&K==="/"&&z==="/"){q=!0,Y+=K,Q++;continue}if(!G&&K==="/"&&z==="*"){U=!0,Y+=K,Q++;continue}if(G){if(Y+=K,K==="\\"){Y+=z,Q+=2;continue}if(K===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(K==="$"&&z==="{"){W++,Y+=z,Q+=2;continue}if(K==="`"){G=null,Q++;continue}}Q++;continue}if(W>0){if(K==="{")W++;else if(K==="}")W--}if(K==='"'||K==="'"||K==="`"){G=K,Y+=K,Q++;continue}if(K==="a"&&$.startsWith("await",Q)){let H=NG($,Q);if(H){let{quote:B,path:j,end:_}=H;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let V=j.startsWith(".")?s0.resolve(Z,j):s0.resolve(X,j.slice(2));Y+=`await import(${B}${V}${B})`,Q=_;continue}}}Y+=K,Q++}return Y}function NG($,Z){let X=Z+5;if(X>=$.length)return null;if(!/\s/.test($[X]))return null;while(X<$.length&&/\s/.test($[X]))X++;if(!$.startsWith("import",X))return null;X+=6;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;X++;while(X<$.length&&/\s/.test($[X]))X++;let J=$[X];if(J!=="'"&&J!=='"')return null;X++;let Y=X;while(X<$.length&&$[X]!==J)if($[X]==="\\")X+=2;else X++;if(X>=$.length)return null;let Q=$.slice(Y,X);X++;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return{quote:J,path:Q,end:X+1}}function a9($,Z){let X=$[Z];if(X!=="{"&&X!=="[")return null;let Y=H0($,X,X==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function t9($){let Z=[],X=$.slice(1,-1).trim();if(!X)return Z;let J=0,Y=0,Q="";while(J<X.length){let G=X[J];if(G==="{"||G==="["){let q=Y===0?a9(X,J):null;if(q){Z.push(...t9(q.pattern)),J=q.endPos,Q="";continue}Y++}else if(G==="}"||G==="]")Y--;if(Y>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<X.length&&X[J]!==","&&Y===0){if(X[J]==="{"||X[J]==="[")Y++;else if(X[J]==="}"||X[J]==="]")Y--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function AG($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let X=Z[0].length,J=(Y)=>Y===" "||Y==="\t";while(X<$.length&&J($[X]))X++;if($[X]===":"){let Y=0,Q=null;X++;for(;X<$.length;X++){let G=$[X];if(Q){if(G==="\\"){X++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Y++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Y--;continue}if(G==="="&&Y<=0){let q=$[X+1],U=$[X-1];if(q!=="="&&q!==">"&&U!=="="&&U!=="!"&&U!=="<"&&U!==">")break}}if($[X]!=="=")return null}while(X<$.length&&J($[X]))X++;if($[X]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(X+1).trim()}}function l9($,Z,X,J){let Y=null,Q=!1;for(let G of $){if(Q){Q=!1;continue}if(G==="\\"){Q=!0;continue}if(Y){if(G===Y)Y=null;continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G===Z)J++;else if(G===X)J--}return J}function c9($,Z){let X=$[Z].trim(),J=AG(X),Y=J?[X,J.type,J.name,J.value]:null;if(!Y){let K=X.match(/^(?:export\s+)?(const|let|var)\s+/);if(K){let z=X.slice(K[0].length),H=Z;if(z.startsWith("{")||z.startsWith("[")){let j=z[0],_=j==="{"?"}":"]",V=l9(z,j,_,0),O=z;for(let F=Z+1;F<$.length&&V>0;F++)O+=` ${$[F].trim()}`,H=F,V=l9($[F],j,_,V);if(V>0)O=z,H=Z;z=O}let B=a9(z,0);if(B){let j=K[1],_=B.pattern,V=z.slice(B.endPos).trim();if(V.startsWith("=")){let O=V.slice(1).trim(),F=O,L=Math.max(H,Z);if(p9(O)){let N=i9($,L,O);F=N.value,L=N.nextIndex}else L=L+1;F=F.trim().replace(/;$/,"");let w=t9(_),R=`__stx_src_${Z}`,D=w.map((N)=>`module.exports.${N} = ${N};`).join(`
|
|
3662
3662
|
`);return{type:j,name:R,value:`${F}; ${j} ${_} = ${R};
|
|
3663
3663
|
${D}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${X}`)}let[,Q,G,q]=Y,U=q,W=Z;if(p9(q)){let K=i9($,Z,q);U=K.value,W=K.nextIndex}else W=Z+1;while(W<$.length){let K=$[W].trim();if(K.startsWith(".")||K.startsWith("?."))U+=`
|
|
3664
|
-
${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:U,nextIndex:W}}function R4($,Z){let X=$[Z].trim(),J=X.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${X}`);let[,Y]=J,Q=X.replace(/^export\s+/,""),G=Z;if(
|
|
3664
|
+
${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:U,nextIndex:W}}function R4($,Z){let X=$[Z].trim(),J=X.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${X}`);let[,Y]=J,Q=X.replace(/^export\s+/,""),G=Z;if(MG(X)){let q=TG($,Z,Q);Q=q.functionCode,G=q.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function p9($){let Z=$.trim();if(Z.startsWith("{"))return H0(Z,"{","}",0)===-1;if(Z.startsWith("["))return H0(Z,"[","]",0)===-1;return!e9(Z)}function e9($){let Z={paren:0,bracket:0,brace:0},X=null,J=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&X)continue;if((Q==='"'||Q==="'")&&!X){X=Q;continue}if(Q===X&&X!=="`"){X=null;continue}if(Q==="`"&&!X){X="`";continue}if(Q==="`"&&X==="`"&&J===0){X=null;continue}if(X==="`"&&Q==="$"&&$[Y+1]==="{"){J++,Y++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(X)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&X===null}function $8($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let X=H0($,"(",")",Z);if(X===-1)return-1;return $.indexOf("{",X)}function MG($){let Z=$8($);if(Z===-1)return!0;return H0($,"{","}",Z)===-1}function i9($,Z,X){let J=X,Y=Z+1;while(Y<$.length&&!e9(J)){let Q=$[Y];J+=`
|
|
3665
3665
|
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
|
|
3666
|
-
${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function
|
|
3667
|
-
${G}`,Y++}return{functionCode:J,nextIndex:Y}}function n9($,Z){let X=X0($,Z)??X0(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...X5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function
|
|
3668
|
-
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let K=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let V=_.trim().split(":");return V[V.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(U())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return Z}function
|
|
3666
|
+
${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function TG($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=$8(J);if(Q!==-1){if(H0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
|
|
3667
|
+
${G}`,Y++}return{functionCode:J,nextIndex:Y}}function n9($,Z){let X=X0($,Z)??X0(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...X5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function IG($,Z,X){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,q]=Q;try{let U=q.trim().replace(/;$/,""),W=n9(U,Z);if(W!==void 0)Z[G]=W}catch(U){console.warn(`Failed to parse export ${G} in fallback:`,U)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,q]=Q;if(!(G in Z))try{let U=q.trim().replace(/;$/,""),W=n9(U,Z);if(W!==void 0)Z[G]=W}catch{}}}function kG($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:J}}function EG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var T5=new O1(500),T$=new O1(1000),N4=new O1(2000),yG=0;function SG($){let Z=new WeakSet;try{let X=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(X);let Y={};for(let Q of Object.keys(J).sort())Y[Q]=X(J[Q]);return Y};return JSON.stringify(X($))}catch{return null}}function Z8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function CG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function N1($){return!CG($)}var M$=new Map;function D4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=M$.get(Z);if(X)return X;if(M$.size>=16)M$.clear();let J=new Bun.Transpiler($);return M$.set(Z,J),J}function A1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let X=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`});let Y=D4({loader:"ts",target:"browser",define:e1()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)Y=Y.replace(`"__STX_EXPR_${Q}__"`,X[Q]),Y=Y.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return Y}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function PG($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(K)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===K){Y++;return}Y++}},q=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let K=1;while(Y<Q&&K>0)if($[Y]==="{")K++,Y++;else if($[Y]==="}")K--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")q();else Y++;continue}Y++}},U=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3668
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let K=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let V=_.trim().split(":");return V[V.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(U())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))W();Y++}return Z}function vG($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function fG($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function xG($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let U=$[J];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let U of vG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let K=fG(W);if(K===-1)continue;let z=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=W.slice(K+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[z]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function R$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(V)=>V.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),q=(V)=>V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let V of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(V))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],K=typeof Y.root==="string"?g.resolve(Y.root):void 0,z=K??g.dirname(J),H=[],B=(V)=>{if(V&&!H.includes(V))H.push(V)},j=X.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));B(Z),B(Y._rootComponentsDir),B(g.join(g.dirname(J),"components")),B(Y.componentsDir);let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let V of _)B(typeof V==="string"?V:null);if(K)B(g.resolve(K,"resources/views/components")),B(g.resolve(K,"resources/components")),B(g.resolve(K,"src/components")),B(g.resolve(K,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return r(g.resolve(g.dirname(J),`${Q}.stx`));for(let V of H){let O=g.isAbsolute(V)?V:g.resolve(z,V);for(let F of W)if(await r(g.join(O,F)))return!0}return!1}function gG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function hG($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function uG($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function T1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await a("stx/variable-extractor",()=>import("./chunk-2bkqbmkn.js")),K=q??new Set;if(K.has($))return`[Circular component reference: ${$}]`;let z=new Set(K);z.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&gG(H)?H:"";try{let j=(P)=>P.split("-").map((u)=>u.charAt(0).toUpperCase()+u.slice(1)).join(""),_=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),V=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Y.__importedComponents;if(F){let P=[V,V.toLowerCase(),j(V),_(V)];for(let u of P)if(F.has(u)){O=F.get(u);break}}let L=[];if(!O){let P=[`${V}.stx`,`${j(V)}.stx`,`${_(V)}.stx`],u=[...new Set(P)],s=Y.__originalFilePath,o=[];if(s){let J0=g.join(g.dirname(s),"components");o.push(J0)}if(J)o.push(J);let z0=G._rootComponentsDir;if(typeof z0==="string"&&!o.includes(z0))o.push(z0);let L0=g.join(g.dirname(Q),"components");if(!o.includes(L0))o.push(L0);if(G.componentsDir&&G.componentsDir!==J&&!o.includes(G.componentsDir))o.push(G.componentsDir);let Z1=G._pluginComponentDirs;if(Array.isArray(Z1)){for(let J0 of Z1)if(typeof J0==="string"&&!o.includes(J0))o.push(J0)}let b0=typeof G.root==="string"?g.resolve(G.root):void 0,D0=b0??g.dirname(Q),v0=[];if(b0)v0.push(g.resolve(b0,"resources/views/components")),v0.push(g.resolve(b0,"resources/components")),v0.push(g.resolve(b0,"src/components")),v0.push(g.resolve(b0,"components"));v0.push(g.resolve(import.meta.dir,"components"));for(let J0 of v0)if(!o.includes(J0))o.push(J0);let Y5=[...new Set(o.map((J0)=>{if(!J0)return J0;return g.isAbsolute(J0)?J0:g.resolve(D0,J0)}))];o.length=0,o.push(...Y5);let X1=`${V}\x00${Q}\x00${Y5.join("\x00")}`,i=T$.get(X1);if(i)if(await r(i))O=i;else T$.delete(X1);if(!O&&(V.startsWith("./")||V.startsWith("../")))O=g.resolve(g.dirname(Q),`${V}.stx`),L.push(O);else if(!O)for(let J0 of o){if(!J0)continue;for(let J1 of u){let j1=g.join(J0,J1);if(L.push(j1),await r(j1)){O=j1;break}}if(O)break;if(!O)try{let J1=await import("fs");if(!J1.statSync(J0,{throwIfNoEntry:!1})?.isDirectory())continue;let k5=8,y1=[{path:J0,depth:0}];while(y1.length>0&&!O){let o0=y1.pop();if(o0.depth>=k5)continue;let E5;try{E5=J1.readdirSync(o0.path,{withFileTypes:!0})}catch{continue}for(let b5 of E5){if(!b5.isDirectory())continue;if(b5.name==="node_modules"||b5.name.startsWith("."))continue;let I4=g.join(o0.path,b5.name);for(let B8 of u){let I$=g.join(I4,B8);if(L.push(I$),await r(I$)){O=I$;break}}if(O)break;y1.push({path:I4,depth:o0.depth+1})}}}catch{}if(O)break}if(O)T$.set(X1,O)}if(!O||!await r(O)){let P=L.length>0?`
|
|
3669
3669
|
Searched paths:
|
|
3670
3670
|
${L.map((u)=>` - ${u}`).join(`
|
|
3671
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(O);let w;if(T5.has(O))w=T5.get(O);else try{w=await Bun.file(O).text(),T5.set(O,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",y5,"__stx_client_signal_names","__stxServeContext"]),D={};for(let[P,u]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=p0(X),T=[],A=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let s=N.scripts[Number(u)]||"",o=s.match(/^<script\b([^>]*)>/i)?.[1]||"",z0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),L0=!z0||["module","text/javascript","application/javascript"].includes(z0);if(!/\bserver\b/i.test(o)&&L0)return T.push(s),"";return s}),{extractSlotContent:M}=await a("stx/slots",()=>import("./chunk-
|
|
3672
|
-
`)}`}if(X&&q0.includes("{{ text || slot }}"))q0=q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:B1}=await a("stx/slots",()=>import("./chunk-
|
|
3671
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(O);let w;if(T5.has(O))w=T5.get(O);else try{w=await Bun.file(O).text(),T5.set(O,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",y5,"__stx_client_signal_names","__stxServeContext"]),D={};for(let[P,u]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=p0(X),T=[],A=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let s=N.scripts[Number(u)]||"",o=s.match(/^<script\b([^>]*)>/i)?.[1]||"",z0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),L0=!z0||["module","text/javascript","application/javascript"].includes(z0);if(!/\bserver\b/i.test(o)&&L0)return T.push(s),"";return s}),{extractSlotContent:M}=await a("stx/slots",()=>import("./chunk-kmgs48jy.js")),k=M(A),I={};if(k.defaultSlot?.trim())I.default=k.defaultSlot;for(let[P,u]of k.namedSlots)I[P]=u.content;let y={...D,...Z,props:Z,slot:A,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:Q1(w)||hG(X)};xG(w,y);let E=w,b=Q$(E);if(b)E=b.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...w.matchAll(C)],f=[],n=x.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&x.every((P)=>/\bserver\b/.test(P[1]||"")),m=null,V0=null;if(n){let P=SG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){m=`${O}\x00${P}`;let u=N4.get(m);if(u){for(let s of u.dependencies)U.add(s);return u.output}V0=new Set(U)}}for(let P of x){let u=P[1]||"",s=P[2]||"",o=u.includes("server");if(N1(u)&&s.trim())s=A1(s);if(o&&s)try{await W(s,y,O)}catch(L0){}if(!o){let L0=s.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Z1=L0.includes("{{")&&L0.includes("}}"),b0=L0.includes("{!!")&&L0.includes("!!}");if(Z1||b0)L0=S$(L0,y);let D0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");f.push(`<script${D0}>${L0}</script>`)}}let M0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T0=M0?M0[1]:"",h0=M0?M0[2]:"",t="",K0=T0&&/\bscoped\b/i.test(T0);if(M0)t=`<style${T0}>${h0}</style>`;let q0=E;if(q0=q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),M0)q0=q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(q0=q0.replace(P,(s,o)=>{let z0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(z0)u.push(`<style${z0[1]}>${z0[2]}</style>`);return""}),q0=q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)t=`${t}${u.join(`
|
|
3672
|
+
`)}`}if(X&&q0.includes("{{ text || slot }}"))q0=q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:B1}=await a("stx/slots",()=>import("./chunk-kmgs48jy.js")),{defaultSlot:J5,namedSlots:p}=k;q0=await B1(q0,J5,p,y);let e=f.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),Y0=uG(f),I0=Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[];if(Y0.length>0||I0.length>0)y.__stx_client_signal_names=[...new Set([...I0,...Y0])];let F0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:e||f.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let P0=await w4(q0,y,O,F0,U),S=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let P of P0.matchAll(/\{\{([\s\S]*?)\}\}/g))S.add(P[1].trim());if(S.size>0)Y.__stx_preserved_client_expressions=[...S];let v=`stx_${V.replace(/[^a-zA-Z0-9]/g,"_")}_${++yG}_${Math.random().toString(36).slice(2,8)}`,d=P0;if(e){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${Z8(JSON.stringify(Z))}"`}catch{}let u=B?` stx-hydrate="${Z8(B)}"`:"";d=`<div data-stx-scope="${v}"${P}${u}>${P0}</div>`;let s=await Promise.all(f.map(async(o)=>{let z0=o.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!z0)return o;let[,L0,Z1]=z0,b0=M4(Z1,{filePath:O,projectRoot:process.cwd()}),D0=b0.code,v0=T4(b0.styles);D0=R5(D0).code;let{hasUserImports:Y5,bundleClientScript:X1}=await a("stx/client-script-bundler",()=>import("./chunk-2kjp90p2.js"));if(Y5(D0))D0=await X1(D0,O,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:i}=await a("stx/signal-processing",()=>import("./chunk-mpt8ed9w.js"));D0=D0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(o0,E5)=>i(E5));let J0=r0(D0),J1=PG(J0),j1=`function(__scopeId) {
|
|
3673
3673
|
${l1("const",[...X8,...J1],J0)}
|
|
3674
3674
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3675
3675
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -3706,7 +3706,7 @@ finally {
|
|
|
3706
3706
|
`+s.join(`
|
|
3707
3707
|
`),y.__stx_event_bindings=[]}}if(K0){let P=K$(d,O);if(P.hasScoped)d=P.html}if(m&&V0)N4.set(m,{output:d,dependencies:[...U].filter((P)=>!V0.has(P))});return T.length>0?`${d}
|
|
3708
3708
|
${T.join(`
|
|
3709
|
-
`)}`:d}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{K.delete($)}}async function r($){return Bun.file($).exists()}function A4($,Z){let X=g.resolve(Z),J=g.resolve($),Y=X.endsWith(g.sep)?X:X+g.sep;if(J===X||J.startsWith(Y))return J;return null}async function
|
|
3709
|
+
`)}`:d}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{K.delete($)}}async function r($){return Bun.file($).exists()}function A4($,Z){let X=g.resolve(Z),J=g.resolve($),Y=X.endsWith(g.sep)?X:X+g.sep;if(J===X||J.startsWith(Y))return J;return null}async function dG($,Z,X,J){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=g.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await r(G)){if(J)console.log(`Found layout in ${$}: ${G}`);return X?.add(G),G}return null}async function r5($,Z,X,J){let Y=await mG($,Z,X,J);if(Y===null)return null;let Q=A4(Y,process.cwd());if(Q)return Q;let G=[X.root,X.layoutsDir,X.fallbackLayoutsDir,X.componentsDir,X.partialsDir,X.pagesDir].filter((q)=>typeof q==="string"&&q.length>0);for(let q of G){let U=g.isAbsolute(q)?q:g.resolve(process.cwd(),q);if(A4(Y,U))return g.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function mG($,Z,X,J){if(X.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=g.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=g.join(Q,$),B=A4(H,Q);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(X.debug)console.log(`Checking absolute path: ${B}`);if(await r(B)&&J)J.add(B);return B}let G=g.join(Y,$);if(await r(G)){if(X.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let H of[".stx",".tsx",".jsx"]){let B=`${G}${H}`;if(await r(B)){if(X.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let q=[];if(X.layoutsDir)q.push(g.isAbsolute(X.layoutsDir)?X.layoutsDir:g.resolve(process.cwd(),X.layoutsDir));let U=g.resolve(Y),W=process.cwd();for(let H=0;H<10;H++){let B=g.join(U,"layouts"),j=!1;try{j=bG.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){q.push(B);break}let _=g.dirname(U);if(_===U||_.length<W.length)break;U=_}for(let H of q){let B=await dG(H,$,J,X.debug);if(B)return B}if(X.fallbackLayoutsDir){let H=g.isAbsolute(X.fallbackLayoutsDir)?X.fallbackLayoutsDir:g.resolve(process.cwd(),X.fallbackLayoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=[g.join(H,B)];if(!$.endsWith(".stx"))j.push(`${j[0]}.stx`);for(let _ of j)if(await r(_)){if(X.debug)console.log(`Found in options.fallbackLayoutsDir: ${_}`);if(J)J.add(_);return _}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),B=g.join(X.partialsDir||Y,"layouts",H[1]);if(await r(B)){if(X.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await r(j)){if(X.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(X.partialsDir){let H=g.join(X.partialsDir,"layouts");if(await r(H)){let B=g.join(H,$);if(await r(B)){if(X.debug)console.log(`Found in partials layouts dir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await r(j)){if(X.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}}let K=X.partialsDir||g.join(process.cwd(),"views"),z=g.join(K,$);if(await r(z)){if(X.debug)console.log(`Found in views path: ${z}`);if(J)J.add(z);return z}if(!$.endsWith(".stx")){let H=`${z}.stx`;if(await r(H)){if(X.debug)console.log(`Found in views path with extension: ${H}`);if(J)J.add(H);return H}}if(Y.includes("temp")){let H=g.join(g.dirname(Y),"layouts",$);if(await r(H)){if(X.debug)console.log(`Found in temp layouts dir: ${H}`);if(J)J.add(H);return H}if(!$.endsWith(".stx")){let B=`${H}.stx`;if(await r(B)){if(X.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(X.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function J8($,Z,X){let J=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
3710
3710
|
`),q=0;for(let U=0;U<G.length;U++)if(q+=G[U].length+1,q>=Z){J=U+1,Y=G[U].trim();let W=Math.max(0,U-2),K=Math.min(G.length,U+3);Q=G.slice(W,K).map((z,H)=>{let B=W+H+1;return`${B===J?"> ":" "}${B}: ${z}`}).join(`
|
|
3711
3711
|
`);break}}else if(X){let G=$.indexOf(X);if(G>=0)return J8($,G)}}catch{}return{lineNumber:J,lineContent:Y,context:Q}}var Z0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function W0($,Z,X,J,Y,Q){let{lineNumber:G,context:q}=J8(J,Y,Q),U=X.split("/").pop(),W=0;if(typeof Y==="number"&&Y>=0&&J){let z=J.lastIndexOf(`
|
|
3712
3712
|
`,Math.max(0,Y-1));W=Y-(z+1)+1}let K="";if(G>0)K+=`
|
|
@@ -3721,18 +3721,18 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
|
|
|
3721
3721
|
`,q)K+=`
|
|
3722
3722
|
${Z0.blue}${Z0.bold}Context:${Z0.reset}
|
|
3723
3723
|
${Z0.dim}${q}${Z0.reset}
|
|
3724
|
-
`;return K}function
|
|
3724
|
+
`;return K}function p_(){T5.clear(),T$.clear(),N4.clear()}function i_(){return{size:T5.size,maxSize:500}}var lG=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function cG($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let X=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!X)return null;return{pkg:X[1],subpath:X[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function pG($,Z){let X=Z;while(!0){let J=b1.join(X,"node_modules",$,"package.json");if(I5.existsSync(J))return b1.dirname(J);let Y=b1.dirname(X);if(Y===X)return null;X=Y}}function iG($,Z){if(!$||typeof $!=="object")return null;let X=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return X(Y.import);if(typeof Y.default==="object")return X(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return X($[Z]);let J=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),q=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(q))continue;if(Z.length<G.length+q.length)continue;if(!J||G.length>J.prefix.length)J={pattern:Y,prefix:G,suffix:q}}if(J){let Y=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=X($[J.pattern]);if(Q)return Q.replace("*",Y)}return null}function nG($,Z){let X=cG($);if(!X||!X.subpath)return null;let J=pG(X.pkg,Z);if(!J)return null;let Y;try{Y=JSON.parse(I5.readFileSync(b1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${X.subpath}`,G=iG(Y.exports,Q);if(!G)return null;let q=b1.resolve(J,G);return I5.existsSync(q)?q:null}function M4($,Z){let X=Z.filePath?b1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Y=new Set,Q=[];return{code:$.replace(lG,(q,U)=>{let W;try{if(U.startsWith("./")||U.startsWith("../")||U.startsWith("/")){if(W=U.startsWith("/")?U:b1.resolve(X,U),!I5.existsSync(W))throw Error(`file not found: ${W}`)}else{let K=null;try{K=Bun.resolveSync(U,J)}catch{K=nG(U,J)}if(!K)throw Error(`could not resolve ${U} (Bun.resolveSync + exports fallback both failed)`);W=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(U)} (from ${Z.filePath||"<unknown>"}): ${K?.message||K}`),""}if(Y.has(W))return"";Y.add(W);try{let K=I5.readFileSync(W,"utf8");Q.push({source:U,resolvedPath:W,contents:K})}catch(K){console.warn(`[stx:vendor-css] could not read ${W}: ${K?.message||K}`)}return""}),styles:Q}}function sG($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function T4($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${sG(Z.source)}" data-stx-layer="vendor">
|
|
3725
3725
|
@layer vendor {
|
|
3726
3726
|
${Z.contents}
|
|
3727
3727
|
}
|
|
3728
3728
|
</style>`}).join(`
|
|
3729
3729
|
`)}
|
|
3730
|
-
`}var
|
|
3730
|
+
`}var oG=q8,W8=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];function R5($){let Z=i0($),X=new Set;for(let q of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let U of q[1].split(",")){let W=U.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)X.add(W)}let J=new Set;for(let q of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(q[1]);for(let q of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let U of q[1].split(",")){let W=U.trim().split(/[:=]/).pop()?.trim();if(W)J.add(W)}let Y=W8.filter((q)=>{if(X.has(q)||J.has(q))return!1;return new RegExp(`\\b${q}\\s*\\(`).test(Z)}),Q=K8(Z).filter((q)=>!X.has(q)&&!J.has(q));if(Y.length===0&&Q.length===0)return{code:$,imports:Y,models:Q};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
3731
3731
|
`)}
|
|
3732
|
-
${$}`,imports:Y,models:Q}}var
|
|
3732
|
+
${$}`,imports:Y,models:Q}}var rG=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function K8($){let Z=new Set,X=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=X.exec($))!==null)if(!rG.has(J[1]))Z.add(J[1]);return Array.from(Z)}function aG($){let Z=new Set;for(let X of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(X[1]);for(let X of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of X[1].split(",")){let Y=J.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function z8($){let Z=new Set,X=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Y=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let W=G[1],K=G[2];if(G[0].includes("import type"))continue;let z=[];for(let B of W.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let _=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let V=_[1],O=_[2]||V;if(Y.add(V),Y.add(O),K==="stx"||K==="@stacksjs/stx")Z.add(V);else X.add(V);if(O!==V)z.push(`${O} = ${V}`)}let H=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(G[0],H)}let q=aG(J);for(let W of oG){if(Y.has(W)||q.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))Z.add(W)}for(let W of W8){if(Y.has(W)||q.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(J))X.add(W)}let U=K8(J);for(let W of U)if(!Y.has(W)&&!q.has(W))X.add(W);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(X)}}function H8($,Z){let X=[];if($.length>0)X.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)X.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(X.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
3733
3733
|
${X.join(`
|
|
3734
3734
|
`)}
|
|
3735
|
-
${
|
|
3735
|
+
${tG($,Z)}`;return""}function qO($,Z=[]){let{browserImports:X}=z8($),J=new Set(Z);return H8([],X.filter((Y)=>!J.has(Y)))}function tG($,Z){let X=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(X.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
3736
3736
|
[${X.join(", ")}].forEach(function (e) {
|
|
3737
3737
|
if (e[1] !== 'undefined') return;
|
|
3738
3738
|
console.error(
|
|
@@ -3741,10 +3741,10 @@ ${aG($,Z)}`;return""}function GO($,Z=[]){let{browserImports:X}=z8($),J=new Set(Z
|
|
|
3741
3741
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
3742
3742
|
);
|
|
3743
3743
|
});
|
|
3744
|
-
`}function N$($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let J={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;J[Y]=Q}return J.__stxDeclaredPayload=!0,J}let X={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let Y=$[J];if(typeof Y==="function")continue;X[J]=Y}return X}function Y8($,Z){let X=new Set;for(let J of $.split(",")){let Y=J.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(Z){let Q=Y.lastIndexOf(":");if(Q!==-1)Y=Y.slice(Q+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))X.add(Y)}return X}function
|
|
3744
|
+
`}function N$($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let J={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;J[Y]=Q}return J.__stxDeclaredPayload=!0,J}let X={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let Y=$[J];if(typeof Y==="function")continue;X[J]=Y}return X}function Y8($,Z){let X=new Set;for(let J of $.split(",")){let Y=J.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(Z){let Q=Y.lastIndexOf(":");if(Q!==-1)Y=Y.slice(Q+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))X.add(Y)}return X}function eG($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(Y8(X[1],!0).has(Z))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Y8(X[1],!1).has(Z))return!0;return!1}function $q($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var Zq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Q8=new Set;function Xq($,Z){let X=Zq.test($),J=Z.length>32768;if(!X&&!J)return;if(Q8.has($))return;if(Q8.add($),X)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(J)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function a3($,Z){if(!Z)return"";let X=i0($),J=Z.__stxDeclaredPayload===!0,Y=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!J&&!$q(X,Q))continue;if(eG($,Q))continue;let q;try{q=JSON.stringify(G)}catch{continue}if(q===void 0)continue;Xq(Q,q),Y.push(` var ${Q} = ${q.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
3745
3745
|
${Y.join(`
|
|
3746
3746
|
`)}
|
|
3747
|
-
`}var
|
|
3747
|
+
`}var Jq={left:0,middle:1,right:2};function Yq($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let X of $.systemKeys)Z.push(`if (!$event.${X}Key) return`);if($.keys.length>0){let X=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${X})) return`)}if($.mouse!==null){let X=Jq[$.mouse];Z.push(`if ($event.button !== ${X}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Qq($,Z){let{elementId:X,event:J,modifiers:Y}=$,Q=k$($.handler),G=Yq(Y),q=[];if(Y.once)q.push("once: true");if(Y.capture)q.push("capture: true");if(Y.passive)q.push("passive: true");let U=q.length>0?`, { ${q.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
|
|
3748
3748
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
3749
3749
|
};`;function H(B){if(/\$emit\s*\(/.test(B))return`${z}
|
|
3750
3750
|
${B}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
@@ -3787,11 +3787,11 @@ else {
|
|
|
3787
3787
|
else {
|
|
3788
3788
|
${Q}
|
|
3789
3789
|
}
|
|
3790
|
-
}${U})`}function
|
|
3790
|
+
}${U})`}function Gq($){if($.length===0)return"";return`
|
|
3791
3791
|
// STX: auto-generated event bindings
|
|
3792
|
-
${$.map((X,J)=>
|
|
3792
|
+
${$.map((X,J)=>Qq(X,J)).join(`
|
|
3793
3793
|
`)}`}function G8($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let q=J[G];if(q==="'"||q==='"'||q==="`"){let U=q;if(G++,U==="`"){let W=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&W===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){W++,G+=2;continue}if(J[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===U){G++;break}G++}continue}if(q==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
|
|
3794
|
-
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let K=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=K[0].length;continue}let z=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let H=z[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=z[0].length;continue}}G++}return Z}var
|
|
3794
|
+
`)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let K=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=K[0].length;continue}let z=U.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let H=z[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=z[0].length;continue}}G++}return Z}var qq=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function Uq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!qq.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=K.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function A$($,Z={}){let X=$,J="",Y=!1,Q=[],G=M4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=T4(G.styles),U=R5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:K}=await a("stx/client-script-bundler",()=>import("./chunk-2kjp90p2.js"));if(W(X))X=await K(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let F=z8(X);X=F.code,J=H8(F.stxImports,F.browserImports.filter((L)=>!Q.includes(L)))}if(J=`${a3(X,Z.serverData)}${J}`,X=r0(X),!Y&&N1(Z.attrs||""))X=A1(X);let z=Gq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let F=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${F?` ${F}`:""}`;return`${q}<script ${L}>
|
|
3795
3795
|
${n1(`${J}${X}
|
|
3796
3796
|
${z}`)}
|
|
3797
3797
|
</script>`}let j=U8($),_=/function __stx_setup_/.test(X),V=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function O(F){let L=F.length>0?`
|
|
@@ -3800,10 +3800,10 @@ window.stx.mount(function() {
|
|
|
3800
3800
|
'use strict';
|
|
3801
3801
|
${n1(`${J}${X}
|
|
3802
3802
|
${z}${L}`)}
|
|
3803
|
-
})</script>`}if(!V&&!_){if(j)return O(G8($));if(Z.templateContent){let F=G8($);if(F.length>0){let L=
|
|
3803
|
+
})</script>`}if(!V&&!_){if(j)return O(G8($));if(Z.templateContent){let F=G8($);if(F.length>0){let L=Uq(Z.templateContent);if(F.some((R)=>L.has(R)))return O(F)}}}return`${q}<script data-stx-scoped data-stx-run="always">
|
|
3804
3804
|
;(function() {
|
|
3805
3805
|
'use strict';
|
|
3806
3806
|
${n1(`${J}${X}
|
|
3807
3807
|
${z}`)}
|
|
3808
3808
|
})()</script>`}
|
|
3809
|
-
export{t8 as dl,e8 as el,$Z as fl,a0 as gl,f$ as hl,x$ as il,g$ as jl,h$ as kl,O7 as ll,_7 as ml,UZ as nl,KZ as ol,HZ as pl,
|
|
3809
|
+
export{t8 as dl,e8 as el,$Z as fl,a0 as gl,f$ as hl,x$ as il,g$ as jl,h$ as kl,O7 as ll,_7 as ml,UZ as nl,KZ as ol,HZ as pl,nq as ql,sq as rl,oq as sl,rq as tl,aq as ul,r8 as vl,z7 as wl,H7 as xl,B7 as yl,j7 as zl,pq as Al,A7 as Bl,W5 as Cl,k$ as Dl,E$ as El,F8 as Fl,P4 as Gl,Kq as Hl,r0 as Il,Hq as Jl,e1 as Kl,Yj as Ll,M4 as Ml,T4 as Nl,oG as Ol,R5 as Pl,H8 as Ql,qO as Rl,N$ as Sl,a3 as Tl,A$ as Ul,Q0 as Vl,_0 as Wl,G0 as Xl,Vq as Yl,v5 as Zl,Fq as _l,Lq as $l,wq as am,Rq as bm,Y1 as cm,Q5 as dm,x5 as em,E8 as fm,Eq as gm,b8 as hm,bq as im,y$ as jm,t4 as km,Q1 as lm,S$ as mm,C8 as nm,yq as om,_1 as pm,P8 as qm,y0 as rm,Sq as sm,X7 as tm,xq as um,l8 as vm,c8 as wm,U7 as xm,W7 as ym,K7 as zm,lq as Am,V7 as Bm,U1 as Cm,nZ as Dm,sZ as Em,oZ as Fm,rZ as Gm,s7 as Hm,aZ as Im,l as Jm,t$ as Km,H5 as Lm,B5 as Mm,c5 as Nm,eZ as Om,p5 as Pm,$X as Qm,i5 as Rm,F1 as Sm,r7 as Tm,L1 as Um,a7 as Vm,t7 as Wm,n5 as Xm,e$ as Ym,$0 as Zm,GX as _m,qX as $m,UX as an,h1 as bn,$3 as cn,Z3 as dn,d0 as en,X3 as fn,Y3 as gn,s5 as hn,KX as in,zX as jn,HX as kn,Z6 as ln,Z$ as mn,H0 as nn,L6 as on,B3 as pn,W1 as qn,w1 as rn,w6 as sn,_5 as tn,X$ as un,j3 as vn,dX as wn,lX as xn,N6 as yn,pX as zn,iX as An,M6 as Bn,R1 as Cn,RK as Dn,T6 as En,w3 as Fn,aX as Gn,L3 as Hn,tX as In,eX as Jn,DK as Kn,NK as Ln,I6 as Mn,k6 as Nn,E6 as On,$J as Pn,ZJ as Qn,AK as Rn,MK as Sn,XJ as Tn,TK as Un,IK as Vn,S6 as Wn,f6 as Xn,N3 as Yn,gK as Zn,F5 as _n,A3 as $n,M3 as ao,hK as bo,FJ as co,uK as do,LJ as eo,h6 as fo,dK as go,wJ as ho,mK as io,lK as jo,y3 as ko,sK as lo,oK as mo,rK as no,aK as oo,tK as po,NJ as qo,eK as ro,Y$ as so,AJ as to,$z as uo,Zz as vo,Xz as wo,Jz as xo,bJ as yo,SJ as zo,cJ as Ao,b3 as Bo,l6 as Co,Yz as Do,Q$ as Eo,kQ as Fo,gQ as Go,mQ as Ho,_4 as Io,o9 as Jo,OG as Ko,VG as Lo,FG as Mo,LG as No,wG as Oo,r9 as Po,AG as Qo,kG as Ro,EG as So,X2 as To,J2 as Uo,Vz as Vo,s6 as Wo,Fz as Xo,P3 as Yo,v3 as Zo,f3 as _o,q2 as $o,U2 as ap,W2 as bp,J6 as cp,Y6 as dp,Q6 as ep,G6 as fp,Q3 as gp,G3 as hp,OW as ip,VW as jp,FW as kp,jX as lp,LW as mp,dz as np,mz as op,z2 as pp,lz as qp,j2 as rp,OY as sp,O2 as tp,w2 as up,M2 as vp,K$ as wp,XH as xp,JH as yp,l3 as zp,T2 as Ap,I2 as Bp,nY as Cp,QH as Dp,GH as Ep,sY as Fp,qH as Gp,k2 as Hp,E2 as Ip,H$ as Jp,B$ as Kp,i1 as Lp,rY as Mp,y2 as Np,S2 as Op,C2 as Pp,aY as Qp,tY as Rp,c3 as Sp,p3 as Tp,P2 as Up,v2 as Vp,x2 as Wp,VH as Xp,d2 as Yp,XQ as Zp,QQ as _p,a2 as $p,t3 as aq,t2 as bq,$9 as cq,Z9 as dq,_Q as eq,OQ as fq,X9 as gq,o3 as hq,VQ as iq,O4 as jq,V4 as kq,L4 as lq,w4 as mq,YG as nq,WG as oq,KG as pq,zG as qq,HG as rq,CG as sq,N1 as tq,D4 as uq,A1 as vq,R$ as wq,gG as xq,hG as yq,uG as zq,T1 as Aq,r as Bq,r5 as Cq,J8 as Dq,W0 as Eq,p_ as Fq,i_ as Gq,M7 as Hq,T7 as Iq,V1 as Jq,I7 as Kq,f1 as Lq,k7 as Mq,K5 as Nq,zU as Oq,MZ as Pq,d$ as Qq,HU as Rq,m$ as Sq,BU as Tq,jU as Uq,q1 as Vq,_U as Wq,OU as Xq,VU as Yq,FU as Zq,LU as _q,wU as $q,TZ as ar,c$ as br,E7 as cr,DU as dr,NU as er,AU as fr,MU as gr,TU as hr,y7 as ir,IU as jr,S7 as kr,kU as lr,EU as mr,z5 as nr,SZ as or,CU as pr,PZ as qr,g7 as rr,m5 as sr,hU as tr,p7 as ur,a$ as vr,MW as wr,U3 as xr,wX as yr,AX as zr,TW as Ar,IW as Br,kW as Cr,EW as Dr,bW as Er,yW as Fr,MX as Gr,TX as Hr,q6 as Ir,O6 as Jr,bX as Kr,K3 as Lr,V6 as Mr,nW as Nr,sW as Or,H3 as Pr,fX as Qr,F6 as Rr};
|