@stacksjs/stx 0.2.672 → 0.2.674
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-0jwdcqj8.js +2 -0
- package/dist/chunk-0mwdq478.js +2 -0
- package/dist/{chunk-npa7gze7.js → chunk-0nfqgv4n.js} +2 -2
- package/dist/chunk-1y6egkty.js +2 -0
- package/dist/{chunk-1sr6c0nk.js → chunk-25zmy8q6.js} +2 -2
- package/dist/chunk-2881tcqt.js +2 -0
- package/dist/chunk-2a775q7x.js +2 -0
- package/dist/chunk-2asdbd5e.js +2 -0
- package/dist/chunk-34yj93hh.js +2 -0
- package/dist/{chunk-30nes8ne.js → chunk-35ezh7de.js} +2 -2
- package/dist/{chunk-sjcqxfq1.js → chunk-40tswfe7.js} +8 -8
- package/dist/chunk-41de209e.js +2 -0
- package/dist/{chunk-6xe8rnfv.js → chunk-4b9s7wgy.js} +2 -2
- package/dist/{chunk-ttbn287w.js → chunk-4bgjrrvz.js} +1 -1
- package/dist/{chunk-365vg0eg.js → chunk-4s8zacxg.js} +4 -4
- package/dist/chunk-4w6baw62.js +3 -0
- package/dist/{chunk-fbtv2k1p.js → chunk-506mv7hb.js} +2 -2
- package/dist/{chunk-fzqj1mjz.js → chunk-5qtthtg3.js} +7 -7
- package/dist/chunk-5s1ay9mv.js +2 -0
- package/dist/{chunk-kenbxxbn.js → chunk-5vt48yce.js} +6 -6
- package/dist/{chunk-qv6axke4.js → chunk-5zhp87wv.js} +2 -2
- package/dist/{chunk-hvf2e7pr.js → chunk-6s7tvmqp.js} +1 -1
- package/dist/{chunk-ecqrkyg8.js → chunk-6sjtyd0k.js} +4 -4
- package/dist/{chunk-a3d0g4mr.js → chunk-7adznted.js} +2 -2
- package/dist/chunk-7j1zgrnf.js +42 -0
- package/dist/chunk-7kznee1g.js +2 -0
- package/dist/{chunk-qjtpxsyx.js → chunk-7mvz972c.js} +3 -3
- package/dist/chunk-80zgyaqe.js +2 -0
- package/dist/chunk-84tqb1rn.js +2 -0
- package/dist/chunk-8azm7nha.js +2 -0
- package/dist/chunk-902qnyg0.js +2 -0
- package/dist/{chunk-3y41efsf.js → chunk-9dtbvjpp.js} +8 -8
- package/dist/chunk-9n6jwcpb.js +2 -0
- package/dist/{chunk-yfvm7q6t.js → chunk-a4p18ybc.js} +3 -3
- package/dist/chunk-a6y8td0d.js +2 -0
- package/dist/chunk-a7kt1ts4.js +2 -0
- package/dist/chunk-a81y8g40.js +2 -0
- package/dist/{chunk-mjm3tyfj.js → chunk-aet1pgw7.js} +36 -36
- package/dist/chunk-aft1zc84.js +2 -0
- package/dist/{chunk-04kg16qs.js → chunk-am2w363p.js} +4 -4
- package/dist/{chunk-ym41ybz2.js → chunk-asezs2n3.js} +6 -6
- package/dist/{chunk-7kk2m44a.js → chunk-bawq4fqy.js} +4 -4
- package/dist/chunk-bdp2r0v4.js +2 -0
- package/dist/{chunk-1mj9crcg.js → chunk-bkkpq8dx.js} +9 -9
- package/dist/chunk-brtvm8mb.js +2 -0
- package/dist/{chunk-2dp7hyv7.js → chunk-bsajk82t.js} +14 -14
- package/dist/chunk-bvzr9zqt.js +2 -0
- package/dist/{chunk-t9yqq483.js → chunk-cbjabv1w.js} +4 -4
- package/dist/chunk-cbvgtf3m.js +2 -0
- package/dist/chunk-cfydbaeq.js +2 -0
- package/dist/{chunk-t2pzy3x1.js → chunk-ck2e3e47.js} +3 -3
- package/dist/{chunk-wpmrz872.js → chunk-d09q93yf.js} +2 -2
- package/dist/{chunk-a91atghh.js → chunk-d1a86qx8.js} +1 -1
- package/dist/{chunk-xqp4hstk.js → chunk-dgc1a3yt.js} +6 -6
- package/dist/chunk-dq8c3h4n.js +2 -0
- package/dist/chunk-e36pne7n.js +2 -0
- package/dist/chunk-e62qfexp.js +2 -0
- package/dist/chunk-eq5jzaj5.js +2 -0
- package/dist/{chunk-kwek8xdt.js → chunk-f9zyf9n6.js} +65 -65
- package/dist/{chunk-dgb4z4kw.js → chunk-faakv1p6.js} +2 -2
- package/dist/{chunk-yqz01qvy.js → chunk-fb7t1nn9.js} +3 -3
- package/dist/{chunk-06b8btkv.js → chunk-fbmth6xv.js} +10 -10
- package/dist/{chunk-7met6yva.js → chunk-fd49fahd.js} +5 -5
- package/dist/chunk-fr39emcz.js +2 -0
- package/dist/chunk-fsq13amm.js +2 -0
- package/dist/chunk-fw413k9q.js +3 -0
- package/dist/chunk-fxh12vqd.js +2 -0
- package/dist/chunk-gcc9fa33.js +2 -0
- package/dist/chunk-h6t2ney6.js +2 -0
- package/dist/{chunk-kgfgb971.js → chunk-ham5x7ts.js} +4 -4
- package/dist/{chunk-n38yb274.js → chunk-hb3edeq9.js} +6 -6
- package/dist/{chunk-fvtwec1r.js → chunk-hegfgw27.js} +1 -1
- package/dist/{chunk-p472crv1.js → chunk-hgry3mjd.js} +1 -1
- package/dist/{chunk-t961jbzc.js → chunk-hsmcbh0p.js} +7 -7
- package/dist/{chunk-wz2zb53w.js → chunk-hz4x7h0n.js} +5 -5
- package/dist/{chunk-jxda11cg.js → chunk-j6m8xqh3.js} +2 -2
- package/dist/chunk-j8g5cvvm.js +2 -0
- package/dist/chunk-jzjpyyw2.js +2 -0
- package/dist/chunk-k1b8x73j.js +2 -0
- package/dist/{chunk-8k3rwv8r.js → chunk-kdebh22m.js} +7 -7
- package/dist/{chunk-pvb48ehs.js → chunk-mwnhdsbp.js} +2 -2
- package/dist/{chunk-s20h5gmr.js → chunk-nj343mw2.js} +5 -5
- package/dist/chunk-nw9bdk2n.js +2 -0
- package/dist/chunk-p4jkswz8.js +2 -0
- package/dist/chunk-p4r90vqf.js +2 -0
- package/dist/{chunk-bnn7pd62.js → chunk-p6qd7ad0.js} +2 -2
- package/dist/chunk-p8bgy5tt.js +2 -0
- package/dist/{chunk-aprhqxky.js → chunk-pb6erpj3.js} +5 -5
- package/dist/{chunk-r3e6x87d.js → chunk-pg2v1pb5.js} +3 -3
- package/dist/{chunk-dw81nc5v.js → chunk-pqqe2b6m.js} +4 -4
- package/dist/chunk-q6nwcav4.js +2 -0
- package/dist/chunk-qmqavdz2.js +2 -0
- package/dist/chunk-qpw72bty.js +2 -0
- package/dist/chunk-qwnh1kj6.js +2 -0
- package/dist/chunk-qy9m6qdn.js +2 -0
- package/dist/chunk-qychcdsm.js +2 -0
- package/dist/{chunk-7d4z944r.js → chunk-qz5b8ed4.js} +7 -7
- package/dist/{chunk-6ajahb2x.js → chunk-r7fdw2v5.js} +3 -3
- package/dist/{chunk-mmwedr93.js → chunk-rdr09efy.js} +5 -5
- package/dist/chunk-rj3w1ama.js +2 -0
- package/dist/{chunk-prf164ct.js → chunk-rr527jt6.js} +2 -2
- package/dist/{chunk-x68etmdg.js → chunk-rv39s5az.js} +4 -4
- package/dist/{chunk-a5zqqgx2.js → chunk-rym0309c.js} +3 -3
- package/dist/{chunk-sqayfat9.js → chunk-s0vtjyyj.js} +1 -1
- package/dist/{chunk-vqc4h16r.js → chunk-s2wptfm1.js} +2 -2
- package/dist/chunk-sf0r963g.js +2 -0
- package/dist/{chunk-a3yte051.js → chunk-sqn3y9qt.js} +2 -2
- package/dist/{chunk-9gfffs28.js → chunk-srq9fqq8.js} +10 -10
- package/dist/chunk-ss820yys.js +2 -0
- package/dist/{chunk-pn1ehs6a.js → chunk-szevd7d5.js} +2 -2
- package/dist/{chunk-wbzmr6a4.js → chunk-t0k16vqv.js} +2 -2
- package/dist/chunk-t4j9g2vh.js +2 -0
- package/dist/chunk-t79jfpv6.js +3 -0
- package/dist/{chunk-rcadtv3x.js → chunk-t9kxhe46.js} +1 -1
- package/dist/{chunk-zqtbtqbq.js → chunk-tddnb5bv.js} +2 -2
- package/dist/{chunk-hvzzhkhr.js → chunk-thceyzj6.js} +2 -2
- package/dist/{chunk-n3m7fkv1.js → chunk-trh7s6k3.js} +5 -5
- package/dist/{chunk-3349573p.js → chunk-trz8z4j4.js} +18 -18
- package/dist/chunk-ttemwrbx.js +2 -0
- package/dist/{chunk-wankp78x.js → chunk-twqzn21x.js} +7 -7
- package/dist/chunk-v14rq8b4.js +3 -0
- package/dist/{chunk-b4pcw34n.js → chunk-v21bhhjb.js} +1 -1
- package/dist/{chunk-ka8befem.js → chunk-v6peecfp.js} +2 -2
- package/dist/{chunk-g8r0km7g.js → chunk-vayhx642.js} +2 -2
- package/dist/{chunk-5pgk3w2c.js → chunk-vdxg7e1y.js} +2 -2
- package/dist/chunk-vq513cxx.js +2 -0
- package/dist/chunk-vvq8xe3n.js +2 -0
- package/dist/{chunk-tre98h62.js → chunk-w3d98907.js} +2 -2
- package/dist/{chunk-p3x21vp7.js → chunk-w7t2cfgy.js} +42 -42
- package/dist/chunk-w8t31bn9.js +2 -0
- package/dist/chunk-x1kz4d7j.js +2 -0
- package/dist/chunk-xcsyqwxf.js +25 -0
- package/dist/{chunk-9p6efb17.js → chunk-xghcsg3f.js} +1 -1
- package/dist/chunk-xn9jrjzh.js +2 -0
- package/dist/{chunk-nrvwejdw.js → chunk-y1pcdeg9.js} +5 -5
- package/dist/{chunk-qffbkvfn.js → chunk-yx3dpdwc.js} +3 -3
- package/dist/{chunk-f9hrpwsw.js → chunk-z22zy22p.js} +2 -2
- package/dist/chunk-z97bwx8m.js +2 -0
- package/dist/{chunk-120ze5ms.js → chunk-zmg1peyg.js} +3 -3
- package/dist/{chunk-pxdww4rb.js → chunk-zp79zkkd.js} +2 -2
- package/dist/cli.js +20 -20
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/loops.js +19 -3
- package/dist/pwa.js +3 -3
- package/dist/signal-processing.d.ts +12 -0
- package/dist/signal-processing.js +1 -1
- package/dist/ssg.js +6 -6
- package/package.json +5 -5
- package/dist/chunk-028ee6q5.js +0 -2
- package/dist/chunk-02ymqwmj.js +0 -2
- package/dist/chunk-0dcrd58z.js +0 -2
- package/dist/chunk-0f33ssaq.js +0 -2
- package/dist/chunk-17yfcd5s.js +0 -2
- package/dist/chunk-1pnp91wx.js +0 -2
- package/dist/chunk-23b0khvh.js +0 -3
- package/dist/chunk-2f17h17f.js +0 -2
- package/dist/chunk-4c183zem.js +0 -2
- package/dist/chunk-4ve8vsw5.js +0 -2
- package/dist/chunk-4yt8tg4j.js +0 -2
- package/dist/chunk-52gp2xxk.js +0 -2
- package/dist/chunk-5w1c7x22.js +0 -2
- package/dist/chunk-5zgrvj4b.js +0 -2
- package/dist/chunk-67kj14at.js +0 -2
- package/dist/chunk-6vzktvyw.js +0 -2
- package/dist/chunk-7a3g26kk.js +0 -2
- package/dist/chunk-7d2fab0z.js +0 -2
- package/dist/chunk-7dtpszqq.js +0 -2
- package/dist/chunk-7spxdz5k.js +0 -2
- package/dist/chunk-864qtx7y.js +0 -2
- package/dist/chunk-89jbdtgw.js +0 -3
- package/dist/chunk-96mm4q2g.js +0 -2
- package/dist/chunk-9szxxgv5.js +0 -2
- package/dist/chunk-9yxgdy4z.js +0 -42
- package/dist/chunk-a95r5nmq.js +0 -25
- package/dist/chunk-am246nf3.js +0 -2
- package/dist/chunk-avnhsjq0.js +0 -2
- package/dist/chunk-aw3meb8t.js +0 -2
- package/dist/chunk-b4fd2dtk.js +0 -2
- package/dist/chunk-b823zxq6.js +0 -3
- package/dist/chunk-bdg0fydw.js +0 -2
- package/dist/chunk-d6en3vz7.js +0 -2
- package/dist/chunk-dnw3knxq.js +0 -2
- package/dist/chunk-dpvxe52r.js +0 -2
- package/dist/chunk-e1fetwbr.js +0 -2
- package/dist/chunk-e44z03s5.js +0 -2
- package/dist/chunk-e4vpr36s.js +0 -2
- package/dist/chunk-f8dkq3ta.js +0 -2
- package/dist/chunk-fcn71bq1.js +0 -2
- package/dist/chunk-g2jmwh7p.js +0 -2
- package/dist/chunk-j0v970k3.js +0 -2
- package/dist/chunk-jk41jwsc.js +0 -2
- package/dist/chunk-k2pa44rf.js +0 -2
- package/dist/chunk-qq1k3364.js +0 -2
- package/dist/chunk-qxmyaajq.js +0 -2
- package/dist/chunk-sc7hszsx.js +0 -2
- package/dist/chunk-sf0wsq74.js +0 -2
- package/dist/chunk-shpc1ttk.js +0 -2
- package/dist/chunk-sj6mhjdq.js +0 -2
- package/dist/chunk-sqhmkvwd.js +0 -2
- package/dist/chunk-sw6p5176.js +0 -2
- package/dist/chunk-tb6vacgp.js +0 -2
- package/dist/chunk-we8ptx6w.js +0 -2
- package/dist/chunk-weqc0ssb.js +0 -2
- package/dist/chunk-wq712sw1.js +0 -2
- package/dist/chunk-wyq0c4wy.js +0 -2
- package/dist/chunk-wz6368p4.js +0 -2
- package/dist/chunk-yscr04dv.js +0 -2
- package/dist/chunk-z8j2sbnb.js +0 -2
- package/dist/chunk-z8p6tk5z.js +0 -2
- package/dist/chunk-zhf01af3.js +0 -3
- package/dist/chunk-zp9k5pha.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{yn}from"./chunk-
|
|
2
|
+
import{yn}from"./chunk-bsajk82t.js";import{q,Pe,ue,Rt,At,lr,g,Za,Lo,z,_}from"./chunk-f9zyf9n6.js";import{V}from"./chunk-506mv7hb.js";var L=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function H(t,n,e){let r={fullTag:e,content:n,attrs:t};if(/\bserver\b/.test(t))return{...r,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...r,type:"client"};if(L.test(n))return{...r,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...r,type:"client"};return{...r,type:"server"}}var B=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Ci(t){let n=[],e=[],r=[],i=0;while(i<t.length){let s=t.indexOf("<",i);if(s===-1)break;let a=Pe(t,s);if(a>s){i=a;continue}let o=q(t,s);if(o>s){let c=t.slice(s,o),u=B.exec(c);if(u){let l=H(u[1],u[2],c);switch(l.type){case"signals":n.push(l);break;case"client":e.push(l);break;case"server":r.push(l);break}}i=o;continue}i=s+(t.startsWith("<!--",s)?4:1)}return{signals:n,client:e,server:r}}var G=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let n=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=e.exec(t))!==null)n.push({start:r.index,end:r.index+r[0].length});return n}function P(t,n){return n.some((e)=>t>=e.start&&t<e.end)}function W(t){let n=(t||"").trim();if(!n)return null;if(/[\s>+~,:]/.test(n))return null;let e={},r=n,i=r.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),r=r.slice(i[0].length);while(r.length>0){let s=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(s){if(e.attr=s[1],s[3]!==void 0&&s[3]!=="")e.attrValue=s[3];r=r.slice(s[0].length);continue}let a=r.match(/^#([\w-]+)/);if(a){e.id=a[1],r=r.slice(a[0].length);continue}let o=r.match(/^\.([\w-]+)/);if(o){e.className=o[1],r=r.slice(o[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function X(t,n){if(n.attr){if(!(n.attrValue===void 0?new RegExp(`\\b${n.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${n.attr}\\s*=\\s*(["'])\\s*${n.attrValue}\\s*\\1`,"i")).test(t))return!1}if(n.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${n.id}\\s*\\1`,"i").test(t))return!1}if(n.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(n.className))return!1}return!0}function T(t,n="main"){let e=W(n);if(!e)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,i=U(t),s;while((s=r.exec(t))!==null){if(P(s.index,i))continue;let a=s[1].toLowerCase(),o=s[2]||"";if(o.trimEnd().endsWith("/")||G.has(a))continue;if(e.tag&&e.tag!==a)continue;if(!X(o,e))continue;let c=s[0],u=s.index+c.length,l=new RegExp(`<(/?)${a}\\b([^>]*)>`,"gi");l.lastIndex=u;let f=1,m;while((m=l.exec(t))!==null){if(P(m.index,i))continue;let x=m[1]==="/";if(!x&&(m[2]||"").trimEnd().endsWith("/"))continue;if(f+=x?-1:1,f===0)return{openTag:c,openIndex:s.index,start:u,end:m.index,tagName:a}}return null}return null}var ut="private, no-store";function Ei(t){return t.replace(/&#(\d+);/g,(n,e)=>M(Number(e),n)).replace(/&#x([0-9a-f]+);/gi,(n,e)=>M(Number.parseInt(e,16),n)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function M(t,n){if(!Number.isInteger(t)||t<0||t>1114111)return n;try{return String.fromCodePoint(t)}catch{return n}}function Se(t){return t.headers.get("X-STX-Router")==="true"}function J(t,n){if(!t)return n;return t.split(",").some((r)=>r.trim().toLowerCase()===n.toLowerCase())?t:`${t}, ${n}`}function O(t){return{Vary:J(t,"X-STX-Router")}}import A from"path";var K="stx-page-head:",Y=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,C={dev:null,prod:null};function Z(){let t=V()?"dev":"prod",n=C[t];if(n!==null)return n;try{let e=import.meta.require("./chunk-a81y8g40.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;C[t]=`<script>${r()}</script>`}catch{C[t]=""}return C[t]}async function Ti(t,n){if(n===!1)return null;if(n&&typeof n==="string"){let r=A.resolve(t,n);if(await Bun.file(r).exists())return r;return null}let e=A.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Bs(t,n){try{let e=await Bun.file(t).text(),r=e,i=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(i)r=i[1].trim();let s=Ci(e),a=[...s.client.map((d)=>d.fullTag),...s.signals.map((d)=>d.fullTag)],o=[],c=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=c.exec(e))!==null)o.push(u[0]);let l=r;for(let d of s.server)l=l.replace(d.fullTag,"");for(let d of s.client)l=l.replace(d.fullTag,"");l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let f="<!--__STX_PAGE_SLOT__-->";if(l=l.replace(/<slot\s*\/>/gi,f).replace(/<slot\s*>\s*<\/slot>/gi,f),!l.includes(f))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:m,extractVariables:x,defaultConfig:y,loadStxConfig:R}=await import("./chunk-a7kt1ts4.js"),S=await R(),p={__filename:t,__dirname:A.dirname(t)};for(let d of a){let w=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(w&&!d.includes("client")&&!d.includes('type="module"'))await x(w[1],p,t)}let b=await m(l,p,t,{...y,...S,...n},new Set),h=b.indexOf(f);if(h===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:b.substring(0,h),afterSlot:b.substring(h+f.length),filePath:t,shellScripts:a,shellStyles:o}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Rr(t,n,e){let r,i="",s=n.match(Y);if(s){n=n.replace(s[0],"");try{let l=Buffer.from(s[1],"base64").toString("utf8"),f=l.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(f)r=f[1].trim();i=l.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let a=e||r||"stx App",o=Z(),c="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -22,10 +22,10 @@ ${o}
|
|
|
22
22
|
`),"utf8").toString("base64")}-->`)}let s=e.match(/<body\b[^>]*>/i),a=e.lastIndexOf("</body>");if(s&&a!==-1){let c=s.index+s[0].length,u=e.slice(c,a).trim();if(r.length>0)return r.join(`
|
|
23
23
|
`)+`
|
|
24
24
|
`+u;return u}let o=e;if(o=o.replace(/<!DOCTYPE\b[^>]*>/i,""),o=o.replace(/<html\b[^>]*>/i,""),o=o.replace(/<\/html\s*>/i,""),i)o=o.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,r.join(`
|
|
25
|
-
`));return o=o.replace(/<body\b[^>]*>/i,""),o=o.replace(/<\/body\s*>/i,""),o.trim()}var j=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function N(t,n,e,r){if(!j.test(n))return!1;let i=n.slice(0,n.indexOf(">")+1),s=/\sdata-stx-owner="([^"]+)"/i.exec(i)?.[1];if(!s)return!0;let a=`data-stx-scope="${s}"`;for(let o=t.indexOf(a);o!==-1;o=t.indexOf(a,o+a.length))if(o>=e&&o<r)return!1;return!0}function
|
|
25
|
+
`));return o=o.replace(/<body\b[^>]*>/i,""),o=o.replace(/<\/body\s*>/i,""),o.trim()}var j=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function N(t,n,e,r){if(!j.test(n))return!1;let i=n.slice(0,n.indexOf(">")+1),s=/\sdata-stx-owner="([^"]+)"/i.exec(i)?.[1];if(!s)return!0;let a=`data-stx-scope="${s}"`;for(let o=t.indexOf(a);o!==-1;o=t.indexOf(a,o+a.length))if(o>=e&&o<r)return!1;return!0}function $i(t){return Se(t)}function Q(t,n){let e=[],r=new Set;for(let i of ue(t,q)){if(i.start>=n.start&&i.start<n.end)continue;let s=i.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",a=new Map;for(let u of s.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))a.set(u[1].toLowerCase(),u[2]??u[3]??u[4]??"");let o=a.get("src")?.trim(),c=a.get("type")?.trim().toLowerCase();if(!o||a.has("server")||c&&!["module","text/javascript","application/javascript"].includes(c))continue;if(a.has("data-stx-runtime")||a.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(o))continue;if(N(t,i.token,n.start,n.end)||r.has(i.token))continue;r.add(i.token),e.push(i.token)}return e}function ke(t,n="main"){let e=t.trim(),r=[],i=[],s=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(s){let p=s[1],b=/<style\b[^>]*>[\s\S]*?<\/style>/gi,h;while((h=b.exec(p))!==null)r.push(h[0]);let d=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((h=d.exec(p))!==null){if(j.test(h[0])||h[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(h[0]))continue;i.push(h[0])}}let a=T(e,n);if(!a)return He(t);let o=Q(e,a),c=new Set(o),{tagName:u,start:l,end:f}=a,m=e.slice(l,f).trim(),x=[],y=e.match(/<body\b[^>]*>/i),R=e.lastIndexOf("</body>");if(y&&y.index!==void 0&&R!==-1){let b=[[y.index+y[0].length,a.openIndex],[f+`</${u}>`.length,R]],h=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[d,w]of b){if(d>=w)continue;let F=e.slice(d,w),v;h.lastIndex=0;while((v=h.exec(F))!==null){if(N(e,v[0],l,f))continue;x.push(v[0])}}}let S=[];if(r.length>0)S.push(r.join(`
|
|
26
26
|
`));if(o.length>0)S.push(o.join(`
|
|
27
27
|
`));if(i.length>0)S.push(i.filter((p)=>!c.has(p)).join(`
|
|
28
28
|
`));if(x.length>0)S.push(x.filter((p)=>!c.has(p)).join(`
|
|
29
29
|
`));return S.push(m),S.join(`
|
|
30
|
-
`)}import E from"fs";import I from"path";function
|
|
31
|
-
export{
|
|
30
|
+
`)}import E from"fs";import I from"path";function Ri(t,n,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:n,outputDir:e}}function Ai(t,n){let e=I.join(n,"manifest.json");E.writeFileSync(e,JSON.stringify(t,null,2))}function Pi(t){let n=I.join(t,"manifest.json");if(!E.existsSync(n))return null;try{let e=E.readFileSync(n,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function k(t,n,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function tt(t){let n=t.headers.get("content-type")||"",e={},r=(i,s)=>{let a=e[i];if(a===void 0)e[i]=s;else if(Array.isArray(a))a.push(s);else e[i]=[a,s]};if(n.includes("multipart/form-data")){let i=await t.formData();for(let[s,a]of i.entries())if(typeof a==="string")r(s,a);return e}if(n.includes("application/x-www-form-urlencoded")){for(let[i,s]of new URLSearchParams(await t.text()).entries())r(i,s);return e}return e}function Fs(t){if(!t)return!1;let n=t.toUpperCase();return n!=="GET"&&n!=="HEAD"}async function D(t,n={}){let e=n.request,r=n.method??e?.method;if(!e||!Fs(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await tt(e)}catch{}let s=await t.action({request:e,form:i,params:n.params??{},query:t.query??{},cookies:n.cookies??{}});if(s&&typeof s==="object"){let a=s,o=et(a.cookies),c=a.redirect;if(typeof c==="string"&&c)return{redirect:c,ran:!0,...o.length>0?{cookies:o}:{}};let{cookies:u,redirect:l,...f}=a;if(Object.assign(t,f),o.length>0)return{ran:!0,cookies:o}}return{ran:!0}}function et(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let n=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){n.push(k(e,r));continue}if(r&&typeof r==="object"){let i=r;if(typeof i.value!=="string")continue;n.push(k(e,i.value,i))}}return n}function Ii(t,n=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of n)r.append("Set-Cookie",i);for(let[i,s]of Object.entries(e??{}))if(i.toLowerCase()!=="location")r.set(i,s);return new Response(null,{status:303,headers:r})}async function kn(t,n={}){let{html:e,context:r,redirect:i,cookies:s}=await nt(t,n),a=Rt(r),o=At(r);if(i)return{html:e,redirect:i,cookies:s,status:a,headers:o};let{extractStreamBoundaries:c}=await import("./chunk-7kznee1g.js"),u=c(r),l=t.streamTemplates;if(l&&Object.keys(l).length>0){let{processDirectives:f}=await import("./chunk-jzjpyyw2.js"),{defaultConfig:m}=await import("./chunk-2881tcqt.js"),x=r.streamBoundaries||{},y={...m,autoShell:!1},R=Object.keys(l).map((p)=>({id:p,render:async()=>{let b=typeof x[p]==="function"?await x[p]():void 0;return f(l[p],{...r,$boundary:b},t.sourceFile,y,new Set)}})),S=new Set(R.map((p)=>p.id));u=[...(u||[]).filter((p)=>!S.has(p.id)),...R]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:s,status:a,headers:o}}async function nt(t,n){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...n};if(!t.hasServerScripts&&!Lo(t.html))return{html:t.html,context:e};for(let a of t.serverScriptContent)try{await g(a,e,t.sourceFile)}catch(o){if(n.__stx_strict_hydration)throw o;console.warn(`[stx] Server script error in ${t.sourceFile}:`,o)}let r=await D(e,{request:n.request,method:n.method,params:n.params??{},cookies:n.cookies??{}}),i=(a)=>{let o=a.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),c=lr(e);if(!c)return o;let u=o.indexOf("</head>");return u<0?c+o:o.slice(0,u)+c+o.slice(u)};if(r.redirect)return{html:t.html,context:e,redirect:r.redirect,cookies:r.cookies};if(!Lo(t.html))return{html:i(t.html),context:e,cookies:r.cookies};let s=new Map;for(let[a,o]of Object.entries(t.placeholders))if(o.expression)try{let c=_(o.expression,e);if(o.type==="raw")s.set(a,c!==void 0&&c!==null?String(c):"");else s.set(a,c!==void 0&&c!==null?z(String(c)):"")}catch(c){if(n.__stx_strict_hydration)throw c;s.set(a,"")}return{html:i(Za(t.html,s)),context:e,cookies:r.cookies}}
|
|
31
|
+
export{Ci,ut,Ei,Se,O,Ti,Bs,Rr,He,$i,ke,Ri,Ai,Pi,Fs,Ii,kn};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{l,p,E,u,
|
|
3
|
-
`)s++;return!0}if(t[s]==="/"&&t[s+1]==="*"){s+=2;while(s<f-1&&!(t[s]==="*"&&t[s+1]==="/"))s++;return s+=2,!0}return!1},it=()=>{if(b!==0)return;let j=t.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!i.has(V))c.push(V),i.add(V);return}let et=t.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(et){let V=et[1];if(!i.has(V))c.push(V),i.add(V);return}let Y=t.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let V=Y[1];if(!i.has(V))c.push(V),i.add(V)}};while(s<f){if(
|
|
2
|
+
import{l,p,E,u,H}from"./chunk-bsajk82t.js";import{L,rs,B,Ae,le,cr,De,Me,n,m,ve,k}from"./chunk-f9zyf9n6.js";import{st}from"./chunk-zp79zkkd.js";import{T}from"./chunk-ce6zddpf.js";import{ne}from"./chunk-v6peecfp.js";import{W,Ge}from"./chunk-p6qd7ad0.js";import{C,bn}from"./chunk-506mv7hb.js";import A from"path";import{existsSync as St}from"fs";function at(a,t){let c=0;for(let i=t;i<a.length;i++){let b=a[i];if(b==="("||b==="["||b==="{")c++;else if(b===")"||b==="]"||b==="}")c--;else if(b===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,b=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=b.exec(i);while(s){let f=s.index,e=f+s[0].length-1,D=1,Z=e+1;while(Z<i.length&&D>0){if(i[Z]==="(")D++;else if(i[Z]===")")D--;Z++}if(D!==0)break;let it=i.substring(e+1,Z-1),j=`${c}(${it})`;i=i.substring(0,f)+j+i.substring(Z),b.lastIndex=f+j.length,s=b.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,b=0,s=0,f=t.length,e=(j)=>{s++;while(s<f){if(t[s]==="\\"){s+=2;continue}if(t[s]===j){s++;return}s++}},D=()=>{s++;while(s<f){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let j=1;while(s<f&&j>0)if(t[s]==="{")j++,s++;else if(t[s]==="}")j--,s++;else if(t[s]==="'"||t[s]==='"')e(t[s]);else if(t[s]==="`")D();else s++;continue}s++}},Z=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<f&&t[s]!==`
|
|
3
|
+
`)s++;return!0}if(t[s]==="/"&&t[s+1]==="*"){s+=2;while(s<f-1&&!(t[s]==="*"&&t[s+1]==="/"))s++;return s+=2,!0}return!1},it=()=>{if(b!==0)return;let j=t.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!i.has(V))c.push(V),i.add(V);return}let et=t.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(et){let V=et[1];if(!i.has(V))c.push(V),i.add(V);return}let Y=t.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let V=Y[1];if(!i.has(V))c.push(V),i.add(V)}};while(s<f){if(Z())continue;if(t[s]==="'"||t[s]==='"'){e(t[s]);continue}if(t[s]==="`"){D();continue}if(t[s]==="{"){b++,s++;continue}if(t[s]==="}"){b--,s++;continue}if(b===0&&/[a-z]/i.test(t[s])&&(s===0||/\s|[;{}()]/.test(t[s-1])))it();s++}return c.join(", ")}function Et(a,t=""){let c=mt(a).split(",").map((i)=>i.trim()).filter(Boolean);return`
|
|
4
4
|
(function() {
|
|
5
5
|
${st("var",c)}
|
|
6
6
|
var __destroyHooks = [];
|
|
@@ -9,7 +9,7 @@ import{l,p,E,u,z}from"./chunk-2dp7hyv7.js";import{L,ns,B,Ae,ae,ar,De,Me,n,m,ve,k
|
|
|
9
9
|
|
|
10
10
|
${a}
|
|
11
11
|
${t}})();
|
|
12
|
-
`}function vt(a,t){let i=mt(a).split(",").map((f)=>f.trim()).filter(Boolean),b=new Set(L(a,!0).split(",").map((f)=>f.trim())),s=i.map((f)=>b.has(f)?` try { ${f}; Object.defineProperty(__scopeRegistration, ${JSON.stringify(f)}, ${
|
|
12
|
+
`}function vt(a,t){let i=mt(a).split(",").map((f)=>f.trim()).filter(Boolean),b=new Set(L(a,!0).split(",").map((f)=>f.trim())),s=i.map((f)=>b.has(f)?` try { ${f}; Object.defineProperty(__scopeRegistration, ${JSON.stringify(f)}, ${rs(f)}); } catch (e) { /* not actually top-level */ }`:` try { __scopeRegistration[${JSON.stringify(f)}] = ${f}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
13
13
|
`);return`
|
|
14
14
|
// Register scope variables for STX runtime
|
|
15
15
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
@@ -44,11 +44,11 @@ ${s}
|
|
|
44
44
|
}
|
|
45
45
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
46
46
|
}
|
|
47
|
-
})();`;return c+a+i}function It(a,t){if(
|
|
48
|
-
${S}`}if(dt&&!K){P=!0,M=ut(r,t);let
|
|
49
|
-
`;continue}if(K)try{let{extractVariables:
|
|
50
|
-
`}}if(F.length>0){let{interpolateScriptExpressions:y}=await import("./chunk-
|
|
47
|
+
})();`;return c+a+i}function It(a,t){if(W(a)){let b=W(a).tag.match(/data-stx-scope="([^"]*)"/);if(b)return{html:a,mergedIntoExisting:b[1],stamped:!0,root:"body"};return{html:Ge(a,(s,f)=>`<body${f} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],b=c[2].slice(1),s=i.match(/data-stx-scope="([^"]*)"/);if(s)return{html:a,mergedIntoExisting:s[1],stamped:!0,root:b};let f=c[1],e=c[2],D=c[3];return{html:`${f}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:b}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=A.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function up(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function kl(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],b=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,f;while((f=s.exec(c))!==null){let e=f[1]==="/",D=f[2],Z=f[3]==="/"||Tt.has(D.toLowerCase());if(e){b=Math.max(0,b-1);continue}if(b===0)i.push(D);if(!Z)b++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var qe=new B(500),oa=new Set;function dp(){oa.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return oa}async function Mr(a,t,c,i,b,s=new Set){let f=i.partialsDir||A.join(A.dirname(c),"partials");if(f&&!A.isAbsolute(f))f=A.resolve(process.cwd(),f);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(h,R,x)=>{let g=R.trim(),r=`${c}:${g}`;if(D.has(r))return"";return D.add(r),R});{let h=/@includeIf\s*\(/g,R;while((R=h.exec(e))!==null){let x=R.index,g=x+R[0].length-1,r=1,_=g+1;while(_<e.length&&r>0){if(e[_]==="(")r++;else if(e[_]===")")r--;_++}if(r!==0)break;let d=e.substring(g+1,_-1),o=d.match(/^\s*['"]([^'"]+)['"]/);if(!o){h.lastIndex=_;continue}let O=o[1],z=Z(O,f,c),v="";if(z&&await Bun.file(z).exists())b.add(z),v=`@include(${d})`;e=e.substring(0,x)+v+e.substring(_),h.lastIndex=0}}for(let[h,R]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),g;while((g=x.exec(e))!==null){let r=g.index,_=r+g[0].length-1,d=1,o=_+1;while(o<e.length&&d>0){if(e[o]==="(")d++;else if(e[o]===")")d--;o++}if(d!==0)break;let O=e.substring(_+1,o-1),z=at(O,0);if(z===-1){x.lastIndex=o;continue}let v=O.substring(0,z).trim(),X=O.substring(z+1).trim(),F=X.match(/^\s*['"]([^'"]+)['"]/);if(!F){x.lastIndex=o;continue}let w=F[1],J=X.substring(F[0].length),N,I=at(J,0);if(I!==-1)N=J.substring(I+1).trim();try{let M=`Boolean(${v})`,P;if(p(M)){let ot=u(M,Object.keys(t));P=Boolean(ot(...Object.values(t)))}else P=Boolean(l(M,t));let tt=R?!P:P,rt="";if(tt){let ot=Z(w,f,c);if(ot&&await Bun.file(ot).exists())b.add(ot);rt=`@include('${w}'${N?`, ${N}`:""})`}e=e.substring(0,r)+rt+e.substring(o),x.lastIndex=0}catch(M){let P=M instanceof Error?M.message:String(M),tt=m("Include",`Error evaluating ${h} condition: ${P}`,c,a,r);e=e.substring(0,r)+tt+e.substring(o),x.lastIndex=0}}}{let h=/@each\s*\(/g,R;while((R=h.exec(e))!==null){let x=R.index,g=x+R[0].length-1,r=1,_=g+1;while(_<e.length&&r>0){if(e[_]==="(")r++;else if(e[_]===")"){if(r--,r===0)break}_++}if(r!==0)break;let d=e.substring(g+1,_),o=e.substring(x,_+1),O=d.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){h.lastIndex=0,e=e.replace(o,"");continue}let[,z,v,X,F]=O;try{let w,J=v.trim();if(p(J))w=u(J,Object.keys(t))(...Object.values(t));else w=l(J,t);let N="";if(Array.isArray(w)&&w.length>0)for(let I of w){let M={...t,[X]:I},P=await et(z,M,a,x);N+=P}else if(F)N=await et(F,{},a,x);e=e.substring(0,x)+N+e.substring(_+1),h.lastIndex=0}catch(w){let J=w instanceof Error?w.message:String(w);e=e.substring(0,x)+m("Each",`Error in @each: ${J}`,c,a,x)+e.substring(_+1),h.lastIndex=0}}}{let h=/@includeFirst\s*\(/g,R;while((R=h.exec(e))!==null){let x=R.index,g=x+R[0].length-1,r=1,_=g+1;while(_<e.length&&r>0){if(e[_]==="(")r++;else if(e[_]===")"){if(r--,r===0)break}_++}if(r!==0)break;let d=e.substring(g+1,_),o=e.substring(x,_+1),O=d.match(/^\s*(\[[^\]]+\])/);if(!O){h.lastIndex=0,e=e.replace(o,"");continue}let z=O[1],v=d.slice(O[0].length),X,F=v.match(/^\s*,\s*\{/);if(F){v=v.slice(F[0].length-1);let N=1,I=1;while(I<v.length&&N>0){if(v[I]==="{")N++;else if(v[I]==="}"){if(N--,N===0)break}I++}X=v.substring(0,I+1),v=v.slice(I+1)}let w,J=v.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)w=J[1];try{let N=JSON.parse(z.replace(/'/g,'"')),I={};if(X)try{I=E(X,t)}catch(P){let tt=P instanceof Error?P.message:String(P);if(i.debug){let rt=m("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>rt)}else e=e.replace(o,()=>w||"");continue}let M=!1;for(let P of N){let tt=Z(P,f,c);if(!tt)continue;if(await n(tt)){let rt=await et(P,I,a,x);e=e.replace(o,()=>rt),M=!0;break}}if(!M)if(w!==void 0)e=e.replace(o,()=>w);else if(i.debug){let P=m("Include",`None of the includeFirst paths exist: ${z}`,c,a,x,o);e=e.replace(o,()=>P)}else e=e.replace(o,"")}catch(N){let I=N instanceof Error?N.message:String(N),M=m("Include",`Error processing @includeFirst: ${I}`,c,a,x,o);e=e.replace(o,()=>M)}h.lastIndex=0}}function Z(h,R,x){try{let g=h;if(!h.endsWith(".stx"))g=`${h}.stx`;let r=A.resolve(R),_=A.resolve(A.dirname(x)),d;if(!g.startsWith("./")&&!g.startsWith("../")){for(let F of i._layerPartialDirs??[]){let w=A.resolve(F,g);if(w.startsWith(`${A.resolve(F)}${A.sep}`)&&St(w))return w}d=A.resolve(R,g)}else d=A.resolve(_,g);let o=A.normalize(d),O=o.startsWith(r+A.sep)||o===r,z=o.startsWith(_+A.sep)||o===_,v=!1,X=A.dirname(_);if(o.startsWith(X+A.sep)){if(!A.relative(X,o).split(A.sep).some((N)=>N.startsWith(".")&&N!=="."&&N!==".."))v=!0}if(!O&&!z&&!v)return console.error(`Security: Path traversal attempt blocked for include path: ${h}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${r}, ${_}`),null;return o}catch(g){return console.error(`Error resolving path ${h}: ${g}`),null}}let it=A.resolve(c);s.add(it);function j(h,R,x,g){return i.onIncludeError?.({includePath:h,templatePath:c,message:R,partialsDir:f}),m("Include",R,c,x,g)}async function et(h,R={},x,g){let r=Z(h,f,c);if(!r)return j(h,`Could not resolve path for include: ${h}`,x,g);let _=A.resolve(r);if(s.has(_)){let d=[...s,_].map((o)=>A.basename(o)).join(" -> ");return j(h,`Circular include detected: ${d}`,x,g)}try{b.add(r);let d;if(!d)try{d=await Bun.file(r).text()}catch(y){let q=y instanceof Error?y.message:String(y);return j(h,`Error loading include file ${h}: ${q}`,x,g)}if(d)d=d.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(d&&d.includes("@stream")){let{processStreamDirectives:y}=await import("./chunk-7kznee1g.js");d=y(d,t)}if(d&&(i.debug||!C()&&!bn()))try{let{warnUnbalancedTags:y}=await import("./chunk-p4jkswz8.js");y(d,r)}catch{}try{let{processESImports:y}=await import("./chunk-eq5jzaj5.js");d=await y(d,t,r,i,b)}catch(y){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${r}:`,y instanceof Error?y.message:y)}let o=d,O=le(o);if(O)o=O.content.trim();let v=d.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),X="";if(v)X=`<style${v[1]}>${v[2]}</style>`;let F=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(y,q,S)=>{if(!ft(q))return"";return F.push({attrs:q,body:S}),`__STX_DATA_BLOCK_${F.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let w={...t};w.__stx_signals_gate=ve(d,r);for(let[y,q]of Object.entries(R))w[y]=q;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,N=[...d.matchAll(J)].sort((y,q)=>{let S=(y[1]||"").includes("server"),K=(q[1]||"").includes("server");return Number(K)-Number(S)}),I="",M=null,P=!1,tt=!1;for(let y of N){let q=y[1]||"",S=y[2]||"";if(ft(q))continue;let K=q.includes("server"),wt=De(q);if(!K&&!/\bsrc\s*=/i.test(q))Ae(S,r,i.strict);if(!K&&S.trim()){let{interpolateScriptExpressions:U}=await import("./chunk-z97bwx8m.js");S=U(S,w,h)}let ct="";try{let{extractAndStripCssImports:U,renderVendorStyleTags:Q}=await import("./chunk-w8t31bn9.js"),nt=U(S,{filePath:r,projectRoot:process.cwd()});S=nt.code,ct=Q(nt.styles)}catch(U){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${r}:`,U instanceof Error?U.message:U)}if(wt&&S.trim())S=Me(S);if(!K){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-w8t31bn9.js");S=Q(S).code;let{hasUserImports:nt,bundleClientScript:bt}=await import("./chunk-2a775q7x.js");if(nt(S))S=await bt(S,r,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${r}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:U}=await import("./chunk-fr39emcz.js");S=U(S)}let dt=$t(S);if(!K){let{extractBridgeData:U,generateServerDataBridge:Q}=await import("./chunk-w8t31bn9.js"),nt=Q(S,U(w));if(nt)S=`${nt}
|
|
48
|
+
${S}`}if(dt&&!K){P=!0,M=ut(r,t);let U=T(S),Q=gt(U,M);I+=`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${M}">${Q}</script>
|
|
49
|
+
`;continue}if(K)try{let{extractVariables:U}=await import("./chunk-902qnyg0.js");await U(S,w,r)}catch(U){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${r}:`,U)}if(!K&&!dt){let U=q.replace(/\bclient\b/i,"").trim();M=ut(r,t);let Q=T(S),nt=gt(Q,M);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(nt))tt=!0;I+=`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${M}"${U?` ${U}`:""}>${nt}</script>
|
|
50
|
+
`}}if(F.length>0){let{interpolateScriptExpressions:y}=await import("./chunk-z97bwx8m.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(q,S)=>{let K=F[Number(S)];return`<script${K.attrs}>${y(K.body,w,h)}</script>`})}if(M){let y=It(o,M);if(o=y.html,y.mergedIntoExisting){let S=M,K=y.mergedIntoExisting;I=I.split(`'${S}'`).join(`'${K}'`).split(`"${S}"`).join(`"${K}"`),M=K}else if(!y.stamped&&P&&!lt.has(r))lt.add(r),console.warn(`[stx] ${A.relative(process.cwd(),r)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(y.stamped&&y.root!=="body"&&(P||tt)&&!pt.has(r)){let S=kl(o);if(S.length>1)pt.add(r),console.warn(`[stx] ${A.relative(process.cwd(),r)} declares ${P?"signals":"bindings"} and has ${S.length} top-level elements (${S.map((K)=>`<${K}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let q=y.stamped&&y.root!==null&&cr(y.root);I=Rt(I,q?M:null)}if(o.includes("@include")||o.includes("@partial"))o=await Mr(o,w,r,i,b,s);let{processLoops:rt,reportDeferredLoopWarnings:ot}=await import("./chunk-e36pne7n.js"),G=rt(o,w,r,void 0,!0);G=ne(G,w,r),G=ot(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-fsq13amm.js");if(G=ht(G,w,r,i),G=_t(G,w,r),G=xt(G,w,r,i),G=k(G,w,r),X)G+=`
|
|
51
51
|
`+X;if(I)G+=`
|
|
52
|
-
`+I;return G}catch(d){if(d instanceof
|
|
52
|
+
`+I;return G}catch(d){if(d instanceof H)throw d;let o=d instanceof Error?d.message:String(d);return j(h,`Error processing include ${h}: ${o}`,x,g)}}let Y=/@include\s*\(/g,V;while((V=Y.exec(e))!==null){let h=V.index,R=h+V[0].length-1,x=1,g=R+1;while(g<e.length&&x>0){if(e[g]==="(")x++;else if(e[g]===")")x--;g++}if(x!==0)break;let r=e.substring(h,g),_=e.substring(R+1,g-1),d=_.match(/^\s*['"]([^'"]+)['"]/);if(!d){Y.lastIndex=g;continue}let o=d[1],O,z=_.substring(d[0].length),v=at(z,0);if(v!==-1)O=z.substring(v+1).trim();let X={};if(O)try{X=E(O,t)}catch(w){let J=w instanceof Error?w.message:String(w);e=e.replace(r,m("Include",`Error parsing include variables for ${o}: ${J}`,c,a,h)),Y.lastIndex=0;continue}let F=await et(o,X,a,h);e=e.substring(0,h)+F+e.substring(g),Y.lastIndex=0}return e}function Lr(a,t){let c=a;function i(b,s,f,e){let D=b,Z=!0;while(Z){Z=!1;let it=new RegExp(`@${s}\\(['"]([^'"]+)['"]\\)`),j=D.match(it);if(!j||j.index===void 0)break;let et=j.index,Y=j[1],V=et+j[0].length,h=new RegExp(`@${s}\\(`),R=new RegExp(`@${f}(?![a-z])`),x=1,g=V,r=-1;while(x>0&&g<D.length){let d=D.slice(g),o=d.match(h),O=d.match(R),z=o?g+o.index:1/0,v=O?g+O.index:1/0;if(z<v)x++,g=z+(o[0].length||1);else if(v<1/0){if(x--,x===0){r=v;break}g=v+f.length+1}else break}if(r===-1)break;let _=D.slice(V,r);if(!t[Y])t[Y]=[];if(e)t[Y].unshift(_);else t[Y].push(_);D=D.substring(0,et)+D.substring(r+`@${f}`.length),Z=!0}return D}return c=i(c,"push","endpush",!1),c=i(c,"prepend","endprepend",!0),c}function jr(a,t){return a.replace(/@stack\(['"]([^'"]+)['"]\)/g,(c,i)=>{if(!t[i]||t[i].length===0)return"";return t[i].join(`
|
|
53
53
|
`)})}
|
|
54
|
-
export{
|
|
54
|
+
export{up,kl,qe,oa,dp,Mr,Lr,jr};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{V}from"./chunk-506mv7hb.js";import Oe 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 G(e){for(let[n,r]of Object.entries(t))if(r===e)return n;return}import st from"path";var ot={showRelativePaths:!1,enableAutoRecovery:V(),logRecoveryWarnings:!0},Y={...ot};function N(){return{...Y}}function M(e){if(!Y.showRelativePaths||!e)return e;let n=Y.baseDir||process.cwd();try{let r=st.relative(n,e);return r.startsWith("..")?e:r}catch{return e}}class L extends Error{code;filePath;line;column;context;numericCode;constructor(e,n,r,i,s,o,c){super(e);this.code=n;this.filePath=r;this.line=i;this.column=s;this.context=o;if(this.name="StxError",this.numericCode=c||t.EVALUATION_ERROR,this.filePath)this.filePath=M(this.filePath)}}class oe extends L{constructor(e,n,r,i,s,o){super(e,"stx_RUNTIME_ERROR",n,r,i,s,o||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class dr extends L{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 H extends L{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 me(e){let{type:n,message:r,code:i,filePath:s,line:o,column:c,template:g,offset:d,snippet:f,suggestion:h,format:m="text"}=e,y=o,x=c;if(!y&&g&&d!==void 0){let K=pt(g,d);y=K.line,x=K.column}let k=s?M(s):void 0,S=i?G(i):void 0,C={type:n,code:i,codeName:S,message:r,filePath:k,line:y,column:x,snippet:f,suggestion:h,timestamp:new Date().toISOString()},T;switch(m){case"html":T=ct(C);break;case"json":T=JSON.stringify(C,null,2);break;case"console":T=lt(C,g,d);break;case"text":default:T=at(C,g,d);break}return{formatted:T,data:C}}function at(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=ut(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,15 +17,15 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
17
17
|
`)}function gt(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),c="\x1B[90m",g="\x1B[31m",d="\x1B[0m",f=[];for(let h=s;h<=o;h++){let m=(h+1).toString().padStart(4),y=h===n-1,x=y?"\x1B[31m>\x1B[0m":" ",k=y?`\x1B[31m${i[h]}\x1B[0m`:`\x1B[90m${i[h]}\x1B[0m`;f.push(`${x}\x1B[90m${m}\x1B[0m | ${k}`)}return f.join(`
|
|
19
19
|
`)}function de(e){return e.replace(/--/g,"- -").replace(/>/g,">")}function pt(e,n){let i=e.substring(0,n).split(`
|
|
20
|
-
`);return{line:i.length,column:i[i.length-1].length}}function a(e,n,r){return me({type:e,message:n,code:r,format:"html"}).formatted}async function we(e,n,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return n}}var
|
|
21
|
-
@end${g}`;i.push(`Added ${h} missing @end${g}`)}}if(i.length>0&&n.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((g)=>console.warn(` - ${g}`)),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 a(e,n,r){return me({type:e,message:n,code:r,format:"html"}).formatted}async function we(e,n,r){try{return await e()}catch(i){if(r&&i instanceof Error)r(i);return n}}var Ho={isEnabled(){return N().enableAutoRecovery},fixCommonSyntaxErrors(e){let n=N();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 g=s-o;r+="}}".repeat(g),i.push(`Added ${g} missing closing braces '}}'`)}let c=["if","foreach","for","switch","section"];for(let g of c){let d=(r.match(new RegExp(`@${g}\\b`,"g"))||[]).length,f=(r.match(new RegExp(`@end${g}\\b`,"g"))||[]).length;if(d>f){let h=d-f;for(let m=0;m<h;m++)r+=`
|
|
21
|
+
@end${g}`;i.push(`Added ${h} missing @end${g}`)}}if(i.length>0&&n.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),i.forEach((g)=>console.warn(` - ${g}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:i}},createFallbackContent(e,n){if(V())return`<!-- ${e} failed: ${n.message} -->`;return"<!-- stx rendering error -->"}};class J{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((c)=>({timestamp:c.timestamp.toISOString(),level:c.level||"error",type:c.error.constructor.name,message:c.error.message,stack:c.error.stack,context:c.context}));r.writeFileSync(e,JSON.stringify(o,null,2),"utf-8")}else{let o=this.errors.map((c)=>this.formatEntry(c));r.writeFileSync(e,o.join(`
|
|
26
26
|
|
|
27
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var D=new J,hn={isDevelopment(){return
|
|
28
|
-
`)}};function w(e,n,r,i=0){let s=0,o=i,c=null,g=0,d=!1;while(o<e.length){let f=e[o];if(c&&d){d=!1,o++;continue}if(c&&f==="\\"){d=!0,o++;continue}if(d=!1,(f==='"'||f==="'"||f==="`")&&!c){c=f,o++;continue}if(f===c&&c!=="`"){c=null,o++;continue}if(c==="`"&&f==="$"&&e[o+1]==="{"){g++,o+=2;continue}if(g>0&&f==="}"){g--,o++;continue}if(f==="`"&&c==="`"&&g===0){c=null,o++;continue}if(c){o++;continue}if(f===n)s++;else if(f===r){if(s--,s===0)return o}o++}return-1}var ft={maxSanitizeDepth:10,allowBracketNotation:!1},ke={...ft};var j=/\bnew\s+/,
|
|
27
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var D=new J,hn={isDevelopment(){return V()},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
|
+
`)}};function w(e,n,r,i=0){let s=0,o=i,c=null,g=0,d=!1;while(o<e.length){let f=e[o];if(c&&d){d=!1,o++;continue}if(c&&f==="\\"){d=!0,o++;continue}if(d=!1,(f==='"'||f==="'"||f==="`")&&!c){c=f,o++;continue}if(f===c&&c!=="`"){c=null,o++;continue}if(c==="`"&&f==="$"&&e[o+1]==="{"){g++,o+=2;continue}if(g>0&&f==="}"){g--,o++;continue}if(f==="`"&&c==="`"&&g===0){c=null,o++;continue}if(c){o++;continue}if(f===n)s++;else if(f===r){if(s--,s===0)return o}o++}return-1}var ft={maxSanitizeDepth:10,allowBracketNotation:!1},ke={...ft};var j=/\bnew\s+/,z="__stx_safe_ctors",ve=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],Z=[...ve,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],he=Z.map(()=>{return}),Q=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})),te=[/\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*\(/,j,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],ne=new Set([...ve,"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",z]),re=new Set(["__proto__","constructor","prototype"]);function $e(e){let n="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let c=e[o];if(s){s=!1;continue}if(c==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&c==="$"&&o+1<e.length&&e[o+1]==="{"){let g=1;o+=2;while(o<e.length&&g>0){if(e[o]==="{")g++;else if(e[o]==="}")g--;if(g>0)n+=e[o],r.push(o),o++}continue}if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}n+=c,r.push(o)}return{text:n,map:r}}function Re(e){return $e(e).text}var Ce=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Ae=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of Ce)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),dt=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,ye=/(?<![\w$])new(?![\w$])/g,Ee=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Ce.join(",")}}() are allowed`;function mt(e){let{text:n,map:r}=$e(e),i=[];ye.lastIndex=0;let s;while((s=ye.exec(n))!==null){let c=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,c)))continue;let g=dt.exec(n.slice(c)),d=g?.[3],f=!g?null:d?`Intl_${d}`:g[2];if(!g||!f||!(f in Ae))throw new v(`matched /${j.source}/; ${Ee}`,e);let h=c+g[0].length,m=r[c],y=r[h-1]+1;if(e.slice(m,y)!==n.slice(c,h))throw new v(`matched /${j.source}/; ${Ee}`,e);let x=m+3+g[1].length;i.push({start:x,end:x+g[2].length,key:f})}let o=e;for(let c=i.length-1;c>=0;c--){let g=i[c];o=`${o.slice(0,g.start)}${z}.${g.key}${o.slice(g.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class v 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 vs(e){try{return ie(e),null}catch(n){return n instanceof v?n.rule:n instanceof Error?n.message:String(n)}}function Te(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(ne.has(s))throw new v(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&re.has(s))throw new v(`matched /.${s}/; property ${s}`,n)}}function _e(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("["),c=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(c))continue;let g=s[1].trim(),d=/^'(?:[^'\\]|\\.)*'$/.test(g),f=/^"(?:[^"\\]|\\.)*"$/.test(g);if(/^\d+$/.test(g))continue;if(d||f){let m=g.slice(1,-1);if(re.has(m))throw new v(`bracket key ${m}`,e);if(!ke.allowBracketNotation)throw new v("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(g)){i.add(g);continue}throw new v("dynamic bracket notation is not allowed",e)}return[...i]}function ie(e){let n=e.trim(),r=Re(n);Te(r,n);let i=_e(n);for(let s of te){if(s===j)continue;if(s.test(r))throw new v(`matched /${s.source}/`,n)}return{...mt(n),dynamicKeys:i}}function zo(e){return ie(e),e.trim()}var ws=Symbol("stx.sanitizeCache");function B(e){let n={},r=e[ws];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=Q,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("__")||te.some((o)=>o.test(i)))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=ee(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function ee(e,n=0){if(n>=ke.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>ee(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]=ee(s,n+1);else r[i]=s}return r}function l(e,n){try{let r=B(n),i=Object.keys(r),s=Object.values(r);return u(e,i)(...s)}catch{return}}function p(e){try{return zo(e),!0}catch{return!1}}function ec(e,n){try{let r=B(n),i=Object.keys(r),s=Object.values(r),o=!1,g=u(e,i,()=>{o=!0})(...s);return!o&&Boolean(g)}catch{return!1}}function E(e,n){try{let r=l(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Ie=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"]),ht=2000,F=new Map;function be(e,n){let r=`${e.join(",")}\x00${n}`,i=F.get(r);if(i)return i;let s=Function(...e,n);if(F.size>=ht)F.clear();return F.set(r,s),s}function tt(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 yt=/^[A-Za-z_$][\w$]*$/;function Nt(e){return yt.test(e)&&!Ie.has(e)}function u(e,n,r){let{source:i,usesSafeConstructors:s,dynamicKeys:o}=ie(e),c=[];for(let m=0;m<n.length;m++){if(!Nt(n[m]))continue;if(n[m]===z||n[m]==="Object"||ne.has(n[m]))continue;c.push({key:n[m],index:m})}c.sort((m,y)=>m.key.localeCompare(y.key));let g=c.map((m)=>m.key),d=c.map((m)=>m.index),f=`
|
|
29
29
|
'use strict';
|
|
30
30
|
try {
|
|
31
31
|
return ${i};
|
|
@@ -36,11 +36,11 @@ catch (e) {
|
|
|
36
36
|
}
|
|
37
37
|
throw e;
|
|
38
38
|
}
|
|
39
|
-
`;return Et(bt(s?(m)=>{let y=be([
|
|
40
|
-
`:c==="t"?"\t":c;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var xt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Lt(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=
|
|
41
|
-
${i}${e.slice(r)}`}var ce=
|
|
42
|
-
${o[0]}${e.slice(r,o.index)}${e.slice(c,s)}${e.slice(s)}`}function
|
|
43
|
-
${n[0]}${i.slice(s)}`}var He="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",
|
|
39
|
+
`;return Et(bt(s?(m)=>{let y=be([z,"Object",...Z,...g,...m],f);return(...x)=>y(Ae,Q,...he,...x)}:(m)=>{let y=be(["Object",...Z,...g,...m],f);return(...x)=>y(Q,...he,...x)},g,n,c,d,r),n,o)}function Et(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 c=s[o];if(typeof c==="string"&&re.has(c))return}return e(...s)}}function bt(e,n,r,i,s,o){let c=e([]),g=i.every((f,h)=>f.index===h);if(n.length===r.length&&g)return Se(c,n,e,void 0,o);return Se((...f)=>{let h=Array(s.length);for(let m=0;m<s.length;m++)h[m]=f[s[m]];return c(...h)},n,e,(f)=>{c=e(f)},o)}function Se(e,n,r,i,s){let c=/^(\w+) is not defined$/,g=e,d=[],f=new Set(n);return(...h)=>{for(let m=0;m<=8;m++)try{return g(...h)}catch(y){let x=y instanceof Error?y.message:"",k=c.exec(x);if(!(y instanceof ReferenceError)||!k)return;let S=k[1];if(f.has(S)||Ie.has(S)||ne.has(S))return;if(s?.(S),f.add(S),d.push(S),i)i(d);else g=r(d)}return}}function xs(e){let n=e.trim();try{let r=Re(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;Te(r,n),_e(n);for(let i of te)if(i.test(r))return!1}catch{return!1}return!0}function Vo(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,c=w(e,"(",")",o);if(c===-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:c+1,args:e.slice(o+1,c),call:e.slice(s,c+1)}),n.lastIndex=c+1}return r}function Dt(e,n,r,i){let s="",o=0;for(let c of Vo(e,n)){if(s+=e.slice(o,c.start),c.end===-1){s+=i(c.call),o=c.start;continue}s+=r(c.args,c.call),o=c.end}return s+e.slice(o)}function Mt(e){let n=[],r=0,i=null,s="";for(let o=0;o<e.length;o++){let c=e[o];if(i){if(s+=c,c==="\\"&&o+1<e.length){s+=e[++o];continue}if(c===i)i=null;continue}if(c==="'"||c==='"'||c==="`")i=c;else if(c==="("||c==="["||c==="{")r++;else if(c===")"||c==="]"||c==="}")r--;else if(c===","&&r===0){n.push(s.trim()),s="";continue}s+=c}if(s.trim())n.push(s.trim());return n}function ae(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 c=n[++s];i+=c==="n"?`
|
|
40
|
+
`:c==="t"?"\t":c;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var xt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Lt(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=vs(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=B(n),o;try{o=u(r,Object.keys(s))(...Object.values(s))}catch(g){return{ok:!1,message:`the expression could not be evaluated: ${g instanceof Error?g.message:String(g)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let c=[...new Set(tt(r))].filter((g)=>!xt.has(g)&&!(g in s)&&!(g in globalThis));if(c.length>0)return{ok:!1,message:`${c.map((d)=>`"${d}"`).join(", ")} ${c.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 Be(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 nt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Le(e){if(!e)return"";return Oe.isAbsolute(e)?Oe.relative(process.cwd(),e)||e:e}function se(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function P(e,n,r,i,s=t.EVALUATION_ERROR){let o=i?` in ${Le(i)}`:"";return console.warn(`[stx] ${se(n)}${o}: ${r}`),a(e,`${se(n)}: ${r}`,s)}function Ss(e,n,r){let i=r?` in ${Le(r)}`:"";console.warn(`[stx] ${se(e)}${i}: ${n}`)}function Uo(){return{afterOpen:[],beforeClose:[]}}function wt(e){return e.afterOpen.length>0||e.beforeClose.length>0}function tc(e,n){if(!wt(n))return e;let r=n.afterOpen.join(""),i=n.beforeClose.join(""),s=e.lastIndexOf("</head>"),o=r?pr(e):null,c=i&&s!==-1?s:null;if(o===null&&c===null)return e;if(o!==null&&c!==null)return`${e.slice(0,o)}${r}${e.slice(o,c)}${i}${e.slice(c)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,c)}${i}${e.slice(c)}`}var Ne=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function pr(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;Ne.lastIndex=r;let i=Ne.exec(e);return i?r+i[0].length:r}var le="data-stx-color-mode-boot",Me="__STX_COLOR_MODE__",St=new Set(["light","dark","auto","system"]),kt=new Set(["auto","system"]),vt=/^[a-z][\w:-]*$/i,$t=/^[\w-]+$/;function Rt(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,c=e.respectExisting===!0;if(typeof n!=="string"||n.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!St.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"||!$t.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"||!vt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!kt.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(c&&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:c}}function Ct(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ue(e={}){let n=Rt(e),r=Ct(n),i=`(function(){"use strict";var o=window.${Me};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.${Me}={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 ${le}>${i}</script>`}function fr(e,n={}){if(e.includes(le))return e;let r=ce(e);if(r===null)return e;let i=ue(n);return`${e.slice(0,r)}
|
|
41
|
+
${i}${e.slice(r)}`}var ce=pr,At=new RegExp(`<script\\b[^>]*\\b${le}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),Pe=/<meta\b[^>]*\bcharset\b[^>]*>/gi,De=/<\/head>/gi;function Tt(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;De.lastIndex=r;let i=De.exec(e),s=i?i.index:e.length;Pe.lastIndex=r;let o=Pe.exec(e);if(!o||o.index>=s)return e;if(e.slice(r,o.index).trim()==="")return e;let c=o.index+o[0].length;return`${e.slice(0,r)}
|
|
42
|
+
${o[0]}${e.slice(r,o.index)}${e.slice(c,s)}${e.slice(s)}`}function nc(e){return _t(Tt(e))}function _t(e){let n=At.exec(e);if(!n)return e;let r=ce(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=ce(i);if(s===null)return e;return`${i.slice(0,s)}
|
|
43
|
+
${n[0]}${i.slice(s)}`}var He="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",U="data-stx-html-attrs",W="data-stx-html-class",Ue=/^[A-Za-z_:][\w:.-]*$/;function R(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function It(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function rt(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 Ot(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}="${R(String(i))}"`).join(" ")}function X(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 Ve(e){let n=_(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${X(e)}</script>`}function Pt(e={},n="en"){let r=[],i=[],s="",o=n;for(let[g,d]of Object.entries(e||{})){if(d==null)continue;let f=g.trim();if(!Ue.test(f))continue;let h=f.toLowerCase();if(h==="lang"){o=String(d);continue}if(h==="class"){s=String(d).trim();continue}r.push(` ${f}="${R(String(d))}"`),i.push(f)}let c=` lang="${R(o)}"`;if(s)c+=` class="${R(s)}"`;if(c+=r.join(""),s)c+=` ${W}="${R(s)}"`;if(i.length)c+=` ${U}="${R(i.join(" "))}"`;return c}function rc(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 gr(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,c;while((c=o.exec(r[1]))!==null){let h=c[1];if(!(h in i))s.push(h);i[h]=c[2]??c[3]??c[4]??""}let g=[],d=[];for(let[h,m]of Object.entries(n)){if(m==null)continue;let y=h.trim();if(!Ue.test(y))continue;let x=y.toLowerCase();if(x==="class"){let k=(i.class||"").split(/\s+/).filter(Boolean);for(let S of String(m).split(/\s+/).filter(Boolean))if(!k.includes(S))k.push(S),g.push(S);if(!("class"in i))s.push("class");i.class=k.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(m),x!=="lang")d.push(y)}if(g.length){if(!(W in i))s.push(W);i[W]=g.join(" ")}if(d.length){if(!(U in i))s.push(U);i[U]=d.join(" ")}let f=s.map((h)=>` ${h}="${R(i[h])}"`).join("");return e.replace(r[0],()=>`<html${f}>`)}function sc(e){if(e.includes("data-stx-cloak"))return null;if(e.lastIndexOf("</head>")===-1)return null;return`${He}
|
|
44
44
|
`}function Ft(e){let n=[],r=0;while(r<e.length){let o=e.slice(r),c=o.match(/^\s+/);if(c){r+=c[0].length;continue}if(o.startsWith("<!--")){let m=e.indexOf("-->",r);if(m===-1)break;r=m+3;continue}let g=o.match(/^<script\b[^>]*>/i);if(g){let m=e.toLowerCase().indexOf("</script>",r+g[0].length);if(m===-1)break;r=m+9;continue}let d=o.match(/^<link\b[^>]*>/i);if(d){n.push(d[0]),r+=d[0].length;continue}let f=o.match(/^<meta\b[^>]*>/i);if(f){n.push(f[0]),r+=f[0].length;continue}let h=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(h){n.push(h[0]),r+=h[0].length;continue}break}if(n.length===0)return{body:e,hoisted:n};let i="",s=0;while(s<e.length&&s<r){let o=e.slice(s),c=o.match(/^<link\b[^>]*>/i);if(c&&n.includes(c[0])){s+=c[0].length;continue}let g=o.match(/^<meta\b[^>]*>/i);if(g&&n.includes(g[0])){s+=g[0].length;continue}let d=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(d&&n.includes(d[0])){s+=d[0].length;continue}i+=e[s],s++}return i+=e.slice(r),{body:i,hoisted:n}}function jt(e,n={},r={}){let{title:i="stx App",lang:s="en",meta:o=[],link:c=[],script:g=[],headRaw:d="",htmlAttrs:f={},bodyClass:h="",bodyAttrs:m={}}=n,y=r.title||i,x=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],k=new Set(o.map(rt).filter(Boolean)),{body:S,hoisted:C}=Ft(e),T=new Set(C.flatMap((b)=>{let O=Ot(b);return O?[rt(O)].filter(Boolean):[]})),Ke=[...x.filter((b)=>!k.has(rt(b))),...o].filter((b)=>!T.has(rt(b))).map((b)=>` <meta ${_(b)}>`).join(`
|
|
45
45
|
`),Ge=c.map((b)=>` <link ${_(b)}>`).join(`
|
|
46
46
|
`),Ye=g.map((b)=>{if(b.src)return` <script ${_(b,(O)=>O==="content")}></script>`;if(b.content)return` ${Ve(b)}`;return""}).filter(Boolean).join(`
|
|
@@ -54,8 +54,8 @@ ${et.join(`
|
|
|
54
54
|
${it.join(`
|
|
55
55
|
`)}
|
|
56
56
|
</body>
|
|
57
|
-
</html>`}var ge=/\s+/y,pe=/<(script|style)\b[^>]*>/iy,zt=/<\/script>/gi,Bt=/<\/style>/gi,je=/<!DOCTYPE\b/iy,ze=/<html[\s>]/iy;function yn(e){let n=0;while(n<e.length){if(ge.lastIndex=n,ge.exec(e)){n=ge.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}pe.lastIndex=n;let i=pe.exec(e);if(i){let s=i[1].toLowerCase()==="script"?zt:Bt;s.lastIndex=pe.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(je.lastIndex=n,je.test(e))return!0;return ze.lastIndex=n,ze.test(e)}return!1}function
|
|
57
|
+
</html>`}var ge=/\s+/y,pe=/<(script|style)\b[^>]*>/iy,zt=/<\/script>/gi,Bt=/<\/style>/gi,je=/<!DOCTYPE\b/iy,ze=/<html[\s>]/iy;function yn(e){let n=0;while(n<e.length){if(ge.lastIndex=n,ge.exec(e)){n=ge.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}pe.lastIndex=n;let i=pe.exec(e);if(i){let s=i[1].toLowerCase()==="script"?zt:Bt;s.lastIndex=pe.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(je.lastIndex=n,je.test(e))return!0;return ze.lastIndex=n,ze.test(e)}return!1}function Wo(e){return yn(e)}function oc(e,n={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:c=""}=n,g=e.slice(0,r),d=[];for(let f of i){let h=rt(f);if(h&&g.includes(h))continue;d.push(` <meta ${_(f)}>`)}for(let f of s){if(f.href&&g.includes(`href="${f.href}"`))continue;d.push(` <link ${_(f)}>`)}for(let f of o)if(f.src){if(g.includes(`src="${f.src}"`))continue;d.push(` <script ${_(f,(h)=>h==="content")}></script>`)}else if(f.content){if(g.includes(X(f)))continue;d.push(` ${Ve(f)}`)}if(c&&!g.includes(c))d.push(` ${c}`);if(d.length===0)return e;return`${e.slice(0,r)}${d.join(`
|
|
58
58
|
`)}
|
|
59
|
-
${e.slice(r)}`}function
|
|
60
|
-
`)}function
|
|
61
|
-
`,"")),headContent:n.trim()}}function
|
|
59
|
+
${e.slice(r)}`}function mr(e,n={},r={},i){if(i??Wo(e))return e;return jt(e,n,r)}var Ht=["og:","article:","book:","profile:","fb:","music:","video:"],Ut=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function hr(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=Vt(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=Wt(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,c=n.openGraph,g=n[o]??(nt(c)?c[o]:void 0);i=g===void 0||g===null||typeof g==="object"?"":String(g)}if(!i)return{kind:"empty"};return{kind:"tag",tag:Ht.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function Vt(e,n){let r=ae(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(Ut.test(e.trim()))return e.trim();let i=Lt(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 ${Be(i.value)}`,code:t.TYPE_ERROR};return i.value}function Wt(e,n){let r=ae(e);if(r!==null)return r;let i=Lt(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 ${Be(s)}`,code:t.TYPE_ERROR};return String(s)}var yr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],ks=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],qe={links:"link",metas:"meta",scripts:"script",styles:"style"},We=new Set,Xe=new WeakMap;function fe(e){if(We.has(e))return;We.add(e),console.warn(e)}function Xt(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 c=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===n[o-1]?0:1)),s=c}}return r[n.length]}function qt(e,n){let r=e.toLowerCase(),i=n.find((d)=>d.toLowerCase()===r);if(i)return i;let s=qe[r];if(s&&n.includes(s))return s;let o,c=1/0;for(let d of n){let f=Xt(r,d.toLowerCase());if(f<c)o=d,c=f}let g=Math.min(e.length,o?.length??0)<=4?1:2;return c<=g?o:void 0}function xe(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Xe.get(e);if(r)return r;let{known:i,source:s}=n,o=e;for(let c of Object.keys(e)){if(i.includes(c))continue;let g=qe[c];if(g&&i.includes(g)&&Array.isArray(e[c])){if(o===e)o={...e};let f=Array.isArray(o[g])?o[g]:[];o[g]=[...f,...e[c]],delete o[c],fe(`[stx] ${s}.${c} is not a head key; reading it as ${s}.${g}. Rename it to \`${g}\`.`);continue}if(/^styles?$/.test(c)&&!i.includes("style")){fe(`[stx] ${s}.${c} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let d=qt(c,i);fe(d?`[stx] ${s}.${c} is not a head key and is ignored. Did you mean \`${d}\`?`:`[stx] ${s}.${c} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return Xe.set(e,o),o}var A={},Kt=[],q={};function qo(){return A}function Mp(){return q}function Lp(){A={},Kt.length=0,q={}}function ic(e){A=Fe(A,xe(e,{known:ks,source:"useHead()"}))}function Fe(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:[...e.meta||[],...n.meta||[]],link:[...e.link||[],...n.link||[]],script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function lu(e){ic(_s(e))}function _s(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let d=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:d})}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,c=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(c){n.push({name:"twitter:image",content:c});let d=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(d)n.push({name:"twitter:image:alt",content:d})}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 d of e.articleTags)n.push({property:"article:tag",content:d});let g=[];if(e.canonical)g.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:g}}function jp(e){if(q={...q,...e},e.title||e.description)lu({title:e.title,description:e.description})}function Bp(e){let n=typeof e==="function"?e():e;ic({title:n})}function Fp(e=A){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(([c,g])=>g!==void 0).map(([c,g])=>{if(typeof g==="boolean")return g?c:"";return`${c}="${I(String(g))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${X(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(`
|
|
60
|
+
`)}function zp(e=A){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function Hp(e=A){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 Vp(e=A){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 Up(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
|
|
61
|
+
`,"")),headContent:n.trim()}}function Wp(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let c=i?s:n[(o||"").trim()]??o,g=n.__stx_runtime_head??{};return n.__stx_runtime_head=Fe(g,{title:c}),""})}function qp(e,n,r=""){if(!e.includes("@meta"))return e;return Dt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=hr(Mt(i),n);if(o.kind==="error")return P("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let c=n.__stx_runtime_head??{};n.__stx_runtime_head=Fe(c,{meta:[o.tag]})}return""},(i)=>P("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{vs,zo,ws,l,p,ec,E,tt,Nt,u,xs,t,oe,dr,H,a,we,Ho,D,hn,w,Vo,Dt,Mt,Lt,Be,nt,P,Ss,Uo,tc,pr,fr,nc,rt,rc,gr,sc,yn,Wo,oc,mr,hr,yr,ks,xe,qo,Mp,Lp,ic,Fe,lu,_s,jp,Bp,Fp,zp,Hp,Vp,Up,Wp,qp};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Zt,Ks,Xs,Js,op,Ys}from"./chunk-hz4x7h0n.js";import"./chunk-am2w363p.js";import"./chunk-4s8zacxg.js";import"./chunk-25zmy8q6.js";export{Xs as buildServerApi,op as createServerApi,Zt as discoverServerApi,Ks as generateApiTypes,Ys as isServerApiSource,Js as productionApiDispatcher};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{le,La,ps,ln,g,Oe,Ne}from"./chunk-f9zyf9n6.js";import{Zn,Xe,N}from"./chunk-srq9fqq8.js";import{Hn,s}from"./chunk-aet1pgw7.js";import{he}from"./chunk-twqzn21x.js";function b(o){return o.endsWith(".md")||o.endsWith(".markdown")}function k(o){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 u;while((u=n.exec(o))!==null){let t=u.index,i=t+u[0].length;if(p?.some((l)=>t>=l.start&&i<=l.end))continue;e.push({start:t,end:i})}}if(e.length===0)return o;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=o.slice(a,n.start),c+=`@raw${o.slice(n.start,n.end)}@endraw`,a=n.end}return c+=o.slice(a),c}async function R(o,e={}){let{data:r,content:m}=Zn(o),a=await(e.renderer??((n)=>Xe(n)))(m);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(o){let e=o,r=le(o);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(i)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(i),u;while((u=m.exec(o))!==null){let i=u[1],l=u[2],d=u[0],f=i.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let i=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=i.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),i.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let i of c)t=t.replace(i,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(o,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -9,10 +9,10 @@ import{ae,Ma,ds,ln,g,Oe,Ne}from"./chunk-kwek8xdt.js";import{Yn,Xe,N}from"./chunk
|
|
|
9
9
|
<body>
|
|
10
10
|
${o}
|
|
11
11
|
</body>
|
|
12
|
-
</html>`}async function
|
|
12
|
+
</html>`}async function Xi(o,e={}){let r=_(o),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(b(r)){let n=await R(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=_(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:u,injectCSS:t,...i}=e,l={...e.context||{}};ln(l);let d=await S(c,r,{...i,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),f=await p.text(),x={...l,content:d},y={...i,context:x,injectCSS:t};return S(f,n,y)}return S(c,r,e)}async function S(o,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=M(o),n={...N,...r.options},p={__filename:e,__dirname:v(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...ps(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let i of c)await g(i,p,e);let u=new Set,t=m;if(t=await s(t,p,e,n,u),La(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 i=p.__stx_event_bindings||[],l=Oe(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await Ne(h[1],{eventBindings:i,templateContent:t,serverData:l,filePath:e})})),x=[await Hn(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
15
|
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${x}`}t=await
|
|
18
|
-
export{
|
|
17
|
+
${x}`}t=await he(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:i}=await import("./chunk-5s1ay9mv.js");t=await i(t)}catch{}return t}
|
|
18
|
+
export{Xi};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{jc,Yu,Bc,Fc,Zu,Qu}from"./chunk-4w6baw62.js";import"./chunk-f9zyf9n6.js";import"./chunk-mwnhdsbp.js";import"./chunk-25zmy8q6.js";import"./chunk-bsajk82t.js";import"./chunk-ce6zddpf.js";import"./chunk-zp79zkkd.js";export{Qu as applySlots,Zu as extractSlotContent,Yu as parseSlotElement,jc as parseSlots,Fc as processSlots,Bc as renderSlot};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Fd,zd}from"./chunk-pqqe2b6m.js";import"./chunk-rv39s5az.js";import"./chunk-hz4x7h0n.js";import"./chunk-md2jn67b.js";import"./chunk-40tswfe7.js";import"./chunk-twqzn21x.js";import"./chunk-hgry3mjd.js";import"./chunk-srq9fqq8.js";import"./chunk-rym0309c.js";import"./chunk-7adznted.js";import"./chunk-am2w363p.js";import"./chunk-5qtthtg3.js";import"./chunk-4s8zacxg.js";import"./chunk-f9zyf9n6.js";import"./chunk-mwnhdsbp.js";import"./chunk-25zmy8q6.js";import"./chunk-bsajk82t.js";import"./chunk-ce6zddpf.js";import"./chunk-zp79zkkd.js";export{zd as clearStoreCache,Fd as getStoreScript};
|