@stacksjs/stx 0.2.284 → 0.2.286
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-x11dh3a3.js → chunk-2q630fj4.js} +1 -1
- package/dist/{chunk-0h7ty10c.js → chunk-3ehv1by2.js} +1 -1
- package/dist/{chunk-qccdz9t1.js → chunk-4cqgbcy7.js} +170 -170
- package/dist/{chunk-a95mf15m.js → chunk-56ywtaff.js} +1 -1
- package/dist/{chunk-ef5663vk.js → chunk-61sj52qh.js} +1 -1
- package/dist/{chunk-pmw28376.js → chunk-6cye5m9f.js} +1 -1
- package/dist/{chunk-mx8k7bwh.js → chunk-7ej1d910.js} +1 -1
- package/dist/{chunk-r5fp0bse.js → chunk-829pcte9.js} +1 -1
- package/dist/{chunk-crmgatrx.js → chunk-8emkx9ja.js} +1 -1
- package/dist/{chunk-5k3qb1am.js → chunk-9th1wd1d.js} +3 -3
- package/dist/{chunk-50mpsfpx.js → chunk-ah4e6e09.js} +1 -1
- package/dist/{chunk-1rcn9yfj.js → chunk-ajbfeey7.js} +1 -1
- package/dist/{chunk-7etzqabz.js → chunk-an2539bs.js} +1 -1
- package/dist/{chunk-s5ttqj6h.js → chunk-b7tjq91c.js} +1 -1
- package/dist/{chunk-vckr41zn.js → chunk-e2w23g2r.js} +8 -8
- package/dist/{chunk-7n45tcyf.js → chunk-e4akvata.js} +1 -1
- package/dist/{chunk-mrbw9vts.js → chunk-f4k2a7vs.js} +1 -1
- package/dist/{chunk-gn9q45yp.js → chunk-hs0387tm.js} +1 -1
- package/dist/{chunk-cvhyxt55.js → chunk-j9g11dzx.js} +1 -1
- package/dist/{chunk-se360fvh.js → chunk-jbfpc4z7.js} +1 -1
- package/dist/{chunk-zkzmxy32.js → chunk-jg0axas8.js} +1 -1
- package/dist/{chunk-sb7k89hq.js → chunk-jrk8rhwt.js} +1 -1
- package/dist/{chunk-ffqddern.js → chunk-kawk5ve9.js} +1 -1
- package/dist/{chunk-f16kkw9v.js → chunk-kmhr1z0m.js} +1 -1
- package/dist/chunk-m3yaa0v5.js +15 -0
- package/dist/{chunk-fxyrvwqw.js → chunk-m7xnzt2t.js} +1 -1
- package/dist/{chunk-sw16pkqg.js → chunk-mkn6qqc7.js} +1 -1
- package/dist/{chunk-822x6vhb.js → chunk-n3jyv9z6.js} +1 -1
- package/dist/{chunk-k4qx7jbk.js → chunk-nh21517m.js} +1 -1
- package/dist/{chunk-1a8e5xpf.js → chunk-qbeffw17.js} +1 -1
- package/dist/{chunk-w4eykv3z.js → chunk-qk8tbcwk.js} +1 -1
- package/dist/{chunk-x0zv8dt4.js → chunk-qsr3bqav.js} +1 -1
- package/dist/{chunk-abydddye.js → chunk-rhs51nmz.js} +2 -2
- package/dist/{chunk-e9nmf863.js → chunk-s7pc68jf.js} +1 -1
- package/dist/{chunk-3828z7q8.js → chunk-vb10qph4.js} +1 -1
- package/dist/{chunk-vhsrgtcg.js → chunk-vy8v5xdb.js} +1 -1
- package/dist/{chunk-jt4gqtag.js → chunk-w0sqz3cb.js} +1 -1
- package/dist/{chunk-5v6atbsr.js → chunk-w8smn72c.js} +1 -1
- package/dist/{chunk-s5y267vs.js → chunk-wxk2pbrh.js} +1 -1
- package/dist/{chunk-gp3s8020.js → chunk-x1nw1p8z.js} +1 -1
- package/dist/{chunk-9x4jejq0.js → chunk-xg57nax9.js} +1 -1
- package/dist/{chunk-gzxbnyde.js → chunk-xz55q3gr.js} +1 -1
- package/dist/{chunk-9236skjs.js → chunk-y8n174xq.js} +2 -2
- package/dist/cli.js +7 -7
- package/dist/client-script-bundler.js +35 -27
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/dev-server/ts-css.js +4 -2
- package/dist/import-rebase.d.ts +16 -0
- package/dist/import-rebase.js +16 -0
- package/dist/process.js +5 -2
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-4ds1cmgq.js +0 -15
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ar as R2,Dr as
|
|
2
|
+
import{Ar as R2,Dr as x6,Fr as J0,Hs as a3,Is as t3,Jr as D2,Kr as g6,Mr as s0,Nr as h6,Ur as g4,Vr as e,Wr as z0,Xr as I0,Yr as Q9,Zr as U0,_r as Z9,pr as X0,rr as e2,tr as $9,ts as u6,xs as d6}from"./chunk-q68xmak4.js";import{Os as d2}from"./chunk-c0an64km.js";import{Ws as l0}from"./chunk-52mh63sp.js";import{Xs as g1,Ys as v1,Zs as l6,_s as e1,at as M1,bt as U8,ct as W8,rt as c6}from"./chunk-9th1wd1d.js";import{st as e3,ut as $4,vt as Z4,xt as K2}from"./chunk-39f40yc4.js";import{yt as a7}from"./chunk-ysnk7x79.js";import{Bt as p6,Ft as l2,Ht as Z8}from"./chunk-0f1kz0x2.js";import{St as i6}from"./chunk-ayrjwkyw.js";import{$t as y$,Tt as o$,Ut as L8,Vt as K8,Wt as x1,_t as O8,au as h7,cu as r4,fu as w6}from"./chunk-c6fw33zh.js";import{Qu as m6,Su as AQ,Tu as m9,Vu as Q2,pu as u5,su as k7,zu as I5}from"./chunk-bf8wf3r2.js";import{_u as X4}from"./chunk-jn6m8zf7.js";import{dv as u}from"./chunk-sskbegsz.js";import I1 from"path";import A2 from"fs";var T$=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"]),E$={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"},A8=new Set(["ctrl","alt","shift","meta"]),C$={left:0,middle:1,right:2};function b$($){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(A8.has(J))Z.systemKeys.push(J);else if(J in C$)Z.mouse=J;else if(J in E$||/^[a-z]$/.test(J))Z.keys.push(E$[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 S$($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,z]=Y,q=Y.index,K=q+Q.length,U=`__stx_evt_${X++}`,W=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(z))!==null){let[,_,O]=j,V=_.split("."),L=V[0];if(!T$.has(L))continue;W.push({attribute:`@${_}`,event:L,handler:O,modifiers:b$(V.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,_,O]=j,V=_.split("."),L=V[0];if(!T$.has(L))continue;W.push({attribute:`@${_}`,event:L,handler:O,modifiers:b$(V.slice(1)),elementId:U})}if(W.length>0)Z.push({originalTag:Q,elementId:U,events:W,startIndex:q,endIndex:K})}return Z}function M8($){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=C$[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 k8($,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 E9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function I8($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=M8($),Y=k8(E9($.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(", ")} }`:"",z=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;
|
|
@@ -108,13 +108,13 @@ else {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
// Event listeners
|
|
111
|
-
${$.map(
|
|
111
|
+
${$.map(I8).join(`
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
|
-
</script>`}function
|
|
115
|
-
`+Y.slice(G);else Y+=Q;return Y}function
|
|
114
|
+
</script>`}function T8($){let Z=S$($);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 z=G.match(/id=["']([^"']+)["']/);if(z)for(let q of Q.events)q.elementId=z[1]}for(let z of Q.events){let q=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(K,""),G=G.replace(U,"")}X=X.slice(0,Q.startIndex)+G+X.slice(Q.endIndex),J.push(...Q.events)}return{template:X,bindings:J}}function P$($,Z,X){if(y$($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:z,bindings:q}=T8($),K=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...K,...q],z}let J=S$($);if(J.length===0)return $;let Y=$;for(let z=J.length-1;z>=0;z--){let q=J[z],K=q.originalTag;if(!K.includes(" id="))K=K.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let U=K.match(/id=["']([^"']+)["']/);if(U)for(let W of q.events)W.elementId=U[1]}for(let U of q.events){let W=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");K=K.replace(H,""),K=K.replace(j,"")}Y=Y.slice(0,q.startIndex)+K+Y.slice(q.endIndex)}let Q=b9(J.flatMap((z)=>z.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
|
|
115
|
+
`+Y.slice(G);else Y+=Q;return Y}function cG($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}function t0($){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 iG($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}import KG from"fs";import h from"path";import{createHash as E8}from"crypto";var C2="__stx_component_client_factories";function S2($){let Z=$[C2];return Z instanceof Map?Z:null}function v$($){$[C2]=new Map}function y9($,Z){let X=S2($);if(!X)return null;let J=E8("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 f$($,Z){let X=S2(Z);if(!X?.size)return $;let J=$;for(let[q,K]of X){if(K.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(U,(W,H)=>`(${K.body})(${H});`)}let Y=[...X].filter(([,q])=>q.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(([q,K])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${K.body}; }
|
|
@@ -123,7 +123,7 @@ ${Y.map(([q,K])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.str
|
|
|
123
123
|
})();
|
|
124
124
|
</script>`,z=J.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(z<0)return`${G}
|
|
125
125
|
${J}`;return`${J.slice(0,z)}${G}
|
|
126
|
-
${J.slice(z)}`}function f$($){let Z=S2($),X=new Map;if(Z)for(let[J,Y]of Z)X.set(J,Y.instances);return X}function x$($,Z){let X=S2($);if(!X)return[];let J=[];for(let[Y,Q]of X){let G=Q.instances-(Z.get(Y)??0);if(G>0)J.push({body:Q.body,count:G})}return J}function g$($,Z){for(let{body:X,count:J}of Z)for(let Y=0;Y<J;Y++)y9($,X)}var h$=0,P2=new Map;function pG(){h$=0,P2.clear()}function v2($,Z){let X=h$++,J=`<!--__STX_${$.toUpperCase()}_${X}__-->`;return P2.set(J,{type:$,expression:Z}),J}function iG(){let $={};for(let[Z,X]of P2)$[Z]={type:X.type,expression:X.expression};return $}function nG($){let Z={},X=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=J[1].toLowerCase(),G=P2.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function oG($,Z){let X=$;for(let[J,Y]of Z)X=X.split(J).join(Y);return X}function sG($){return $.includes("<!--__STX_")}var u$=/<script\b[^>]*>/iy,d$=/<\/script\s*>/ig,m$=/<style\b[^>]*>/iy,l$=/<\/style\s*>/ig;function c$($,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 X1($,Z){return c$($,Z,u$,d$)}function T1($,Z){return c$($,Z,m$,l$)}function X2($,Z){if(!$.startsWith("<!--",Z))return-1;let X=$.indexOf("-->",Z+4);if(X===-1)return-1;return X+3}function T8($,Z){if($.startsWith("<!--",Z)){let X=X2($,Z);return X===-1?$.length:X}for(let[X,J]of[[u$,d$],[m$,l$]]){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 f2($,Z){let X=[],J=0,Y=$.length,Q=!1,G=null;while(J<Y){let z=$[J];if(Q){if(G){if(z===G)G=null}else if(z==='"'||z==="'")G=z;else if(z===">")Q=!1;J++;continue}if(z!=="<"){J++;continue}let q=Z($,J);if(q>J){X.push({start:J,end:q,token:$.slice(J,q)}),J=q;continue}let K=T8($,J);if(K>J){J=K;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return X}function i0($,Z,X){let J=f2($,Z);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((z)=>z.token),Q="",G=0;for(let z=0;z<J.length;z++){let q=J[z];Q+=$.slice(G,q.start),Q+=X(q.token,z),G=q.end}return Q+=$.slice(G),{output:Q,tokens:Y}}function n0($){let{output:Z,tokens:X}=i0($,X1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:Z,scripts:X}}function E1($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(X,J)=>Z[+J]??"")}var J2={},p$=new Map;function E8($){let Z=p$.get($);if(!Z){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${X}(?!\\w)`,"g"),p$.set($,Z)}return Z.lastIndex=0,Z}var x2={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 o$(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 q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Y?$:"";let z=String(G);return Object.entries(X).forEach(([q,K])=>{z=z.replace(E8(q),String(K))}),z},t:($,Z,X={})=>{return x2.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 b8($,Z){if($ in x2)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);J2[$]=Z}function Yz($){for(let[Z,X]of Object.entries($))b8(Z,X)}function y8(){return{...x2,...J2}}function Qz(){for(let $ of Object.keys(J2))delete J2[$]}function C9($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function o$($){return C9($).replace(/\{{2,}/g,(Z)=>C8(Z.length)).replace(/\{(?=!)/g,`{${s$}`)}var s$="⁠";function C8($){return Array.from({length:$},()=>"{").join(s$)}function J1($,Z){let{scripts:X}=n0($);for(let J of X){let Y=J.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let Q=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(n$(Q,Z))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 i$($,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 K=0;K<J.length;K++){let U=J[K];if(!Q&&U==="`"){Q=!0,G=0;continue}if(Q){if(U==="`"&&G===0){Q=!1;continue}if(U==="$"&&J[K+1]==="{"){G++,K++,Y+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Y+=U;continue}continue}Y+=U}J=Y;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=z.exec(J))!==null){let K=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!X.includes(K)&&!(K in Z))return!1}}return!0}function S8($,Z){let X=Z.__stx_serverDeclared;if(!X||X.size===0)return!1;let J=l0($);for(let Y of X)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function S9($,Z){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=v0(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=v0(Y,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),X}function P8($,Z){if(!$.includes("{"))return $;let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=v0(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=v0(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 Gz($,Z,X={}){let{output:J,scripts:Y}=n0($),Q=Y.map((G)=>{let z=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),K=G.search(/<\/script\s*>$/i);if(!z||!q||K===-1)return G;let U=z[1],W=z[2];if(/\bdata-raw\b/.test(U))return G;if(X.skipServer&&/\bserver\b/.test(U))return G;let j=`<script${P8(U,Z)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return j+W+G.slice(K);return j+S9(W,Z)+G.slice(K)});return E1(J,Q)}function B1($,Z,X){let J=$,Y=(W,H)=>{let j=T1(W,H);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(H,j))?-1:j},Q=(W,H,j,B)=>{let _=j.length,{output:O,tokens:V}=i0(W,H,(L,F)=>B(_+F));return j.push(...V),O},G=[];J=Q(J,Y,G,(W)=>`<!--__STX_STYLE_${W}__-->`);let z=[];J=Q(J,X1,z,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let q=Z?.__stx_signals_gate===!0||J1($),K=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);if(J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(W,H,j)=>{try{let B=v0(H,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,X,$,j,W)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(W,H,j)=>{try{let B=v0(H,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return v2("raw",H.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return v2("raw",H.trim());let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,X,$,j,W)}}),J=Q(J,X1,z,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),J=Q(J,Y,G,(W)=>`<!--__STX_STYLE_${W}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(W,H,j)=>{let B=H.trim();if(U.has(B))return W;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(O)?.[1],F=L&&((L in Z)||_.includes(L)),w=Boolean(L&&K.has(L)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=B.match(R),A=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let k=v0(H,Z);if(w)return W;if(q&&!i$(B,Z))return W;if(Z.__stx_buildMode==="compile"&&!q&&(k===void 0||S8(B,Z)))return v2("expr",B);return k!==void 0&&k!==null?o$(String(k)):""}catch(k){if(w)return W;if(q&&!i$(B,Z))return W;if(A)return W;let N=k instanceof Error?k.message:String(k);return j0("Expression",`Error evaluating: {{ ${B} }}: ${N}`,X,$,j,W)}}),z.length>0)J=J.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(W,H)=>z[Number(H)]??W);if(G.length>0)J=J.replace(/<!--__STX_STYLE_(\d+)__-->/g,(W,H)=>G[Number(H)]??W);return J}function v8($,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 z=J2[G]||x2[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(y8()).join(", ")}`);let q=[];if(Y.startsWith(":")){let K=Y.match(/^:([^|\s]+)/);if(K){let U=K[1].trim();try{let W=Number(U);q=[Number.isNaN(W)?U:W]}catch{q=[U]}Y=Y.substring(K[0].length).trim()}}else if(Y.startsWith("(")){let K=1,U=1;while(K>0&&U<Y.length){if(Y[U]==="(")K++;if(Y[U]===")")K--;U++}if(K===0){let W=Y.substring(1,U-1).trim();if(W)try{if(W.startsWith("{")&&W.endsWith("}"))q=[v0(`(${W})`,X,!0)];else{let H=[],j="",B=null,_=0,O=0,V=0,L=!1;for(let F=0;F<W.length;F++){let w=W[F];if(L){j+=w,L=!1;continue}if(w==="\\"){j+=w,L=!0;continue}if(B){if(j+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,j+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&_===0&&O===0&&V===0){H.push(j),j="";continue}j+=w}if(j)H.push(j);q=H.map((F)=>{let w=F.trim();return v0(w,X,!0)})}}catch{q=[W]}Y=Y.substring(U).trim()}}try{J=z(J,X,...q)}catch(K){let U=K instanceof Error?K.message:String(K);throw Error(`Error applying filter '${G}': ${U}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function f8($){let Z=!1,X="",J=0,Y=0,Q=0,G=!1;for(let z=0;z<$.length;z++){let q=$[z],K=$[z+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,X=q;else if(q===X)Z=!1,X="";continue}if(Z&&X==="`"&&q==="$"&&K==="{"){let U=1;z+=2;while(z<$.length&&U>0){if($[z]==="{")U++;else if($[z]==="}")U--;if(U>0)z++}continue}if(Z)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")Y++;else if(q==="]")Y--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&J===0&&Y===0&&Q===0){if(K==="|"){z++;continue}if(K==="="){z++;continue}return z}}return-1}function v0($,Z,X=!1){try{let J=$.trim(),Y=f8(J);if(Y>0){let Q=J.substring(0,Y).trim(),G=J.substring(Y+1).trim(),z=v0(Q,Z,!0);return v8(z,G,Z)}if(!z0(J)){if(!X)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return e(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return U0(J,Q)(...G)}catch{return e(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=x8(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 x8($,Z){let X=null;for(let Y of Z){if(Y===$)continue;let Q=g8($,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 g8($,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 z=1;z<=X.length;z++){let q=X[z-1]===J[G-1]?0:1;Q[z]=Math.min(Q[z-1]+1,Y[z]+1,Y[z-1]+q)}for(let z=0;z<=X.length;z++)Y[z]=Q[z]}return Y[X.length]}function zz($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import wQ from"fs";import A0 from"path";var P9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],r$=/<body\b([^>]*)>/gi;function Y1($){let Z=0,X,J=P9.map(()=>{return});while(Z<$.length){if(X===void 0||X!==null&&X.index<Z)r$.lastIndex=Z,X=r$.exec($);if(!X)return null;let Y=X.index,Q=-1,G=null;for(let q=0;q<P9.length;q++){let K=P9[q],U=J[q];if(U===void 0||U!==null&&U.index<Z)K.open.lastIndex=Z,U=K.open.exec($),J[q]=U;if(!U)continue;if(U.index<Y&&(Q===-1||U.index<Q))Q=U.index,G=K.close}if(Q===-1||!G)return{index:Y,tag:X[0],attrs:X[1]??""};G.lastIndex=Q;let z=G.exec($);if(!z)return null;Z=z.index+z[0].length}return null}function b1($,Z){let X=Y1($);if(!X)return $;return $.slice(0,X.index)+Z(X.tag,X.attrs)+$.slice(X.index+X.tag.length)}var a$=null;function h8($){if(!a$)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return a$}function Uz($){let Z=h8("onUpdate");if(Z)Z.updateHooks.push($)}function t$(){return`
|
|
126
|
+
${J.slice(z)}`}function x$($){let Z=S2($),X=new Map;if(Z)for(let[J,Y]of Z)X.set(J,Y.instances);return X}function g$($,Z){let X=S2($);if(!X)return[];let J=[];for(let[Y,Q]of X){let G=Q.instances-(Z.get(Y)??0);if(G>0)J.push({body:Q.body,count:G})}return J}function h$($,Z){for(let{body:X,count:J}of Z)for(let Y=0;Y<J;Y++)y9($,X)}var u$=0,P2=new Map;function rG(){u$=0,P2.clear()}function v2($,Z){let X=u$++,J=`<!--__STX_${$.toUpperCase()}_${X}__-->`;return P2.set(J,{type:$,expression:Z}),J}function aG(){let $={};for(let[Z,X]of P2)$[Z]={type:X.type,expression:X.expression};return $}function tG($){let Z={},X=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=J[1].toLowerCase(),G=P2.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function eG($,Z){let X=$;for(let[J,Y]of Z)X=X.split(J).join(Y);return X}function $z($){return $.includes("<!--__STX_")}var d$=/<script\b[^>]*>/iy,m$=/<\/script\s*>/ig,l$=/<style\b[^>]*>/iy,c$=/<\/style\s*>/ig;function p$($,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 X1($,Z){return p$($,Z,d$,m$)}function T1($,Z){return p$($,Z,l$,c$)}function X2($,Z){if(!$.startsWith("<!--",Z))return-1;let X=$.indexOf("-->",Z+4);if(X===-1)return-1;return X+3}function b8($,Z){if($.startsWith("<!--",Z)){let X=X2($,Z);return X===-1?$.length:X}for(let[X,J]of[[d$,m$],[l$,c$]]){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 f2($,Z){let X=[],J=0,Y=$.length,Q=!1,G=null;while(J<Y){let z=$[J];if(Q){if(G){if(z===G)G=null}else if(z==='"'||z==="'")G=z;else if(z===">")Q=!1;J++;continue}if(z!=="<"){J++;continue}let q=Z($,J);if(q>J){X.push({start:J,end:q,token:$.slice(J,q)}),J=q;continue}let K=b8($,J);if(K>J){J=K;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return X}function i0($,Z,X){let J=f2($,Z);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((z)=>z.token),Q="",G=0;for(let z=0;z<J.length;z++){let q=J[z];Q+=$.slice(G,q.start),Q+=X(q.token,z),G=q.end}return Q+=$.slice(G),{output:Q,tokens:Y}}function n0($){let{output:Z,tokens:X}=i0($,X1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:Z,scripts:X}}function E1($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(X,J)=>Z[+J]??"")}var J2={},i$=new Map;function y8($){let Z=i$.get($);if(!Z){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${X}(?!\\w)`,"g"),i$.set($,Z)}return Z.lastIndex=0,Z}var x2={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 s$(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 q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Y?$:"";let z=String(G);return Object.entries(X).forEach(([q,K])=>{z=z.replace(y8(q),String(K))}),z},t:($,Z,X={})=>{return x2.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 C8($,Z){if($ in x2)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);J2[$]=Z}function Kz($){for(let[Z,X]of Object.entries($))C8(Z,X)}function S8(){return{...x2,...J2}}function Uz(){for(let $ of Object.keys(J2))delete J2[$]}function C9($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function s$($){return C9($).replace(/\{{2,}/g,(Z)=>P8(Z.length)).replace(/\{(?=!)/g,`{${r$}`)}var r$="⁠";function P8($){return Array.from({length:$},()=>"{").join(r$)}function J1($,Z){let{scripts:X}=n0($);for(let J of X){let Y=J.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let Q=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(o$(Q,Z))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 n$($,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 K=0;K<J.length;K++){let U=J[K];if(!Q&&U==="`"){Q=!0,G=0;continue}if(Q){if(U==="`"&&G===0){Q=!1;continue}if(U==="$"&&J[K+1]==="{"){G++,K++,Y+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Y+=U;continue}continue}Y+=U}J=Y;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=z.exec(J))!==null){let K=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!X.includes(K)&&!(K in Z))return!1}}return!0}function v8($,Z){let X=Z.__stx_serverDeclared;if(!X||X.size===0)return!1;let J=l0($);for(let Y of X)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function S9($,Z){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=v0(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=v0(Y,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),X}function f8($,Z){if(!$.includes("{"))return $;let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=v0(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=v0(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 Wz($,Z,X={}){let{output:J,scripts:Y}=n0($),Q=Y.map((G)=>{let z=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),K=G.search(/<\/script\s*>$/i);if(!z||!q||K===-1)return G;let U=z[1],W=z[2];if(/\bdata-raw\b/.test(U))return G;if(X.skipServer&&/\bserver\b/.test(U))return G;let j=`<script${f8(U,Z)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return j+W+G.slice(K);return j+S9(W,Z)+G.slice(K)});return E1(J,Q)}function B1($,Z,X){let J=$,Y=(W,H)=>{let j=T1(W,H);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(H,j))?-1:j},Q=(W,H,j,B)=>{let _=j.length,{output:O,tokens:V}=i0(W,H,(L,F)=>B(_+F));return j.push(...V),O},G=[];J=Q(J,Y,G,(W)=>`<!--__STX_STYLE_${W}__-->`);let z=[];J=Q(J,X1,z,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let q=Z?.__stx_signals_gate===!0||J1($),K=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);if(J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(W,H,j)=>{try{let B=v0(H,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,X,$,j,W)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(W,H,j)=>{try{let B=v0(H,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return v2("raw",H.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return v2("raw",H.trim());let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,X,$,j,W)}}),J=Q(J,X1,z,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),J=Q(J,Y,G,(W)=>`<!--__STX_STYLE_${W}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(W,H,j)=>{let B=H.trim();if(U.has(B))return W;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(O)?.[1],F=L&&((L in Z)||_.includes(L)),w=Boolean(L&&K.has(L)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=B.match(R),A=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let k=v0(H,Z);if(w)return W;if(q&&!n$(B,Z))return W;if(Z.__stx_buildMode==="compile"&&!q&&(k===void 0||v8(B,Z)))return v2("expr",B);return k!==void 0&&k!==null?s$(String(k)):""}catch(k){if(w)return W;if(q&&!n$(B,Z))return W;if(A)return W;let N=k instanceof Error?k.message:String(k);return j0("Expression",`Error evaluating: {{ ${B} }}: ${N}`,X,$,j,W)}}),z.length>0)J=J.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(W,H)=>z[Number(H)]??W);if(G.length>0)J=J.replace(/<!--__STX_STYLE_(\d+)__-->/g,(W,H)=>G[Number(H)]??W);return J}function x8($,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 z=J2[G]||x2[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(S8()).join(", ")}`);let q=[];if(Y.startsWith(":")){let K=Y.match(/^:([^|\s]+)/);if(K){let U=K[1].trim();try{let W=Number(U);q=[Number.isNaN(W)?U:W]}catch{q=[U]}Y=Y.substring(K[0].length).trim()}}else if(Y.startsWith("(")){let K=1,U=1;while(K>0&&U<Y.length){if(Y[U]==="(")K++;if(Y[U]===")")K--;U++}if(K===0){let W=Y.substring(1,U-1).trim();if(W)try{if(W.startsWith("{")&&W.endsWith("}"))q=[v0(`(${W})`,X,!0)];else{let H=[],j="",B=null,_=0,O=0,V=0,L=!1;for(let F=0;F<W.length;F++){let w=W[F];if(L){j+=w,L=!1;continue}if(w==="\\"){j+=w,L=!0;continue}if(B){if(j+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,j+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&_===0&&O===0&&V===0){H.push(j),j="";continue}j+=w}if(j)H.push(j);q=H.map((F)=>{let w=F.trim();return v0(w,X,!0)})}}catch{q=[W]}Y=Y.substring(U).trim()}}try{J=z(J,X,...q)}catch(K){let U=K instanceof Error?K.message:String(K);throw Error(`Error applying filter '${G}': ${U}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function g8($){let Z=!1,X="",J=0,Y=0,Q=0,G=!1;for(let z=0;z<$.length;z++){let q=$[z],K=$[z+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,X=q;else if(q===X)Z=!1,X="";continue}if(Z&&X==="`"&&q==="$"&&K==="{"){let U=1;z+=2;while(z<$.length&&U>0){if($[z]==="{")U++;else if($[z]==="}")U--;if(U>0)z++}continue}if(Z)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")Y++;else if(q==="]")Y--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&J===0&&Y===0&&Q===0){if(K==="|"){z++;continue}if(K==="="){z++;continue}return z}}return-1}function v0($,Z,X=!1){try{let J=$.trim(),Y=g8(J);if(Y>0){let Q=J.substring(0,Y).trim(),G=J.substring(Y+1).trim(),z=v0(Q,Z,!0);return x8(z,G,Z)}if(!z0(J)){if(!X)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return e(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return U0(J,Q)(...G)}catch{return e(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=h8(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 h8($,Z){let X=null;for(let Y of Z){if(Y===$)continue;let Q=u8($,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 u8($,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 z=1;z<=X.length;z++){let q=X[z-1]===J[G-1]?0:1;Q[z]=Math.min(Q[z-1]+1,Y[z]+1,Y[z-1]+q)}for(let z=0;z<=X.length;z++)Y[z]=Q[z]}return Y[X.length]}function Hz($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import MQ from"fs";import A0 from"path";var P9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],a$=/<body\b([^>]*)>/gi;function Y1($){let Z=0,X,J=P9.map(()=>{return});while(Z<$.length){if(X===void 0||X!==null&&X.index<Z)a$.lastIndex=Z,X=a$.exec($);if(!X)return null;let Y=X.index,Q=-1,G=null;for(let q=0;q<P9.length;q++){let K=P9[q],U=J[q];if(U===void 0||U!==null&&U.index<Z)K.open.lastIndex=Z,U=K.open.exec($),J[q]=U;if(!U)continue;if(U.index<Y&&(Q===-1||U.index<Q))Q=U.index,G=K.close}if(Q===-1||!G)return{index:Y,tag:X[0],attrs:X[1]??""};G.lastIndex=Q;let z=G.exec($);if(!z)return null;Z=z.index+z[0].length}return null}function b1($,Z){let X=Y1($);if(!X)return $;return $.slice(0,X.index)+Z(X.tag,X.attrs)+$.slice(X.index+X.tag.length)}var t$=null;function d8($){if(!t$)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return t$}function _z($){let Z=d8("onUpdate");if(Z)Z.updateHooks.push($)}function e$(){return`
|
|
127
127
|
// STX Lifecycle Runtime
|
|
128
128
|
(function() {
|
|
129
129
|
if (typeof window === 'undefined') return;
|
|
@@ -471,7 +471,7 @@ else {
|
|
|
471
471
|
|
|
472
472
|
console.log('[stx] Lifecycle runtime initialized');
|
|
473
473
|
})();
|
|
474
|
-
`}function v9($){return Symbol($)}var
|
|
474
|
+
`}function v9($){return Symbol($)}var Vz=v9("theme"),Lz=v9("router"),Oz=v9("i18n");import*as Z3 from"crypto";function $3($){let Z=/\$(\w+)\./g,X=[],J;while((J=Z.exec($))!==null)if(!X.includes(J[1]))X.push(J[1]);return X}function m8(){return`stx-${Z3.randomBytes(4).toString("hex")}`}function l8($){return/\$\w+\./.test($)}function c8($){let Z=[],X=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(Q,G,z,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let K=[],U=!1,W=z,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...z.matchAll(H)];for(let O of j){let V=O[0],L=O[1],F=O[2];if(l8(F)){U=!0;let w=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(K.push({attr:L,expr:R,fullMatch:V,originalAttr:L}),$3(R).forEach((A)=>X.add(A)),L==="text")W=W.replace(V,"");else if(L==="class")W=W.replace(V,'class=""');else if(L==="disabled"||L==="hidden")W=W.replace(V,"");else W=W.replace(V,`${L}=""`)}}}if(!U)return Q;let B=W.match(/\bid\s*=\s*"([^"]+)"/),_;if(B)_=B[1];else _=m8(),W=` id="${_}"${W}`;for(let O of K)Z.push({elementId:_,attribute:O.attr,expression:O.expr,stores:$3(O.expr)});return`<${G}${W}${q}`}),{html:Y,bindings:Z,stores:X}}function p8($,Z){if($.length===0)return"";let X=Array.from(Z),J=`
|
|
475
475
|
<script>
|
|
476
476
|
(function() {
|
|
477
477
|
'use strict';
|
|
@@ -629,10 +629,10 @@ else {
|
|
|
629
629
|
}
|
|
630
630
|
})();
|
|
631
631
|
</script>
|
|
632
|
-
`,J}function
|
|
632
|
+
`,J}function X3($){let{html:Z,bindings:X,stores:J}=c8($);if(X.length===0)return $;let Y=p8(X,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function J3($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return i8(Z);case"google-analytics":return n8(Z);case"plausible":return o8(Z);case"self-hosted":return s8(Z);case"custom":return r8(Z);default:return""}}function i8($){let Z=$.fathom;if(!Z?.siteId)return"";let X=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",Y=[`data-site="${f0(Z.siteId)}"`];if(Z.honorDnt)Y.push('data-honor-dnt="true"');if(Z.spa)Y.push('data-spa="auto"');if(Z.canonical)Y.push(`data-canonical="${f0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
|
|
633
633
|
<!-- Fathom Analytics -->
|
|
634
634
|
<script src="${f0(X)}" ${Y.join(" ")}${J}></script>
|
|
635
|
-
`}function
|
|
635
|
+
`}function n8($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let X=f0(Z.measurementId),J=Z.debug?`gtag('config', '${X}', { 'debug_mode': true });`:"";return`
|
|
636
636
|
<!-- Google Analytics -->
|
|
637
637
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${X}"></script>
|
|
638
638
|
<script>
|
|
@@ -642,10 +642,10 @@ else {
|
|
|
642
642
|
gtag('config', '${X}');
|
|
643
643
|
${J}
|
|
644
644
|
</script>
|
|
645
|
-
`}function
|
|
645
|
+
`}function o8($){let Z=$.plausible;if(!Z?.domain)return"";let X=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${f0(Z.domain)}"`],Y=X,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&X==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
|
|
646
646
|
<!-- Plausible Analytics -->
|
|
647
647
|
<script defer data-domain="${f0(Z.domain)}" src="${f0(Y)}"></script>
|
|
648
|
-
`}function
|
|
648
|
+
`}function s8($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let X=f0(Z.siteId),J=f0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
|
|
649
649
|
d.addEventListener('click',function(e){
|
|
650
650
|
var a=e.target.closest('a');
|
|
651
651
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -678,7 +678,7 @@ else {
|
|
|
678
678
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
679
679
|
})();
|
|
680
680
|
</script>
|
|
681
|
-
`}function
|
|
681
|
+
`}function r8($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
|
|
682
682
|
<!-- Custom Analytics -->
|
|
683
683
|
<script>
|
|
684
684
|
${Z.inlineScript}
|
|
@@ -686,7 +686,7 @@ ${Z.inlineScript}
|
|
|
686
686
|
`;if(!Z.scriptUrl)return"";let X=[];if(Z.scriptId)X.push(`id="${f0(Z.scriptId)}"`);if(Z.attributes)for(let[Y,Q]of Object.entries(Z.attributes))X.push(`${f0(Y)}="${f0(Q)}"`);return`
|
|
687
687
|
<!-- Custom Analytics -->
|
|
688
688
|
<script${X.length>0?` ${X.join(" ")}`:""} src="${f0(Z.scriptUrl)}" defer></script>
|
|
689
|
-
`}function
|
|
689
|
+
`}function Y3($,Z){let X=J3(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 f0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var Rz={name:"analytics",hasEndTag:!1,handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};return J3(Y)}};var a8={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 Q3($){let Z=$.heatmap;if(!Z?.enabled)return"";let X={...a8,...Z};return`
|
|
690
690
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
691
691
|
<script>
|
|
692
692
|
(function() {
|
|
@@ -1069,7 +1069,7 @@ else {
|
|
|
1069
1069
|
};
|
|
1070
1070
|
})();
|
|
1071
1071
|
</script>
|
|
1072
|
-
`}function
|
|
1072
|
+
`}function G3($,Z){let X=Q3(Z);if(!X)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}var z3={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=t8(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return Q3(Y)}};function t8($){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 q3{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),z=Math.min(Math.floor(Q.y/100*Z),Z-1);J[z][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((z,q)=>({x:q,y:G,intensity:Y>0?z/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 Nz(){return new q3}var e8;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(e8||={});var $Z;((J)=>{J.In="in";J.Out="out";J.Both="both"})($Z||={});var ZZ;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(ZZ||={});var e0={duration:300,delay:0,ease:"ease",direction:"both"};function XZ($,Z={}){let{duration:X,delay:J,ease:Y,direction:Q,custom:G}={...e0,...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);"}
|
|
1073
1073
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1074
1074
|
@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);"}
|
|
1075
1075
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -1079,7 +1079,7 @@ else {
|
|
|
1079
1079
|
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
1080
1080
|
@keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(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);"}
|
|
1081
1081
|
@keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
|
|
1082
|
-
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function
|
|
1082
|
+
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function JZ(){return`
|
|
1083
1083
|
<script data-stx-scoped data-stx-run="once">
|
|
1084
1084
|
// Motion preferences handling
|
|
1085
1085
|
(function() {
|
|
@@ -1107,7 +1107,7 @@ else {
|
|
|
1107
1107
|
});
|
|
1108
1108
|
})();
|
|
1109
1109
|
</script>
|
|
1110
|
-
`}function
|
|
1110
|
+
`}function YZ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((X)=>X.test($))}function QZ($=0.1,Z="0px"){return`
|
|
1111
1111
|
<script data-stx-scoped data-stx-run="always">
|
|
1112
1112
|
// Intersection Observer for scroll animations
|
|
1113
1113
|
(function() {
|
|
@@ -1150,7 +1150,7 @@ else {
|
|
|
1150
1150
|
}
|
|
1151
1151
|
})();
|
|
1152
1152
|
</script>
|
|
1153
|
-
`}function
|
|
1153
|
+
`}function GZ(){return`
|
|
1154
1154
|
<style id="stx-animation-base">
|
|
1155
1155
|
:root {
|
|
1156
1156
|
--stx-transition-duration: 300ms;
|
|
@@ -1265,7 +1265,7 @@ else {
|
|
|
1265
1265
|
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1266
1266
|
}
|
|
1267
1267
|
</style>
|
|
1268
|
-
`}function
|
|
1268
|
+
`}function zZ($,Z,X={}){let{staggerDelay:J=50,sequence:Y=!1}=X;return`
|
|
1269
1269
|
<script data-stx-scoped data-stx-run="always">
|
|
1270
1270
|
// Animation Group: ${$}
|
|
1271
1271
|
(function() {
|
|
@@ -1302,21 +1302,21 @@ else {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
})();
|
|
1304
1304
|
</script>
|
|
1305
|
-
`}var f9={name:"transition",handler:($,Z,X,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||e0.duration:e0.duration,G=Z.length>2?Z[2]||e0.ease:e0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||e0.delay:e0.delay,q=Z.length>4?Z[4]||e0.direction:e0.direction,K=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U
|
|
1306
|
-
style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},x9={name:"scrollAnimate",handler:($,Z,X,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",z=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,K=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,W="stx-transition stx-observe stx-out";if(Y==="fade")W+=" stx-fade";else if(Y==="slide-up"||Y==="slide")W+=" stx-from-bottom";else if(Y==="slide-down")W+=" stx-from-top";else if(Y==="slide-left")W+=" stx-from-right";else if(Y==="slide-right")W+=" stx-from-left";else if(Y==="scale")W+=" stx-scale";else if(Y.includes("-"))W+=` stx-${Y}`;else W+=` stx-${Y}`;return`<div id="${K}" class="${W}" style="${U}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},g9={name:"animationGroup",handler:($,Z,X,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=Z[0],Q=Z.slice(1).map((K)=>K.startsWith("#")||K.startsWith(".")?K:`#${K}`),G=X.staggerDelay||50,z=X.sequence||!0,q=
|
|
1307
|
-
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},h9={name:"motion",handler:($,Z,X,J)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=
|
|
1308
|
-
</head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let q=
|
|
1309
|
-
`+Y.slice(K)}}return Y}var
|
|
1305
|
+
`}var f9={name:"transition",handler:($,Z,X,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||e0.duration:e0.duration,G=Z.length>2?Z[2]||e0.ease:e0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||e0.delay:e0.delay,q=Z.length>4?Z[4]||e0.direction:e0.direction,K=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=XZ(Y,{duration:Q,delay:z,ease:G,direction:q}),W="stx-transition",H="";if(Y==="fade")H="stx-fade";else if(Y==="slide")H="stx-slide";else if(Y==="scale")H="stx-scale";else if(Y==="flip")H="stx-flip";else if(Y==="rotate")H="stx-rotate";return`<div id="${K}" class="${W} ${H} ${q==="out"?"stx-out":""}"
|
|
1306
|
+
style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},x9={name:"scrollAnimate",handler:($,Z,X,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",z=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,K=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,W="stx-transition stx-observe stx-out";if(Y==="fade")W+=" stx-fade";else if(Y==="slide-up"||Y==="slide")W+=" stx-from-bottom";else if(Y==="slide-down")W+=" stx-from-top";else if(Y==="slide-left")W+=" stx-from-right";else if(Y==="slide-right")W+=" stx-from-left";else if(Y==="scale")W+=" stx-scale";else if(Y.includes("-"))W+=` stx-${Y}`;else W+=` stx-${Y}`;return`<div id="${K}" class="${W}" style="${U}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},g9={name:"animationGroup",handler:($,Z,X,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=Z[0],Q=Z.slice(1).map((K)=>K.startsWith("#")||K.startsWith(".")?K:`#${K}`),G=X.staggerDelay||50,z=X.sequence||!0,q=zZ(Y,Q,{staggerDelay:G,sequence:z});return`${$}
|
|
1307
|
+
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},h9={name:"motion",handler:($,Z,X,J)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=JZ();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function U3($,Z,X,J){let Y=$;if(J.animation?.enabled===!1)return Y;let Q=X.includes("test")&&X.includes("animation");if(!YZ(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let z=GZ();Y=Y.replace("</head>",`${z}
|
|
1308
|
+
</head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let q=QZ(),K=Y.lastIndexOf("</body>");if(K!==-1)Y=Y.slice(0,K)+q+`
|
|
1309
|
+
`+Y.slice(K)}}return Y}var K3={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};function qZ($,Z){let X=Z.map((J)=>{let Y=J.offset!==void 0?`${J.offset*100}%`:"from",Q=Object.entries(J.properties).map(([G,z])=>`${G}: ${z}`).join("; ");return`${Y} { ${Q} }`}).join(`
|
|
1310
1310
|
`);return`@keyframes ${$} {
|
|
1311
1311
|
${X}
|
|
1312
|
-
}`}var
|
|
1312
|
+
}`}var KZ={name:"keyframe",hasEndTag:!0,handler:($,Z,X,J)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let Y=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",z=Z[3]||"1",q=Z[4]?.replace(/['"`]/g,"")||"normal",K=Z[5]?.replace(/['"`]/g,"")||"forwards",U=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,W=`
|
|
1313
1313
|
animation-name: ${Y};
|
|
1314
1314
|
animation-duration: ${Q}ms;
|
|
1315
1315
|
animation-timing-function: ${G};
|
|
1316
1316
|
animation-iteration-count: ${z};
|
|
1317
1317
|
animation-direction: ${q};
|
|
1318
1318
|
animation-fill-mode: ${K};
|
|
1319
|
-
`.trim().replace(/\s+/g," ");return`<div id="${U}" style="${W}">${$}</div>`},description:"Applies a keyframe animation to an element"};function
|
|
1319
|
+
`.trim().replace(/\s+/g," ");return`<div id="${U}" style="${W}">${$}</div>`},description:"Applies a keyframe animation to an element"};function UZ($,Z,X,J,Y){return`
|
|
1320
1320
|
<script data-stx-scoped data-stx-run="always">
|
|
1321
1321
|
(function() {
|
|
1322
1322
|
const container = document.getElementById('${$}');
|
|
@@ -1330,7 +1330,7 @@ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
|
|
|
1330
1330
|
child.classList.add('${Y}');
|
|
1331
1331
|
});
|
|
1332
1332
|
})();
|
|
1333
|
-
</script>`}var
|
|
1333
|
+
</script>`}var WZ={name:"stagger",hasEndTag:!0,handler:($,Z,X,J)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"> *",Q=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,z=Z[3]?.replace(/['"`]/g,"")||"fade",q=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,K="stx-stagger-item";if(z==="fade")K+=" stx-fade";else if(z==="slide")K+=" stx-from-bottom";else if(z==="scale")K+=" stx-scale";let U=UZ(q,Y,G,Q,K);return`${`
|
|
1334
1334
|
<style>
|
|
1335
1335
|
#${q} .stx-stagger-item {
|
|
1336
1336
|
opacity: 0;
|
|
@@ -1340,12 +1340,12 @@ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
|
|
|
1340
1340
|
from { opacity: 0; transform: translateY(10px); }
|
|
1341
1341
|
to { opacity: 1; transform: translateY(0); }
|
|
1342
1342
|
}
|
|
1343
|
-
</style>`}<div id="${q}" class="stx-stagger-container">${$}</div>${U}`},description:"Applies staggered animations to child elements"};function
|
|
1343
|
+
</style>`}<div id="${q}" class="stx-stagger-container">${$}</div>${U}`},description:"Applies staggered animations to child elements"};function HZ($){let{stiffness:Z,damping:X}=$,J=X/(2*Math.sqrt(Z));if(J<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(J<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var jZ={name:"spring",hasEndTag:!0,handler:($,Z,X,J)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(K3[Y])Q=K3[Y];else Q={stiffness:Number.parseInt(Y,10)||100,damping:Z[1]?Number.parseInt(Z[1],10):10,mass:Z[2]?Number.parseFloat(Z[2]):1};let G=Z[3]?Number.parseInt(Z[3],10):500,z=`stx-spring-${Math.random().toString(36).slice(2,9)}`,q=HZ(Q),K=`
|
|
1344
1344
|
transition: all ${G}ms ${q};
|
|
1345
1345
|
--stx-spring-stiffness: ${Q.stiffness};
|
|
1346
1346
|
--stx-spring-damping: ${Q.damping};
|
|
1347
1347
|
--stx-spring-mass: ${Q.mass};
|
|
1348
|
-
`.trim().replace(/\s+/g," ");return`<div id="${z}" class="stx-spring" style="${K}">${$}</div>`},description:"Applies spring physics animations to an element"};function
|
|
1348
|
+
`.trim().replace(/\s+/g," ");return`<div id="${z}" class="stx-spring" style="${K}">${$}</div>`},description:"Applies spring physics animations to an element"};function Mz($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
|
|
1349
1349
|
<script data-stx-scoped data-stx-run="always">
|
|
1350
1350
|
(function() {
|
|
1351
1351
|
const timeline = ${JSON.stringify($)};
|
|
@@ -1382,7 +1382,7 @@ else {
|
|
|
1382
1382
|
runTimeline();
|
|
1383
1383
|
}
|
|
1384
1384
|
})();
|
|
1385
|
-
</script>`}function
|
|
1385
|
+
</script>`}function kz($,Z,X){let J=qZ($,Z),Y=`
|
|
1386
1386
|
.${$}-animation {
|
|
1387
1387
|
animation-name: ${$};
|
|
1388
1388
|
animation-duration: ${X.duration}ms;
|
|
@@ -1392,7 +1392,7 @@ else {
|
|
|
1392
1392
|
animation-direction: ${X.direction||"normal"};
|
|
1393
1393
|
animation-fill-mode: ${X.fill||"forwards"};
|
|
1394
1394
|
}`;return`${J}
|
|
1395
|
-
${Y}`}function
|
|
1395
|
+
${Y}`}function Iz($){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 Tz(){return`
|
|
1396
1396
|
<script data-stx-scoped data-stx-run="once">
|
|
1397
1397
|
window.__stxAnimation = {
|
|
1398
1398
|
// Registry of animations
|
|
@@ -1464,7 +1464,7 @@ else {
|
|
|
1464
1464
|
);
|
|
1465
1465
|
}
|
|
1466
1466
|
};
|
|
1467
|
-
</script>`}function
|
|
1467
|
+
</script>`}function Ez($){let Z=$.customDirectives||[];return Z.push(f9),Z.push(g9),Z.push(h9),Z.push(x9),Z.push(KZ),Z.push(WZ),Z.push(jZ),{...$,customDirectives:Z}}function W3($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function H3($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var BZ=100,_Z=599,d9="__stxResponseStatus",Y2="__stxResponseHeaders";function g2($){return typeof $==="number"&&Number.isInteger($)&&$>=BZ&&$<=_Z}function Sz($){for(let Z of $.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let X=Z[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!X)continue;let J=Number(X[1]);if(g2(J))return J}return}function u9($,Z){if(!$||typeof $!=="object")return!1;let X=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!g2(X))return!1;return $[d9]=X,!0}function VZ($,Z,X){if(!$||typeof $!=="object")return;let J=String(Z??"").trim();if(!J)return;$[Y2]={...$[Y2],[J]:String(X)}}function LZ($){let Z=$?.[d9];return g2(Z)?Z:void 0}function OZ($){let Z=$?.[Y2];if(!Z||typeof Z!=="object")return;let X=Object.entries(Z).map(([J,Y])=>[J,String(Y)]);return X.length>0?Object.fromEntries(X):void 0}function Pz($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let X=LZ($);if(X!==void 0)Z[d9]=X;let J=OZ($);if(J)Z[Y2]={...Z[Y2],...J}}function j3($){return{setResponseStatus:(Z)=>{u9($,Z)},notFound:(Z=404)=>{let X=g2(Z)&&Z>=400?Z:404;u9($,X)},setResponseHeader:(Z,X)=>{VZ($,Z,X)}}}function B3($,Z,X={}){if(!$.includes("@status"))return $;let{filePath:J,buildMode:Y}=X,Q=Y==="compile",G="",z=0,q=/@status\s*\(/g,K;while((K=q.exec($))!==null){let U=FZ($,K.index+K[0].length-1);if(U<0)break;let W=$.slice(K.index+K[0].length,U).trim(),H=/^\d+$/.test(W)?Number(W):e(W,Z),j=J?` in ${J}`:"";if(Q)console.warn(`[stx] @status(${W})${j} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${W}) from <script server> instead \u2014 that runs per request.`);else if(!u9(Z,H))console.warn(`[stx] @status(${W})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(z,K.index),z=U+1+($.slice(U+1).match(/^[^\S\n]*\n?/)?.[0].length??0),q.lastIndex=z}return z===0?$:G+$.slice(z)}function FZ($,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}var wZ=0,RZ=0;function _3($,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 DZ($){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,z=J.index,q=_3(G,"x-data");if(!q)continue;let K=`__stx_scope_${wZ++}`,U=_3(G,"x-init"),W=NZ($,Q,z+Y.length),H=$.slice(z,W.endIndex),j=AZ(H);Z.push({id:K,selector:`[data-stx-scope="${K}"]`,stateExpr:q,initExpr:U,bindings:[],refs:j})}return Z}function NZ($,Z,X){let J=1,Y=X,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),z=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,z.lastIndex=Y;let q=Q.exec($),K=G.exec($),U=z.exec($);if(U&&U.index<(q?.index??1/0)){Y=U.index+U[0].length;continue}if(!K)return{endIndex:$.length};if(q&&q.index<K.index)J++,Y=q.index+q[0].length;else{if(J--,J===0)return{endIndex:K.index+K[0].length};Y=K.index+K[0].length}}return{endIndex:$.length}}function AZ($){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,z=MZ(Q);Z.set(G,z)}return Z}function MZ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${RZ++}`}function kZ(){return`
|
|
1468
1468
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
1469
1469
|
(function() {
|
|
1470
1470
|
var style = document.createElement('style');
|
|
@@ -1671,7 +1671,7 @@ window.__stx_reactive = (function() {
|
|
|
1671
1671
|
|
|
1672
1672
|
return { initScope: initScope, reactive: reactive };
|
|
1673
1673
|
})();
|
|
1674
|
-
`}function
|
|
1674
|
+
`}function V3($,Z){let X=$.replace(/\{!!([\s\S]*?)!!\}/g,(z,q)=>{try{let K=v0(q,Z,!0);if(K===void 0)return z;return String(K)}catch{return z}}),J="",Y=0,Q=null;while(Y<X.length){let z=X[Y];if(Q&&z==="\\"){J+=z+(X[Y+1]??""),Y+=2;continue}if(z==="{"&&X[Y+1]==="{"){let q=X.indexOf("}}",Y+2);if(q!==-1){let K=X.slice(Y,q+2);J+=G(X.slice(Y+2,q),K,Q),Y=q+2;continue}}if(Q){if(z===Q)Q=null}else if(z==="'"||z==='"'||z==="`")Q=z;J+=z,Y++}return J;function G(z,q,K){let U;try{U=v0(z,Z,!0)}catch{return q}if(U===void 0)return q;if(K){let W=String(U).replace(/\\/g,"\\\\").replace(new RegExp(K==="`"?"`":K,"g"),`\\${K}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return K==="`"?W.replace(/\$\{/g,"\\${"):W}if(typeof U==="string"){let W=U.trim();if(W.startsWith("{")&&W.endsWith("}")||W.startsWith("[")&&W.endsWith("]"))try{return JSON.parse(W),W}catch{}}return JSON.stringify(U)}}function IZ($,Z){if($.length===0)return"";let X=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),Q=V3(J.stateExpr,Z),G=J.initExpr?V3(J.initExpr,Z):null,z=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
|
|
1675
1675
|
(function() {
|
|
1676
1676
|
var scopeEl = document.querySelector('${J.selector}');
|
|
1677
1677
|
if (!scopeEl) return;
|
|
@@ -1680,11 +1680,11 @@ window.__stx_reactive = (function() {
|
|
|
1680
1680
|
})();`}).join(`
|
|
1681
1681
|
`);return`
|
|
1682
1682
|
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
1683
|
-
${
|
|
1683
|
+
${kZ()}
|
|
1684
1684
|
${X}
|
|
1685
|
-
</script>`}function
|
|
1686
|
-
`+Y.slice(G);else Y+=Q;return Y}function
|
|
1687
|
-
`)){let z=G.trim();if(!z||z.startsWith("#"))continue;let q=z.indexOf(":");if(q===-1)continue;let K=z.slice(0,q).trim(),U=z.slice(q+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}Q[K]=U}return{data:Q,content:Y.trim()}}function G2($,Z={}){let{gfm:X=!0,breaks:J=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(U,W,H)=>{let j=Q.length,B=W?` class="language-${Q1(W)}"`:"";return Q.push(`<pre><code${B}>${Q1(H.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(U,W)=>`<code>${Q1(W)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),X)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,W,H)=>{return`<img src="${
|
|
1685
|
+
</script>`}function L3($,Z,X){if(!EZ($))return $;let J=DZ($);if(J.length===0)return $;let Y=TZ($,J),Q=IZ(J,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
|
|
1686
|
+
`+Y.slice(G);else Y+=Q;return Y}function TZ($,Z){let X=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,Q,G)=>{let z=Z[X++];if(!z)return Y;let q=/data-stx-scope="([^"]*)"/.exec(G);if(q)return z.id=q[1],z.selector=`[data-stx-scope="${z.id}"]`,Y;return`<${Q} data-stx-scope="${z.id}"${G}>`});return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),J=J.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),J}function EZ($){return/x-data\s*=\s*["']/.test($)}import wX from"fs";import G5 from"path";import{createHighlighter as RX}from"ts-syntax-highlighter";import p2 from"fs";import T0 from"path";import{loadConfigWithResult as jX}from"bunfig";Q2();async function bZ($,Z,X,J){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=m9();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var O3={name:"stxRouter",handler:bZ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Q1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function F3($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function w3($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,X=$.match(Z);if(!X)return{data:{},content:$.trim()};let J=X[1],Y=$.slice(X[0].length),Q={};for(let G of J.split(`
|
|
1687
|
+
`)){let z=G.trim();if(!z||z.startsWith("#"))continue;let q=z.indexOf(":");if(q===-1)continue;let K=z.slice(0,q).trim(),U=z.slice(q+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}Q[K]=U}return{data:Q,content:Y.trim()}}function G2($,Z={}){let{gfm:X=!0,breaks:J=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(U,W,H)=>{let j=Q.length,B=W?` class="language-${Q1(W)}"`:"";return Q.push(`<pre><code${B}>${Q1(H.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(U,W)=>`<code>${Q1(W)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),X)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,W,H)=>{return`<img src="${F3(H)?Q1(H):""}" alt="${Q1(W)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,W,H)=>{return`<a href="${F3(H)?Q1(H):""}">${W}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
1688
1688
|
`),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),X)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,W,H)=>{let B=`<tr>${W.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<th>${Q1(O)}</th>`).join("")}</tr>`,_=H.trim().split(`
|
|
1689
1689
|
`).map((O)=>{return`<tr>${O.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${Q1(L)}</td>`).join("")}</tr>`}).join(`
|
|
1690
1690
|
`);return`<table>
|
|
@@ -1701,9 +1701,9 @@ ${_}
|
|
|
1701
1701
|
`:`
|
|
1702
1702
|
`)}</p>`);if(Y=z.join(`
|
|
1703
1703
|
`),J)Y=Y.replace(/\n/g,`<br />
|
|
1704
|
-
`);for(let U=0;U<Q.length;U++)Y=Y.replace(`\x00CODEBLOCK${U}\x00`,Q[U]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function
|
|
1705
|
-
`||L==="\r"||L===" "||L===void 0)W++;H=O+9}else{if(W--,W===0){j=V;break}H=V+12}}if(j===-1)continue;let B=$.slice(U,j),_=$.slice(z,j+12);Y.push({fullMatch:_,options:K,content:B,index:z}),Q.lastIndex=j+12}for(let{fullMatch:z,options:q,content:K,index:U}of Y)try{let W={};if(q)q.split(",").forEach((B)=>{let _=B.trim();if(_)W[_]=!0});let H={gfm:W.gfm??!0,breaks:W.breaks??!1},j=G2(K.trim(),H);J=J.split(z).join(j)}catch(W){let H=W instanceof Error?W.message:String(W),j=j0("Markdown Directive",`Error processing markdown: ${H}`,X,$,U,z);J=J.split(z).join(j)}return J}async function
|
|
1706
|
-
`)}function
|
|
1704
|
+
`);for(let U=0;U<Q.length;U++)Y=Y.replace(`\x00CODEBLOCK${U}\x00`,Q[U]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function R3($,Z,X=""){let J=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let z=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),K=q?q[1]:"",U=z+G[0].length,W=1,H=U,j=-1;while(W>0&&H<$.length){let O=$.indexOf("@markdown",H),V=$.indexOf("@endmarkdown",H);if(V===-1)break;if(O!==-1&&O<V&&O!==z){let L=$[O+9];if(L==="("||L===`
|
|
1705
|
+
`||L==="\r"||L===" "||L===void 0)W++;H=O+9}else{if(W--,W===0){j=V;break}H=V+12}}if(j===-1)continue;let B=$.slice(U,j),_=$.slice(z,j+12);Y.push({fullMatch:_,options:K,content:B,index:z}),Q.lastIndex=j+12}for(let{fullMatch:z,options:q,content:K,index:U}of Y)try{let W={};if(q)q.split(",").forEach((B)=>{let _=B.trim();if(_)W[_]=!0});let H={gfm:W.gfm??!0,breaks:W.breaks??!1},j=G2(K.trim(),H);J=J.split(z).join(j)}catch(W){let H=W instanceof Error?W.message:String(W),j=j0("Markdown Directive",`Error processing markdown: ${H}`,X,$,U,z);J=J.split(z).join(j)}return J}async function D3($,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}),G2($.trim(),Y)}var _1=[320,480,640,768,1024,1280,1536,1920,2560],N3=[1,1.5,2,3],y1=["avif","webp","jpeg"],A3={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},yZ={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function z2($,Z=_1,X={},J){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${G1($,{...X,w:Y,fm:J})} ${Y}w`}).join(", ")}function nz($,Z=320,X=2560,J=0.08,Y={},Q){let G=CZ(Z,X,J);return z2($,G,Y,Q)}function CZ($,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 l9($,Z,X=N3,J={},Y){return X.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${G1($,{...J,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function oz($,Z,X=N3,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((z,q)=>z-q).map((z)=>{let q=Math.round(Z*z),K=G[z]||Math.round(J*Math.max(0.5,1-z*0.1));return`${G1($,{...Y,w:q,q:K,dpr:z,fm:Q})} ${z}x`}).join(", ")}function c9($,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 sz($,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 rz={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 G1($,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 az($){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 tz($){let{src:Z,widths:X,dprValues:J,fixedWidth:Y,formats:Q=y1,baseUrl:G="",params:z={}}=$,q=[];for(let K of Q){let U,W;if(Y!==void 0&&J)U=l9(Z,Y,J,z,K),W=J.map((H)=>({path:"",url:G1(Z,{...z,w:Math.round(Y*H),fm:K}),width:Math.round(Y*H),height:0,format:K,size:0,dpr:H}));else{let H=X||_1;U=z2(Z,H,z,K),W=H.map((j)=>({path:"",url:G1(Z,{...z,w:j,fm:K}),width:j,height:0,format:K,size:0}))}q.push({srcset:U,format:K,mimeType:A3[K],variants:W})}return q}function ez($,Z="100vw"){return $.map(({srcset:X,mimeType:J})=>`<source type="${J}" srcset="${X}" sizes="${Z}" />`).join(`
|
|
1706
|
+
`)}function $q($,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 p9($){return A3[$]||"application/octet-stream"}function Zq($){return yZ[$]||$}function Xq($){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 SZ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},i9=`
|
|
1707
1707
|
.stx-img-placeholder {
|
|
1708
1708
|
position: relative;
|
|
1709
1709
|
overflow: hidden;
|
|
@@ -1732,9 +1732,9 @@ ${_}
|
|
|
1732
1732
|
filter: blur(0);
|
|
1733
1733
|
transform: scale(1);
|
|
1734
1734
|
}
|
|
1735
|
-
`.trim();async function n9(){try{return await import("ts-images")}catch{return null}}async function
|
|
1735
|
+
`.trim();async function n9(){try{return await import("ts-images")}catch{return null}}async function M3($,Z={}){let X={...SZ,...Z},J=await n9();if(J)try{return await PZ($,X,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return k3($,X)}async function PZ($,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 z=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:Z.strategy,dominantColor:z.dominantColor,css:z.css}}function k3($,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 Yq($){let Z=await n9();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await k3($,{strategy:"thumbhash",width:32,height:32})).dataURL}function Qq($){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,z=$[3]|$[4]<<8,q=(z>>3&63)/63,K=(z>>9&63)/63,U=z>>15!==0,W=Math.max(3,U?G?5:7:G?5:7),H=Math.max(3,U?G?5:7:G?5:7),j=32,B=32,_=Math.max(0,Math.min(255,Math.round((X+J)*255))),O=Math.max(0,Math.min(255,Math.round(X*255))),V=Math.max(0,Math.min(255,Math.round((X-J)*255))),L=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
|
1736
1736
|
<rect fill="rgb(${_},${O},${V})" width="32" height="32"/>
|
|
1737
|
-
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(L)}`}async function
|
|
1737
|
+
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(L)}`}async function Gq($,Z=20,X=50){return M3($,{strategy:"blur",width:Z,quality:X,blurLevel:40})}async function zq($){let Z=await n9();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function qq($,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 I3($,Z,X={}){let J=X.transitionDuration||300,Y=X.easing||"ease-out";return`
|
|
1738
1738
|
#${$} {
|
|
1739
1739
|
--stx-img-transition-duration: ${J}ms;
|
|
1740
1740
|
--stx-img-transition-easing: ${Y};
|
|
@@ -1751,8 +1751,8 @@ ${_}
|
|
|
1751
1751
|
#${$}.stx-img-loaded img {
|
|
1752
1752
|
opacity: 1;
|
|
1753
1753
|
}
|
|
1754
|
-
`.trim()}function
|
|
1755
|
-
`):void 0,script:a0}}async function
|
|
1754
|
+
`.trim()}function Kq($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var C1=new Map;async function T3($,Z={}){let X=`${$}:${JSON.stringify(Z)}`;if(C1.has(X))return C1.get(X);let J=await M3($,Z);return C1.set(X,J),J}function Uq(){C1.clear()}function Wq(){return{size:C1.size,keys:Array.from(C1.keys())}}async function vZ(){try{return await import("./chunk-f3hfk78e.js")}catch($){if(!E3)console.warn("[stx-media] Image processor not available, some features disabled:",$),E3=!0;return null}}var E3=!1,o9=80,h2="async",u2="lazy",b3=!1;async function q2($,Z={}){let X=Z,J=$;if(J.process&&!J.skipOptimization){if(X.tsImagesConfig?.enabled&&!X.isDev)return uZ(J,X)}if(X.processedResult?.processed)return a9($,X.processedResult,Z);if(X.responsiveVariants)return S3($,X.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:z,sizes:q,widths:K=_1,dpr:U,formats:W=y1,quality:H=o9,params:j={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:V=!1,loading:L=V?"eager":u2,decoding:F=h2,fetchpriority:w,objectFit:R,objectPosition:D,crossorigin:A,referrerpolicy:k}=$,N=$.class,M=$.style,T=$.id,I=$.data||{},{isDev:y=!1,baseUrl:E=""}=Z;if(y&&!Z.optimize)return gZ($);let b,C,v=T||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!V)try{b=await T3(Y,{strategy:B,..._}),C=I3(v,b,_)}catch{}let P=U!==void 0&&G!==void 0,g;if(P)g=xZ($,v,b,Z);else g=await fZ($,v,b,Z);let x;if(V){let M0=W.includes("webp")?"webp":W[0],C0=z2(Y,K,{...j,q:H},M0),Z0=typeof q==="object"?c9(q):q||"100vw";x=`<link rel="preload" as="image" imagesrcset="${C0}" imagesizes="${Z0}" />`}let $0=[];if(!b3&&B!=="none")$0.push(i9),b3=!0;if(C)$0.push(C);let a0=O?C3(v):void 0;return{html:g,preloadLink:x,css:$0.length>0?$0.join(`
|
|
1755
|
+
`):void 0,script:a0}}async function fZ($,Z,X,J){let{src:Y,alt:Q,width:G,height:z,sizes:q,widths:K=_1,formats:U=y1,quality:W=o9,params:H={},lazy:j=!0,priority:B=!1,loading:_=B?"eager":u2,decoding:O=h2,fetchpriority:V,objectFit:L,objectPosition:F,crossorigin:w,referrerpolicy:R}=$,D=$.class,A=$.style,k=$.data||{},N=typeof q==="object"?c9(q):q||"100vw",M=[];for(let y of U){let E=z2(Y,K,{...H,q:W},y),b=p9(y);if(j&&!B)M.push(` <source type="${b}" data-srcset="${E}" data-sizes="${N}" />`);else M.push(` <source type="${b}" srcset="${E}" sizes="${N}" />`)}let T=s9({src:G1(Y,{...H,q:W}),alt:Q,width:G,height:z,loading:B?void 0:_,decoding:O,fetchpriority:B?"high":V,objectFit:L,objectPosition:F,crossorigin:w,referrerpolicy:R,className:y3(D,X),style:r9(A,L,F,X),lazy:j&&!B,data:k}),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}">
|
|
1756
1756
|
<picture>
|
|
1757
1757
|
${M.join(`
|
|
1758
1758
|
`)}
|
|
@@ -1762,9 +1762,9 @@ ${M.join(`
|
|
|
1762
1762
|
${M.join(`
|
|
1763
1763
|
`)}
|
|
1764
1764
|
<img ${T} />
|
|
1765
|
-
</picture>`;return I}function
|
|
1765
|
+
</picture>`;return I}function xZ($,Z,X,J){let{src:Y,alt:Q,width:G,height:z,dpr:q=[1,2,3],quality:K=o9,params:U={},lazy:W=!0,priority:H=!1,loading:j=H?"eager":u2,decoding:B=h2,fetchpriority:_,objectFit:O,objectPosition:V,crossorigin:L,referrerpolicy:F}=$,w=$.class,R=$.style,D=$.data||{},A=typeof G==="number"?G:Number.parseInt(String(G),10),k=l9(Y,A,q,{...U,q:K}),N=s9({src:G1(Y,{...U,w:A,q:K}),alt:Q,width:G,height:z,loading:H?void 0:j,decoding:B,fetchpriority:H?"high":_,objectFit:O,objectPosition:V,crossorigin:L,referrerpolicy:F,className:y3(w,X),style:r9(R,O,V,X),lazy:W&&!H,data:D}),M=W&&!H?`data-srcset="${k}"`:`srcset="${k}"`;if(X){let T=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${T}">
|
|
1766
1766
|
<img ${N} ${M} />
|
|
1767
|
-
</div>`}return`<img ${Z?`id="${Z}" `:""}${N} ${M} />`}function
|
|
1767
|
+
</div>`}return`<img ${Z?`id="${Z}" `:""}${N} ${M} />`}function gZ($){let{src:Z,alt:X,width:J,height:Y,loading:Q=u2,decoding:G=h2,fetchpriority:z,objectFit:q,objectPosition:K,crossorigin:U,referrerpolicy:W,priority:H=!1}=$,j=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${s9({src:Z,alt:X,width:J,height:Y,loading:H?"eager":Q,decoding:G,fetchpriority:H?"high":z,objectFit:q,objectPosition:K,crossorigin:U,referrerpolicy:W,className:j,style:r9(B,q,K),id:_,data:O})} />`}}function s9($){let Z=[];if($.lazy)Z.push(`data-src="${c0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${c0($.src)}"`);if(Z.push(`alt="${c0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${c0($.className)}"`);if($.style)Z.push(`style="${c0($.style)}"`);if($.id)Z.push(`id="${c0($.id)}"`);if($.data)for(let[X,J]of Object.entries($.data))Z.push(`data-${X}="${c0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function y3($,Z){let X=[];if($)X.push($);if(Z)X.push("stx-img-blur");return X.join(" ")||""}function r9($,Z,X,J){let Y=[];if(Z)Y.push(`object-fit: ${Z}`);if(X)Y.push(`object-position: ${X}`);if(J)Y.push("opacity: 0; transition: opacity 300ms ease-out");if($)Y.push($);return Y.join("; ")}function c0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function C3($){return`
|
|
1768
1768
|
(function() {
|
|
1769
1769
|
const container = document.getElementById('${$}');
|
|
1770
1770
|
if (!container) return;
|
|
@@ -1801,7 +1801,7 @@ ${M.join(`
|
|
|
1801
1801
|
|
|
1802
1802
|
observer.observe(container);
|
|
1803
1803
|
})();
|
|
1804
|
-
`.trim()}function
|
|
1804
|
+
`.trim()}function hZ($){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,z,q,K,U]=Q,W=q??K??U??!0;if(G===":"&&typeof W==="string")try{J[z]=JSON.parse(W)}catch{J[z]=W}else switch(z){case"src":J.src=String(W);break;case"alt":J.alt=String(W);break;case"width":J.width=Number(W)||W;break;case"height":J.height=Number(W)||W;break;case"sizes":J.sizes=String(W);break;case"quality":J.quality=Number(W);break;case"placeholder":J.placeholder=W;break;case"lazy":J.lazy=W===!0||W==="true";break;case"priority":J.priority=W===!0||W==="true";break;case"class":J.class=String(W);break;case"style":J.style=String(W);break;case"id":J.id=String(W);break;case"loading":J.loading=W;break;case"decoding":J.decoding=W;break;case"fetchpriority":J.fetchpriority=W;break;case"objectFit":J.objectFit=W;break;case"objectPosition":J.objectPosition=String(W);break;case"crossorigin":J.crossorigin=W;break}}if(!J.src||!J.alt)return null;return J}async function _q($,Z={}){let X=/<Img\s+[^>]*?\/?>/g,J=[],Y=[],Q=[],G=$,z=[],q;while((q=X.exec($))!==null)z.push({match:q[0],index:q.index});for(let K=z.length-1;K>=0;K--){let{match:U}=z[K],W=hZ(U);if(W){let H=await q2(W,Z);if(G=G.replace(U,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 uZ($,Z){let X=await vZ();if(!X)return q2({...$,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 S3($,Q,Z)}else{let Q=await X.processImage($.src,$,J);if(Q.processed)return a9($,Q,Z)}return q2({...$,process:!1},Z)}async function a9($,Z,X){let{alt:J,width:Y,height:Q,lazy:G=!0,priority:z=!1,objectFit:q,objectPosition:K,crossorigin:U,referrerpolicy:W}=$,H=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],V=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=V?.url||$.src,F=O.filter((C)=>C.format===(V?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){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 v=w.get(C);if(v&&v.length>0){let P=v.map((x)=>`${x.url} ${x.width}w`).join(", "),g=p9(C);if(G&&!z)R.push(` <source type="${g}" data-srcset="${P}" />`);else R.push(` <source type="${g}" srcset="${P}" />`)}}let A=[];if(G&&!z){if(A.push(`data-src="${c0(L)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)A.push(`data-srcset="${F}"`)}else if(A.push(`src="${c0(L)}"`),F)A.push(`srcset="${F}"`);A.push(`alt="${c0(J)}"`);let k=Y||Z.originalWidth,N=Q||Z.originalHeight;if(k)A.push(`width="${k}"`);if(N)A.push(`height="${N}"`);if(!z)A.push(`loading="${G?"lazy":"eager"}"`);if(A.push('decoding="async"'),z)A.push('fetchpriority="high"');if(U)A.push(`crossorigin="${U}"`);if(W)A.push(`referrerpolicy="${W}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(K)M.push(`object-position: ${K}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)A.push(`style="${M.join("; ")}"`);let T=[];if(H)T.push(H);if(Z.placeholder)T.push("stx-img-blur");if(T.length>0)A.push(`class="${T.join(" ")}"`);if(G&&!z)A.push("data-stx-lazy");for(let[C,v]of Object.entries(_))A.push(`data-${C}="${c0(v)}"`);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="${B}" class="stx-img-placeholder" style="${C}">
|
|
1805
1805
|
<picture>
|
|
1806
1806
|
${R.join(`
|
|
1807
1807
|
`)}
|
|
@@ -1811,11 +1811,11 @@ ${R.join(`
|
|
|
1811
1811
|
${R.join(`
|
|
1812
1812
|
`)}
|
|
1813
1813
|
<img ${A.join(" ")} />
|
|
1814
|
-
</picture>`;let y=[];if(Z.placeholder)y.push(i9);let E=G?
|
|
1815
|
-
`):void 0,script:E}}async function
|
|
1814
|
+
</picture>`;let y=[];if(Z.placeholder)y.push(i9);let E=G?C3(B):void 0,b;if(z&&F)b=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:b,css:y.length>0?y.join(`
|
|
1815
|
+
`):void 0,script:E}}async function S3($,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 a9($,J,X)}function dZ(){return d2({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}=mZ($,Z,X);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Y,alt:Q||"",widths:G.widths||_1,formats:G.formats||y1,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},q=X.__isDev||!1,K=await q2(z,{isDev:q}),U=K.html;if(K.preloadLink)U=K.preloadLink+`
|
|
1816
1816
|
`+U;if(K.css)U+=`
|
|
1817
1817
|
<style>${K.css}</style>`;if(K.script)U+=`
|
|
1818
|
-
<script>${K.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function
|
|
1818
|
+
<script>${K.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function mZ($,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=lZ(J),Q=t9(Y[0],X)||"",G=t9(Y[1],X)||"",z={};if(Y[2]){let q=t9(Y[2],X);if(typeof q==="object"&&q!==null)z=q;else if(typeof Y[2]==="string")try{z=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:z}}function lZ($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let q=$[z],K=z>0?$[z-1]:"";if((q==='"'||q==="'"||q==="`")&&K!=="\\"){if(!J)J=!0,Y=q;else if(q===Y)J=!1,Y="";else X+=q;continue}if(!J){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=q}if(X.trim())Z.push(X.trim());return Z}function t9($,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 P3=dZ();async function f3(){try{return await import("./chunk-bz2gytfs.js")}catch($){if(!v3)console.warn("[stx-media] Video processor not available, some features disabled:",$),v3=!0;return null}}var v3=!1,x3=!0,g3="metadata",cZ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function m2($,Z={}){let X=Z,J=$;if(J.process&&!J.skipProcessing){if(X.tsVideosConfig?.enabled&&!X.isDev)return sZ(J,X)}if(X.processedResult?.processed)return u3($,X.processedResult,Z);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await rZ(J,X);let{src:Q,sources:G=[],poster:z,posterPlaceholder:q,controls:K=x3,autoplay:U=!1,muted:W=!1,loop:H=!1,preload:j=g3,playsinline:B=!0,lazy:_=!0,player:O="native",type:V,width:L,height:F,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:D=!1}=$,A=Y||z,k=$.class,N=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return iZ($,Z);if(V&&V!=="video")return pZ(Q||"",V,$);let T=G.length>0?G:Q?[{src:Q,type:h3(Q)}]:[],I=[`id="${M}"`];if(K)I.push("controls");if(U)I.push("autoplay");if(W)I.push("muted");if(H)I.push("loop");if(B)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="${j}"`),I.push('preload="none"'),A)I.push(`data-poster="${R0(A)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${j}"`),A)I.push(`poster="${R0(A)}"`);if(L)I.push(`width="${L}"`);if(F)I.push(`height="${F}"`);if(k)I.push(`class="${R0(k)}"`);if(N)I.push(`style="${R0(N)}"`);let y=T.map((C)=>{return` <source ${_?`data-src="${R0(C.src)}"`:`src="${R0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
|
|
1819
1819
|
`),E=`<video ${I.join(" ")}>
|
|
1820
1820
|
${y}
|
|
1821
1821
|
Your browser does not support the video tag.
|
|
@@ -1854,9 +1854,9 @@ ${y}
|
|
|
1854
1854
|
|
|
1855
1855
|
observer.observe(video);
|
|
1856
1856
|
})();
|
|
1857
|
-
`.trim();return{html:E,script:b}}function
|
|
1857
|
+
`.trim();return{html:E,script:b}}function pZ($,Z,X){let{width:J=640,height:Y=360}=X,Q=X.class,G=X.style,z=X.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,K=null;switch(Z){case"youtube":K=nZ($),q=K?`https://www.youtube-nocookie.com/embed/${K}`:$;break;case"vimeo":K=oZ($),q=K?`https://player.vimeo.com/video/${K}`:$;break;case"dailymotion":K=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${K}`;break;case"twitch":K=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${K}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${z}"`,`src="${R0(q)}"`,`width="${J}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)U.push(`class="${R0(Q)}"`);if(G)U.push(`style="${R0(G)}"`);if(X.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
1858
1858
|
<iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
1859
|
-
</div>`}}function
|
|
1859
|
+
</div>`}}function iZ($,Z={}){let{src:X,sources:J=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:z=!1,loop:q=!1,preload:K="metadata",playsinline:U=!0,lazy:W=!0,width:H,height:j}=$,B=$.class,_=$.style,O=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,V={src:J.length>0?J:X,autoplay:G,loop:q,muted:z,playsinline:U,preload:K,poster:Y,controls:Q,title:$.title},L=["position: relative",H?`width: ${typeof H==="number"?H+"px":H}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",_||""].filter(Boolean).join("; "),F=`
|
|
1860
1860
|
<div
|
|
1861
1861
|
id="${O}"
|
|
1862
1862
|
class="ts-video-player${B?" "+R0(B):""}"
|
|
@@ -1893,7 +1893,7 @@ ${y}
|
|
|
1893
1893
|
|
|
1894
1894
|
// Load ts-video-player from CDN
|
|
1895
1895
|
var script = document.createElement('script');
|
|
1896
|
-
script.src = '${
|
|
1896
|
+
script.src = '${cZ}';
|
|
1897
1897
|
script.onload = initPlayer;
|
|
1898
1898
|
script.onerror = function() {
|
|
1899
1899
|
console.error('[stx] Failed to load ts-video-player');
|
|
@@ -2023,7 +2023,7 @@ else {
|
|
|
2023
2023
|
.ts-video-player__play-button svg {
|
|
2024
2024
|
margin-left: 4px;
|
|
2025
2025
|
}
|
|
2026
|
-
`.trim();return{html:F,script:w,css:R}}function
|
|
2026
|
+
`.trim();return{html:F,script:w,css:R}}function h3($){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 nZ($){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 oZ($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function R0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}function Rq($,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 z=JSON.parse(G);return{src:Q,...z}}catch{return{src:Q}}}async function sZ($,Z){let X=await f3();if(!X)return m2({...$,process:!1},Z);let J=Z.tsVideosConfig,Y=await X.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return u3($,Y,Z);return m2({...$,process:!1},Z)}async function rZ($,Z){let X=await f3();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 u3($,Z,X){let{controls:J=x3,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:z=g3,playsinline:q=!0,lazy:K=!0,width:U,height:W,crossorigin:H,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,_=$.class,O=$.style,V=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=$.src,F=h3(L);if(Z.transcoded)L=Z.transcoded.url,F="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)L=Z.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(Z.streaming?.dash)L=Z.streaming.dash.manifestUrl,F="application/dash+xml"}let R=Z.poster?.url||$.poster,D=[`id="${V}"`];if(J)D.push("controls");if(Y)D.push("autoplay");if(Q)D.push("muted");if(G)D.push("loop");if(q)D.push("playsinline");if(j)D.push("disablepictureinpicture");if(B)D.push("disableremoteplayback");if(H)D.push(`crossorigin="${H}"`);if(K){if(D.push(`data-preload="${z}"`),D.push('preload="none"'),R)D.push(`data-poster="${R0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${z}"`),R)D.push(`poster="${R0(R)}"`);let A=U||Z.metadata?.width,k=W||Z.metadata?.height;if(A)D.push(`width="${A}"`);if(k)D.push(`height="${k}"`);if(_)D.push(`class="${R0(_)}"`);if(O)D.push(`style="${R0(O)}"`);let M=` <source ${K?`data-src="${R0(L)}"`:`src="${R0(L)}"`} type="${F}" />`,T=`<video ${D.join(" ")}>
|
|
2027
2027
|
${M}
|
|
2028
2028
|
Your browser does not support the video tag.
|
|
2029
2029
|
</video>`;if(Z.spriteSheet)T=`<div class="stx-video-wrapper" data-sprite-sheet="${R0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
@@ -2072,9 +2072,9 @@ ${T}
|
|
|
2072
2072
|
width: 100%;
|
|
2073
2073
|
height: auto;
|
|
2074
2074
|
}
|
|
2075
|
-
`.trim();return{html:T,script:I,css:y}}function
|
|
2075
|
+
`.trim();return{html:T,script:I,css:y}}function d3(){return d2({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,X,J)=>{let{src:Y,options:Q}=aZ($,Z,X);if(!Y)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Y,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},q={isDev:X.__isDev||!1,tsVideosConfig:X.__tsVideosConfig},K=await m2(G,q),U=K.html;if(K.css)U+=`
|
|
2076
2076
|
<style>${K.css}</style>`;if(K.script)U+=`
|
|
2077
|
-
<script>${K.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function
|
|
2077
|
+
<script>${K.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function aZ($,Z,X){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=tZ(J),Q=m3(Y[0],X)||"",G={};if(Y[1]){let z=m3(Y[1],X);if(typeof z==="object"&&z!==null)G=z;else if(typeof Y[1]==="string")try{G=JSON.parse(Y[1])}catch{}}return{src:Q,options:G}}function tZ($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let q=$[z],K=z>0?$[z-1]:"";if((q==='"'||q==="'"||q==="`")&&K!=="\\"){if(!J)J=!0,Y=q;else if(q===Y)J=!1,Y="";else X+=q;continue}if(!J){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=q}if(X.trim())Z.push(X.trim());return Z}function m3($,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 e9=d3();function c3($,Z,X,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(z,q,K)=>{if(!K&&q.includes(":")){let U=q.split(":"),W=q,H=U.length>1?U[1]:"";if(H&&Z[H])K=Z[H];else if(W.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])K=Z.openGraph[U[1]];else K="";return K?`<meta property="${l(W)}" content="${l(K)}">`:""}return K?`<meta name="${l(q)}" content="${l(K)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(Y))!==null){let z=G.index,q=z+G[0].length-1,K=1,U=q+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")"){if(K--,K===0)break}U++}if(K!==0)break;let W=Y.substring(q+1,U).trim(),H=U+1,j=(()=>{try{let B=I0(W,Z);if(!B)return"";let _="<meta";if(B.name)_+=` name="${l(String(B.name))}"`;if(B.property)_+=` property="${l(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)_+=` content="${l(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return J0("MetaTag",_,X0.EVALUATION_ERROR)}})();Y=Y.substring(0,z)+j+Y.substring(H),Q.lastIndex=0}return Y}function p3($,Z,X){let J=$,Y=/@structuredData\s*\(/g,Q;while((Q=Y.exec(J))!==null){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1;while(K<J.length&&q>0){if(J[K]==="(")q++;else if(J[K]===")"){if(q--,q===0)break}K++}if(q!==0)break;let U=J.substring(z+1,K).trim(),W=K+1,H=(()=>{try{let j=I0(U,Z);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let B=j instanceof Error?j.message:String(j);return J0("StructuredData",B,X0.EVALUATION_ERROR)}})();J=J.substring(0,G)+H+J.substring(W),Y.lastIndex=0}return J}function i3($,Z,X,J){let Y=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(Y))!==null){let z=Y.indexOf("{",G.index+4),q=1,K=z+1,U=null,W=!1;while(K<Y.length&&q>0){let V=Y[K];if(W){W=!1,K++;continue}if(V==="\\"&&U){W=!0,K++;continue}if(U){if(V===U)U=null;K++;continue}if(V==='"'||V==="'"||V==="`"){U=V,K++;continue}if(V==="{")q++;else if(V==="}")q--;K++}if(q!==0)break;let H=Y.substring(K).match(/^\s*\)/);if(!H)break;let j=K+H[0].length,B=Y.substring(z,K),_=Y.substring(G.index,j),O=((V)=>{try{let L=I0(V,Z);if(!L)return"";let F="";if(L.title)F+=`<title>${l(L.title)}</title>
|
|
2078
2078
|
`,F+=`<meta name="title" content="${l(L.title)}">
|
|
2079
2079
|
`;if(L.description)F+=`<meta name="description" content="${l(L.description)}">
|
|
2080
2080
|
`;if(L.keywords){let w=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;F+=`<meta name="keywords" content="${l(w)}">
|
|
@@ -2096,7 +2096,7 @@ ${T}
|
|
|
2096
2096
|
`}if(w.site)F+=`<meta name="twitter:site" content="${l(w.site)}">
|
|
2097
2097
|
`;if(w.creator)F+=`<meta name="twitter:creator" content="${l(w.creator)}">
|
|
2098
2098
|
`}if(L.structuredData){let w=JSON.stringify(L.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${w}</script>
|
|
2099
|
-
`}return F.trim()}catch(L){let F=L instanceof Error?L.message:String(L);return J0("SEO",`Error processing @seo directive: ${F}`,X0.EVALUATION_ERROR)}})(B);Y=Y.substring(0,G.index)+O+Y.substring(j),Q.lastIndex=G.index+O.length}return Y}function
|
|
2099
|
+
`}return F.trim()}catch(L){let F=L instanceof Error?L.message:String(L);return J0("SEO",`Error processing @seo directive: ${F}`,X0.EVALUATION_ERROR)}})(B);Y=Y.substring(0,G.index)+O+Y.substring(j),Q.lastIndex=G.index+O.length}return Y}function n3($,Z,X){if(X.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Z.__stx_seo_staged===!0||X.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((H)=>H.property==="og:title"||H.name==="og:title"||H.name==="twitter:title"||H.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(X.seo?.defaultConfig?.title)G=X.seo.defaultConfig.title;else G=X.defaultTitle||"stx Project";let z="";if(Z.description)z=Z.description;else if(Z.meta&&Z.meta.description)z=Z.meta.description;else if(X.seo?.defaultConfig?.description)z=X.seo.defaultConfig.description;else z=X.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(X.seo?.defaultImage)q=X.seo.defaultImage;else if(X.defaultImage)q=X.defaultImage;let K=`
|
|
2100
2100
|
<!-- stx SEO Tags -->
|
|
2101
2101
|
<meta name="title" content="${l(G)}">
|
|
2102
2102
|
<meta name="description" content="${l(z)}">
|
|
@@ -2114,15 +2114,15 @@ ${T}
|
|
|
2114
2114
|
${K}
|
|
2115
2115
|
`),U;return U.replace(/<head[^>]*>/,`$&
|
|
2116
2116
|
${K}
|
|
2117
|
-
`)}function l($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var
|
|
2117
|
+
`)}function l($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var eZ=["og:","article:","book:","profile:","fb:","music:","video:"];function l3($){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 $5={name:"meta",handler:($,Z,X,J)=>{if(Z.length<1)return J0("Meta","meta directive requires at least the meta name",X0.INVALID_DIRECTIVE_SYNTAX);let Y=l3(Z[0]).value,Q;if(Z.length>1){let q=l3(Z[1]);Q=q.quoted?q.value:String(X?.[q.value]??q.value)}else{let q=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,K=X?.openGraph;Q=String(X?.[q]??K?.[q]??"")}if(!Q)return"";let z=eZ.some((q)=>Y.startsWith(q))?{property:Y,content:Q}:{name:Y,content:Q};if(X)X.__stx_runtime_head=l2(X.__stx_runtime_head??{},{meta:[z]});return""},hasEndTag:!1},Z5={name:"structuredData",handler:($,Z,X,J)=>{if($.trim()==="")return J0("StructuredData","structuredData directive requires JSON-LD content",X0.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return J0("StructuredData","structuredData requires @type property",X0.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 J0("StructuredData",Q,X0.EVALUATION_ERROR)}},hasEndTag:!0};function bq(){return[$5,Z5]}function yq($,Z){let X=Z.replace(/\/$/,""),J=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
|
|
2118
2118
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
2119
2119
|
${$.map((Q)=>{let G=Q.startsWith("http")?Q:`${X}${Q.startsWith("/")?"":"/"}${Q}`;return` <sitemap>
|
|
2120
|
-
<loc>${
|
|
2120
|
+
<loc>${ZX(G)}</loc>
|
|
2121
2121
|
<lastmod>${J}</lastmod>
|
|
2122
2122
|
</sitemap>`}).join(`
|
|
2123
2123
|
`)}
|
|
2124
|
-
</sitemapindex>`}async function
|
|
2125
|
-
`).trim()}function
|
|
2124
|
+
</sitemapindex>`}async function Cq($,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 z of G.scan($)){if(J.some((H)=>{if(H.startsWith("*"))return z.includes(H.slice(1));return z.startsWith(H)||z.includes(`/${H}`)}))continue;let K=z.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!K.startsWith("/"))K=`/${K}`;if(K!=="/"&&K.endsWith("/"))K=K.slice(0,-1);let U=`${$}/${z}`,W;try{let H=await Bun.file(U).stat();if(H)W=new Date(H.mtime).toISOString().split("T")[0]}catch{}Y.push({loc:K||"/",lastmod:W,priority:K==="/"?1:0.5})}return Y.sort((z,q)=>z.loc.localeCompare(q.loc)),Y}function $X($){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(`
|
|
2125
|
+
`).trim()}function Sq($){return $X({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function ZX($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}import XX from"fs";import g0 from"path";async function hq($,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 JX(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 JX($,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 z=null;if(g0.isAbsolute(Y)&&await a(Y))z=Y;else if(Z.componentsDir){let _=g0.join(Z.componentsDir,Y);if(await a(_))z=_}if(!z)z=await c2(Y,process.cwd(),Z,X);if(!z)return console.error(`Web component source file not found: ${Y}`),null;let q=await Bun.file(z).text();X.add(z);let U=($.outputFormat||"js")==="ts",W=U?QX({name:J,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):YX({name:J,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await XX.promises.mkdir(H,{recursive:!0});let j=U?"ts":"js",B=g0.join(H,`${Q}.${j}`);if(await Bun.write(B,W),Z.debug)console.log(`Built web component ${J} -> ${B}`);return B}function YX($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:q=[]}=$,K=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)K=K.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),K=K.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),K=K.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),K=K.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let U="";if(z)U=`<link rel="stylesheet" href="${z}">`;return`/**
|
|
2126
2126
|
* ${Z} Web Component
|
|
2127
2127
|
* Auto-generated from stx component
|
|
2128
2128
|
*/
|
|
@@ -2214,7 +2214,7 @@ class ${Z.replace(/\W/g,"")} extends ${J} {
|
|
|
2214
2214
|
|
|
2215
2215
|
// Register the web component
|
|
2216
2216
|
customElements.define('${X}', ${Z.replace(/\W/g,"")})
|
|
2217
|
-
`}function
|
|
2217
|
+
`}function QX($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:q=[],attributeTypes:K={}}=$,U=Z.replace(/\W/g,""),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>");W=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let H=z?`<link rel="stylesheet" href="${z}">`:"",j=(R)=>{switch(K[R]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},B=(R)=>R.replace(/-([a-z])/g,(D,A)=>A.toUpperCase()),_=q.map((R)=>` private _${B(R)}: ${j(R)} | null = null;`).join(`
|
|
2218
2218
|
`),O=q.map((R)=>{let D=j(R),A=B(R);return`
|
|
2219
2219
|
get ${A}(): ${D} | null {
|
|
2220
2220
|
return this._${A};
|
|
@@ -2369,9 +2369,9 @@ declare global {
|
|
|
2369
2369
|
|
|
2370
2370
|
// Register the web component
|
|
2371
2371
|
customElements.define('${X}', ${U});
|
|
2372
|
-
`}var X5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function J5($){let Z=$.split("").reduce((X,J)=>(X<<5)-X+J.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function
|
|
2372
|
+
`}var X5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function J5($){let Z=$.split("").reduce((X,J)=>(X<<5)-X+J.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function GX($,Z,X={}){let J={...X5,...X},Y=J5(Z);switch(J.strategy){case"shadow":return $;case"prefix":return qX($,J.prefix||Z,J.preserveOriginal);case"attribute":return zX($,Y,J.attributeName||"data-v",J.preserveOriginal);case"bem":return KX($,Z,J.preserveOriginal);default:return $}}function zX($,Z,X,J){let Y=`[${X}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,z)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${J?`${G}${Y}`:`${G}${Y}`}${z}`})}function qX($,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 KX($,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 UX($,Z,X={}){let J={...X5,...X};if(J.strategy==="shadow")return $;if(J.strategy==="attribute"){let Y=J5(Z),G=`${J.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(z,q,K)=>{if(/^(?:script|style|!--)$/i.test(q))return z;let U=K.trimEnd().endsWith("/"),W=U?K.slice(0,-1):K;return`<${q}${W} ${G}${U?"/":""}>`})}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((q)=>{if(!q)return q;if(q.startsWith(Y))return q;return`${Y}__${q}`}).join(" ")}"`})}return $}function uq($,Z={}){let X={...X5,...Z},J=J5($);return`${X.attributeName||"data-v"}-${J}`}function dq($,Z,X={}){let J="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,z,q)=>{if(/\bscoped\b/i.test(z)||X.strategy!=="shadow")J+=`${GX(q,Z,X)}
|
|
2373
2373
|
`;else J+=`${q}
|
|
2374
|
-
`;return""});return{html:
|
|
2374
|
+
`;return""});return{html:UX(Y,Z,X),css:J.trim()}}function S1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function mq($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:q={},events:K={},methods:U={},state:W={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((k)=>z[k].attribute!==!1).map((k)=>z[k].attribute||S1(k)),_=j.map((k)=>{let N=z[k],M=N.default!==void 0?JSON.stringify(N.default):N.type==="string"?'""':N.type==="number"?"0":N.type==="boolean"?"false":N.type==="array"?"[]":"{}";return` this._${k} = ${M};`}).join(`
|
|
2375
2375
|
`),O=j.map((k)=>{let N=z[k],M=N.attribute!==!1?N.attribute||S1(k):null,T=N.reflect&&M?`
|
|
2376
2376
|
if (value !== null && value !== undefined) {
|
|
2377
2377
|
${N.type==="boolean"?`if (value) { this.setAttribute('${M}', ''); }
|
|
@@ -2573,7 +2573,7 @@ customElements.define('${X}', ${H});
|
|
|
2573
2573
|
// Export for module usage
|
|
2574
2574
|
export { ${H} };
|
|
2575
2575
|
export default ${H};
|
|
2576
|
-
`}function
|
|
2576
|
+
`}function lq($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:q={},events:K={},methods:U={},state:W={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((N)=>z[N].attribute!==!1).map((N)=>z[N].attribute||S1(N)),_=(N)=>{switch(N){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"}},O=j.length>0?`
|
|
2577
2577
|
/**
|
|
2578
2578
|
* Props interface for ${Z}
|
|
2579
2579
|
*/
|
|
@@ -2825,7 +2825,7 @@ declare global {
|
|
|
2825
2825
|
customElements.define('${X}', ${H});
|
|
2826
2826
|
|
|
2827
2827
|
export default ${H};
|
|
2828
|
-
`}function
|
|
2828
|
+
`}function cq(){return`/**
|
|
2829
2829
|
* ReactiveElement Mixin
|
|
2830
2830
|
* Adds reactive properties and lifecycle management to web components
|
|
2831
2831
|
*/
|
|
@@ -2947,7 +2947,7 @@ else {
|
|
|
2947
2947
|
|
|
2948
2948
|
export { ReactiveElement };
|
|
2949
2949
|
export default ReactiveElement;
|
|
2950
|
-
`}function
|
|
2950
|
+
`}function pq(){return`/**
|
|
2951
2951
|
* stx Reactive Web Components Runtime
|
|
2952
2952
|
* Provides base classes and utilities for reactive web components
|
|
2953
2953
|
*/
|
|
@@ -3164,7 +3164,7 @@ else {
|
|
|
3164
3164
|
};
|
|
3165
3165
|
|
|
3166
3166
|
})(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);
|
|
3167
|
-
`}function
|
|
3167
|
+
`}function WX($,Z){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=X?X[1].trim():"",Y=Z,Q=[],G=!0;if(J){let W=J.match(/export\s+default\s+({[\s\S]*})/);if(W)try{let H=W[1],j=H.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Y=j[1];let B=H.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.length>0);let _=H.match(/shadowDOM\s*:\s*(true|false)/);if(_)G=_[1]==="true"}catch{}}let z=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=z?z[1].trim():"",K=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=K?K[1].trim():"";return{tag:Y,props:Q,template:q,styles:U,script:J,shadowDOM:G}}function HX($){let{tag:Z,props:X,template:J,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((W)=>W.charAt(0).toUpperCase()+W.slice(1)).join(""),z=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),K=X.map((W)=>`'${W}'`).join(", "),U=X.map((W)=>`
|
|
3168
3168
|
get ${W}() {
|
|
3169
3169
|
return this.getAttribute('${W}') || '';
|
|
3170
3170
|
}
|
|
@@ -3215,14 +3215,14 @@ ${U}
|
|
|
3215
3215
|
}
|
|
3216
3216
|
|
|
3217
3217
|
customElements.define('${Z}', ${G});
|
|
3218
|
-
`}async function
|
|
3219
|
-
${
|
|
3220
|
-
</script>`}var X4={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:t3,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,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:R3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:n3,hasEndTag:!1,description:"Include a web component in the template"},r3,a3,$5,Z5,f9,g9,h9,x9,L3,G3,S3,e9,...Z4],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 HX($,Z,X){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=X||process.cwd(),Q=T0.join(Y,"resources","views"),G=T0.join(Y,"resources","layouts");if(p2.existsSync(Q)&&p2.existsSync(G))return{root:"resources",pagesDir:"views"};let z=T0.join(Y,"resources","views","pages");if(p2.existsSync(z))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}var o3=new Set,i2=["partialsDir","componentsDir","layoutsDir"],Y5=new WeakMap;function jX($,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=HX($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,X&&J.root!=="."){let Y=`${Z}::${J.root}`;if(!o3.has(Y))o3.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(!Y5.has($)){let Y={};for(let Q of i2){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}Y5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of i2){let G=$[Q];if(typeof G!=="string"||!G)continue;if(T0.isAbsolute(G)||jX(G,Y))continue;$[Q]=T0.join(Y,G)}}for(let Y of i2){let Q=$[Y];if(typeof Q!=="string"||!Q||T0.isAbsolute(Q))continue;$[Y]=T0.resolve(Z,Q)}return $}function _X($,Z){let X=Y5.get($);for(let J of i2){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let Q=T0.isAbsolute(Y)?Y:T0.join(Z,Y);if(p2.existsSync(Q))continue;let G=X?.[J]??Y,z=$.root,q=!!z&&z!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(q?`, resolved under root "${z}".`:"."))}}function VX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function LX($){if(e3($.stateDir),$.stateDir=$4(),$.cachePath=K2($.cachePath),$.build)$.build.cacheDir=K2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=K2($.media.cache.directory);if($.story)$.story.outDir=K2($.story.outDir)}var P1=null,s3=new Map,n2=null;async function Q5($){if(!$){if(P1)return P1;if(n2)return n2}let Z=$?T0.resolve($):process.cwd(),X=s3.get(Z);if(X)return X;let J=(async()=>{let Q=(await WX({name:"stx",alias:"ui",cwd:Z,defaultConfig:X4,verbose:!1})).config;if(VX(Q),LX(Q),BX(Q,Z),_X(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await import("./chunk-kdrpx9ft.js"),z=[],q=[];for(let K of Q.plugins){let U=typeof K==="string"?K:K[0],W=typeof K==="string"?{}:K[1]||{};try{let H,j;try{H=await import(U),j=T0.dirname(u.resolve(U))}catch{let _=T0.resolve(process.cwd(),U);H=await import(_),j=T0.dirname(_)}let B=H.default||H;if(!G.has(B.name))await G.register(B,Q);if(B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)z.push(T0.resolve(j,O))}if(B.pages){let _=T0.resolve(j,B.pages),O=W.path||"/";q.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,V)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=V},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:j,config:Q};await B.setup(W,_)}console.log(`[stx] Plugin loaded: ${B.name||U}`)}catch(H){console.warn(`[stx] Failed to load plugin ${U}:`,H.message)}}Q._pluginComponentDirs=z,Q._pluginPageDirs=q}return Q})();if(s3.set(Z,J),!$)n2=J,J.then((Y)=>{P1=Y}).catch(()=>{});return J}var J4=new Proxy(X4,{get($,Z){if(P1&&Z in P1)return P1[Z];if(!n2)Q5().catch((X)=>{console.warn("[stx] Failed to load config file:",X?.message||X)});return $[Z]}});function XK($){return $}function JK($){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 z5=new Map;async function wX($,Z={}){try{if(!await a($))throw Error(`Markdown file not found: ${$}`);let J=(await OX.promises.stat($)).mtime.getTime();if(Z.cache&&z5.has($)){let W=z5.get($);if(W.updatedAt>=J)return{content:W.content,data:W.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=F3(Y),z=Z.markdown||J4.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},K=G2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)K=await RX(K,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:K,data:Q||{}};if(Z.cache)z5.set($,{...U,updatedAt:J});return U}catch(X){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,X);let J=X instanceof Error?X.message:String(X);return{content:j0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}var o2=null;async function RX($,Z,X){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!o2)try{o2=await FX({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,q,K,U)=>{let W=U.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),H=K||(X?"text":"");if(!H)return z;try{if(!o2.getSupportedLanguages().includes(H))return z;return(await o2.highlight(W,H,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${K}:`,j)}return z},Q=$,G=$.matchAll(J);for(let z of G){let[q,K,U,W]=z,H=await Y(q,K,U,W);Q=Q.replace(q,H)}return Q}async function Y4($,Z,X="",J={}){return await DX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,q,K)=>{try{let U=z;if(!G5.isAbsolute(z))U=G5.resolve(G5.dirname(X),z);let W={};if(q)try{try{W=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of L){let w=F.indexOf(":");if(w>0){let R=F.substring(0,w).trim(),D=F.substring(w+1).trim(),A=D.startsWith('"')&&D.endsWith('"'),k=D.startsWith("'")&&D.endsWith("'");if(A||k)D=D.substring(1,D.length-1);W[R]=D}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:H,data:j}=await wX(U,J),B={...Z,...j,...W},_=H,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(V,L)=>{let F=L.trim();return B[F]!==void 0?String(B[F]):V}),_}catch(U){let W=U instanceof Error?U.message:String(U);return j0("Markdown File",`Error including markdown file: ${W}`,X,$,K,G)}})}async function DX($,Z,X){let J=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],q=Y.index,K=Y;J.push(X(...K).then((U)=>({match:z,replacement:U,index:q})))}let Q=await Promise.all(J);Q.sort((z,q)=>q.index-z.index);let G=$;for(let{match:z,replacement:q}of Q)G=G.replace(z,()=>q);return G}function z1($,Z){try{let X=$.trim();if(z0(X))return U0(X,Object.keys(Z))(...Object.values(Z));else return e(X,Z)}catch{return!1}}class s2{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]!==`
|
|
3218
|
+
`}async function o3($,Z,X,J){if(Z.length<1)return J0("WebComponent","@webcomponent directive requires at least the tag name parameter",X0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(X.__stx_options||{}).componentsDir||"components",z=g0.isAbsolute(G)?[g0.join(G,`${Y}.stx`),g0.join(g0.dirname(J),`${Y}.stx`)]:[g0.join(g0.dirname(J),G,`${Y}.stx`),g0.join(process.cwd(),G,`${Y}.stx`),g0.join(g0.dirname(J),`${Y}.stx`)],q=null;for(let W of z)if(await a(W)){q=await Bun.file(W).text();break}if(!q)return J0("WebComponent",`Component file not found: ${Y}.stx`,X0.FILE_NOT_FOUND);let K=WX(q,Y);return`<script type="module">
|
|
3219
|
+
${HX(K)}
|
|
3220
|
+
</script>`}var J4={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:e3,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,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:D3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:o3,hasEndTag:!1,description:"Include a web component in the template"},a3,t3,$5,Z5,f9,g9,h9,x9,O3,z3,P3,e9,...X4],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 BX($,Z,X){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=X||process.cwd(),Q=T0.join(Y,"resources","views"),G=T0.join(Y,"resources","layouts");if(p2.existsSync(Q)&&p2.existsSync(G))return{root:"resources",pagesDir:"views"};let z=T0.join(Y,"resources","views","pages");if(p2.existsSync(z))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}var s3=new Set,i2=["partialsDir","componentsDir","layoutsDir"],Y5=new WeakMap;function _X($,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 VX($,Z){let X=!$.root,J=BX($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,X&&J.root!=="."){let Y=`${Z}::${J.root}`;if(!s3.has(Y))s3.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(!Y5.has($)){let Y={};for(let Q of i2){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}Y5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of i2){let G=$[Q];if(typeof G!=="string"||!G)continue;if(T0.isAbsolute(G)||_X(G,Y))continue;$[Q]=T0.join(Y,G)}}for(let Y of i2){let Q=$[Y];if(typeof Q!=="string"||!Q||T0.isAbsolute(Q))continue;$[Y]=T0.resolve(Z,Q)}return $}function LX($,Z){let X=Y5.get($);for(let J of i2){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let Q=T0.isAbsolute(Y)?Y:T0.join(Z,Y);if(p2.existsSync(Q))continue;let G=X?.[J]??Y,z=$.root,q=!!z&&z!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(q?`, resolved under root "${z}".`:"."))}}function OX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function FX($){if($4($.stateDir),$.stateDir=Z4(),$.cachePath=K2($.cachePath),$.build)$.build.cacheDir=K2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=K2($.media.cache.directory);if($.story)$.story.outDir=K2($.story.outDir)}var P1=null,r3=new Map,n2=null;async function Q5($){if(!$){if(P1)return P1;if(n2)return n2}let Z=$?T0.resolve($):process.cwd(),X=r3.get(Z);if(X)return X;let J=(async()=>{let Q=(await jX({name:"stx",alias:"ui",cwd:Z,defaultConfig:J4,verbose:!1})).config;if(OX(Q),FX(Q),VX(Q,Z),LX(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await import("./chunk-kdrpx9ft.js"),z=[],q=[];for(let K of Q.plugins){let U=typeof K==="string"?K:K[0],W=typeof K==="string"?{}:K[1]||{};try{let H,j;try{H=await import(U),j=T0.dirname(u.resolve(U))}catch{let _=T0.resolve(process.cwd(),U);H=await import(_),j=T0.dirname(_)}let B=H.default||H;if(!G.has(B.name))await G.register(B,Q);if(B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)z.push(T0.resolve(j,O))}if(B.pages){let _=T0.resolve(j,B.pages),O=W.path||"/";q.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,V)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=V},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:j,config:Q};await B.setup(W,_)}console.log(`[stx] Plugin loaded: ${B.name||U}`)}catch(H){console.warn(`[stx] Failed to load plugin ${U}:`,H.message)}}Q._pluginComponentDirs=z,Q._pluginPageDirs=q}return Q})();if(r3.set(Z,J),!$)n2=J,J.then((Y)=>{P1=Y}).catch(()=>{});return J}var Y4=new Proxy(J4,{get($,Z){if(P1&&Z in P1)return P1[Z];if(!n2)Q5().catch((X)=>{console.warn("[stx] Failed to load config file:",X?.message||X)});return $[Z]}});function zK($){return $}function qK($){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 z5=new Map;async function DX($,Z={}){try{if(!await a($))throw Error(`Markdown file not found: ${$}`);let J=(await wX.promises.stat($)).mtime.getTime();if(Z.cache&&z5.has($)){let W=z5.get($);if(W.updatedAt>=J)return{content:W.content,data:W.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=w3(Y),z=Z.markdown||Y4.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},K=G2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)K=await NX(K,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:K,data:Q||{}};if(Z.cache)z5.set($,{...U,updatedAt:J});return U}catch(X){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,X);let J=X instanceof Error?X.message:String(X);return{content:j0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}var o2=null;async function NX($,Z,X){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!o2)try{o2=await RX({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,q,K,U)=>{let W=U.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),H=K||(X?"text":"");if(!H)return z;try{if(!o2.getSupportedLanguages().includes(H))return z;return(await o2.highlight(W,H,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${K}:`,j)}return z},Q=$,G=$.matchAll(J);for(let z of G){let[q,K,U,W]=z,H=await Y(q,K,U,W);Q=Q.replace(q,H)}return Q}async function Q4($,Z,X="",J={}){return await AX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,q,K)=>{try{let U=z;if(!G5.isAbsolute(z))U=G5.resolve(G5.dirname(X),z);let W={};if(q)try{try{W=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of L){let w=F.indexOf(":");if(w>0){let R=F.substring(0,w).trim(),D=F.substring(w+1).trim(),A=D.startsWith('"')&&D.endsWith('"'),k=D.startsWith("'")&&D.endsWith("'");if(A||k)D=D.substring(1,D.length-1);W[R]=D}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:H,data:j}=await DX(U,J),B={...Z,...j,...W},_=H,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(V,L)=>{let F=L.trim();return B[F]!==void 0?String(B[F]):V}),_}catch(U){let W=U instanceof Error?U.message:String(U);return j0("Markdown File",`Error including markdown file: ${W}`,X,$,K,G)}})}async function AX($,Z,X){let J=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],q=Y.index,K=Y;J.push(X(...K).then((U)=>({match:z,replacement:U,index:q})))}let Q=await Promise.all(J);Q.sort((z,q)=>q.index-z.index);let G=$;for(let{match:z,replacement:q}of Q)G=G.replace(z,()=>q);return G}function z1($,Z){try{let X=$.trim();if(z0(X))return U0(X,Object.keys(Z))(...Object.values(Z));else return e(X,Z)}catch{return!1}}class s2{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]!==`
|
|
3221
3221
|
`)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]===`
|
|
3222
|
-
`)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 B0($,Z,X,J=0){let Y=0,Q=J,G=null,z=0,q=!1;while(Q<$.length){let K=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&K==="\\"){q=!0,Q++;continue}if(q=!1,(K==='"'||K==="'"||K==="`")&&!G){G=K,Q++;continue}if(K===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&K==="$"&&$[Q+1]==="{"){z++,Q+=2;continue}if(z>0&&K==="}"){z--,Q++;continue}if(K==="`"&&G==="`"&&z===0){G=null,Q++;continue}if(G){Q++;continue}if(K===Z)Y++;else if(K===X){if(Y--,Y===0)return Q}Q++}return-1}function Q4($,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 q5($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,X+=z;continue}if(z===Y&&Y!=="`"){Y=null,X+=z;continue}if(z==="`"&&!Y){Y="`",X+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,X+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,X+=z+$[G+1],G++;continue}if(Q>0&&z==="{"){Q++,X+=z;continue}if(Q>0&&z==="}"){Q--,X+=z;continue}if(Y){X+=z;continue}if(z==="(")J.paren++;else if(z===")")J.paren--;else if(z==="[")J.bracket++;else if(z==="]")J.bracket--;else if(z==="{")J.brace++;else if(z==="}")J.brace--;if(z==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}if(z==="|"&&$[G-1]==="\\"&&!Y){X=X.slice(0,-1)+z;continue}X+=z}if(X.trim())Z.push(X.trim());return Z}function q1($,Z){let X=NX($,Z);return X.ok?{expression:X.expression,endPos:X.endPos}:null}function NX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return{ok:!1,reason:"missing-open-paren",pos:X};let J=B0($,"(",")",X);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:X};return{ok:!0,expression:$.slice(X+1,J),endPos:J+1}}function AX($,Z){let X=$.lastIndexOf("<",Z);if(X===-1)return!1;return X>$.lastIndexOf(">",Z)}function V1($,Z,X,J){let Y=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${X}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let q=G.exec($),K=z.exec($),U=q?q.index:1/0,W=K?K.index:1/0;if(U<W)Y++,Q=U+q[0].length;else if(W<1/0){if(Y--,Y===0)return W;Q=W+K[0].length}else break}return-1}function G4($,Z){let X=$.slice(Z).match(/^@if\s*/);if(!X)return null;let J=Z+X[0].length,Y=q1($,J);if(!Y)return null;let Q=Y.endPos,G=V1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,U="if",W=Y.expression,H=0,j=0;while(K<z.length){let B=z.indexOf("@",K);if(B===-1)break;K=B;let _=z.substring(B);if(AX(z,B)){K++;continue}if(/^@if\s*\(/.test(_)){j++,K++;continue}if(/^@endif(?![a-z])/.test(_)){j--,K+=6;continue}if(j===0){let O=_.match(/^@elseif\s*/);if(O){q.push({type:U,condition:W,content:z.substring(H,K),start:Q+H,end:Q+K});let V=K+O[0].length,L=q1(z,V);if(!L){K++;continue}U="elseif",W=L.expression,K=L.endPos,H=K;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:U,condition:W,content:z.substring(H,K),start:Q+H,end:Q+K}),U="else",W=void 0,K+=5,H=K;continue}}K++}return q.push({type:U,condition:W,content:z.slice(H),start:Q+H,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function U2($){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=G4($,J.index);if(Q)Z.push(Q),X.lastIndex=Q.end;J=X.exec($)}return Z}function r2($,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 z=Q.index,q=z+Q[0].length-1,K=B0($,"(",")",q);if(K===-1){Q=Y.exec($);continue}let U=$.slice(q+1,K),W=K+1,H=V1($,Z,X,W);if(H===-1){Q=Y.exec($);continue}let j=$.slice(W,H),B=H+`@${X}`.length;J.push({fullMatch:$.slice(z,B),name:Z,params:U,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return J}function K5($,Z){let X=$.slice(Z).match(/^@switch\s*/);if(!X)return null;let J=Z+X[0].length,Y=q1($,J);if(!Y)return null;let Q=Y.endPos,G=V1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,U=null,W=0;while(K<z.length){let H=z.slice(K),j=H.match(/^@switch\s*\(/),B=H.match(/^@endswitch(?![a-z])/);if(j){if(W++,U)U.content+=j[0];K+=j[0].length;continue}if(B){if(W--,U)U.content+=B[0];K+=B[0].length;continue}if(W>0){if(U)U.content+=z[K];K++;continue}let _=H.match(/^@case\s*/),O=H.match(/^@default(?![a-z])/),V=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(U)q.push(U);let L=K+_[0].length,F=q1(z,L);if(!F){K++;continue}U={type:"case",value:F.expression,content:""},K=F.endPos}else if(O&&H.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},K+=O[0].length}else if(V&&H.startsWith("@break"))K+=V[0].length;else{if(U)U.content+=z[K];K++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:q,start:Z,end:G+10}}function MX($){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 z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",q=Q?z==="{{{"?"}}}":"!!}":"}}",K=G+z.length,U=kX($,K,q);if(U===-1){X=G+1;continue}let W=$.slice(K,U).trim(),H=U+q.length;Z.push({fullMatch:$.slice(G,H),expression:W,start:G,end:H,isRaw:Q}),X=H}return Z}function kX($,Z,X){let J=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(J<$.length){let z=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((z==='"'||z==="'")&&!Y){Y=z,J++;continue}if(z===Y&&Y!=="`"){Y=null,J++;continue}if(z==="`"&&!Y){Y="`",J++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,J++;continue}if(Y==="`"&&z==="$"&&$[J+1]==="{"){G++,J+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;J++;continue}if(Y){J++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")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 IX($){let Z=q5($);if(Z.length===0)return{baseExpression:"",filters:[]};let X=Z[0],J=[];for(let Y=1;Y<Z.length;Y++){let Q=TX(Z[Y]);if(Q)J.push(Q)}return{baseExpression:X,filters:J}}function TX($){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=B0(Z,"(",")",X);if(Q===-1)return{name:J,args:[]};let G=Z.slice(Y,Q),z=K4(G);return{name:J,args:z}}function K4($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,X+=z;continue}if(z===Y&&Y!=="`"){Y=null,X+=z;continue}if(z==="`"&&!Y){Y="`",X+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,X+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,X+="${",G++;continue}if(Q>0&&z==="{"){Q++,X+=z;continue}if(Q>0&&z==="}"){Q--,X+=z;continue}if(Y){X+=z;continue}if(z==="(")J.paren++;else if(z===")")J.paren--;else if(z==="[")J.bracket++;else if(z==="]")J.bracket--;else if(z==="{")J.brace++;else if(z==="}")J.brace--;if(z===","&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}X+=z}if(X.trim())Z.push(X.trim());return Z}function EX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;let J=B0($,"(",")",X);if(J===-1)return null;return{params:$.slice(X+1,J),endPos:J+1}}function bX($){let Z=[],J=new s2($).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 z=J[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let q=z.value;if(Y++,Y>=J.length)break;let K=J[Y];if(K.type==="IDENTIFIER"){let U=K.value;if(Y++,Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let W=Y<J.length?J[Y].start:$.length,H=z4(J,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:U,value:$.slice(W,H.endPos),exported:G,start:z.start,end:H.endPos})}}else if(K.type==="PUNCTUATION"&&(K.value==="{"||K.value==="[")){let U=K.start,W=K.value==="{"?"}":"]",H=B0($,K.value,W,U);if(H!==-1){let j=$.slice(U,H+1);if(Y=q4(J,H+1),Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let B=Y<J.length?J[Y].start:$.length,_=z4(J,Y,$);Y=_.nextIndex;let O=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:O,value:`${$.slice(B,_.endPos)}; ${q} ${j} = ${O}`,exported:G,start:z.start,end:_.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let q=G?J[Y-1].start:z.start;if(Y++,Y>=J.length)break;let K=J[Y];if(K.type==="IDENTIFIER"){let U=K.value;Y++;let W=-1;while(Y<J.length){if(J[Y].type==="PUNCTUATION"&&J[Y].value==="{"){W=J[Y].start;break}Y++}if(W!==-1){let H=B0($,"{","}",W);if(H!==-1)Z.push({type:"function",name:U,value:$.slice(q,H+1).replace(/^export\s+/,""),exported:G,start:q,end:H+1}),Y=q4(J,H+1)}}}else Y++}return Z}function z4($,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 q4($,Z){for(let X=0;X<$.length;X++)if($[X].start>=Z)return X;return $.length}function yX($,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,z=K5(J,G);if(!z)break;try{let q;if(z0(z.expression))q=U0(z.expression,Object.keys(Z))(...Object.values(Z));else q=e(z.expression,Z);let K="",U=!1;for(let W of z.cases)if(W.type==="default"){if(!U)K=W.content.trim()}else try{let H;if(W.value&&z0(W.value))H=U0(W.value,Object.keys(Z))(...Object.values(Z));else if(W.value)H=e(W.value,Z);if(q===H){K=W.content.trim(),U=!0;break}}catch{continue}J=J.substring(0,G)+K+J.substring(z.end),Y=!0}catch(q){let K=q instanceof Error?q.message:String(q),U=J0("Switch",`Error evaluating @switch expression: ${K}`,X0.EVALUATION_ERROR);J=J.substring(0,G)+U+J.substring(z.end);break}}return J}function CX($){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 SX($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(X,J)=>Z[Number(J)]??X)}function $1($,Z,X){let{masked:J,scripts:Y}=CX($);return SX(PX(J,Z,X),Y)}function PX($,Z,X){let J=$;J=yX(J,Z,X);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=q1(J,z+7);if(!q)break;let K=q.endPos,U=V1(J,"unless","endunless",K);if(U===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let W=J.slice(K,U),H=q.expression,j=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],w;while((w=O.exec(W))!==null)F.push({pos:w.index,type:"open"});while((w=V.exec(W))!==null)F.push({pos:w.index,type:"close"});while((w=L.exec(W))!==null)F.push({pos:w.index,type:"else"});F.sort((R,D)=>R.pos-D.pos);for(let R of F)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){j=R.pos;break}}let B;if(j!==-1){let _=W.slice(0,j),O=W.slice(j+5);B=`@if (${H})${O}@else ${_}@endif`}else B=`@if (!(${H}))${W}@endif`;J=J.substring(0,z)+B+J.substring(U+10),Q=!0}}J=W5(J,Z,X),J=H5(J,Z,X),J=U5(J,Z);let Y=()=>{let Q=U2(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let z=Q[G];try{let q="",K=!1;for(let U of z.branches){if(K)break;if(U.type==="else")q=U.content,K=!0;else try{let W;if(U.condition&&z0(U.condition))W=U0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)W=e(U.condition,Z);if(W)q=U.content,K=!0}catch(W){q=J0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${W instanceof Error?W.message:String(W)}`,X0.EVALUATION_ERROR),K=!0}}J=J.substring(0,z.start)+q+J.substring(z.end)}catch(q){let K=q instanceof Error?q.message:String(q),U=J0("If",`Error processing @if block: ${K}`,X0.EVALUATION_ERROR);J=J.substring(0,z.start)+U+J.substring(z.end)}}return!0};while(!0){let Q=J;if(!Y())break;if(J===Q)break}return J}function U4($){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 U5($,Z){let X=$;function J(z,q,K,U){let W=1,H=U,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${K}(?![a-z])`,"g");while(H<z.length&&W>0){j.lastIndex=H,B.lastIndex=H;let _=j.exec(z),O=B.exec(z),V=_?_.index:1/0,L=O?O.index:1/0;if(V<L)W++,H=V+_[0].length;else if(L<1/0){if(W--,W===0)return L;H=L+O[0].length}else break}return-1}function Y(z,q,K){let U=0,W=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],_;while((_=W.exec(z))!==null)B.push({pos:_.index,type:"open"});while((_=H.exec(z))!==null)B.push({pos:_.index,type:"close"});while((_=j.exec(z))!==null)B.push({pos:_.index,type:"else"});B.sort((O,V)=>O.pos-V.pos);for(let O of B)if(O.type==="open")U++;else if(O.type==="close")U--;else if(O.type==="else"&&U===0)return O.pos;return-1}{let z=!0;while(z){z=!1;let q=X.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,U,W,H=X.slice(K+5),j=U4(H);if(j)U=j.value,W=K+5+j.consumed;else W=K+5;let B=J(X,"auth","endauth",W);if(B===-1){console.warn(`[stx] @auth directive at position ${K} has no matching @endauth \u2014 the block was skipped.`);break}let _=X.slice(W,B),O=Y(_,"auth","endauth"),V;if(!Z.auth)V=!1;else V=U?z1(`auth?.check && auth?.user?.[${U}]`,Z):z1("auth?.check",Z);let L;if(O!==-1){let F=_.slice(0,O),w=_.slice(O+5);L=V?F:w}else L=V?_:"";X=X.substring(0,K)+L+X.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let q=X.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,U,W,H=X.slice(K+6),j=U4(H);if(j)U=j.value,W=K+6+j.consumed;else W=K+6;let B=J(X,"guest","endguest",W);if(B===-1){console.warn(`[stx] @guest directive at position ${K} has no matching @endguest \u2014 the block was skipped.`);break}let _=X.slice(W,B),O=Y(_,"guest","endguest"),V;if(!Z.auth)V=!0;else V=U?z1(`!auth?.check || !auth?.user?.[${U}]`,Z):z1("!auth?.check",Z);let L;if(O!==-1){let F=_.slice(0,O),w=_.slice(O+5);L=V?F:w}else L=V?_:"";X=X.substring(0,K)+L+X.substring(B+9),z=!0}}function Q(z,q,K){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[z];if(q)U.push(q);if(K){let W=z1(K,Z);U.push(W)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(z){let q=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let z of["can","cannot"]){let q=`end${z}`,K=z==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let W=X.match(new RegExp(`@${z}\\s*\\(`));if(!W||W.index===void 0)break;let H=W.index,j=X.slice(H+`@${z}`.length),B=G(j);if(!B)break;let _=H+`@${z}`.length+B.paramsEnd,O=J(X,z,q,_);if(O===-1){console.warn(`[stx] @${z} directive at position ${H} has no matching @${q} \u2014 the block was skipped.`);break}let V=X.slice(_,O),L=[],F=0,w=new RegExp(`@${z}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),D=new RegExp(`@${K}\\s*\\(`,"g"),A=/@else(?![a-z])/g,k=[],N;while((N=w.exec(V))!==null)k.push({pos:N.index,type:"open"});while((N=R.exec(V))!==null)k.push({pos:N.index,type:"close"});while((N=D.exec(V))!==null)k.push({pos:N.index,type:"elseDirective"});while((N=A.exec(V))!==null)k.push({pos:N.index,type:"else"});k.sort((b,C)=>b.pos-C.pos);for(let b of k){if(b.type==="open"){F++;continue}if(b.type==="close"){F--;continue}if(F===0)L.push(b)}let M=[],T=0;for(let b=0;b<L.length;b++){let C=L[b];if(M.push({content:V.slice(T,C.pos),ability:void 0}),C.type==="elseDirective"){let v=V.slice(C.pos+`@${K}`.length),P=G(v);if(P){M[M.length-1]={content:V.slice(T,C.pos)},T=C.pos+`@${K}`.length+P.paramsEnd,M.push({content:"",ability:P.ability,type:P.type,id:P.id}),M.pop();let g=L[b+1],x=g?g.pos:V.length;M.push({content:V.slice(T,x),ability:P.ability,type:P.type,id:P.id}),T=x}}else T=C.pos+5}if(T<V.length){let b=M[M.length-1];if(L.length>0&&L[L.length-1].type==="else")M.push({content:V.slice(T),isFinalElse:!0});else if(M.length===0)M.push({content:V.slice(T)})}let I=Q(B.ability,B.type,B.id),y=z==="can"?I:!I,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let v=M[C];if(v.isFinalElse){E=v.content,b=!0;break}if(v.ability){let P=Q(v.ability,v.type,v.id);if(z==="can"?P:!P){E=v.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(O+`@${q}`.length),U=!0}}return X}function W5($,Z,X){let J=$;function Y(Q,G,z,q,K){let U=!0;while(U){U=!1;let W=new RegExp(`@${G}\\s*\\(`),H=Q.match(W);if(!H||H.index===void 0)break;let j=H.index,B=q1(Q,j+`@${G}`.length);if(!B)break;let _=B.endPos,O=V1(Q,G,z,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let V=Q.slice(_,O),L=B.expression,F=-1,w=0,R=0;while(R<V.length){let D=V.indexOf("@",R);if(D===-1)break;let A=V.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){F=D;break}R=D+1}try{let D=q(L.trim()),A;if(F!==-1){let k=V.slice(0,F),N=V.slice(F+5);A=D?k:N}else A=D?V:"";Q=Q.substring(0,j)+A+Q.substring(O+`@${z}`.length),U=!0}catch(D){let A=D instanceof Error?D.message:String(D),k=J0(K,`Error processing @${G} directive: ${A}`,X0.EVALUATION_ERROR);Q=Q.substring(0,j)+k+Q.substring(O+`@${z}`.length);break}}return Q}return J=Y(J,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=Y(J,"empty","endempty",(Q)=>{let G=z1(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 H5($,Z,X){let J=$,Y="development";function Q(G,z,q,K){let U=new RegExp(`@${z}(?![a-z])`,"g"),W=new RegExp(`@${q}(?![a-z])`,"g"),H=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,_=!0;while(_){_=!1,U.lastIndex=0;let O=U.exec(B);if(!O)break;let V=O.index,L=V+O[0].length;if(z==="env"){let I=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;L+=I[0].length,K=Y===I[2]}let F=1,w=L,R=-1;while(F>0&&w<B.length){U.lastIndex=w,W.lastIndex=w;let I=U.exec(B),y=W.exec(B),E=I?I.index:1/0,b=y?y.index:1/0;if(E<b)F++,w=E+I[0].length;else if(b<1/0){if(F--,F===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${z} directive at position ${V} has no matching @${q} \u2014 the block was skipped.`);break}let D=B.substring(L,R),A=-1,k=0,N=0;while(N<D.length){let I=D.indexOf("@",N);if(I===-1)break;let y=D.substring(I);if(H.test(y)){k++,N=I+1;continue}if(j.test(y)){k--,N=I+1;continue}if(k===0&&/^@else(?![a-z])/.test(y)){A=I;break}N=I+1}let M;if(A!==-1){let I=D.slice(0,A),y=D.slice(A+5);M=K?I:y}else M=K?D:"";let T=`@${q}`.length;B=B.substring(0,V)+M+B.substring(R+T),_=!0}return B}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 j5=new WeakMap;function W4($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function L1($,Z){if(!$)return Z?.nonceGenerator?.()??W4();let X=j5.get($);if(!X)X=Z?.nonceGenerator?.()??W4(),j5.set($,X);return X}function bK($){j5.delete($)}function H4($,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 _5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${H4($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var vX={"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},B5={"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},fX={"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'"]},xX={"default-src":["'none'"],"frame-ancestors":["'none'"]};function yK($){return{enabled:!0,directives:{strict:vX,moderate:B5,relaxed:fX,api:xX}[$]||B5,useNonce:$==="strict",addMetaTag:!0}}function CK($,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 z=Array.isArray(G)?G:[],q=[...new Set([...z,...Y])];X[Q]=q}}return X}function j4($,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?L1(X,Z):void 0,Y=_5(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3223
|
-
${Y}`)}function B4($,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 _4($,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?L1(Z,Q):void 0;return _5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return L1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=L1(Z,Q);return Y}var gX={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?L1(X,Q):void 0;return _5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},hX={name:"cspNonce",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return L1(X,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function SK(){return[gX,hX]}function PK($){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 uX($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function vK($,Z){if(!$.enabled)return{};let X=$.useNonce?L1(Z,$):void 0,J=H4($.directives,X);return{[uX($.reportOnly)]:J}}var fK={enabled:!1,reportOnly:!1,directives:B5,useNonce:!1,addMetaTag:!0};import dX from"crypto";var mX=40,V4="_token",V5=null;function lX($=mX){let Z=dX.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return V5=Z,Z}function cX(){if(!V5)lX();return V5}function pX($=V4){let Z=cX();return`<input type="hidden" name="${$}" value="${Z}">`}function L4($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,X,J)=>{return pX(J||V4)})}async function O4($,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 iX(Y,Q,Z,X,J);else Y=await nX(Y,Q,Z,X,J)}return Y}async function iX($,Z,X,J,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,q=`@end${Q}`,K=$,U=v1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),W=[],H=U.exec(K);while(H!==null){let[j,B="",_=""]=H,O=H.index||0;try{let V=B?F4(B):[],L=_.trim(),F=await G(L,V,X,J);W.push({original:j,processed:F,startIndex:O})}catch(V){let L=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);W.push({original:j,processed:J0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${L}`,X0.EVALUATION_ERROR),startIndex:O})}H=U.exec(K)}for(let j=W.length-1;j>=0;j--){let{original:B,processed:_}=W[j];K=K.replace(B,_)}return K}async function nX($,Z,X,J,Y){let{name:Q,handler:G}=Z,z=$,q=v1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),K=[],U=q.exec(z);while(U!==null){let[j,B=""]=U,_=U.index||0;try{let O=F4(B),V=await G("",O,X,J);K.push({original:j,processed:V,startIndex:_})}catch(O){let V=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);K.push({original:j,processed:J0("CustomDirective",`Error in @${Q}(${B}): ${V}`,X0.EVALUATION_ERROR),startIndex:_})}U=q.exec(z)}let W=v1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=W.exec(z);while(H!==null){let[j]=H,B=H.index||0;try{let _=await G("",[],X,J);K.push({original:j,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);K.push({original:j,processed:J0("CustomDirective",`Error in @${Q}: ${O}`,X0.EVALUATION_ERROR),startIndex:B})}H=W.exec(z)}for(let j=K.length-1;j>=0;j--){let{original:B,processed:_}=K[j];z=z.replace(B,_)}return z}function F4($){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 w4=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,R4=/^[A-Za-z_$][\w$]*$/,oX=new Set(["light","dark","system"]);function O1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function sX($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,X=Z.appearance,J=Z.colorMode;if(O1(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(O1(X.key,"appearance.key"),O1(X.attribute,"appearance.attribute"),O1(X.default,"appearance.default"),O1(J.key,"colorMode.key"),O1(J.attribute,"colorMode.attribute"),O1(J.default,"colorMode.default"),!R4.test(X.key)||!R4.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!w4.test(X.attribute)||!w4.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(!oX.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 rX($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function aX($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${rX($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){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{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function tX($,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 D4($,Z){let X=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,G=tX(X,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=X.slice(Q+1,G).trim(),q=e(`(${z})`,Z),K=aX(sX(q));X=X.slice(0,Y.index)+K+X.slice(G+1),J.lastIndex=Y.index+K.length}return X}import eX from"crypto";function _0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var O5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function $J($){return{...O5,...$.forms?.classes}}function a2($,Z,X,J){let Y=$||Z;return X?`${Y} ${J}`:Y}function h0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function f1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${_0(Z)}"`}function L5($,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="${_0(`${h0($)}-error`)}"`;return J}function ZJ(){return eX.randomUUID()}function nK($,Z,X,J){let Y=$J(J),Q=$;return Q=JJ(Q,Z),Q=j2(Q,Z),Q=F5(Q,Z,Y),Q=w5(Q,Z,Y),Q}function j2($,Z){let X=$;return X=X.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=ZJ();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${_0(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="${_0(Q)}">`;return J}),X}function F5($,Z,X=O5){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,q,K="")=>{let U=Q||G||"POST",W=z||q||"",H=K1(K),j=U.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",_=`<form method="${_0(B)}" action="${_0(W)}"${H?` ${H}`:""}>`;if(_+=`
|
|
3222
|
+
`)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 B0($,Z,X,J=0){let Y=0,Q=J,G=null,z=0,q=!1;while(Q<$.length){let K=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&K==="\\"){q=!0,Q++;continue}if(q=!1,(K==='"'||K==="'"||K==="`")&&!G){G=K,Q++;continue}if(K===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&K==="$"&&$[Q+1]==="{"){z++,Q+=2;continue}if(z>0&&K==="}"){z--,Q++;continue}if(K==="`"&&G==="`"&&z===0){G=null,Q++;continue}if(G){Q++;continue}if(K===Z)Y++;else if(K===X){if(Y--,Y===0)return Q}Q++}return-1}function G4($,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 q5($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,X+=z;continue}if(z===Y&&Y!=="`"){Y=null,X+=z;continue}if(z==="`"&&!Y){Y="`",X+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,X+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,X+=z+$[G+1],G++;continue}if(Q>0&&z==="{"){Q++,X+=z;continue}if(Q>0&&z==="}"){Q--,X+=z;continue}if(Y){X+=z;continue}if(z==="(")J.paren++;else if(z===")")J.paren--;else if(z==="[")J.bracket++;else if(z==="]")J.bracket--;else if(z==="{")J.brace++;else if(z==="}")J.brace--;if(z==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}if(z==="|"&&$[G-1]==="\\"&&!Y){X=X.slice(0,-1)+z;continue}X+=z}if(X.trim())Z.push(X.trim());return Z}function q1($,Z){let X=MX($,Z);return X.ok?{expression:X.expression,endPos:X.endPos}:null}function MX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return{ok:!1,reason:"missing-open-paren",pos:X};let J=B0($,"(",")",X);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:X};return{ok:!0,expression:$.slice(X+1,J),endPos:J+1}}function kX($,Z){let X=$.lastIndexOf("<",Z);if(X===-1)return!1;return X>$.lastIndexOf(">",Z)}function V1($,Z,X,J){let Y=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${X}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let q=G.exec($),K=z.exec($),U=q?q.index:1/0,W=K?K.index:1/0;if(U<W)Y++,Q=U+q[0].length;else if(W<1/0){if(Y--,Y===0)return W;Q=W+K[0].length}else break}return-1}function z4($,Z){let X=$.slice(Z).match(/^@if\s*/);if(!X)return null;let J=Z+X[0].length,Y=q1($,J);if(!Y)return null;let Q=Y.endPos,G=V1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,U="if",W=Y.expression,H=0,j=0;while(K<z.length){let B=z.indexOf("@",K);if(B===-1)break;K=B;let _=z.substring(B);if(kX(z,B)){K++;continue}if(/^@if\s*\(/.test(_)){j++,K++;continue}if(/^@endif(?![a-z])/.test(_)){j--,K+=6;continue}if(j===0){let O=_.match(/^@elseif\s*/);if(O){q.push({type:U,condition:W,content:z.substring(H,K),start:Q+H,end:Q+K});let V=K+O[0].length,L=q1(z,V);if(!L){K++;continue}U="elseif",W=L.expression,K=L.endPos,H=K;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:U,condition:W,content:z.substring(H,K),start:Q+H,end:Q+K}),U="else",W=void 0,K+=5,H=K;continue}}K++}return q.push({type:U,condition:W,content:z.slice(H),start:Q+H,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function U2($){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=z4($,J.index);if(Q)Z.push(Q),X.lastIndex=Q.end;J=X.exec($)}return Z}function r2($,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 z=Q.index,q=z+Q[0].length-1,K=B0($,"(",")",q);if(K===-1){Q=Y.exec($);continue}let U=$.slice(q+1,K),W=K+1,H=V1($,Z,X,W);if(H===-1){Q=Y.exec($);continue}let j=$.slice(W,H),B=H+`@${X}`.length;J.push({fullMatch:$.slice(z,B),name:Z,params:U,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return J}function K5($,Z){let X=$.slice(Z).match(/^@switch\s*/);if(!X)return null;let J=Z+X[0].length,Y=q1($,J);if(!Y)return null;let Q=Y.endPos,G=V1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,U=null,W=0;while(K<z.length){let H=z.slice(K),j=H.match(/^@switch\s*\(/),B=H.match(/^@endswitch(?![a-z])/);if(j){if(W++,U)U.content+=j[0];K+=j[0].length;continue}if(B){if(W--,U)U.content+=B[0];K+=B[0].length;continue}if(W>0){if(U)U.content+=z[K];K++;continue}let _=H.match(/^@case\s*/),O=H.match(/^@default(?![a-z])/),V=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(U)q.push(U);let L=K+_[0].length,F=q1(z,L);if(!F){K++;continue}U={type:"case",value:F.expression,content:""},K=F.endPos}else if(O&&H.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},K+=O[0].length}else if(V&&H.startsWith("@break"))K+=V[0].length;else{if(U)U.content+=z[K];K++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:q,start:Z,end:G+10}}function IX($){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 z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",q=Q?z==="{{{"?"}}}":"!!}":"}}",K=G+z.length,U=TX($,K,q);if(U===-1){X=G+1;continue}let W=$.slice(K,U).trim(),H=U+q.length;Z.push({fullMatch:$.slice(G,H),expression:W,start:G,end:H,isRaw:Q}),X=H}return Z}function TX($,Z,X){let J=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(J<$.length){let z=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((z==='"'||z==="'")&&!Y){Y=z,J++;continue}if(z===Y&&Y!=="`"){Y=null,J++;continue}if(z==="`"&&!Y){Y="`",J++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,J++;continue}if(Y==="`"&&z==="$"&&$[J+1]==="{"){G++,J+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;J++;continue}if(Y){J++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")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 EX($){let Z=q5($);if(Z.length===0)return{baseExpression:"",filters:[]};let X=Z[0],J=[];for(let Y=1;Y<Z.length;Y++){let Q=bX(Z[Y]);if(Q)J.push(Q)}return{baseExpression:X,filters:J}}function bX($){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=B0(Z,"(",")",X);if(Q===-1)return{name:J,args:[]};let G=Z.slice(Y,Q),z=U4(G);return{name:J,args:z}}function U4($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,X+=z;continue}if(z===Y&&Y!=="`"){Y=null,X+=z;continue}if(z==="`"&&!Y){Y="`",X+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,X+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,X+="${",G++;continue}if(Q>0&&z==="{"){Q++,X+=z;continue}if(Q>0&&z==="}"){Q--,X+=z;continue}if(Y){X+=z;continue}if(z==="(")J.paren++;else if(z===")")J.paren--;else if(z==="[")J.bracket++;else if(z==="]")J.bracket--;else if(z==="{")J.brace++;else if(z==="}")J.brace--;if(z===","&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}X+=z}if(X.trim())Z.push(X.trim());return Z}function yX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;let J=B0($,"(",")",X);if(J===-1)return null;return{params:$.slice(X+1,J),endPos:J+1}}function CX($){let Z=[],J=new s2($).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 z=J[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let q=z.value;if(Y++,Y>=J.length)break;let K=J[Y];if(K.type==="IDENTIFIER"){let U=K.value;if(Y++,Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let W=Y<J.length?J[Y].start:$.length,H=q4(J,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:U,value:$.slice(W,H.endPos),exported:G,start:z.start,end:H.endPos})}}else if(K.type==="PUNCTUATION"&&(K.value==="{"||K.value==="[")){let U=K.start,W=K.value==="{"?"}":"]",H=B0($,K.value,W,U);if(H!==-1){let j=$.slice(U,H+1);if(Y=K4(J,H+1),Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let B=Y<J.length?J[Y].start:$.length,_=q4(J,Y,$);Y=_.nextIndex;let O=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:O,value:`${$.slice(B,_.endPos)}; ${q} ${j} = ${O}`,exported:G,start:z.start,end:_.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let q=G?J[Y-1].start:z.start;if(Y++,Y>=J.length)break;let K=J[Y];if(K.type==="IDENTIFIER"){let U=K.value;Y++;let W=-1;while(Y<J.length){if(J[Y].type==="PUNCTUATION"&&J[Y].value==="{"){W=J[Y].start;break}Y++}if(W!==-1){let H=B0($,"{","}",W);if(H!==-1)Z.push({type:"function",name:U,value:$.slice(q,H+1).replace(/^export\s+/,""),exported:G,start:q,end:H+1}),Y=K4(J,H+1)}}}else Y++}return Z}function q4($,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 K4($,Z){for(let X=0;X<$.length;X++)if($[X].start>=Z)return X;return $.length}function SX($,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,z=K5(J,G);if(!z)break;try{let q;if(z0(z.expression))q=U0(z.expression,Object.keys(Z))(...Object.values(Z));else q=e(z.expression,Z);let K="",U=!1;for(let W of z.cases)if(W.type==="default"){if(!U)K=W.content.trim()}else try{let H;if(W.value&&z0(W.value))H=U0(W.value,Object.keys(Z))(...Object.values(Z));else if(W.value)H=e(W.value,Z);if(q===H){K=W.content.trim(),U=!0;break}}catch{continue}J=J.substring(0,G)+K+J.substring(z.end),Y=!0}catch(q){let K=q instanceof Error?q.message:String(q),U=J0("Switch",`Error evaluating @switch expression: ${K}`,X0.EVALUATION_ERROR);J=J.substring(0,G)+U+J.substring(z.end);break}}return J}function PX($){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 vX($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(X,J)=>Z[Number(J)]??X)}function $1($,Z,X){let{masked:J,scripts:Y}=PX($);return vX(fX(J,Z,X),Y)}function fX($,Z,X){let J=$;J=SX(J,Z,X);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=q1(J,z+7);if(!q)break;let K=q.endPos,U=V1(J,"unless","endunless",K);if(U===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let W=J.slice(K,U),H=q.expression,j=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],w;while((w=O.exec(W))!==null)F.push({pos:w.index,type:"open"});while((w=V.exec(W))!==null)F.push({pos:w.index,type:"close"});while((w=L.exec(W))!==null)F.push({pos:w.index,type:"else"});F.sort((R,D)=>R.pos-D.pos);for(let R of F)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){j=R.pos;break}}let B;if(j!==-1){let _=W.slice(0,j),O=W.slice(j+5);B=`@if (${H})${O}@else ${_}@endif`}else B=`@if (!(${H}))${W}@endif`;J=J.substring(0,z)+B+J.substring(U+10),Q=!0}}J=W5(J,Z,X),J=H5(J,Z,X),J=U5(J,Z);let Y=()=>{let Q=U2(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let z=Q[G];try{let q="",K=!1;for(let U of z.branches){if(K)break;if(U.type==="else")q=U.content,K=!0;else try{let W;if(U.condition&&z0(U.condition))W=U0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)W=e(U.condition,Z);if(W)q=U.content,K=!0}catch(W){q=J0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${W instanceof Error?W.message:String(W)}`,X0.EVALUATION_ERROR),K=!0}}J=J.substring(0,z.start)+q+J.substring(z.end)}catch(q){let K=q instanceof Error?q.message:String(q),U=J0("If",`Error processing @if block: ${K}`,X0.EVALUATION_ERROR);J=J.substring(0,z.start)+U+J.substring(z.end)}}return!0};while(!0){let Q=J;if(!Y())break;if(J===Q)break}return J}function W4($){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 U5($,Z){let X=$;function J(z,q,K,U){let W=1,H=U,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${K}(?![a-z])`,"g");while(H<z.length&&W>0){j.lastIndex=H,B.lastIndex=H;let _=j.exec(z),O=B.exec(z),V=_?_.index:1/0,L=O?O.index:1/0;if(V<L)W++,H=V+_[0].length;else if(L<1/0){if(W--,W===0)return L;H=L+O[0].length}else break}return-1}function Y(z,q,K){let U=0,W=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],_;while((_=W.exec(z))!==null)B.push({pos:_.index,type:"open"});while((_=H.exec(z))!==null)B.push({pos:_.index,type:"close"});while((_=j.exec(z))!==null)B.push({pos:_.index,type:"else"});B.sort((O,V)=>O.pos-V.pos);for(let O of B)if(O.type==="open")U++;else if(O.type==="close")U--;else if(O.type==="else"&&U===0)return O.pos;return-1}{let z=!0;while(z){z=!1;let q=X.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,U,W,H=X.slice(K+5),j=W4(H);if(j)U=j.value,W=K+5+j.consumed;else W=K+5;let B=J(X,"auth","endauth",W);if(B===-1){console.warn(`[stx] @auth directive at position ${K} has no matching @endauth \u2014 the block was skipped.`);break}let _=X.slice(W,B),O=Y(_,"auth","endauth"),V;if(!Z.auth)V=!1;else V=U?z1(`auth?.check && auth?.user?.[${U}]`,Z):z1("auth?.check",Z);let L;if(O!==-1){let F=_.slice(0,O),w=_.slice(O+5);L=V?F:w}else L=V?_:"";X=X.substring(0,K)+L+X.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let q=X.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,U,W,H=X.slice(K+6),j=W4(H);if(j)U=j.value,W=K+6+j.consumed;else W=K+6;let B=J(X,"guest","endguest",W);if(B===-1){console.warn(`[stx] @guest directive at position ${K} has no matching @endguest \u2014 the block was skipped.`);break}let _=X.slice(W,B),O=Y(_,"guest","endguest"),V;if(!Z.auth)V=!0;else V=U?z1(`!auth?.check || !auth?.user?.[${U}]`,Z):z1("!auth?.check",Z);let L;if(O!==-1){let F=_.slice(0,O),w=_.slice(O+5);L=V?F:w}else L=V?_:"";X=X.substring(0,K)+L+X.substring(B+9),z=!0}}function Q(z,q,K){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[z];if(q)U.push(q);if(K){let W=z1(K,Z);U.push(W)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(z){let q=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let z of["can","cannot"]){let q=`end${z}`,K=z==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let W=X.match(new RegExp(`@${z}\\s*\\(`));if(!W||W.index===void 0)break;let H=W.index,j=X.slice(H+`@${z}`.length),B=G(j);if(!B)break;let _=H+`@${z}`.length+B.paramsEnd,O=J(X,z,q,_);if(O===-1){console.warn(`[stx] @${z} directive at position ${H} has no matching @${q} \u2014 the block was skipped.`);break}let V=X.slice(_,O),L=[],F=0,w=new RegExp(`@${z}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),D=new RegExp(`@${K}\\s*\\(`,"g"),A=/@else(?![a-z])/g,k=[],N;while((N=w.exec(V))!==null)k.push({pos:N.index,type:"open"});while((N=R.exec(V))!==null)k.push({pos:N.index,type:"close"});while((N=D.exec(V))!==null)k.push({pos:N.index,type:"elseDirective"});while((N=A.exec(V))!==null)k.push({pos:N.index,type:"else"});k.sort((b,C)=>b.pos-C.pos);for(let b of k){if(b.type==="open"){F++;continue}if(b.type==="close"){F--;continue}if(F===0)L.push(b)}let M=[],T=0;for(let b=0;b<L.length;b++){let C=L[b];if(M.push({content:V.slice(T,C.pos),ability:void 0}),C.type==="elseDirective"){let v=V.slice(C.pos+`@${K}`.length),P=G(v);if(P){M[M.length-1]={content:V.slice(T,C.pos)},T=C.pos+`@${K}`.length+P.paramsEnd,M.push({content:"",ability:P.ability,type:P.type,id:P.id}),M.pop();let g=L[b+1],x=g?g.pos:V.length;M.push({content:V.slice(T,x),ability:P.ability,type:P.type,id:P.id}),T=x}}else T=C.pos+5}if(T<V.length){let b=M[M.length-1];if(L.length>0&&L[L.length-1].type==="else")M.push({content:V.slice(T),isFinalElse:!0});else if(M.length===0)M.push({content:V.slice(T)})}let I=Q(B.ability,B.type,B.id),y=z==="can"?I:!I,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let v=M[C];if(v.isFinalElse){E=v.content,b=!0;break}if(v.ability){let P=Q(v.ability,v.type,v.id);if(z==="can"?P:!P){E=v.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(O+`@${q}`.length),U=!0}}return X}function W5($,Z,X){let J=$;function Y(Q,G,z,q,K){let U=!0;while(U){U=!1;let W=new RegExp(`@${G}\\s*\\(`),H=Q.match(W);if(!H||H.index===void 0)break;let j=H.index,B=q1(Q,j+`@${G}`.length);if(!B)break;let _=B.endPos,O=V1(Q,G,z,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let V=Q.slice(_,O),L=B.expression,F=-1,w=0,R=0;while(R<V.length){let D=V.indexOf("@",R);if(D===-1)break;let A=V.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){F=D;break}R=D+1}try{let D=q(L.trim()),A;if(F!==-1){let k=V.slice(0,F),N=V.slice(F+5);A=D?k:N}else A=D?V:"";Q=Q.substring(0,j)+A+Q.substring(O+`@${z}`.length),U=!0}catch(D){let A=D instanceof Error?D.message:String(D),k=J0(K,`Error processing @${G} directive: ${A}`,X0.EVALUATION_ERROR);Q=Q.substring(0,j)+k+Q.substring(O+`@${z}`.length);break}}return Q}return J=Y(J,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=Y(J,"empty","endempty",(Q)=>{let G=z1(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 H5($,Z,X){let J=$,Y="development";function Q(G,z,q,K){let U=new RegExp(`@${z}(?![a-z])`,"g"),W=new RegExp(`@${q}(?![a-z])`,"g"),H=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,_=!0;while(_){_=!1,U.lastIndex=0;let O=U.exec(B);if(!O)break;let V=O.index,L=V+O[0].length;if(z==="env"){let I=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;L+=I[0].length,K=Y===I[2]}let F=1,w=L,R=-1;while(F>0&&w<B.length){U.lastIndex=w,W.lastIndex=w;let I=U.exec(B),y=W.exec(B),E=I?I.index:1/0,b=y?y.index:1/0;if(E<b)F++,w=E+I[0].length;else if(b<1/0){if(F--,F===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${z} directive at position ${V} has no matching @${q} \u2014 the block was skipped.`);break}let D=B.substring(L,R),A=-1,k=0,N=0;while(N<D.length){let I=D.indexOf("@",N);if(I===-1)break;let y=D.substring(I);if(H.test(y)){k++,N=I+1;continue}if(j.test(y)){k--,N=I+1;continue}if(k===0&&/^@else(?![a-z])/.test(y)){A=I;break}N=I+1}let M;if(A!==-1){let I=D.slice(0,A),y=D.slice(A+5);M=K?I:y}else M=K?D:"";let T=`@${q}`.length;B=B.substring(0,V)+M+B.substring(R+T),_=!0}return B}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 j5=new WeakMap;function H4($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function L1($,Z){if(!$)return Z?.nonceGenerator?.()??H4();let X=j5.get($);if(!X)X=Z?.nonceGenerator?.()??H4(),j5.set($,X);return X}function vK($){j5.delete($)}function j4($,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 _5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${j4($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}var xX={"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},B5={"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},gX={"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'"]},hX={"default-src":["'none'"],"frame-ancestors":["'none'"]};function fK($){return{enabled:!0,directives:{strict:xX,moderate:B5,relaxed:gX,api:hX}[$]||B5,useNonce:$==="strict",addMetaTag:!0}}function xK($,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 z=Array.isArray(G)?G:[],q=[...new Set([...z,...Y])];X[Q]=q}}return X}function B4($,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?L1(X,Z):void 0,Y=_5(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
3223
|
+
${Y}`)}function _4($,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 V4($,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?L1(Z,Q):void 0;return _5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return L1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=L1(Z,Q);return Y}var uX={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?L1(X,Q):void 0;return _5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},dX={name:"cspNonce",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return L1(X,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function gK(){return[uX,dX]}function hK($){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 mX($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function uK($,Z){if(!$.enabled)return{};let X=$.useNonce?L1(Z,$):void 0,J=j4($.directives,X);return{[mX($.reportOnly)]:J}}var dK={enabled:!1,reportOnly:!1,directives:B5,useNonce:!1,addMetaTag:!0};import lX from"crypto";var cX=40,L4="_token",V5=null;function pX($=cX){let Z=lX.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return V5=Z,Z}function iX(){if(!V5)pX();return V5}function nX($=L4){let Z=iX();return`<input type="hidden" name="${$}" value="${Z}">`}function O4($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,X,J)=>{return nX(J||L4)})}async function F4($,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 oX(Y,Q,Z,X,J);else Y=await sX(Y,Q,Z,X,J)}return Y}async function oX($,Z,X,J,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,q=`@end${Q}`,K=$,U=v1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),W=[],H=U.exec(K);while(H!==null){let[j,B="",_=""]=H,O=H.index||0;try{let V=B?w4(B):[],L=_.trim(),F=await G(L,V,X,J);W.push({original:j,processed:F,startIndex:O})}catch(V){let L=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);W.push({original:j,processed:J0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${L}`,X0.EVALUATION_ERROR),startIndex:O})}H=U.exec(K)}for(let j=W.length-1;j>=0;j--){let{original:B,processed:_}=W[j];K=K.replace(B,_)}return K}async function sX($,Z,X,J,Y){let{name:Q,handler:G}=Z,z=$,q=v1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),K=[],U=q.exec(z);while(U!==null){let[j,B=""]=U,_=U.index||0;try{let O=w4(B),V=await G("",O,X,J);K.push({original:j,processed:V,startIndex:_})}catch(O){let V=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);K.push({original:j,processed:J0("CustomDirective",`Error in @${Q}(${B}): ${V}`,X0.EVALUATION_ERROR),startIndex:_})}U=q.exec(z)}let W=v1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=W.exec(z);while(H!==null){let[j]=H,B=H.index||0;try{let _=await G("",[],X,J);K.push({original:j,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);K.push({original:j,processed:J0("CustomDirective",`Error in @${Q}: ${O}`,X0.EVALUATION_ERROR),startIndex:B})}H=W.exec(z)}for(let j=K.length-1;j>=0;j--){let{original:B,processed:_}=K[j];z=z.replace(B,_)}return z}function w4($){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 R4=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,D4=/^[A-Za-z_$][\w$]*$/,rX=new Set(["light","dark","system"]);function O1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function aX($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,X=Z.appearance,J=Z.colorMode;if(O1(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(O1(X.key,"appearance.key"),O1(X.attribute,"appearance.attribute"),O1(X.default,"appearance.default"),O1(J.key,"colorMode.key"),O1(J.attribute,"colorMode.attribute"),O1(J.default,"colorMode.default"),!D4.test(X.key)||!D4.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!R4.test(X.attribute)||!R4.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(!rX.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 tX($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function eX($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${tX($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){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{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function $J($,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 N4($,Z){let X=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,G=$J(X,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=X.slice(Q+1,G).trim(),q=e(`(${z})`,Z),K=eX(aX(q));X=X.slice(0,Y.index)+K+X.slice(G+1),J.lastIndex=Y.index+K.length}return X}import ZJ from"crypto";function _0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var O5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function XJ($){return{...O5,...$.forms?.classes}}function a2($,Z,X,J){let Y=$||Z;return X?`${Y} ${J}`:Y}function h0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function f1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${_0(Z)}"`}function L5($,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="${_0(`${h0($)}-error`)}"`;return J}function JJ(){return ZJ.randomUUID()}function tK($,Z,X,J){let Y=XJ(J),Q=$;return Q=QJ(Q,Z),Q=j2(Q,Z),Q=F5(Q,Z,Y),Q=w5(Q,Z,Y),Q}function j2($,Z){let X=$;return X=X.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=JJ();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${_0(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="${_0(Q)}">`;return J}),X}function F5($,Z,X=O5){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,q,K="")=>{let U=Q||G||"POST",W=z||q||"",H=K1(K),j=U.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",_=`<form method="${_0(B)}" action="${_0(W)}"${H?` ${H}`:""}>`;if(_+=`
|
|
3224
3224
|
${j2("@csrf",Z)}`,!["GET","POST"].includes(j))_+=`
|
|
3225
|
-
${j2(`@method('${j}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,q,K="")=>{let U=Q||G||"",W=z||q||"",H=K1(K),j=W2(U,Z),B=j!==void 0&&j!==null?j:W||"",_=H.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",V=H2(U,Z),L=H.match(/class=['"]([^'"]+)['"]/i),F=a2(L?L[1]:"",X.input,V,X.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${_0(O)}" name="${_0(U)}"${f1(H,h0(U))} value="${_0(B)}" class="${F}"${L5(U,V,H)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let q=K1(G),K=W2(Q,Z)||z.trim(),U=H2(Q,Z),W=q.match(/class=['"]([^'"]+)['"]/i),H=a2(W?W[1]:"",X.input,U,X.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${_0(Q)}"${f1(q,h0(Q))} class="${H}"${L5(Q,U,q)}${j?` ${j}`:""}>${_0(K)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let q=K1(G),K=W2(Q,Z),U=H2(Q,Z),W=q.match(/class=['"]([^'"]+)['"]/i),H=a2(W?W[1]:"",X.input,U,X.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=z;if(K!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,V)=>{if((Array.isArray(K)?K.some((F)=>String(F)===V):String(K)===V)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${_0(Q)}"${f1(q,h0(Q))} class="${H}"${L5(Q,U,q)}${j?` ${j}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let q=G===void 0?"1":G,K=G===void 0?h0(Q):`${h0(Q)}-${h0(q)}`,U=K1(z),W=W2(Q,Z),H=W!==void 0&&(Array.isArray(W)?W.some((O)=>String(O)===q):W===!0||String(W)===q),j=U.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:X.checkInput,_=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${_0(Q)}"${f1(U,K)} value="${_0(q)}" class="${B}"${H?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let q=K1(z),K=W2(Q,Z),U=K!==void 0&&K===G,W=q.match(/class=['"]([^'"]+)['"]/i),H=W?W[1]:X.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${_0(Q)}"${f1(q,`${h0(Q)}-${h0(G)}`)} value="${_0(G)}" class="${H}"${U?" checked":""}${j?` ${j}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=K1(G),q=z.match(/accept=['"]([^'"]+)['"]/i),K=q?q[1]:"",U=z.includes("multiple"),W=H2(Q,Z),H=z.match(/class=['"]([^'"]+)['"]/i),j=a2(H?H[1]:"",X.input,W,X.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${_0(Q)}"${f1(z,h0(Q))}`,`class="${j}"`];if(K)_.push(`accept="${_0(K)}"`);if(U)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let q=K1(G),K=q.match(/class=['"]([^'"]+)['"]/i),U=K?K[1]:X.label,W=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${_0(h0(Q))}" class="${U}"${W?` ${W}`:""}>${z}</label>`}),J}function w5($,Z,X=O5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,Q)=>{try{if(H2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return N4(Y,Z);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return N4(Y,Z)}let K=q.trim();if(z0(K)){let U=e(K,Z);return U!==void 0?String(U):K}return K}catch{return q}});return`<div id="${_0(`${h0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function H2($,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 N4($,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 W2($,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 A4={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 oK($,Z){A4[$]=Z}function R5($){let[Z,...X]=$.split(":"),J=X.length>0?X.join(":").split(","):[];return{name:Z.trim(),params:J}}function XJ($,Z,X,J={}){let Y=[],Q=X.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=R5(G),q=A4[z.name];if(!q){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let U=`${$}_confirmation`;z.params=[J[U]]}let K=q(Z,z.params||[],$);if(K)Y.push(z.message||K)}return{field:$,valid:Y.length===0,errors:Y}}function sK($,Z){let X={};for(let[J,Y]of Object.entries(Z)){let Q=XJ(J,$[J],Y,$);if(!Q.valid)X[J]=Q.errors}return X}function JJ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(X,J,Y,Q)=>{let G=Y.split("|").map((q)=>q.trim()),z=[];for(let q of G){let K=R5(q);switch(K.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),K.name==="integer")z.push('step="1"');break;case"min":if(K.params?.[0])z.push(`minlength="${K.params[0]}"`);break;case"max":if(K.params?.[0])z.push(`maxlength="${K.params[0]}"`);break;case"regex":if(K.params?.[0])z.push(`pattern="${K.params[0]}"`);break}}return`<!-- @validate:${J}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var M4={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 rK($){M4[$.name]=$}function YJ($,Z,X={}){let J=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=R5(Q),z=M4[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let q=z.validate($,G.params||[],X);if(q!==!0)J.push(q)}return{valid:J.length===0,errors:J}}function aK($,Z){let X={},J=!0;for(let[Y,Q]of Object.entries(Z)){let G=YJ($[Y],Q,$);if(!G.valid)J=!1,X[Y]=G.errors}return{valid:J,errors:X}}function tK($,Z){let X=JSON.stringify(Z);return`
|
|
3225
|
+
${j2(`@method('${j}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,q,K="")=>{let U=Q||G||"",W=z||q||"",H=K1(K),j=W2(U,Z),B=j!==void 0&&j!==null?j:W||"",_=H.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",V=H2(U,Z),L=H.match(/class=['"]([^'"]+)['"]/i),F=a2(L?L[1]:"",X.input,V,X.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${_0(O)}" name="${_0(U)}"${f1(H,h0(U))} value="${_0(B)}" class="${F}"${L5(U,V,H)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let q=K1(G),K=W2(Q,Z)||z.trim(),U=H2(Q,Z),W=q.match(/class=['"]([^'"]+)['"]/i),H=a2(W?W[1]:"",X.input,U,X.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${_0(Q)}"${f1(q,h0(Q))} class="${H}"${L5(Q,U,q)}${j?` ${j}`:""}>${_0(K)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let q=K1(G),K=W2(Q,Z),U=H2(Q,Z),W=q.match(/class=['"]([^'"]+)['"]/i),H=a2(W?W[1]:"",X.input,U,X.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=z;if(K!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,V)=>{if((Array.isArray(K)?K.some((F)=>String(F)===V):String(K)===V)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${_0(Q)}"${f1(q,h0(Q))} class="${H}"${L5(Q,U,q)}${j?` ${j}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let q=G===void 0?"1":G,K=G===void 0?h0(Q):`${h0(Q)}-${h0(q)}`,U=K1(z),W=W2(Q,Z),H=W!==void 0&&(Array.isArray(W)?W.some((O)=>String(O)===q):W===!0||String(W)===q),j=U.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:X.checkInput,_=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${_0(Q)}"${f1(U,K)} value="${_0(q)}" class="${B}"${H?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let q=K1(z),K=W2(Q,Z),U=K!==void 0&&K===G,W=q.match(/class=['"]([^'"]+)['"]/i),H=W?W[1]:X.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${_0(Q)}"${f1(q,`${h0(Q)}-${h0(G)}`)} value="${_0(G)}" class="${H}"${U?" checked":""}${j?` ${j}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=K1(G),q=z.match(/accept=['"]([^'"]+)['"]/i),K=q?q[1]:"",U=z.includes("multiple"),W=H2(Q,Z),H=z.match(/class=['"]([^'"]+)['"]/i),j=a2(H?H[1]:"",X.input,W,X.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${_0(Q)}"${f1(z,h0(Q))}`,`class="${j}"`];if(K)_.push(`accept="${_0(K)}"`);if(U)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let q=K1(G),K=q.match(/class=['"]([^'"]+)['"]/i),U=K?K[1]:X.label,W=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${_0(h0(Q))}" class="${U}"${W?` ${W}`:""}>${z}</label>`}),J}function w5($,Z,X=O5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,Q)=>{try{if(H2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return A4(Y,Z);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return A4(Y,Z)}let K=q.trim();if(z0(K)){let U=e(K,Z);return U!==void 0?String(U):K}return K}catch{return q}});return`<div id="${_0(`${h0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function H2($,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 A4($,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 W2($,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 M4={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 eK($,Z){M4[$]=Z}function R5($){let[Z,...X]=$.split(":"),J=X.length>0?X.join(":").split(","):[];return{name:Z.trim(),params:J}}function YJ($,Z,X,J={}){let Y=[],Q=X.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=R5(G),q=M4[z.name];if(!q){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let U=`${$}_confirmation`;z.params=[J[U]]}let K=q(Z,z.params||[],$);if(K)Y.push(z.message||K)}return{field:$,valid:Y.length===0,errors:Y}}function $U($,Z){let X={};for(let[J,Y]of Object.entries(Z)){let Q=YJ(J,$[J],Y,$);if(!Q.valid)X[J]=Q.errors}return X}function QJ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(X,J,Y,Q)=>{let G=Y.split("|").map((q)=>q.trim()),z=[];for(let q of G){let K=R5(q);switch(K.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),K.name==="integer")z.push('step="1"');break;case"min":if(K.params?.[0])z.push(`minlength="${K.params[0]}"`);break;case"max":if(K.params?.[0])z.push(`maxlength="${K.params[0]}"`);break;case"regex":if(K.params?.[0])z.push(`pattern="${K.params[0]}"`);break}}return`<!-- @validate:${J}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var k4={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 ZU($){k4[$.name]=$}function GJ($,Z,X={}){let J=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=R5(Q),z=k4[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let q=z.validate($,G.params||[],X);if(q!==!0)J.push(q)}return{valid:J.length===0,errors:J}}function XU($,Z){let X={},J=!0;for(let[Y,Q]of Object.entries(Z)){let G=GJ($[Y],Q,$);if(!G.valid)J=!1,X[Y]=G.errors}return{valid:J,errors:X}}function JU($,Z){let X=JSON.stringify(Z);return`
|
|
3226
3226
|
<script>
|
|
3227
3227
|
(function() {
|
|
3228
3228
|
const form = document.getElementById('${$}');
|
|
@@ -3274,8 +3274,8 @@ catch { return 'Please enter a valid URL'; } },
|
|
|
3274
3274
|
}
|
|
3275
3275
|
});
|
|
3276
3276
|
})();
|
|
3277
|
-
</script>`.trim()}var B2=/<\/?template\b[^>]*>/gi,
|
|
3278
|
-
`)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},U=()=>{if(Y!==0)return;let W=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!J.has(B))X.push(B),J.add(B);return}let H=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))X.push(B),J.add(B);return}let j=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))X.push(B),J.add(B)}};while(Q<G){if(K())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]);continue}if(Z[Q]==="`"){q();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])))U();Q++}return X.join(", ")}function
|
|
3277
|
+
</script>`.trim()}var B2=/<\/?template\b[^>]*>/gi,zJ=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function qJ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return zJ.test(Z)}function t2($){B2.lastIndex=0;let Z;while((Z=B2.exec($))!==null){if(Z[0].startsWith("</")||qJ(Z[0]))continue;let X=Z.index,J=B2.lastIndex,Y=1,Q;while((Q=B2.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:X,openEnd:J,closeStart:G,end:B2.lastIndex,content:$.slice(J,G)}}}else Y++;return null}return null}import W0 from"path";function D5($,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 KJ($,Z,X){let J=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(J);while(Q){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1;while(K<J.length&&q>0){if(J[K]==="(")q++;else if(J[K]===")")q--;K++}if(q!==0)break;let U=J.substring(z+1,K-1),W=`${X}(${U})`;J=J.substring(0,G)+W+J.substring(K),Y.lastIndex=G+W.length,Q=Y.exec(J)}return J}function UJ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function T4($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,z=(W)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===W){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let W=1;while(Q<G&&W>0)if(Z[Q]==="{")W++,Q++;else if(Z[Q]==="}")W--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},K=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3278
|
+
`)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},U=()=>{if(Y!==0)return;let W=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!J.has(B))X.push(B),J.add(B);return}let H=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))X.push(B),J.add(B);return}let j=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))X.push(B),J.add(B)}};while(Q<G){if(K())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]);continue}if(Z[Q]==="`"){q();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])))U();Q++}return X.join(", ")}function E4($,Z=""){let X=T4($).split(",").map((J)=>J.trim()).filter(Boolean);return`
|
|
3279
3279
|
(function() {
|
|
3280
3280
|
${x1("var",X)}
|
|
3281
3281
|
var __destroyHooks = [];
|
|
@@ -3284,11 +3284,11 @@ catch { return 'Please enter a valid URL'; } },
|
|
|
3284
3284
|
|
|
3285
3285
|
${$}
|
|
3286
3286
|
${Z}})();
|
|
3287
|
-
`}function
|
|
3287
|
+
`}function b4($,Z){return`
|
|
3288
3288
|
// Register scope variables for STX runtime
|
|
3289
3289
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
3290
3290
|
var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
|
|
3291
|
-
${
|
|
3291
|
+
${T4($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
3292
3292
|
`)}
|
|
3293
3293
|
// #1767: when the bundler renamed a component const that collided with an
|
|
3294
3294
|
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
@@ -3296,7 +3296,7 @@ ${I4($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3296
3296
|
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
3297
3297
|
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
3298
3298
|
window.stx._scopes['${Z}'] = __scopeRegistration;
|
|
3299
|
-
`}function
|
|
3299
|
+
`}function WJ($,Z){let X=b4($,Z),J=`
|
|
3300
3300
|
(function() {
|
|
3301
3301
|
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
|
|
3302
3302
|
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
@@ -3305,29 +3305,29 @@ ${I4($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3305
3305
|
} finally {
|
|
3306
3306
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3307
3307
|
}
|
|
3308
|
-
})();`;return J+
|
|
3308
|
+
})();`;return J+E4($,X)+`
|
|
3309
3309
|
} finally {
|
|
3310
3310
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
3311
3311
|
}
|
|
3312
|
-
})();`}function
|
|
3313
|
-
`;continue}if($0)try{let{extractVariables:Z0}=await import("./chunk-
|
|
3314
|
-
`}}if(b){let P=
|
|
3312
|
+
})();`}function HJ($,Z){if(Y1($)){let Y=Y1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:b1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0}}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],stamped:!0};let Q=X[1],G=X[2],z=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${z}${$.slice(X[0].length)}`,mergedIntoExisting:null,stamped:!0}}return{html:$,mergedIntoExisting:null,stamped:!1}}var I4=0,LU=new g1(500),y4=new Set;function OU(){y4.clear()}function jJ($){if($.__onceStore instanceof Set)return $.__onceStore;return y4}async function N5($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||W0.join(W0.dirname(X),"partials");if(G&&!W0.isAbsolute(G))G=W0.resolve(process.cwd(),G);let z=KJ($,"@partial","@include"),q=jJ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(_,O,V)=>{let L=O.trim(),F=`${X}:${L}`;if(q.has(F))return"";return q.add(F),O});{let _=/@includeIf\s*\(/g,O;while((O=_.exec(z))!==null){let V=O.index,L=V+O[0].length-1,F=1,w=L+1;while(w<z.length&&F>0){if(z[w]==="(")F++;else if(z[w]===")")F--;w++}if(F!==0)break;let R=z.substring(L+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let A=D[1],k=K(A,G,X),N="";if(k&&await Bun.file(k).exists())Y.add(k),N=`@include(${R})`;z=z.substring(0,V)+N+z.substring(w),_.lastIndex=0}}for(let[_,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=V.exec(z))!==null){let F=L.index,w=F+L[0].length-1,R=1,D=w+1;while(D<z.length&&R>0){if(z[D]==="(")R++;else if(z[D]===")")R--;D++}if(R!==0)break;let A=z.substring(w+1,D-1),k=D5(A,0);if(k===-1){V.lastIndex=D;continue}let N=A.substring(0,k).trim(),M=A.substring(k+1).trim(),T=M.match(/^\s*['"]([^'"]+)['"]/);if(!T){V.lastIndex=D;continue}let I=T[1],y=M.substring(T[0].length),E,b=D5(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${N})`,v;if(z0(C)){let x=U0(C,Object.keys(Z));v=Boolean(x(...Object.values(Z)))}else v=Boolean(e(C,Z));let P=O?!v:v,g="";if(P){let x=K(I,G,X);if(x&&await Bun.file(x).exists())Y.add(x);g=`@include('${I}'${E?`, ${E}`:""})`}z=z.substring(0,F)+g+z.substring(D),V.lastIndex=0}catch(C){let v=C instanceof Error?C.message:String(C),P=j0("Include",`Error evaluating ${_} condition: ${v}`,X,$,F);z=z.substring(0,F)+P+z.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,O;while((O=_.exec(z))!==null){let V=O.index,L=V+O[0].length-1,F=1,w=L+1;while(w<z.length&&F>0){if(z[w]==="(")F++;else if(z[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=z.substring(L+1,w),D=z.substring(V,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){_.lastIndex=0,z=z.replace(D,"");continue}let[,k,N,M,T]=A;try{let I,y=N.trim();if(z0(y))I=U0(y,Object.keys(Z))(...Object.values(Z));else I=e(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},v=await H(k,C,$,V);E+=v}else if(T)E=await H(T,{},$,V);z=z.substring(0,V)+E+z.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);z=z.substring(0,V)+j0("Each",`Error in @each: ${y}`,X,$,V)+z.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,O;while((O=_.exec(z))!==null){let V=O.index,L=V+O[0].length-1,F=1,w=L+1;while(w<z.length&&F>0){if(z[w]==="(")F++;else if(z[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=z.substring(L+1,w),D=z.substring(V,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){_.lastIndex=0,z=z.replace(D,"");continue}let k=A[1],N=R.slice(A[0].length),M,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}M=N.substring(0,b+1),N=N.slice(b+1)}let I,y=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(k.replace(/'/g,'"')),b={};if(M)try{b=I0(M,Z)}catch(v){let P=v instanceof Error?v.message:String(v);if(J.debug){let g=j0("Include",`Error parsing includeFirst variables: ${P}`,X,$,V,D);z=z.replace(D,()=>g)}else z=z.replace(D,()=>I||"");continue}let C=!1;for(let v of E){let P=K(v,G,X);if(!P)continue;if(await a(P)){let g=await H(v,b,$,V);z=z.replace(D,()=>g),C=!0;break}}if(!C)if(I!==void 0)z=z.replace(D,()=>I);else if(J.debug){let v=j0("Include",`None of the includeFirst paths exist: ${k}`,X,$,V,D);z=z.replace(D,()=>v)}else z=z.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=j0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);z=z.replace(D,()=>C)}_.lastIndex=0}}function K(_,O,V){try{let L=_;if(!_.endsWith(".stx"))L=`${_}.stx`;let F=W0.resolve(O),w=W0.resolve(W0.dirname(V)),R;if(!L.startsWith("./")&&!L.startsWith("../"))R=W0.resolve(O,L);else R=W0.resolve(w,L);let D=W0.normalize(R),A=D.startsWith(F+W0.sep)||D===F,k=D.startsWith(w+W0.sep)||D===w,N=!1,M=W0.dirname(w);if(D.startsWith(M+W0.sep)){if(!W0.relative(M,D).split(W0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!A&&!k&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${F}, ${w}`),null;return D}catch(L){return console.error(`Error resolving path ${_}: ${L}`),null}}let U=W0.resolve(X);Q.add(U);function W(_,O,V,L){return J.onIncludeError?.({includePath:_,templatePath:X,message:O,partialsDir:G}),j0("Include",O,X,V,L)}async function H(_,O={},V,L){let F=K(_,G,X);if(!F)return W(_,`Could not resolve path for include: ${_}`,V,L);let w=W0.resolve(F);if(Q.has(w)){let R=[...Q,w].map((D)=>W0.basename(D)).join(" -> ");return W(_,`Circular include detected: ${R}`,V,L)}try{Y.add(F);let R;if(!R)try{R=await Bun.file(F).text()}catch(P){let g=P instanceof Error?P.message:String(P);return W(_,`Error loading include file ${_}: ${g}`,V,L)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:P}=await import("./chunk-mkn6qqc7.js");R=P(R,Z)}if(R&&(J.debug||!e2()&&!$9()))try{let{warnUnbalancedTags:P}=await import("./chunk-vrvehb01.js");P(R,F)}catch{}let D=R;try{let{processESImports:P}=await import("./chunk-jg0axas8.js");await P(R,Z,F,J,Y)}catch(P){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,P instanceof Error?P.message:P)}let A=t2(D);if(A)D=A.content.trim();let N=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(N)M=`<style${N[1]}>${N[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=J1(R,F);for(let[P,g]of Object.entries(O))T[P]=g;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],E="",b=null;for(let P of y){let g=P[1]||"",x=P[2]||"",$0=g.includes("server"),a0=F1(g);if(!$0&&x.trim()){let{interpolateScriptExpressions:Z0}=await import("./chunk-n3jyv9z6.js");x=Z0(x,T)}let M0="";try{let{extractAndStripCssImports:Z0,renderVendorStyleTags:H0}=await import("./chunk-vy8v5xdb.js"),k0=Z0(x,{filePath:F,projectRoot:process.cwd()});x=k0.code,M0=H0(k0.styles)}catch(Z0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,Z0 instanceof Error?Z0.message:Z0)}if(a0&&x.trim())x=w1(x);if(!$0){try{let{injectBrowserCoreAutoImports:H0}=await import("./chunk-vy8v5xdb.js");x=H0(x).code;let{hasUserImports:k0,bundleClientScript:E0}=await import("./chunk-7ej1d910.js");if(k0(x))x=await E0(x,F,{projectRoot:process.cwd()})}catch(H0){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,H0 instanceof Error?H0.message:H0)}let{stripStxRuntimeImports:Z0}=await import("./chunk-8emkx9ja.js");x=Z0(x)}let C0=UJ(x);if(C0&&!$0){b=`stx_scope_${W0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++I4}`;let Z0=t0(x),H0=WJ(Z0,b);E+=`${M0}<script data-stx-scoped data-stx-run="always">${H0}</script>
|
|
3313
|
+
`;continue}if($0)try{let{extractVariables:Z0}=await import("./chunk-e4akvata.js");await Z0(x,T,F)}catch(Z0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,Z0)}if(!$0&&!C0){let Z0=g.replace(/\bclient\b/i,"").trim();b=`stx_scope_${W0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++I4}`;let H0=t0(x),k0=b4(H0,b),E0=E4(H0,k0);E+=`${M0}<script data-stx-scoped data-stx-run="always"${Z0?` ${Z0}`:""}>${E0}</script>
|
|
3314
|
+
`}}if(b){let P=HJ(D,b);if(D=P.html,P.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${P.mergedIntoExisting}']`),b=P.mergedIntoExisting;else if(!P.stamped)console.warn(`[stx] ${W0.relative(process.cwd(),F)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`)}if(D.includes("@include")||D.includes("@partial"))D=await N5(D,T,F,J,Y,Q);let{processLoops:C}=await import("./chunk-kawk5ve9.js"),v=C(D,T,F);if(v=$1(v,T,F),v=B1(v,T,F),M)v+=`
|
|
3315
3315
|
`+M;if(E)v+=`
|
|
3316
3316
|
`+E;return v}catch(R){let D=R instanceof Error?R.message:String(R);return W(_,`Error processing include ${_}: ${D}`,V,L)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let _=B.index,O=_+B[0].length-1,V=1,L=O+1;while(L<z.length&&V>0){if(z[L]==="(")V++;else if(z[L]===")")V--;L++}if(V!==0)break;let F=z.substring(_,L),w=z.substring(O+1,L-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=L;continue}let D=R[1],A,k=w.substring(R[0].length),N=D5(k,0);if(N!==-1)A=k.substring(N+1).trim();let M={};if(A)try{M=I0(A,Z)}catch(I){let y=I instanceof Error?I.message:String(I);z=z.replace(F,j0("Include",`Error parsing include variables for ${D}: ${y}`,X,$,_)),j.lastIndex=0;continue}let T=await H(D,M,$,_);z=z.substring(0,_)+T+z.substring(L),j.lastIndex=0}return z}function A5($,Z){let X=$;function J(Y,Q,G,z){let q=Y,K=!0;while(K){K=!1;let U=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),W=q.match(U);if(!W||W.index===void 0)break;let H=W.index,j=W[1],B=H+W[0].length,_=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),V=1,L=B,F=-1;while(V>0&&L<q.length){let R=q.slice(L),D=R.match(_),A=R.match(O),k=D?L+D.index:1/0,N=A?L+A.index:1/0;if(k<N)V++,L=k+(D[0].length||1);else if(N<1/0){if(V--,V===0){F=N;break}L=N+G.length+1}else break}if(F===-1)break;let w=q.slice(B,F);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);q=q.substring(0,H)+q.substring(F+`@${G}`.length),K=!0}return q}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function M5($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
|
|
3317
|
-
`)})}import*as k5 from"path";async function
|
|
3317
|
+
`)})}import*as k5 from"path";async function C4($,Z,X=""){if(k5.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 P4($,Z,X,"@js","@endjs")}async function S4($,Z,X=""){if(k5.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 P4($,Z,X,"@ts","@endts")}async function P4($,Z,X,J,Y){let Q=$,G=v1(`${J}([\\s\\S]*?)${Y}`,"g"),z=[],q;while((q=G.exec($))!==null)z.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:K,content:U,index:W}of z)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),_=U.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 V=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=V.length>0?`return { ${V.join(", ")} };`:"return {};",F=`
|
|
3318
3318
|
${_}
|
|
3319
3319
|
${L}
|
|
3320
|
-
`,R=Function(...j,F)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(K,"")}catch(H){console.error(`Error executing ${J} code block in ${X}:`,H);let j=H instanceof Error?H.message:String(H),B=j0(`${J} Directive`,`Error executing code: ${j}`,X,$,W,K);console.error(B),Q=Q.replace(K,"")}return Q}var
|
|
3320
|
+
`,R=Function(...j,F)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(K,"")}catch(H){console.error(`Error executing ${J} code block in ${X}:`,H);let j=H instanceof Error?H.message:String(H),B=j0(`${J} Directive`,`Error executing code: ${j}`,X,$,W,K);console.error(B),Q=Q.replace(K,"")}return Q}var BJ=1000,_J=!1;function VJ($,Z){let X=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",Y=0,Q;while((Q=X.exec($))!==null){let G=Q.index+Q[0].length,z=Q.index+Q[0].indexOf("("),q=B0($,"(",")",z);if(q===-1)continue;let K=$.slice(G,q).trim();if(!K)continue;if(!Object.keys(Z).some((H)=>new RegExp(`(?:^|[^\\w$.])${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(K)))continue;let W;try{let H=I0(K,Z);if(!H||typeof H!=="object")continue;W=JSON.stringify(H)}catch{continue}J+=$.slice(Y,G)+W,Y=q,X.lastIndex=q}return Y===0?$:J+$.slice(Y)}function LJ($,Z){let X=/@component\s*\(/g,J=$,Y,Q=[];while((Y=X.exec(J))!==null){let G=Y.index,z=G+Y[0].length-1,q=1,K=z+1;while(K<J.length&&q>0){if(J[K]==="(")q++;else if(J[K]===")"){if(q--,q===0)break}K++}if(q!==0)continue;let U=J.substring(z+1,K),W=K+1,H=U.match(/^\s*['"]([^'"]+)['"]/);if(!H)continue;let j=H[1],B=U.slice(H[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let V=I0(O,Z),L=JSON.stringify(V),F=`@component('${j}', ${L})`;Q.push({start:G,end:W,replacement:F})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Q[G];J=J.substring(0,z)+K+J.substring(q)}return J}function X9($,Z,X){let J=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(J))!==null){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1,U=null,W=!1;while(K<J.length&&q>0){let B=J[K];if(W){W=!1,K++;continue}if(B==="\\"&&U){W=!0,K++;continue}if(U){if(B===U)U=null;K++;continue}if(B==='"'||B==="'"||B==="`"){U=B,K++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}K++}if(q!==0)break;let H=J.substring(z+1,K),j=X(H);J=J.substring(0,G)+j+J.substring(K+1)}return J}function OJ($,Z){let X=$;return X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return J}),X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Y,Q)=>{try{let G=Object.keys(Z),z=Object.values(Z);g4(Q);let K=U0(Q,G)(...z),U=JSON.stringify(K);if(U===void 0){if(!Q9(Q).some((j)=>!(j in Z)))return"";return J}let W=Buffer.from(U,"utf8").toString("base64");return`__stx_${Y}="${W}"`}catch(G){return J}}),X}var J9="<!--__STX_BREAK__-->",Y9="<!--__STX_CONTINUE__-->";function FJ($,Z){let X=$;return X=X9(X,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(z0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?J9:""}catch{return""}}),X=X9(X,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(z0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?Y9:""}catch{return""}}),X}function wJ($){let Z=$;return Z=Z.replace(/@break(?!\()/g,J9),Z=Z.replace(/@continue(?!\()/g,Y9),Z}function v4($){let Z=$.includes(J9),X=Z?$.substring(0,$.indexOf(J9)):$;return{hasBreak:Z,content:X}}function f4($){let Z=$.includes(Y9),X=Z?$.substring(0,$.indexOf(Y9)):$;return{hasContinue:Z,content:X}}function h4($){let Z=$;return Z=X9(Z,"@break",(X)=>{let J=X.trim();if(!Z9(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=X9(Z,"@continue",(X)=>{let J=X.trim();if(!Z9(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function RJ($){let Z=/@forelse\s*\(/g,X,J=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((U,W)=>U.pos-W.pos);let z=[],q=0;for(let U of J)q+=U.delta,z.push({pos:U.pos,depth:q});function K(U){let W=0,H=z.length-1,j=0;while(W<=H){let B=W+H>>1;if(z[B].pos<=U)j=z[B].depth,W=B+1;else H=B-1}return j}while((X=Z.exec($))!==null){if(K(X.index)>0)continue;let U=X.index,W=X.index+X[0].length-1,H=1,j=W+1,B=-1;while(j<$.length&&H>0){if($[j]==="(")H++;else if($[j]===")"){if(H--,H===0){B=j;break}}j++}if(B===-1)continue;let _=$.substring(W+1,B),O=u4(_);if(!O)continue;let{arrayExpr:V,itemVar:L}=O,F=B+1,w=1,R=F,D=/@forelse\s*\(/g,A=/@endforelse/g,k=-1;while(w>0&&R<$.length){D.lastIndex=R,A.lastIndex=R;let E=D.exec($),b=A.exec($);if(!b)break;if(E&&E.index<b.index)w++,R=E.index+E[0].length;else{if(w--,w===0){k=b.index;break}R=b.index+11}}if(k===-1)continue;let N=$.substring(F,k),M=k+11,T=-1,I=0,y=0;while(y<N.length){let E=N.indexOf("@",y);if(E===-1)break;let b=N.substring(E);if(/^@forelse\s*\(/.test(b))I++,y=E+1;else if(b.startsWith("@endforelse"))I--,y=E+11;else if(I===0&&b.startsWith("@empty")){if(N.length<=E+6||!/[a-z]/i.test(N[E+6])){T=E;break}y=E+1}else y=E+1}if(T===-1)continue;return{start:U,end:M,arrayExpr:V,itemVar:L,foreachContent:N.substring(0,T),emptyContent:N.substring(T+6)}}return null}function x4($,Z){let X=$;while(!0){let J=RJ(X);if(!J)break;let{start:Y,end:Q,arrayExpr:G,itemVar:z,foreachContent:q,emptyContent:K}=J;try{let U;if(z0(G))U=U0(G,Object.keys(Z))(...Object.values(Z));else U=e(G,Z);let W;if(!Array.isArray(U)||U.length===0)W=K;else W=`@foreach (${G} as ${z})${q}@endforeach`;X=X.substring(0,Y)+W+X.substring(Q)}catch(U){let W=U instanceof Error?U.message:String(U),H=J0("Forelse",`Error in @forelse(${G} as ${z}): ${W}`,X0.EVALUATION_ERROR);X=X.substring(0,Y)+H+X.substring(Q)}}return X}function u4($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let X=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!X)return null;let J=X[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=X[2].trim();return J&&Y?{arrayExpr:Y,itemVar:J}:null}function d4($,Z,X,J){let Y=$;Y=x4(Y,Z);function Q(q){let K=/@foreach\s*\(/g,U;while((U=K.exec(q))!==null){let W=U.index,H=U.index+U[0].length-1,j=1,B=H+1,_=-1;while(B<q.length&&j>0){if(q[B]==="(")j++;else if(q[B]===")"){if(j--,j===0){_=B;break}}B++}if(_===-1)continue;let O=q.substring(H+1,_),V=u4(O);if(!V)continue;let L=W,{arrayExpr:F,itemVar:w}=V,R=_+1,D=1,A=R,k=/@foreach\s*\(/g,N=/@endforeach/g;while(D>0&&A<q.length){k.lastIndex=A,N.lastIndex=A;let M=k.exec(q),T=N.exec(q);if(!T)break;if(M&&M.index<T.index)D++,A=M.index+M[0].length;else{if(D--,D===0){let I=q.substring(R,T.index),y=T.index+11;return{start:L,end:y,arrayExpr:F,itemVar:w,content:I}}A=T.index+11}}}return null}function G(q,K){let U=q;while(!0){let W=Q(U);if(!W)break;let{start:H,end:j,arrayExpr:B,itemVar:_,content:O}=W;try{let V=B.trim(),L;if(z0(V))L=U0(V,Object.keys(K))(...Object.values(K));else L=e(V,K);let F=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),F=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),F=!0;else{console.warn(`[stx] @foreach(${V}) in ${X}: ${V} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let T=J0("Foreach",`Error in @foreach: ${V} is not iterable`,X0.TYPE_ERROR);U=U.substring(0,H)+T+U.substring(j);continue}let w=J?.loops?.useAltLoopVariable??_J,R=_.trim(),D=null,A,k=!1;if(R.includes("=>")){let T=R.split("=>").map((I)=>I.trim());if(T.length===2&&T[0]&&T[1])D=T[0],A=T[1];else A=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let T=R.split(",").map((I)=>I.trim());if(T.length===2&&T[0]&&T[1])A=T[0],D=T[1],k=!0;else A=R}else A=R;let N="",M=L;for(let T=0;T<M.length;T++){let I=M[T],y={index:T,iteration:T+1,first:T===0,last:T===M.length-1,count:M.length},E={...K,loop:y,$loop:y};if(A.startsWith("[")&&A.endsWith("]")){let P=A.slice(1,-1).split(",").map((g)=>g.trim());if(Array.isArray(I))P.forEach((g,x)=>{if(g)E[g]=I[x]});else E[A]=I}else E[A]=I;if(D)if(!k&&F&&Array.isArray(I)&&I.length===2)E[D]=I[0],E[A]=I[1];else E[D]=T;let b=FJ(O,E),C=f4(b);if(C.hasContinue){N+=C.content;continue}let v=v4(b);if(v.hasBreak){N+=v.content;break}if(b=x4(b,E),b=G(b,E),b=$1(b,E,X),b=wJ(b),v=v4(b),v.hasBreak){N+=v.content;break}if(C=f4(b),C.hasContinue){N+=C.content;continue}b=B1(b,E,X),b=OJ(b,E),b=LJ(b,E),b=VJ(b,E),N+=b}U=U.substring(0,H)+N+U.substring(j)}catch(V){let L=J0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${V instanceof Error?V.message:String(V)}`,X0.EVALUATION_ERROR);U=U.substring(0,H)+L+U.substring(j)}}return U}Y=G(Y,Z),Y=l4(Y,Z,X,J);let z=J?.loops?.maxWhileIterations??BJ;return Y=AJ(Y,Z,z),Y}function m4($){return Z9($)}function l4($,Z,X,J){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=z+G[0].length-1,K=B0(Y,"(",")",q);if(K===-1)break;let U=Y.slice(q+1,K),W=K+1,H=r2(Y.slice(z),"for","endfor");if(H.length===0)break;let j=H[0].content,B=z+H[0].end;if(!m4(U)){let _=J0("For",`Unsafe expression in @for: ${U}`,X0.UNSAFE_EXPRESSION);Y=Y.substring(0,z)+_+Y.substring(B),Q=!0;continue}try{let _=DJ(U),O=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(_.length>0&&O){let D=NJ({forExpr:U,content:j,iterVarNames:_,context:Z,filePath:X,options:J});Y=Y.substring(0,z)+D+Y.substring(B),Q=!0;continue}let V=Object.keys(Z),L=Object.values(Z),F=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(D,A)=>{return`\${${A}}`});F=h4(F);let R=Function(...V,`
|
|
3321
3321
|
let result = '';
|
|
3322
3322
|
for (${U}) {
|
|
3323
3323
|
result += \`${F}\`;
|
|
3324
3324
|
}
|
|
3325
3325
|
return result;
|
|
3326
|
-
`)(...L);Y=Y.substring(0,z)+R+Y.substring(B),Q=!0}catch(_){let O=J0("For",`Error in @for(${U}): ${_ instanceof Error?_.message:String(_)}`,X0.EVALUATION_ERROR);Y=Y.substring(0,z)+O+Y.substring(B),Q=!0}}return Y}function
|
|
3326
|
+
`)(...L);Y=Y.substring(0,z)+R+Y.substring(B),Q=!0}catch(_){let O=J0("For",`Error in @for(${U}): ${_ instanceof Error?_.message:String(_)}`,X0.EVALUATION_ERROR);Y=Y.substring(0,z)+O+Y.substring(B),Q=!0}}return Y}function DJ($){let Z=$.trim(),X=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(X){let Q=X[1];return Q.slice(1,-1).split(",").map((z)=>{let q=z.trim();if(!q)return"";let K=q.indexOf(":");if(K>=0&&Q.startsWith("{")){let H=q.slice(K+1).trim(),j=H.indexOf("=");return(j>=0?H.slice(0,j):H).trim()}let U=q.indexOf("="),W=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(W)?W:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function NJ($){let{forExpr:Z,content:X,iterVarNames:J,context:Y,filePath:Q,options:G}=$,z=Object.keys(Y),q=Object.values(Y),K=Function(...z,"__pushIter",`
|
|
3327
3327
|
for (${Z}) {
|
|
3328
3328
|
__pushIter([${J.join(", ")}])
|
|
3329
3329
|
}
|
|
3330
|
-
`),U=[];K(...q,(j)=>{U.push(j)});let W=Q??"inline.stx",H="";for(let j of U){let B={...Y};J.forEach((O,V)=>{B[O]=j[V]});let _=
|
|
3330
|
+
`),U=[];K(...q,(j)=>{U.push(j)});let W=Q??"inline.stx",H="";for(let j of U){let B={...Y};J.forEach((O,V)=>{B[O]=j[V]});let _=l4(X,B,Q,G);_=$1(_,B,W),_=B1(_,B,W),H+=_}return H}function AJ($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=G+Q[0].length-1,q=B0(J,"(",")",z);if(q===-1)break;let K=J.slice(z+1,q),U=r2(J.slice(G),"while","endwhile");if(U.length===0)break;let W=U[0].content,H=G+U[0].end;if(!m4(K)){let j=J0("While",`Unsafe expression in @while: ${K}`,X0.UNSAFE_EXPRESSION);J=J.substring(0,G)+j+J.substring(H),Y=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),_=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,F)=>{return`\${${F}}`});_=h4(_);let V=Function(...j,`
|
|
3331
3331
|
let result = '';
|
|
3332
3332
|
let maxIterations = ${X}; // Configurable safety limit
|
|
3333
3333
|
let counter = 0;
|
|
@@ -3339,31 +3339,31 @@ ${I4($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
3339
3339
|
result += '<!-- [While Error [1104]]: Maximum iterations (${X}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
3340
3340
|
}
|
|
3341
3341
|
return result;
|
|
3342
|
-
`)(...B);J=J.substring(0,G)+V+J.substring(H),Y=!0}catch(j){let B=J0("While",`Error in @while(${K}): ${j instanceof Error?j.message:String(j)}`,X0.EVALUATION_ERROR);J=J.substring(0,G)+B+J.substring(H),Y=!0}}return J}function
|
|
3342
|
+
`)(...B);J=J.substring(0,G)+V+J.substring(H),Y=!0}catch(j){let B=J0("While",`Error in @while(${K}): ${j instanceof Error?j.message:String(j)}`,X0.EVALUATION_ERROR);J=J.substring(0,G)+B+J.substring(H),Y=!0}}return J}function MJ($,Z="_method"){let X=$.toUpperCase();if(X==="GET"||X==="POST")return"";return`<input type="hidden" name="${Z}" value="${X}">`}function c4($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,X,J,Y,Q)=>{return MJ(J,Q||"_method")})}async function p4($,Z,X,J,Y){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((z)=>z.timing===Y);if(G.length===0)return Q;for(let z of G){if(!z.name||typeof z.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",z);continue}try{let q=await z.handler(Q,Z,X,J);if(typeof q==="string")Q=q;else if(J.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${z.name}:`,q);if(J.debug){let K=j0("Middleware",`Error in middleware '${z.name}': ${q instanceof Error?q.message:String(q)}`,X,$);Q=Q.replace(/<body[^>]*>/,`$&
|
|
3343
3343
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${C9(K)}</div>
|
|
3344
|
-
`)}}}return Q}async function
|
|
3344
|
+
`)}}}return Q}async function i4($,Z,X,J){return p4($,Z,X,J,"before")}async function n4($,Z,X,J){return p4($,Z,X,J,"after")}Q2();Q2();function o4($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,X,J,Y,Q)=>{try{let G=Y?I0(Y,{}):{};return I5(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var p0={patterns:[],exact:{}};function dU($,Z){if(!p0.exact[$])p0.exact[$]=[];p0.exact[$].push(Z)}function mU($,Z){let X=typeof $==="string"?new RegExp($):$;p0.patterns.push({pattern:X,callback:Z})}async function s4($,Z){let X=$.split("/").pop()?.split(".")[0]||"";if(p0.exact[$])for(let J of p0.exact[$])await Promise.resolve(J(Z,$));if(p0.exact[X])for(let J of p0.exact[X])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:Y}of p0.patterns)if(J.test($)||J.test(X))await Promise.resolve(Y(Z,$))}function lU(){p0.patterns=[],p0.exact={}}var kJ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),IJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function T5($){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,z=J[1].toLowerCase();if(J[0].endsWith("/>")||IJ.has(z)){Z.push([Q,G]);continue}let q=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`<\\/?${q}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");K.lastIndex=G;let U=1,W=G,H;while((H=K.exec($))!==null)if(H[0].startsWith("</")){if(U--,U===0){W=H.index+H[0].length;break}}else if(!H[0].endsWith("/>"))U++;Z.push([Q,W])}return Z}function a4($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>a4(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function t4($,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(...T5($));function G(K){return Y.some(([U,W])=>K>=U&&K<W)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,q=[];while((Q=z.exec(X))!==null){if(G(Q.index))continue;let K=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let W=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,H,j=U,B=!1;while((H=W.exec(U))!==null){let _=H[1],O=H[2];if(r4(_))continue;if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let V=Object.keys(Z),L=Object.values(Z),F=O.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!V.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let R=Function(...V,`return (${O})`)(...L);if(_==="class"){let D=a4(R);if(D){let A=j.match(/\sclass="([^"]*)"/);if(A)j=j.replace(A[0],` class="${A[1]} ${D}"`);else j=j.replace(H[0],` class="${D}"`)}else j=j.replace(H[0],"");B=!0;continue}if(kJ.has(_)){if(R)j=j.replace(H[0],` ${_}`);else j=j.replace(H[0],"");B=!0;continue}if(R===null||R===void 0||R===!1)j=j.replace(H[0],"");else{let D=String(R).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");j=j.replace(H[0],` ${_}="${D}"`)}B=!0}catch{continue}}if(B){let _=K.endsWith("/>")?" /":"",V=`<${Q[1]}${j}${_}>`;q.push({start:Q.index,end:Q.index+K.length,replacement:V})}}for(let K=q.length-1;K>=0;K--){let{start:U,end:W,replacement:H}=q[K];X=X.slice(0,U)+H+X.slice(W)}return X}var TJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),EJ=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 R1($,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()&&TJ.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 bJ($,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 z=Q.exec($),q=G.exec($);if(!q)return-1;if(z&&z.index<q.index)J++,Y=z.index+z[0].length;else{if(J--,J===0)return q.index+q[0].length;Y=q.index+q[0].length}}return-1}function o0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let X=bJ($,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 e4($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function h1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${X}="([^"]*)"`,"s"))||$.match(new RegExp(`${X}='([^']*)'`,"s"));return J?J[1]:null}function U1($,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 W1($,Z,X){let J=Z.selfClosing?" /":"",Y=`<${Z.tag}${X}${J}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function yJ($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function CJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;let Y=h1(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(),z=Q[2].trim(),q;if(G.includes(",")){let O=G.split(",").map((F)=>F.trim()),V=O[0],L=O[1];q=`${z} as ${L} => ${V}`}else q=`${z} as ${G}`;let K=U1(J.attrs,"v-for"),U=U1(K,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=o0(Z,J),H=Z.slice(W.outerStart,W.outerEnd),j=W1(H,{...J,start:0,end:J.end-J.start},U),B=`@foreach(${q})
|
|
3345
3345
|
`,_=`${B}${j}
|
|
3346
|
-
@endforeach`;Z=Z.slice(0,W.outerStart)+_+Z.slice(W.outerEnd),X=W.outerStart+B.length}return Z}function
|
|
3346
|
+
@endforeach`;Z=Z.slice(0,W.outerStart)+_+Z.slice(W.outerEnd),X=W.outerStart+B.length}return Z}function SJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;let Y=h1(J.attrs,"v-if");if(Y===null){X=J.end;continue}let Q=[],G=o0(Z,J),z=U1(J.attrs,"v-if"),q=W1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},z);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:J});let K=G.outerEnd,U=!0;while(U){let _=Z.slice(K).match(/^\s*/),O=_?_[0].length:0,V=R1(Z,K+O);if(!V){U=!1;break}let L=h1(V.attrs,"v-else-if"),F=e4(V.attrs,"v-else");if(L!==null){let w=o0(Z,V),R=U1(V.attrs,"v-else-if"),D=W1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},R);Q.push({type:"else-if",expr:L,outerStart:K,outerEnd:w.outerEnd,element:D,parsedTag:V}),K=w.outerEnd}else if(F){let w=o0(Z,V),R=U1(V.attrs,"v-else"),D=W1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},R);Q.push({type:"else",outerStart:K,outerEnd:w.outerEnd,element:D,parsedTag:V}),U=!1}else U=!1}let W=[];for(let _ of Q)if(_.type==="if")W.push(`@if(${_.expr})
|
|
3347
3347
|
${_.element}`);else if(_.type==="else-if")W.push(`@elseif(${_.expr})
|
|
3348
3348
|
${_.element}`);else W.push(`@else
|
|
3349
3349
|
${_.element}`);W.push("@endif");let H=W.join(`
|
|
3350
|
-
`),j=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,j)+H+Z.slice(B),X=j+H.length}return Z}function
|
|
3350
|
+
`),j=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,j)+H+Z.slice(B),X=j+H.length}return Z}function PJ($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function vJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;let Y=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,z=Y.match(G);while(z){Q=!0;let U=z[1],W=z[2],H=z[3];Y=Y.replace(z[0],""),Y+=` :${U}="${H}" @update:${U}="${H} = $event"`,z=Y.match(G)}if(Q){let U=o0(Z,J),W=Z.slice(U.outerStart,U.outerEnd),H=W1(W,{...J,start:0,end:J.end-J.start},Y);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),X=U.outerStart+H.length;continue}let q=h1(J.attrs,"v-model");if(q===null){X=J.end;continue}if(EJ.has(J.tag)){let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,W=o0(Z,J),H=Z.slice(W.outerStart,W.outerEnd),j=W1(H,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,W.outerStart)+j+Z.slice(W.outerEnd),X=W.outerStart+j.length}else{let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let W=o0(Z,J),H=Z.slice(W.outerStart,W.outerEnd),j=W1(H,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,W.outerStart)+j+Z.slice(W.outerEnd),X=W.outerStart+j.length}}return Z}function fJ($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function xJ($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function gJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;let Y=h1(J.attrs,"v-html");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=o0(Z,J),G=U1(J.attrs,"v-html"),z=J.selfClosing?" /":"",q=`<${J.tag}${G}${z}>{!! ${Y} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),X=Q.outerStart+q.length}return Z}function hJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;let Y=h1(J.attrs,"v-text");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=o0(Z,J),G=U1(J.attrs,"v-text"),z=J.selfClosing?" /":"",q=`<${J.tag}${G}${z}>{{ ${Y} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),X=Q.outerStart+q.length}return Z}function uJ($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function dJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;if(!e4(J.attrs,"v-once")){X=J.end;continue}let Y=U1(J.attrs,"v-once"),Q=o0(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
|
|
3351
3351
|
${W1(G,{...J,start:0,end:J.end-J.start},Y)}
|
|
3352
|
-
@endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),X=Q.outerStart+q.length}return Z}function
|
|
3352
|
+
@endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),X=Q.outerStart+q.length}return Z}function mJ($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function lJ($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function $7($){if(!yJ($))return $;let Z=$;return Z=CJ(Z),Z=SJ(Z),Z=dJ(Z),Z=fJ(Z),Z=xJ(Z),Z=vJ(Z),Z=PJ(Z),Z=lJ(Z),Z=gJ(Z),Z=hJ(Z),Z=uJ(Z),Z=mJ(Z),Z}function G9($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}var E5=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),cJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Z7($,Z){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=X?X[1]:$,Y=e(J,Z);if(Y&&typeof Y==="string")return Y;let Q=J.trim();return E5.has(Q)?Q:null}function X7($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function J7($,Z,X){let J=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(cJ.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${X}</${$}>`}async function Y7($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],q;while((q=G.exec(Q))!==null)z.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let K=z.length-1;K>=0;K--){let U=z[K];try{let W=Z7(U.expr,Z);if(!W||typeof W!=="string"){let L=`<!-- dynamic component: could not resolve "${G9(X7(U.expr))}" -->`;Q=Q.slice(0,U.index)+L+Q.slice(U.index+U.full.length);continue}if(E5.has(W)){let L=J7(W,U.attrs,U.slotContent);Q=Q.slice(0,U.index)+L+Q.slice(U.index+U.full.length);continue}let H=U.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=B.exec(H))!==null){let L=_[1]||_[2],F=_[3];if(_[1])try{j[L]=e(F,Z)}catch{j[L]=F}else j[L]=F}let O=J.componentsDir||"components",V=await D1(W,j,U.slotContent,O,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,U.index)+V+Q.slice(U.index+U.full.length)}catch(W){let H=W instanceof Error?W.message:String(W),j=`<!-- dynamic component error: ${G9(H)} -->`;Q=Q.slice(0,U.index)+j+Q.slice(U.index+U.full.length)}}return Q=await pJ(Q,Z,X,J,Y),Q}async function pJ($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],q;while((q=G.exec(Q))!==null)z.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let K=z.length-1;K>=0;K--){let U=z[K];try{let W=Z7(U.expr,Z);if(!W||typeof W!=="string"){let B=`<!-- dynamic component: could not resolve "${G9(X7(U.expr))}" -->`;Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length);continue}if(E5.has(W)){let B=J7(W,U.attrs,"");Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length);continue}let H=J.componentsDir||"components",j=await D1(W,{},"",H,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,U.index)+j+Q.slice(U.index+U.full.length)}catch(W){let H=W instanceof Error?W.message:String(W),j=`<!-- dynamic component error: ${G9(H)} -->`;Q=Q.slice(0,U.index)+j+Q.slice(U.index+U.full.length)}}return Q}function Q7($,Z=""){let X=`${$}${Z}`,J=0;for(let Y=0;Y<X.length;Y++){let Q=X.charCodeAt(Y);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function G7($,Z,X={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=X;if(!$.trim())return"";let z=b5($),q=[],K=new Map;if(Q)for(let U of z){let W=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(W){let H=W[1],j=`${Z}_${H}`;K.set(H,j)}}for(let U of z){let W=z7(U,Z,J,Y,K,G);q.push(W)}return q.join(`
|
|
3353
3353
|
|
|
3354
3354
|
`)}function b5($){let Z=[],X=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Y="",Q=!1,G="";for(let z=0;z<X.length;z++){let q=X[z];if(q==="@"&&J===0)Q=!0;if(q==="{")J++;else if(q==="}"){if(J--,J===0){if(Q){G+=q;let K=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(K){let[,U,W,H]=K;if(U==="keyframes")Z.push({selector:`@keyframes ${W.trim()}`,declarations:H.trim()});else if(U==="media"||U==="supports"||U==="container"){let j=b5(H);Z.push({selector:`@${U} ${W.trim()}`,declarations:j.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
|
|
3355
|
-
`)})}else Z.push({selector:`@${U} ${W.trim()}`,declarations:H.trim()})}G="",Q=!1}else if(Y.trim()){Y+=q;let K=Y.match(/([^{]+)\{([^}]*)\}/);if(K)Z.push({selector:K[1].trim(),declarations:K[2].trim()});Y=""}continue}}if(Q)G+=q;else Y+=q}return Z}function
|
|
3355
|
+
`)})}else Z.push({selector:`@${U} ${W.trim()}`,declarations:H.trim()})}G="",Q=!1}else if(Y.trim()){Y+=q;let K=Y.match(/([^{]+)\{([^}]*)\}/);if(K)Z.push({selector:K[1].trim(),declarations:K[2].trim()});Y=""}continue}}if(Q)G+=q;else Y+=q}return Z}function z7($,Z,X,J,Y,Q){let{selector:G,declarations:z}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Y.get(U)||U} { ${z} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let W=b5(`x { ${z} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>z7(H,Z,X,J,Y,Q)).join(`
|
|
3356
3356
|
`);return`${G} {
|
|
3357
3357
|
${W}
|
|
3358
|
-
}`}return`${G} { ${z} }`}let q=
|
|
3359
|
-
${J}${$.slice(X)}`}var S5=_2,
|
|
3360
|
-
${Q[0]}${$.slice(X,Q.index)}${$.slice(G,Y)}${$.slice(Y)}`}function
|
|
3361
|
-
${Z[0]}${J.slice(Y)}`}var
|
|
3362
|
-
<meta name="stx-build" content="${Z}">`}var
|
|
3363
|
-
`}function
|
|
3358
|
+
}`}return`${G} { ${z} }`}let q=iJ(G,Z,X,J),K=z;for(let[U,W]of Y)K=K.replace(new RegExp(`\\b${U}\\b`,"g"),W);if(Q)K=K.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${K} }`}function iJ($,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 K=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(K)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let z=X?`${X} .${Z}`:`.${Z}`;Q.push(`${z} ${G}`);let q=nJ(G,Z);if(q)Q.push(X?`${X} ${q}`:q)}return Q.join(", ")}function nJ($,Z){let X=0,J=$.length;for(let q=0;q<$.length;q++){let K=$[q];if(K==="["||K==="(")X++;else if(K==="]"||K===")")X--;else if(X===0&&(K===" "||K===">"||K==="+"||K==="~")){J=q;break}}let Y=$.slice(0,J),Q=$.slice(J);if(!Y)return"";let G=Y.length,z=0;for(let q=0;q<Y.length;q++){let K=Y[q];if(K==="["||K==="(")z++;else if(K==="]"||K===")")z--;else if(X===0&&z===0&&K===":"){G=q;break}}return`${Y.slice(0,G)}.${Z}${Y.slice(G)}${Q}`}var U7=String.raw`(?<![\w-])scoped(?![\w-])`,y5=/<style\s+([^>]*)>/gi,q7=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,W7=new RegExp(U7,"i"),oJ=new RegExp(U7,"gi");function sJ($){y5.lastIndex=0;let Z=y5.exec($);while(Z!==null){if(W7.test(Z[1]))return!0;Z=y5.exec($)}return!1}function H7($){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 z9($,Z){if(!sJ($))return{html:$,hasScoped:!1};let X=Q7(Z),J=`data-v-${X}`,Y=$,Q=!1;if(q7.lastIndex=0,Y=Y.replace(q7,(G,z,q)=>{if(!W7.test(z))return G;Q=!0;let K=rJ(q,J),U=z.replace(oJ,"").trim(),W=U?` ${U}`:"";return`<style data-stx-scoped="${X}"${W}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=tJ(Y,J),{html:Y,hasScoped:!0}}function rJ($,Z){return G7($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}var aJ=($)=>`\x00stx-scope-mask-${$}\x00`,K7=/\u0000stx-scope-mask-(\d+)\u0000/g;function tJ($,Z){let X=i0($,(Y,Q)=>{let G=X1(Y,Q);return G>Q?G:T1(Y,Q)},(Y,Q)=>aJ(Q)),J=eJ(X.output,Z);return K7.lastIndex=0,J.replace(K7,(Y,Q)=>X.tokens[Number(Q)])}function eJ($,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}>`})}function C5(){return{afterOpen:[],beforeClose:[]}}function $Y($){return $.afterOpen.length>0||$.beforeClose.length>0}function B7($,Z){if(!$Y(Z))return $;let X=Z.afterOpen.join(""),J=Z.beforeClose.join(""),Y=$.lastIndexOf("</head>"),Q=X?_2($):null,G=J&&Y!==-1?Y:null;if(Q===null&&G===null)return $;if(Q!==null&&G!==null)return`${$.slice(0,Q)}${X}${$.slice(Q,G)}${J}${$.slice(G)}`;if(Q!==null)return`${$.slice(0,Q)}${X}${$.slice(Q)}`;return`${$.slice(0,G)}${J}${$.slice(G)}`}var j7=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function _2($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let X=Z.index+Z[0].length;j7.lastIndex=X;let J=j7.exec($);return J?X+J[0].length:X}var P5="data-stx-color-mode-boot",ZY="__STX_COLOR_MODE__",XY=new Set(["light","dark","auto","system"]),JY=new Set(["auto","system"]),YY=/^[a-z][\w:-]*$/i,QY=/^[\w-]+$/;function GY($){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(!XY.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"||!QY.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"||!YY.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!JY.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 zY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function v5($={}){let Z=GY($),J=`(function(){"use strict";var c=${zY(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.${ZY}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${P5}>${J}</script>`}function L7($,Z={}){if($.includes(P5))return $;let X=S5($);if(X===null)return $;let J=v5(Z);return`${$.slice(0,X)}
|
|
3359
|
+
${J}${$.slice(X)}`}var S5=_2,qY=new RegExp(`<script\\b[^>]*\\b${P5}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),_7=/<meta\b[^>]*\bcharset\b[^>]*>/gi,V7=/<\/head>/gi;function KY($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let X=Z.index+Z[0].length;V7.lastIndex=X;let J=V7.exec($),Y=J?J.index:$.length;_7.lastIndex=X;let Q=_7.exec($);if(!Q||Q.index>=Y)return $;if($.slice(X,Q.index).trim()==="")return $;let G=Q.index+Q[0].length;return`${$.slice(0,X)}
|
|
3360
|
+
${Q[0]}${$.slice(X,Q.index)}${$.slice(G,Y)}${$.slice(Y)}`}function O7($){return UY(KY($))}function UY($){let Z=qY.exec($);if(!Z)return $;let X=S5($);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=S5(J);if(Y===null)return $;return`${J.slice(0,Y)}
|
|
3361
|
+
${Z[0]}${J.slice(Y)}`}var QW="stx-build",GW="X-STX-Build",q9=null;function F7(){if(q9===null)q9=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return q9}function zW($){q9=$}function qW($,Z=F7()){let X=f5($,Z);if(X===null)return $;let J=/<head\b[^>]*>/i.exec($),Y=J.index+J[0].length;return`${$.slice(0,Y)}${X}${$.slice(Y)}`}function f5($,Z=F7()){if($.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test($))return null;return`
|
|
3362
|
+
<meta name="stx-build" content="${Z}">`}var w7="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",K9="data-stx-html-attrs",U9="data-stx-html-class",R7=/^[A-Za-z_:][\w:.-]*$/;function Z1($){return String($).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function WY($){return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function d1($){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 u1($,Z){return Object.entries($).filter(([X])=>!Z?.(X)).map(([X,J])=>`${X}="${Z1(String(J))}"`).join(" ")}function HY($={},Z="en"){let X=[],J=[],Y="",Q=Z;for(let[z,q]of Object.entries($||{})){if(q==null)continue;let K=z.trim();if(!R7.test(K))continue;let U=K.toLowerCase();if(U==="lang"){Q=String(q);continue}if(U==="class"){Y=String(q).trim();continue}X.push(` ${K}="${Z1(String(q))}"`),J.push(K)}let G=` lang="${Z1(Q)}"`;if(Y)G+=` class="${Z1(Y)}"`;if(G+=X.join(""),Y)G+=` ${U9}="${Z1(Y)}"`;if(J.length)G+=` ${K9}="${Z1(J.join(" "))}"`;return G}function D7($={},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 N7($,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 U=G[1];if(!(U in J))Y.push(U);J[U]=G[2]??G[3]??G[4]??""}let z=[],q=[];for(let[U,W]of Object.entries(Z)){if(W==null)continue;let H=U.trim();if(!R7.test(H))continue;let j=H.toLowerCase();if(j==="class"){let B=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(W).split(/\s+/).filter(Boolean))if(!B.includes(_))B.push(_),z.push(_);if(!("class"in J))Y.push("class");J.class=B.join(" ");continue}if(!(H in J))Y.push(H);if(J[H]=String(W),j!=="lang")q.push(H)}if(z.length){if(!(U9 in J))Y.push(U9);J[U9]=z.join(" ")}if(q.length){if(!(K9 in J))Y.push(K9);J[K9]=q.join(" ")}let K=Y.map((U)=>` ${U}="${Z1(J[U])}"`).join("");return $.replace(X[0],()=>`<html${K}>`)}function WW($){let Z=x5($);if(Z===null)return $;let X=$.lastIndexOf("</head>");return`${$.slice(0,X)}${Z}${$.slice(X)}`}function x5($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${w7}
|
|
3363
|
+
`}function jY($){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 W=$.indexOf("-->",X);if(W===-1)break;X=W+3;continue}let z=Q.match(/^<script\b[^>]*>/i);if(z){let W=$.toLowerCase().indexOf("</script>",X+z[0].length);if(W===-1)break;X=W+9;continue}let q=Q.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),X+=q[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K){Z.push(K[0]),X+=K[0].length;continue}let U=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){Z.push(U[0]),X+=U[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 z=Q.match(/^<meta\b[^>]*>/i);if(z&&Z.includes(z[0])){Y+=z[0].length;continue}let q=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Y+=q[0].length;continue}J+=$[Y],Y++}return J+=$.slice(X),{body:J,hoisted:Z}}function BY($,Z={},X={}){let{title:J="stx App",lang:Y="en",meta:Q=[],link:G=[],script:z=[],headRaw:q="",htmlAttrs:K={},bodyClass:U="",bodyAttrs:W={}}=Z,H=X.title||J,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map(d1).filter(Boolean)),O=[...j.filter((M)=>!B.has(d1(M))),...Q].map((M)=>{return` <meta ${u1(M)}>`}).join(`
|
|
3364
3364
|
`),V=G.map((M)=>{return` <link ${u1(M)}>`}).join(`
|
|
3365
3365
|
`),L=z.map((M)=>{if(M.src)return` <script ${u1(M,(T)=>T==="content")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
|
|
3366
|
-
`),F=
|
|
3366
|
+
`),F=HY(K,Y),w=Object.entries(W).map(([M,T])=>` ${M}="${Z1(String(T))}"`).join(""),R=U?` class="${Z1(U)}"`:"",{body:D,hoisted:A}=jY($),k=[O,X.colorMode?` ${v5(X.colorMode)}`:"",` <title>${X.titleIsHtml?H:WY(H)}</title>`,` ${w7}`,V,L,q?` ${q}`:"",...(X.styles||[]).map((M)=>` ${M}`),...A.map((M)=>` ${M}`),...(X.headScripts||[]).map((M)=>` ${M}`),X.headStack||""].filter(Boolean),N=[D,...(X.bodyScripts||[]).map((M)=>M),X.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
3367
3367
|
<html${F}>
|
|
3368
3368
|
<head>
|
|
3369
3369
|
${k.join(`
|
|
@@ -3373,9 +3373,9 @@ ${k.join(`
|
|
|
3373
3373
|
${N.join(`
|
|
3374
3374
|
`)}
|
|
3375
3375
|
</body>
|
|
3376
|
-
</html>`}function g5($){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 h5($){return g5($)}function
|
|
3376
|
+
</html>`}function g5($){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 h5($){return g5($)}function A7($,Z={}){let X=$.lastIndexOf("</head>");if(X===-1)return $;let{meta:J=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,z=$.slice(0,X),q=[];for(let K of J){let U=d1(K);if(U&&z.includes(U))continue;q.push(` <meta ${u1(K)}>`)}for(let K of Y){if(K.href&&z.includes(`href="${K.href}"`))continue;q.push(` <link ${u1(K)}>`)}for(let K of Q)if(K.src){if(z.includes(`src="${K.src}"`))continue;q.push(` <script ${u1(K,(U)=>U==="content")}></script>`)}else if(K.content){if(z.includes(K.content))continue;q.push(` <script>${K.content}</script>`)}if(G&&!z.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,X)}${q.join(`
|
|
3377
3377
|
`)}
|
|
3378
|
-
${$.slice(X)}`}function
|
|
3378
|
+
${$.slice(X)}`}function M7($,Z={},X={}){if(h5($))return $;return BY($,Z,X)}var _Y=/<\/(script)/gi;function m1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(_Y,"<\\/$1")}var V2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useObjectUrl","useTimeoutFn"];Q2();Q2();function I7($,Z={}){return new k7($,Z).routes}function wW($,Z){let X=u5($,Z);return X?X.params:null}var T7=new Map;async function E7($){let Z=$;if(!Z)try{Z=(await Q5())?.pagesDir||"pages"}catch{Z="pages"}let X=Z,J=T7.get(X);if(J)return J;let Y=[];try{Y=I7(".",{pagesDir:X}).map((Q)=>Q.regex.source).filter(Boolean)}catch{Y=[]}return T7.set(X,Y),Y}function VY($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function b7($){return VY(JSON.stringify($))}function d5(){return`
|
|
3379
3379
|
(function(){
|
|
3380
3380
|
var tip=null,hideTimer=null,currentEl=null;
|
|
3381
3381
|
|
|
@@ -3478,22 +3478,22 @@ document.addEventListener("focusout",function(e){
|
|
|
3478
3478
|
if(el) hideTip();
|
|
3479
3479
|
});
|
|
3480
3480
|
})();
|
|
3481
|
-
`}function
|
|
3481
|
+
`}function y7($){return $.includes("data-stx-runtime")}function C7($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let X=Z.exec($);X!==null;X=Z.exec($)){let J=$.slice(Math.max(0,X.index-80),X.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}function m5($,Z){let X=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(X!==-1&&(J===-1||X>J))return $.slice(0,X)+Z+`
|
|
3482
3482
|
`+$.slice(X);let Y=_2($);if(Y!==null)return`${$.slice(0,Y)}
|
|
3483
3483
|
${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
|
|
3484
3484
|
`+$.slice(G)}if(Y1($))return b1($,(G)=>`${G}
|
|
3485
3485
|
${Z}`);return`${Z}
|
|
3486
|
-
${$}`}async function W9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return m5($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return m5($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-
|
|
3486
|
+
${$}`}async function W9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return m5($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return m5($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-vb10qph4.js"),J=await X(Z.debug);return m5($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function LY($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function S7($){if($.includes("data-stx-tooltip-runtime")||!LY($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${d5()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
|
|
3487
3487
|
${Z}`;return`${$.slice(0,X)}${Z}
|
|
3488
|
-
${$.slice(X)}`}var
|
|
3489
|
-
`}let{getCachedRouterScript:Y}=await import("./chunk-
|
|
3490
|
-
</body>`+$.slice(G+7)}var
|
|
3491
|
-
`)}else{if(!
|
|
3488
|
+
${$.slice(X)}`}var OY=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function FY($){return OY.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function wY($,Z){if(!$.includes("</body>"))return $;if(FY($))return $;let X=Z?.router,J="";{let z={};if(X){if(X.container)z.container=X.container;if(X.interceptAllLinks!==void 0)z.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)z.progress=X.progress;if(X.viewTransitions!==void 0)z.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)z.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)z.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)z.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)z.prefetch=X.prefetch;if(X.cache!==void 0)z.cache=X.cache;if(X.progressColor!==void 0)z.progressColor=X.progressColor;if(X.progressHeight!==void 0)z.progressHeight=X.progressHeight}try{let q=await E7(Z?.pagesDir);if(q.length>0)z.ownedRoutes=q}catch{}if(Object.keys(z).length>0)J=`<script>window.__stxRouterConfig=${b7(z)};</script>
|
|
3489
|
+
`}let{getCachedRouterScript:Y}=await import("./chunk-vb10qph4.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+`
|
|
3490
|
+
</body>`+$.slice(G+7)}var P7=Symbol.for("stx.lazy-module-promises");function RY(){let $=globalThis;return $[P7]??=new Map,$[P7]}function o($,Z){let X=RY(),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 c5=`(?:"[^"]*"|'[^']*'|[^>"'])*`,u7=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function DY($,Z={}){let X=[];for(let J of f2($,X1)){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 z=Y[0].length,q=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(z,q),start:J.start,end:J.end})}return X}function d7($){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:z}=v7(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}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:z}=v7(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function v7($){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 i5($,Z){return h7($,Z)}function NY($){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 AY($){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 MY($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${c5})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=f2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!X.test(z[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 z=G[2].match(X),q=d7(z?.[1]??z?.[2]??""),K=[q.itemVar,q.indexVar].filter(Boolean);if(K.length===0)continue;let U=G[1],H=/\/\s*>$/.test(Q.token)||j9.has(U.toLowerCase())?Q.end:l7($,Q.start,U,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(K)})}return Y}var f7=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 kY($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function x7($,Z,X,J){if(!$)return!1;let Y=kY($),Q=!1,G=!1,z=!1,q=/([a-zA-Z_$][\w$]*)/g,K;while((K=q.exec(Y))!==null){let j=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(f7.has(j))continue;if(Z.has(j)||J?.has(j))Q=!0;else if(X&&j in X)G=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,W;while((W=U.exec(Y))!==null){let j=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(f7.has(j)||X&&j in X)continue;z=!0}return(Q||z)&&!G}function H9($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,""")}"`,Y=$.trim(),Q=Y.match(u7);if(Q&&IY(Q[3],Q[1])){let[,G,z,q]=Q;return`<${G}${z}${J}>${q}</${G}>`}return`<template${J}>${Y}</template>`}function IY($,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 m7($,Z){let X=AY($);function J(Y){let Q=Y,G=MY(Y),z=(W)=>{let H=new Set;for(let j of G)if(W>j.start&&W<j.end)for(let B of j.vars)H.add(B);return H},q=/@if\s*\(/g,K,U=[];while((K=q.exec(Q))!==null){let W=K.index,H=W+K[0].length,j=1,B=H;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let _=Q.substring(H,B-1).trim(),O=B,V=1,L=O,F=/@(if\s*\(|endif)/g;F.lastIndex=O;let w;while((w=F.exec(Q))!==null)if(w[1].startsWith("if"))V++;else if(w[1]==="endif"){if(V--,V===0){L=w.index+w[0].length;break}}if(V!==0)continue;let R=Q.substring(O,L-6).trim(),D;if(NY(R)){let A=U2(Q.substring(W,L));if(A.length===0)continue;let k=A[0].branches.filter((I)=>I.type!=="else"),N=z(W);if(!(k.length>0&&k.every((I)=>x7(I.condition,X,Z,N))))continue;D=A[0].branches.map((I)=>{let y=J(I.content);if(I.type==="elseif")return H9(y,"@else-if",I.condition??"");if(I.type==="else")return H9(y,"@else");return H9(y,"@if",I.condition??"")}).join(`
|
|
3491
|
+
`)}else{if(!x7(_,X,Z,z(W)))continue;D=H9(J(R),"@if",_)}U.push({start:W,end:L,replacement:D}),q.lastIndex=L}for(let W=U.length-1;W>=0;W--){let{start:H,end:j,replacement:B}=U[W];Q=Q.substring(0,H)+B+Q.substring(j)}return Q}return J($)}function TY($){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 j9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function l7($,Z,X,J){if(j9.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,z=1,q=J;while(q<G){let K=$.indexOf("<",q);if(K===-1)return-1;if(q=K,$.startsWith("<!--",q)){let j=$.indexOf("-->",q+4);if(j===-1)return-1;q=j+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let j=$.indexOf(">",q);if(j===-1)return-1;if($[j-1]==="/"){q=j+1;continue}let B=Q.indexOf(`</${U[1].toLowerCase()}`,q);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;q=_+1;continue}if($[q+1]==="/"){let j=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!j){q++;continue}if(j[1].toLowerCase()===Y){if(z--,q+=j[0].length,z===0)return q;continue}q+=j[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!W){q++;continue}let H=$.indexOf(">",q);if(H===-1)return-1;if(W[1].toLowerCase()===Y){let j=$.slice(q,H+1);if(!(/\/\s*>$/.test(j)||j9.has(Y)))z++}q=H+1}return-1}var EY=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function bY($,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 EY.test(Q)}function c7($){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=(W)=>Z.some(([H,j])=>W>=H&&W<j),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=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[W,H,j,B,_,O,V]=z,L=TY(_);if(L===void 0)continue;let F=z.index,w=F+W.length,A=!!V||/\/\s*>$/.test(W)||j9.has(H.toLowerCase())?w:l7($,F,H,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&bY($,A)){Q.lastIndex=w;continue}if(L===!0){let N=`<${H}${j}${O}${V}>`;G.push({start:F,end:w,replacement:N});continue}G.push({start:F,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((W,H)=>W.start-H.start);let q=[],K=-1;for(let W of G){if(W.start<K)continue;q.push(W),K=W.end}let U=$;for(let W=q.length-1;W>=0;W--){let{start:H,end:j,replacement:B}=q[W];U=U.substring(0,H)+B+U.substring(j)}return U}function n5($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let z=Y[1],q=Y.index,K=q+Y[0].length,U=1,W=K;while(W<X.length&&U>0){if(X[W]==="(")U++;else if(X[W]===")")U--;W++}if(U!==0)continue;let H=X.substring(K,W-1).trim(),j=W,B=d7(H),_=z==="for"?"@endfor":"@endforeach",O=1,V=j,L=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");L.lastIndex=j;let F;while((F=L.exec(X))!==null)if(F[1].startsWith(z))O++;else if(O--,O===0){V=F.index+F[0].length;break}if(O!==0)continue;let w=()=>{let M=[B.itemVar,B.indexVar].filter(Boolean);if(M.length)G.push({start:q,end:V,vars:M})};if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){w();continue}let T=M.split(/[.[(]/)[0].trim(),I=Z?T in Z:!1,y=G.some((E)=>q>E.start&&q<E.end&&E.vars.includes(T));if(T&&(I||y)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=X.substring(j,V-_.length).trim(),D=Z?{...Z}:{};if(B.itemVar)delete D[B.itemVar];if(B.indexVar)delete D[B.indexVar];let A=n5(R,D),k=A.match(u7),N;if(k){let[,M,T,I]=k;N=`<${M}${T} @for="${H}">${I}</${M}>`}else N=`<template @for="${H}">${A}</template>`;Q.push({start:q,end:V,replacement:N}),J.lastIndex=V}for(let z=Q.length-1;z>=0;z--){let{start:q,end:K,replacement:U}=Q[z];X=X.substring(0,q)+U+X.substring(K)}return X}function yY($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(U)=>{let W=J+1;while(W<Q){let H=$[W];if(H==="\\"){W+=2;continue}if(H===U)return W+1;W++}return Q},z=()=>{let U=J+2;while(U<Q&&$[U]!==`
|
|
3492
3492
|
`)U++;return U},q=()=>{let U=J+2;while(U<Q-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return Q},K=(U)=>{let W=U,H=0;while(W<Q){let j=$[W];if(j==="/"&&$[W+1]==="/"){let B=W+2;while(B<Q&&$[B]!==`
|
|
3493
|
-
`)B++;W=B;continue}if(j==="/"&&$[W+1]==="*"){let B=W+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}W=B;continue}if(j==="("||j==="["||j==="{"){H++,W++;continue}if(j===")"||j==="]"||j==="}"){H--,W++;continue}if(j===";"&&H===0)return W+1;W++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let W=z();X.push($.slice(J,W)),J=W;continue}if(U==="/"&&$[J+1]==="*"){let W=q();X.push($.slice(J,W)),J=W;continue}if(U==='"'||U==="'"||U==="`"){let W=G(U);X.push($.slice(J,W)),J=W;continue}if(U==="{"){Y++,X.push(U),J++;continue}if(U==="}"){Y--,X.push(U),J++;continue}if(Y===0){let W=J>0?$[J-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],_=K(J+j[0].length);if(Z.has(B)){X.push(`/* stx: deduped const ${B} */`),J=_;continue}Z.add(B),X.push($.slice(J,_)),J=_;continue}}}X.push(U),J++}return X.join("")}async function
|
|
3493
|
+
`)B++;W=B;continue}if(j==="/"&&$[W+1]==="*"){let B=W+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}W=B;continue}if(j==="("||j==="["||j==="{"){H++,W++;continue}if(j===")"||j==="]"||j==="}"){H--,W++;continue}if(j===";"&&H===0)return W+1;W++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let W=z();X.push($.slice(J,W)),J=W;continue}if(U==="/"&&$[J+1]==="*"){let W=q();X.push($.slice(J,W)),J=W;continue}if(U==='"'||U==="'"||U==="`"){let W=G(U);X.push($.slice(J,W)),J=W;continue}if(U==="{"){Y++,X.push(U),J++;continue}if(U==="}"){Y--,X.push(U),J++;continue}if(Y===0){let W=J>0?$[J-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],_=K(J+j[0].length);if(Z.has(B)){X.push(`/* stx: deduped const ${B} */`),J=_;continue}Z.add(B),X.push($.slice(J,_)),J=_;continue}}}X.push(U),J++}return X.join("")}async function CY($,Z,X){let J=DY($,{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=[],{hasUserImports:G,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-7ej1d910.js"));for(let V of J){let L=V.body;if(F1(V.attrs))L=w1(L);if(Y.test(L)){Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:L});continue}if(!G(L))continue;try{let F=await z(l1(L).code,Z||"",{projectRoot:process.cwd()});if(Y.test(F))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:L,bundled:F})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let q=`${Z??""}\x00${Q.map((V)=>V.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(q).toString(36).slice(0,10)}`,U=[];for(let V=0;V<Q.length;V++){let L=Q[V].bundled??l1(Q[V].content).code;if(!Q[V].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=fY(L);let F=t0(L);U.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
|
|
3494
3494
|
${F}`)}let W=U.join(`
|
|
3495
3495
|
|
|
3496
|
-
`);W=
|
|
3496
|
+
`);W=yY(W);let H=SY(W),j=H.split(",").map((V)=>V.trim()).filter(Boolean),B=p5(W,X),_=`
|
|
3497
3497
|
<script data-stx-scoped>
|
|
3498
3498
|
function ${K}() {
|
|
3499
3499
|
${x1("const",j)}
|
|
@@ -3502,24 +3502,24 @@ ${m1(`${B}${W}`)}
|
|
|
3502
3502
|
}
|
|
3503
3503
|
window.__stx_latestSetup=${K};
|
|
3504
3504
|
if(window.stx)window.stx._latestSetup=${K};
|
|
3505
|
-
</script>`,O=$;for(let V of Q)O=O.split(V.fullMatch).join("");if(O.includes("<body"))O=O.replace(new RegExp(`<body(${c5})>`),`<body$1 data-stx="${K}">`);else{let V=["script","style","html","head","meta","link","title","!doctype"],L=!1;O=O.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${c5})>`,"gi"),(F,w,R)=>{if(L||V.includes(w.toLowerCase()))return F;return L=!0,`<${w}${R} data-stx="${K}">`})}return{output:O,setupCode:_}}function
|
|
3505
|
+
</script>`,O=$;for(let V of Q)O=O.split(V.fullMatch).join("");if(O.includes("<body"))O=O.replace(new RegExp(`<body(${c5})>`),`<body$1 data-stx="${K}">`);else{let V=["script","style","html","head","meta","link","title","!doctype"],L=!1;O=O.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${c5})>`,"gi"),(F,w,R)=>{if(L||V.includes(w.toLowerCase()))return F;return L=!0,`<${w}${R} data-stx="${K}">`})}return{output:O,setupCode:_}}function SY($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,z="",q=()=>{Q++;let B=!1;while(Q<G){let _=Z[Q];if(_==="\\"){Q+=2;continue}if(_==="["&&!B){B=!0,Q++;continue}if(_==="]"&&B){B=!1,Q++;continue}if(_==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(_===`
|
|
3506
3506
|
`)return;Q++}},K=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},U=(B)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===B){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let B=1;while(Q<G&&B>0)if(Z[Q]==="{")B++,Q++;else if(Z[Q]==="}")B--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')U(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},H=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
3507
|
-
`)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},j=()=>{if(Y!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let F=B[2];if(!J.has(F))X.push(F),J.add(F);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((F)=>{let w=F.trim();if(!w)return;let R=w.indexOf(":"),A=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(A&&!J.has(A))X.push(A),J.add(A)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((F)=>{let w=F.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!J.has(R))X.push(R),J.add(R)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let F=V[1];if(!J.has(F))X.push(F),J.add(F);return}let L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!J.has(F))X.push(F),J.add(F)}};while(Q<G){if(H())continue;if(Z[Q]==="'"||Z[Q]==='"'){U(Z[Q]),z=Z[Q-1];continue}if(Z[Q]==="`"){W(),z="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&K()){q(),z="/";continue}if(Z[Q]==="{"){Y++,z="{",Q++;continue}if(Z[Q]==="}"){Y--,z="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))j();if(!/\s/.test(Z[Q]))z=Z[Q];Q++}return X.join(", ")}async function
|
|
3507
|
+
`)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},j=()=>{if(Y!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let F=B[2];if(!J.has(F))X.push(F),J.add(F);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((F)=>{let w=F.trim();if(!w)return;let R=w.indexOf(":"),A=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(A&&!J.has(A))X.push(A),J.add(A)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((F)=>{let w=F.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!J.has(R))X.push(R),J.add(R)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let F=V[1];if(!J.has(F))X.push(F),J.add(F);return}let L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!J.has(F))X.push(F),J.add(F)}};while(Q<G){if(H())continue;if(Z[Q]==="'"||Z[Q]==='"'){U(Z[Q]),z=Z[Q-1];continue}if(Z[Q]==="`"){W(),z="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&K()){q(),z="/";continue}if(Z[Q]==="{"){Y++,z="{",Q++;continue}if(Z[Q]==="}"){Y--,z="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))j();if(!/\s/.test(Z[Q]))z=Z[Q];Q++}return X.join(", ")}async function p7($,Z,X,J){if(!i5($,X))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await CY(Y,X,J);if(Y=Q,Y=await W9(Y,Z),G){let U=l5(Y,/<\/head>/i),W=U===-1?l5(Y,/<body[^>]*>/i):-1;if(U!==-1)Y=`${Y.slice(0,U)}${G}
|
|
3508
3508
|
${Y.slice(U)}`;else if(W!==-1){let H=/<body[^>]*>/i.exec(Y.slice(W))[0],j=W+H.length;Y=`${Y.slice(0,j)}
|
|
3509
3509
|
${G}${Y.slice(j)}`}else Y=`${Y}
|
|
3510
|
-
${G}`}let q=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),K=q&&/data-stx/.test(q[1]);if(!G&&!K&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,W=l5(Y,U);if(W!==-1){let H=Y.slice(0,W),j=Y.slice(W).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Y=H+j}}return Y}function l5($,Z){let X=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],Y;while((Y=X.exec($))!==null)J.push([Y.index,Y.index+Y[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let z=Q.exec($.slice(G));if(!z)return-1;let q=G+z.index;if(!J.some(([U,W])=>q>=U&&q<W))return q;G=q+Math.max(z[0].length,1)}return-1}var x7="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function CY($){let Z=[];for(let X of $.split(",")){let J=X.trim();if(!J||J.startsWith("type "))continue;let Y=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])Z.push(`${Y[2]} = ${Y[1]}`)}if(Z.length===0)return x7;return`var ${Z.join(", ")}; ${x7}`}var SY=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function PY($){return $.replace(SY,(Z,X)=>CY(X))}import u0 from"path";import o5 from"fs";function p7($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function i7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class n7{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,X,J){let Y=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let j=[Y,Y.toLowerCase(),p7(Y),i7(Y)];for(let B of j)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${Y}.stx`,`${p7(Y)}.stx`,`${i7(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let j=u0.resolve(u0.dirname(Z),`${Y}.stx`);if(await a(j))return j;return null}let z=[],q=X.componentsDir||"",K=J?.__originalFilePath;if(K)z.push(u0.join(u0.dirname(K),"components"));if(q)z.push(q);let U=u0.join(u0.dirname(Z),"components");if(!z.includes(U))z.push(U);let W=process.cwd(),H=[u0.resolve(W,"src/components"),u0.resolve(W,"components"),u0.resolve(import.meta.dir,"components")];for(let j of H)if(!z.includes(j))z.push(j);for(let j of z){if(!j)continue;for(let B of G){let _=u0.join(j,B);if(await a(_))return _}try{if(!o5.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let _=o5.readdirSync(j,{withFileTypes:!0});for(let O of _)if(O.isDirectory()){let V=u0.join(j,O.name);for(let L of G){let F=u0.join(V,L);if(await a(F))return F}}}catch{}}return null}}var y0=new n7;function w0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var N1="\x00stx-boolean-attribute";function s5($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function c1($,Z){let X=[];for(let[J,Y]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof Y==="boolean"){if(Y)X.push(w0(Q));continue}if(Y===N1){X.push(w0(Q));continue}X.push(`${w0(Q)}="${w0(s5(String(Y)))}"`)}return X}function p1($,Z){let X=[];for(let[J,Y]of Object.entries($.serverDynamic??{})){if(Z.has(J))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[J]??J;if(Y===!0){X.push(w0(Q));continue}if(typeof Y==="object")continue;X.push(`${w0(Q)}="${w0(s5(String(Y)))}"`)}return X}function L2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function vY($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var r5={name:"StxLink",aliases:["stx-link"],render($,Z,X){let J=vY($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",z=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(J.reactive)q.push(`:href="${L2(J.value)}"`);else q.push(`href="${L2(J.value)}"`);if(Y)q.push(`class="${L2(Y)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${L2(Q)}"`),q.push(`data-stx-exact-active-class="${L2(G)}"`),z)q.push("data-stx-prefetch");let K=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...c1($,K)),q.push(...p1($,K)),`<a ${q.join(" ")}>${Z}</a>`}};import n1 from"fs";import a5 from"path";var fY=new Set([".jpg",".jpeg",".png",".webp",".avif"]),H1=new Map,i1=!1;function o7($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return H1.get(Z)}function ZH(){return i1}function XH(){H1.clear(),i1=!1}function JH($,Z){H1.set($,Z),i1=!0}function xY($){let Z=0,X=0,J=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],X+=$[G+1],J+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(X)}${Q(J)}`}function gY($,Z,X,J=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let z=0;z<J;z++){let q=Math.floor(z*Z/J),K=Math.max(q+1,Math.floor((z+1)*Z/J)),U=Math.floor(G*X/Y),W=Math.max(U+1,Math.floor((G+1)*X/Y)),H=0,j=0,B=0,_=0;for(let V=U;V<W;V++)for(let L=q;L<K;L++){let F=(V*Z+L)*4;H+=$[F],j+=$[F+1],B+=$[F+2],_++}let O=(V)=>Math.round(V/_).toString(16).padStart(2,"0");Q.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${O(H)}${O(j)}${O(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${J} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function hY($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function uY($){try{return JSON.parse(n1.readFileSync($,"utf8"))}catch{return{}}}function dY($,Z){try{n1.mkdirSync(a5.dirname($),{recursive:!0}),n1.writeFileSync($,JSON.stringify(Z))}catch{}}function s7($,Z,X=[]){let J;try{J=n1.readdirSync($,{withFileTypes:!0})}catch{return X}for(let Y of J){let Q=a5.join($,Y.name);if(Y.isDirectory()){s7(Q,`${Z}/${Y.name}`,X);continue}if(!fY.has(a5.extname(Y.name).toLowerCase()))continue;X.push([`${Z}/${Y.name}`,Q])}return X}async function YH($,Z={}){let{cachePath:X,maxBytes:J=33554432,limit:Y=2000}=Z;if(!$||!n1.existsSync($))return i1=!0,H1.size;let Q;try{Q=await import("ts-images")}catch{return i1=!0,H1.size}let G=X?uY(X):{},z=!1,q=s7($,"").slice(0,Y),K=8,U=async([W,H])=>{let j;try{j=n1.statSync(H)}catch{return}if(j.size>J)return;let B=G[W];if(B&&B.mtimeMs===j.mtimeMs&&B.size===j.size){H1.set(W,{dataUrl:B.dataUrl,color:B.color});return}try{let{hash:_}=await Q.generateThumbHash(H);if(!_)return;let{rgba:O,w:V,h:L}=Q.thumbHashToRGBA(_),F={dataUrl:hY(gY(O,V,L)),color:xY(O)};H1.set(W,F),G[W]={mtimeMs:j.mtimeMs,size:j.size,...F},z=!0}catch{}};for(let W=0;W<q.length;W+=K)await Promise.all(q.slice(W,W+K).map(U));if(X&&z)dY(X,G);return i1=!0,H1.size}var mY={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},t5=[320,640,768,1024,1280,1536,1920];function V0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function N0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function B9($,Z,X=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return X}function lY($){let Z=(J)=>$.variants.filter((Y)=>Y.format===J).reduce((Y,Q)=>Y+Q.bytes,0),X=Z($.fallback.format);return["avif","webp"].map((J)=>({format:J,srcset:$.sources[J]||"",bytes:Z(J)})).filter((J)=>J.srcset&&J.bytes>0&&J.bytes<X).sort((J,Y)=>J.bytes-Y.bytes).map(({format:J,srcset:Y})=>({format:J,srcset:Y}))}function e5($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),X=[];for(let J of Z)if(J.includes(":")){let[Y,Q]=J.split(":"),G=mY[Y];if(G)X.push(`(max-width: ${G}px) ${Q}`);else{let z=Number.parseInt(Y);if(!Number.isNaN(z))X.push(`(max-width: ${z}px) ${Q}`)}}else X.push(J);return X.join(", ")}function $$($,Z,X,J){return Z.map((Y)=>`${O2($,Y,void 0,X,J)} ${Y}w`).join(", ")}function cY($,Z,X,J,Y){return Z.map((Q)=>{let G=X?X*Q:void 0;return`${O2($,G,void 0,J,Y)} ${Q}x`}).join(", ")}function O2($,Z,X,J,Y){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(X)Q.push(`h_${X}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(X)Q.set("h",String(X));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(X)Q.set("height",String(X));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function pY($,Z,X="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${X}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var Z$={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,X){let J=N0($,"src")||"",Y=r7(J),Q=N0($,"alt")||"",G=N0($,"width")||(Y?String(Y.source.width):void 0),z=N0($,"height")||(Y?String(Y.source.height):void 0),q=N0($,"sizes"),K=N0($,"srcset"),U=N0($,"densities"),W=N0($,"format"),H=N0($,"placeholder")||(Y?"thumbhash":void 0),j=N0($,"placeholderColor")||"#e5e7eb",B=N0($,"provider"),_=N0($,"class")||N0($,"className")||"",O=N0($,"style")||"",V=N0($,"quality"),L=B9($,"lazy",!0),F=B9($,"preload",!1),w=B9($,"priority",!1),R=N0($,"loading"),D=N0($,"decoding")||"async",A=!!Y||B9($,"picture",!1)||!!W,k=G?Number.parseInt(G):void 0,N=z?Number.parseInt(z):void 0,M=K||"",T="";if(Y)M=Y.sources[Y.fallback.format]||"",T=q?e5(q):"100vw";else if(!M&&q&&B&&B!=="local"&&B!=="static")M=$$(J,t5,B,W),T=e5(q);else if(!M&&U){let g=U.split(/\s+/).map((x)=>Number.parseFloat(x.replace("x","")));M=cY(J,g,k,B,W)}else if(q)T=e5(q);let I=[];if(O)I.push(O);if(k&&N)I.push(`aspect-ratio:${k}/${N}`);if(H==="blur"||H==="color"||H==="thumbhash"){let g=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:j}:o7(J);if(g&&H==="color")I.push(`background-color:${g.color}`);else if(g)I.push(`background-color:${g.color}`),I.push(`background-image:url(${g.dataUrl})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");else{let x=pY(k||16,N||9,j);I.push(`background-image:url(${x})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat")}}else if(H&&H!=="empty"&&H!=="none")I.push(`background-image:url(${V0(H)})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");let y=Y?.fallback.url||O2(J,k,N,B,W),E=[];if(E.push(`src="${V0(y)}"`),E.push(`alt="${V0(Q)}"`),G)E.push(`width="${V0(G)}"`);if(z)E.push(`height="${V0(z)}"`);let b=R||(w||F?"eager":L?"lazy":"");if(b)E.push(`loading="${V0(b)}"`);if(w)E.push('fetchpriority="high"');if(E.push(`decoding="${V0(D)}"`),_)E.push(`class="${V0(_)}"`);if(I.length>0)E.push(`style="${V0(I.join(";"))}"`);if(M)E.push(`srcset="${V0(M)}"`);if(T)E.push(`sizes="${V0(T)}"`);let C=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);E.push(...c1($,C)),E.push(...p1($,C));let v=`<img ${E.join(" ")} />`,P="";if(F){let x=W==="webp"?"image/webp":W==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${V0(y)}"${x?` type="${x}"`:""}${M?` imagesrcset="${V0(M)}"`:""}${T?` imagesizes="${V0(T)}"`:""} />
|
|
3511
|
-
`}if(A){let g=[];if(Y)for(let x of
|
|
3510
|
+
${G}`}let q=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),K=q&&/data-stx/.test(q[1]);if(!G&&!K&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,W=l5(Y,U);if(W!==-1){let H=Y.slice(0,W),j=Y.slice(W).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Y=H+j}}return Y}function l5($,Z){let X=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],Y;while((Y=X.exec($))!==null)J.push([Y.index,Y.index+Y[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let z=Q.exec($.slice(G));if(!z)return-1;let q=G+z.index;if(!J.some(([U,W])=>q>=U&&q<W))return q;G=q+Math.max(z[0].length,1)}return-1}var g7="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function PY($){let Z=[];for(let X of $.split(",")){let J=X.trim();if(!J||J.startsWith("type "))continue;let Y=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])Z.push(`${Y[2]} = ${Y[1]}`)}if(Z.length===0)return g7;return`var ${Z.join(", ")}; ${g7}`}var vY=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function fY($){return $.replace(vY,(Z,X)=>PY(X))}import u0 from"path";import o5 from"fs";function i7($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function n7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class o7{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,X,J){let Y=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let j=[Y,Y.toLowerCase(),i7(Y),n7(Y)];for(let B of j)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${Y}.stx`,`${i7(Y)}.stx`,`${n7(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let j=u0.resolve(u0.dirname(Z),`${Y}.stx`);if(await a(j))return j;return null}let z=[],q=X.componentsDir||"",K=J?.__originalFilePath;if(K)z.push(u0.join(u0.dirname(K),"components"));if(q)z.push(q);let U=u0.join(u0.dirname(Z),"components");if(!z.includes(U))z.push(U);let W=process.cwd(),H=[u0.resolve(W,"src/components"),u0.resolve(W,"components"),u0.resolve(import.meta.dir,"components")];for(let j of H)if(!z.includes(j))z.push(j);for(let j of z){if(!j)continue;for(let B of G){let _=u0.join(j,B);if(await a(_))return _}try{if(!o5.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let _=o5.readdirSync(j,{withFileTypes:!0});for(let O of _)if(O.isDirectory()){let V=u0.join(j,O.name);for(let L of G){let F=u0.join(V,L);if(await a(F))return F}}}catch{}}return null}}var y0=new o7;function w0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var N1="\x00stx-boolean-attribute";function s5($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function c1($,Z){let X=[];for(let[J,Y]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof Y==="boolean"){if(Y)X.push(w0(Q));continue}if(Y===N1){X.push(w0(Q));continue}X.push(`${w0(Q)}="${w0(s5(String(Y)))}"`)}return X}function p1($,Z){let X=[];for(let[J,Y]of Object.entries($.serverDynamic??{})){if(Z.has(J))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[J]??J;if(Y===!0){X.push(w0(Q));continue}if(typeof Y==="object")continue;X.push(`${w0(Q)}="${w0(s5(String(Y)))}"`)}return X}function L2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function xY($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var r5={name:"StxLink",aliases:["stx-link"],render($,Z,X){let J=xY($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",z=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(J.reactive)q.push(`:href="${L2(J.value)}"`);else q.push(`href="${L2(J.value)}"`);if(Y)q.push(`class="${L2(Y)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${L2(Q)}"`),q.push(`data-stx-exact-active-class="${L2(G)}"`),z)q.push("data-stx-prefetch");let K=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...c1($,K)),q.push(...p1($,K)),`<a ${q.join(" ")}>${Z}</a>`}};import n1 from"fs";import a5 from"path";var gY=new Set([".jpg",".jpeg",".png",".webp",".avif"]),H1=new Map,i1=!1;function s7($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return H1.get(Z)}function GH(){return i1}function zH(){H1.clear(),i1=!1}function qH($,Z){H1.set($,Z),i1=!0}function hY($){let Z=0,X=0,J=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],X+=$[G+1],J+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(X)}${Q(J)}`}function uY($,Z,X,J=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let z=0;z<J;z++){let q=Math.floor(z*Z/J),K=Math.max(q+1,Math.floor((z+1)*Z/J)),U=Math.floor(G*X/Y),W=Math.max(U+1,Math.floor((G+1)*X/Y)),H=0,j=0,B=0,_=0;for(let V=U;V<W;V++)for(let L=q;L<K;L++){let F=(V*Z+L)*4;H+=$[F],j+=$[F+1],B+=$[F+2],_++}let O=(V)=>Math.round(V/_).toString(16).padStart(2,"0");Q.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${O(H)}${O(j)}${O(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${J} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function dY($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function mY($){try{return JSON.parse(n1.readFileSync($,"utf8"))}catch{return{}}}function lY($,Z){try{n1.mkdirSync(a5.dirname($),{recursive:!0}),n1.writeFileSync($,JSON.stringify(Z))}catch{}}function r7($,Z,X=[]){let J;try{J=n1.readdirSync($,{withFileTypes:!0})}catch{return X}for(let Y of J){let Q=a5.join($,Y.name);if(Y.isDirectory()){r7(Q,`${Z}/${Y.name}`,X);continue}if(!gY.has(a5.extname(Y.name).toLowerCase()))continue;X.push([`${Z}/${Y.name}`,Q])}return X}async function KH($,Z={}){let{cachePath:X,maxBytes:J=33554432,limit:Y=2000}=Z;if(!$||!n1.existsSync($))return i1=!0,H1.size;let Q;try{Q=await import("ts-images")}catch{return i1=!0,H1.size}let G=X?mY(X):{},z=!1,q=r7($,"").slice(0,Y),K=8,U=async([W,H])=>{let j;try{j=n1.statSync(H)}catch{return}if(j.size>J)return;let B=G[W];if(B&&B.mtimeMs===j.mtimeMs&&B.size===j.size){H1.set(W,{dataUrl:B.dataUrl,color:B.color});return}try{let{hash:_}=await Q.generateThumbHash(H);if(!_)return;let{rgba:O,w:V,h:L}=Q.thumbHashToRGBA(_),F={dataUrl:dY(uY(O,V,L)),color:hY(O)};H1.set(W,F),G[W]={mtimeMs:j.mtimeMs,size:j.size,...F},z=!0}catch{}};for(let W=0;W<q.length;W+=K)await Promise.all(q.slice(W,W+K).map(U));if(X&&z)lY(X,G);return i1=!0,H1.size}var cY={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},t5=[320,640,768,1024,1280,1536,1920];function V0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function N0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function B9($,Z,X=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return X}function pY($){let Z=(J)=>$.variants.filter((Y)=>Y.format===J).reduce((Y,Q)=>Y+Q.bytes,0),X=Z($.fallback.format);return["avif","webp"].map((J)=>({format:J,srcset:$.sources[J]||"",bytes:Z(J)})).filter((J)=>J.srcset&&J.bytes>0&&J.bytes<X).sort((J,Y)=>J.bytes-Y.bytes).map(({format:J,srcset:Y})=>({format:J,srcset:Y}))}function e5($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),X=[];for(let J of Z)if(J.includes(":")){let[Y,Q]=J.split(":"),G=cY[Y];if(G)X.push(`(max-width: ${G}px) ${Q}`);else{let z=Number.parseInt(Y);if(!Number.isNaN(z))X.push(`(max-width: ${z}px) ${Q}`)}}else X.push(J);return X.join(", ")}function $$($,Z,X,J){return Z.map((Y)=>`${O2($,Y,void 0,X,J)} ${Y}w`).join(", ")}function iY($,Z,X,J,Y){return Z.map((Q)=>{let G=X?X*Q:void 0;return`${O2($,G,void 0,J,Y)} ${Q}x`}).join(", ")}function O2($,Z,X,J,Y){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(X)Q.push(`h_${X}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(X)Q.set("h",String(X));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(X)Q.set("height",String(X));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function nY($,Z,X="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${X}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var Z$={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,X){let J=N0($,"src")||"",Y=a7(J),Q=N0($,"alt")||"",G=N0($,"width")||(Y?String(Y.source.width):void 0),z=N0($,"height")||(Y?String(Y.source.height):void 0),q=N0($,"sizes"),K=N0($,"srcset"),U=N0($,"densities"),W=N0($,"format"),H=N0($,"placeholder")||(Y?"thumbhash":void 0),j=N0($,"placeholderColor")||"#e5e7eb",B=N0($,"provider"),_=N0($,"class")||N0($,"className")||"",O=N0($,"style")||"",V=N0($,"quality"),L=B9($,"lazy",!0),F=B9($,"preload",!1),w=B9($,"priority",!1),R=N0($,"loading"),D=N0($,"decoding")||"async",A=!!Y||B9($,"picture",!1)||!!W,k=G?Number.parseInt(G):void 0,N=z?Number.parseInt(z):void 0,M=K||"",T="";if(Y)M=Y.sources[Y.fallback.format]||"",T=q?e5(q):"100vw";else if(!M&&q&&B&&B!=="local"&&B!=="static")M=$$(J,t5,B,W),T=e5(q);else if(!M&&U){let g=U.split(/\s+/).map((x)=>Number.parseFloat(x.replace("x","")));M=iY(J,g,k,B,W)}else if(q)T=e5(q);let I=[];if(O)I.push(O);if(k&&N)I.push(`aspect-ratio:${k}/${N}`);if(H==="blur"||H==="color"||H==="thumbhash"){let g=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:j}:s7(J);if(g&&H==="color")I.push(`background-color:${g.color}`);else if(g)I.push(`background-color:${g.color}`),I.push(`background-image:url(${g.dataUrl})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");else{let x=nY(k||16,N||9,j);I.push(`background-image:url(${x})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat")}}else if(H&&H!=="empty"&&H!=="none")I.push(`background-image:url(${V0(H)})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");let y=Y?.fallback.url||O2(J,k,N,B,W),E=[];if(E.push(`src="${V0(y)}"`),E.push(`alt="${V0(Q)}"`),G)E.push(`width="${V0(G)}"`);if(z)E.push(`height="${V0(z)}"`);let b=R||(w||F?"eager":L?"lazy":"");if(b)E.push(`loading="${V0(b)}"`);if(w)E.push('fetchpriority="high"');if(E.push(`decoding="${V0(D)}"`),_)E.push(`class="${V0(_)}"`);if(I.length>0)E.push(`style="${V0(I.join(";"))}"`);if(M)E.push(`srcset="${V0(M)}"`);if(T)E.push(`sizes="${V0(T)}"`);let C=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);E.push(...c1($,C)),E.push(...p1($,C));let v=`<img ${E.join(" ")} />`,P="";if(F){let x=W==="webp"?"image/webp":W==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${V0(y)}"${x?` type="${x}"`:""}${M?` imagesrcset="${V0(M)}"`:""}${T?` imagesizes="${V0(T)}"`:""} />
|
|
3511
|
+
`}if(A){let g=[];if(Y)for(let x of pY(Y))g.push(`<source type="image/${x.format}" srcset="${V0(x.srcset)}"${T?` sizes="${V0(T)}"`:""} />`);if(!Y&&(W==="avif"||W==="auto")){let x=O2(J,k,N,B,"avif"),$0=M?$$(J,t5,B,"avif"):`${x}`;g.push(`<source type="image/avif" srcset="${V0($0)}"${T?` sizes="${V0(T)}"`:""} />`)}if(!Y&&(W==="webp"||W==="auto")){let x=O2(J,k,N,B,"webp"),$0=M?$$(J,t5,B,"webp"):`${x}`;g.push(`<source type="image/webp" srcset="${V0($0)}"${T?` sizes="${V0(T)}"`:""} />`)}return`${P}<picture>
|
|
3512
3512
|
${g.join(`
|
|
3513
3513
|
`)}
|
|
3514
3514
|
${v}
|
|
3515
|
-
</picture>`}return`${P}${v}`}};var
|
|
3515
|
+
</picture>`}return`${P}${v}`}};var t7="/images/safe-image-default.svg";function F2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function o1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var oY=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${t7}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,X$={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,X){let J=o1($,"src")||"",Y=o1($,"alt")||"",Q=o1($,"fallback")||t7,G=o1($,"class")||o1($,"className")||"",z=o1($,"fallbackClassName")||"",q=[];if(q.push(`src="${F2(J)}"`),q.push(`alt="${F2(Y)}"`),G)q.push(`class="${F2(G)}"`);if(q.push(`data-fallback="${F2(Q)}"`),z)q.push(`data-fallback-class="${F2(z)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let K=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...c1($,K)),q.push(...p1($,K));let U=`<img ${q.join(" ")} />`,W=X.context;if(!W.__safeImageHandlerEmitted)return W.__safeImageHandlerEmitted=!0,`${oY}${U}`;return U}};function J$($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function w2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function _9($,Z,X){let J=w2($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var Y$={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,X){let J=J$(w2($,"color")||"#6366f1"),Y=J$(w2($,"initialColor")||w2($,"initial-color")||""),Q=J$(w2($,"height")||"3px"),G=_9($,"duration",2000),z=_9($,"throttle",200),q=_9($,"zIndex",999999)||_9($,"z-index",999999),K=Y?`linear-gradient(to right, ${Y}, ${J})`:J;return`
|
|
3516
3516
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${K};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
3517
3517
|
<div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
|
|
3518
3518
|
</div>
|
|
3519
3519
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
3520
3520
|
<script>
|
|
3521
3521
|
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${z})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
3522
|
-
</script>`}};function
|
|
3522
|
+
</script>`}};function $6($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function sY($,Z,X){let J=$6($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var e7={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},Q$={name:"StxToast",aliases:["stx-toast"],render($,Z,X){let J=w0($6($,"position")||"top-right"),Y=sY($,"max",5),Q=e7[J]||e7["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${Y}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
3523
3523
|
<style>
|
|
3524
3524
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
3525
3525
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -3527,7 +3527,7 @@ ${v}
|
|
|
3527
3527
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
3528
3528
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
3529
3529
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
3530
|
-
</style>`}};function V9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var
|
|
3530
|
+
</style>`}};function V9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var Z6={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},G$={name:"StxModal",aliases:["stx-modal"],render($,Z,X){let J=V9($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=w0(J),Q=V9($,"size")||"md",G=V9($,"closeOnBackdrop")!=="false",z=V9($,"closeOnEscape")!=="false",q=Z6[Q]||Z6.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${G}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
|
|
3531
3531
|
<div class="stx-modal-panel" style="${q};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
|
|
3532
3532
|
<div style="padding:1.5rem">${Z}</div>
|
|
3533
3533
|
</div>
|
|
@@ -3536,7 +3536,7 @@ ${v}
|
|
|
3536
3536
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
3537
3537
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
3538
3538
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
3539
|
-
</style>`}};function s1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var
|
|
3539
|
+
</style>`}};function s1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var X6={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},z$={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,X){let J=s1($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=w0(J),Q=s1($,"side")||"right",G=s1($,"size")||"md",z=s1($,"closeOnBackdrop")!=="false",q=s1($,"closeOnEscape")!=="false",K=s1($,"overlay")!=="false",U=X6[G]||X6.md,W=Q==="left",H=W?"left:0":"right:0",j=W?"translateX(-100%)":"translateX(100%)",B=W?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${z}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${K?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
|
|
3540
3540
|
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${H};width:${U};max-width:100vw;transform:${j};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
|
|
3541
3541
|
<div style="padding:1.5rem">${Z}</div>
|
|
3542
3542
|
</div>
|
|
@@ -3545,14 +3545,14 @@ ${v}
|
|
|
3545
3545
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
3546
3546
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
3547
3547
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
3548
|
-
</style>`}};import{existsSync as
|
|
3549
|
-
`||N==="\t")L++;F=A+O.length}else{if(L--,L===0){w=k;break}F=k+V.length}}if(w===-1){Y=j;continue}let R=$.slice(j,w),D=w+V.length;J.push({fullMatch:$.slice(G,D),tagName:K,attributes:_,content:R,startIndex:G,endIndex:D,isSelfClosing:!1}),Y=D}}return J}function H6($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function j6($,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 w9 from"fs";import x0 from"path";var B6=!1,_6=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 $Q($,Z,X,J=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(U)=>{if(Q.size===0)return!1;let W=l0(U),H=W.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(H&&Q.has(H))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(W))return!0}return!1},z=new Set(F6),q=(U)=>{if(!U.includes("-")||U.startsWith("@")||U.startsWith(":")||U.startsWith("x-")||U.startsWith("__"))return U;if(U.startsWith("aria-")||U.startsWith("data-"))return U;return U.replace(/-([a-z0-9])/g,(W,H)=>H.toUpperCase())},K=(U,W)=>{let H=q(U);if(Y.static[H]=W,H!==U)Y.staticNames[H]=U};for(let[U,W]of Object.entries($)){let H=U.startsWith("x-")&&!z.has(U)&&!U.startsWith("x-bind:")&&!U.startsWith("x-on:")?`:${U.slice(2)}`:U;if(H.startsWith("@")){Y.events[H]=W;continue}if(H.startsWith("__stx_")){let j=q(H.slice(6));Y.serverDynamic[j]=j6(W,X);continue}if(H.startsWith(":")){let j=q(H.slice(1)),B=W===N1?j:W;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(J){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!z0(B)){if(X.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let _=Object.keys(Z),V=U0(B,_)(...Object.values(Z));if(V===void 0){let L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(Q9(B).some((w)=>!L.has(w)&&!_.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=V,j!==H.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=H.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let j=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(z0(B)){let O=U0(B,Object.keys(Z))(...Object.values(Z));K(H,O!=null?String(O):"")}else{if(X.debug)console.error(`Unsafe expression in ${H}: ${B}`);K(H,W)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${H}:`,B);K(H,W)}else{let B=W,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,O;while((O=_.exec(W))!==null)try{let V=O[1];if(!z0(V)){if(X.debug)console.error(`Unsafe expression in ${H}: ${V}`);continue}let F=U0(V,Object.keys(Z))(...Object.values(Z));B=B.replace(O[0],String(F??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${H}:`,V)}K(H,B)}continue}K(H,W===N1?"true":H6(W))}return Y}var ZQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function XQ($,Z,X){if(!$.includes("@"))return $;if(!ZQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return $1($,Z,X)}catch{return $}}function JQ($){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 z=$[X];if(z==="\\"&&X+1<J){X++,Q+=$[X],X++;continue}if(z===G){X++;break}Q+=z,X++}}else while(X<J&&!/\s/.test($[X]))Q+=$[X],X++;Z[Y]=Q}else Z[Y]=N1}return Z}function V6($){return Object.entries($).map(([Z,X])=>X===N1?Z:`${Z}="${YQ(X)}"`).join(" ")}function YQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function QQ($){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(y0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var L6=new Map;function GQ($){let Z=L6.get($);if(Z)return Z;let X=new Map,J=[x0.join($,"src"),x0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let z;try{z=w9.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of z){let K=x0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Y(K,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!X.has(U))X.set(U,K);let W=U.toLowerCase();if(!X.has(W))X.set(W,K);let H=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,K)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return L6.set($,X),X}function zQ($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=x0.join(X,"node_modules",$);try{if(w9.statSync(J).isDirectory())return J}catch{}let Y=x0.dirname(X);if(Y===X)return null;X=Y}}async function qQ($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=x0.dirname(X),z=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return z=z.replace(q,(K,U,W)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,j=W,B,_=[];while((B=H.exec(W))!==null){let[O,V,L,F]=B,w=null,R=null;if(F.startsWith(".")||F.startsWith("/")){let k=x0.resolve(G,F);if(k.endsWith(".stx"))R=k;else{let N=`${k}.stx`;try{if(w9.statSync(N).isFile())R=N}catch{try{if(w9.statSync(k).isDirectory())w=k}catch{}}}}else w=zQ(F,G);if(!w&&!R)continue;let D=!1,A=(k,N)=>{Q.set(k,N),Q.set(k.toLowerCase(),N);let M=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,N),Y.add(N)};if(L&&R)A(L,R),D=!0;else if(V){let k=V.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let T=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T)return{source:T[1],local:T[2]};return{source:M,local:M}}),N=w?GQ(w):null;for(let{source:M,local:T}of k){let I=null;if(R)I=R;else if(N)I=N.get(M)??N.get(M.toLowerCase())??N.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)A(T,I),D=!0}}if(D)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return K;for(let O=_.length-1;O>=0;O--)j=j.slice(0,_[O].start)+j.slice(_[O].end);return`<script${U}>${j}</script>`}),z}async function KQ($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=z.exec(Q))!==null){let[K,U]=q,W=U.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of W){let j=H.split("/"),_=j[j.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,L=[x0.resolve(x0.dirname(X),`${H}.stx`),x0.resolve(x0.dirname(X),H),x0.resolve(J.componentsDir||"components",`${H}.stx`),x0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(O,V),G.set(_,V),G.set(_.toLowerCase(),V);let F=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),Y.add(V),J.debug)console.log(`Imported component: ${O} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(K,""),z.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 z=Z.__processedComponents,q=/@component\s*\(/g,K;while((K=q.exec(Q))!==null){let U=K.index,W=U+K[0].length-1,H=1,j=W+1;while(j<Q.length&&H>0){if(Q[j]==="(")H++;else if(Q[j]===")"){if(H--,H===0)break}j++}if(H!==0)break;let B=Q.substring(W+1,j),_=j+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){q.lastIndex=0;continue}let V=O[1],L,F=B.slice(O[0].length),w=F.match(/^\s*,\s*/);if(w)L=F.slice(w[0].length).trim();let R={};if(L)try{R=I0(L,Z)}catch(T){let I=T instanceof Error?T.message:String(T);Q=Q.replace(Q.substring(U,_),`[Error parsing component props: ${I}]`);continue}let D="",A=_,N=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(N)D=N[1].trim(),A=_+N[0].length;let M=await D1(V,R,D,G,Z,X,J,z,Y);Q=Q.substring(0,U)+M+Q.substring(A),q.lastIndex=0}return Q}async function WQ($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,q=n0(Q);Q=q.output;let K=T5(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,U6(_6)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,_6),Q=E1(Q,q.scripts),Q;async function j(B,_,O,V){if(!B)return B;let L=B,F=W6(L,_,V),w=new Map;for(let A=F.length-1;A>=0;A--){let k=F[A],N=O?O9(k.tagName):k.tagName,M=JQ(XQ(k.attributes,Z,X)),T=K.some(([P,g])=>k.startIndex>=P&&k.startIndex<g),I=$Q(M,Z,J,T),y=y0.getBuiltin(k.tagName),E=y?await F9(N,G,Z,X,J):!1;if(y&&!E){let P={context:Z,filePath:X,options:J,dependencies:Y},g=y.render(I,k.content,P);if(Object.keys(I.events).length>0){let x=V6(I.events);g=g.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${x}`)}if(Object.keys(I.clientReactive).length>0)g=O6(g,I.clientReactive);w.set(A,g);continue}if(!O&&k.tagName.includes("-")&&!await F9(N,G,Z,X,J))continue;let b={};for(let[P,g]of Object.entries(I.static))b[P]=g;for(let[P,g]of Object.entries(I.serverDynamic))b[P]=g;let v=await D1(N,b,E1(k.content,q.scripts),G,Z,X,J,z,Y);if(Object.keys(I.events).length>0){let P=w6(v);if(P){let g=V6(I.events),x=Object.keys(I.events).map(($0)=>$0.replace(/^@/,"").split(".")[0]).join(" ");v=v.substring(0,P.insertPos)+` data-stx-parent-events="${x}" ${g}`+v.substring(P.insertPos)}}if(Object.keys(I.clientReactive).length>0)v=O6(v,I.clientReactive);w.set(A,v)}if(w.size===0)return L;let R="",D=0;for(let A=0;A<F.length;A++){let k=w.get(A);if(k===void 0)continue;R+=L.slice(D,F[A].startIndex),R+=k,D=F[A].endIndex}return R+=L.slice(D),R}}function O6($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([U])=>!X.has(U)),Q=Y.filter(([U])=>!J.has(U)).map(([U])=>O9(U)).join(" "),G=$,z=Y.length>0?w6(G):null;if(z){let U=Y.map(([H,j])=>`:${O9(H)}="${j.replace(/"/g,""")}"`).join(" "),W=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${W} ${U}`+G.substring(z.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,""")}">${G}</template>`;let K=Z.for;if(K)G=`<template :for="${K.replace(/"/g,""")}">${G}</template>`;return G}function w6($){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 z=$.indexOf("-->",X+4);if(z===-1)return null;X=z+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(z,X+Q[0].length);if(q===-1)return null;X=q+z.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 W$($,Z,X,J,Y){if(!B6)z6(),B6=!0;let Q=await qQ($,Z,X,J,Y);Q=await KQ(Q,Z,X,J,Y),Q=await UQ(Q,Z,X,J,Y);let G=[];for(let z=0;z<3;z++){let q=i0(Q,X2,(U,W)=>`\x00STX_COMPONENT_COMMENT_${G.length+W}\x00`);G.push(...q.tokens);let K=Q;if(Q=await WQ(q.output,Z,X,J,Y),Q===K)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,q)=>G[Number(q)]??"");if(J.debug){let z=QQ(Q);if(z.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import t1 from"path";import R6 from"process";function a1($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(R6.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 Bj($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(R6.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function D6($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function N6($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=t1.join(Y,$);if(await Bun.file(G).exists())return G;Y=t1.dirname(Y)}J=t1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=t1.resolve(Z,$);else J=t1.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function A6($,Z,X){let J=$,Y=t1.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[K,U,W,H]=G;if(D6(W))continue;let j=await N6(W,Y,Z);if(j)try{let B=await Bun.file(j).text();if(X.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let O=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:a1()});if(O.outputs.length>0)B=await O.outputs[0].text()}let _=`<script>
|
|
3548
|
+
</style>`}};import{existsSync as rY,readFileSync as aY}from"fs";var A1=new Map,J6=new Set;function Y6($){if(J6.has($))return;J6.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Q6($){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(rY(X))return X;for(let X of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return u.resolve(X)}catch{}return null}function tY($){if(A1.has($))return A1.get($);let Z=Q6($);if(!Z)return Y6($),null;try{let X=JSON.parse(aY(Z,"utf8"));return A1.set($,X.icons),X.icons}catch{return null}}async function eY($,Z=!1){if(A1.has($))return A1.get($);let X=Q6($);if(!X){if(!Z)Y6($);return null}try{let J=await Bun.file(X).json();return A1.set($,J.icons),J.icons}catch{return null}}function r1($,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 q$={name:"Icon",aliases:["icon","stx-icon"],render($,Z,X){let J=r1($,"name")??r1($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=J;if(J.includes(":")){let L=J.split(":");Y=L[0],Q=L[1]}let G=w0(r1($,"size")||"24"),z=w0(r1($,"color")||"currentColor"),q=w0(r1($,"class")||""),K=w0(r1($,"style")||""),U=A1.get(Y)??tY(Y);if(!U)return`<!-- Icon: collection "${Y}" not loaded -->`;let W=U[Q];if(!W)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let H=W.width||24,j=W.height||24,B=`0 0 ${H} ${j}`,_=W.body;if(z!=="currentColor")_=_.replace(/currentColor/g,z);let O=q?` class="${q}"`:"",V=K?` style="${K}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${V}>${_}</svg>`}};async function $Q($="lucide",Z={}){await eY($,Z.speculative??!0)}function G6($,...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 z6($,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 K$={name:"Suspense",aliases:["suspense"],render($,Z,X){let J=z6(Z,"fallback"),Y=J.rest,Q=z6(Y,"error"),G=Q.rest,z=J.region??G6($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??G6($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function L9($,...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 U$={name:"TransitionGroup",aliases:["transition-group"],render($,Z,X){let J=(L9($,"name")||"v").replace(/["'<>]/g,""),Y=(L9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=L9($,"class"),G=L9($,"id"),z=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${z}>${Z}</${Y}>`}};function q6(){y0.registerBuiltin(r5),y0.registerBuiltin(Z$),y0.registerBuiltin(X$),y0.registerBuiltin(Y$),y0.registerBuiltin(Q$),y0.registerBuiltin(G$),y0.registerBuiltin(z$),y0.registerBuiltin(q$),y0.registerBuiltin(K$),y0.registerBuiltin(U$)}function O9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var K6=new Map;function ZQ($){let Z=K6.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),K6.set($.source,Z);return Z}var U6=new WeakMap;function W6($){let Z=U6.get($);if(!Z)Z=new Set([...$].map((J)=>J.toLowerCase())),U6.set($,Z);let X=Z;return(J)=>!/[a-z]/.test(J)&&X.has(J.toLowerCase())}function H6($,Z,X){let J=[],Y=0,Q=typeof X==="function"?X:X?(G)=>X.has(G.toLowerCase()):void 0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let z=ZQ(Z);z.lastIndex=G+1;let q=z.exec($);if(!q){Y=G+1;continue}let K=q[1];if(Q&&Q(K)){let O=G+1+K.length;while(O<$.length&&$[O]!==">")O++;Y=O+1;continue}let U=G+1+K.length,W=null,H=U,j=-1,B=!1;while(U<$.length){let O=$[U];if(W){if(O==="\\"&&U+1<$.length){U+=2;continue}if(O===W)W=null;U++;continue}if(O==='"'||O==="'"){W=O,U++;continue}if(O==="/"&&U+1<$.length&&$[U+1]===">"){j=U+2,B=!0;break}if(O===">"){j=U+1;break}U++}if(j===-1){Y=G+1;continue}let _=$.slice(H,B?j-2:j-1).trim();if(B)J.push({fullMatch:$.slice(G,j),tagName:K,attributes:_,content:"",startIndex:G,endIndex:j,isSelfClosing:!0}),Y=j;else{let O=`<${K}`,V=`</${K}>`,L=1,F=j,w=-1;while(L>0&&F<$.length){let A=$.indexOf(O,F),k=$.indexOf(V,F);if(k===-1)break;if(A!==-1&&A<k){let N=$[A+O.length];if(N===" "||N===">"||N==="/"||N===`
|
|
3549
|
+
`||N==="\t")L++;F=A+O.length}else{if(L--,L===0){w=k;break}F=k+V.length}}if(w===-1){Y=j;continue}let R=$.slice(j,w),D=w+V.length;J.push({fullMatch:$.slice(G,D),tagName:K,attributes:_,content:R,startIndex:G,endIndex:D,isSelfClosing:!1}),Y=D}}return J}function j6($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function B6($,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 w9 from"fs";import x0 from"path";var _6=!1,V6=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 XQ($,Z,X,J=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(U)=>{if(Q.size===0)return!1;let W=l0(U),H=W.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(H&&Q.has(H))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(W))return!0}return!1},z=new Set(w6),q=(U)=>{if(!U.includes("-")||U.startsWith("@")||U.startsWith(":")||U.startsWith("x-")||U.startsWith("__"))return U;if(U.startsWith("aria-")||U.startsWith("data-"))return U;return U.replace(/-([a-z0-9])/g,(W,H)=>H.toUpperCase())},K=(U,W)=>{let H=q(U);if(Y.static[H]=W,H!==U)Y.staticNames[H]=U};for(let[U,W]of Object.entries($)){let H=U.startsWith("x-")&&!z.has(U)&&!U.startsWith("x-bind:")&&!U.startsWith("x-on:")?`:${U.slice(2)}`:U;if(H.startsWith("@")){Y.events[H]=W;continue}if(H.startsWith("__stx_")){let j=q(H.slice(6));Y.serverDynamic[j]=B6(W,X);continue}if(H.startsWith(":")){let j=q(H.slice(1)),B=W===N1?j:W;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(J){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!z0(B)){if(X.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let _=Object.keys(Z),V=U0(B,_)(...Object.values(Z));if(V===void 0){let L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(Q9(B).some((w)=>!L.has(w)&&!_.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=V,j!==H.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=H.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let j=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(z0(B)){let O=U0(B,Object.keys(Z))(...Object.values(Z));K(H,O!=null?String(O):"")}else{if(X.debug)console.error(`Unsafe expression in ${H}: ${B}`);K(H,W)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${H}:`,B);K(H,W)}else{let B=W,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,O;while((O=_.exec(W))!==null)try{let V=O[1];if(!z0(V)){if(X.debug)console.error(`Unsafe expression in ${H}: ${V}`);continue}let F=U0(V,Object.keys(Z))(...Object.values(Z));B=B.replace(O[0],String(F??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${H}:`,V)}K(H,B)}continue}K(H,W===N1?"true":j6(W))}return Y}var JQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function YQ($,Z,X){if(!$.includes("@"))return $;if(!JQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return $1($,Z,X)}catch{return $}}function QQ($){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 z=$[X];if(z==="\\"&&X+1<J){X++,Q+=$[X],X++;continue}if(z===G){X++;break}Q+=z,X++}}else while(X<J&&!/\s/.test($[X]))Q+=$[X],X++;Z[Y]=Q}else Z[Y]=N1}return Z}function L6($){return Object.entries($).map(([Z,X])=>X===N1?Z:`${Z}="${GQ(X)}"`).join(" ")}function GQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function zQ($){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(y0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var O6=new Map;function qQ($){let Z=O6.get($);if(Z)return Z;let X=new Map,J=[x0.join($,"src"),x0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let z;try{z=w9.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of z){let K=x0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Y(K,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!X.has(U))X.set(U,K);let W=U.toLowerCase();if(!X.has(W))X.set(W,K);let H=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,K)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return O6.set($,X),X}function KQ($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=x0.join(X,"node_modules",$);try{if(w9.statSync(J).isDirectory())return J}catch{}let Y=x0.dirname(X);if(Y===X)return null;X=Y}}async function UQ($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=x0.dirname(X),z=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return z=z.replace(q,(K,U,W)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,j=W,B,_=[];while((B=H.exec(W))!==null){let[O,V,L,F]=B,w=null,R=null;if(F.startsWith(".")||F.startsWith("/")){let k=x0.resolve(G,F);if(k.endsWith(".stx"))R=k;else{let N=`${k}.stx`;try{if(w9.statSync(N).isFile())R=N}catch{try{if(w9.statSync(k).isDirectory())w=k}catch{}}}}else w=KQ(F,G);if(!w&&!R)continue;let D=!1,A=(k,N)=>{Q.set(k,N),Q.set(k.toLowerCase(),N);let M=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,N),Y.add(N)};if(L&&R)A(L,R),D=!0;else if(V){let k=V.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let T=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T)return{source:T[1],local:T[2]};return{source:M,local:M}}),N=w?qQ(w):null;for(let{source:M,local:T}of k){let I=null;if(R)I=R;else if(N)I=N.get(M)??N.get(M.toLowerCase())??N.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)A(T,I),D=!0}}if(D)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return K;for(let O=_.length-1;O>=0;O--)j=j.slice(0,_[O].start)+j.slice(_[O].end);return`<script${U}>${j}</script>`}),z}async function WQ($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=z.exec(Q))!==null){let[K,U]=q,W=U.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of W){let j=H.split("/"),_=j[j.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,L=[x0.resolve(x0.dirname(X),`${H}.stx`),x0.resolve(x0.dirname(X),H),x0.resolve(J.componentsDir||"components",`${H}.stx`),x0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(O,V),G.set(_,V),G.set(_.toLowerCase(),V);let F=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),Y.add(V),J.debug)console.log(`Imported component: ${O} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(K,""),z.lastIndex=0}return Q}async function HQ($,Z,X,J,Y){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,q=/@component\s*\(/g,K;while((K=q.exec(Q))!==null){let U=K.index,W=U+K[0].length-1,H=1,j=W+1;while(j<Q.length&&H>0){if(Q[j]==="(")H++;else if(Q[j]===")"){if(H--,H===0)break}j++}if(H!==0)break;let B=Q.substring(W+1,j),_=j+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){q.lastIndex=0;continue}let V=O[1],L,F=B.slice(O[0].length),w=F.match(/^\s*,\s*/);if(w)L=F.slice(w[0].length).trim();let R={};if(L)try{R=I0(L,Z)}catch(T){let I=T instanceof Error?T.message:String(T);Q=Q.replace(Q.substring(U,_),`[Error parsing component props: ${I}]`);continue}let D="",A=_,N=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(N)D=N[1].trim(),A=_+N[0].length;let M=await D1(V,R,D,G,Z,X,J,z,Y);Q=Q.substring(0,U)+M+Q.substring(A),q.lastIndex=0}return Q}async function jQ($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,q=n0(Q);Q=q.output;let K=T5(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,W6(V6)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,V6),Q=E1(Q,q.scripts),Q;async function j(B,_,O,V){if(!B)return B;let L=B,F=H6(L,_,V),w=new Map;for(let A=F.length-1;A>=0;A--){let k=F[A],N=O?O9(k.tagName):k.tagName,M=QQ(YQ(k.attributes,Z,X)),T=K.some(([P,g])=>k.startIndex>=P&&k.startIndex<g),I=XQ(M,Z,J,T),y=y0.getBuiltin(k.tagName),E=y?await F9(N,G,Z,X,J):!1;if(y&&!E){let P={context:Z,filePath:X,options:J,dependencies:Y},g=y.render(I,k.content,P);if(Object.keys(I.events).length>0){let x=L6(I.events);g=g.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${x}`)}if(Object.keys(I.clientReactive).length>0)g=F6(g,I.clientReactive);w.set(A,g);continue}if(!O&&k.tagName.includes("-")&&!await F9(N,G,Z,X,J))continue;let b={};for(let[P,g]of Object.entries(I.static))b[P]=g;for(let[P,g]of Object.entries(I.serverDynamic))b[P]=g;let v=await D1(N,b,E1(k.content,q.scripts),G,Z,X,J,z,Y);if(Object.keys(I.events).length>0){let P=R6(v);if(P){let g=L6(I.events),x=Object.keys(I.events).map(($0)=>$0.replace(/^@/,"").split(".")[0]).join(" ");v=v.substring(0,P.insertPos)+` data-stx-parent-events="${x}" ${g}`+v.substring(P.insertPos)}}if(Object.keys(I.clientReactive).length>0)v=F6(v,I.clientReactive);w.set(A,v)}if(w.size===0)return L;let R="",D=0;for(let A=0;A<F.length;A++){let k=w.get(A);if(k===void 0)continue;R+=L.slice(D,F[A].startIndex),R+=k,D=F[A].endIndex}return R+=L.slice(D),R}}function F6($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([U])=>!X.has(U)),Q=Y.filter(([U])=>!J.has(U)).map(([U])=>O9(U)).join(" "),G=$,z=Y.length>0?R6(G):null;if(z){let U=Y.map(([H,j])=>`:${O9(H)}="${j.replace(/"/g,""")}"`).join(" "),W=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${W} ${U}`+G.substring(z.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,""")}">${G}</template>`;let K=Z.for;if(K)G=`<template :for="${K.replace(/"/g,""")}">${G}</template>`;return G}function R6($){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 z=$.indexOf("-->",X+4);if(z===-1)return null;X=z+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(z,X+Q[0].length);if(q===-1)return null;X=q+z.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 W$($,Z,X,J,Y){if(!_6)q6(),_6=!0;let Q=await UQ($,Z,X,J,Y);Q=await WQ(Q,Z,X,J,Y),Q=await HQ(Q,Z,X,J,Y);let G=[];for(let z=0;z<3;z++){let q=i0(Q,X2,(U,W)=>`\x00STX_COMPONENT_COMMENT_${G.length+W}\x00`);G.push(...q.tokens);let K=Q;if(Q=await jQ(q.output,Z,X,J,Y),Q===K)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,q)=>G[Number(q)]??"");if(J.debug){let z=zQ(Q);if(z.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import t1 from"path";import D6 from"process";function a1($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(D6.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 Fj($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(D6.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function N6($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function A6($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=t1.join(Y,$);if(await Bun.file(G).exists())return G;Y=t1.dirname(Y)}J=t1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=t1.resolve(Z,$);else J=t1.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function M6($,Z,X){let J=$,Y=t1.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[K,U,W,H]=G;if(N6(W))continue;let j=await A6(W,Y,Z);if(j)try{let B=await Bun.file(j).text();if(X.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let O=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:a1()});if(O.outputs.length>0)B=await O.outputs[0].text()}let _=`<script>
|
|
3550
3550
|
// Source: ${W}
|
|
3551
3551
|
${B}
|
|
3552
|
-
</script>`;J=J.replace(K,_),Q.lastIndex=0}catch(B){}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=z.exec(J))!==null){let[K,U,W,H]=q,j=U+H;if(
|
|
3552
|
+
</script>`;J=J.replace(K,_),Q.lastIndex=0}catch(B){}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=z.exec(J))!==null){let[K,U,W,H]=q,j=U+H;if(N6(W))continue;if(/rel=["']stylesheet["']/.test(j)||W.endsWith(".css")){let _=await A6(W,Y,Z);if(_)try{let O=await Bun.file(_).text();X.add(_);let V=`<style>
|
|
3553
3553
|
/* Source: ${W} */
|
|
3554
3554
|
${O}
|
|
3555
|
-
</style>`;J=J.replace(K,V),z.lastIndex=0}catch(O){}}}return J}function H$($,Z){let X=$,J=/@json\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index,G=Q+Y[0].length-1,z=1,q=G+1,K=null,U=!1;while(q<X.length&&z>0){let F=X[q];if(U){U=!1,q++;continue}if(F==="\\"&&K){U=!0,q++;continue}if(K){if(F===K)K=null;q++;continue}if(F==='"'||F==="'"||F==="`"){K=F,q++;continue}if(F==="(")z++;else if(F===")"){if(z--,z===0)break}q++}if(z!==0)break;let W=X.substring(G+1,q).trim(),H=X.substring(Q,q+1),j=-1,B=0,_=null,O=!1;for(let F=0;F<W.length;F++){let w=W[F];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){j=F;break}}let V=j>=0?W.substring(0,j).trim():W,L=j>=0?W.substring(j+1).trim():void 0;try{let F=V.trim(),w;if(z0(F))w=U0(F,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(L==="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(q+1),J.lastIndex=Q+D.length}catch(F){s0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=Q+H.length}}return X}function j$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function
|
|
3555
|
+
</style>`;J=J.replace(K,V),z.lastIndex=0}catch(O){}}}return J}function H$($,Z){let X=$,J=/@json\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index,G=Q+Y[0].length-1,z=1,q=G+1,K=null,U=!1;while(q<X.length&&z>0){let F=X[q];if(U){U=!1,q++;continue}if(F==="\\"&&K){U=!0,q++;continue}if(K){if(F===K)K=null;q++;continue}if(F==='"'||F==="'"||F==="`"){K=F,q++;continue}if(F==="(")z++;else if(F===")"){if(z--,z===0)break}q++}if(z!==0)break;let W=X.substring(G+1,q).trim(),H=X.substring(Q,q+1),j=-1,B=0,_=null,O=!1;for(let F=0;F<W.length;F++){let w=W[F];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){j=F;break}}let V=j>=0?W.substring(0,j).trim():W,L=j>=0?W.substring(j+1).trim():void 0;try{let F=V.trim(),w;if(z0(F))w=U0(F,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(L==="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(q+1),J.lastIndex=Q+D.length}catch(F){s0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=Q+H.length}}return X}function j$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function k6($){let Z=$,X=/@memo\s*\(/g,J,Y=[];while((J=X.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,z=1,q=G;while(q<Z.length&&z>0){if(Z[q]==="(")z++;else if(Z[q]===")")z--;q++}if(z!==0)continue;let K=Z.slice(G,q-1).trim(),U=q,W=Z.slice(U),H=W.indexOf("@endmemo");if(H===-1)continue;let j=W.slice(0,H),B=U+H+8,_=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,V=j.slice(O),L=j.match(/(\s*)$/),F=L?L[0].length:0,w=V.slice(0,V.length-F),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[A,k,N="",M]=R,T=`<${k}${N} data-stx-memo="${K}"${M}>`;D=j.slice(0,O)+T+w.slice(A.length)+j.slice(O+w.length)}else D=`${j.slice(0,O)}<div data-stx-memo="${K}">${w}</div>${j.slice(O+w.length)}`;Y.push({start:Q,end:B,replacement:D}),X.lastIndex=B}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 B$($){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}var BQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),I6=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/;function _Q($,Z){let X=!1,J=!1;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(X){if(Q==="'")X=!1}else if(J){if(Q==='"')J=!1}else if(Q==="'")X=!0;else if(Q==='"')J=!0;else if(Q===">")return Y}return-1}function VQ($,Z){let X=0,J="",Y=Z;while(Y<$.length){let Q=$[Y];if(Q!=="<"){if(X===0)J+=Q;Y++;continue}if($.startsWith("<!--",Y)){let K=$.indexOf("-->",Y);Y=K===-1?$.length:K+3;continue}let G=_Q($,Y);if(G===-1)break;let z=$.slice(Y,G+1),q=/^<\/?\s*([a-z][\w-]*)/i.exec(z)?.[1]?.toLowerCase()??"";if(z[1]==="/"){if(X===0)break;X--}else if(!/\/\s*>$/.test(z)&&!BQ.has(q))X++;Y=G+1}return J}function T6($){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,z=G+Q[0].length,q=!1,K=!1,U=-1;while(z<$.length){let j=$[z];if(q){if(j==="'")q=!1}else if(K){if(j==='"')K=!1}else if(j==="'")q=!0;else if(j==='"')K=!0;else if(j===">"){U=z;break}z++}if(U===-1)continue;let W=$.slice(G,U+1);if(I6.test(W))continue;if(W.includes("x-cloak"))continue;let H=VQ($,U+1);if(/\{\{[\s\S]*?\}\}/.test(H))J+=$.slice(Y,U)+" x-cloak>",Y=U+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|\/|>|$)/,OQ=/<\/script>/gi,FQ=/<\/style>/gi;function E6($){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 B=G==="script"?OQ:FQ;B.lastIndex=Q;let _=B.exec($);if(_!==null)Z.lastIndex=_.index+_[0].length;continue}let z=Q+Y[0].length,q=!1,K=!1,U=-1;while(z<$.length){let B=$[z];if(q){if(B==="'")q=!1}else if(K){if(B==='"')K=!1}else if(B==="'")q=!0;else if(B==='"')K=!0;else if(B===">"){U=z;break}z++}if(U===-1)continue;let W=$.slice(Q+Y[0].length,U);if(I6.test(W))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(W))continue;if(!LQ.test(W))continue;let H=$[U-1]==="/",j=H?U-1:U;X+=`${$.slice(J,j)} x-cloak${H?" ":""}`,J=j}return X+=$.slice(J),X}var _$=e1(256),wQ=[{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 V$($,Z,X,J){let Y=typeof X==="boolean"?{enabled:X,failOnViolation:X}:X??{enabled:!1};if(!Y.enabled)return;let Q=M1($,Z,J,JSON.stringify(Y)),G=_$.get(Q);if(G!==void 0){if(G&&Y.failOnViolation)throw Error(G);return}let z=Y.allowPatterns??[],q=[],K=l0($.replace(/\{\{--[\s\S]*?--\}\}/g,(j)=>j.replace(/[^\n]/g," ")));for(let{pattern:j,message:B,suggestion:_}of wQ){if(z.some((V)=>/\w/.test(V)&&B.includes(V)))continue;j.lastIndex=0;let O=K.match(j);if(O&&O.length>0){let V=K.split(`
|
|
3556
3556
|
`),L=$.split(`
|
|
3557
3557
|
`),F=[];V.forEach((A,k)=>{if(j.lastIndex=0,j.test(A))F.push(k+1)});let w=F.length>0?` (script line${F.length>1?"s":""} ${F.join(", ")})`:"",R=F.slice(0,3).map((A)=>` ${A} | ${(L[A-1]??"").trim().slice(0,100)}`).join(`
|
|
3558
3558
|
`),D=R?`
|
|
@@ -3560,73 +3560,73 @@ ${R}`:"";q.push(` \u2717 ${B}${w}
|
|
|
3560
3560
|
\u2192 ${_}${D}`)}}if(q.length===0){_$.set(Q,"");return}let U=(j)=>{let B=`${process.cwd()}/`;return j.startsWith(B)?j.slice(B.length):j},H=`[STX] DOM API violation in ${J&&J!==Z?`${U(J)} (composed into ${U(Z)})`:U(Z)}:
|
|
3561
3561
|
${q.join(`
|
|
3562
3562
|
`)}
|
|
3563
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(_$.set(Q,H),Y.failOnViolation)throw Error(H);else console.warn(H)}
|
|
3563
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(_$.set(Q,H),Y.failOnViolation)throw Error(H);else console.warn(H)}AQ();import L$ from"path";var RQ=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,DQ=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function NQ($,Z){if(!Z||!$.includes("/"))return $;let X=L$.dirname(Z);return $.replace(RQ,(J,Y,Q,G)=>{let z=L$.resolve(X,G);return`${Y}${Q}${z.split(L$.sep).join("/")}${Q}`})}function b6($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(DQ,(X,J,Y,Q)=>`${J}${NQ(Y,Z)}${Q}`)}var k1="<!--PARENT_CONTENT_PLACEHOLDER-->";function y6($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function kQ($,Z){let X=$.length,J=Z,Y=!0,Q=[],G=(z)=>z+9<=X&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(J<X){let z=$[J];if(G(J))return J;if(z==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
|
|
3564
3564
|
`,J+2),J===-1)return-1;J+=1,Y=!0;continue}if(z==="/"&&$[J+1]==="*"){let q=$.indexOf("*/",J+2);if(q===-1)return-1;J=q+2,Y=!0;continue}if(z==="/"&&Y){let q=J+1,K=!1;while(q<X){let U=$[q];if(U==="\\"){q+=2;continue}if(U==="[")K=!0;else if(U==="]")K=!1;else if(U==="/"&&!K){q++;break}else if(U===`
|
|
3565
3565
|
`){q=-1;break}q++}if(q===-1){J++,Y=!1;continue}while(q<X&&/[a-z]/.test($[q]))q++;J=q,Y=!1;continue}if(z==="'"||z==='"'){let q=z;J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]===q){J++;break}if($[J]===`
|
|
3566
|
-
`)break;J++}Y=!1;continue}if(z==="`"){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(z==="}"&&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(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;J++}return-1}function
|
|
3566
|
+
`)break;J++}Y=!1;continue}if(z==="`"){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(z==="}"&&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(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;J++}return-1}function n6($,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}}var C6=/<style\b[^>]*>/iy,S6=/<\/style>/gi,P6=/<script\b[^>]*>/iy;function v6($){let Z=0;while(Z<$.length){let X=$.indexOf("<",Z);if(X===-1)return-1;if($.startsWith("<!--",X)){let Y=$.indexOf("-->",X+4);Z=Y===-1?$.length:Y+3;continue}C6.lastIndex=X;let J=C6.exec($);if(J){S6.lastIndex=X+J[0].length;let Y=S6.exec($);Z=Y===null?$.length:Y.index+8;continue}if(P6.lastIndex=X,P6.test($))return X;Z=X+1}return-1}function IQ($){let Z=n6($,"data-stx-runtime");if(!Z)return $;let X=v6($);if(X===-1||X===Z.start)return $;let J=$.slice(Z.start,Z.end),Y=$.slice(0,Z.start)+$.slice(Z.end),Q=v6(Y);if(Q===-1)return J+`
|
|
3567
3567
|
`+Y;return Y.slice(0,Q)+J+`
|
|
3568
|
-
`+Y.slice(Q)}async function
|
|
3569
|
-
`),...K.htmlAttrs&&{htmlAttrs:
|
|
3570
|
-
<meta name="stx-layout" content="${
|
|
3571
|
-
<meta name="stx-layout-group" content="${
|
|
3572
|
-
${H}`).join("");if(W)G=G.slice(0,z.end)+W+G.slice(z.end)}}if(Q)G=
|
|
3568
|
+
`+Y.slice(Q)}async function O$($,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=J1($,X);let Q=!Z.__stxProcessingDepth;if(Q)v$(Z),Z.__stx_head_injections=C5(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!e2()&&!$9())&&X&&X.endsWith(".stx"))i6($,X);try{return await l6.timeAsync("template-processing",async()=>{let G=await TQ($,Z,X,J,Y);if(Q)G=B$(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let z=J.app?.head||{},K=(Z.__stx_runtime_head||null)??p6(),U=(Z.__stx_head_raw||"").trim(),W,H=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)W=H[1].trim(),U=U.replace(H[0],"").trim();let j=Z.__sections?.title,B=K.title||W||j,_=!K.title&&(!!W||!!j),O=K.meta||[],V=new Set(O.map((A)=>d1(A)).filter(Boolean)),L={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((A)=>!V.has(d1(A))),...O],link:[...z.link||[],...K.link||[]],script:[...z.script||[],...K.script||[]],headRaw:[z.headRaw,U].filter(Boolean).join(`
|
|
3569
|
+
`),...K.htmlAttrs&&{htmlAttrs:D7(z.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...K.bodyAttrs}}},F=h5(G);if(G=M7(G,L,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)G=A7(G,z),G=N7(G,L.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let A=w[1],k=m6(A);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
|
|
3570
|
+
<meta name="stx-layout" content="${y6(A)}">
|
|
3571
|
+
<meta name="stx-layout-group" content="${y6(k)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?Y1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=b1(G,(k,N)=>`<body${N} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Q){let z=Z.__stx_head_injections??C5(),q=x5(G);if(q!==null)z.beforeClose.push(q);let K=f5(G);if(K!==null)z.afterOpen.push(K);G=B7(G,z);let U=J.app?.colorMode;if(U)G=L7(G,U);G=IQ(G)}if(Q){let z=n6(G,"data-stx-runtime");if(z){let q=null,K=null,U=null;try{let{getStoreScript:H}=await o("stx/store-loader",()=>import("./chunk-829pcte9.js")),j=J.storesDir,B=await H(j);if(B)q=`<script data-stx-stores>${B}</script>`}catch{}try{let{getFrameworkComposableScript:H}=await o("stx/framework-composables",()=>import("./chunk-qsr3bqav.js"));U=await H(G)}catch{}try{let{getComposableScript:H}=await o("stx/composable-loader",()=>import("./chunk-wxk2pbrh.js")),j=J.composablesDir,B=[q,U].filter((O)=>O!==null),_=await H(j,G,B);if(_)K=`<script data-stx-composables>${_}</script>`}catch{}let W=[q,K,U].filter((H)=>H!==null).map((H)=>`
|
|
3572
|
+
${H}`).join("");if(W)G=G.slice(0,z.end)+W+G.slice(z.end)}}if(Q)G=O7(G);if(Q&&Z.__stx_inject_css!==!1)G=await c6(G,void 0,J.buildMode==="serve");if(Q)G=H7(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof x6)throw G;let z=G instanceof Error?G.message:String(G),q=new R2(`Template processing failed: ${z}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(s0.log(q,{filePath:X,context:Z}),h6.logDetailedError(q,{filePath:X,template:$.substring(0,500)}),J.debug)throw q;return g6.createFallbackContent("Template Processing",q)}}async function TQ($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!A0.isAbsolute(J.partialsDir)?A0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!A0.isAbsolute(J.componentsDir)?A0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!A0.isAbsolute(J.layoutsDir)?A0.resolve(Q,J.layoutsDir):J.layoutsDir},z=G,q=$;await yQ(X,Z),bQ(Z,z),q=await D2(()=>i4(q,Z,X,z),q,(F)=>{s0.log(F,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=i0(q,X2,(F,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=K.output;let U=K.tokens,W=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>U[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,H),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,w)=>{return`{{ ${w} }}`}),q=$7(q),q=await M6(q,X,Y);let j={};q=A5(q,j);let B={...Z.__sections||{}},_="",O=H3(W3($)),V=/@nolayout\b/.test(q)||O===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(q))q=`@section('content')
|
|
3573
3573
|
${q.trim()}
|
|
3574
3574
|
@endsection`}if(!_&&!V&&z.defaultLayout){let F=g5(q),w=/@section\s*\(/.test(q);if(!F||w){let R="",D=A0.dirname(X),A=z.layoutsDir?A0.dirname(z.layoutsDir):process.cwd();for(let k=0;k<20;k++){let N=A0.join(D,"_layout.stx");if(await a(N)){R=N;break}let M=A0.dirname(D);if(M===D||M.length<A.length)break;D=M}if(R)_=R;else if(z.layoutsDir){let k=A0.isAbsolute(z.layoutsDir)?z.layoutsDir:A0.resolve(process.cwd(),z.layoutsDir),N=A0.join(k,`${z.defaultLayout}.stx`);if(await a(N))_=N}if(_&&!w)q=`@section('content')
|
|
3575
3575
|
${q.trim()}
|
|
3576
3576
|
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,w,R)=>{return B[w]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return F;try{let D=e(R.trim(),Z);if(D===void 0)return F;return B[w]=String(D??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",k1);else B[w]=R.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=M5(q,j),_){let F=[],w=n0(q),R=i0(w.output,T1,(D,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,A,k)=>{let N=A==="SCRIPT"?w.scripts[Number(k)]:R.tokens[Number(k)];if(N)F.push(N);return""}),F.length>0){let D=F.join(`
|
|
3577
3577
|
`);B.content=B.content?`${B.content}
|
|
3578
|
-
${D}`:D,Z.__sections=B}}if(_)try{let F;if(A0.isAbsolute(_))F=_,Y.add(_);else F=await D2(()=>c2(_,X,G,Y),null,()=>{throw new R2(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!F){let N=(I)=>{if(!I)return[];try{let y=A0.isAbsolute(I)?I:A0.resolve(process.cwd(),I);return
|
|
3579
|
-
${q}`,W(q)}catch(F){return s0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return W(await
|
|
3580
|
-
`;if(Q=N(Q,Z),Q=M(Q,Z),Q=
|
|
3578
|
+
${D}`:D,Z.__sections=B}}if(_)try{let F;if(A0.isAbsolute(_))F=_,Y.add(_);else F=await D2(()=>c2(_,X,G,Y),null,()=>{throw new R2(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!F){let N=(I)=>{if(!I)return[];try{let y=A0.isAbsolute(I)?I:A0.resolve(process.cwd(),I);return MQ.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((I,y,E)=>E.indexOf(I)===y).sort(),T=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(s0.log(Error(T),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${T}`),G.debug)throw new R2(T,X);return q}let w=await D2(()=>Bun.file(F).text(),"",()=>{throw new R2(`Failed to read layout file: ${F}`,X,void 0,void 0,"Layout content could not be loaded")});w=b6(w,F);let R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${F}`);let N={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return N[E]=b.trim(),""});for(let[y,E]of Object.entries(N))if(B[y]&&B[y].includes(k1)){let b=B[y].indexOf(k1);B[y]=B[y].slice(0,b)+E+B[y].slice(b+k1.length)}else if(!B[y])B[y]=E;let T={...Z,__sections:B},I=`@layout('${R[1]}')${M}`;return await O$(I,T,F,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=A5(D,j),k={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,M,T)=>{return k[M]=T.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,M,T)=>{if(B[M]){let I=B[M];if(I.includes(k1)){let y=k[M]||"",E=I.indexOf(k1);I=I.slice(0,E)+y+I.slice(E+k1.length)}return I}return T||""}),A=EQ(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=M5(A,j),Z.__originalFilePath=X,q=await f6(A,Z,F,G,Y),q=`<!-- stx-layout: ${_} -->
|
|
3579
|
+
${q}`,W(q)}catch(F){return s0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return W(await f6(q,Z,X,G,Y))}function EQ($,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 bQ($,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 yQ($,Z){await D2(()=>s4($,Z),void 0,(X)=>{s0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function CQ($,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:q}=await o("stx/variable-extractor",()=>import("./chunk-e4akvata.js"));await q(G,Z,X,{preserveExisting:!0})}catch(q){let K=q instanceof Error?q:Error(String(q));s0.log(K,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${K.message}`)}}}async function SQ($,Z,X){try{let{interpolateScriptsInTemplate:J}=await o("stx/expressions",()=>import("./chunk-n3jyv9z6.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return s0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function f6($,Z,X,J,Y){let Q=$,G=J;if(await CQ(Q,Z,X),Q=await SQ(Q,Z,X),Q=await C4(Q,Z,X),Q=await S4(Q,Z,X),Q=await F4(Q,Z,X,G),J1(Q))Q=m7(Q,Z),Q=n5(Q,Z);Q=c7(Q);let{processStreamDirectives:z}=await o("stx/streaming",()=>import("./chunk-mkn6qqc7.js"));Q=z(Q,Z),Q=d4(Q,Z,X,G),Q=await Y7(Q,Z,X,G,Y),Q=await W$(Q,Z,X,G,Y),Q=U3(Q,Z,X,G);let{processDeferDirectives:q}=await o("stx/defer",()=>import("./chunk-j03bare5.js"));Q=q(Q,Z,X);let{processTeleportDirectives:K}=await o("stx/teleport",()=>import("./chunk-fjkstnz3.js"));Q=K(Q,Z,X);let{processTransitionDirectives:U,processTransitionAttributes:W}=await o("stx/transitions",()=>import("./chunk-7p9ns60j.js"));Q=U(Q,Z,X),Q=W(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-s67mgegv.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:j}=await o("stx/suspense",()=>import("./chunk-areethga.js"));Q=j(Q,Z,X);let{processAsyncDirectives:B}=await o("stx/async-components",()=>import("./chunk-d0c3v7ax.js"));Q=B(Q,Z,X);let{processKeepAliveDirectives:_}=await o("stx/keep-alive",()=>import("./chunk-vbdca0k1.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:O,processVirtualGridDirectives:V,processInfiniteListDirectives:L}=await o("stx/virtual-scrolling",()=>import("./chunk-cvnh7dma.js"));Q=O(Q,Z,X),Q=V(Q,Z,X),Q=L(Q,Z,X);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-90qr4f9m.js"));Q=F(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await o("stx/computed",()=>import("./chunk-3bv8h4r6.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:A}=await o("stx/forms-validation",()=>import("./chunk-yq1d9hb3.js"));Q=A(Q,Z,X);let{processHeadDirective:k,processTitleDirective:N,processMetaDirective:M,resetHead:T}=await o("stx/head",()=>import("./chunk-phhzfeh9.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)T();let I=k(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
|
|
3580
|
+
`;if(Q=N(Q,Z),Q=M(Q,Z),Q=o4(Q),Q=U5(Q,Z),Q=O4(Q),Q=c4(Q),Q=await N5(Q,Z,X,G,Y),Q=await W$(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=f$(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=B$(Q),Q=$1(Q,Z,X),Q=B3(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=W5(Q,Z),Q=H5(Q,Z),Q=j2(Q,Z),Q=F5(Q,Z),Q=w5(Q,Z),Q=await Q4(Q,Z,X,G),Q=await R3(Q,Z,X),Q=await u6(Q,Z,X,G),Q=d6(Q,Z,X,G),Q=c3(Q,Z,X,G),Q=p3(Q,Z,X),Q=i3(Q,Z,X,G),Q=V4(Q,Z,X,G),Q=H$(Q,Z),Q=j$(Q),Q=k6(Q),!G.skipEventDirectives)Q=P$(Q,Z,X);if(Q=L3(Q,Z,X),G.debug){let c=/\bx-data\s*=/.test(Q),p=i5($);if(c&&p)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
3581
3581
|
Both work on the same page, but they manage separate scopes.
|
|
3582
|
-
Prefer signals (state/derived/effect) for new components.`)}Q=
|
|
3582
|
+
Prefer signals (state/derived/effect) for new components.`)}Q=t4(Q,Z),Q=await B1(Q,Z,X),Q=T6(Q),Q=E6(Q),Q=X3(Q);let{processXElementDirectives:y}=await o("stx/x-element",()=>import("./chunk-a54n1r1q.js"));Q=y(Q);let E=Z.__originalFilePath||X,b=R9(Z);if(Q=await p7(Q,G,E,b),Q=N4(Q,Z),Q=await n4(Q,Z,X,G),G.media?.image?.autoSiblings){let c=G.publicDir||"public",{rewriteImagesWithSiblings:p}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-b29wbjs5.js"));Q=await p(Q,{publicDir:c})}if(G.seo?.enabled)Q=n3(Q,Z,G);let C=(c,p,q0=!0)=>{if(!p)return c;let G0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),D0=c.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(G0&&D0){if(q0)c=c.replace(D0[0],G0[0]);if(p=p.replace(G0[0],"").trim(),!p)return c}if(/<\/head>/i.test(c))return c.replace(/<\/head>/i,`${p}
|
|
3583
3583
|
</head>`);if(/<head\b[^>]*>/i.test(c))return c.replace(/(<head\b[^>]*>)/i,`$1
|
|
3584
3584
|
${p}`);if(/<html\b[^>]*>/i.test(c))return c.replace(/(<html\b[^>]*>)/i,`$1
|
|
3585
3585
|
<head>
|
|
3586
3586
|
${p}
|
|
3587
|
-
</head>`);return c},{renderHead:v,getHead:P}=await o("stx/head",()=>import("./chunk-phhzfeh9.js")),x=Z.__stx_runtime_head??P();if(x.title||x.meta?.length||x.link?.length){let c=v(x);if(c)Q=C(Q,c)}if(I.headContent)Q=C(Q,I.headContent,!x.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=
|
|
3588
|
-
${
|
|
3587
|
+
</head>`);return c},{renderHead:v,getHead:P}=await o("stx/head",()=>import("./chunk-phhzfeh9.js")),x=Z.__stx_runtime_head??P();if(x.title||x.meta?.length||x.link?.length){let c=v(x);if(c)Q=C(Q,c)}if(I.headContent)Q=C(Q,I.headContent,!x.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=B4(Q,G.csp,Z);if(G.analytics?.enabled)Q=Y3(Q,G);if(G.heatmap?.enabled)Q=G3(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:c}=await o("stx/pwa/inject",()=>import("./chunk-qp97dx7x.js"));Q=c(Q,G)}let $0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),a0=/\bSTX\.\w+/.test(Q),M0=/window\.STX\s*=/.test(Q);if($0&&a0&&!M0){let p=`<script data-stx-scoped data-stx-run="once">
|
|
3588
|
+
${e$()}
|
|
3589
3589
|
</script>`;if(Q.includes("</head>")){let q0=Q.indexOf("</head>"),D0=Q.slice(0,q0).indexOf("<script");if(D0!==-1){let S0=Q.slice(0,D0),Z2=Q.slice(D0);Q=S0+p+`
|
|
3590
3590
|
`+Z2}else Q=Q.replace("</head>",`${p}
|
|
3591
3591
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
3592
3592
|
${p}`);else Q=p+`
|
|
3593
|
-
`+Q}{let{scanScriptTags:c}=await o("stx/signal-processing",()=>import("./chunk-
|
|
3594
|
-
`+Q.slice(q0)}Z.__stx_event_bindings=[]}}if(!
|
|
3595
|
-
`);return{line:X.length,column:X[X.length-1].length+1}}function
|
|
3596
|
-
`);for(let Y of J){let Q=X,G=null,z=!1;for(let q=0;q<Y.length;q++){let K=Y[q];if(z){z=!1;continue}if(K==="\\"){z=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&q+1<Y.length&&Y[q+1]==="/")break;if(K==="{")X++;else if(K==="}")X--}if(Q===0){let q=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let K=Y.match(/(?:const|let|var)\s+(\w+)/);if(K)Z.push(K[1])}else{let K=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let W=K[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...W)}}}}return[...new Set(Z)]}function
|
|
3593
|
+
`+Q}{let{scanScriptTags:c}=await o("stx/signal-processing",()=>import("./chunk-8emkx9ja.js")),p=[];for(let q0 of c(Q)){if(!/\bserver\b/i.test(q0.attrs))continue;let G0=q0.start+q0.fullMatch.indexOf(">")+1,D0=kQ(Q,G0);if(D0===-1)continue;let S0=D0+9;while(S0<Q.length&&/\s/.test(Q[S0]))S0++;p.push({start:q0.start,end:S0})}for(let q0=p.length-1;q0>=0;q0--){let{start:G0,end:D0}=p[q0];Q=Q.substring(0,G0)+Q.substring(D0)}}let C0=z9(Q,X);if(C0.hasScoped)Q=C0.html;let Z0=Z.__stx_event_bindings||[],H0=!1,k0=[],E0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:d0}=await o("stx/signal-processing",()=>import("./chunk-8emkx9ja.js"));for(let c of d0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))k0.push({match:c.fullMatch,attrs:c.attrs,content:c.body});for(let{match:c,attrs:p,content:q0}of k0){H0=!0;let G0=q0;V$(q0,X,J.strict,Z.__originalFilePath);let D0=await D9(q0,{eventBindings:Z0,attrs:p,hasColonDirectives:E0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(c,()=>D0)}if(H0)Z.__stx_event_bindings=[];if(!H0&&Z.__stxProcessingDepth===1){let c=Z.__stx_event_bindings||[];if(c.length>0){let p=b9(c);if(p){let q0=Q.lastIndexOf("</body>");Q=q0===-1?Q+p:Q.slice(0,q0)+p+`
|
|
3594
|
+
`+Q.slice(q0)}Z.__stx_event_bindings=[]}}if(!y7(Q)&&C7(Q))Q=await W9(Q,G);if(Q=S7(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=_4(Q,Z.cspNonce);return Q}var PQ=[{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"}],vQ=[{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')"}],fQ=[{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 xQ($){let Z=[],X=[];return gQ($,Z),hQ($,Z,X),uQ($,X),dQ($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function gQ($,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 hQ($,Z,X){for(let J of PQ){let Y=new RegExp(`${J.open}(?:\\s|\\()`,"g"),Q=new RegExp(J.close,"g"),G=($.match(Y)||[]).length,z=($.match(Q)||[]).length;if(J.altClose){let q=new RegExp(J.altClose,"g");z+=($.match(q)||[]).length}if(G>z)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${z} closing`,suggestion:`Add ${G-z} missing ${J.close} tag(s)`});else if(z>G)X.push({type:"directive",message:`Extra ${J.close} found: ${z-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function uQ($,Z){for(let X of vQ)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function dQ($,Z){for(let X of fQ)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function mQ($,Z){let X=$.slice(0,Z).split(`
|
|
3595
|
+
`);return{line:X.length,column:X[X.length-1].length+1}}function lQ($,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 cQ($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function pQ($){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 r0 from"path";import $2 from"process";var X8=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","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"],o6=new Set(X8),iQ=new Set(["props","$props","defineProps"]),nQ=new Set(["stx","@stacksjs/stx"]),s6=e1(128);function oQ($){let Z=[],X=0,J=$.split(`
|
|
3596
|
+
`);for(let Y of J){let Q=X,G=null,z=!1;for(let q=0;q<Y.length;q++){let K=Y[q];if(z){z=!1;continue}if(K==="\\"){z=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&q+1<Y.length&&Y[q+1]==="/")break;if(K==="{")X++;else if(K==="}")X--}if(Q===0){let q=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let K=Y.match(/(?:const|let|var)\s+(\w+)/);if(K)Z.push(K[1])}else{let K=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let W=K[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...W)}}}}return[...new Set(Z)]}function sQ($){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,z=0,q=null;for(let K=0;K<J.length;K++){let U=J[K];if(q){if(Q+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,Q+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")z++;else if(U===")")z--;if(U===","&&G===0&&z===0){Y.push(Q),Q="";continue}Q+=U}if(Q)Y.push(Q);return Y.map((K)=>{let U=K.trim(),W=U.startsWith("..."),H=W?U.slice(3):U,j=-1,B=0;for(let R=0;R<H.length;R++)if(H[R]==="<")B++;else if(H[R]===">")B--;else if(H[R]===":"&&B===0){j=R;break}if(j===-1)return K;let O=H.substring(0,j).trim().replace(/\?$/,""),V=H.substring(j+1),L=-1,F=0;for(let R=0;R<V.length;R++)if(V[R]==="<")F++;else if(V[R]===">")F--;else if(V[R]==="="&&F===0){L=R;break}let w=W?"...":"";if(L!==-1)return`${w}${O} = ${V.substring(L+1).trim()}`;return`${w}${O}`}).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,z=1,q=G+1,K=0,U=null;while(q<Z.length&&z>0){let j=Z[q];if(U){if(j===U)U=null;q++;continue}if(j==='"'||j==="'"||j==="`"){U=j,q++;continue}if(j==="<")K++;else if(j===">"&&K>0)K--;else if(K===0){if(j==="(")z++;else if(j===")")z--}if(z>0)q++}if(z!==0)continue;let W=Z.substring(G+1,q);if(!W.includes(":"))continue;let H=X(W);Q.push({start:G+1,end:q,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Q[G];Z=Z.substring(0,z)+K+Z.substring(q)}}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[z,...q]=G.split("="),K=z.split(":")[0].trim();if(q.length>0)return`${K} = ${q.join("=").trim()}`;return K}).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,`
|
|
3597
3597
|
|
|
3598
|
-
`),Z}function
|
|
3599
|
-
`),L0=Z.params??{},O0=[],P0=[];for(let n=0;n<r.length;n++){if(r[n]==="params")continue;O0.push(r[n]),P0.push(Y0[n])}let b0=await Function(
|
|
3598
|
+
`),Z}function rQ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function aQ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function tQ($,Z,X,J={}){if(!$.trim())return;let Y=a1(),Q=M1($,JSON.stringify(Y)),G=s6.get(Q);if(G===void 0){try{let S=w$({loader:"ts",target:"browser",define:Y}),f=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");f=f.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),G=S.transformSync(f)}catch{G=sQ($)}s6.set(Q,G)}let z={exports:{}},q=z.exports,K=$2.cwd(),U={},W=[...G.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)),H=new Map;for(let S of W)try{if(S.startsWith(".")){U[S]=await import(r0.resolve(r0.dirname(X),S));continue}let f=r0.resolve(K,"node_modules",S),s=r0.join(f,"package.json"),r=JSON.parse(u("fs").readFileSync(s,"utf8")),Y0=r.main||"index.js";if(r.exports){let Q0=typeof r.exports==="string"?r.exports:r.exports["."];if(typeof Q0==="string")Y0=Q0;else if(Q0?.bun)Y0=Q0.bun;else if(Q0?.import)Y0=Q0.import;else if(Q0?.default)Y0=Q0.default}U[S]=await import(r0.resolve(f,Y0))}catch(f){if(S.startsWith("."))H.set(S,f instanceof Error?f.message:String(f))}let j=(S)=>{if(U[S])return U[S];let f=H.get(S);if(f!==void 0)throw Error(`Cannot require '${S}' from ${X}: ${f}`);return u(S)},B=Z.props||{},_=(S)=>{if(!S)return B;let f={};for(let[s,r]of Object.entries(S)){let Y0=B[s];if(Y0!==void 0)f[s]=Y0;else if(typeof r==="function")f[s]=r();else f[s]=r}return f};for(let[S,f]of Object.entries(B))Object.defineProperty(_,S,{value:f,enumerable:!0,configurable:!0,writable:!0});for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(B,S))continue;try{Object.defineProperty(_,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let O=(S)=>{if(!S)return B;let f={...B};for(let[s,r]of Object.entries(S)){let Y0=r&&typeof r==="object"&&!Array.isArray(r)?r:{type:r};if(f[s]===void 0&&Y0.default!==void 0)f[s]=typeof Y0.default==="function"?Y0.default():Y0.default}return f},V=()=>Z.slots||{},L=(S,f)=>{let s={...S};for(let[r,Y0]of Object.entries(f))if(s[r]===void 0)if(typeof Y0==="function")s[r]=Y0();else s[r]=Y0;return s},F=(S)=>{let f=()=>S;return f.set=(s)=>{},f.update=(s)=>{},f},w=(S)=>{let f,s=!1;return()=>{if(!s)try{f=S(),s=!0}catch{f=void 0}return f}},R=(S)=>{},D=(S)=>S(),A=(S)=>{},k=(S)=>{},N=j3(Z);function M(S){let f=S||{};if(f.title!==void 0||f.description!==void 0)b({title:f.title,description:f.description})}function T(S){if(!S||typeof S!=="object")return;let f=Z.__stxClientPayload??{};Object.assign(f,S),Z.__stxClientPayload=f}let I=()=>{let S=Z.__stxServeContext,f=Z.__stxServeSearch??S?.search??"",s=S?.path??"",r=Object.fromEntries(new URLSearchParams(f)),Y0=Z.query,Q0=Object.keys(r).length>0?r:Y0??{},d=f||(Object.keys(Q0).length>0?`?${new URLSearchParams(Q0).toString()}`:"");return{params:Z.params??{},query:Q0,path:s,name:"",fullPath:s+d,hash:"",matched:[]}},y=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),E=(S)=>{let f=Z.__stx_runtime_head||{};Z.__stx_runtime_head=l2(f,S||{})},b=(S)=>{E(Z8(S||{}))},C=(S)=>({value:S}),v=(S)=>S,P=(S)=>({value:typeof S==="function"?S():S}),g=(S,f)=>{},x=(S)=>{},$0=(S)=>{},a0=(S)=>S?S():Promise.resolve(),M0=(S)=>(f,...s)=>{},C0=(S)=>{},Z0=(S,f)=>{},H0=(S,f)=>f,k0=()=>({value:"light"}),E0=()=>F(!1),d0=(S)=>F(!1),c=()=>F(!1),p=()=>d0("(prefers-color-scheme: dark)"),q0=()=>d0("(prefers-color-scheme: light)"),G0=()=>d0("(prefers-reduced-motion: reduce)"),D0=()=>d0("(prefers-contrast: more)"),S0={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:{}},Z2=new Proxy(S0,{get(S,f){if(f in S)return S[f];return},set(S,f,s){return S[f]=s,!0}}),M2={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},k2=console;try{let S=J8(G,X),f=new Set(Object.keys(B)),s=(n)=>/^[a-z_$][\w$]*$/i.test(n),r=Object.keys(Z).filter((n)=>!f.has(n)&&!iQ.has(n)&&s(n)),Y0=r.map((n)=>Z[n]);if(!r.includes("__stxServeContext"))r.push("__stxServeContext"),Y0.push(void 0);let Q0=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"]),d=[],m=[];for(let[n,m0]of Object.entries(B)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n))continue;if(Q0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(S))continue;d.push(n),m.push(m0)}let i=oQ(S).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
|
|
3599
|
+
`),L0=Z.params??{},O0=[],P0=[];for(let n=0;n<r.length;n++){if(r[n]==="params")continue;O0.push(r[n]),P0.push(Y0[n])}let b0=await Function(...X8,...d,...O0,`return (async () => {
|
|
3600
3600
|
${S}
|
|
3601
3601
|
${i}
|
|
3602
3602
|
return module.exports
|
|
3603
|
-
})()`)(z,q,j,B,_,O,L,T,F,w,R,D,A,k,M,I,y,E,b,N.setResponseStatus,N.setResponseHeader,N.notFound,C,v,P,g,x,$0,a0,M0,C0,V,Z0,H0,k0,E0,d0,c,p,q0,G0,D0,Z2,M2,k2,S0.confirm,S0.alert,S0.fetch,L0,...m,...P0);if(J.preserveExisting){for(let[n,m0]of Object.entries(b0))if(!(n in Z)||Z[n]===void 0)Z[n]=m0}else Object.assign(Z,b0);for(let[n,m0]of Object.entries(B))if(!(n in Z))Z[n]=m0}catch(S){let f=S instanceof Error?S.message:String(S);if(
|
|
3603
|
+
})()`)(z,q,j,B,_,O,L,T,F,w,R,D,A,k,M,I,y,E,b,N.setResponseStatus,N.setResponseHeader,N.notFound,C,v,P,g,x,$0,a0,M0,C0,V,Z0,H0,k0,E0,d0,c,p,q0,G0,D0,Z2,M2,k2,S0.confirm,S0.alert,S0.fetch,L0,...m,...P0);if(J.preserveExisting){for(let[n,m0]of Object.entries(b0))if(!(n in Z)||Z[n]===void 0)Z[n]=m0}else Object.assign(Z,b0);for(let[n,m0]of Object.entries(B))if(!(n in Z))Z[n]=m0}catch(S){let f=S instanceof Error?S.message:String(S);if(rQ(f))console.warn(`[stx] server <script> in ${X??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${f}`);else if(aQ(f))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: ${f}`);else if($2.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${X??"<unknown>"} \u2014 falling back to static extraction. Cause: ${f}`);try{await GG(G,Z,X)}catch(s){if($2.env.STX_DEBUG){let r=s instanceof Error?s.message:String(s);console.warn(`[stx] fallback extraction also failed in ${X??"<unknown>"}: ${r}`)}}}}function eQ($){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 $G=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function J8($,Z){let X=Z?r0.dirname(Z):$2.cwd(),J=$2.cwd(),Y=$.split(`
|
|
3604
3604
|
`),Q=[],G=0;while(G<Y.length){let z=Y[G].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let q=0;for(;G<Y.length;G++){for(let K of Y[G])if(K==="{")q++;else if(K==="}")q--;if(q<=0)break}}G++;continue}if(z.startsWith("definePageMeta(")){let q=0,K=!1,U=G;for(let j=G;j<Y.length&&!K;j++){let B=null,_=!1,O=Y[j];for(let V=0;V<O.length;V++){let L=O[V];if(_){_=!1;continue}if(L==="\\"){_=!0;continue}if(B){if(L===B)B=null;continue}if(L==='"'||L==="'"||L==="`"){B=L;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0){G=j+1,K=!0;break}}}}if(!K)G=Y.length;let W=Y.slice(U,G).join(`
|
|
3605
|
-
`),H=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(W);if(B)H.push(`${j}: ${JSON.stringify(B[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let q=z,K=0;while(!
|
|
3606
|
-
`+j;if(W<=0&&H>=G)break}Q.push(U),Q.push(`module.exports.${K} = ${K};`),G=H+1}else Q.push(z),G++}else if(z.includes("module.exports"))Q.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Q.push(z),G++;else G++}return
|
|
3607
|
-
`),X,J)}function
|
|
3608
|
-
`)z=!1;Q++;continue}if(q){if(Y+=U,U==="*"&&W==="/"){Y+=W,Q+=2,q=!1;continue}Q++;continue}if(!G&&U==="/"&&W==="/"){z=!0,Y+=U,Q++;continue}if(!G&&U==="/"&&W==="*"){q=!0,Y+=U,Q++;continue}if(G){if(Y+=U,U==="\\"){Y+=W,Q+=2;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(U==="$"&&W==="{"){K++,Y+=W,Q+=2;continue}if(U==="`"){G=null,Q++;continue}}Q++;continue}if(K>0){if(U==="{")K++;else if(U==="}")K--}if(U==='"'||U==="'"||U==="`"){G=U,Y+=U,Q++;continue}if(U==="a"&&$.startsWith("await",Q)){let H=
|
|
3605
|
+
`),H=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(W);if(B)H.push(`${j}: ${JSON.stringify(B[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let q=z,K=0;while(!eQ(q)&&G+K+1<Y.length)K++,q=`${q} ${Y[G+K].trim()}`;G+=K;let U=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),W=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=q.match(/^import\s+['"](.+?)['"]/),j=q,B=(_)=>{if(_.startsWith("."))return r0.resolve(X,_);if(_.startsWith("~/")||_.startsWith("@/"))return r0.resolve(J,_.slice(2));return _};if(U){let[,_,O]=U,V=B(O);Q.push(`const ${_} = (await import('${V}')).default`),Q.push(`module.exports.${_} = ${_};`)}else if(W){let[,_,O]=W,V=B(O),L=[],F=[],w=nQ.has(O);for(let R of _.split(",")){let D=R.trim();if(!D)continue;let A=D.split(/\s+as\s+/);if(A.length===2){let[k,N]=[A[0].trim(),A[1].trim()];if(w&&o6.has(k)){Q.push(`const ${N} = ${k};`);continue}L.push(`${k}: ${N}`),F.push(N)}else{if(w&&o6.has(D))continue;L.push(D),F.push(D)}}if(L.length>0)Q.push(`const { ${L.join(", ")} } = await import('${V}')`);for(let R of F)Q.push(`module.exports.${R} = ${R};`)}else if(H){let _=B(H[1]);Q.push(`await import('${_}')`)}else Q.push(j);G++;continue}if($G.test(z))Q.push(Y[G]),G++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let q=a6(Y,G),{type:K,name:U,value:W}=q;Q.push(`${K} ${U} = ${W};`),Q.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let q=F$(Y,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let q=a6(Y,G),{type:K,name:U,value:W}=q;Q.push(`${K} ${U} = ${W};`),Q.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let q=F$(Y,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let q=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),K=[...Y];K[G]=q;let U=F$(K,G);if(Q.push(U.functionCode),U.name)Q.push(`module.exports.default = ${U.name};`);G=U.nextIndex}else if(z.startsWith("export default ")){let q=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${q};`),G++}else if(z.startsWith("class ")||z.startsWith("export class ")){let q=z.match(/(?:export\s+)?class\s+(\w+)/);if(q){let K=q[1],U=Y[G].replace(/^export\s+/,""),W=0,H=G;for(;H<Y.length;H++){let j=Y[H];for(let B of j)if(B==="{")W++;else if(B==="}")W--;if(H>G)U+=`
|
|
3606
|
+
`+j;if(W<=0&&H>=G)break}Q.push(U),Q.push(`module.exports.${K} = ${K};`),G=H+1}else Q.push(z),G++}else if(z.includes("module.exports"))Q.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Q.push(z),G++;else G++}return ZG(Q.join(`
|
|
3607
|
+
`),X,J)}function ZG($,Z,X){let J=$.length,Y="",Q=0,G=null,z=!1,q=!1,K=0;while(Q<J){let U=$[Q],W=$[Q+1];if(z){if(Y+=U,U===`
|
|
3608
|
+
`)z=!1;Q++;continue}if(q){if(Y+=U,U==="*"&&W==="/"){Y+=W,Q+=2,q=!1;continue}Q++;continue}if(!G&&U==="/"&&W==="/"){z=!0,Y+=U,Q++;continue}if(!G&&U==="/"&&W==="*"){q=!0,Y+=U,Q++;continue}if(G){if(Y+=U,U==="\\"){Y+=W,Q+=2;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(U==="$"&&W==="{"){K++,Y+=W,Q+=2;continue}if(U==="`"){G=null,Q++;continue}}Q++;continue}if(K>0){if(U==="{")K++;else if(U==="}")K--}if(U==='"'||U==="'"||U==="`"){G=U,Y+=U,Q++;continue}if(U==="a"&&$.startsWith("await",Q)){let H=XG($,Q);if(H){let{quote:j,path:B,end:_}=H;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let O=B.startsWith(".")?r0.resolve(Z,B):r0.resolve(X,B.slice(2));Y+=`await import(${j}${O}${j})`,Q=_;continue}}}Y+=U,Q++}return Y}function XG($,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 Y8($,Z){let X=$[Z];if(X!=="{"&&X!=="[")return null;let Y=B0($,X,X==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function Q8($){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 z=Y===0?Y8(X,J):null;if(z){Z.push(...Q8(z.pattern)),J=z.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 JG($){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 z=$[X+1],q=$[X-1];if(z!=="="&&z!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")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 r6($,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 a6($,Z){let X=$[Z].trim(),J=JG(X),Y=J?[X,J.type,J.name,J.value]:null;if(!Y){let U=X.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let W=X.slice(U[0].length),H=Z;if(W.startsWith("{")||W.startsWith("[")){let B=W[0],_=B==="{"?"}":"]",O=r6(W,B,_,0),V=W;for(let L=Z+1;L<$.length&&O>0;L++)V+=` ${$[L].trim()}`,H=L,O=r6($[L],B,_,O);if(O>0)V=W,H=Z;W=V}let j=Y8(W,0);if(j){let B=U[1],_=j.pattern,O=W.slice(j.endPos).trim();if(O.startsWith("=")){let V=O.slice(1).trim(),L=V,F=Math.max(H,Z);if(t6(V)){let A=e6($,F,V);L=A.value,F=A.nextIndex}else F=F+1;L=L.trim().replace(/;$/,"");let w=Q8(_),R=`__stx_src_${Z}`,D=w.map((A)=>`module.exports.${A} = ${A};`).join(`
|
|
3609
3609
|
`);return{type:B,name:R,value:`${L}; ${B} ${_} = ${R};
|
|
3610
|
-
${D}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${X}`)}let[,Q,G,z]=Y,q=z,K=Z;if(
|
|
3611
|
-
${$[K]}`,K++;else break}return q=q.trim().replace(/;$/,""),{type:Q,name:G,value:q,nextIndex:K}}function
|
|
3610
|
+
${D}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${X}`)}let[,Q,G,z]=Y,q=z,K=Z;if(t6(z)){let U=e6($,Z,z);q=U.value,K=U.nextIndex}else K=Z+1;while(K<$.length){let U=$[K].trim();if(U.startsWith(".")||U.startsWith("?."))q+=`
|
|
3611
|
+
${$[K]}`,K++;else break}return q=q.trim().replace(/;$/,""),{type:Q,name:G,value:q,nextIndex:K}}function F$($,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(YG(X)){let z=QG($,Z,Q);Q=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function t6($){let Z=$.trim();if(Z.startsWith("{"))return B0(Z,"{","}",0)===-1;if(Z.startsWith("["))return B0(Z,"[","]",0)===-1;return!G8(Z)}function G8($){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 z8($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let X=B0($,"(",")",Z);if(X===-1)return-1;return $.indexOf("{",X)}function YG($){let Z=z8($);if(Z===-1)return!0;return B0($,"{","}",Z)===-1}function e6($,Z,X){let J=X,Y=Z+1;while(Y<$.length&&!G8(J)){let Q=$[Y];J+=`
|
|
3612
3612
|
${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
|
|
3613
|
-
${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function
|
|
3614
|
-
${G}`,Y++}return{functionCode:J,nextIndex:Y}}function
|
|
3615
|
-
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(J!==0)return;let U=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let W=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!X.has(B))Z.push(B),X.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))Z.push(B),X.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Z.push(B),X.add(B)}};while(Y<Q){if(q())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();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])))K();Y++}return Z}function
|
|
3613
|
+
${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function QG($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=z8(J);if(Q!==-1){if(B0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
|
|
3614
|
+
${G}`,Y++}return{functionCode:J,nextIndex:Y}}function $8($,Z){let X=e($,Z)??e(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...$2.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 GG($,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,z]=Q;try{let q=z.trim().replace(/;$/,""),K=$8(q,Z);if(K!==void 0)Z[G]=K}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}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,z]=Q;if(!(G in Z))try{let q=z.trim().replace(/;$/,""),K=$8(q,Z);if(K!==void 0)Z[G]=K}catch{}}}function zG($){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 qG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var N2=new g1(500),A9=new g1(1000),H8=33554432,D$=H8;function UG($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===D$)return;D$=Z,M9.setMaxBytes(Z)}var M9=new g1(2000,{maxBytes:H8,sizeOf:($)=>$.output.length});function WG($){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 q8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function HG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function F1($){return!HG($)}var N9=new Map;function w$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=N9.get(Z);if(X)return X;if(N9.size>=16)N9.clear();let J=new Bun.Transpiler($);return N9.set(Z,J),J}function w1($){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=w$({loader:"ts",target:"browser",define:a1()}).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 jG($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(U)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===U){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let U=1;while(Y<Q&&U>0)if($[Y]==="{")U++,Y++;else if($[Y]==="}")U--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},q=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
|
|
3615
|
+
`)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(J!==0)return;let U=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let W=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!X.has(B))Z.push(B),X.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))Z.push(B),X.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Z.push(B),X.add(B)}};while(Y<Q){if(q())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();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])))K();Y++}return Z}function BG($){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 _G($){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 VG($,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 q=$[J];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let q of BG(z)){let K=q.trim();if(!K||K.startsWith("..."))continue;let U=_G(K);if(U===-1)continue;let W=K.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(W))continue;if(Z[W]!==void 0)continue;let H=K.slice(U+1).trim();if(!H)continue;try{let j=Object.keys(Z),B=Function(...j,`"use strict"; return (${H});`);Z[W]=B(...j.map((_)=>Z[_]))}catch{}}}catch{}}async function F9($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),z=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=X.__importedComponents;if(q){for(let O of[Q,Q.toLowerCase(),G(Q),z(Q)])if(q.has(O))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],U=typeof Y.root==="string"?h.resolve(Y.root):void 0,W=U??h.dirname(J),H=[],j=(O)=>{if(O&&!H.includes(O))H.push(O)},B=X.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(h.join(h.dirname(J),"components")),j(Y.componentsDir),U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let O of _)j(typeof O==="string"?O:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return a(h.resolve(h.dirname(J),`${Q}.stx`));for(let O of H){let V=h.isAbsolute(O)?O:h.resolve(W,O);for(let L of K)if(await a(h.join(V,L)))return!0}return!1}function LG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function OG($){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 FG($){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 D1($,Z,X,J,Y,Q,G,z=new Set,q){let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-e4akvata.js")),U=z??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let W=new Set(U);W.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&LG(H)?H:"";try{let B=(d)=>d.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),_=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,V=null,L=Y.__importedComponents;if(L){let d=[O,O.toLowerCase(),B(O),_(O)];for(let m of d)if(L.has(m)){V=L.get(m);break}}let F=[];if(!V){let d=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],m=[...new Set(d)],K0=Y.__originalFilePath,i=[];if(K0){let F0=h.join(h.dirname(K0),"components");i.push(F0)}if(J)i.push(J);let L0=G._rootComponentsDir;if(typeof L0==="string"&&!i.includes(L0))i.push(L0);let O0=h.join(h.dirname(Q),"components");if(!i.includes(O0))i.push(O0);if(G.componentsDir&&G.componentsDir!==J&&!i.includes(G.componentsDir))i.push(G.componentsDir);let P0=typeof G.root==="string"?h.resolve(G.root):void 0,j1=P0??h.dirname(Q),b0=[];if(P0)b0.push(h.resolve(P0,"resources/views/components")),b0.push(h.resolve(P0,"resources/components")),b0.push(h.resolve(P0,"src/components")),b0.push(h.resolve(P0,"components"));b0.push(h.resolve(import.meta.dir,"components"));for(let F0 of b0)if(!i.includes(F0))i.push(F0);let n=G._pluginComponentDirs;if(Array.isArray(n)){for(let F0 of n)if(typeof F0==="string"&&!i.includes(F0))i.push(F0)}if(G.fallbackComponentsDir&&!i.includes(G.fallbackComponentsDir))i.push(G.fallbackComponentsDir);let m0=[...new Set(i.map((F0)=>{if(!F0)return F0;return h.isAbsolute(F0)?F0:h.resolve(j1,F0)}))];i.length=0,i.push(...m0);let I2=`${O}\x00${Q}\x00${m0.join("\x00")}`,k9=A9.get(I2);if(k9)if(await a(k9))V=k9;else A9.delete(I2);if(!V&&(O.startsWith("./")||O.startsWith("../")))V=h.resolve(h.dirname(Q),`${O}.stx`),F.push(V);else if(!V)for(let F0 of i){if(!F0)continue;for(let T2 of m){let E2=h.join(F0,T2);if(F.push(E2),await a(E2)){V=E2;break}}if(V)break;if(!V)try{let T2=await import("fs");if(!T2.statSync(F0,{throwIfNoEntry:!1})?.isDirectory())continue;let D8=8,I9=[{path:F0,depth:0}];while(I9.length>0&&!V){let b2=I9.pop();if(b2.depth>=D8)continue;let k$;try{k$=T2.readdirSync(b2.path,{withFileTypes:!0})}catch{continue}for(let y2 of k$){if(!y2.isDirectory())continue;if(y2.name==="node_modules"||y2.name.startsWith("."))continue;let I$=h.join(b2.path,y2.name);for(let N8 of m){let T9=h.join(I$,N8);if(F.push(T9),await a(T9)){V=T9;break}}if(V)break;I9.push({path:I$,depth:b2.depth+1})}}}catch{}if(V)break}if(V)A9.set(I2,V)}if(!V||!await a(V)){let d=F.length>0?`
|
|
3616
3616
|
Searched paths:
|
|
3617
3617
|
${F.map((m)=>` - ${m}`).join(`
|
|
3618
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(V);let w;if(N2.has(V))w=N2.get(V);else try{w=await Bun.file(V).text(),N2.set(V,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",C2,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[d,m]of Object.entries(Y))if(!d.startsWith("__")||R.has(d))D[d]=m;let A=X;if(X.includes("@include")){let{processIncludes:d}=await o("stx/includes",()=>import("./chunk-
|
|
3619
|
-
`)}`}if(X&&G0.includes("{{ text || slot }}"))G0=G0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:D0}=await o("stx/slots",()=>import("./chunk-
|
|
3618
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(V);let w;if(N2.has(V))w=N2.get(V);else try{w=await Bun.file(V).text(),N2.set(V,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",C2,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[d,m]of Object.entries(Y))if(!d.startsWith("__")||R.has(d))D[d]=m;let A=X;if(X.includes("@include")){let{processIncludes:d}=await o("stx/includes",()=>import("./chunk-f4k2a7vs.js"));A=await d(X,Y,Q,G,q)}let k=n0(A),N=[],M=k.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(d,m)=>{let K0=k.scripts[Number(m)]||"",i=K0.match(/^<script\b([^>]*)>/i)?.[1]||"",L0=i.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),O0=!L0||["module","text/javascript","application/javascript"].includes(L0);if(!/\bserver\b/i.test(i)&&O0)return N.push(K0),"";return K0}),{extractSlotContent:T}=await o("stx/slots",()=>import("./chunk-m7xnzt2t.js")),I=T(M),y={};if(I.defaultSlot?.trim())y.default=I.defaultSlot;for(let[d,m]of I.namedSlots)y[d]=m.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,C={...D,$uid:b,...Z,props:Z,slot:M,$slots:y,__processedComponents:W,__sections:{},__stx_signals_gate:J1(w)||OG(X)};VG(w,C);let v=w,P=t2(v);if(P)v=P.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...w.matchAll(g)],$0=[],a0=x.some((d)=>/\bserver\b/.test(d[1]||"")&&/\bcache\b/.test(d[1]||"")),M0=null,C0=null,Z0=null,H0=0,k0=null;if(UG(G),a0&&D$>0){let d=WG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,uid:b});if(d!==null){M0=`${V}\x00${M1(w)}\x00${d}`;let m=M9.get(M0);if(m){for(let K0 of m.dependencies)q.add(K0);if(h$(Y,m.clientFactories),E.n+=m.uidsConsumed,m.preservedClientExpressions.length>0){let K0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let i of m.preservedClientExpressions)K0.add(i);Y.__stx_preserved_client_expressions=[...K0]}return m.output}C0=new Set(q),Z0=x$(Y),H0=E.n,k0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let d of x){let m=d[1]||"",K0=d[2]||"",i=m.includes("server");if(F1(m)&&K0.trim())K0=w1(K0);if(i&&K0)try{await K(K0,C,V)}catch(O0){}if(!i){let O0=K0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),P0=O0.includes("{{")&&O0.includes("}}"),j1=O0.includes("{!!")&&O0.includes("!!}");if(P0||j1)O0=S9(O0,C);let b0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");$0.push(`<script${b0}>${O0}</script>`)}}let E0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),d0=E0?E0[1]:"",c=E0?E0[2]:"",p="",q0=d0&&/\bscoped\b/i.test(d0);if(E0)p=`<style${d0}>${c}</style>`;let G0=v;if(G0=G0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E0)G0=G0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(G0=G0.replace(d,(K0,i)=>{let L0=i.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(L0)m.push(`<style${L0[1]}>${L0[2]}</style>`);return""}),G0=G0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)p=`${p}${m.join(`
|
|
3619
|
+
`)}`}if(X&&G0.includes("{{ text || slot }}"))G0=G0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:D0}=await o("stx/slots",()=>import("./chunk-m7xnzt2t.js")),{defaultSlot:S0,namedSlots:Z2}=I;G0=await D0(G0,S0,Z2,C);let M2=$0.some((d)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),k2=FG($0),S=Array.isArray(C.__stx_client_signal_names)?C.__stx_client_signal_names:[];if(k2.length>0||S.length>0)C.__stx_client_signal_names=[...new Set([...S,...k2])];let f={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:M2||$0.length===0,defaultLayout:void 0};C.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let s=await O$(G0,C,V,f,q),r=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let d of s.matchAll(/\{\{([\s\S]*?)\}\}/g))r.add(d[1].trim());if(r.size>0)Y.__stx_preserved_client_expressions=[...r];let Y0=b,Q0=s;if(M2){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${q8(JSON.stringify(Z))}"`}catch{}let m=j?` stx-hydrate="${q8(j)}"`:"";Q0=`<div data-stx-scope="${Y0}"${d}${m}>${s}</div>`;let K0=await Promise.all($0.map(async(i)=>{let L0=i.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!L0)return i;let[,O0,P0]=L0,{vendorStyleTags:j1,factoryBody:b0}=await DG(P0,V,G.buildMode==="compile"),n=j?null:y9(Y,b0),m0=n?`window.__stxComponentFactories[${JSON.stringify(n)}](${JSON.stringify(Y0)});`:`(${b0})(${JSON.stringify(Y0)});`;if(j)return`${j1}<script type="stx/island" data-stx-island="${Y0}" data-stx-scoped${O0}>${m0}</script>`;return`${j1}<script data-stx-scoped data-stx-run="always"${O0}>${m0}</script>`}));if(Q0=Q0+`
|
|
3620
3620
|
`+K0.join(`
|
|
3621
3621
|
`),p)Q0+=`
|
|
3622
3622
|
`+p}else{if(p)Q0+=`
|
|
3623
3623
|
`+p;if($0.length>0){let d=C.__stx_event_bindings||[],m=R9(C),K0=await Promise.all($0.map(async(i)=>{let L0=i.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!L0)return i;return await D9(L0[1],{eventBindings:d,templateContent:Q0,filePath:V,projectRoot:process.cwd(),serverData:m})}));Q0+=`
|
|
3624
3624
|
`+K0.join(`
|
|
3625
|
-
`),C.__stx_event_bindings=[]}}if(q0){let d=z9(Q0,V);if(d.hasScoped)Q0=d.html}if(M0&&C0){let d=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];M9.set(M0,{output:Q0,dependencies:[...q].filter((m)=>!C0.has(m)),clientFactories:Z0?
|
|
3625
|
+
`),C.__stx_event_bindings=[]}}if(q0){let d=z9(Q0,V);if(d.hasScoped)Q0=d.html}if(M0&&C0){let d=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];M9.set(M0,{output:Q0,dependencies:[...q].filter((m)=>!C0.has(m)),clientFactories:Z0?g$(Y,Z0):[],uidsConsumed:E.n-H0,preservedClientExpressions:k0?d.filter((m)=>!k0.has(m)):[]})}return N.length>0?`${Q0}
|
|
3626
3626
|
${N.join(`
|
|
3627
|
-
`)}`:Q0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function a($){return Bun.file($).exists()}function
|
|
3627
|
+
`)}`:Q0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function a($){return Bun.file($).exists()}function N$($,Z){let X=h.resolve(Z),J=h.resolve($),Y=X.endsWith(h.sep)?X:X+h.sep;if(J===X||J.startsWith(Y))return J;return null}async function wG($,Z,X,J){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=h.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await a(G)){if(J)console.log(`Found layout in ${$}: ${G}`);return X?.add(G),G}return null}async function c2($,Z,X,J){let Y=await RG($,Z,X,J);if(Y===null)return null;let Q=N$(Y,process.cwd());if(Q)return Q;let G=[X.root,X.layoutsDir,X.fallbackLayoutsDir,X.componentsDir,X.partialsDir,X.pagesDir].filter((z)=>typeof z==="string"&&z.length>0);for(let z of G){let q=h.isAbsolute(z)?z:h.resolve(process.cwd(),z);if(N$(Y,q))return h.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function RG($,Z,X,J){if(X.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=h.join(Q,$),j=N$(H,Q);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(X.debug)console.log(`Checking absolute path: ${j}`);if(await a(j)&&J)J.add(j);return j}let G=h.join(Y,$);if(await a(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 j=`${G}${H}`;if(await a(j)){if(X.debug)console.log(`Found direct path with extension: ${j}`);if(J)J.add(j);return j}}let z=[];if(X.layoutsDir)z.push(h.isAbsolute(X.layoutsDir)?X.layoutsDir:h.resolve(process.cwd(),X.layoutsDir));let q=h.resolve(Y),K=process.cwd();for(let H=0;H<10;H++){let j=h.join(q,"layouts"),B=!1;try{B=KG.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){z.push(j);break}let _=h.dirname(q);if(_===q||_.length<K.length)break;q=_}for(let H of z){let j=await wG(H,$,J,X.debug);if(j)return j}if(X.fallbackLayoutsDir){let H=h.isAbsolute(X.fallbackLayoutsDir)?X.fallbackLayoutsDir:h.resolve(process.cwd(),X.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[h.join(H,j)];if(!$.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let _ of B)if(await a(_)){if(X.debug)console.log(`Found in options.fallbackLayoutsDir: ${_}`);if(J)J.add(_);return _}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),j=h.join(X.partialsDir||Y,"layouts",H[1]);if(await a(j)){if(X.debug)console.log(`Found in layouts path: ${j}`);if(J)J.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await a(B)){if(X.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(X.partialsDir){let H=h.join(X.partialsDir,"layouts");if(await a(H)){let j=h.join(H,$);if(await a(j)){if(X.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await a(B)){if(X.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}}let U=X.partialsDir||h.join(process.cwd(),"views"),W=h.join(U,$);if(await a(W)){if(X.debug)console.log(`Found in views path: ${W}`);if(J)J.add(W);return W}if(!$.endsWith(".stx")){let H=`${W}.stx`;if(await a(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=h.join(h.dirname(Y),"layouts",$);if(await a(H)){if(X.debug)console.log(`Found in temp layouts dir: ${H}`);if(J)J.add(H);return H}if(!$.endsWith(".stx")){let j=`${H}.stx`;if(await a(j)){if(X.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}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(`
|
|
3628
3628
|
`),z=0;for(let q=0;q<G.length;q++)if(z+=G[q].length+1,z>=Z){J=q+1,Y=G[q].trim();let K=Math.max(0,q-2),U=Math.min(G.length,q+3);Q=G.slice(K,U).map((W,H)=>{let j=K+H+1;return`${j===J?"> ":" "}${j}: ${W}`}).join(`
|
|
3629
|
-
`);break}}else if(X){let G=$.indexOf(X);if(G>=0)return
|
|
3629
|
+
`);break}}else if(X){let G=$.indexOf(X);if(G>=0)return j8($,G)}}catch{}return{lineNumber:J,lineContent:Y,context:Q}}var t={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 j0($,Z,X,J,Y,Q){let{lineNumber:G,context:z}=j8(J,Y,Q),q=X.split("/").pop(),K=0;if(typeof Y==="number"&&Y>=0&&J){let W=J.lastIndexOf(`
|
|
3630
3630
|
`,Math.max(0,Y-1));K=Y-(W+1)+1}let U="";if(G>0)U+=`
|
|
3631
3631
|
${X}:${G}${K>0?`:${K}`:""}: ${$.toLowerCase()} error: ${Z}
|
|
3632
3632
|
`;if(U+=`
|
|
@@ -3639,8 +3639,8 @@ ${t.yellow}${t.bold}Message:${t.reset} ${Z}
|
|
|
3639
3639
|
`,z)U+=`
|
|
3640
3640
|
${t.blue}${t.bold}Context:${t.reset}
|
|
3641
3641
|
${t.dim}${z}${t.reset}
|
|
3642
|
-
`;return U}function
|
|
3643
|
-
${x1("const",[...
|
|
3642
|
+
`;return U}function __(){N2.clear(),A9.clear(),M9.clear()}function V_(){return{size:N2.size,maxSize:500}}var R$=e1(128);async function DG($,Z,X){let J=M1($,Z,X),Y=R$.get(J);if(Y){if(W8(Y.deps))return Y;R$.delete(J)}let Q=A$($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=M$(Q.styles);G=l1(G).code;let{hasUserImports:q,bundleClientScript:K}=await o("stx/client-script-bundler",()=>import("./chunk-7ej1d910.js")),U=[],W=!1;if(q(G)){let V=G;G=await K(V,Z,{projectRoot:process.cwd(),minify:X,collectInputs:U}),W=G===V}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-8emkx9ja.js"));G=H(G);let j=t0(G),B=jG(j),_=`function(__scopeId) {
|
|
3643
|
+
${x1("const",[...K8,...B],j)}
|
|
3644
3644
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
3645
3645
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
3646
3646
|
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
@@ -3668,18 +3668,18 @@ catch (e) {}
|
|
|
3668
3668
|
finally {
|
|
3669
3669
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
3670
3670
|
}
|
|
3671
|
-
}`,O={vendorStyleTags:z,factoryBody:_,deps:
|
|
3671
|
+
}`,O={vendorStyleTags:z,factoryBody:_,deps:U8([...U,...Q.styles.map((V)=>V.resolvedPath)])};if(!W&&Q.unresolved.length===0)R$.set(J,O);return O}var NG=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function AG($){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 MG($,Z){let X=Z;while(!0){let J=I1.join(X,"node_modules",$,"package.json");if(A2.existsSync(J))return I1.dirname(J);let Y=I1.dirname(X);if(Y===X)return null;X=Y}}function kG($,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),z=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(z))continue;if(Z.length<G.length+z.length)continue;if(!J||G.length>J.prefix.length)J={pattern:Y,prefix:G,suffix:z}}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 IG($,Z){let X=AG($);if(!X||!X.subpath)return null;let J=MG(X.pkg,Z);if(!J)return null;let Y;try{Y=JSON.parse(A2.readFileSync(I1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${X.subpath}`,G=kG(Y.exports,Q);if(!G)return null;let z=I1.resolve(J,G);return A2.existsSync(z)?z:null}function A$($,Z){let X=Z.filePath?I1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Y=new Set,Q=[],G=[];return{code:$.replace(NG,(q,K)=>{let U;try{if(K.startsWith("./")||K.startsWith("../")||K.startsWith("/")){if(U=K.startsWith("/")?K:I1.resolve(X,K),!A2.existsSync(U))throw Error(`file not found: ${U}`)}else{let W=null;try{W=Bun.resolveSync(K,J)}catch{W=IG(K,J)}if(!W)throw Error(`could not resolve ${K} (Bun.resolveSync + exports fallback both failed)`);U=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(K)} (from ${Z.filePath||"<unknown>"}): ${W?.message||W}`),G.push(K),""}if(Y.has(U))return"";Y.add(U);try{let W=A2.readFileSync(U,"utf8");Q.push({source:K,resolvedPath:U,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${U}: ${W?.message||W}`),G.push(K)}return""}),styles:Q,unresolved:G}}function TG($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function M$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${TG(Z.source)}" data-stx-layer="vendor">
|
|
3672
3672
|
@layer vendor {
|
|
3673
3673
|
${Z.contents}
|
|
3674
3674
|
}
|
|
3675
3675
|
</style>`}).join(`
|
|
3676
3676
|
`)}
|
|
3677
|
-
`}var
|
|
3677
|
+
`}var EG=L8;function l1($){let Z=l0($),X=new Set;for(let z of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of z[1].split(",")){let K=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(K)X.add(K)}let J=new Set;for(let z of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(z[1]);for(let z of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of z[1].split(",")){let K=q.trim().split(/[:=]/).pop()?.trim();if(K)J.add(K)}let Y=V2.filter((z)=>{if(X.has(z)||J.has(z))return!1;return new RegExp(`\\b${z}\\s*\\(`).test(Z)}),Q=F8(Z).filter((z)=>!X.has(z)&&!J.has(z));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(`
|
|
3678
3678
|
`)}
|
|
3679
|
-
${$}`,imports:Y,models:Q}}var
|
|
3679
|
+
${$}`,imports:Y,models:Q}}var bG=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 F8($){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(!bG.has(J[1]))Z.add(J[1]);return Array.from(Z)}function yG($){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 w8($){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],H=G[2];if(G[0].includes("import type"))continue;let j=[];for(let _ of W.split(",")){let O=_.trim();if(!O||O.startsWith("type "))continue;let V=O.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!V)continue;let L=V[1],F=V[2]||L;if(Y.add(L),Y.add(F),H==="stx"||H==="@stacksjs/stx")Z.add(L);else X.add(L);if(F!==L)j.push(`${F} = ${L}`)}let B=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(G[0],B)}let z=yG(J);for(let W of EG){if(Y.has(W)||z.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))Z.add(W)}let q=l0(J),K=new Set;for(let W of J.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let H of W[1].split(",")){let j=H.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let B of j){let _=B.trim();if(_)K.add(_)}}for(let W of V2){if(Y.has(W)||z.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(q))X.add(W)}let U=F8(J);for(let W of U)if(!Y.has(W)&&!z.has(W))X.add(W);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(X)}}function R8($,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
|
|
3680
3680
|
${X.join(`
|
|
3681
3681
|
`)}
|
|
3682
|
-
${
|
|
3682
|
+
${CG($,Z)}`;return""}function C_($,Z=[]){let{browserImports:X}=w8($),J=new Set(Z);return R8([],X.filter((Y)=>!J.has(Y)))}function CG($,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
|
|
3683
3683
|
[${X.join(", ")}].forEach(function (e) {
|
|
3684
3684
|
if (e[1] !== 'undefined') return;
|
|
3685
3685
|
console.error(
|
|
@@ -3688,10 +3688,10 @@ ${IG($,Z)}`;return""}function A_($,Z=[]){let{browserImports:X}=O8($),J=new Set(Z
|
|
|
3688
3688
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
3689
3689
|
);
|
|
3690
3690
|
});
|
|
3691
|
-
`}function R9($){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
|
|
3691
|
+
`}function R9($){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 B8($,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 SG($,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(B8(X[1],!0).has(Z))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B8(X[1],!1).has(Z))return!0;return!1}function PG($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var vG=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,_8=new Set;function fG($,Z){let X=vG.test($),J=Z.length>32768;if(!X&&!J)return;if(_8.has($))return;if(_8.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 p5($,Z){if(!Z)return"";let X=l0($),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&&!PG(X,Q))continue;if(SG($,Q))continue;let z;try{z=JSON.stringify(G)}catch{continue}if(z===void 0)continue;fG(Q,z),Y.push(` var ${Q} = ${z.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
3692
3692
|
${Y.join(`
|
|
3693
3693
|
`)}
|
|
3694
|
-
`}var
|
|
3694
|
+
`}var xG={left:0,middle:1,right:2};function gG($){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=xG[$.mouse];Z.push(`if ($event.button !== ${X}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function hG($,Z){let{elementId:X,event:J,modifiers:Y}=$,Q=E9($.handler),G=gG(Y),z=[];if(Y.once)z.push("once: true");if(Y.capture)z.push("capture: true");if(Y.passive)z.push("passive: true");let q=z.length>0?`, { ${z.join(", ")} }`:"",K="";if(G)K+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),W=`var $emit = function(name, detail) {
|
|
3695
3695
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
3696
3696
|
};`;function H(j){if(/\$emit\s*\(/.test(j))return`${W}
|
|
3697
3697
|
${j}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
@@ -3734,23 +3734,23 @@ else {
|
|
|
3734
3734
|
else {
|
|
3735
3735
|
${Q}
|
|
3736
3736
|
}
|
|
3737
|
-
}${q})`}function
|
|
3737
|
+
}${q})`}function uG($){if($.length===0)return"";return`
|
|
3738
3738
|
// STX: auto-generated event bindings
|
|
3739
|
-
${$.map((X,J)=>
|
|
3740
|
-
`)}`}function
|
|
3741
|
-
`)G++;continue}if(z==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let q=J.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=U[0].length;continue}let W=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}}G++}return Z}var
|
|
3739
|
+
${$.map((X,J)=>hG(X,J)).join(`
|
|
3740
|
+
`)}`}function V8($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let z=J[G];if(z==="'"||z==='"'||z==="`"){let q=z;if(G++,q==="`"){let K=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&K===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){K++,G+=2;continue}if(J[G]==="}"&&K>0){K--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===q){G++;break}G++}continue}if(z==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
|
|
3741
|
+
`)G++;continue}if(z==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let q=J.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=U[0].length;continue}let W=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}}G++}return Z}var dG=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 mG($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let j;while((j=X.exec(H))!==null){let B=j[0];if(!dG.has(B))Z.add(B)}}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 z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)J(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)J(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=W.exec($))!==null)J(Q[1]);return Z}async function D9($,Z={}){let X=$,J="",Y=!1,Q=[],G=A$(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let z=M$(G.styles),q=l1(X);X=q.code,Q=[...q.imports,...q.models];let{hasUserImports:K,bundleClientScript:U}=await o("stx/client-script-bundler",()=>import("./chunk-7ej1d910.js"));if(K(X))X=await U(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=w8(X);X=L.code,J=R8(L.stxImports,L.browserImports.filter((F)=>!Q.includes(F)))}if(J=`${p5(X,Z.serverData)}${J}`,X=t0(X),!Y&&F1(Z.attrs||""))X=w1(X);let W=uG(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let L=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${z}<script ${F}>
|
|
3742
3742
|
${m1(`${J}${X}
|
|
3743
3743
|
${W}`)}
|
|
3744
|
-
</script>`}let B=
|
|
3744
|
+
</script>`}let B=O8($),_=/function __stx_setup_/.test(X),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(L){let F=L.length>0?`
|
|
3745
3745
|
return { ${L.join(", ")} };`:"";return`${z}<script data-stx-scoped data-stx-run="always">
|
|
3746
3746
|
window.stx.mount(function() {
|
|
3747
3747
|
'use strict';
|
|
3748
3748
|
${m1(`${J}${X}
|
|
3749
3749
|
${W}${F}`)}
|
|
3750
|
-
})</script>`}if(!O&&!_){if(B)return V(
|
|
3750
|
+
})</script>`}if(!O&&!_){if(B)return V(V8($));if(Z.templateContent){let L=V8($);if(L.length>0){let F=mG(Z.templateContent);if(L.some((R)=>F.has(R)))return V(L)}}}return`${z}<script data-stx-scoped data-stx-run="always">
|
|
3751
3751
|
;(function() {
|
|
3752
3752
|
'use strict';
|
|
3753
3753
|
${m1(`${J}${X}
|
|
3754
3754
|
${W}`)}
|
|
3755
3755
|
})()</script>`}
|
|
3756
|
-
export{
|
|
3756
|
+
export{e8 as jl,$Z as kl,ZZ as ll,e0 as ml,f9 as nl,x9 as ol,g9 as pl,h9 as ql,U3 as rl,K3 as sl,KZ as tl,WZ as ul,jZ as vl,Mz as wl,kz as xl,Iz as yl,Tz as zl,Ez as Al,a8 as Bl,Q3 as Cl,G3 as Dl,z3 as El,q3 as Fl,Nz as Gl,w3 as Hl,G2 as Il,E9 as Jl,b9 as Kl,T8 as Ll,P$ as Ml,cG as Nl,t0 as Ol,iG as Pl,V2 as Ql,a1 as Rl,Fj as Sl,A$ as Tl,M$ as Ul,EG as Vl,l1 as Wl,w8 as Xl,R8 as Yl,C_ as Zl,R9 as _l,p5 as $l,D9 as am,rG as bm,v2 as cm,aG as dm,tG as em,eG as fm,$z as gm,X1 as hm,X2 as im,x2 as jm,C8 as km,Kz as lm,S8 as mm,Uz as nm,C9 as om,s$ as pm,J1 as qm,S9 as rm,f8 as sm,Wz as tm,B1 as um,x8 as vm,v0 as wm,Hz as xm,_z as ym,c8 as zm,p8 as Am,X3 as Bm,J3 as Cm,Y3 as Dm,Rz as Em,W3 as Fm,d9 as Gm,Y2 as Hm,g2 as Im,Sz as Jm,u9 as Km,VZ as Lm,LZ as Mm,OZ as Nm,Pz as Om,j3 as Pm,B3 as Qm,z1 as Rm,s2 as Sm,B0 as Tm,G4 as Um,q5 as Vm,q1 as Wm,V1 as Xm,z4 as Ym,U2 as Zm,r2 as _m,K5 as $m,IX as an,EX as bn,U4 as cn,yX as dn,CX as en,H4 as fn,L1 as gn,vK as hn,j4 as in,_5 as jn,xX as kn,B5 as ln,gX as mn,hX as nn,fK as on,xK as pn,B4 as qn,_4 as rn,V4 as sn,uX as tn,dX as un,gK as vn,hK as wn,mX as xn,uK as yn,dK as zn,F4 as An,N4 as Bn,O5 as Cn,tK as Dn,j2 as En,F5 as Fn,w5 as Gn,eK as Hn,YJ as In,$U as Jn,QJ as Kn,k4 as Ln,ZU as Mn,GJ as Nn,XU as On,JU as Pn,t2 as Qn,s7 as Rn,GH as Sn,zH as Tn,qH as Un,KH as Vn,$Q as Wn,t4 as Xn,UQ as Yn,W$ as Zn,I7 as _n,wW as $n,y7 as ao,wY as bo,DY as co,d7 as do,i5 as eo,m7 as fo,c7 as go,n5 as ho,CY as io,SY as jo,p7 as ko,l5 as lo,PY as mo,fY as no,X8 as oo,sQ as po,rQ as qo,aQ as ro,tQ as so,eQ as to,J8 as uo,JG as vo,zG as wo,qG as xo,u4 as yo,d4 as zo,LU as Ao,y4 as Bo,OU as Co,N5 as Do,A5 as Eo,M5 as Fo,p4 as Go,i4 as Ho,n4 as Io,c3 as Jo,p3 as Ko,i3 as Lo,n3 as Mo,$5 as No,Z5 as Oo,bq as Po,yq as Qo,Cq as Ro,$X as So,Sq as To,dU as Uo,mU as Vo,s4 as Wo,lU as Xo,yJ as Yo,$7 as Zo,Y7 as _o,H7 as $o,z9 as ap,P5 as bp,ZY as cp,v5 as dp,L7 as ep,O7 as fp,UY as gp,QW as hp,GW as ip,F7 as jp,zW as kp,qW as lp,f5 as mp,w7 as np,K9 as op,U9 as pp,d1 as qp,HY as rp,D7 as sp,N7 as tp,WW as up,x5 as vp,jY as wp,BY as xp,g5 as yp,h5 as zp,A7 as Ap,M7 as Bp,H$ as Cp,j$ as Dp,V$ as Ep,O$ as Fp,xQ as Gp,mQ as Hp,lQ as Ip,cQ as Jp,pQ as Kp,HG as Lp,F1 as Mp,w$ as Np,w1 as Op,F9 as Pp,LG as Qp,OG as Rp,FG as Sp,D1 as Tp,a as Up,c2 as Vp,j8 as Wp,j0 as Xp,__ as Yp,V_ as Zp,R3 as _p,D3 as $p,_1 as aq,N3 as bq,y1 as cq,A3 as dq,z2 as eq,nz as fq,CZ as gq,l9 as hq,oz as iq,c9 as jq,sz as kq,rz as lq,G1 as mq,az as nq,tz as oq,ez as pq,$q as qq,Zq as rq,Xq as sq,SZ as tq,i9 as uq,M3 as vq,Yq as wq,Qq as xq,Gq as yq,zq,qq as Aq,I3 as Bq,Kq as Cq,T3 as Dq,Uq as Eq,Wq as Fq,q2 as Gq,hZ as Hq,_q as Iq,dZ as Jq,P3 as Kq,m2 as Lq,Rq as Mq,d3 as Nq,e9 as Oq,hq as Pq,J5 as Qq,GX as Rq,UX as Sq,uq as Tq,dq as Uq,mq as Vq,lq as Wq,cq as Xq,pq as Yq,WX as Zq,HX as _q,o3 as $q,J4 as ar,VX as br,Q5 as cr,Y4 as dr,zK as er,qK as fr,z5 as gr,DX as hr,Q4 as ir};
|