// @bun
var{defineProperty:J,getOwnPropertyNames:U,getOwnPropertyDescriptor:V}=Object,W=Object.prototype.hasOwnProperty;function X(f){return this[f]}var x=(f)=>{var j=(K??=new WeakMap).get(f),v;if(j)return j;if(j=J({},"__esModule",{value:!0}),f&&typeof f==="object"||typeof f==="function"){for(var z of U(f))if(!W.call(j,z))J(j,z,{get:X.bind(f,z),enumerable:!(v=V(f,z))||v.enumerable})}return K.set(f,j),j},K;var Z=(f)=>f;function $(f,j){this[f]=Z.bind(null,j)}var C=(f,j)=>{for(var v in j)J(f,v,{get:j[v],enumerable:!0,configurable:!0,set:$.bind(j,v)})};var b=(f,j)=>()=>(f&&(j=f(f=0)),j);var L=import.meta.require;function M(f,j,v,z){v.lastIndex=j;let B=v.exec(f);if(!B||B.index!==j)return-1;z.lastIndex=v.lastIndex;let w=z.exec(f);if(!w)return-1;return w.index+w[0].length}function Y(f,j){return M(f,j,y,A)}function _(f,j){return M(f,j,I,N)}function P(f,j){if(!f.startsWith("<!--",j))return-1;let v=f.indexOf("-->",j+4);if(v===-1)return-1;return v+3}function g(f,j,v){let z=[],B="",w=0,Q=f.length,H=!1,F=null;while(w<Q){let D=f[w];if(H){if(B+=D,F){if(D===F)F=null}else if(D==='"'||D==="'")F=D;else if(D===">")H=!1;w++;continue}if(D==="<"){let G=j(f,w);if(G>w){B+=v(f.slice(w,G),z.length),z.push(f.slice(w,G)),w=G;continue}if(/^<\/?[a-zA-Z]/.test(f.slice(w,w+2)))H=!0;B+=D,w++;continue}B+=D,w++}return{output:B,tokens:z}}function R(f){let{output:j,tokens:v}=g(f,Y,(z,B)=>`\x00STX_SCRIPT_${B}\x00`);return{output:j,scripts:v}}function k(f,j){if(j.length===0)return f;return f.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(v,z)=>j[+z]??"")}var y,A,I,N;var q=b(()=>{y=/<script\b[^>]*>/iy,A=/<\/script\s*>/ig,I=/<style\b[^>]*>/iy,N=/<\/style\s*>/ig});q();export{R as stashScriptElements,k as restoreStashedScripts,_ as matchStyleElement,Y as matchScriptElement,P as matchHtmlComment,g as maskAtElementPosition};
