import{t as h}from"./vendor-oniguruma-to-es-DLBnFDCE.js";const f=4294967295;class l{constructor(r,o={}){this.patterns=r,this.options=o;const{forgiving:g=!1,cache:a,regexConstructor:i}=o;if(!i)throw new Error("Option `regexConstructor` is not provided");this.regexps=r.map(c=>{if(typeof c!="string")return c;const e=a?.get(c);if(e){if(e instanceof RegExp)return e;if(g)return null;throw e}try{const t=i(c);return a?.set(c,t),t}catch(t){if(a?.set(c,t),g)return null;throw t}})}regexps;findNextMatchSync(r,o,g){const a=typeof r=="string"?r:r.content,i=[];function c(e,t,n=0){return{index:e,captureIndices:t.indices.map(s=>s==null?{start:f,end:f,length:0}:{start:s[0]+n,end:s[1]+n,length:s[1]-s[0]})}}for(let e=0;e<this.regexps.length;e++){const t=this.regexps[e];if(t)try{t.lastIndex=o;const n=t.exec(a);if(!n)continue;if(n.index===o)return c(e,n,0);i.push([e,n,0])}catch(n){if(this.options.forgiving)continue;throw n}}if(i.length){const e=Math.min(...i.map(t=>t[1].index));for(const[t,n,s]of i)if(n.index===e)return c(t,n,s)}return null}}function p(u,r){return h(u,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...r})}function d(u={}){const r=Object.assign({target:"auto",cache:new Map},u);return r.regexConstructor||=o=>p(o,{target:r.target}),{createScanner(o){return new l(o,r)},createString(o){return{content:o}}}}export{d as c};
