@stacksjs/stx 0.2.120 → 0.2.121
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 +495 -516
- package/dist/client-script-bundler.d.ts +13 -0
- package/dist/client-script-bundler.js +19 -2
- package/dist/component-library.js +30 -12
- package/dist/craft.js +12302 -120
- package/dist/native-build.d.ts +6 -0
- package/dist/native-build.js +77 -60
- package/dist/pwa.js +337 -336
- package/dist/render.js +6 -1
- package/dist/signals.js +2 -1
- package/dist/ssg.js +278 -277
- package/package.json +5 -5
package/dist/ssg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var mX=Object.defineProperty;var pX=($)=>$;function lX($,Z){this[$]=pX.bind(null,Z)}var e=($,Z)=>{for(var Y in Z)mX($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:lX.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var U0=import.meta.require;import T5 from"path";function p6($){m6=$?.trim()||null}function M5(){return process.env[iX]?.trim()||m6||r1}function B1($=process.cwd(),...Z){let Y=M5();return T5.isAbsolute(Y)?T5.join(Y,...Z):T5.join($,Y,...Z)}function I5($){if(!$||T5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==r1&&!Z.startsWith(`${r1}/`))return $;let Y=Z.slice(r1.length+1);return Y?T5.join(M5(),Y):M5()}var r1=".stx",iX="STX_DIR",m6=null;var D5=()=>{};var O0;var l6=b(()=>{O0={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 c6($,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 i6,n6;var $7=b(()=>{i6={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},n6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function nX($,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 dX=Object.defineProperty;var uX=($)=>$;function mX($,Z){this[$]=uX.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 oX(){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 sX($){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 rX($=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 aX(){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 tX($,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 t6($,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 K1,o6,s6,r6,a6;var Z7=b(()=>{K1={duration:300,delay:0,ease:"ease",direction:"both"};o6={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=
|
|
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"},s6={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"},r6={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"},a6={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=
|
|
235
|
+
`}function t6($,Z,Y,J){let X=$;if(J.animation?.enabled===!1)return X;let Q=Y.includes("test")&&Y.includes("animation");if(!sX(X)&&!Q)return X;if(!X.includes('<style id="stx-animation-base">')){let K=aX();X=X.replace("</head>",`${K}
|
|
236
|
+
</head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let q=rX(),z=X.lastIndexOf("</body>");if(z!==-1)X=X.slice(0,z)+q+`
|
|
237
|
+
`+X.slice(z)}}return X}var K1,o6,s6,r6,a6;var Z7=b(()=>{K1={duration:300,delay:0,ease:"ease",direction:"both"};o6={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=nX(X,{duration:Q,delay:K,ease:G,direction:q}),U="stx-transition",j="";if(X==="fade")j="stx-fade";else if(X==="slide")j="stx-slide";else if(X==="scale")j="stx-scale";else if(X==="flip")j="stx-flip";else if(X==="rotate")j="stx-rotate";return`<div id="${z}" class="${U} ${j} ${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"},s6={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"},r6={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=tX(X,Q,{staggerDelay:G,sequence:K});return`${$}
|
|
239
|
+
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},a6={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=oX();return`<div data-animate="${X?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as e6}from"stx-router";var $9=b(()=>{Y7()});async function eX($,Z,Y,J){let X=Z[0]?.replace(/['"]/g,"")||"main",Q=e6();if(X!=="main")Q=Q.replace("container:'main'",`container:'${X}'`);return`<script data-stx-router>${Q}</script>`}var Z9;var Y7=b(()=>{$9();Z9={name:"stxRouter",handler:eX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function Y9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...$Q,...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 J9($,Z){let Y=Y9(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 E5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,
|
|
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,
|
|
625
|
-
`).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${
|
|
622
|
+
`}function J9($,Z){let Y=Y9(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function ZQ($){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 $Q,X9;var J7=b(()=>{$Q={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};X9={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=ZQ(Z.join(" "));X.heatmap={...X.heatmap,...Q,enabled:!0}}return Y9(X)}}});function _1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Q9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function G9($){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 E5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,j)=>{let B=Q.length,_=U?` class="language-${_1(U)}"`:"";return Q.push(`<pre><code${_}>${_1(j.trim())}</code></pre>`),`\x00CODEBLOCK${B}\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,j)=>{return`<img src="${Q9(j)?_1(j):""}" alt="${_1(U)}" />`}),X=X.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,U,j)=>{return`<a href="${Q9(j)?_1(j):""}">${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,j)=>{let _=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${_1(L)}</th>`).join("")}</tr>`,H=j.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
|
+
${_}
|
|
629
629
|
</thead>
|
|
630
630
|
<tbody>
|
|
631
631
|
${H}
|
|
@@ -639,8 +639,8 @@ ${H}
|
|
|
639
639
|
`),J)X=X.replace(/\n/g,`<br />
|
|
640
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 o0($){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 { ${
|
|
642
|
+
`}),$}import YQ from"process";function p0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(YQ.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 b1=()=>{};var k5={};e(k5,{queueClientBundleBuild:()=>W9,hasUserImports:()=>XQ,bundleClientScript:()=>GQ});import F0 from"path";import C0 from"fs";function XQ($){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(!K9.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(!K9.some((G)=>G.test(X)))return console.log("[stx:bundler] detected side-effect import:",X),!0}return!1}function QQ($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:F0.dirname(Q),q=F0.resolve(K,G),z=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,F0.join(q,"index.ts"),F0.join(q,"index.tsx"),F0.join(q,"index.js"),F0.join(q,"index.mjs")];for(let W of z)try{if(C0.existsSync(W)&&C0.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(C0.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=F0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,F0.join(K,"index.ts"),F0.join(K,"index.tsx"),F0.join(K,"index.js"),F0.join(K,"index.mjs")];for(let z of q)if(C0.existsSync(z)&&C0.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}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=F0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";return J.add(G.path),{contents:C0.readFileSync(G.path,"utf8"),loader:q}})}}}function W9($){let Z=globalThis,J=(Z[q9]??Promise.resolve()).then($,$);return Z[q9]=J.then(()=>{return},()=>{return}),J}async function GQ($,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(`${JQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=F0.join(Q,`${K}.js`),z=F0.join(Q,`${K}.deps.json`),W=Bun.file(q);if(await W.exists()){let B=Bun.file(z),_=!0;if(await B.exists())try{let H=JSON.parse(await B.text());if(H.metadataVersion!==z9||!Array.isArray(H.files))_=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(C0.statSync(L.path).mtimeMs!==L.mtimeMs){_=!1;break}}catch{_=!1;break}}catch{_=!1}if(_)return console.log("[stx:bundler] cache hit:",K),await W.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=X7.get(K);if(U)return await U;let j=W9(()=>KQ($,Z,{projectRoot:J,minify:X,cacheDir:Q,hash:K,cachePath:q,depsPath:z}));X7.set(K,j);try{return await j}finally{X7.delete(K)}}async function KQ($,Z,Y){let{projectRoot:J,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:q}=Y,z=B1(J,"bundle-tmp"),W=F0.join(z,`${G}.ts`),U=F0.join(z,"out",G);C0.mkdirSync(z,{recursive:!0}),C0.mkdirSync(U,{recursive:!0});let j=F0.dirname(Z),B=[],_=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=_.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((F)=>{let w=F.split(":")[0].trim();if(w)B.push(w)});else if(L[3])B.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;B.push(L[2])}let V=B.length>0?`
|
|
643
|
+
export { ${B.join(", ")} }`:"";await Bun.write(W,$+V),console.log("[stx:bundler] bundling:",G,"from:",F0.basename(Z));let O=new Set;try{let F=await Bun.build({entrypoints:[W],outdir:U,target:"browser",format:"esm",minify:X,plugins:[QQ(J,j,W,O)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...p0()},root:J});if(!F.success){let D=F.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of F.outputs){w=await D.text();break}let A=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let k=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(k))A.push([k,k])}let R=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${G}`,T=A.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),M=A.map(([D])=>`var ${D} = undefined;`).join(`
|
|
644
644
|
`),I=A.map(([D])=>`${D} = ${N}[${JSON.stringify(D)}];`).join(`
|
|
645
645
|
`);if(w=`${R.join(`
|
|
646
646
|
`)}
|
|
@@ -649,19 +649,19 @@ var ${N} = (function() {
|
|
|
649
649
|
${w}
|
|
650
650
|
return { ${T} };
|
|
651
651
|
})();
|
|
652
|
-
${I}`.trim(),console.log("[stx:bundler] bundled:",G,"output:",w.length,"bytes"),
|
|
652
|
+
${I}`.trim(),console.log("[stx:bundler] bundled:",G,"output:",w.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${F0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;C0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let E=Array.from(O).map((D)=>{try{return{path:D,mtimeMs:C0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(q,JSON.stringify({metadataVersion:z9,files:E})),w}catch(F){let w=F instanceof Error?F.message:String(F),A=F?.errors,R=Array.isArray(A)&&A.length>0?`
|
|
653
653
|
${A.map((N)=>`- ${N?.message??N}`).join(`
|
|
654
|
-
`)}`:"";return console.warn(`[stx:bundler] error: ${w}${R}`),$}finally{try{
|
|
654
|
+
`)}`:"";return console.warn(`[stx:bundler] error: ${w}${R}`),$}finally{try{C0.rmSync(W,{force:!0}),C0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var JQ=5,z9=1,K9,X7,q9;var b5=b(()=>{b1();D5();K9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];X7=new Map,q9=Symbol.for("stx.client-bundle-build-queue")});var H9={};e(H9,{renderVendorStyleTags:()=>O$,processClientScript:()=>P5,injectBrowserCoreAutoImports:()=>a1,generateServerDataBridge:()=>L$,generateBrowserAutoImportDestructuring:()=>LQ,generateAutoImportDestructuring:()=>Q7,extractBridgeData:()=>y5,extractAndStripCssImports:()=>H$});import S1 from"path";import S5 from"fs";function zQ($){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 WQ($,Z){let Y=Z;while(!0){let J=S1.join(Y,"node_modules",$,"package.json");if(S5.existsSync(J))return S1.dirname(J);let X=S1.dirname(Y);if(X===Y)return null;Y=X}}function UQ($,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 jQ($,Z){let Y=zQ($);if(!Y||!Y.subpath)return null;let J=WQ(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(S5.readFileSync(S1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=UQ(X.exports,Q);if(!G)return null;let K=S1.resolve(J,G);return S5.existsSync(K)?K:null}function H$($,Z){let Y=Z.filePath?S1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(qQ,(K,q)=>{let z;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(z=q.startsWith("/")?q:S1.resolve(Y,q),!S5.existsSync(z))throw Error(`file not found: ${z}`)}else{let W=null;try{W=Bun.resolveSync(q,J)}catch{W=jQ(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=S5.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 BQ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function O$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${BQ(Z.source)}" data-stx-layer="vendor">
|
|
655
655
|
@layer vendor {
|
|
656
656
|
${Z.contents}
|
|
657
657
|
}
|
|
658
658
|
</style>`}).join(`
|
|
659
659
|
`)}
|
|
660
|
-
`}function a1($){let Z=new Set;for(let X of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Q of X[1].split(",")){let G=Q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(G)Z.add(G)}let Y=new Set;for(let X of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(X[1]);for(let X of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Q of X[1].split(",")){let G=Q.trim().split(/[:=]/).pop()?.trim();if(G)Y.add(G)}let J=
|
|
661
|
-
${$}`,imports:J}}function
|
|
660
|
+
`}function a1($){let Z=new Set;for(let X of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Q of X[1].split(",")){let G=Q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(G)Z.add(G)}let Y=new Set;for(let X of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(X[1]);for(let X of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Q of X[1].split(",")){let G=Q.trim().split(/[:=]/).pop()?.trim();if(G)Y.add(G)}let J=B9.filter((X)=>{if(Z.has(X)||Y.has(X))return!1;return new RegExp(`\\b${X}\\b`).test($)});if(J.length===0)return{code:$,imports:J};return{code:`import { ${J.join(", ")} } from '@stacksjs/browser'
|
|
661
|
+
${$}`,imports:J}}function OQ($){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(!HQ.has(J[1]))Z.add(J[1]);return Array.from(Z)}function _9($){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 B9){if(X.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let K=OQ(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 Q7($,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
|
|
662
662
|
${Y.join(`
|
|
663
663
|
`)}
|
|
664
|
-
${
|
|
664
|
+
${FQ($,Z)}`;return""}function LQ($,Z=[]){let{browserImports:Y}=_9($),J=new Set(Z);return Q7([],Y.filter((X)=>!J.has(X)))}function FQ($,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
|
|
665
665
|
[${Y.join(", ")}].forEach(function (e) {
|
|
666
666
|
if (e[1] !== 'undefined') return;
|
|
667
667
|
console.error(
|
|
@@ -670,18 +670,18 @@ ${OQ($,Z)}`;return""}function HQ($,Z=[]){let{browserImports:Y}=B9($),J=new Set(Z
|
|
|
670
670
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
671
671
|
);
|
|
672
672
|
});
|
|
673
|
-
`}function y5($){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
|
|
673
|
+
`}function y5($){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 U9($,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 VQ($,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(U9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(U9(Y[1],!1).has(Z))return!0;return!1}function L$($,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(VQ($,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)
|
|
674
674
|
${Y.join(`
|
|
675
675
|
`)}
|
|
676
|
-
`}function
|
|
676
|
+
`}function AQ($){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=wQ[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function RQ($,Z){let{elementId:Y,event:J,handler:X,modifiers:Q}=$,G=AQ(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) {
|
|
677
677
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
678
|
-
};`;function B
|
|
679
|
-
${
|
|
678
|
+
};`;function j(B){if(/\$emit\s*\(/.test(B))return`${U}
|
|
679
|
+
${B}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
680
680
|
if (scope && scope.__stx_execute) {
|
|
681
681
|
scope.__stx_execute('${W}', $event, $el);
|
|
682
682
|
}
|
|
683
683
|
else {
|
|
684
|
-
${
|
|
684
|
+
${B}
|
|
685
685
|
}`}if(Q.debounce!==null)return` ;(function() {
|
|
686
686
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
687
687
|
var $el = document.getElementById('${Y}')
|
|
@@ -689,7 +689,7 @@ else {
|
|
|
689
689
|
var __timer
|
|
690
690
|
$el.addEventListener('${J}', function($event) {
|
|
691
691
|
${G?G+"; ":""}clearTimeout(__timer)
|
|
692
|
-
__timer = setTimeout(function() { ${
|
|
692
|
+
__timer = setTimeout(function() { ${j(X)} }, ${Q.debounce})
|
|
693
693
|
}${q})
|
|
694
694
|
})()`;if(Q.throttle!==null)return` ;(function() {
|
|
695
695
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
@@ -700,7 +700,7 @@ else {
|
|
|
700
700
|
${G?G+"; ":""}var __now = Date.now()
|
|
701
701
|
if (__now - __last >= ${Q.throttle}) {
|
|
702
702
|
__last = __now
|
|
703
|
-
${
|
|
703
|
+
${j(X)}
|
|
704
704
|
}
|
|
705
705
|
}${q})
|
|
706
706
|
})()`;if(/\$emit\s*\(/.test(X))return` var $el = document.getElementById('${Y}')
|
|
@@ -716,25 +716,25 @@ else {
|
|
|
716
716
|
else {
|
|
717
717
|
${X}
|
|
718
718
|
}
|
|
719
|
-
}${q})`}function
|
|
719
|
+
}${q})`}function NQ($){if($.length===0)return"";return`
|
|
720
720
|
// STX: auto-generated event bindings
|
|
721
|
-
${$.map((Y,J)=>
|
|
722
|
-
`)}`}function
|
|
723
|
-
`)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
|
|
721
|
+
${$.map((Y,J)=>RQ(Y,J)).join(`
|
|
722
|
+
`)}`}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]!==`
|
|
723
|
+
`)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 j=z[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=z[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((j)=>{let B=j.trim(),_=B.indexOf(":"),H=_>=0?B.slice(_+1).trim().split(/[\s=]/)[0]:B.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 j=U[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=U[0].length;continue}}G++}return Z}function MQ($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(j){let B;while((B=Y.exec(j))!==null){let _=B[0];if(!TQ.has(_))Z.add(_)}}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 P5($,Z={}){let Y=$,J="",X=!1,Q=[],G=H$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=O$(G.styles),q=a1(Y);Y=q.code,Q=q.imports;let{hasUserImports:z,bundleClientScript:W}=await Promise.resolve().then(() => (b5(),k5));if(z(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await W(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let O=_9(Y);Y=O.code,J=Q7(O.stxImports,O.browserImports.filter((F)=>!Q.includes(F)))}if(J=`${L$(Y,Z.serverData)}${J}`,Y=o0(Y),!X&&y1(Z.attrs||""))Y=P1(Y);let U=NQ(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let O=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${F}>
|
|
724
724
|
${J}${Y}
|
|
725
725
|
${U}
|
|
726
|
-
</script>`}let
|
|
726
|
+
</script>`}let _=/\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($),H=/function __stx_setup_/.test(Y),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(O){let F=O.length>0?`
|
|
727
727
|
return { ${O.join(", ")} };`:"";return`${K}<script data-stx-scoped>
|
|
728
728
|
window.stx.mount(function() {
|
|
729
729
|
'use strict';
|
|
730
730
|
${J}${Y}
|
|
731
731
|
${U}${F}
|
|
732
|
-
})</script>`}if(!L&&!H){if(
|
|
732
|
+
})</script>`}if(!L&&!H){if(_)return V(j9($));if(Z.templateContent){let O=j9($);if(O.length>0){let F=MQ(Z.templateContent);if(O.some((A)=>F.has(A)))return V(O)}}}return`${K}<script data-stx-scoped>
|
|
733
733
|
;(function() {
|
|
734
734
|
'use strict';
|
|
735
735
|
${J}${Y}
|
|
736
736
|
${U}
|
|
737
|
-
})()</script>`}var
|
|
737
|
+
})()</script>`}var qQ,_Q,B9,HQ,wQ,TQ;var C5=b(()=>{R0();qQ=/^[ \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","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","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"],B9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];HQ=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"]);wQ={left:0,middle:1,right:2};TQ=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 kQ($){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 bQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(DQ.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&V9.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function SQ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!V9.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 F$($){let Z=$.trim(),Y=kQ(Z);bQ(Y,Z),SQ(Z);for(let J of F9)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!L9.allowBracketNotation&&EQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function yQ($){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("__")||F9.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=G7(J);else Z[Y]=J}return Z}function G7($,Z=0){if(Z>=L9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>G7(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]=G7(X,Z+1);else Y[J]=X}return Y}function X0($,Z){try{let Y=yQ(Z),J=Object.keys(Y),X=Object.values(Y);return K0($,J)(...X)}catch{return}}function G0($){try{return F$($),!0}catch{return!1}}function N0($,Z){try{let Y=X0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function K0($,Z){let Y=F$($),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,`
|
|
738
738
|
'use strict';
|
|
739
739
|
try {
|
|
740
740
|
return ${Y};
|
|
@@ -745,7 +745,7 @@ catch (e) {
|
|
|
745
745
|
}
|
|
746
746
|
throw e;
|
|
747
747
|
}
|
|
748
|
-
`),K=G([]);if(Q.length===Z.length)return j9(K,Q,G);return j9((...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 j9($,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)||F9.has(j))return;q.add(j),K.push(j),G=Y(K),J?.(K)}return}}function V$($){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 TQ,H9,O9,MQ,L9,IQ,F9;var T0=b(()=>{TQ={maxSanitizeDepth:10,allowBracketNotation:!1},H9={...TQ},O9=[/\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/],MQ=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"]),L9=new Set(["__proto__","constructor","prototype"]),IQ=/[\w)\]]\s*\[\s*['"]/;F9=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 w$($,Z){let Y=SQ++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return yQ.set(J,{type:$,expression:Z}),J}var SQ=0,yQ;var V9=b(()=>{yQ=new Map});function T9($,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 H1($,Z){return T9($,Z,w9,A9)}function t1($,Z){return T9($,Z,R9,N9)}function v5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function PQ($,Z){if($.startsWith("<!--",Z)){let Y=v5($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[w9,A9],[R9,N9]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function K7($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let q=Z($,J);if(q>J){Y.push({start:J,end:q,token:$.slice(J,q)}),J=q;continue}let z=PQ($,J);if(z>J){J=z;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function Z1($,Z,Y){let J=K7($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let q=J[K];Q+=$.slice(G,q.start),Q+=Y(q.token,K),G=q.end}return Q+=$.slice(G),{output:Q,tokens:X}}function O1($){let{output:Z,tokens:Y}=Z1($,H1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function x5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var w9,A9,R9,N9;var C1=b(()=>{w9=/<script\b[^>]*>/iy,A9=/<\/script\s*>/ig,R9=/<style\b[^>]*>/iy,N9=/<\/style\s*>/ig});var b9={};e(b9,{usesSignalsInScript:()=>e1,unescapeHtml:()=>q7,registerFilters:()=>vQ,registerFilter:()=>D9,processExpressions:()=>L1,interpolateScriptsInTemplate:()=>fQ,interpolateScriptExpressions:()=>A$,getAllFilters:()=>E9,evaluateExpression:()=>l0,escapeHtml:()=>s0,defaultFilters:()=>g5,clearCustomFilters:()=>xQ,applyFilters:()=>k9});function CQ($){let Z=M9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),M9.set($,Z)}return Z.lastIndex=0,Z}function D9($,Z){if($ in g5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);f5[$]=Z}function vQ($){for(let[Z,Y]of Object.entries($))D9(Z,Y)}function E9(){return{...g5,...f5}}function xQ(){for(let $ of Object.keys(f5))delete f5[$]}function s0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function e1($){let{scripts:Z}=O1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))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 I9($,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 A$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=l0(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=l0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function fQ($,Z,Y={}){let{output:J,scripts:X}=O1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),z=G.search(/<\/script\s*>$/i);if(!K||!q||z===-1)return G;let W=K[1],U=K[2];if(/\bsrc\s*=/.test(W))return G;if(/\bdata-raw\b/.test(W))return G;if(/\btype\s*=\s*["']application\/json["']/.test(W))return G;if(Y.skipServer&&/\bserver\b/.test(W))return G;let B=A$(U,Z);return q[0]+B+G.slice(z)});return x5(J,Q)}function L1($,Z,Y,J){let X=$,Q=(B,_)=>{let j=t1(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:V,tokens:O}=Z1(B,_,(F,w)=>H(L+w));return j.push(...O),V},K=[];X=G(X,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let q=[];X=G(X,H1,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let z=J?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||e1($),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=l0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return z0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,j,B)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(B,_,j)=>{try{let H=l0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return w$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return w$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return z0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,j,B)}}),X=G(X,H1,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"],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)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(R),T=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=l0(_,Z);if(A)return B;if(z&&!I9(H,Z))return B;if(M===void 0&&Z.__stx_buildMode==="compile"&&!z)return w$("expr",H);return M!==void 0&&M!==null?s0(String(M)):""}catch(M){if(A)return B;if(z&&!I9(H,Z))return B;if(T)return B;let I=M instanceof Error?M.message:String(M);return z0("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 k9($,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=f5[G]||g5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(E9()).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=[l0(`(${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){_+=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==="{")V++;else if(w==="}")V--;if(w===","&&H===0&&L===0&&V===0){B.push(_),_="";continue}_+=w}if(_)B.push(_);q=B.map((F)=>{let w=F.trim();return l0(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 gQ($){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 l0($,Z,Y=!1){try{let J=$.trim(),X=gQ(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=l0(Q,Z,!0);return k9(K,G,Z)}if(!G0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return X0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return K0(J,Q)(...G)}catch{return X0(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=hQ(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 hQ($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=dQ($,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 dQ($,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 q7($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var f5,M9,g5;var Y1=b(()=>{T0();R0();V9();C1();f5={},M9=new Map;g5={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 s0(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(CQ(q),String(z))}),K},t:($,Z,Y={})=>{return g5.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 $5($="const",Z=[],Y){let J=Z.length?R$.filter((X)=>!Z.includes(X)):R$;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}var R$,S9;var h5=b(()=>{R$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],S9=["onMount","onDestroy"]});class d5{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 Y5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!Z5.has(Y)){if(Z5.size>=uQ){let J=Z5.keys().next().value;if(J)Z5.delete(J)}Z5.set(Y,new RegExp($,Z))}return Z5.get(Y)}class y9{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
|
+
`),K=G([]);if(Q.length===Z.length)return O9(K,Q,G);return O9((...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 O9($,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 j=U instanceof Error?U.message:"",B=Q.exec(j);if(!(U instanceof ReferenceError)||!B)return;let _=B[1];if(q.has(_)||w9.has(_))return;q.add(_),K.push(_),G=Y(K),J?.(K)}return}}function V$($){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 IQ,L9,F9,DQ,V9,EQ,w9;var T0=b(()=>{IQ={maxSanitizeDepth:10,allowBracketNotation:!1},L9={...IQ},F9=[/\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/],DQ=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"]),V9=new Set(["__proto__","constructor","prototype"]),EQ=/[\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 w$($,Z){let Y=PQ++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return CQ.set(J,{type:$,expression:Z}),J}var PQ=0,CQ;var A9=b(()=>{CQ=new Map});function I9($,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 H1($,Z){return I9($,Z,R9,N9)}function t1($,Z){return I9($,Z,T9,M9)}function v5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function vQ($,Z){if($.startsWith("<!--",Z)){let Y=v5($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[R9,N9],[T9,M9]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function K7($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let q=Z($,J);if(q>J){Y.push({start:J,end:q,token:$.slice(J,q)}),J=q;continue}let z=vQ($,J);if(z>J){J=z;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function Z1($,Z,Y){let J=K7($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let q=J[K];Q+=$.slice(G,q.start),Q+=Y(q.token,K),G=q.end}return Q+=$.slice(G),{output:Q,tokens:X}}function O1($){let{output:Z,tokens:Y}=Z1($,H1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function x5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var R9,N9,T9,M9;var C1=b(()=>{R9=/<script\b[^>]*>/iy,N9=/<\/script\s*>/ig,T9=/<style\b[^>]*>/iy,M9=/<\/style\s*>/ig});var y9={};e(y9,{usesSignalsInScript:()=>e1,unescapeHtml:()=>q7,registerFilters:()=>fQ,registerFilter:()=>k9,processExpressions:()=>L1,interpolateScriptsInTemplate:()=>hQ,interpolateScriptExpressions:()=>A$,getAllFilters:()=>b9,evaluateExpression:()=>l0,escapeHtml:()=>s0,defaultFilters:()=>g5,clearCustomFilters:()=>gQ,applyFilters:()=>S9});function xQ($){let Z=D9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),D9.set($,Z)}return Z.lastIndex=0,Z}function k9($,Z){if($ in g5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);f5[$]=Z}function fQ($){for(let[Z,Y]of Object.entries($))k9(Z,Y)}function b9(){return{...g5,...f5}}function gQ(){for(let $ of Object.keys(f5))delete f5[$]}function s0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function e1($){let{scripts:Z}=O1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))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 E9($,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 A$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=l0(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=l0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function hQ($,Z,Y={}){let{output:J,scripts:X}=O1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),z=G.search(/<\/script\s*>$/i);if(!K||!q||z===-1)return G;let W=K[1],U=K[2];if(/\bsrc\s*=/.test(W))return G;if(/\bdata-raw\b/.test(W))return G;if(/\btype\s*=\s*["']application\/json["']/.test(W))return G;if(Y.skipServer&&/\bserver\b/.test(W))return G;let j=A$(U,Z);return q[0]+j+G.slice(z)});return x5(J,Q)}function L1($,Z,Y,J){let X=$,Q=(j,B)=>{let _=t1(j,B);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(j.slice(B,_))?-1:_},G=(j,B,_,H)=>{let L=_.length,{output:V,tokens:O}=Z1(j,B,(F,w)=>H(L+w));return _.push(...O),V},K=[];X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`);let q=[];X=G(X,H1,q,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`);let z=J?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||e1($),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,(j,B,_)=>{try{let H=l0(B,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return z0("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${L}`,Y,$,_,j)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(j,B,_)=>{try{let H=l0(B,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return w$("raw",B.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return w$("raw",B.trim());let L=H instanceof Error?H.message:String(H);return z0("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${L}`,Y,$,_,j)}}),X=G(X,H1,q,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`),X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(j,B,_)=>{let H=B.trim();if(U.has(H))return j;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)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(R),T=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=l0(B,Z);if(A)return j;if(z&&!E9(H,Z))return j;if(M===void 0&&Z.__stx_buildMode==="compile"&&!z)return w$("expr",H);return M!==void 0&&M!==null?s0(String(M)):""}catch(M){if(A)return j;if(z&&!E9(H,Z))return j;if(T)return j;let I=M instanceof Error?M.message:String(M);return z0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,_,j)}});for(let j=0;j<q.length;j++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${j}__-->`,()=>q[j]);for(let j=0;j<K.length;j++)X=X.replace(`<!--__STX_STYLE_${j}__-->`,()=>K[j]);return X}function S9($,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=f5[G]||g5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(b9()).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=[l0(`(${U})`,Y,!0)];else{let j=[],B="",_=null,H=0,L=0,V=0,O=!1;for(let F=0;F<U.length;F++){let w=U[F];if(O){B+=w,O=!1;continue}if(w==="\\"){B+=w,O=!0;continue}if(_){if(B+=w,w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w,B+=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){j.push(B),B="";continue}B+=w}if(B)j.push(B);q=j.map((F)=>{let w=F.trim();return l0(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 dQ($){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 l0($,Z,Y=!1){try{let J=$.trim(),X=dQ(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=l0(Q,Z,!0);return S9(K,G,Z)}if(!G0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return X0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return K0(J,Q)(...G)}catch{return X0(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=uQ(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 uQ($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=mQ($,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 mQ($,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 q7($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var f5,D9,g5;var Y1=b(()=>{T0();R0();A9();C1();f5={},D9=new Map;g5={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 s0(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(xQ(q),String(z))}),K},t:($,Z,Y={})=>{return g5.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 $5($="const",Z=[],Y){let J=Z.length?R$.filter((X)=>!Z.includes(X)):R$;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}var R$,P9;var h5=b(()=>{R$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],P9=["onMount","onDestroy"]});class d5{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 Y5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!Z5.has(Y)){if(Z5.size>=pQ){let J=Z5.keys().next().value;if(J)Z5.delete(J)}Z5.set(Y,new RegExp($,Z))}return Z5.get(Y)}class C9{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,`
|
|
749
749
|
'use strict';
|
|
750
750
|
try {
|
|
751
751
|
return ${q};
|
|
@@ -756,33 +756,33 @@ catch (e) {
|
|
|
756
756
|
}
|
|
757
757
|
throw e;
|
|
758
758
|
}
|
|
759
|
-
`),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
|
|
759
|
+
`),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 v9{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 lQ(){if(!z7)z7=new v9;return z7}var Z5,pQ=500,k_,z7=null,x9;var J5=b(()=>{Z5=new Map;k_=new C9;x9=new Proxy({},{get($,Z){return lQ()[Z]}})});function f9($,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 g9($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=W7($),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 j=U[1],B=`${Z}_${j}`;z.set(j,B)}}for(let W of K){let U=h9(W,Z,J,X,z,G);q.push(U)}return q.join(`
|
|
760
760
|
|
|
761
|
-
`)}function W7($){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,
|
|
762
|
-
`)})}else Z.push({selector:`@${W} ${U.trim()}`,declarations:
|
|
761
|
+
`)}function W7($){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,j]=z;if(W==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:j.trim()});else if(W==="media"||W==="supports"||W==="container"){let B=W7(j);Z.push({selector:`@${W} ${U.trim()}`,declarations:B.map((_)=>`${_.selector} { ${_.declarations} }`).join(`
|
|
762
|
+
`)})}else Z.push({selector:`@${W} ${U.trim()}`,declarations:j.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 h9($,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=W7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>h9(j,Z,Y,J,X,Q)).join(`
|
|
763
763
|
`);return`${G} {
|
|
764
764
|
${U}
|
|
765
|
-
}`}return`${G} { ${K} }`}let q=
|
|
766
|
-
`)}function
|
|
767
|
-
`,""}),headContent:Z.trim()}}function
|
|
768
|
-
`);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((
|
|
765
|
+
}`}return`${G} { ${K} }`}let q=cQ(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 cQ($,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=iQ(G,Z);if(q)Q.push(Y?`${Y} ${q}`:q)}return Q.join(", ")}function iQ($,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(!nQ.test($))return{html:$,hasScoped:!1};let Y=f9(Z),J=`data-v-${Y}`,X=$,Q=new RegExp(`<style\\s+([^>]*${U7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,q,z)=>{G=!0;let W=oQ(z,J),U=q.replace(new RegExp(U7,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${j}>${W}</style>`}),!G)return{html:$,hasScoped:!1};return X=rQ(X,J),{html:X,hasScoped:!0}}function oQ($,Z){return g9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function rQ($,Z){let Y=Z1($,(X,Q)=>{let G=H1(X,Q);return G>Q?G:t1(X,Q)},(X,Q)=>sQ(Q)),J=aQ(Y.output,Z);return d9.lastIndex=0,J.replace(d9,(X,Q)=>Y.tokens[Number(Q)])}function aQ($,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 U7,nQ,sQ=($)=>`\x00stx-scope-mask-${$}\x00`,d9;var j7=b(()=>{C1();U7=String.raw`(?<![\w-])scoped(?![\w-])`,nQ=new RegExp(`<style\\s+[^>]*${U7}`,"i");d9=/\u0000stx-scope-mask-(\d+)\u0000/g});function eQ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return tQ.test(Z)}function T$($){u5.lastIndex=0;let Z;while((Z=u5.exec($))!==null){if(Z[0].startsWith("</")||eQ(Z[0]))continue;let Y=Z.index,J=u5.lastIndex,X=1,Q;while((Q=u5.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:Y,openEnd:J,closeStart:G,end:u5.lastIndex,content:$.slice(J,G)}}}else X++;return null}return null}var u5,tQ;var B7=b(()=>{u5=/<\/?template\b[^>]*>/gi,tQ=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var u9=()=>{};function v0($,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 O7={};e(O7,{useTitle:()=>XG,useSeoMeta:()=>m9,usePageTitle:()=>XG,useHead:()=>H7,seoMetaToHeadConfig:()=>I$,resetHead:()=>YG,renderHtmlAttrs:()=>GG,renderHead:()=>QG,renderBodyAttrs:()=>KG,processTitleDirective:()=>WG,processMetaDirective:()=>UG,processHeadDirective:()=>zG,mergeHeadConfigs:()=>X5,getPageMeta:()=>ZG,getHead:()=>_7,definePageMeta:()=>JG,applyHead:()=>qG});function _7(){return F1}function ZG(){return M$}function YG(){F1={},$G.length=0,M$={}}function H7($){F1=X5(F1,$)}function X5($,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 m9($){H7(I$($))}function I$($){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});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function JG($){if(M$={...M$,...$},$.title||$.description)m9({title:$.title,description:$.description})}function XG($){let Z=typeof $==="function"?$():$;H7({title:Z})}function QG($=F1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${v1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${v1(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}="${v1(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}="${v1(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}="${v1(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(`
|
|
766
|
+
`)}function GG($=F1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${v1(Y)}"`).join(" ")}function KG($=F1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${v1(Y)}"`).join(" ")}function v1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function qG($=F1){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 zG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,X)=>{return Z+=X.trim()+`
|
|
767
|
+
`,""}),headContent:Z.trim()}}function WG($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=X5(K,{title:G}),""})}function UG($,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},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=X5(j,{meta:[U]}),""})}var F1,$G,M$;var m5=b(()=>{F1={},$G=[],M$={}});var D$={};e(D$,{stripTypeScript:()=>n9,hasVariables:()=>t9,extractVariables:()=>x1,extractScriptFromTemplate:()=>a9,convertToCommonJS:()=>F7});import Q5 from"path";import p5 from"process";function jG($){let Z=[],Y=0,J=$.split(`
|
|
768
|
+
`);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((j)=>{let B=j.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...U)}}}}return[...new Set(Z)]}function n9($){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("..."),j=U?W.slice(3):W,B=-1,_=0;for(let A=0;A<j.length;A++)if(j[A]==="<")_++;else if(j[A]===">")_--;else if(j[A]===":"&&_===0){B=A;break}if(B===-1)return z;let L=j.substring(0,B).trim().replace(/\?$/,""),V=j.substring(B+1),O=-1,F=0;for(let A=0;A<V.length;A++)if(V[A]==="<")F++;else if(V[A]===">")F--;else if(V[A]==="="&&F===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${V.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 B=Z[q];if(W){if(B===W)W=null;q++;continue}if(B==='"'||B==="'"||B==="`"){W=B,q++;continue}if(B==="<")z++;else if(B===">"&&z>0)z--;else if(z===0){if(B==="(")K++;else if(B===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let j=Y(U);Q.push({start:G+1,end:q,replacement:j})}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,`
|
|
769
769
|
|
|
770
|
-
`),Z}async function x1($,Z,Y,J={}){if(!$.trim())return;let X;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:p0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=P.transformSync(v)}catch{X=
|
|
771
|
-
`),
|
|
770
|
+
`),Z}async function x1($,Z,Y,J={}){if(!$.trim())return;let X;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:p0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=P.transformSync(v)}catch{X=n9($)}let Q={exports:{}},G=Q.exports,K=p5.cwd(),q={},z=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((P)=>P[1]).filter((P)=>!P.startsWith("node:")&&!P.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(P));for(let P of z)try{let v=Q5.resolve(K,"node_modules",P),m=Q5.join(v,"package.json"),n=JSON.parse(U0("fs").readFileSync(m,"utf8")),q0=n.main||"index.js";if(n.exports){let H0=typeof n.exports==="string"?n.exports:n.exports["."];if(typeof H0==="string")q0=H0;else if(H0?.bun)q0=H0.bun;else if(H0?.import)q0=H0.import;else if(H0?.default)q0=H0.default}q[P]=await import(Q5.resolve(v,q0))}catch{}let W=(P)=>{if(q[P])return q[P];return U0(P)},U=Z.props||{},j=(P)=>{if(!P)return U;let v={};for(let[m,n]of Object.entries(P)){let q0=U[m];if(q0!==void 0)v[m]=q0;else if(typeof n==="function")v[m]=n();else v[m]=n}return v};for(let[P,v]of Object.entries(U))Object.defineProperty(j,P,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let P of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,P))continue;try{Object.defineProperty(j,P,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(P)=>{if(!P)return U;let v={...U};for(let[m,n]of Object.entries(P)){let q0=n&&typeof n==="object"&&!Array.isArray(n)?n:{type:n};if(v[m]===void 0&&q0.default!==void 0)v[m]=typeof q0.default==="function"?q0.default():q0.default}return v},_=()=>Z.slots||{},H=(P,v)=>{let m={...P};for(let[n,q0]of Object.entries(v))if(m[n]===void 0)if(typeof q0==="function")m[n]=q0();else m[n]=q0;return m},L=(P)=>{let v=()=>P;return v.set=(m)=>{},v.update=(m)=>{},v},V=(P)=>{let v,m=!1;return()=>{if(!m)try{v=P(),m=!0}catch{v=void 0}return v}},O=(P)=>{},F=(P)=>P(),w=(P)=>{},A=(P)=>{},R=(P)=>{},N=()=>{let P=Z.__stxServeContext,v=Z.__stxServeSearch??P?.search??"",m=P?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:m,name:"",fullPath:m+v,hash:"",matched:[]}},T=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),M=(P)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=X5(v,P||{})},I=(P)=>{M(I$(P||{}))},E=(P)=>({value:P}),D=(P)=>P,y=(P)=>({value:typeof P==="function"?P():P}),S=(P,v)=>{},k=(P)=>{},C=(P)=>{},x=(P)=>P?P():Promise.resolve(),f=(P)=>(v,...m)=>{},d=(P)=>{},c=(P,v)=>{},p=(P,v)=>v,W0=()=>({value:"light"}),w0=()=>L(!1),_0=(P)=>L(!1),J0=()=>L(!1),I0=()=>_0("(prefers-color-scheme: dark)"),i0=()=>_0("(prefers-color-scheme: light)"),G1=()=>_0("(prefers-reduced-motion: reduce)"),D1=()=>_0("(prefers-contrast: more)"),l={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(l,{get(P,v){if(v in P)return P[v];return},set(P,v,m){return P[v]=m,!0}}),h={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},u=console;try{let P=F7(X,Y),v=new Set(Object.keys(U)),m=(t)=>/^[a-z_$][\w$]*$/i.test(t),n=Object.keys(Z).filter((t)=>!v.has(t)&&t!=="props"&&m(t)),q0=n.map((t)=>Z[t]),H0=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"]),k0=[],u0=[];for(let[t,$1]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(H0.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(P))continue;k0.push(t),u0.push($1)}let j0=jG(P).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
|
|
771
|
+
`),j1=Z.params??{},n0=[],E1=[];for(let t=0;t<n.length;t++){if(n[t]==="params")continue;n0.push(n[t]),E1.push(q0[t])}let m0=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","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...k0,...n0,`return (async () => {
|
|
772
772
|
${P}
|
|
773
|
-
${
|
|
773
|
+
${j0}
|
|
774
774
|
return module.exports
|
|
775
|
-
})()`)(Q,G,W,U,B,
|
|
776
|
-
`),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,
|
|
777
|
-
`+
|
|
778
|
-
`),Y)}function
|
|
779
|
-
`)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=
|
|
780
|
-
`);return{type:
|
|
781
|
-
${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,X,Q,G]=J,K=G,q=Z;if(
|
|
782
|
-
${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:X,name:Q,value:K,nextIndex:q}}function L7($,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(
|
|
775
|
+
})()`)(Q,G,W,U,j,B,H,L,V,O,F,w,A,R,N,T,M,I,E,D,y,S,k,C,x,f,d,_,c,p,W0,w0,_0,J0,I0,i0,G1,D1,a,h,u,l.confirm,l.alert,l.fetch,j1,...u0,...E1);if(J.preserveExisting){for(let[t,$1]of Object.entries(m0))if(!(t in Z)||Z[t]===void 0)Z[t]=$1}else Object.assign(Z,m0);for(let[t,$1]of Object.entries(U))if(!(t in Z))Z[t]=$1}catch(P){if(p5.env.STX_DEBUG){let v=P instanceof Error?P.message:String(P);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`)}try{await LG(X,Z,Y)}catch(v){if(p5.env.STX_DEBUG){let m=v instanceof Error?v.message:String(v);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${m}`)}}}}function F7($,Z){let Y=Z?Q5.dirname(Z):p5.cwd(),J=$.split(`
|
|
776
|
+
`),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,j=J[z];for(let B=0;B<j.length;B++){let _=j[B];if(U){U=!1;continue}if(_==="\\"){U=!0;continue}if(W){if(_===W)W=null;continue}if(_==='"'||_==="'"||_==="`"){W=_;continue}if(_==="(")K++;else if(_===")"){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 Q5.resolve(Y,U);return U};if(K){let[,U,j]=K,B=W(j);X.push(`const ${U} = await import('${B}')`),X.push(`module.exports.${U} = ${U};`)}else if(q){let[,U,j]=q,B=U.trim(),_=W(j);X.push(`const { ${B} } = await import('${_}')`);for(let H of B.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=p9(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=L7(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=p9(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=L7(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=L7(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 j=J[U];for(let B of j)if(B==="{")W++;else if(B==="}")W--;if(U>Q)z+=`
|
|
777
|
+
`+j;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 BG(X.join(`
|
|
778
|
+
`),Y)}function BG($,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===`
|
|
779
|
+
`)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=_G($,X);if(U){let{quote:j,path:B,end:_}=U;if(B.startsWith(".")){let H=Q5.resolve(Z,B);J+=`await import(${j}${H}${j})`,X=_;continue}}}J+=z,X++}return J}function _G($,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 o9($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let X=v0($,Y,Y==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:$.slice(Z,X+1),endPos:X+1}}function s9($){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=o9(Y,J);if(K){let q=s9(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 p9($,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 B=W.startsWith("{")?"}":"]",_=W;for(let H=Z+1;H<$.length;H++)if(_+=" "+$[H].trim(),U=H,$[H].includes(B))break;W=_}let j=o9(W,0);if(j){let B=z[1],_=j.pattern,H=W.slice(j.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),V=L,O=Math.max(U,Z);if(l9(L)){let R=c9($,O,L);V=R.value,O=R.nextIndex}else O=O+1;V=V.trim().replace(/;$/,"");let F=s9(_),w=`__stx_src_${Z}`,A=F.map((R)=>`module.exports.${R} = ${R};`).join(`
|
|
780
|
+
`);return{type:B,name:w,value:`${V}; ${B} ${_} = ${w};
|
|
781
|
+
${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,X,Q,G]=J,K=G,q=Z;if(l9(G)){let z=c9($,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+=`
|
|
782
|
+
${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:X,name:Q,value:K,nextIndex:q}}function L7($,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(HG(Y)){let K=OG($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function l9($){let Z=$.trim();if(Z.startsWith("{"))return v0(Z,"{","}",0)===-1;if(Z.startsWith("["))return v0(Z,"[","]",0)===-1;return!r9(Z)}function r9($){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 HG($){let Z=$.indexOf("{");if(Z===-1)return!0;return v0($,"{","}",Z)===-1}function c9($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!r9(J)){let Q=$[X];J+=`
|
|
783
783
|
${Q}`,X++}while(X<$.length){let Q=$[X].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
|
|
784
|
-
${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function
|
|
785
|
-
${G}`,X++}return{functionCode:J,nextIndex:X}}function l9($,Z){let Y=X0($,Z)??X0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...p5.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 HG($,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=l9(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=l9(q,Z);if(z!==void 0)Z[G]=z}catch{}}}function s9($){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 r9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var l5=b(()=>{m5();b1();T0()});var V7={};e(V7,{renderSlot:()=>t9,processSlots:()=>$8,parseSlots:()=>a9,parseSlotElement:()=>wG,extractSlotContent:()=>NG,applySlots:()=>TG});function OG($,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 FG($,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 VG($){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=FG($,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 _=OG($,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)&&!LG.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 a9($){let Z={default:"",named:new Map},Y=$,J=VG($);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(),V=`<${z}${L?" "+L:""}>${_}</${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,_=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 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 t9($,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=AG(X,G)}return X}function AG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=e9(X,Z);return s0(String(Q??""))}catch{return`{{ ${J} }}`}})}function e9($,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 $8($,Z,Y){let J=$;J=await RG(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],V=H[2];_[L]=e9(V,Y)}return await t9(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 RG($,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 NG($){let Z=a9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function TG($,Z,Y,J){return await $8($,{default:Z,named:Y},J)}var LG;var w7=b(()=>{Y1();T0();LG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function V1($,Z){let Y=MG($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function MG($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=C0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function IG($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function f1($,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 Z8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=V1($,J);if(!X)return null;let Q=X.endPos,G=f1($,"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(IG(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 V=z+L[0].length,O=V1(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 c5($){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=Z8($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function E$($,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=C0($,"(",")",q);if(z===-1){Q=X.exec($);continue}let W=$.slice(q+1,z),U=z+1,B=f1($,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 A7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=V1($,J);if(!X)return null;let Q=X.endPos,G=f1($,"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])/),V=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(W)q.push(W);let O=z+H[0].length,F=V1(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 Y8=()=>{};var J8=()=>{};var k$=b(()=>{Y8();J8()});function y$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(g0)J.add(g0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),i5)J.forEach((K)=>S$.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}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function P$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,i5)J.forEach((G)=>S$.add(G));else J.forEach((G)=>G())},Q=()=>{if(g0)J.add(g0);if(Y){let G=g0;g0=X,b$.push(X);try{Z=$()}finally{b$.pop(),g0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function C$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=g0;g0=X,b$.push(X);try{Y=$()}finally{b$.pop(),g0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function R7($){if(i5){$();return}i5=!0;try{$()}finally{i5=!1,S$.forEach((Z)=>Z()),S$.clear()}}function N7($){bG.push($)}function T7($){SG.push($)}function v$($){return typeof $==="function"&&$._isSignal===!0}function x$($){return typeof $==="function"&&$._isDerived===!0}function M7($){if(v$($)||x$($))return $();return $}function f$($){let Z=g0;g0=null;try{return $()}finally{g0=Z}}function yG($,Z){let Y=typeof $==="function"?$:()=>$,J=y$([]),X=P$(()=>J().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return C$(()=>{if(Y(),!Q){Q=!0;return}if(f$(()=>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 g0=null,b$,i5=!1,S$,bG,SG;var I7=b(()=>{b$=[],S$=new Set,bG=[],SG=[]});var Q8={};e(Q8,{useOptimistic:()=>yG,untrack:()=>M7,state:()=>y$,peek:()=>f$,onMount:()=>N7,onDestroy:()=>T7,isSignal:()=>v$,isDerived:()=>x$,generateSignalsRuntimeDev:()=>g$,generateSignalsRuntime:()=>X8,effect:()=>C$,derived:()=>P$,default:()=>CG,batch:()=>R7});function X8(){try{let $=PG(g$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return g$()}}function PG($){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 g$(){return`
|
|
784
|
+
${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function OG($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=J.indexOf("{");if(Q!==-1){if(v0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
|
|
785
|
+
${G}`,X++}return{functionCode:J,nextIndex:X}}function i9($,Z){let Y=X0($,Z)??X0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...p5.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 LG($,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=i9(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=i9(q,Z);if(z!==void 0)Z[G]=z}catch{}}}function a9($){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 t9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var l5=b(()=>{m5();b1();T0()});var V7={};e(V7,{renderSlot:()=>$8,processSlots:()=>Y8,parseSlots:()=>e9,parseSlotElement:()=>RG,extractSlotContent:()=>MG,applySlots:()=>IG});function FG($,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 wG($,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 AG($){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 j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=wG($,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 j=Y.lastIndexOf(W);if(j!==-1)Y.splice(j);X=G;continue}if(W==="template"&&Y.length===0){let j=K.match(J);if(j){let B=FG($,G);if(B!==-1){let _=j[1]||j[2]||j[3];Z.push({start:Q,end:B,slotName:_,content:$.slice(G,B-11).trim(),propsBinding:j[4]||void 0}),X=B;continue}}}if(!/\/\s*>$/.test(K)&&!VG.has(W)){if(Y.push(W),W==="script"||W==="style"){let j=$.toLowerCase().indexOf(`</${W}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function e9($){let Z={default:"",named:new Map},Y=$,J=AG($);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,j,B]=G,_=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(_+H).trim(),V=`<${z}${L?" "+L:""}>${B}</${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,j]=G,B=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(B+_).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 RG($){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 $8($,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((j)=>j.trim()),U=W||z;if(Z[z]!==void 0)G[U]=Z[z]}}else G[Q]=Z;X=NG(X,G)}return X}function NG($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=Z8(X,Z);return s0(String(Q??""))}catch{return`{{ ${J} }}`}})}function Z8($,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 Y8($,Z,Y){let J=$;J=await TG(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,z)=>{let W=Z.named.get(K),U=z?.trim()||"",j=q||"",B={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=_.exec(j))!==null){let L=H[1],V=H[2];B[L]=Z8(V,Y)}return await $8(W,B,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 TG($,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 MG($){let Z=e9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function IG($,Z,Y,J){return await Y8($,{default:Z,named:Y},J)}var VG;var w7=b(()=>{Y1();T0();VG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function V1($,Z){let Y=DG($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function DG($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=v0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function EG($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function f1($,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 J8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=V1($,J);if(!X)return null;let Q=X.endPos,G=f1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],z=0,W="if",U=X.expression,j=0,B=0;while(z<K.length){let _=K.indexOf("@",z);if(_===-1)break;z=_;let H=K.substring(_);if(EG(K,_)){z++;continue}if(/^@if\s*\(/.test(H)){B++,z++;continue}if(/^@endif(?![a-z])/.test(H)){B--,z+=6;continue}if(B===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:W,condition:U,content:K.substring(j,z),start:Q+j,end:Q+z});let V=z+L[0].length,O=V1(K,V);if(!O){z++;continue}W="elseif",U=O.expression,z=O.endPos,j=z;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:W,condition:U,content:K.substring(j,z),start:Q+j,end:Q+z}),W="else",U=void 0,z+=5,j=z;continue}}z++}return q.push({type:W,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function c5($){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=J8($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function E$($,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=v0($,"(",")",q);if(z===-1){Q=X.exec($);continue}let W=$.slice(q+1,z),U=z+1,j=f1($,Z,Y,U);if(j===-1){Q=X.exec($);continue}let B=$.slice(U,j),_=j+`@${Y}`.length;J.push({fullMatch:$.slice(K,_),name:Z,params:W,content:B,start:K,end:_}),X.lastIndex=_,Q=X.exec($)}return J}function A7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=V1($,J);if(!X)return null;let Q=X.endPos,G=f1($,"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 j=K.slice(z),B=j.match(/^@switch\s*\(/),_=j.match(/^@endswitch(?![a-z])/);if(B){if(U++,W)W.content+=B[0];z+=B[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=j.match(/^@case\s*/),L=j.match(/^@default(?![a-z])/),V=j.match(/^@break(?![a-z])/);if(H&&j.startsWith("@case")){if(W)q.push(W);let O=z+H[0].length,F=V1(K,O);if(!F){z++;continue}W={type:"case",value:F.expression,content:""},z=F.endPos}else if(L&&j.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},z+=L[0].length}else if(V&&j.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 X8=()=>{};var Q8=()=>{};var k$=b(()=>{X8();Q8()});function y$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(g0)J.add(g0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),i5)J.forEach((K)=>S$.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}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function P$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,i5)J.forEach((G)=>S$.add(G));else J.forEach((G)=>G())},Q=()=>{if(g0)J.add(g0);if(Y){let G=g0;g0=X,b$.push(X);try{Z=$()}finally{b$.pop(),g0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function C$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=g0;g0=X,b$.push(X);try{Y=$()}finally{b$.pop(),g0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function R7($){if(i5){$();return}i5=!0;try{$()}finally{i5=!1,S$.forEach((Z)=>Z()),S$.clear()}}function N7($){yG.push($)}function T7($){PG.push($)}function v$($){return typeof $==="function"&&$._isSignal===!0}function x$($){return typeof $==="function"&&$._isDerived===!0}function M7($){if(v$($)||x$($))return $();return $}function f$($){let Z=g0;g0=null;try{return $()}finally{g0=Z}}function CG($,Z){let Y=typeof $==="function"?$:()=>$,J=y$([]),X=P$(()=>J().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return C$(()=>{if(Y(),!Q){Q=!0;return}if(f$(()=>J().length))J.set([])}),[X,(K,q)=>{let z={action:K};J.set([...J(),z]);let W=()=>{let U=J().filter((j)=>j!==z);if(U.length!==J().length)J.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(W,W);return W}]}var g0=null,b$,i5=!1,S$,yG,PG;var I7=b(()=>{b$=[],S$=new Set,yG=[],PG=[]});var K8={};e(K8,{useOptimistic:()=>CG,untrack:()=>M7,state:()=>y$,peek:()=>f$,onMount:()=>N7,onDestroy:()=>T7,isSignal:()=>v$,isDerived:()=>x$,generateSignalsRuntimeDev:()=>g$,generateSignalsRuntime:()=>G8,effect:()=>C$,derived:()=>P$,default:()=>xG,batch:()=>R7});function G8(){try{let $=vG(g$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return g$()}}function vG($){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 g$(){return`
|
|
786
786
|
// STX Signals Runtime (Development Build)
|
|
787
787
|
console.log('[stx] signals runtime loading');
|
|
788
788
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -3148,7 +3148,8 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
|
|
|
3148
3148
|
// handler like \`pick(option.value)\` receives the whole item.
|
|
3149
3149
|
// It is not an error, so it lands silently: the wrong value is
|
|
3150
3150
|
// stored and only surfaces much later.
|
|
3151
|
-
if (v && typeof v === 'function' && v._isSignal && !v._isStxLoopItem
|
|
3151
|
+
if (v && typeof v === 'function' && v._isSignal && !v._isStxLoopItem
|
|
3152
|
+
&& (expressionCallsSignal(value, k) || expressionUsesSignalApi(value, k))) {
|
|
3152
3153
|
return 'var ' + k + ' = __s["' + k + '"]';
|
|
3153
3154
|
}
|
|
3154
3155
|
return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && __s["' + k + '"]._isSignal ? __s["' + k + '"]() : __s["' + k + '"]';
|
|
@@ -7301,16 +7302,16 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
|
|
|
7301
7302
|
}
|
|
7302
7303
|
}
|
|
7303
7304
|
})();
|
|
7304
|
-
`}var
|
|
7305
|
+
`}var xG;var q8=b(()=>{I7();I7();xG={state:y$,derived:P$,effect:C$,batch:R7,onMount:N7,onDestroy:T7,isSignal:v$,isDerived:x$,untrack:M7,peek:f$,generateSignalsRuntime:G8,generateSignalsRuntimeDev:g$}});var D7={};e(D7,{templateCache:()=>z8,readFileCached:()=>fG,invalidateFileCacheByDir:()=>hG,invalidateFileCache:()=>gG,hashFilePath:()=>n5,getCachedSignalsRuntime:()=>mG,getCachedRouterScript:()=>pG,clearDevCaches:()=>lG,checkCache:()=>cG,cacheTemplate:()=>iG,__setSignalsGeneratorsForTest:()=>uG});import w1 from"fs";import G5 from"path";async function fG($){let Y;for(let J=0;J<3;J++)try{let Q=(await w1.promises.stat($)).mtime.getTime(),G=g1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),z=(await w1.promises.stat($)).mtime.getTime();if(z!==Q)continue;return g1.set($,{content:K,mtime:z}),K}catch(X){Y=X;break}throw g1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function gG($){g1.delete($)}function hG($){for(let Z of g1.keys())if(Z.startsWith($))g1.delete(Z)}function uG($){W8=$}async function mG($=!1){let Z=W8??await Promise.resolve().then(() => (q8(),K8));if($)return Z.generateSignalsRuntimeDev();if(h$===null)h$=Z.generateSignalsRuntime();return h$}async function pG(){if(d$===null){let{getRouterScript:$}=await import("stx-router");d$=$()}return d$}function lG(){g1.clear(),j8(),h$=null,dG=null,d$=null}function U8($){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=G5.resolve(Z.cachePath),J=G5.join(Y,`${n5($)}.html`),X=G5.join(Y,`${n5($)}.meta.json`);if(!await o(J)||!await o(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==U8(Z))return null;if((await w1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await o(q)){if((await w1.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 iG($,Z,Y,J){try{if(!J.cachePath)return;let X=G5.resolve(J.cachePath);await w1.promises.mkdir(X,{recursive:!0});let Q=G5.join(X,`${n5($)}.html`),G=G5.join(X,`${n5($)}.meta.json`),K=await w1.promises.stat($);await Bun.write(Q,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:U8(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),z8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function n5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,nG)}var z8,g1,h$=null,dG=null,W8=null,d$=null,nG=16;var E7=b(()=>{R0();z8=new Map,g1=new Map});function B8($){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]+`
|
|
7305
7306
|
`;let X=/\{\{([\s\S]*?)\}\}/g;while((J=X.exec($))!==null)Y+=J[1]+`
|
|
7306
|
-
`;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"].some((
|
|
7307
|
+
`;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"].some((j)=>{return new RegExp(`\\b${j}\\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">
|
|
7307
7308
|
// STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
|
|
7308
7309
|
import '@stacksjs/browser'
|
|
7309
|
-
</script>`;if($.includes("</head>")){let
|
|
7310
|
-
`+$.slice(
|
|
7310
|
+
</script>`;if($.includes("</head>")){let j=$.indexOf("</head>"),_=$.slice(0,j).indexOf("<script");if(_!==-1)return $.slice(0,_)+U+`
|
|
7311
|
+
`+$.slice(_);return $.replace("</head>",`${U}
|
|
7311
7312
|
</head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
7312
7313
|
${U}`);return U+`
|
|
7313
|
-
`+$}async function
|
|
7314
|
+
`+$}async function _8($,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>
|
|
7314
7315
|
`+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
7315
7316
|
`+$.slice(q)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
7316
7317
|
`+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (E7(),D7)),X=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,Q=$.indexOf("<script");if(Q!==-1)return $.slice(0,Q)+X+`
|
|
@@ -7319,34 +7320,34 @@ ${U}`);return U+`
|
|
|
7319
7320
|
`+X+$.slice(K+1)}return X+`
|
|
7320
7321
|
`+$}async function k7($,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>
|
|
7321
7322
|
`}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (E7(),D7)),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+`
|
|
7322
|
-
</body>`+$.slice(G+7)}var l$={};e(l$,{scanScriptTags:()=>
|
|
7323
|
-
`)}else{if(!
|
|
7324
|
-
`)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,
|
|
7325
|
-
`)
|
|
7323
|
+
</body>`+$.slice(G+7)}var l$={};e(l$,{scanScriptTags:()=>A8,rewriteStxImportSpecifiers:()=>M8,processSignals:()=>C7,processScriptSetup:()=>N8,preEvalLiteralReactiveIfs:()=>y7,parseLoopExpression:()=>R8,hasSignalsSyntax:()=>p$,findMarkupIndexOutsideScripts:()=>m$,extractExports:()=>T8,convertSignalLoopsToAttributes:()=>P7,convertSignalDirectivesToAttributes:()=>S7});function A8($,Z={}){let Y=[];for(let J of K7($,H1)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let G=X[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=X[0].length,q=J.token.length-Q[0].length;Y.push({fullMatch:J.token,attrs:G,body:J.token.slice(K,q),start:J.start,end:J.end})}return Y}function R8($){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}=O8(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}=O8(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function O8($){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 p$($){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*\(/,/\buseId\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 sG($){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 rG($){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 aG($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function F8($,Z,Y){if(!$)return!1;let J=aG($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(J))!==null){let j=q[1];if(J.slice(0,q.index).trimEnd().endsWith("."))continue;if(L8.has(j))continue;if(Z.has(j))X=!0;else if(Y&&j 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 j=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(L8.has(j)||Y&&j in Y)continue;G=!0}return(X||G)&&!Q}function u$($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,""")}"`,X=$.trim(),Q=X.match(w8);if(Q&&tG(Q[3],Q[1])){let[,G,K,q]=Q;return`<${G}${K}${J}>${q}</${G}>`}return`<template${J}>${X}</template>`}function tG($,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 S7($,Z){let Y=rG($);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,j=W;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")")U--;j++}if(U!==0)continue;let B=Q.substring(W,j-1).trim(),_=j,H=1,L=_,V=/@(if\s*\(|endif)/g;V.lastIndex=_;let O;while((O=V.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 F=Q.substring(_,L-6).trim(),w;if(sG(F)){let A=c5(Q.substring(z,L));if(A.length===0)continue;let R=A[0].branches.filter((M)=>M.type!=="else");if(!(R.length>0&&R.every((M)=>F8(M.condition,Y,Z))))continue;w=A[0].branches.map((M)=>{let I=J(M.content);if(M.type==="elseif")return u$(I,"@else-if",M.condition??"");if(M.type==="else")return u$(I,"@else");return u$(I,"@if",M.condition??"")}).join(`
|
|
7324
|
+
`)}else{if(!F8(B,Y,Z))continue;w=u$(J(F),"@if",B)}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:j}=q[z];Q=Q.substring(0,W)+j+Q.substring(U)}return Q}return J($)}function eG($){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 $K($,Z,Y,J){if(b7.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 B=$.indexOf("-->",q+4);if(B===-1)return-1;q=B+3;continue}let W=/^<(script|style)\b/i.exec($.slice(q,q+8));if(W){let B=$.indexOf(">",q);if(B===-1)return-1;if($[B-1]==="/"){q=B+1;continue}let _=Q.indexOf(`</${W[1].toLowerCase()}`,q);if(_===-1)return-1;let H=$.indexOf(">",_);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!B){q++;continue}if(B[1].toLowerCase()===X){if(K--,q+=B[0].length,K===0)return q;continue}q+=B[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!U){q++;continue}let j=$.indexOf(">",q);if(j===-1)return-1;if(U[1].toLowerCase()===X){let B=$.slice(q,j+1);if(!(/\/\s*>$/.test(B)||b7.has(X)))K++}q=j+1}return-1}function YK($,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 ZK.test(Q)}function y7($){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(([j,B])=>U>=j&&U<B),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(X(K.index))continue;let[U,j,B,_,H,L,V]=K,O=eG(H);if(O===void 0)continue;let F=K.index,w=F+U.length,N=!!V||/\/\s*>$/.test(U)||b7.has(j.toLowerCase())?w:$K($,F,j,w);if(N===-1)continue;if((_===":if"||_==="x-if"||_==="@if")&&YK($,N)){Q.lastIndex=w;continue}if(O===!0){let M=`<${j}${B}${L}${V}>`;G.push({start:F,end:w,replacement:M});continue}G.push({start:F,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((U,j)=>U.start-j.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:j,end:B,replacement:_}=q[U];W=W.substring(0,j)+_+W.substring(B)}return W}function P7($,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(),j=W,B=R8(U);if(B.iterable){let R=B.iterable.trim();if(R.startsWith("[")||R.startsWith("{")||R.startsWith("'")||R.startsWith('"')||R.startsWith("`")||/^-?\d/.test(R))continue;if(Z){let N=R.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let _=G==="for"?"@endfor":"@endforeach",H=1,L=j,V=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");V.lastIndex=j;let O;while((O=V.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 F=Y.substring(j,L-_.length).trim(),w=F.match(w8),A;if(w){let[,R,N,T]=w;A=`<${R}${N} @for="${U}">${T}</${R}>`}else A=`<template @for="${U}">${F}</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 JK($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(W)=>{let U=J+1;while(U<Q){let j=$[U];if(j==="\\"){U+=2;continue}if(j===W)return U+1;U++}return Q},K=()=>{let W=J+2;while(W<Q&&$[W]!==`
|
|
7325
|
+
`)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,j=0;while(U<Q){let B=$[U];if(B==="/"&&$[U+1]==="/"){let _=U+2;while(_<Q&&$[_]!==`
|
|
7326
|
+
`)_++;U=_;continue}if(B==="/"&&$[U+1]==="*"){let _=U+2;while(_<Q-1&&!($[_]==="*"&&$[_+1]==="/"))_++;U=_+2;continue}if(B==='"'||B==="'"||B==="`"){let _=U+1;while(_<Q){if($[_]==="\\"){_+=2;continue}if($[_]===B){_++;break}_++}U=_;continue}if(B==="("||B==="["||B==="{"){j++,U++;continue}if(B===")"||B==="]"||B==="}"){j--,U++;continue}if(B===";"&&j===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 B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let _=B[2],H=z(J+B[0].length);if(Z.has(_)){Y.push(`/* stx: deduped const ${_} */`),J=H;continue}Z.add(_),Y.push($.slice(J,H)),J=H;continue}}}Y.push(W),J++}return Y.join("")}async function N8($,Z,Y){let J=A8($,{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|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let L of J){let V=L.body;if(y1(L.attrs))V=P1(V);if(X.test(V))Q.push({fullMatch:L.fullMatch,attrs:L.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${oG++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (b5(),k5)),z=[];for(let L=0;L<Q.length;L++){let V=Q[L].content;if(V=a1(V).code,K(V))console.log("[stx:bundler] bundling signal script imports"),V=await q(V,Z||"",{projectRoot:process.cwd()});V=V.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,w)=>M8(w));let O=o0(V);z.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
|
|
7326
7327
|
${O}`)}let W=z.join(`
|
|
7327
7328
|
|
|
7328
|
-
`);W=
|
|
7329
|
+
`);W=JK(W);let U=T8(W),j=U.split(",").map((L)=>L.trim()).filter(Boolean),B=L$(W,Y),_=`
|
|
7329
7330
|
<script data-stx-scoped>
|
|
7330
7331
|
function ${G}() {
|
|
7331
|
-
${$5("const",
|
|
7332
|
-
${
|
|
7332
|
+
${$5("const",j)}
|
|
7333
|
+
${B}${W}
|
|
7333
7334
|
return { ${U} };
|
|
7334
7335
|
}
|
|
7335
7336
|
window.__stx_latestSetup=${G};
|
|
7336
7337
|
if(window.stx)window.stx._latestSetup=${G};
|
|
7337
|
-
</script>`,H=$;for(let L of Q)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${
|
|
7338
|
-
`)return;Q++}},z=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},W=(
|
|
7339
|
-
`)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},
|
|
7340
|
-
${X.slice(W)}`;else if(U!==-1){let
|
|
7341
|
-
${G}${X.slice(
|
|
7342
|
-
${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=m$(X,W);if(U!==-1){let
|
|
7343
|
-
`)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
|
|
7338
|
+
</script>`,H=$;for(let L of Q)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${H8})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],V=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${H8})>`,"gi"),(O,F,w)=>{if(V||L.includes(F.toLowerCase()))return O;return V=!0,`<${F}${w} data-stx="${G}">`})}return{output:H,setupCode:_}}function T8($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K="",q=()=>{Q++;let _=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!_){_=!0,Q++;continue}if(H==="]"&&_){_=!1,Q++;continue}if(H==="/"&&!_){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
|
|
7339
|
+
`)return;Q++}},z=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},W=(_)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===_){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 _=1;while(Q<G&&_>0)if(Z[Q]==="{")_++,Q++;else if(Z[Q]==="}")_--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')W(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},j=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
7340
|
+
`)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},B=()=>{if(X!==0)return;let _=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(_){let F=_[2];if(!J.has(F))Y.push(F),J.add(F);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((F)=>{let w=F.trim();if(!w)return;let A=w.indexOf(":"),N=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(N&&!J.has(N))Y.push(N),J.add(N)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((F)=>{let w=F.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let F=V[1];if(!J.has(F))Y.push(F),J.add(F);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!J.has(F))Y.push(F),J.add(F)}};while(Q<G){if(j())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])))B();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function C7($,Z,Y,J){if(!p$($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await N8(X,Y,J);if(X=Q,X=await _8(X,Z),X=B8(X),G){let W=m$(X,/<\/head>/i),U=W===-1?m$(X,/<body[^>]*>/i):-1;if(W!==-1)X=`${X.slice(0,W)}${G}
|
|
7341
|
+
${X.slice(W)}`;else if(U!==-1){let j=/<body[^>]*>/i.exec(X.slice(U))[0],B=U+j.length;X=`${X.slice(0,B)}
|
|
7342
|
+
${G}${X.slice(B)}`}else X=`${X}
|
|
7343
|
+
${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=m$(X,W);if(U!==-1){let j=X.slice(0,U),B=X.slice(U).replace(W,(_)=>_.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+B}}return X}function m$($,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 M8($){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 V8;return`var ${Z.join(", ")}; ${V8}`}var oG=0,H8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,w8,L8,b7,ZK,V8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var o5=b(()=>{C5();k$();h5();R0();C1();w8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;L8=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"]);b7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);ZK=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import XK from"fs";import g from"path";function I8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function GK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function y1($){return!GK($)}function P1($){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:p0()}).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 KK($){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]!==`
|
|
7344
|
+
`)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 _=W[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of _)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 _=U[2];if(!Y.has(_))Z.push(_),Y.add(_);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let _=j[1];if(!Y.has(_))Z.push(_),Y.add(_);return}let B=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!Y.has(_))Z.push(_),Y.add(_)}};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 qK($){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 zK($){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 WK($,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 qK(K)){let z=q.trim();if(!z||z.startsWith("..."))continue;let W=zK(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 j=z.slice(W+1).trim();if(!j)continue;try{let B=Object.keys(Z),_=Function(...B,`"use strict"; return (${j});`);Z[U]=_(...B.map((H)=>Z[H]))}catch{}}}catch{}}async function i$($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.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"?g.resolve(X.root):void 0,U=W??g.dirname(J),j=[],B=(L)=>{if(L&&!j.includes(L))j.push(L)},_=Y.__originalFilePath;if(_)B(g.join(g.dirname(_),"components"));B(Z),B(X._rootComponentsDir),B(g.join(g.dirname(J),"components")),B(X.componentsDir);let H=X._pluginComponentDirs;if(Array.isArray(H))for(let L of H)B(typeof L==="string"?L:null);if(W)B(g.resolve(W,"resources/views/components")),B(g.resolve(W,"resources/components")),B(g.resolve(W,"src/components")),B(g.resolve(W,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return o(g.resolve(g.dirname(J),`${Q}.stx`));for(let L of j){let V=g.isAbsolute(L)?L:g.resolve(U,L);for(let O of z)if(await o(g.join(V,O)))return!0}return!1}function UK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function jK($){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 BK($){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 h1($,Z,Y,J,X,Q,G,K=new Set,q){let{extractVariables:z}=await Promise.resolve().then(() => (l5(),D$)),W=K??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=j&&j!=="load"&&UK(j)?j:"";try{let _=(h)=>h.split("-").map((u)=>u.charAt(0).toUpperCase()+u.slice(1)).join(""),H=(h)=>h.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=X.__importedComponents;if(O){let h=[L,L.toLowerCase(),_(L),H(L)];for(let u of h)if(O.has(u)){V=O.get(u);break}}let F=[];if(!V){let h=[`${L}.stx`,`${_(L)}.stx`,`${H(L)}.stx`],u=[...new Set(h)],P=X.__originalFilePath,v=[];if(P){let j0=g.join(g.dirname(P),"components");v.push(j0)}if(J)v.push(J);let m=G._rootComponentsDir;if(typeof m==="string"&&!v.includes(m))v.push(m);let n=g.join(g.dirname(Q),"components");if(!v.includes(n))v.push(n);if(G.componentsDir&&G.componentsDir!==J&&!v.includes(G.componentsDir))v.push(G.componentsDir);let q0=G._pluginComponentDirs;if(Array.isArray(q0)){for(let j0 of q0)if(typeof j0==="string"&&!v.includes(j0))v.push(j0)}let H0=typeof G.root==="string"?g.resolve(G.root):void 0,k0=H0??g.dirname(Q),u0=[];if(H0)u0.push(g.resolve(H0,"resources/views/components")),u0.push(g.resolve(H0,"resources/components")),u0.push(g.resolve(H0,"src/components")),u0.push(g.resolve(H0,"components"));u0.push(g.resolve(import.meta.dir,"components"));for(let j0 of u0)if(!v.includes(j0))v.push(j0);let _$=[...new Set(v.map((j0)=>{if(!j0)return j0;return g.isAbsolute(j0)?j0:g.resolve(k0,j0)}))];if(v.length=0,v.push(..._$),L.startsWith("./")||L.startsWith("../"))V=g.resolve(g.dirname(Q),`${L}.stx`),F.push(V);else for(let j0 of v){if(!j0)continue;for(let j1 of u){let n0=g.join(j0,j1);if(F.push(n0),await o(n0)){V=n0;break}}if(V)break;if(!V)try{let j1=await import("fs");if(!j1.statSync(j0,{throwIfNoEntry:!1})?.isDirectory())continue;let E1=8,k1=[{path:j0,depth:0}];while(k1.length>0&&!V){let m0=k1.pop();if(m0.depth>=E1)continue;let t;try{t=j1.readdirSync(m0.path,{withFileTypes:!0})}catch{continue}for(let $1 of t){if(!$1.isDirectory())continue;if($1.name==="node_modules"||$1.name.startsWith("."))continue;let a4=g.join(m0.path,$1.name);for(let uX of u){let t4=g.join(a4,uX);if(F.push(t4),await o(t4)){V=t4;break}}if(V)break;k1.push({path:a4,depth:m0.depth+1})}}}catch{}if(V)break}}if(!V||!await o(V)){let h=F.length>0?`
|
|
7344
7345
|
Searched paths:
|
|
7345
7346
|
${F.map((u)=>` - ${u}`).join(`
|
|
7346
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${h}`}q.add(V);let w;if(c$.has(V))w=c$.get(V);else try{w=await Bun.file(V).text(),c$.set(V,w)}catch(h){return`[Error loading component: ${h instanceof Error?h.message:String(h)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),R={};for(let[h,u]of Object.entries(X))if(!h.startsWith("__")||A.has(h))R[h]=u;let{extractSlotContent:N}=await Promise.resolve().then(() => (w7(),V7)),T=N(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[h,u]of T.namedSlots)M[h]=u.content;let I={...R,...Z,props:Z,slot:Y,$slots:M,__processedComponents:U,__sections:{},...
|
|
7347
|
-
`)}`}if(Y&&p.includes("{{ text || slot }}"))p=p.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:W0}=await Promise.resolve().then(() => (w7(),V7)),{defaultSlot:
|
|
7347
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${h}`}q.add(V);let w;if(c$.has(V))w=c$.get(V);else try{w=await Bun.file(V).text(),c$.set(V,w)}catch(h){return`[Error loading component: ${h instanceof Error?h.message:String(h)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),R={};for(let[h,u]of Object.entries(X))if(!h.startsWith("__")||A.has(h))R[h]=u;let{extractSlotContent:N}=await Promise.resolve().then(() => (w7(),V7)),T=N(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[h,u]of T.namedSlots)M[h]=u.content;let I={...R,...Z,props:Z,slot:Y,$slots:M,__processedComponents:U,__sections:{},...jK(Y)&&{__stx_force_signals:!0}};WK(w,I);let E=w,D=T$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(y)],k=[];for(let h of S){let u=h[1]||"",P=h[2]||"",v=u.includes("server");if(y1(u)&&P.trim())P=P1(P);if(v&&P)try{await z(P,I,V)}catch(n){}if(!v){let n=P.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),q0=n.includes("{{")&&n.includes("}}"),H0=n.includes("{!!")&&n.includes("!!}");if(q0||H0)n=A$(n,I);let k0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${k0}>${n}</script>`)}}let C=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),x=C?C[1]:"",f=C?C[2]:"",d="",c=x&&/\bscoped\b/i.test(x);if(C)d=`<style${x}>${f}</style>`;let p=E;if(p=p.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),C)p=p.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let h=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(p=p.replace(h,(P,v)=>{let m=v.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(m)u.push(`<style${m[1]}>${m[2]}</style>`);return""}),p=p.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)d=`${d}${u.join(`
|
|
7348
|
+
`)}`}if(Y&&p.includes("{{ text || slot }}"))p=p.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:W0}=await Promise.resolve().then(() => (w7(),V7)),{defaultSlot:w0,namedSlots:_0}=T;p=await W0(p,w0,_0,I);for(let[h,u]of Object.entries(I))if(typeof u==="string"){if(u.includes("<")&&u.includes(">")||u.includes("<")||u.includes(""")){let P=q7(u);I[h]=P}}let J0=k.some((h)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(h)),I0=BK(k);if(I0.length>0)I.__stx_client_signal_names=I0;let i0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:J0||k.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let G1=await L0(p,I,V,i0,q),D1=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let h of G1.matchAll(/\{\{([\s\S]*?)\}\}/g))D1.add(h[1].trim());if(D1.size>0)X.__stx_preserved_client_expressions=[...D1];let l=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++QK}_${Math.random().toString(36).slice(2,8)}`,a=G1;if(J0){let h="";if(Object.keys(Z).length>0)try{h=` data-stx-props="${I8(JSON.stringify(Z))}"`}catch{}let u=B?` stx-hydrate="${I8(B)}"`:"";a=`<div data-stx-scope="${l}"${h}${u}>${G1}</div>`;let P=await Promise.all(k.map(async(v)=>{let m=v.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!m)return v;let[,n,q0]=m,H0=H$(q0,{filePath:V,projectRoot:process.cwd()}),k0=H0.code,u0=O$(H0.styles);k0=a1(k0).code;let{hasUserImports:_$,bundleClientScript:j0}=await Promise.resolve().then(() => (b5(),k5));if(_$(k0))k0=await j0(k0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:j1}=await Promise.resolve().then(() => (o5(),l$));k0=k0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(m0,t)=>j1(t));let n0=o0(k0),E1=KK(n0),k1=`
|
|
7348
7349
|
(function() {
|
|
7349
|
-
${$5("const",[...
|
|
7350
|
+
${$5("const",[...P9,...E1],n0)}
|
|
7350
7351
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
7351
7352
|
const __scopeVars = __scope['${l}'] = __scope['${l}'] || {};
|
|
7352
7353
|
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
@@ -7373,15 +7374,15 @@ catch (e) {}
|
|
|
7373
7374
|
finally {
|
|
7374
7375
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
7375
7376
|
}
|
|
7376
|
-
})();`;if(
|
|
7377
|
+
})();`;if(B)return`${u0}<script type="stx/island" data-stx-island="${l}" data-stx-scoped${n}>${k1}</script>`;return`${u0}<script data-stx-scoped${n}>${k1}</script>`}));if(a=a+`
|
|
7377
7378
|
`+P.join(`
|
|
7378
7379
|
`),d)a+=`
|
|
7379
7380
|
`+d}else{if(d)a+=`
|
|
7380
7381
|
`+d;if(k.length>0){let h=I.__stx_event_bindings||[],u=y5(I),P=await Promise.all(k.map(async(v)=>{let m=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!m)return v;return await P5(m[1],{eventBindings:h,templateContent:a,filePath:V,projectRoot:process.cwd(),serverData:u})}));a+=`
|
|
7381
7382
|
`+P.join(`
|
|
7382
|
-
`),I.__stx_event_bindings=[]}}if(c){let h=N$(a,V);if(h.hasScoped)a=h.html}return a}catch(
|
|
7383
|
-
`),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,
|
|
7384
|
-
`);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return
|
|
7383
|
+
`),I.__stx_event_bindings=[]}}if(c){let h=N$(a,V);if(h.hasScoped)a=h.html}return a}catch(_){return`[Error processing component: ${_ instanceof Error?_.message:String(_)}]`}finally{W.delete($)}}async function o($){return Bun.file($).exists()}function v7($,Z){let Y=g.resolve(Z),J=g.resolve($),X=Y.endsWith(g.sep)?Y:Y+g.sep;if(J===Y||J.startsWith(X))return J;return null}async function x7($,Z,Y,J){let X=await _K($,Z,Y,J);if(X===null)return null;let Q=v7(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=g.isAbsolute(K)?K:g.resolve(process.cwd(),K);if(v7(X,q))return g.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function _K($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=g.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=g.join(Q,$),B=v7(j,Q);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${B}`);if(await o(B)&&J)J.add(B);return B}let G=g.join(X,$);if(await o(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 j of[".stx",".tsx",".jsx"]){let B=`${G}${j}`;if(await o(B)){if(Y.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let K="",q=g.resolve(X),z=process.cwd();for(let j=0;j<10;j++){let B=g.join(q,"layouts"),_=!1;try{_=XK.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(_){K=B;break}let H=g.dirname(q);if(H===q||H.length<z.length)break;q=H}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,B=g.join(K,j);if(await o(B)){if(Y.debug)console.log(`Found in current layouts dir: ${B}`);if(J)J.add(B);return B}if(!j.endsWith(".stx")){let _=`${B}.stx`;if(await o(_)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}if(Y.layoutsDir){let j=g.isAbsolute(Y.layoutsDir)?Y.layoutsDir:g.resolve(process.cwd(),Y.layoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,_=g.join(j,B);if(await o(_)){if(Y.debug)console.log(`Found in options.layoutsDir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let H=`${_}.stx`;if(await o(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 j=$.split("layouts/"),B=g.join(Y.partialsDir||X,"layouts",j[1]);if(await o(B)){if(Y.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let _=`${B}.stx`;if(await o(_)){if(Y.debug)console.log(`Found in layouts path with extension: ${_}`);if(J)J.add(_);return _}}}if(Y.partialsDir){if(K=g.join(Y.partialsDir,"layouts"),await o(K)){let j=g.join(K,$);if(await o(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await o(B)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}}let W=Y.partialsDir||g.join(process.cwd(),"views"),U=g.join(W,$);if(await o(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await o(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(J)J.add(j);return j}}if(X.includes("temp")){let j=g.join(g.dirname(X),"layouts",$);if(await o(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await o(B)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}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 D8($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
7384
|
+
`),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,j)=>{let B=z+j+1;return`${B===J?"> ":" "}${B}: ${U}`}).join(`
|
|
7385
|
+
`);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return D8($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function z0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=D8(J,X,Q),q=Y.split("/").pop(),z=0;if(typeof X==="number"&&X>=0&&J){let U=J.lastIndexOf(`
|
|
7385
7386
|
`,Math.max(0,X-1));z=X-(U+1)+1}let W="";if(G>0)W+=`
|
|
7386
7387
|
${Y}:${G}${z>0?`:${z}`:""}: ${$.toLowerCase()} error: ${Z}
|
|
7387
7388
|
`;if(W+=`
|
|
@@ -7394,8 +7395,8 @@ ${$0.yellow}${$0.bold}Message:${$0.reset} ${Z}
|
|
|
7394
7395
|
`,K)W+=`
|
|
7395
7396
|
${$0.blue}${$0.bold}Context:${$0.reset}
|
|
7396
7397
|
${$0.dim}${K}${$0.reset}
|
|
7397
|
-
`;return W}function
|
|
7398
|
-
`||O==="\r"||O===" "||O===void 0)U++;
|
|
7398
|
+
`;return W}function j8(){c$.clear()}var c$,QK=0,$0;var R0=b(()=>{C5();Y1();h5();J5();n$();b1();j7();B7();u9();l5();c$=new d5(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 E8($,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,j=W,B=-1;while(U>0&&j<$.length){let L=$.indexOf("@markdown",j),V=$.indexOf("@endmarkdown",j);if(V===-1)break;if(L!==-1&&L<V&&L!==K){let O=$[L+9];if(O==="("||O===`
|
|
7399
|
+
`||O==="\r"||O===" "||O===void 0)U++;j=L+9}else{if(U--,U===0){B=V;break}j=V+12}}if(B===-1)continue;let _=$.slice(W,B),H=$.slice(K,B+12);X.push({fullMatch:H,options:z,content:_,index:K}),Q.lastIndex=B+12}for(let{fullMatch:K,options:q,content:z,index:W}of X)try{let U={};if(q)q.split(",").forEach((_)=>{let H=_.trim();if(H)U[H]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},B=E5(z.trim(),j);J=J.split(K).join(B)}catch(U){let j=U instanceof Error?U.message:String(U),B=z0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,W,K);J=J.split(K).join(B)}return J}async function k8($,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}),E5($.trim(),X)}var f7=b(()=>{R0()});function LK($){if(HK.set($.name,$),$.client)OK.set($.name,$.client)}function o$($){return LK($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=FK(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 FK($,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 HK,OK;var g7=b(()=>{HK=new Map,OK=new Map});function h7($,Z=K5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${r5($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function b8($,Z,Y=VK,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${r5($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function d7($,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 r5($,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 u7($){return wK[$]||"application/octet-stream"}var K5,VK,s5,wK;var m7=b(()=>{K5=[320,480,640,768,1024,1280,1536,1920,2560],VK=[1,1.5,2,3],s5=["avif","webp","jpeg"],wK={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function RK(){try{return await import("ts-images")}catch{return null}}async function NK($,Z={}){let Y={...AK,...Z},J=await RK();if(J)try{return await TK($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return MK($,Y)}async function TK($,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 MK($,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 S8($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
|
|
7399
7400
|
#${$} {
|
|
7400
7401
|
--stx-img-transition-duration: ${J}ms;
|
|
7401
7402
|
--stx-img-transition-easing: ${X};
|
|
@@ -7412,7 +7413,7 @@ ${$0.dim}${K}${$0.reset}
|
|
|
7412
7413
|
#${$}.stx-img-loaded img {
|
|
7413
7414
|
opacity: 1;
|
|
7414
7415
|
}
|
|
7415
|
-
`.trim()}async function
|
|
7416
|
+
`.trim()}async function y8($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(p7.has(Y))return p7.get(Y);let J=await NK($,Z);return p7.set(Y,J),J}var AK,l7,p7;var P8=b(()=>{AK={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},l7=`
|
|
7416
7417
|
.stx-img-placeholder {
|
|
7417
7418
|
position: relative;
|
|
7418
7419
|
overflow: hidden;
|
|
@@ -7441,8 +7442,8 @@ ${$0.dim}${K}${$0.reset}
|
|
|
7441
7442
|
filter: blur(0);
|
|
7442
7443
|
transform: scale(1);
|
|
7443
7444
|
}
|
|
7444
|
-
`.trim();p7=new Map});import{createHash as P8}from"crypto";import{readFile as TK,stat as C8}from"fs/promises";async function b0($){try{let Z=await TK($);return P8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function y8($){return P8("sha256").update($).digest("hex").slice(0,16)}function s$($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${y8($)}-${y8(Y)}`}async function c7($){try{return(await C8($)).mtimeMs}catch{return 0}}async function D0($){try{return await C8($),!0}catch{return!1}}var d1=()=>{};import{mkdir as MK,readFile as IK,writeFile as DK,readdir as sH,rm as EK,stat as rH}from"fs/promises";import{join as x8,dirname as kK}from"path";async function bK($){try{await MK($,{recursive:!0})}catch{}}function f8($,Z,Y){return x8($,Y,`${Z}.json`)}async function v8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await c7(Z)!==$.srcMtime)return!1;return!0}async function r$($,Z,Y,J=i7){if(!J.enabled)return null;let X=s$($,Z),Q=q5.get(X);if(Q){if(await v8(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;q5.delete(X)}let G=f8(J.directory,X,Y);if(await D0(G))try{let K=await IK(G,"utf-8"),q=JSON.parse(K);if(await v8(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),q5.set(X,q),q.data}catch{}return null}async function a$($,Z,Y,J,X=i7){if(!X.enabled)return;let Q=s$($,Z),G=await b0($),K=await c7($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:s$("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};q5.set(Q,q);let z=f8(X.directory,Q,J);try{await bK(kK(z)),await DK(z,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function t$($,Z=i7){if($==="all")q5.clear();else q5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=x8(Z.directory,J);try{await EK(X,{recursive:!0,force:!0})}catch{}}}var q5,i7;var n7=b(()=>{d1();q5=new Map,i7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class $4{config;constructor($={}){this.config={...SK,...$}}async get($,Z){return r$($,Z,"image",this.config)}async set($,Z,Y){return a$($,Z,Y,"image",this.config)}async clear(){return t$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function o7($){if(!e$)e$=new $4($);else if($)e$.updateConfig($);return e$}async function Z4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return o7(J).get($,Z)}async function Y4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return o7(X).set($,Z,Y)}async function g8(){return o7().clear()}var SK,e$=null;var s7=b(()=>{n7();SK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as yK,basename as PK,extname as CK,join as vK}from"path";import{mkdir as xK}from"fs/promises";async function r7(){try{return await import("ts-images")}catch{return null}}function h8($){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 fK($,Z){let Y=Z?h8(Z):h8("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 r7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await Z4($,Z,Y);if(X)return X;try{let Q=yK($);if(!await D0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=fK(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await xK(K,{recursive:!0});let z=await b0(Q),W=PK($,CK($)),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 a7(Q,Z.transformations,J);for(let j of U){let H=G[j]||{},L=`${W}-${z}.${j}`,V=vK(K,L);try{let O=await J.optimizeImage({input:_||Q,output:V,format:j,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: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 Y4($,Z,B,Y),B}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function u8($,Z,Y,J){let X=await r7();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 a7($,Z,Y){let J=Y||await r7();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 m8=b(()=>{d1();s7()});import{resolve as gK,basename as hK,extname as dK,join as uK}from"path";import{mkdir as mK}from"fs/promises";async function pK(){try{return await import("ts-images")}catch{return null}}async function p8($,Z,Y){let J=await pK();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=gK($);if(!await D0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||lK,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await mK(K,{recursive:!0});let z=await b0(X),W=hK($,dK($)),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 V=`${W}-${L}w-${z}.${j}`,O=uK(K,V),F=`${q}/${V}`;try{let w=U[j]?.quality||80;if(await D0(O)){B.byFormat[j].push({path:O,url:F,width:L,height:0,format:j,size:0}),H.push(`${F} ${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:F,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${F} ${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||cK(Q),B}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function cK($){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 l8($,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 lK;var c8=b(()=>{d1();lK=[320,480,640,768,1024,1280,1536,1920]});var i8={};e(i8,{setCachedImageResult:()=>Y4,processImage:()=>d8,optimizeImage:()=>u8,getCachedImageResult:()=>Z4,generateSrcset:()=>l8,generateResponsiveVariants:()=>p8,clearImageCache:()=>g8,applyTransformations:()=>a7,ImageProcessorCache:()=>$4});var n8=b(()=>{m8();c8();s7()});async function iK(){try{return await Promise.resolve().then(() => (n8(),i8))}catch($){if(!o8)console.warn("[stx-media] Image processor not available, some features disabled:",$),o8=!0;return null}}async function J4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return rK(J,Y)}if(Y.processedResult?.processed)return Z3($,Y.processedResult,Z);if(Y.responsiveVariants)return t8($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:q,widths:z=K5,dpr:W,formats:U=s5,quality:B=t7,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:V=!1,loading:O=V?"eager":Q4,decoding:F=X4,fetchpriority:w,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return sK($);let k,C,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!V)try{k=await b8(X,{strategy:j,...H}),C=k8(x,k,H)}catch{}let f=W!==void 0&&G!==void 0,d;if(f)d=oK($,x,k,Z);else d=await nK($,x,k,Z);let c;if(V){let V0=U.includes("webp")?"webp":U[0],j0=h7(X,z,{..._,q:B},V0),J0=typeof q==="object"?d7(q):q||"100vw";c=`<link rel="preload" as="image" imagesrcset="${j0}" imagesizes="${J0}" />`}let p=[];if(!s8&&j!=="none")p.push(l7),s8=!0;if(C)p.push(C);let W0=L?a8(x):void 0;return{html:d,preloadLink:c,css:p.length>0?p.join(`
|
|
7445
|
-
`):void 0,script:W0}}async function
|
|
7445
|
+
`.trim();p7=new Map});import{createHash as v8}from"crypto";import{readFile as IK,stat as x8}from"fs/promises";async function b0($){try{let Z=await IK($);return v8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function C8($){return v8("sha256").update($).digest("hex").slice(0,16)}function s$($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${C8($)}-${C8(Y)}`}async function c7($){try{return(await x8($)).mtimeMs}catch{return 0}}async function D0($){try{return await x8($),!0}catch{return!1}}var d1=()=>{};import{mkdir as DK,readFile as EK,writeFile as kK,readdir as aH,rm as bK,stat as tH}from"fs/promises";import{join as g8,dirname as SK}from"path";async function yK($){try{await DK($,{recursive:!0})}catch{}}function h8($,Z,Y){return g8($,Y,`${Z}.json`)}async function f8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await c7(Z)!==$.srcMtime)return!1;return!0}async function r$($,Z,Y,J=i7){if(!J.enabled)return null;let X=s$($,Z),Q=q5.get(X);if(Q){if(await f8(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;q5.delete(X)}let G=h8(J.directory,X,Y);if(await D0(G))try{let K=await EK(G,"utf-8"),q=JSON.parse(K);if(await f8(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),q5.set(X,q),q.data}catch{}return null}async function a$($,Z,Y,J,X=i7){if(!X.enabled)return;let Q=s$($,Z),G=await b0($),K=await c7($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:s$("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};q5.set(Q,q);let z=h8(X.directory,Q,J);try{await yK(SK(z)),await kK(z,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function t$($,Z=i7){if($==="all")q5.clear();else q5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=g8(Z.directory,J);try{await bK(X,{recursive:!0,force:!0})}catch{}}}var q5,i7;var n7=b(()=>{d1();q5=new Map,i7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class $4{config;constructor($={}){this.config={...PK,...$}}async get($,Z){return r$($,Z,"image",this.config)}async set($,Z,Y){return a$($,Z,Y,"image",this.config)}async clear(){return t$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function o7($){if(!e$)e$=new $4($);else if($)e$.updateConfig($);return e$}async function Z4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return o7(J).get($,Z)}async function Y4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return o7(X).set($,Z,Y)}async function d8(){return o7().clear()}var PK,e$=null;var s7=b(()=>{n7();PK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as CK,basename as vK,extname as xK,join as fK}from"path";import{mkdir as gK}from"fs/promises";async function r7(){try{return await import("ts-images")}catch{return null}}function u8($){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 hK($,Z){let Y=Z?u8(Z):u8("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 m8($,Z,Y){let J=await r7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await Z4($,Z,Y);if(X)return X;try{let Q=CK($);if(!await D0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=hK(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await gK(K,{recursive:!0});let z=await b0(Q),W=vK($,xK($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:z},B=null;if(Z.transformations&&Z.transformations.length>0)B=await a7(Q,Z.transformations,J);for(let _ of U){let H=G[_]||{},L=`${W}-${z}.${_}`,V=fK(K,L);try{let O=await J.optimizeImage({input:B||Q,output:V,format:_,quality:H.quality,progressive:H.progressive});if(O){if(j.variants.push({path:V,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:_,size:O.outputSize||0}),!j.originalWidth&&O.width)j.originalWidth=O.width,j.originalHeight=O.height}}catch(O){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${_}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let _=await J.generateThumbHash(Q);j.placeholder=_.dataUrl}catch(_){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${_}`)}if(Z.useDominantColor)try{let _=await J.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=_.dominantColor}catch(_){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${_}`)}return await Y4($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function p8($,Z,Y,J){let X=await r7();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 a7($,Z,Y){let J=Y||await r7();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 l8=b(()=>{d1();s7()});import{resolve as dK,basename as uK,extname as mK,join as pK}from"path";import{mkdir as lK}from"fs/promises";async function cK(){try{return await import("ts-images")}catch{return null}}async function c8($,Z,Y){let J=await cK();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=dK($);if(!await D0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||iK,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await lK(K,{recursive:!0});let z=await b0(X),W=uK($,mK($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let _ of G){j.byFormat[_]=[];let H=[];for(let L of Q){let V=`${W}-${L}w-${z}.${_}`,O=pK(K,V),F=`${q}/${V}`;try{let w=U[_]?.quality||80;if(await D0(O)){j.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)j.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}`)}}j.srcsets[_]=H.join(", ")}let B=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let _=await J.generateThumbHash(X);j.placeholder={dataURL:_.dataUrl,width:_.width||32,height:_.height||32,strategy:"thumbhash"}}else{let _=await J.generatePlaceholder(X,{strategy:B,width:20});j.placeholder={dataURL:_.dataURL,width:_.width,height:_.height,strategy:B}}}catch(_){console.warn(`[stx-media] Failed to generate placeholder: ${_}`)}return j.sizes=Z.sizes||nK(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function nK($){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 i8($,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 iK;var n8=b(()=>{d1();iK=[320,480,640,768,1024,1280,1536,1920]});var o8={};e(o8,{setCachedImageResult:()=>Y4,processImage:()=>m8,optimizeImage:()=>p8,getCachedImageResult:()=>Z4,generateSrcset:()=>i8,generateResponsiveVariants:()=>c8,clearImageCache:()=>d8,applyTransformations:()=>a7,ImageProcessorCache:()=>$4});var s8=b(()=>{l8();n8();s7()});async function oK(){try{return await Promise.resolve().then(() => (s8(),o8))}catch($){if(!r8)console.warn("[stx-media] Image processor not available, some features disabled:",$),r8=!0;return null}}async function J4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return tK(J,Y)}if(Y.processedResult?.processed)return Z3($,Y.processedResult,Z);if(Y.responsiveVariants)return $Z($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:q,widths:z=K5,dpr:W,formats:U=s5,quality:j=t7,params:B={},placeholder:_="none",placeholderOptions:H={},lazy:L=!0,priority:V=!1,loading:O=V?"eager":Q4,decoding:F=X4,fetchpriority:w,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return aK($);let k,C,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(_!=="none"&&!V)try{k=await y8(X,{strategy:_,...H}),C=S8(x,k,H)}catch{}let f=W!==void 0&&G!==void 0,d;if(f)d=rK($,x,k,Z);else d=await sK($,x,k,Z);let c;if(V){let w0=U.includes("webp")?"webp":U[0],_0=h7(X,z,{...B,q:j},w0),J0=typeof q==="object"?d7(q):q||"100vw";c=`<link rel="preload" as="image" imagesrcset="${_0}" imagesizes="${J0}" />`}let p=[];if(!a8&&_!=="none")p.push(l7),a8=!0;if(C)p.push(C);let W0=L?e8(x):void 0;return{html:d,preloadLink:c,css:p.length>0?p.join(`
|
|
7446
|
+
`):void 0,script:W0}}async function sK($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:q,widths:z=K5,formats:W=s5,quality:U=t7,params:j={},lazy:B=!0,priority:_=!1,loading:H=_?"eager":Q4,decoding:L=X4,fetchpriority:V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:A}=$,R=$.class,N=$.style,T=$.data||{},M=typeof q==="object"?d7(q):q||"100vw",I=[];for(let y of W){let S=h7(X,z,{...j,q:U},y),k=u7(y);if(B&&!_)I.push(` <source type="${k}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${k}" srcset="${S}" sizes="${M}" />`)}let E=e7({src:r5(X,{...j,q:U}),alt:Q,width:G,height:K,loading:_?void 0:H,decoding:L,fetchpriority:_?"high":V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:A,className:t8(R,Y),style:$3(N,O,F,Y),lazy:B&&!_,data:T}),D;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
|
|
7446
7447
|
<picture>
|
|
7447
7448
|
${I.join(`
|
|
7448
7449
|
`)}
|
|
@@ -7452,9 +7453,9 @@ ${I.join(`
|
|
|
7452
7453
|
${I.join(`
|
|
7453
7454
|
`)}
|
|
7454
7455
|
<img ${E} />
|
|
7455
|
-
</picture>`;return D}function
|
|
7456
|
+
</picture>`;return D}function rK($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,dpr:q=[1,2,3],quality:z=t7,params:W={},lazy:U=!0,priority:j=!1,loading:B=j?"eager":Q4,decoding:_=X4,fetchpriority:H,objectFit:L,objectPosition:V,crossorigin:O,referrerpolicy:F}=$,w=$.class,A=$.style,R=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=b8(X,N,q,{...W,q:z}),M=e7({src:r5(X,{...W,w:N,q:z}),alt:Q,width:G,height:K,loading:j?void 0:B,decoding:_,fetchpriority:j?"high":H,objectFit:L,objectPosition:V,crossorigin:O,referrerpolicy:F,className:t8(w,Y),style:$3(A,L,V,Y),lazy:U&&!j,data:R}),I=U&&!j?`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}">
|
|
7456
7457
|
<img ${M} ${I} />
|
|
7457
|
-
</div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function
|
|
7458
|
+
</div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function aK($){let{src:Z,alt:Y,width:J,height:X,loading:Q=Q4,decoding:G=X4,fetchpriority:K,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U,priority:j=!1}=$,B=$.class,_=$.style,H=$.id,L=$.data||{};return{html:`<img ${e7({src:Z,alt:Y,width:J,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U,className:B,style:$3(_,q,z),id:H,data:L})} />`}}function e7($){let Z=[];if($.lazy)Z.push(`data-src="${r0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${r0($.src)}"`);if(Z.push(`alt="${r0($.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="${r0($.className)}"`);if($.style)Z.push(`style="${r0($.style)}"`);if($.id)Z.push(`id="${r0($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${r0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function t8($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function $3($,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 r0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function e8($){return`
|
|
7458
7459
|
(function() {
|
|
7459
7460
|
const container = document.getElementById('${$}');
|
|
7460
7461
|
if (!container) return;
|
|
@@ -7491,22 +7492,22 @@ ${I.join(`
|
|
|
7491
7492
|
|
|
7492
7493
|
observer.observe(container);
|
|
7493
7494
|
})();
|
|
7494
|
-
`.trim()}async function
|
|
7495
|
+
`.trim()}async function tK($,Z){let Y=await oK();if(!Y)return J4({...$,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 $Z($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return Z3($,Q,Z)}return J4({...$,process:!1},Z)}async function Z3($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U}=$,j=$.class,B=$.style,_=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],V=L.find((C)=>C.format==="jpeg")||L.find((C)=>C.format==="webp")||L[0],O=V?.url||$.src,F=L.filter((C)=>C.format===(V?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of L){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let A=[],R=["avif","webp","jpeg","png"];for(let C of R){let x=w.get(C);if(x&&x.length>0){let f=x.map((c)=>`${c.url} ${c.width}w`).join(", "),d=u7(C);if(G&&!K)A.push(` <source type="${d}" data-srcset="${f}" />`);else A.push(` <source type="${d}" srcset="${f}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${r0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${r0(O)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${r0(J)}"`);let T=X||Z.originalWidth,M=Q||Z.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(W)N.push(`crossorigin="${W}"`);if(U)N.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(B)I.push(B);if(I.length>0)N.push(`style="${I.join("; ")}"`);let E=[];if(j)E.push(j);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[C,x]of Object.entries(H))N.push(`data-${C}="${r0(x)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${_}" class="stx-img-placeholder" style="${C}">
|
|
7495
7496
|
<picture>
|
|
7496
7497
|
${A.join(`
|
|
7497
7498
|
`)}
|
|
7498
7499
|
<img ${N.join(" ")} />
|
|
7499
7500
|
</picture>
|
|
7500
|
-
</div>`}else D=`<picture${
|
|
7501
|
+
</div>`}else D=`<picture${_?` id="${_}"`:""}>
|
|
7501
7502
|
${A.join(`
|
|
7502
7503
|
`)}
|
|
7503
7504
|
<img ${N.join(" ")} />
|
|
7504
|
-
</picture>`;let y=[];if(Z.placeholder)y.push(l7);let S=G?
|
|
7505
|
-
`):void 0,script:S}}async function
|
|
7505
|
+
</picture>`;let y=[];if(Z.placeholder)y.push(l7);let S=G?e8(_):void 0,k;if(K&&F)k=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:D,preloadLink:k,css:y.length>0?y.join(`
|
|
7506
|
+
`):void 0,script:S}}async function $Z($,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 Z3($,J,Y)}var r8=!1,t7=80,X4="async",Q4="lazy",a8=!1;var ZZ=b(()=>{m7();P8()});function eK(){return o$({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}=$q($,Z,Y);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||K5,formats:G.formats||s5,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 J4(K,{isDev:q}),W=z.html;if(z.preloadLink)W=z.preloadLink+`
|
|
7506
7507
|
`+W;if(z.css)W+=`
|
|
7507
7508
|
<style>${z.css}</style>`;if(z.script)W+=`
|
|
7508
|
-
<script>${z.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function
|
|
7509
|
-
`)}async function H4($,Z,Y,J,X){let Q=await
|
|
7509
|
+
<script>${z.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function $q($,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=Zq(J),Q=Y3(X[0],Y)||"",G=Y3(X[1],Y)||"",K={};if(X[2]){let q=Y3(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 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 Y3($,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 YZ;var JZ=b(()=>{g7();ZZ();m7();YZ=eK()});class K4{config;constructor($={}){this.config={...Yq,...$}}async get($,Z){return r$($,Z,"video",this.config)}async set($,Z,Y){return a$($,Z,Y,"video",this.config)}async clear(){return t$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function J3($){if(!G4)G4=new K4($);else if($)G4.updateConfig($);return G4}async function q4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return J3(J).get($,Z)}async function z4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return J3(X).set($,Z,Y)}async function XZ(){return J3().clear()}var Yq,G4=null;var X3=b(()=>{n7();Yq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as Q3,basename as G3,extname as K3,join as W4}from"path";import{mkdir as q3}from"fs/promises";async function z3(){try{return await import("ts-videos")}catch{return null}}async function U4($,Z,Y,J){let X=await z3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=Q3($);if(!await D0(Q))return null;await q3(Y,{recursive:!0});let G=await b0(Q),K=G3($,K3($)),q=Z.format||"webp",z=Z.timestamp||0,W=`${K}-poster-${G}.${q}`,U=W4(Y,W),j=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(j&&j.length>0){let B=j[0];return{path:U,url:`${J}/${W}`,width:B.width||Z.width||1280,height:B.height||720,timestamp:z,size:B.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function j4($,Z,Y,J){let X=await z3();if(!X)return[];try{let Q=Q3($);if(!await D0(Q))return[];await q3(Y,{recursive:!0});let G=await b0(Q),K=G3($,K3($)),q=Z.format||"webp",U=(await new X.Input(Q).getInfo()).duration||60,j=Z.count||10,B=Z.interval||U/j,_=[];for(let L=0;L<j&&L*B<U;L++)_.push(L*B);let H=await X.extractThumbnails(Q,{timestamps:_,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,V)=>({path:L.path||W4(Y,`${K}-thumb-${G}-${V}.${q}`),url:`${J}/${K}-thumb-${G}-${V}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:_[V],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function QZ($,Z,Y,J){let X=await z3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=Q3($);if(!await D0(Q))return null;await q3(Y,{recursive:!0});let G=await b0(Q),K=G3($,K3($)),W=(await new X.Input(Q).getInfo()).duration||60,U=Z.columns||10,j=Z.interval||5,B=Z.thumbnailWidth||160,_=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(W/j),V=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,F=W4(Y,O),w=[];for(let R=0;R<L;R++)w.push(R*j);let A=await X.extractThumbnails(Q,{timestamps:w,width:B,height:_,format:H,quality:Z.quality||70,outputDir:W4(Y,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=U*B,T=V*_,M=await R.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:F,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:F,columns:U,rows:V,thumbnailWidth:B,thumbnailHeight:_,interval:j,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 W3=b(()=>{d1()});import{resolve as KZ,basename as qZ,extname as zZ,join as u1}from"path";import{mkdir as B4,writeFile as WZ}from"fs/promises";async function UZ(){try{return await import("ts-videos")}catch{return null}}async function _4($,Z,Y,J,X){let Q=await UZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=KZ($);if(!await D0(G))return null;let K=await b0(G),q=qZ($,zZ($)),z=u1(Y,`${q}-${K}-hls`);await B4(z,{recursive:!0});let W=Z.length>0?Z:jZ,U=X?.segmentDuration||6,_=(await new Q.Input(G).getInfo()).duration||0,H=[],L=0;for(let F of W){let w=u1(z,F.label);await B4(w,{recursive:!0});let A=`${F.label}.m3u8`,R=u1(w,A);try{let N=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(N)H.push({quality:F,url:`${J}/${q}-${K}-hls/${F.label}/${A}`,path:R}),L+=N.segmentCount||Math.ceil(_/U)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(H.length===0)return null;let V=u1(z,"master.m3u8"),O=Jq(H,J,q,K);return await WZ(V,O),{manifestUrl:`${J}/${q}-${K}-hls/master.m3u8`,manifestPath:V,playlists:H,segmentCount:L,duration:_}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function Jq($,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(`
|
|
7510
|
+
`)}async function H4($,Z,Y,J,X){let Q=await UZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=KZ($);if(!await D0(G))return null;let K=await b0(G),q=qZ($,zZ($)),z=u1(Y,`${q}-${K}-dash`);await B4(z,{recursive:!0});let W=Z.length>0?Z:jZ,U=X?.segmentDuration||4,j=X?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,L=[],V=[];for(let A of W){let R=u1(z,A.label);await B4(R,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:R,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)V.push({bandwidth:A.audioBitrate,url:`${J}/${q}-${K}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(L.length===0)return null;let O=u1(z,"manifest.mpd"),F=Xq(L,V,H,U,j);await WZ(O,F);let w=[{type:"video",representations:L}];if(V.length>0)w.push({type:"audio",representations:V});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 Xq($,Z,Y,J,X){let Q=GZ(Y),G=GZ(X),K=`<?xml version="1.0" encoding="UTF-8"?>
|
|
7510
7511
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
7511
7512
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
7512
7513
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -7532,7 +7533,7 @@ ${A.join(`
|
|
|
7532
7533
|
</Representation>
|
|
7533
7534
|
`}K+=` </AdaptationSet>
|
|
7534
7535
|
`}return K+=` </Period>
|
|
7535
|
-
</MPD>`,K}function
|
|
7536
|
+
</MPD>`,K}function GZ($){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 jZ;var U3=b(()=>{d1();jZ=[{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 BZ,basename as Qq,extname as Gq,join as Kq}from"path";import{mkdir as qq}from"fs/promises";async function _Z(){try{return await import("ts-videos")}catch{return null}}function zq($){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 Wq($){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 j3($){let Z=await _Z();if(!Z)return null;try{let Y=BZ($),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 HZ($,Z,Y,J){let X=await _Z();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await q4($,Z,Y);if(Q)return Q;try{let G=BZ($);if(!await D0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await qq(K,{recursive:!0});let z=await b0(G),W=Qq($,Gq($)),U={src:$,processed:!0,hash:z};J?.({percentage:5,stage:"analyzing"}),U.metadata=await j3(G)||void 0;let j={};if(Z.quality)j.bitrate=zq(Z.quality);if(Z.platform)Object.assign(j,Wq(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let B=`${W}-${z}.mp4`,_=Kq(K,B);try{let H=await Uq(G,_,j,X,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:_,url:`${q}/${B}`,duration:H.duration,size:H.size,video:{codec:j.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.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 B=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},_=await U4(G,B,K,q);if(_)U.poster=_}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let B=await j4(G,Y.thumbnails,K,q);if(B.length>0)U.thumbnails=B}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let B=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let _=await _4(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(_)U.streaming={...U.streaming,hls:_}}if(B.format==="dash"){let _=await H4(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(_)U.streaming={...U.streaming,dash:_}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await z4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function Uq($,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 OZ=b(()=>{d1();X3();W3();U3()});var LZ={};e(LZ,{setCachedVideoResult:()=>z4,processVideo:()=>HZ,getCachedVideoResult:()=>q4,generateThumbnails:()=>j4,generateSpriteSheet:()=>QZ,generatePoster:()=>U4,generateHLSManifest:()=>_4,generateDASHManifest:()=>H4,clearVideoCache:()=>XZ,analyzeVideo:()=>j3,VideoProcessorCache:()=>K4});var FZ=b(()=>{OZ();W3();U3();X3()});async function wZ(){try{return await Promise.resolve().then(() => (FZ(),LZ))}catch($){if(!VZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),VZ=!0;return null}}async function O4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return Lq(J,Y)}if(Y.processedResult?.processed)return TZ($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await Fq(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:q,controls:z=AZ,autoplay:W=!1,muted:U=!1,loop:j=!1,preload:B=RZ,playsinline:_=!0,lazy:H=!0,player:L="native",type:V,width:O,height:F,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=X||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return _q($,Z);if(V&&V!=="video")return Bq(Q||"",V,$);let E=G.length>0?G:Q?[{src:Q,type:NZ(Q)}]:[],D=[`id="${I}"`];if(z)D.push("controls");if(W)D.push("autoplay");if(U)D.push("muted");if(j)D.push("loop");if(_)D.push("playsinline");if(A)D.push("disablepictureinpicture");if(R)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(H){if(D.push(`data-preload="${B}"`),D.push('preload="none"'),N)D.push(`data-poster="${A0(N)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${B}"`),N)D.push(`poster="${A0(N)}"`);if(O)D.push(`width="${O}"`);if(F)D.push(`height="${F}"`);if(T)D.push(`class="${A0(T)}"`);if(M)D.push(`style="${A0(M)}"`);let y=E.map((C)=>{return` <source ${H?`data-src="${A0(C.src)}"`:`src="${A0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
|
|
7536
7537
|
`),S=`<video ${D.join(" ")}>
|
|
7537
7538
|
${y}
|
|
7538
7539
|
Your browser does not support the video tag.
|
|
@@ -7571,12 +7572,12 @@ ${y}
|
|
|
7571
7572
|
|
|
7572
7573
|
observer.observe(video);
|
|
7573
7574
|
})();
|
|
7574
|
-
`.trim();return{html:S,script:k}}function
|
|
7575
|
+
`.trim();return{html:S,script:k}}function Bq($,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=Hq($),q=z?`https://www.youtube-nocookie.com/embed/${z}`:$;break;case"vimeo":z=Oq($),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="${A0(q)}"`,`width="${J}"`,`height="${X}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)W.push(`class="${A0(Q)}"`);if(G)W.push(`style="${A0(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;">
|
|
7575
7576
|
<iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
7576
|
-
</div>`}}function
|
|
7577
|
+
</div>`}}function _q($,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:j,height:B}=$,_=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,V={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",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",H||""].filter(Boolean).join("; "),F=`
|
|
7577
7578
|
<div
|
|
7578
7579
|
id="${L}"
|
|
7579
|
-
class="ts-video-player${
|
|
7580
|
+
class="ts-video-player${_?" "+A0(_):""}"
|
|
7580
7581
|
style="${O}"
|
|
7581
7582
|
data-ts-video-player
|
|
7582
7583
|
data-config='${JSON.stringify(V)}'
|
|
@@ -7610,7 +7611,7 @@ ${y}
|
|
|
7610
7611
|
|
|
7611
7612
|
// Load ts-video-player from CDN
|
|
7612
7613
|
var script = document.createElement('script');
|
|
7613
|
-
script.src = '${
|
|
7614
|
+
script.src = '${jq}';
|
|
7614
7615
|
script.onload = initPlayer;
|
|
7615
7616
|
script.onerror = function() {
|
|
7616
7617
|
console.error('[stx] Failed to load ts-video-player');
|
|
@@ -7740,7 +7741,7 @@ else {
|
|
|
7740
7741
|
.ts-video-player__play-button svg {
|
|
7741
7742
|
margin-left: 4px;
|
|
7742
7743
|
}
|
|
7743
|
-
`.trim();return{html:F,script:w,css:A}}function
|
|
7744
|
+
`.trim();return{html:F,script:w,css:A}}function NZ($){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 Hq($){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 Oq($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function A0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function Lq($,Z){let Y=await wZ();if(!Y)return O4({...$,process:!1},Z);let J=Z.tsVideosConfig,X=await Y.processVideo($.src,$,J,$.onProcessProgress);if(X.processed)return TZ($,X,Z);return O4({...$,process:!1},Z)}async function Fq($,Z){let Y=await wZ();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 TZ($,Z,Y){let{controls:J=AZ,autoplay:X=!1,muted:Q=!1,loop:G=!1,preload:K=RZ,playsinline:q=!0,lazy:z=!0,width:W,height:U,crossorigin:j,disablePictureInPicture:B=!1,disableRemotePlayback:_=!1}=$,H=$.class,L=$.style,V=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,F=NZ(O);if(Z.transcoded)O=Z.transcoded.url,F="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,F="application/dash+xml"}let A=Z.poster?.url||$.poster,R=[`id="${V}"`];if(J)R.push("controls");if(X)R.push("autoplay");if(Q)R.push("muted");if(G)R.push("loop");if(q)R.push("playsinline");if(B)R.push("disablepictureinpicture");if(_)R.push("disableremoteplayback");if(j)R.push(`crossorigin="${j}"`);if(z){if(R.push(`data-preload="${K}"`),R.push('preload="none"'),A)R.push(`data-poster="${A0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${K}"`),A)R.push(`poster="${A0(A)}"`);let N=W||Z.metadata?.width,T=U||Z.metadata?.height;if(N)R.push(`width="${N}"`);if(T)R.push(`height="${T}"`);if(H)R.push(`class="${A0(H)}"`);if(L)R.push(`style="${A0(L)}"`);let I=` <source ${z?`data-src="${A0(O)}"`:`src="${A0(O)}"`} type="${F}" />`,E=`<video ${R.join(" ")}>
|
|
7744
7745
|
${I}
|
|
7745
7746
|
Your browser does not support the video tag.
|
|
7746
7747
|
</video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${A0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
@@ -7789,9 +7790,9 @@ ${E}
|
|
|
7789
7790
|
width: 100%;
|
|
7790
7791
|
height: auto;
|
|
7791
7792
|
}
|
|
7792
|
-
`.trim();return{html:E,script:D,css:y}}var
|
|
7793
|
+
`.trim();return{html:E,script:D,css:y}}var VZ=!1,AZ=!0,RZ="metadata",jq="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var MZ=b(()=>{_3()});function IZ(){return o$({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}=Vq($,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 O4(G,q),W=z.html;if(z.css)W+=`
|
|
7793
7794
|
<style>${z.css}</style>`;if(z.script)W+=`
|
|
7794
|
-
<script>${z.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function
|
|
7795
|
+
<script>${z.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Vq($,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=wq(J),Q=DZ(X[0],Y)||"",G={};if(X[1]){let K=DZ(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 wq($){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 DZ($,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 B3;var _3=b(()=>{g7();MZ();B3=IZ()});function Aq($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
|
|
7795
7796
|
${$}
|
|
7796
7797
|
</div>
|
|
7797
7798
|
<script>
|
|
@@ -7836,7 +7837,7 @@ ${E}
|
|
|
7836
7837
|
}
|
|
7837
7838
|
}
|
|
7838
7839
|
})();
|
|
7839
|
-
</script>`}function
|
|
7840
|
+
</script>`}function Rq($,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=`
|
|
7840
7841
|
<div class="stx-pwa-update-banner" style="
|
|
7841
7842
|
position: fixed;
|
|
7842
7843
|
bottom: 0;
|
|
@@ -7947,7 +7948,7 @@ else {
|
|
|
7947
7948
|
// Also listen for custom event
|
|
7948
7949
|
window.addEventListener('pwa-update-available', showUpdate);
|
|
7949
7950
|
})();
|
|
7950
|
-
</script>`}function
|
|
7951
|
+
</script>`}function Nq($,Z){let Y=$.trim().length>0,J=`
|
|
7951
7952
|
<div class="stx-offline-indicator" style="
|
|
7952
7953
|
position: fixed;
|
|
7953
7954
|
top: 16px;
|
|
@@ -8008,7 +8009,7 @@ else {
|
|
|
8008
8009
|
window.addEventListener('offline', updateStatus);
|
|
8009
8010
|
updateStatus();
|
|
8010
8011
|
})();
|
|
8011
|
-
</script>`}function
|
|
8012
|
+
</script>`}function Tq($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",X=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
|
|
8012
8013
|
${$}
|
|
8013
8014
|
</div>
|
|
8014
8015
|
<script>
|
|
@@ -8090,33 +8091,33 @@ catch (error) {
|
|
|
8090
8091
|
init();
|
|
8091
8092
|
}
|
|
8092
8093
|
})();
|
|
8093
|
-
</script>`}var
|
|
8094
|
-
${$.message}`),Z&&$.line){let Q=
|
|
8094
|
+
</script>`}var Mq,Iq,Dq,Eq,EZ;var kZ=b(()=>{Mq={name:"pwa.installButton",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Aq($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Iq={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Rq($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Dq={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Nq($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Eq={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Tq($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},EZ=[Mq,Iq,Dq,Eq]});function H3($){for(let[Z,Y]of Object.entries(r))if(Y===$)return Z;return}var r;var L4=b(()=>{r={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 a5(){return!1}function t5(){return!a5()||process.env.STX_DEBUG==="true"}function F4(){return!1}import kq from"path";function V4(){return{...O3}}function w4($){if(!O3.showRelativePaths||!$)return $;let Z=O3.baseDir||process.cwd();try{let Y=kq.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var bq,O3,A4,m1,R4;var N4=b(()=>{L4();bq={showRelativePaths:!1,enableAutoRecovery:t5(),logRecoveryWarnings:!0},O3={...bq};A4=class A4 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||r.EVALUATION_ERROR,this.filePath)this.filePath=w4(this.filePath)}};m1=class m1 extends A4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||r.EVALUATION_ERROR);this.name="StxRuntimeError"}};R4=class R4 extends A4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||r.DOM_API_VIOLATION);this.name="StxValidationError"}}});function SZ($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:q,snippet:z,suggestion:W,format:U="text"}=$,j=Q,B=G;if(!j&&K&&q!==void 0){let O=xq(K,q);j=O.line,B=O.column}let _=X?w4(X):void 0,H=J?H3(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:_,line:j,column:B,snippet:z,suggestion:W,timestamp:new Date().toISOString()},V;switch(U){case"html":V=yq(L);break;case"json":V=JSON.stringify(L,null,2);break;case"console":V=Pq(L,K,q);break;case"text":default:V=Sq(L,K,q);break}return{formatted:V,data:L}}function Sq($,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(`
|
|
8095
|
+
${$.message}`),Z&&$.line){let Q=Cq(Z,$.line,2);if(Q)J.push(`
|
|
8095
8096
|
${Q}`)}if($.snippet)J.push(`
|
|
8096
8097
|
Snippet: ${$.snippet}`);if($.suggestion)J.push(`
|
|
8097
|
-
Suggestion: ${$.suggestion}`);return J.join(" ")}function
|
|
8098
|
+
Suggestion: ${$.suggestion}`);return J.join(" ")}function yq($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${bZ($.message)}`;if($.suggestion)J+=` | Suggestion: ${bZ($.suggestion)}`;return J+=" -->",J}function Pq($,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(`
|
|
8098
8099
|
\x1B[90mat\x1B[0m ${U}`)}if(z.push(`
|
|
8099
8100
|
|
|
8100
|
-
${$.message}`),Z&&$.line){let U=
|
|
8101
|
+
${$.message}`),Z&&$.line){let U=vq(Z,$.line,2);if(U)z.push(`
|
|
8101
8102
|
|
|
8102
8103
|
\x1B[90mContext:\x1B[0m
|
|
8103
8104
|
${U}`)}if($.suggestion)z.push(`
|
|
8104
8105
|
|
|
8105
8106
|
\x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return z.push(`
|
|
8106
|
-
${"\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
|
|
8107
|
+
${"\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 Cq($,Z,Y){let J=$.split(`
|
|
8107
8108
|
`),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(`
|
|
8108
|
-
`)}function
|
|
8109
|
-
`),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),
|
|
8110
|
-
`)}function
|
|
8111
|
-
`);return{line:J.length,column:J[J.length-1].length}}function Z0($,Z,Y){return
|
|
8109
|
+
`)}function vq($,Z,Y){let J=$.split(`
|
|
8110
|
+
`),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),j=W===Z-1,B=j?"\x1B[31m>\x1B[0m":" ",_=j?`\x1B[31m${J[W]}\x1B[0m`:`\x1B[90m${J[W]}\x1B[0m`;z.push(`${B}\x1B[90m${U}\x1B[0m | ${_}`)}return z.join(`
|
|
8111
|
+
`)}function bZ($){return $.replace(/--/g,"- -").replace(/>/g,">")}function xq($,Z){let J=$.substring(0,Z).split(`
|
|
8112
|
+
`);return{line:J.length,column:J[J.length-1].length}}function Z0($,Z,Y){return SZ({type:$,message:Z,code:Y,format:"html"}).formatted}async function z5($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var yZ=b(()=>{L4();N4()});class F3{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(`
|
|
8112
8113
|
`).slice(1).join(`
|
|
8113
8114
|
`)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
|
|
8114
8115
|
`)}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($)}
|
|
8115
8116
|
`;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(`
|
|
8116
8117
|
|
|
8117
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var L3,a0,V3;var
|
|
8118
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var L3,a0,V3;var PZ=b(()=>{N4();L3={isEnabled(){return V4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=V4();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+=`
|
|
8118
8119
|
@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(t5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};a0=new F3,V3={isDevelopment(){return t5()},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(`
|
|
8119
|
-
`)}}});var
|
|
8120
|
+
`)}}});var CZ=()=>{};var vZ=b(()=>{L4();yZ();PZ();CZ();N4()});var q1=b(()=>{vZ()});function xZ($,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,j=W.length>1?W[1]:"";if(j&&Z[j])z=Z[j];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])z=Z.openGraph[W[1]];else z="";return z?`<meta property="${i(U)}" content="${i(z)}">`:""}return z?`<meta name="${i(q)}" content="${i(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(),j=W+1,B=(()=>{try{let _=N0(U,Z);if(!_)return"";let H="<meta";if(_.name)H+=` name="${i(String(_.name))}"`;if(_.property)H+=` property="${i(String(_.property))}"`;if(_.httpEquiv)H+=` http-equiv="${i(String(_.httpEquiv))}"`;if(_.content)H+=` content="${i(String(_.content))}"`;return H+=">",H}catch(_){let H=_ instanceof Error?_.message:String(_);return Z0("MetaTag",H,r.EVALUATION_ERROR)}})();X=X.substring(0,K)+B+X.substring(j),Q.lastIndex=0}return X}function fZ($,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,j=(()=>{try{let B=N0(W,Z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let _=B instanceof Error?B.message:String(B);return Z0("StructuredData",_,r.EVALUATION_ERROR)}})();J=J.substring(0,G)+j+J.substring(U),X.lastIndex=0}return J}function gZ($,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 V=X[z];if(U){U=!1,z++;continue}if(V==="\\"&&W){U=!0,z++;continue}if(W){if(V===W)W=null;z++;continue}if(V==='"'||V==="'"||V==="`"){W=V,z++;continue}if(V==="{")q++;else if(V==="}")q--;z++}if(q!==0)break;let j=X.substring(z).match(/^\s*\)/);if(!j)break;let B=z+j[0].length,_=X.substring(K,z),H=X.substring(G.index,B),L=((V)=>{try{let O=N0(V,Z);if(!O)return"";let F="";if(O.title)F+=`<title>${i(O.title)}</title>
|
|
8120
8121
|
`,F+=`<meta name="title" content="${i(O.title)}">
|
|
8121
8122
|
`;if(O.description)F+=`<meta name="description" content="${i(O.description)}">
|
|
8122
8123
|
`;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${i(w)}">
|
|
@@ -8138,7 +8139,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
8138
8139
|
`}if(w.site)F+=`<meta name="twitter:site" content="${i(w.site)}">
|
|
8139
8140
|
`;if(w.creator)F+=`<meta name="twitter:creator" content="${i(w.creator)}">
|
|
8140
8141
|
`}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${w}</script>
|
|
8141
|
-
`}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return Z0("SEO",`Error processing @seo directive: ${F}`,r.EVALUATION_ERROR)}})(
|
|
8142
|
+
`}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return Z0("SEO",`Error processing @seo directive: ${F}`,r.EVALUATION_ERROR)}})(_);X=X.substring(0,G.index)+L+X.substring(B),Q.lastIndex=G.index+L.length}return X}function hZ($,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=`
|
|
8142
8143
|
<!-- stx SEO Tags -->
|
|
8143
8144
|
<meta name="title" content="${i(G)}">
|
|
8144
8145
|
<meta name="description" content="${i(K)}">
|
|
@@ -8154,7 +8155,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
8154
8155
|
`;let W=$;if(!Q)W=W.replace(/<head[^>]*>/,`$&
|
|
8155
8156
|
<title>${i(G)}</title>`);return W.replace(/<head[^>]*>/,`$&
|
|
8156
8157
|
${z}
|
|
8157
|
-
`)}function i($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var
|
|
8158
|
+
`)}function i($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var dZ,uZ;var w3=b(()=>{q1();T0();dZ={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return Z0("Meta","meta directive requires at least the meta name",r.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${i(X)}" content="${i(Q)}">`},hasEndTag:!1},uZ={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return Z0("StructuredData","structuredData directive requires JSON-LD content",r.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",r.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,r.EVALUATION_ERROR)}},hasEndTag:!0}});import e5 from"path";function fq($,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 j=U[1],B=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)X=B[1];let _=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(_)Q=_[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=j.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 gq($){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)=>`
|
|
8158
8159
|
get ${U}() {
|
|
8159
8160
|
return this.getAttribute('${U}') || '';
|
|
8160
8161
|
}
|
|
@@ -8205,16 +8206,16 @@ ${W}
|
|
|
8205
8206
|
}
|
|
8206
8207
|
|
|
8207
8208
|
customElements.define('${Z}', ${G});
|
|
8208
|
-
`}async function
|
|
8209
|
-
${
|
|
8210
|
-
</script>`}var uZ=b(()=>{q1();R0()});var mZ={};e(mZ,{timingPlugin:()=>uq,pluginManager:()=>fq,definePlugin:()=>T4,debugPlugin:()=>dq,createVariablesPlugin:()=>mq,createFilterPlugin:()=>hq,createDirectivePlugin:()=>gq,PluginManager:()=>A3});function T4($){return $}class A3{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 gq($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function hq($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function mq($){return T4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var fq,dq,uq;var pZ=b(()=>{fq=new A3;dq=T4({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)}}),uq=T4({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 cZ={};e(cZ,{validateConfig:()=>nq,loadStxConfig:()=>z1,defineStxConfig:()=>iq,defaultConfig:()=>p1,config:()=>N3});import R3 from"fs";import S0 from"path";import{loadConfigWithResult as pq}from"bunfig";function lq($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=S0.join(process.cwd(),"resources","views"),X=S0.join(process.cwd(),"resources","layouts");if(R3.existsSync(J)&&R3.existsSync(X))return{root:"resources",pagesDir:"views"};let Q=S0.join(process.cwd(),"resources","views","pages");if(R3.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function cq($){if(p6($.stateDir),$.stateDir=M5(),$.cachePath=I5($.cachePath),$.build)$.build.cacheDir=I5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=I5($.media.cache.directory);if($.story)$.story.outDir=I5($.story.outDir)}async function z1($){if(!$){if(W5)return W5;if(M4)return M4}let Z=$?S0.resolve($):process.cwd(),Y=lZ.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await pq({name:"stx",alias:"ui",cwd:Z,defaultConfig:p1,verbose:!1})).config;cq(Q);let G=lq(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!S0.isAbsolute(Q.partialsDir))Q.partialsDir=S0.join(K,Q.partialsDir);if(Q.componentsDir&&!S0.isAbsolute(Q.componentsDir))Q.componentsDir=S0.join(K,Q.componentsDir);if(Q.layoutsDir&&!S0.isAbsolute(Q.layoutsDir))Q.layoutsDir=S0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (pZ(),mZ)),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=S0.dirname(U0.resolve(U))}catch{let L=S0.resolve(process.cwd(),U);_=await import(L),j=S0.dirname(L)}let H=_.default||_;if(K.register(H,Q),H.components){let L=S0.resolve(j,H.components);q.push(L)}if(H.pages){let L=S0.resolve(j,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: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(lZ.set(Z,J),!$)M4=J,J.then((X)=>{W5=X}).catch(()=>{});return J}function iq($){return $}function nq($){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 p1,W5=null,lZ,M4=null,N3;var l1=b(()=>{$7();Z7();Y7();J7();f7();ZZ();j3();DZ();w3();D5();uZ();p1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:r1,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:D8,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:dZ,hasEndTag:!1,description:"Include a web component in the template"},i6,n6,gZ,hZ,o6,r6,a6,s6,Z9,X9,$Z,_3,...IZ],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}};lZ=new Map;N3=new Proxy(p1,{get($,Z){if(W5&&Z in W5)return W5[Z];if(!M4)z1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var rZ={};e(rZ,{resetCssCache:()=>$z,resetCrosswindCache:()=>Zz,rebuildCrosswindCSS:()=>Yz,loadCrosswindConfig:()=>E3,loadCrosswind:()=>D3,injectCrosswindCSS:()=>Z$,getCachedCSS:()=>Jz,generateCrosswindCSS:()=>sZ,extractClassNames:()=>oZ,buildCrosswindCSS:()=>nZ});import Y0 from"path";import{hasLocalConfig as oq}from"bunfig/discovery";function I3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function T3($,Z){if(W1.has($))W1.delete($);else if(W1.size>=sq)W1.delete(W1.keys().next().value);W1.set($,Z)}async function rq($){if(!A1)return null;try{let Z=Bun.file(Y0.join(A1,`cw-${I3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function aq($,Z){if(!A1)return;try{if(!fs.existsSync(A1))fs.mkdirSync(A1,{recursive:!0});await Bun.write(Y0.join(A1,`cw-${I3($)}.css`),Z)}catch{}}async function iZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function tq(){let $=[],Z=process.cwd();while(Z!==Y0.dirname(Z))$.push(Y0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=Y0.dirname(Z);return $}function eq(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function D3(){if(M3)return J1;M3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await iZ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=Y0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return J1=Q,J1}let Z=await $(tq());if(Z)return J1=Z,J1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await iZ(X);if(Q){if(J1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return J1}}let J=await $(eq());if(J)return J1=J,J1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function $z(){W1.clear()}function Zz(){J1=null,M3=!1,t0=null,$$="",W1.clear(),I4=null}async function E3($){try{if(!oq({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=Y0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function nZ($){if(U5)return $$;U5=!0;try{let Z=await D3();if(!Z||!Z.build)return U5=!1,"";if(!t0)t0=await E3($);if(!t0)return U5=!1,"";let Y=Z.defaultConfig?.theme||{},J=t0.theme||{},X={...Z.defaultConfig,...t0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if($$=G.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let q=Y0.isAbsolute(X.output)?X.output:Y0.join($,X.output),z=Y0.dirname(q);if(!fs.existsSync(z))fs.mkdirSync(z,{recursive:!0});await Bun.write(q,G.css)}return U5=!1,G.css}catch(Z){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,Z),U5=!1,$$}}async function Yz($){t0=null,await nZ($)}function Jz(){return $$}function oZ($){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 sZ($,Z){try{let Y=await D3();if(!Y)return"";let J=typeof Y.extractClasses==="function"?Y.extractClasses($):oZ($);if(J.size===0)return"";let X=Z?Y0.resolve(Z):process.cwd();if(!A1)A1=_1(X,"cache");let Q=[...J].sort().join(" "),G=`${I4||"default"}::${Q}`,K=W1.get(G);if(K!==void 0)return T3(G,K),K;let q=await rq(G);if(q!==null)return T3(G,q),q;if(!t0){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (l1(),cZ)),N=await R(X);if(N.css)if(typeof N.css==="string"){let T=Y0.isAbsolute(N.css)?N.css:Y0.resolve(X,N.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(A={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=Y0.isAbsolute(N.css.config)?N.css.config:Y0.resolve(X,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}t0=A||await E3(X);try{I4=I3(JSON.stringify(t0??{}))}catch{I4="unhashable"}}let z=Y.defaultConfig||Y.config,W=t0||{},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},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,R]of Object.entries(F)){if(!J.has(A)&&!H.includes(A))continue;let N=R.split(/\s+/).filter(Boolean);for(let T of N)V.generate(T)}O=V.toCSS(!0,!1);let w=O.split(`
|
|
8209
|
+
`}async function mZ($,Z,Y,J){if(Z.length<1)return Z0("WebComponent","@webcomponent directive requires at least the tag name parameter",r.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[e5.join(e5.dirname(J),G,`${X}.stx`),e5.join(process.cwd(),G,`${X}.stx`),e5.join(e5.dirname(J),`${X}.stx`)],q=null;for(let U of K)if(await o(U)){q=await Bun.file(U).text();break}if(!q)return Z0("WebComponent",`Component file not found: ${X}.stx`,r.FILE_NOT_FOUND);let z=fq(q,X);return`<script type="module">
|
|
8210
|
+
${gq(z)}
|
|
8211
|
+
</script>`}var pZ=b(()=>{q1();R0()});var lZ={};e(lZ,{timingPlugin:()=>pq,pluginManager:()=>hq,definePlugin:()=>T4,debugPlugin:()=>mq,createVariablesPlugin:()=>lq,createFilterPlugin:()=>uq,createDirectivePlugin:()=>dq,PluginManager:()=>A3});function T4($){return $}class A3{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 dq($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function uq($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function lq($){return T4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var hq,mq,pq;var cZ=b(()=>{hq=new A3;mq=T4({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)}}),pq=T4({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 nZ={};e(nZ,{validateConfig:()=>sq,loadStxConfig:()=>z1,defineStxConfig:()=>oq,defaultConfig:()=>p1,config:()=>N3});import R3 from"fs";import S0 from"path";import{loadConfigWithResult as cq}from"bunfig";function iq($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=S0.join(process.cwd(),"resources","views"),X=S0.join(process.cwd(),"resources","layouts");if(R3.existsSync(J)&&R3.existsSync(X))return{root:"resources",pagesDir:"views"};let Q=S0.join(process.cwd(),"resources","views","pages");if(R3.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function nq($){if(p6($.stateDir),$.stateDir=M5(),$.cachePath=I5($.cachePath),$.build)$.build.cacheDir=I5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=I5($.media.cache.directory);if($.story)$.story.outDir=I5($.story.outDir)}async function z1($){if(!$){if(W5)return W5;if(M4)return M4}let Z=$?S0.resolve($):process.cwd(),Y=iZ.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await cq({name:"stx",alias:"ui",cwd:Z,defaultConfig:p1,verbose:!1})).config;nq(Q);let G=iq(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!S0.isAbsolute(Q.partialsDir))Q.partialsDir=S0.join(K,Q.partialsDir);if(Q.componentsDir&&!S0.isAbsolute(Q.componentsDir))Q.componentsDir=S0.join(K,Q.componentsDir);if(Q.layoutsDir&&!S0.isAbsolute(Q.layoutsDir))Q.layoutsDir=S0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (cZ(),lZ)),q=[],z=[];for(let W of Q.plugins){let U=typeof W==="string"?W:W[0],j=typeof W==="string"?{}:W[1]||{};try{let B,_;try{B=await import(U),_=S0.dirname(U0.resolve(U))}catch{let L=S0.resolve(process.cwd(),U);B=await import(L),_=S0.dirname(L)}let H=B.default||B;if(K.register(H,Q),H.components){let L=S0.resolve(_,H.components);q.push(L)}if(H.pages){let L=S0.resolve(_,H.pages),V=j.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(j,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(B){console.warn(`[stx] Failed to load plugin ${U}:`,B.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=z}return Q})();if(iZ.set(Z,J),!$)M4=J,J.then((X)=>{W5=X}).catch(()=>{});return J}function oq($){return $}function sq($){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 p1,W5=null,iZ,M4=null,N3;var l1=b(()=>{$7();Z7();Y7();J7();f7();JZ();_3();kZ();w3();D5();pZ();p1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:r1,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:k8,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:mZ,hasEndTag:!1,description:"Include a web component in the template"},i6,n6,dZ,uZ,o6,r6,a6,s6,Z9,X9,YZ,B3,...EZ],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}};iZ=new Map;N3=new Proxy(p1,{get($,Z){if(W5&&Z in W5)return W5[Z];if(!M4)z1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var tZ={};e(tZ,{resetCssCache:()=>Yz,resetCrosswindCache:()=>Jz,rebuildCrosswindCSS:()=>Xz,loadCrosswindConfig:()=>E3,loadCrosswind:()=>D3,injectCrosswindCSS:()=>Z$,getCachedCSS:()=>Qz,generateCrosswindCSS:()=>aZ,extractClassNames:()=>rZ,buildCrosswindCSS:()=>sZ});import Y0 from"path";import{hasLocalConfig as rq}from"bunfig/discovery";function I3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function T3($,Z){if(W1.has($))W1.delete($);else if(W1.size>=aq)W1.delete(W1.keys().next().value);W1.set($,Z)}async function tq($){if(!A1)return null;try{let Z=Bun.file(Y0.join(A1,`cw-${I3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function eq($,Z){if(!A1)return;try{if(!fs.existsSync(A1))fs.mkdirSync(A1,{recursive:!0});await Bun.write(Y0.join(A1,`cw-${I3($)}.css`),Z)}catch{}}async function oZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function $z(){let $=[],Z=process.cwd();while(Z!==Y0.dirname(Z))$.push(Y0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=Y0.dirname(Z);return $}function Zz(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function D3(){if(M3)return J1;M3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await oZ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=Y0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return J1=Q,J1}let Z=await $($z());if(Z)return J1=Z,J1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await oZ(X);if(Q){if(J1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return J1}}let J=await $(Zz());if(J)return J1=J,J1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function Yz(){W1.clear()}function Jz(){J1=null,M3=!1,t0=null,$$="",W1.clear(),I4=null}async function E3($){try{if(!rq({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=Y0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function sZ($){if(U5)return $$;U5=!0;try{let Z=await D3();if(!Z||!Z.build)return U5=!1,"";if(!t0)t0=await E3($);if(!t0)return U5=!1,"";let Y=Z.defaultConfig?.theme||{},J=t0.theme||{},X={...Z.defaultConfig,...t0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if($$=G.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let q=Y0.isAbsolute(X.output)?X.output:Y0.join($,X.output),z=Y0.dirname(q);if(!fs.existsSync(z))fs.mkdirSync(z,{recursive:!0});await Bun.write(q,G.css)}return U5=!1,G.css}catch(Z){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,Z),U5=!1,$$}}async function Xz($){t0=null,await sZ($)}function Qz(){return $$}function rZ($){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 aZ($,Z){try{let Y=await D3();if(!Y)return"";let J=typeof Y.extractClasses==="function"?Y.extractClasses($):rZ($);if(J.size===0)return"";let X=Z?Y0.resolve(Z):process.cwd();if(!A1)A1=B1(X,"cache");let Q=[...J].sort().join(" "),G=`${I4||"default"}::${Q}`,K=W1.get(G);if(K!==void 0)return T3(G,K),K;let q=await tq(G);if(q!==null)return T3(G,q),q;if(!t0){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (l1(),nZ)),N=await R(X);if(N.css)if(typeof N.css==="string"){let T=Y0.isAbsolute(N.css)?N.css:Y0.resolve(X,N.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(A={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=Y0.isAbsolute(N.css.config)?N.css.config:Y0.resolve(X,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}t0=A||await E3(X);try{I4=I3(JSON.stringify(t0??{}))}catch{I4="unhashable"}}let z=Y.defaultConfig||Y.config,W=t0||{},U=z.theme||{},B=(W.theme||{}).extend||{},_={...U};if(Object.keys(B).length>0)_.extend=B;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,R]of Object.entries(F)){if(!J.has(A)&&!H.includes(A))continue;let N=R.split(/\s+/).filter(Boolean);for(let T of N)V.generate(T)}O=V.toCSS(!0,!1);let w=O.split(`
|
|
8211
8212
|
`);for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!H.includes(A))continue;let N=R.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of N){let E=I.startsWith("dark:"),S=`.${(E?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<w.length;k++){let C=w[k].trim();if(C===`${S} {`||C.startsWith(`${S} {`)){let x=k,f="";while(x<w.length){if(f+=w[x],w[x].includes("}"))break;x++}let d=f.match(/\{([^}]+)\}/);if(d)if(E)M.push(d[1].trim());else T.push(d[1].trim());break}}}if(T.length)O+=`
|
|
8212
8213
|
.${A} { ${T.join(" ")} }`;if(M.length)O+=`
|
|
8213
|
-
@media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return T3(G,O),
|
|
8214
|
+
@media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return T3(G,O),eq(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function Z$($,Z){let Y=await aZ($,Z);if(!Y)return $;let J=`<style data-crosswind="generated">
|
|
8214
8215
|
${Y}
|
|
8215
8216
|
</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}
|
|
8216
8217
|
</head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
8217
|
-
${J}`);return J+$}var J1=null,M3=!1,t0=null,$$="",U5=!1,
|
|
8218
|
+
${J}`);return J+$}var J1=null,M3=!1,t0=null,$$="",U5=!1,aq=256,W1,A1=null,I4=null;var D4=b(()=>{D5();l6();W1=new Map});function eZ(){return`
|
|
8218
8219
|
// STX Lifecycle Runtime
|
|
8219
8220
|
(function() {
|
|
8220
8221
|
if (typeof window === 'undefined') return;
|
|
@@ -8559,7 +8560,7 @@ else {
|
|
|
8559
8560
|
|
|
8560
8561
|
console.log('[stx] Lifecycle runtime initialized');
|
|
8561
8562
|
})();
|
|
8562
|
-
`}function k3($){return Symbol($)}var
|
|
8563
|
+
`}function k3($){return Symbol($)}var UF,jF,BF;var $2=b(()=>{UF=k3("theme"),jF=k3("router"),BF=k3("i18n")});import*as Y2 from"crypto";function Z2($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function Gz(){return`stx-${Y2.randomBytes(4).toString("hex")}`}function Kz($){return/\$\w+\./.test($)}function qz($){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,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...K.matchAll(j)];for(let L of B){let V=L[0],O=L[1],F=L[2];if(Kz(F)){W=!0;let w=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(z.push({attr:O,expr:A,fullMatch:V,originalAttr:O}),Z2(A).forEach((N)=>Y.add(N)),O==="text")U=U.replace(V,"");else if(O==="class")U=U.replace(V,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(V,"");else U=U.replace(V,`${O}=""`)}}}if(!W)return Q;let _=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(_)H=_[1];else H=Gz(),U=` id="${H}"${U}`;for(let L of z)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:Z2(L.expr)});return`<${G}${U}${q}`}),{html:X,bindings:Z,stores:Y}}function zz($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
|
|
8563
8564
|
<script>
|
|
8564
8565
|
(function() {
|
|
8565
8566
|
'use strict';
|
|
@@ -8717,10 +8718,10 @@ else {
|
|
|
8717
8718
|
}
|
|
8718
8719
|
})();
|
|
8719
8720
|
</script>
|
|
8720
|
-
`,J}function
|
|
8721
|
+
`,J}function J2($){let{html:Z,bindings:Y,stores:J}=qz($);if(Y.length===0)return $;let X=zz(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var X2=()=>{};function Wz($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Uz(Z);case"google-analytics":return jz(Z);case"plausible":return Bz(Z);case"self-hosted":return _z(Z);case"custom":return Hz(Z);default:return""}}function Uz($){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="${h0(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="${h0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
|
|
8721
8722
|
<!-- Fathom Analytics -->
|
|
8722
8723
|
<script src="${h0(Y)}" ${X.join(" ")}${J}></script>
|
|
8723
|
-
`}function
|
|
8724
|
+
`}function jz($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=h0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
|
|
8724
8725
|
<!-- Google Analytics -->
|
|
8725
8726
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
|
|
8726
8727
|
<script>
|
|
@@ -8730,10 +8731,10 @@ else {
|
|
|
8730
8731
|
gtag('config', '${Y}');
|
|
8731
8732
|
${J}
|
|
8732
8733
|
</script>
|
|
8733
|
-
`}function
|
|
8734
|
+
`}function Bz($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${h0(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`
|
|
8734
8735
|
<!-- Plausible Analytics -->
|
|
8735
8736
|
<script defer data-domain="${h0(Z.domain)}" src="${h0(X)}"></script>
|
|
8736
|
-
`}function
|
|
8737
|
+
`}function _z($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=h0(Z.siteId),J=h0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
|
|
8737
8738
|
d.addEventListener('click',function(e){
|
|
8738
8739
|
var a=e.target.closest('a');
|
|
8739
8740
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -8766,7 +8767,7 @@ else {
|
|
|
8766
8767
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
8767
8768
|
})();
|
|
8768
8769
|
</script>
|
|
8769
|
-
`}function
|
|
8770
|
+
`}function Hz($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
|
|
8770
8771
|
<!-- Custom Analytics -->
|
|
8771
8772
|
<script>
|
|
8772
8773
|
${Z.inlineScript}
|
|
@@ -8774,7 +8775,7 @@ ${Z.inlineScript}
|
|
|
8774
8775
|
`;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${h0(Z.scriptId)}"`);if(Z.attributes)for(let[X,Q]of Object.entries(Z.attributes))Y.push(`${h0(X)}="${h0(Q)}"`);return`
|
|
8775
8776
|
<!-- Custom Analytics -->
|
|
8776
8777
|
<script${Y.length>0?` ${Y.join(" ")}`:""} src="${h0(Z.scriptUrl)}" defer></script>
|
|
8777
|
-
`}function
|
|
8778
|
+
`}function Q2($,Z){let Y=Wz(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 h0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var G2=()=>{};function z2($){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(Oz.has(J))Z.systemKeys.push(J);else if(J in W2)Z.mouse=J;else if(J in q2||/^[a-z]$/.test(J))Z.keys.push(q2[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 U2($){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=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=j.exec(K))!==null){let[,H,L]=B,V=H.split("."),O=V[0];if(!K2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:z2(V.slice(1)),elementId:W})}let _=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=_.exec(K))!==null){let[,H,L]=B,V=H.split("."),O=V[0];if(!K2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:z2(V.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:Q,elementId:W,events:U,startIndex:q,endIndex:z})}return Z}function Lz($){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=W2[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 Fz($,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 Vz($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=Lz($),X=Fz($.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`
|
|
8778
8779
|
(function() {
|
|
8779
8780
|
var $el = document.getElementById('${Y}');
|
|
8780
8781
|
if (!$el) return;
|
|
@@ -8828,7 +8829,7 @@ else {
|
|
|
8828
8829
|
__stx_runHandler('${K}', $event, $el);
|
|
8829
8830
|
}
|
|
8830
8831
|
}${G});
|
|
8831
|
-
})();`}function
|
|
8832
|
+
})();`}function wz($){if($.length===0)return"";return`
|
|
8832
8833
|
<script data-stx-events>
|
|
8833
8834
|
(function() {
|
|
8834
8835
|
'use strict';
|
|
@@ -8876,11 +8877,11 @@ else {
|
|
|
8876
8877
|
}
|
|
8877
8878
|
|
|
8878
8879
|
// Event listeners
|
|
8879
|
-
${$.flatMap((Y)=>Y.events).map(
|
|
8880
|
+
${$.flatMap((Y)=>Y.events).map(Vz).join(`
|
|
8880
8881
|
`)}
|
|
8881
8882
|
})();
|
|
8882
|
-
</script>`}function
|
|
8883
|
-
`+Q.slice(K);else Q+=G;return Q}var
|
|
8883
|
+
</script>`}function Az($){let Z=U2($);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 j2($,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}=Az($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...z],q}let X=U2($);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 j of z.events)j.elementId=U[1]}for(let U of z.events){let j=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),_=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");W=W.replace(B,""),W=W.replace(_,"")}Q=Q.slice(0,z.startIndex)+W+Q.slice(z.endIndex)}let G=wz(X),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
|
|
8884
|
+
`+Q.slice(K);else Q+=G;return Q}var K2,q2,Oz,W2;var B2=b(()=>{K2=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"]),q2={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"},Oz=new Set(["ctrl","alt","shift","meta"]),W2={left:0,middle:1,right:2}});function E4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _2($,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 Nz($){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=_2(G,"x-data");if(!q)continue;let z=`__stx_scope_${O2++}`,W=_2(G,"x-init"),U=Tz($,Q,K+X.length),j=$.slice(K,U.endIndex),B=Mz(j);Z.push({id:z,selector:`[data-stx-scope="${z}"]`,stateExpr:q,initExpr:W,bindings:[],refs:B})}return Z}function Tz($,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 Mz($){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=Iz(Q);Z.set(G,K)}return Z}function Iz($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${Rz++}`}function Dz(){return`
|
|
8884
8885
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
8885
8886
|
(function() {
|
|
8886
8887
|
var style = document.createElement('style');
|
|
@@ -9087,7 +9088,7 @@ window.__stx_reactive = (function() {
|
|
|
9087
9088
|
|
|
9088
9089
|
return { initScope: initScope, reactive: reactive };
|
|
9089
9090
|
})();
|
|
9090
|
-
`}function
|
|
9091
|
+
`}function H2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=l0(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=l0(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 Ez($,Z){if($.length===0)return"";let Y=$.map((J)=>{let X=JSON.stringify(Object.fromEntries(J.refs)),Q=H2(J.stateExpr,Z),G=J.initExpr?H2(J.initExpr,Z):null,K=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
|
|
9091
9092
|
(function() {
|
|
9092
9093
|
var scopeEl = document.querySelector('${J.selector}');
|
|
9093
9094
|
if (!scopeEl) return;
|
|
@@ -9096,16 +9097,16 @@ window.__stx_reactive = (function() {
|
|
|
9096
9097
|
})();`}).join(`
|
|
9097
9098
|
`);return`
|
|
9098
9099
|
<script data-stx-scoped data-stx-reactive>
|
|
9099
|
-
${
|
|
9100
|
+
${Dz()}
|
|
9100
9101
|
${Y}
|
|
9101
|
-
</script>`}function
|
|
9102
|
-
`+X.slice(G);else X+=Q;return X}function Dz($,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*["']${E4(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*["']${E4(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*"${E4(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*'${E4(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 Ez($){return/x-data\s*=\s*["']/.test($)}var j2=0,wz=0;var O2=b(()=>{Y1()});import kz from"fs";import b3 from"path";import{createHighlighter as bz}from"ts-syntax-highlighter";async function Sz($,Z={}){try{if(!await o($))throw Error(`Markdown file not found: ${$}`);let J=(await kz.promises.stat($)).mtime.getTime();if(Z.cache&&S3.has($)){let U=S3.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=G9(X),K=Z.markdown||N3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},z=E5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)z=await yz(z,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:z,data:Q||{}};if(Z.cache)S3.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:z0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function yz($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!k4)try{k4=await bz({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(!k4.getSupportedLanguages().includes(B))return K;return(await k4.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 L2($,Z,Y="",J={}){return await Pz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,z)=>{try{let W=K;if(!b3.isAbsolute(K))W=b3.resolve(b3.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(),R=F.substring(w+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(N||T)R=R.substring(1,R.length-1);U[A]=R}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:B,data:_}=await Sz(W,J),j={...Z,..._,...U},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(V,O)=>{let F=O.trim();return j[F]!==void 0?String(j[F]):V}),H}catch(W){let U=W instanceof Error?W.message:String(W);return z0("Markdown File",`Error including markdown file: ${U}`,Y,$,z,G)}})}async function Pz($,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 S3,k4=null;var F2=b(()=>{l1();R0();S3=new Map});function R1($,Z){try{let Y=$.trim();if(G0(Y))return K0(Y,Object.keys(Z))(...Object.values(Z));else return X0(Y,Z)}catch{return!1}}var V2=b(()=>{T0()});function Cz($,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=A7(J,G);if(!K)break;try{let q;if(G0(K.expression))q=K0(K.expression,Object.keys(Z))(...Object.values(Z));else q=X0(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=X0(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}`,r.EVALUATION_ERROR);J=J.substring(0,G)+W+J.substring(K.end);break}}return J}function c1($,Z,Y){let J=$;J=Cz(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=V1(J,K+7);if(!q)break;let z=q.endPos,W=f1(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,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,R)=>A.pos-R.pos);for(let A of F)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=P3(J,Z,Y),J=C3(J,Z,Y),J=y3(J,Z);let X=()=>{let Q=c5(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=X0(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)}`,r.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}`,r.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 w2($){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 y3($,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),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"),_=/@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,V)=>L.pos-V.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),_=w2(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"),V;if(!Z.auth)V=!1;else V=W?R1(`auth?.check && auth?.user?.[${W}]`,Z):R1("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(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),_=w2(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"),V;if(!Z.auth)V=!0;else V=W?R1(`!auth?.check || !auth?.user?.[${W}]`,Z):R1("!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(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=R1(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 V=Y.slice(H,L),O=[],F=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${z}\\s*\\(`,"g"),N=/@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=R.exec(V))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(V))!==null)T.push({pos:M.index,type:"else"});T.sort((k,C)=>k.pos-C.pos);for(let k of T){if(k.type==="open"){F++;continue}if(k.type==="close"){F--;continue}if(F===0)O.push(k)}let I=[],E=0;for(let k=0;k<O.length;k++){let C=O[k];if(I.push({content:V.slice(E,C.pos),ability:void 0}),C.type==="elseDirective"){let x=V.slice(C.pos+`@${z}`.length),f=G(x);if(f){I[I.length-1]={content:V.slice(E,C.pos)},E=C.pos+`@${z}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let d=O[k+1],c=d?d.pos:V.length;I.push({content:V.slice(E,c),ability:f.ability,type:f.type,id:f.id}),E=c}}else E=C.pos+5}if(E<V.length){let k=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 D=Q(j.ability,j.type,j.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let k=!1;for(let C=1;C<I.length;C++){let x=I[C];if(x.isFinalElse){S=x.content,k=!0;break}if(x.ability){let f=Q(x.ability,x.type,x.id);if(K==="can"?f:!f){S=x.content,k=!0;break}}}if(!k&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)S=C.content}}Y=Y.substring(0,B)+S+Y.substring(L+`@${q}`.length),W=!0}}return Y}function P3($,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=V1(Q,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=f1(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 V=Q.slice(H,L),O=j.expression,F=-1,w=0,A=0;while(A<V.length){let R=V.indexOf("@",A);if(R===-1)break;let N=V.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,A=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=q(O.trim()),N;if(F!==-1){let T=V.slice(0,F),M=V.slice(F+5);N=R?T:M}else N=R?V:"";Q=Q.substring(0,_)+N+Q.substring(L+`@${K}`.length),W=!0}catch(R){let N=R instanceof Error?R.message:String(R),T=Z0(z,`Error processing @${G} directive: ${N}`,r.EVALUATION_ERROR);Q=Q.substring(0,_)+T+Q.substring(L+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=R1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=R1(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 C3($,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 V=L.index,O=V+L[0].length;if(K==="env"){let D=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,z=X===D[2]}let F=1,w=O,A=-1;while(F>0&&w<j.length){W.lastIndex=w,U.lastIndex=w;let D=W.exec(j),y=U.exec(j),S=D?D.index:1/0,k=y?y.index:1/0;if(S<k)F++,w=S+D[0].length;else if(k<1/0){if(F--,F===0){A=k;break}w=k+y[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 R=j.substring(O,A),N=-1,T=0,M=0;while(M<R.length){let D=R.indexOf("@",M);if(D===-1)break;let y=R.substring(D);if(B.test(y)){T++,M=D+1;continue}if(_.test(y)){T--,M=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){N=D;break}M=D+1}let I;if(N!==-1){let D=R.slice(0,N),y=R.slice(N+5);I=z?D:y}else I=z?R:"";let E=`@${q}`.length;j=j.substring(0,V)+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 b4=b(()=>{V2();q1();k$();T0()});function R2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function S4($,Z){if(!$)return Z?.nonceGenerator?.()??R2();let Y=A2.get($);if(!Y)Y=Z?.nonceGenerator?.()??R2(),A2.set($,Y);return Y}function vz($,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 N2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${vz($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function T2($,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?S4(Y,Z):void 0,X=N2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
9103
|
-
${X}`)}function
|
|
9104
|
-
${P4("@csrf",Z)}`,!["GET","POST"].includes(
|
|
9105
|
-
${P4(`@method('${
|
|
9106
|
-
`),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(),
|
|
9102
|
+
</script>`}function L2($,Z,Y){if(O2=0,!bz($))return $;let J=Nz($);if(J.length===0)return $;let X=kz($,J),Q=Ez(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
|
|
9103
|
+
`+X.slice(G);else X+=Q;return X}function kz($,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*["']${E4(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*["']${E4(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*"${E4(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*'${E4(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 bz($){return/x-data\s*=\s*["']/.test($)}var O2=0,Rz=0;var F2=b(()=>{Y1()});import Sz from"fs";import b3 from"path";import{createHighlighter as yz}from"ts-syntax-highlighter";async function Pz($,Z={}){try{if(!await o($))throw Error(`Markdown file not found: ${$}`);let J=(await Sz.promises.stat($)).mtime.getTime();if(Z.cache&&S3.has($)){let U=S3.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=G9(X),K=Z.markdown||N3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},z=E5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)z=await Cz(z,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:z,data:Q||{}};if(Z.cache)S3.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:z0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function Cz($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!k4)try{k4=await yz({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,"'"),j=z||(Y?"text":"");if(!j)return K;try{if(!k4.getSupportedLanguages().includes(j))return K;return(await k4.highlight(U,j,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${z}:`,B)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[q,z,W,U]=K,j=await X(q,z,W,U);Q=Q.replace(q,j)}return Q}async function V2($,Z,Y="",J={}){return await vz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,z)=>{try{let W=K;if(!b3.isAbsolute(K))W=b3.resolve(b3.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(),R=F.substring(w+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(N||T)R=R.substring(1,R.length-1);U[A]=R}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:j,data:B}=await Pz(W,J),_={...Z,...B,...U},H=j,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 z0("Markdown File",`Error including markdown file: ${U}`,Y,$,z,G)}})}async function vz($,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 S3,k4=null;var w2=b(()=>{l1();R0();S3=new Map});function R1($,Z){try{let Y=$.trim();if(G0(Y))return K0(Y,Object.keys(Z))(...Object.values(Z));else return X0(Y,Z)}catch{return!1}}var A2=b(()=>{T0()});function xz($,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=A7(J,G);if(!K)break;try{let q;if(G0(K.expression))q=K0(K.expression,Object.keys(Z))(...Object.values(Z));else q=X0(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 j;if(U.value&&G0(U.value))j=K0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=X0(U.value,Z);if(q===j){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}`,r.EVALUATION_ERROR);J=J.substring(0,G)+W+J.substring(K.end);break}}return J}function c1($,Z,Y){let J=$;J=xz(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=V1(J,K+7);if(!q)break;let z=q.endPos,W=f1(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),j=q.expression,B=-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,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){B=A.pos;break}}let _;if(B!==-1){let H=U.slice(0,B),L=U.slice(B+5);_=`@if (${j})${L}@else ${H}@endif`}else _=`@if (!(${j}))${U}@endif`;J=J.substring(0,K)+_+J.substring(W+10),Q=!0}}J=P3(J,Z,Y),J=C3(J,Z,Y),J=y3(J,Z);let X=()=>{let Q=c5(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=X0(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)}`,r.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}`,r.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 R2($){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 y3($,Z){let Y=$;function J(K,q,z,W){let U=1,j=W,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${z}(?![a-z])`,"g");while(j<K.length&&U>0){B.lastIndex=j,_.lastIndex=j;let H=B.exec(K),L=_.exec(K),V=H?H.index:1/0,O=L?L.index:1/0;if(V<O)U++,j=V+H[0].length;else if(O<1/0){if(U--,U===0)return O;j=O+L[0].length}else break}return-1}function X(K,q,z){let W=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${z}(?![a-z])`,"g"),B=/@else(?![a-z])/g,_=[],H;while((H=U.exec(K))!==null)_.push({pos:H.index,type:"open"});while((H=j.exec(K))!==null)_.push({pos:H.index,type:"close"});while((H=B.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,j=Y.slice(z+5),B=R2(j);if(B)W=B.value,U=z+5+B.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?R1(`auth?.check && auth?.user?.[${W}]`,Z):R1("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,j=Y.slice(z+6),B=R2(j);if(B)W=B.value,U=z+6+B.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?R1(`!auth?.check || !auth?.user?.[${W}]`,Z):R1("!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=R1(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 j=U.index,B=Y.slice(j+`@${K}`.length),_=G(B);if(!_)break;let H=j+`@${K}`.length+_.paramsEnd,L=J(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${j} 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"),R=new RegExp(`@${z}\\s*\\(`,"g"),N=/@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=R.exec(V))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(V))!==null)T.push({pos:M.index,type:"else"});T.sort((k,C)=>k.pos-C.pos);for(let k of T){if(k.type==="open"){F++;continue}if(k.type==="close"){F--;continue}if(F===0)O.push(k)}let I=[],E=0;for(let k=0;k<O.length;k++){let C=O[k];if(I.push({content:V.slice(E,C.pos),ability:void 0}),C.type==="elseDirective"){let x=V.slice(C.pos+`@${z}`.length),f=G(x);if(f){I[I.length-1]={content:V.slice(E,C.pos)},E=C.pos+`@${z}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let d=O[k+1],c=d?d.pos:V.length;I.push({content:V.slice(E,c),ability:f.ability,type:f.type,id:f.id}),E=c}}else E=C.pos+5}if(E<V.length){let k=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 D=Q(_.ability,_.type,_.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let k=!1;for(let C=1;C<I.length;C++){let x=I[C];if(x.isFinalElse){S=x.content,k=!0;break}if(x.ability){let f=Q(x.ability,x.type,x.id);if(K==="can"?f:!f){S=x.content,k=!0;break}}}if(!k&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)S=C.content}}Y=Y.substring(0,j)+S+Y.substring(L+`@${q}`.length),W=!0}}return Y}function P3($,Z,Y){let J=$;function X(Q,G,K,q,z){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let B=j.index,_=V1(Q,B+`@${G}`.length);if(!_)break;let H=_.endPos,L=f1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${B} 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 R=V.indexOf("@",A);if(R===-1)break;let N=V.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,A=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=q(O.trim()),N;if(F!==-1){let T=V.slice(0,F),M=V.slice(F+5);N=R?T:M}else N=R?V:"";Q=Q.substring(0,B)+N+Q.substring(L+`@${K}`.length),W=!0}catch(R){let N=R instanceof Error?R.message:String(R),T=Z0(z,`Error processing @${G} directive: ${N}`,r.EVALUATION_ERROR);Q=Q.substring(0,B)+T+Q.substring(L+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=R1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=R1(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 C3($,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"),j=new RegExp(`^@${K}(?![a-z])`),B=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 D=_.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,z=X===D[2]}let F=1,w=O,A=-1;while(F>0&&w<_.length){W.lastIndex=w,U.lastIndex=w;let D=W.exec(_),y=U.exec(_),S=D?D.index:1/0,k=y?y.index:1/0;if(S<k)F++,w=S+D[0].length;else if(k<1/0){if(F--,F===0){A=k;break}w=k+y[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 R=_.substring(O,A),N=-1,T=0,M=0;while(M<R.length){let D=R.indexOf("@",M);if(D===-1)break;let y=R.substring(D);if(j.test(y)){T++,M=D+1;continue}if(B.test(y)){T--,M=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){N=D;break}M=D+1}let I;if(N!==-1){let D=R.slice(0,N),y=R.slice(N+5);I=z?D:y}else I=z?R:"";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 b4=b(()=>{A2();q1();k$();T0()});function T2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function S4($,Z){if(!$)return Z?.nonceGenerator?.()??T2();let Y=N2.get($);if(!Y)Y=Z?.nonceGenerator?.()??T2(),N2.set($,Y);return Y}function fz($,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 M2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${fz($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function I2($,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?S4(Y,Z):void 0,X=M2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
9104
|
+
${X}`)}function D2($,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?S4(Z,Q):void 0;return M2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return S4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=S4(Z,Q);return X}var N2;var E2=b(()=>{N2=new WeakMap});import gz from"crypto";function dz($=hz){let Z=gz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return v3=Z,Z}function uz(){if(!v3)dz();return v3}function mz($=k2){let Z=uz();return`<input type="hidden" name="${$}" value="${Z}">`}function b2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return mz(J||k2)})}var hz=40,k2="_token",v3=null;var S2=()=>{};async function y2($,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 pz(X,Q,Z,Y,J);else X=await lz(X,Q,Z,Y,J)}return X}async function pz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,q=`@end${Q}`,z=$,W=Y5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],j=W.exec(z);while(j!==null){let[B,_="",H=""]=j,L=j.index||0;try{let V=_?P2(_):[],O=H.trim(),F=await G(O,V,Y,J);U.push({original:B,processed:F,startIndex:L})}catch(V){let O=V instanceof Error?V.message:String(V);if(X.debug)console.error(`Error processing custom directive @${Q}:`,V);U.push({original:B,processed:Z0("CustomDirective",`Error in @${Q}${_?`(${_})`:""}: ${O}`,r.EVALUATION_ERROR),startIndex:L})}j=W.exec(z)}for(let B=U.length-1;B>=0;B--){let{original:_,processed:H}=U[B];z=z.replace(_,H)}return z}async function lz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,q=Y5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),z=[],W=q.exec(K);while(W!==null){let[B,_=""]=W,H=W.index||0;try{let L=P2(_),V=await G("",L,Y,J);z.push({original:B,processed:V,startIndex:H})}catch(L){let V=L instanceof Error?L.message:String(L);if(X.debug)console.error(`Error processing custom directive @${Q}:`,L);z.push({original:B,processed:Z0("CustomDirective",`Error in @${Q}(${_}): ${V}`,r.EVALUATION_ERROR),startIndex:H})}W=q.exec(K)}let U=Y5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=U.exec(K);while(j!==null){let[B]=j,_=j.index||0;try{let H=await G("",[],Y,J);z.push({original:B,processed:H,startIndex:_})}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:B,processed:Z0("CustomDirective",`Error in @${Q}: ${L}`,r.EVALUATION_ERROR),startIndex:_})}j=U.exec(K)}for(let B=z.length-1;B>=0;B--){let{original:_,processed:H}=z[B];K=K.replace(_,H)}return K}function P2($){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 C2=b(()=>{q1();J5()});import cz from"crypto";function M0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function y4($,Z,Y,J){let X=$||Z;return Y?`${X} ${J}`:X}function iz(){return cz.randomUUID()}function P4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=iz();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 f2($,Z,Y=x2){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||"",j=N1(z),B=W.toUpperCase(),_=["GET","POST"].includes(B)?B:"POST",H=`<form method="${M0(_)}" action="${M0(U)}"${j?` ${j}`:""}>`;if(H+=`
|
|
9105
|
+
${P4("@csrf",Z)}`,!["GET","POST"].includes(B))H+=`
|
|
9106
|
+
${P4(`@method('${B}')`,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||"",j=N1(z),B=Y$(W,Z),_=B!==void 0&&B!==null?B:U||"",H=j.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",V=J$(W,Z),O=j.match(/class=['"]([^'"]+)['"]/i),F=y4(O?O[1]:"",Y.input,V,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${M0(L)}" name="${M0(W)}" value="${M0(_)}" class="${F}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let q=N1(G),z=Y$(Q,Z)||K.trim(),W=J$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),j=y4(U?U[1]:"",Y.input,W,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${M0(Q)}" class="${j}"${B?` ${B}`:""}>${M0(z)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let q=N1(G),z=Y$(Q,Z),W=J$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),j=y4(U?U[1]:"",Y.input,W,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),_=K;if(z!==void 0)_=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,V)=>{if((Array.isArray(z)?z.some((F)=>String(F)===V):String(z)===V)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${M0(Q)}" class="${j}"${B?` ${B}`:""}>${_}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="1",K="")=>{let q=N1(K),z=Y$(Q,Z),W=z!==void 0&&(Array.isArray(z)?z.some((_)=>String(_)===G):z===!0||String(z)===G),U=q.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${M0(Q)}" value="${M0(G)}" class="${j}"${W?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let q=N1(K),z=Y$(Q,Z),W=z!==void 0&&z===G,U=q.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${M0(Q)}" value="${M0(G)}" class="${j}"${W?" checked":""}${B?` ${B}`:""}>`}),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=J$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),B=y4(j?j[1]:"",Y.input,U,Y.inputError),_=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${M0(Q)}"`,`class="${B}"`];if(z)H.push(`accept="${M0(z)}"`);if(W)H.push("multiple");if(_)H.push(_);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 g2($,Z,Y=x2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(J$(X,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return v2(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 v2(X,Z)}let q=K.trim();if(G0(q)){let z=X0(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 J$($,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 v2($,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 Y$($,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 x2;var h2=b(()=>{T0();x2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import g3 from"path";async function nz(){if(X$!==void 0)return X$;try{X$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{X$=null}return X$}function oz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function sz($,Z){if({...u3,...Z.i18n}.cache&&h3[$]){let X=h3[$],Q=Z.i18n?.cacheMaxAge??0;if(!oz(X,Q))return X.translations}if(Q$[$]?.state==="loading")return Q$[$].promise;x3[$]="loading";let J=d3($,Z).then((X)=>{return x3[$]="loaded",delete Q$[$],X}).catch((X)=>{throw x3[$]="error",Q$[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return Q$[$]={promise:J,state:"loading"},J}async function d3($,Z){let Y={...u3,...Z.i18n},J=g3.isAbsolute(Y.translationsDir)?Y.translationsDir:g3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await nz(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:$W(Y.format)}):await rz($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return d3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)h3[$]={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 d3(Y.defaultLocale,Z);return{}}}async function rz($,Z,Y){let J=g3.join(Y,`${$}${az(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 tz(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function az($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function tz($){let Z={},Y=$.split(`
|
|
9107
|
+
`),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(),j=W.trim();if(j==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=ez(j)}}return Z}function ez($){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 $W($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function ZW($,Z){return sz($,Z)}function YW($,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 JW($,Z={}){return m2($,Z)}function m2($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=XW($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=QW(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 XW($,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 QW($,Z){let Y=GW($);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 KW(X,Y.slice(2).join(","),Z);case"select":return zW(X,Y.slice(2).join(","));case"selectordinal":return WW(X,Y.slice(2).join(","));case"number":return jW(X,Y[2]?.trim());case"date":return BW(X,Y[2]?.trim());case"time":return _W(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function GW($){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 KW($,Z,Y){let J=Number($)||0,X=m3(Z),Q=`=${J}`;if(X[Q])return f3(X[Q],J,Y);let G=qW(J);if(X[G])return f3(X[G],J,Y);if(X.other)return f3(X.other,J,Y);return String(J)}function f3($,Z,Y){let J=$.replace(/#/g,String(Z));return m2(J,Y)}function qW($){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 zW($,Z){let Y=String($||""),J=m3(Z);if(J[Y])return J[Y];return J.other||String($)}function WW($,Z){let Y=Number($)||0,J=m3(Z),X=UW(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 UW($){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 m3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function jW($,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 BW($,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 _W($,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 HW($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function d2($,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(HW(G))return JW(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),q=G.split("|");G=YW(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 p2($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...u3,...J.i18n},K=await ZW(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await u2(X,Q,async(W,U,j,B,_)=>{try{let H={};if(j)try{let V=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return N0(j,Z)}];for(let O of V)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(V){if(J.debug)console.error("Error parsing parameters for @translate directive:",V)}return d2(U,K,G.fallbackToKey,H)||B.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)}`,r.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,j)=>console.warn(`Match ${j}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return X=await u2(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,U,j,B)=>{try{let _={};if(j)try{let H=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return N0(j,Z)}];for(let L of H)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return d2(U,K,G.fallbackToKey,_)}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return Z0("Translate",`Error in @translate('${U}'): ${_ instanceof Error?_.message:String(_)}`,r.EVALUATION_ERROR)}}),X}async function u2($,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 X$,u3,h3,Q$,x3;var l2=b(()=>{q1();T0();u3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},h3={},Q$={},x3={}});var c3={};e(c3,{streamingSuspenseDirective:()=>n2,streamToResponse:()=>DW,streamTemplateSimple:()=>NW,streamTemplate:()=>LW,renderStreamingPage:()=>VW,registerStreamingDirectives:()=>MW,processStreamDirectives:()=>AW,processSectionDirectives:()=>IW,islandDirective:()=>o2,generateHydrationRuntime:()=>EW,extractStreamBoundaries:()=>RW,createStreamRenderer:()=>TW,buildSuspenseResolveScript:()=>l3,SUSPENSE_RESOLVER_RUNTIME:()=>i2});import C4 from"path";function OW($){let Z=[],Y=0,J;c2.lastIndex=0;while((J=c2.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 LW($,Z={},Y={}){let J={...p1,...Y,streaming:{...p3,...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:C4.dirname($)};if(q.trim())await x1(q,W,$);let U=OW(z),j=new Set;if(!U.some((_)=>_.type==="suspense")){let _=J.streaming?.strategy||"auto",H=new RegExp(i1.source,"g");if(!(_!=="manual"&&H.test(z))){let V=await L0(z,W,$,J,j);for(let O=0;O<V.length;O+=X)Q.enqueue(V.slice(O,O+X)),await new Promise((F)=>setTimeout(F,0))}else{let V=[],O=new RegExp(i1.source,"g"),F;while((F=O.exec(z))!==null)V.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let w=0;for(let A of V){if(A.start>w){let N=z.slice(w,A.start);if(N.trim()){let T=await L0(N,W,$,J,j);Q.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let R=await L0(A.content,W,$,J,j);Q.enqueue(R),await new Promise((N)=>setTimeout(N,0)),w=A.end}if(w<z.length){let A=z.slice(w);if(A.trim()){let R=await L0(A,W,$,J,j);Q.enqueue(R)}}}}else{let _=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let V=await L0(L.content,W,$,J,j);Q.enqueue(V)}else if(L.type==="suspense"&&L.name){let V=`stx-suspense-${L.name}`;Q.enqueue(`<div id="${V}" data-suspense="${L.name}" style="display:contents;">
|
|
9107
9108
|
<template data-suspense-fallback>Loading...</template>
|
|
9108
|
-
</div>`),
|
|
9109
|
+
</div>`),_.set(L.name,L0(L.content,W,$,J,j))}Q.enqueue(`
|
|
9109
9110
|
<script>
|
|
9110
9111
|
(function() {
|
|
9111
9112
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -9121,13 +9122,13 @@ ${X}`)}function M2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?
|
|
|
9121
9122
|
}
|
|
9122
9123
|
};
|
|
9123
9124
|
})();
|
|
9124
|
-
</script>`);let H=Array.from(
|
|
9125
|
+
</script>`);let H=Array.from(_.entries()).map(async([L,V])=>{Q.enqueue(await l3(L,V))});await Promise.all(H)}Q.close()}catch(G){Q.error(G)}}})}async function l3($,Z){try{let J=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
|
|
9125
9126
|
<script>
|
|
9126
9127
|
window.__stxSuspense.resolve('${$}', \`${J}\`);
|
|
9127
9128
|
</script>`}catch(Y){let J=Y instanceof Error?Y.message:String(Y);return`
|
|
9128
9129
|
<script>
|
|
9129
9130
|
window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${s0(J)}</div>');
|
|
9130
|
-
</script>`}}function
|
|
9131
|
+
</script>`}}function FW($,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 VW($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(i2),await Promise.all(Z.map(async(Q)=>{let G=FW(Q.render(),J,Q.id);X.enqueue(await l3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function AW($,Z){return $.replace(wW,(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 RW($){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 NW($,Z={},Y={}){let J={...p1,...Y,streaming:{...p3,...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:C4.dirname($)};if(q.trim())await x1(q,W,$);let U=new Set,j=J.streaming?.strategy||"auto",B=new RegExp(i1.source,"g");if(!(j!=="manual"&&B.test(z))){let H=await L0(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(i1.source,"g"),V;while((V=L.exec(z))!==null)H.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let O=0;for(let F of H){if(F.start>O){let A=z.slice(O,F.start);if(A.trim()){let R=await L0(A,W,$,J,U);Q.enqueue(R)}}let w=await L0(F.content,W,$,J,U);Q.enqueue(w),O=F.end}if(O<z.length){let F=z.slice(O);if(F.trim()){let w=await L0(F,W,$,J,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function TW($,Z={}){let Y={...p1,...Z,streaming:{...p3,...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;i1.lastIndex=0;while((z=i1.exec(G))!==null){let j=z[1],B=z[2];q[j]=B}let W=G.replace(i1,"");return{renderShell:async(j={})=>{let B={...j,__filename:$,__dirname:C4.dirname($)};return await x1(Q,B,$),L0(W,B,$,Y,new Set)},renderSection:async(j,B={})=>{try{if(!q[j])return`<div class="error-message">Section "${s0(j)}" not found in template "${s0($)}"</div>`;let _={...B,__filename:$,__dirname:C4.dirname($)};await x1(Q,_,$);let H=new Set;return await L0(q[j],_,$,Y,H)}catch(_){let H=_ instanceof Error?_.message:String(_);return z0("Expression",H,$,q[j]||"",0,q[j]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function MW($={}){let Z=[];if($.streaming?.enabled)Z.push(n2);if($.hydration?.enabled)Z.push(o2);return Z}async function IW($,Z,Y,J={}){return $}function DW($,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 EW($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
|
|
9131
9132
|
`);if(Z==="loader")return`
|
|
9132
9133
|
(function() {
|
|
9133
9134
|
window.__stx = window.__stx || {};
|
|
@@ -9269,7 +9270,7 @@ else {
|
|
|
9269
9270
|
else {
|
|
9270
9271
|
stx.hydrate();
|
|
9271
9272
|
}
|
|
9272
|
-
})();`}var p3,i1,
|
|
9273
|
+
})();`}var p3,i1,c2,i2=`
|
|
9273
9274
|
<script>
|
|
9274
9275
|
(function(){
|
|
9275
9276
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -9289,25 +9290,25 @@ else {
|
|
|
9289
9290
|
}
|
|
9290
9291
|
};
|
|
9291
9292
|
})();
|
|
9292
|
-
</script>`,
|
|
9293
|
+
</script>`,wW,n2,o2;var i3=b(()=>{l1();Y1();n$();R0();p3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},i1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,c2=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;wW=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;n2={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} -->`}},o2={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}">
|
|
9293
9294
|
${z}
|
|
9294
9295
|
<script type="application/json" data-island-props="${G}">
|
|
9295
9296
|
${q?`{${q}}`:"{}"}
|
|
9296
9297
|
</script>
|
|
9297
|
-
</div>`}}});var
|
|
9298
|
-
`).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(
|
|
9299
|
-
`}if(F){let S=[];if(W==="avif"||W==="auto"){let k=K$(J,w,A,
|
|
9298
|
+
</div>`}}});var a2={};e(a2,{warnUnbalancedTags:()=>n3,findUnbalancedTags:()=>r2});function j5($){return $.replace(/[^\n]/g," ")}function r2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,j5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,j5).replace(/<!--[\s\S]*?-->/g,j5).replace(/\{\{\{[\s\S]*?\}\}\}/g,j5).replace(/\{\{[\s\S]*?\}\}/g,j5).replace(/\{!![\s\S]*?!!\}/g,j5),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(kW.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(`
|
|
9299
|
+
`).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(bW.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 n3($,Z){let Y;try{Y=r2($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(s2.has(J))return;s2.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 kW,bW,s2;var o3=b(()=>{kW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),bW=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);s2=new Set});import c0 from"path";import s3 from"fs";function t2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function e2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class $Y{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 B=[X,X.toLowerCase(),t2(X),e2(X)];for(let _ of B)if(Q.has(_))return Q.get(_)}let G=[...new Set([`${X}.stx`,`${t2(X)}.stx`,`${e2(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let B=c0.resolve(c0.dirname(Z),`${X}.stx`);if(await o(B))return B;return null}let K=[],q=Y.componentsDir||"",z=J?.__originalFilePath;if(z)K.push(c0.join(c0.dirname(z),"components"));if(q)K.push(q);let W=c0.join(c0.dirname(Z),"components");if(!K.includes(W))K.push(W);let U=process.cwd(),j=[c0.resolve(U,"src/components"),c0.resolve(U,"components"),c0.resolve(import.meta.dir,"components")];for(let B of j)if(!K.includes(B))K.push(B);for(let B of K){if(!B)continue;for(let _ of G){let H=c0.join(B,_);if(await o(H))return H}try{if(!s3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let H=s3.readdirSync(B,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let V=c0.join(B,L.name);for(let O of G){let F=c0.join(V,O);if(await o(F))return F}}}catch{}}return null}}var x0;var r3=b(()=>{R0();x0=new $Y});function y0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function B5($,Z){let Y=[];for(let[J,X]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof X==="boolean"){if(X)Y.push(y0(Q));continue}Y.push(`${y0(Q)}="${y0(X)}"`)}return Y}var v4=()=>{};function G$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function SW($){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 a3;var t3=b(()=>{v4();a3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=SW($),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="${G$(J.value)}"`);else q.push(`href="${G$(J.value)}"`);if(X)q.push(`class="${G$(X)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${G$(Q)}"`),q.push(`data-stx-exact-active-class="${G$(G)}"`),K)q.push("data-stx-prefetch");let z=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...B5($,z)),`<a ${q.join(" ")}>${Z}</a>`}}});function E0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function P0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function $6($,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 ZY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=yW[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 Z6($,Z,Y,J){return Z.map((X)=>`${K$($,X,void 0,Y,J)} ${X}w`).join(", ")}function PW($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${K$($,G,void 0,J,X)} ${Q}x`}).join(", ")}function K$($,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 CW($,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 yW,e3,Y6;var J6=b(()=>{v4();yW={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},e3=[320,640,768,1024,1280,1536,1920];Y6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=P0($,"src")||"",X=P0($,"alt")||"",Q=P0($,"width"),G=P0($,"height"),K=P0($,"sizes"),q=P0($,"srcset"),z=P0($,"densities"),W=P0($,"format"),U=P0($,"placeholder"),j=P0($,"placeholderColor")||"#e5e7eb",B=P0($,"provider"),_=P0($,"class")||P0($,"className")||"",H=P0($,"style")||"",L=P0($,"quality"),V=$6($,"lazy",!0),O=$6($,"preload",!1),F=$6($,"picture",!1)||!!W,w=Q?Number.parseInt(Q):void 0,A=G?Number.parseInt(G):void 0,R=q||"",N="";if(!R&&K)R=Z6(J,e3,B,W),N=ZY(K);else if(!R&&z){let S=z.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));R=PW(J,S,w,B,W)}else if(K)N=ZY(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 S=CW(w||16,A||9,j);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${E0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=K$(J,w,A,B,W),I=[];if(I.push(`src="${E0(M)}"`),I.push(`alt="${E0(X)}"`),Q)I.push(`width="${E0(Q)}"`);if(G)I.push(`height="${E0(G)}"`);if(V)I.push('loading="lazy"');if(I.push('decoding="async"'),_)I.push(`class="${E0(_)}"`);if(T.length>0)I.push(`style="${E0(T.join(";"))}"`);if(R)I.push(`srcset="${E0(R)}"`);if(N)I.push(`sizes="${E0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...B5($,E));let D=`<img ${I.join(" ")} />`,y="";if(O){let k=W==="webp"?"image/webp":W==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${E0(M)}"${k?` type="${k}"`:""}${R?` imagesrcset="${E0(R)}"`:""}${N?` imagesizes="${E0(N)}"`:""} />
|
|
9300
|
+
`}if(F){let S=[];if(W==="avif"||W==="auto"){let k=K$(J,w,A,B,"avif"),C=R?Z6(J,e3,B,"avif"):`${k}`;S.push(`<source type="image/avif" srcset="${E0(C)}"${N?` sizes="${E0(N)}"`:""} />`)}if(W==="webp"||W==="auto"){let k=K$(J,w,A,B,"webp"),C=R?Z6(J,e3,B,"webp"):`${k}`;S.push(`<source type="image/webp" srcset="${E0(C)}"${N?` sizes="${E0(N)}"`:""} />`)}return`${y}<picture>
|
|
9300
9301
|
${S.join(`
|
|
9301
9302
|
`)}
|
|
9302
9303
|
${D}
|
|
9303
|
-
</picture>`}return`${y}${D}`}}});function q$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function
|
|
9304
|
+
</picture>`}return`${y}${D}`}}});function q$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function _5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var YY="/images/safe-image-default.svg",vW,X6;var Q6=b(()=>{v4();vW=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${YY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,X6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=_5($,"src")||"",X=_5($,"alt")||"",Q=_5($,"fallback")||YY,G=_5($,"class")||_5($,"className")||"",K=_5($,"fallbackClassName")||"",q=[];if(q.push(`src="${q$(J)}"`),q.push(`alt="${q$(X)}"`),G)q.push(`class="${q$(G)}"`);if(q.push(`data-fallback="${q$(Q)}"`),K)q.push(`data-fallback-class="${q$(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let z=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...B5($,z));let W=`<img ${q.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${vW}${W}`;return W}}});function G6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function z$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function x4($,Z,Y){let J=z$($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var K6;var q6=b(()=>{K6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=G6(z$($,"color")||"#6366f1"),X=G6(z$($,"initialColor")||z$($,"initial-color")||""),Q=G6(z$($,"height")||"3px"),G=x4($,"duration",2000),K=x4($,"throttle",200),q=x4($,"zIndex",999999)||x4($,"z-index",999999),z=X?`linear-gradient(to right, ${X}, ${J})`:J;return`
|
|
9304
9305
|
<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">
|
|
9305
9306
|
<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>
|
|
9306
9307
|
</div>
|
|
9307
9308
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
9308
9309
|
<script>
|
|
9309
9310
|
(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()})})();
|
|
9310
|
-
</script>`}}});function
|
|
9311
|
+
</script>`}}});function XY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function xW($,Z,Y){let J=XY($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var JY,z6;var W6=b(()=>{JY={"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%)"},z6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=y0(XY($,"position")||"top-right"),X=xW($,"max",5),Q=JY[J]||JY["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>
|
|
9311
9312
|
<style>
|
|
9312
9313
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
9313
9314
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -9315,7 +9316,7 @@ ${D}
|
|
|
9315
9316
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
9316
9317
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
9317
9318
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
9318
|
-
</style>`}}});function f4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var
|
|
9319
|
+
</style>`}}});function f4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var QY,U6;var j6=b(()=>{QY={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)"},U6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=f4($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=y0(J),Q=f4($,"size")||"md",G=f4($,"closeOnBackdrop")!=="false",K=f4($,"closeOnEscape")!=="false",q=QY[Q]||QY.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">
|
|
9319
9320
|
<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)">
|
|
9320
9321
|
<div style="padding:1.5rem">${Z}</div>
|
|
9321
9322
|
</div>
|
|
@@ -9324,8 +9325,8 @@ ${D}
|
|
|
9324
9325
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
9325
9326
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
9326
9327
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
9327
|
-
</style>`}}});function H5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var
|
|
9328
|
-
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${
|
|
9328
|
+
</style>`}}});function H5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var GY,B6;var _6=b(()=>{GY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},B6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=H5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=y0(J),Q=H5($,"side")||"right",G=H5($,"size")||"md",K=H5($,"closeOnBackdrop")!=="false",q=H5($,"closeOnEscape")!=="false",z=H5($,"overlay")!=="false",W=GY[G]||GY.md,U=Q==="left",j=U?"left:0":"right:0",B=U?"translateX(-100%)":"translateX(100%)",_=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">
|
|
9329
|
+
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${j};width:${W};max-width:100vw;transform:${B};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">
|
|
9329
9330
|
<div style="padding:1.5rem">${Z}</div>
|
|
9330
9331
|
</div>
|
|
9331
9332
|
</div>
|
|
@@ -9333,18 +9334,18 @@ ${D}
|
|
|
9333
9334
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
9334
9335
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
9335
9336
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
9336
|
-
</style>`}}});import{existsSync as
|
|
9337
|
-
`||T==="\t")V++;O=R+H.length}else{if(V--,V===0){F=N;break}O=N+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:j,content:w,startIndex:Q,endIndex:A,isSelfClosing:!1}),X=A}}return J}function UY($,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 BY=b(()=>{T0();R0();C1()});var VY={};e(VY,{processESImports:()=>LY,processComponents:()=>m4});import u4 from"fs";import d0 from"path";function uW($,Z,Y){let J={static:{},staticNames:{},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=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,z)=>z.toUpperCase())},G=(K,q)=>{let z=Q(K);if(J.static[z]=q,z!==K)J.staticNames[z]=K};for(let[K,q]of Object.entries($)){let z=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(z.startsWith("@")){J.events[z]=q;continue}if(z.startsWith("__stx_")){let W=Q(z.slice(6));J.serverDynamic[W]=UY(q,Y);continue}if(z.startsWith(":")){let W=Q(z.slice(1)),U=q===A6?W:q;try{if(!G0(U)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${U}`);J.clientReactive[W]=U;continue}let B=Object.keys(Z),j=K0(U,B)(...Object.values(Z));if(j===void 0){let H=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!B.includes(O))){J.clientReactive[W]=U;continue}}J.serverDynamic[W]=j}catch{J.clientReactive[W]=U}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let W=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let U=W[1];if(G0(U)){let _=K0(U,Object.keys(Z))(...Object.values(Z));G(z,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${z}: ${U}`);G(z,q)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${z}:`,U);G(z,q)}else{let U=q,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=B.exec(q))!==null)try{let j=_[1];if(!G0(j)){if(Y.debug)console.error(`Unsafe expression in ${z}: ${j}`);continue}let L=K0(j,Object.keys(Z))(...Object.values(Z));U=U.replace(_[0],String(L??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${z}:`,j)}G(z,U)}continue}G(z,q===A6?"true":q)}return J}function mW($){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]=A6}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(v0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function lW($){let Z=HY.get($);if(Z)return Z;let Y=new Map,J=[d0.join($,"src"),d0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=u4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let z=d0.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 HY.set($,Y),Y}function cW($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=d0.join(Y,"node_modules",$);try{if(u4.statSync(J).isDirectory())return J}catch{}let X=d0.dirname(Y);if(X===Y)return null;Y=X}}async function LY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=d0.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,V,O,F]=j,w=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=d0.resolve(G,F);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(u4.statSync(M).isFile())A=M}catch{try{if(u4.statSync(T).isDirectory())w=T}catch{}}}}else w=cW(F,G);if(!w&&!A)continue;let R=!1,N=(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)N(O,A),R=!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?lW(w):null;for(let{source:I,local:E}of T){let D=null;if(A)D=A;else if(M)D=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)N(E,D),R=!0}}if(R)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 iW($,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((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),V=null,O=[d0.resolve(d0.dirname(Y),`${B}.stx`),d0.resolve(d0.dirname(Y),B),d0.resolve(J.componentsDir||"components",`${B}.stx`),d0.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 nW($,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 V=L[1],O,F=j.slice(L[0].length),w=F.match(/^\s*,\s*/);if(w)O=F.slice(w[0].length).trim();let A={};if(O)try{A=N0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(W,H),`[Error parsing component props: ${D}]`);continue}let R="",N=H,M=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)R=M[1].trim(),N=H+M[0].length;let I=await h1(V,A,R,G,Z,Y,J,K,X);Q=Q.substring(0,W)+I+Q.substring(N),q.lastIndex=0}return Q}async function oW($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=O1(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,dW),Q=x5(Q,q.scripts),Q;async function B(_,j,H,L){if(!_)return _;let V=_,O=WY(V,j,L);for(let F=O.length-1;F>=0;F--){let w=O[F],A=H?d4(w.tagName):w.tagName,R=mW(w.attributes),N=uW(R,Z,J),T=v0.getBuiltin(w.tagName),M=T?await i$(A,G,Z,Y,J):!1;if(T&&!M){let y={context:Z,filePath:Y,options:J,dependencies:X},S=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)S=OY(S,N.clientReactive);if(Object.keys(N.events).length>0){let k=Object.entries(N.events).map(([C,x])=>`${C}="${jY(x)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}V=V.substring(0,w.startIndex)+S+V.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await i$(A,G,Z,Y,J))continue;let I={};for(let[y,S]of Object.entries(N.static))I[y]=S;for(let[y,S]of Object.entries(N.serverDynamic))I[y]=S;let D=await h1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(N.clientReactive).length>0)D=OY(D,N.clientReactive);if(Object.keys(N.events).length>0){let y=FY(D);if(y){let S=Object.entries(N.events).map(([C,x])=>`${C}="${jY(x)}"`).join(" "),k=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${k}" ${S}`+D.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+D+V.substring(w.endIndex)}return V}}function OY($,Z){let Y=FY($);if(!Y)return $;let J=new Set(["if","for","show"]),X=Object.entries(Z).map(([K,q])=>`:${d4(K)}="${q.replace(/"/g,""")}"`).join(" "),Q=Object.keys(Z).filter((K)=>!J.has(K)).map((K)=>d4(K)).join(" "),G=Q?` data-stx-parent-bindings="${Q}"`:"";return $.substring(0,Y.insertPos)+`${G} ${X}`+$.substring(Y.insertPos)}function FY($){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 m4($,Z,Y,J,X){if(!_Y)qY(),_Y=!0;let Q=await LY($,Z,Y,J,X);Q=await iW(Q,Z,Y,J,X),Q=await nW(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let q=Z1(Q,v5,(W,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...q.tokens);let z=Q;if(Q=await oW(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 _Y=!1,A6="\x00stx-boolean-attribute",dW,HY;var R6=b(()=>{r3();zY();BY();C1();R0();T0();dW=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"]);HY=new Map});var IY={};e(IY,{processLoops:()=>N6});function aW($,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 V=N0(L,Z),O=JSON.stringify(V),F=`@component('${_}', ${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 p4($,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 tW($,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);F$(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 eW($,Z){let Y=$;return Y=p4(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(X0(Q,Z));return G?l4:""}catch{return""}}),Y=p4(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(X0(Q,Z));return G?c4:""}catch{return""}}),Y}function $U($){let Z=$;return Z=Z.replace(/@break(?!\()/g,l4),Z=Z.replace(/@continue(?!\()/g,c4),Z}function wY($){let Z=$.includes(l4),Y=Z?$.substring(0,$.indexOf(l4)):$;return{hasBreak:Z,content:Y}}function AY($){let Z=$.includes(c4),Y=Z?$.substring(0,$.indexOf(c4)):$;return{hasContinue:Z,content:Y}}function NY($){let Z=$;return Z=p4(Z,"@break",(Y)=>{let J=Y.trim();if(!V$(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=p4(Z,"@continue",(Y)=>{let J=Y.trim();if(!V$(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function ZU($){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 V=H.substring(0,L).trim(),O=H.substring(L+4).trim(),F=j+1,w=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let S=R.exec($),k=N.exec($);if(!k)break;if(S&&S.index<k.index)w++,A=S.index+S[0].length;else{if(w--,w===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(F,T),I=T+11,E=-1,D=0,y=0;while(y<M.length){let S=M.indexOf("@",y);if(S===-1)break;let k=M.substring(S);if(/^@forelse\s*\(/.test(k))D++,y=S+1;else if(k.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&k.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){E=S;break}y=S+1}else y=S+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 RY($,Z){let Y=$;while(!0){let J=ZU(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=X0(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}`,r.EVALUATION_ERROR);Y=Y.substring(0,X)+B+Y.substring(Q)}}return Y}function N6($,Z,Y,J){let X=$;X=RY(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),V=L.indexOf(" as ");if(V===-1)continue;let O=U,F=L.substring(0,V),w=L.substring(V+4),A=H+1,R=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(R>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let I=T.exec(q),E=M.exec(q);if(!E)break;if(I&&I.index<E.index)R++,N=I.index+I[0].length;else{if(R--,R===0){let D=q.substring(A,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:F,itemVar:w,content:D}}N=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 V=j.trim(),O;if(G0(V))O=K0(V,Object.keys(z))(...Object.values(z));else O=X0(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`,r.TYPE_ERROR);W=W.substring(0,B)+E+W.substring(_);continue}let w=J?.loops?.useAltLoopVariable??rW,A=H.trim(),R=null,N,T=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],T=!0;else N=A}else N=A;let M="",I=O;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...z,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,c)=>{if(d)S[d]=D[c]});else S[N]=D}else S[N]=D;if(R)if(!T&&F&&Array.isArray(D)&&D.length===2)S[R]=D[0],S[N]=D[1];else S[R]=E;let k=eW(L,S),C=AY(k);if(C.hasContinue){M+=C.content;continue}let x=wY(k);if(x.hasBreak){M+=x.content;break}if(k=RY(k,S),k=G(k,S),k=c1(k,S,Y),k=$U(k),x=wY(k),x.hasBreak){M+=x.content;break}if(C=AY(k),C.hasContinue){M+=C.content;continue}k=L1(k,S,Y),k=tW(k,S),k=aW(k,S),M+=k}W=W.substring(0,B)+M+W.substring(_)}catch(V){let O=Z0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${V instanceof Error?V.message:String(V)}`,r.EVALUATION_ERROR);W=W.substring(0,B)+O+W.substring(_)}}return W}X=G(X,Z),X=MY(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??sW;return X=XU(X,Z,K),X}function TY($){return V$($)}function MY($,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=C0(X,"(",")",q);if(z===-1)break;let W=X.slice(q+1,z),U=z+1,B=E$(X.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!TY(W)){let H=Z0("For",`Unsafe expression in @for: ${W}`,r.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(j),Q=!0;continue}try{let H=YU(W),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let R=JU({forExpr:W,content:_,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+R+X.substring(j),Q=!0;continue}let V=Object.keys(Z),O=Object.values(Z),F=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=NY(F);let A=Function(...V,`
|
|
9337
|
+
</style>`}}});import{existsSync as fW,readFileSync as gW}from"fs";function hW($){if(KY.has($))return;KY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function dW($){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(fW(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return U0.resolve(Y)}catch{}return null}function uW($){if(g4.has($))return g4.get($);let Z=dW($);if(!Z)return hW($),null;try{let Y=JSON.parse(gW(Z,"utf8"));return g4.set($,Y.icons),Y.icons}catch{return null}}function O5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var g4,KY,H6;var O6=b(()=>{g4=new Map,KY=new Set;H6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=O5($,"name")??O5($,"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=y0(O5($,"size")||"24"),K=y0(O5($,"color")||"currentColor"),q=y0(O5($,"class")||""),z=y0(O5($,"style")||""),W=g4.get(X)??uW(X);if(!W)return`<!-- Icon: collection "${X}" not loaded -->`;let U=W[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${X} -->`;let j=U.width||24,B=U.height||24,_=`0 0 ${j} ${B}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",V=z?` style="${z}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${_}" fill="none"${L}${V}>${H}</svg>`}}});function qY($,...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 zY($,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 L6;var F6=b(()=>{L6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=zY(Z,"fallback"),X=J.rest,Q=zY(X,"error"),G=Q.rest,K=J.region??qY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??qY($,"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 h4($,...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 V6;var w6=b(()=>{V6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(h4($,"name")||"v").replace(/["'<>]/g,""),X=(h4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=h4($,"class"),G=h4($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function WY(){x0.registerBuiltin(a3),x0.registerBuiltin(Y6),x0.registerBuiltin(X6),x0.registerBuiltin(K6),x0.registerBuiltin(z6),x0.registerBuiltin(U6),x0.registerBuiltin(B6),x0.registerBuiltin(H6),x0.registerBuiltin(L6),x0.registerBuiltin(V6)}var UY=b(()=>{t3();J6();Q6();q6();W6();j6();_6();O6();F6();w6();r3();t3();J6();Q6();q6();W6();j6();_6();O6();F6();w6()});function d4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function jY($,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,j=-1,B=!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]===">"){j=z+2,B=!0;break}if(H===">"){j=z+1;break}z++}if(j===-1){X=Q+1;continue}let _=$.slice(U,B?j-2:j-1).trim();if(B)J.push({fullMatch:$.slice(Q,j),tagName:q,attributes:_,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let H=`<${q}`,L=`</${q}>`,V=1,O=j,F=-1;while(V>0&&O<$.length){let R=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(R!==-1&&R<N){let T=$[R+H.length];if(T===" "||T===">"||T==="/"||T===`
|
|
9338
|
+
`||T==="\t")V++;O=R+H.length}else{if(V--,V===0){F=N;break}O=N+L.length}}if(F===-1){X=j;continue}let w=$.slice(j,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 BY($,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 _Y=b(()=>{T0();R0();C1()});var AY={};e(AY,{processESImports:()=>VY,processComponents:()=>m4});import u4 from"fs";import d0 from"path";function pW($,Z,Y){let J={static:{},staticNames:{},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=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,z)=>z.toUpperCase())},G=(K,q)=>{let z=Q(K);if(J.static[z]=q,z!==K)J.staticNames[z]=K};for(let[K,q]of Object.entries($)){let z=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(z.startsWith("@")){J.events[z]=q;continue}if(z.startsWith("__stx_")){let W=Q(z.slice(6));J.serverDynamic[W]=BY(q,Y);continue}if(z.startsWith(":")){let W=Q(z.slice(1)),U=q===A6?W:q;try{if(!G0(U)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${U}`);J.clientReactive[W]=U;continue}let j=Object.keys(Z),_=K0(U,j)(...Object.values(Z));if(_===void 0){let H=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!j.includes(O))){J.clientReactive[W]=U;continue}}J.serverDynamic[W]=_}catch{J.clientReactive[W]=U}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let W=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let U=W[1];if(G0(U)){let B=K0(U,Object.keys(Z))(...Object.values(Z));G(z,B!=null?String(B):"")}else{if(Y.debug)console.error(`Unsafe expression in ${z}: ${U}`);G(z,q)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${z}:`,U);G(z,q)}else{let U=q,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=j.exec(q))!==null)try{let _=B[1];if(!G0(_)){if(Y.debug)console.error(`Unsafe expression in ${z}: ${_}`);continue}let L=K0(_,Object.keys(Z))(...Object.values(Z));U=U.replace(B[0],String(L??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${z}:`,_)}G(z,U)}continue}G(z,q===A6?"true":q)}return J}function lW($){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]=A6}return Z}function OY($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function cW($){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(x0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function iW($){let Z=LY.get($);if(Z)return Z;let Y=new Map,J=[d0.join($,"src"),d0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=u4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let z=d0.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 j=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,z)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return LY.set($,Y),Y}function nW($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=d0.join(Y,"node_modules",$);try{if(u4.statSync(J).isDirectory())return J}catch{}let X=d0.dirname(Y);if(X===Y)return null;Y=X}}async function VY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=d0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(z,W,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=U,_,H=[];while((_=j.exec(U))!==null){let[L,V,O,F]=_,w=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=d0.resolve(G,F);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(u4.statSync(M).isFile())A=M}catch{try{if(u4.statSync(T).isDirectory())w=T}catch{}}}}else w=nW(F,G);if(!w&&!A)continue;let R=!1,N=(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)N(O,A),R=!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?iW(w):null;for(let{source:I,local:E}of T){let D=null;if(A)D=A;else if(M)D=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)N(E,D),R=!0}}if(R)H.push({start:_.index,end:_.index+L.length})}if(H.length===0)return z;for(let L=H.length-1;L>=0;L--)B=B.slice(0,H[L].start)+B.slice(H[L].end);return`<script${W}>${B}</script>`}),K}async function oW($,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((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let B=j.split("/"),H=B[B.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=[d0.resolve(d0.dirname(Y),`${j}.stx`),d0.resolve(d0.dirname(Y),j),d0.resolve(J.componentsDir||"components",`${j}.stx`),d0.resolve(J.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.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: ${j}`)}Q=Q.replace(z,""),K.lastIndex=0}return Q}async function sW($,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,j=1,B=U+1;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")"){if(j--,j===0)break}B++}if(j!==0)break;let _=Q.substring(U+1,B),H=B+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=N0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(W,H),`[Error parsing component props: ${D}]`);continue}let R="",N=H,M=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)R=M[1].trim(),N=H+M[0].length;let I=await h1(V,A,R,G,Z,Y,J,K,X);Q=Q.substring(0,W)+I+Q.substring(N),q.lastIndex=0}return Q}async function rW($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=O1(Q);return Q=q.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,mW),Q=x5(Q,q.scripts),Q;async function j(B,_,H,L){if(!B)return B;let V=B,O=jY(V,_,L);for(let F=O.length-1;F>=0;F--){let w=O[F],A=H?d4(w.tagName):w.tagName,R=lW(w.attributes),N=pW(R,Z,J),T=x0.getBuiltin(w.tagName),M=T?await i$(A,G,Z,Y,J):!1;if(T&&!M){let y={context:Z,filePath:Y,options:J,dependencies:X},S=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)S=FY(S,N.clientReactive);if(Object.keys(N.events).length>0){let k=Object.entries(N.events).map(([C,x])=>`${C}="${OY(x)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}V=V.substring(0,w.startIndex)+S+V.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await i$(A,G,Z,Y,J))continue;let I={};for(let[y,S]of Object.entries(N.static))I[y]=S;for(let[y,S]of Object.entries(N.serverDynamic))I[y]=S;let D=await h1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(N.clientReactive).length>0)D=FY(D,N.clientReactive);if(Object.keys(N.events).length>0){let y=wY(D);if(y){let S=Object.entries(N.events).map(([C,x])=>`${C}="${OY(x)}"`).join(" "),k=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${k}" ${S}`+D.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+D+V.substring(w.endIndex)}return V}}function FY($,Z){let Y=wY($);if(!Y)return $;let J=new Set(["if","for","show"]),X=Object.entries(Z).map(([K,q])=>`:${d4(K)}="${q.replace(/"/g,""")}"`).join(" "),Q=Object.keys(Z).filter((K)=>!J.has(K)).map((K)=>d4(K)).join(" "),G=Q?` data-stx-parent-bindings="${Q}"`:"";return $.substring(0,Y.insertPos)+`${G} ${X}`+$.substring(Y.insertPos)}function wY($){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 m4($,Z,Y,J,X){if(!HY)WY(),HY=!0;let Q=await VY($,Z,Y,J,X);Q=await oW(Q,Z,Y,J,X),Q=await sW(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let q=Z1(Q,v5,(W,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...q.tokens);let z=Q;if(Q=await rW(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=cW(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 HY=!1,A6="\x00stx-boolean-attribute",mW,LY;var R6=b(()=>{r3();UY();_Y();C1();R0();T0();mW=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"]);LY=new Map});var EY={};e(EY,{processLoops:()=>N6});function eW($,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,j=W.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let B=j[1],_=W.slice(j[0].length),H=_.match(/^\s*,\s*/);if(!H)continue;let L=_.slice(H[0].length).trim();if(!L)continue;try{let V=N0(L,Z),O=JSON.stringify(V),F=`@component('${B}', ${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 p4($,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 j=J.substring(K+1,z),B=Y(j);J=J.substring(0,G)+B+J.substring(z+1)}return J}function $U($,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);F$(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 ZU($,Z){let Y=$;return Y=p4(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(X0(Q,Z));return G?l4:""}catch{return""}}),Y=p4(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(X0(Q,Z));return G?c4:""}catch{return""}}),Y}function YU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,l4),Z=Z.replace(/@continue(?!\()/g,c4),Z}function RY($){let Z=$.includes(l4),Y=Z?$.substring(0,$.indexOf(l4)):$;return{hasBreak:Z,content:Y}}function NY($){let Z=$.includes(c4),Y=Z?$.substring(0,$.indexOf(c4)):$;return{hasContinue:Z,content:Y}}function MY($){let Z=$;return Z=p4(Z,"@break",(Y)=>{let J=Y.trim();if(!V$(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=p4(Z,"@continue",(Y)=>{let J=Y.trim();if(!V$(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function JU($){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,j=K.length-1,B=0;while(U<=j){let _=U+j>>1;if(K[_].pos<=W)B=K[_].depth,U=_+1;else j=_-1}return B}while((Y=Z.exec($))!==null){if(z(Y.index)>0)continue;let W=Y.index,U=Y.index+Y[0].length-1,j=1,B=U+1,_=-1;while(B<$.length&&j>0){if($[B]==="(")j++;else if($[B]===")"){if(j--,j===0){_=B;break}}B++}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,R=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let S=R.exec($),k=N.exec($);if(!k)break;if(S&&S.index<k.index)w++,A=S.index+S[0].length;else{if(w--,w===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(F,T),I=T+11,E=-1,D=0,y=0;while(y<M.length){let S=M.indexOf("@",y);if(S===-1)break;let k=M.substring(S);if(/^@forelse\s*\(/.test(k))D++,y=S+1;else if(k.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&k.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){E=S;break}y=S+1}else y=S+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 TY($,Z){let Y=$;while(!0){let J=JU(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=X0(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),j=Z0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,r.EVALUATION_ERROR);Y=Y.substring(0,X)+j+Y.substring(Q)}}return Y}function N6($,Z,Y,J){let X=$;X=TY(X,Z);function Q(q){let z=/@foreach\s*\(/g,W;while((W=z.exec(q))!==null){let U=W.index,j=W.index+W[0].length-1,B=1,_=j+1,H=-1;while(_<q.length&&B>0){if(q[_]==="(")B++;else if(q[_]===")"){if(B--,B===0){H=_;break}}_++}if(H===-1)continue;let L=q.substring(j+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,R=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(R>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let I=T.exec(q),E=M.exec(q);if(!E)break;if(I&&I.index<E.index)R++,N=I.index+I[0].length;else{if(R--,R===0){let D=q.substring(A,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:F,itemVar:w,content:D}}N=E.index+11}}}return null}function G(q,z){let W=q;while(!0){let U=Q(W);if(!U)break;let{start:j,end:B,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=X0(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`,r.TYPE_ERROR);W=W.substring(0,j)+E+W.substring(B);continue}let w=J?.loops?.useAltLoopVariable??tW,A=H.trim(),R=null,N,T=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],T=!0;else N=A}else N=A;let M="",I=O;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...z,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,c)=>{if(d)S[d]=D[c]});else S[N]=D}else S[N]=D;if(R)if(!T&&F&&Array.isArray(D)&&D.length===2)S[R]=D[0],S[N]=D[1];else S[R]=E;let k=ZU(L,S),C=NY(k);if(C.hasContinue){M+=C.content;continue}let x=RY(k);if(x.hasBreak){M+=x.content;break}if(k=TY(k,S),k=G(k,S),k=c1(k,S,Y),k=YU(k),x=RY(k),x.hasBreak){M+=x.content;break}if(C=NY(k),C.hasContinue){M+=C.content;continue}k=L1(k,S,Y),k=$U(k,S),k=eW(k,S),M+=k}W=W.substring(0,j)+M+W.substring(B)}catch(V){let O=Z0("Foreach",`Error in @foreach(${_.trim()} as ${H.trim()}): ${V instanceof Error?V.message:String(V)}`,r.EVALUATION_ERROR);W=W.substring(0,j)+O+W.substring(B)}}return W}X=G(X,Z),X=DY(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??aW;return X=GU(X,Z,K),X}function IY($){return V$($)}function DY($,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=v0(X,"(",")",q);if(z===-1)break;let W=X.slice(q+1,z),U=z+1,j=E$(X.slice(K),"for","endfor");if(j.length===0)break;let B=j[0].content,_=K+j[0].end;if(!IY(W)){let H=Z0("For",`Unsafe expression in @for: ${W}`,r.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(_),Q=!0;continue}try{let H=XU(W),L=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(H.length>0&&L){let R=QU({forExpr:W,content:B,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+R+X.substring(_),Q=!0;continue}let V=Object.keys(Z),O=Object.values(Z),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=MY(F);let A=Function(...V,`
|
|
9338
9339
|
let result = '';
|
|
9339
9340
|
for (${W}) {
|
|
9340
9341
|
result += \`${F}\`;
|
|
9341
9342
|
}
|
|
9342
9343
|
return result;
|
|
9343
|
-
`)(...O);X=X.substring(0,K)+A+X.substring(
|
|
9344
|
+
`)(...O);X=X.substring(0,K)+A+X.substring(_),Q=!0}catch(H){let L=Z0("For",`Error in @for(${W}): ${H instanceof Error?H.message:String(H)}`,r.EVALUATION_ERROR);X=X.substring(0,K)+L+X.substring(_),Q=!0}}return X}function XU($){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 j=q.slice(z+1).trim(),B=j.indexOf("=");return(B>=0?j.slice(0,B):j).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 QU($){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",`
|
|
9344
9345
|
for (${Z}) {
|
|
9345
9346
|
__pushIter([${J.join(", ")}])
|
|
9346
9347
|
}
|
|
9347
|
-
`),W=[];z(...q,(
|
|
9348
|
+
`),W=[];z(...q,(B)=>{W.push(B)});let U=Q??"inline.stx",j="";for(let B of W){let _={...X};J.forEach((L,V)=>{_[L]=B[V]});let H=DY(Y,_,Q,G);H=c1(H,_,U),H=L1(H,_,U),j+=H}return j}function GU($,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=v0(J,"(",")",K);if(q===-1)break;let z=J.slice(K+1,q),W=E$(J.slice(G),"while","endwhile");if(W.length===0)break;let U=W[0].content,j=G+W[0].end;if(!IY(z)){let B=Z0("While",`Unsafe expression in @while: ${z}`,r.UNSAFE_EXPRESSION);J=J.substring(0,G)+B+J.substring(j),X=!0;continue}try{let B=Object.keys(Z),_=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});H=MY(H);let V=Function(...B,`
|
|
9348
9349
|
let result = '';
|
|
9349
9350
|
let maxIterations = ${Y}; // Configurable safety limit
|
|
9350
9351
|
let counter = 0;
|
|
@@ -9356,8 +9357,8 @@ ${D}
|
|
|
9356
9357
|
result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
9357
9358
|
}
|
|
9358
9359
|
return result;
|
|
9359
|
-
`)(...
|
|
9360
|
-
`)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
|
|
9360
|
+
`)(..._);J=J.substring(0,G)+V+J.substring(j),X=!0}catch(B){let _=Z0("While",`Error in @while(${z}): ${B instanceof Error?B.message:String(B)}`,r.EVALUATION_ERROR);J=J.substring(0,G)+_+J.substring(j),X=!0}}return J}var aW=1000,tW=!1,l4="<!--__STX_BREAK__-->",c4="<!--__STX_CONTINUE__-->";var T6=b(()=>{b4();q1();Y1();k$();T0()});import B0 from"path";function M6($,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 KU($,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 qU($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function bY($){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]!==`
|
|
9361
|
+
`)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 _=U[2];if(!J.has(_))Y.push(_),J.add(_);return}let j=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let _=j[1];if(!J.has(_))Y.push(_),J.add(_);return}let B=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!J.has(_))Y.push(_),J.add(_)}};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 SY($,Z=""){let Y=bY($).split(",").map((J)=>J.trim()).filter(Boolean);return`
|
|
9361
9362
|
(function() {
|
|
9362
9363
|
${$5("var",Y)}
|
|
9363
9364
|
var __destroyHooks = [];
|
|
@@ -9366,11 +9367,11 @@ ${D}
|
|
|
9366
9367
|
|
|
9367
9368
|
${$}
|
|
9368
9369
|
${Z}})();
|
|
9369
|
-
`}function
|
|
9370
|
+
`}function yY($,Z){return`
|
|
9370
9371
|
// Register scope variables for STX runtime
|
|
9371
9372
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
9372
9373
|
var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
|
|
9373
|
-
${
|
|
9374
|
+
${bY($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
9374
9375
|
`)}
|
|
9375
9376
|
// #1767: when the bundler renamed a component const that collided with an
|
|
9376
9377
|
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
@@ -9378,7 +9379,7 @@ ${EY($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
9378
9379
|
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
9379
9380
|
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
9380
9381
|
window.stx._scopes['${Z}'] = __scopeRegistration;
|
|
9381
|
-
`}function
|
|
9382
|
+
`}function zU($,Z){let Y=yY($,Z),J=`
|
|
9382
9383
|
(function() {
|
|
9383
9384
|
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
|
|
9384
9385
|
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
@@ -9387,33 +9388,33 @@ ${EY($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
9387
9388
|
} finally {
|
|
9388
9389
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
9389
9390
|
}
|
|
9390
|
-
})();`;return J+
|
|
9391
|
+
})();`;return J+SY($,Y)+`
|
|
9391
9392
|
} finally {
|
|
9392
9393
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
9393
9394
|
}
|
|
9394
|
-
})();`}function
|
|
9395
|
-
`;continue}if(p)try{let{extractVariables:J0}=await Promise.resolve().then(() => (l5(),D$));await J0(c,I,O)}catch(J0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,J0)}if(!p&&!
|
|
9396
|
-
`}}if(S){let f=
|
|
9395
|
+
})();`}function WU($,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 jU($){if($.__onceStore instanceof Set)return $.__onceStore;return UU}async function I6($,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=KU($,"@partial","@include"),q=jU(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(_,H,L)=>{let V=H.trim(),O=`${Y}:${V}`;if(q.has(O))return"";return q.add(O),H});{let _=/@includeIf\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let w=K.substring(V+1,F-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){_.lastIndex=F;continue}let R=A[1],N=z(R,G,Y),T="";if(N&&await Bun.file(N).exists())X.add(N),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(F),_.lastIndex=0}}for(let[_,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),V;while((V=L.exec(K))!==null){let O=V.index,F=O+V[0].length-1,w=1,A=F+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let R=K.substring(F+1,A-1),N=M6(R,0);if(N===-1){L.lastIndex=A;continue}let T=R.substring(0,N).trim(),M=R.substring(N+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let E=I[1],D=M.substring(I[0].length),y,S=M6(D,0);if(S!==-1)y=D.substring(S+1).trim();try{let k=`Boolean(${T})`,C;if(G0(k)){let d=K0(k,Object.keys(Z));C=Boolean(d(...Object.values(Z)))}else C=Boolean(X0(k,Z));let x=H?!C:C,f="";if(x){let d=z(E,G,Y);if(d&&await Bun.file(d).exists())X.add(d);f=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,O)+f+K.substring(A),L.lastIndex=0}catch(k){let C=k instanceof Error?k.message:String(k),x=z0("Include",`Error evaluating ${_} condition: ${C}`,Y,$,O);K=K.substring(0,O)+x+K.substring(A),L.lastIndex=0}}}{let _=/@each\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let w=K.substring(V+1,F),A=K.substring(L,F+1),R=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){_.lastIndex=0,K=K.replace(A,"");continue}let[,N,T,M,I]=R;try{let E,D=T.trim();if(G0(D))E=K0(D,Object.keys(Z))(...Object.values(Z));else E=X0(D,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let k={...Z,[M]:S},C=await U(N,k,$,L);y+=C}else if(I)y=await U(I,{},$,L);K=K.substring(0,L)+y+K.substring(F+1),_.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+z0("Each",`Error in @each: ${D}`,Y,$,L)+K.substring(F+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let w=K.substring(V+1,F),A=K.substring(L,F+1),R=w.match(/^\s*(\[[^\]]+\])/);if(!R){_.lastIndex=0,K=K.replace(A,"");continue}let N=R[1],T=w.slice(R[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let y=1,S=1;while(S<T.length&&y>0){if(T[S]==="{")y++;else if(T[S]==="}"){if(y--,y===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let E,D=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let y=JSON.parse(N.replace(/'/g,'"')),S={};if(M)try{S=N0(M,Z)}catch(C){let x=C instanceof Error?C.message:String(C);if(J.debug){let f=z0("Include",`Error parsing includeFirst variables: ${x}`,Y,$,L,A);K=K.replace(A,()=>f)}else K=K.replace(A,()=>E||"");continue}let k=!1;for(let C of y){let x=z(C,G,Y);if(!x)continue;if(await o(x)){let f=await U(C,S,$,L);K=K.replace(A,()=>f),k=!0;break}}if(!k)if(E!==void 0)K=K.replace(A,()=>E);else if(J.debug){let C=z0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,A);K=K.replace(A,()=>C)}else K=K.replace(A,"")}catch(y){let S=y instanceof Error?y.message:String(y),k=z0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>k)}_.lastIndex=0}}function z(_,H,L){try{let V=_;if(!_.endsWith(".stx"))V=`${_}.stx`;let O=B0.resolve(H),F=B0.resolve(B0.dirname(L)),w;if(!V.startsWith("./")&&!V.startsWith("../"))w=B0.resolve(H,V);else w=B0.resolve(F,V);let A=B0.normalize(w),R=A.startsWith(O+B0.sep)||A===O,N=A.startsWith(F+B0.sep)||A===F,T=!1,M=B0.dirname(F);if(A.startsWith(M+B0.sep)){if(!B0.relative(M,A).split(B0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))T=!0}if(!R&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${F}`),null;return A}catch(V){return console.error(`Error resolving path ${_}: ${V}`),null}}let W=B0.resolve(Y);Q.add(W);async function U(_,H={},L,V){let O=z(_,G,Y);if(!O)return z0("Include",`Could not resolve path for include: ${_}`,Y,L,V);let F=B0.resolve(O);if(Q.has(F)){let w=[...Q,F].map((A)=>B0.basename(A)).join(" -> ");return z0("Include",`Circular include detected: ${w}`,Y,L,V)}try{X.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let d=f instanceof Error?f.message:String(f);return z0("Include",`Error loading include file ${_}: ${d}`,Y,L,V)}if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (i3(),c3));w=f(w,Z)}if(w&&(J.debug||!a5()&&!F4()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (o3(),a2));f(w,O)}catch{}let A=w;try{let{processESImports:f}=await Promise.resolve().then(() => (R6(),AY));await f(w,Z,O,J,X)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let R=T$(A);if(R)A=R.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[f,d]of Object.entries(H))I[f]=d;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],y="",S=null;for(let f of D){let d=f[1]||"",c=f[2]||"",p=d.includes("server"),W0=y1(d),w0="";try{let{extractAndStripCssImports:J0,renderVendorStyleTags:I0}=await Promise.resolve().then(() => (C5(),H9)),i0=J0(c,{filePath:O,projectRoot:process.cwd()});c=i0.code,w0=I0(i0.styles)}catch(J0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,J0 instanceof Error?J0.message:J0)}if(W0&&c.trim())c=P1(c);if(!p)try{let{hasUserImports:J0,bundleClientScript:I0}=await Promise.resolve().then(() => (b5(),k5));if(J0(c))c=await I0(c,O,{projectRoot:process.cwd()})}catch(J0){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,J0 instanceof Error?J0.message:J0)}let _0=qU(c);if(_0&&!p){S=`stx_scope_${B0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++kY}`;let J0=o0(c),I0=zU(J0,S);y+=`${w0}<script data-stx-scoped>${I0}</script>
|
|
9396
|
+
`;continue}if(p)try{let{extractVariables:J0}=await Promise.resolve().then(() => (l5(),D$));await J0(c,I,O)}catch(J0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,J0)}if(!p&&!_0){let J0=d.replace(/\bclient\b/i,"").trim();S=`stx_scope_${B0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++kY}`;let I0=o0(c),i0=yY(I0,S),G1=SY(I0,i0);y+=`${w0}<script data-stx-scoped${J0?` ${J0}`:""}>${G1}</script>
|
|
9397
|
+
`}}if(S){let f=WU(A,S);if(A=f.html,f.mergedIntoExisting)y=y.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await I6(A,I,O,J,X,Q);let{processLoops:k}=await Promise.resolve().then(() => (T6(),EY)),C=k(A,I,O);C=c1(C,I,O);let x=e1(w);if(C=L1(C,I,O,{forceSignals:x}),M)C+=`
|
|
9397
9398
|
`+M;if(y)C+=`
|
|
9398
|
-
`+y;return C}catch(w){let A=w instanceof Error?w.message:String(w);return z0("Include",`Error processing include ${
|
|
9399
|
-
`)})}var
|
|
9400
|
-
${
|
|
9399
|
+
`+y;return C}catch(w){let A=w instanceof Error?w.message:String(w);return z0("Include",`Error processing include ${_}: ${A}`,Y,L,V)}}let j=/@include\s*\(/g,B;while((B=j.exec(K))!==null){let _=B.index,H=_+B[0].length-1,L=1,V=H+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let O=K.substring(_,V),F=K.substring(H+1,V-1),w=F.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=V;continue}let A=w[1],R,N=F.substring(w[0].length),T=M6(N,0);if(T!==-1)R=N.substring(T+1).trim();let M={};if(R)try{M=N0(R,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,z0("Include",`Error parsing include variables for ${A}: ${D}`,Y,$,_)),j.lastIndex=0;continue}let I=await U(A,M,$,_);K=K.substring(0,_)+I+K.substring(V),j.lastIndex=0}return K}function D6($,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 j=U.index,B=U[1],_=j+U[0].length,H=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),V=1,O=_,F=-1;while(V>0&&O<q.length){let A=q.slice(O),R=A.match(H),N=A.match(L),T=R?O+R.index:1/0,M=N?O+N.index:1/0;if(T<M)V++,O=T+(R[0].length||1);else if(M<1/0){if(V--,V===0){F=M;break}O=M+G.length+1}else break}if(F===-1)break;let w=q.slice(_,F);if(!Z[B])Z[B]=[];if(K)Z[B].unshift(w);else Z[B].push(w);q=q.substring(0,j)+q.substring(F+`@${G}`.length),z=!0}return q}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function E6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
|
|
9400
|
+
`)})}var kY=0,Tw,UU;var PY=b(()=>{B7();b4();Y1();h5();J5();T0();R0();Tw=new d5(500),UU=new Set});import*as k6 from"path";async function CY($,Z,Y=""){if(k6.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 xY($,Z,Y,"@js","@endjs")}async function vY($,Z,Y=""){if(k6.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 xY($,Z,Y,"@ts","@endts")}async function xY($,Z,Y,J,X){let Q=$,G=Y5(`${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 j=Object.keys(Z),B=Object.values(Z),_=W.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),V=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
|
|
9401
|
+
${_}
|
|
9401
9402
|
${V}
|
|
9402
|
-
`,w=Function(...
|
|
9403
|
+
`,w=Function(...j,O)(...B);if(w&&typeof w==="object")Object.assign(Z,w);Q=Q.replace(z,"")}catch(j){console.error(`Error executing ${J} code block in ${Y}:`,j);let B=j instanceof Error?j.message:String(j),_=z0(`${J} Directive`,`Error executing code: ${B}`,Y,$,U,z);console.error(_),Q=Q.replace(z,"")}return Q}var fY=b(()=>{J5();R0()});function BU($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function gY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return BU(J,Q||"_method")})}async function hY($,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=z0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
|
|
9403
9404
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${s0(z)}</div>
|
|
9404
|
-
`)}}}return Q}async function
|
|
9405
|
-
`,H=`${
|
|
9406
|
-
@endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+
|
|
9405
|
+
`)}}}return Q}async function dY($,Z,Y,J){return hY($,Z,Y,J,"before")}async function uY($,Z,Y,J){return hY($,Z,Y,J,"after")}var mY=b(()=>{Y1();R0()});import{defineRoute as fw,defineRoutes as gw,resetRoutes as hw,route as dw,setAppUrl as uw}from"stx-router";import{route as _U}from"stx-router";function pY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?N0(X,{}):{};return _U(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var lY=b(()=>{T0()});async function cY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(W$.exact[$])for(let J of W$.exact[$])await Promise.resolve(J(Z,$));if(W$.exact[Y])for(let J of W$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of W$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var W$;var iY=b(()=>{W$={patterns:[],exact:{}}});function nY($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>nY(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function oY($,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,j,B=W,_=!1;while((j=U.exec(W))!==null){let H=j[1],L=j[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let V=Object.keys(Z),O=Object.values(Z),F=L.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!V.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...V,`return (${L})`)(...O);if(H==="class"){let R=nY(A);if(R){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${R}"`);else B=B.replace(j[0],` class="${R}"`)}else B=B.replace(j[0],"");_=!0;continue}if(HU.has(H)){if(A)B=B.replace(j[0],` ${H}`);else B=B.replace(j[0],"");_=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(j[0],"");else{let R=String(A).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");B=B.replace(j[0],` ${H}="${R}"`)}_=!0}catch{continue}}if(_){let H=z.endsWith("/>")?" /":"",V=`<${Q[1]}${B}${H}>`;q.push({start:Q.index,end:Q.index+z.length,replacement:V})}}for(let z=q.length-1;z>=0;z--){let{start:W,end:U,replacement:j}=q[z];Y=Y.slice(0,W)+j+Y.slice(U)}return Y}var HU;var sY=b(()=>{HU=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function n1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;let X=/\/\s*>$/.test(J[0])||OU.has(J[1].toLowerCase()),Q=X?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:X,start:J.index,end:J.index+J[0].length}}function FU($,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 X1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=FU($,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 rY($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function L5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function T1($,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 M1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function VU($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function wU($){let Z=$,Y=0;while(Y<Z.length){let J=n1(Z,Y);if(!J)break;let X=L5(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((F)=>F.trim()),V=L[0],O=L[1];q=`${K} as ${O} => ${V}`}else q=`${K} as ${G}`;let z=T1(J.attrs,"v-for"),W=T1(z,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=X1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),B=M1(j,{...J,start:0,end:J.end-J.start},W),_=`@foreach(${q})
|
|
9406
|
+
`,H=`${_}${B}
|
|
9407
|
+
@endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+_.length}return Z}function AU($){let Z=$,Y=0;while(Y<Z.length){let J=n1(Z,Y);if(!J)break;let X=L5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=X1(Z,J),K=T1(J.attrs,"v-if"),q=M1(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,V=n1(Z,z+L);if(!V){W=!1;break}let O=L5(V.attrs,"v-else-if"),F=rY(V.attrs,"v-else");if(O!==null){let w=X1(Z,V),A=T1(V.attrs,"v-else-if"),R=M1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},A);Q.push({type:"else-if",expr:O,outerStart:z,outerEnd:w.outerEnd,element:R,parsedTag:V}),z=w.outerEnd}else if(F){let w=X1(Z,V),A=T1(V.attrs,"v-else"),R=M1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},A);Q.push({type:"else",outerStart:z,outerEnd:w.outerEnd,element:R,parsedTag:V}),W=!1}else W=!1}let U=[];for(let H of Q)if(H.type==="if")U.push(`@if(${H.expr})
|
|
9407
9408
|
${H.element}`);else if(H.type==="else-if")U.push(`@elseif(${H.expr})
|
|
9408
9409
|
${H.element}`);else U.push(`@else
|
|
9409
|
-
${H.element}`);U.push("@endif");let
|
|
9410
|
-
`),
|
|
9410
|
+
${H.element}`);U.push("@endif");let j=U.join(`
|
|
9411
|
+
`),B=Q[0].outerStart,_=Q[Q.length-1].outerEnd;Z=Z.slice(0,B)+j+Z.slice(_),Y=B+j.length}return Z}function RU($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function NU($){let Z=$,Y=0;while(Y<Z.length){let J=n1(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],j=K[3];X=X.replace(K[0],""),X+=` :${W}="${j}" @update:${W}="${j} = $event"`,K=X.match(G)}if(Q){let W=X1(Z,J),U=Z.slice(W.outerStart,W.outerEnd),j=M1(U,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,W.outerStart)+j+Z.slice(W.outerEnd),Y=W.outerStart+j.length;continue}let q=L5(J.attrs,"v-model");if(q===null){Y=J.end;continue}if(LU.has(J.tag.toLowerCase())){let W=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=X1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),B=M1(j,{...J,start:0,end:J.end-J.start},W);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}else{let W=J.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=X1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),B=M1(j,{...J,start:0,end:J.end-J.start},W);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}}return Z}function TU($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function MU($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function IU($){let Z=$,Y=0;while(Y<Z.length){let J=n1(Z,Y);if(!J)break;let X=L5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=X1(Z,J),G=T1(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 DU($){let Z=$,Y=0;while(Y<Z.length){let J=n1(Z,Y);if(!J)break;let X=L5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=X1(Z,J),G=T1(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 EU($){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 kU($){let Z=$,Y=0;while(Y<Z.length){let J=n1(Z,Y);if(!J)break;if(!rY(J.attrs,"v-once")){Y=J.end;continue}let X=T1(J.attrs,"v-once"),Q=X1(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
|
|
9411
9412
|
${M1(G,{...J,start:0,end:J.end-J.start},X)}
|
|
9412
|
-
@endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function
|
|
9413
|
-
${$.slice(Z)}`}function
|
|
9413
|
+
@endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function bU($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function SU($){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 aY($){if(!VU($))return $;let Z=$;return Z=wU(Z),Z=AU(Z),Z=kU(Z),Z=TU(Z),Z=MU(Z),Z=NU(Z),Z=RU(Z),Z=SU(Z),Z=IU(Z),Z=DU(Z),Z=EU(Z),Z=bU(Z),Z}var OU,LU;var tY=b(()=>{OU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),LU=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 i4($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}async function eY($,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=X0(W.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${i4(W.expr)}" -->`;Q=Q.slice(0,W.index)+O+Q.slice(W.index+W.full.length);continue}let j=W.attrs.trim(),B={},_=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=_.exec(j))!==null){let O=H[1]||H[2],F=H[3];if(H[1])try{B[O]=X0(F,Z)}catch{B[O]=F}else B[O]=F}let L=J.componentsDir||"components",V=await h1(U,B,W.slotContent,L,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,W.index)+V+Q.slice(W.index+W.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${i4(j)} -->`;Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length)}}return Q=await yU(Q,Z,Y,J,X),Q}async function yU($,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=X0(W.expr,Z);if(!U||typeof U!=="string"){let _=`<!-- dynamic component: could not resolve "${i4(W.expr)}" -->`;Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length);continue}let j=J.componentsDir||"components",B=await h1(U,{},"",j,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${i4(j)} -->`;Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length)}}return Q}var $J=b(()=>{R0();T0()});function ZJ($){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>
|
|
9414
|
+
${$.slice(Z)}`}function PU($){let Z=[],Y=0;while(Y<$.length){let Q=$.slice(Y),G=Q.match(/^\s+/);if(G){Y+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",Y);if(U===-1)break;Y=U+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let U=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(U===-1)break;Y=U+9;continue}let q=Q.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let z=Q.match(/^<meta\b[^>]*>/i);if(z){Z.push(z[0]),Y+=z[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",X=0;while(X<$.length&&X<Y){let Q=$.slice(X),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){X+=G[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){X+=K[0].length;continue}let q=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){X+=q[0].length;continue}J+=$[X],X++}return J+=$.slice(Y),{body:J,hoisted:Z}}function CU($,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,_=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...Q].map((N)=>{return` <meta ${Object.entries(N).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
|
|
9414
9415
|
`),H=G.map((N)=>{return` <link ${Object.entries(N).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
|
|
9415
9416
|
`),L=K.map((N)=>{if(N.src)return` <script ${Object.entries(N).filter(([M])=>M!=="content").map(([M,I])=>`${M}="${I}"`).join(" ")}></script>`;if(N.content)return` <script>${N.content}</script>`;return""}).filter(Boolean).join(`
|
|
9416
|
-
`),V=Object.entries(W).map(([N,T])=>` ${N}="${T}"`).join(""),O=z?` class="${z}"`:"",{body:F,hoisted:w}=
|
|
9417
|
+
`),V=Object.entries(W).map(([N,T])=>` ${N}="${T}"`).join(""),O=z?` class="${z}"`:"",{body:F,hoisted:w}=PU($),A=[_,` <title>${U}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((N)=>` ${N}`),...w.map((N)=>` ${N}`),...(Y.headScripts||[]).map((N)=>` ${N}`),Y.headStack||""].filter(Boolean),R=[F,...(Y.bodyScripts||[]).map((N)=>N),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
9417
9418
|
<html lang="${X}">
|
|
9418
9419
|
<head>
|
|
9419
9420
|
${A.join(`
|
|
@@ -9423,33 +9424,33 @@ ${A.join(`
|
|
|
9423
9424
|
${R.join(`
|
|
9424
9425
|
`)}
|
|
9425
9426
|
</body>
|
|
9426
|
-
</html>`}function b6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function
|
|
9427
|
+
</html>`}function b6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function YJ($,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,j])=>`${U}="${j}"`).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(`
|
|
9427
9428
|
`)}
|
|
9428
|
-
${$.slice(Y)}`}function
|
|
9429
|
+
${$.slice(Y)}`}function JJ($,Z={},Y={}){if(b6($))return $;return CU($,Z,Y)}import F5 from"path";function XJ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function QJ($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=F5.join(X,$);if(await Bun.file(G).exists())return G;X=F5.dirname(X)}J=F5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=F5.resolve(Z,$);else J=F5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function GJ($,Z,Y){let J=$,X=F5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[z,W,U,j]=G;if(XJ(U))continue;let B=await QJ(U,X,Z);if(B)try{let _=await Bun.file(B).text();if(Y.add(B),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:p0()});if(L.outputs.length>0)_=await L.outputs[0].text()}let H=`<script>
|
|
9429
9430
|
// Source: ${U}
|
|
9430
|
-
${
|
|
9431
|
-
</script>`;J=J.replace(z,H),Q.lastIndex=0}catch(
|
|
9431
|
+
${_}
|
|
9432
|
+
</script>`;J=J.replace(z,H),Q.lastIndex=0}catch(_){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(J))!==null){let[z,W,U,j]=q,B=W+j;if(XJ(U))continue;if(/rel=["']stylesheet["']/.test(B)||U.endsWith(".css")){let H=await QJ(U,X,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let V=`<style>
|
|
9432
9433
|
/* Source: ${U} */
|
|
9433
9434
|
${L}
|
|
9434
|
-
</style>`;J=J.replace(z,V),K.lastIndex=0}catch(L){}}}return J}var
|
|
9435
|
-
`),U=[];W.forEach((_
|
|
9435
|
+
</style>`;J=J.replace(z,V),K.lastIndex=0}catch(L){}}}return J}var KJ=b(()=>{b1()});function S6($,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 F=Y[q];if(W){W=!1,q++;continue}if(F==="\\"&&z){W=!0,q++;continue}if(z){if(F===z)z=null;q++;continue}if(F==='"'||F==="'"||F==="`"){z=F,q++;continue}if(F==="(")K++;else if(F===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),j=Y.substring(Q,q+1),B=-1,_=0,H=null,L=!1;for(let F=0;F<U.length;F++){let w=U[F];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==="{")_++;else if(w===")"||w==="]"||w==="}")_--;if(w===","&&_===0){B=F;break}}let V=B>=0?U.substring(0,B).trim():U,O=B>=0?U.substring(B+1).trim():void 0;try{let F=V.trim(),w;if(G0(F))w=K0(F,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 R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+R+Y.substring(q+1),J.lastIndex=Q+R.length}catch(F){a0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=Q+j.length}}return Y}function y6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function qJ($){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),j=U.indexOf("@endmemo");if(j===-1)continue;let B=U.slice(0,j),_=W+j+8,H=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,V=B.slice(L),O=B.match(/(\s*)$/),F=O?O[0].length:0,w=V.slice(0,V.length-F),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,T,M="",I]=A,E=`<${T}${M} data-stx-memo="${z}"${I}>`;R=B.slice(0,L)+E+w.slice(N.length)+B.slice(L+w.length)}else R=`${B.slice(0,L)}<div data-stx-memo="${z}">${w}</div>${B.slice(L+w.length)}`;X.push({start:Q,end:_,replacement:R}),Y.lastIndex=_}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 P6($){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 zJ($){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 j=$.slice(W+1),B=j.indexOf("</"),_=B>=0?j.slice(0,B):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(_))J+=$.slice(X,W)+" x-cloak>",X=W+1}return J+=$.slice(X),J}function WJ($){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 _=`</${G}>`,H=$.toLowerCase().indexOf(_,Q);if(H!==-1)Z.lastIndex=H+_.length;continue}let K=Q+X[0].length,q=!1,z=!1,W=-1;while(K<$.length){let _=$[K];if(q){if(_==="'")q=!1}else if(z){if(_==='"')z=!1}else if(_==="'")q=!0;else if(_==='"')z=!0;else if(_===">"){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(!vU.test(U))continue;let j=$[W-1]==="/",B=j?W-1:W;Y+=`${$.slice(J,B)} x-cloak${j?" ":""}`,J=B}return Y+=$.slice(J),Y}var vU;var C6=b(()=>{q1();T0();vU=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function v6($,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 xU){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(`
|
|
9436
|
+
`),U=[];W.forEach((B,_)=>{if(G.lastIndex=0,G.test(B))U.push(_+1)});let j=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";Q.push(` \u2717 ${K}${j}
|
|
9436
9437
|
\u2192 ${q}`)}}if(Q.length>0&&J.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
|
|
9437
9438
|
${Q.join(`
|
|
9438
9439
|
`)}
|
|
9439
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var
|
|
9440
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var xU;var x6=b(()=>{xU=[{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 UJ={};e(UJ,{getStoreScript:()=>fU,clearStoreCache:()=>gU});import n4 from"path";async function fU($){let Z;if($)Z=n4.resolve($);else{let W=await z1();Z=n4.resolve(W.root||process.cwd(),W.storesDir||"stores")}let Y=V5.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=n4.basename(W,".ts");if(["index","types"].includes(U))continue;if(W.includes(".d.ts"))continue;X.push(W)}}catch{return V5.set(Z,""),null}if(X.length===0)return V5.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:p0()});for(let W of G)try{let U=await Bun.file(W).text(),j=n4.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: ${j}
|
|
9440
9441
|
${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${W}:`,U)}if(K.length===0)return V5.set(Z,""),null;let z=`;(function(){
|
|
9441
9442
|
${K.join(`
|
|
9442
9443
|
|
|
9443
9444
|
`)}
|
|
9444
|
-
})();`;return V5.set(Z,z),z}function
|
|
9445
|
-
${
|
|
9445
|
+
})();`;return V5.set(Z,z),z}function gU(){V5.clear()}var V5;var jJ=b(()=>{l1();b1();V5=new Map});var _J={};e(_J,{getComposableScript:()=>mU,clearComposableCache:()=>pU});import U$ from"path";function BJ($){let Z=U$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function dU($){if($)return U$.resolve($);let Z=`<default>:${process.cwd()}`,Y=f6.get(Z);if(Y!==void 0)return Y;let J=await uU();return f6.set(Z,J),J}async function uU(){let $=await z1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return U$.resolve(Z,Y);for(let J of hU){let X=U$.resolve(Z,J);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!BJ(G))return X}catch{}}return null}async function mU($){let Z=await dU($);if(!Z)return null;let Y=w5.get(Z);if(Y!==void 0)return Y||null;let J=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(BJ(_))continue;J.push(_)}}catch{return w5.set(Z,""),null}if(J.length===0)return w5.set(Z,""),null;J.sort();let X=new Bun.Transpiler({loader:"ts",target:"browser",define:p0()}),Q=[],G=new Set,K=new Set;for(let B of J)try{let _=await Bun.file(B).text(),H=U$.basename(B,".ts");for(let L of _.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(_).exports)if(L!=="default")G.add(L)}catch{}_=o0(_),_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(default\s+)?/gm,""),_=X.transformSync(_),Q.push(`// Composable: ${H}
|
|
9446
|
+
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${B}:`,_)}if(Q.length===0||G.size===0)return w5.set(Z,""),null;let q=[...G].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
|
|
9446
9447
|
`),z=JSON.stringify([...G]),W=Q.join(`
|
|
9447
9448
|
|
|
9448
|
-
`),
|
|
9449
|
+
`),j=`;(function(){
|
|
9449
9450
|
window.__composables = window.__composables || {};
|
|
9450
9451
|
var __c = window.__composables;
|
|
9451
9452
|
var __stx = window.stx || {};
|
|
9452
|
-
${R$.filter((
|
|
9453
|
+
${R$.filter((B)=>!K.has(B)&&new RegExp(`\\b${B}\\b`).test(W)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
|
|
9453
9454
|
`)}
|
|
9454
9455
|
${W}
|
|
9455
9456
|
${q}
|
|
@@ -9466,7 +9467,7 @@ ${q}
|
|
|
9466
9467
|
}
|
|
9467
9468
|
window[__n] = __c[__n];
|
|
9468
9469
|
}
|
|
9469
|
-
})();`;return w5.set(Z,
|
|
9470
|
+
})();`;return w5.set(Z,j),j}function pU(){w5.clear(),f6.clear()}var w5,f6,hU;var HJ=b(()=>{l1();b1();h5();w5=new Map,f6=new Map,hU=["composables","functions"]});var LJ={};e(LJ,{processDeferDirectives:()=>oU});function lU(){return`stx-defer-${++OJ}`}function cU($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function iU($,Z,Y){let{trigger:J,value:X}=cU(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 nU($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
|
|
9470
9471
|
const observer = new IntersectionObserver((entries) => {
|
|
9471
9472
|
if (entries[0].isIntersecting) {
|
|
9472
9473
|
observer.disconnect();
|
|
@@ -9539,15 +9540,15 @@ else {
|
|
|
9539
9540
|
${X}
|
|
9540
9541
|
})();
|
|
9541
9542
|
</script>
|
|
9542
|
-
`}function
|
|
9543
|
+
`}function oU($,Z,Y){OJ=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(X,Q,G)=>{let K=lU(),q=iU(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>`:"",j=`<div data-defer-content style="display: none;">${q.content}</div>`,B=nU(K,q);return`
|
|
9543
9544
|
<div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
|
|
9544
9545
|
${z}
|
|
9545
9546
|
${W}
|
|
9546
|
-
${
|
|
9547
|
+
${j}
|
|
9547
9548
|
${U}
|
|
9548
9549
|
</div>
|
|
9549
|
-
${
|
|
9550
|
-
`})}var
|
|
9550
|
+
${B}
|
|
9551
|
+
`})}var OJ=0;var VJ={};e(VJ,{processTeleportDirectives:()=>tU,ensureTeleportTargets:()=>eU});function sU(){return`stx-teleport-${++FJ}`}function rU($){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 aU($,Z){return`
|
|
9551
9552
|
<script>
|
|
9552
9553
|
(function() {
|
|
9553
9554
|
const source = document.getElementById('${$}');
|
|
@@ -9593,12 +9594,12 @@ else {
|
|
|
9593
9594
|
});
|
|
9594
9595
|
})();
|
|
9595
9596
|
</script>
|
|
9596
|
-
`}function
|
|
9597
|
+
`}function tU($,Z,Y){FJ=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(X,Q,G)=>{let K=sU(),{target:q,disabled:z}=rU(Q),W=G.trim();if(z)try{let j=!1;if(z==="true")j=!0;else if(z==="false")j=!1;else if(z in Z)j=Boolean(Z[z]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${W}</div>`}catch{}let U=aU(K,q);return`
|
|
9597
9598
|
<div id="${K}" class="stx-teleport-source" style="display: none;">
|
|
9598
9599
|
<template>${W}</template>
|
|
9599
9600
|
</div>
|
|
9600
9601
|
${U}
|
|
9601
|
-
`})}function
|
|
9602
|
+
`})}function eU(){return`
|
|
9602
9603
|
<script>
|
|
9603
9604
|
(function() {
|
|
9604
9605
|
// Common teleport targets
|
|
@@ -9615,7 +9616,7 @@ else {
|
|
|
9615
9616
|
});
|
|
9616
9617
|
})();
|
|
9617
9618
|
</script>
|
|
9618
|
-
`}var
|
|
9619
|
+
`}var FJ=0;var NJ={};e(NJ,{processTransitionDirectives:()=>Jj,processTransitionAttributes:()=>Kj,performLeave:()=>Yj,performEnter:()=>Zj,generateTransitionRuntime:()=>Gj,generateTransitionCSS:()=>Qj});function wJ($,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 $j($){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 AJ($,Z){return new Promise((Y)=>{let J=Z??$j($);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 RJ($){$.offsetHeight}async function Zj($,Z={}){let Y=Z.name||"stx",J=wJ(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),RJ($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await AJ($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function Yj($,Z={}){let Y=Z.name||"stx",J=wJ(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),RJ($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await AJ($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function Jj($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=Xj(Q),q=K.name||"stx",z=K.duration||300,W=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
9619
9620
|
<div
|
|
9620
9621
|
class="stx-transition-wrapper"
|
|
9621
9622
|
data-transition="${q}"
|
|
@@ -9657,7 +9658,7 @@ else {
|
|
|
9657
9658
|
});
|
|
9658
9659
|
})();
|
|
9659
9660
|
</script>
|
|
9660
|
-
`})}function
|
|
9661
|
+
`})}function Xj($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4]||J[5];switch(X){case"name":Z.name=Q;break;case"duration":Z.duration=parseInt(Q,10);break;case"mode":Z.mode=Q;break;case"easing":Z.easing=Q;break}}return Z}function Qj(){return`
|
|
9661
9662
|
/* STX Transition Presets */
|
|
9662
9663
|
|
|
9663
9664
|
/* Fade */
|
|
@@ -9844,7 +9845,7 @@ else {
|
|
|
9844
9845
|
opacity: 1;
|
|
9845
9846
|
max-height: 1000px;
|
|
9846
9847
|
}
|
|
9847
|
-
`}function
|
|
9848
|
+
`}function Gj(){return`
|
|
9848
9849
|
// STX Transition Runtime
|
|
9849
9850
|
(function() {
|
|
9850
9851
|
if (typeof window === 'undefined') return;
|
|
@@ -9933,7 +9934,7 @@ else {
|
|
|
9933
9934
|
|
|
9934
9935
|
console.log('[stx] Transition runtime initialized');
|
|
9935
9936
|
})();
|
|
9936
|
-
`}function
|
|
9937
|
+
`}function Kj($){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 MJ={};e(MJ,{withErrorBoundary:()=>TJ,processErrorBoundaryDirectives:()=>Wj,generateErrorBoundaryRuntime:()=>Hj,generateErrorBoundaryCSS:()=>_j,createErrorBoundary:()=>Bj});function zj(){return`eb-${++qj}-${Date.now().toString(36)}`}function Wj($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let q=zj(),z=Uj(Q||"");return jj(q,G.trim(),K.trim(),z)})}function Uj($){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 jj($,Z,Y,J){let X=J.logErrors!==!1;return`
|
|
9937
9938
|
<div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
|
|
9938
9939
|
<div class="stx-error-boundary-content" data-boundary-content="${$}">
|
|
9939
9940
|
${Z}
|
|
@@ -10053,7 +10054,7 @@ else {
|
|
|
10053
10054
|
};
|
|
10054
10055
|
})();
|
|
10055
10056
|
</script>
|
|
10056
|
-
`}async function
|
|
10057
|
+
`}async function TJ($,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 Bj($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>TJ(J,$,Y)}function _j(){return`
|
|
10057
10058
|
/* STX Error Boundary Styles */
|
|
10058
10059
|
.stx-error-boundary {
|
|
10059
10060
|
position: relative;
|
|
@@ -10097,7 +10098,7 @@ else {
|
|
|
10097
10098
|
color: #fecaca;
|
|
10098
10099
|
}
|
|
10099
10100
|
}
|
|
10100
|
-
`}function
|
|
10101
|
+
`}function Hj(){return`
|
|
10101
10102
|
// STX Error Boundary Runtime
|
|
10102
10103
|
(function() {
|
|
10103
10104
|
if (typeof window === 'undefined') return;
|
|
@@ -10162,7 +10163,7 @@ else {
|
|
|
10162
10163
|
|
|
10163
10164
|
console.log('[stx] Error boundary runtime initialized');
|
|
10164
10165
|
})();
|
|
10165
|
-
`}var
|
|
10166
|
+
`}var qj=0;var IJ={};e(IJ,{renderSSRSuspense:()=>Rj,processSuspenseDirectives:()=>Fj,generateSuspenseRuntime:()=>Tj,generateSuspenseCSS:()=>Nj,createSSRSuspense:()=>Aj});function Lj(){return`suspense-${++Oj}-${Date.now().toString(36)}`}function Fj($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let q=Lj(),z=Vj(Q||"");return wj(q,G.trim(),K.trim(),z)})}function Vj($){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 wj($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
|
|
10166
10167
|
<div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
|
|
10167
10168
|
<div class="stx-suspense-fallback" data-suspense-fallback="${$}">
|
|
10168
10169
|
${Y}
|
|
@@ -10352,7 +10353,7 @@ else {
|
|
|
10352
10353
|
}, 0);
|
|
10353
10354
|
})();
|
|
10354
10355
|
</script>
|
|
10355
|
-
`}function
|
|
10356
|
+
`}function Aj($,Z,Y){return{id:$,fallback:Y,content:Z}}async function Rj($){let Z=$.map((J)=>`
|
|
10356
10357
|
<div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
|
|
10357
10358
|
${J.fallback}
|
|
10358
10359
|
</div>
|
|
@@ -10377,7 +10378,7 @@ else {
|
|
|
10377
10378
|
}
|
|
10378
10379
|
})();
|
|
10379
10380
|
</script>
|
|
10380
|
-
`}}return{initial:Z,streaming:Y()}}function
|
|
10381
|
+
`}}return{initial:Z,streaming:Y()}}function Nj(){return`
|
|
10381
10382
|
/* STX Suspense Styles */
|
|
10382
10383
|
.stx-suspense {
|
|
10383
10384
|
position: relative;
|
|
@@ -10433,7 +10434,7 @@ else {
|
|
|
10433
10434
|
background-size: 200% 100%;
|
|
10434
10435
|
}
|
|
10435
10436
|
}
|
|
10436
|
-
`}function
|
|
10437
|
+
`}function Tj(){return`
|
|
10437
10438
|
// STX Suspense Runtime
|
|
10438
10439
|
(function() {
|
|
10439
10440
|
if (typeof window === 'undefined') return;
|
|
@@ -10500,7 +10501,7 @@ else {
|
|
|
10500
10501
|
|
|
10501
10502
|
console.log('[stx] Suspense runtime initialized');
|
|
10502
10503
|
})();
|
|
10503
|
-
`}var
|
|
10504
|
+
`}var Oj=0;var bJ={};e(bJ,{processAsyncDirectives:()=>Ij,isAsyncComponent:()=>Ej,generateAsyncComponentRuntime:()=>bj,generateAsyncComponentCSS:()=>kj,defineAsyncComponent:()=>Dj});function DJ(){return`async-${++Mj}-${Date.now().toString(36)}`}function Ij($,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=DJ(),U=EJ(K);return kJ(W,U,q.trim(),z.trim())}),Q=Q.replace(X,(G,K,q)=>{let z=DJ(),W=EJ(K);return kJ(z,W,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function EJ($){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 kJ($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:q}=Z;return`
|
|
10504
10505
|
<div class="stx-async-component" data-async-id="${$}" data-component="${X}" data-status="pending">
|
|
10505
10506
|
<div class="stx-async-loading" data-async-loading="${$}">
|
|
10506
10507
|
${Y}
|
|
@@ -10727,7 +10728,7 @@ catch (error) {
|
|
|
10727
10728
|
loadComponent();
|
|
10728
10729
|
})();
|
|
10729
10730
|
</script>
|
|
10730
|
-
`}function
|
|
10731
|
+
`}function Dj($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function Ej($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function kj(){return`
|
|
10731
10732
|
/* STX Async Component Styles */
|
|
10732
10733
|
.stx-async-component {
|
|
10733
10734
|
position: relative;
|
|
@@ -10801,7 +10802,7 @@ catch (error) {
|
|
|
10801
10802
|
background-size: 200% 100%;
|
|
10802
10803
|
}
|
|
10803
10804
|
}
|
|
10804
|
-
`}function
|
|
10805
|
+
`}function bj(){return`
|
|
10805
10806
|
// STX Async Component Runtime
|
|
10806
10807
|
(function() {
|
|
10807
10808
|
if (typeof window === 'undefined') return;
|
|
@@ -10855,7 +10856,7 @@ catch (error) {
|
|
|
10855
10856
|
|
|
10856
10857
|
console.log('[stx] Async component runtime initialized');
|
|
10857
10858
|
})();
|
|
10858
|
-
`}var
|
|
10859
|
+
`}var Mj=0;var yJ={};e(yJ,{shouldCacheComponent:()=>xj,processKeepAliveDirectives:()=>yj,onDeactivated:()=>dj,onActivated:()=>hj,generateKeepAliveRuntime:()=>gj,generateKeepAliveCSS:()=>fj,createKeepAliveCache:()=>vj});function SJ(){return`keep-alive-${++Sj}-${Date.now().toString(36)}`}function yj($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=SJ(),q=Pj(Q||"");return Cj(K,G.trim(),q)})}function Pj($){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 Cj($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
|
|
10859
10860
|
<div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
|
|
10860
10861
|
<div class="stx-keep-alive-content" data-keep-alive-content="${$}">
|
|
10861
10862
|
${Z}
|
|
@@ -11142,7 +11143,7 @@ else {
|
|
|
11142
11143
|
});
|
|
11143
11144
|
})();
|
|
11144
11145
|
</script>
|
|
11145
|
-
`}function
|
|
11146
|
+
`}function vj($={}){return{id:$.id||SJ(),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 xj($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function fj(){return`
|
|
11146
11147
|
/* STX Keep-Alive Styles */
|
|
11147
11148
|
.stx-keep-alive {
|
|
11148
11149
|
position: relative;
|
|
@@ -11167,7 +11168,7 @@ else {
|
|
|
11167
11168
|
.stx-keep-alive-content > [data-activated] {
|
|
11168
11169
|
opacity: 1;
|
|
11169
11170
|
}
|
|
11170
|
-
`}function
|
|
11171
|
+
`}function gj(){return`
|
|
11171
11172
|
// STX Keep-Alive Runtime
|
|
11172
11173
|
(function() {
|
|
11173
11174
|
if (typeof window === 'undefined') return;
|
|
@@ -11203,7 +11204,7 @@ else {
|
|
|
11203
11204
|
|
|
11204
11205
|
console.log('[stx] Keep-alive runtime initialized');
|
|
11205
11206
|
})();
|
|
11206
|
-
`}function
|
|
11207
|
+
`}function hj($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function dj($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var Sj=0;var fJ={};e(fJ,{useVirtualList:()=>CJ,processVirtualListDirectives:()=>h6,processVirtualGridDirectives:()=>xJ,processInfiniteListDirectives:()=>vJ,generateVirtualListCSS:()=>PJ,default:()=>uj,createVirtualList:()=>g6});function g6($,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 j(){if(G)return B();let R=Math.max(0,Math.floor(W/Y)-X),N=Math.ceil(J/Y),T=Math.min(z.length-1,R+N+X*2);return{startIndex:R,endIndex:T}}function B(){let R=0,N=0,T=z.length-1;for(let M=0;M<z.length;M++){let I=U.get(M)||K;if(R+I>W){N=Math.max(0,M-X);break}R+=I}R=0;for(let M=0;M<z.length;M++){let I=U.get(M)||K;if(R+=I,R>W+J){T=Math.min(z.length-1,M+X);break}}return{startIndex:N,endIndex:T}}function _(){if(G){let R=0;for(let N=0;N<z.length;N++)R+=U.get(N)||K;return R}return z.length*Y}function H(R){if(G){let N=0;for(let T=0;T<R;T++)N+=U.get(T)||K;return N}return R*Y}function L(){let{startIndex:R,endIndex:N}=j();return{startIndex:R,endIndex:N,scrollTop:W,totalHeight:_(),visibleItems:z.slice(R,N+1),itemHeights:new Map(U)}}function V(R,N="auto"){let T=H(R);O(T,N)}function O(R,N="auto"){W=Math.max(0,Math.min(R,_()-J))}function F(){j()}function w(R){z=[...R],U.clear(),F()}function A(){z=[],U.clear()}return{scrollToIndex:V,scrollToOffset:O,getState:L,refresh:F,setItems:w,destroy:A}}function h6($,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(),F=Function(`return ${O}`)();W={...W,...F}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(W.containerHeight/W.itemHeight),B=W.overscan||3,_=0,H=Math.min(z.length-1,j+B),L="";for(let O=_;O<=H&&O<z.length;O++){let F=z[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
|
|
11207
11208
|
<div class="virtual-item ${W.itemClass||""}"
|
|
11208
11209
|
style="position: absolute; top: ${O*W.itemHeight}px; height: ${W.itemHeight}px; width: 100%;"
|
|
11209
11210
|
data-index="${O}">
|
|
@@ -11214,7 +11215,7 @@ else {
|
|
|
11214
11215
|
style="position: relative; height: ${W.containerHeight}px; overflow-y: auto;"
|
|
11215
11216
|
data-item-height="${W.itemHeight}"
|
|
11216
11217
|
data-total-items="${z.length}"
|
|
11217
|
-
data-overscan="${
|
|
11218
|
+
data-overscan="${B}">
|
|
11218
11219
|
<div class="virtual-list-viewport ${W.viewportClass||""}"
|
|
11219
11220
|
style="position: relative; height: ${V}px; width: 100%;">
|
|
11220
11221
|
${L}
|
|
@@ -11228,7 +11229,7 @@ else {
|
|
|
11228
11229
|
const viewport = container.querySelector('.virtual-list-viewport');
|
|
11229
11230
|
const itemHeight = ${W.itemHeight};
|
|
11230
11231
|
const totalItems = ${z.length};
|
|
11231
|
-
const overscan = ${
|
|
11232
|
+
const overscan = ${B};
|
|
11232
11233
|
const containerHeight = ${W.containerHeight};
|
|
11233
11234
|
const items = ${JSON.stringify(z)};
|
|
11234
11235
|
const template = ${JSON.stringify(K.trim())};
|
|
@@ -11280,7 +11281,7 @@ else {
|
|
|
11280
11281
|
};
|
|
11281
11282
|
})();
|
|
11282
11283
|
</script>
|
|
11283
|
-
`})}function
|
|
11284
|
+
`})}function PJ(){return`
|
|
11284
11285
|
.virtual-list-container {
|
|
11285
11286
|
position: relative;
|
|
11286
11287
|
overflow-y: auto;
|
|
@@ -11328,7 +11329,7 @@ else {
|
|
|
11328
11329
|
0% { background-position: 200% 0; }
|
|
11329
11330
|
100% { background-position: -200% 0; }
|
|
11330
11331
|
}
|
|
11331
|
-
`}function
|
|
11332
|
+
`}function CJ($,Z){let Y=null,J=()=>{if(!Y)Y=g6($(),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 vJ($,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 _=Function(`return ${G.trim()}`)();U={...U,..._}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,B=h6(`@virtualList(${z}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return B=B.replace("</script>",`
|
|
11332
11333
|
// Infinite scroll detection
|
|
11333
11334
|
container.addEventListener('scroll', function() {
|
|
11334
11335
|
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
@@ -11340,13 +11341,13 @@ else {
|
|
|
11340
11341
|
}
|
|
11341
11342
|
});
|
|
11342
11343
|
</script>`),`
|
|
11343
|
-
<div id="${
|
|
11344
|
-
${
|
|
11344
|
+
<div id="${j}" class="infinite-list-wrapper">
|
|
11345
|
+
${B}
|
|
11345
11346
|
<div class="infinite-list-loading" style="display: none;">
|
|
11346
11347
|
${q}
|
|
11347
11348
|
</div>
|
|
11348
11349
|
</div>
|
|
11349
|
-
`})}function
|
|
11350
|
+
`})}function xJ($,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 F=Function(`return ${G.trim()}`)();W={...W,...F}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(z.length/W.columns),B=j*(W.rowHeight+(W.gap||0)),_=Math.ceil(W.containerHeight/(W.rowHeight+(W.gap||0))),H=W.overscan||2,L=0,V=Math.min(j-1,_+H),O="";for(let F=L;F<=V;F++)for(let w=0;w<W.columns;w++){let A=F*W.columns+w;if(A>=z.length)break;let R=z[A],N=w*(100/W.columns),T=F*(W.rowHeight+(W.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,E)=>{if(typeof R==="object"&&R!==null)return String(R[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
|
|
11350
11351
|
<div class="virtual-grid-item"
|
|
11351
11352
|
style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/W.columns}% - ${W.gap||0}px); height: ${W.rowHeight}px;"
|
|
11352
11353
|
data-index="${A}">
|
|
@@ -11356,7 +11357,7 @@ else {
|
|
|
11356
11357
|
class="virtual-grid-container"
|
|
11357
11358
|
style="position: relative; height: ${W.containerHeight}px; overflow-y: auto;">
|
|
11358
11359
|
<div class="virtual-grid-viewport"
|
|
11359
|
-
style="position: relative; height: ${
|
|
11360
|
+
style="position: relative; height: ${B}px; width: 100%;">
|
|
11360
11361
|
${O}
|
|
11361
11362
|
</div>
|
|
11362
11363
|
</div>
|
|
@@ -11416,7 +11417,7 @@ else {
|
|
|
11416
11417
|
});
|
|
11417
11418
|
})();
|
|
11418
11419
|
</script>
|
|
11419
|
-
`})}var
|
|
11420
|
+
`})}var uj;var gJ=b(()=>{uj={createVirtualList:g6,processVirtualListDirectives:h6,processInfiniteListDirectives:vJ,processVirtualGridDirectives:xJ,generateVirtualListCSS:PJ,useVirtualList:CJ}});function hJ(){return`<script data-stx-hydration-runtime>
|
|
11420
11421
|
(function() {
|
|
11421
11422
|
'use strict';
|
|
11422
11423
|
|
|
@@ -11576,7 +11577,7 @@ else {
|
|
|
11576
11577
|
stxIslands.initIslands();
|
|
11577
11578
|
}
|
|
11578
11579
|
})();
|
|
11579
|
-
</script>`}function
|
|
11580
|
+
</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 uJ($,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 tJ={};e(tJ,{processStaticDirectives:()=>rJ,processPartialHydrationDirectives:()=>pJ,onHydrated:()=>sJ,isHydrated:()=>oJ,hydrateIsland:()=>cJ,hydrateByStrategy:()=>iJ,hydrateAll:()=>nJ,generatePartialHydrationCSS:()=>lJ,generateIslandManifest:()=>aJ,default:()=>sj,createIslandRegistry:()=>mJ});function mJ(){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 mj($){return`
|
|
11580
11581
|
<script data-hydrate="${$}">
|
|
11581
11582
|
(function() {
|
|
11582
11583
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -11587,7 +11588,7 @@ else {
|
|
|
11587
11588
|
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
11588
11589
|
})();
|
|
11589
11590
|
</script>
|
|
11590
|
-
`}function
|
|
11591
|
+
`}function pj($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
|
|
11591
11592
|
<script data-hydrate="${$}">
|
|
11592
11593
|
(function() {
|
|
11593
11594
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -11623,7 +11624,7 @@ else {
|
|
|
11623
11624
|
}
|
|
11624
11625
|
})();
|
|
11625
11626
|
</script>
|
|
11626
|
-
`}function
|
|
11627
|
+
`}function lj($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
|
|
11627
11628
|
<script data-hydrate="${$}">
|
|
11628
11629
|
(function() {
|
|
11629
11630
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -11656,7 +11657,7 @@ else {
|
|
|
11656
11657
|
}
|
|
11657
11658
|
})();
|
|
11658
11659
|
</script>
|
|
11659
|
-
`}function
|
|
11660
|
+
`}function cj($,Z){let Y=Z.media||"(min-width: 768px)";return`
|
|
11660
11661
|
<script data-hydrate="${$}">
|
|
11661
11662
|
(function() {
|
|
11662
11663
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -11685,7 +11686,7 @@ else {
|
|
|
11685
11686
|
}
|
|
11686
11687
|
})();
|
|
11687
11688
|
</script>
|
|
11688
|
-
`}function
|
|
11689
|
+
`}function ij($){return`
|
|
11689
11690
|
<script data-hydrate="${$}">
|
|
11690
11691
|
(function() {
|
|
11691
11692
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -11707,7 +11708,7 @@ else {
|
|
|
11707
11708
|
events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
|
|
11708
11709
|
})();
|
|
11709
11710
|
</script>
|
|
11710
|
-
`}function
|
|
11711
|
+
`}function nj($,Z){let Y=Z.event||"stx:activate";return`
|
|
11711
11712
|
<script data-hydrate="${$}">
|
|
11712
11713
|
(function() {
|
|
11713
11714
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -11728,19 +11729,19 @@ else {
|
|
|
11728
11729
|
});
|
|
11729
11730
|
})();
|
|
11730
11731
|
</script>
|
|
11731
|
-
`}function
|
|
11732
|
-
`+
|
|
11733
|
-
<script type="application/json" data-island-props="${q}">${JSON.stringify(W)}</script>`:"",
|
|
11732
|
+
`}function pJ($,Z={},Y){let J=$,X=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=A5(J,"load",Z),J=A5(J,"idle",Z),J=A5(J,"visible",Z),J=A5(J,"media",Z),J=oj(J),J=A5(J,"hover",Z),J=A5(J,"event",Z),X=Q&&J!==$,X)J+=`
|
|
11733
|
+
`+hJ();return J}function A5($,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[V,O]=L.split(":").map((F)=>F.trim());if(V&&O){let F=O.replace(/^['"]|['"]$/g,"");K[V]=F}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,z=dJ(G.trim()),W=uJ(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 B=Object.keys(W).length>0?`
|
|
11734
|
+
<script type="application/json" data-island-props="${q}">${JSON.stringify(W)}</script>`:"",_="";switch(Z){case"load":_=mj(q);break;case"idle":_=pj(q,K);break;case"visible":_=lj(q,K);break;case"media":_=cj(q,K);break;case"hover":_=ij(q);break;case"event":_=nj(q,K);break}return`
|
|
11734
11735
|
<div data-island="${q}"
|
|
11735
11736
|
data-strategy="${Z}"
|
|
11736
11737
|
${U.join(`
|
|
11737
11738
|
`)}
|
|
11738
11739
|
class="stx-island"
|
|
11739
11740
|
style="contents;">
|
|
11740
|
-
${G.trim()}${
|
|
11741
|
+
${G.trim()}${B}
|
|
11741
11742
|
</div>
|
|
11742
|
-
${
|
|
11743
|
-
`})}function
|
|
11743
|
+
${_}
|
|
11744
|
+
`})}function oj($){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`
|
|
11744
11745
|
<div data-island="${X}"
|
|
11745
11746
|
data-strategy="only"
|
|
11746
11747
|
class="stx-island stx-client-only">
|
|
@@ -11759,7 +11760,7 @@ else {
|
|
|
11759
11760
|
}
|
|
11760
11761
|
})();
|
|
11761
11762
|
</script>
|
|
11762
|
-
`})}function
|
|
11763
|
+
`})}function lJ(){return`
|
|
11763
11764
|
/* Island base styles */
|
|
11764
11765
|
.stx-island {
|
|
11765
11766
|
display: contents;
|
|
@@ -11800,11 +11801,11 @@ else {
|
|
|
11800
11801
|
.stx-island.hydrated {
|
|
11801
11802
|
opacity: 1;
|
|
11802
11803
|
}
|
|
11803
|
-
`}function
|
|
11804
|
+
`}function cJ($){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 iJ($){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 nJ(){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 oJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function sJ($){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 rJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function aJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
|
|
11804
11805
|
<script type="application/json" id="stx-island-manifest">
|
|
11805
11806
|
${JSON.stringify(Z)}
|
|
11806
11807
|
</script>
|
|
11807
|
-
`}var
|
|
11808
|
+
`}var sj;var eJ=b(()=>{sj={processPartialHydrationDirectives:pJ,processStaticDirectives:rJ,generatePartialHydrationCSS:lJ,generateIslandManifest:aJ,createIslandRegistry:mJ,hydrateIsland:cJ,hydrateByStrategy:iJ,hydrateAll:nJ,isHydrated:oJ,onHydrated:sJ}});var WX={};e(WX,{watchMultiple:()=>XX,watchEffect:()=>QX,watch:()=>JX,unref:()=>$X,toRefs:()=>ZX,throttledComputed:()=>zX,stxWatchMultiple:()=>XX,stxWatchEffect:()=>QX,stxWatch:()=>JX,stxUnref:()=>$X,stxToRefs:()=>ZX,stxThrottledComputed:()=>zX,stxShallowRef:()=>YX,stxRef:()=>R5,stxIsRef:()=>I1,stxDebouncedComputed:()=>qX,stxComputed:()=>B$,shallowRef:()=>YX,ref:()=>R5,processWatchDirectives:()=>KX,processComputedDirectives:()=>GX,isRef:()=>I1,default:()=>rj,debouncedComputed:()=>qX,computed:()=>B$});function R5($){let Z=$,Y=new Set,J={get value(){if(Q1){let X=j$.get(J);if(!X)X=new Set,j$.set(J,X);X.add(Q1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=j$.get(J);if(Q)Q.forEach((G)=>G())}},subscribe(X){return Y.add(X),()=>Y.delete(X)},peek(){return Z}};return J}function I1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function $X($){return I1($)?$.value:$}function ZX($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=R5($[Y]);return Z}function YX($){return R5($)}function B$($){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 j=U.value;q.forEach((B)=>B(j))}};function W(){K.clear();let j=Q1;Q1=z,o4.push(z);try{return Y()}finally{o4.pop(),Q1=j}}let U={get value(){if(Q1){let j=j$.get(U);if(!j)j=new Set,j$.set(U,j);j.add(Q1)}if(G){let j=W();if(!X(Q,j))Q=j;G=!1}return Q},set value(j){if(J)J(j);else console.warn("Computed property is readonly")},subscribe(j){return q.add(j),()=>q.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function JX($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,q=!0,z=!1,W=()=>{if(I1($))return X?o1($.value):$.value;return $()},U=()=>{if(!q||z)return;let _=W();if(K!==void 0&&Object.is(K,_)&&!X)return;let H=()=>{if(Z(_,K),K=X?o1(_):_,G)B()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},j=null;if(I1($))j=$.subscribe(()=>U());else j=B$($).subscribe(()=>U());if(J)K=void 0,U();else K=W();let B=()=>{if(q=!1,j)j(),j=null};return B.pause=()=>{z=!0},B.resume=()=>{z=!1},B}function XX($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((U)=>I1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((j)=>I1(j)?j.value:void 0);if(Z(U,Q),Q=[...U],X)W()},z=$.map((U)=>{if(I1(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 QX($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let q=Q1;Q1=G,o4.push(G);try{J=$()}finally{o4.pop(),Q1=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 GX($,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 KX($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
|
|
11808
11809
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
11809
11810
|
(function() {
|
|
11810
11811
|
// Watch implementation for ${Q}
|
|
@@ -11816,9 +11817,9 @@ else {
|
|
|
11816
11817
|
}
|
|
11817
11818
|
})();
|
|
11818
11819
|
</script>
|
|
11819
|
-
`})}function o1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>o1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(o1(X),o1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(o1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=o1($[Y]);return Z}function
|
|
11820
|
-
`)}catch{return""}})}function
|
|
11821
|
-
`)}catch{return""}})}function
|
|
11820
|
+
`})}function o1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>o1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(o1(X),o1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(o1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=o1($[Y]);return Z}function qX($,Z=100){let Y=R5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return B$($).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 zX($,Z=100){let Y=R5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return B$($).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 Q1=null,o4,j$,rj;var UX=b(()=>{o4=[],j$=new WeakMap;rj={ref:R5,computed:B$,watch:JX,watchMultiple:XX,watchEffect:QX,isRef:I1,unref:$X,toRefs:ZX,shallowRef:YX,debouncedComputed:qX,throttledComputed:zX,processComputedDirectives:GX,processWatchDirectives:KX}});var HX={};e(HX,{v:()=>aj,processHasErrorsDirective:()=>_X,processFormValidationDirectives:()=>ej,processErrorsDirective:()=>BX,processErrorDirective:()=>jX,defineForm:()=>tj,Validator:()=>N5});class N5{rules=[];defaultValue="";addRule($){let Z=new N5;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 N5;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 N5;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 tj($,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 F=await $[O].validate(J[O],J);return X[O]=F,K[O]=!1,F.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 j(O){for(let F of Y)if(F in O)J[F]=O[F],G[F]=!0}function B(O,F){J[O]=F,G[O]=!0}function _(O,F=!0){if(Q[O]=F,F)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(F)=>{F?.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:j,setFieldValue:B,setFieldTouched:_,getFieldState:H,handleSubmit:L}}function jX($,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(`
|
|
11821
|
+
`)}catch{return""}})}function BX($,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(`
|
|
11822
|
+
`)}catch{return""}})}function _X($,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 ej($,Z,Y){let J=$;return J=jX(J,Z,Y),J=BX(J,Z,Y),J=_X(J,Z,Y),J}var aj;var OX=b(()=>{aj=new N5});var VX={};e(VX,{processXElementDirectives:()=>$B,hasXElementDirectives:()=>FX,generateXElementRuntime:()=>LX});function LX(){return`<script data-stx-scoped data-stx-x-element-runtime>
|
|
11822
11823
|
(function() {
|
|
11823
11824
|
'use strict';
|
|
11824
11825
|
|
|
@@ -12102,9 +12103,9 @@ else {
|
|
|
12102
12103
|
// Expose for manual initialization
|
|
12103
12104
|
window.XElement = XElement;
|
|
12104
12105
|
})();
|
|
12105
|
-
</script>`}function
|
|
12106
|
+
</script>`}function FX($){return/\bx-data(?:\s|=)/.test($)}function $B($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],J=Y.length>0?$.replace(Z,""):$;if(!FX(J))return J;let X=Y[0]?.trim()||LX(),Q=J.lastIndexOf("</body>");if(Q!==-1)return J.slice(0,Q)+X+`
|
|
12106
12107
|
`+J.slice(Q);return J+`
|
|
12107
|
-
`+X}var
|
|
12108
|
+
`+X}var wX={};e(wX,{rewriteImagesWithSiblings:()=>JB});import U1 from"path";async function JB($,Z){let Y=Z.formats??YB;if(!Z.publicDir)return $;let J=GB($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let U=K[0],j=U.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(KB(K.index,J))continue;G.push({idx:K.index,length:U.length,src:j[1],raw:U})}if(G.length===0)return $;let q=await Promise.all(G.map(async(U)=>{let j=await XB(U.src,Z.publicDir,Y);return{match:U,sources:j}}));for(let{match:U,sources:j}of q){if(j.length===0)continue;let _=`<picture>${j.map((H)=>`<source type="${H.mime}" srcset="${qB(H.url)}">`).join("")}${U.raw}</picture>`;X.push({start:U.idx,end:U.idx+U.length,replacement:_})}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 XB($,Z,Y){if(!QB($))return[];let J=U1.extname($).toLowerCase();if(!ZB.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(j)=>{let B=U1.join(Q,`${G}${j.ext}`);if(!await Bun.file(B).exists())return null;return{url:U1.posix.join(z,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(W)).filter((j)=>j!==null)}function QB($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function GB($){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 KB($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function qB($){return $.replace(/&/g,"&").replace(/"/g,""")}var ZB,YB;var AX=b(()=>{ZB=new Set([".jpg",".jpeg",".png",".gif"]),YB=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var RX=()=>{};function d6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var NX=b(()=>{RX()});var TX={};e(TX,{injectPwaTags:()=>zB,generateThemeColorMeta:()=>jB,generateSwRegistrationScript:()=>WB,generatePwaTags:()=>s4,generateManifestLink:()=>UB});function s4($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=d6($),Q=`
|
|
12108
12109
|
<!-- stx PWA Meta Tags -->
|
|
12109
12110
|
<link rel="manifest" href="/manifest.json">
|
|
12110
12111
|
<meta name="theme-color" content="${u6(Y?.themeColor||"#000000")}">
|
|
@@ -12148,9 +12149,9 @@ if ('serviceWorker' in navigator) {
|
|
|
12148
12149
|
});
|
|
12149
12150
|
}
|
|
12150
12151
|
</script>
|
|
12151
|
-
<!-- End stx PWA -->`,Q}function
|
|
12152
|
+
<!-- End stx PWA -->`,Q}function zB($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1){let Q=s4(Z);return $.slice(0,X)+Q+`
|
|
12152
12153
|
`+$.slice(X)}return $+s4(Z)}let J=s4(Z);return $.replace("</head>",`${J}
|
|
12153
|
-
</head>`)}function
|
|
12154
|
+
</head>`)}function WB($){if(!$.pwa?.enabled)return"";return`<script>
|
|
12154
12155
|
if ('serviceWorker' in navigator) {
|
|
12155
12156
|
window.addEventListener('load', function() {
|
|
12156
12157
|
navigator.serviceWorker.register('/${d6($)}')
|
|
@@ -12162,46 +12163,46 @@ if ('serviceWorker' in navigator) {
|
|
|
12162
12163
|
});
|
|
12163
12164
|
});
|
|
12164
12165
|
}
|
|
12165
|
-
</script>`}function
|
|
12166
|
+
</script>`}function UB(){return'<link rel="manifest" href="/manifest.json">'}function jB($){return`<meta name="theme-color" content="${u6($)}">`}function u6($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var MX=b(()=>{NX()});import f0 from"path";import{deriveLayoutGroup as BB}from"stx-router/layout-metadata";function IX($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function _B($,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(`
|
|
12166
12167
|
`,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===`
|
|
12167
12168
|
`){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]===`
|
|
12168
|
-
`)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 r4($,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
|
|
12169
|
+
`)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 r4($,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 DX($){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 HB($){let Z=r4($,"data-stx-runtime");if(!Z)return $;let Y=DX($);if(Y===-1||Y===Z.start)return $;let J=$.slice(Z.start,Z.end),X=$.slice(0,Z.start)+$.slice(Z.end),Q=DX(X);if(Q===-1)return J+`
|
|
12169
12170
|
`+X;return X.slice(0,Q)+J+`
|
|
12170
|
-
`+X.slice(Q)}async function L0($,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||!a5()&&!F4())&&Y&&Y.endsWith(".stx"))n3($,Y);try{return await
|
|
12171
|
-
`),...z.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...z.htmlAttrs}},...z.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...z.bodyAttrs}}},L=b6(G);if(G=
|
|
12172
|
-
<meta name="stx-layout" content="${
|
|
12173
|
-
<meta name="stx-layout-group" content="${
|
|
12174
|
-
`+W+G.slice(U.end)}}catch{}if(Q)try{let{getComposableScript:K}=await Promise.resolve().then(() => (
|
|
12175
|
-
`+W+G.slice(U.end)}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await Z$(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof R4)throw G;let K=G instanceof Error?G.message:String(G),q=new m1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(a0.log(q,{filePath:Y,context:Z}),V3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),J.debug)throw q;return L3.createFallbackContent("Template Processing",q)}}async function
|
|
12171
|
+
`+X.slice(Q)}async function L0($,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||!a5()&&!F4())&&Y&&Y.endsWith(".stx"))n3($,Y);try{return await x9.timeAsync("template-processing",async()=>{let G=await OB($,Z,Y,J,X);if(Q)G=P6(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},z=(Z.__stx_runtime_head||null)??_7(),W=(Z.__stx_head_raw||"").trim(),U,j=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)U=j[1].trim(),W=W.replace(j[0],"").trim();let B=Z.__sections?.title,_=z.title||U||B,H={...K,..._&&{title:_},meta:[...K.meta||[],...z.meta||[]],link:[...K.link||[],...z.link||[]],script:[...K.script||[],...z.script||[]],headRaw:[K.headRaw,W].filter(Boolean).join(`
|
|
12172
|
+
`),...z.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...z.htmlAttrs}},...z.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...z.bodyAttrs}}},L=b6(G);if(G=JJ(G,H),L)G=YJ(G,K);let V=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(V&&G.includes("<head")){let F=V[1],w=BB(F);G=G.replace("<head>",`<head>
|
|
12173
|
+
<meta name="stx-layout" content="${IX(F)}">
|
|
12174
|
+
<meta name="stx-layout-group" content="${IX(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 F=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(F,"$1")}}if(Q)G=ZJ(G),G=HB(G);if(Q)try{let{getStoreScript:K}=await Promise.resolve().then(() => (jJ(),UJ)),q=J.storesDir,z=await K(q);if(z){let W=`<script data-stx-stores>${z}</script>`,U=r4(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
12175
|
+
`+W+G.slice(U.end)}}catch{}if(Q)try{let{getComposableScript:K}=await Promise.resolve().then(() => (HJ(),_J)),q=J.composablesDir,z=await K(q);if(z){let W=`<script data-stx-composables>${z}</script>`,U=r4(G,"data-stx-stores")||r4(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
12176
|
+
`+W+G.slice(U.end)}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await Z$(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof R4)throw G;let K=G instanceof Error?G.message:String(G),q=new m1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(a0.log(q,{filePath:Y,context:Z}),V3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),J.debug)throw q;return L3.createFallbackContent("Template Processing",q)}}async function OB($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!f0.isAbsolute(J.partialsDir)?f0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!f0.isAbsolute(J.componentsDir)?f0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!f0.isAbsolute(J.layoutsDir)?f0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,q=$;await VB(Y,Z),FB(Z,K),q=await z5(()=>dY(q,Z,Y,K),q,(O)=>{a0.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=Z1(q,v5,(O,F)=>`\x00STX_HTML_COMMENT_${F}\x00`);q=z.output;let W=z.tokens,U=(O)=>W.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(F,w)=>W[Number(w)]??""),j="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,j),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,F)=>{return`{{ ${F} }}`}),q=aY(q),q=await GJ(q,Y,X);let B={};q=D6(q,B);let _={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let V=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(V)H=V[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),F=/@section\s*\(/.test(q);if(!O||F){let w="",A=f0.dirname(Y),R=K.layoutsDir?f0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let T=f0.join(A,"_layout.stx");if(await o(T)){w=T;break}let M=f0.dirname(A);if(M===A||M.length<R.length)break;A=M}if(w)H=w;else if(K.layoutsDir){let N=f0.isAbsolute(K.layoutsDir)?K.layoutsDir:f0.resolve(process.cwd(),K.layoutsDir),T=f0.join(N,`${K.defaultLayout}.stx`);if(await o(T))H=T}if(H&&!F)q=`@section('content')
|
|
12176
12177
|
${q.trim()}
|
|
12177
|
-
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,w)=>{return
|
|
12178
|
-
`);
|
|
12179
|
-
${A}`:A,Z.__sections=
|
|
12180
|
-
${q}`,U(q)}catch(O){return a0.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
|
|
12181
|
-
`;if(Q=M(Q,Z),Q=I(Q,Z),Q=
|
|
12178
|
+
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,w)=>{return _[F]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,F,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=X0(w.trim(),Z);if(A===void 0)return O;return _[F]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,F,w)=>{if(w.includes("@parent"))_[F]=w.replace("@parent",s1);else _[F]=w.trim();return""}),Z.__sections=_,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,F,w)=>{return _[F]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""});if(q=E6(q,B),H){let O=[],F=O1(q),w=Z1(F.output,t1,(A,R)=>`\x00STX_ORPHAN_STYLE_${R}\x00`);if(q=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,R,N)=>{let T=R==="SCRIPT"?F.scripts[Number(N)]:w.tokens[Number(N)];if(T)O.push(T);return""}),O.length>0){let A=O.join(`
|
|
12179
|
+
`);_.content=_.content?`${_.content}
|
|
12180
|
+
${A}`:A,Z.__sections=_}}if(H)try{let O;if(f0.isAbsolute(H))O=H,X.add(H);else O=await z5(()=>x7(H,Y,G,X),null,()=>{throw new m1(`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(a0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new m1(T,Y);return q}let F=await z5(()=>Bun.file(O).text(),"",()=>{throw new m1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,y,S)=>{return T[y]=S.trim(),""});for(let[D,y]of Object.entries(T))if(_[D]&&_[D].includes(s1)){let S=_[D].indexOf(s1);_[D]=_[D].slice(0,S)+y+_[D].slice(S+s1.length)}else if(!_[D])_[D]=y;let I={...Z,__sections:_},E=`@layout('${w[1]}')${M}`;return await L0(E,I,O,G,X)}let A=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),R=D6(A,B),N={};return R=R.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return N[M]=I.trim(),`@slot('${M}')`}),R=R.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(_[M]){let E=_[M];if(E.includes(s1)){let D=N[M]||"",y=E.indexOf(s1);E=E.slice(0,y)+D+E.slice(y+s1.length)}return E}return I||""}),R=LB(R,_),R=R.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""}),R=E6(R,B),Z.__originalFilePath=Y,q=await EX(R,Z,O,G,X),q=`<!-- stx-layout: ${H} -->
|
|
12181
|
+
${q}`,U(q)}catch(O){return a0.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 EX(q,Z,Y,G,X))}function LB($,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 FB($,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 VB($,Z){await z5(()=>cY($,Z),void 0,(Y)=>{a0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function wB($,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(() => (l5(),D$));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let z=q instanceof Error?q:Error(String(q));a0.log(z,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${z.message}`)}}}async function AB($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await Promise.resolve().then(() => (Y1(),y9));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return a0.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function EX($,Z,Y,J,X){let Q=$,G=J;if(await wB(Q,Z,Y),Q=await AB(Q,Z,Y),Q=await CY(Q,Z,Y),Q=await vY(Q,Z,Y),Q=await y2(Q,Z,Y,G),e1(Q))Q=S7(Q,Z),Q=P7(Q,Z);Q=y7(Q);let{processStreamDirectives:K}=await Promise.resolve().then(() => (i3(),c3));Q=K(Q,Z),Q=N6(Q,Z,Y,G),Q=await m4(Q,Z,Y,G,X),Q=await eY(Q,Z,Y,G,X),Q=t6(Q,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => LJ);Q=q(Q,Z,Y);let{processTeleportDirectives:z}=await Promise.resolve().then(() => VJ);Q=z(Q,Z,Y);let{processTransitionDirectives:W,processTransitionAttributes:U}=await Promise.resolve().then(() => NJ);Q=W(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:j}=await Promise.resolve().then(() => MJ);Q=j(Q,Z,Y);let{processSuspenseDirectives:B}=await Promise.resolve().then(() => IJ);Q=B(Q,Z,Y);let{processAsyncDirectives:_}=await Promise.resolve().then(() => bJ);Q=_(Q,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => yJ);Q=H(Q,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (gJ(),fJ));Q=L(Q,Z,Y),Q=V(Q,Z,Y),Q=O(Q,Z,Y);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await Promise.resolve().then(() => (eJ(),tJ));Q=F(Q,Z,Y),Q=w(Q);let{processComputedDirectives:A,processWatchDirectives:R}=await Promise.resolve().then(() => (UX(),WX));Q=A(Q,Z,Y),Q=R(Q,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (OX(),HX));Q=N(Q,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:E}=await Promise.resolve().then(() => (m5(),O7));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=T(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
|
|
12182
|
+
`;if(Q=M(Q,Z),Q=I(Q,Z),Q=pY(Q),Q=y3(Q,Z),Q=b2(Q),Q=gY(Q),Q=await I6(Q,Z,Y,G,X),Q=await m4(Q,Z,Y,G,X),Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=P6(Q),Q=c1(Q,Z,Y),Q=P3(Q,Z),Q=C3(Q,Z),Q=P4(Q,Z),Q=f2(Q,Z),Q=g2(Q,Z),Q=await V2(Q,Z,Y,G),Q=await E8(Q,Z,Y),Q=await p2(Q,Z,Y,G),Q=c6(Q,Z,Y,G),Q=xZ(Q,Z,Y,G),Q=fZ(Q,Z,Y),Q=gZ(Q,Z,Y,G),Q=D2(Q,Z,Y,G),Q=S6(Q,Z),Q=y6(Q),Q=qJ(Q),!G.skipEventDirectives)Q=j2(Q,Z,Y);if(Q=L2(Q,Z,Y),G.debug){let l=/\bx-data\s*=/.test(Q),a=p$($);if(l&&a)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
12182
12183
|
Both work on the same page, but they manage separate scopes.
|
|
12183
|
-
Prefer signals (state/derived/effect) for new components.`)}Q=
|
|
12184
|
+
Prefer signals (state/derived/effect) for new components.`)}Q=oY(Q,Z),Q=await L1(Q,Z,Y),Q=zJ(Q),Q=WJ(Q),Q=J2(Q);let{processXElementDirectives:y}=await Promise.resolve().then(() => VX);Q=y(Q);let S=Z.__originalFilePath||Y,k=y5(Z);if(Q=await C7(Q,G,S,k),Q=await uY(Q,Z,Y,G),G.media?.image?.autoSiblings){let l=G.publicDir||"public",{rewriteImagesWithSiblings:a}=await Promise.resolve().then(() => (AX(),wX));Q=await a(Q,{publicDir:l})}if(G.seo?.enabled)Q=hZ(Q,Z,G);let C=(l,a,h=!0)=>{if(!a)return l;let u=a.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),P=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(u&&P){if(h)l=l.replace(P[0],u[0]);if(a=a.replace(u[0],"").trim(),!a)return l}if(/<\/head>/i.test(l))return l.replace(/<\/head>/i,`${a}
|
|
12184
12185
|
</head>`);if(/<head\b[^>]*>/i.test(l))return l.replace(/(<head\b[^>]*>)/i,`$1
|
|
12185
12186
|
${a}`);if(/<html\b[^>]*>/i.test(l))return l.replace(/(<html\b[^>]*>)/i,`$1
|
|
12186
12187
|
<head>
|
|
12187
12188
|
${a}
|
|
12188
|
-
</head>`);return l},{renderHead:x,getHead:f}=await Promise.resolve().then(() => (m5(),O7)),c=Z.__stx_runtime_head??f();if(c.title||c.meta?.length||c.link?.length){let l=x(c);if(l)Q=C(Q,l)}if(D.headContent)Q=C(Q,D.headContent,!c.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=
|
|
12189
|
-
${
|
|
12189
|
+
</head>`);return l},{renderHead:x,getHead:f}=await Promise.resolve().then(() => (m5(),O7)),c=Z.__stx_runtime_head??f();if(c.title||c.meta?.length||c.link?.length){let l=x(c);if(l)Q=C(Q,l)}if(D.headContent)Q=C(Q,D.headContent,!c.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=I2(Q,G.csp,Z);if(G.analytics?.enabled)Q=Q2(Q,G);if(G.heatmap?.enabled)Q=J9(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:l}=await Promise.resolve().then(() => (MX(),TX));Q=l(Q,G)}let p=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),W0=/\bSTX\.\w+/.test(Q),w0=/window\.STX\s*=/.test(Q);if(p&&W0&&!w0){let a=`<script data-stx-scoped>
|
|
12190
|
+
${eZ()}
|
|
12190
12191
|
</script>`;if(Q.includes("</head>")){let h=Q.indexOf("</head>"),P=Q.slice(0,h).indexOf("<script");if(P!==-1){let v=Q.slice(0,P),m=Q.slice(P);Q=v+a+`
|
|
12191
12192
|
`+m}else Q=Q.replace("</head>",`${a}
|
|
12192
12193
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
12193
12194
|
${a}`);else Q=a+`
|
|
12194
|
-
`+Q}{let{scanScriptTags:l}=await Promise.resolve().then(() => (o5(),l$)),a=[];for(let h of l(Q)){if(!/\bserver\b/i.test(h.attrs))continue;let u=h.start+h.fullMatch.indexOf(">")+1,P=
|
|
12195
|
+
`+Q}{let{scanScriptTags:l}=await Promise.resolve().then(() => (o5(),l$)),a=[];for(let h of l(Q)){if(!/\bserver\b/i.test(h.attrs))continue;let u=h.start+h.fullMatch.indexOf(">")+1,P=_B(Q,u);if(P===-1)continue;let v=P+9;while(v<Q.length&&/\s/.test(Q[v]))v++;a.push({start:h.start,end:v})}for(let h=a.length-1;h>=0;h--){let{start:u,end:P}=a[h];Q=Q.substring(0,u)+Q.substring(P)}}let _0=N$(Q,Y);if(_0.hasScoped)Q=_0.html;let J0=Z.__stx_event_bindings||[],I0=!1,i0=[],G1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:D1}=await Promise.resolve().then(() => (o5(),l$));for(let l of D1(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))i0.push({match:l.fullMatch,attrs:l.attrs,content:l.body});for(let{match:l,attrs:a,content:h}of i0){I0=!0;let u=h;v6(h,Y,J.strict);let P=await P5(h,{eventBindings:J0,attrs:a,hasColonDirectives:G1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:k});Q=Q.replace(l,()=>P)}if(I0)Z.__stx_event_bindings=[];return Q}var s1="<!--PARENT_CONTENT_PLACEHOLDER-->";var n$=b(()=>{D4();C1();$7();$2();X2();G2();J7();Z7();B2();C5();F2();w2();b4();E2();S2();C2();q1();m5();Y1();h2();l2();PY();fY();T6();f7();mY();J5();lY();w3();R0();iY();sY();tY();$J();j7();o5();R6();KJ();C6();x6();T0();o3();C6();x6()});import V0 from"fs";import Q0 from"path";import{matchRoute as lB,Router as cX}from"stx-router";import{findErrorPage as nB,formatRoutes as oB,generateRouteManifest as sB,generateRouteTypes as rB,matchRoute as aB}from"stx-router";function e4($,Z={}){return new cX($,Z).routes}n$();import{createHash as RB}from"crypto";function NB($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var TB=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function MB($){return Bun.hash($).toString(16)}function kX($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(TB,(Q,G,K,q)=>{let z=q.trim();if(!z)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)z=NB(z);let W=MB(z);if(!Y.has(W))Y.set(W,z);let U=Z.integrity?` data-stx-integrity="sha384-${RB("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 IB=new Set(["visible","idle"]);function bX($){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(IB.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)}l1();D5();D4();import{abortNavigation as RR,clearMiddleware as SX,createClientCookieManager as NR,createMiddlewareContext as yX,createRouteLocation as PX,createServerCookieManager as TR,createStorageManager as MR,defineMiddleware as IR,getMiddleware as DR,getMiddlewareNames as CX,hasMiddleware as ER,loadMiddlewareFromDirectory as vX,navigateTo as kR,registerMiddleware as bR,runMiddleware as xX}from"stx-router";class fX{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 V0.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=V0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(V0.existsSync(Q)){let G=V0.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 gX{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 V0.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 V0.promises.unlink(Z)}async invalidatePattern($){let Z=Q0.join(this.cacheDir,"isr");if(!V0.existsSync(Z))return;let Y=await V0.promises.readdir(Z);for(let J of Y){let X=J.replace(/_/g,"/").replace(".json","");if($.test(X))await V0.promises.unlink(Q0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function DB($){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(`
|
|
12195
12196
|
return (async function getStaticPaths() {
|
|
12196
12197
|
${X[1]}
|
|
12197
12198
|
})()
|
|
12198
|
-
`)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function
|
|
12199
|
+
`)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function EB($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let Y=await DB($.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 kB($){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 bB($,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",`
|
|
12199
12200
|
return (async function getStaticProps() {
|
|
12200
12201
|
${Q[1]}
|
|
12201
12202
|
})()
|
|
12202
|
-
`)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${Y}:`,Q),null}}async function
|
|
12203
|
-
</head>`);else U=`${
|
|
12204
|
-
${U}`}if(U=await k7(U),U=await Z$(U),J.minify!==!1)return{html:
|
|
12203
|
+
`)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${Y}:`,Q),null}}async function hX($,Z,Y={},J,X){let Q=await Bun.file($.filePath).text(),G=await kB($.filePath),K=await bB(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 L0(Q,q,$.filePath,W,z);if(Object.keys(Z).length>0){let j=`<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>",`${j}
|
|
12204
|
+
</head>`);else U=`${j}
|
|
12205
|
+
${U}`}if(U=await k7(U),U=await Z$(U),J.minify!==!1)return{html:SB(U),dependencies:Array.from(z)};return{html:U,dependencies:Array.from(z)}}function SB($){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 yB($){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 PB($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
12205
12206
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
12206
12207
|
${$.map((J)=>{let X=new URL(J.loc,Z).href,Q=` <url>
|
|
12207
12208
|
<loc>${e0(X)}</loc>`;if(J.lastmod)Q+=`
|
|
@@ -12210,7 +12211,7 @@ ${$.map((J)=>{let X=new URL(J.loc,Z).href,Q=` <url>
|
|
|
12210
12211
|
<priority>${J.priority}</priority>`;return Q+=`
|
|
12211
12212
|
</url>`,Q}).join(`
|
|
12212
12213
|
`)}
|
|
12213
|
-
</urlset>`}function e0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
12214
|
+
</urlset>`}function e0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function CB($,Z){let Y=Z.map((J)=>{let X=" <item>";if(X+=`
|
|
12214
12215
|
<title>${e0(J.title)}</title>`,X+=`
|
|
12215
12216
|
<link>${e0(J.link)}</link>`,J.description)X+=`
|
|
12216
12217
|
<description>${e0(J.description)}</description>`;if(J.pubDate)X+=`
|
|
@@ -12231,10 +12232,10 @@ ${$.map((J)=>{let X=new URL(J.loc,Z).href,Q=` <url>
|
|
|
12231
12232
|
${Y.join(`
|
|
12232
12233
|
`)}
|
|
12233
12234
|
</channel>
|
|
12234
|
-
</rss>`}async function
|
|
12235
|
+
</rss>`}async function vB($={}){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&&V0.existsSync(J.outputDir))await V0.promises.rm(J.outputDir,{recursive:!0});await V0.promises.mkdir(J.outputDir,{recursive:!0});let W=new fX(J.cacheDir);if(J.cache)await W.load();try{let{generateCrosswindCSS:F}=await Promise.resolve().then(() => (D4(),tZ));await F('<div class="bg-black"></div>')}catch{}SX();let U=Y?.routeMiddleware?.dir||"middleware";await vX(process.cwd(),U);let j=CX();if(j.length>0)console.log(`Loaded ${j.length} middleware: ${j.join(", ")}`);let B=Y?.routeMiddleware?.global||[],_=e4(".",{pagesDir:J.pagesDir});console.log(`Found ${_.length} routes`);let H=[];for(let F of _){let w=await EB(F);for(let A of w)H.push({route:F,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=[],V=[];for(let F=0;F<H.length;F+=J.concurrency)V.push(H.slice(F,F+J.concurrency));for(let F of V)await Promise.all(F.map(async(w)=>{let{route:A,url:R,params:N,props:T,revalidate:M}=w;try{await J.hooks.onPageStart?.(R);let I=await Bun.file(A.filePath).text(),E=hB(I),D=E?.middleware?Array.isArray(E.middleware)?E.middleware:[E.middleware]:[],y=[...B,...D];if(y.length>0){let d=PX(R,N,E||{}),c=yX(d,null),p=await xX(y,c);if(p.redirect){let W0=typeof p.redirect==="string"?p.redirect:p.redirect.path||p.redirect,w0=dB(String(W0),R),_0=uB(R,J);await V0.promises.mkdir(Q0.dirname(_0),{recursive:!0}),await Bun.write(_0,w0),X.successCount++,X.pages.push({route:R,outputPath:_0,size:Buffer.byteLength(w0),cached:!1}),L.push({loc:R,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${R} \u2192 redirect to ${W0}`);return}if(p.abort){let W0=typeof p.abort==="string"?p.abort:p.abort?.error?.message||"aborted";console.warn(` \u21B3 ${R} \u2014 middleware aborted: ${W0}`);return}}let S=I.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(S)try{if(!await Function("route",`
|
|
12235
12236
|
const validate = ${S[1]};
|
|
12236
12237
|
return validate(route);
|
|
12237
|
-
`)({params:N})){console.warn(`Validation failed for ${R}, skipping...`);return}}catch{}let k=null,C=!1;if(J.cache){if(k=W.get(R,A.filePath),k)C=!0,X.cachedCount++}if(!k){let d=await
|
|
12238
|
+
`)({params:N})){console.warn(`Validation failed for ${R}, skipping...`);return}}catch{}let k=null,C=!1;if(J.cache){if(k=W.get(R,A.filePath),k)C=!0,X.cachedCount++}if(!k){let d=await hX(A,N,T,J,Y);if(k=d.html,J.cache)W.set(R,A.filePath,d.dependencies,k)}let x;if(J.trailingSlash)x=Q0.join(J.outputDir,R,"index.html");else x=R==="/"?Q0.join(J.outputDir,"index.html"):Q0.join(J.outputDir,`${R}.html`);if(J.chunkIslands){let{html:d,chunks:c}=kX(k,{integrity:J.integrityIslands,minify:J.minify});if(c.length>0){let p=Q0.join(J.outputDir,"_stx","islands");await V0.promises.mkdir(p,{recursive:!0});for(let W0 of c){let w0=Q0.join(p,`${W0.hash}.js`);if(!await Bun.file(w0).exists())await Bun.write(w0,W0.code);if(!Q.has(W0.hash)){Q.add(W0.hash);let _0=Buffer.byteLength(W0.code,"utf8");G+=_0,K[W0.hash]={bytes:_0,file:`/_stx/islands/${W0.hash}.js`}}}if(q[R]=c.map((W0)=>W0.hash),k=d,J.prefetchIslands)k=bX(k)}}await V0.promises.mkdir(Q0.dirname(x),{recursive:!0}),await Bun.write(x,k),L.push({loc:R,lastmod:new Date().toISOString().split("T")[0],priority:R==="/"?1:0.8});let f={route:R,outputPath:x,size:Buffer.byteLength(k,"utf8"),cached:C};if(M!==!1)f.revalidateAt=Date.now()+M*1000;X.pages.push(f),X.successCount++,await J.hooks.onPageEnd?.(R,k)}catch(I){X.failedCount++,X.errors.push({route:R,error:I}),await J.hooks.onError?.(I,R),console.error(`Error generating ${R}:`,I)}}));if(J.cache)await W.save();if(J.generate404){let F=Q0.join(J.pagesDir,"404.stx");if(await Bun.file(F).exists()){let w=new Set,A={...Y,debug:!1,cache:!1},R=await L0(await Bun.file(F).text(),{},F,A,w);await Bun.write(Q0.join(J.outputDir,"404.html"),R)}else await Bun.write(Q0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
|
|
12238
12239
|
<html lang="en">
|
|
12239
12240
|
<head>
|
|
12240
12241
|
<meta charset="UTF-8">
|
|
@@ -12255,7 +12256,7 @@ ${Y.join(`
|
|
|
12255
12256
|
<a href="/">Go home</a>
|
|
12256
12257
|
</div>
|
|
12257
12258
|
</body>
|
|
12258
|
-
</html>`)}for(let F of[500]){let w=Q0.join(J.pagesDir,`${F}.stx`);if(await Bun.file(w).exists()){let A=new Set,R={...Y,debug:!1,cache:!1},N=await L0(await Bun.file(w).text(),{},w,R,A);await Bun.write(Q0.join(J.outputDir,`${F}.html`),N)}}let O=Q0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let F=new Set,w={...Y,debug:!1,cache:!1},A=await L0(await Bun.file(O).text(),{},O,w,F);await Bun.write(Q0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let F=
|
|
12259
|
+
</html>`)}for(let F of[500]){let w=Q0.join(J.pagesDir,`${F}.stx`);if(await Bun.file(w).exists()){let A=new Set,R={...Y,debug:!1,cache:!1},N=await L0(await Bun.file(w).text(),{},w,R,A);await Bun.write(Q0.join(J.outputDir,`${F}.html`),N)}}let O=Q0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let F=new Set,w={...Y,debug:!1,cache:!1},A=await L0(await Bun.file(O).text(),{},O,w,F);await Bun.write(Q0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let F=PB(L,J.domain),w=Q0.join(J.outputDir,"sitemap.xml");await Bun.write(w,F),X.sitemapPath=w,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.rss){let F=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},w=[];if(F.getItems)w=await F.getItems();let A=CB(F,w),R=Q0.join(J.outputDir,"rss.xml");await Bun.write(R,A),X.rssPath=R,console.log(`Generated rss.xml with ${w.length} items`)}if(J.publicDir&&V0.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?`
|
|
12259
12260
|
Island chunks: ${X.islandChunks.count} (${(X.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
|
|
12260
12261
|
Build complete!
|
|
12261
12262
|
Total: ${X.totalPages} pages
|
|
@@ -12263,8 +12264,8 @@ Build complete!
|
|
|
12263
12264
|
Cached: ${X.cachedCount}
|
|
12264
12265
|
Failed: ${X.failedCount}
|
|
12265
12266
|
Time: ${X.buildTime}ms${z}
|
|
12266
|
-
`),X}async function
|
|
12267
|
-
`)){let U=W.indexOf(":");if(U>0){let
|
|
12267
|
+
`),X}async function dX($,Z){let Y=await V0.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 V0.promises.mkdir(Q,{recursive:!0}),await dX(X,Q);else await V0.promises.copyFile(X,Q)}}function xB($={}){let Z=$.cacheDir||B1(process.cwd(),"ssg-cache"),Y=new gX(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=e4(".",{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,j)=>{q[U]=K[j+1]});let z=await z1(),{html:W}=await hX(G,q,{},$,z);await Y.set(X,{html:W,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:yB(W)}),console.log(`Revalidated: ${X}`)},async invalidate(X){if(typeof X==="string")await Y.invalidate(X);else await Y.invalidatePattern(X)}}}function fB($){return async()=>{return{paths:await $(),fallback:!1}}}function gB(){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(`
|
|
12268
|
+
`)){let U=W.indexOf(":");if(U>0){let j=W.slice(0,U).trim(),B=W.slice(U+1).trim();if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^\d+$/.test(B))B=parseInt(B,10);else if(/^\d+\.\d+$/.test(B))B=parseFloat(B);else if(B.startsWith("[")&&B.endsWith("]"))B=B.slice(1,-1).split(",").map((_)=>_.trim().replace(/^['"]|['"]$/g,""));J[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 hB($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function dB($,Z){return`<!DOCTYPE html>
|
|
12268
12269
|
<html>
|
|
12269
12270
|
<head>
|
|
12270
12271
|
<meta charset="utf-8">
|
|
@@ -12276,4 +12277,4 @@ Build complete!
|
|
|
12276
12277
|
<p>Redirecting to <a href="${$}">${$}</a>...</p>
|
|
12277
12278
|
<script>window.location.replace('${$}')</script>
|
|
12278
12279
|
</body>
|
|
12279
|
-
</html>`}function
|
|
12280
|
+
</html>`}function uB($,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 dR={generateStaticSite:vB,createISRHandler:xB,defineStaticPaths:fB,createMarkdownLoader:gB};export{vB as generateStaticSite,fB as defineStaticPaths,dR as default,gB as createMarkdownLoader,xB as createISRHandler};
|