@stacksjs/stx 0.2.868 → 0.2.870
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/app-shell.js +5 -4
- package/dist/chunk-04f6r2kh.js +2 -0
- package/dist/{chunk-5kh12nvn.js → chunk-0jchm9gg.js} +1 -1
- package/dist/{chunk-g0xn80gz.js → chunk-0tyyad6q.js} +9 -9
- package/dist/{chunk-j4ec0g5g.js → chunk-12sk3dtm.js} +1 -1
- package/dist/{chunk-3wcwr2qt.js → chunk-1637r8fg.js} +1 -1
- package/dist/{chunk-67dgp45w.js → chunk-1dt8e7ew.js} +2 -2
- package/dist/{chunk-5dvkphbe.js → chunk-311mrz2n.js} +1 -1
- package/dist/chunk-3asy7ev5.js +2 -0
- package/dist/{chunk-z512gt4v.js → chunk-3f51tn2b.js} +3 -3
- package/dist/{chunk-f22sdw5q.js → chunk-3v7xht2q.js} +1 -1
- package/dist/{chunk-8s6s6nd0.js → chunk-4068rmzv.js} +2 -2
- package/dist/{chunk-tefr8tve.js → chunk-4t5t33yj.js} +3 -3
- package/dist/{chunk-8arfg8kp.js → chunk-4vtw6f0c.js} +1 -1
- package/dist/{chunk-5kkq2eqr.js → chunk-5d0csn7w.js} +1 -1
- package/dist/{chunk-vvzys1x7.js → chunk-5h9d6jew.js} +3 -3
- package/dist/{chunk-h65shwe9.js → chunk-5sbtbfj3.js} +1 -1
- package/dist/{chunk-k32q90b2.js → chunk-60yppcbb.js} +2 -2
- package/dist/{chunk-eafqxbr0.js → chunk-6ggme8xx.js} +1 -1
- package/dist/{chunk-fmzyrg2e.js → chunk-6ksyrmpp.js} +1 -1
- package/dist/{chunk-x64afx6z.js → chunk-6mjd3pqd.js} +1 -1
- package/dist/{chunk-6k4ac74t.js → chunk-6vgr5g6d.js} +2 -2
- package/dist/chunk-79sr2kxg.js +2 -0
- package/dist/{chunk-pnqap5yf.js → chunk-7d6jq5j8.js} +1 -1
- package/dist/chunk-7wae4311.js +33 -0
- package/dist/{chunk-nq4zvers.js → chunk-81n2s24z.js} +1 -1
- package/dist/chunk-8cf6995c.js +2 -0
- package/dist/chunk-8cgn4re9.js +2 -0
- package/dist/chunk-94e6kmjm.js +2 -0
- package/dist/{chunk-amkzap4f.js → chunk-9ffvh6cr.js} +1 -1
- package/dist/chunk-aa6ztwdq.js +2 -0
- package/dist/chunk-bz1jgrx8.js +2 -0
- package/dist/{chunk-egvyeet8.js → chunk-ca9x39p1.js} +1 -1
- package/dist/{chunk-qc4eca8y.js → chunk-cbpxd3qa.js} +1 -1
- package/dist/{chunk-9mvc7t63.js → chunk-cwmfxbhz.js} +2 -2
- package/dist/{chunk-9a7tds1a.js → chunk-d4zcwtna.js} +1 -1
- package/dist/{chunk-mcnwvh06.js → chunk-d9k8j44b.js} +5 -5
- package/dist/{chunk-2rz0wdft.js → chunk-dg4zxpbq.js} +3 -3
- package/dist/chunk-djdganvr.js +2 -0
- package/dist/{chunk-je3wv4qx.js → chunk-drdr0a53.js} +1 -1
- package/dist/{chunk-hw156fjb.js → chunk-dwqjrbse.js} +2 -2
- package/dist/{chunk-kh6njq2r.js → chunk-dy7vqv1x.js} +2 -2
- package/dist/{chunk-0qx649hq.js → chunk-eh1rdapx.js} +1 -1
- package/dist/{chunk-tv8107sc.js → chunk-fcvgf88g.js} +1 -1
- package/dist/{chunk-ynkbv9jq.js → chunk-gcsy3z1e.js} +2 -2
- package/dist/{chunk-ycqnq4b0.js → chunk-gesktj4m.js} +1 -1
- package/dist/{chunk-mapk8tws.js → chunk-h0nxd9xg.js} +1 -1
- package/dist/chunk-hb6r4pxp.js +2 -0
- package/dist/{chunk-jbgj2hph.js → chunk-hvx6j4a2.js} +2 -2
- package/dist/{chunk-d54r5c9e.js → chunk-hze3158c.js} +74 -74
- package/dist/chunk-jksjr12b.js +2 -0
- package/dist/{chunk-8me8hamk.js → chunk-k7m8659h.js} +2 -2
- package/dist/chunk-khe30jmk.js +3 -0
- package/dist/{chunk-d9r6xy5m.js → chunk-m1a3a32y.js} +1 -1
- package/dist/{chunk-cjy9cdm0.js → chunk-m4k6ndf5.js} +1 -1
- package/dist/{chunk-7xhwqc0c.js → chunk-mnx6njd4.js} +4 -4
- package/dist/{chunk-4hb62hcj.js → chunk-mwxehpse.js} +2 -2
- package/dist/{chunk-6jpgyb22.js → chunk-n7w8n327.js} +1 -1
- package/dist/chunk-ndrgek64.js +2 -0
- package/dist/{chunk-t76vnqff.js → chunk-nkwj7eq3.js} +1 -1
- package/dist/chunk-nxecjev1.js +2 -0
- package/dist/chunk-pdpmtmfj.js +54 -0
- package/dist/{chunk-ea3c80wv.js → chunk-pfr3cazq.js} +2 -2
- package/dist/chunk-ps6m8n9n.js +2 -0
- package/dist/{chunk-aef82ns3.js → chunk-pxce4aag.js} +1 -1
- package/dist/{chunk-cra4g128.js → chunk-q58f5wk2.js} +6 -6
- package/dist/{chunk-ypfbw069.js → chunk-qm0qn2xa.js} +4 -4
- package/dist/{chunk-p50qqwed.js → chunk-qmr5xsjj.js} +1 -1
- package/dist/chunk-qxxvaxee.js +2 -0
- package/dist/chunk-rhhq8k9f.js +2 -0
- package/dist/{chunk-bwdbj60y.js → chunk-rpep1ve3.js} +2 -2
- package/dist/{chunk-jx8nha8j.js → chunk-rt55f47q.js} +2 -2
- package/dist/chunk-s2a9vfdg.js +2 -0
- package/dist/{chunk-0kzawt78.js → chunk-sb3dx4dd.js} +2 -2
- package/dist/{chunk-83tvkw4y.js → chunk-sbvkk4cn.js} +2 -2
- package/dist/{chunk-wrvs1hh1.js → chunk-sew1z7cv.js} +7 -7
- package/dist/{chunk-f6ypmk8x.js → chunk-stdddhk9.js} +1 -1
- package/dist/{chunk-mayk025t.js → chunk-swzxhkh2.js} +26 -26
- package/dist/{chunk-krhcqf22.js → chunk-t5ekex4s.js} +2 -2
- package/dist/chunk-tg7kt56m.js +2 -0
- package/dist/{chunk-6m6y9bbx.js → chunk-tjwzy9xq.js} +1 -1
- package/dist/chunk-ttr8ay8h.js +2 -0
- package/dist/{chunk-xk555zd5.js → chunk-tv61s6fc.js} +1 -1
- package/dist/{chunk-gd56arnm.js → chunk-vrcr4b13.js} +1 -1
- package/dist/{chunk-he975510.js → chunk-w1rrfj39.js} +1 -1
- package/dist/{chunk-0v2yj490.js → chunk-w2hqjv5e.js} +1 -1
- package/dist/{chunk-3hrps6aa.js → chunk-wb7s2cnb.js} +9 -9
- package/dist/{chunk-5zvytrge.js → chunk-wk188ph7.js} +3 -3
- package/dist/chunk-xb34eyne.js +2 -0
- package/dist/{chunk-chd60py8.js → chunk-xr3x6wk6.js} +1 -1
- package/dist/chunk-y0dee635.js +2 -0
- package/dist/{chunk-sxh28q9h.js → chunk-y0msz738.js} +26 -26
- package/dist/{chunk-5n3f6mg2.js → chunk-y1cvab1b.js} +1 -1
- package/dist/{chunk-64ebysb4.js → chunk-yx3vghee.js} +1 -1
- package/dist/chunk-z8x86cr7.js +42 -0
- package/dist/{chunk-tdp2tvf3.js → chunk-zf9n3esr.js} +3 -3
- package/dist/{chunk-n3z0d58b.js → chunk-zfq2vvex.js} +39 -39
- package/dist/{chunk-2tpsbzfe.js → chunk-zpgj4asv.js} +1 -1
- package/dist/cli.js +12 -12
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/pwa.js +2 -2
- package/dist/ssg.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-02stnjr0.js +0 -2
- package/dist/chunk-0twkeh31.js +0 -2
- package/dist/chunk-1872e8z8.js +0 -2
- package/dist/chunk-23nr1jcs.js +0 -2
- package/dist/chunk-2d8kfrs8.js +0 -2
- package/dist/chunk-3gk1e2b1.js +0 -2
- package/dist/chunk-49bx8g98.js +0 -2
- package/dist/chunk-7nvaapgm.js +0 -2
- package/dist/chunk-8qyc4nqe.js +0 -3
- package/dist/chunk-9cwag0tk.js +0 -2
- package/dist/chunk-9vq7vk10.js +0 -2
- package/dist/chunk-cm8wy2wv.js +0 -42
- package/dist/chunk-dvvp0bdw.js +0 -2
- package/dist/chunk-etjaf7f2.js +0 -2
- package/dist/chunk-f4ct7tj1.js +0 -2
- package/dist/chunk-g5hpzby1.js +0 -2
- package/dist/chunk-gy6p5xx4.js +0 -2
- package/dist/chunk-ha9qcfys.js +0 -54
- package/dist/chunk-hqgnpq8n.js +0 -33
- package/dist/chunk-kejcaqbd.js +0 -2
- package/dist/chunk-m05y60v0.js +0 -2
- package/dist/chunk-nrhahqye.js +0 -2
- package/dist/chunk-phppqwdd.js +0 -2
- package/dist/chunk-wzsr1z0z.js +0 -2
- package/dist/chunk-z1rs6b4x.js +0 -2
package/dist/app-shell.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
var {require}=import.meta;import {
|
|
1
|
+
var {require}=import.meta;import { findSfcTemplateBlock } from "./sfc-template.js";
|
|
2
|
+
import { bodyCloseIndex } from "./document-tags.js";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { classifyAllScripts } from "./script-classifier.js";
|
|
4
5
|
import { startsDocument } from "./document-shell.js";
|
|
@@ -39,9 +40,9 @@ export async function processShell(shellPath, options) {
|
|
|
39
40
|
try {
|
|
40
41
|
const content = await Bun.file(shellPath).text();
|
|
41
42
|
let shellTemplate = content;
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
shellTemplate =
|
|
43
|
+
const sfcTemplate = findSfcTemplateBlock(content);
|
|
44
|
+
if (sfcTemplate)
|
|
45
|
+
shellTemplate = sfcTemplate.content.trim();
|
|
45
46
|
const classified = classifyAllScripts(content), shellScripts = [
|
|
46
47
|
...classified.client.map((s) => s.fullTag),
|
|
47
48
|
...classified.signals.map((s) => s.fullTag)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ym,Aa,_u,Zm,Qm,eh,th,nh,Cu,Eu,rh,sh,oh,ih}from"./chunk-cwmfxbhz.js";import"./chunk-zfq2vvex.js";import"./chunk-pfr3cazq.js";import"./chunk-pdpmtmfj.js";import"./chunk-q1wxgw5s.js";import"./chunk-z8x86cr7.js";import"./chunk-khe30jmk.js";import"./chunk-wk188ph7.js";import"./chunk-hvx6j4a2.js";import"./chunk-sew1z7cv.js";import"./chunk-q58f5wk2.js";import"./chunk-311mrz2n.js";import"./chunk-nkwj7eq3.js";import"./chunk-y0msz738.js";import"./chunk-sb3dx4dd.js";import"./chunk-tnp2ta5q.js";import"./chunk-rw5492e2.js";import"./chunk-sbvkk4cn.js";import"./chunk-dy7vqv1x.js";import"./chunk-hze3158c.js";import"./chunk-w1rrfj39.js";import"./chunk-60yppcbb.js";import"./chunk-0tyyad6q.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{_u as SUSPENSE_RESOLVER_RUNTIME,Aa as buildSuspenseResolveScript,nh as createStreamRenderer,eh as extractStreamBoundaries,ih as generateHydrationRuntime,Eu as islandDirective,sh as processSectionDirectives,Qm as processStreamDirectives,rh as registerStreamingDirectives,Zm as renderStreamingPage,Ym as streamTemplate,th as streamTemplateSimple,oh as streamToResponse,Cu as streamingSuspenseDirective};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Uo,Wo,qo,Gh,ys,Xh}from"./chunk-
|
|
2
|
+
import{Uo,Wo,qo,Gh,ys,Xh}from"./chunk-z8x86cr7.js";export{ys as clearImageDeliveryCatalog,Gh as deliveredImage,qo as efficientDeliverySources,Uo as getImageDelivery,Wo as isTransparentImage,Xh as prepareImageDelivery};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Z}from"./chunk-rpep1ve3.js";import{D}from"./chunk-fd1bpv35.js";import Ve from"path";var t={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 ee(e){for(let[n,r]of Object.entries(t))if(r===e)return n;return}import bt from"path";var Et={showRelativePaths:!1,enableAutoRecovery:Z(),logRecoveryWarnings:!0},te={...Et};function z(){return{...te}}function j(e){if(!te.showRelativePaths||!e)return e;let n=te.baseDir||process.cwd();try{let r=bt.relative(n,e);return r.startsWith("..")?e:r}catch{return e}}class N extends Error{code;filePath;line;column;context;numericCode;constructor(e,n,r,i,s,o,a){super(e);this.code=n;this.filePath=r;this.line=i;this.column=s;this.context=o;if(this.name="StxError",this.numericCode=a||t.EVALUATION_ERROR,this.filePath)this.filePath=j(this.filePath)}}class se extends N{constructor(e,n,r,i,s,o){super(e,"stx_RUNTIME_ERROR",n,r,i,s,o||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Or extends N{constructor(e,n,r,i,s,o){super(e,"stx_FILE_ERROR",n,r,i,s,o||t.FILE_NOT_FOUND);this.name="StxFileError"}}class Y extends N{isFatal=!0;constructor(e,n,r,i,s,o){super(e,"stx_VALIDATION_ERROR",n,r,i,s,o||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function ve(e){let{type:n,message:r,code:i,filePath:s,line:o,column:a,template:c,offset:g,snippet:l,suggestion:h,format:f="text"}=e,y=o,x=a;if(!y&&c&&g!==void 0){let Q=Tt(c,g);y=Q.line,x=Q.column}let v=s?j(s):void 0,w=i?ee(i):void 0,R={type:n,code:i,codeName:w,message:r,filePath:v,line:y,column:x,snippet:l,suggestion:h,timestamp:new Date().toISOString()},A;switch(f){case"html":A=wt(R);break;case"json":A=JSON.stringify(R,null,2);break;case"console":A=vt(R,c,g);break;case"text":default:A=xt(R,c,g);break}return{formatted:A,data:R}}function xt(e,n,r){let i=[],s=e.code?` [${e.codeName||e.code}]`:"";if(i.push(`[${e.type} Error${s}]`),e.filePath){let o=e.filePath;if(e.line){if(o+=`:${e.line}`,e.column)o+=`:${e.column}`}i.push(`at ${o}`)}if(i.push(`
|
|
3
3
|
${e.message}`),n&&e.line){let o=St(n,e.line,2);if(o)i.push(`
|
|
4
4
|
${o}`)}if(e.snippet)i.push(`
|
|
5
5
|
Snippet: ${e.snippet}`);if(e.suggestion)i.push(`
|
|
@@ -17,14 +17,14 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
17
17
|
`)}function kt(e,n,r){let i=e.split(`
|
|
18
18
|
`),s=Math.max(0,n-r-1),o=Math.min(i.length-1,n+r-1),a="\x1B[90m",c="\x1B[31m",g="\x1B[0m",l=[];for(let h=s;h<=o;h++){let f=(h+1).toString().padStart(4),y=h===n-1,x=y?"\x1B[31m>\x1B[0m":" ",v=y?`\x1B[31m${i[h]}\x1B[0m`:`\x1B[90m${i[h]}\x1B[0m`;l.push(`${x}\x1B[90m${f}\x1B[0m | ${v}`)}return l.join(`
|
|
19
19
|
`)}function we(e){return e.replace(/--/g,"- -").replace(/>/g,">")}function Tt(e,n){let i=e.substring(0,n).split(`
|
|
20
|
-
`);return{line:i.length,column:i[i.length-1].length}}function u(e,n,r){return ve({type:e,message:n,code:r,format:"html"}).formatted}async function $e(e,n,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return n}}var Ni={isEnabled(){return
|
|
21
|
-
@end${c}`;i.push(`Added ${h} missing @end${c}`)}}if(i.length>0&&n.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((c)=>console.warn(` - ${c}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:i}},createFallbackContent(e,n){if(
|
|
20
|
+
`);return{line:i.length,column:i[i.length-1].length}}function u(e,n,r){return ve({type:e,message:n,code:r,format:"html"}).formatted}async function $e(e,n,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return n}}var Ni={isEnabled(){return z().enableAutoRecovery},fixCommonSyntaxErrors(e){let n=z();if(!n.enableAutoRecovery)return{fixed:e,fixes:[]};let r=e,i=[],s=(r.match(/\{\{/g)||[]).length,o=(r.match(/\}\}/g)||[]).length;if(s>o){let c=s-o;r+="}}".repeat(c),i.push(`Added ${c} missing closing braces '}}'`)}let a=["if","foreach","for","switch","section"];for(let c of a){let g=(r.match(new RegExp(`@${c}\\b`,"g"))||[]).length,l=(r.match(new RegExp(`@end${c}\\b`,"g"))||[]).length;if(g>l){let h=g-l;for(let f=0;f<h;f++)r+=`
|
|
21
|
+
@end${c}`;i.push(`Added ${h} missing @end${c}`)}}if(i.length>0&&n.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((c)=>console.warn(` - ${c}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:i}},createFallbackContent(e,n){if(Z())return`<!-- ${e} failed: ${n.message} -->`;return"<!-- stx rendering error -->"}};class ne{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,n,r="error"){let i={timestamp:new Date,error:e,context:n,level:r};if(this.errors.push(i),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(r))this.writeToFile(i)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let n=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)n.push(` Stack: ${e.error.stack.split(`
|
|
22
22
|
`).slice(1).join(`
|
|
23
23
|
`)}`);if(e.context)n.push(` Context: ${JSON.stringify(e.context)}`);return n.join(`
|
|
24
24
|
`)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let n=await import("fs"),r=await import("path"),i=r.dirname(this.logFilePath);if(!n.existsSync(i))n.mkdirSync(i,{recursive:!0});await this.rotateIfNeeded(n);let s=`${this.formatEntry(e)}
|
|
25
25
|
`;n.appendFileSync(this.logFilePath,s,"utf-8")}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",n)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let r=this.maxLogFiles-1;r>=1;r--){let i=`${this.logFilePath}.${r}`,s=`${this.logFilePath}.${r+1}`;if(e.existsSync(i))if(r>=this.maxLogFiles-1)e.unlinkSync(i);else e.renameSync(i,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",n)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((n)=>n.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((n)=>n.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},n={error:0,warning:0,info:0};for(let r of this.errors){let i=r.error.constructor.name;e[i]=(e[i]||0)+1;let s=r.level||"error";n[s]=(n[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:n}}async exportToFile(e,n="json"){let r=await import("fs"),i=await import("path"),s=i.dirname(e);if(!r.existsSync(s))r.mkdirSync(s,{recursive:!0});if(n==="json"){let o=this.errors.map((a)=>({timestamp:a.timestamp.toISOString(),level:a.level||"error",type:a.error.constructor.name,message:a.error.message,stack:a.error.stack,context:a.context}));r.writeFileSync(e,JSON.stringify(o,null,2),"utf-8")}else{let o=this.errors.map((a)=>this.formatEntry(a));r.writeFileSync(e,o.join(`
|
|
26
26
|
|
|
27
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var
|
|
27
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var W=new ne,Rn={isDevelopment(){return Z()},logDetailedError(e,n){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),n)console.error("Context:",n);console.error("========================")},createErrorReport(e,n){let r=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(n)r.push(`Context: ${JSON.stringify(n,null,2)}`);return r.push("========================"),r.join(`
|
|
28
28
|
`)}};function k(e,n,r,i=0){let s=0,o=i,a=null,c=0,g=!1;while(o<e.length){let l=e[o];if(a&&g){g=!1,o++;continue}if(a&&l==="\\"){g=!0,o++;continue}if(g=!1,(l==='"'||l==="'"||l==="`")&&!a){a=l,o++;continue}if(l===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&l==="$"&&e[o+1]==="{"){c++,o+=2;continue}if(c>0&&l==="}"){c--,o++;continue}if(l==="`"&&a==="`"&&c===0){a=null,o++;continue}if(a){o++;continue}if(l===n)s++;else if(l===r){if(s--,s===0)return o}o++}return-1}function yl(e,n){let r=n,i={paren:0,bracket:0,brace:0},s=null,o=0;while(r<e.length){let a=e[r];if((r>0?e[r-1]:"")==="\\"&&s){r++;continue}if((a==='"'||a==="'")&&!s){s=a,r++;continue}if(a===s&&s!=="`"){s=null,r++;continue}if(a==="`"&&!s){s="`",r++;continue}if(a==="`"&&s==="`"&&o===0){s=null,r++;continue}if(s==="`"&&a==="$"&&e[r+1]==="{"){o++,r+=2;continue}if(o>0){if(a==="{")o++;else if(a==="}")o--;r++;continue}if(s){r++;continue}if(i.paren===0&&i.bracket===0&&i.brace===0){if(e.slice(r,r+2)==="}}"||e.slice(r,r+3)==="!!}")break;if(a===","||a===";")break}if(a==="(")i.paren++;else if(a===")"){if(i.paren--,i.paren<0)break}else if(a==="[")i.bracket++;else if(a==="]"){if(i.bracket--,i.bracket<0)break}else if(a==="{")i.brace++;else if(a==="}"){if(i.brace--,i.brace<0)break}r++}return{expression:e.slice(n,r),endPos:r}}class P{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let r=this.options?this.options.sizeOf(n):0;if(this.options&&r>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+r>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,r),this.bytes+=r}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var M=new Map,Rt=500;function Vt(e,n){if(n?.includes("g"))return new RegExp(e,n);let r=`${e}:${n||""}`;if(!M.has(r)){if(M.size>=Rt){let i=M.keys().next().value;if(i)M.delete(i)}M.set(r,new RegExp(e,n))}return M.get(r)}class ke{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),r=n.sort().join(","),i=this.pool.find((c)=>c.context.join(",")===r);if(i)return i.func;let s=this.fnCache,o=this.fnCacheMaxSize,a=(...c)=>(g)=>{try{let l=`${r}:${g}`,h=s.get(l);if(!h){if(s.size>=o){let f=s.keys().next().value;if(f)s.delete(f)}h=Function(...n,`
|
|
29
29
|
'use strict';
|
|
30
30
|
try {
|
|
@@ -36,7 +36,7 @@ catch (e) {
|
|
|
36
36
|
}
|
|
37
37
|
throw e;
|
|
38
38
|
}
|
|
39
|
-
`),s.set(l,h)}return h(...c)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:a,context:n.slice()});return a}clear(){this.pool.length=0,this.fnCache.clear()}}var ar=new ke;class Te{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,n){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...n})}setBudgets(e){for(let[n,r]of Object.entries(e))this.setBudget(n,r)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[n,r]of this.budgets.entries())e[n]=r;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let n=this.violationHandlers.indexOf(e);if(n!==-1)this.violationHandlers.splice(n,1)}time(e,n){if(!this.enabled)return n();let r=performance.now(),i=n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}async timeAsync(e,n){if(!this.enabled)return n();let r=performance.now(),i=await n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}checkBudget(e,n){let r=this.budgets.get(e);if(!r)return;let i=n/r.maxTime*100,s=r.warnThreshold!==void 0?n>=r.maxTime*r.warnThreshold&&n<r.maxTime:!1,o=n>=r.maxTime;if(!s&&!o)return;let a={label:e,actualTime:n,budgetTime:r.maxTime,exceedancePercent:i,timestamp:new Date,isWarning:s};this.violations.push(a);while(this.violations.length>this.maxViolations)this.violations.shift();for(let g of this.violationHandlers)try{g(a)}catch{}let c=s?`[Performance Warning] "${e}" took ${n.toFixed(2)}ms (${i.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${n.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(i-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(c);break;case"warn":console.warn(c);break;case"error":console.error(c);break;case"throw":if(o)throw Error(c);else console.warn(c);break}}recordTime(e,n){let r=this.metrics.get(e);if(r)r.count++,r.totalTime+=n,r.maxTime=Math.max(r.maxTime,n),r.minTime=Math.min(r.minTime,n);else this.metrics.set(e,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(e){if(e){let r=this.metrics.get(e);if(!r)return{};let i=this.budgets.get(e);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:i?.maxTime,budgetUtilization:i?r.totalTime/r.count/i.maxTime*100:void 0}}let n={};for(let[r,i]of this.metrics.entries()){let s=this.budgets.get(r);n[r]={count:i.count,avgTime:i.totalTime/i.count,totalTime:i.totalTime,maxTime:i.maxTime,minTime:i.minTime,budget:s?.maxTime,budgetUtilization:s?i.totalTime/i.count/s.maxTime*100:void 0}}return n}getViolations(e){if(e)return this.violations.filter((n)=>n.label===e);return[...this.violations]}getViolationStats(){let e={},n=0,r=0;for(let i of this.violations)if(e[i.label]=(e[i.label]||0)+1,i.isWarning)n++;else r++;return{total:this.violations.length,byLabel:e,warnings:n,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var ie=null;function $t(){if(!ie)ie=new Te;return ie}var pe=new Proxy({},{get(e,n){return $t()[n]}});var Se=0;async function E(){if(performance.now()-Se<16)return;await new Promise((e)=>setTimeout(e,0)),Se=performance.now()}var Ct={maxSanitizeDepth:10,allowBracketNotation:!1},Me={...Ct};var V=/\bnew\s+/,W="__stx_safe_ctors",Ne=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],se=[...Ne,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],Ce=se.map(()=>{return}),oe=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),ce=[/\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*\(/,V,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],le=new Set([...Ne,"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",W]),ue=new Set(["__proto__","constructor","prototype"]);function De(e){let n="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let c=1;o+=2;while(o<e.length&&c>0){if(e[o]==="{")c++;else if(e[o]==="}")c--;if(c>0)n+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}n+=a,r.push(o)}return{text:n,map:r}}function Fe(e){return De(e).text}var ze=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],je=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of ze)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),At=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,Ae=/(?<![\w$])new(?![\w$])/g,_e=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${ze.join(",")}}() are allowed`;function _t(e){let{text:n,map:r}=De(e),i=[];Ae.lastIndex=0;let s;while((s=Ae.exec(n))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,a)))continue;let c=At.exec(n.slice(a)),g=c?.[3],l=!c?null:g?`Intl_${g}`:c[2];if(!c||!l||!(l in je))throw new S(`matched /${V.source}/; ${_e}`,e);let h=a+c[0].length,f=r[a],y=r[h-1]+1;if(e.slice(f,y)!==n.slice(a,h))throw new S(`matched /${V.source}/; ${_e}`,e);let x=f+3+c[1].length;i.push({start:x,end:x+c[2].length,key:l})}let o=e;for(let a=i.length-1;a>=0;a--){let c=i[a];o=`${o.slice(0,c.start)}${W}.${c.key}${o.slice(c.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class S extends Error{rule;expression;constructor(e,n,r){super(r??`Potentially unsafe expression (${e}): ${n}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=n}}function Qs(e){try{return ge(e),null}catch(n){return n instanceof S?n.rule:n instanceof Error?n.message:String(n)}}function Be(e,n){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(le.has(s))throw new S(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&ue.has(s))throw new S(`matched /.${s}/; property ${s}`,n)}}function He(e,n=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let c=s[1].trim(),g=/^'(?:[^'\\]|\\.)*'$/.test(c),l=/^"(?:[^"\\]|\\.)*"$/.test(c);if(/^\d+$/.test(c))continue;if(g||l){let f=c.slice(1,-1);if(ue.has(f))throw new S(`bracket key ${f}`,e);if(!Me.allowBracketNotation)throw new S("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(n&&/^[$A-Z_a-z][$\w]*$/.test(c)){i.add(c);continue}throw new S("dynamic bracket notation is not allowed",e)}return[...i]}function ge(e){let n=e.trim(),r=Fe(n);Be(r,n);let i=He(n);for(let s of ce){if(s===V)continue;if(s.test(r))throw new S(`matched /${s.source}/`,n)}return{..._t(n),dynamicKeys:i}}function Oi(e){return ge(e),e.trim()}var eo=Symbol("stx.sanitizeCache"),It=4000,j=new Map;function Ot(e){let n=j.get(e);if(n===void 0){if(n=ce.some((r)=>r.test(e)),j.size>=It)j.clear();j.set(e,n)}return n}function K(e){let n={},r=e[eo];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=oe,n.parseInt=Number.parseInt,n.parseFloat=Number.parseFloat,n.isNaN=Number.isNaN,n.isFinite=Number.isFinite,n.encodeURIComponent=encodeURIComponent,n.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||Ot(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=ae(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function ae(e,n=0){if(n>=Me.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>ae(i,n+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=ae(s,n+1);else r[i]=s}return r}function d(e,n){try{let r=K(n),i=Object.keys(r),s=Object.values(r);return p(e,i)(...s)}catch{return}}function m(e){try{return Oi(e),!0}catch{return!1}}function hl(e,n){try{let r=K(n),i=Object.keys(r),s=Object.values(r),o=!1,c=p(e,i,()=>{o=!0})(...s);return!o&&Boolean(c)}catch{return!1}}function O(e,n){try{let r=d(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Ue=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"]),Ie=`stx-compile-probe:${globalThis.crypto.randomUUID()}`,Pt=0,Lt=0;function Mt(e,n){let r="__stx_compile_probe";while(e.includes(r))r+="_";let i=Array.from({length:e.length+1});i[e.length]=Ie;for(let s=0;s<16;s++){let o=`c${++Pt}`,a=`'use strict';if(${r}===${JSON.stringify(Ie)})return ${JSON.stringify(o)};`,c=Function(...e,r,a+n);if(c(...i)===o)return c;Lt++}throw Error("[stx] the JavaScript runtime repeatedly returned code compiled from a different source; refusing to evaluate with it.")}var Nt=2000,H=new Map;function Oe(e,n){let r=`${e.join(",")}\x00${n}`,i=H.get(r);if(i)return i;let s=Mt(e,n);if(H.size>=Nt)H.clear();return H.set(r,s),s}function ut(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var Dt=/^[A-Za-z_$][\w$]*$/;function Ut(e){return Dt.test(e)&&!Ue.has(e)}var Pe=new P(2000,{maxBytes:2097152,sizeOf:(e)=>e.sourceBytes});function p(e,n,r){let i=JSON.stringify([e,n]),s=Pe.get(i);if(!s)s=Ft(e,[...n]),s.sourceBytes+=i.length*2,Pe.set(i,s);return zt(jt(s.buildFunc,s.filteredKeys,s.contextKeys,s.validEntries,s.validIndices,r),s.contextKeys,s.dynamicKeys)}function Ft(e,n){let{source:r,usesSafeConstructors:i,dynamicKeys:s}=ge(e),o=[];for(let f=0;f<n.length;f++){if(!Ut(n[f]))continue;if(n[f]===W||n[f]==="Object"||le.has(n[f]))continue;o.push({key:n[f],index:f})}o.sort((f,y)=>f.key<y.key?-1:1);let a=o.map((f)=>f.key),c=o.map((f)=>f.index),g=`
|
|
39
|
+
`),s.set(l,h)}return h(...c)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:a,context:n.slice()});return a}clear(){this.pool.length=0,this.fnCache.clear()}}var ar=new ke;class Te{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,n){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...n})}setBudgets(e){for(let[n,r]of Object.entries(e))this.setBudget(n,r)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[n,r]of this.budgets.entries())e[n]=r;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let n=this.violationHandlers.indexOf(e);if(n!==-1)this.violationHandlers.splice(n,1)}time(e,n){if(!this.enabled)return n();let r=performance.now(),i=n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}async timeAsync(e,n){if(!this.enabled)return n();let r=performance.now(),i=await n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}checkBudget(e,n){let r=this.budgets.get(e);if(!r)return;let i=n/r.maxTime*100,s=r.warnThreshold!==void 0?n>=r.maxTime*r.warnThreshold&&n<r.maxTime:!1,o=n>=r.maxTime;if(!s&&!o)return;let a={label:e,actualTime:n,budgetTime:r.maxTime,exceedancePercent:i,timestamp:new Date,isWarning:s};this.violations.push(a);while(this.violations.length>this.maxViolations)this.violations.shift();for(let g of this.violationHandlers)try{g(a)}catch{}let c=s?`[Performance Warning] "${e}" took ${n.toFixed(2)}ms (${i.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${n.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(i-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(c);break;case"warn":console.warn(c);break;case"error":console.error(c);break;case"throw":if(o)throw Error(c);else console.warn(c);break}}recordTime(e,n){let r=this.metrics.get(e);if(r)r.count++,r.totalTime+=n,r.maxTime=Math.max(r.maxTime,n),r.minTime=Math.min(r.minTime,n);else this.metrics.set(e,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(e){if(e){let r=this.metrics.get(e);if(!r)return{};let i=this.budgets.get(e);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:i?.maxTime,budgetUtilization:i?r.totalTime/r.count/i.maxTime*100:void 0}}let n={};for(let[r,i]of this.metrics.entries()){let s=this.budgets.get(r);n[r]={count:i.count,avgTime:i.totalTime/i.count,totalTime:i.totalTime,maxTime:i.maxTime,minTime:i.minTime,budget:s?.maxTime,budgetUtilization:s?i.totalTime/i.count/s.maxTime*100:void 0}}return n}getViolations(e){if(e)return this.violations.filter((n)=>n.label===e);return[...this.violations]}getViolationStats(){let e={},n=0,r=0;for(let i of this.violations)if(e[i.label]=(e[i.label]||0)+1,i.isWarning)n++;else r++;return{total:this.violations.length,byLabel:e,warnings:n,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var re=null;function $t(){if(!re)re=new Te;return re}var fe=new Proxy({},{get(e,n){return $t()[n]}});var Se=0;async function E(){if(performance.now()-Se<16)return;await new Promise((e)=>setTimeout(e,0)),Se=performance.now()}var Ct={maxSanitizeDepth:10,allowBracketNotation:!1},Me={...Ct};var U=/\bnew\s+/,V="__stx_safe_ctors",Ne=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],ie=[...Ne,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],Ce=ie.map(()=>{return}),oe=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),ce=[/\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*\(/,U,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],le=new Set([...Ne,"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",V]),ue=new Set(["__proto__","constructor","prototype"]);function De(e){let n="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let c=1;o+=2;while(o<e.length&&c>0){if(e[o]==="{")c++;else if(e[o]==="}")c--;if(c>0)n+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}n+=a,r.push(o)}return{text:n,map:r}}function Fe(e){return De(e).text}var ze=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],je=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of ze)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),At=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,Ae=/(?<![\w$])new(?![\w$])/g,_e=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${ze.join(",")}}() are allowed`;function _t(e){let{text:n,map:r}=De(e),i=[];Ae.lastIndex=0;let s;while((s=Ae.exec(n))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,a)))continue;let c=At.exec(n.slice(a)),g=c?.[3],l=!c?null:g?`Intl_${g}`:c[2];if(!c||!l||!(l in je))throw new S(`matched /${U.source}/; ${_e}`,e);let h=a+c[0].length,f=r[a],y=r[h-1]+1;if(e.slice(f,y)!==n.slice(a,h))throw new S(`matched /${U.source}/; ${_e}`,e);let x=f+3+c[1].length;i.push({start:x,end:x+c[2].length,key:l})}let o=e;for(let a=i.length-1;a>=0;a--){let c=i[a];o=`${o.slice(0,c.start)}${V}.${c.key}${o.slice(c.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class S extends Error{rule;expression;constructor(e,n,r){super(r??`Potentially unsafe expression (${e}): ${n}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=n}}function Qs(e){try{return ge(e),null}catch(n){return n instanceof S?n.rule:n instanceof Error?n.message:String(n)}}function Be(e,n){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(le.has(s))throw new S(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&ue.has(s))throw new S(`matched /.${s}/; property ${s}`,n)}}function He(e,n=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let c=s[1].trim(),g=/^'(?:[^'\\]|\\.)*'$/.test(c),l=/^"(?:[^"\\]|\\.)*"$/.test(c);if(/^\d+$/.test(c))continue;if(g||l){let f=c.slice(1,-1);if(ue.has(f))throw new S(`bracket key ${f}`,e);if(!Me.allowBracketNotation)throw new S("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(n&&/^[$A-Z_a-z][$\w]*$/.test(c)){i.add(c);continue}throw new S("dynamic bracket notation is not allowed",e)}return[...i]}function ge(e){let n=e.trim(),r=Fe(n);Be(r,n);let i=He(n);for(let s of ce){if(s===U)continue;if(s.test(r))throw new S(`matched /${s.source}/`,n)}return{..._t(n),dynamicKeys:i}}function Oi(e){return ge(e),e.trim()}var eo=Symbol("stx.sanitizeCache"),It=4000,B=new Map;function Ot(e){let n=B.get(e);if(n===void 0){if(n=ce.some((r)=>r.test(e)),B.size>=It)B.clear();B.set(e,n)}return n}function K(e){let n={},r=e[eo];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=oe,n.parseInt=Number.parseInt,n.parseFloat=Number.parseFloat,n.isNaN=Number.isNaN,n.isFinite=Number.isFinite,n.encodeURIComponent=encodeURIComponent,n.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||Ot(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=ae(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function ae(e,n=0){if(n>=Me.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>ae(i,n+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=ae(s,n+1);else r[i]=s}return r}function d(e,n){try{let r=K(n),i=Object.keys(r),s=Object.values(r);return p(e,i)(...s)}catch{return}}function m(e){try{return Oi(e),!0}catch{return!1}}function hl(e,n){try{let r=K(n),i=Object.keys(r),s=Object.values(r),o=!1,c=p(e,i,()=>{o=!0})(...s);return!o&&Boolean(c)}catch{return!1}}function O(e,n){try{let r=d(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Ue=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"]),Ie=`stx-compile-probe:${globalThis.crypto.randomUUID()}`,Pt=0,Lt=0;function Mt(e,n){let r="__stx_compile_probe";while(e.includes(r))r+="_";let i=Array.from({length:e.length+1});i[e.length]=Ie;for(let s=0;s<16;s++){let o=`c${++Pt}`,a=`'use strict';if(${r}===${JSON.stringify(Ie)})return ${JSON.stringify(o)};`,c=Function(...e,r,a+n);if(c(...i)===o)return c;Lt++}throw Error("[stx] the JavaScript runtime repeatedly returned code compiled from a different source; refusing to evaluate with it.")}var Nt=2000,H=new Map;function Oe(e,n){let r=`${e.join(",")}\x00${n}`,i=H.get(r);if(i)return i;let s=Mt(e,n);if(H.size>=Nt)H.clear();return H.set(r,s),s}function ut(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var Dt=/^[A-Za-z_$][\w$]*$/;function Ut(e){return Dt.test(e)&&!Ue.has(e)}var Pe=new P(2000,{maxBytes:2097152,sizeOf:(e)=>e.sourceBytes});function p(e,n,r){let i=JSON.stringify([e,n]),s=Pe.get(i);if(!s)s=Ft(e,[...n]),s.sourceBytes+=i.length*2,Pe.set(i,s);return zt(jt(s.buildFunc,s.filteredKeys,s.contextKeys,s.validEntries,s.validIndices,r),s.contextKeys,s.dynamicKeys)}function Ft(e,n){let{source:r,usesSafeConstructors:i,dynamicKeys:s}=ge(e),o=[];for(let f=0;f<n.length;f++){if(!Ut(n[f]))continue;if(n[f]===V||n[f]==="Object"||le.has(n[f]))continue;o.push({key:n[f],index:f})}o.sort((f,y)=>f.key<y.key?-1:1);let a=o.map((f)=>f.key),c=o.map((f)=>f.index),g=`
|
|
40
40
|
'use strict';
|
|
41
41
|
try {
|
|
42
42
|
return ${r};
|
|
@@ -47,8 +47,8 @@ catch (e) {
|
|
|
47
47
|
}
|
|
48
48
|
throw e;
|
|
49
49
|
}
|
|
50
|
-
`,l=i?(f)=>{let y=Oe([
|
|
51
|
-
`:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var Bt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Kt(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=Qs(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=K(n),o;try{o=p(r,Object.keys(s))(...Object.values(s))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(ut(r))].filter((c)=>!Bt.has(c)&&!(c in s)&&!(c in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((g)=>`"${g}"`).join(", ")} ${a.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:t.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:t.EVALUATION_ERROR};return{ok:!0,value:o}}function Ke(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function dt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function We(e){if(!e)return"";return Ve.isAbsolute(e)?Ve.relative(process.cwd(),e)||e:e}function
|
|
50
|
+
`,l=i?(f)=>{let y=Oe([V,"Object",...ie,...a,...f],g);return(...x)=>y(je,oe,...Ce,...x)}:(f)=>{let y=Oe(["Object",...ie,...a,...f],g);return(...x)=>y(oe,...Ce,...x)},h=l([]);return{sourceBytes:e.length*2+n.reduce((f,y)=>f+y.length*2,0),contextKeys:n,filteredKeys:a,validEntries:o,validIndices:c,dynamicKeys:s,buildFunc:(f)=>f.length===0?h:l(f)}}function zt(e,n,r){if(r.length===0)return e;let i=r.map((s)=>n.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let a=s[o];if(typeof a==="string"&&ue.has(a))return}return e(...s)}}function jt(e,n,r,i,s,o){let a=e([]),c=i.every((l,h)=>l.index===h);if(n.length===r.length&&c)return Le(a,n,e,void 0,o);return Le((...l)=>{let h=Array(s.length);for(let f=0;f<s.length;f++)h[f]=l[s[f]];return a(...h)},n,e,(l)=>{a=e(l)},o)}function Le(e,n,r,i,s){let a=/^(\w+) is not defined$/,c=e,g=[],l=new Set(n);return(...h)=>{for(let f=0;f<=8;f++)try{return c(...h)}catch(y){let x=y instanceof Error?y.message:"",v=a.exec(x);if(!(y instanceof ReferenceError)||!v)return;let w=v[1];if(l.has(w)||Ue.has(w)||le.has(w))return;if(s?.(w),l.add(w),g.push(w),i)i(g);else c=r(g)}return}}function to(e){let n=e.trim();try{let r=Fe(n);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(r))return!1;Be(r,n),He(n);for(let i of ce)if(i.test(r))return!1}catch{return!1}return!0}function Di(e,n){let r=[];n.lastIndex=0;let i;while((i=n.exec(e))!==null){let s=i.index,o=s+i[0].length-1,a=k(e,"(",")",o);if(a===-1){r.push({start:s,end:-1,args:"",call:e.slice(s,Math.min(e.length,s+80))}),n.lastIndex=o+1;continue}r.push({start:s,end:a+1,args:e.slice(o+1,a),call:e.slice(s,a+1)}),n.lastIndex=a+1}return r}function Wt(e,n,r,i){let s="",o=0;for(let a of Di(e,n)){if(s+=e.slice(o,a.start),a.end===-1){s+=i(a.call),o=a.start;continue}s+=r(a.args,a.call),o=a.end}return s+e.slice(o)}function qt(e){let n=[],r=0,i=null,s="";for(let o=0;o<e.length;o++){let a=e[o];if(i){if(s+=a,a==="\\"&&o+1<e.length){s+=e[++o];continue}if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`")i=a;else if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===","&&r===0){n.push(s.trim()),s="";continue}s+=a}if(s.trim())n.push(s.trim());return n}function de(e){let n=e.trim(),r=n[0];if(r!=="'"&&r!=='"'&&r!=="`"||n.length<2||n.at(-1)!==r)return null;let i="";for(let s=1;s<n.length-1;s++){let o=n[s];if(o==="\\"&&s+1<n.length-1){let a=n[++s];i+=a==="n"?`
|
|
51
|
+
`:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var Bt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Kt(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=Qs(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=K(n),o;try{o=p(r,Object.keys(s))(...Object.values(s))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(ut(r))].filter((c)=>!Bt.has(c)&&!(c in s)&&!(c in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((g)=>`"${g}"`).join(", ")} ${a.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:t.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:t.EVALUATION_ERROR};return{ok:!0,value:o}}function Ke(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function dt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function We(e){if(!e)return"";return Ve.isAbsolute(e)?Ve.relative(process.cwd(),e)||e:e}function pe(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function F(e,n,r,i,s=t.EVALUATION_ERROR){let o=i?` in ${We(i)}`:"";return console.warn(`[stx] ${pe(n)}${o}: ${r}`),u(e,`${pe(n)}: ${r}`,s)}function no(e,n,r){let i=r?` in ${We(r)}`:"";console.warn(`[stx] ${pe(e)}${i}: ${n}`)}function Mi(){return{afterOpen:[],beforeClose:[]}}function Ht(e){return e.afterOpen.length>0||e.beforeClose.length>0}function bl(e,n){if(!Ht(n))return e;let r=n.afterOpen.join(""),i=n.beforeClose.join(""),s=D(e),o=r?Nr(e):null,a=i&&s!==-1?s:null;if(o===null&&a===null)return e;if(o!==null&&a!==null)return`${e.slice(0,o)}${r}${e.slice(o,a)}${i}${e.slice(a)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,a)}${i}${e.slice(a)}`}var Xe=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Nr(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;Xe.lastIndex=r;let i=Xe.exec(e);return i?r+i[0].length:r}var he="data-stx-color-mode-boot",qe="__STX_COLOR_MODE__",Xt=new Set(["light","dark","auto","system"]),Gt=new Set(["auto","system"]),Yt=/^[a-z][\w:-]*$/i,Jt=/^[\w-]+$/;function Zt(e){let n=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",i=e.darkClass===void 0?"dark":e.darkClass,s=e.attribute??null,o=e.autoValue??null,a=e.respectExisting===!0;if(typeof n!=="string"||n.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Xt.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(i!==null&&(typeof i!=="string"||!Jt.test(i)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(i)}`);if(s!==null&&(typeof s!=="string"||!Yt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Gt.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(i===null&&s===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(a&&s===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:n,initialMode:r==="system"?"auto":r,darkClass:i,attribute:s,autoValue:o,respectExisting:a}}function Qt(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ye(e={}){let n=Zt(e),r=Qt(n),i=`(function(){"use strict";var o=window.${qe};if(o&&typeof o.sync==="function"){o.sync();return}var c=${r};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${qe}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${he}>${i}</script>`}function Dr(e,n={}){if(e.includes(he))return e;let r=me(e);if(r===null)return e;let i=ye(n);return`${e.slice(0,r)}
|
|
52
52
|
${i}${e.slice(r)}`}var me=Nr,en=new RegExp(`<script\\b[^>]*\\b${he}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),Ye=/<meta\b[^>]*\bcharset\b[^>]*>/gi,Je=/<\/head>/gi;function tn(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;Je.lastIndex=r;let i=Je.exec(e),s=i?i.index:e.length;Ye.lastIndex=r;let o=Ye.exec(e);if(!o||o.index>=s)return e;if(e.slice(r,o.index).trim()==="")return e;let a=o.index+o[0].length;return`${e.slice(0,r)}
|
|
53
53
|
${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function wl(e){return nn(tn(e))}function nn(e){let n=en.exec(e);if(!n)return e;let r=me(e);if(r===null)return e;if(n.index<=r||e.slice(r,n.index).trim()==="")return e;let i=e.slice(0,n.index)+e.slice(n.index+n[0].length),s=me(i);if(s===null)return e;return`${i.slice(0,s)}
|
|
54
54
|
${n[0]}${i.slice(s)}`}var rn="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",et=`<style data-stx-cloak>[x-cloak]{display:none !important}${rn}</style>`,X="data-stx-html-attrs",q="data-stx-html-class",tt=/^[A-Za-z_:][\w:.-]*$/;function T(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function sn(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function pt(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function on(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let i of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function _(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${T(String(i))}"`).join(" ")}function G(e){let n=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?n.replace(/<\//g,"<\\/"):n}function nt(e){let n=_(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${G(e)}</script>`}function an(e={},n="en"){let r=[],i=[],s="",o=n;for(let[c,g]of Object.entries(e||{})){if(g==null)continue;let l=c.trim();if(!tt.test(l))continue;let h=l.toLowerCase();if(h==="lang"){o=String(g);continue}if(h==="class"){s=String(g).trim();continue}r.push(` ${l}="${T(String(g))}"`),i.push(l)}let a=` lang="${T(o)}"`;if(s)a+=` class="${T(s)}"`;if(a+=r.join(""),s)a+=` ${q}="${T(s)}"`;if(i.length)a+=` ${X}="${T(i.join(" "))}"`;return a}function vl(e={},n={}){let r={...e,...n};if(e.class&&n.class){let i=e.class.split(/\s+/).filter(Boolean);for(let s of n.class.split(/\s+/).filter(Boolean))if(!i.includes(s))i.push(s);r.class=i.join(" ")}return r}function Mr(e,n={}){if(!n||Object.keys(n).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let i={},s=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,a;while((a=o.exec(r[1]))!==null){let h=a[1];if(!(h in i))s.push(h);i[h]=a[2]??a[3]??a[4]??""}let c=[],g=[];for(let[h,f]of Object.entries(n)){if(f==null)continue;let y=h.trim();if(!tt.test(y))continue;let x=y.toLowerCase();if(x==="class"){let v=(i.class||"").split(/\s+/).filter(Boolean);for(let w of String(f).split(/\s+/).filter(Boolean))if(!v.includes(w))v.push(w),c.push(w);if(!("class"in i))s.push("class");i.class=v.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(f),x!=="lang")g.push(y)}if(c.length){if(!(q in i))s.push(q);i[q]=c.join(" ")}if(g.length){if(!(X in i))s.push(X);i[X]=g.join(" ")}let l=s.map((h)=>` ${h}="${T(i[h])}"`).join("");return e.replace(r[0],()=>`<html${l}>`)}function xl(e){if(e.includes("data-stx-cloak"))return null;if(D(e)===-1)return null;return`${et}
|
|
@@ -67,6 +67,6 @@ ${yt.join(`
|
|
|
67
67
|
</body>
|
|
68
68
|
</html>`}var be=/\s+/y,Ee=/<(script|style)\b[^>]*>/iy,un=/<\/script>/gi,gn=/<\/style>/gi,Ze=/<!DOCTYPE\b/iy,Qe=/<html[\s>]/iy;function An(e){let n=0;while(n<e.length){if(be.lastIndex=n,be.exec(e)){n=be.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}Ee.lastIndex=n;let i=Ee.exec(e);if(i){let s=i[1].toLowerCase()==="script"?un:gn;s.lastIndex=Ee.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(Ze.lastIndex=n,Ze.test(e))return!0;return Qe.lastIndex=n,Qe.test(e)}return!1}function Li(e){return An(e)}function Sl(e,n={}){let r=D(e);if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=n,c=e.slice(0,r),g=[];for(let l of i){let h=pt(l);if(h&&c.includes(h))continue;g.push(` <meta ${_(l)}>`)}for(let l of s){if(l.href&&c.includes(`href="${l.href}"`))continue;g.push(` <link ${_(l)}>`)}for(let l of o)if(l.src){if(c.includes(`src="${l.src}"`))continue;g.push(` <script ${_(l,(h)=>h==="content")}></script>`)}else if(l.content){if(c.includes(G(l)))continue;g.push(` ${nt(l)}`)}if(a&&!c.includes(a))g.push(` ${a}`);if(g.length===0)return e;return`${e.slice(0,r)}${g.join(`
|
|
69
69
|
`)}
|
|
70
|
-
${e.slice(r)}`}function Lr(e,n={},r={},i){if(i??Li(e))return e;return ln(e,n,r)}var pn=["og:","article:","book:","profile:","fb:","music:","video:"],dn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function jr(e,n){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let r=fn(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=mn(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=n.openGraph,c=n[o]??(dt(a)?a[o]:void 0);i=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!i)return{kind:"empty"};return{kind:"tag",tag:pn.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function fn(e,n){let r=
|
|
70
|
+
${e.slice(r)}`}function Lr(e,n={},r={},i){if(i??Li(e))return e;return ln(e,n,r)}var pn=["og:","article:","book:","profile:","fb:","music:","video:"],dn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function jr(e,n){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let r=fn(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=mn(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=n.openGraph,c=n[o]??(dt(a)?a[o]:void 0);i=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!i)return{kind:"empty"};return{kind:"tag",tag:pn.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function fn(e,n){let r=de(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(dn.test(e.trim()))return e.trim();let i=Kt(e,n);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${Ke(i.value)}`,code:t.TYPE_ERROR};return i.value}function mn(e,n){let r=de(e);if(r!==null)return r;let i=Kt(e,n);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${Ke(s)}`,code:t.TYPE_ERROR};return String(s)}var Br=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],ro=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],st={links:"link",metas:"meta",scripts:"script",styles:"style"},rt=new Set,it=new WeakMap;function xe(e){if(rt.has(e))return;rt.add(e),console.warn(e)}function hn(e,n){let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=n.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===n[o-1]?0:1)),s=a}}return r[n.length]}function yn(e,n){let r=e.toLowerCase(),i=n.find((g)=>g.toLowerCase()===r);if(i)return i;let s=st[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let g of n){let l=hn(r,g.toLowerCase());if(l<a)o=g,a=l}let c=Math.min(e.length,o?.length??0)<=4?1:2;return a<=c?o:void 0}function Re(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=it.get(e);if(r)return r;let{known:i,source:s}=n,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let c=st[a];if(c&&i.includes(c)&&Array.isArray(e[a])){if(o===e)o={...e};let l=Array.isArray(o[c])?o[c]:[];o[c]=[...l,...e[a]],delete o[a],xe(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${c}. Rename it to \`${c}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){xe(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let g=yn(a,i);xe(g?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${g}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return it.set(e,o),o}var C={},bn=[],J={};function ji(){return C}function vy(){return J}function xy(){C={},bn.length=0,J={}}function kl(e){C=Ge(C,Re(e,{known:ro,source:"useHead()"}))}function ot(e,n,r){let i=[...e||[]];for(let s of n||[]){let o=r(s),a=o?i.findIndex((c)=>r(c)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Ge(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:ot(e.meta,n.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:ot(e.link,n.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function Lg(e){kl(so(e))}function so(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let g=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:g})}if(e.author)n.push({name:"author",content:e.author});if(e.robots)n.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(i)n.push({property:"og:description",content:i});if(e.ogImage){if(n.push({property:"og:image",content:e.ogImage}),e.ogImageType)n.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)n.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)n.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)n.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)n.push({property:"og:url",content:e.ogUrl});if(e.ogType)n.push({property:"og:type",content:e.ogType});if(e.ogSiteName)n.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)n.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)n.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)n.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)n.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(s)n.push({name:"twitter:title",content:s});if(o)n.push({name:"twitter:description",content:o});if(a){n.push({name:"twitter:image",content:a});let g=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(g)n.push({name:"twitter:image:alt",content:g})}if(e.twitterSite)n.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)n.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)n.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)n.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)n.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)n.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let g of e.articleTags)n.push({property:"article:tag",content:g});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:c}}function Sy(e){if(J={...J,...e},e.title||e.description)Lg({title:e.title,description:e.description})}function ky(e){let n=typeof e==="function"?e():e;kl({title:n})}function _y(e=C){let n=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);n.push(`<title>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(s)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${I(String(o))}"`).join(" ");n.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${I(String(o))}"`).join(" ");n.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,c])=>c!==void 0).map(([a,c])=>{if(typeof c==="boolean")return c?a:"";return`${a}="${I(String(c))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${G(r)}</script>`);else n.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";n.push(`<style${i}>${r.content}</style>`)}return n.join(`
|
|
71
71
|
`)}function Cy(e=C){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function Ey(e=C){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ty(e=C){if(typeof document>"u")return;if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);document.title=n}for(let n of e.meta||[]){let r=n.name?`meta[name="${n.name}"]`:n.property?`meta[property="${n.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),n.name)i.setAttribute("name",n.name);if(n.property)i.setAttribute("property",n.property);document.head.appendChild(i)}i.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(n))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function $y(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
|
|
72
|
-
`,"")),headContent:n.trim()}}function Ry(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,c=n.__stx_runtime_head??{};return n.__stx_runtime_head=Ge(c,{title:a}),""})}function Ay(e,n,r=""){if(!e.includes("@meta"))return e;return Wt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=jr(qt(i),n);if(o.kind==="error")return
|
|
72
|
+
`,"")),headContent:n.trim()}}function Ry(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,c=n.__stx_runtime_head??{};return n.__stx_runtime_head=Ge(c,{title:a}),""})}function Ay(e,n,r=""){if(!e.includes("@meta"))return e;return Wt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=jr(qt(i),n);if(o.kind==="error")return F("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=Ge(a,{meta:[o.tag]})}return""},(i)=>F("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{P,Vt,fe,E,Qs,Oi,eo,d,m,hl,O,ut,Ut,p,to,t,se,Or,Y,u,$e,Ni,W,Rn,k,yl,Di,Wt,qt,Kt,Ke,dt,F,no,Mi,bl,Nr,Dr,wl,pt,vl,Mr,xl,An,Li,Sl,Lr,jr,Br,ro,Re,ji,vy,xy,kl,Ge,Lg,so,Sy,ky,_y,Cy,Ey,Ty,$y,Ry,Ay};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{J,Be}from"./chunk-hze3158c.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function an(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Be(t,s);if(p>s){c=p;continue}let a=J(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
|
|
3
3
|
export{an};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{h,_i,ol,il,_g,Cg,Eg,Tg,$g,Js,Rg,Ve,
|
|
2
|
+
import{h,_i,ol,il,_g,Cg,Eg,Tg,$g,Js,Rg,Ve,ne,Ue,Ag,Ir,Pg,ll,ul,Ti,We,s,_n,dl,y,be,gy}from"./chunk-hze3158c.js";import"./chunk-w1rrfj39.js";import"./chunk-60yppcbb.js";import"./chunk-0tyyad6q.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{ul as SIGNAL_COMPOSABLE_CALL,be as clearComponentCache,Ti as componentClientSignalNames,_i as convertToCommonJS,y as createDetailedErrorMessage,$g as extractDirectiveNames,ol as extractScriptFromTemplate,h as extractVariables,s as fileExists,gy as getComponentCacheStats,Cg as getPositionInfo,ne as getSharedTranspiler,dl as getSourceLineInfo,Tg as hasDirectives,il as hasVariables,Pg as isHydrateTrigger,Rg as isJavaScriptScript,We as renderComponentWithSlot,_n as resolveTemplatePath,Ag as scopeOnRootElement,Js as scopeSequenceKey,Ve as shouldTranspileTypeScript,ll as slotContentHasExpressions,Ue as transpileTypeScript,Ir as userComponentFileExists,Eg as validateDirective,_g as validateTemplate};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function
|
|
3
|
-
export{
|
|
2
|
+
var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function me(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function Jn(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function Rh(e,n=Object.is){return Jn(e,{equals:n})}function Yn(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function To(e){C(e)}function ns(e){k.push(e)}function rs(e){T.push(e)}function Ah(){O(k,"onMount",T)}function Ph(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function Ih(){return{mount:k.length,destroy:T.length}}function Zn(e){return typeof e==="function"&&e._isSignal===!0}function Qn(e){return typeof e==="function"&&e._isDerived===!0}function $o(e){if(Zn(e)||Qn(e))return m(()=>e());return e}function ss(e){return m(e)}function Oh(e,n){let r=typeof e==="function"?e:()=>e,i=me([]),o=Jn(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return Yn(()=>{if(r(),!t){t=!0;return}if(ss(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
|
|
3
|
+
export{me,Jn,Rh,Yn,To,ns,rs,Ah,Ph,Ih,Zn,Qn,$o,ss,Oh};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{k}from"./chunk-
|
|
2
|
+
import{k}from"./chunk-0tyyad6q.js";function rt(e,r){let n=v(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function v(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=k(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function y(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function Et(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function P(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=rt(e,c);if(!o)return null;let i=o.endPos,u=Et(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,x=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(y(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){x++,t++;continue}if(/^@endif(?![a-z])/.test(d)){x--,t+=6;continue}if(x===0){let g=d.match(/^@elseif\s*/);if(g){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let m=t+g[0].length,b=rt(a,m);if(!b){t++;continue}s="elseif",f=b.expression,t=b.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function hn(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=P(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function Cs(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=k(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=Et(e,r,n,f);if(l===-1){i=o.exec(e);continue}let x=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:x,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function ti(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=rt(e,c);if(!o)return null;let i=o.endPos,u=Et(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),x=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(x){if(f++,s)s.content+=x[0];t+=x[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),g=l.match(/^@default(?![a-z])/),m=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let b=t+d[0].length,E=rt(a,b);if(!E){t++;continue}s={type:"case",value:E.expression,content:""},t=E.endPos}else if(g&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=g[0].length}else if(m&&l.startsWith("@break"))t+=m[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{rt,Et,hn,Cs,ti};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fn,Lo,jo,Bo,Hh,Fo}from"./chunk-mwxehpse.js";import"./chunk-rw5492e2.js";import"./chunk-dy7vqv1x.js";import"./chunk-60yppcbb.js";export{jo as buildServerApi,Hh as createServerApi,fn as discoverServerApi,Lo as generateApiTypes,Fo as isServerApiSource,Bo as productionApiDispatcher};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
`)}async function ea(t,e,a,c,r){let n=await j();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=I(t);if(!await
|
|
2
|
+
import{q,z,zr,Hr,Vr}from"./chunk-6vgr5g6d.js";import{resolve as k,basename as J,extname as K,join as Y}from"path";import{mkdir as Z}from"fs/promises";var N={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0};class Gi{config;constructor(t={}){this.config={...N,...t}}async get(t,e){return zr(t,e,"video",this.config)}async set(t,e,a){return Hr(t,e,a,"video",this.config)}async clear(){return Vr("video",this.config)}updateConfig(t){this.config={...this.config,...t}}}var V=null;function T(t){if(!V)V=new Gi(t);else if(t)V.updateConfig(t);return V}async function Xi(t,e,a){let c=a?{directory:`${a.outputDir}/../.cache`}:{};return T(c).get(t,e)}async function Ji(t,e,a,c){let r=c?{directory:`${c.outputDir}/../.cache`}:{};return T(r).set(t,e,a)}async function Qg(){return T().clear()}import{resolve as B,basename as _,extname as D,join as v}from"path";import{mkdir as A}from"fs/promises";async function M(){try{return await import("ts-videos")}catch{return null}}async function Yi(t,e,a,c){let r=await M();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let n=B(t);if(!await z(n))return null;await A(a,{recursive:!0});let i=await q(n),s=_(t,D(t)),o=e.format||"webp",h=e.timestamp||0,y=`${s}-poster-${i}.${o}`,u=v(a,y),m=await r.extractThumbnails(n,{timestamps:[h],width:e.width||1280,height:e.height,format:o,quality:e.quality||85,outputDir:a,outputPattern:y.replace(`.${o}`,"")});if(m&&m.length>0){let d=m[0];return{path:u,url:`${c}/${y}`,width:d.width||e.width||1280,height:d.height||720,timestamp:h,size:d.size||0}}return null}catch(n){return console.warn(`[stx-media] Failed to generate poster: ${n}`),null}}async function Zi(t,e,a,c){let r=await M();if(!r)return[];try{let n=B(t);if(!await z(n))return[];await A(a,{recursive:!0});let i=await q(n),s=_(t,D(t)),o=e.format||"webp",u=(await new r.Input(n).getInfo()).duration||60,m=e.count||10,d=e.interval||u/m,g=[];for(let f=0;f<m&&f*d<u;f++)g.push(f*d);let l=await r.extractThumbnails(n,{timestamps:g,width:e.width||320,format:o,quality:e.quality||80,outputDir:a,outputPattern:`${s}-thumb-${i}`});if(l&&l.length>0)return l.map((f,b)=>({path:f.path||v(a,`${s}-thumb-${i}-${b}.${o}`),url:`${c}/${s}-thumb-${i}-${b}.${o}`,width:f.width||e.width||320,height:f.height||180,timestamp:g[b],size:f.size||0}));return[]}catch(n){return console.warn(`[stx-media] Failed to generate thumbnails: ${n}`),[]}}async function em(t,e,a,c){let r=await M();if(!r)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let n=B(t);if(!await z(n))return null;await A(a,{recursive:!0});let i=await q(n),s=_(t,D(t)),y=(await new r.Input(n).getInfo()).duration||60,u=e.columns||10,m=e.interval||5,d=e.thumbnailWidth||160,g=e.thumbnailHeight||90,l=e.format||"jpeg",f=Math.ceil(y/m),b=Math.ceil(f/u),S=`${s}-sprite-${i}.${l}`,w=v(a,S),C=[];for(let P=0;P<f;P++)C.push(P*m);let p=await r.extractThumbnails(n,{timestamps:C,width:d,height:g,format:l,quality:e.quality||70,outputDir:v(a,".temp")});if(!p||p.length===0)return null;try{let P=await import("ts-images"),x=u*d,ie=b*g,re=await P.createSprite({images:p.map((U)=>U.path),columns:u,padding:0,outputPath:w,format:l,quality:e.quality||70});return{url:`${c}/${S}`,path:w,columns:u,rows:b,thumbnailWidth:d,thumbnailHeight:g,interval:m,totalFrames:f}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(n){return console.warn(`[stx-media] Failed to generate sprite sheet: ${n}`),null}}import{resolve as I,basename as E,extname as F,join as R}from"path";import{mkdir as H,writeFile as W}from"fs/promises";async function j(){try{return await import("ts-videos")}catch{return null}}var Q=[{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}];async function Qi(t,e,a,c,r){let n=await j();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let i=I(t);if(!await z(i))return null;let s=await q(i),o=E(t,F(t)),h=R(a,`${o}-${s}-hls`);await H(h,{recursive:!0});let y=e.length>0?e:Q,u=r?.segmentDuration||6,g=(await new n.Input(i).getInfo()).duration||0,l=[],f=0;for(let w of y){let C=R(h,w.label);await H(C,{recursive:!0});let p=`${w.label}.m3u8`,P=R(C,p);try{let x=await n.generateHLS(i,{outputDir:C,segmentDuration:u,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate,playlistName:w.label});if(x)l.push({quality:w,url:`${c}/${o}-${s}-hls/${w.label}/${p}`,path:P}),f+=x.segmentCount||Math.ceil(g/u)}catch(x){console.warn(`[stx-media] Failed to generate HLS for ${w.label}: ${x}`)}}if(l.length===0)return null;let b=R(h,"master.m3u8"),S=X(l,c,o,s);return await W(b,S),{manifestUrl:`${c}/${o}-${s}-hls/master.m3u8`,manifestPath:b,playlists:l,segmentCount:f,duration:g}}catch(i){return console.warn(`[stx-media] Failed to generate HLS manifest: ${i}`),null}}function X(t,e,a,c){let r=["#EXTM3U","#EXT-X-VERSION:3"];for(let n of t){let{quality:i}=n,s=i.bitrate+(i.audioBitrate||128000),o=`${i.width}x${i.height||Math.round(i.width*9/16)}`;r.push(`#EXT-X-STREAM-INF:BANDWIDTH=${s},RESOLUTION=${o},NAME="${i.label}"`,`${i.label}/${i.label}.m3u8`)}return r.join(`
|
|
3
|
+
`)}async function ea(t,e,a,c,r){let n=await j();if(!n)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let i=I(t);if(!await z(i))return null;let s=await q(i),o=E(t,F(t)),h=R(a,`${o}-${s}-dash`);await H(h,{recursive:!0});let y=e.length>0?e:Q,u=r?.segmentDuration||4,m=r?.minBufferTime||2,l=(await new n.Input(i).getInfo()).duration||0,f=[],b=[];for(let p of y){let P=R(h,p.label);await H(P,{recursive:!0});try{if(await n.generateDASH(i,{outputDir:P,segmentDuration:u,width:p.width,height:p.height,videoBitrate:p.bitrate,audioBitrate:p.audioBitrate})){if(f.push({bandwidth:p.bitrate,width:p.width,height:p.height||Math.round(p.width*9/16),url:`${c}/${o}-${s}-dash/${p.label}/video`}),p.audioBitrate)b.push({bandwidth:p.audioBitrate,url:`${c}/${o}-${s}-dash/${p.label}/audio`})}}catch(x){console.warn(`[stx-media] Failed to generate DASH for ${p.label}: ${x}`)}}if(f.length===0)return null;let S=R(h,"manifest.mpd"),w=G(f,b,l,u,m);await W(S,w);let C=[{type:"video",representations:f}];if(b.length>0)C.push({type:"audio",representations:b});return{manifestUrl:`${c}/${o}-${s}-dash/manifest.mpd`,manifestPath:S,adaptationSets:C,duration:l}}catch(i){return console.warn(`[stx-media] Failed to generate DASH manifest: ${i}`),null}}function G(t,e,a,c,r){let n=L(a),i=L(r),s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
4
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
5
5
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
6
6
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -26,4 +26,4 @@ import{W,F,zr,Hr,Vr}from"./chunk-6k4ac74t.js";import{resolve as k,basename as J,
|
|
|
26
26
|
</Representation>
|
|
27
27
|
`}s+=` </AdaptationSet>
|
|
28
28
|
`}return s+=` </Period>
|
|
29
|
-
</MPD>`,s}function L(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function O(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){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 te(t){switch(t){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 jl(t){let e=await O();if(!e)return null;try{let a=k(t),r=await new e.Input(a).getInfo();return{duration:r.duration||0,width:r.width||0,height:r.height||0,frameRate:r.frameRate||0,bitrate:r.bitrate||0,codec:r.videoCodec||"",audioCodec:r.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function tm(t,e,a,c){let r=await O();if(!r)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let n=await Xi(t,e,a);if(n)return n;try{let i=k(t);if(!await
|
|
29
|
+
</MPD>`,s}function L(t){let e=Math.floor(t/3600),a=Math.floor(t%3600/60),c=Math.floor(t%60),r="PT";if(e>0)r+=`${e}H`;if(a>0)r+=`${a}M`;return r+=`${c}S`,r}async function O(){try{return await import("ts-videos")}catch{return null}}function ee(t){switch(t){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 te(t){switch(t){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 jl(t){let e=await O();if(!e)return null;try{let a=k(t),r=await new e.Input(a).getInfo();return{duration:r.duration||0,width:r.width||0,height:r.height||0,frameRate:r.frameRate||0,bitrate:r.bitrate||0,codec:r.videoCodec||"",audioCodec:r.audioCodec}}catch(a){return console.warn(`[stx-media] Failed to analyze video: ${a}`),null}}async function tm(t,e,a,c){let r=await O();if(!r)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:t,processed:!1};let n=await Xi(t,e,a);if(n)return n;try{let i=k(t);if(!await z(i))return{src:t,processed:!1,errors:[`Source file not found: ${t}`]};let s=a.outputDir||"dist/videos",o=a.baseUrl||"/videos";await Z(s,{recursive:!0});let h=await q(i),y=J(t,K(t)),u={src:t,processed:!0,hash:h};c?.({percentage:5,stage:"analyzing"}),u.metadata=await jl(i)||void 0;let m={};if(e.quality)m.bitrate=ee(e.quality);if(e.platform)Object.assign(m,te(e.platform));if(e.transcode)Object.assign(m,e.transcode);if(Object.keys(m).length>0||e.process){c?.({percentage:10,stage:"transcoding"});let d=`${y}-${h}.mp4`,g=Y(s,d);try{let l=await ae(i,g,m,r,(f)=>c?.({percentage:10+f*0.5,stage:"transcoding"}));if(l)u.transcoded={path:g,url:`${o}/${d}`,duration:l.duration,size:l.size,video:{codec:m.codec||"h264",width:l.width,height:l.height,bitrate:l.bitrate,frameRate:l.frameRate},audio:l.audioCodec?{codec:m.audioCodec||"aac",bitrate:m.audioBitrate||128000,sampleRate:m.sampleRate||48000,channels:m.channels||2}:void 0}}catch(l){u.errors=u.errors||[],u.errors.push(`Transcoding failed: ${l}`)}}if(e.generatePoster){c?.({percentage:65,stage:"generating-poster"});let d=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},g=await Yi(i,d,s,o);if(g)u.poster=g}if(a.thumbnails?.enabled){c?.({percentage:70,stage:"generating-thumbnails"});let d=await Zi(i,a.thumbnails,s,o);if(d.length>0)u.thumbnails=d}if(e.streaming){c?.({percentage:80,stage:"generating-manifests"});let d=typeof e.streaming==="object"?e.streaming:a.streaming||{format:"hls"};if(d.format==="hls"||d.format===void 0){let g=await Qi(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,hls:g}}if(d.format==="dash"){let g=await ea(i,d.qualities||a.streaming?.defaultQualities||[],s,o);if(g)u.streaming={...u.streaming,dash:g}}}if(e.spriteSheet)c?.({percentage:90,stage:"generating-sprite-sheet"});return c?.({percentage:100,stage:"complete"}),await Ji(t,e,u,a),u}catch(i){return{src:t,processed:!1,errors:[`Processing failed: ${i}`]}}}async function ae(t,e,a,c,r){try{let i=await new c.Conversion(t,e,{videoCodec:a.codec,videoBitrate:a.bitrate,width:a.maxWidth,height:a.maxHeight,frameRate:a.frameRate,audioCodec:a.audioCodec,audioBitrate:a.audioBitrate,sampleRate:a.sampleRate,channels:a.channels}).run((s)=>{r?.(s.percentage/100)});return{duration:i.duration||0,size:i.size||0,width:i.width||a.maxWidth||0,height:i.height||a.maxHeight||0,bitrate:i.bitrate||a.bitrate||0,frameRate:i.frameRate||a.frameRate||30,audioCodec:i.audioCodec}}catch(n){return console.error(`[stx-media] Transcoding failed: ${n}`),null}}export{Gi,Xi,Ji,Qg,Yi,Zi,em,Qi,ea,jl,tm};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m,p}from"./chunk-
|
|
2
|
+
import{m,p}from"./chunk-0tyyad6q.js";import{te,j,g}from"./chunk-hze3158c.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let f=t.indexOf("-->",s+4);n=f===-1?t.length:f+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let f=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=f||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!f&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",f=u[2].toLowerCase();if(c){let l=i.lastIndexOf(f);if(l!==-1)i.splice(l);e=s;continue}if(f==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(f)){if(i.push(f),f==="script"||f==="style"){let l=t.toLowerCase().indexOf(`</${f}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function tu(t){let o={default:"",named:new Map},i=t,r=L(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Im(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function nu(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of c){let[d,l]=f.split(":").map((S)=>S.trim()),h=l||d;if(s[h]=o[d],o[d]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=I(e,s,a,u)}return e}function I(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(j(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!j(s,r))return e;let a=_(s,o);if(a===void 0)return e;return g(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!m(t))return;return p(t,Object.keys(o))(...Object.values(o))}catch{return}}async function ru(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,f)=>{let d=o.named.get(u),l=f?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&d?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=d.propsBinding.trim(),x=te(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=g(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${g(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${d.content}</template>`}return await nu(d,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let f=c?.trim()||"";return o.default||f}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function Om(t){let o=tu(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Nm(t,o,i,r,e){return await ru(t,{default:o,named:i},r,e)}
|
|
3
3
|
export{tu,Im,nu,ru,Om,Nm};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var d=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],u=/<body\b([^>]*)>/gi;function
|
|
3
|
-
export{
|
|
2
|
+
var d=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],u=/<body\b([^>]*)>/gi;function V(n){let i=0,e,c=d.map(()=>{return});while(i<n.length){if(e===void 0||e!==null&&e.index<i)u.lastIndex=i,e=u.exec(n);if(!e)return null;let a=e.index,r=-1,o=null;for(let l=0;l<d.length;l++){let g=d[l],t=c[l];if(t===void 0||t!==null&&t.index<i)g.open.lastIndex=i,t=g.open.exec(n),c[l]=t;if(!t)continue;if(t.index<a&&(r===-1||t.index<r))r=t.index,o=g.close}if(r===-1||!o)return{index:a,tag:e[0],attrs:e[1]??""};o.lastIndex=r;let s=o.exec(n);if(!s)return null;i=s.index+s[0].length}return null}function nt(n,i){let e=V(n);if(!e)return n;return n.slice(0,e.index)+i(e.tag,e.attrs)+n.slice(e.index+e.tag.length)}
|
|
3
|
+
export{V,nt};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{L,Yc,Ks,xn,h,ze,He}from"./chunk-hze3158c.js";import{br,st,U}from"./chunk-y0msz738.js";import{cr,i}from"./chunk-zfq2vvex.js";import{_e}from"./chunk-q58f5wk2.js";import{Ui}from"./chunk-fd1bpv35.js";function y(s){return s.endsWith(".md")||s.endsWith(".markdown")}function C(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(s))!==null){let t=g.index,o=t+g[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function b(s,e={}){let{data:r,content:m}=br(s),a=await(e.renderer??((n)=>st(n)))(m);return{html:C(a),frontmatter:r??{}}}import{dirname as k,resolve as R}from"path";function v(s){let e=s,r=L(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),g;while((g=m.exec(s))!==null){let o=g[1],l=g[2],d=g[0],u=o.includes("server");if(p(l))n.push(d);else if(u)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let u=l.index+l[0].length,f=t.indexOf("</script>",u);if(f===-1)continue;d.push({start:l.index,end:f+9}),o.lastIndex=f+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function M(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -9,8 +9,8 @@ import{he,Yc,Ks,xn,h,ze,He}from"./chunk-d54r5c9e.js";import{br,st,V}from"./chunk
|
|
|
9
9
|
<body>
|
|
10
10
|
${s}
|
|
11
11
|
</body>
|
|
12
|
-
</html>`}async function ac(s,e={}){let r=R(s),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(y(r)){let n=await b(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=R(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...o}=e,l={...e.context||{}};xn(l);let d=await w(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),f={...l,content:d},x={...o,context:f,injectCSS:t};return w(u,n,x)}return w(c,r,e)}async function w(s,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=v(s),n={...
|
|
12
|
+
</html>`}async function ac(s,e={}){let r=R(s),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(y(r)){let n=await b(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=R(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...o}=e,l={...e.context||{}};xn(l);let d=await w(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),f={...l,content:d},x={...o,context:f,injectCSS:t};return w(u,n,x)}return w(c,r,e)}async function w(s,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=v(s),n={...U,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...Ks(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let o of c)await h(o,p,e);let g=new Set,t=m;if(t=await i(t,p,e,n,g),Yc(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),a.length>0)t+=`
|
|
13
13
|
${a.join(`
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=ze(p),d=await Promise.all(a.map(async(x)=>{let _=x.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(_))return x;let S=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!S)return x;return await He(S[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),f=[await cr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
|
-
`);t=Ui(t,f)}t=await _e(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-
|
|
15
|
+
`);t=Ui(t,f)}t=await _e(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-y1cvab1b.js");t=await o(t)}catch{}return t}
|
|
16
16
|
export{ac};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{A}from"./chunk-
|
|
2
|
+
import{A}from"./chunk-rpep1ve3.js";import{Xe,Nn}from"./chunk-mrh08821.js";function m(e){let t={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return t[e]||t["network-first"]}function g(e){return m(e).className}function d(e){let t=e.pwa;if(!t?.enabled)return"";let r=t.routes||[],n=t.cacheStorage,c=[];for(let a of r){let i=g(a.strategy),s=[];if(a.maxAgeSeconds||a.maxEntries||n?.maxEntries){let o=a.maxEntries||n?.maxEntries||100,u=a.maxAgeSeconds||(n?.maxAge?n.maxAge*24*60*60:void 0);s.push(`new ExpirationPlugin({
|
|
3
3
|
maxEntries: ${o},
|
|
4
4
|
${u?`maxAgeSeconds: ${u},`:""}
|
|
5
5
|
purgeOnQuotaError: true,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ui,di,$t,
|
|
2
|
+
import{ui,di,$t,he,wr,Ns,vr,Ds,Ms,og,ig,ag,xr,cg,lg,ug,dg,Lc,jc,Bc,pi,Fc,pg,Rt,At,Pt,It,Ot,Nt,it,fg}from"./chunk-dy7vqv1x.js";export{vr as Router,ug as abortNavigation,Ns as bracketPathToRegex,Rt as clearMiddleware,jc as createClientCookieManager,Ot as createMiddlewareContext,It as createRouteLocation,Lc as createServerCookieManager,Bc as createStorageManager,dg as defineMiddleware,ig as defineRoute,ag as defineRoutes,Ds as findErrorPage,Ms as formatRoutes,di as generateRouteManifest,ui as generateRouteTypes,Fc as getMiddleware,At as getMiddlewareNames,it as getRouterScript,fg as getRouterScriptDev,pg as hasMiddleware,$t as isFileRequestPath,Pt as loadMiddlewareFromDirectory,wr as matchRoute,lg as navigateTo,he as patternToRegex,pi as registerMiddleware,cg as resetRoutes,xr as route,Nt as runMiddleware,og as setAppUrl};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function Ze(e="stx",n=x()){if(!S.has(n))S.add(n),O({root:n});let r=D(s(n,L(e)));if(z())return H(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return G(),i.add(r),r}function
|
|
3
|
-
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function cc(e,n){let r=Ze(e);try{return await n(r)}finally{
|
|
4
|
-
export{Ze,
|
|
2
|
+
import{existsSync as A,mkdtempSync as D,readdirSync as M,rmSync as b,statSync as g,writeFileSync as k}from"fs";import{constants as P,tmpdir as x}from"os";import{join as s}from"path";import t from"process";var _=/^stx-(?:.+-)?p(\d+)-\w{6}$/,v=".stx-keep",I=60000,N=["SIGINT","SIGTERM","SIGHUP"],i=new Set,y=new Set,c=!1,S=new Set;function p(e){try{b(e,{recursive:!0,force:!0})}catch{}}function R(){for(let e of i)p(e);i.clear(),f()}function E(){for(let e of i)p(e);i.clear()}function C(e){if(R(),t.listenerCount(e)===0)t.exit(128+(P.signals[e]??1))}var h=new Map(N.map((e)=>[e,()=>C(e)]));function G(){if(c)return;c=!0,t.on("exit",E);for(let[e,n]of h)try{t.on(e,n)}catch{}}function f(){if(!c)return;c=!1,t.off("exit",E);for(let[e,n]of h)t.off(e,n)}function K(e){try{return t.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function O(e={}){let n=e.root??x(),r=e.isAlive??K,w=e.minAgeMs??I,T=e.now??Date.now(),a=[],u;try{u=M(n)}catch{return a}for(let d of u){let l=_.exec(d);if(!l)continue;let m=Number(l[1]);if(m===t.pid||r(m))continue;let o=s(n,d);try{if(!g(o).isDirectory())continue;if(T-g(o).mtimeMs<w)continue;if(A(s(o,v)))continue}catch{continue}p(o),a.push(o)}return a}function L(e){let n=e.replace(/^stx-/,"").replace(/-+$/,"");return n?`stx-${n}-p${t.pid}-`:`stx-p${t.pid}-`}function z(e=t.env){let n=e.STX_KEEP_TEMP?.trim().toLowerCase();return!!n&&n!=="0"&&n!=="false"}function Ze(e="stx",n=x()){if(!S.has(n))S.add(n),O({root:n});let r=D(s(n,L(e)));if(z())return H(r),console.warn(`[stx] STX_KEEP_TEMP: keeping ${r}`),r;return G(),i.add(r),r}function le(e){if(y.has(e))return;if(p(e),i.delete(e),i.size===0)f()}function H(e){try{k(s(e,v),`kept by pid ${t.pid}
|
|
3
|
+
`)}catch{}if(y.add(e),i.delete(e),i.size===0)f()}async function cc(e,n){let r=Ze(e);try{return await n(r)}finally{le(r)}}
|
|
4
|
+
export{Ze,le,cc};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Wi,qi,Ki,Gg,Xg,Jg,Ll,Yg,Zg}from"./chunk-
|
|
2
|
+
import{Wi,qi,Ki,Gg,Xg,Jg,Ll,Yg,Zg}from"./chunk-tjwzy9xq.js";export{Wi as ImageProcessorCache,Ll as applyTransformations,Gg as clearImageCache,Yg as generateResponsiveVariants,Zg as generateSrcset,qi as getCachedImageResult,Jg as optimizeImage,Xg as processImage,Ki as setCachedImageResult};
|