@stacksjs/stx 0.2.115 → 0.2.117
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/cli.js +454 -420
- package/dist/includes.js +2 -1
- package/dist/menubar.d.ts +1 -0
- package/dist/menubar.js +2 -6
- package/dist/pwa.js +274 -240
- package/dist/render.d.ts +14 -0
- package/dist/render.js +1 -1
- package/dist/runtime-globals.d.ts +4 -2
- package/dist/signal-processing.js +2 -2
- package/dist/signals.js +42 -8
- package/dist/ssg.js +343 -309
- package/dist/utils.js +3 -3
- package/package.json +5 -5
package/dist/ssg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var kX=Object.defineProperty;var bX=($)=>$;function SX($,Z){this[$]=bX.bind(null,Z)}var r=($,Z)=>{for(var Y in Z)kX($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:SX.bind(Z,Y)})};var y=($,Z)=>()=>($&&(Z=$($=0)),Z);var W0=import.meta.require;import N5 from"path";function f6($){x6=$?.trim()||null}function R5(){return process.env[PX]?.trim()||x6||s1}function B1($=process.cwd(),...Z){let Y=R5();return N5.isAbsolute(Y)?N5.join(Y,...Z):N5.join($,Y,...Z)}function T5($){if(!$||N5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==s1&&!Z.startsWith(`${s1}/`))return $;let Y=Z.slice(s1.length+1);return Y?N5.join(R5(),Y):R5()}var s1=".stx",PX="STX_DIR",x6=null;var M5=()=>{};var j0;var g6=y(()=>{j0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function h6($,Z,Y,J){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let W={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||W} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return X=X.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),X=X.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),X}var d6,u6;var t4=y(()=>{d6={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[X]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},u6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function CX($,Z={}){let{duration:Y,delay:J,ease:X,direction:Q,custom:G}={...K1,...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);"}
|
|
3
3
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
4
4
|
@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);"}
|
|
5
5
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -9,7 +9,7 @@ var EX=Object.defineProperty;var kX=($)=>$;function bX($,Z){this[$]=kX.bind(null
|
|
|
9
9
|
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
10
10
|
@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);"}
|
|
11
11
|
@keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
|
|
12
|
-
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function
|
|
12
|
+
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function vX(){return`
|
|
13
13
|
<script data-stx-scoped>
|
|
14
14
|
// Motion preferences handling
|
|
15
15
|
(function() {
|
|
@@ -37,7 +37,7 @@ else {
|
|
|
37
37
|
});
|
|
38
38
|
})();
|
|
39
39
|
</script>
|
|
40
|
-
`}function
|
|
40
|
+
`}function xX($){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((Y)=>Y.test($))}function fX($=0.1,Z="0px"){return`
|
|
41
41
|
<script data-stx-scoped>
|
|
42
42
|
// Intersection Observer for scroll animations
|
|
43
43
|
(function() {
|
|
@@ -80,7 +80,7 @@ else {
|
|
|
80
80
|
}
|
|
81
81
|
})();
|
|
82
82
|
</script>
|
|
83
|
-
`}function
|
|
83
|
+
`}function gX(){return`
|
|
84
84
|
<style id="stx-animation-base">
|
|
85
85
|
:root {
|
|
86
86
|
--stx-transition-duration: 300ms;
|
|
@@ -195,7 +195,7 @@ else {
|
|
|
195
195
|
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
196
196
|
}
|
|
197
197
|
</style>
|
|
198
|
-
`}function
|
|
198
|
+
`}function hX($,Z,Y={}){let{staggerDelay:J=50,sequence:X=!1}=Y;return`
|
|
199
199
|
<script data-stx-scoped>
|
|
200
200
|
// Animation Group: ${$}
|
|
201
201
|
(function() {
|
|
@@ -232,11 +232,11 @@ else {
|
|
|
232
232
|
}
|
|
233
233
|
})();
|
|
234
234
|
</script>
|
|
235
|
-
`}function i6($,Z,Y,J){let X=$;if(J.animation?.enabled===!1)return X;let Q=Y.includes("test")&&Y.includes("animation");if(!
|
|
236
|
-
</head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let q=
|
|
237
|
-
`+X.slice(z)}}return X}var
|
|
238
|
-
style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},p6={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,z=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(X==="fade")U+=" stx-fade";else if(X==="slide-up"||X==="slide")U+=" stx-from-bottom";else if(X==="slide-down")U+=" stx-from-top";else if(X==="slide-left")U+=" stx-from-right";else if(X==="slide-right")U+=" stx-from-left";else if(X==="scale")U+=" stx-scale";else if(X.includes("-"))U+=` stx-${X}`;else U+=` stx-${X}`;return`<div id="${z}" class="${U}" style="${W}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},l6={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((z)=>z.startsWith("#")||z.startsWith(".")?z:`#${z}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=
|
|
239
|
-
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},c6={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=
|
|
235
|
+
`}function i6($,Z,Y,J){let X=$;if(J.animation?.enabled===!1)return X;let Q=Y.includes("test")&&Y.includes("animation");if(!xX(X)&&!Q)return X;if(!X.includes('<style id="stx-animation-base">')){let K=gX();X=X.replace("</head>",`${K}
|
|
236
|
+
</head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let q=fX(),z=X.lastIndexOf("</body>");if(z!==-1)X=X.slice(0,z)+q+`
|
|
237
|
+
`+X.slice(z)}}return X}var K1,m6,p6,l6,c6;var e4=y(()=>{K1={duration:300,delay:0,ease:"ease",direction:"both"};m6={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||K1.duration:K1.duration,G=Z.length>2?Z[2]||K1.ease:K1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||K1.delay:K1.delay,q=Z.length>4?Z[4]||K1.direction:K1.direction,z=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=CX(X,{duration:Q,delay:K,ease:G,direction:q}),U="stx-transition",B="";if(X==="fade")B="stx-fade";else if(X==="slide")B="stx-slide";else if(X==="scale")B="stx-scale";else if(X==="flip")B="stx-flip";else if(X==="rotate")B="stx-rotate";return`<div id="${z}" class="${U} ${B} ${q==="out"?"stx-out":""}"
|
|
238
|
+
style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},p6={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,z=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(X==="fade")U+=" stx-fade";else if(X==="slide-up"||X==="slide")U+=" stx-from-bottom";else if(X==="slide-down")U+=" stx-from-top";else if(X==="slide-left")U+=" stx-from-right";else if(X==="slide-right")U+=" stx-from-left";else if(X==="scale")U+=" stx-scale";else if(X.includes("-"))U+=` stx-${X}`;else U+=` stx-${X}`;return`<div id="${z}" class="${U}" style="${W}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},l6={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((z)=>z.startsWith("#")||z.startsWith(".")?z:`#${z}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=hX(X,Q,{staggerDelay:G,sequence:K});return`${$}
|
|
239
|
+
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},c6={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=vX();return`<div data-animate="${X?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as n6}from"stx-router";var o6=y(()=>{$7()});async function dX($,Z,Y,J){let X=Z[0]?.replace(/['"]/g,"")||"main",Q=n6();if(X!=="main")Q=Q.replace("container:'main'",`container:'${X}'`);return`<script data-stx-router>${Q}</script>`}var s6;var $7=y(()=>{o6();s6={name:"stxRouter",handler:dX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function r6($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...uX,...Z};return`
|
|
240
240
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
241
241
|
<script>
|
|
242
242
|
(function() {
|
|
@@ -619,13 +619,13 @@ else {
|
|
|
619
619
|
};
|
|
620
620
|
})();
|
|
621
621
|
</script>
|
|
622
|
-
`}function a6($,Z){let Y=r6(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function
|
|
623
|
-
`)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let z=K.slice(0,q).trim(),W=K.slice(q+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}Q[z]=W}return{data:Q,content:X.trim()}}function I5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,B)=>{let
|
|
624
|
-
`),X=X.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),X=X.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),X=X.replace(/<\/ul>\n<ul>/g,""),X=X.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),X=X.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),X=X.replace(/<\/ol>\n<ol>/g,""),X=X.replace(/<li data-ul>/g,"<li>"),X=X.replace(/<li data-ol>/g,"<li>"),Y)X=X.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,U,B)=>{let
|
|
625
|
-
`).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${
|
|
622
|
+
`}function a6($,Z){let Y=r6(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function mX($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[X,Q]=J.split("="),G=Q?.replace(/["']/g,"");switch(X){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}var uX,t6;var Z7=y(()=>{uX={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};t6={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let X=Y.__stx_config||{};if(Z.length>0){let Q=mX(Z.join(" "));X.heatmap={...X.heatmap,...Q,enabled:!0}}return r6(X)}}});function _1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function e6($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function $9($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],X=$.slice(Y[0].length),Q={};for(let G of J.split(`
|
|
623
|
+
`)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let z=K.slice(0,q).trim(),W=K.slice(q+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}Q[z]=W}return{data:Q,content:X.trim()}}function I5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,B)=>{let _=Q.length,j=U?` class="language-${_1(U)}"`:"";return Q.push(`<pre><code${j}>${_1(B.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),X=X.replace(/`([^`]*)`/g,(W,U)=>`<code>${_1(U)}</code>`),X=X.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),X=X.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),X=X.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),X=X.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),X=X.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),X=X.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),X=X.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),X=X.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),X=X.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),X=X.replace(/__(.+?)__/g,"<strong>$1</strong>"),X=X.replace(/\*(.+?)\*/g,"<em>$1</em>"),X=X.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)X=X.replace(/~~(.+?)~~/g,"<del>$1</del>");if(X=X.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,U,B)=>{return`<img src="${e6(B)?_1(B):""}" alt="${_1(U)}" />`}),X=X.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,U,B)=>{return`<a href="${e6(B)?_1(B):""}">${U}</a>`}),X=X.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),X=X.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),X=X.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
624
|
+
`),X=X.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),X=X.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),X=X.replace(/<\/ul>\n<ul>/g,""),X=X.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),X=X.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),X=X.replace(/<\/ol>\n<ol>/g,""),X=X.replace(/<li data-ul>/g,"<li>"),X=X.replace(/<li data-ol>/g,"<li>"),Y)X=X.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,U,B)=>{let j=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${_1(L)}</th>`).join("")}</tr>`,H=B.trim().split(`
|
|
625
|
+
`).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${_1(O)}</td>`).join("")}</tr>`}).join(`
|
|
626
626
|
`);return`<table>
|
|
627
627
|
<thead>
|
|
628
|
-
${
|
|
628
|
+
${j}
|
|
629
629
|
</thead>
|
|
630
630
|
<tbody>
|
|
631
631
|
${H}
|
|
@@ -637,10 +637,10 @@ ${H}
|
|
|
637
637
|
`:`
|
|
638
638
|
`)}</p>`);if(X=K.join(`
|
|
639
639
|
`),J)X=X.replace(/\n/g,`<br />
|
|
640
|
-
`);for(let W=0;W<Q.length;W++)X=X.replace(`\x00CODEBLOCK${W}\x00`,Q[W]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function
|
|
640
|
+
`);for(let W=0;W<Q.length;W++)X=X.replace(`\x00CODEBLOCK${W}\x00`,Q[W]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function l0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
641
641
|
`});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
642
|
-
`}),$}import
|
|
643
|
-
export { ${H.join(", ")} }`:"";await Bun.write(B,$+
|
|
642
|
+
`}),$}import pX from"process";function d0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(pX.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var E1=()=>{};var D5={};r(D5,{hasUserImports:()=>cX,bundleClientScript:()=>nX});import A0 from"path";import x0 from"fs";function cX($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(!Z9.some((G)=>G.test(X)))return console.log("[stx:bundler] detected user import:",X),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=J.exec($))!==null){let X=Y[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!Z9.some((G)=>G.test(X)))return console.log("[stx:bundler] detected side-effect import:",X),!0}return!1}function iX($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:A0.dirname(Q),q=A0.resolve(K,G),z=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,A0.join(q,"index.ts"),A0.join(q,"index.tsx"),A0.join(q,"index.js"),A0.join(q,"index.mjs")];for(let W of z)try{if(x0.existsSync(W)&&x0.statSync(W,{throwIfNoEntry:!1})?.isFile())return W}catch{}return q};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(x0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return J.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=A0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,A0.join(K,"index.ts"),A0.join(K,"index.tsx"),A0.join(K,"index.js"),A0.join(K,"index.mjs")];for(let z of q)if(x0.existsSync(z)&&x0.statSync(z,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",z),J.add(z),{path:z};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function nX($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||B1(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${lX}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=A0.join(Q,`${K}.js`),z=A0.join(Q,`${K}.deps.json`),W=Bun.file(q);if(await W.exists()){let A=Bun.file(z),N=!0;if(await A.exists())try{let R=JSON.parse(await A.text());for(let T of R.files)try{if(x0.statSync(T.path).mtimeMs!==T.mtimeMs){N=!1;break}}catch{N=!1;break}}catch{N=!1}if(N)return console.log("[stx:bundler] cache hit:",K),await W.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=B1(J,"bundle-tmp"),B=A0.join(U,`${K}.ts`),_=A0.join(U,"out",K);x0.mkdirSync(U,{recursive:!0}),x0.mkdirSync(_,{recursive:!0});let j=A0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((A)=>{let N=A.split(":")[0].trim();if(N)H.push(N)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
|
|
643
|
+
export { ${H.join(", ")} }`:"";await Bun.write(B,$+V),console.log("[stx:bundler] bundling:",K,"from:",A0.basename(Z));let w=new Set;try{let A=await Bun.build({entrypoints:[B],outdir:_,target:"browser",format:"esm",minify:X,plugins:[iX(J,j,B,w)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...d0()},root:J});if(!A.success){let b=A.logs.filter((D)=>D.level==="error").map((D)=>D.message).join(", ");return console.warn("[stx:bundler] build failed:",b),$}let N="";for(let b of A.outputs){N=await b.text();break}let R=[];for(let b of N.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let D of b[1].split(",")){let P=D.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(P){R.push([P[2],P[1]]);continue}let f=D.trim();if(/^[A-Za-z_$][\w$]*$/.test(f))R.push([f,f])}let T=N.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];N=N.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let M=`__stxBundle_${K}`,I=R.map(([b,D])=>`${JSON.stringify(b)}: ${D}`).join(", "),E=R.map(([b])=>`var ${b} = undefined;`).join(`
|
|
644
644
|
`),k=R.map(([b])=>`${b} = ${M}[${JSON.stringify(b)}];`).join(`
|
|
645
645
|
`);N=`${T.join(`
|
|
646
646
|
`)}
|
|
@@ -651,16 +651,16 @@ return { ${I} };
|
|
|
651
651
|
})();
|
|
652
652
|
${k}`.trim(),console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),x0.mkdirSync(Q,{recursive:!0}),await Bun.write(q,N);let C=Array.from(w).map((b)=>{try{return{path:b,mtimeMs:x0.statSync(b).mtimeMs}}catch{return null}}).filter((b)=>b!==null);return await Bun.write(z,JSON.stringify({files:C})),N}catch(A){let N=A instanceof Error?A.message:String(A),R=A?.errors,T=Array.isArray(R)&&R.length>0?`
|
|
653
653
|
${R.map((M)=>`- ${M?.message??M}`).join(`
|
|
654
|
-
`)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{x0.rmSync(B,{force:!0}),x0.rmSync(
|
|
654
|
+
`)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{x0.rmSync(B,{force:!0}),x0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var lX=4,Z9;var E5=y(()=>{E1();M5();Z9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var Q9={};r(Q9,{renderVendorStyleTags:()=>B$,processClientScript:()=>S5,generateServerDataBridge:()=>_$,generateAutoImportDestructuring:()=>X9,extractBridgeData:()=>b5,extractAndStripCssImports:()=>U$});import k1 from"path";import k5 from"fs";function sX($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function rX($,Z){let Y=Z;while(!0){let J=k1.join(Y,"node_modules",$,"package.json");if(k5.existsSync(J))return k1.dirname(J);let X=k1.dirname(Y);if(X===Y)return null;Y=X}}function aX($,Z){if(!$||typeof $!=="object")return null;let Y=(X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"){if(typeof X.import==="string")return X.import;if(typeof X.default==="string")return X.default;if(typeof X.import==="object")return Y(X.import);if(typeof X.default==="object")return Y(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=null;for(let X of Object.keys($)){let Q=X.indexOf("*");if(Q===-1)continue;let G=X.slice(0,Q),K=X.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!J||G.length>J.prefix.length)J={pattern:X,prefix:G,suffix:K}}if(J){let X=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=Y($[J.pattern]);if(Q)return Q.replace("*",X)}return null}function tX($,Z){let Y=sX($);if(!Y||!Y.subpath)return null;let J=rX(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(k5.readFileSync(k1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=aX(X.exports,Q);if(!G)return null;let K=k1.resolve(J,G);return k5.existsSync(K)?K:null}function U$($,Z){let Y=Z.filePath?k1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(oX,(K,q)=>{let z;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(z=q.startsWith("/")?q:k1.resolve(Y,q),!k5.existsSync(z))throw Error(`file not found: ${z}`)}else{let W=null;try{W=Bun.resolveSync(q,J)}catch{W=tX(q,J)}if(!W)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);z=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${W?.message||W}`),""}if(X.has(z))return"";X.add(z);try{let W=k5.readFileSync(z,"utf8");Q.push({source:q,resolvedPath:z,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${z}: ${W?.message||W}`)}return""}),styles:Q}}function eX($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function B$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${eX(Z.source)}" data-stx-layer="vendor">
|
|
655
655
|
@layer vendor {
|
|
656
656
|
${Z.contents}
|
|
657
657
|
}
|
|
658
658
|
</style>`}).join(`
|
|
659
659
|
`)}
|
|
660
|
-
`}function
|
|
660
|
+
`}function JQ($){let Z=new Set,Y=/\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=Y.exec($))!==null)if(!YQ.has(J[1]))Z.add(J[1]);return Array.from(Z)}function XQ($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let X=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 q=G[1],z=G[2];if(G[0].includes("import type"))continue;q.split(",").map((U)=>U.trim().split(/\s+as\s+/)[0]).filter((U)=>U.length>0).forEach((U)=>{if(X.add(U),z==="stx"||z==="@stacksjs/stx")Z.add(U);else Y.add(U)}),J=J.replace(G[0],"// [auto-import processed]")}for(let q of $Q){if(X.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(J))Z.add(q)}for(let q of ZQ){if(X.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let K=JQ(J);for(let q of K)if(!X.has(q))Y.add(q);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function X9($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
661
661
|
${Y.join(`
|
|
662
662
|
`)}
|
|
663
|
-
${
|
|
663
|
+
${QQ($,Z)}`;return""}function QQ($,Z){let Y=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
664
664
|
[${Y.join(", ")}].forEach(function (e) {
|
|
665
665
|
if (e[1] !== 'undefined') return;
|
|
666
666
|
console.error(
|
|
@@ -669,18 +669,18 @@ ${XQ($,Z)}`;return""}function XQ($,Z){let Y=[...$.map((J)=>`['${J}', typeof ${J}
|
|
|
669
669
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
670
670
|
);
|
|
671
671
|
});
|
|
672
|
-
`}function b5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function Y9($,Z){let Y=new Set;for(let J of $.split(",")){let X=J.trim().replace(/^\.\.\./,"").trim();if(!X)continue;if(Z){let Q=X.lastIndexOf(":");if(Q!==-1)X=X.slice(Q+1).trim()}if(X=X.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(X))Y.add(X)}return Y}function
|
|
672
|
+
`}function b5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function Y9($,Z){let Y=new Set;for(let J of $.split(",")){let X=J.trim().replace(/^\.\.\./,"").trim();if(!X)continue;if(Z){let Q=X.lastIndexOf(":");if(Q!==-1)X=X.slice(Q+1).trim()}if(X=X.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(X))Y.add(X)}return Y}function GQ($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(Y9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Y9(Y[1],!1).has(Z))return!0;return!1}function _$($,Z){if(!Z)return"";let Y=[];for(let[J,X]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(J))continue;if(!new RegExp(`\\b${J}\\b`).test($))continue;if(GQ($,J))continue;let Q;try{Q=JSON.stringify(X)}catch{continue}if(Q===void 0)continue;Y.push(` var ${J} = ${Q.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
673
673
|
${Y.join(`
|
|
674
674
|
`)}
|
|
675
|
-
`}function
|
|
675
|
+
`}function qQ($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=KQ[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function zQ($,Z){let{elementId:Y,event:J,handler:X,modifiers:Q}=$,G=qQ(Q),K=[];if(Q.once)K.push("once: true");if(Q.capture)K.push("capture: true");if(Q.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",z="";if(G)z+=`${G}; `;let W=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
|
|
676
676
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
677
|
-
};`;function B(
|
|
678
|
-
${
|
|
677
|
+
};`;function B(_){if(/\$emit\s*\(/.test(_))return`${U}
|
|
678
|
+
${_}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
679
679
|
if (scope && scope.__stx_execute) {
|
|
680
680
|
scope.__stx_execute('${W}', $event, $el);
|
|
681
681
|
}
|
|
682
682
|
else {
|
|
683
|
-
${
|
|
683
|
+
${_}
|
|
684
684
|
}`}if(Q.debounce!==null)return` ;(function() {
|
|
685
685
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
686
686
|
var $el = document.getElementById('${Y}')
|
|
@@ -715,25 +715,25 @@ else {
|
|
|
715
715
|
else {
|
|
716
716
|
${X}
|
|
717
717
|
}
|
|
718
|
-
}${q})`}function
|
|
718
|
+
}${q})`}function WQ($){if($.length===0)return"";return`
|
|
719
719
|
// STX: auto-generated event bindings
|
|
720
|
-
${$.map((Y,J)=>
|
|
720
|
+
${$.map((Y,J)=>zQ(Y,J)).join(`
|
|
721
721
|
`)}`}function J9($){let Z=[],Y=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),X=0,Q=J.length,G=0;while(G<Q){let K=J[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let z=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&z===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){z++,G+=2;continue}if(J[G]==="}"&&z>0){z--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===q){G++;break}G++}continue}if(K==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
|
|
722
|
-
`)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let q=J.slice(G),z=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(z){let B=z[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=z[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((B)=>{let
|
|
722
|
+
`)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let q=J.slice(G),z=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(z){let B=z[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=z[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((B)=>{let _=B.trim(),j=_.indexOf(":"),H=j>=0?_.slice(j+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=W[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let B=U[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=U[0].length;continue}}G++}return Z}function BQ($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(B){let _;while((_=Y.exec(B))!==null){let j=_[0];if(!UQ.has(j))Z.add(j)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)J(Q[1]);let z=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)J(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)J(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);return Z}async function S5($,Z={}){let Y=$,J="",X=!1,Q=U$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=Q.code;let G=B$(Q.styles),{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (E5(),D5));if(K(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let L=XQ(Y);Y=L.code,J=X9(L.stxImports,L.browserImports)}if(J=`${_$(Y,Z.serverData)}${J}`,Y=l0(Y),!X&&b1(Z.attrs||""))Y=S1(Y);let z=WQ(Z.eventBindings||[]),W=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(W)){let L=W.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
|
|
723
723
|
${J}${Y}
|
|
724
724
|
${z}
|
|
725
|
-
</script>`}let B=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|onMounted|onBeforeUnmount|onUnmounted|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),
|
|
725
|
+
</script>`}let B=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|onMounted|onBeforeUnmount|onUnmounted|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),_=/function __stx_setup_/.test(Y),j=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function H(L){let F=L.length>0?`
|
|
726
726
|
return { ${L.join(", ")} };`:"";return`${G}<script data-stx-scoped>
|
|
727
727
|
window.stx.mount(function() {
|
|
728
728
|
'use strict';
|
|
729
729
|
${J}${Y}
|
|
730
|
-
${z}${
|
|
731
|
-
})</script>`}if(!_
|
|
730
|
+
${z}${F}
|
|
731
|
+
})</script>`}if(!j&&!_){if(B)return H(J9($));if(Z.templateContent){let L=J9($);if(L.length>0){let F=BQ(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
|
|
732
732
|
;(function() {
|
|
733
733
|
'use strict';
|
|
734
734
|
${J}${Y}
|
|
735
735
|
${z}
|
|
736
|
-
})()</script>`}var
|
|
736
|
+
})()</script>`}var oX,$Q,ZQ,YQ,KQ,UQ;var y5=y(()=>{N0();oX=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;$Q=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],ZQ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],YQ=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"]);KQ={left:0,middle:1,right:2};UQ=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 OQ($){let Z="",Y=null,J=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(J){J=!1;continue}if(Q==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function LQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(jQ.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&z9.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function FQ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!z9.has(J))continue;let X=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function j$($){let Z=$.trim(),Y=OQ(Z);LQ(Y,Z),FQ(Z);for(let J of q9)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!K9.allowBracketNotation&&HQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function VQ($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||q9.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=Y7(J);else Z[Y]=J}return Z}function Y7($,Z=0){if(Z>=K9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>Y7(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,X]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(X&&typeof X==="object")Y[J]=Y7(X,Z+1);else Y[J]=X}return Y}function J0($,Z){try{let Y=VQ(Z),J=Object.keys(Y),X=Object.values(Y);return K0($,J)(...X)}catch{return}}function G0($){try{return j$($),!0}catch{return!1}}function R0($,Z){try{let Y=J0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function K0($,Z){let Y=j$($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let z=0;z<Z.length;z++){let W=Z[z];if(!J.test(W))continue;if(W9.has(W))continue;X.push(z),Q.push(W)}let G=(z)=>Function(...Q,...z,`
|
|
737
737
|
'use strict';
|
|
738
738
|
try {
|
|
739
739
|
return ${Y};
|
|
@@ -744,7 +744,7 @@ catch (e) {
|
|
|
744
744
|
}
|
|
745
745
|
throw e;
|
|
746
746
|
}
|
|
747
|
-
`),K=G([]);if(Q.length===Z.length)return G9(K,Q,G);return G9((...z)=>{let W=Array(X.length);for(let U=0;U<X.length;U++)W[U]=z[X[U]];return K(...W)},Q,G,(z)=>{K=G(z)})}function G9($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...z)=>{for(let W=0;W<=8;W++)try{return G(...z)}catch(U){let B=U instanceof Error?U.message:"",j=Q.exec(B);if(!(U instanceof ReferenceError)||!j)return;let _=j[1];if(q.has(_)||W9.has(_))return;q.add(_),K.push(_),G=Y(K),J?.(K)}return}}function H$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var BQ,K9,q9,jQ,z9,_Q,W9;var T0=y(()=>{BQ={maxSanitizeDepth:10,allowBracketNotation:!1},K9={...BQ},q9=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],jQ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),z9=new Set(["__proto__","constructor","prototype"]),_Q=/[\w)\]]\s*\[\s*['"]/;W9=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function O$($,Z){let Y=VQ++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return wQ.set(J,{type:$,expression:Z}),J}var VQ=0,wQ;var U9=y(()=>{wQ=new Map});function B9($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function L$($,Z){return B9($,Z,AQ,NQ)}function F$($,Z){return B9($,Z,RQ,TQ)}function V$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function _1($,Z,Y){let J=[],X="",Q=0,G=$.length,K=!1,q=null;while(Q<G){let z=$[Q];if(K){if(X+=z,q){if(z===q)q=null}else if(z==='"'||z==="'")q=z;else if(z===">")K=!1;Q++;continue}if(z==="<"){let W=Z($,Q);if(W>Q){X+=Y($.slice(Q,W),J.length),J.push($.slice(Q,W)),Q=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Q,Q+2)))K=!0;X+=z,Q++;continue}X+=z,Q++}return{output:X,tokens:J}}function P5($){let{output:Z,tokens:Y}=_1($,L$,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function J7($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var AQ,NQ,RQ,TQ;var C5=y(()=>{AQ=/<script\b[^>]*>/iy,NQ=/<\/script\s*>/ig,RQ=/<style\b[^>]*>/iy,TQ=/<\/style\s*>/ig});var F9={};r(F9,{usesSignalsInScript:()=>r1,unescapeHtml:()=>X7,registerFilters:()=>IQ,registerFilter:()=>H9,processExpressions:()=>H1,interpolateScriptsInTemplate:()=>EQ,interpolateScriptExpressions:()=>w$,getAllFilters:()=>O9,evaluateExpression:()=>u0,escapeHtml:()=>i0,defaultFilters:()=>x5,clearCustomFilters:()=>DQ,applyFilters:()=>L9});function MQ($){let Z=j9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),j9.set($,Z)}return Z.lastIndex=0,Z}function H9($,Z){if($ in x5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);v5[$]=Z}function IQ($){for(let[Z,Y]of Object.entries($))H9(Z,Y)}function O9(){return{...x5,...v5}}function DQ(){for(let $ of Object.keys(v5))delete v5[$]}function i0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))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 _9($,Z){let Y=["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,""),X="",Q=!1,G=0;for(let z=0;z<J.length;z++){let W=J[z];if(!Q&&W==="`"){Q=!0,G=0;continue}if(Q){if(W==="`"&&G===0){Q=!1;continue}if(W==="$"&&J[z+1]==="{"){G++,z++,X+=" ";continue}if(W==="}"&&G>0){G--;continue}if(G>0){X+=W;continue}continue}X+=W}J=X;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(J))!==null){let z=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(z)&&!(z in Z))return!1}}return!0}function w$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=u0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=u0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function EQ($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(J,X,Q)=>{if(/\bsrc\s*=/.test(X))return J;if(/\bdata-raw\b/.test(X))return J;if(/\btype\s*=\s*["']application\/json["']/.test(X))return J;if(Y.skipServer&&/\bserver\b/.test(X))return J;let G=w$(Q,Z);return`<script${X}>${G}</script>`})}function H1($,Z,Y,J){let X=$,Q=(B,j)=>{let _=F$(B,j);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(j,_))?-1:_},G=(B,j,_,H)=>{let L=_.length,{output:V,tokens:O}=_1(B,j,(F,w)=>H(L+w));return _.push(...O),V},K=[];X=G(X,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let q=[];X=G(X,L$,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let z=J?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||r1($),W=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:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,j,_)=>{try{let H=u0(j,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${L}`,Y,$,_,B)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(B,j,_)=>{try{let H=u0(j,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return O$("raw",j.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return O$("raw",j.trim());let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${L}`,Y,$,_,B)}}),X=G(X,L$,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),X=G(X,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(B,j,_)=>{let H=j.trim();if(U.has(H))return B;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=H.match(V)?.[1],w=F&&((F in Z)||L.includes(F)),A=Boolean(F&&W.has(F)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=H.match(N),T=R&&!L.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=u0(j,Z);if(A)return B;if(z&&!_9(H,Z))return B;if(M===void 0&&Z.__stx_buildMode==="compile"&&!z)return O$("expr",H);return M!==void 0&&M!==null?i0(String(M)):""}catch(M){if(A)return B;if(z&&!_9(H,Z))return B;if(T)return B;let I=M instanceof Error?M.message:String(M);return q0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,_,B)}});for(let B=0;B<q.length;B++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>q[B]);for(let B=0;B<K.length;B++)X=X.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return X}function L9($,Z,Y){if(!Z.trim())return $;let J=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=v5[G]||x5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(O9()).join(", ")}`);let q=[];if(X.startsWith(":")){let z=X.match(/^:([^|\s]+)/);if(z){let W=z[1].trim();try{let U=Number(W);q=[Number.isNaN(U)?W:U]}catch{q=[W]}X=X.substring(z[0].length).trim()}}else if(X.startsWith("(")){let z=1,W=1;while(z>0&&W<X.length){if(X[W]==="(")z++;if(X[W]===")")z--;W++}if(z===0){let U=X.substring(1,W-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[u0(`(${U})`,Y,!0)];else{let B=[],j="",_=null,H=0,L=0,V=0,O=!1;for(let F=0;F<U.length;F++){let w=U[F];if(O){j+=w,O=!1;continue}if(w==="\\"){j+=w,O=!0;continue}if(_){if(j+=w,w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w,j+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&H===0&&L===0&&V===0){B.push(j),j="";continue}j+=w}if(j)B.push(j);q=B.map((F)=>{let w=F.trim();return u0(w,Y,!0)})}}catch{q=[U]}X=X.substring(W).trim()}}try{J=K(J,Y,...q)}catch(z){let W=z instanceof Error?z.message:String(z);throw Error(`Error applying filter '${G}': ${W}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function kQ($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],z=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&z==="{"){let W=1;K+=2;while(K<$.length&&W>0){if($[K]==="{")W++;else if($[K]==="}")W--;if(W>0)K++}continue}if(Z)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")X++;else if(q==="]")X--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&J===0&&X===0&&Q===0){if(z==="|"){K++;continue}if(z==="="){K++;continue}return K}}return-1}function u0($,Z,Y=!1){try{let J=$.trim(),X=kQ(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=u0(Q,Z,!0);return L9(K,G,Z)}if(!G0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return J0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return K0(J,Q)(...G)}catch{return J0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=bQ(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function bQ($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=SQ($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function SQ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+q)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function X7($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var v5,j9,x5;var Z1=y(()=>{T0();N0();U9();C5();v5={},j9=new Map;x5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return i0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=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 X?$:"";let K=String(G);return Object.entries(Y).forEach(([q,z])=>{K=K.replace(MQ(q),String(z))}),K},t:($,Z,Y={})=>{return x5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.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(Y==="iso")return X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y: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 Y=String($);return Y.charAt(Y.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,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"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 Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});function a1($="const",Z=[]){let Y=Z.length?A$.filter((J)=>!Z.includes(J)):A$;return`${$} { ${Y.join(", ")} } = window.stx;`}var A$,V9;var f5=y(()=>{A$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],V9=["onMount","onDestroy"]});class g5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function e1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!t1.has(Y)){if(t1.size>=yQ){let J=t1.keys().next().value;if(J)t1.delete(J)}t1.set(Y,new RegExp($,Z))}return t1.get(Y)}class w9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let z=`${Y}:${q}`,W=X.get(z);if(!W){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}W=Function(...Z,`
|
|
747
|
+
`),K=G([]);if(Q.length===Z.length)return G9(K,Q,G);return G9((...z)=>{let W=Array(X.length);for(let U=0;U<X.length;U++)W[U]=z[X[U]];return K(...W)},Q,G,(z)=>{K=G(z)})}function G9($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...z)=>{for(let W=0;W<=8;W++)try{return G(...z)}catch(U){let B=U instanceof Error?U.message:"",_=Q.exec(B);if(!(U instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||W9.has(j))return;q.add(j),K.push(j),G=Y(K),J?.(K)}return}}function H$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var _Q,K9,q9,jQ,z9,HQ,W9;var T0=y(()=>{_Q={maxSanitizeDepth:10,allowBracketNotation:!1},K9={..._Q},q9=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],jQ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),z9=new Set(["__proto__","constructor","prototype"]),HQ=/[\w)\]]\s*\[\s*['"]/;W9=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function O$($,Z){let Y=wQ++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return AQ.set(J,{type:$,expression:Z}),J}var wQ=0,AQ;var U9=y(()=>{AQ=new Map});function B9($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function L$($,Z){return B9($,Z,NQ,RQ)}function F$($,Z){return B9($,Z,TQ,MQ)}function V$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function j1($,Z,Y){let J=[],X="",Q=0,G=$.length,K=!1,q=null;while(Q<G){let z=$[Q];if(K){if(X+=z,q){if(z===q)q=null}else if(z==='"'||z==="'")q=z;else if(z===">")K=!1;Q++;continue}if(z==="<"){let W=Z($,Q);if(W>Q){X+=Y($.slice(Q,W),J.length),J.push($.slice(Q,W)),Q=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Q,Q+2)))K=!0;X+=z,Q++;continue}X+=z,Q++}return{output:X,tokens:J}}function P5($){let{output:Z,tokens:Y}=j1($,L$,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function J7($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var NQ,RQ,TQ,MQ;var C5=y(()=>{NQ=/<script\b[^>]*>/iy,RQ=/<\/script\s*>/ig,TQ=/<style\b[^>]*>/iy,MQ=/<\/style\s*>/ig});var F9={};r(F9,{usesSignalsInScript:()=>r1,unescapeHtml:()=>X7,registerFilters:()=>DQ,registerFilter:()=>H9,processExpressions:()=>H1,interpolateScriptsInTemplate:()=>kQ,interpolateScriptExpressions:()=>w$,getAllFilters:()=>O9,evaluateExpression:()=>u0,escapeHtml:()=>c0,defaultFilters:()=>x5,clearCustomFilters:()=>EQ,applyFilters:()=>L9});function IQ($){let Z=_9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),_9.set($,Z)}return Z.lastIndex=0,Z}function H9($,Z){if($ in x5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);v5[$]=Z}function DQ($){for(let[Z,Y]of Object.entries($))H9(Z,Y)}function O9(){return{...x5,...v5}}function EQ(){for(let $ of Object.keys(v5))delete v5[$]}function c0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))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 j9($,Z){let Y=["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,""),X="",Q=!1,G=0;for(let z=0;z<J.length;z++){let W=J[z];if(!Q&&W==="`"){Q=!0,G=0;continue}if(Q){if(W==="`"&&G===0){Q=!1;continue}if(W==="$"&&J[z+1]==="{"){G++,z++,X+=" ";continue}if(W==="}"&&G>0){G--;continue}if(G>0){X+=W;continue}continue}X+=W}J=X;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(J))!==null){let z=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(z)&&!(z in Z))return!1}}return!0}function w$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=u0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=u0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function kQ($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(J,X,Q)=>{if(/\bsrc\s*=/.test(X))return J;if(/\bdata-raw\b/.test(X))return J;if(/\btype\s*=\s*["']application\/json["']/.test(X))return J;if(Y.skipServer&&/\bserver\b/.test(X))return J;let G=w$(Q,Z);return`<script${X}>${G}</script>`})}function H1($,Z,Y,J){let X=$,Q=(B,_)=>{let j=F$(B,_);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(_,j))?-1:j},G=(B,_,j,H)=>{let L=j.length,{output:F,tokens:O}=j1(B,_,(V,w)=>H(L+w));return j.push(...O),F},K=[];X=G(X,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let q=[];X=G(X,L$,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let z=J?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||r1($),W=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:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,_,j)=>{try{let H=u0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,j,B)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(B,_,j)=>{try{let H=u0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return O$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return O$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return q0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,j,B)}}),X=G(X,L$,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),X=G(X,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(B,_,j)=>{let H=_.trim();if(U.has(H))return B;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],w=V&&((V in Z)||L.includes(V)),A=Boolean(V&&W.has(V)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=H.match(N),T=R&&!L.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=u0(_,Z);if(A)return B;if(z&&!j9(H,Z))return B;if(M===void 0&&Z.__stx_buildMode==="compile"&&!z)return O$("expr",H);return M!==void 0&&M!==null?c0(String(M)):""}catch(M){if(A)return B;if(z&&!j9(H,Z))return B;if(T)return B;let I=M instanceof Error?M.message:String(M);return q0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,j,B)}});for(let B=0;B<q.length;B++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>q[B]);for(let B=0;B<K.length;B++)X=X.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return X}function L9($,Z,Y){if(!Z.trim())return $;let J=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=v5[G]||x5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(O9()).join(", ")}`);let q=[];if(X.startsWith(":")){let z=X.match(/^:([^|\s]+)/);if(z){let W=z[1].trim();try{let U=Number(W);q=[Number.isNaN(U)?W:U]}catch{q=[W]}X=X.substring(z[0].length).trim()}}else if(X.startsWith("(")){let z=1,W=1;while(z>0&&W<X.length){if(X[W]==="(")z++;if(X[W]===")")z--;W++}if(z===0){let U=X.substring(1,W-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[u0(`(${U})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(j){if(_+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=w}if(_)B.push(_);q=B.map((V)=>{let w=V.trim();return u0(w,Y,!0)})}}catch{q=[U]}X=X.substring(W).trim()}}try{J=K(J,Y,...q)}catch(z){let W=z instanceof Error?z.message:String(z);throw Error(`Error applying filter '${G}': ${W}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function bQ($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],z=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&z==="{"){let W=1;K+=2;while(K<$.length&&W>0){if($[K]==="{")W++;else if($[K]==="}")W--;if(W>0)K++}continue}if(Z)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")X++;else if(q==="]")X--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&J===0&&X===0&&Q===0){if(z==="|"){K++;continue}if(z==="="){K++;continue}return K}}return-1}function u0($,Z,Y=!1){try{let J=$.trim(),X=bQ(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=u0(Q,Z,!0);return L9(K,G,Z)}if(!G0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return J0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return K0(J,Q)(...G)}catch{return J0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=SQ(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function SQ($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=yQ($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function yQ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+q)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function X7($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var v5,_9,x5;var Z1=y(()=>{T0();N0();U9();C5();v5={},_9=new Map;x5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return c0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=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 X?$:"";let K=String(G);return Object.entries(Y).forEach(([q,z])=>{K=K.replace(IQ(q),String(z))}),K},t:($,Z,Y={})=>{return x5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.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(Y==="iso")return X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y: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 Y=String($);return Y.charAt(Y.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,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"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 Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});function a1($="const",Z=[]){let Y=Z.length?A$.filter((J)=>!Z.includes(J)):A$;return`${$} { ${Y.join(", ")} } = window.stx;`}var A$,V9;var f5=y(()=>{A$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],V9=["onMount","onDestroy"]});class g5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function e1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!t1.has(Y)){if(t1.size>=PQ){let J=t1.keys().next().value;if(J)t1.delete(J)}t1.set(Y,new RegExp($,Z))}return t1.get(Y)}class w9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let z=`${Y}:${q}`,W=X.get(z);if(!W){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}W=Function(...Z,`
|
|
748
748
|
'use strict';
|
|
749
749
|
try {
|
|
750
750
|
return ${q};
|
|
@@ -755,33 +755,33 @@ catch (e) {
|
|
|
755
755
|
}
|
|
756
756
|
throw e;
|
|
757
757
|
}
|
|
758
|
-
`),X.set(z,W)}return W(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class A9{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:X};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=X?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function
|
|
758
|
+
`),X.set(z,W)}return W(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class A9{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:X};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=X?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function CQ(){if(!Q7)Q7=new A9;return Q7}var t1,PQ=500,Oj,Q7=null,N9;var $5=y(()=>{t1=new Map;Oj=new w9;N9=new Proxy({},{get($,Z){return CQ()[Z]}})});function R9($,Z=""){let Y=`${$}${Z}`,J=0;for(let X=0;X<Y.length;X++){let Q=Y.charCodeAt(X);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function T9($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=G7($),q=[],z=new Map;if(Q)for(let W of K){let U=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let B=U[1],_=`${Z}_${B}`;z.set(B,_)}}for(let W of K){let U=M9(W,Z,J,X,z,G);q.push(U)}return q.join(`
|
|
759
759
|
|
|
760
|
-
`)}function G7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,X="",Q=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&J===0)Q=!0;if(q==="{")J++;else if(q==="}"){if(J--,J===0){if(Q){G+=q;let z=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(z){let[,W,U,B]=z;if(W==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:B.trim()});else if(W==="media"||W==="supports"||W==="container"){let
|
|
760
|
+
`)}function G7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,X="",Q=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&J===0)Q=!0;if(q==="{")J++;else if(q==="}"){if(J--,J===0){if(Q){G+=q;let z=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(z){let[,W,U,B]=z;if(W==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:B.trim()});else if(W==="media"||W==="supports"||W==="container"){let _=G7(B);Z.push({selector:`@${W} ${U.trim()}`,declarations:_.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
|
|
761
761
|
`)})}else Z.push({selector:`@${W} ${U.trim()}`,declarations:B.trim()})}G="",Q=!1}else if(X.trim()){X+=q;let z=X.match(/([^{]+)\{([^}]*)\}/);if(z)Z.push({selector:z[1].trim(),declarations:z[2].trim()});X=""}continue}}if(Q)G+=q;else X+=q}return Z}function M9($,Z,Y,J,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let W=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(W)||W} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=G7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>M9(B,Z,Y,J,X,Q)).join(`
|
|
762
762
|
`);return`${G} {
|
|
763
763
|
${U}
|
|
764
|
-
}`}return`${G} { ${K} }`}let q=
|
|
765
|
-
`)}function
|
|
766
|
-
`,""}),headContent:Z.trim()}}function
|
|
767
|
-
`);for(let X of J){let Q=Y,G=null,K=!1;for(let q=0;q<X.length;q++){let z=X[q];if(K){K=!1;continue}if(z==="\\"){K=!0;continue}if(G){if(z===G)G=null;continue}if(z==="'"||z==='"'||z==="`"){G=z;continue}if(z==="/"&&q+1<X.length&&X[q+1]==="/")break;if(z==="{")Y++;else if(z==="}")Y--}if(Q===0){let q=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let z=X.match(/(?:const|let|var)\s+(\w+)/);if(z)Z.push(z[1])}else{let z=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(z){let U=z[1].slice(1,-1).split(",").map((B)=>{let
|
|
764
|
+
}`}return`${G} { ${K} }`}let q=vQ(G,Z,Y,J),z=K;for(let[W,U]of X)z=z.replace(new RegExp(`\\b${W}\\b`,"g"),U);if(Q)z=z.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${z} }`}function vQ($,Z,Y,J){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(J)Q.push(G);else{let z=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(z)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let q=xQ(G,Z);if(q)Q.push(Y?`${Y} ${q}`:q)}return Q.join(", ")}function xQ($,Z){let Y=0,J=$.length;for(let q=0;q<$.length;q++){let z=$[q];if(z==="["||z==="(")Y++;else if(z==="]"||z===")")Y--;else if(Y===0&&(z===" "||z===">"||z==="+"||z==="~")){J=q;break}}let X=$.slice(0,J),Q=$.slice(J);if(!X)return"";let G=X.length,K=0;for(let q=0;q<X.length;q++){let z=X[q];if(z==="["||z==="(")K++;else if(z==="]"||z===")")K--;else if(Y===0&&K===0&&z===":"){G=q;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function N$($,Z){if(!fQ.test($))return{html:$,hasScoped:!1};let Y=R9(Z),J=`data-v-${Y}`,X=$,Q=new RegExp(`<style\\s+([^>]*${K7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,q,z)=>{G=!0;let W=gQ(z,J),U=q.replace(new RegExp(K7,"gi"),"").trim(),B=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${B}>${W}</style>`}),!G)return{html:$,hasScoped:!1};return X=hQ(X,J),{html:X,hasScoped:!0}}function gQ($,Z){return T9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function hQ($,Z){let Y=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,X,Q)=>{if(Y.has(X.toLowerCase()))return J;if(J.includes(Z))return J;if(X.toLowerCase()==="style"||X.toLowerCase()==="script")return J;if(Q)return J.replace(`<${X}${Q}`,`<${X} ${Z}${Q}`);if(J.endsWith("/>"))return`<${X} ${Z} />`;return`<${X} ${Z}>`})}var K7,fQ;var q7=y(()=>{K7=String.raw`(?<![\w-])scoped(?![\w-])`,fQ=new RegExp(`<style\\s+[^>]*${K7}`,"i")});function uQ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return dQ.test(Z)}function R$($){h5.lastIndex=0;let Z;while((Z=h5.exec($))!==null){if(Z[0].startsWith("</")||uQ(Z[0]))continue;let Y=Z.index,J=h5.lastIndex,X=1,Q;while((Q=h5.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:Y,openEnd:J,closeStart:G,end:h5.lastIndex,content:$.slice(J,G)}}}else X++;return null}return null}var h5,dQ;var z7=y(()=>{h5=/<\/?template\b[^>]*>/gi,dQ=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var I9=()=>{};function y0($,Z,Y,J=0){let X=0,Q=J,G=null,K=0,q=!1;while(Q<$.length){let z=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&z==="\\"){q=!0,Q++;continue}if(q=!1,(z==='"'||z==="'"||z==="`")&&!G){G=z,Q++;continue}if(z===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&z==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&z==="}"){K--,Q++;continue}if(z==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(z===Z)X++;else if(z===Y){if(X--,X===0)return Q}Q++}return-1}var W7={};r(W7,{useTitle:()=>nQ,useSeoMeta:()=>M$,usePageTitle:()=>nQ,useHead:()=>P1,resetHead:()=>lQ,renderHtmlAttrs:()=>sQ,renderHead:()=>oQ,renderBodyAttrs:()=>rQ,processTitleDirective:()=>eQ,processMetaDirective:()=>$G,processHeadDirective:()=>tQ,getPageMeta:()=>pQ,getHead:()=>d5,definePageMeta:()=>iQ,applyHead:()=>aQ});function d5(){return O1}function pQ(){return T$}function lQ(){O1={},mQ.length=0,T$={}}function P1($){O1=cQ(O1,$)}function cQ($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function M$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let X=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(X)Z.push({name:"twitter:title",content:X});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});P1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function iQ($){if(T$={...T$,...$},$.title||$.description)M$({title:$.title,description:$.description})}function nQ($){let Z=typeof $==="function"?$():$;P1({title:Z})}function oQ($=O1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${y1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${y1(X)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>{return`${X==="httpEquiv"?"http-equiv":X}="${y1(String(Q))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>`${X}="${y1(String(Q))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...X}=Y,Q=Object.entries(X).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${y1(String(K))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${Q}>${J}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
|
|
765
|
+
`)}function sQ($=O1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${y1(Y)}"`).join(" ")}function rQ($=O1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${y1(Y)}"`).join(" ")}function y1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function aQ($=O1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),Z.name)J.setAttribute("name",Z.name);if(Z.property)J.setAttribute("property",Z.property);document.head.appendChild(J)}J.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[X,Q]of Object.entries(Z))if(Q!==void 0)J.setAttribute(X,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function tQ($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,X)=>{return Z+=X.trim()+`
|
|
766
|
+
`,""}),headContent:Z.trim()}}function eQ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q;return P1({title:G}),""})}function $G($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,X,Q,G,K)=>{let q=Q?G:K,z=Q?q:Z[(q||"").trim()]??q,U=X.includes(":")?{property:X,content:z}:{name:X,content:z};return P1({meta:[U]}),""})}var O1,mQ,T$;var u5=y(()=>{O1={},mQ=[],T$={}});var I$={};r(I$,{stripTypeScript:()=>S9,hasVariables:()=>x9,extractVariables:()=>C1,extractScriptFromTemplate:()=>v9,convertToCommonJS:()=>B7});import Z5 from"path";import m5 from"process";function ZG($){let Z=[],Y=0,J=$.split(`
|
|
767
|
+
`);for(let X of J){let Q=Y,G=null,K=!1;for(let q=0;q<X.length;q++){let z=X[q];if(K){K=!1;continue}if(z==="\\"){K=!0;continue}if(G){if(z===G)G=null;continue}if(z==="'"||z==='"'||z==="`"){G=z;continue}if(z==="/"&&q+1<X.length&&X[q+1]==="/")break;if(z==="{")Y++;else if(z==="}")Y--}if(Q===0){let q=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let z=X.match(/(?:const|let|var)\s+(\w+)/);if(z)Z.push(z[1])}else{let z=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(z){let U=z[1].slice(1,-1).split(",").map((B)=>{let _=B.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...U)}}}}return[...new Set(Z)]}function S9($){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 Y(J){if(!J.includes(":"))return J;let X=[],Q="",G=0,K=0,q=null;for(let z=0;z<J.length;z++){let W=J[z];if(q){if(Q+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,Q+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")K++;else if(W===")")K--;if(W===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=W}if(Q)X.push(Q);return X.map((z)=>{let W=z.trim(),U=W.startsWith("..."),B=U?W.slice(3):W,_=-1,j=0;for(let A=0;A<B.length;A++)if(B[A]==="<")j++;else if(B[A]===">")j--;else if(B[A]===":"&&j===0){_=A;break}if(_===-1)return z;let L=B.substring(0,_).trim().replace(/\?$/,""),F=B.substring(_+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,X,Q)=>{if(!Q.includes(":"))return J;return`${X}(${Y(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,X,Q=[];while((X=J.exec(Z))!==null){let G=X.index+X[0].length-1,K=1,q=G+1,z=0,W=null;while(q<Z.length&&K>0){let _=Z[q];if(W){if(_===W)W=null;q++;continue}if(_==='"'||_==="'"||_==="`"){W=_,q++;continue}if(_==="<")z++;else if(_===">"&&z>0)z--;else if(z===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let B=Y(U);Q.push({start:G+1,end:q,replacement:B})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=Q[G];Z=Z.substring(0,K)+z+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,X)=>{if(!X.includes(":"))return J;if(X.includes("{")||X.includes("}"))return J;return`(${X.split(",").map((G)=>{let[K,...q]=G.split("="),z=K.split(":")[0].trim();if(q.length>0)return`${z} = ${q.join("=").trim()}`;return z}).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,`
|
|
768
768
|
|
|
769
|
-
`),Z}async function C1($,Z,Y,J={}){if(!$.trim())return;let X;try{let S=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=S.transformSync(v)}catch{X=S9($)}let Q={exports:{}},G=Q.exports,K=m5.cwd(),q={},z=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!S.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S));for(let S of z)try{let v=Z5.resolve(K,"node_modules",S),x=Z5.join(v,"package.json"),p=JSON.parse(W0("fs").readFileSync(x,"utf8")),t=p.main||"index.js";if(p.exports){let w0=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof w0==="string")t=w0;else if(w0?.bun)t=w0.bun;else if(w0?.import)t=w0.import;else if(w0?.default)t=w0.default}q[S]=await import(Z5.resolve(v,t))}catch{}let W=(S)=>{if(q[S])return q[S];return W0(S)},U=Z.props||{},B=(S)=>{if(!S)return U;let v={};for(let[x,p]of Object.entries(S)){let t=U[x];if(t!==void 0)v[x]=t;else if(typeof p==="function")v[x]=p();else v[x]=p}return v};for(let[S,v]of Object.entries(U))Object.defineProperty(B,S,{value:v,enumerable:!0,configurable:!0,writable:!0});let
|
|
770
|
-
`),U0=Z.params??{},Q1=[]
|
|
769
|
+
`),Z}async function C1($,Z,Y,J={}){if(!$.trim())return;let X;try{let S=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=S.transformSync(v)}catch{X=S9($)}let Q={exports:{}},G=Q.exports,K=m5.cwd(),q={},z=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!S.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S));for(let S of z)try{let v=Z5.resolve(K,"node_modules",S),x=Z5.join(v,"package.json"),p=JSON.parse(W0("fs").readFileSync(x,"utf8")),t=p.main||"index.js";if(p.exports){let w0=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof w0==="string")t=w0;else if(w0?.bun)t=w0.bun;else if(w0?.import)t=w0.import;else if(w0?.default)t=w0.default}q[S]=await import(Z5.resolve(v,t))}catch{}let W=(S)=>{if(q[S])return q[S];return W0(S)},U=Z.props||{},B=(S)=>{if(!S)return U;let v={};for(let[x,p]of Object.entries(S)){let t=U[x];if(t!==void 0)v[x]=t;else if(typeof p==="function")v[x]=p();else v[x]=p}return v};for(let[S,v]of Object.entries(U))Object.defineProperty(B,S,{value:v,enumerable:!0,configurable:!0,writable:!0});let _=(S)=>{if(!S)return U;let v={...U};for(let[x,p]of Object.entries(S)){let t=p&&typeof p==="object"&&!Array.isArray(p)?p:{type:p};if(v[x]===void 0&&t.default!==void 0)v[x]=typeof t.default==="function"?t.default():t.default}return v},j=()=>Z.slots||{},H=(S,v)=>{let x={...S};for(let[p,t]of Object.entries(v))if(x[p]===void 0)if(typeof t==="function")x[p]=t();else x[p]=t;return x},L=(S)=>{let v=()=>S;return v.set=(x)=>{},v.update=(x)=>{},v},F=(S)=>{let v,x=!1;return()=>{if(!x)try{v=S(),x=!0}catch{v=void 0}return v}},O=(S)=>{},V=(S)=>S(),w=(S)=>{},A=(S)=>{},N=(S)=>{},R=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",x=S?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:x,name:"",fullPath:x+v,hash:"",matched:[]}},T=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),M=(S)=>{P1(S);let v=Z.__stx_runtime_head||{},x=S||{};Z.__stx_runtime_head={...v,...x.title&&{title:x.title},meta:[...v.meta||[],...x.meta||[]],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],htmlAttrs:{...v.htmlAttrs||{},...x.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs||{}}}},I=(S)=>{M$(S);let v=d5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},E=(S)=>({value:S}),k=(S)=>S,C=(S)=>({value:typeof S==="function"?S():S}),b=(S,v)=>{},D=(S)=>{},P=(S)=>{},f=(S)=>S?S():Promise.resolve(),g=(S)=>(v,...x)=>{},d=(S)=>{},i=(S,v)=>{},m=(S,v)=>v,z0=()=>({value:"light"}),F0=()=>L(!1),_0=(S)=>L(!1),Y0=()=>_0("(prefers-color-scheme: dark)"),I0=()=>_0("(prefers-color-scheme: light)"),p0=()=>_0("(prefers-reduced-motion: reduce)"),X1=()=>_0("(prefers-contrast: more)"),a0={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:{}},a=new Proxy(a0,{get(S,v){if(v in S)return S[v];return},set(S,v,x){return S[v]=x,!0}}),e={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},u=console;try{let S=B7(X,Y),v=new Set(Object.keys(U)),x=(l)=>/^[a-z_$][\w$]*$/i.test(l),p=Object.keys(Z).filter((l)=>!v.has(l)&&l!=="props"&&x(l)),t=p.map((l)=>Z[l]),w0=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"]),S0=[],v0=[];for(let[l,$1]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(l))continue;if(w0.has(l))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${l}\\b`).test(S))continue;S0.push(l),v0.push($1)}let V5=ZG(S).map((l)=>`module.exports.${l} = typeof ${l} !== 'undefined' ? ${l} : module.exports.${l};`).join(`
|
|
770
|
+
`),U0=Z.params??{},Q1=[],e0=[];for(let l=0;l<p.length;l++){if(p[l]==="params")continue;Q1.push(p[l]),e0.push(t[l])}let G1=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...S0,...Q1,`return (async () => {
|
|
771
771
|
${S}
|
|
772
772
|
${V5}
|
|
773
773
|
return module.exports
|
|
774
|
-
})()`)(Q,G,W,U,B,
|
|
775
|
-
`),X=[],Q=0;while(Q<J.length){let G=J[Q].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;Q<J.length;Q++){for(let q of J[Q])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}Q++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let z=Q;z<J.length&&!q;z++){let W=null,U=!1,B=J[z];for(let
|
|
776
|
-
`+B;if(W<=0&&U>=Q)break}X.push(z),X.push(`module.exports.${q} = ${q};`),Q=U+1}else X.push(G),Q++}else if(G.includes("module.exports"))X.push(G),Q++;else if(G.trim()&&!G.startsWith("//"))X.push(G),Q++;else Q++}return
|
|
777
|
-
`),Y)}function
|
|
778
|
-
`)G=!1;X++;continue}if(K){if(J+=z,z==="*"&&W==="/"){J+=W,X+=2,K=!1;continue}X++;continue}if(!Q&&z==="/"&&W==="/"){G=!0,J+=z,X++;continue}if(!Q&&z==="/"&&W==="*"){K=!0,J+=z,X++;continue}if(Q){if(J+=z,z==="\\"){J+=W,X+=2;continue}if(z===Q&&Q!=="`"){Q=null,X++;continue}if(Q==="`"){if(z==="$"&&W==="{"){q++,J+=W,X+=2;continue}if(z==="`"){Q=null,X++;continue}}X++;continue}if(q>0){if(z==="{")q++;else if(z==="}")q--}if(z==='"'||z==="'"||z==="`"){Q=z,J+=z,X++;continue}if(z==="a"&&$.startsWith("await",X)){let U=
|
|
779
|
-
`);return{type:
|
|
774
|
+
})()`)(Q,G,W,U,B,_,H,L,F,O,V,w,A,N,R,T,M,I,E,k,C,b,D,P,f,g,d,j,i,m,z0,F0,_0,Y0,I0,p0,X1,a,e,u,a0.confirm,a0.alert,a0.fetch,U0,...v0,...e0);if(J.preserveExisting){for(let[l,$1]of Object.entries(G1))if(!(l in Z)||Z[l]===void 0)Z[l]=$1}else Object.assign(Z,G1);for(let[l,$1]of Object.entries(U))if(!(l in Z))Z[l]=$1}catch(S){if(m5.env.STX_DEBUG){let v=S instanceof Error?S.message:String(S);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`)}try{await GG(X,Z,Y)}catch(v){if(m5.env.STX_DEBUG){let x=v instanceof Error?v.message:String(v);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function B7($,Z){let Y=Z?Z5.dirname(Z):m5.cwd(),J=$.split(`
|
|
775
|
+
`),X=[],Q=0;while(Q<J.length){let G=J[Q].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;Q<J.length;Q++){for(let q of J[Q])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}Q++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let z=Q;z<J.length&&!q;z++){let W=null,U=!1,B=J[z];for(let _=0;_<B.length;_++){let j=B[_];if(U){U=!1;continue}if(j==="\\"){U=!0;continue}if(W){if(j===W)W=null;continue}if(j==='"'||j==="'"||j==="`"){W=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){Q=z+1,q=!0;break}}}}if(!q)Q=J.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),z=G.match(/^import\s+['"](.+)['"]/),W=(U)=>{if(U.startsWith("."))return Z5.resolve(Y,U);return U};if(K){let[,U,B]=K,_=W(B);X.push(`const ${U} = await import('${_}')`),X.push(`module.exports.${U} = ${U};`)}else if(q){let[,U,B]=q,_=U.trim(),j=W(B);X.push(`const { ${_} } = await import('${j}')`);for(let H of _.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)X.push(`module.exports.${L} = ${L};`)}}else if(z){let U=W(z[1]);X.push(`await import('${U}')`)}else X.push(G);Q++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))X.push(J[Q]),Q++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=D9(J,Q),{type:q,name:z,value:W}=K;X.push(`${q} ${z} = ${W};`),X.push(`module.exports.${z} = ${z};`),Q=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=U7(J,Q);X.push(K.functionCode),X.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=D9(J,Q),{type:q,name:z,value:W}=K;X.push(`${q} ${z} = ${W};`),X.push(`module.exports.${z} = ${z};`),Q=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=U7(J,Q);X.push(K.functionCode),X.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...J];q[Q]=K;let z=U7(q,Q);if(X.push(z.functionCode),z.name)X.push(`module.exports.default = ${z.name};`);Q=z.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");X.push(`module.exports.default = ${K};`),Q++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],z=J[Q].replace(/^export\s+/,""),W=0,U=Q;for(;U<J.length;U++){let B=J[U];for(let _ of B)if(_==="{")W++;else if(_==="}")W--;if(U>Q)z+=`
|
|
776
|
+
`+B;if(W<=0&&U>=Q)break}X.push(z),X.push(`module.exports.${q} = ${q};`),Q=U+1}else X.push(G),Q++}else if(G.includes("module.exports"))X.push(G),Q++;else if(G.trim()&&!G.startsWith("//"))X.push(G),Q++;else Q++}return YG(X.join(`
|
|
777
|
+
`),Y)}function YG($,Z){let Y=$.length,J="",X=0,Q=null,G=!1,K=!1,q=0;while(X<Y){let z=$[X],W=$[X+1];if(G){if(J+=z,z===`
|
|
778
|
+
`)G=!1;X++;continue}if(K){if(J+=z,z==="*"&&W==="/"){J+=W,X+=2,K=!1;continue}X++;continue}if(!Q&&z==="/"&&W==="/"){G=!0,J+=z,X++;continue}if(!Q&&z==="/"&&W==="*"){K=!0,J+=z,X++;continue}if(Q){if(J+=z,z==="\\"){J+=W,X+=2;continue}if(z===Q&&Q!=="`"){Q=null,X++;continue}if(Q==="`"){if(z==="$"&&W==="{"){q++,J+=W,X+=2;continue}if(z==="`"){Q=null,X++;continue}}X++;continue}if(q>0){if(z==="{")q++;else if(z==="}")q--}if(z==='"'||z==="'"||z==="`"){Q=z,J+=z,X++;continue}if(z==="a"&&$.startsWith("await",X)){let U=JG($,X);if(U){let{quote:B,path:_,end:j}=U;if(_.startsWith(".")){let H=Z5.resolve(Z,_);J+=`await import(${B}${H}${B})`,X=j;continue}}}J+=z,X++}return J}function JG($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let X=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let Q=$.slice(X,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:Q,end:Y+1}}function y9($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let X=y0($,Y,Y==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:$.slice(Z,X+1),endPos:X+1}}function P9($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,X=0,Q="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(X++,X===1){let K=y9(Y,J);if(K){let q=P9(K.pattern);Z.push(...q),J=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")X--;if(X>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<Y.length&&Y[J]!==","&&X===0){if(Y[J]==="{"||Y[J]==="[")X++;else if(Y[J]==="}"||Y[J]==="]")X--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function D9($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!J){let z=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(z){let W=Y.slice(z[0].length),U=Z;if((W.startsWith("{")||W.startsWith("["))&&!W.includes(W.startsWith("{")?"}":"]")){let _=W.startsWith("{")?"}":"]",j=W;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),U=H,$[H].includes(_))break;W=j}let B=y9(W,0);if(B){let _=z[1],j=B.pattern,H=W.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(U,Z);if(E9(L)){let N=k9($,O,L);F=N.value,O=N.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=P9(j),w=`__stx_src_${Z}`,A=V.map((N)=>`module.exports.${N} = ${N};`).join(`
|
|
779
|
+
`);return{type:_,name:w,value:`${F}; ${_} ${j} = ${w};
|
|
780
780
|
${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,X,Q,G]=J,K=G,q=Z;if(E9(G)){let z=k9($,Z,G);K=z.value,q=z.nextIndex}else q=Z+1;while(q<$.length){let z=$[q].trim();if(z.startsWith(".")||z.startsWith("?."))K+=`
|
|
781
|
-
${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:X,name:Q,value:K,nextIndex:q}}function U7($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,X]=J,Q=Y.replace(/^export\s+/,""),G=Z;if(
|
|
781
|
+
${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:X,name:Q,value:K,nextIndex:q}}function U7($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,X]=J,Q=Y.replace(/^export\s+/,""),G=Z;if(XG(Y)){let K=QG($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function E9($){let Z=$.trim();if(Z.startsWith("{"))return y0(Z,"{","}",0)===-1;if(Z.startsWith("["))return y0(Z,"[","]",0)===-1;return!C9(Z)}function C9($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let X=0;X<$.length;X++){let Q=$[X];if((X>0?$[X-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[X+1]==="{"){J++,X++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(Y)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&&Y===null}function XG($){let Z=$.indexOf("{");if(Z===-1)return!0;return y0($,"{","}",Z)===-1}function k9($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!C9(J)){let Q=$[X];J+=`
|
|
782
782
|
${Q}`,X++}while(X<$.length){let Q=$[X].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
|
|
783
|
-
${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function
|
|
784
|
-
${G}`,X++}return{functionCode:J,nextIndex:X}}function b9($,Z){let Y=J0($,Z)??J0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...m5.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 QG($,Z,Y){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,K]=Q;try{let q=K.trim().replace(/;$/,""),z=b9(q,Z);if(z!==void 0)Z[G]=z}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),z=b9(q,Z);if(z!==void 0)Z[G]=z}catch{}}}function v9($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function x9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var p5=y(()=>{u5();E1();T0()});var j7={};r(j7,{renderSlot:()=>g9,processSlots:()=>d9,parseSlots:()=>f9,parseSlotElement:()=>WG,extractSlotContent:()=>jG,applySlots:()=>_G});function GG($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function qG($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function zG($){let Z=[],Y=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let B=$.indexOf("-->",Q+4);X=B===-1?$.length:B+3;continue}let G=qG($,Q+1);if(G===-1)break;let K=$.slice(Q,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){X=G;continue}let z=q[1]==="/",W=q[2].toLowerCase();if(z){let B=Y.lastIndexOf(W);if(B!==-1)Y.splice(B);X=G;continue}if(W==="template"&&Y.length===0){let B=K.match(J);if(B){let j=GG($,G);if(j!==-1){let _=B[1]||B[2]||B[3];Z.push({start:Q,end:j,slotName:_,content:$.slice(G,j-11).trim(),propsBinding:B[4]||void 0}),X=j;continue}}}if(!/\/\s*>$/.test(K)&&!KG.has(W)){if(Y.push(W),W==="script"||W==="style"){let B=$.toLowerCase().indexOf(`</${W}>`,G);if(B!==-1){X=B;continue}}}X=G}return Z}function f9($){let Z={default:"",named:new Map},Y=$,J=zG($);for(let q of J)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});J.sort((q,z)=>z.start-q.start);for(let q of J)Y=Y.slice(0,q.start)+Y.slice(q.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[q,z,W,U,B,j]=G,_=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(_+H).trim(),V=`<${z}${L?" "+L:""}>${j}</${z}>`;X.push({start:G.index,end:G.index+q.length,slotName:U,element:V})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,z,W,U,B]=G,j=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+_).trim(),L=`<${z}${H?" "+H:""} />`;X.push({start:G.index,end:G.index+q.length,slotName:U,element:L})}X.sort((q,z)=>z.start-q.start);for(let q of X){let z=Z.named.get(q.slotName);if(z)z.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function WG($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function g9($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[z,W]=q.split(":").map((B)=>B.trim()),U=W||z;if(Z[z]!==void 0)G[U]=Z[z]}}else G[Q]=Z;X=UG(X,G)}return X}function UG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=h9(X,Z);return i0(String(Q??""))}catch{return`{{ ${J} }}`}})}function h9($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!G0($))return;return K0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function d9($,Z,Y){let J=$;J=await BG(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,z)=>{let W=Z.named.get(K),U=z?.trim()||"",B=q||"",j={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=_.exec(B))!==null){let L=H[1],V=H[2];j[L]=h9(V,Y)}return await g9(W,j,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),J}async function BG($,Z,Y){let J=[],X=[];$.replace(Z,(K,...q)=>{let z=q[q.length-2];return X.push({match:K,index:z}),J.push(Y(K,...q.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:q,index:z}=X[K];G=G.slice(0,z)+Q[K]+G.slice(z+q.length)}return G}function jG($){let Z=f9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function _G($,Z,Y,J){return await d9($,{default:Z,named:Y},J)}var KG;var _7=y(()=>{Z1();T0();KG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function L1($,Z){let Y=HG($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function HG($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=y0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function OG($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function v1($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let q=G.exec($),z=K.exec($),W=q?q.index:1/0,U=z?z.index:1/0;if(W<U)X++,Q=W+q[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+z[0].length}else break}return-1}function u9($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=L1($,J);if(!X)return null;let Q=X.endPos,G=v1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],z=0,W="if",U=X.expression,B=0,j=0;while(z<K.length){let _=K.indexOf("@",z);if(_===-1)break;z=_;let H=K.substring(_);if(OG(K,_)){z++;continue}if(/^@if\s*\(/.test(H)){j++,z++;continue}if(/^@endif(?![a-z])/.test(H)){j--,z+=6;continue}if(j===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:W,condition:U,content:K.substring(B,z),start:Q+B,end:Q+z});let V=z+L[0].length,O=L1(K,V);if(!O){z++;continue}W="elseif",U=O.expression,z=O.endPos,B=z;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:W,condition:U,content:K.substring(B,z),start:Q+B,end:Q+z}),W="else",U=void 0,z+=5,B=z;continue}}z++}return q.push({type:W,condition:U,content:K.slice(B),start:Q+B,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function l5($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=u9($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function D$($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=X.exec($);continue}let K=Q.index,q=K+Q[0].length-1,z=y0($,"(",")",q);if(z===-1){Q=X.exec($);continue}let W=$.slice(q+1,z),U=z+1,B=v1($,Z,Y,U);if(B===-1){Q=X.exec($);continue}let j=$.slice(U,B),_=B+`@${Y}`.length;J.push({fullMatch:$.slice(K,_),name:Z,params:W,content:j,start:K,end:_}),X.lastIndex=_,Q=X.exec($)}return J}function H7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=L1($,J);if(!X)return null;let Q=X.endPos,G=v1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],z=0,W=null,U=0;while(z<K.length){let B=K.slice(z),j=B.match(/^@switch\s*\(/),_=B.match(/^@endswitch(?![a-z])/);if(j){if(U++,W)W.content+=j[0];z+=j[0].length;continue}if(_){if(U--,W)W.content+=_[0];z+=_[0].length;continue}if(U>0){if(W)W.content+=K[z];z++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),V=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(W)q.push(W);let O=z+H[0].length,F=L1(K,O);if(!F){z++;continue}W={type:"case",value:F.expression,content:""},z=F.endPos}else if(L&&B.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},z+=L[0].length}else if(V&&B.startsWith("@break"))z+=V[0].length;else{if(W)W.content+=K[z];z++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:q,start:Z,end:G+10}}var m9=()=>{};var p9=()=>{};var E$=y(()=>{m9();p9()});function S$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(f0)J.add(f0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),c5)J.forEach((K)=>b$.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),X}function y$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,c5)J.forEach((G)=>b$.add(G));else J.forEach((G)=>G())},Q=()=>{if(f0)J.add(f0);if(Y){let G=f0;f0=X,k$.push(X);try{Z=$()}finally{k$.pop(),f0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Q}function P$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=f0;f0=X,k$.push(X);try{Y=$()}finally{k$.pop(),f0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function O7($){if(c5){$();return}c5=!0;try{$()}finally{c5=!1,b$.forEach((Z)=>Z()),b$.clear()}}function L7($){wG.push($)}function F7($){AG.push($)}function C$($){return typeof $==="function"&&$._isSignal===!0}function v$($){return typeof $==="function"&&$._isDerived===!0}function V7($){if(C$($)||v$($))return $();return $}function x$($){let Z=f0;f0=null;try{return $()}finally{f0=Z}}function NG($,Z){let Y=typeof $==="function"?$:()=>$,J=S$([]),X=y$(()=>J().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return P$(()=>{if(Y(),!Q){Q=!0;return}if(x$(()=>J().length))J.set([])}),[X,(K,q)=>{let z={action:K};J.set([...J(),z]);let W=()=>{let U=J().filter((B)=>B!==z);if(U.length!==J().length)J.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(W,W);return W}]}var f0=null,k$,c5=!1,b$,wG,AG;var w7=y(()=>{k$=[],b$=new Set,wG=[],AG=[]});var c9={};r(c9,{useOptimistic:()=>NG,untrack:()=>V7,state:()=>S$,peek:()=>x$,onMount:()=>L7,onDestroy:()=>F7,isSignal:()=>C$,isDerived:()=>v$,generateSignalsRuntimeDev:()=>f$,generateSignalsRuntime:()=>l9,effect:()=>P$,derived:()=>y$,default:()=>TG,batch:()=>O7});function l9(){try{let $=RG(f$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return f$()}}function RG($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function f$(){return`
|
|
783
|
+
${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function QG($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=J.indexOf("{");if(Q!==-1){if(y0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
|
|
784
|
+
${G}`,X++}return{functionCode:J,nextIndex:X}}function b9($,Z){let Y=J0($,Z)??J0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...m5.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,Y){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,K]=Q;try{let q=K.trim().replace(/;$/,""),z=b9(q,Z);if(z!==void 0)Z[G]=z}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),z=b9(q,Z);if(z!==void 0)Z[G]=z}catch{}}}function v9($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function x9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var p5=y(()=>{u5();E1();T0()});var _7={};r(_7,{renderSlot:()=>g9,processSlots:()=>d9,parseSlots:()=>f9,parseSlotElement:()=>UG,extractSlotContent:()=>jG,applySlots:()=>HG});function KG($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function zG($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function WG($){let Z=[],Y=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let B=$.indexOf("-->",Q+4);X=B===-1?$.length:B+3;continue}let G=zG($,Q+1);if(G===-1)break;let K=$.slice(Q,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){X=G;continue}let z=q[1]==="/",W=q[2].toLowerCase();if(z){let B=Y.lastIndexOf(W);if(B!==-1)Y.splice(B);X=G;continue}if(W==="template"&&Y.length===0){let B=K.match(J);if(B){let _=KG($,G);if(_!==-1){let j=B[1]||B[2]||B[3];Z.push({start:Q,end:_,slotName:j,content:$.slice(G,_-11).trim(),propsBinding:B[4]||void 0}),X=_;continue}}}if(!/\/\s*>$/.test(K)&&!qG.has(W)){if(Y.push(W),W==="script"||W==="style"){let B=$.toLowerCase().indexOf(`</${W}>`,G);if(B!==-1){X=B;continue}}}X=G}return Z}function f9($){let Z={default:"",named:new Map},Y=$,J=WG($);for(let q of J)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});J.sort((q,z)=>z.start-q.start);for(let q of J)Y=Y.slice(0,q.start)+Y.slice(q.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[q,z,W,U,B,_]=G,j=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(j+H).trim(),F=`<${z}${L?" "+L:""}>${_}</${z}>`;X.push({start:G.index,end:G.index+q.length,slotName:U,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,z,W,U,B]=G,_=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+j).trim(),L=`<${z}${H?" "+H:""} />`;X.push({start:G.index,end:G.index+q.length,slotName:U,element:L})}X.sort((q,z)=>z.start-q.start);for(let q of X){let z=Z.named.get(q.slotName);if(z)z.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function UG($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function g9($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[z,W]=q.split(":").map((B)=>B.trim()),U=W||z;if(Z[z]!==void 0)G[U]=Z[z]}}else G[Q]=Z;X=BG(X,G)}return X}function BG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=h9(X,Z);return c0(String(Q??""))}catch{return`{{ ${J} }}`}})}function h9($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!G0($))return;return K0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function d9($,Z,Y){let J=$;J=await _G(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,z)=>{let W=Z.named.get(K),U=z?.trim()||"",B=q||"",_={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(B))!==null){let L=H[1],F=H[2];_[L]=h9(F,Y)}return await g9(W,_,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),J}async function _G($,Z,Y){let J=[],X=[];$.replace(Z,(K,...q)=>{let z=q[q.length-2];return X.push({match:K,index:z}),J.push(Y(K,...q.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:q,index:z}=X[K];G=G.slice(0,z)+Q[K]+G.slice(z+q.length)}return G}function jG($){let Z=f9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function HG($,Z,Y,J){return await d9($,{default:Z,named:Y},J)}var qG;var j7=y(()=>{Z1();T0();qG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function L1($,Z){let Y=OG($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function OG($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=y0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function LG($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function v1($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let q=G.exec($),z=K.exec($),W=q?q.index:1/0,U=z?z.index:1/0;if(W<U)X++,Q=W+q[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+z[0].length}else break}return-1}function u9($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=L1($,J);if(!X)return null;let Q=X.endPos,G=v1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],z=0,W="if",U=X.expression,B=0,_=0;while(z<K.length){let j=K.indexOf("@",z);if(j===-1)break;z=j;let H=K.substring(j);if(LG(K,j)){z++;continue}if(/^@if\s*\(/.test(H)){_++,z++;continue}if(/^@endif(?![a-z])/.test(H)){_--,z+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:W,condition:U,content:K.substring(B,z),start:Q+B,end:Q+z});let F=z+L[0].length,O=L1(K,F);if(!O){z++;continue}W="elseif",U=O.expression,z=O.endPos,B=z;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:W,condition:U,content:K.substring(B,z),start:Q+B,end:Q+z}),W="else",U=void 0,z+=5,B=z;continue}}z++}return q.push({type:W,condition:U,content:K.slice(B),start:Q+B,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function l5($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=u9($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function D$($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=X.exec($);continue}let K=Q.index,q=K+Q[0].length-1,z=y0($,"(",")",q);if(z===-1){Q=X.exec($);continue}let W=$.slice(q+1,z),U=z+1,B=v1($,Z,Y,U);if(B===-1){Q=X.exec($);continue}let _=$.slice(U,B),j=B+`@${Y}`.length;J.push({fullMatch:$.slice(K,j),name:Z,params:W,content:_,start:K,end:j}),X.lastIndex=j,Q=X.exec($)}return J}function H7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=L1($,J);if(!X)return null;let Q=X.endPos,G=v1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],z=0,W=null,U=0;while(z<K.length){let B=K.slice(z),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(U++,W)W.content+=_[0];z+=_[0].length;continue}if(j){if(U--,W)W.content+=j[0];z+=j[0].length;continue}if(U>0){if(W)W.content+=K[z];z++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(W)q.push(W);let O=z+H[0].length,V=L1(K,O);if(!V){z++;continue}W={type:"case",value:V.expression,content:""},z=V.endPos}else if(L&&B.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},z+=L[0].length}else if(F&&B.startsWith("@break"))z+=F[0].length;else{if(W)W.content+=K[z];z++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:q,start:Z,end:G+10}}var m9=()=>{};var p9=()=>{};var E$=y(()=>{m9();p9()});function S$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(f0)J.add(f0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),c5)J.forEach((K)=>b$.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),X}function y$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,c5)J.forEach((G)=>b$.add(G));else J.forEach((G)=>G())},Q=()=>{if(f0)J.add(f0);if(Y){let G=f0;f0=X,k$.push(X);try{Z=$()}finally{k$.pop(),f0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Q}function P$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=f0;f0=X,k$.push(X);try{Y=$()}finally{k$.pop(),f0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function O7($){if(c5){$();return}c5=!0;try{$()}finally{c5=!1,b$.forEach((Z)=>Z()),b$.clear()}}function L7($){AG.push($)}function F7($){NG.push($)}function C$($){return typeof $==="function"&&$._isSignal===!0}function v$($){return typeof $==="function"&&$._isDerived===!0}function V7($){if(C$($)||v$($))return $();return $}function x$($){let Z=f0;f0=null;try{return $()}finally{f0=Z}}function RG($,Z){let Y=typeof $==="function"?$:()=>$,J=S$([]),X=y$(()=>J().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return P$(()=>{if(Y(),!Q){Q=!0;return}if(x$(()=>J().length))J.set([])}),[X,(K,q)=>{let z={action:K};J.set([...J(),z]);let W=()=>{let U=J().filter((B)=>B!==z);if(U.length!==J().length)J.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(W,W);return W}]}var f0=null,k$,c5=!1,b$,AG,NG;var w7=y(()=>{k$=[],b$=new Set,AG=[],NG=[]});var c9={};r(c9,{useOptimistic:()=>RG,untrack:()=>V7,state:()=>S$,peek:()=>x$,onMount:()=>L7,onDestroy:()=>F7,isSignal:()=>C$,isDerived:()=>v$,generateSignalsRuntimeDev:()=>f$,generateSignalsRuntime:()=>l9,effect:()=>P$,derived:()=>y$,default:()=>MG,batch:()=>O7});function l9(){try{let $=TG(f$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return f$()}}function TG($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function f$(){return`
|
|
785
785
|
// STX Signals Runtime (Development Build)
|
|
786
786
|
console.log('[stx] signals runtime loading');
|
|
787
787
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -2702,6 +2702,7 @@ catch (e2) {
|
|
|
2702
2702
|
Array.from(el.attributes).forEach(attr => {
|
|
2703
2703
|
const name = attr.name;
|
|
2704
2704
|
const value = attr.value;
|
|
2705
|
+
if (!name) return;
|
|
2705
2706
|
|
|
2706
2707
|
if (el.hasAttribute && (el.hasAttribute('x-class') || el.hasAttribute('@click'))) {
|
|
2707
2708
|
console.log('[stx] attr iter:', el.tagName, 'name:', name);
|
|
@@ -2734,9 +2735,34 @@ catch (e2) {
|
|
|
2734
2735
|
catch (e) { controlValue = String(v); }
|
|
2735
2736
|
}
|
|
2736
2737
|
controlValue = v === false || v === null || v === undefined ? '' : String(controlValue);
|
|
2737
|
-
el.
|
|
2738
|
-
|
|
2739
|
-
|
|
2738
|
+
el.__stx_bound_value = controlValue;
|
|
2739
|
+
var applyControlValue = function() {
|
|
2740
|
+
var desiredValue = el.__stx_bound_value == null ? '' : String(el.__stx_bound_value);
|
|
2741
|
+
el.value = desiredValue;
|
|
2742
|
+
if (desiredValue === '' && el.tagName !== 'OPTION') el.removeAttribute(attrName);
|
|
2743
|
+
else if (el.getAttribute(attrName) !== desiredValue) el.setAttribute(attrName, desiredValue);
|
|
2744
|
+
};
|
|
2745
|
+
applyControlValue();
|
|
2746
|
+
|
|
2747
|
+
// A select's value binding is processed before its child
|
|
2748
|
+
// directives. When a nested :for creates the matching options
|
|
2749
|
+
// afterward, the browser otherwise leaves the first option
|
|
2750
|
+
// selected. Keep the desired value and reapply it whenever the
|
|
2751
|
+
// option tree changes, including later reactive list updates.
|
|
2752
|
+
if (el.tagName === 'SELECT' && !el.__stx_value_observer && typeof window.MutationObserver !== 'undefined') {
|
|
2753
|
+
el.__stx_value_observer = new window.MutationObserver(applyControlValue);
|
|
2754
|
+
el.__stx_value_observer.observe(el, {
|
|
2755
|
+
childList: true,
|
|
2756
|
+
subtree: true,
|
|
2757
|
+
attributes: true,
|
|
2758
|
+
attributeFilter: ['value'],
|
|
2759
|
+
});
|
|
2760
|
+
el.__stx_destroy = el.__stx_destroy || [];
|
|
2761
|
+
el.__stx_destroy.push(function() {
|
|
2762
|
+
if (el.__stx_value_observer) el.__stx_value_observer.disconnect();
|
|
2763
|
+
el.__stx_value_observer = null;
|
|
2764
|
+
});
|
|
2765
|
+
}
|
|
2740
2766
|
return;
|
|
2741
2767
|
}
|
|
2742
2768
|
if (v === false || v === null || v === undefined) {
|
|
@@ -3971,7 +3997,11 @@ catch (e2) {
|
|
|
3971
3997
|
const content = el.content;
|
|
3972
3998
|
currentNodes = Array.from(content.childNodes).map(n => n.cloneNode(true));
|
|
3973
3999
|
// Insert cloned content initially
|
|
3974
|
-
|
|
4000
|
+
// Capture the anchor once. Re-reading placeholder.nextSibling after
|
|
4001
|
+
// every insertion points at the node just inserted and reverses a
|
|
4002
|
+
// multi-root template branch.
|
|
4003
|
+
const initialAnchor = placeholder.nextSibling;
|
|
4004
|
+
currentNodes.forEach(node => parent.insertBefore(node, initialAnchor));
|
|
3975
4005
|
el.remove(); // Remove the template element itself
|
|
3976
4006
|
}
|
|
3977
4007
|
|
|
@@ -4052,7 +4082,8 @@ catch (e2) {
|
|
|
4052
4082
|
if (value && !isInserted) {
|
|
4053
4083
|
// Re-insert cloned content
|
|
4054
4084
|
currentNodes = Array.from(el.content.childNodes).map(n => n.cloneNode(true));
|
|
4055
|
-
|
|
4085
|
+
const insertionAnchor = placeholder.nextSibling;
|
|
4086
|
+
currentNodes.forEach(node => parent.insertBefore(node, insertionAnchor));
|
|
4056
4087
|
// Process the new nodes \u2014 use LIVE componentScope so all functions are available
|
|
4057
4088
|
const childScope = { ...componentScope, ...(capturedElementScope || {}) };
|
|
4058
4089
|
currentNodes.forEach(node => {
|
|
@@ -5195,7 +5226,8 @@ catch (e) {}
|
|
|
5195
5226
|
var scopeId = el.getAttribute('data-stx-scope');
|
|
5196
5227
|
var scopeVars = window.stx._scopes && window.stx._scopes[scopeId];
|
|
5197
5228
|
if (!scopeVars) return;
|
|
5198
|
-
el.__stx_parent_scope =
|
|
5229
|
+
el.__stx_parent_scope = el.__stx_parent_scope
|
|
5230
|
+
|| resolveComponentCallerScope(el, componentScope);
|
|
5199
5231
|
bindParentComponentProps(el, el.__stx_parent_scope);
|
|
5200
5232
|
Object.assign(componentScope, scopeVars);
|
|
5201
5233
|
el.__stx_disposers = trackEffects(function() { processElement(el, componentScope); });
|
|
@@ -6057,7 +6089,8 @@ else {
|
|
|
6057
6089
|
// Forwarded props and events belong to the caller. Capture its scope
|
|
6058
6090
|
// before this component's locals are merged, so identical child names
|
|
6059
6091
|
// cannot shadow expressions such as :total-items="totalItems".
|
|
6060
|
-
el.__stx_parent_scope =
|
|
6092
|
+
el.__stx_parent_scope = el.__stx_parent_scope
|
|
6093
|
+
|| resolveComponentCallerScope(el, pageScopeSnapshot);
|
|
6061
6094
|
bindParentComponentProps(el, el.__stx_parent_scope);
|
|
6062
6095
|
|
|
6063
6096
|
// Merge component scope vars into componentScope (don't restore - keep for head elements)
|
|
@@ -6438,7 +6471,8 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
6438
6471
|
return;
|
|
6439
6472
|
}
|
|
6440
6473
|
if (!scopeVars) return;
|
|
6441
|
-
el.__stx_parent_scope =
|
|
6474
|
+
el.__stx_parent_scope = el.__stx_parent_scope
|
|
6475
|
+
|| resolveComponentCallerScope(el, spaPageScopeSnapshot);
|
|
6442
6476
|
bindParentComponentProps(el, el.__stx_parent_scope);
|
|
6443
6477
|
Object.assign(componentScope, scopeVars);
|
|
6444
6478
|
if (el.__stx_disposers) return;
|
|
@@ -6526,13 +6560,13 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
|
|
|
6526
6560
|
}
|
|
6527
6561
|
}
|
|
6528
6562
|
})();
|
|
6529
|
-
`}var
|
|
6563
|
+
`}var MG;var i9=y(()=>{w7();w7();MG={state:S$,derived:y$,effect:P$,batch:O7,onMount:L7,onDestroy:F7,isSignal:C$,isDerived:v$,untrack:V7,peek:x$,generateSignalsRuntime:l9,generateSignalsRuntimeDev:f$}});var A7={};r(A7,{templateCache:()=>n9,readFileCached:()=>IG,invalidateFileCacheByDir:()=>EG,invalidateFileCache:()=>DG,hashFilePath:()=>i5,getCachedSignalsRuntime:()=>SG,getCachedRouterScript:()=>yG,clearDevCaches:()=>PG,checkCache:()=>CG,cacheTemplate:()=>vG,__setSignalsGeneratorsForTest:()=>bG});import F1 from"fs";import Y5 from"path";async function IG($){let Y;for(let J=0;J<3;J++)try{let Q=(await F1.promises.stat($)).mtime.getTime(),G=x1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),z=(await F1.promises.stat($)).mtime.getTime();if(z!==Q)continue;return x1.set($,{content:K,mtime:z}),K}catch(X){Y=X;break}throw x1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function DG($){x1.delete($)}function EG($){for(let Z of x1.keys())if(Z.startsWith($))x1.delete(Z)}function bG($){o9=$}async function SG($=!1){let Z=o9??await Promise.resolve().then(() => (i9(),c9));if($)return Z.generateSignalsRuntimeDev();if(g$===null)g$=Z.generateSignalsRuntime();return g$}async function yG(){if(h$===null){let{getRouterScript:$}=await import("stx-router");h$=$()}return h$}function PG(){x1.clear(),r9(),g$=null,kG=null,h$=null}function s9($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function CG($,Z){try{if(!Z.cachePath)return null;let Y=Y5.resolve(Z.cachePath),J=Y5.join(Y,`${i5($)}.html`),X=Y5.join(Y,`${i5($)}.meta.json`);if(!await n(J)||!await n(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==s9(Z))return null;if((await F1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await n(q)){if((await F1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function vG($,Z,Y,J){try{if(!J.cachePath)return;let X=Y5.resolve(J.cachePath);await F1.promises.mkdir(X,{recursive:!0});let Q=Y5.join(X,`${i5($)}.html`),G=Y5.join(X,`${i5($)}.meta.json`),K=await F1.promises.stat($);await Bun.write(Q,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:s9(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),n9.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function i5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,xG)}var n9,x1,g$=null,kG=null,o9=null,h$=null,xG=16;var N7=y(()=>{N0();n9=new Map,x1=new Map});function a9($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",J;while((J=Z.exec($))!==null)Y+=J[1]+`
|
|
6530
6564
|
`;let X=/\{\{([\s\S]*?)\}\}/g;while((J=X.exec($))!==null)Y+=J[1]+`
|
|
6531
6565
|
`;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Y)}),K=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"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,z,W=!1;while((z=q.exec(Y))!==null)if(!K.has(z[1])){W=!0;break}if(!G&&!W)return $;let U=`<script type="module">
|
|
6532
6566
|
// STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
|
|
6533
6567
|
import '@stacksjs/browser'
|
|
6534
|
-
</script>`;if($.includes("</head>")){let B=$.indexOf("</head>"),
|
|
6535
|
-
`+$.slice(
|
|
6568
|
+
</script>`;if($.includes("</head>")){let B=$.indexOf("</head>"),j=$.slice(0,B).indexOf("<script");if(j!==-1)return $.slice(0,j)+U+`
|
|
6569
|
+
`+$.slice(j);return $.replace("</head>",`${U}
|
|
6536
6570
|
</head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
6537
6571
|
${U}`);return U+`
|
|
6538
6572
|
`+$}async function t9($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
@@ -6544,34 +6578,34 @@ ${U}`);return U+`
|
|
|
6544
6578
|
`+X+$.slice(K+1)}return X+`
|
|
6545
6579
|
`+$}async function R7($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
|
|
6546
6580
|
`}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (N7(),A7)),Q=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await X()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
|
|
6547
|
-
</body>`+$.slice(G+7)}var p$={};r(p$,{scanScriptTags:()=>G8,rewriteStxImportSpecifiers:()=>W8,processSignals:()=>E7,processScriptSetup:()=>q8,preEvalLiteralReactiveIfs:()=>I7,parseLoopExpression:()=>K8,hasSignalsSyntax:()=>m$,findMarkupIndexOutsideScripts:()=>u$,extractExports:()=>z8,convertSignalLoopsToAttributes:()=>D7,convertSignalDirectivesToAttributes:()=>M7});function G8($,Z={}){let Y=[],J=0;while(J<$.length){$8.lastIndex=J;let X=$8.exec($);if(!X)break;let Q=$.indexOf("<!--",J);if(Q!==-1&&Q<X.index){let W=$.indexOf("-->",Q+4);if(W===-1)break;J=W+3;continue}let G=X[1],K=X.index+X[0].length,q=$.toLowerCase().indexOf("</script>",K);if(q===-1)break;let z=q+9;if(Z.skipAttrs&&Z.skipAttrs.test(G)){J=z;continue}Y.push({fullMatch:$.slice(X.index,z),attrs:G,body:$.slice(K,q),start:X.index,end:z}),J=z}return Y}function K8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=Z8(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=Z8(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Z8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let X=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(X)return{itemVar:X[1],indexVar:X[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function m$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function
|
|
6548
|
-
`)}else{if(!J8(
|
|
6549
|
-
`)W++;return W},q=()=>{let W=J+2;while(W<Q-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Q},z=(W)=>{let U=W,B=0;while(U<Q){let
|
|
6550
|
-
`)
|
|
6551
|
-
${
|
|
6581
|
+
</body>`+$.slice(G+7)}var p$={};r(p$,{scanScriptTags:()=>G8,rewriteStxImportSpecifiers:()=>W8,processSignals:()=>E7,processScriptSetup:()=>q8,preEvalLiteralReactiveIfs:()=>I7,parseLoopExpression:()=>K8,hasSignalsSyntax:()=>m$,findMarkupIndexOutsideScripts:()=>u$,extractExports:()=>z8,convertSignalLoopsToAttributes:()=>D7,convertSignalDirectivesToAttributes:()=>M7});function G8($,Z={}){let Y=[],J=0;while(J<$.length){$8.lastIndex=J;let X=$8.exec($);if(!X)break;let Q=$.indexOf("<!--",J);if(Q!==-1&&Q<X.index){let W=$.indexOf("-->",Q+4);if(W===-1)break;J=W+3;continue}let G=X[1],K=X.index+X[0].length,q=$.toLowerCase().indexOf("</script>",K);if(q===-1)break;let z=q+9;if(Z.skipAttrs&&Z.skipAttrs.test(G)){J=z;continue}Y.push({fullMatch:$.slice(X.index,z),attrs:G,body:$.slice(K,q),start:X.index,end:z}),J=z}return Y}function K8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=Z8(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=Z8(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Z8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let X=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(X)return{itemVar:X[1],indexVar:X[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function m$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function gG($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let X=J[1];if(X.startsWith("if"))Y++;else if(X==="endif")Y--;else if(Y===0)return!0}return!1}function hG($){let Z=new Set,Y=/<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,X;while((X=Y.exec($))!==null){let Q=X[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function dG($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function J8($,Z,Y){if(!$)return!1;let J=dG($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(J))!==null){let B=q[1];if(J.slice(0,q.index).trimEnd().endsWith("."))continue;if(Y8.has(B))continue;if(Z.has(B))X=!0;else if(Y&&B in Y)Q=!0}let z=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,W;while((W=z.exec(J))!==null){let B=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(Y8.has(B)||Y&&B in Y)continue;G=!0}return(X||G)&&!Q}function d$($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,""")}"`,X=$.trim(),Q=X.match(Q8);if(Q&&uG(Q[3],Q[1])){let[,G,K,q]=Q;return`<${G}${K}${J}>${q}</${G}>`}return`<template${J}>${X}</template>`}function uG($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,X;while((X=Y.exec($))!==null)if(X[1]){if(J--,J<0)return!1}else J++;return!0}function M7($,Z){let Y=hG($);function J(X){let Q=X,G=/@if\s*\(/g,K,q=[];while((K=G.exec(Q))!==null){let z=K.index,W=z+K[0].length,U=1,B=W;while(B<Q.length&&U>0){if(Q[B]==="(")U++;else if(Q[B]===")")U--;B++}if(U!==0)continue;let _=Q.substring(W,B-1).trim(),j=B,H=1,L=j,F=/@(if\s*\(|endif)/g;F.lastIndex=j;let O;while((O=F.exec(Q))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=Q.substring(j,L-6).trim(),w;if(gG(V)){let A=l5(Q.substring(z,L));if(A.length===0)continue;let N=A[0].branches.filter((M)=>M.type!=="else");if(!(N.length>0&&N.every((M)=>J8(M.condition,Y,Z))))continue;w=A[0].branches.map((M)=>{let I=J(M.content);if(M.type==="elseif")return d$(I,"@else-if",M.condition??"");if(M.type==="else")return d$(I,"@else");return d$(I,"@if",M.condition??"")}).join(`
|
|
6582
|
+
`)}else{if(!J8(_,Y,Z))continue;w=d$(J(V),"@if",_)}q.push({start:z,end:L,replacement:w}),G.lastIndex=L}for(let z=q.length-1;z>=0;z--){let{start:W,end:U,replacement:B}=q[z];Q=Q.substring(0,W)+B+Q.substring(U)}return Q}return J($)}function mG($){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 X=Number(Z);return X!==0&&!Number.isNaN(X)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function pG($,Z,Y,J){if(T7.has(Y.toLowerCase()))return J;let X=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,q=J;while(q<G){let z=$.indexOf("<",q);if(z===-1)return-1;if(q=z,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let W=/^<(script|style)\b/i.exec($.slice(q,q+8));if(W){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let j=Q.indexOf(`</${W[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===X){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!U){q++;continue}let B=$.indexOf(">",q);if(B===-1)return-1;if(U[1].toLowerCase()===X){let _=$.slice(q,B+1);if(!(/\/\s*>$/.test(_)||T7.has(X)))K++}q=B+1}return-1}function cG($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let X=$.indexOf(">",Y);if(X===-1)return!1;let Q=$.slice(Y,X+1);return lG.test(Q)}function I7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let X=(U)=>Z.some(([B,_])=>U>=B&&U<_),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=[],K;while((K=Q.exec($))!==null){if(X(K.index))continue;let[U,B,_,j,H,L,F]=K,O=mG(H);if(O===void 0)continue;let V=K.index,w=V+U.length,R=!!F||/\/\s*>$/.test(U)||T7.has(B.toLowerCase())?w:pG($,V,B,w);if(R===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&cG($,R)){Q.lastIndex=w;continue}if(O===!0){let M=`<${B}${_}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:R,replacement:""}),Q.lastIndex=R}if(G.length===0)return $;G.sort((U,B)=>U.start-B.start);let q=[],z=-1;for(let U of G){if(U.start<z)continue;q.push(U),z=U.end}let W=$;for(let U=q.length-1;U>=0;U--){let{start:B,end:_,replacement:j}=q[U];W=W.substring(0,B)+j+W.substring(_)}return W}function D7($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,X,Q=[];while((X=J.exec(Y))!==null){let G=X[1],K=X.index,q=K+X[0].length,z=1,W=q;while(W<Y.length&&z>0){if(Y[W]==="(")z++;else if(Y[W]===")")z--;W++}if(z!==0)continue;let U=Y.substring(q,W-1).trim(),B=W,_=K8(U);if(_.iterable){let N=_.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let R=N.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(_.style==="as")U=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-j.length).trim(),w=V.match(Q8),A;if(w){let[,N,R,T]=w;A=`<${N}${R} @for="${U}">${T}</${N}>`}else A=`<template @for="${U}">${V}</template>`;Q.push({start:K,end:L,replacement:A})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=Q[G];Y=Y.substring(0,K)+z+Y.substring(q)}return Y}function iG($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(W)=>{let U=J+1;while(U<Q){let B=$[U];if(B==="\\"){U+=2;continue}if(B===W)return U+1;U++}return Q},K=()=>{let W=J+2;while(W<Q&&$[W]!==`
|
|
6583
|
+
`)W++;return W},q=()=>{let W=J+2;while(W<Q-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Q},z=(W)=>{let U=W,B=0;while(U<Q){let _=$[U];if(_==="/"&&$[U+1]==="/"){let j=U+2;while(j<Q&&$[j]!==`
|
|
6584
|
+
`)j++;U=j;continue}if(_==="/"&&$[U+1]==="*"){let j=U+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;U=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=U+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}U=j;continue}if(_==="("||_==="["||_==="{"){B++,U++;continue}if(_===")"||_==="]"||_==="}"){B--,U++;continue}if(_===";"&&B===0)return U+1;U++}return Q};while(J<Q){let W=$[J];if(W==="/"&&$[J+1]==="/"){let U=K();Y.push($.slice(J,U)),J=U;continue}if(W==="/"&&$[J+1]==="*"){let U=q();Y.push($.slice(J,U)),J=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);Y.push($.slice(J,U)),J=U;continue}if(W==="{"){X++,Y.push(W),J++;continue}if(W==="}"){X--,Y.push(W),J++;continue}if(X===0){let U=J>0?$[J-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let _=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let j=_[2],H=z(J+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),J=H;continue}Z.add(j),Y.push($.slice(J,H)),J=H;continue}}}Y.push(W),J++}return Y.join("")}async function q8($,Z,Y){let J=G8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let L of J){let F=L.body;if(b1(L.attrs))F=S1(F);if(X.test(F))Q.push({fullMatch:L.fullMatch,attrs:L.attrs,content:F})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${fG++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (E5(),D5)),z=[];for(let L=0;L<Q.length;L++){let F=Q[L].content;if(K(F))console.log("[stx:bundler] bundling signal script imports"),F=await q(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>W8(w));let O=l0(F);z.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
|
|
6585
|
+
${O}`)}let W=z.join(`
|
|
6552
6586
|
|
|
6553
|
-
`);W=
|
|
6587
|
+
`);W=iG(W);let U=z8(W),B=U.split(",").map((L)=>L.trim()).filter(Boolean),_=_$(W,Y),j=`
|
|
6554
6588
|
<script data-stx-scoped>
|
|
6555
6589
|
function ${G}() {
|
|
6556
|
-
${a1("const")}
|
|
6557
|
-
${
|
|
6590
|
+
${a1("const",B)}
|
|
6591
|
+
${_}${W}
|
|
6558
6592
|
return { ${U} };
|
|
6559
6593
|
}
|
|
6560
6594
|
window.__stx_latestSetup=${G};
|
|
6561
6595
|
if(window.stx)window.stx._latestSetup=${G};
|
|
6562
|
-
</script>`,
|
|
6563
|
-
`)return;Q++}},z=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},W=(
|
|
6564
|
-
`)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},
|
|
6565
|
-
${X.slice(W)}`;else if(U!==-1){let B=/<body[^>]*>/i.exec(X.slice(U))[0],
|
|
6566
|
-
${G}${X.slice(
|
|
6567
|
-
${G}`}let q=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),z=q&&/data-stx/.test(q[1]);if(!G&&!z&&q&&!/data-stx-auto/.test(q[1])){let W=/<body[^>]*>/i,U=u$(X,W);if(U!==-1){let B=X.slice(0,U),
|
|
6568
|
-
`)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},z=()=>{if(J!==0)return;let W=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let
|
|
6596
|
+
</script>`,H=$;for(let L of Q)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${e9})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],F=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${e9})>`,"gi"),(O,V,w)=>{if(F||L.includes(V.toLowerCase()))return O;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:H,setupCode:j}}function z8($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K="",q=()=>{Q++;let j=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!j){j=!0,Q++;continue}if(H==="]"&&j){j=!1,Q++;continue}if(H==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
|
|
6597
|
+
`)return;Q++}},z=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},W=(j)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===j){Q++;return}Q++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let j=1;while(Q<G&&j>0)if(Z[Q]==="{")j++,Q++;else if(Z[Q]==="}")j--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')W(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},B=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
6598
|
+
`)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},_=()=>{if(X!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!J.has(V))Y.push(V),J.add(V);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!J.has(R))Y.push(R),J.add(R)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!J.has(V))Y.push(V),J.add(V);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!J.has(V))Y.push(V),J.add(V)}};while(Q<G){if(B())continue;if(Z[Q]==="'"||Z[Q]==='"'){W(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&z()){q(),K="/";continue}if(Z[Q]==="{"){X++,K="{",Q++;continue}if(Z[Q]==="}"){X--,K="}",Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))_();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function E7($,Z,Y,J){if(!m$($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await q8(X,Y,J);if(X=Q,X=await t9(X,Z),X=a9(X),G){let W=u$(X,/<\/head>/i),U=W===-1?u$(X,/<body[^>]*>/i):-1;if(W!==-1)X=`${X.slice(0,W)}${G}
|
|
6599
|
+
${X.slice(W)}`;else if(U!==-1){let B=/<body[^>]*>/i.exec(X.slice(U))[0],_=U+B.length;X=`${X.slice(0,_)}
|
|
6600
|
+
${G}${X.slice(_)}`}else X=`${X}
|
|
6601
|
+
${G}`}let q=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),z=q&&/data-stx/.test(q[1]);if(!G&&!z&&q&&!/data-stx-auto/.test(q[1])){let W=/<body[^>]*>/i,U=u$(X,W);if(U!==-1){let B=X.slice(0,U),_=X.slice(U).replace(W,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=B+_}}return X}function u$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],X;while((X=Y.exec($))!==null)J.push([X.index,X.index+X[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!J.some(([W,U])=>q>=W&&q<U))return q;G=q+Math.max(K[0].length,1)}return-1}function W8($){let Z=[];for(let Y of $.split(",")){let J=Y.trim();if(!J||J.startsWith("type "))continue;let X=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X&&X[1]!==X[2])Z.push(`${X[2]} = ${X[1]}`)}if(Z.length===0)return X8;return`var ${Z.join(", ")}; ${X8}`}var fG=0,e9=`(?:"[^"]*"|'[^']*'|[^>"'])*`,$8,Q8,Y8,T7,lG,X8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var n5=y(()=>{y5();E$();f5();N0();$8=/<script\b([^>]*)>/gi,Q8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;Y8=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"]);T7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);lG=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import nG from"fs";import h from"path";function U8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function sG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function b1($){return!sG($)}function S1($){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 Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function rG($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(W)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===W){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let W=1;while(X<Q&&W>0)if($[X]==="{")W++,X++;else if($[X]==="}")W--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},q=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
|
|
6602
|
+
`)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},z=()=>{if(J!==0)return;let W=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let j=W[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(X<Q){if(q())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){J++,X++;continue}if($[X]==="}"){J--,X++;continue}if(J===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))z();X++}return Z}function aG($){let Z=[],Y=0,J=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function tG($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function eG($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let X=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 K=$.slice(G+1,X);for(let q of aG(K)){let z=q.trim();if(!z||z.startsWith("..."))continue;let W=tG(z);if(W===-1)continue;let U=z.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let B=z.slice(W+1).trim();if(!B)continue;try{let _=Object.keys(Z),j=Function(..._,`"use strict"; return (${B});`);Z[U]=j(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function c$($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[Q,Q.toLowerCase(),G(Q),K(Q)])if(q.has(L))return!0}let z=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],W=typeof X.root==="string"?h.resolve(X.root):void 0,U=W??h.dirname(J),B=[],_=(L)=>{if(L&&!B.includes(L))B.push(L)},j=Y.__originalFilePath;if(j)_(h.join(h.dirname(j),"components"));_(Z),_(X._rootComponentsDir),_(h.join(h.dirname(J),"components")),_(X.componentsDir);let H=X._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(W)_(h.resolve(W,"resources/views/components")),_(h.resolve(W,"resources/components")),_(h.resolve(W,"src/components")),_(h.resolve(W,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return n(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of B){let F=h.isAbsolute(L)?L:h.resolve(U,L);for(let O of z)if(await n(h.join(F,O)))return!0}return!1}function $K($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function ZK($){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 YK($){let Z=new Set,Y=/\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 X;while((X=Y.exec(J))!==null)Z.add(X[1]);Y.lastIndex=0}return[...Z]}async function f1($,Z,Y,J,X,Q,G,K=new Set,q){let{extractVariables:z}=await Promise.resolve().then(() => (p5(),I$)),W=K??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=B&&B!=="load"&&$K(B)?B:"";try{let j=(u)=>u.split("-").map((S)=>S.charAt(0).toUpperCase()+S.slice(1)).join(""),H=(u)=>u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=X.__importedComponents;if(O){let u=[L,L.toLowerCase(),j(L),H(L)];for(let S of u)if(O.has(S)){F=O.get(S);break}}let V=[];if(!F){let u=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],S=[...new Set(u)],v=X.__originalFilePath,x=[];if(v){let U0=h.join(h.dirname(v),"components");x.push(U0)}if(J)x.push(J);let p=G._rootComponentsDir;if(typeof p==="string"&&!x.includes(p))x.push(p);let t=h.join(h.dirname(Q),"components");if(!x.includes(t))x.push(t);if(G.componentsDir&&G.componentsDir!==J&&!x.includes(G.componentsDir))x.push(G.componentsDir);let w0=G._pluginComponentDirs;if(Array.isArray(w0)){for(let U0 of w0)if(typeof U0==="string"&&!x.includes(U0))x.push(U0)}let S0=typeof G.root==="string"?h.resolve(G.root):void 0,v0=S0??h.dirname(Q),t0=[];if(S0)t0.push(h.resolve(S0,"resources/views/components")),t0.push(h.resolve(S0,"resources/components")),t0.push(h.resolve(S0,"src/components")),t0.push(h.resolve(S0,"components"));t0.push(h.resolve(import.meta.dir,"components"));for(let U0 of t0)if(!x.includes(U0))x.push(U0);let V5=[...new Set(x.map((U0)=>{if(!U0)return U0;return h.isAbsolute(U0)?U0:h.resolve(v0,U0)}))];if(x.length=0,x.push(...V5),L.startsWith("./")||L.startsWith("../"))F=h.resolve(h.dirname(Q),`${L}.stx`),V.push(F);else for(let U0 of x){if(!U0)continue;for(let Q1 of S){let e0=h.join(U0,Q1);if(V.push(e0),await n(e0)){F=e0;break}}if(F)break;if(!F)try{let Q1=await import("fs");if(!Q1.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let w5=8,G1=[{path:U0,depth:0}];while(G1.length>0&&!F){let l=G1.pop();if(l.depth>=w5)continue;let $1;try{$1=Q1.readdirSync(l.path,{withFileTypes:!0})}catch{continue}for(let A5 of $1){if(!A5.isDirectory())continue;if(A5.name==="node_modules"||A5.name.startsWith("."))continue;let v6=h.join(l.path,A5.name);for(let EX of S){let r4=h.join(v6,EX);if(V.push(r4),await n(r4)){F=r4;break}}if(F)break;G1.push({path:v6,depth:l.depth+1})}}}catch{}if(F)break}}if(!F||!await n(F)){let u=V.length>0?`
|
|
6569
6603
|
Searched paths:
|
|
6570
|
-
${
|
|
6571
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${u}`}q.add(
|
|
6572
|
-
`)}`}if(Y&&m.includes("{{ text || slot }}"))m=m.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:z0}=await Promise.resolve().then(() => (
|
|
6604
|
+
${V.map((S)=>` - ${S}`).join(`
|
|
6605
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${u}`}q.add(F);let w;if(l$.has(F))w=l$.get(F);else try{w=await Bun.file(F).text(),l$.set(F,w)}catch(u){return`[Error loading component: ${u instanceof Error?u.message:String(u)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[u,S]of Object.entries(X))if(!u.startsWith("__")||A.has(u))N[u]=S;let{extractSlotContent:R}=await Promise.resolve().then(() => (j7(),_7)),T=R(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[u,S]of T.namedSlots)M[u]=S.content;let I={...N,...Z,props:Z,slot:Y,$slots:M,__processedComponents:U,__sections:{},...ZK(Y)&&{__stx_force_signals:!0}};eG(w,I);let E=w,k=R$(E);if(k)E=k.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...w.matchAll(C)],D=[];for(let u of b){let S=u[1]||"",v=u[2]||"",x=S.includes("server");if(b1(S)&&v.trim())v=S1(v);if(x&&v)try{await z(v,I,F)}catch(t){}if(!x){let t=v.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),w0=t.includes("{{")&&t.includes("}}"),S0=t.includes("{!!")&&t.includes("!!}");if(w0||S0)t=w$(t,I);let v0=S.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");D.push(`<script${v0}>${t}</script>`)}}let P=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),f=P?P[1]:"",g=P?P[2]:"",d="",i=f&&/\bscoped\b/i.test(f);if(P)d=`<style${f}>${g}</style>`;let m=E;if(m=m.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),P)m=m.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let u=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,S=[];if(m=m.replace(u,(v,x)=>{let p=x.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(p)S.push(`<style${p[1]}>${p[2]}</style>`);return""}),m=m.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),S.length>0)d=`${d}${S.join(`
|
|
6606
|
+
`)}`}if(Y&&m.includes("{{ text || slot }}"))m=m.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:z0}=await Promise.resolve().then(() => (j7(),_7)),{defaultSlot:F0,namedSlots:_0}=T;m=await z0(m,F0,_0,I);for(let[u,S]of Object.entries(I))if(typeof S==="string"){if(S.includes("<")&&S.includes(">")||S.includes("<")||S.includes(""")){let v=X7(S);I[u]=v}}let Y0=D.some((u)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(u)),I0=YK(D);if(I0.length>0)I.__stx_client_signal_names=I0;let p0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:Y0||D.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let X1=await H0(m,I,F,p0,q),a0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let u of X1.matchAll(/\{\{([\s\S]*?)\}\}/g))a0.add(u[1].trim());if(a0.size>0)X.__stx_preserved_client_expressions=[...a0];let a=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++oG}_${Math.random().toString(36).slice(2,8)}`,e=X1;if(Y0){let u="";if(Object.keys(Z).length>0)try{u=` data-stx-props="${U8(JSON.stringify(Z))}"`}catch{}let S=_?` stx-hydrate="${U8(_)}"`:"";e=`<div data-stx-scope="${a}"${u}${S}>${X1}</div>`;let v=await Promise.all(D.map(async(x)=>{let p=x.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!p)return x;let[,t,w0]=p,S0=U$(w0,{filePath:F,projectRoot:process.cwd()}),v0=S0.code,t0=B$(S0.styles),{hasUserImports:V5,bundleClientScript:U0}=await Promise.resolve().then(() => (E5(),D5));if(V5(v0))v0=await U0(v0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:Q1}=await Promise.resolve().then(() => (n5(),p$));v0=v0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(l,$1)=>Q1($1));let e0=l0(v0),w5=rG(e0),G1=`
|
|
6573
6607
|
(function() {
|
|
6574
|
-
${a1("const",V9)}
|
|
6608
|
+
${a1("const",[...V9,...w5])}
|
|
6575
6609
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
6576
6610
|
const __scopeVars = __scope['${a}'] = __scope['${a}'] || {};
|
|
6577
6611
|
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
@@ -6584,12 +6618,12 @@ ${F.map((S)=>` - ${S}`).join(`
|
|
|
6584
6618
|
const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
|
|
6585
6619
|
|
|
6586
6620
|
try {
|
|
6587
|
-
${
|
|
6621
|
+
${e0}
|
|
6588
6622
|
|
|
6589
6623
|
// Register all defined signals and functions in this scope
|
|
6590
6624
|
const __localVars = {};
|
|
6591
6625
|
try {
|
|
6592
|
-
${
|
|
6626
|
+
${w5.map((l)=>`if (typeof ${l} !== 'undefined') __localVars['${l}'] = ${l};`).join(`
|
|
6593
6627
|
`)}
|
|
6594
6628
|
}
|
|
6595
6629
|
catch (e) {}
|
|
@@ -6598,14 +6632,14 @@ catch (e) {}
|
|
|
6598
6632
|
finally {
|
|
6599
6633
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
6600
6634
|
}
|
|
6601
|
-
})();`;if(
|
|
6635
|
+
})();`;if(_)return`${t0}<script type="stx/island" data-stx-island="${a}" data-stx-scoped${t}>${G1}</script>`;return`${t0}<script data-stx-scoped${t}>${G1}</script>`}));if(e=e+`
|
|
6602
6636
|
`+v.join(`
|
|
6603
6637
|
`),d)e+=`
|
|
6604
6638
|
`+d}else{if(d)e+=`
|
|
6605
|
-
`+d;if(D.length>0){let u=I.__stx_event_bindings||[],S=b5(I),v=await Promise.all(D.map(async(x)=>{let p=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!p)return x;return await S5(p[1],{eventBindings:u,templateContent:e,filePath:
|
|
6639
|
+
`+d;if(D.length>0){let u=I.__stx_event_bindings||[],S=b5(I),v=await Promise.all(D.map(async(x)=>{let p=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!p)return x;return await S5(p[1],{eventBindings:u,templateContent:e,filePath:F,projectRoot:process.cwd(),serverData:S})}));e+=`
|
|
6606
6640
|
`+v.join(`
|
|
6607
|
-
`),I.__stx_event_bindings=[]}}if(
|
|
6608
|
-
`),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){J=q+1,X=G[q].trim();let z=Math.max(0,q-2),W=Math.min(G.length,q+3);Q=G.slice(z,W).map((U,B)=>{let
|
|
6641
|
+
`),I.__stx_event_bindings=[]}}if(i){let u=N$(e,F);if(u.hasScoped)e=u.html}return e}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{W.delete($)}}async function n($){return Bun.file($).exists()}function k7($,Z){let Y=h.resolve(Z),J=h.resolve($),X=Y.endsWith(h.sep)?Y:Y+h.sep;if(J===Y||J.startsWith(X))return J;return null}async function b7($,Z,Y,J){let X=await JK($,Z,Y,J);if(X===null)return null;let Q=k7(X,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(k7(X,q))return h.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function JK($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let B=h.join(Q,$),_=k7(B,Q);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await n(_)&&J)J.add(_);return _}let G=h.join(X,$);if(await n(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let _=`${G}${B}`;if(await n(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(J)J.add(_);return _}}let K="",q=h.resolve(X),z=process.cwd();for(let B=0;B<10;B++){let _=h.join(q,"layouts"),j=!1;try{j=nG.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=_;break}let H=h.dirname(q);if(H===q||H.length<z.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,_=h.join(K,B);if(await n(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(J)J.add(_);return _}if(!B.endsWith(".stx")){let j=`${_}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.layoutsDir){let B=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,j=h.join(B,_);if(await n(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await n(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(J)J.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),_=h.join(Y.partialsDir||X,"layouts",B[1]);if(await n(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(J)J.add(_);return _}if(!_.endsWith(".stx")){let j=`${_}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await n(K)){let B=h.join(K,$);if(await n(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}}let W=Y.partialsDir||h.join(process.cwd(),"views"),U=h.join(W,$);if(await n(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let B=`${U}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(J)J.add(B);return B}}if(X.includes("temp")){let B=h.join(h.dirname(X),"layouts",$);if(await n(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}if(Y.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 B8($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
6642
|
+
`),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){J=q+1,X=G[q].trim();let z=Math.max(0,q-2),W=Math.min(G.length,q+3);Q=G.slice(z,W).map((U,B)=>{let _=z+B+1;return`${_===J?"> ":" "}${_}: ${U}`}).join(`
|
|
6609
6643
|
`);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return B8($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function q0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=B8(J,X,Q),q=Y.split("/").pop(),z=0;if(typeof X==="number"&&X>=0&&J){let U=J.lastIndexOf(`
|
|
6610
6644
|
`,Math.max(0,X-1));z=X-(U+1)+1}let W="";if(G>0)W+=`
|
|
6611
6645
|
${Y}:${G}${z>0?`:${z}`:""}: ${$.toLowerCase()} error: ${Z}
|
|
@@ -6619,8 +6653,8 @@ ${$0.yellow}${$0.bold}Message:${$0.reset} ${Z}
|
|
|
6619
6653
|
`,K)W+=`
|
|
6620
6654
|
${$0.blue}${$0.bold}Context:${$0.reset}
|
|
6621
6655
|
${$0.dim}${K}${$0.reset}
|
|
6622
|
-
`;return W}function r9(){l$.clear()}var l$,
|
|
6623
|
-
`||O==="\r"||O===" "||O===void 0)U++;B=L+9}else{if(U--,U===0){
|
|
6656
|
+
`;return W}function r9(){l$.clear()}var l$,oG=0,$0;var N0=y(()=>{y5();Z1();f5();$5();i$();E1();q7();z7();I9();p5();l$=new g5(500);$0={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"}});async function _8($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),z=q?q[1]:"",W=K+G[0].length,U=1,B=W,_=-1;while(U>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
|
|
6657
|
+
`||O==="\r"||O===" "||O===void 0)U++;B=L+9}else{if(U--,U===0){_=F;break}B=F+12}}if(_===-1)continue;let j=$.slice(W,_),H=$.slice(K,_+12);X.push({fullMatch:H,options:z,content:j,index:K}),Q.lastIndex=_+12}for(let{fullMatch:K,options:q,content:z,index:W}of X)try{let U={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)U[H]=!0});let B={gfm:U.gfm??!0,breaks:U.breaks??!1},_=I5(z.trim(),B);J=J.split(K).join(_)}catch(U){let B=U instanceof Error?U.message:String(U),_=q0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,W,K);J=J.split(K).join(_)}return J}async function j8($,Z,Y,J){let X={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")X.breaks=!0;if(G==="no-gfm")X.gfm=!1}),I5($.trim(),X)}var S7=y(()=>{N0()});function GK($){if(XK.set($.name,$),$.client)QK.set($.name,$.client)}function n$($){return GK($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=KK(J,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let z=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(z)}}let K=Y;if($.transform)K=await $.transform(Y,G,X,Q);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function KK($,Z){let Y={...Z};for(let J of $){let X=J.indexOf(":"),Q=J.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=J.slice(0,G).trim(),q=J.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var XK,QK;var y7=y(()=>{XK=new Map,QK=new Map});function P7($,Z=J5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${s5($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function H8($,Z,Y=qK,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${s5($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function C7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([X,Q])=>{let G=/^\d+$/.test(X)?`${X}px`:X;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((X,Q)=>X.numericBp-Q.numericBp).map(({bp:X,size:Q})=>`(max-width: ${X}) ${Q}`);return J.push(Z),J.join(", ")}function s5($,Z={}){let Y=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(Y.length===0)return $;let J=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${J}`}function v7($){return zK[$]||"application/octet-stream"}var J5,qK,o5,zK;var x7=y(()=>{J5=[320,480,640,768,1024,1280,1536,1920,2560],qK=[1,1.5,2,3],o5=["avif","webp","jpeg"],zK={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function UK(){try{return await import("ts-images")}catch{return null}}async function BK($,Z={}){let Y={...WK,...Z},J=await UK();if(J)try{return await _K($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return jK($,Y)}async function _K($,Z,Y){let{generatePlaceholder:J,generateThumbHash:X}=Y,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 X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function jK($,Z){let Y=Z.width||20,J=Z.height||Y,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function O8($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
|
|
6624
6658
|
#${$} {
|
|
6625
6659
|
--stx-img-transition-duration: ${J}ms;
|
|
6626
6660
|
--stx-img-transition-easing: ${X};
|
|
@@ -6637,7 +6671,7 @@ ${$0.dim}${K}${$0.reset}
|
|
|
6637
6671
|
#${$}.stx-img-loaded img {
|
|
6638
6672
|
opacity: 1;
|
|
6639
6673
|
}
|
|
6640
|
-
`.trim()}async function L8($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(f7.has(Y))return f7.get(Y);let J=await
|
|
6674
|
+
`.trim()}async function L8($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(f7.has(Y))return f7.get(Y);let J=await BK($,Z);return f7.set(Y,J),J}var WK,g7,f7;var F8=y(()=>{WK={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},g7=`
|
|
6641
6675
|
.stx-img-placeholder {
|
|
6642
6676
|
position: relative;
|
|
6643
6677
|
overflow: hidden;
|
|
@@ -6666,8 +6700,8 @@ ${$0.dim}${K}${$0.reset}
|
|
|
6666
6700
|
filter: blur(0);
|
|
6667
6701
|
transform: scale(1);
|
|
6668
6702
|
}
|
|
6669
|
-
`.trim();f7=new Map});import{createHash as w8}from"crypto";import{readFile as _K,stat as A8}from"fs/promises";async function E0($){try{let Z=await _K($);return w8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function V8($){return w8("sha256").update($).digest("hex").slice(0,16)}function o$($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${V8($)}-${V8(Y)}`}async function h7($){try{return(await A8($)).mtimeMs}catch{return 0}}async function D0($){try{return await A8($),!0}catch{return!1}}var g1=()=>{};import{mkdir as HK,readFile as OK,writeFile as LK,readdir as xH,rm as FK,stat as fH}from"fs/promises";import{join as R8,dirname as VK}from"path";async function wK($){try{await HK($,{recursive:!0})}catch{}}function T8($,Z,Y){return R8($,Y,`${Z}.json`)}async function N8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await h7(Z)!==$.srcMtime)return!1;return!0}async function s$($,Z,Y,J=d7){if(!J.enabled)return null;let X=o$($,Z),Q=X5.get(X);if(Q){if(await N8(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;X5.delete(X)}let G=T8(J.directory,X,Y);if(await D0(G))try{let K=await OK(G,"utf-8"),q=JSON.parse(K);if(await N8(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),X5.set(X,q),q.data}catch{}return null}async function r$($,Z,Y,J,X=d7){if(!X.enabled)return;let Q=o$($,Z),G=await E0($),K=await h7($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:o$("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};X5.set(Q,q);let z=T8(X.directory,Q,J);try{await wK(VK(z)),await LK(z,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function a$($,Z=d7){if($==="all")X5.clear();else X5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=R8(Z.directory,J);try{await FK(X,{recursive:!0,force:!0})}catch{}}}var X5,d7;var u7=y(()=>{g1();X5=new Map,d7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class e${config;constructor($={}){this.config={...AK,...$}}async get($,Z){return s$($,Z,"image",this.config)}async set($,Z,Y){return r$($,Z,Y,"image",this.config)}async clear(){return a$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function m7($){if(!t$)t$=new e$($);else if($)t$.updateConfig($);return t$}async function $4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return m7(J).get($,Z)}async function Z4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return m7(X).set($,Z,Y)}async function M8(){return m7().clear()}var AK,t$=null;var p7=y(()=>{u7();AK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as NK,basename as RK,extname as TK,join as MK}from"path";import{mkdir as IK}from"fs/promises";async function l7(){try{return await import("ts-images")}catch{return null}}function I8($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function DK($,Z){let Y=Z?I8(Z):I8("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function D8($,Z,Y){let J=await l7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await $4($,Z,Y);if(X)return X;try{let Q=NK($);if(!await D0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=DK(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await IK(K,{recursive:!0});let z=await E0(Q),W=RK($,TK($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:z},j=null;if(Z.transformations&&Z.transformations.length>0)j=await c7(Q,Z.transformations,J);for(let _ of U){let H=G[_]||{},L=`${W}-${z}.${_}`,V=MK(K,L);try{let O=await J.optimizeImage({input:j||Q,output:V,format:_,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:V,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:_,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${_}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let _=await J.generateThumbHash(Q);B.placeholder=_.dataUrl}catch(_){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${_}`)}if(Z.useDominantColor)try{let _=await J.generatePlaceholder(Q,{strategy:"dominant-color"});B.dominantColor=_.dominantColor}catch(_){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${_}`)}return await Z4($,Z,B,Y),B}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function E8($,Z,Y,J){let X=await l7();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function c7($,Z,Y){let J=Y||await l7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var k8=y(()=>{g1();p7()});import{resolve as EK,basename as kK,extname as bK,join as SK}from"path";import{mkdir as yK}from"fs/promises";async function PK(){try{return await import("ts-images")}catch{return null}}async function b8($,Z,Y){let J=await PK();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=EK($);if(!await D0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||CK,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await yK(K,{recursive:!0});let z=await E0(X),W=kK($,bK($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let _ of G){B.byFormat[_]=[];let H=[];for(let L of Q){let V=`${W}-${L}w-${z}.${_}`,O=SK(K,V),F=`${q}/${V}`;try{let w=U[_]?.quality||80;if(await D0(O)){B.byFormat[_].push({path:O,url:F,width:L,height:0,format:_,size:0}),H.push(`${F} ${L}w`);continue}let A=await J.processImage({input:X,output:O,format:_,quality:w,resize:{width:L}});if(A)B.byFormat[_].push({path:O,url:F,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:_,size:A.outputSize||0}),H.push(`${F} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${_} at ${L}w: ${w}`)}}B.srcsets[_]=H.join(", ")}let j=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let _=await J.generateThumbHash(X);B.placeholder={dataURL:_.dataUrl,width:_.width||32,height:_.height||32,strategy:"thumbhash"}}else{let _=await J.generatePlaceholder(X,{strategy:j,width:20});B.placeholder={dataURL:_.dataURL,width:_.width,height:_.height,strategy:j}}}catch(_){console.warn(`[stx-media] Failed to generate placeholder: ${_}`)}return B.sizes=Z.sizes||vK(Q),B}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function vK($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function S8($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var CK;var y8=y(()=>{g1();CK=[320,480,640,768,1024,1280,1536,1920]});var P8={};r(P8,{setCachedImageResult:()=>Z4,processImage:()=>D8,optimizeImage:()=>E8,getCachedImageResult:()=>$4,generateSrcset:()=>S8,generateResponsiveVariants:()=>b8,clearImageCache:()=>M8,applyTransformations:()=>c7,ImageProcessorCache:()=>e$});var C8=y(()=>{k8();y8();p7()});async function xK(){try{return await Promise.resolve().then(() => (C8(),P8))}catch($){if(!v8)console.warn("[stx-media] Image processor not available, some features disabled:",$),v8=!0;return null}}async function Y4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return dK(J,Y)}if(Y.processedResult?.processed)return s7($,Y.processedResult,Z);if(Y.responsiveVariants)return h8($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:q,widths:z=J5,dpr:W,formats:U=o5,quality:B=i7,params:j={},placeholder:_="none",placeholderOptions:H={},lazy:L=!0,priority:V=!1,loading:O=V?"eager":X4,decoding:F=J4,fetchpriority:w,objectFit:A,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,k=$.data||{},{isDev:C=!1,baseUrl:b=""}=Z;if(C&&!Z.optimize)return hK($);let D,P,f=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(_!=="none"&&!V)try{D=await L8(X,{strategy:_,...H}),P=O8(f,D,H)}catch{}let g=W!==void 0&&G!==void 0,d;if(g)d=gK($,f,D,Z);else d=await fK($,f,D,Z);let c;if(V){let F0=U.includes("webp")?"webp":U[0],j0=P7(X,z,{...j,q:B},F0),Y0=typeof q==="object"?C7(q):q||"100vw";c=`<link rel="preload" as="image" imagesrcset="${j0}" imagesizes="${Y0}" />`}let m=[];if(!x8&&_!=="none")m.push(g7),x8=!0;if(P)m.push(P);let z0=L?g8(f):void 0;return{html:d,preloadLink:c,css:m.length>0?m.join(`
|
|
6670
|
-
`):void 0,script:z0}}async function
|
|
6703
|
+
`.trim();f7=new Map});import{createHash as w8}from"crypto";import{readFile as HK,stat as A8}from"fs/promises";async function E0($){try{let Z=await HK($);return w8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function V8($){return w8("sha256").update($).digest("hex").slice(0,16)}function o$($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${V8($)}-${V8(Y)}`}async function h7($){try{return(await A8($)).mtimeMs}catch{return 0}}async function D0($){try{return await A8($),!0}catch{return!1}}var g1=()=>{};import{mkdir as OK,readFile as LK,writeFile as FK,readdir as xH,rm as VK,stat as fH}from"fs/promises";import{join as R8,dirname as wK}from"path";async function AK($){try{await OK($,{recursive:!0})}catch{}}function T8($,Z,Y){return R8($,Y,`${Z}.json`)}async function N8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await h7(Z)!==$.srcMtime)return!1;return!0}async function s$($,Z,Y,J=d7){if(!J.enabled)return null;let X=o$($,Z),Q=X5.get(X);if(Q){if(await N8(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;X5.delete(X)}let G=T8(J.directory,X,Y);if(await D0(G))try{let K=await LK(G,"utf-8"),q=JSON.parse(K);if(await N8(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),X5.set(X,q),q.data}catch{}return null}async function r$($,Z,Y,J,X=d7){if(!X.enabled)return;let Q=o$($,Z),G=await E0($),K=await h7($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:o$("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};X5.set(Q,q);let z=T8(X.directory,Q,J);try{await AK(wK(z)),await FK(z,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function a$($,Z=d7){if($==="all")X5.clear();else X5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=R8(Z.directory,J);try{await VK(X,{recursive:!0,force:!0})}catch{}}}var X5,d7;var u7=y(()=>{g1();X5=new Map,d7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class e${config;constructor($={}){this.config={...NK,...$}}async get($,Z){return s$($,Z,"image",this.config)}async set($,Z,Y){return r$($,Z,Y,"image",this.config)}async clear(){return a$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function m7($){if(!t$)t$=new e$($);else if($)t$.updateConfig($);return t$}async function $4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return m7(J).get($,Z)}async function Z4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return m7(X).set($,Z,Y)}async function M8(){return m7().clear()}var NK,t$=null;var p7=y(()=>{u7();NK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as RK,basename as TK,extname as MK,join as IK}from"path";import{mkdir as DK}from"fs/promises";async function l7(){try{return await import("ts-images")}catch{return null}}function I8($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function EK($,Z){let Y=Z?I8(Z):I8("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function D8($,Z,Y){let J=await l7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await $4($,Z,Y);if(X)return X;try{let Q=RK($);if(!await D0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=EK(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await DK(K,{recursive:!0});let z=await E0(Q),W=TK($,MK($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:z},_=null;if(Z.transformations&&Z.transformations.length>0)_=await c7(Q,Z.transformations,J);for(let j of U){let H=G[j]||{},L=`${W}-${z}.${j}`,F=IK(K,L);try{let O=await J.optimizeImage({input:_||Q,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await J.generateThumbHash(Q);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await J.generatePlaceholder(Q,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await Z4($,Z,B,Y),B}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function E8($,Z,Y,J){let X=await l7();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function c7($,Z,Y){let J=Y||await l7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var k8=y(()=>{g1();p7()});import{resolve as kK,basename as bK,extname as SK,join as yK}from"path";import{mkdir as PK}from"fs/promises";async function CK(){try{return await import("ts-images")}catch{return null}}async function b8($,Z,Y){let J=await CK();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=kK($);if(!await D0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||vK,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await PK(K,{recursive:!0});let z=await E0(X),W=bK($,SK($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of Q){let F=`${W}-${L}w-${z}.${j}`,O=yK(K,F),V=`${q}/${F}`;try{let w=U[j]?.quality||80;if(await D0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await J.processImage({input:X,output:O,format:j,quality:w,resize:{width:L}});if(A)B.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await J.generateThumbHash(X);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await J.generatePlaceholder(X,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||xK(Q),B}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function xK($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function S8($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var vK;var y8=y(()=>{g1();vK=[320,480,640,768,1024,1280,1536,1920]});var P8={};r(P8,{setCachedImageResult:()=>Z4,processImage:()=>D8,optimizeImage:()=>E8,getCachedImageResult:()=>$4,generateSrcset:()=>S8,generateResponsiveVariants:()=>b8,clearImageCache:()=>M8,applyTransformations:()=>c7,ImageProcessorCache:()=>e$});var C8=y(()=>{k8();y8();p7()});async function fK(){try{return await Promise.resolve().then(() => (C8(),P8))}catch($){if(!v8)console.warn("[stx-media] Image processor not available, some features disabled:",$),v8=!0;return null}}async function Y4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return uK(J,Y)}if(Y.processedResult?.processed)return s7($,Y.processedResult,Z);if(Y.responsiveVariants)return h8($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:q,widths:z=J5,dpr:W,formats:U=o5,quality:B=i7,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":X4,decoding:V=J4,fetchpriority:w,objectFit:A,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,k=$.data||{},{isDev:C=!1,baseUrl:b=""}=Z;if(C&&!Z.optimize)return dK($);let D,P,f=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{D=await L8(X,{strategy:j,...H}),P=O8(f,D,H)}catch{}let g=W!==void 0&&G!==void 0,d;if(g)d=hK($,f,D,Z);else d=await gK($,f,D,Z);let i;if(F){let F0=U.includes("webp")?"webp":U[0],_0=P7(X,z,{..._,q:B},F0),Y0=typeof q==="object"?C7(q):q||"100vw";i=`<link rel="preload" as="image" imagesrcset="${_0}" imagesizes="${Y0}" />`}let m=[];if(!x8&&j!=="none")m.push(g7),x8=!0;if(P)m.push(P);let z0=L?g8(f):void 0;return{html:d,preloadLink:i,css:m.length>0?m.join(`
|
|
6704
|
+
`):void 0,script:z0}}async function gK($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:q,widths:z=J5,formats:W=o5,quality:U=i7,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":X4,decoding:L=J4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,N=$.class,R=$.style,T=$.data||{},M=typeof q==="object"?C7(q):q||"100vw",I=[];for(let C of W){let b=P7(X,z,{...B,q:U},C),D=v7(C);if(_&&!j)I.push(` <source type="${D}" data-srcset="${b}" data-sizes="${M}" />`);else I.push(` <source type="${D}" srcset="${b}" sizes="${M}" />`)}let E=n7({src:s5(X,{...B,q:U}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:f8(N,Y),style:o7(R,O,V,Y),lazy:_&&!j,data:T}),k;if(Y){let C=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;k=`<div id="${Z}" class="stx-img-placeholder" style="${C}">
|
|
6671
6705
|
<picture>
|
|
6672
6706
|
${I.join(`
|
|
6673
6707
|
`)}
|
|
@@ -6677,9 +6711,9 @@ ${I.join(`
|
|
|
6677
6711
|
${I.join(`
|
|
6678
6712
|
`)}
|
|
6679
6713
|
<img ${E} />
|
|
6680
|
-
</picture>`;return k}function
|
|
6714
|
+
</picture>`;return k}function hK($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,dpr:q=[1,2,3],quality:z=i7,params:W={},lazy:U=!0,priority:B=!1,loading:_=B?"eager":X4,decoding:j=J4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,N=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),T=H8(X,R,q,{...W,q:z}),M=n7({src:s5(X,{...W,w:R,q:z}),alt:Q,width:G,height:K,loading:B?void 0:_,decoding:j,fetchpriority:B?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:f8(w,Y),style:o7(A,L,F,Y),lazy:U&&!B,data:N}),I=U&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
|
|
6681
6715
|
<img ${M} ${I} />
|
|
6682
|
-
</div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function
|
|
6716
|
+
</div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function dK($){let{src:Z,alt:Y,width:J,height:X,loading:Q=X4,decoding:G=J4,fetchpriority:K,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U,priority:B=!1}=$,_=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${n7({src:Z,alt:Y,width:J,height:X,loading:B?"eager":Q,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U,className:_,style:o7(j,q,z),id:H,data:L})} />`}}function n7($){let Z=[];if($.lazy)Z.push(`data-src="${i0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${i0($.src)}"`);if(Z.push(`alt="${i0($.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="${i0($.className)}"`);if($.style)Z.push(`style="${i0($.style)}"`);if($.id)Z.push(`id="${i0($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${i0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function f8($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function o7($,Z,Y,J){let X=[];if(Z)X.push(`object-fit: ${Z}`);if(Y)X.push(`object-position: ${Y}`);if(J)X.push("opacity: 0; transition: opacity 300ms ease-out");if($)X.push($);return X.join("; ")}function i0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function g8($){return`
|
|
6683
6717
|
(function() {
|
|
6684
6718
|
const container = document.getElementById('${$}');
|
|
6685
6719
|
if (!container) return;
|
|
@@ -6716,22 +6750,22 @@ ${I.join(`
|
|
|
6716
6750
|
|
|
6717
6751
|
observer.observe(container);
|
|
6718
6752
|
})();
|
|
6719
|
-
`.trim()}async function
|
|
6753
|
+
`.trim()}async function uK($,Z){let Y=await fK();if(!Y)return Y4({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,J);if(Q)return h8($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return s7($,Q,Z)}return Y4({...$,process:!1},Z)}async function s7($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((P)=>P.format==="jpeg")||L.find((P)=>P.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((P)=>P.format===(F?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),w=new Map;for(let P of L){if(!w.has(P.format))w.set(P.format,[]);w.get(P.format).push(P)}let A=[],N=["avif","webp","jpeg","png"];for(let P of N){let f=w.get(P);if(f&&f.length>0){let g=f.map((i)=>`${i.url} ${i.width}w`).join(", "),d=v7(P);if(G&&!K)A.push(` <source type="${d}" data-srcset="${g}" />`);else A.push(` <source type="${d}" srcset="${g}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${i0(O)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${i0(O)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${i0(J)}"`);let T=X||Z.originalWidth,M=Q||Z.originalHeight;if(T)R.push(`width="${T}"`);if(M)R.push(`height="${M}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(W)R.push(`crossorigin="${W}"`);if(U)R.push(`referrerpolicy="${U}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(z)I.push(`object-position: ${z}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)R.push(`style="${I.join("; ")}"`);let E=[];if(B)E.push(B);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)R.push(`class="${E.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[P,f]of Object.entries(H))R.push(`data-${P}="${i0(f)}"`);let k;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let P=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;k=`<div id="${j}" class="stx-img-placeholder" style="${P}">
|
|
6720
6754
|
<picture>
|
|
6721
6755
|
${A.join(`
|
|
6722
6756
|
`)}
|
|
6723
6757
|
<img ${R.join(" ")} />
|
|
6724
6758
|
</picture>
|
|
6725
|
-
</div>`}else k=`<picture${
|
|
6759
|
+
</div>`}else k=`<picture${j?` id="${j}"`:""}>
|
|
6726
6760
|
${A.join(`
|
|
6727
6761
|
`)}
|
|
6728
6762
|
<img ${R.join(" ")} />
|
|
6729
|
-
</picture>`;let C=[];if(Z.placeholder)C.push(g7);let b=G?g8(
|
|
6730
|
-
`):void 0,script:b}}async function h8($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[X,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return s7($,J,Y)}var v8=!1,i7=80,J4="async",X4="lazy",x8=!1;var d8=y(()=>{x7();F8()});function
|
|
6763
|
+
</picture>`;let C=[];if(Z.placeholder)C.push(g7);let b=G?g8(j):void 0,D;if(K&&V)D=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:k,preloadLink:D,css:C.length>0?C.join(`
|
|
6764
|
+
`):void 0,script:b}}async function h8($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[X,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return s7($,J,Y)}var v8=!1,i7=80,J4="async",X4="lazy",x8=!1;var d8=y(()=>{x7();F8()});function mK(){return n$({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:X,alt:Q,options:G}=pK($,Z,Y);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||J5,formats:G.formats||o5,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=Y.__isDev||!1,z=await Y4(K,{isDev:q}),W=z.html;if(z.preloadLink)W=z.preloadLink+`
|
|
6731
6765
|
`+W;if(z.css)W+=`
|
|
6732
6766
|
<style>${z.css}</style>`;if(z.script)W+=`
|
|
6733
|
-
<script>${z.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function
|
|
6734
|
-
`)}async function
|
|
6767
|
+
<script>${z.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function pK($,Z,Y){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 X=lK(J),Q=r7(X[0],Y)||"",G=r7(X[1],Y)||"",K={};if(X[2]){let q=r7(X[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof X[2]==="string")try{K=JSON.parse(X[2])}catch{}}return{src:Q,alt:G,options:K}}function lK($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],z=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&z!=="\\"){if(!J)J=!0,X=q;else if(q===X)J=!1,X="";else Y+=q;continue}if(!J){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function r7($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var u8;var m8=y(()=>{y7();d8();x7();u8=mK()});class G4{config;constructor($={}){this.config={...cK,...$}}async get($,Z){return s$($,Z,"video",this.config)}async set($,Z,Y){return r$($,Z,Y,"video",this.config)}async clear(){return a$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function a7($){if(!Q4)Q4=new G4($);else if($)Q4.updateConfig($);return Q4}async function K4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return a7(J).get($,Z)}async function q4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return a7(X).set($,Z,Y)}async function p8(){return a7().clear()}var cK,Q4=null;var t7=y(()=>{u7();cK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as e7,basename as $3,extname as Z3,join as z4}from"path";import{mkdir as Y3}from"fs/promises";async function J3(){try{return await import("ts-videos")}catch{return null}}async function W4($,Z,Y,J){let X=await J3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=e7($);if(!await D0(Q))return null;await Y3(Y,{recursive:!0});let G=await E0(Q),K=$3($,Z3($)),q=Z.format||"webp",z=Z.timestamp||0,W=`${K}-poster-${G}.${q}`,U=z4(Y,W),B=await X.extractThumbnails(Q,{timestamps:[z],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:W.replace(`.${q}`,"")});if(B&&B.length>0){let _=B[0];return{path:U,url:`${J}/${W}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:z,size:_.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function U4($,Z,Y,J){let X=await J3();if(!X)return[];try{let Q=e7($);if(!await D0(Q))return[];await Y3(Y,{recursive:!0});let G=await E0(Q),K=$3($,Z3($)),q=Z.format||"webp",U=(await new X.Input(Q).getInfo()).duration||60,B=Z.count||10,_=Z.interval||U/B,j=[];for(let L=0;L<B&&L*_<U;L++)j.push(L*_);let H=await X.extractThumbnails(Q,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||z4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${J}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function l8($,Z,Y,J){let X=await J3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=e7($);if(!await D0(Q))return null;await Y3(Y,{recursive:!0});let G=await E0(Q),K=$3($,Z3($)),W=(await new X.Input(Q).getInfo()).duration||60,U=Z.columns||10,B=Z.interval||5,_=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(W/B),F=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,V=z4(Y,O),w=[];for(let N=0;N<L;N++)w.push(N*B);let A=await X.extractThumbnails(Q,{timestamps:w,width:_,height:j,format:H,quality:Z.quality||70,outputDir:z4(Y,".temp")});if(!A||A.length===0)return null;try{let N=await import("ts-images"),R=U*_,T=F*j,M=await N.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:V,columns:U,rows:F,thumbnailWidth:_,thumbnailHeight:j,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var X3=y(()=>{g1()});import{resolve as i8,basename as n8,extname as o8,join as h1}from"path";import{mkdir as B4,writeFile as s8}from"fs/promises";async function r8(){try{return await import("ts-videos")}catch{return null}}async function _4($,Z,Y,J,X){let Q=await r8();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=i8($);if(!await D0(G))return null;let K=await E0(G),q=n8($,o8($)),z=h1(Y,`${q}-${K}-hls`);await B4(z,{recursive:!0});let W=Z.length>0?Z:a8,U=X?.segmentDuration||6,j=(await new Q.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of W){let w=h1(z,V.label);await B4(w,{recursive:!0});let A=`${V.label}.m3u8`,N=h1(w,A);try{let R=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)H.push({quality:V,url:`${J}/${q}-${K}-hls/${V.label}/${A}`,path:N}),L+=R.segmentCount||Math.ceil(j/U)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(H.length===0)return null;let F=h1(z,"master.m3u8"),O=iK(H,J,q,K);return await s8(F,O),{manifestUrl:`${J}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function iK($,Z,Y,J){let X=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;X.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return X.join(`
|
|
6768
|
+
`)}async function j4($,Z,Y,J,X){let Q=await r8();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=i8($);if(!await D0(G))return null;let K=await E0(G),q=n8($,o8($)),z=h1(Y,`${q}-${K}-dash`);await B4(z,{recursive:!0});let W=Z.length>0?Z:a8,U=X?.segmentDuration||4,B=X?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of W){let N=h1(z,A.label);await B4(N,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:N,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${J}/${q}-${K}-dash/${A.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${R}`)}}if(L.length===0)return null;let O=h1(z,"manifest.mpd"),V=nK(L,F,H,U,B);await s8(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${J}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function nK($,Z,Y,J,X){let Q=c8(Y),G=c8(X),K=`<?xml version="1.0" encoding="UTF-8"?>
|
|
6735
6769
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
6736
6770
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
6737
6771
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -6757,7 +6791,7 @@ ${A.join(`
|
|
|
6757
6791
|
</Representation>
|
|
6758
6792
|
`}K+=` </AdaptationSet>
|
|
6759
6793
|
`}return K+=` </Period>
|
|
6760
|
-
</MPD>`,K}function c8($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var a8;var Q3=y(()=>{g1();a8=[{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},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as t8,basename as
|
|
6794
|
+
</MPD>`,K}function c8($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var a8;var Q3=y(()=>{g1();a8=[{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},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as t8,basename as oK,extname as sK,join as rK}from"path";import{mkdir as aK}from"fs/promises";async function e8(){try{return await import("ts-videos")}catch{return null}}function tK($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function eK($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function G3($){let Z=await e8();if(!Z)return null;try{let Y=t8($),X=await new Z.Input(Y).getInfo();return{duration:X.duration||0,width:X.width||0,height:X.height||0,frameRate:X.frameRate||0,bitrate:X.bitrate||0,codec:X.videoCodec||"",audioCodec:X.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function $Z($,Z,Y,J){let X=await e8();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await K4($,Z,Y);if(Q)return Q;try{let G=t8($);if(!await D0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await aK(K,{recursive:!0});let z=await E0(G),W=oK($,sK($)),U={src:$,processed:!0,hash:z};J?.({percentage:5,stage:"analyzing"}),U.metadata=await G3(G)||void 0;let B={};if(Z.quality)B.bitrate=tK(Z.quality);if(Z.platform)Object.assign(B,eK(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let _=`${W}-${z}.mp4`,j=rK(K,_);try{let H=await $q(G,j,B,X,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await W4(G,_,K,q);if(j)U.poster=j}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let _=await U4(G,Y.thumbnails,K,q);if(_.length>0)U.thumbnails=_}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let j=await _4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,hls:j}}if(_.format==="dash"){let j=await j4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,dash:j}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await q4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function $q($,Z,Y,J,X){try{let G=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var ZZ=y(()=>{g1();t7();X3();Q3()});var YZ={};r(YZ,{setCachedVideoResult:()=>q4,processVideo:()=>$Z,getCachedVideoResult:()=>K4,generateThumbnails:()=>U4,generateSpriteSheet:()=>l8,generatePoster:()=>W4,generateHLSManifest:()=>_4,generateDASHManifest:()=>j4,clearVideoCache:()=>p8,analyzeVideo:()=>G3,VideoProcessorCache:()=>G4});var JZ=y(()=>{ZZ();X3();Q3();t7()});async function QZ(){try{return await Promise.resolve().then(() => (JZ(),YZ))}catch($){if(!XZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),XZ=!0;return null}}async function H4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return Gq(J,Y)}if(Y.processedResult?.processed)return zZ($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await Kq(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:q,controls:z=GZ,autoplay:W=!1,muted:U=!1,loop:B=!1,preload:_=KZ,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:N=!1}=$,R=X||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return Jq($,Z);if(F&&F!=="video")return Yq(Q||"",F,$);let E=G.length>0?G:Q?[{src:Q,type:qZ(Q)}]:[],k=[`id="${I}"`];if(z)k.push("controls");if(W)k.push("autoplay");if(U)k.push("muted");if(B)k.push("loop");if(j)k.push("playsinline");if(A)k.push("disablepictureinpicture");if(N)k.push("disableremoteplayback");if(w)k.push(`crossorigin="${w}"`);if(H){if(k.push(`data-preload="${_}"`),k.push('preload="none"'),R)k.push(`data-poster="${V0(R)}"`);k.push("data-stx-lazy")}else if(k.push(`preload="${_}"`),R)k.push(`poster="${V0(R)}"`);if(O)k.push(`width="${O}"`);if(V)k.push(`height="${V}"`);if(T)k.push(`class="${V0(T)}"`);if(M)k.push(`style="${V0(M)}"`);let C=E.map((P)=>{return` <source ${H?`data-src="${V0(P.src)}"`:`src="${V0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
|
|
6761
6795
|
`),b=`<video ${k.join(" ")}>
|
|
6762
6796
|
${C}
|
|
6763
6797
|
Your browser does not support the video tag.
|
|
@@ -6796,15 +6830,15 @@ ${C}
|
|
|
6796
6830
|
|
|
6797
6831
|
observer.observe(video);
|
|
6798
6832
|
})();
|
|
6799
|
-
`.trim();return{html:b,script:D}}function
|
|
6833
|
+
`.trim();return{html:b,script:D}}function Yq($,Z,Y){let{width:J=640,height:X=360}=Y,Q=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,z=null;switch(Z){case"youtube":z=Xq($),q=z?`https://www.youtube-nocookie.com/embed/${z}`:$;break;case"vimeo":z=Qq($),q=z?`https://player.vimeo.com/video/${z}`:$;break;case"dailymotion":z=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${z}`;break;case"twitch":z=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${z}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let W=[`id="${K}"`,`src="${V0(q)}"`,`width="${J}"`,`height="${X}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)W.push(`class="${V0(Q)}"`);if(G)W.push(`style="${V0(G)}"`);if(Y.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
|
|
6800
6834
|
<iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
6801
|
-
</div>`}}function
|
|
6835
|
+
</div>`}}function Jq($,Z={}){let{src:Y,sources:J=[],poster:X,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:z="metadata",playsinline:W=!0,lazy:U=!0,width:B,height:_}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:G,loop:q,muted:K,playsinline:W,preload:z,poster:X,controls:Q,title:$.title},O=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
|
|
6802
6836
|
<div
|
|
6803
6837
|
id="${L}"
|
|
6804
|
-
class="ts-video-player${
|
|
6838
|
+
class="ts-video-player${j?" "+V0(j):""}"
|
|
6805
6839
|
style="${O}"
|
|
6806
6840
|
data-ts-video-player
|
|
6807
|
-
data-config='${JSON.stringify(
|
|
6841
|
+
data-config='${JSON.stringify(F)}'
|
|
6808
6842
|
${U?"data-lazy":""}
|
|
6809
6843
|
>
|
|
6810
6844
|
<div class="ts-video-player__container">
|
|
@@ -6835,7 +6869,7 @@ ${C}
|
|
|
6835
6869
|
|
|
6836
6870
|
// Load ts-video-player from CDN
|
|
6837
6871
|
var script = document.createElement('script');
|
|
6838
|
-
script.src = '${
|
|
6872
|
+
script.src = '${Zq}';
|
|
6839
6873
|
script.onload = initPlayer;
|
|
6840
6874
|
script.onerror = function() {
|
|
6841
6875
|
console.error('[stx] Failed to load ts-video-player');
|
|
@@ -6965,14 +6999,14 @@ else {
|
|
|
6965
6999
|
.ts-video-player__play-button svg {
|
|
6966
7000
|
margin-left: 4px;
|
|
6967
7001
|
}
|
|
6968
|
-
`.trim();return{html:
|
|
7002
|
+
`.trim();return{html:V,script:w,css:A}}function qZ($){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 Xq($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function Qq($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function V0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function Gq($,Z){let Y=await QZ();if(!Y)return H4({...$,process:!1},Z);let J=Z.tsVideosConfig,X=await Y.processVideo($.src,$,J,$.onProcessProgress);if(X.processed)return zZ($,X,Z);return H4({...$,process:!1},Z)}async function Kq($,Z){let Y=await QZ();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},X=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,X.outputDir,X.baseUrl||"/videos"))?.url}function zZ($,Z,Y){let{controls:J=GZ,autoplay:X=!1,muted:Q=!1,loop:G=!1,preload:K=KZ,playsinline:q=!0,lazy:z=!0,width:W,height:U,crossorigin:B,disablePictureInPicture:_=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=qZ(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,N=[`id="${F}"`];if(J)N.push("controls");if(X)N.push("autoplay");if(Q)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(_)N.push("disablepictureinpicture");if(j)N.push("disableremoteplayback");if(B)N.push(`crossorigin="${B}"`);if(z){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),A)N.push(`data-poster="${V0(A)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),A)N.push(`poster="${V0(A)}"`);let R=W||Z.metadata?.width,T=U||Z.metadata?.height;if(R)N.push(`width="${R}"`);if(T)N.push(`height="${T}"`);if(H)N.push(`class="${V0(H)}"`);if(L)N.push(`style="${V0(L)}"`);let I=` <source ${z?`data-src="${V0(O)}"`:`src="${V0(O)}"`} type="${V}" />`,E=`<video ${N.join(" ")}>
|
|
6969
7003
|
${I}
|
|
6970
7004
|
Your browser does not support the video tag.
|
|
6971
7005
|
</video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${V0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
6972
7006
|
${E}
|
|
6973
7007
|
</div>`;let k;if(z)k=`
|
|
6974
7008
|
(function() {
|
|
6975
|
-
var video = document.getElementById('${
|
|
7009
|
+
var video = document.getElementById('${F}');
|
|
6976
7010
|
if (!video) return;
|
|
6977
7011
|
|
|
6978
7012
|
var observer = new IntersectionObserver(function(entries) {
|
|
@@ -7014,9 +7048,9 @@ ${E}
|
|
|
7014
7048
|
width: 100%;
|
|
7015
7049
|
height: auto;
|
|
7016
7050
|
}
|
|
7017
|
-
`.trim();return{html:E,script:k,css:C}}var XZ=!1,GZ=!0,KZ="metadata"
|
|
7051
|
+
`.trim();return{html:E,script:k,css:C}}var XZ=!1,GZ=!0,KZ="metadata",Zq="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var WZ=y(()=>{q3()});function UZ(){return n$({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:X,options:Q}=qq($,Z,Y);if(!X)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:X,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:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},z=await H4(G,q),W=z.html;if(z.css)W+=`
|
|
7018
7052
|
<style>${z.css}</style>`;if(z.script)W+=`
|
|
7019
|
-
<script>${z.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function
|
|
7053
|
+
<script>${z.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function qq($,Z,Y){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 X=zq(J),Q=BZ(X[0],Y)||"",G={};if(X[1]){let K=BZ(X[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof X[1]==="string")try{G=JSON.parse(X[1])}catch{}}return{src:Q,options:G}}function zq($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],z=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&z!=="\\"){if(!J)J=!0,X=q;else if(q===X)J=!1,X="";else Y+=q;continue}if(!J){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function BZ($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var K3;var q3=y(()=>{y7();WZ();K3=UZ()});function Wq($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
|
|
7020
7054
|
${$}
|
|
7021
7055
|
</div>
|
|
7022
7056
|
<script>
|
|
@@ -7061,7 +7095,7 @@ ${E}
|
|
|
7061
7095
|
}
|
|
7062
7096
|
}
|
|
7063
7097
|
})();
|
|
7064
|
-
</script>`}function
|
|
7098
|
+
</script>`}function Uq($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",X=Y?.autoReload||!1,Q=$.trim().length>0,G=`
|
|
7065
7099
|
<div class="stx-pwa-update-banner" style="
|
|
7066
7100
|
position: fixed;
|
|
7067
7101
|
bottom: 0;
|
|
@@ -7172,7 +7206,7 @@ else {
|
|
|
7172
7206
|
// Also listen for custom event
|
|
7173
7207
|
window.addEventListener('pwa-update-available', showUpdate);
|
|
7174
7208
|
})();
|
|
7175
|
-
</script>`}function
|
|
7209
|
+
</script>`}function Bq($,Z){let Y=$.trim().length>0,J=`
|
|
7176
7210
|
<div class="stx-offline-indicator" style="
|
|
7177
7211
|
position: fixed;
|
|
7178
7212
|
top: 16px;
|
|
@@ -7233,7 +7267,7 @@ else {
|
|
|
7233
7267
|
window.addEventListener('offline', updateStatus);
|
|
7234
7268
|
updateStatus();
|
|
7235
7269
|
})();
|
|
7236
|
-
</script>`}function
|
|
7270
|
+
</script>`}function _q($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",X=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
|
|
7237
7271
|
${$}
|
|
7238
7272
|
</div>
|
|
7239
7273
|
<script>
|
|
@@ -7315,71 +7349,71 @@ catch (error) {
|
|
|
7315
7349
|
init();
|
|
7316
7350
|
}
|
|
7317
7351
|
})();
|
|
7318
|
-
</script>`}var jq,
|
|
7319
|
-
${$.message}`),Z&&$.line){let Q=
|
|
7352
|
+
</script>`}var jq,Hq,Oq,Lq,_Z;var jZ=y(()=>{jq={name:"pwa.installButton",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Wq($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Hq={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Uq($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Oq={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Bq($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Lq={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return _q($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},_Z=[jq,Hq,Oq,Lq]});function z3($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var O4=y(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function r5(){return!1}function a5(){return!r5()||process.env.STX_DEBUG==="true"}function L4(){return!1}import Fq from"path";function F4(){return{...W3}}function V4($){if(!W3.showRelativePaths||!$)return $;let Z=W3.baseDir||process.cwd();try{let Y=Fq.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var Vq,W3,w4,d1,A4;var N4=y(()=>{O4();Vq={showRelativePaths:!1,enableAutoRecovery:a5(),logRecoveryWarnings:!0},W3={...Vq};w4=class w4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,X,Q,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=X;this.context=Q;if(this.name="StxError",this.numericCode=G||s.EVALUATION_ERROR,this.filePath)this.filePath=V4(this.filePath)}};d1=class d1 extends w4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};A4=class A4 extends w4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function OZ($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:q,snippet:z,suggestion:W,format:U="text"}=$,B=Q,_=G;if(!B&&K&&q!==void 0){let O=Mq(K,q);B=O.line,_=O.column}let j=X?V4(X):void 0,H=J?z3(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:z,suggestion:W,timestamp:new Date().toISOString()},F;switch(U){case"html":F=Aq(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=Nq(L,K,q);break;case"text":default:F=wq(L,K,q);break}return{formatted:F,data:L}}function wq($,Z,Y){let J=[],X=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${X}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
|
|
7353
|
+
${$.message}`),Z&&$.line){let Q=Rq(Z,$.line,2);if(Q)J.push(`
|
|
7320
7354
|
${Q}`)}if($.snippet)J.push(`
|
|
7321
7355
|
Snippet: ${$.snippet}`);if($.suggestion)J.push(`
|
|
7322
|
-
Suggestion: ${$.suggestion}`);return J.join(" ")}function
|
|
7356
|
+
Suggestion: ${$.suggestion}`);return J.join(" ")}function Aq($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${HZ($.message)}`;if($.suggestion)J+=` | Suggestion: ${HZ($.suggestion)}`;return J+=" -->",J}function Nq($,Z,Y){let z=[],W=$.code?` [${$.codeName||$.code}]`:"";if(z.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${W} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}z.push(`
|
|
7323
7357
|
\x1B[90mat\x1B[0m ${U}`)}if(z.push(`
|
|
7324
7358
|
|
|
7325
|
-
${$.message}`),Z&&$.line){let U=
|
|
7359
|
+
${$.message}`),Z&&$.line){let U=Tq(Z,$.line,2);if(U)z.push(`
|
|
7326
7360
|
|
|
7327
7361
|
\x1B[90mContext:\x1B[0m
|
|
7328
7362
|
${U}`)}if($.suggestion)z.push(`
|
|
7329
7363
|
|
|
7330
7364
|
\x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return z.push(`
|
|
7331
|
-
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),z.join("")}function
|
|
7365
|
+
${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),z.join("")}function Rq($,Z,Y){let J=$.split(`
|
|
7332
7366
|
`),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G=[];for(let K=X;K<=Q;K++){let q=(K+1).toString().padStart(4),z=K===Z-1?">":" ";G.push(`${z}${q} | ${J[K]}`)}return G.join(`
|
|
7333
|
-
`)}function
|
|
7334
|
-
`),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let W=X;W<=Q;W++){let U=(W+1).toString().padStart(4),B=W===Z-1,
|
|
7335
|
-
`)}function HZ($){return $.replace(/--/g,"- -").replace(/>/g,">")}function
|
|
7367
|
+
`)}function Tq($,Z,Y){let J=$.split(`
|
|
7368
|
+
`),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let W=X;W<=Q;W++){let U=(W+1).toString().padStart(4),B=W===Z-1,_=B?"\x1B[31m>\x1B[0m":" ",j=B?`\x1B[31m${J[W]}\x1B[0m`:`\x1B[90m${J[W]}\x1B[0m`;z.push(`${_}\x1B[90m${U}\x1B[0m | ${j}`)}return z.join(`
|
|
7369
|
+
`)}function HZ($){return $.replace(/--/g,"- -").replace(/>/g,">")}function Mq($,Z){let J=$.substring(0,Z).split(`
|
|
7336
7370
|
`);return{line:J.length,column:J[J.length-1].length}}function Z0($,Z,Y){return OZ({type:$,message:Z,code:Y,format:"html"}).formatted}async function Q5($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var LZ=y(()=>{O4();N4()});class B3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
|
|
7337
7371
|
`).slice(1).join(`
|
|
7338
7372
|
`)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
|
|
7339
7373
|
`)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded(Z);let X=`${this.formatEntry($)}
|
|
7340
7374
|
`;Z.appendFileSync(this.logFilePath,X,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let J=`${this.logFilePath}.${Y}`,X=`${this.logFilePath}.${Y+1}`;if($.existsSync(J))if(Y>=this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,X)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let J=Y.error.constructor.name;$[J]=($[J]||0)+1;let X=Y.level||"error";Z[X]=(Z[X]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),X=(await import("path")).dirname($);if(!Y.existsSync(X))Y.mkdirSync(X,{recursive:!0});if(Z==="json"){let Q=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,Q.join(`
|
|
7341
7375
|
|
|
7342
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var U3,
|
|
7343
|
-
@end${K}`;J.push(`Added ${W} missing @end${K}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(a5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};
|
|
7344
|
-
`)}}});var VZ=()=>{};var wZ=y(()=>{O4();LZ();FZ();VZ();N4()});var
|
|
7345
|
-
`,
|
|
7346
|
-
`;if(O.description)
|
|
7347
|
-
`;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;
|
|
7348
|
-
`}if(O.robots)
|
|
7349
|
-
`;if(O.canonical)
|
|
7350
|
-
`;if(O.openGraph){let w=O.openGraph;if(
|
|
7351
|
-
`,w.title||O.title){let A=w.title||O.title||"";
|
|
7352
|
-
`}if(w.description||O.description){let A=w.description||O.description||"";
|
|
7353
|
-
`}if(w.url||O.canonical){let A=w.url||O.canonical||"";
|
|
7354
|
-
`}if(w.image){if(
|
|
7355
|
-
`,w.imageAlt)
|
|
7356
|
-
`;if(w.imageWidth)
|
|
7357
|
-
`;if(w.imageHeight)
|
|
7358
|
-
`}if(w.siteName)
|
|
7359
|
-
`}if(O.twitter){let w=O.twitter;if(
|
|
7360
|
-
`,w.title||O.title){let A=w.title||O.title||"";
|
|
7361
|
-
`}if(w.description||O.description){let A=w.description||O.description||"";
|
|
7362
|
-
`}if(w.image||O.openGraph&&O.openGraph.image){let A=w.image||(O.openGraph?O.openGraph.image:"")||"";
|
|
7363
|
-
`}if(w.site)
|
|
7364
|
-
`;if(w.creator)
|
|
7365
|
-
`}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");
|
|
7366
|
-
`}return
|
|
7376
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var U3,n0,_3;var FZ=y(()=>{N4();U3={isEnabled(){return F4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=F4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],X=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,z=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>z){let W=q-z;for(let U=0;U<W;U++)Y+=`
|
|
7377
|
+
@end${K}`;J.push(`Added ${W} missing @end${K}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(a5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};n0=new B3,_3={isDevelopment(){return a5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
|
|
7378
|
+
`)}}});var VZ=()=>{};var wZ=y(()=>{O4();LZ();FZ();VZ();N4()});var q1=y(()=>{wZ()});function AZ($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,z)=>{if(!z&&q.includes(":")){let W=q.split(":"),U=q,B=W.length>1?W[1]:"";if(B&&Z[B])z=Z[B];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])z=Z.openGraph[W[1]];else z="";return z?`<meta property="${c(U)}" content="${c(z)}">`:""}return z?`<meta name="${c(q)}" content="${c(z)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,q=K+G[0].length-1,z=1,W=q+1;while(W<X.length&&z>0){if(X[W]==="(")z++;else if(X[W]===")"){if(z--,z===0)break}W++}if(z!==0)break;let U=X.substring(q+1,W).trim(),B=W+1,_=(()=>{try{let j=R0(U,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${c(String(j.name))}"`;if(j.property)H+=` property="${c(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${c(String(j.httpEquiv))}"`;if(j.content)H+=` content="${c(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return Z0("MetaTag",H,s.EVALUATION_ERROR)}})();X=X.substring(0,K)+_+X.substring(B),Q.lastIndex=0}return X}function NZ($,Z,Y){let J=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,z=K+1;while(z<J.length&&q>0){if(J[z]==="(")q++;else if(J[z]===")"){if(q--,q===0)break}z++}if(q!==0)break;let W=J.substring(K+1,z).trim(),U=z+1,B=(()=>{try{let _=R0(W,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let j=_ instanceof Error?_.message:String(_);return Z0("StructuredData",j,s.EVALUATION_ERROR)}})();J=J.substring(0,G)+B+J.substring(U),X.lastIndex=0}return J}function RZ($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),q=1,z=K+1,W=null,U=!1;while(z<X.length&&q>0){let F=X[z];if(U){U=!1,z++;continue}if(F==="\\"&&W){U=!0,z++;continue}if(W){if(F===W)W=null;z++;continue}if(F==='"'||F==="'"||F==="`"){W=F,z++;continue}if(F==="{")q++;else if(F==="}")q--;z++}if(q!==0)break;let B=X.substring(z).match(/^\s*\)/);if(!B)break;let _=z+B[0].length,j=X.substring(K,z),H=X.substring(G.index,_),L=((F)=>{try{let O=R0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${c(O.title)}</title>
|
|
7379
|
+
`,V+=`<meta name="title" content="${c(O.title)}">
|
|
7380
|
+
`;if(O.description)V+=`<meta name="description" content="${c(O.description)}">
|
|
7381
|
+
`;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${c(w)}">
|
|
7382
|
+
`}if(O.robots)V+=`<meta name="robots" content="${c(O.robots)}">
|
|
7383
|
+
`;if(O.canonical)V+=`<link rel="canonical" href="${c(O.canonical)}">
|
|
7384
|
+
`;if(O.openGraph){let w=O.openGraph;if(V+=`<meta property="og:type" content="${c(w.type||"website")}">
|
|
7385
|
+
`,w.title||O.title){let A=w.title||O.title||"";V+=`<meta property="og:title" content="${c(A)}">
|
|
7386
|
+
`}if(w.description||O.description){let A=w.description||O.description||"";V+=`<meta property="og:description" content="${c(A)}">
|
|
7387
|
+
`}if(w.url||O.canonical){let A=w.url||O.canonical||"";V+=`<meta property="og:url" content="${c(A)}">
|
|
7388
|
+
`}if(w.image){if(V+=`<meta property="og:image" content="${c(w.image)}">
|
|
7389
|
+
`,w.imageAlt)V+=`<meta property="og:image:alt" content="${c(w.imageAlt)}">
|
|
7390
|
+
`;if(w.imageWidth)V+=`<meta property="og:image:width" content="${c(String(w.imageWidth))}">
|
|
7391
|
+
`;if(w.imageHeight)V+=`<meta property="og:image:height" content="${c(String(w.imageHeight))}">
|
|
7392
|
+
`}if(w.siteName)V+=`<meta property="og:site_name" content="${c(w.siteName)}">
|
|
7393
|
+
`}if(O.twitter){let w=O.twitter;if(V+=`<meta name="twitter:card" content="${c(w.card||"summary_large_image")}">
|
|
7394
|
+
`,w.title||O.title){let A=w.title||O.title||"";V+=`<meta name="twitter:title" content="${c(A)}">
|
|
7395
|
+
`}if(w.description||O.description){let A=w.description||O.description||"";V+=`<meta name="twitter:description" content="${c(A)}">
|
|
7396
|
+
`}if(w.image||O.openGraph&&O.openGraph.image){let A=w.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${c(A)}">
|
|
7397
|
+
`}if(w.site)V+=`<meta name="twitter:site" content="${c(w.site)}">
|
|
7398
|
+
`;if(w.creator)V+=`<meta name="twitter:creator" content="${c(w.creator)}">
|
|
7399
|
+
`}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
|
|
7400
|
+
`}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return Z0("SEO",`Error processing @seo directive: ${V}`,s.EVALUATION_ERROR)}})(j);X=X.substring(0,G.index)+L+X.substring(_),Q.lastIndex=G.index+L.length}return X}function TZ($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.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(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.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(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let z=`
|
|
7367
7401
|
<!-- stx SEO Tags -->
|
|
7368
|
-
<meta name="title" content="${
|
|
7369
|
-
<meta name="description" content="${
|
|
7370
|
-
<meta property="og:title" content="${
|
|
7371
|
-
<meta property="og:description" content="${
|
|
7402
|
+
<meta name="title" content="${c(G)}">
|
|
7403
|
+
<meta name="description" content="${c(K)}">
|
|
7404
|
+
<meta property="og:title" content="${c(G)}">
|
|
7405
|
+
<meta property="og:description" content="${c(K)}">
|
|
7372
7406
|
<meta property="og:type" content="website">
|
|
7373
7407
|
<meta name="twitter:card" content="summary_large_image">
|
|
7374
|
-
<meta name="twitter:title" content="${
|
|
7375
|
-
<meta name="twitter:description" content="${
|
|
7408
|
+
<meta name="twitter:title" content="${c(G)}">
|
|
7409
|
+
<meta name="twitter:description" content="${c(K)}">
|
|
7376
7410
|
`;if(q)z+=`
|
|
7377
|
-
<meta property="og:image" content="${
|
|
7378
|
-
<meta name="twitter:image" content="${
|
|
7411
|
+
<meta property="og:image" content="${c(q)}">
|
|
7412
|
+
<meta name="twitter:image" content="${c(q)}">
|
|
7379
7413
|
`;let W=$;if(!Q)W=W.replace(/<head[^>]*>/,`$&
|
|
7380
|
-
<title>${
|
|
7414
|
+
<title>${c(G)}</title>`);return W.replace(/<head[^>]*>/,`$&
|
|
7381
7415
|
${z}
|
|
7382
|
-
`)}function
|
|
7416
|
+
`)}function c($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var MZ,IZ;var j3=y(()=>{q1();T0();MZ={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return Z0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${c(X)}" content="${c(Q)}">`},hasEndTag:!1},IZ={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return Z0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return Z0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(X)}</script>`}catch(X){let Q=X instanceof Error?X.message:String(X);return Z0("StructuredData",Q,s.EVALUATION_ERROR)}},hasEndTag:!0}});import t5 from"path";function Iq($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",X=Z,Q=[],G=!0;if(J){let U=J.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let B=U[1],_=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)X=_[1];let j=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)Q=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=B.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",z=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=z?z[1].trim():"";return{tag:X,props:Q,template:q,styles:W,script:J,shadowDOM:G}}function Dq($){let{tag:Z,props:Y,template:J,styles:X,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),z=Y.map((U)=>`'${U}'`).join(", "),W=Y.map((U)=>`
|
|
7383
7417
|
get ${U}() {
|
|
7384
7418
|
return this.getAttribute('${U}') || '';
|
|
7385
7419
|
}
|
|
@@ -7430,16 +7464,16 @@ ${W}
|
|
|
7430
7464
|
}
|
|
7431
7465
|
|
|
7432
7466
|
customElements.define('${Z}', ${G});
|
|
7433
|
-
`}async function DZ($,Z,Y,J){if(Z.length<1)return Z0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[t5.join(t5.dirname(J),G,`${X}.stx`),t5.join(process.cwd(),G,`${X}.stx`),t5.join(t5.dirname(J),`${X}.stx`)],q=null;for(let U of K)if(await
|
|
7434
|
-
${
|
|
7435
|
-
</script>`}var EZ=y(()=>{K1();N0()});var kZ={};r(kZ,{timingPlugin:()=>Sq,pluginManager:()=>Dq,definePlugin:()=>R4,debugPlugin:()=>bq,createVariablesPlugin:()=>yq,createFilterPlugin:()=>kq,createDirectivePlugin:()=>Eq,PluginManager:()=>H3});function R4($){return $}class H3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let X=J[$];if(X)try{let Q=await X(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return J}}function Eq($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function kq($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function yq($){return R4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var Dq,bq,Sq;var bZ=y(()=>{Dq=new H3;bq=R4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),Sq=R4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var yZ={};r(yZ,{validateConfig:()=>fq,loadStxConfig:()=>q1,defineStxConfig:()=>xq,defaultConfig:()=>u1,config:()=>L3});import O3 from"fs";import k0 from"path";import{loadConfigWithResult as Pq}from"bunfig";function Cq($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=k0.join(process.cwd(),"resources","views"),X=k0.join(process.cwd(),"resources","layouts");if(O3.existsSync(J)&&O3.existsSync(X))return{root:"resources",pagesDir:"views"};let Q=k0.join(process.cwd(),"resources","views","pages");if(O3.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function vq($){if(f6($.stateDir),$.stateDir=R5(),$.cachePath=T5($.cachePath),$.build)$.build.cacheDir=T5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=T5($.media.cache.directory);if($.story)$.story.outDir=T5($.story.outDir)}async function q1($){if(!$){if(G5)return G5;if(T4)return T4}let Z=$?k0.resolve($):process.cwd(),Y=SZ.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await Pq({name:"stx",alias:"ui",cwd:Z,defaultConfig:u1,verbose:!1})).config;vq(Q);let G=Cq(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!k0.isAbsolute(Q.partialsDir))Q.partialsDir=k0.join(K,Q.partialsDir);if(Q.componentsDir&&!k0.isAbsolute(Q.componentsDir))Q.componentsDir=k0.join(K,Q.componentsDir);if(Q.layoutsDir&&!k0.isAbsolute(Q.layoutsDir))Q.layoutsDir=k0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (bZ(),kZ)),q=[],z=[];for(let W of Q.plugins){let U=typeof W==="string"?W:W[0],B=typeof W==="string"?{}:W[1]||{};try{let j,_;try{j=await import(U),_=k0.dirname(W0.resolve(U))}catch{let L=k0.resolve(process.cwd(),U);j=await import(L),_=k0.dirname(L)}let H=j.default||j;if(K.register(H,Q),H.components){let L=k0.resolve(_,H.components);q.push(L)}if(H.pages){let L=k0.resolve(_,H.pages),V=B.path||"/";z.push({dir:L,prefix:V})}if(H.setup){let L={addDirective:(V)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(V)},addRoute:(V,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[V]=O},addMiddleware:(V)=>{Q.middleware=Q.middleware||[],Q.middleware.push(V)},pluginDir:_,config:Q};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=z}return Q})();if(SZ.set(Z,J),!$)T4=J,J.then((X)=>{G5=X}).catch(()=>{});return J}function xq($){return $}function fq($){let Z=[],Y=[];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,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${X}].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,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.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)Y.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((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.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((X)=>typeof X!=="number"||X<16||X>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)Y.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)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var u1,G5=null,SZ,T4=null,L3;var m1=y(()=>{t4();e4();$7();Z7();S7();m8();q3();_Z();_3();M5();EZ();u1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:s1,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:_8,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:DZ,hasEndTag:!1,description:"Include a web component in the template"},d6,u6,MZ,IZ,m6,l6,c6,p6,s6,t6,u8,K3,...jZ],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:"#app-content",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}};SZ=new Map;L3=new Proxy(u1,{get($,Z){if(G5&&Z in G5)return G5[Z];if(!T4)q1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var fZ={};r(fZ,{resetCssCache:()=>lq,resetCrosswindCache:()=>cq,rebuildCrosswindCSS:()=>iq,loadCrosswindConfig:()=>N3,loadCrosswind:()=>A3,injectCrosswindCSS:()=>$$,getCachedCSS:()=>nq,generateCrosswindCSS:()=>xZ,extractClassNames:()=>vZ,buildCrosswindCSS:()=>CZ});import X0 from"path";import{hasLocalConfig as gq}from"bunfig/discovery";function w3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function F3($,Z){if(z1.has($))z1.delete($);else if(z1.size>=hq)z1.delete(z1.keys().next().value);z1.set($,Z)}async function dq($){if(!w1)return null;try{let Z=Bun.file(X0.join(w1,`cw-${w3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function uq($,Z){if(!w1)return;try{if(!fs.existsSync(w1))fs.mkdirSync(w1,{recursive:!0});await Bun.write(X0.join(w1,`cw-${w3($)}.css`),Z)}catch{}}async function PZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function mq(){let $=[],Z=process.cwd();while(Z!==X0.dirname(Z))$.push(X0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=X0.dirname(Z);return $}function pq(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[X0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function A3(){if(V3)return V1;V3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await PZ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(Q))}`);return G}}return null},Z=await $(mq());if(Z)return V1=Z,V1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await PZ(X);if(Q){if(V1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} CSS engine loaded`);return V1}}let J=await $(pq());if(J)return V1=J,V1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${_0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${_0.reset}`),console.warn(`${_0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${_0.reset}`),null}}function lq(){z1.clear()}function cq(){V1=null,V3=!1,s0=null,e5="",z1.clear(),M4=null}async function N3($){try{if(!gq({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=X0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${_0.yellow}[Crosswind]${_0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function CZ($){if(K5)return e5;K5=!0;try{let Z=await A3();if(!Z||!Z.build)return K5=!1,"";if(!s0)s0=await N3($);if(!s0)return K5=!1,"";let Y=Z.defaultConfig?.theme||{},J=s0.theme||{},X={...Z.defaultConfig,...s0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(e5=G.css,console.log(`${_0.cyan}[Crosswind]${_0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let q=X0.isAbsolute(X.output)?X.output:X0.join($,X.output),z=X0.dirname(q);if(!fs.existsSync(z))fs.mkdirSync(z,{recursive:!0});await Bun.write(q,G.css)}return K5=!1,G.css}catch(Z){return console.error(`${_0.red}[Crosswind]${_0.reset} Build error:`,Z),K5=!1,e5}}async function iq($){s0=null,await CZ($)}function nq(){return e5}function vZ($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}Q=X.exec($)}return Z}async function xZ($,Z){try{let Y=await A3();if(!Y)return"";let J=vZ($);if(J.size===0)return"";let X=Z?X0.resolve(Z):process.cwd();if(!w1)w1=B1(X,"cache");let Q=[...J].sort().join(" "),G=`${M4||"default"}::${Q}`,K=z1.get(G);if(K!==void 0)return F3(G,K),K;let q=await dq(G);if(q!==null)return F3(G,q),q;if(!s0){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (m1(),yZ)),R=await N(X);if(R.css)if(typeof R.css==="string"){let T=X0.isAbsolute(R.css)?R.css:X0.resolve(X,R.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${_0.green}[Crosswind]${_0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=X0.isAbsolute(R.css.config)?R.css.config:X0.resolve(X,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${_0.green}[Crosswind]${_0.reset} Using inline CSS config from stx.config.ts`)}}catch{}s0=A||await N3(X);try{M4=w3(JSON.stringify(s0??{}))}catch{M4="unhashable"}}let z=Y.defaultConfig||Y.config,W=s0||{},U=z.theme||{},j=(W.theme||{}).extend||{},_={...U};if(Object.keys(j).length>0)_.extend=j;let H=[...z.safelist||[],...W.safelist||[]],L={...z,...W,content:[],output:"",preflight:!0,minify:!1,theme:_,safelist:H},V=new Y.CSSGenerator(L);for(let A of H)V.generate(A);for(let A of J)V.generate(A);let O=V.toCSS(!0,!1),F=L.shortcuts||W.shortcuts||{};for(let[A,N]of Object.entries(F)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean);for(let T of R)V.generate(T)}O=V.toCSS(!0,!1);let w=O.split(`
|
|
7436
|
-
`);for(let[A,N]of Object.entries(
|
|
7467
|
+
`}async function DZ($,Z,Y,J){if(Z.length<1)return Z0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[t5.join(t5.dirname(J),G,`${X}.stx`),t5.join(process.cwd(),G,`${X}.stx`),t5.join(t5.dirname(J),`${X}.stx`)],q=null;for(let U of K)if(await n(U)){q=await Bun.file(U).text();break}if(!q)return Z0("WebComponent",`Component file not found: ${X}.stx`,s.FILE_NOT_FOUND);let z=Iq(q,X);return`<script type="module">
|
|
7468
|
+
${Dq(z)}
|
|
7469
|
+
</script>`}var EZ=y(()=>{q1();N0()});var kZ={};r(kZ,{timingPlugin:()=>yq,pluginManager:()=>Eq,definePlugin:()=>R4,debugPlugin:()=>Sq,createVariablesPlugin:()=>Pq,createFilterPlugin:()=>bq,createDirectivePlugin:()=>kq,PluginManager:()=>H3});function R4($){return $}class H3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let X=J[$];if(X)try{let Q=await X(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return J}}function kq($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function bq($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function Pq($){return R4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var Eq,Sq,yq;var bZ=y(()=>{Eq=new H3;Sq=R4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),yq=R4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var yZ={};r(yZ,{validateConfig:()=>gq,loadStxConfig:()=>z1,defineStxConfig:()=>fq,defaultConfig:()=>u1,config:()=>L3});import O3 from"fs";import k0 from"path";import{loadConfigWithResult as Cq}from"bunfig";function vq($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=k0.join(process.cwd(),"resources","views"),X=k0.join(process.cwd(),"resources","layouts");if(O3.existsSync(J)&&O3.existsSync(X))return{root:"resources",pagesDir:"views"};let Q=k0.join(process.cwd(),"resources","views","pages");if(O3.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function xq($){if(f6($.stateDir),$.stateDir=R5(),$.cachePath=T5($.cachePath),$.build)$.build.cacheDir=T5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=T5($.media.cache.directory);if($.story)$.story.outDir=T5($.story.outDir)}async function z1($){if(!$){if(G5)return G5;if(T4)return T4}let Z=$?k0.resolve($):process.cwd(),Y=SZ.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await Cq({name:"stx",alias:"ui",cwd:Z,defaultConfig:u1,verbose:!1})).config;xq(Q);let G=vq(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!k0.isAbsolute(Q.partialsDir))Q.partialsDir=k0.join(K,Q.partialsDir);if(Q.componentsDir&&!k0.isAbsolute(Q.componentsDir))Q.componentsDir=k0.join(K,Q.componentsDir);if(Q.layoutsDir&&!k0.isAbsolute(Q.layoutsDir))Q.layoutsDir=k0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (bZ(),kZ)),q=[],z=[];for(let W of Q.plugins){let U=typeof W==="string"?W:W[0],B=typeof W==="string"?{}:W[1]||{};try{let _,j;try{_=await import(U),j=k0.dirname(W0.resolve(U))}catch{let L=k0.resolve(process.cwd(),U);_=await import(L),j=k0.dirname(L)}let H=_.default||_;if(K.register(H,Q),H.components){let L=k0.resolve(j,H.components);q.push(L)}if(H.pages){let L=k0.resolve(j,H.pages),F=B.path||"/";z.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(F)},addRoute:(F,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[F]=O},addMiddleware:(F)=>{Q.middleware=Q.middleware||[],Q.middleware.push(F)},pluginDir:j,config:Q};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(_){console.warn(`[stx] Failed to load plugin ${U}:`,_.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=z}return Q})();if(SZ.set(Z,J),!$)T4=J,J.then((X)=>{G5=X}).catch(()=>{});return J}function fq($){return $}function gq($){let Z=[],Y=[];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,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${X}].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,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.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)Y.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((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.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((X)=>typeof X!=="number"||X<16||X>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)Y.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)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var u1,G5=null,SZ,T4=null,L3;var m1=y(()=>{t4();e4();$7();Z7();S7();m8();q3();jZ();j3();M5();EZ();u1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:s1,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:j8,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:DZ,hasEndTag:!1,description:"Include a web component in the template"},d6,u6,MZ,IZ,m6,l6,c6,p6,s6,t6,u8,K3,..._Z],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:"#app-content",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}};SZ=new Map;L3=new Proxy(u1,{get($,Z){if(G5&&Z in G5)return G5[Z];if(!T4)z1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var fZ={};r(fZ,{resetCssCache:()=>cq,resetCrosswindCache:()=>iq,rebuildCrosswindCSS:()=>nq,loadCrosswindConfig:()=>N3,loadCrosswind:()=>A3,injectCrosswindCSS:()=>$$,getCachedCSS:()=>oq,generateCrosswindCSS:()=>xZ,extractClassNames:()=>vZ,buildCrosswindCSS:()=>CZ});import X0 from"path";import{hasLocalConfig as hq}from"bunfig/discovery";function w3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function F3($,Z){if(W1.has($))W1.delete($);else if(W1.size>=dq)W1.delete(W1.keys().next().value);W1.set($,Z)}async function uq($){if(!w1)return null;try{let Z=Bun.file(X0.join(w1,`cw-${w3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function mq($,Z){if(!w1)return;try{if(!fs.existsSync(w1))fs.mkdirSync(w1,{recursive:!0});await Bun.write(X0.join(w1,`cw-${w3($)}.css`),Z)}catch{}}async function PZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function pq(){let $=[],Z=process.cwd();while(Z!==X0.dirname(Z))$.push(X0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=X0.dirname(Z);return $}function lq(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[X0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function A3(){if(V3)return V1;V3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await PZ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(Q))}`);return G}}return null},Z=await $(pq());if(Z)return V1=Z,V1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await PZ(X);if(Q){if(V1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded`);return V1}}let J=await $(lq());if(J)return V1=J,V1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${j0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${j0.reset}`),console.warn(`${j0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${j0.reset}`),null}}function cq(){W1.clear()}function iq(){V1=null,V3=!1,o0=null,e5="",W1.clear(),M4=null}async function N3($){try{if(!hq({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=X0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${j0.yellow}[Crosswind]${j0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function CZ($){if(K5)return e5;K5=!0;try{let Z=await A3();if(!Z||!Z.build)return K5=!1,"";if(!o0)o0=await N3($);if(!o0)return K5=!1,"";let Y=Z.defaultConfig?.theme||{},J=o0.theme||{},X={...Z.defaultConfig,...o0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(e5=G.css,console.log(`${j0.cyan}[Crosswind]${j0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let q=X0.isAbsolute(X.output)?X.output:X0.join($,X.output),z=X0.dirname(q);if(!fs.existsSync(z))fs.mkdirSync(z,{recursive:!0});await Bun.write(q,G.css)}return K5=!1,G.css}catch(Z){return console.error(`${j0.red}[Crosswind]${j0.reset} Build error:`,Z),K5=!1,e5}}async function nq($){o0=null,await CZ($)}function oq(){return e5}function vZ($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}Q=X.exec($)}return Z}async function xZ($,Z){try{let Y=await A3();if(!Y)return"";let J=vZ($);if(J.size===0)return"";let X=Z?X0.resolve(Z):process.cwd();if(!w1)w1=B1(X,"cache");let Q=[...J].sort().join(" "),G=`${M4||"default"}::${Q}`,K=W1.get(G);if(K!==void 0)return F3(G,K),K;let q=await uq(G);if(q!==null)return F3(G,q),q;if(!o0){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (m1(),yZ)),R=await N(X);if(R.css)if(typeof R.css==="string"){let T=X0.isAbsolute(R.css)?R.css:X0.resolve(X,R.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=X0.isAbsolute(R.css.config)?R.css.config:X0.resolve(X,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${j0.green}[Crosswind]${j0.reset} Using inline CSS config from stx.config.ts`)}}catch{}o0=A||await N3(X);try{M4=w3(JSON.stringify(o0??{}))}catch{M4="unhashable"}}let z=Y.defaultConfig||Y.config,W=o0||{},U=z.theme||{},_=(W.theme||{}).extend||{},j={...U};if(Object.keys(_).length>0)j.extend=_;let H=[...z.safelist||[],...W.safelist||[]],L={...z,...W,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of J)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||W.shortcuts||{};for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean);for(let T of R)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
|
|
7470
|
+
`);for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of R){let E=I.startsWith("dark:"),b=`.${(E?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let D=0;D<w.length;D++){let P=w[D].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let f=D,g="";while(f<w.length){if(g+=w[f],w[f].includes("}"))break;f++}let d=g.match(/\{([^}]+)\}/);if(d)if(E)M.push(d[1].trim());else T.push(d[1].trim());break}}}if(T.length)O+=`
|
|
7437
7471
|
.${A} { ${T.join(" ")} }`;if(M.length)O+=`
|
|
7438
|
-
@media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return F3(G,O),
|
|
7472
|
+
@media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return F3(G,O),mq(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function $$($,Z){let Y=await xZ($,Z);if(!Y)return $;let J=`<style data-crosswind="generated">
|
|
7439
7473
|
${Y}
|
|
7440
7474
|
</style>`,X=/<style data-crosswind="generated">[\s\S]*?<\/style>/g;if(X.test($)){let Q=!1;return $.replace(X,()=>{if(Q)return"";return Q=!0,J})}if($.includes("</head>"))return $.replace("</head>",`${J}
|
|
7441
7475
|
</head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
7442
|
-
${J}`);return J+$}var V1=null,V3=!1,
|
|
7476
|
+
${J}`);return J+$}var V1=null,V3=!1,o0=null,e5="",K5=!1,dq=256,W1,w1=null,M4=null;var I4=y(()=>{M5();g6();W1=new Map});function gZ(){return`
|
|
7443
7477
|
// STX Lifecycle Runtime
|
|
7444
7478
|
(function() {
|
|
7445
7479
|
if (typeof window === 'undefined') return;
|
|
@@ -7784,7 +7818,7 @@ else {
|
|
|
7784
7818
|
|
|
7785
7819
|
console.log('[stx] Lifecycle runtime initialized');
|
|
7786
7820
|
})();
|
|
7787
|
-
`}function R3($){return Symbol($)}var rL,aL,tL;var hZ=y(()=>{rL=R3("theme"),aL=R3("router"),tL=R3("i18n")});import*as uZ from"crypto";function dZ($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function
|
|
7821
|
+
`}function R3($){return Symbol($)}var rL,aL,tL;var hZ=y(()=>{rL=R3("theme"),aL=R3("router"),tL=R3("i18n")});import*as uZ from"crypto";function dZ($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function sq(){return`stx-${uZ.randomBytes(4).toString("hex")}`}function rq($){return/\$\w+\./.test($)}function aq($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,X=$;return X=X.replace(J,(Q,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let z=[],W=!1,U=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(rq(V)){W=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(z.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),dZ(A).forEach((R)=>Y.add(R)),O==="text")U=U.replace(F,"");else if(O==="class")U=U.replace(F,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(F,"");else U=U.replace(F,`${O}=""`)}}}if(!W)return Q;let j=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=sq(),U=` id="${H}"${U}`;for(let L of z)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:dZ(L.expr)});return`<${G}${U}${q}`}),{html:X,bindings:Z,stores:Y}}function tq($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
|
|
7788
7822
|
<script>
|
|
7789
7823
|
(function() {
|
|
7790
7824
|
'use strict';
|
|
@@ -7942,10 +7976,10 @@ else {
|
|
|
7942
7976
|
}
|
|
7943
7977
|
})();
|
|
7944
7978
|
</script>
|
|
7945
|
-
`,J}function mZ($){let{html:Z,bindings:Y,stores:J}=
|
|
7979
|
+
`,J}function mZ($){let{html:Z,bindings:Y,stores:J}=aq($);if(Y.length===0)return $;let X=tq(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var pZ=()=>{};function eq($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return $z(Z);case"google-analytics":return Zz(Z);case"plausible":return Yz(Z);case"self-hosted":return Jz(Z);case"custom":return Xz(Z);default:return""}}function $z($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",X=[`data-site="${g0(Z.siteId)}"`];if(Z.honorDnt)X.push('data-honor-dnt="true"');if(Z.spa)X.push('data-spa="auto"');if(Z.canonical)X.push(`data-canonical="${g0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
|
|
7946
7980
|
<!-- Fathom Analytics -->
|
|
7947
7981
|
<script src="${g0(Y)}" ${X.join(" ")}${J}></script>
|
|
7948
|
-
`}function
|
|
7982
|
+
`}function Zz($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=g0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
|
|
7949
7983
|
<!-- Google Analytics -->
|
|
7950
7984
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
|
|
7951
7985
|
<script>
|
|
@@ -7955,10 +7989,10 @@ else {
|
|
|
7955
7989
|
gtag('config', '${Y}');
|
|
7956
7990
|
${J}
|
|
7957
7991
|
</script>
|
|
7958
|
-
`}function
|
|
7992
|
+
`}function Yz($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${g0(Z.domain)}"`],X=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")X=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
|
|
7959
7993
|
<!-- Plausible Analytics -->
|
|
7960
7994
|
<script defer data-domain="${g0(Z.domain)}" src="${g0(X)}"></script>
|
|
7961
|
-
`}function
|
|
7995
|
+
`}function Jz($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=g0(Z.siteId),J=g0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
|
|
7962
7996
|
d.addEventListener('click',function(e){
|
|
7963
7997
|
var a=e.target.closest('a');
|
|
7964
7998
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -7991,7 +8025,7 @@ else {
|
|
|
7991
8025
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
7992
8026
|
})();
|
|
7993
8027
|
</script>
|
|
7994
|
-
`}function
|
|
8028
|
+
`}function Xz($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
|
|
7995
8029
|
<!-- Custom Analytics -->
|
|
7996
8030
|
<script>
|
|
7997
8031
|
${Z.inlineScript}
|
|
@@ -7999,7 +8033,7 @@ ${Z.inlineScript}
|
|
|
7999
8033
|
`;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${g0(Z.scriptId)}"`);if(Z.attributes)for(let[X,Q]of Object.entries(Z.attributes))Y.push(`${g0(X)}="${g0(Q)}"`);return`
|
|
8000
8034
|
<!-- Custom Analytics -->
|
|
8001
8035
|
<script${Y.length>0?` ${Y.join(" ")}`:""} src="${g0(Z.scriptUrl)}" defer></script>
|
|
8002
|
-
`}function lZ($,Z){let Y=
|
|
8036
|
+
`}function lZ($,Z){let Y=eq(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function g0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var cZ=()=>{};function oZ($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.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(Qz.has(J))Z.systemKeys.push(J);else if(J in sZ)Z.mouse=J;else if(J in nZ||/^[a-z]$/.test(J))Z.keys.push(nZ[J]||J.toUpperCase());else if(J.startsWith("debounce")){let X=J.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(J.startsWith("throttle")){let X=J.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function rZ($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,G,K]=X,q=X.index,z=q+Q.length,W=`__stx_evt_${Y++}`,U=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!iZ.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:oZ(F.slice(1)),elementId:W})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!iZ.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:oZ(F.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:Q,elementId:W,events:U,startIndex:q,endIndex:z})}return Z}function Gz($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=sZ[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Kz($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function qz($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=Gz($),X=Kz($.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(", ")} }`:"",K=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
8003
8037
|
(function() {
|
|
8004
8038
|
var $el = document.getElementById('${Y}');
|
|
8005
8039
|
if (!$el) return;
|
|
@@ -8053,7 +8087,7 @@ else {
|
|
|
8053
8087
|
__stx_runHandler('${K}', $event, $el);
|
|
8054
8088
|
}
|
|
8055
8089
|
}${G});
|
|
8056
|
-
})();`}function
|
|
8090
|
+
})();`}function zz($){if($.length===0)return"";return`
|
|
8057
8091
|
<script data-stx-events>
|
|
8058
8092
|
(function() {
|
|
8059
8093
|
'use strict';
|
|
@@ -8101,11 +8135,11 @@ else {
|
|
|
8101
8135
|
}
|
|
8102
8136
|
|
|
8103
8137
|
// Event listeners
|
|
8104
|
-
${$.flatMap((Y)=>Y.events).map(
|
|
8138
|
+
${$.flatMap((Y)=>Y.events).map(qz).join(`
|
|
8105
8139
|
`)}
|
|
8106
8140
|
})();
|
|
8107
|
-
</script>`}function
|
|
8108
|
-
`+Q.slice(K);else Q+=G;return Q}var iZ,nZ,
|
|
8141
|
+
</script>`}function Wz($){let Z=rZ($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let X=Z.length-1;X>=0;X--){let Q=Z[X],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of Q.events)q.elementId=K[1]}for(let K of Q.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(z,""),G=G.replace(W,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),J.push(...Q.events)}return{template:Y,bindings:J}}function aZ($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:z}=Wz($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...z],q}let X=rZ($);if(X.length===0)return $;let Q=$;for(let q=X.length-1;q>=0;q--){let z=X[q],W=z.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let U=W.match(/id=["']([^"']+)["']/);if(U)for(let B of z.events)B.elementId=U[1]}for(let U of z.events){let B=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");W=W.replace(_,""),W=W.replace(j,"")}Q=Q.slice(0,z.startIndex)+W+Q.slice(z.endIndex)}let G=zz(X),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
|
|
8142
|
+
`+Q.slice(K);else Q+=G;return Q}var iZ,nZ,Qz,sZ;var tZ=y(()=>{iZ=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"]),nZ={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"},Qz=new Set(["ctrl","alt","shift","meta"]),sZ={left:0,middle:1,right:2}});function D4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function eZ($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function Bz($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[X,Q,G]=J,K=J.index,q=eZ(G,"x-data");if(!q)continue;let z=`__stx_scope_${Z2++}`,W=eZ(G,"x-init"),U=_z($,Q,K+X.length),B=$.slice(K,U.endIndex),_=jz(B);Z.push({id:z,selector:`[data-stx-scope="${z}"]`,stateExpr:q,initExpr:W,bindings:[],refs:_})}return Z}function _z($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X,K.lastIndex=X;let q=Q.exec($),z=G.exec($),W=K.exec($);if(W&&W.index<(q?.index??1/0)){X=W.index+W[0].length;continue}if(!z)return{endIndex:$.length};if(q&&q.index<z.index)J++,X=q.index+q[0].length;else{if(J--,J===0)return{endIndex:z.index+z[0].length};X=z.index+z[0].length}}return{endIndex:$.length}}function jz($){let Z=new Map,Y=$.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,X;while((X=J.exec(Y))!==null){let[,Q,G]=X,K=Hz(Q);Z.set(G,K)}return Z}function Hz($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${Uz++}`}function Oz(){return`
|
|
8109
8143
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
8110
8144
|
(function() {
|
|
8111
8145
|
var style = document.createElement('style');
|
|
@@ -8312,7 +8346,7 @@ window.__stx_reactive = (function() {
|
|
|
8312
8346
|
|
|
8313
8347
|
return { initScope: initScope, reactive: reactive };
|
|
8314
8348
|
})();
|
|
8315
|
-
`}function $2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=u0(X,Z,!0);if(Q===void 0)return J;return String(Q)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{try{let Q=u0(X,Z,!0);if(Q===void 0)return J;if(typeof Q==="string"){let G=Q.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(Q)}catch{return J}}),Y}function
|
|
8349
|
+
`}function $2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=u0(X,Z,!0);if(Q===void 0)return J;return String(Q)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{try{let Q=u0(X,Z,!0);if(Q===void 0)return J;if(typeof Q==="string"){let G=Q.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(Q)}catch{return J}}),Y}function Lz($,Z){if($.length===0)return"";let Y=$.map((J)=>{let X=JSON.stringify(Object.fromEntries(J.refs)),Q=$2(J.stateExpr,Z),G=J.initExpr?$2(J.initExpr,Z):null,K=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
|
|
8316
8350
|
(function() {
|
|
8317
8351
|
var scopeEl = document.querySelector('${J.selector}');
|
|
8318
8352
|
if (!scopeEl) return;
|
|
@@ -8321,16 +8355,16 @@ window.__stx_reactive = (function() {
|
|
|
8321
8355
|
})();`}).join(`
|
|
8322
8356
|
`);return`
|
|
8323
8357
|
<script data-stx-scoped data-stx-reactive>
|
|
8324
|
-
${
|
|
8358
|
+
${Oz()}
|
|
8325
8359
|
${Y}
|
|
8326
|
-
</script>`}function Y2($,Z,Y){if(Z2=0,!
|
|
8327
|
-
`+X.slice(G);else X+=Q;return X}function Lz($,Z){let Y=$;for(let J of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${D4(J.stateExpr)}["']`,"gi").exec(Y);if(Q)J.id=Q[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${D4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${D4(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${D4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Fz($){return/x-data\s*=\s*["']/.test($)}var Z2=0,Wz=0;var J2=y(()=>{Z1()});import Vz from"fs";import T3 from"path";import{createHighlighter as wz}from"ts-syntax-highlighter";async function Az($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let J=(await Vz.promises.stat($)).mtime.getTime();if(Z.cache&&M3.has($)){let U=M3.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=$9(X),K=Z.markdown||L3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},z=I5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)z=await Nz(z,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:z,data:Q||{}};if(Z.cache)M3.set($,{...W,updatedAt:J});return W}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:q0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function Nz($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!E4)try{E4=await wz({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,q,z,W)=>{let U=W.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),B=z||(Y?"text":"");if(!B)return K;try{if(!E4.getSupportedLanguages().includes(B))return K;return(await E4.highlight(U,B,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${z}:`,j)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[q,z,W,U]=K,B=await X(q,z,W,U);Q=Q.replace(q,B)}return Q}async function X2($,Z,Y="",J={}){return await Rz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,z)=>{try{let W=K;if(!T3.isAbsolute(K))W=T3.resolve(T3.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let w=F.indexOf(":");if(w>0){let A=F.substring(0,w).trim(),N=F.substring(w+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);U[A]=N}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:B,data:j}=await Az(W,J),_={...Z,...j,...U},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(V,O)=>{let F=O.trim();return _[F]!==void 0?String(_[F]):V}),H}catch(W){let U=W instanceof Error?W.message:String(W);return q0("Markdown File",`Error including markdown file: ${U}`,Y,$,z,G)}})}async function Rz($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],q=X.index,z=X;J.push(Y(...z).then((W)=>({match:K,replacement:W,index:q})))}let Q=await Promise.all(J);Q.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of Q)G=G.replace(K,()=>q);return G}var M3,E4=null;var Q2=y(()=>{m1();N0();M3=new Map});function A1($,Z){try{let Y=$.trim();if(G0(Y))return K0(Y,Object.keys(Z))(...Object.values(Z));else return J0(Y,Z)}catch{return!1}}var G2=y(()=>{T0()});function Tz($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=H7(J,G);if(!K)break;try{let q;if(G0(K.expression))q=K0(K.expression,Object.keys(Z))(...Object.values(Z));else q=J0(K.expression,Z);let z="",W=!1;for(let U of K.cases)if(U.type==="default"){if(!W)z=U.content.trim()}else try{let B;if(U.value&&G0(U.value))B=K0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)B=J0(U.value,Z);if(q===B){z=U.content.trim(),W=!0;break}}catch{continue}J=J.substring(0,G)+z+J.substring(K.end),X=!0}catch(q){let z=q instanceof Error?q.message:String(q),W=Z0("Switch",`Error evaluating @switch expression: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,G)+W+J.substring(K.end);break}}return J}function p1($,Z,Y){let J=$;J=Tz(J,Z,Y);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=L1(J,K+7);if(!q)break;let z=q.endPos,W=v1(J,"unless","endunless",z);if(W===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=J.slice(z,W),B=q.expression,j=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],w;while((w=L.exec(U))!==null)F.push({pos:w.index,type:"open"});while((w=V.exec(U))!==null)F.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)F.push({pos:w.index,type:"else"});F.sort((A,N)=>A.pos-N.pos);for(let A of F)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){j=A.pos;break}}let _;if(j!==-1){let H=U.slice(0,j),L=U.slice(j+5);_=`@if (${B})${L}@else ${H}@endif`}else _=`@if (!(${B}))${U}@endif`;J=J.substring(0,K)+_+J.substring(W+10),Q=!0}}J=D3(J,Z,Y),J=E3(J,Z,Y),J=I3(J,Z);let X=()=>{let Q=l5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let q="",z=!1;for(let W of K.branches){if(z)break;if(W.type==="else")q=W.content,z=!0;else try{let U;if(W.condition&&G0(W.condition))U=K0(W.condition,Object.keys(Z))(...Object.values(Z));else if(W.condition)U=J0(W.condition,Z);if(U)q=W.content,z=!0}catch(U){q=Z0(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),z=!0}}J=J.substring(0,K.start)+q+J.substring(K.end)}catch(q){let z=q instanceof Error?q.message:String(q),W=Z0("If",`Error processing @if block: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,K.start)+W+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function K2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(X===Y){Z++;break}J.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function I3($,Z){let Y=$;function J(K,q,z,W){let U=1,B=W,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${z}(?![a-z])`,"g");while(B<K.length&&U>0){j.lastIndex=B,_.lastIndex=B;let H=j.exec(K),L=_.exec(K),V=H?H.index:1/0,O=L?L.index:1/0;if(V<O)U++,B=V+H[0].length;else if(O<1/0){if(U--,U===0)return O;B=O+L[0].length}else break}return-1}function X(K,q,z){let W=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${z}(?![a-z])`,"g"),j=/@else(?![a-z])/g,_=[],H;while((H=U.exec(K))!==null)_.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)_.push({pos:H.index,type:"close"});while((H=j.exec(K))!==null)_.push({pos:H.index,type:"else"});_.sort((L,V)=>L.pos-V.pos);for(let L of _)if(L.type==="open")W++;else if(L.type==="close")W--;else if(L.type==="else"&&W===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let z=q.index,W,U,B=Y.slice(z+5),j=K2(B);if(j)W=j.value,U=z+5+j.consumed;else U=z+5;let _=J(Y,"auth","endauth",U);if(_===-1){console.warn(`[stx] @auth directive at position ${z} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,_),L=X(H,"auth","endauth"),V;if(!Z.auth)V=!1;else V=W?A1(`auth?.check && auth?.user?.[${W}]`,Z):A1("auth?.check",Z);let O;if(L!==-1){let F=H.slice(0,L),w=H.slice(L+5);O=V?F:w}else O=V?H:"";Y=Y.substring(0,z)+O+Y.substring(_+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let z=q.index,W,U,B=Y.slice(z+6),j=K2(B);if(j)W=j.value,U=z+6+j.consumed;else U=z+6;let _=J(Y,"guest","endguest",U);if(_===-1){console.warn(`[stx] @guest directive at position ${z} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,_),L=X(H,"guest","endguest"),V;if(!Z.auth)V=!0;else V=W?A1(`!auth?.check || !auth?.user?.[${W}]`,Z):A1("!auth?.check",Z);let O;if(L!==-1){let F=H.slice(0,L),w=H.slice(L+5);O=V?F:w}else O=V?H:"";Y=Y.substring(0,z)+O+Y.substring(_+9),K=!0}}function Q(K,q,z){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[K];if(q)W.push(q);if(z){let U=A1(z,Z);W.push(U)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(K){let q=K.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 K of["can","cannot"]){let q=`end${K}`,z=K==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let B=U.index,j=Y.slice(B+`@${K}`.length),_=G(j);if(!_)break;let H=B+`@${K}`.length+_.paramsEnd,L=J(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let V=Y.slice(H,L),O=[],F=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${z}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],M;while((M=w.exec(V))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(V))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(V))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=R.exec(V))!==null)T.push({pos:M.index,type:"else"});T.sort((D,P)=>D.pos-P.pos);for(let D of T){if(D.type==="open"){F++;continue}if(D.type==="close"){F--;continue}if(F===0)O.push(D)}let I=[],E=0;for(let D=0;D<O.length;D++){let P=O[D];if(I.push({content:V.slice(E,P.pos),ability:void 0}),P.type==="elseDirective"){let f=V.slice(P.pos+`@${z}`.length),g=G(f);if(g){I[I.length-1]={content:V.slice(E,P.pos)},E=P.pos+`@${z}`.length+g.paramsEnd,I.push({content:"",ability:g.ability,type:g.type,id:g.id}),I.pop();let d=O[D+1],c=d?d.pos:V.length;I.push({content:V.slice(E,c),ability:g.ability,type:g.type,id:g.id}),E=c}}else E=P.pos+5}if(E<V.length){let D=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:V.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:V.slice(E)})}let k=Q(_.ability,_.type,_.id),C=K==="can"?k:!k,b="";if(C)b=I[0]?.content||"";else{let D=!1;for(let P=1;P<I.length;P++){let f=I[P];if(f.isFinalElse){b=f.content,D=!0;break}if(f.ability){let g=Q(f.ability,f.type,f.id);if(K==="can"?g:!g){b=f.content,D=!0;break}}}if(!D&&I.length>0){let P=I[I.length-1];if(P.isFinalElse)b=P.content}}Y=Y.substring(0,B)+b+Y.substring(L+`@${q}`.length),W=!0}}return Y}function D3($,Z,Y){let J=$;function X(Q,G,K,q,z){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),B=Q.match(U);if(!B||B.index===void 0)break;let j=B.index,_=L1(Q,j+`@${G}`.length);if(!_)break;let H=_.endPos,L=v1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let V=Q.slice(H,L),O=_.expression,F=-1,w=0,A=0;while(A<V.length){let N=V.indexOf("@",A);if(N===-1)break;let R=V.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){F=N;break}A=N+1}try{let N=q(O.trim()),R;if(F!==-1){let T=V.slice(0,F),M=V.slice(F+5);R=N?T:M}else R=N?V:"";Q=Q.substring(0,j)+R+Q.substring(L+`@${K}`.length),W=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=Z0(z,`Error processing @${G} directive: ${R}`,s.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(L+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=A1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=A1(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 E3($,Z,Y){let J=$,X="development";function Q(G,K,q,z){let W=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),_=G,H=!0;while(H){H=!1,W.lastIndex=0;let L=W.exec(_);if(!L)break;let V=L.index,O=V+L[0].length;if(K==="env"){let k=_.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!k)break;O+=k[0].length,z=X===k[2]}let F=1,w=O,A=-1;while(F>0&&w<_.length){W.lastIndex=w,U.lastIndex=w;let k=W.exec(_),C=U.exec(_),b=k?k.index:1/0,D=C?C.index:1/0;if(b<D)F++,w=b+k[0].length;else if(D<1/0){if(F--,F===0){A=D;break}w=D+C[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${V} has no matching @${q} \u2014 the block was skipped.`);break}let N=_.substring(O,A),R=-1,T=0,M=0;while(M<N.length){let k=N.indexOf("@",M);if(k===-1)break;let C=N.substring(k);if(B.test(C)){T++,M=k+1;continue}if(j.test(C)){T--,M=k+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){R=k;break}M=k+1}let I;if(R!==-1){let k=N.slice(0,R),C=N.slice(R+5);I=z?k:C}else I=z?N:"";let E=`@${q}`.length;_=_.substring(0,V)+I+_.substring(A+E),H=!0}return _}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",X==="production"),J=Q(J,"development","enddevelopment",X==="development"),J=Q(J,"staging","endstaging",X==="staging"),J=Q(J,"testing","endtesting",X==="testing"),J}var k4=y(()=>{G2();K1();E$();T0()});function z2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function b4($,Z){if(!$)return Z?.nonceGenerator?.()??z2();let Y=q2.get($);if(!Y)Y=Z?.nonceGenerator?.()??z2(),q2.set($,Y);return Y}function Mz($,Z){let Y=[];for(let[J,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)Y.push(J);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${J} ${Q.join(" ")}`)}}return Y.join("; ")}function W2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Mz($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function U2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?b4(Y,Z):void 0,X=W2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
8328
|
-
${X}`)}function B2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?b4(Z,Q):void 0;return W2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return b4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=b4(Z,Q);return X}var q2;var
|
|
8329
|
-
${y4("@csrf",Z)}`,!["GET","POST"].includes(
|
|
8330
|
-
${y4(`@method('${
|
|
8331
|
-
`),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,q=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,z,W]=q,U=z.trim(),B=W.trim();if(B==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=
|
|
8360
|
+
</script>`}function Y2($,Z,Y){if(Z2=0,!Vz($))return $;let J=Bz($);if(J.length===0)return $;let X=Fz($,J),Q=Lz(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
|
|
8361
|
+
`+X.slice(G);else X+=Q;return X}function Fz($,Z){let Y=$;for(let J of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${D4(J.stateExpr)}["']`,"gi").exec(Y);if(Q)J.id=Q[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${D4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${D4(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${D4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Vz($){return/x-data\s*=\s*["']/.test($)}var Z2=0,Uz=0;var J2=y(()=>{Z1()});import wz from"fs";import T3 from"path";import{createHighlighter as Az}from"ts-syntax-highlighter";async function Nz($,Z={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let J=(await wz.promises.stat($)).mtime.getTime();if(Z.cache&&M3.has($)){let U=M3.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=$9(X),K=Z.markdown||L3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},z=I5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)z=await Rz(z,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:z,data:Q||{}};if(Z.cache)M3.set($,{...W,updatedAt:J});return W}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:q0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function Rz($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!E4)try{E4=await Az({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,q,z,W)=>{let U=W.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),B=z||(Y?"text":"");if(!B)return K;try{if(!E4.getSupportedLanguages().includes(B))return K;return(await E4.highlight(U,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${z}:`,_)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[q,z,W,U]=K,B=await X(q,z,W,U);Q=Q.replace(q,B)}return Q}async function X2($,Z,Y="",J={}){return await Tz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,z)=>{try{let W=K;if(!T3.isAbsolute(K))W=T3.resolve(T3.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),N=V.substring(w+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);U[A]=N}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await Nz(W,J),j={...Z,..._,...U},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(W){let U=W instanceof Error?W.message:String(W);return q0("Markdown File",`Error including markdown file: ${U}`,Y,$,z,G)}})}async function Tz($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],q=X.index,z=X;J.push(Y(...z).then((W)=>({match:K,replacement:W,index:q})))}let Q=await Promise.all(J);Q.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of Q)G=G.replace(K,()=>q);return G}var M3,E4=null;var Q2=y(()=>{m1();N0();M3=new Map});function A1($,Z){try{let Y=$.trim();if(G0(Y))return K0(Y,Object.keys(Z))(...Object.values(Z));else return J0(Y,Z)}catch{return!1}}var G2=y(()=>{T0()});function Mz($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=H7(J,G);if(!K)break;try{let q;if(G0(K.expression))q=K0(K.expression,Object.keys(Z))(...Object.values(Z));else q=J0(K.expression,Z);let z="",W=!1;for(let U of K.cases)if(U.type==="default"){if(!W)z=U.content.trim()}else try{let B;if(U.value&&G0(U.value))B=K0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)B=J0(U.value,Z);if(q===B){z=U.content.trim(),W=!0;break}}catch{continue}J=J.substring(0,G)+z+J.substring(K.end),X=!0}catch(q){let z=q instanceof Error?q.message:String(q),W=Z0("Switch",`Error evaluating @switch expression: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,G)+W+J.substring(K.end);break}}return J}function p1($,Z,Y){let J=$;J=Mz(J,Z,Y);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=L1(J,K+7);if(!q)break;let z=q.endPos,W=v1(J,"unless","endunless",z);if(W===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=J.slice(z,W),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let j;if(_!==-1){let H=U.slice(0,_),L=U.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${U}@endif`;J=J.substring(0,K)+j+J.substring(W+10),Q=!0}}J=D3(J,Z,Y),J=E3(J,Z,Y),J=I3(J,Z);let X=()=>{let Q=l5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let q="",z=!1;for(let W of K.branches){if(z)break;if(W.type==="else")q=W.content,z=!0;else try{let U;if(W.condition&&G0(W.condition))U=K0(W.condition,Object.keys(Z))(...Object.values(Z));else if(W.condition)U=J0(W.condition,Z);if(U)q=W.content,z=!0}catch(U){q=Z0(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),z=!0}}J=J.substring(0,K.start)+q+J.substring(K.end)}catch(q){let z=q instanceof Error?q.message:String(q),W=Z0("If",`Error processing @if block: ${z}`,s.EVALUATION_ERROR);J=J.substring(0,K.start)+W+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function K2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(X===Y){Z++;break}J.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function I3($,Z){let Y=$;function J(K,q,z,W){let U=1,B=W,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${z}(?![a-z])`,"g");while(B<K.length&&U>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)U++,B=F+H[0].length;else if(O<1/0){if(U--,U===0)return O;B=O+L[0].length}else break}return-1}function X(K,q,z){let W=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${z}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=U.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")W++;else if(L.type==="close")W--;else if(L.type==="else"&&W===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let z=q.index,W,U,B=Y.slice(z+5),_=K2(B);if(_)W=_.value,U=z+5+_.consumed;else U=z+5;let j=J(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${z} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=X(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=W?A1(`auth?.check && auth?.user?.[${W}]`,Z):A1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,z)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let z=q.index,W,U,B=Y.slice(z+6),_=K2(B);if(_)W=_.value,U=z+6+_.consumed;else U=z+6;let j=J(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${z} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=X(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=W?A1(`!auth?.check || !auth?.user?.[${W}]`,Z):A1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,z)+O+Y.substring(j+9),K=!0}}function Q(K,q,z){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[K];if(q)W.push(q);if(z){let U=A1(z,Z);W.push(U)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(K){let q=K.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 K of["can","cannot"]){let q=`end${K}`,z=K==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let B=U.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=J(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${z}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((D,P)=>D.pos-P.pos);for(let D of T){if(D.type==="open"){V++;continue}if(D.type==="close"){V--;continue}if(V===0)O.push(D)}let I=[],E=0;for(let D=0;D<O.length;D++){let P=O[D];if(I.push({content:F.slice(E,P.pos),ability:void 0}),P.type==="elseDirective"){let f=F.slice(P.pos+`@${z}`.length),g=G(f);if(g){I[I.length-1]={content:F.slice(E,P.pos)},E=P.pos+`@${z}`.length+g.paramsEnd,I.push({content:"",ability:g.ability,type:g.type,id:g.id}),I.pop();let d=O[D+1],i=d?d.pos:F.length;I.push({content:F.slice(E,i),ability:g.ability,type:g.type,id:g.id}),E=i}}else E=P.pos+5}if(E<F.length){let D=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(E)})}let k=Q(j.ability,j.type,j.id),C=K==="can"?k:!k,b="";if(C)b=I[0]?.content||"";else{let D=!1;for(let P=1;P<I.length;P++){let f=I[P];if(f.isFinalElse){b=f.content,D=!0;break}if(f.ability){let g=Q(f.ability,f.type,f.id);if(K==="can"?g:!g){b=f.content,D=!0;break}}}if(!D&&I.length>0){let P=I[I.length-1];if(P.isFinalElse)b=P.content}}Y=Y.substring(0,B)+b+Y.substring(L+`@${q}`.length),W=!0}}return Y}function D3($,Z,Y){let J=$;function X(Q,G,K,q,z){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),B=Q.match(U);if(!B||B.index===void 0)break;let _=B.index,j=L1(Q,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=v1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(H,L),O=j.expression,V=-1,w=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let R=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=N;break}A=N+1}try{let N=q(O.trim()),R;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);R=N?T:M}else R=N?F:"";Q=Q.substring(0,_)+R+Q.substring(L+`@${K}`.length),W=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=Z0(z,`Error processing @${G} directive: ${R}`,s.EVALUATION_ERROR);Q=Q.substring(0,_)+T+Q.substring(L+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=A1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=A1(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 E3($,Z,Y){let J=$,X="development";function Q(G,K,q,z){let W=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,W.lastIndex=0;let L=W.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let k=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!k)break;O+=k[0].length,z=X===k[2]}let V=1,w=O,A=-1;while(V>0&&w<j.length){W.lastIndex=w,U.lastIndex=w;let k=W.exec(j),C=U.exec(j),b=k?k.index:1/0,D=C?C.index:1/0;if(b<D)V++,w=b+k[0].length;else if(D<1/0){if(V--,V===0){A=D;break}w=D+C[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=j.substring(O,A),R=-1,T=0,M=0;while(M<N.length){let k=N.indexOf("@",M);if(k===-1)break;let C=N.substring(k);if(B.test(C)){T++,M=k+1;continue}if(_.test(C)){T--,M=k+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){R=k;break}M=k+1}let I;if(R!==-1){let k=N.slice(0,R),C=N.slice(R+5);I=z?k:C}else I=z?N:"";let E=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+E),H=!0}return j}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",X==="production"),J=Q(J,"development","enddevelopment",X==="development"),J=Q(J,"staging","endstaging",X==="staging"),J=Q(J,"testing","endtesting",X==="testing"),J}var k4=y(()=>{G2();q1();E$();T0()});function z2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function b4($,Z){if(!$)return Z?.nonceGenerator?.()??z2();let Y=q2.get($);if(!Y)Y=Z?.nonceGenerator?.()??z2(),q2.set($,Y);return Y}function Iz($,Z){let Y=[];for(let[J,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)Y.push(J);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${J} ${Q.join(" ")}`)}}return Y.join("; ")}function W2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Iz($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function U2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?b4(Y,Z):void 0,X=W2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
8362
|
+
${X}`)}function B2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?b4(Z,Q):void 0;return W2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return b4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=b4(Z,Q);return X}var q2;var _2=y(()=>{q2=new WeakMap});import Dz from"crypto";function kz($=Ez){let Z=Dz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return k3=Z,Z}function bz(){if(!k3)kz();return k3}function Sz($=j2){let Z=bz();return`<input type="hidden" name="${$}" value="${Z}">`}function H2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Sz(J||j2)})}var Ez=40,j2="_token",k3=null;var O2=()=>{};async function L2($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let X=$;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)X=await yz(X,Q,Z,Y,J);else X=await Pz(X,Q,Z,Y,J)}return X}async function yz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,q=`@end${Q}`,z=$,W=e1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],B=W.exec(z);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?F2(j):[],O=H.trim(),V=await G(O,F,Y,J);U.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(X.debug)console.error(`Error processing custom directive @${Q}:`,F);U.push({original:_,processed:Z0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:L})}B=W.exec(z)}for(let _=U.length-1;_>=0;_--){let{original:j,processed:H}=U[_];z=z.replace(j,H)}return z}async function Pz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,q=e1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),z=[],W=q.exec(K);while(W!==null){let[_,j=""]=W,H=W.index||0;try{let L=F2(j),F=await G("",L,Y,J);z.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(X.debug)console.error(`Error processing custom directive @${Q}:`,L);z.push({original:_,processed:Z0("CustomDirective",`Error in @${Q}(${j}): ${F}`,s.EVALUATION_ERROR),startIndex:H})}W=q.exec(K)}let U=e1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),B=U.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,J);z.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(X.debug)console.error(`Error processing custom directive @${Q}:`,H);z.push({original:_,processed:Z0("CustomDirective",`Error in @${Q}: ${L}`,s.EVALUATION_ERROR),startIndex:j})}B=U.exec(K)}for(let _=z.length-1;_>=0;_--){let{original:j,processed:H}=z[_];K=K.replace(j,H)}return K}function F2($){if(!$.trim())return[];let Z=[],Y="",J=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,X=G;else if(G===X)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.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 V2=y(()=>{q1();$5()});import Cz from"crypto";function M0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function S4($,Z,Y,J){let X=$||Z;return Y?`${X} ${J}`:X}function vz(){return Cz.randomUUID()}function y4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=vz();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${M0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,X)=>{let Q=X.toUpperCase();if(X&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${M0(Q)}">`;return J}),Y}function N2($,Z,Y=A2){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,q,z="")=>{let W=Q||G||"POST",U=K||q||"",B=N1(z),_=W.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${M0(j)}" action="${M0(U)}"${B?` ${B}`:""}>`;if(H+=`
|
|
8363
|
+
${y4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
|
|
8364
|
+
${y4(`@method('${_}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,q,z="")=>{let W=Q||G||"",U=K||q||"",B=N1(z),_=Z$(W,Z),j=_!==void 0&&_!==null?_:U||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=Y$(W,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=S4(O?O[1]:"",Y.input,F,Y.inputError),w=B.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${M0(L)}" name="${M0(W)}" value="${M0(j)}" class="${V}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let q=N1(G),z=Z$(Q,Z)||K.trim(),W=Y$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),B=S4(U?U[1]:"",Y.input,W,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${M0(Q)}" class="${B}"${_?` ${_}`:""}>${M0(z)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let q=N1(G),z=Z$(Q,Z),W=Y$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),B=S4(U?U[1]:"",Y.input,W,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(z!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(z)?z.some((V)=>String(V)===F):String(z)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${M0(Q)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="1",K="")=>{let q=N1(K),z=Z$(Q,Z),W=z!==void 0&&(Array.isArray(z)?z.some((j)=>String(j)===G):z===!0||String(z)===G),U=q.match(/class=['"]([^'"]+)['"]/i),B=U?U[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${M0(Q)}" value="${M0(G)}" class="${B}"${W?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let q=N1(K),z=Z$(Q,Z),W=z!==void 0&&z===G,U=q.match(/class=['"]([^'"]+)['"]/i),B=U?U[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${M0(Q)}" value="${M0(G)}" class="${B}"${W?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=N1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),z=q?q[1]:"",W=K.includes("multiple"),U=Y$(Q,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=S4(B?B[1]:"",Y.input,U,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${M0(Q)}"`,`class="${_}"`];if(z)H.push(`accept="${M0(z)}"`);if(W)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let q=N1(G),z=q.match(/class=['"]([^'"]+)['"]/i),W=z?z[1]:Y.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${M0(Q)}" class="${W}"${U?` ${U}`:""}>${K}</label>`}),J}function R2($,Z,Y=A2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(Y$(X,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return w2(X,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return w2(X,Z)}let q=K.trim();if(G0(q)){let z=J0(q,Z);return z!==void 0?String(z):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function Y$($,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 w2($,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 Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function Z$($,Z){let Y;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(Y=Z[J],Y!==void 0)return Y}return Z[$]}function N1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec(Y))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var A2;var T2=y(()=>{T0();A2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import y3 from"path";async function xz(){if(J$!==void 0)return J$;try{J$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{J$=null}return J$}function fz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function gz($,Z){if({...v3,...Z.i18n}.cache&&P3[$]){let X=P3[$],Q=Z.i18n?.cacheMaxAge??0;if(!fz(X,Q))return X.translations}if(X$[$]?.state==="loading")return X$[$].promise;b3[$]="loading";let J=C3($,Z).then((X)=>{return b3[$]="loaded",delete X$[$],X}).catch((X)=>{throw b3[$]="error",X$[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return X$[$]={promise:J,state:"loading"},J}async function C3($,Z){let Y={...v3,...Z.i18n},J=y3.isAbsolute(Y.translationsDir)?Y.translationsDir:y3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await xz(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:pz(Y.format)}):await hz($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return C3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)P3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==Y.defaultLocale)return C3(Y.defaultLocale,Z);return{}}}async function hz($,Z,Y){let J=y3.join(Y,`${$}${dz(Z.format)}`);try{let X=await import(J);return X.default||X}catch(X){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return uz(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function dz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function uz($){let Z={},Y=$.split(`
|
|
8365
|
+
`),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,q=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,z,W]=q,U=z.trim(),B=W.trim();if(B==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=mz(B)}}return Z}function mz($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function pz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function lz($,Z){return gz($,Z)}function cz($,Z){for(let Y of $){let J=Y.trim(),X=J.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function iz($,Z={}){return D2($,Z)}function D2($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=nz($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=oz(Q,Z),J=X+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function nz($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function oz($,Z){let Y=sz($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),X=Z[J];if(Y.length===1)return X!==void 0?String(X):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return rz(X,Y.slice(2).join(","),Z);case"select":return tz(X,Y.slice(2).join(","));case"selectordinal":return ez(X,Y.slice(2).join(","));case"number":return ZW(X,Y[2]?.trim());case"date":return YW(X,Y[2]?.trim());case"time":return JW(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function sz($){let Z=[],Y="",J=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")J++,Y+=Q;else if(Q==="}")J--,Y+=Q;else if(Q===","&&J===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function rz($,Z,Y){let J=Number($)||0,X=x3(Z),Q=`=${J}`;if(X[Q])return S3(X[Q],J,Y);let G=az(J);if(X[G])return S3(X[G],J,Y);if(X.other)return S3(X.other,J,Y);return String(J)}function S3($,Z,Y){let J=$.replace(/#/g,String(Z));return D2(J,Y)}function az($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function tz($,Z){let Y=String($||""),J=x3(Z);if(J[Y])return J[Y];return J.other||String($)}function ez($,Z){let Y=Number($)||0,J=x3(Z),X=$W(Y);if(J[X])return J[X].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function $W($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function x3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function ZW($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function YW($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function JW($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function XW($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function M2($,Z,Y=!0,J={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(XW(G))return iz(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),q=G.split("|");G=cz(q,K)}for(let[K,q]of Object.entries(J)){let z=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${z}`,"g"),String(q))}return G}async function E2($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...v3,...J.i18n},K=await lz(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await I2(X,Q,async(W,U,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return R0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return M2(U,K,G.fallbackToKey,H)||_.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return Z0("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...X.matchAll(q)];console.warn(`Found ${W.length} @translate matches`),W.forEach((U,B)=>console.warn(`Match ${B}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return X=await I2(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,U,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return R0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return M2(U,K,G.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return Z0("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR)}}),X}async function I2($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((q)=>({match:Q,replacement:q}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var J$,v3,P3,X$,b3;var k2=y(()=>{q1();T0();v3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},P3={},X$={},b3={}});var h3={};r(h3,{streamingSuspenseDirective:()=>y2,streamToResponse:()=>OW,streamTemplateSimple:()=>BW,streamTemplate:()=>GW,renderStreamingPage:()=>qW,registerStreamingDirectives:()=>jW,processStreamDirectives:()=>WW,processSectionDirectives:()=>HW,islandDirective:()=>P2,generateHydrationRuntime:()=>LW,extractStreamBoundaries:()=>UW,createStreamRenderer:()=>_W,buildSuspenseResolveScript:()=>g3,SUSPENSE_RESOLVER_RUNTIME:()=>S2});import P4 from"path";function QW($){let Z=[],Y=0,J;b2.lastIndex=0;while((J=b2.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=J[1],Q=J[2];Z.push({type:"suspense",name:X,content:Q}),Y=J.index+J[0].length}if(Y<$.length){let X=$.slice(Y);if(X.trim())Z.push({type:Z.length===0?"shell":"content",content:X})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function GW($,Z={},Y={}){let J={...u1,...Y,streaming:{...f3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",z=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...Z,__filename:$,__dirname:P4.dirname($)};if(q.trim())await C1(q,W,$);let U=QW(z),B=new Set;if(!U.some((j)=>j.type==="suspense")){let j=J.streaming?.strategy||"auto",H=new RegExp(l1.source,"g");if(!(j!=="manual"&&H.test(z))){let F=await H0(z,W,$,J,B);for(let O=0;O<F.length;O+=X)Q.enqueue(F.slice(O,O+X)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(l1.source,"g"),V;while((V=O.exec(z))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let R=z.slice(w,A.start);if(R.trim()){let T=await H0(R,W,$,J,B);Q.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let N=await H0(A.content,W,$,J,B);Q.enqueue(N),await new Promise((R)=>setTimeout(R,0)),w=A.end}if(w<z.length){let A=z.slice(w);if(A.trim()){let N=await H0(A,W,$,J,B);Q.enqueue(N)}}}}else{let j=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let F=await H0(L.content,W,$,J,B);Q.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;Q.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
|
|
8332
8366
|
<template data-suspense-fallback>Loading...</template>
|
|
8333
|
-
</div>`),
|
|
8367
|
+
</div>`),j.set(L.name,H0(L.content,W,$,J,B))}Q.enqueue(`
|
|
8334
8368
|
<script>
|
|
8335
8369
|
(function() {
|
|
8336
8370
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -8346,13 +8380,13 @@ ${X}`)}function B2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?
|
|
|
8346
8380
|
}
|
|
8347
8381
|
};
|
|
8348
8382
|
})();
|
|
8349
|
-
</script>`);let H=Array.from(
|
|
8383
|
+
</script>`);let H=Array.from(j.entries()).map(async([L,F])=>{Q.enqueue(await g3(L,F))});await Promise.all(H)}Q.close()}catch(G){Q.error(G)}}})}async function g3($,Z){try{let J=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
|
|
8350
8384
|
<script>
|
|
8351
8385
|
window.__stxSuspense.resolve('${$}', \`${J}\`);
|
|
8352
8386
|
</script>`}catch(Y){let J=Y instanceof Error?Y.message:String(Y);return`
|
|
8353
8387
|
<script>
|
|
8354
|
-
window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${
|
|
8355
|
-
</script>`}}function
|
|
8388
|
+
window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${c0(J)}</div>');
|
|
8389
|
+
</script>`}}function KW($,Z,Y){if(!Z||Z<=0)return $;let J,X=new Promise((Q,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(J))}function qW($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(S2),await Promise.all(Z.map(async(Q)=>{let G=KW(Q.render(),J,Q.id);X.enqueue(await g3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function WW($,Z){return $.replace(zW,(Y,J,X)=>{let Q=J.trim(),G=X.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${q}</div>`})}function UW($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,X])=>({id:J,render:X})):void 0}async function BW($,Z={},Y={}){let J={...u1,...Y,streaming:{...f3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",z=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...Z,__filename:$,__dirname:P4.dirname($)};if(q.trim())await C1(q,W,$);let U=new Set,B=J.streaming?.strategy||"auto",_=new RegExp(l1.source,"g");if(!(B!=="manual"&&_.test(z))){let H=await H0(z,W,$,J,U);for(let L=0;L<H.length;L+=X)Q.enqueue(H.slice(L,L+X))}else{let H=[],L=new RegExp(l1.source,"g"),F;while((F=L.exec(z))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=z.slice(O,V.start);if(A.trim()){let N=await H0(A,W,$,J,U);Q.enqueue(N)}}let w=await H0(V.content,W,$,J,U);Q.enqueue(w),O=V.end}if(O<z.length){let V=z.slice(O);if(V.trim()){let w=await H0(V,W,$,J,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function _W($,Z={}){let Y={...u1,...Z,streaming:{...f3,...Z.streaming}},J=await Bun.file($).text(),X=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},z;l1.lastIndex=0;while((z=l1.exec(G))!==null){let B=z[1],_=z[2];q[B]=_}let W=G.replace(l1,"");return{renderShell:async(B={})=>{let _={...B,__filename:$,__dirname:P4.dirname($)};return await C1(Q,_,$),H0(W,_,$,Y,new Set)},renderSection:async(B,_={})=>{try{if(!q[B])return`<div class="error-message">Section "${c0(B)}" not found in template "${c0($)}"</div>`;let j={..._,__filename:$,__dirname:P4.dirname($)};await C1(Q,j,$);let H=new Set;return await H0(q[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return q0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function jW($={}){let Z=[];if($.streaming?.enabled)Z.push(y2);if($.hydration?.enabled)Z.push(P2);return Z}async function HW($,Z,Y,J={}){return $}function OW($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),X=new Headers(Z.headers);if(!X.has("Content-Type"))X.set("Content-Type","text/html; charset=utf-8");if(!X.has("Transfer-Encoding"))X.set("Transfer-Encoding","chunked");if(!X.has("X-Content-Type-Options"))X.set("X-Content-Type-Options","nosniff");if(!X.has("X-Accel-Buffering"))X.set("X-Accel-Buffering","no");return new Response(J,{...Z,headers:X})}function LW($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
|
|
8356
8390
|
`);if(Z==="loader")return`
|
|
8357
8391
|
(function() {
|
|
8358
8392
|
window.__stx = window.__stx || {};
|
|
@@ -8514,25 +8548,25 @@ else {
|
|
|
8514
8548
|
}
|
|
8515
8549
|
};
|
|
8516
8550
|
})();
|
|
8517
|
-
</script>`,
|
|
8551
|
+
</script>`,zW,y2,P2;var d3=y(()=>{m1();Z1();i$();N0();f3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},l1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,b2=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;zW=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;y2={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},P2={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let X=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${X}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",z=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
|
|
8518
8552
|
${z}
|
|
8519
8553
|
<script type="application/json" data-island-props="${G}">
|
|
8520
8554
|
${q?`{${q}}`:"{}"}
|
|
8521
8555
|
</script>
|
|
8522
|
-
</div>`}}});var x2={};r(x2,{warnUnbalancedTags:()=>u3,findUnbalancedTags:()=>v2});function q5($){return $.replace(/[^\n]/g," ")}function v2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,q5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,q5).replace(/<!--[\s\S]*?-->/g,q5).replace(/\{\{\{[\s\S]*?\}\}\}/g,q5).replace(/\{\{[\s\S]*?\}\}/g,q5).replace(/\{!![\s\S]*?!!\}/g,q5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",q=Q[2],z=Q[3]==="/";if(
|
|
8523
|
-
`).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(
|
|
8524
|
-
`}if(
|
|
8556
|
+
</div>`}}});var x2={};r(x2,{warnUnbalancedTags:()=>u3,findUnbalancedTags:()=>v2});function q5($){return $.replace(/[^\n]/g," ")}function v2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,q5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,q5).replace(/<!--[\s\S]*?-->/g,q5).replace(/\{\{\{[\s\S]*?\}\}\}/g,q5).replace(/\{\{[\s\S]*?\}\}/g,q5).replace(/\{!![\s\S]*?!!\}/g,q5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",q=Q[2],z=Q[3]==="/";if(FW.has(q.toLowerCase()))continue;if(z)continue;if(K)J.set(q,(J.get(q)??0)+1);else{let W=Y.get(q);if(W)W.count++;else{let U=Z.slice(0,Q.index).split(`
|
|
8557
|
+
`).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(VW.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,z=J.get(K)??0;if(q!==z)G.push({tag:K,opened:q,closed:z,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function u3($,Z){let Y;try{Y=v2($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(C2.has(J))return;C2.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let z=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${z} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var FW,VW,C2;var m3=y(()=>{FW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),VW=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);C2=new Set});import m0 from"path";import p3 from"fs";function f2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function g2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class h2{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,Y,J){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let _=[X,X.toLowerCase(),f2(X),g2(X)];for(let j of _)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${X}.stx`,`${f2(X)}.stx`,`${g2(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let _=m0.resolve(m0.dirname(Z),`${X}.stx`);if(await n(_))return _;return null}let K=[],q=Y.componentsDir||"",z=J?.__originalFilePath;if(z)K.push(m0.join(m0.dirname(z),"components"));if(q)K.push(q);let W=m0.join(m0.dirname(Z),"components");if(!K.includes(W))K.push(W);let U=process.cwd(),B=[m0.resolve(U,"src/components"),m0.resolve(U,"components"),m0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=m0.join(_,j);if(await n(H))return H}try{if(!p3.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=p3.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=m0.join(_,L.name);for(let O of G){let V=m0.join(F,O);if(await n(V))return V}}}catch{}}return null}}var P0;var l3=y(()=>{N0();P0=new h2});function R1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function wW($){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 c3;var i3=y(()=>{c3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=wW($),X=(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",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(J.reactive)q.push(`:href="${R1(J.value)}"`);else q.push(`href="${R1(J.value)}"`);if(X)q.push(`class="${R1(X)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${R1(Q)}"`),q.push(`data-stx-exact-active-class="${R1(G)}"`),K)q.push("data-stx-prefetch");let z=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[W,U]of Object.entries($.static)){if(z.has(W))continue;if(typeof U==="boolean"){if(U)q.push(R1(W))}else q.push(`${R1(W)}="${R1(U)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function O0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function b0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function o3($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let X=$.static[Z];if(X!==void 0)return X!=="false"&&X!==!1;return Y}function d2($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=AW[X];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(X);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(J);return Y.join(", ")}function s3($,Z,Y,J){return Z.map((X)=>`${Q$($,X,void 0,Y,J)} ${X}w`).join(", ")}function NW($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${Q$($,G,void 0,J,X)} ${Q}x`}).join(", ")}function Q$($,Z,Y,J,X){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(X)Q.push(`f_${X}`);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(Y)Q.set("h",String(Y));if(X)Q.set("fm",X);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(Y)Q.set("height",String(Y));if(X)Q.set("format",X);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function RW($,Z,Y="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var AW,n3,r3;var a3=y(()=>{AW={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},n3=[320,640,768,1024,1280,1536,1920];r3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=b0($,"src")||"",X=b0($,"alt")||"",Q=b0($,"width"),G=b0($,"height"),K=b0($,"sizes"),q=b0($,"srcset"),z=b0($,"densities"),W=b0($,"format"),U=b0($,"placeholder"),B=b0($,"placeholderColor")||"#e5e7eb",_=b0($,"provider"),j=b0($,"class")||b0($,"className")||"",H=b0($,"style")||"",L=b0($,"quality"),F=o3($,"lazy",!0),O=o3($,"preload",!1),V=o3($,"picture",!1)||!!W,w=Q?Number.parseInt(Q):void 0,A=G?Number.parseInt(G):void 0,N=q||"",R="";if(!N&&K)N=s3(J,n3,_,W),R=d2(K);else if(!N&&z){let b=z.split(/\s+/).map((D)=>Number.parseFloat(D.replace("x","")));N=NW(J,b,w,_,W)}else if(K)R=d2(K);let T=[];if(H)T.push(H);if(w&&A)T.push(`aspect-ratio:${w}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let b=RW(w||16,A||9,B);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${O0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=Q$(J,w,A,_,W),I=[];if(I.push(`src="${O0(M)}"`),I.push(`alt="${O0(X)}"`),Q)I.push(`width="${O0(Q)}"`);if(G)I.push(`height="${O0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${O0(j)}"`);if(T.length>0)I.push(`style="${O0(T.join(";"))}"`);if(N)I.push(`srcset="${O0(N)}"`);if(R)I.push(`sizes="${O0(R)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[b,D]of Object.entries($.static)){if(E.has(b))continue;if(typeof D==="boolean"){if(D)I.push(O0(b))}else I.push(`${O0(b)}="${O0(D)}"`)}let k=`<img ${I.join(" ")} />`,C="";if(O){let D=W==="webp"?"image/webp":W==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${O0(M)}"${D?` type="${D}"`:""}${N?` imagesrcset="${O0(N)}"`:""}${R?` imagesizes="${O0(R)}"`:""} />
|
|
8558
|
+
`}if(V){let b=[];if(W==="avif"||W==="auto"){let D=Q$(J,w,A,_,"avif"),P=N?s3(J,n3,_,"avif"):`${D}`;b.push(`<source type="image/avif" srcset="${O0(P)}"${R?` sizes="${O0(R)}"`:""} />`)}if(W==="webp"||W==="auto"){let D=Q$(J,w,A,_,"webp"),P=N?s3(J,n3,_,"webp"):`${D}`;b.push(`<source type="image/webp" srcset="${O0(P)}"${R?` sizes="${O0(R)}"`:""} />`)}return`${C}<picture>
|
|
8525
8559
|
${b.join(`
|
|
8526
8560
|
`)}
|
|
8527
8561
|
${k}
|
|
8528
|
-
</picture>`}return`${C}${k}`}}});function T1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function z5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var
|
|
8562
|
+
</picture>`}return`${C}${k}`}}});function T1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function z5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var TW="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",t3;var e3=y(()=>{t3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=z5($,"src")||"",X=z5($,"alt")||"",Q=z5($,"fallback")||"/images/safe-image-default.svg",G=z5($,"class")||z5($,"className")||"",K=z5($,"fallbackClassName")||"",q=[];if(q.push(`src="${T1(J)}"`),q.push(`alt="${T1(X)}"`),G)q.push(`class="${T1(G)}"`);if(q.push(`data-fallback="${T1(Q)}"`),K)q.push(`data-fallback-class="${T1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let z=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,_]of Object.entries($.static)){if(z.has(B))continue;if(typeof _==="boolean"){if(_)q.push(T1(B))}else q.push(`${T1(B)}="${T1(_)}"`)}let W=`<img ${q.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${TW}${W}`;return W}}});function $6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function G$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function C4($,Z,Y){let J=G$($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var Z6;var Y6=y(()=>{Z6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=$6(G$($,"color")||"#6366f1"),X=$6(G$($,"initialColor")||G$($,"initial-color")||""),Q=$6(G$($,"height")||"3px"),G=C4($,"duration",2000),K=C4($,"throttle",200),q=C4($,"zIndex",999999)||C4($,"z-index",999999),z=X?`linear-gradient(to right, ${X}, ${J})`:J;return`
|
|
8529
8563
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${z};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
8530
8564
|
<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>
|
|
8531
8565
|
</div>
|
|
8532
8566
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
8533
8567
|
<script>
|
|
8534
8568
|
(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)},${K})},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()})})();
|
|
8535
|
-
</script>`}}});function
|
|
8569
|
+
</script>`}}});function s0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function m2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function MW($,Z,Y){let J=m2($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var u2,J6;var X6=y(()=>{u2={"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%)"},J6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=s0(m2($,"position")||"top-right"),X=MW($,"max",5),Q=u2[J]||u2["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${X}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
8536
8570
|
<style>
|
|
8537
8571
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
8538
8572
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -8540,7 +8574,7 @@ ${k}
|
|
|
8540
8574
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
8541
8575
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
8542
8576
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
8543
|
-
</style>`}}});function v4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var p2,Q6;var G6=y(()=>{p2={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)"},Q6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=v4($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=
|
|
8577
|
+
</style>`}}});function v4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var p2,Q6;var G6=y(()=>{p2={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)"},Q6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=v4($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=s0(J),Q=v4($,"size")||"md",G=v4($,"closeOnBackdrop")!=="false",K=v4($,"closeOnEscape")!=="false",q=p2[Q]||p2.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${G}" data-close-escape="${K}" 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">
|
|
8544
8578
|
<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)">
|
|
8545
8579
|
<div style="padding:1.5rem">${Z}</div>
|
|
8546
8580
|
</div>
|
|
@@ -8549,8 +8583,8 @@ ${k}
|
|
|
8549
8583
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
8550
8584
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
8551
8585
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
8552
|
-
</style>`}}});function W5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var l2,K6;var q6=y(()=>{l2={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},K6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=W5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=
|
|
8553
|
-
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${B};width:${W};max-width:100vw;transform:${
|
|
8586
|
+
</style>`}}});function W5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var l2,K6;var q6=y(()=>{l2={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},K6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=W5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=s0(J),Q=W5($,"side")||"right",G=W5($,"size")||"md",K=W5($,"closeOnBackdrop")!=="false",q=W5($,"closeOnEscape")!=="false",z=W5($,"overlay")!=="false",W=l2[G]||l2.md,U=Q==="left",B=U?"left:0":"right:0",_=U?"translateX(-100%)":"translateX(100%)",j=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${z?"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">
|
|
8587
|
+
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${B};width:${W};max-width:100vw;transform:${_};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">
|
|
8554
8588
|
<div style="padding:1.5rem">${Z}</div>
|
|
8555
8589
|
</div>
|
|
8556
8590
|
</div>
|
|
@@ -8558,18 +8592,18 @@ ${k}
|
|
|
8558
8592
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
8559
8593
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
8560
8594
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
8561
|
-
</style>`}}});var o2={};r(o2,{resolveCollectionPath:()=>z6,preloadIconCollection:()=>n2,IconBuiltin:()=>x4});import{existsSync as
|
|
8562
|
-
`||T==="\t")V++;O=N+H.length}else{if(V--,V===0){F=R;break}O=R+L.length}}if(F===-1){X=B;continue}let w=$.slice(B,F),A=F+L.length;J.push({fullMatch:$.slice(Q,A),tagName:q,attributes:_,content:w,startIndex:Q,endIndex:A,isSelfClosing:!1}),X=A}}return J}function $Y($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var ZY=y(()=>{T0();N0();C5()});var qY={};r(qY,{processESImports:()=>GY,processComponents:()=>u4});import d4 from"fs";import h0 from"path";function bW($,Z,Y){let J={static:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!X.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){J.events[q]=K;continue}if(q.startsWith("__stx_")){let z=Q(q.slice(6));J.serverDynamic[z]=$Y(K,Y);continue}if(q.startsWith(":")){let z=Q(q.slice(1)),W=K===_6?z:K;try{if(!G0(W)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${W}`);J.clientReactive[z]=W;continue}let U=Object.keys(Z),j=K0(W,U)(...Object.values(Z));if(j===void 0){let _=W.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((V)=>!H.has(V)&&!U.includes(V))){J.clientReactive[z]=W;continue}}J.serverDynamic[z]=j}catch{J.clientReactive[z]=W}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let z=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let W=z[1];if(G0(W)){let B=K0(W,Object.keys(Z))(...Object.values(Z));J.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${W}`);J.static[q]=K}}catch(W){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,W);J.static[q]=K}else{let W=K,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=U.exec(K))!==null)try{let j=B[1];if(!G0(j)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${j}`);continue}let H=K0(j,Object.keys(Z))(...Object.values(Z));W=W.replace(B[0],String(H??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,j)}J.static[q]=W}continue}J.static[q]=K===_6?"true":K}return J}function SW($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=_6}return Z}function JY($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function yW($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(P0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function PW($){let Z=XY.get($);if(Z)return Z;let Y=new Map,J=[h0.join($,"src"),h0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=d4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let z=h0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;X(z,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let W=q.name.slice(0,-4);if(!Y.has(W))Y.set(W,z);let U=W.toLowerCase();if(!Y.has(U))Y.set(U,z);let B=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,z)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return XY.set($,Y),Y}function CW($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=h0.join(Y,"node_modules",$);try{if(d4.statSync(J).isDirectory())return J}catch{}let X=h0.dirname(Y);if(X===Y)return null;Y=X}}async function GY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=h0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(z,W,U)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,j=U,_,H=[];while((_=B.exec(U))!==null){let[L,V,O,F]=_,w=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=h0.resolve(G,F);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(d4.statSync(M).isFile())A=M}catch{try{if(d4.statSync(T).isDirectory())w=T}catch{}}}}else w=CW(F,G);if(!w&&!A)continue;let N=!1,R=(T,M)=>{Q.set(T,M),Q.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,M),X.add(M)};if(O&&A)R(O,A),N=!0;else if(V){let T=V.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),M=w?PW(w):null;for(let{source:I,local:E}of T){let k=null;if(A)k=A;else if(M)k=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(k)R(E,k),N=!0}}if(N)H.push({start:_.index,end:_.index+L.length})}if(H.length===0)return z;for(let L=H.length-1;L>=0;L--)j=j.slice(0,H[L].start)+j.slice(H[L].end);return`<script${W}>${j}</script>`}),K}async function vW($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[z,W]=q,U=W.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of U){let j=B.split("/"),H=j[j.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),V=null,O=[h0.resolve(h0.dirname(Y),`${B}.stx`),h0.resolve(h0.dirname(Y),B),h0.resolve(J.componentsDir||"components",`${B}.stx`),h0.resolve(J.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(L,V),G.set(H,V),G.set(H.toLowerCase(),V);let F=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),X.add(V),J.debug)console.log(`Imported component: ${L} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${B}`)}Q=Q.replace(z,""),K.lastIndex=0}return Q}async function xW($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,z;while((z=q.exec(Q))!==null){let W=z.index,U=W+z[0].length-1,B=1,j=U+1;while(j<Q.length&&B>0){if(Q[j]==="(")B++;else if(Q[j]===")"){if(B--,B===0)break}j++}if(B!==0)break;let _=Q.substring(U+1,j),H=j+1,L=_.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let V=L[1],O,F=_.slice(L[0].length),w=F.match(/^\s*,\s*/);if(w)O=F.slice(w[0].length).trim();let A={};if(O)try{A=R0(O,Z)}catch(E){let k=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(W,H),`[Error parsing component props: ${k}]`);continue}let N="",R=H,M=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let I=await f1(V,A,N,G,Z,Y,J,K,X);Q=Q.substring(0,W)+I+Q.substring(R),q.lastIndex=0}return Q}async function fW($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=P5(Q);return Q=q.output,Q=await B(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await B(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await B(Q,/[a-z][a-z0-9]*/,!1,kW),Q=J7(Q,q.scripts),Q;async function B(j,_,H,L){if(!j)return j;let V=j,O=e2(V,_,L);for(let F=O.length-1;F>=0;F--){let w=O[F],A=H?h4(w.tagName):w.tagName,N=SW(w.attributes),R=bW(N,Z,J),T=P0.getBuiltin(w.tagName),M=T?await c$(A,G,Z,Y,J):!1;if(T&&!M){let C={context:Z,filePath:Y,options:J,dependencies:X},b=T.render(R,w.content,C);if(Object.keys(R.clientReactive).length>0)b=QY(b,R.clientReactive);if(Object.keys(R.events).length>0){let D=Object.entries(R.events).map(([P,f])=>`${P}="${JY(f)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${D}`)}V=V.substring(0,w.startIndex)+b+V.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await c$(A,G,Z,Y,J))continue;let I={};for(let[C,b]of Object.entries(R.static))I[C]=b;for(let[C,b]of Object.entries(R.serverDynamic))I[C]=b;let k=await f1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(R.clientReactive).length>0)k=QY(k,R.clientReactive);if(Object.keys(R.events).length>0){let C=KY(k);if(C){let b=Object.entries(R.events).map(([P,f])=>`${P}="${JY(f)}"`).join(" "),D=Object.keys(R.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");k=k.substring(0,C.insertPos)+` data-stx-parent-events="${D}" ${b}`+k.substring(C.insertPos)}}V=V.substring(0,w.startIndex)+k+V.substring(w.endIndex)}return V}}function QY($,Z){let Y=KY($);if(!Y)return $;let J=new Set(["if","for","show"]),X=Object.entries(Z).map(([K,q])=>`:${h4(K)}="${q.replace(/"/g,""")}"`).join(" "),Q=Object.keys(Z).filter((K)=>!J.has(K)).map((K)=>h4(K)).join(" "),G=Q?` data-stx-parent-bindings="${Q}"`:"";return $.substring(0,Y.insertPos)+`${G} ${X}`+$.substring(Y.insertPos)}function KY($){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 Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+Q[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function u4($,Z,Y,J,X){if(!YY)a2(),YY=!0;let Q=await GY($,Z,Y,J,X);Q=await vW(Q,Z,Y,J,X),Q=await xW(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let q=_1(Q,V$,(W,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...q.tokens);let z=Q;if(Q=await fW(q.output,Z,Y,J,X),Q===z)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(J.debug){let K=yW(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var YY=!1,_6="\x00stx-boolean-attribute",kW,XY;var H6=y(()=>{l3();t2();ZY();C5();N0();T0();kW=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","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"]);XY=new Map});var HY={};r(HY,{processLoops:()=>O6});function dW($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,q=1,z=K+1;while(z<J.length&&q>0){if(J[z]==="(")q++;else if(J[z]===")"){if(q--,q===0)break}z++}if(q!==0)continue;let W=J.substring(K+1,z),U=z+1,B=W.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let j=B[1],_=W.slice(B[0].length),H=_.match(/^\s*,\s*/);if(!H)continue;let L=_.slice(H[0].length).trim();if(!L)continue;try{let V=R0(L,Z),O=JSON.stringify(V),F=`@component('${j}', ${O})`;Q.push({start:G,end:U,replacement:F})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=Q[G];J=J.substring(0,K)+z+J.substring(q)}return J}function m4($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,z=K+1,W=null,U=!1;while(z<J.length&&q>0){let _=J[z];if(U){U=!1,z++;continue}if(_==="\\"&&W){U=!0,z++;continue}if(W){if(_===W)W=null;z++;continue}if(_==='"'||_==="'"||_==="`"){W=_,z++;continue}if(_==="(")q++;else if(_===")"){if(q--,q===0)break}z++}if(q!==0)break;let B=J.substring(K+1,z),j=Y(B);J=J.substring(0,G)+j+J.substring(z+1)}return J}function uW($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);_$(Q);let z=K0(Q,G)(...K),W=JSON.stringify(z),U=Buffer.from(W,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return J}}),Y}function mW($,Z){let Y=$;return Y=m4(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(G0(Q)){let K=K0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?p4:""}catch{return""}}),Y=m4(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(G0(Q)){let K=K0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?l4:""}catch{return""}}),Y}function pW($){let Z=$;return Z=Z.replace(/@break(?!\()/g,p4),Z=Z.replace(/@continue(?!\()/g,l4),Z}function zY($){let Z=$.includes(p4),Y=Z?$.substring(0,$.indexOf(p4)):$;return{hasBreak:Z,content:Y}}function WY($){let Z=$.includes(l4),Y=Z?$.substring(0,$.indexOf(l4)):$;return{hasContinue:Z,content:Y}}function BY($){let Z=$;return Z=m4(Z,"@break",(Y)=>{let J=Y.trim();if(!H$(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=m4(Z,"@continue",(Y)=>{let J=Y.trim();if(!H$(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function lW($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((W,U)=>W.pos-U.pos);let K=[],q=0;for(let W of J)q+=W.delta,K.push({pos:W.pos,depth:q});function z(W){let U=0,B=K.length-1,j=0;while(U<=B){let _=U+B>>1;if(K[_].pos<=W)j=K[_].depth,U=_+1;else B=_-1}return j}while((Y=Z.exec($))!==null){if(z(Y.index)>0)continue;let W=Y.index,U=Y.index+Y[0].length-1,B=1,j=U+1,_=-1;while(j<$.length&&B>0){if($[j]==="(")B++;else if($[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let H=$.substring(U+1,_),L=H.indexOf(" as ");if(L===-1)continue;let V=H.substring(0,L).trim(),O=H.substring(L+4).trim(),F=_+1,w=1,A=F,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(w>0&&A<$.length){N.lastIndex=A,R.lastIndex=A;let b=N.exec($),D=R.exec($);if(!D)break;if(b&&b.index<D.index)w++,A=b.index+b[0].length;else{if(w--,w===0){T=D.index;break}A=D.index+11}}if(T===-1)continue;let M=$.substring(F,T),I=T+11,E=-1,k=0,C=0;while(C<M.length){let b=M.indexOf("@",C);if(b===-1)break;let D=M.substring(b);if(/^@forelse\s*\(/.test(D))k++,C=b+1;else if(D.startsWith("@endforelse"))k--,C=b+11;else if(k===0&&D.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){E=b;break}C=b+1}else C=b+1}if(E===-1)continue;return{start:W,end:I,arrayExpr:V,itemVar:O,foreachContent:M.substring(0,E),emptyContent:M.substring(E+6)}}return null}function UY($,Z){let Y=$;while(!0){let J=lW(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:z}=J;try{let W;if(G0(G))W=K0(G,Object.keys(Z))(...Object.values(Z));else W=J0(G,Z);let U;if(!Array.isArray(W)||W.length===0)U=z;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,X)+U+Y.substring(Q)}catch(W){let U=W instanceof Error?W.message:String(W),B=Z0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,X)+B+Y.substring(Q)}}return Y}function O6($,Z,Y,J){let X=$;X=UY(X,Z);function Q(q){let z=/@foreach\s*\(/g,W;while((W=z.exec(q))!==null){let U=W.index,B=W.index+W[0].length-1,j=1,_=B+1,H=-1;while(_<q.length&&j>0){if(q[_]==="(")j++;else if(q[_]===")"){if(j--,j===0){H=_;break}}_++}if(H===-1)continue;let L=q.substring(B+1,H),V=L.indexOf(" as ");if(V===-1)continue;let O=U,F=L.substring(0,V),w=L.substring(V+4),A=H+1,N=1,R=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&R<q.length){T.lastIndex=R,M.lastIndex=R;let I=T.exec(q),E=M.exec(q);if(!E)break;if(I&&I.index<E.index)N++,R=I.index+I[0].length;else{if(N--,N===0){let k=q.substring(A,E.index),C=E.index+11;return{start:O,end:C,arrayExpr:F,itemVar:w,content:k}}R=E.index+11}}}return null}function G(q,z){let W=q;while(!0){let U=Q(W);if(!U)break;let{start:B,end:j,arrayExpr:_,itemVar:H,content:L}=U;try{let V=_.trim(),O;if(G0(V))O=K0(V,Object.keys(z))(...Object.values(z));else O=J0(V,z);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{let E=Z0("Foreach",`Error in @foreach: ${V} is not iterable`,s.TYPE_ERROR);W=W.substring(0,B)+E+W.substring(j);continue}let w=J?.loops?.useAltLoopVariable??hW,A=H.trim(),N=null,R,T=!1;if(A.includes("=>")){let E=A.split("=>").map((k)=>k.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((k)=>k.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1],T=!0;else R=A}else R=A;let M="",I=O;for(let E=0;E<I.length;E++){let k=I[E],C={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},b={...z,loop:C,$loop:C};if(R.startsWith("[")&&R.endsWith("]")){let g=R.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(k))g.forEach((d,c)=>{if(d)b[d]=k[c]});else b[R]=k}else b[R]=k;if(N)if(!T&&F&&Array.isArray(k)&&k.length===2)b[N]=k[0],b[R]=k[1];else b[N]=E;let D=mW(L,b),P=WY(D);if(P.hasContinue){M+=P.content;continue}let f=zY(D);if(f.hasBreak){M+=f.content;break}if(D=UY(D,b),D=G(D,b),D=p1(D,b,Y),D=pW(D),f=zY(D),f.hasBreak){M+=f.content;break}if(P=WY(D),P.hasContinue){M+=P.content;continue}D=H1(D,b,Y),D=uW(D,b),D=dW(D,b),M+=D}W=W.substring(0,B)+M+W.substring(j)}catch(V){let O=Z0("Foreach",`Error in @foreach(${_.trim()} as ${H.trim()}): ${V instanceof Error?V.message:String(V)}`,s.EVALUATION_ERROR);W=W.substring(0,B)+O+W.substring(j)}}return W}X=G(X,Z),X=_Y(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??gW;return X=nW(X,Z,K),X}function jY($){return H$($)}function _Y($,Z,Y,J){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,z=y0(X,"(",")",q);if(z===-1)break;let W=X.slice(q+1,z),U=z+1,B=D$(X.slice(K),"for","endfor");if(B.length===0)break;let j=B[0].content,_=K+B[0].end;if(!jY(W)){let H=Z0("For",`Unsafe expression in @for: ${W}`,s.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(_),Q=!0;continue}try{let H=cW(W),L=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(H.length>0&&L){let N=iW({forExpr:W,content:j,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+N+X.substring(_),Q=!0;continue}let V=Object.keys(Z),O=Object.values(Z),F=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});F=BY(F);let A=Function(...V,`
|
|
8595
|
+
</style>`}}});var o2={};r(o2,{resolveCollectionPath:()=>z6,preloadIconCollection:()=>n2,IconBuiltin:()=>x4});import{existsSync as IW,readFileSync as DW}from"fs";function i2($){if(c2.has($))return;c2.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function z6($){let Z=process.cwd();for(let Y 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(IW(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return W0.resolve(Y)}catch{}return null}function EW($){if(c1.has($))return c1.get($);let Z=z6($);if(!Z)return i2($),null;try{let Y=JSON.parse(DW(Z,"utf8"));return c1.set($,Y.icons),Y.icons}catch{return null}}async function kW($){if(c1.has($))return c1.get($);let Z=z6($);if(!Z)return i2($),null;try{let Y=await Bun.file(Z).json();return c1.set($,Y.icons),Y.icons}catch{return null}}function U5($,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}async function n2($="lucide"){await kW($)}var c1,c2,x4;var f4=y(()=>{c1=new Map,c2=new Set;x4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=U5($,"name")??U5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let O=J.split(":");X=O[0],Q=O[1]}let G=s0(U5($,"size")||"24"),K=s0(U5($,"color")||"currentColor"),q=s0(U5($,"class")||""),z=s0(U5($,"style")||""),W=c1.get(X)??EW(X);if(!W)return`<!-- Icon: collection "${X}" not loaded -->`;let U=W[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${X} -->`;let B=U.width||24,_=U.height||24,j=`0 0 ${B} ${_}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=z?` style="${z}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function s2($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function r2($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var W6;var U6=y(()=>{W6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=r2(Z,"fallback"),X=J.rest,Q=r2(X,"error"),G=Q.rest,K=J.region??s2($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??s2($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function g4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var B6;var _6=y(()=>{B6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(g4($,"name")||"v").replace(/["'<>]/g,""),X=(g4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=g4($,"class"),G=g4($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function a2(){P0.registerBuiltin(c3),P0.registerBuiltin(r3),P0.registerBuiltin(t3),P0.registerBuiltin(Z6),P0.registerBuiltin(J6),P0.registerBuiltin(Q6),P0.registerBuiltin(K6),P0.registerBuiltin(x4),P0.registerBuiltin(W6),P0.registerBuiltin(B6)}var t2=y(()=>{i3();a3();e3();Y6();X6();G6();q6();f4();U6();_6();l3();i3();a3();e3();Y6();X6();G6();q6();f4();U6();_6()});function h4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function e2($,Z,Y){let J=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})`));if(!K){X=Q+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=Q+1+q.length;while(H<$.length&&$[H]!==">")H++;X=H+1;continue}let z=Q+1+q.length,W=null,U=z,B=-1,_=!1;while(z<$.length){let H=$[z];if(W){if(H==="\\"&&z+1<$.length){z+=2;continue}if(H===W)W=null;z++;continue}if(H==='"'||H==="'"){W=H,z++;continue}if(H==="/"&&z+1<$.length&&$[z+1]===">"){B=z+2,_=!0;break}if(H===">"){B=z+1;break}z++}if(B===-1){X=Q+1;continue}let j=$.slice(U,_?B-2:B-1).trim();if(_)J.push({fullMatch:$.slice(Q,B),tagName:q,attributes:j,content:"",startIndex:Q,endIndex:B,isSelfClosing:!0}),X=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),R=$.indexOf(L,O);if(R===-1)break;if(N!==-1&&N<R){let T=$[N+H.length];if(T===" "||T===">"||T==="/"||T===`
|
|
8596
|
+
`||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){X=B;continue}let w=$.slice(B,V),A=V+L.length;J.push({fullMatch:$.slice(Q,A),tagName:q,attributes:j,content:w,startIndex:Q,endIndex:A,isSelfClosing:!1}),X=A}}return J}function $Y($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var ZY=y(()=>{T0();N0();C5()});var qY={};r(qY,{processESImports:()=>GY,processComponents:()=>u4});import d4 from"fs";import h0 from"path";function SW($,Z,Y){let J={static:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!X.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){J.events[q]=K;continue}if(q.startsWith("__stx_")){let z=Q(q.slice(6));J.serverDynamic[z]=$Y(K,Y);continue}if(q.startsWith(":")){let z=Q(q.slice(1)),W=K===j6?z:K;try{if(!G0(W)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${W}`);J.clientReactive[z]=W;continue}let U=Object.keys(Z),_=K0(W,U)(...Object.values(Z));if(_===void 0){let j=W.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!U.includes(F))){J.clientReactive[z]=W;continue}}J.serverDynamic[z]=_}catch{J.clientReactive[z]=W}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let z=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let W=z[1];if(G0(W)){let B=K0(W,Object.keys(Z))(...Object.values(Z));J.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${W}`);J.static[q]=K}}catch(W){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,W);J.static[q]=K}else{let W=K,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=U.exec(K))!==null)try{let _=B[1];if(!G0(_)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${_}`);continue}let H=K0(_,Object.keys(Z))(...Object.values(Z));W=W.replace(B[0],String(H??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,_)}J.static[q]=W}continue}J.static[q]=K===j6?"true":K}return J}function yW($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=j6}return Z}function JY($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function PW($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(P0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function CW($){let Z=XY.get($);if(Z)return Z;let Y=new Map,J=[h0.join($,"src"),h0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=d4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let z=h0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;X(z,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let W=q.name.slice(0,-4);if(!Y.has(W))Y.set(W,z);let U=W.toLowerCase();if(!Y.has(U))Y.set(U,z);let B=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,z)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return XY.set($,Y),Y}function vW($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=h0.join(Y,"node_modules",$);try{if(d4.statSync(J).isDirectory())return J}catch{}let X=h0.dirname(Y);if(X===Y)return null;Y=X}}async function GY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=h0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(z,W,U)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=U,j,H=[];while((j=B.exec(U))!==null){let[L,F,O,V]=j,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=h0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(d4.statSync(M).isFile())A=M}catch{try{if(d4.statSync(T).isDirectory())w=T}catch{}}}}else w=vW(V,G);if(!w&&!A)continue;let N=!1,R=(T,M)=>{Q.set(T,M),Q.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,M),X.add(M)};if(O&&A)R(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),M=w?CW(w):null;for(let{source:I,local:E}of T){let k=null;if(A)k=A;else if(M)k=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(k)R(E,k),N=!0}}if(N)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return z;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${W}>${_}</script>`}),K}async function xW($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[z,W]=q,U=W.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of U){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[h0.resolve(h0.dirname(Y),`${B}.stx`),h0.resolve(h0.dirname(Y),B),h0.resolve(J.componentsDir||"components",`${B}.stx`),h0.resolve(J.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),X.add(F),J.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${B}`)}Q=Q.replace(z,""),K.lastIndex=0}return Q}async function fW($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,z;while((z=q.exec(Q))!==null){let W=z.index,U=W+z[0].length-1,B=1,_=U+1;while(_<Q.length&&B>0){if(Q[_]==="(")B++;else if(Q[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=Q.substring(U+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=R0(O,Z)}catch(E){let k=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(W,H),`[Error parsing component props: ${k}]`);continue}let N="",R=H,M=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let I=await f1(F,A,N,G,Z,Y,J,K,X);Q=Q.substring(0,W)+I+Q.substring(R),q.lastIndex=0}return Q}async function gW($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=P5(Q);return Q=q.output,Q=await B(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await B(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await B(Q,/[a-z][a-z0-9]*/,!1,bW),Q=J7(Q,q.scripts),Q;async function B(_,j,H,L){if(!_)return _;let F=_,O=e2(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?h4(w.tagName):w.tagName,N=yW(w.attributes),R=SW(N,Z,J),T=P0.getBuiltin(w.tagName),M=T?await c$(A,G,Z,Y,J):!1;if(T&&!M){let C={context:Z,filePath:Y,options:J,dependencies:X},b=T.render(R,w.content,C);if(Object.keys(R.clientReactive).length>0)b=QY(b,R.clientReactive);if(Object.keys(R.events).length>0){let D=Object.entries(R.events).map(([P,f])=>`${P}="${JY(f)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${D}`)}F=F.substring(0,w.startIndex)+b+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await c$(A,G,Z,Y,J))continue;let I={};for(let[C,b]of Object.entries(R.static))I[C]=b;for(let[C,b]of Object.entries(R.serverDynamic))I[C]=b;let k=await f1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(R.clientReactive).length>0)k=QY(k,R.clientReactive);if(Object.keys(R.events).length>0){let C=KY(k);if(C){let b=Object.entries(R.events).map(([P,f])=>`${P}="${JY(f)}"`).join(" "),D=Object.keys(R.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");k=k.substring(0,C.insertPos)+` data-stx-parent-events="${D}" ${b}`+k.substring(C.insertPos)}}F=F.substring(0,w.startIndex)+k+F.substring(w.endIndex)}return F}}function QY($,Z){let Y=KY($);if(!Y)return $;let J=new Set(["if","for","show"]),X=Object.entries(Z).map(([K,q])=>`:${h4(K)}="${q.replace(/"/g,""")}"`).join(" "),Q=Object.keys(Z).filter((K)=>!J.has(K)).map((K)=>h4(K)).join(" "),G=Q?` data-stx-parent-bindings="${Q}"`:"";return $.substring(0,Y.insertPos)+`${G} ${X}`+$.substring(Y.insertPos)}function KY($){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 Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+Q[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function u4($,Z,Y,J,X){if(!YY)a2(),YY=!0;let Q=await GY($,Z,Y,J,X);Q=await xW(Q,Z,Y,J,X),Q=await fW(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let q=j1(Q,V$,(W,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...q.tokens);let z=Q;if(Q=await gW(q.output,Z,Y,J,X),Q===z)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(J.debug){let K=PW(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var YY=!1,j6="\x00stx-boolean-attribute",bW,XY;var H6=y(()=>{l3();t2();ZY();C5();N0();T0();bW=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","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"]);XY=new Map});var HY={};r(HY,{processLoops:()=>O6});function uW($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,q=1,z=K+1;while(z<J.length&&q>0){if(J[z]==="(")q++;else if(J[z]===")"){if(q--,q===0)break}z++}if(q!==0)continue;let W=J.substring(K+1,z),U=z+1,B=W.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=W.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=R0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;Q.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=Q[G];J=J.substring(0,K)+z+J.substring(q)}return J}function m4($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,z=K+1,W=null,U=!1;while(z<J.length&&q>0){let j=J[z];if(U){U=!1,z++;continue}if(j==="\\"&&W){U=!0,z++;continue}if(W){if(j===W)W=null;z++;continue}if(j==='"'||j==="'"||j==="`"){W=j,z++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}z++}if(q!==0)break;let B=J.substring(K+1,z),_=Y(B);J=J.substring(0,G)+_+J.substring(z+1)}return J}function mW($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);j$(Q);let z=K0(Q,G)(...K),W=JSON.stringify(z),U=Buffer.from(W,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return J}}),Y}function pW($,Z){let Y=$;return Y=m4(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(G0(Q)){let K=K0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?p4:""}catch{return""}}),Y=m4(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(G0(Q)){let K=K0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?l4:""}catch{return""}}),Y}function lW($){let Z=$;return Z=Z.replace(/@break(?!\()/g,p4),Z=Z.replace(/@continue(?!\()/g,l4),Z}function zY($){let Z=$.includes(p4),Y=Z?$.substring(0,$.indexOf(p4)):$;return{hasBreak:Z,content:Y}}function WY($){let Z=$.includes(l4),Y=Z?$.substring(0,$.indexOf(l4)):$;return{hasContinue:Z,content:Y}}function BY($){let Z=$;return Z=m4(Z,"@break",(Y)=>{let J=Y.trim();if(!H$(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=m4(Z,"@continue",(Y)=>{let J=Y.trim();if(!H$(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function cW($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((W,U)=>W.pos-U.pos);let K=[],q=0;for(let W of J)q+=W.delta,K.push({pos:W.pos,depth:q});function z(W){let U=0,B=K.length-1,_=0;while(U<=B){let j=U+B>>1;if(K[j].pos<=W)_=K[j].depth,U=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(z(Y.index)>0)continue;let W=Y.index,U=Y.index+Y[0].length-1,B=1,_=U+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(U+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,A=V,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(w>0&&A<$.length){N.lastIndex=A,R.lastIndex=A;let b=N.exec($),D=R.exec($);if(!D)break;if(b&&b.index<D.index)w++,A=b.index+b[0].length;else{if(w--,w===0){T=D.index;break}A=D.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,E=-1,k=0,C=0;while(C<M.length){let b=M.indexOf("@",C);if(b===-1)break;let D=M.substring(b);if(/^@forelse\s*\(/.test(D))k++,C=b+1;else if(D.startsWith("@endforelse"))k--,C=b+11;else if(k===0&&D.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){E=b;break}C=b+1}else C=b+1}if(E===-1)continue;return{start:W,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,E),emptyContent:M.substring(E+6)}}return null}function UY($,Z){let Y=$;while(!0){let J=cW(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:z}=J;try{let W;if(G0(G))W=K0(G,Object.keys(Z))(...Object.values(Z));else W=J0(G,Z);let U;if(!Array.isArray(W)||W.length===0)U=z;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,X)+U+Y.substring(Q)}catch(W){let U=W instanceof Error?W.message:String(W),B=Z0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,X)+B+Y.substring(Q)}}return Y}function O6($,Z,Y,J){let X=$;X=UY(X,Z);function Q(q){let z=/@foreach\s*\(/g,W;while((W=z.exec(q))!==null){let U=W.index,B=W.index+W[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=U,V=L.substring(0,F),w=L.substring(F+4),A=H+1,N=1,R=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&R<q.length){T.lastIndex=R,M.lastIndex=R;let I=T.exec(q),E=M.exec(q);if(!E)break;if(I&&I.index<E.index)N++,R=I.index+I[0].length;else{if(N--,N===0){let k=q.substring(A,E.index),C=E.index+11;return{start:O,end:C,arrayExpr:V,itemVar:w,content:k}}R=E.index+11}}}return null}function G(q,z){let W=q;while(!0){let U=Q(W);if(!U)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=U;try{let F=j.trim(),O;if(G0(F))O=K0(F,Object.keys(z))(...Object.values(z));else O=J0(F,z);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let E=Z0("Foreach",`Error in @foreach: ${F} is not iterable`,s.TYPE_ERROR);W=W.substring(0,B)+E+W.substring(_);continue}let w=J?.loops?.useAltLoopVariable??dW,A=H.trim(),N=null,R,T=!1;if(A.includes("=>")){let E=A.split("=>").map((k)=>k.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((k)=>k.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1],T=!0;else R=A}else R=A;let M="",I=O;for(let E=0;E<I.length;E++){let k=I[E],C={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},b={...z,loop:C,$loop:C};if(R.startsWith("[")&&R.endsWith("]")){let g=R.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(k))g.forEach((d,i)=>{if(d)b[d]=k[i]});else b[R]=k}else b[R]=k;if(N)if(!T&&V&&Array.isArray(k)&&k.length===2)b[N]=k[0],b[R]=k[1];else b[N]=E;let D=pW(L,b),P=WY(D);if(P.hasContinue){M+=P.content;continue}let f=zY(D);if(f.hasBreak){M+=f.content;break}if(D=UY(D,b),D=G(D,b),D=p1(D,b,Y),D=lW(D),f=zY(D),f.hasBreak){M+=f.content;break}if(P=WY(D),P.hasContinue){M+=P.content;continue}D=H1(D,b,Y),D=mW(D,b),D=uW(D,b),M+=D}W=W.substring(0,B)+M+W.substring(_)}catch(F){let O=Z0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,s.EVALUATION_ERROR);W=W.substring(0,B)+O+W.substring(_)}}return W}X=G(X,Z),X=jY(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??hW;return X=oW(X,Z,K),X}function _Y($){return H$($)}function jY($,Z,Y,J){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,z=y0(X,"(",")",q);if(z===-1)break;let W=X.slice(q+1,z),U=z+1,B=D$(X.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!_Y(W)){let H=Z0("For",`Unsafe expression in @for: ${W}`,s.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(j),Q=!0;continue}try{let H=iW(W),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let N=nW({forExpr:W,content:_,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+N+X.substring(j),Q=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=BY(V);let A=Function(...F,`
|
|
8563
8597
|
let result = '';
|
|
8564
8598
|
for (${W}) {
|
|
8565
|
-
result += \`${
|
|
8599
|
+
result += \`${V}\`;
|
|
8566
8600
|
}
|
|
8567
8601
|
return result;
|
|
8568
|
-
`)(...O);X=X.substring(0,K)+A+X.substring(
|
|
8602
|
+
`)(...O);X=X.substring(0,K)+A+X.substring(j),Q=!0}catch(H){let L=Z0("For",`Error in @for(${W}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);X=X.substring(0,K)+L+X.substring(j),Q=!0}}return X}function iW($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let Q=Y[1];return Q.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let z=q.indexOf(":");if(z>=0&&Q.startsWith("{")){let B=q.slice(z+1).trim(),_=B.indexOf("=");return(_>=0?B.slice(0,_):B).trim()}let W=q.indexOf("="),U=(W>=0?q.slice(0,W):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(X)return[X[1]];return[]}function nW($){let{forExpr:Z,content:Y,iterVarNames:J,context:X,filePath:Q,options:G}=$,K=Object.keys(X),q=Object.values(X),z=Function(...K,"__pushIter",`
|
|
8569
8603
|
for (${Z}) {
|
|
8570
8604
|
__pushIter([${J.join(", ")}])
|
|
8571
8605
|
}
|
|
8572
|
-
`),W=[];z(...q,(
|
|
8606
|
+
`),W=[];z(...q,(_)=>{W.push(_)});let U=Q??"inline.stx",B="";for(let _ of W){let j={...X};J.forEach((L,F)=>{j[L]=_[F]});let H=jY(Y,j,Q,G);H=p1(H,j,U),H=H1(H,j,U),B+=H}return B}function oW($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,q=y0(J,"(",")",K);if(q===-1)break;let z=J.slice(K+1,q),W=D$(J.slice(G),"while","endwhile");if(W.length===0)break;let U=W[0].content,B=G+W[0].end;if(!_Y(z)){let _=Z0("While",`Unsafe expression in @while: ${z}`,s.UNSAFE_EXPRESSION);J=J.substring(0,G)+_+J.substring(B),X=!0;continue}try{let _=Object.keys(Z),j=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=BY(H);let F=Function(..._,`
|
|
8573
8607
|
let result = '';
|
|
8574
8608
|
let maxIterations = ${Y}; // Configurable safety limit
|
|
8575
8609
|
let counter = 0;
|
|
@@ -8581,21 +8615,21 @@ ${k}
|
|
|
8581
8615
|
result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
8582
8616
|
}
|
|
8583
8617
|
return result;
|
|
8584
|
-
`)(...
|
|
8585
|
-
`)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},W=()=>{if(X!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let
|
|
8618
|
+
`)(...j);J=J.substring(0,G)+F+J.substring(B),X=!0}catch(_){let j=Z0("While",`Error in @while(${z}): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR);J=J.substring(0,G)+j+J.substring(B),X=!0}}return J}var hW=1000,dW=!1,p4="<!--__STX_BREAK__-->",l4="<!--__STX_CONTINUE__-->";var L6=y(()=>{k4();q1();Z1();E$();T0()});import B0 from"path";function F6($,Z){let Y=0;for(let J=Z;J<$.length;J++){let X=$[J];if(X==="("||X==="["||X==="{")Y++;else if(X===")"||X==="]"||X==="}")Y--;else if(X===","&&Y===0)return J}return-1}function sW($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=X.exec(J);while(Q){let G=Q.index,K=G+Q[0].length-1,q=1,z=K+1;while(z<J.length&&q>0){if(J[z]==="(")q++;else if(J[z]===")")q--;z++}if(q!==0)break;let W=J.substring(K+1,z-1),U=`${Y}(${W})`;J=J.substring(0,G)+U+J.substring(z),X.lastIndex=G+U.length,Q=X.exec(J)}return J}function rW($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function LY($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){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 U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},z=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
8619
|
+
`)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},W=()=>{if(X!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!J.has(j))Y.push(j),J.add(j);return}let B=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))Y.push(j),J.add(j);return}let _=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!J.has(j))Y.push(j),J.add(j)}};while(Q<G){if(z())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){q();continue}if(Z[Q]==="{"){X++,Q++;continue}if(Z[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))W();Q++}return Y.join(", ")}function FY($,Z=""){let Y=LY($).split(",").map((J)=>J.trim()).filter(Boolean);return`
|
|
8586
8620
|
(function() {
|
|
8587
|
-
${a1("var")}
|
|
8621
|
+
${a1("var",Y)}
|
|
8588
8622
|
var __destroyHooks = [];
|
|
8589
8623
|
var __origOnDestroy = onDestroy;
|
|
8590
8624
|
onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
|
|
8591
8625
|
|
|
8592
8626
|
${$}
|
|
8593
8627
|
${Z}})();
|
|
8594
|
-
`}function
|
|
8628
|
+
`}function VY($,Z){return`
|
|
8595
8629
|
// Register scope variables for STX runtime
|
|
8596
8630
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
8597
8631
|
var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
|
|
8598
|
-
${
|
|
8632
|
+
${LY($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
8599
8633
|
`)}
|
|
8600
8634
|
// #1767: when the bundler renamed a component const that collided with an
|
|
8601
8635
|
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
@@ -8603,7 +8637,7 @@ ${rW($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
8603
8637
|
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
8604
8638
|
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
8605
8639
|
window.stx._scopes['${Z}'] = __scopeRegistration;
|
|
8606
|
-
`}function aW($,Z){let Y=
|
|
8640
|
+
`}function aW($,Z){let Y=VY($,Z),J=`
|
|
8607
8641
|
(function() {
|
|
8608
8642
|
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
|
|
8609
8643
|
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
@@ -8612,69 +8646,69 @@ ${rW($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
8612
8646
|
} finally {
|
|
8613
8647
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
8614
8648
|
}
|
|
8615
|
-
})();`;return J+
|
|
8649
|
+
})();`;return J+FY($,Y)+`
|
|
8616
8650
|
} finally {
|
|
8617
8651
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
8618
8652
|
}
|
|
8619
|
-
})();`}function tW($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let X=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function $U($){if($.__onceStore instanceof Set)return $.__onceStore;return eW}async function V6($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||B0.join(B0.dirname(Y),"partials");if(G&&!B0.isAbsolute(G))G=B0.resolve(process.cwd(),G);let K=
|
|
8620
|
-
`;continue}if(m)try{let{extractVariables:Y0}=await Promise.resolve().then(() => (p5(),I$));await Y0(
|
|
8653
|
+
})();`}function tW($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let X=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function $U($){if($.__onceStore instanceof Set)return $.__onceStore;return eW}async function V6($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||B0.join(B0.dirname(Y),"partials");if(G&&!B0.isAbsolute(G))G=B0.resolve(process.cwd(),G);let K=sW($,"@partial","@include"),q=$U(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let N=A[1],R=z(N,G,Y),T="";if(R&&await Bun.file(R).exists())X.add(R),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let N=K.substring(V+1,A-1),R=F6(N,0);if(R===-1){L.lastIndex=A;continue}let T=N.substring(0,R).trim(),M=N.substring(R+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let E=I[1],k=M.substring(I[0].length),C,b=F6(k,0);if(b!==-1)C=k.substring(b+1).trim();try{let D=`Boolean(${T})`,P;if(G0(D)){let d=K0(D,Object.keys(Z));P=Boolean(d(...Object.values(Z)))}else P=Boolean(J0(D,Z));let f=H?!P:P,g="";if(f){let d=z(E,G,Y);if(d&&await Bun.file(d).exists())X.add(d);g=`@include('${E}'${C?`, ${C}`:""})`}K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}catch(D){let P=D instanceof Error?D.message:String(D),f=q0("Include",`Error evaluating ${j} condition: ${P}`,Y,$,O);K=K.substring(0,O)+f+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let[,R,T,M,I]=N;try{let E,k=T.trim();if(G0(k))E=K0(k,Object.keys(Z))(...Object.values(Z));else E=J0(k,Z);let C="";if(Array.isArray(E)&&E.length>0)for(let b of E){let D={...Z,[M]:b},P=await U(R,D,$,L);C+=P}else if(I)C=await U(I,{},$,L);K=K.substring(0,L)+C+K.substring(V+1),j.lastIndex=0}catch(E){let k=E instanceof Error?E.message:String(E);K=K.substring(0,L)+q0("Each",`Error in @each: ${k}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let R=N[1],T=w.slice(N[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let C=1,b=1;while(b<T.length&&C>0){if(T[b]==="{")C++;else if(T[b]==="}"){if(C--,C===0)break}b++}M=T.substring(0,b+1),T=T.slice(b+1)}let E,k=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)E=k[1];try{let C=JSON.parse(R.replace(/'/g,'"')),b={};if(M)try{b=R0(M,Z)}catch(P){let f=P instanceof Error?P.message:String(P);if(J.debug){let g=q0("Include",`Error parsing includeFirst variables: ${f}`,Y,$,L,A);K=K.replace(A,()=>g)}else K=K.replace(A,()=>E||"");continue}let D=!1;for(let P of C){let f=z(P,G,Y);if(!f)continue;if(await n(f)){let g=await U(P,b,$,L);K=K.replace(A,()=>g),D=!0;break}}if(!D)if(E!==void 0)K=K.replace(A,()=>E);else if(J.debug){let P=q0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,L,A);K=K.replace(A,()=>P)}else K=K.replace(A,"")}catch(C){let b=C instanceof Error?C.message:String(C),D=q0("Include",`Error processing @includeFirst: ${b}`,Y,$,L,A);K=K.replace(A,()=>D)}j.lastIndex=0}}function z(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=B0.resolve(H),V=B0.resolve(B0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=B0.resolve(H,F);else w=B0.resolve(V,F);let A=B0.normalize(w),N=A.startsWith(O+B0.sep)||A===O,R=A.startsWith(V+B0.sep)||A===V,T=!1,M=B0.dirname(V);if(A.startsWith(M+B0.sep)){if(!B0.relative(M,A).split(B0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))T=!0}if(!N&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let W=B0.resolve(Y);Q.add(W);async function U(j,H={},L,F){let O=z(j,G,Y);if(!O)return q0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=B0.resolve(O);if(Q.has(V)){let w=[...Q,V].map((A)=>B0.basename(A)).join(" -> ");return q0("Include",`Circular include detected: ${w}`,Y,L,F)}try{X.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(g){let d=g instanceof Error?g.message:String(g);return q0("Include",`Error loading include file ${j}: ${d}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:g}=await Promise.resolve().then(() => (d3(),h3));w=g(w,Z)}if(w&&(J.debug||!r5()&&!L4()))try{let{warnUnbalancedTags:g}=await Promise.resolve().then(() => (m3(),x2));g(w,O)}catch{}let A=w;try{let{processESImports:g}=await Promise.resolve().then(() => (H6(),qY));await g(w,Z,O,J,X)}catch(g){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,g instanceof Error?g.message:g)}let N=R$(A);if(N)A=N.content.trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[g,d]of Object.entries(H))I[g]=d;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k=[...w.matchAll(E)],C="",b=null;for(let g of k){let d=g[1]||"",i=g[2]||"",m=d.includes("server"),z0=b1(d),F0="";try{let{extractAndStripCssImports:Y0,renderVendorStyleTags:I0}=await Promise.resolve().then(() => (y5(),Q9)),p0=Y0(i,{filePath:O,projectRoot:process.cwd()});i=p0.code,F0=I0(p0.styles)}catch(Y0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Y0 instanceof Error?Y0.message:Y0)}if(z0&&i.trim())i=S1(i);if(!m)try{let{hasUserImports:Y0,bundleClientScript:I0}=await Promise.resolve().then(() => (E5(),D5));if(Y0(i))i=await I0(i,O,{projectRoot:process.cwd()})}catch(Y0){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,Y0 instanceof Error?Y0.message:Y0)}let _0=rW(i);if(_0&&!m){b=`stx_scope_${B0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++OY}`;let Y0=l0(i),I0=aW(Y0,b);C+=`${F0}<script data-stx-scoped>${I0}</script>
|
|
8654
|
+
`;continue}if(m)try{let{extractVariables:Y0}=await Promise.resolve().then(() => (p5(),I$));await Y0(i,I,O)}catch(Y0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Y0)}if(!m&&!_0){let Y0=d.replace(/\bclient\b/i,"").trim();b=`stx_scope_${B0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++OY}`;let I0=l0(i),p0=VY(I0,b),X1=FY(I0,p0);C+=`${F0}<script data-stx-scoped${Y0?` ${Y0}`:""}>${X1}</script>
|
|
8621
8655
|
`}}if(b){let g=tW(A,b);if(A=g.html,g.mergedIntoExisting)C=C.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${g.mergedIntoExisting}']`),b=g.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await V6(A,I,O,J,X,Q);let{processLoops:D}=await Promise.resolve().then(() => (L6(),HY)),P=D(A,I,O);P=p1(P,I,O);let f=r1(w);if(P=H1(P,I,O,{forceSignals:f}),M)P+=`
|
|
8622
8656
|
`+M;if(C)P+=`
|
|
8623
|
-
`+C;return P}catch(w){let A=w instanceof Error?w.message:String(w);return q0("Include",`Error processing include ${
|
|
8624
|
-
`)})}var OY=0,Yw,eW;var
|
|
8625
|
-
${
|
|
8626
|
-
${
|
|
8627
|
-
`,w=Function(...B,O)(...
|
|
8628
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${
|
|
8629
|
-
`)}}}return Q}async function
|
|
8630
|
-
`,H=`${
|
|
8631
|
-
@endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+
|
|
8657
|
+
`+C;return P}catch(w){let A=w instanceof Error?w.message:String(w);return q0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){B.lastIndex=F;continue}let A=w[1],N,R=V.substring(w[0].length),T=F6(R,0);if(T!==-1)N=R.substring(T+1).trim();let M={};if(N)try{M=R0(N,Z)}catch(E){let k=E instanceof Error?E.message:String(E);K=K.replace(O,q0("Include",`Error parsing include variables for ${A}: ${k}`,Y,$,j)),B.lastIndex=0;continue}let I=await U(A,M,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function w6($,Z){let Y=$;function J(X,Q,G,K){let q=X,z=!0;while(z){z=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=q.match(W);if(!U||U.index===void 0)break;let B=U.index,_=U[1],j=B+U[0].length,H=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let A=q.slice(O),N=A.match(H),R=A.match(L),T=N?O+N.index:1/0,M=R?O+R.index:1/0;if(T<M)F++,O=T+(N[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);q=q.substring(0,B)+q.substring(V+`@${G}`.length),z=!0}return q}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function A6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
|
|
8658
|
+
`)})}var OY=0,Yw,eW;var wY=y(()=>{z7();k4();Z1();f5();$5();T0();N0();Yw=new g5(500),eW=new Set});import*as N6 from"path";async function AY($,Z,Y=""){if(N6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return RY($,Z,Y,"@js","@endjs")}async function NY($,Z,Y=""){if(N6.basename(Y)==="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 RY($,Z,Y,"@ts","@endts")}async function RY($,Z,Y,J,X){let Q=$,G=e1(`${J}([\\s\\S]*?)${X}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:z,content:W,index:U}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=W.trim();if(J==="@ts")j=j.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 L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
|
|
8659
|
+
${j}
|
|
8660
|
+
${F}
|
|
8661
|
+
`,w=Function(...B,O)(..._);if(w&&typeof w==="object")Object.assign(Z,w);Q=Q.replace(z,"")}catch(B){console.error(`Error executing ${J} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=q0(`${J} Directive`,`Error executing code: ${_}`,Y,$,U,z);console.error(j),Q=Q.replace(z,"")}return Q}var TY=y(()=>{$5();N0()});function ZU($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function MY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return ZU(J,Q||"_method")})}async function IY($,Z,Y,J,X){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((K)=>K.timing===X);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(Q,Z,Y,J);if(typeof q==="string")Q=q;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${K.name}:`,q);if(J.debug){let z=q0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
|
|
8662
|
+
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${c0(z)}</div>
|
|
8663
|
+
`)}}}return Q}async function DY($,Z,Y,J){return IY($,Z,Y,J,"before")}async function EY($,Z,Y,J){return IY($,Z,Y,J,"after")}var kY=y(()=>{Z1();N0()});import{defineRoute as Hw,defineRoutes as Ow,resetRoutes as Lw,route as Fw,setAppUrl as Vw}from"stx-router";import{route as YU}from"stx-router";function bY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?R0(X,{}):{};return YU(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var SY=y(()=>{T0()});async function yY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(K$.exact[$])for(let J of K$.exact[$])await Promise.resolve(J(Z,$));if(K$.exact[Y])for(let J of K$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of K$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var K$;var PY=y(()=>{K$={patterns:[],exact:{}}});function CY($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>CY(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function vY($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(z){return X.some(([W,U])=>z>=W&&z<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let z=Q[0],W=Q[2];if(!W||!W.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=W,j=!1;while((B=U.exec(W))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${L})`)(...O);if(H==="class"){let N=CY(A);if(N){let R=_.match(/\sclass="([^"]*)"/);if(R)_=_.replace(R[0],` class="${R[1]} ${N}"`);else _=_.replace(B[0],` class="${N}"`)}else _=_.replace(B[0],"");j=!0;continue}if(JU.has(H)){if(A)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(B[0],"");else{let N=String(A).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");_=_.replace(B[0],` ${H}="${N}"`)}j=!0}catch{continue}}if(j){let H=z.endsWith("/>")?" /":"",F=`<${Q[1]}${_}${H}>`;q.push({start:Q.index,end:Q.index+z.length,replacement:F})}}for(let z=q.length-1;z>=0;z--){let{start:W,end:U,replacement:B}=q[z];Y=Y.slice(0,W)+B+Y.slice(U)}return Y}var JU;var xY=y(()=>{JU=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function i1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;return{full:J[0],tag:J[1],attrs:J[2],selfClosing:J[3].includes("/")||XU.has(J[1].toLowerCase()),start:J.index,end:J.index+J[0].length}}function GU($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X;let K=Q.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)J++,X=K.index+K[0].length;else{if(J--,J===0)return q.index+q[0].length;X=q.index+q[0].length}}return-1}function Y1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=GU($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function fY($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function B5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function M1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function I1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function KU($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function qU($){let Z=$,Y=0;while(Y<Z.length){let J=i1(Z,Y);if(!J)break;let X=B5(J.attrs,"v-for");if(X===null){Y=J.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=J.end;continue}let G=Q[1].trim(),K=Q[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let z=M1(J.attrs,"v-for"),W=M1(z,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=Y1(Z,J),B=Z.slice(U.outerStart,U.outerEnd),_=I1(B,{...J,start:0,end:J.end-J.start},W),j=`@foreach(${q})
|
|
8664
|
+
`,H=`${j}${_}
|
|
8665
|
+
@endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function zU($){let Z=$,Y=0;while(Y<Z.length){let J=i1(Z,Y);if(!J)break;let X=B5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=Y1(Z,J),K=M1(J.attrs,"v-if"),q=I1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:J});let z=G.outerEnd,W=!0;while(W){let H=Z.slice(z).match(/^\s*/),L=H?H[0].length:0,F=i1(Z,z+L);if(!F){W=!1;break}let O=B5(F.attrs,"v-else-if"),V=fY(F.attrs,"v-else");if(O!==null){let w=Y1(Z,F),A=M1(F.attrs,"v-else-if"),N=I1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);Q.push({type:"else-if",expr:O,outerStart:z,outerEnd:w.outerEnd,element:N,parsedTag:F}),z=w.outerEnd}else if(V){let w=Y1(Z,F),A=M1(F.attrs,"v-else"),N=I1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);Q.push({type:"else",outerStart:z,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=!1}else W=!1}let U=[];for(let H of Q)if(H.type==="if")U.push(`@if(${H.expr})
|
|
8632
8666
|
${H.element}`);else if(H.type==="else-if")U.push(`@elseif(${H.expr})
|
|
8633
8667
|
${H.element}`);else U.push(`@else
|
|
8634
8668
|
${H.element}`);U.push("@endif");let B=U.join(`
|
|
8635
|
-
`),
|
|
8669
|
+
`),_=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function WU($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function UU($){let Z=$,Y=0;while(Y<Z.length){let J=i1(Z,Y);if(!J)break;let X=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=X.match(G);while(K){Q=!0;let W=K[1],U=K[2],B=K[3];X=X.replace(K[0],""),X+=` :${W}="${B}" @update:${W}="${B} = $event"`,K=X.match(G)}if(Q){let W=Y1(Z,J),U=Z.slice(W.outerStart,W.outerEnd),B=I1(U,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,W.outerStart)+B+Z.slice(W.outerEnd),Y=W.outerStart+B.length;continue}let q=B5(J.attrs,"v-model");if(q===null){Y=J.end;continue}if(QU.has(J.tag.toLowerCase())){let W=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=Y1(Z,J),B=Z.slice(U.outerStart,U.outerEnd),_=I1(B,{...J,start:0,end:J.end-J.start},W);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}else{let W=J.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=Y1(Z,J),B=Z.slice(U.outerStart,U.outerEnd),_=I1(B,{...J,start:0,end:J.end-J.start},W);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}}return Z}function BU($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function _U($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function jU($){let Z=$,Y=0;while(Y<Z.length){let J=i1(Z,Y);if(!J)break;let X=B5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=Y1(Z,J),G=M1(J.attrs,"v-html"),K=J.selfClosing?" /":"",q=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function HU($){let Z=$,Y=0;while(Y<Z.length){let J=i1(Z,Y);if(!J)break;let X=B5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=Y1(Z,J),G=M1(J.attrs,"v-text"),K=J.selfClosing?" /":"",q=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function OU($){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 LU($){let Z=$,Y=0;while(Y<Z.length){let J=i1(Z,Y);if(!J)break;if(!fY(J.attrs,"v-once")){Y=J.end;continue}let X=M1(J.attrs,"v-once"),Q=Y1(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
|
|
8636
8670
|
${I1(G,{...J,start:0,end:J.end-J.start},X)}
|
|
8637
|
-
@endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function FU($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function VU($){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
|
|
8638
|
-
${$.slice(Z)}`}function AU($,Z={},Y={}){let{title:J="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:q="",bodyClass:z="",bodyAttrs:W={}}=Z,U=Y.title||J,
|
|
8671
|
+
@endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function FU($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function VU($){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 gY($){if(!KU($))return $;let Z=$;return Z=qU(Z),Z=zU(Z),Z=LU(Z),Z=BU(Z),Z=_U(Z),Z=UU(Z),Z=WU(Z),Z=VU(Z),Z=jU(Z),Z=HU(Z),Z=OU(Z),Z=FU(Z),Z}var XU,QU;var hY=y(()=>{XU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),QU=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 c4($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}async function dY($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let z=K.length-1;z>=0;z--){let W=K[z];try{let U=J0(W.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${c4(W.expr)}" -->`;Q=Q.slice(0,W.index)+O+Q.slice(W.index+W.full.length);continue}let B=W.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=J0(V,Z)}catch{_[O]=V}else _[O]=V}let L=J.componentsDir||"components",F=await f1(U,_,W.slotContent,L,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,W.index)+F+Q.slice(W.index+W.full.length)}catch(U){let B=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${c4(B)} -->`;Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}}return Q=await wU(Q,Z,Y,J,X),Q}async function wU($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let z=K.length-1;z>=0;z--){let W=K[z];try{let U=J0(W.expr,Z);if(!U||typeof U!=="string"){let j=`<!-- dynamic component: could not resolve "${c4(W.expr)}" -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length);continue}let B=J.componentsDir||"components",_=await f1(U,{},"",B,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}catch(U){let B=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${c4(B)} -->`;Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}}return Q}var uY=y(()=>{N0();T0()});function mY($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
|
|
8672
|
+
${$.slice(Z)}`}function AU($,Z={},Y={}){let{title:J="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:q="",bodyClass:z="",bodyAttrs:W={}}=Z,U=Y.title||J,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...Q].map((A)=>{return` <meta ${Object.entries(A).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
|
|
8639
8673
|
`),H=G.map((A)=>{return` <link ${Object.entries(A).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
|
|
8640
8674
|
`),L=K.map((A)=>{if(A.src)return` <script ${Object.entries(A).filter(([R])=>R!=="content").map(([R,T])=>`${R}="${T}"`).join(" ")}></script>`;if(A.content)return` <script>${A.content}</script>`;return""}).filter(Boolean).join(`
|
|
8641
|
-
`),
|
|
8675
|
+
`),F=Object.entries(W).map(([A,N])=>` ${A}="${N}"`).join(""),O=z?` class="${z}"`:"",V=[j,` <title>${U}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((A)=>` ${A}`),...(Y.headScripts||[]).map((A)=>` ${A}`),Y.headStack||""].filter(Boolean),w=[$,...(Y.bodyScripts||[]).map((A)=>A),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
8642
8676
|
<html lang="${X}">
|
|
8643
8677
|
<head>
|
|
8644
|
-
${
|
|
8678
|
+
${V.join(`
|
|
8645
8679
|
`)}
|
|
8646
8680
|
</head>
|
|
8647
|
-
<body${O}${
|
|
8681
|
+
<body${O}${F}>
|
|
8648
8682
|
${w.join(`
|
|
8649
8683
|
`)}
|
|
8650
8684
|
</body>
|
|
8651
|
-
</html>`}function R6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function
|
|
8685
|
+
</html>`}function R6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function pY($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:X=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let z of J){let W=z.name?`name="${z.name}"`:z.property?`property="${z.property}"`:z.charset!=null?"charset=":z["http-equiv"]?`http-equiv="${z["http-equiv"]}"`:"";if(W&&K.includes(W))continue;q.push(` <meta ${Object.entries(z).map(([U,B])=>`${U}="${B}"`).join(" ")}>`)}for(let z of X){if(z.href&&K.includes(`href="${z.href}"`))continue;q.push(` <link ${Object.entries(z).map(([W,U])=>`${W}="${U}"`).join(" ")}>`)}for(let z of Q)if(z.src){if(K.includes(`src="${z.src}"`))continue;q.push(` <script ${Object.entries(z).filter(([W])=>W!=="content").map(([W,U])=>`${W}="${U}"`).join(" ")}></script>`)}else if(z.content){if(K.includes(z.content))continue;q.push(` <script>${z.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
|
|
8652
8686
|
`)}
|
|
8653
|
-
${$.slice(Y)}`}function
|
|
8687
|
+
${$.slice(Y)}`}function lY($,Z={},Y={}){if(R6($))return $;return AU($,Z,Y)}import _5 from"path";function cY($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function iY($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=_5.join(X,$);if(await Bun.file(G).exists())return G;X=_5.dirname(X)}J=_5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=_5.resolve(Z,$);else J=_5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function nY($,Z,Y){let J=$,X=_5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[z,W,U,B]=G;if(cY(U))continue;let _=await iY(U,X,Z);if(_)try{let j=await Bun.file(_).text();if(Y.add(_),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:d0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
|
|
8654
8688
|
// Source: ${U}
|
|
8655
|
-
${
|
|
8656
|
-
</script>`;J=J.replace(z,H),Q.lastIndex=0}catch(
|
|
8689
|
+
${j}
|
|
8690
|
+
</script>`;J=J.replace(z,H),Q.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(J))!==null){let[z,W,U,B]=q,_=W+B;if(cY(U))continue;if(/rel=["']stylesheet["']/.test(_)||U.endsWith(".css")){let H=await iY(U,X,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
|
|
8657
8691
|
/* Source: ${U} */
|
|
8658
8692
|
${L}
|
|
8659
|
-
</style>`;J=J.replace(z,
|
|
8660
|
-
`),U=[];W.forEach((j
|
|
8693
|
+
</style>`;J=J.replace(z,F),K.lastIndex=0}catch(L){}}}return J}var oY=y(()=>{E1()});function T6($,Z){let Y=$,J=/@json\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,q=G+1,z=null,W=!1;while(q<Y.length&&K>0){let V=Y[q];if(W){W=!1,q++;continue}if(V==="\\"&&z){W=!0,q++;continue}if(z){if(V===z)z=null;q++;continue}if(V==='"'||V==="'"||V==="`"){z=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),B=Y.substring(Q,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){_=V;break}}let F=_>=0?U.substring(0,_).trim():U,O=_>=0?U.substring(_+1).trim():void 0;try{let V=F.trim(),w;if(G0(V))w=K0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let N=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+N+Y.substring(q+1),J.lastIndex=Q+N.length}catch(V){n0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),J.lastIndex=Q+B.length}}return Y}function M6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function sY($){let Z=$,Y=/@memo\s*\(/g,J,X=[];while((J=Y.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let z=Z.slice(G,q-1).trim(),W=q,U=Z.slice(W),B=U.indexOf("@endmemo");if(B===-1)continue;let _=U.slice(0,B),j=W+B+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[R,T,M="",I]=A,E=`<${T}${M} data-stx-memo="${z}"${I}>`;N=_.slice(0,L)+E+w.slice(R.length)+_.slice(L+w.length)}else N=`${_.slice(0,L)}<div data-stx-memo="${z}">${w}</div>${_.slice(L+w.length)}`;X.push({start:Q,end:j,replacement:N}),Y.lastIndex=j}for(let Q=X.length-1;Q>=0;Q--){let G=X[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function I6($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function rY($){let Y=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="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,q=!1,z=!1,W=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(z){if(H==='"')z=!1}else if(H==="'")q=!0;else if(H==='"')z=!0;else if(H===">"){W=K;break}K++}if(W===-1)continue;if($.slice(G,W+1).includes("x-cloak"))continue;let B=$.slice(W+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(X,W)+" x-cloak>",X=W+1}return J+=$.slice(X),J}function aY($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,X;while((X=Z.exec($))!==null){let Q=X.index,G=X[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,Q);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=Q+X[0].length,q=!1,z=!1,W=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(z){if(j==='"')z=!1}else if(j==="'")q=!0;else if(j==='"')z=!0;else if(j===">"){W=K;break}K++}if(W===-1)continue;let U=$.slice(Q+X[0].length,W);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!NU.test(U))continue;let B=$[W-1]==="/",_=B?W-1:W;Y+=`${$.slice(J,_)} x-cloak${B?" ":""}`,J=_}return Y+=$.slice(J),Y}var NU;var D6=y(()=>{q1();T0();NU=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function E6($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},X=J.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:q}of RU){if(X.some((W)=>K.includes(W)||G.source.includes(W)))continue;G.lastIndex=0;let z=$.match(G);if(z&&z.length>0){let W=$.split(`
|
|
8694
|
+
`),U=[];W.forEach((_,j)=>{if(G.lastIndex=0,G.test(_))U.push(j+1)});let B=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";Q.push(` \u2717 ${K}${B}
|
|
8661
8695
|
\u2192 ${q}`)}}if(Q.length>0&&J.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
|
|
8662
8696
|
${Q.join(`
|
|
8663
8697
|
`)}
|
|
8664
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var RU;var k6=y(()=>{RU=[{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:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{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"}]});var
|
|
8665
|
-
${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${W}:`,U)}if(K.length===0)return
|
|
8698
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var RU;var k6=y(()=>{RU=[{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:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{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"}]});var tY={};r(tY,{getStoreScript:()=>TU,clearStoreCache:()=>MU});import i4 from"path";async function TU($){let Z;if($)Z=i4.resolve($);else{let W=await z1();Z=i4.resolve(W.root||process.cwd(),W.storesDir||"stores")}let Y=j5.get(Z);if(Y!==void 0)return Y||null;let J=new Bun.Glob("*.ts"),X=[];try{for await(let W of J.scan({cwd:Z,absolute:!0})){let U=i4.basename(W,".ts");if(["index","types"].includes(U))continue;if(W.includes(".d.ts"))continue;X.push(W)}}catch{return j5.set(Z,""),null}if(X.length===0)return j5.set(Z,""),null;let Q=[];for(let W of X){let U=await Bun.file(W).text();Q.push({file:W,hasUseStore:/useStore\s*\(/.test(U)})}Q.sort((W,U)=>{if(W.hasUseStore===U.hasUseStore)return 0;return W.hasUseStore?1:-1});let G=Q.map((W)=>W.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()});for(let W of G)try{let U=await Bun.file(W).text(),B=i4.basename(W,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=q.transformSync(U),K.push(`// Store: ${B}
|
|
8699
|
+
${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${W}:`,U)}if(K.length===0)return j5.set(Z,""),null;let z=`;(function(){
|
|
8666
8700
|
${K.join(`
|
|
8667
8701
|
|
|
8668
8702
|
`)}
|
|
8669
|
-
})();`;return
|
|
8670
|
-
${
|
|
8703
|
+
})();`;return j5.set(Z,z),z}function MU(){j5.clear()}var j5;var eY=y(()=>{m1();E1();j5=new Map});var ZJ={};r(ZJ,{getComposableScript:()=>kU,clearComposableCache:()=>bU});import q$ from"path";function $J($){let Z=q$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function DU($){if($)return q$.resolve($);let Z=`<default>:${process.cwd()}`,Y=b6.get(Z);if(Y!==void 0)return Y;let J=await EU();return b6.set(Z,J),J}async function EU(){let $=await z1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return q$.resolve(Z,Y);for(let J of IU){let X=q$.resolve(Z,J);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!$J(G))return X}catch{}}return null}async function kU($){let Z=await DU($);if(!Z)return null;let Y=H5.get(Z);if(Y!==void 0)return Y||null;let J=[];try{let _=new Bun.Glob("**/*.ts");for await(let j of _.scan({cwd:Z,absolute:!0})){if($J(j))continue;J.push(j)}}catch{return H5.set(Z,""),null}if(J.length===0)return H5.set(Z,""),null;J.sort();let X=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}),Q=[],G=new Set,K=new Set;for(let _ of J)try{let j=await Bun.file(_).text(),H=q$.basename(_,".ts");for(let L of j.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of X.scan(j).exports)if(L!=="default")G.add(L)}catch{}j=l0(j),j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(default\s+)?/gm,""),j=X.transformSync(j),Q.push(`// Composable: ${H}
|
|
8704
|
+
${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load composable ${_}:`,j)}if(Q.length===0||G.size===0)return H5.set(Z,""),null;let q=[...G].map((_)=>` try { __c[${JSON.stringify(_)}] = ${_}; } catch (e) {}`).join(`
|
|
8671
8705
|
`),z=JSON.stringify([...G]),W=Q.join(`
|
|
8672
8706
|
|
|
8673
8707
|
`),B=`;(function(){
|
|
8674
8708
|
window.__composables = window.__composables || {};
|
|
8675
8709
|
var __c = window.__composables;
|
|
8676
8710
|
var __stx = window.stx || {};
|
|
8677
|
-
${A$.filter((
|
|
8711
|
+
${A$.filter((_)=>!K.has(_)&&new RegExp(`\\b${_}\\b`).test(W)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
|
|
8678
8712
|
`)}
|
|
8679
8713
|
${W}
|
|
8680
8714
|
${q}
|
|
@@ -8691,7 +8725,7 @@ ${q}
|
|
|
8691
8725
|
}
|
|
8692
8726
|
window[__n] = __c[__n];
|
|
8693
8727
|
}
|
|
8694
|
-
})();`;return H5.set(Z,B),B}function bU(){H5.clear(),b6.clear()}var H5,b6,IU;var
|
|
8728
|
+
})();`;return H5.set(Z,B),B}function bU(){H5.clear(),b6.clear()}var H5,b6,IU;var YJ=y(()=>{m1();E1();f5();H5=new Map,b6=new Map,IU=["composables","functions"]});var XJ={};r(XJ,{processDeferDirectives:()=>vU});function SU(){return`stx-defer-${++JJ}`}function yU($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function PU($,Z,Y){let{trigger:J,value:X}=yU(Z),Q=Y,G,K,q,z=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(z)G=z[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)K=W[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:J,triggerValue:X,content:Q,placeholder:G,loading:K,error:q}}function CU($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
|
|
8695
8729
|
const observer = new IntersectionObserver((entries) => {
|
|
8696
8730
|
if (entries[0].isIntersecting) {
|
|
8697
8731
|
observer.disconnect();
|
|
@@ -8764,15 +8798,15 @@ else {
|
|
|
8764
8798
|
${X}
|
|
8765
8799
|
})();
|
|
8766
8800
|
</script>
|
|
8767
|
-
`}function vU($,Z,Y){
|
|
8801
|
+
`}function vU($,Z,Y){JJ=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(X,Q,G)=>{let K=SU(),q=PU(X,Q,G),z=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",W=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,_=CU(K,q);return`
|
|
8768
8802
|
<div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
|
|
8769
8803
|
${z}
|
|
8770
8804
|
${W}
|
|
8771
8805
|
${B}
|
|
8772
8806
|
${U}
|
|
8773
8807
|
</div>
|
|
8774
|
-
${
|
|
8775
|
-
`})}var
|
|
8808
|
+
${_}
|
|
8809
|
+
`})}var JJ=0;var GJ={};r(GJ,{processTeleportDirectives:()=>hU,ensureTeleportTargets:()=>dU});function xU(){return`stx-teleport-${++QJ}`}function fU($){let Z=$.split(",").map((X)=>X.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let X=1;X<Z.length;X++){let Q=Z[X].match(/disabled:\s*(.+)/);if(Q)J=Q[1].trim()}return{target:Y,disabled:J}}function gU($,Z){return`
|
|
8776
8810
|
<script>
|
|
8777
8811
|
(function() {
|
|
8778
8812
|
const source = document.getElementById('${$}');
|
|
@@ -8818,7 +8852,7 @@ else {
|
|
|
8818
8852
|
});
|
|
8819
8853
|
})();
|
|
8820
8854
|
</script>
|
|
8821
|
-
`}function hU($,Z,Y){
|
|
8855
|
+
`}function hU($,Z,Y){QJ=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(X,Q,G)=>{let K=xU(),{target:q,disabled:z}=fU(Q),W=G.trim();if(z)try{let B=!1;if(z==="true")B=!0;else if(z==="false")B=!1;else if(z in Z)B=Boolean(Z[z]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${W}</div>`}catch{}let U=gU(K,q);return`
|
|
8822
8856
|
<div id="${K}" class="stx-teleport-source" style="display: none;">
|
|
8823
8857
|
<template>${W}</template>
|
|
8824
8858
|
</div>
|
|
@@ -8840,7 +8874,7 @@ else {
|
|
|
8840
8874
|
});
|
|
8841
8875
|
})();
|
|
8842
8876
|
</script>
|
|
8843
|
-
`}var
|
|
8877
|
+
`}var QJ=0;var WJ={};r(WJ,{processTransitionDirectives:()=>lU,processTransitionAttributes:()=>oU,performLeave:()=>pU,performEnter:()=>mU,generateTransitionRuntime:()=>nU,generateTransitionCSS:()=>iU});function KJ($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function uU($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",X=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(X(Y),X(J))}function qJ($,Z){return new Promise((Y)=>{let J=Z??uU($);if(J===0){Y();return}let X=!1,Q=()=>{if(X)return;X=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,J+50)})}function zJ($){$.offsetHeight}async function mU($,Z={}){let Y=Z.name||"stx",J=KJ(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),zJ($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await qJ($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function pU($,Z={}){let Y=Z.name||"stx",J=KJ(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),zJ($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await qJ($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function lU($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=cU(Q),q=K.name||"stx",z=K.duration||300,W=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
8844
8878
|
<div
|
|
8845
8879
|
class="stx-transition-wrapper"
|
|
8846
8880
|
data-transition="${q}"
|
|
@@ -9158,7 +9192,7 @@ else {
|
|
|
9158
9192
|
|
|
9159
9193
|
console.log('[stx] Transition runtime initialized');
|
|
9160
9194
|
})();
|
|
9161
|
-
`}function oU($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var
|
|
9195
|
+
`}function oU($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var BJ={};r(BJ,{withErrorBoundary:()=>UJ,processErrorBoundaryDirectives:()=>aU,generateErrorBoundaryRuntime:()=>YB,generateErrorBoundaryCSS:()=>ZB,createErrorBoundary:()=>$B});function rU(){return`eb-${++sU}-${Date.now().toString(36)}`}function aU($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let q=rU(),z=tU(Q||"");return eU(q,G.trim(),K.trim(),z)})}function tU($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4];switch(X){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function eU($,Z,Y,J){let X=J.logErrors!==!1;return`
|
|
9162
9196
|
<div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
|
|
9163
9197
|
<div class="stx-error-boundary-content" data-boundary-content="${$}">
|
|
9164
9198
|
${Z}
|
|
@@ -9278,7 +9312,7 @@ else {
|
|
|
9278
9312
|
};
|
|
9279
9313
|
})();
|
|
9280
9314
|
</script>
|
|
9281
|
-
`}async function
|
|
9315
|
+
`}async function UJ($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function $B($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>UJ(J,$,Y)}function ZB(){return`
|
|
9282
9316
|
/* STX Error Boundary Styles */
|
|
9283
9317
|
.stx-error-boundary {
|
|
9284
9318
|
position: relative;
|
|
@@ -9387,7 +9421,7 @@ else {
|
|
|
9387
9421
|
|
|
9388
9422
|
console.log('[stx] Error boundary runtime initialized');
|
|
9389
9423
|
})();
|
|
9390
|
-
`}var sU=0;var
|
|
9424
|
+
`}var sU=0;var _J={};r(_J,{renderSSRSuspense:()=>zB,processSuspenseDirectives:()=>QB,generateSuspenseRuntime:()=>UB,generateSuspenseCSS:()=>WB,createSSRSuspense:()=>qB});function XB(){return`suspense-${++JB}-${Date.now().toString(36)}`}function QB($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let q=XB(),z=GB(Q||"");return KB(q,G.trim(),K.trim(),z)})}function GB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function KB($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
|
|
9391
9425
|
<div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
|
|
9392
9426
|
<div class="stx-suspense-fallback" data-suspense-fallback="${$}">
|
|
9393
9427
|
${Y}
|
|
@@ -9725,7 +9759,7 @@ else {
|
|
|
9725
9759
|
|
|
9726
9760
|
console.log('[stx] Suspense runtime initialized');
|
|
9727
9761
|
})();
|
|
9728
|
-
`}var JB=0;var
|
|
9762
|
+
`}var JB=0;var LJ={};r(LJ,{processAsyncDirectives:()=>_B,isAsyncComponent:()=>HB,generateAsyncComponentRuntime:()=>LB,generateAsyncComponentCSS:()=>OB,defineAsyncComponent:()=>jB});function jJ(){return`async-${++BB}-${Date.now().toString(36)}`}function _B($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(J,(G,K,q,z)=>{let W=jJ(),U=HJ(K);return OJ(W,U,q.trim(),z.trim())}),Q=Q.replace(X,(G,K,q)=>{let z=jJ(),W=HJ(K);return OJ(z,W,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function HJ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4],K=J[5];switch(X){case"component":Z.component=Q||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function OJ($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:q}=Z;return`
|
|
9729
9763
|
<div class="stx-async-component" data-async-id="${$}" data-component="${X}" data-status="pending">
|
|
9730
9764
|
<div class="stx-async-loading" data-async-loading="${$}">
|
|
9731
9765
|
${Y}
|
|
@@ -9952,7 +9986,7 @@ catch (error) {
|
|
|
9952
9986
|
loadComponent();
|
|
9953
9987
|
})();
|
|
9954
9988
|
</script>
|
|
9955
|
-
`}function
|
|
9989
|
+
`}function jB($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function HB($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function OB(){return`
|
|
9956
9990
|
/* STX Async Component Styles */
|
|
9957
9991
|
.stx-async-component {
|
|
9958
9992
|
position: relative;
|
|
@@ -10080,7 +10114,7 @@ catch (error) {
|
|
|
10080
10114
|
|
|
10081
10115
|
console.log('[stx] Async component runtime initialized');
|
|
10082
10116
|
})();
|
|
10083
|
-
`}var BB=0;var
|
|
10117
|
+
`}var BB=0;var VJ={};r(VJ,{shouldCacheComponent:()=>RB,processKeepAliveDirectives:()=>VB,onDeactivated:()=>DB,onActivated:()=>IB,generateKeepAliveRuntime:()=>MB,generateKeepAliveCSS:()=>TB,createKeepAliveCache:()=>NB});function FJ(){return`keep-alive-${++FB}-${Date.now().toString(36)}`}function VB($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=FJ(),q=wB(Q||"");return AB(K,G.trim(),q)})}function wB($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function AB($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
|
|
10084
10118
|
<div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
|
|
10085
10119
|
<div class="stx-keep-alive-content" data-keep-alive-content="${$}">
|
|
10086
10120
|
${Z}
|
|
@@ -10367,7 +10401,7 @@ else {
|
|
|
10367
10401
|
});
|
|
10368
10402
|
})();
|
|
10369
10403
|
</script>
|
|
10370
|
-
`}function NB($={}){return{id:$.id||
|
|
10404
|
+
`}function NB($={}){return{id:$.id||FJ(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function RB($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function TB(){return`
|
|
10371
10405
|
/* STX Keep-Alive Styles */
|
|
10372
10406
|
.stx-keep-alive {
|
|
10373
10407
|
position: relative;
|
|
@@ -10428,20 +10462,20 @@ else {
|
|
|
10428
10462
|
|
|
10429
10463
|
console.log('[stx] Keep-alive runtime initialized');
|
|
10430
10464
|
})();
|
|
10431
|
-
`}function IB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function DB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var FB=0;var
|
|
10465
|
+
`}function IB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function DB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var FB=0;var TJ={};r(TJ,{useVirtualList:()=>AJ,processVirtualListDirectives:()=>y6,processVirtualGridDirectives:()=>RJ,processInfiniteListDirectives:()=>NJ,generateVirtualListCSS:()=>wJ,default:()=>EB,createVirtualList:()=>S6});function S6($,Z){let{itemHeight:Y,containerHeight:J,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,z=[...$],W=0,U=new Map;function B(){if(G)return _();let N=Math.max(0,Math.floor(W/Y)-X),R=Math.ceil(J/Y),T=Math.min(z.length-1,N+R+X*2);return{startIndex:N,endIndex:T}}function _(){let N=0,R=0,T=z.length-1;for(let M=0;M<z.length;M++){let I=U.get(M)||K;if(N+I>W){R=Math.max(0,M-X);break}N+=I}N=0;for(let M=0;M<z.length;M++){let I=U.get(M)||K;if(N+=I,N>W+J){T=Math.min(z.length-1,M+X);break}}return{startIndex:R,endIndex:T}}function j(){if(G){let N=0;for(let R=0;R<z.length;R++)N+=U.get(R)||K;return N}return z.length*Y}function H(N){if(G){let R=0;for(let T=0;T<N;T++)R+=U.get(T)||K;return R}return N*Y}function L(){let{startIndex:N,endIndex:R}=B();return{startIndex:N,endIndex:R,scrollTop:W,totalHeight:j(),visibleItems:z.slice(N,R+1),itemHeights:new Map(U)}}function F(N,R="auto"){let T=H(N);O(T,R)}function O(N,R="auto"){W=Math.max(0,Math.min(N,j()-J))}function V(){B()}function w(N){z=[...N],U.clear(),V()}function A(){z=[],U.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function y6($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(X,Q,G,K)=>{let q=Q.trim(),z=Z[q];if(!z||!Array.isArray(z))return`<!-- virtualList: items "${q}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();W={...W,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(W.containerHeight/W.itemHeight),_=W.overscan||3,j=0,H=Math.min(z.length-1,B+_),L="";for(let O=j;O<=H&&O<z.length;O++){let V=z[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
|
|
10432
10466
|
<div class="virtual-item ${W.itemClass||""}"
|
|
10433
10467
|
style="position: absolute; top: ${O*W.itemHeight}px; height: ${W.itemHeight}px; width: 100%;"
|
|
10434
10468
|
data-index="${O}">
|
|
10435
10469
|
${w}
|
|
10436
|
-
</div>`}let
|
|
10470
|
+
</div>`}let F=z.length*W.itemHeight;return`
|
|
10437
10471
|
<div id="${U}"
|
|
10438
10472
|
class="virtual-list-container ${W.containerClass||""}"
|
|
10439
10473
|
style="position: relative; height: ${W.containerHeight}px; overflow-y: auto;"
|
|
10440
10474
|
data-item-height="${W.itemHeight}"
|
|
10441
10475
|
data-total-items="${z.length}"
|
|
10442
|
-
data-overscan="${
|
|
10476
|
+
data-overscan="${_}">
|
|
10443
10477
|
<div class="virtual-list-viewport ${W.viewportClass||""}"
|
|
10444
|
-
style="position: relative; height: ${
|
|
10478
|
+
style="position: relative; height: ${F}px; width: 100%;">
|
|
10445
10479
|
${L}
|
|
10446
10480
|
</div>
|
|
10447
10481
|
</div>
|
|
@@ -10453,7 +10487,7 @@ else {
|
|
|
10453
10487
|
const viewport = container.querySelector('.virtual-list-viewport');
|
|
10454
10488
|
const itemHeight = ${W.itemHeight};
|
|
10455
10489
|
const totalItems = ${z.length};
|
|
10456
|
-
const overscan = ${
|
|
10490
|
+
const overscan = ${_};
|
|
10457
10491
|
const containerHeight = ${W.containerHeight};
|
|
10458
10492
|
const items = ${JSON.stringify(z)};
|
|
10459
10493
|
const template = ${JSON.stringify(K.trim())};
|
|
@@ -10505,7 +10539,7 @@ else {
|
|
|
10505
10539
|
};
|
|
10506
10540
|
})();
|
|
10507
10541
|
</script>
|
|
10508
|
-
`})}function
|
|
10542
|
+
`})}function wJ(){return`
|
|
10509
10543
|
.virtual-list-container {
|
|
10510
10544
|
position: relative;
|
|
10511
10545
|
overflow-y: auto;
|
|
@@ -10553,7 +10587,7 @@ else {
|
|
|
10553
10587
|
0% { background-position: 200% 0; }
|
|
10554
10588
|
100% { background-position: -200% 0; }
|
|
10555
10589
|
}
|
|
10556
|
-
`}function
|
|
10590
|
+
`}function AJ($,Z){let Y=null,J=()=>{if(!Y)Y=S6($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(X)=>{let Q=X.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(X)=>({style:{position:"absolute",top:`${X*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":X}),scrollToIndex:(X)=>{J().scrollToIndex(X)}}}function NJ($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(X,Q,G,K,q)=>{let z=Q.trim(),W=Z[z];if(!W||!Array.isArray(W))return`<!-- infiniteList: items "${z}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();U={...U,...j}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,_=y6(`@virtualList(${z}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
|
|
10557
10591
|
// Infinite scroll detection
|
|
10558
10592
|
container.addEventListener('scroll', function() {
|
|
10559
10593
|
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
@@ -10566,12 +10600,12 @@ else {
|
|
|
10566
10600
|
});
|
|
10567
10601
|
</script>`),`
|
|
10568
10602
|
<div id="${B}" class="infinite-list-wrapper">
|
|
10569
|
-
${
|
|
10603
|
+
${_}
|
|
10570
10604
|
<div class="infinite-list-loading" style="display: none;">
|
|
10571
10605
|
${q}
|
|
10572
10606
|
</div>
|
|
10573
10607
|
</div>
|
|
10574
|
-
`})}function
|
|
10608
|
+
`})}function RJ($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(X,Q,G,K)=>{let q=Q.trim(),z=Z[q];if(!z||!Array.isArray(z))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let W={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();W={...W,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(z.length/W.columns),_=B*(W.rowHeight+(W.gap||0)),j=Math.ceil(W.containerHeight/(W.rowHeight+(W.gap||0))),H=W.overscan||2,L=0,F=Math.min(B-1,j+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<W.columns;w++){let A=V*W.columns+w;if(A>=z.length)break;let N=z[A],R=w*(100/W.columns),T=V*(W.rowHeight+(W.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,E)=>{if(typeof N==="object"&&N!==null)return String(N[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
|
|
10575
10609
|
<div class="virtual-grid-item"
|
|
10576
10610
|
style="position: absolute; top: ${T}px; left: ${R}%; width: calc(${100/W.columns}% - ${W.gap||0}px); height: ${W.rowHeight}px;"
|
|
10577
10611
|
data-index="${A}">
|
|
@@ -10581,7 +10615,7 @@ else {
|
|
|
10581
10615
|
class="virtual-grid-container"
|
|
10582
10616
|
style="position: relative; height: ${W.containerHeight}px; overflow-y: auto;">
|
|
10583
10617
|
<div class="virtual-grid-viewport"
|
|
10584
|
-
style="position: relative; height: ${
|
|
10618
|
+
style="position: relative; height: ${_}px; width: 100%;">
|
|
10585
10619
|
${O}
|
|
10586
10620
|
</div>
|
|
10587
10621
|
</div>
|
|
@@ -10641,7 +10675,7 @@ else {
|
|
|
10641
10675
|
});
|
|
10642
10676
|
})();
|
|
10643
10677
|
</script>
|
|
10644
|
-
`})}var EB;var
|
|
10678
|
+
`})}var EB;var MJ=y(()=>{EB={createVirtualList:S6,processVirtualListDirectives:y6,processInfiniteListDirectives:NJ,processVirtualGridDirectives:RJ,generateVirtualListCSS:wJ,useVirtualList:AJ}});function IJ(){return`<script data-stx-hydration-runtime>
|
|
10645
10679
|
(function() {
|
|
10646
10680
|
'use strict';
|
|
10647
10681
|
|
|
@@ -10801,7 +10835,7 @@ else {
|
|
|
10801
10835
|
stxIslands.initIslands();
|
|
10802
10836
|
}
|
|
10803
10837
|
})();
|
|
10804
|
-
</script>`}function
|
|
10838
|
+
</script>`}function DJ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function EJ($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var hJ={};r(hJ,{processStaticDirectives:()=>fJ,processPartialHydrationDirectives:()=>bJ,onHydrated:()=>xJ,isHydrated:()=>vJ,hydrateIsland:()=>yJ,hydrateByStrategy:()=>PJ,hydrateAll:()=>CJ,generatePartialHydrationCSS:()=>SJ,generateIslandManifest:()=>gJ,default:()=>xB,createIslandRegistry:()=>kJ});function kJ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function kB($){return`
|
|
10805
10839
|
<script data-hydrate="${$}">
|
|
10806
10840
|
(function() {
|
|
10807
10841
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -10953,18 +10987,18 @@ else {
|
|
|
10953
10987
|
});
|
|
10954
10988
|
})();
|
|
10955
10989
|
</script>
|
|
10956
|
-
`}function
|
|
10957
|
-
`+
|
|
10958
|
-
<script type="application/json" data-island-props="${q}">${JSON.stringify(W)}</script>`:"",
|
|
10990
|
+
`}function bJ($,Z={},Y){let J=$,X=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=O5(J,"load",Z),J=O5(J,"idle",Z),J=O5(J,"visible",Z),J=O5(J,"media",Z),J=vB(J),J=O5(J,"hover",Z),J=O5(J,"event",Z),X=Q&&J!==$,X)J+=`
|
|
10991
|
+
`+IJ();return J}function O5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(X,Q,G)=>{let K={strategy:Z};if(Q)try{let H=Q.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,z=DJ(G.trim()),W=EJ(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(z)U.push(`data-component="${z}"`);let _=Object.keys(W).length>0?`
|
|
10992
|
+
<script type="application/json" data-island-props="${q}">${JSON.stringify(W)}</script>`:"",j="";switch(Z){case"load":j=kB(q);break;case"idle":j=bB(q,K);break;case"visible":j=SB(q,K);break;case"media":j=yB(q,K);break;case"hover":j=PB(q);break;case"event":j=CB(q,K);break}return`
|
|
10959
10993
|
<div data-island="${q}"
|
|
10960
10994
|
data-strategy="${Z}"
|
|
10961
10995
|
${U.join(`
|
|
10962
10996
|
`)}
|
|
10963
10997
|
class="stx-island"
|
|
10964
10998
|
style="contents;">
|
|
10965
|
-
${G.trim()}${
|
|
10999
|
+
${G.trim()}${_}
|
|
10966
11000
|
</div>
|
|
10967
|
-
${
|
|
11001
|
+
${j}
|
|
10968
11002
|
`})}function vB($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let X=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
|
|
10969
11003
|
<div data-island="${X}"
|
|
10970
11004
|
data-strategy="only"
|
|
@@ -10984,7 +11018,7 @@ else {
|
|
|
10984
11018
|
}
|
|
10985
11019
|
})();
|
|
10986
11020
|
</script>
|
|
10987
|
-
`})}function
|
|
11021
|
+
`})}function SJ(){return`
|
|
10988
11022
|
/* Island base styles */
|
|
10989
11023
|
.stx-island {
|
|
10990
11024
|
display: contents;
|
|
@@ -11025,11 +11059,11 @@ else {
|
|
|
11025
11059
|
.stx-island.hydrated {
|
|
11026
11060
|
opacity: 1;
|
|
11027
11061
|
}
|
|
11028
|
-
`}function
|
|
11062
|
+
`}function yJ($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function PJ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function CJ(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function vJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function xJ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function fJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function gJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
|
|
11029
11063
|
<script type="application/json" id="stx-island-manifest">
|
|
11030
11064
|
${JSON.stringify(Z)}
|
|
11031
11065
|
</script>
|
|
11032
|
-
`}var xB;var
|
|
11066
|
+
`}var xB;var dJ=y(()=>{xB={processPartialHydrationDirectives:bJ,processStaticDirectives:fJ,generatePartialHydrationCSS:SJ,generateIslandManifest:gJ,createIslandRegistry:kJ,hydrateIsland:yJ,hydrateByStrategy:PJ,hydrateAll:CJ,isHydrated:vJ,onHydrated:xJ}});var aJ={};r(aJ,{watchMultiple:()=>cJ,watchEffect:()=>iJ,watch:()=>lJ,unref:()=>uJ,toRefs:()=>mJ,throttledComputed:()=>rJ,stxWatchMultiple:()=>cJ,stxWatchEffect:()=>iJ,stxWatch:()=>lJ,stxUnref:()=>uJ,stxToRefs:()=>mJ,stxThrottledComputed:()=>rJ,stxShallowRef:()=>pJ,stxRef:()=>L5,stxIsRef:()=>D1,stxDebouncedComputed:()=>sJ,stxComputed:()=>W$,shallowRef:()=>pJ,ref:()=>L5,processWatchDirectives:()=>oJ,processComputedDirectives:()=>nJ,isRef:()=>D1,default:()=>fB,debouncedComputed:()=>sJ,computed:()=>W$});function L5($){let Z=$,Y=new Set,J={get value(){if(J1){let X=z$.get(J);if(!X)X=new Set,z$.set(J,X);X.add(J1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=z$.get(J);if(Q)Q.forEach((G)=>G())}},subscribe(X){return Y.add(X),()=>Y.delete(X)},peek(){return Z}};return J}function D1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function uJ($){return D1($)?$.value:$}function mJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=L5($[Y]);return Z}function pJ($){return L5($)}function W$($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,X=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,q=new Set,z=()=>{if(G=!0,q.size>0){let B=U.value;q.forEach((_)=>_(B))}};function W(){K.clear();let B=J1;J1=z,n4.push(z);try{return Y()}finally{n4.pop(),J1=B}}let U={get value(){if(J1){let B=z$.get(U);if(!B)B=new Set,z$.set(U,B);B.add(J1)}if(G){let B=W();if(!X(Q,B))Q=B;G=!1}return Q},set value(B){if(J)J(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function lJ($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,q=!0,z=!1,W=()=>{if(D1($))return X?n1($.value):$.value;return $()},U=()=>{if(!q||z)return;let j=W();if(K!==void 0&&Object.is(K,j)&&!X)return;let H=()=>{if(Z(j,K),K=X?n1(j):j,G)_()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(D1($))B=$.subscribe(()=>U());else B=W$($).subscribe(()=>U());if(J)K=void 0,U();else K=W();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{z=!0},_.resume=()=>{z=!1},_}function cJ($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((U)=>D1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((B)=>D1(B)?B.value:void 0);if(Z(U,Q),Q=[...U],X)W()},z=$.map((U)=>{if(D1(U))return U.subscribe(()=>q());return()=>{}});if(J)q();let W=()=>{G=!1,z.forEach((U)=>U())};return W.pause=()=>{K=!0},W.resume=()=>{K=!1},W}function iJ($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let q=J1;J1=G,n4.push(G);try{J=$()}finally{n4.pop(),J1=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(X=!1,J)J()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function nJ($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(X,Q,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=q,`<!-- computed: ${Q} = ${q} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function oJ($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
|
|
11033
11067
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
11034
11068
|
(function() {
|
|
11035
11069
|
// Watch implementation for ${Q}
|
|
@@ -11041,9 +11075,9 @@ else {
|
|
|
11041
11075
|
}
|
|
11042
11076
|
})();
|
|
11043
11077
|
</script>
|
|
11044
|
-
`})}function n1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>n1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(n1(X),n1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(n1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=n1($[Y]);return Z}function
|
|
11045
|
-
`)}catch{return""}})}function
|
|
11046
|
-
`)}catch{return""}})}function
|
|
11078
|
+
`})}function n1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>n1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(n1(X),n1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(n1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=n1($[Y]);return Z}function sJ($,Z=100){let Y=L5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return W$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function rJ($,Z=100){let Y=L5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return W$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var J1=null,n4,z$,fB;var tJ=y(()=>{n4=[],z$=new WeakMap;fB={ref:L5,computed:W$,watch:lJ,watchMultiple:cJ,watchEffect:iJ,isRef:D1,unref:uJ,toRefs:mJ,shallowRef:pJ,debouncedComputed:sJ,throttledComputed:rJ,processComputedDirectives:nJ,processWatchDirectives:oJ}});var YX={};r(YX,{v:()=>gB,processHasErrorsDirective:()=>ZX,processFormValidationDirectives:()=>dB,processErrorsDirective:()=>$X,processErrorDirective:()=>eJ,defineForm:()=>hB,Validator:()=>F5});class F5{rules=[];defaultValue="";addRule($){let Z=new F5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(X)=>{if(!X)return!0;let Q=String(X).length;return Q>=$&&Q<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(X)=>{if(!X&&X!==0)return!0;let Q=Number(X);return Q>=$&&Q<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,X)=>{if(!X)return!0;return J===X[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new F5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(X,Q)=>{if(!$(X,Q||{}))return!0;return J.validate(X,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new F5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let X=await J.validate($,Z);if(X!==!0)Y.push(X)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let X=J.validate($,Z);if(X!==!0)Y.push(X)}return Y}}function hB($,Z){let Y=Object.keys($),J={},X={},Q={},G={},K={};for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function z(O){K[O]=!0;let V=await $[O].validate(J[O],J);return X[O]=V,K[O]=!1,V.length===0}async function W(){q=!0;let O=await Promise.all(Y.map(z));return q=!1,O.every(Boolean)}function U(){for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)J[V]=O[V],G[V]=!0}function _(O,V){J[O]=V,G[O]=!0}function j(O,V=!0){if(Q[O]=V,V)z(O)}function H(O){return{value:J[O],errors:X[O],touched:Q[O],dirty:G[O],valid:X[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)Q[A]=!0;if(await W())await O(J)}}return{values:J,errors:X,touched:Q,dirty:G,get isValid(){return Y.every((O)=>X[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:W,validateField:z,reset:U,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function eJ($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((W)=>{return G.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
|
|
11079
|
+
`)}catch{return""}})}function $X($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((W)=>G.replace(/\{\{\s*message\s*\}\}/g,W)).join(`
|
|
11080
|
+
`)}catch{return""}})}function ZX($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return G}catch{return""}})}function dB($,Z,Y){let J=$;return J=eJ(J,Z,Y),J=$X(J,Z,Y),J=ZX(J,Z,Y),J}var gB;var JX=y(()=>{gB=new F5});var GX={};r(GX,{processXElementDirectives:()=>uB,hasXElementDirectives:()=>QX,generateXElementRuntime:()=>XX});function XX(){return`<script data-stx-scoped>
|
|
11047
11081
|
(function() {
|
|
11048
11082
|
'use strict';
|
|
11049
11083
|
|
|
@@ -11327,9 +11361,9 @@ else {
|
|
|
11327
11361
|
// Expose for manual initialization
|
|
11328
11362
|
window.XElement = XElement;
|
|
11329
11363
|
})();
|
|
11330
|
-
</script>`}function
|
|
11364
|
+
</script>`}function QX($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function uB($){if(!QX($))return $;let Z=XX(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
|
|
11331
11365
|
`+$.slice(Y);return $+`
|
|
11332
|
-
`+Z}var
|
|
11366
|
+
`+Z}var KX={};r(KX,{rewriteImagesWithSiblings:()=>lB});import U1 from"path";async function lB($,Z){let Y=Z.formats??pB;if(!Z.publicDir)return $;let J=nB($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let U=K[0],B=U.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(oB(K.index,J))continue;G.push({idx:K.index,length:U.length,src:B[1],raw:U})}if(G.length===0)return $;let q=await Promise.all(G.map(async(U)=>{let B=await cB(U.src,Z.publicDir,Y);return{match:U,sources:B}}));for(let{match:U,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${sB(H.url)}">`).join("")}${U.raw}</picture>`;X.push({start:U.idx,end:U.idx+U.length,replacement:j})}if(X.length===0)return $;let z="",W=0;for(let U of X)z+=$.slice(W,U.start),z+=U.replacement,W=U.end;return z+=$.slice(W),z}async function cB($,Z,Y){if(!iB($))return[];let J=U1.extname($).toLowerCase();if(!mB.has(J))return[];if(!$.startsWith("/"))return[];let X=U1.join(Z,$.slice(1)),Q=U1.dirname(X),G=U1.basename(X,J),K=U1.resolve(Q),q=U1.resolve(Z);if(!K.startsWith(q))return[];let z=U1.posix.dirname($),W=Y.map(async(B)=>{let _=U1.join(Q,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:U1.posix.join(z,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(W)).filter((B)=>B!==null)}function iB($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function nB($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function oB($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function sB($){return $.replace(/&/g,"&").replace(/"/g,""")}var mB,pB;var qX=y(()=>{mB=new Set([".jpg",".jpeg",".png",".gif"]),pB=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var zX=()=>{};function P6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var WX=y(()=>{zX()});var UX={};r(UX,{injectPwaTags:()=>rB,generateThemeColorMeta:()=>eB,generateSwRegistrationScript:()=>aB,generatePwaTags:()=>o4,generateManifestLink:()=>tB});function o4($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=P6($),Q=`
|
|
11333
11367
|
<!-- stx PWA Meta Tags -->
|
|
11334
11368
|
<link rel="manifest" href="/manifest.json">
|
|
11335
11369
|
<meta name="theme-color" content="${C6(Y?.themeColor||"#000000")}">
|
|
@@ -11387,79 +11421,79 @@ if ('serviceWorker' in navigator) {
|
|
|
11387
11421
|
});
|
|
11388
11422
|
});
|
|
11389
11423
|
}
|
|
11390
|
-
</script>`}function tB(){return'<link rel="manifest" href="/manifest.json">'}function eB($){return`<meta name="theme-color" content="${C6($)}">`}function C6($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var
|
|
11424
|
+
</script>`}function tB(){return'<link rel="manifest" href="/manifest.json">'}function eB($){return`<meta name="theme-color" content="${C6($)}">`}function C6($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var BX=y(()=>{WX()});import C0 from"path";import{deriveLayoutGroup as $_}from"stx-router/layout-metadata";function _X($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Z_($,Z){let Y=$.length,J=Z,X=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
|
|
11391
11425
|
`,J+2),J===-1)return-1;J+=1,X=!0;continue}if(K==="/"&&$[J+1]==="*"){let q=$.indexOf("*/",J+2);if(q===-1)return-1;J=q+2,X=!0;continue}if(K==="/"&&X){let q=J+1,z=!1;while(q<Y){let W=$[q];if(W==="\\"){q+=2;continue}if(W==="[")z=!0;else if(W==="]")z=!1;else if(W==="/"&&!z){q++;break}else if(W===`
|
|
11392
11426
|
`){q=-1;break}q++}if(q===-1){J++,X=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;J=q,X=!1;continue}if(K==="'"||K==='"'){let q=K;J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]===q){J++;break}if($[J]===`
|
|
11393
|
-
`)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}function s4($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let X=J.index+J[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function jX($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(Y),X=/^<style\b[^>]*>/i.exec(J);if(X){let Q=$.toLowerCase().indexOf("</style>",Y+X[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return Y;Z=Y+1}return-1}function
|
|
11427
|
+
`)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}function s4($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let X=J.index+J[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function jX($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(Y),X=/^<style\b[^>]*>/i.exec(J);if(X){let Q=$.toLowerCase().indexOf("</style>",Y+X[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return Y;Z=Y+1}return-1}function Y_($){let Z=s4($,"data-stx-runtime");if(!Z)return $;let Y=jX($);if(Y===-1||Y===Z.start)return $;let J=$.slice(Z.start,Z.end),X=$.slice(0,Z.start)+$.slice(Z.end),Q=jX(X);if(Q===-1)return J+`
|
|
11394
11428
|
`+X;return X.slice(0,Q)+J+`
|
|
11395
|
-
`+X.slice(Q)}async function H0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!r5()&&!L4())&&Y&&Y.endsWith(".stx"))u3($,Y);try{return await N9.timeAsync("template-processing",async()=>{let G=await
|
|
11396
|
-
`),...z.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...z.htmlAttrs}},...z.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...z.bodyAttrs}}},L=R6(G);if(G=
|
|
11397
|
-
<meta name="stx-layout" content="${
|
|
11398
|
-
<meta name="stx-layout-group" content="${
|
|
11399
|
-
`+W+G.slice(U.end)}}catch{}if(Q)try{let{getComposableScript:K}=await Promise.resolve().then(() => (
|
|
11400
|
-
`+W+G.slice(U.end)}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await $$(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof A4)throw G;let K=G instanceof Error?G.message:String(G),q=new d1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(
|
|
11429
|
+
`+X.slice(Q)}async function H0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!r5()&&!L4())&&Y&&Y.endsWith(".stx"))u3($,Y);try{return await N9.timeAsync("template-processing",async()=>{let G=await J_($,Z,Y,J,X);if(Q)G=I6(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},z=(Z.__stx_runtime_head||null)??d5(),W=(Z.__stx_head_raw||"").trim(),U,B=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)U=B[1].trim(),W=W.replace(B[0],"").trim();let _=Z.__sections?.title,j=z.title||U||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...z.meta||[]],link:[...K.link||[],...z.link||[]],script:[...K.script||[],...z.script||[]],headRaw:[K.headRaw,W].filter(Boolean).join(`
|
|
11430
|
+
`),...z.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...z.htmlAttrs}},...z.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...z.bodyAttrs}}},L=R6(G);if(G=lY(G,H),L)G=pY(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=$_(V);G=G.replace("<head>",`<head>
|
|
11431
|
+
<meta name="stx-layout" content="${_X(V)}">
|
|
11432
|
+
<meta name="stx-layout-group" content="${_X(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(Q)G=mY(G),G=Y_(G);if(Q)try{let{getStoreScript:K}=await Promise.resolve().then(() => (eY(),tY)),q=J.storesDir,z=await K(q);if(z){let W=`<script data-stx-stores>${z}</script>`,U=s4(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
11433
|
+
`+W+G.slice(U.end)}}catch{}if(Q)try{let{getComposableScript:K}=await Promise.resolve().then(() => (YJ(),ZJ)),q=J.composablesDir,z=await K(q);if(z){let W=`<script data-stx-composables>${z}</script>`,U=s4(G,"data-stx-stores")||s4(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
11434
|
+
`+W+G.slice(U.end)}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await $$(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof A4)throw G;let K=G instanceof Error?G.message:String(G),q=new d1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(n0.log(q,{filePath:Y,context:Z}),_3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),J.debug)throw q;return U3.createFallbackContent("Template Processing",q)}}async function J_($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!C0.isAbsolute(J.partialsDir)?C0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!C0.isAbsolute(J.componentsDir)?C0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!C0.isAbsolute(J.layoutsDir)?C0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,q=$;await G_(Y,Z),Q_(Z,K),q=await Q5(()=>DY(q,Z,Y,K),q,(O)=>{n0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let z=j1(q,V$,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=z.output;let W=z.tokens,U=(O)=>W.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>W[Number(w)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=gY(q),q=await nY(q,Y,X);let _={};q=w6(q,_);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",A=C0.dirname(Y),N=K.layoutsDir?C0.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let T=C0.join(A,"_layout.stx");if(await n(T)){w=T;break}let M=C0.dirname(A);if(M===A||M.length<N.length)break;A=M}if(w)H=w;else if(K.layoutsDir){let R=C0.isAbsolute(K.layoutsDir)?K.layoutsDir:C0.resolve(process.cwd(),K.layoutsDir),T=C0.join(R,`${K.defaultLayout}.stx`);if(await n(T))H=T}if(H&&!V)q=`@section('content')
|
|
11401
11435
|
${q.trim()}
|
|
11402
|
-
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,
|
|
11403
|
-
`);
|
|
11404
|
-
${A}`:A,Z.__sections=
|
|
11405
|
-
${q}`,U(q)}catch(O){return
|
|
11406
|
-
`;if(Q=M(Q,Z),Q=I(Q,Z),Q=
|
|
11436
|
+
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return j[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=J0(w.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))j[V]=w.replace("@parent",o1);else j[V]=w.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return j[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=A6(q,_),H){let O=[],V=P5(q),w=j1(V.output,F$,(A,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(q=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,N,R)=>{let T=N==="SCRIPT"?V.scripts[Number(R)]:w.tokens[Number(R)];if(T)O.push(T);return""}),O.length>0){let A=O.join(`
|
|
11437
|
+
`);j.content=j.content?`${j.content}
|
|
11438
|
+
${A}`:A,Z.__sections=j}}if(H)try{let O;if(C0.isAbsolute(H))O=H,X.add(H);else O=await Q5(()=>b7(H,Y,G,X),null,()=>{throw new d1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(n0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new d1(T,Y);return q}let V=await Q5(()=>Bun.file(O).text(),"",()=>{throw new d1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,C,b)=>{return T[C]=b.trim(),""});for(let[k,C]of Object.entries(T))if(j[k]&&j[k].includes(o1)){let b=j[k].indexOf(o1);j[k]=j[k].slice(0,b)+C+j[k].slice(b+o1.length)}else if(!j[k])j[k]=C;let I={...Z,__sections:j},E=`@layout('${w[1]}')${M}`;return await H0(E,I,O,G,X)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=w6(A,_),R={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return R[M]=I.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let E=j[M];if(E.includes(o1)){let k=R[M]||"",C=E.indexOf(o1);E=E.slice(0,C)+k+E.slice(C+o1.length)}return E}return I||""}),N=X_(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=A6(N,_),Z.__originalFilePath=Y,q=await HX(N,Z,O,G,X),q=`<!-- stx-layout: ${H} -->
|
|
11439
|
+
${q}`,U(q)}catch(O){return n0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await HX(q,Z,Y,G,X))}function X_($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,X)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function Q_($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(Y)&&Q!==void 0)J[X]=Q;$.$env=J}async function G_($,Z){await Q5(()=>yY($,Z),void 0,(Y)=>{n0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function K_($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (p5(),I$));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let z=q instanceof Error?q:Error(String(q));n0.log(z,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${z.message}`)}}}async function q_($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await Promise.resolve().then(() => (Z1(),F9));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return n0.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function HX($,Z,Y,J,X){let Q=$,G=J;if(await K_(Q,Z,Y),Q=await q_(Q,Z,Y),Q=await AY(Q,Z,Y),Q=await NY(Q,Z,Y),Q=await L2(Q,Z,Y,G),r1(Q))Q=M7(Q,Z),Q=D7(Q,Z);Q=I7(Q);let{processStreamDirectives:K}=await Promise.resolve().then(() => (d3(),h3));Q=K(Q,Z),Q=O6(Q,Z,Y,G),Q=await u4(Q,Z,Y,G,X),Q=await dY(Q,Z,Y,G,X),Q=i6(Q,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => XJ);Q=q(Q,Z,Y);let{processTeleportDirectives:z}=await Promise.resolve().then(() => GJ);Q=z(Q,Z,Y);let{processTransitionDirectives:W,processTransitionAttributes:U}=await Promise.resolve().then(() => WJ);Q=W(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => BJ);Q=B(Q,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => _J);Q=_(Q,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => LJ);Q=j(Q,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => VJ);Q=H(Q,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (MJ(),TJ));Q=L(Q,Z,Y),Q=F(Q,Z,Y),Q=O(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (dJ(),hJ));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (tJ(),aJ));Q=A(Q,Z,Y),Q=N(Q,Z,Y);let{processFormValidationDirectives:R}=await Promise.resolve().then(() => (JX(),YX));Q=R(Q,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:E}=await Promise.resolve().then(() => (u5(),W7));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let k=T(Q);if(Q=k.content,k.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${k.headContent}
|
|
11440
|
+
`;if(Q=M(Q,Z),Q=I(Q,Z),Q=bY(Q),Q=I3(Q,Z),Q=H2(Q),Q=MY(Q),Q=await V6(Q,Z,Y,G,X),Q=await u4(Q,Z,Y,G,X),Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=I6(Q),Q=p1(Q,Z,Y),Q=D3(Q,Z),Q=E3(Q,Z),Q=y4(Q,Z),Q=N2(Q,Z),Q=R2(Q,Z),Q=await X2(Q,Z,Y,G),Q=await _8(Q,Z,Y),Q=await E2(Q,Z,Y,G),Q=h6(Q,Z,Y,G),Q=AZ(Q,Z,Y,G),Q=NZ(Q,Z,Y),Q=RZ(Q,Z,Y,G),Q=B2(Q,Z,Y,G),Q=T6(Q,Z),Q=M6(Q),Q=sY(Q),!G.skipEventDirectives)Q=aZ(Q,Z,Y);if(Q=Y2(Q,Z,Y),G.debug){let a=/\bx-data\s*=/.test(Q),e=m$($);if(a&&e)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
11407
11441
|
Both work on the same page, but they manage separate scopes.
|
|
11408
|
-
Prefer signals (state/derived/effect) for new components.`)}Q=
|
|
11442
|
+
Prefer signals (state/derived/effect) for new components.`)}Q=vY(Q,Z),Q=await H1(Q,Z,Y),Q=rY(Q),Q=aY(Q),Q=mZ(Q);let{processXElementDirectives:C}=await Promise.resolve().then(() => GX);Q=C(Q);let b=Z.__originalFilePath||Y,D=b5(Z);if(Q=await E7(Q,G,b,D),Q=await EY(Q,Z,Y,G),G.media?.image?.autoSiblings){let a=G.publicDir||"public",{rewriteImagesWithSiblings:e}=await Promise.resolve().then(() => (qX(),KX));Q=await e(Q,{publicDir:a})}if(G.seo?.enabled)Q=TZ(Q,Z,G);let P=(a,e)=>{if(!e)return a;if(/<\/head>/i.test(a))return a.replace(/<\/head>/i,`${e}
|
|
11409
11443
|
</head>`);if(/<head\b[^>]*>/i.test(a))return a.replace(/(<head\b[^>]*>)/i,`$1
|
|
11410
11444
|
${e}`);if(/<html\b[^>]*>/i.test(a))return a.replace(/(<html\b[^>]*>)/i,`$1
|
|
11411
11445
|
<head>
|
|
11412
11446
|
${e}
|
|
11413
|
-
</head>`);return a},{renderHead:f,getHead:g}=await Promise.resolve().then(() => (u5(),W7)),d=Z.__stx_runtime_head,
|
|
11447
|
+
</head>`);return a},{renderHead:f,getHead:g}=await Promise.resolve().then(() => (u5(),W7)),d=Z.__stx_runtime_head,i=d&&(d.title||d.meta?.length||d.link?.length)?d:g();if(i.title||i.meta?.length||i.link?.length){let a=f(i);if(a)Q=P(Q,a)}if(k.headContent)Q=P(Q,k.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)Q=U2(Q,G.csp,Z);if(G.analytics?.enabled)Q=lZ(Q,G);if(G.heatmap?.enabled)Q=a6(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:a}=await Promise.resolve().then(() => (BX(),UX));Q=a(Q,G)}let m=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),z0=/\bSTX\.\w+/.test(Q),F0=/window\.STX\s*=/.test(Q);if(m&&z0&&!F0){let e=`<script data-stx-scoped>
|
|
11414
11448
|
${gZ()}
|
|
11415
11449
|
</script>`;if(Q.includes("</head>")){let u=Q.indexOf("</head>"),v=Q.slice(0,u).indexOf("<script");if(v!==-1){let x=Q.slice(0,v),p=Q.slice(v);Q=x+e+`
|
|
11416
11450
|
`+p}else Q=Q.replace("</head>",`${e}
|
|
11417
11451
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
11418
11452
|
${e}`);else Q=e+`
|
|
11419
|
-
`+Q}{let{scanScriptTags:a}=await Promise.resolve().then(() => (n5(),p$)),e=[];for(let u of a(Q)){if(!/\bserver\b/i.test(u.attrs))continue;let S=u.start+u.fullMatch.indexOf(">")+1,v=
|
|
11453
|
+
`+Q}{let{scanScriptTags:a}=await Promise.resolve().then(() => (n5(),p$)),e=[];for(let u of a(Q)){if(!/\bserver\b/i.test(u.attrs))continue;let S=u.start+u.fullMatch.indexOf(">")+1,v=Z_(Q,S);if(v===-1)continue;let x=v+9;while(x<Q.length&&/\s/.test(Q[x]))x++;e.push({start:u.start,end:x})}for(let u=e.length-1;u>=0;u--){let{start:S,end:v}=e[u];Q=Q.substring(0,S)+Q.substring(v)}}let _0=N$(Q,Y);if(_0.hasScoped)Q=_0.html;let Y0=Z.__stx_event_bindings||[],I0=!1,p0=[],X1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:a0}=await Promise.resolve().then(() => (n5(),p$));for(let a of a0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))p0.push({match:a.fullMatch,attrs:a.attrs,content:a.body});for(let{match:a,attrs:e,content:u}of p0){I0=!0;let S=u;E6(u,Y,J.strict);let v=await S5(u,{eventBindings:Y0,attrs:e,hasColonDirectives:X1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:D});Q=Q.replace(a,()=>v)}if(I0)Z.__stx_event_bindings=[];return Q}var o1="<!--PARENT_CONTENT_PLACEHOLDER-->";var i$=y(()=>{I4();C5();t4();hZ();pZ();cZ();Z7();e4();tZ();y5();J2();Q2();k4();_2();O2();V2();q1();u5();Z1();T2();k2();wY();TY();L6();S7();kY();$5();SY();j3();N0();PY();xY();hY();uY();q7();n5();H6();oY();D6();k6();T0();m3();D6();k6()});import L0 from"fs";import Q0 from"path";import{matchRoute as S_,Router as yX}from"stx-router";import{findErrorPage as C_,formatRoutes as v_,generateRouteManifest as x_,generateRouteTypes as f_,matchRoute as g_}from"stx-router";function a4($,Z={}){return new yX($,Z).routes}i$();import{createHash as z_}from"crypto";function W_($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var U_=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function B_($){return Bun.hash($).toString(16)}function OX($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(U_,(Q,G,K,q)=>{let z=q.trim();if(!z)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)z=W_(z);let W=B_(z);if(!Y.has(W))Y.set(W,z);let U=Z.integrity?` data-stx-integrity="sha384-${z_("sha384").update(z).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${W}.js"${U}${K}></script>`}),X=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:J,chunks:X}}var __=new Set(["visible","idle"]);function LX($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Y.exec($))!==null)Z.set(J[1],J[2]);let X=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(__.has(Z.get(G[1])||""))X.add(G[2]);let K=$.lastIndexOf("</head>");if(X.size===0||K===-1)return $;let q=Array.from(X).filter((z)=>!$.includes(`rel="prefetch" href="${z}"`)).map((z)=>`<link rel="prefetch" href="${z}" as="script">`).join("");if(!q)return $;return $.slice(0,K)+q+$.slice(K)}m1();M5();I4();import{abortNavigation as $N,clearMiddleware as FX,createClientCookieManager as ZN,createMiddlewareContext as VX,createRouteLocation as wX,createServerCookieManager as YN,createStorageManager as JN,defineMiddleware as XN,getMiddleware as QN,getMiddlewareNames as AX,hasMiddleware as GN,loadMiddlewareFromDirectory as NX,navigateTo as KN,registerMiddleware as qN,runMiddleware as RX}from"stx-router";class TX{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=Q0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,J]of Object.entries(Z))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await L0.promises.mkdir(this.cacheDir,{recursive:!0});let $=Q0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,J]of this.cache)Z[Y]=J;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=L0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(L0.existsSync(Q)){let G=L0.statSync(Q);J+=`:${Q}:${G.mtimeMs}`}let X=0;for(let Q=0;Q<J.length;Q++){let G=J.charCodeAt(Q);X=(X<<5)-X+G,X=X&X}return Math.abs(X).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let J=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==J)return this.cache.delete($),null;return Y.html}set($,Z,Y,J){let X=this.getHash(Z,Y);this.cache.set($,{hash:X,html:J,generatedAt:Date.now(),dependencies:Y})}}class MX{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return Q0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await L0.promises.mkdir(Q0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await L0.promises.unlink(Z)}async invalidatePattern($){let Z=Q0.join(this.cacheDir,"isr");if(!L0.existsSync(Z))return;let Y=await L0.promises.readdir(Z);for(let J of Y){let X=J.replace(/_/g,"/").replace(".json","");if($.test(X))await L0.promises.unlink(Q0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function j_($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticPaths"))return null;let X=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!X)return null;return await Function(`
|
|
11420
11454
|
return (async function getStaticPaths() {
|
|
11421
11455
|
${X[1]}
|
|
11422
11456
|
})()
|
|
11423
|
-
`)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function
|
|
11457
|
+
`)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function H_($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let Y=await j_($.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let J of Y.paths){let X=$.pattern;for(let[Q,G]of Object.entries(J.params))X=X.replace(`:${Q}`,G).replace(`:${Q}*`,G);Z.push({url:X,params:J.params,props:J.props,revalidate:J.revalidate})}}return Z}async function O_($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Y of Z)if(await Bun.file(Y).exists())try{let J=await import(Y);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:X,...Q}=J;return Q}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function L_($,Z,Y){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let X=J[1];if(!X.includes("getStaticProps"))return null;try{let Q=X.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!Q)return null;return await Function("params",`
|
|
11424
11458
|
return (async function getStaticProps() {
|
|
11425
11459
|
${Q[1]}
|
|
11426
11460
|
})()
|
|
11427
|
-
`)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${Y}:`,Q),null}}async function
|
|
11461
|
+
`)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${Y}:`,Q),null}}async function IX($,Z,Y={},J,X){let Q=await Bun.file($.filePath).text(),G=await O_($.filePath),K=await L_(Q,Z,$.filePath),q={...G||{},...K||{},...Y,params:Z,$route:{path:$.pattern,params:Z}},z=new Set,W={...X,debug:!1,cache:!1,autoShell:!0},U=await H0(Q,q,$.filePath,W,z);if(Object.keys(Z).length>0){let B=`<script>if(window.stx)window.stx._rp=${JSON.stringify(Z)};else window.__stx_rp=${JSON.stringify(Z)};</script>`;if(U.includes("</head>"))U=U.replace("</head>",`${B}
|
|
11428
11462
|
</head>`);else U=`${B}
|
|
11429
|
-
${U}`}if(U=await R7(U),U=await $$(U),J.minify!==!1)return{html:
|
|
11463
|
+
${U}`}if(U=await R7(U),U=await $$(U),J.minify!==!1)return{html:F_(U),dependencies:Array.from(z)};return{html:U,dependencies:Array.from(z)}}function F_($){let Z=[],Y=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,X;while((X=J.exec($))!==null){let G=$.slice(Y,X.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=X[1],q=X[2],z=X[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+q+z),Y=X.index+X[0].length}let Q=$.slice(Y);return Z.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function V_($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function w_($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
11430
11464
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
11431
11465
|
${$.map((J)=>{let X=new URL(J.loc,Z).href,Q=` <url>
|
|
11432
|
-
<loc>${
|
|
11466
|
+
<loc>${r0(X)}</loc>`;if(J.lastmod)Q+=`
|
|
11433
11467
|
<lastmod>${J.lastmod}</lastmod>`;if(J.changefreq)Q+=`
|
|
11434
11468
|
<changefreq>${J.changefreq}</changefreq>`;if(J.priority!==void 0)Q+=`
|
|
11435
11469
|
<priority>${J.priority}</priority>`;return Q+=`
|
|
11436
11470
|
</url>`,Q}).join(`
|
|
11437
11471
|
`)}
|
|
11438
|
-
</urlset>`}function
|
|
11439
|
-
<title>${
|
|
11440
|
-
<link>${
|
|
11441
|
-
<description>${
|
|
11472
|
+
</urlset>`}function r0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function A_($,Z){let Y=Z.map((J)=>{let X=" <item>";if(X+=`
|
|
11473
|
+
<title>${r0(J.title)}</title>`,X+=`
|
|
11474
|
+
<link>${r0(J.link)}</link>`,J.description)X+=`
|
|
11475
|
+
<description>${r0(J.description)}</description>`;if(J.pubDate)X+=`
|
|
11442
11476
|
<pubDate>${J.pubDate.toUTCString()}</pubDate>`;if(J.author)X+=`
|
|
11443
|
-
<author>${
|
|
11444
|
-
<category>${
|
|
11445
|
-
<guid>${
|
|
11477
|
+
<author>${r0(J.author)}</author>`;if(J.categories)for(let Q of J.categories)X+=`
|
|
11478
|
+
<category>${r0(Q)}</category>`;if(J.guid)X+=`
|
|
11479
|
+
<guid>${r0(J.guid)}</guid>`;return X+=`
|
|
11446
11480
|
</item>`,X});return`<?xml version="1.0" encoding="UTF-8"?>
|
|
11447
11481
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
|
11448
11482
|
<channel>
|
|
11449
|
-
<title>${
|
|
11450
|
-
<link>${
|
|
11451
|
-
<description>${
|
|
11483
|
+
<title>${r0($.title)}</title>
|
|
11484
|
+
<link>${r0($.link)}</link>
|
|
11485
|
+
<description>${r0($.description)}</description>
|
|
11452
11486
|
${$.language?`<language>${$.language}</language>`:""}
|
|
11453
|
-
${$.copyright?`<copyright>${
|
|
11487
|
+
${$.copyright?`<copyright>${r0($.copyright)}</copyright>`:""}
|
|
11454
11488
|
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
|
|
11455
11489
|
<atom:link href="${$.link}/rss.xml" rel="self" type="application/rss+xml"/>
|
|
11456
11490
|
${Y.join(`
|
|
11457
11491
|
`)}
|
|
11458
11492
|
</channel>
|
|
11459
|
-
</rss>`}async function
|
|
11493
|
+
</rss>`}async function N_($={}){let Z=Date.now(),Y=await z1(),J={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||B1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},X={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,G=0,K={},q={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&L0.existsSync(J.outputDir))await L0.promises.rm(J.outputDir,{recursive:!0});await L0.promises.mkdir(J.outputDir,{recursive:!0});let W=new TX(J.cacheDir);if(J.cache)await W.load();try{let{preloadIconCollection:V}=await Promise.resolve().then(() => (f4(),o2));await V("lucide")}catch{}try{let{generateCrosswindCSS:V}=await Promise.resolve().then(() => (I4(),fZ));await V('<div class="bg-black"></div>')}catch{}FX();let U=Y?.routeMiddleware?.dir||"middleware";await NX(process.cwd(),U);let B=AX();if(B.length>0)console.log(`Loaded ${B.length} middleware: ${B.join(", ")}`);let _=Y?.routeMiddleware?.global||[],j=a4(".",{pagesDir:J.pagesDir});console.log(`Found ${j.length} routes`);let H=[];for(let V of j){let w=await H_(V);for(let A of w)H.push({route:V,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??J.revalidate})}X.totalPages=H.length,console.log(`Generating ${X.totalPages} pages...`);let L=[],F=[];for(let V=0;V<H.length;V+=J.concurrency)F.push(H.slice(V,V+J.concurrency));for(let V of F)await Promise.all(V.map(async(w)=>{let{route:A,url:N,params:R,props:T,revalidate:M}=w;try{await J.hooks.onPageStart?.(N);let I=await Bun.file(A.filePath).text(),E=I_(I),k=E?.middleware?Array.isArray(E.middleware)?E.middleware:[E.middleware]:[],C=[..._,...k];if(C.length>0){let d=wX(N,R,E||{}),i=VX(d,null),m=await RX(C,i);if(m.redirect){let z0=typeof m.redirect==="string"?m.redirect:m.redirect.path||m.redirect,F0=D_(String(z0),N),_0=E_(N,J);await L0.promises.mkdir(Q0.dirname(_0),{recursive:!0}),await Bun.write(_0,F0),X.successCount++,X.pages.push({route:N,outputPath:_0,size:Buffer.byteLength(F0),cached:!1}),L.push({loc:N,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${N} \u2192 redirect to ${z0}`);return}if(m.abort){let z0=typeof m.abort==="string"?m.abort:m.abort?.error?.message||"aborted";console.warn(` \u21B3 ${N} \u2014 middleware aborted: ${z0}`);return}}let b=I.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(b)try{if(!await Function("route",`
|
|
11460
11494
|
const validate = ${b[1]};
|
|
11461
11495
|
return validate(route);
|
|
11462
|
-
`)({params:R})){console.warn(`Validation failed for ${N}, skipping...`);return}}catch{}let D=null,P=!1;if(J.cache){if(D=W.get(N,A.filePath),D)P=!0,X.cachedCount++}if(!D){let d=await
|
|
11496
|
+
`)({params:R})){console.warn(`Validation failed for ${N}, skipping...`);return}}catch{}let D=null,P=!1;if(J.cache){if(D=W.get(N,A.filePath),D)P=!0,X.cachedCount++}if(!D){let d=await IX(A,R,T,J,Y);if(D=d.html,J.cache)W.set(N,A.filePath,d.dependencies,D)}let f;if(J.trailingSlash)f=Q0.join(J.outputDir,N,"index.html");else f=N==="/"?Q0.join(J.outputDir,"index.html"):Q0.join(J.outputDir,`${N}.html`);if(J.chunkIslands){let{html:d,chunks:i}=OX(D,{integrity:J.integrityIslands,minify:J.minify});if(i.length>0){let m=Q0.join(J.outputDir,"_stx","islands");await L0.promises.mkdir(m,{recursive:!0});for(let z0 of i){let F0=Q0.join(m,`${z0.hash}.js`);if(!await Bun.file(F0).exists())await Bun.write(F0,z0.code);if(!Q.has(z0.hash)){Q.add(z0.hash);let _0=Buffer.byteLength(z0.code,"utf8");G+=_0,K[z0.hash]={bytes:_0,file:`/_stx/islands/${z0.hash}.js`}}}if(q[N]=i.map((z0)=>z0.hash),D=d,J.prefetchIslands)D=LX(D)}}await L0.promises.mkdir(Q0.dirname(f),{recursive:!0}),await Bun.write(f,D),L.push({loc:N,lastmod:new Date().toISOString().split("T")[0],priority:N==="/"?1:0.8});let g={route:N,outputPath:f,size:Buffer.byteLength(D,"utf8"),cached:P};if(M!==!1)g.revalidateAt=Date.now()+M*1000;X.pages.push(g),X.successCount++,await J.hooks.onPageEnd?.(N,D)}catch(I){X.failedCount++,X.errors.push({route:N,error:I}),await J.hooks.onError?.(I,N),console.error(`Error generating ${N}:`,I)}}));if(J.cache)await W.save();if(J.generate404){let V=Q0.join(J.pagesDir,"404.stx");if(await Bun.file(V).exists()){let w=new Set,A={...Y,debug:!1,cache:!1},N=await H0(await Bun.file(V).text(),{},V,A,w);await Bun.write(Q0.join(J.outputDir,"404.html"),N)}else await Bun.write(Q0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
|
|
11463
11497
|
<html lang="en">
|
|
11464
11498
|
<head>
|
|
11465
11499
|
<meta charset="UTF-8">
|
|
@@ -11480,7 +11514,7 @@ ${Y.join(`
|
|
|
11480
11514
|
<a href="/">Go home</a>
|
|
11481
11515
|
</div>
|
|
11482
11516
|
</body>
|
|
11483
|
-
</html>`)}for(let
|
|
11517
|
+
</html>`)}for(let V of[500]){let w=Q0.join(J.pagesDir,`${V}.stx`);if(await Bun.file(w).exists()){let A=new Set,N={...Y,debug:!1,cache:!1},R=await H0(await Bun.file(w).text(),{},w,N,A);await Bun.write(Q0.join(J.outputDir,`${V}.html`),R)}}let O=Q0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let V=new Set,w={...Y,debug:!1,cache:!1},A=await H0(await Bun.file(O).text(),{},O,w,V);await Bun.write(Q0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let V=w_(L,J.domain),w=Q0.join(J.outputDir,"sitemap.xml");await Bun.write(w,V),X.sitemapPath=w,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.rss){let V=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},w=[];if(V.getItems)w=await V.getItems();let A=A_(V,w),N=Q0.join(J.outputDir,"rss.xml");await Bun.write(N,A),X.rssPath=N,console.log(`Generated rss.xml with ${w.length} items`)}if(J.publicDir&&L0.existsSync(J.publicDir))await DX(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(W){throw await J.hooks.onError?.(W),W}if(X.buildTime=Date.now()-Z,Q.size>0){X.islandChunks={count:Q.size,totalBytes:G};let W={generatedChunks:Q.size,totalBytes:G,chunks:K,pages:q};await Bun.write(Q0.join(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(W,null,2))}await J.hooks.onBuildEnd?.(X);let z=X.islandChunks?`
|
|
11484
11518
|
Island chunks: ${X.islandChunks.count} (${(X.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
|
|
11485
11519
|
Build complete!
|
|
11486
11520
|
Total: ${X.totalPages} pages
|
|
@@ -11488,8 +11522,8 @@ Build complete!
|
|
|
11488
11522
|
Cached: ${X.cachedCount}
|
|
11489
11523
|
Failed: ${X.failedCount}
|
|
11490
11524
|
Time: ${X.buildTime}ms${z}
|
|
11491
|
-
`),X}async function
|
|
11492
|
-
`)){let U=W.indexOf(":");if(U>0){let B=W.slice(0,U).trim(),
|
|
11525
|
+
`),X}async function DX($,Z){let Y=await L0.promises.readdir($,{withFileTypes:!0});for(let J of Y){let X=Q0.join($,J.name),Q=Q0.join(Z,J.name);if(J.isDirectory())await L0.promises.mkdir(Q,{recursive:!0}),await DX(X,Q);else await L0.promises.copyFile(X,Q)}}function R_($={}){let Z=$.cacheDir||B1(process.cwd(),"ssg-cache"),Y=new MX(Z),J=$.revalidate||3600;return{async get(X){let Q=await Y.get(X);if(!Q)return null;if(Date.now()>Q.revalidateAfter)this.revalidate(X).catch(console.error);return{html:Q.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(X){let G=a4(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return X.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${X}`);return}let K=X.match(G.regex),q={};if(K)G.params.forEach((U,B)=>{q[U]=K[B+1]});let z=await z1(),{html:W}=await IX(G,q,{},$,z);await Y.set(X,{html:W,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:V_(W)}),console.log(`Revalidated: ${X}`)},async invalidate(X){if(typeof X==="string")await Y.invalidate(X);else await Y.invalidatePattern(X)}}}function T_($){return async()=>{return{paths:await $(),fallback:!1}}}function M_(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),J={},X=Z;if(Y){let z=Y[1];X=Z.slice(Y[0].length).trim();for(let W of z.split(`
|
|
11526
|
+
`)){let U=W.indexOf(":");if(U>0){let B=W.slice(0,U).trim(),_=W.slice(U+1).trim();if(_==="true")_=!0;else if(_==="false")_=!1;else if(/^\d+$/.test(_))_=parseInt(_,10);else if(/^\d+\.\d+$/.test(_))_=parseFloat(_);else if(_.startsWith("[")&&_.endsWith("]"))_=_.slice(1,-1).split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,""));J[B]=_}}}let Q=X.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),G=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=K.exec(Q))!==null){let z=parseInt(q[1],10),W=q[2],U=W.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:W,level:z})}return{content:Q,data:J,toc:G}}}}function I_($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function D_($,Z){return`<!DOCTYPE html>
|
|
11493
11527
|
<html>
|
|
11494
11528
|
<head>
|
|
11495
11529
|
<meta charset="utf-8">
|
|
@@ -11501,4 +11535,4 @@ Build complete!
|
|
|
11501
11535
|
<p>Redirecting to <a href="${$}">${$}</a>...</p>
|
|
11502
11536
|
<script>window.location.replace('${$}')</script>
|
|
11503
11537
|
</body>
|
|
11504
|
-
</html>`}function
|
|
11538
|
+
</html>`}function E_($,Z){if($==="/"||$==="")return Q0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return Q0.join(Z.outputDir,Y,"index.html");return Q0.join(Z.outputDir,`${Y}.html`)}var FN={generateStaticSite:N_,createISRHandler:R_,defineStaticPaths:T_,createMarkdownLoader:M_};export{N_ as generateStaticSite,T_ as defineStaticPaths,FN as default,M_ as createMarkdownLoader,R_ as createISRHandler};
|