// @bun
var{defineProperty:w,getOwnPropertyNames:F,getOwnPropertyDescriptor:E}=Object,T=Object.prototype.hasOwnProperty;function V(q){return this[q]}var kb=(q)=>{var b=(R??=new WeakMap).get(q),z;if(b)return b;if(b=w({},"__esModule",{value:!0}),q&&typeof q==="object"||typeof q==="function"){for(var k of F(q))if(!T.call(b,k))w(b,k,{get:V.bind(q,k),enumerable:!(z=E(q,k))||z.enumerable})}return R.set(q,b),b},R;var v=(q)=>q;function f(q,b){this[q]=v.bind(null,b)}var qb=(q,b)=>{for(var z in b)w(q,z,{get:b[z],enumerable:!0,configurable:!0,set:f.bind(b,z)})};var x=(q,b)=>()=>(q&&(b=q(q=0)),b);var zb=import.meta.require;function P(q,b){let z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;z.lastIndex=b;let k=z.exec(q);if(!k)return null;return{full:k[0],tag:k[1],attrs:k[2],selfClosing:k[3].includes("/")||d.has(k[1].toLowerCase()),start:k.index,end:k.index+k[0].length}}function o(q,b,z){let k=1,K=z,G=new RegExp(`<${b}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),X=new RegExp(`</${b}\\s*>`,"gi");while(k>0&&K<q.length){G.lastIndex=K,X.lastIndex=K;let Y=G.exec(q),Q=X.exec(q);if(!Q)return-1;if(Y&&Y.index<Q.index)k++,K=Y.index+Y[0].length;else{if(k--,k===0)return Q.index+Q[0].length;K=Q.index+Q[0].length}}return-1}function J(q,b){if(b.selfClosing)return{outerStart:b.start,outerEnd:b.end,innerHTML:""};let z=o(q,b.tag,b.end);if(z===-1)return{outerStart:b.start,outerEnd:b.end,innerHTML:""};return{outerStart:b.start,outerEnd:z,innerHTML:q.slice(b.end,z-`</${b.tag}>`.length)}}function A(q,b){return new RegExp(`(?:^|\\s)${b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(q)||q.includes(` ${b}=`)||q.includes(` ${b} `)||q.trimEnd().endsWith(` ${b}`)}function I(q,b){let z=b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),k=q.match(new RegExp(`${z}="([^"]*)"`,"s"))||q.match(new RegExp(`${z}='([^']*)'`,"s"));return k?k[1]:null}function L(q,b){let z=b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return q.replace(new RegExp(`\\s*${z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${z}(?=\\s|$|>|/)`,"g"),"")}function W(q,b,z){let k=b.selfClosing?" /":"",K=`<${b.tag}${z}${k}>`;return q.slice(0,b.start)+K+q.slice(b.end)}function u(q){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(q)}function i(q){let b=q,z=0;while(z<b.length){let k=P(b,z);if(!k)break;let K=I(k.attrs,"v-for");if(K===null){z=k.end;continue}let G=K.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){z=k.end;continue}let X=G[1].trim(),Y=G[2].trim(),Q;if(X.includes(",")){let C=X.split(",").map((M)=>M.trim()),$=C[0],O=C[1];Q=`${Y} as ${O} => ${$}`}else Q=`${Y} as ${X}`;let _=L(k.attrs,"v-for"),Z=L(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=J(b,k),j=b.slice(U.outerStart,U.outerEnd),B=W(j,{...k,start:0,end:k.end-k.start},Z),S=`@foreach(${Q})
`,y=`${S}${B}
@endforeach`;b=b.slice(0,U.outerStart)+y+b.slice(U.outerEnd),z=U.outerStart+S.length}return b}function h(q){let b=q,z=0;while(z<b.length){let k=P(b,z);if(!k)break;let K=I(k.attrs,"v-if");if(K===null){z=k.end;continue}let G=[],X=J(b,k),Y=L(k.attrs,"v-if"),Q=W(b.slice(X.outerStart,X.outerEnd),{...k,start:0,end:k.end-k.start},Y);G.push({type:"if",expr:K,outerStart:X.outerStart,outerEnd:X.outerEnd,element:Q,parsedTag:k});let _=X.outerEnd,Z=!0;while(Z){let y=b.slice(_).match(/^\s*/),C=y?y[0].length:0,$=P(b,_+C);if(!$){Z=!1;break}let O=I($.attrs,"v-else-if"),M=A($.attrs,"v-else");if(O!==null){let H=J(b,$),N=L($.attrs,"v-else-if"),D=W(b.slice(H.outerStart,H.outerEnd),{...$,start:0,end:$.end-$.start},N);G.push({type:"else-if",expr:O,outerStart:_,outerEnd:H.outerEnd,element:D,parsedTag:$}),_=H.outerEnd}else if(M){let H=J(b,$),N=L($.attrs,"v-else"),D=W(b.slice(H.outerStart,H.outerEnd),{...$,start:0,end:$.end-$.start},N);G.push({type:"else",outerStart:_,outerEnd:H.outerEnd,element:D,parsedTag:$}),Z=!1}else Z=!1}let U=[];for(let y of G)if(y.type==="if")U.push(`@if(${y.expr})
${y.element}`);else if(y.type==="else-if")U.push(`@elseif(${y.expr})
${y.element}`);else U.push(`@else
${y.element}`);U.push("@endif");let j=U.join(`
`),B=G[0].outerStart,S=G[G.length-1].outerEnd;b=b.slice(0,B)+j+b.slice(S),z=B+j.length}return b}function c(q){return q.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function g(q){let b=q,z=0;while(z<b.length){let k=P(b,z);if(!k)break;let K=k.attrs,G=!1,X=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,Y=K.match(X);while(Y){G=!0;let Z=Y[1],U=Y[2],j=Y[3];K=K.replace(Y[0],""),K+=` :${Z}="${j}" @update:${Z}="${j} = $event"`,Y=K.match(X)}if(G){let Z=J(b,k),U=b.slice(Z.outerStart,Z.outerEnd),j=W(U,{...k,start:0,end:k.end-k.start},K);b=b.slice(0,Z.outerStart)+j+b.slice(Z.outerEnd),z=Z.outerStart+j.length;continue}let Q=I(k.attrs,"v-model");if(Q===null){z=k.end;continue}if(p.has(k.tag.toLowerCase())){let Z=k.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${Q}"`,U=J(b,k),j=b.slice(U.outerStart,U.outerEnd),B=W(j,{...k,start:0,end:k.end-k.start},Z);b=b.slice(0,U.outerStart)+B+b.slice(U.outerEnd),z=U.outerStart+B.length}else{let Z=k.attrs.replace(/\s*v-model="[^"]*"/g,"");Z+=` :modelValue="${Q}" @update:modelValue="${Q} = $event"`;let U=J(b,k),j=b.slice(U.outerStart,U.outerEnd),B=W(j,{...k,start:0,end:k.end-k.start},Z);b=b.slice(0,U.outerStart)+B+b.slice(U.outerEnd),z=U.outerStart+B.length}}return b}function m(q){return q.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function n(q){return q.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function l(q){let b=q,z=0;while(z<b.length){let k=P(b,z);if(!k)break;let K=I(k.attrs,"v-html");if(K===null){z=k.end;continue}if(k.selfClosing){z=k.end;continue}let G=J(b,k),X=L(k.attrs,"v-html"),Y=k.selfClosing?" /":"",Q=`<${k.tag}${X}${Y}>{!! ${K} !!}</${k.tag}>`;b=b.slice(0,G.outerStart)+Q+b.slice(G.outerEnd),z=G.outerStart+Q.length}return b}function s(q){let b=q,z=0;while(z<b.length){let k=P(b,z);if(!k)break;let K=I(k.attrs,"v-text");if(K===null){z=k.end;continue}if(k.selfClosing){z=k.end;continue}let G=J(b,k),X=L(k.attrs,"v-text"),Y=k.selfClosing?" /":"",Q=`<${k.tag}${X}${Y}>{{ ${K} }}</${k.tag}>`;b=b.slice(0,G.outerStart)+Q+b.slice(G.outerEnd),z=G.outerStart+Q.length}return b}function a(q){return q.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function r(q){let b=q,z=0;while(z<b.length){let k=P(b,z);if(!k)break;if(!A(k.attrs,"v-once")){z=k.end;continue}let K=L(k.attrs,"v-once"),G=J(b,k),X=b.slice(G.outerStart,G.outerEnd),Q=`@once
${W(X,{...k,start:0,end:k.end-k.start},K)}
@endonce`;b=b.slice(0,G.outerStart)+Q+b.slice(G.outerEnd),z=G.outerStart+Q.length}return b}function t(q){return q.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function e(q){return q.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function Kb(q){if(!u(q))return q;let b=q;return b=i(b),b=h(b),b=r(b),b=m(b),b=n(b),b=g(b),b=c(b),b=e(b),b=l(b),b=s(b),b=a(b),b=t(b),b}var d,p;var bb=x(()=>{d=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),p=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});bb();export{Kb as processVueTemplate,u as hasVueTemplateSyntax};
