var Nr=Object.defineProperty;var Lr=Object.getPrototypeOf;var Fr=Reflect.get;var Gr=(e,r,t)=>r in e?Nr(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var me=(e,r,t)=>(Gr(e,typeof r!="symbol"?r+"":r,t),t),we=(e,r,t)=>{if(!r.has(e))throw TypeError("Cannot "+t)};var $=(e,r,t)=>(we(e,r,"read from private field"),t?t.call(e):r.get(e)),z=(e,r,t)=>{if(r.has(e))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(e):r.set(e,t)},M=(e,r,t,n)=>(we(e,r,"write to private field"),n?n.call(e,t):r.set(e,t),t);var ye=(e,r,t)=>(we(e,r,"access private method"),t),Te=(e,r,t)=>Fr(Lr(e),t,r);import{an as Sn,C as vn,G as _n,t as Mn,v as Nn,x as Ln,z as Fn,A as Gn,B as Pn,g as Rn,h as Un,i as Tn,j as On,k as Dn,H as Bn,N as zn,e as Hn,P as Vn,Q as Wn,r as jn,R as Xn,S as Zn,T as Qn,W as qn,Z as Jn,_ as Kn,$ as Yn,l as es,p as rs,a0 as ts,a1 as ns,a2 as ss,a3 as as,a4 as os,a5 as is,a6 as us,a7 as cs,s as ls,a8 as ps,a9 as fs,aa as ds,ab as gs,ac as hs,ad as ms,ae as ws,af as ys,ag as Cs,ah as bs,ai as ks,aj as xs,ak as $s,al as Es,am as As}from"./MessageList-702dd606.js";import"./index-c3b77b9a.js";import"./toast-b30e06c0.js";function re(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Pr(e,r,t){return e.has(r)||e.set(r,t),e.get(r)}const Le=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),k=String.raw;function te(e,r){if(e==null)throw new Error(r??"Value expected");return e}const ar=k`\[\^?`,or=`c.? | C(?:-.?)?|${k`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${k`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${k`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${k`o\{[^\}]*\}?`}|${k`\d{1,3}`}`,Fe=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,ue=new RegExp(k`
  \\ (?:
    ${or}
    | [gk]<[^>]*>?
    | [gk]'[^']*'?
    | .
  )
  | \( (?:
    \? (?:
      [:=!>({]
      | <[=!]
      | <[^>]*>
      | '[^']*'
      | ~\|?
      | #(?:[^)\\]|\\.?)*
      | [^:)]*[:)]
    )?
    | \*[^\)]*\)?
  )?
  | (?:${Fe.source})+
  | ${ar}
  | .
`.replace(/\s+/g,""),"gsu"),Ce=new RegExp(k`
  \\ (?:
    ${or}
    | .
  )
  | \[:(?:\^?\p{Alpha}+|\^):\]
  | ${ar}
  | &&
  | .
`.replace(/\s+/g,""),"gsu");function Rr(e,r={}){const t={flags:"",...r,rules:{captureGroup:!1,singleline:!1,...r.rules}};if(typeof e!="string")throw new Error("String expected as pattern");const n=rt(t.flags),s=[n.extended],a={captureGroup:t.rules.captureGroup,getCurrentModX(){return s.at(-1)},numOpenGroups:0,popModX(){s.pop()},pushModX(p){s.push(p)},replaceCurrentModX(p){s[s.length-1]=p},singleline:t.rules.singleline};let o=[],i;for(ue.lastIndex=0;i=ue.exec(e);){const p=Ur(a,e,i[0],ue.lastIndex);p.tokens?o.push(...p.tokens):p.token&&o.push(p.token),p.lastIndex!==void 0&&(ue.lastIndex=p.lastIndex)}const u=[];let c=0;o.filter(p=>p.type==="GroupOpen").forEach(p=>{p.kind==="capturing"?p.number=++c:p.raw==="("&&u.push(p)}),c||u.forEach((p,f)=>{p.kind="capturing",p.number=f+1});const l=c||u.length;return{tokens:o.map(p=>p.type==="EscapedNumber"?nt(p,l):p).flat(),flags:n}}function Ur(e,r,t,n){const[s,a]=t;if(t==="["||t==="[^"){const o=Tr(r,t,n);return{tokens:o.tokens,lastIndex:o.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(a))return{token:Oe(t,t)};if(/^\\g[<']/.test(t)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(t))throw new Error(`Invalid group name "${t}"`);return{token:Zr(t)}}if(/^\\k[<']/.test(t)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(t))throw new Error(`Invalid group name "${t}"`);return{token:ur(t)}}if(a==="K")return{token:cr("keep",t)};if(a==="N"||a==="R")return{token:W("newline",t,{negate:a==="N"})};if(a==="O")return{token:W("any",t)};if(a==="X")return{token:W("text_segment",t)};const o=ir(t,{inCharClass:!1});return Array.isArray(o)?{tokens:o}:{token:o}}if(s==="("){if(a==="*")return{token:Kr(t)};if(t==="(?{")throw new Error(`Unsupported callout "${t}"`);if(t.startsWith("(?#")){if(r[n]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:n+1}}if(/^\(\?[-imx]+[:)]$/.test(t))return{token:Jr(t,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,t==="("&&!e.captureGroup||t==="(?:")return{token:Y("group",t)};if(t==="(?>")return{token:Y("atomic",t)};if(t==="(?="||t==="(?!"||t==="(?<="||t==="(?<!")return{token:Y(t[2]==="<"?"lookbehind":"lookahead",t,{negate:t.endsWith("!")})};if(t==="("&&e.captureGroup||t.startsWith("(?<")&&t.endsWith(">")||t.startsWith("(?'")&&t.endsWith("'"))return{token:Y("capturing",t,{...t!=="("&&{name:t.slice(3,-1)}})};if(t.startsWith("(?~")){if(t==="(?~|")throw new Error(`Unsupported absence function kind "${t}"`);return{token:Y("absence_repeater",t)}}throw t==="(?("?new Error(`Unsupported conditional "${t}"`):new Error(`Invalid or unsupported group option "${t}"`)}if(t===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Wr(t)}}if(e.getCurrentModX()){if(t==="#"){const o=r.indexOf(`
`,n);return{lastIndex:o===-1?r.length:o}}if(/^\s$/.test(t)){const o=/\s+/y;return o.lastIndex=n,{lastIndex:o.exec(r)?o.lastIndex:n}}}if(t===".")return{token:W("dot",t)};if(t==="^"||t==="$"){const o=e.singleline?{"^":k`\A`,$:k`\Z`}[t]:t;return{token:Oe(o,t)}}return t==="|"?{token:Dr(t)}:Fe.test(t)?{tokens:st(t)}:{token:P(re(t),t)}}function Tr(e,r,t){const n=[De(r[1]==="^",r)];let s=1,a;for(Ce.lastIndex=t;a=Ce.exec(e);){const o=a[0];if(o[0]==="["&&o[1]!==":")s++,n.push(De(o[1]==="^",o));else if(o==="]"){if(n.at(-1).type==="CharacterClassOpen")n.push(P(93,o));else if(s--,n.push(Br(o)),!s)break}else{const i=Or(o);Array.isArray(i)?n.push(...i):n.push(i)}}return{tokens:n,lastIndex:Ce.lastIndex||e.length}}function Or(e){if(e[0]==="\\")return ir(e,{inCharClass:!0});if(e[0]==="["){const r=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!r||!Le.has(r.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return W("posix",e,{value:r.groups.name,negate:!!r.groups.negate})}return e==="-"?zr(e):e==="&&"?Hr(e):P(re(e),e)}function ir(e,{inCharClass:r}){const t=e[1];if(t==="c"||t==="C")return qr(e);if("dDhHsSwW".includes(t))return Yr(e);if(e.startsWith(k`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return et(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{const n=e.split(/\\x/).slice(1).map(o=>parseInt(o,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(n)),a=new TextEncoder;return[...s].map(o=>{const i=[...a.encode(o)].map(u=>`\\x${u.toString(16)}`).join("");return P(re(o),i)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(t==="u"||t==="x")return P(tt(e),e);if(Be.has(t))return P(Be.get(t),e);if(/\d/.test(t))return Vr(r,e);if(e==="\\")throw new Error(k`Incomplete escape "\"`);if(t==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return P(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function Dr(e){return{type:"Alternator",raw:e}}function Oe(e,r){return{type:"Assertion",kind:e,raw:r}}function ur(e){return{type:"Backreference",raw:e}}function P(e,r){return{type:"Character",value:e,raw:r}}function Br(e){return{type:"CharacterClassClose",raw:e}}function zr(e){return{type:"CharacterClassHyphen",raw:e}}function Hr(e){return{type:"CharacterClassIntersector",raw:e}}function De(e,r){return{type:"CharacterClassOpen",negate:e,raw:r}}function W(e,r,t={}){return{type:"CharacterSet",kind:e,...t,raw:r}}function cr(e,r,t={}){return e==="keep"?{type:"Directive",kind:e,raw:r}:{type:"Directive",kind:e,flags:te(t.flags),raw:r}}function Vr(e,r){return{type:"EscapedNumber",inCharClass:e,raw:r}}function Wr(e){return{type:"GroupClose",raw:e}}function Y(e,r,t={}){return{type:"GroupOpen",kind:e,...t,raw:r}}function jr(e,r,t,n){return{type:"NamedCallout",kind:e,tag:r,arguments:t,raw:n}}function Xr(e,r,t,n){return{type:"Quantifier",kind:e,min:r,max:t,raw:n}}function Zr(e){return{type:"Subroutine",raw:e}}const Qr=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),Be=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function qr(e){const r=e[1]==="c"?e[2]:e[3];if(!r||!/[A-Za-z]/.test(r))throw new Error(`Unsupported control character "${e}"`);return P(re(r.toUpperCase())-64,e)}function Jr(e,r){let{on:t,off:n}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;n??(n="");const s=(r.getCurrentModX()||t.includes("x"))&&!n.includes("x"),a=He(t),o=He(n),i={};if(a&&(i.enable=a),o&&(i.disable=o),e.endsWith(")"))return r.replaceCurrentModX(s),cr("flags",e,{flags:i});if(e.endsWith(":"))return r.pushModX(s),r.numOpenGroups++,Y("group",e,{...(a||o)&&{flags:i}});throw new Error(`Unexpected flag modifier "${e}"`)}function Kr(e){const r=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!r)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:t,tag:n,args:s}=r.groups;if(!t)throw new Error(`Invalid named callout "${e}"`);if(n==="")throw new Error(`Named callout tag with empty value not allowed "${e}"`);const a=s?s.split(",").filter(l=>l!=="").map(l=>/^[+-]?\d+$/.test(l)?+l:l):[],[o,i,u]=a,c=Qr.has(t)?t.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(a.length>0)throw new Error(`Named callout arguments not allowed "${a}"`);break;case"error":if(a.length>1)throw new Error(`Named callout allows only one argument "${a}"`);if(typeof o=="string")throw new Error(`Named callout argument must be a number "${o}"`);break;case"max":if(!a.length||a.length>2)throw new Error(`Named callout must have one or two arguments "${a}"`);if(typeof o=="string"&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${i}"`);break;case"count":case"total_count":if(a.length>1)throw new Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o=="number"||!/^[<>X]$/.test(o)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case"cmp":if(a.length!==3)throw new Error(`Named callout must have three arguments "${a}"`);if(typeof o=="string"&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof i=="number"||!/^(?:[<>!=]=|[<>])$/.test(i))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${i}"`);if(typeof u=="string"&&!/^[A-Za-z_]\w*$/.test(u))throw new Error(`Named callout argument three must be a tag or number "${u}"`);break;case"custom":throw new Error(`Undefined callout name "${t}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return jr(c,n??null,(s==null?void 0:s.split(","))??null,e)}function ze(e){let r=null,t,n;if(e[0]==="{"){const{minStr:s,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+s>o||a&&+a>o)throw new Error("Quantifier value unsupported in Oniguruma");if(t=+s,n=a===void 0?+s:a===""?1/0:+a,t>n&&(r="possessive",[t,n]=[n,t]),e.endsWith("?")){if(r==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');r="lazy"}else r||(r="greedy")}else t=e[0]==="+"?1:0,n=e[0]==="?"?1:1/0,r=e[1]==="+"?"possessive":e[1]==="?"?"lazy":"greedy";return Xr(r,t,n,e)}function Yr(e){const r=e[1].toLowerCase();return W({d:"digit",h:"hex",s:"space",w:"word"}[r],e,{negate:e[1]!==r})}function et(e){const{p:r,neg:t,value:n}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return W("property",e,{value:n,negate:r==="P"&&!t||r==="p"&&!!t})}function He(e){const r={};return e.includes("i")&&(r.ignoreCase=!0),e.includes("m")&&(r.dotAll=!0),e.includes("x")&&(r.extended=!0),Object.keys(r).length?r:null}function rt(e){const r={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let t=0;t<e.length;t++){const n=e[t];if(!"imxDPSWy".includes(n))throw new Error(`Invalid flag "${n}"`);if(n==="y"){if(!/^y{[gw]}/.test(e.slice(t)))throw new Error('Invalid or unspecified flag "y" mode');r.textSegmentMode=e[t+2]==="g"?"grapheme":"word",t+=3;continue}r[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[n]]=!0}return r}function tt(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const r=e[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(r,16)}function nt(e,r){const{raw:t,inCharClass:n}=e,s=t.slice(1);if(!n&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=r))return[ur(t)];const a=[],o=s.match(/^[0-7]+|\d/g);for(let i=0;i<o.length;i++){const u=o[i];let c;if(i===0&&u!=="8"&&u!=="9"){if(c=parseInt(u,8),c>127)throw new Error(k`Octal encoded byte above 177 unsupported "${t}"`)}else c=re(u);a.push(P(c,(i===0?"\\":"")+u))}return a}function st(e){const r=[],t=new RegExp(Fe,"gy");let n;for(;n=t.exec(e);){const s=n[0];if(s[0]==="{"){const a=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(a){const{min:o,max:i}=a.groups;if(+o>+i&&s.endsWith("?")){t.lastIndex--,r.push(ze(s.slice(0,-1)));continue}}}r.push(ze(s))}return r}function lr(e,r){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(e.body.length!==1)return!1;const t=e.body[0];return!r||Object.keys(r).every(n=>r[n]===t[n])}function at(e){return ot.has(e.type)}const ot=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function pr(e,r={}){const t={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...r,rules:{captureGroup:!1,singleline:!1,...r.rules}},n=Rr(e,{flags:t.flags,rules:{captureGroup:t.rules.captureGroup,singleline:t.rules.singleline}}),s=(f,g)=>{const d=n.tokens[a.nextIndex];switch(a.parent=f,a.nextIndex++,d.type){case"Alternator":return Q();case"Assertion":return it(d);case"Backreference":return ut(d,a);case"Character":return de(d.value,{useLastValid:!!g.isCheckingRangeEnd});case"CharacterClassHyphen":return ct(d,a,g);case"CharacterClassOpen":return lt(d,a,g);case"CharacterSet":return pt(d,a);case"Directive":return wt(d.kind,{flags:d.flags});case"GroupOpen":return ft(d,a,g);case"NamedCallout":return Ct(d.kind,d.tag,d.arguments);case"Quantifier":return dt(d,a);case"Subroutine":return gt(d,a);default:throw new Error(`Unexpected token type "${d.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:t.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:t.skipBackrefValidation,skipLookbehindValidation:t.skipLookbehindValidation,skipPropertyNameValidation:t.skipPropertyNameValidation,subroutines:[],tokens:n.tokens,unicodePropertyMap:t.unicodePropertyMap,walk:s},o=kt(yt(n.flags));let i=o.body[0];for(;a.nextIndex<n.tokens.length;){const f=s(i,{});f.type==="Alternative"?(o.body.push(f),i=f):i.body.push(f)}const{capturingGroups:u,hasNumberedRef:c,namedGroupsByName:l,subroutines:p}=a;if(c&&l.size&&!t.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:f}of p)if(typeof f=="number"){if(f>u.length)throw new Error("Subroutine uses a group number that's not defined");f&&(u[f-1].isSubroutined=!0)}else if(l.has(f)){if(l.get(f).length>1)throw new Error(k`Subroutine uses a duplicate group name "\g<${f}>"`);l.get(f)[0].isSubroutined=!0}else throw new Error(k`Subroutine uses a group name that's not defined "\g<${f}>"`);return o}function it({kind:e}){return Ie(te({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===k`\B`||e===k`\Y`})}function ut({raw:e},r){const t=/^\\k[<']/.test(e),n=t?e.slice(3,-1):e.slice(1),s=(a,o=!1)=>{const i=r.capturingGroups.length;let u=!1;if(a>i)if(r.skipBackrefValidation)u=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return r.hasNumberedRef=!0,Se(o?i+1-a:a,{orphan:u})};if(t){const a=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(n);if(a)return s(+a.groups.num,!!a.groups.sign);if(/[-+]/.test(n))throw new Error(`Invalid backref name "${e}"`);if(!r.namedGroupsByName.has(n))throw new Error(`Group name not defined to the left "${e}"`);return Se(n)}return s(+n)}function ct(e,r,t){const{tokens:n,walk:s}=r,a=r.parent,o=a.body.at(-1),i=n[r.nextIndex];if(!t.isCheckingRangeEnd&&o&&o.type!=="CharacterClass"&&o.type!=="CharacterClassRange"&&i&&i.type!=="CharacterClassOpen"&&i.type!=="CharacterClassClose"&&i.type!=="CharacterClassIntersector"){const u=s(a,{...t,isCheckingRangeEnd:!0});if(o.type==="Character"&&u.type==="Character")return a.body.pop(),mt(o,u);throw new Error("Invalid character class range")}return de(re("-"))}function lt({negate:e},r,t){const{tokens:n,walk:s}=r,a=n[r.nextIndex],o=[pe()];let i=je(a);for(;i.type!=="CharacterClassClose";){if(i.type==="CharacterClassIntersector")o.push(pe()),r.nextIndex++;else{const c=o.at(-1);c.body.push(s(c,t))}i=je(n[r.nextIndex],a)}const u=pe({negate:e});return o.length===1?u.body=o[0].body:(u.kind="intersection",u.body=o.map(c=>c.body.length===1?c.body[0]:c)),r.nextIndex++,u}function pt({kind:e,negate:r,value:t},n){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:a,unicodePropertyMap:o}=n;if(e==="property"){const i=ge(t);if(Le.has(i)&&!(o!=null&&o.has(i)))e="posix",t=i;else return ee(t,{negate:r,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e==="posix"?bt(t,{negate:r}):ve(e,{negate:r})}function ft(e,r,t){const{tokens:n,capturingGroups:s,namedGroupsByName:a,skipLookbehindValidation:o,walk:i}=r,u=xt(e),c=u.type==="AbsenceFunction",l=We(u),p=l&&u.negate;if(u.type==="CapturingGroup"&&(s.push(u),u.name&&Pr(a,u.name,[]).push(u)),c&&t.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let f=Xe(n[r.nextIndex]);for(;f.type!=="GroupClose";){if(f.type==="Alternator")u.body.push(Q()),r.nextIndex++;else{const g=u.body.at(-1),d=i(g,{...t,isInAbsenceFunction:t.isInAbsenceFunction||c,isInLookbehind:t.isInLookbehind||l,isInNegLookbehind:t.isInNegLookbehind||p});if(g.body.push(d),(l||t.isInLookbehind)&&!o){const m="Lookbehind includes a pattern not allowed by Oniguruma";if(p||t.isInNegLookbehind){if(Ve(d)||d.type==="CapturingGroup")throw new Error(m)}else if(Ve(d)||We(d)&&d.negate)throw new Error(m)}}f=Xe(n[r.nextIndex])}return r.nextIndex++,u}function dt({kind:e,min:r,max:t},n){const s=n.parent,a=s.body.at(-1);if(!a||!at(a))throw new Error("Quantifier requires a repeatable token");const o=dr(e,r,t,a);return s.body.pop(),o}function gt({raw:e},r){const{capturingGroups:t,subroutines:n}=r;let s=e.slice(3,-1);const a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(a){const i=+a.groups.num,u=t.length;if(r.hasNumberedRef=!0,s={"":i,"+":u+i,"-":u+1-i}[a.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const o=gr(s);return n.push(o),o}function ht(e,r){if(e!=="repeater")throw new Error(`Unexpected absence function kind "${e}"`);return{type:"AbsenceFunction",kind:e,body:ie(r==null?void 0:r.body)}}function Q(e){return{type:"Alternative",body:hr(e==null?void 0:e.body)}}function Ie(e,r){const t={type:"Assertion",kind:e};return(e==="word_boundary"||e==="text_segment_boundary")&&(t.negate=!!(r!=null&&r.negate)),t}function Se(e,r){const t=!!(r!=null&&r.orphan);return{type:"Backreference",ref:e,...t&&{orphan:t}}}function fr(e,r){const t={name:void 0,isSubroutined:!1,...r};if(t.name!==void 0&&!$t(t.name))throw new Error(`Group name "${t.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...t.name&&{name:t.name},...t.isSubroutined&&{isSubroutined:t.isSubroutined},body:ie(r==null?void 0:r.body)}}function de(e,r){const t={useLastValid:!1,...r};if(e>1114111){const n=e.toString(16);if(t.useLastValid)e=1114111;else throw e>1310719?new Error(`Invalid code point out of range "\\x{${n}}"`):new Error(`Invalid code point out of range in JS "\\x{${n}}"`)}return{type:"Character",value:e}}function pe(e){const r={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:r.kind,negate:r.negate,body:hr(e==null?void 0:e.body)}}function mt(e,r){if(r.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:r}}function ve(e,r){const t=!!(r!=null&&r.negate),n={type:"CharacterSet",kind:e};return(e==="digit"||e==="hex"||e==="newline"||e==="space"||e==="word")&&(n.negate=t),(e==="text_segment"||e==="newline"&&!t)&&(n.variableLength=!0),n}function wt(e,r={}){if(e==="keep")return{type:"Directive",kind:e};if(e==="flags")return{type:"Directive",kind:e,flags:te(r.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function yt(e){return{type:"Flags",...e}}function N(e){const r=e==null?void 0:e.atomic,t=e==null?void 0:e.flags;if(r&&t)throw new Error("Atomic group cannot have flags");return{type:"Group",...r&&{atomic:r},...t&&{flags:t},body:ie(e==null?void 0:e.body)}}function V(e){const r={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:r.behind?"lookbehind":"lookahead",negate:r.negate,body:ie(e==null?void 0:e.body)}}function Ct(e,r,t){return{type:"NamedCallout",kind:e,tag:r,arguments:t}}function bt(e,r){const t=!!(r!=null&&r.negate);if(!Le.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:t}}function dr(e,r,t,n){if(r>t)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:r,max:t,body:n}}function kt(e,r){return{type:"Regex",body:ie(r==null?void 0:r.body),flags:e}}function gr(e){return{type:"Subroutine",ref:e}}function ee(e,r){var s;const t={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...r};let n=(s=t.unicodePropertyMap)==null?void 0:s.get(ge(e));if(!n){if(t.normalizeUnknownPropertyNames)n=Et(e);else if(t.unicodePropertyMap&&!t.skipPropertyNameValidation)throw new Error(k`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:n??e,negate:t.negate}}function xt({flags:e,kind:r,name:t,negate:n,number:s}){switch(r){case"absence_repeater":return ht("repeater");case"atomic":return N({atomic:!0});case"capturing":return fr(s,{name:t});case"group":return N({flags:e});case"lookahead":case"lookbehind":return V({behind:r==="lookbehind",negate:n});default:throw new Error(`Unexpected group kind "${r}"`)}}function ie(e){if(e===void 0)e=[Q()];else if(!Array.isArray(e)||!e.length||!e.every(r=>r.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function hr(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(r=>!!r.type))throw new Error("Invalid body; expected array of nodes");return e}function Ve(e){return e.type==="LookaroundAssertion"&&e.kind==="lookahead"}function We(e){return e.type==="LookaroundAssertion"&&e.kind==="lookbehind"}function $t(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Et(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,r=>r[0].toUpperCase()+r.slice(1).toLowerCase())}function ge(e){return e.replace(/[- _]+/g,"").toLowerCase()}function je(e,r){return te(e,`${(r==null?void 0:r.type)==="Character"&&r.value===93?"Empty":"Unclosed"} character class`)}function Xe(e){return te(e,"Unclosed group")}function se(e,r,t=null){function n(a,o){for(let i=0;i<a.length;i++){const u=s(a[i],o,i,a);i=Math.max(-1,i+u)}}function s(a,o=null,i=null,u=null){var E,A;let c=0,l=!1;const p={node:a,parent:o,key:i,container:u,root:e,remove(){ce(u).splice(Math.max(0,J(i)+c),1),c--,l=!0},removeAllNextSiblings(){return ce(u).splice(J(i)+1)},removeAllPrevSiblings(){const y=J(i)+c;return c-=y,ce(u).splice(0,Math.max(0,y))},replaceWith(y,x={}){const v=!!x.traverse;u?u[Math.max(0,J(i)+c)]=y:te(o,"Can't replace root node")[i]=y,v&&s(y,o,i,u),l=!0},replaceWithMultiple(y,x={}){const v=!!x.traverse;if(ce(u).splice(Math.max(0,J(i)+c),1,...y),c+=y.length-1,v){let B=0;for(let _=0;_<y.length;_++)B+=s(y[_],o,J(i)+_+B,u)}l=!0},skip(){l=!0}},{type:f}=a,g=r["*"],d=r[f],m=typeof g=="function"?g:g==null?void 0:g.enter,w=typeof d=="function"?d:d==null?void 0:d.enter;if(m==null||m(p,t),w==null||w(p,t),!l)switch(f){case"AbsenceFunction":case"CapturingGroup":case"Group":n(a.body,a);break;case"Alternative":case"CharacterClass":n(a.body,a);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":s(a.min,a,"min"),s(a.max,a,"max");break;case"LookaroundAssertion":n(a.body,a);break;case"Quantifier":s(a.body,a,"body");break;case"Regex":n(a.body,a),s(a.flags,a,"flags");break;default:throw new Error(`Unexpected node type "${f}"`)}return(E=d==null?void 0:d.exit)==null||E.call(d,p,t),(A=g==null?void 0:g.exit)==null||A.call(g,p,t),c}return s(e),e}function ce(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function J(e){if(typeof e!="number")throw new Error("Numeric key expected");return e}const At=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function It(e,r){for(let t=0;t<e.length;t++)e[t]>=r&&e[t]++}function St(e,r,t,n){return e.slice(0,r)+n+e.slice(r+t.length)}const S=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Ge(e,r,t,n){const s=new RegExp(String.raw`${r}|(?<$skip>\[\^?|\\?.)`,"gsu"),a=[!1];let o=0,i="";for(const u of e.matchAll(s)){const{0:c,groups:{$skip:l}}=u;if(!l&&(!n||n===S.DEFAULT==!o)){t instanceof Function?i+=t(u,{context:o?S.CHAR_CLASS:S.DEFAULT,negated:a[a.length-1]}):i+=t;continue}c[0]==="["?(o++,a.push(c[1]==="^")):c==="]"&&o&&(o--,a.pop()),i+=c}return i}function mr(e,r,t,n){Ge(e,r,t,n)}function vt(e,r,t=0,n){if(!new RegExp(r,"su").test(e))return null;const s=new RegExp(`${r}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=t;let a=0,o;for(;o=s.exec(e);){const{0:i,groups:{$skip:u}}=o;if(!u&&(!n||n===S.DEFAULT==!a))return o;i==="["?a++:i==="]"&&a&&a--,s.lastIndex==o.index&&s.lastIndex++}return null}function le(e,r,t){return!!vt(e,r,0,t)}function _t(e,r){const t=/\\?./gsu;t.lastIndex=r;let n=e.length,s=0,a=1,o;for(;o=t.exec(e);){const[i]=o;if(i==="[")s++;else if(s)i==="]"&&s--;else if(i==="(")a++;else if(i===")"&&(a--,!a)){n=o.index;break}}return e.slice(r,n)}const Ze=new RegExp(String.raw`(?<noncapturingStart>${At})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function Mt(e,r){const t=(r==null?void 0:r.hiddenCaptures)??[];let n=(r==null?void 0:r.captureTransfers)??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:n,hiddenCaptures:t};const s="(?>",a="(?:(?=(",o=[0],i=[];let u=0,c=0,l=NaN,p;do{p=!1;let f=0,g=0,d=!1,m;for(Ze.lastIndex=Number.isNaN(l)?0:l+a.length;m=Ze.exec(e);){const{0:w,index:E,groups:{capturingStart:A,noncapturingStart:y}}=m;if(w==="[")f++;else if(f)w==="]"&&f--;else if(w===s&&!d)l=E,d=!0;else if(d&&y)g++;else if(A)d?g++:(u++,o.push(u+c));else if(w===")"&&d){if(!g){c++;const x=u+c;if(e=`${e.slice(0,l)}${a}${e.slice(l+s.length,E)}))<$$${x}>)${e.slice(E+1)}`,p=!0,i.push(x),It(t,x),n.size){const v=new Map;n.forEach((B,_)=>{v.set(_>=x?_+1:_,B.map(q=>q>=x?q+1:q))}),n=v}break}g--}}}while(p);return t.push(...i),e=Ge(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:f,groups:{backrefNum:g,wrappedBackrefNum:d}})=>{if(g){const m=+g;if(m>o.length-1)throw new Error(`Backref "${f}" greater than number of captures`);return`\\${o[m]}`}return`\\${d}`},S.DEFAULT),{pattern:e,captureTransfers:n,hiddenCaptures:t}}const wr=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,be=new RegExp(String.raw`
\\(?: \d+
  | c[A-Za-z]
  | [gk]<[^>]+>
  | [pPu]\{[^\}]+\}
  | u[A-Fa-f\d]{4}
  | x[A-Fa-f\d]{2}
  )
| \((?: \? (?: [:=!>]
  | <(?:[=!]|[^>]+>)
  | [A-Za-z\-]+:
  | \(DEFINE\)
  ))?
| (?<qBase>${wr})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
| \\?.
`.replace(/\s+/g,""),"gsu");function Nt(e){if(!new RegExp(`${wr}\\+`).test(e))return{pattern:e};const r=[];let t=null,n=null,s="",a=0,o;for(be.lastIndex=0;o=be.exec(e);){const{0:i,index:u,groups:{qBase:c,qMod:l,invalidQ:p}}=o;if(i==="[")a||(n=u),a++;else if(i==="]")a?a--:n=null;else if(!a)if(l==="+"&&s&&!s.startsWith("(")){if(p)throw new Error(`Invalid quantifier "${i}"`);let f=-1;if(/^\{\d+\}$/.test(c))e=St(e,u+c.length,l,"");else{if(s===")"||s==="]"){const g=s===")"?t:n;if(g===null)throw new Error(`Invalid unmatched "${s}"`);e=`${e.slice(0,g)}(?>${e.slice(g,u)}${c})${e.slice(u+i.length)}`}else e=`${e.slice(0,u-s.length)}(?>${s}${c})${e.slice(u+i.length)}`;f+=4}be.lastIndex+=f}else i[0]==="("?r.push(u):i===")"&&(t=r.length?r.pop():null);s=i}return{pattern:e}}const I=String.raw,Lt=I`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,_e=I`\(\?R=(?<rDepth>[^\)]+)\)|${Lt}`,he=I`\(\?<(?![=!])(?<captureName>[^>]+)>`,yr=I`${he}|(?<unnamed>\()(?!\?)`,H=new RegExp(I`${he}|${_e}|\(\?|\\?.`,"gsu"),ke="Cannot use multiple overlapping recursions";function Ft(e,r){const{hiddenCaptures:t,mode:n}={hiddenCaptures:[],mode:"plugin",...r};let s=(r==null?void 0:r.captureTransfers)??new Map;if(!new RegExp(_e,"su").test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:t};if(n==="plugin"&&le(e,I`\(\?\(DEFINE\)`,S.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const a=[],o=le(e,I`\\[1-9]`,S.DEFAULT),i=new Map,u=[];let c=!1,l=0,p=0,f;for(H.lastIndex=0;f=H.exec(e);){const{0:g,groups:{captureName:d,rDepth:m,gRNameOrNum:w,gRDepth:E}}=f;if(g==="[")l++;else if(l)g==="]"&&l--;else if(m){if(Qe(m),c)throw new Error(ke);if(o)throw new Error(`${n==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const A=e.slice(0,f.index),y=e.slice(H.lastIndex);if(le(y,_e,S.DEFAULT))throw new Error(ke);const x=+m-1;e=qe(A,y,x,!1,t,a,p),s=Ke(s,A,x,a.length,0,p);break}else if(w){Qe(E);let A=!1;for(const ne of u)if(ne.name===w||ne.num===+w){if(A=!0,ne.hasRecursedWithin)throw new Error(ke);break}if(!A)throw new Error(I`Recursive \g cannot be used outside the referenced group "${n==="external"?w:I`\g<${w}&R=${E}>`}"`);const y=i.get(w),x=_t(e,y);if(o&&le(x,I`${he}|\((?!\?)`,S.DEFAULT))throw new Error(`${n==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const v=e.slice(y,f.index),B=x.slice(v.length+g.length),_=a.length,q=+E-1,Ue=qe(v,B,q,!0,t,a,p);s=Ke(s,v,q,a.length-_,_,p);const _r=e.slice(0,y),Mr=e.slice(y+x.length);e=`${_r}${Ue}${Mr}`,H.lastIndex+=Ue.length-g.length-v.length-B.length,u.forEach(ne=>ne.hasRecursedWithin=!0),c=!0}else if(d)p++,i.set(String(p),H.lastIndex),i.set(d,H.lastIndex),u.push({num:p,name:d});else if(g[0]==="("){const A=g==="(";A&&(p++,i.set(String(p),H.lastIndex)),u.push(A?{num:p}:{})}else g===")"&&u.pop()}return t.push(...a),{pattern:e,captureTransfers:s,hiddenCaptures:t}}function Qe(e){const r=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(r);if(e=+e,e<2||e>100)throw new Error(r)}function qe(e,r,t,n,s,a,o){const i=new Set;n&&mr(e+r,he,({groups:{captureName:c}})=>{i.add(c)},S.DEFAULT);const u=[t,n?i:null,s,a,o];return`${e}${Je(`(?:${e}`,"forward",...u)}(?:)${Je(`${r})`,"backward",...u)}${r}`}function Je(e,r,t,n,s,a,o){const u=l=>r==="forward"?l+2:t-l+2-1;let c="";for(let l=0;l<t;l++){const p=u(l);c+=Ge(e,I`${yr}|\\k<(?<backref>[^>]+)>`,({0:f,groups:{captureName:g,unnamed:d,backref:m}})=>{if(m&&n&&!n.has(m))return f;const w=`_$${p}`;if(d||g){const E=o+a.length+1;return a.push(E),Gt(s,E),d?f:`(?<${g}${w}>`}return I`\k<${m}${w}>`},S.DEFAULT)}return c}function Gt(e,r){for(let t=0;t<e.length;t++)e[t]>=r&&e[t]++}function Ke(e,r,t,n,s,a){if(e.size&&n){let o=0;mr(r,yr,()=>o++,S.DEFAULT);const i=a-o+s,u=new Map;return e.forEach((c,l)=>{const p=(n-o*t)/t,f=o*t,g=l>i+o?l+n:l,d=[];for(const m of c)if(m<=i)d.push(m);else if(m>i+o+p)d.push(m+n);else if(m<=i+o)for(let w=0;w<=t;w++)d.push(m+o*w);else for(let w=0;w<=t;w++)d.push(m+f+p*w);u.set(g,d)}),u}return e}var b=String.fromCodePoint,h=String.raw,R={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("[[]]","v")}catch{return!1}return!0})()};R.bugFlagVLiteralHyphenIsRange=R.unicodeSets?(()=>{try{new RegExp(h`[\d\-a]`,"v")}catch{return!0}return!1})():!1;R.bugNestedClassIgnoresNegation=R.unicodeSets&&new RegExp("[[^a]]","v").test("a");function fe(e,{enable:r,disable:t}){return{dotAll:!(t!=null&&t.dotAll)&&!!(r!=null&&r.dotAll||e.dotAll),ignoreCase:!(t!=null&&t.ignoreCase)&&!!(r!=null&&r.ignoreCase||e.ignoreCase)}}function ae(e,r,t){return e.has(r)||e.set(r,t),e.get(r)}function Me(e,r){return Ye[e]>=Ye[r]}function Pt(e,r){if(e==null)throw new Error(r??"Value expected");return e}var Ye={ES2025:2025,ES2024:2024,ES2018:2018},Rt={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Cr(e={}){if({}.toString.call(e)!=="[object Object]")throw new Error("Unexpected options");if(e.target!==void 0&&!Rt[e.target])throw new Error(`Unexpected target "${e.target}"`);const r={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return r.target==="auto"&&(r.target=R.flagGroups?"ES2025":R.unicodeSets?"ES2024":"ES2018"),r}var Ut="[	-\r ]",Tt=new Set([b(304),b(305)]),L=h`[\p{L}\p{M}\p{N}\p{Pc}]`;function br(e){if(Tt.has(e))return[e];const r=new Set,t=e.toLowerCase(),n=t.toUpperCase(),s=Bt.get(t),a=Ot.get(t),o=Dt.get(t);return[...n].length===1&&r.add(n),o&&r.add(o),s&&r.add(s),r.add(t),a&&r.add(a),[...r]}var Pe=new Map(`C Other
Cc Control cntrl
Cf Format
Cn Unassigned
Co Private_Use
Cs Surrogate
L Letter
LC Cased_Letter
Ll Lowercase_Letter
Lm Modifier_Letter
Lo Other_Letter
Lt Titlecase_Letter
Lu Uppercase_Letter
M Mark Combining_Mark
Mc Spacing_Mark
Me Enclosing_Mark
Mn Nonspacing_Mark
N Number
Nd Decimal_Number digit
Nl Letter_Number
No Other_Number
P Punctuation punct
Pc Connector_Punctuation
Pd Dash_Punctuation
Pe Close_Punctuation
Pf Final_Punctuation
Pi Initial_Punctuation
Po Other_Punctuation
Ps Open_Punctuation
S Symbol
Sc Currency_Symbol
Sk Modifier_Symbol
Sm Math_Symbol
So Other_Symbol
Z Separator
Zl Line_Separator
Zp Paragraph_Separator
Zs Space_Separator
ASCII
ASCII_Hex_Digit AHex
Alphabetic Alpha
Any
Assigned
Bidi_Control Bidi_C
Bidi_Mirrored Bidi_M
Case_Ignorable CI
Cased
Changes_When_Casefolded CWCF
Changes_When_Casemapped CWCM
Changes_When_Lowercased CWL
Changes_When_NFKC_Casefolded CWKCF
Changes_When_Titlecased CWT
Changes_When_Uppercased CWU
Dash
Default_Ignorable_Code_Point DI
Deprecated Dep
Diacritic Dia
Emoji
Emoji_Component EComp
Emoji_Modifier EMod
Emoji_Modifier_Base EBase
Emoji_Presentation EPres
Extended_Pictographic ExtPict
Extender Ext
Grapheme_Base Gr_Base
Grapheme_Extend Gr_Ext
Hex_Digit Hex
IDS_Binary_Operator IDSB
IDS_Trinary_Operator IDST
ID_Continue IDC
ID_Start IDS
Ideographic Ideo
Join_Control Join_C
Logical_Order_Exception LOE
Lowercase Lower
Math
Noncharacter_Code_Point NChar
Pattern_Syntax Pat_Syn
Pattern_White_Space Pat_WS
Quotation_Mark QMark
Radical
Regional_Indicator RI
Sentence_Terminal STerm
Soft_Dotted SD
Terminal_Punctuation Term
Unified_Ideograph UIdeo
Uppercase Upper
Variation_Selector VS
White_Space space
XID_Continue XIDC
XID_Start XIDS`.split(/\s/).map(e=>[ge(e),e])),Ot=new Map([["s",b(383)],[b(383),"s"]]),Dt=new Map([[b(223),b(7838)],[b(107),b(8490)],[b(229),b(8491)],[b(969),b(8486)]]),Bt=new Map([U(453),U(456),U(459),U(498),...xe(8072,8079),...xe(8088,8095),...xe(8104,8111),U(8124),U(8140),U(8188)]),zt=new Map([["alnum",h`[\p{Alpha}\p{Nd}]`],["alpha",h`\p{Alpha}`],["ascii",h`\p{ASCII}`],["blank",h`[\p{Zs}\t]`],["cntrl",h`\p{Cc}`],["digit",h`\p{Nd}`],["graph",h`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",h`\p{Lower}`],["print",h`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",h`[\p{P}\p{S}]`],["space",h`\p{space}`],["upper",h`\p{Upper}`],["word",h`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",h`\p{AHex}`]]);function Ht(e,r){const t=[];for(let n=e;n<=r;n++)t.push(n);return t}function U(e){const r=b(e);return[r.toLowerCase(),r]}function xe(e,r){return Ht(e,r).map(t=>U(t))}var kr=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function Vt(e,r){const t={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...r};xr(e);const n={accuracy:t.accuracy,asciiWordBoundaries:t.asciiWordBoundaries,avoidSubclass:t.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Me(t.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};se(e,Wt,n);const s={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:n.subroutineRefMap};se(e,jt,a);const o={groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer};return se(e,Xt,o),e._originMap=a.groupOriginByCopy,e._strategy=n.strategy,e}var Wt={AbsenceFunction({node:e,parent:r,replaceWith:t}){const{body:n,kind:s}=e;if(s==="repeater"){const a=N();a.body[0].body.push(V({negate:!0,body:n}),ee("Any"));const o=N();o.body[0].body.push(dr("greedy",0,1/0,a)),t(C(o,r),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:r,key:t},{flagDirectivesByAlt:n}){const s=e.body.filter(a=>a.kind==="flags");for(let a=t+1;a<r.body.length;a++){const o=r.body[a];ae(n,o,[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:r}){var t;if((t=r.get(e))!=null&&t.length){const n=Er(r.get(e));if(n){const s=N({flags:n});s.body[0].body=e.body,e.body=[C(s,e)]}}}},Assertion({node:e,parent:r,key:t,container:n,root:s,remove:a,replaceWith:o},i){const{kind:u,negate:c}=e,{asciiWordBoundaries:l,avoidSubclass:p,supportedGNodes:f,wordIsAscii:g}=i;if(u==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if(u==="line_end")o(C(V({body:[Q({body:[Ie("string_end")]}),Q({body:[de(10)]})]}),r));else if(u==="line_start")o(C(F(h`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),r));else if(u==="search_start")if(f.has(e))s.flags.sticky=!0,a();else{const d=n[t-1];if(d&&Yt(d))o(C(V({negate:!0}),r));else{if(p)throw new Error(h`Uses "\G" in a way that requires a subclass`);o(T(Ie("string_start"),r)),i.strategy="clip_search"}}else if(!(u==="string_end"||u==="string_start"))if(u==="string_end_newline")o(C(F(h`(?=\n?\z)`),r));else if(u==="word_boundary"){if(!g&&!l){const d=`(?:(?<=${L})(?!${L})|(?<!${L})(?=${L}))`,m=`(?:(?<=${L})(?=${L})|(?<!${L})(?!${L}))`;o(C(F(c?m:d),r))}}else throw new Error(`Unexpected assertion kind "${u}"`)},Backreference({node:e},{jsGroupNameMap:r}){let{ref:t}=e;typeof t=="string"&&!Ee(t)&&(t=$e(t,r),e.ref=t)},CapturingGroup({node:e},{jsGroupNameMap:r,subroutineRefMap:t}){let{name:n}=e;n&&!Ee(n)&&(n=$e(n,r),e.name=n),t.set(e.number,e),n&&t.set(n,e)},CharacterClassRange({node:e,parent:r,replaceWith:t}){if(r.kind==="intersection"){const n=pe({body:[e]});t(C(n,r),{traverse:!0})}},CharacterSet({node:e,parent:r,replaceWith:t},{accuracy:n,minTargetEs2024:s,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:i}){const{kind:u,negate:c,value:l}=e;if(a&&(u==="digit"||l==="digit")){t(T(ve("digit",{negate:c}),r));return}if(o&&(u==="space"||l==="space")){t(C(Ae(F(Ut),c),r));return}if(i&&(u==="word"||l==="word")){t(T(ve("word",{negate:c}),r));return}if(u==="any")t(T(ee("Any"),r));else if(u==="digit")t(T(ee("Nd",{negate:c}),r));else if(u!=="dot")if(u==="text_segment"){if(n==="strict")throw new Error(h`Use of "\X" requires non-strict accuracy`);const p="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",f=h`\p{RI}{2}|${p}(?:\u200D${p})*`;t(C(F(h`(?>\r\n|${s?h`\p{RGI_Emoji}`:f}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),r))}else if(u==="hex")t(T(ee("AHex",{negate:c}),r));else if(u==="newline")t(C(F(c?`[^
]`:`(?>\r
?|[
\v\f\u2028\u2029])`),r));else if(u==="posix")if(!s&&(l==="graph"||l==="print")){if(n==="strict")throw new Error(`POSIX class "${l}" requires min target ES2024 or non-strict accuracy`);let p={graph:"!-~",print:" -~"}[l];c&&(p=`\0-${b(p.codePointAt(0)-1)}${b(p.codePointAt(2)+1)}-􏿿`),t(C(F(`[${p}]`),r))}else t(C(Ae(F(zt.get(l)),c),r));else if(u==="property")Pe.has(ge(l))||(e.key="sc");else if(u==="space")t(T(ee("space",{negate:c}),r));else if(u==="word")t(C(Ae(F(L),c),r));else throw new Error(`Unexpected character set kind "${u}"`)},Directive({node:e,parent:r,root:t,remove:n,replaceWith:s,removeAllPrevSiblings:a,removeAllNextSiblings:o}){const{kind:i,flags:u}=e;if(i==="flags")if(!u.enable&&!u.disable)n();else{const c=N({flags:u});c.body[0].body=o(),s(C(c,r),{traverse:!0})}else if(i==="keep"){const c=t.body[0],p=t.body.length===1&&lr(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:t;if(r.parent!==p||p.body.length>1)throw new Error(h`Uses "\K" in a way that's unsupported`);const f=V({behind:!0});f.body[0].body=a(),s(C(f,r))}else throw new Error(`Unexpected directive kind "${i}"`)},Flags({node:e,parent:r}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),r.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:r,disable:t}=e.flags;r!=null&&r.extended&&delete r.extended,t!=null&&t.extended&&delete t.extended,r!=null&&r.dotAll&&(t!=null&&t.dotAll)&&delete r.dotAll,r!=null&&r.ignoreCase&&(t!=null&&t.ignoreCase)&&delete r.ignoreCase,r&&!Object.keys(r).length&&delete e.flags.enable,t&&!Object.keys(t).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},r){const{kind:t}=e;t==="lookbehind"&&(r.passedLookbehind=!0)},NamedCallout({node:e,parent:r,replaceWith:t}){const{kind:n}=e;if(n==="fail")t(C(V({negate:!0}),r));else throw new Error(`Unsupported named callout "(*${n.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const r=N();r.body[0].body.push(e.body),e.body=C(r,e)}},Regex:{enter({node:e},{supportedGNodes:r}){const t=[];let n=!1,s=!1;for(const a of e.body)if(a.body.length===1&&a.body[0].kind==="search_start")a.body.pop();else{const o=Ir(a.body);o?(n=!0,Array.isArray(o)?t.push(...o):t.push(o)):s=!0}n&&!s&&t.forEach(a=>r.add(a))},exit(e,{accuracy:r,passedLookbehind:t,strategy:n}){if(r==="strict"&&t&&n)throw new Error(h`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:r}){let{ref:t}=e;typeof t=="string"&&!Ee(t)&&(t=$e(t,r),e.ref=t)}},jt={Backreference({node:e},{multiplexCapturesToLeftByRef:r,reffedNodesByReferencer:t}){const{orphan:n,ref:s}=e;n||t.set(e,[...r.get(s).map(({node:a})=>a)])},CapturingGroup:{enter({node:e,parent:r,replaceWith:t,skip:n},{groupOriginByCopy:s,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:i,reffedNodesByReferencer:u}){const c=s.get(e);if(c&&i.has(e.number)){const p=T(er(e.number),r);u.set(p,i.get(e.number)),t(p);return}i.set(e.number,e),o.set(e.number,[]),e.name&&ae(o,e.name,[]);const l=o.get(e.name??e.number);for(let p=0;p<l.length;p++){const f=l[p];if(c===f.node||c&&c===f.origin||e===f.origin){l.splice(p,1);break}}if(o.get(e.number).push({node:e,origin:c}),e.name&&o.get(e.name).push({node:e,origin:c}),e.name){const p=ae(a,e.name,new Map);let f=!1;if(c)f=!0;else for(const g of p.values())if(!g.hasDuplicateNameToRemove){f=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:f})}},exit({node:e},{openRefs:r}){r.delete(e.number)}},Group:{enter({node:e},r){r.prevFlags=r.currentFlags,e.flags&&(r.currentFlags=fe(r.currentFlags,e.flags))},exit(e,r){r.currentFlags=r.prevFlags}},Subroutine({node:e,parent:r,replaceWith:t},n){const{isRecursive:s,ref:a}=e;if(s){let l=r;for(;(l=l.parent)&&!(l.type==="CapturingGroup"&&(l.name===a||l.number===a)););n.reffedNodesByReferencer.set(e,l);return}const o=n.subroutineRefMap.get(a),i=a===0,u=i?er(0):$r(o,n.groupOriginByCopy,null);let c=u;if(!i){const l=Er(qt(o,f=>f.type==="Group"&&!!f.flags)),p=l?fe(n.globalFlags,l):n.globalFlags;Zt(p,n.currentFlags)||(c=N({flags:Jt(p)}),c.body[0].body.push(u))}t(C(c,r),{traverse:!i})}},Xt={Backreference({node:e,parent:r,replaceWith:t},n){if(e.orphan){n.highestOrphanBackref=Math.max(n.highestOrphanBackref,e.ref);return}const a=n.reffedNodesByReferencer.get(e).filter(o=>Qt(o,e));if(!a.length)t(C(V({negate:!0}),r));else if(a.length>1){const o=N({atomic:!0,body:a.reverse().map(i=>Q({body:[Se(i.number)]}))});t(C(o,r))}else e.ref=a[0].number},CapturingGroup({node:e},r){e.number=++r.numCapturesToLeft,e.name&&r.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},r){const t=Math.max(r.highestOrphanBackref-r.numCapturesToLeft,0);for(let n=0;n<t;n++){const s=fr();e.body.at(-1).body.push(s)}}},Subroutine({node:e},r){!e.isRecursive||e.ref===0||(e.ref=r.reffedNodesByReferencer.get(e).number)}};function xr(e){se(e,{"*"({node:r,parent:t}){r.parent=t}})}function Zt(e,r){return e.dotAll===r.dotAll&&e.ignoreCase===r.ignoreCase}function Qt(e,r){let t=r;do{if(t.type==="Regex")return!1;if(t.type==="Alternative")continue;if(t===e)return!1;const n=Ar(t.parent);for(const s of n){if(s===t)break;if(s===e||Sr(s,e))return!0}}while(t=t.parent);throw new Error("Unexpected path")}function $r(e,r,t,n){const s=Array.isArray(e)?[]:{};for(const[a,o]of Object.entries(e))a==="parent"?s.parent=Array.isArray(t)?n:t:o&&typeof o=="object"?s[a]=$r(o,r,s,t):(a==="type"&&o==="CapturingGroup"&&r.set(s,r.get(e)??e),s[a]=o);return s}function er(e){const r=gr(e);return r.isRecursive=!0,r}function qt(e,r){const t=[];for(;e=e.parent;)(!r||r(e))&&t.push(e);return t}function $e(e,r){if(r.has(e))return r.get(e);const t=`$${r.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return r.set(e,t),t}function Er(e){const r=["dotAll","ignoreCase"],t={enable:{},disable:{}};return e.forEach(({flags:n})=>{r.forEach(s=>{var a,o;(a=n.enable)!=null&&a[s]&&(delete t.disable[s],t.enable[s]=!0),(o=n.disable)!=null&&o[s]&&(t.disable[s]=!0)})}),Object.keys(t.enable).length||delete t.enable,Object.keys(t.disable).length||delete t.disable,t.enable||t.disable?t:null}function Jt({dotAll:e,ignoreCase:r}){const t={};return(e||r)&&(t.enable={},e&&(t.enable.dotAll=!0),r&&(t.enable.ignoreCase=!0)),(!e||!r)&&(t.disable={},!e&&(t.disable.dotAll=!0),!r&&(t.disable.ignoreCase=!0)),t}function Ar(e){if(!e)throw new Error("Node expected");const{body:r}=e;return Array.isArray(r)?r:r?[r]:null}function Ir(e){const r=e.find(t=>t.kind==="search_start"||en(t,{negate:!1})||!Kt(t));if(!r)return null;if(r.kind==="search_start")return r;if(r.type==="LookaroundAssertion")return r.body[0].body[0];if(r.type==="CapturingGroup"||r.type==="Group"){const t=[];for(const n of r.body){const s=Ir(n.body);if(!s)return null;Array.isArray(s)?t.push(...s):t.push(s)}return t}return null}function Sr(e,r){const t=Ar(e)??[];for(const n of t)if(n===r||Sr(n,r))return!0;return!1}function Kt({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function Yt(e){const r=["Character","CharacterClass","CharacterSet"];return r.includes(e.type)||e.type==="Quantifier"&&e.min&&r.includes(e.body.type)}function en(e,r){const t={negate:null,...r};return e.type==="LookaroundAssertion"&&(t.negate===null||e.negate===t.negate)&&e.body.length===1&&lr(e.body[0],{type:"Assertion",kind:"search_start"})}function Ee(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function F(e,r){const n=pr(e,{...r,unicodePropertyMap:Pe}).body;return n.length>1||n[0].body.length>1?N({body:n}):n[0].body[0]}function Ae(e,r){return e.negate=r,e}function T(e,r){return e.parent=r,e}function C(e,r){return xr(e),e.parent=r,e}function rn(e,r){const t=Cr(r),n=Me(t.target,"ES2024"),s=Me(t.target,"ES2025"),a=t.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw new Error("Invalid recursionLimit; use 2-20");let o=null,i=null;if(!s){const g=[e.flags.ignoreCase];se(e,tn,{getCurrentModI:()=>g.at(-1),popModI(){g.pop()},pushModI(d){g.push(d)},setHasCasedChar(){g.at(-1)?o=!0:i=!0}})}const u={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!i)};let c=e;const l={accuracy:t.accuracy,appliedGlobalFlags:u,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!s&&o&&i),useFlagMods:s,useFlagV:n,verbose:t.verbose};function p(g){return l.lastNode=c,c=g,Pt(nn[g.type],`Unexpected node type "${g.type}"`)(g,l,p)}const f={pattern:e.body.map(p).join("|"),flags:p(e.flags),options:{...e.options}};return n||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],l.captureMap.forEach((g,d)=>{g.hidden&&f._hiddenCaptures.push(d),g.transferTo&&ae(f._captureTransfers,g.transferTo,[]).push(d)}),f}var tn={"*":{enter({node:e},r){if(tr(e)){const t=r.getCurrentModI();r.pushModI(e.flags?fe({ignoreCase:t},e.flags).ignoreCase:t)}},exit({node:e},r){tr(e)&&r.popModI()}},Backreference(e,r){r.setHasCasedChar()},Character({node:e},r){Re(b(e.value))&&r.setHasCasedChar()},CharacterClassRange({node:e,skip:r},t){r(),vr(e,{firstOnly:!0}).length&&t.setHasCasedChar()},CharacterSet({node:e},r){e.kind==="property"&&kr.has(e.value)&&r.setHasCasedChar()}},nn={Alternative({body:e},r,t){return e.map(t).join("")},Assertion({kind:e,negate:r}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return r?h`\B`:h`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},r){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!r.useFlagMods&&r.accuracy==="strict"&&r.currentFlags.ignoreCase&&!r.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,r,t){const{body:n,name:s,number:a}=e,o={ignoreCase:r.currentFlags.ignoreCase},i=r.originMap.get(e);return i&&(o.hidden=!0,a>i.number&&(o.transferTo=i.number)),r.captureMap.set(a,o),`(${s?`?<${s}>`:""}${n.map(t).join("|")})`},Character({value:e},r){const t=b(e),n=K(e,{escDigit:r.lastNode.type==="Backreference",inCharClass:r.inCharClass,useFlagV:r.useFlagV});if(n!==t)return n;if(r.useAppliedIgnoreCase&&r.currentFlags.ignoreCase&&Re(t)){const s=br(t);return r.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return t},CharacterClass(e,r,t){const{kind:n,negate:s,parent:a}=e;let{body:o}=e;if(n==="intersection"&&!r.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");R.bugFlagVLiteralHyphenIsRange&&r.useFlagV&&o.some(nr)&&(o=[de(45),...o.filter(c=>!nr(c))]);const i=()=>`[${s?"^":""}${o.map(t).join(n==="intersection"?"&&":"")}]`;if(!r.inCharClass){if((!r.useFlagV||R.bugNestedClassIgnoresNegation)&&!s){const l=o.filter(p=>p.type==="CharacterClass"&&p.kind==="union"&&p.negate);if(l.length){const p=N(),f=p.body[0];return p.parent=a,f.parent=p,o=o.filter(g=>!l.includes(g)),e.body=o,o.length?(e.parent=f,f.body.push(e)):p.body.pop(),l.forEach(g=>{const d=Q({body:[g]});g.parent=d,d.parent=p,p.body.push(d)}),t(p)}}r.inCharClass=!0;const c=i();return r.inCharClass=!1,c}const u=o[0];if(n==="union"&&!s&&u&&((!r.useFlagV||!r.verbose)&&a.kind==="union"&&!(R.bugFlagVLiteralHyphenIsRange&&r.useFlagV)||!r.verbose&&a.kind==="intersection"&&o.length===1&&u.type!=="CharacterClassRange"))return o.map(t).join("");if(!r.useFlagV&&a.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return i()},CharacterClassRange(e,r){const t=e.min.value,n=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:r.useFlagV},a=K(t,s),o=K(n,s),i=new Set;if(r.useAppliedIgnoreCase&&r.currentFlags.ignoreCase){const u=vr(e);cn(u).forEach(l=>{i.add(Array.isArray(l)?`${K(l[0],s)}-${K(l[1],s)}`:K(l,s))})}return`${a}-${o}${[...i].join("")}`},CharacterSet({kind:e,negate:r,value:t,key:n},s){if(e==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":h`[^\n]`;if(e==="digit")return r?h`\D`:h`\d`;if(e==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&kr.has(t))throw new Error(`Unicode property "${t}" can't be case-insensitive when other chars have specific case`);return`${r?h`\P`:h`\p`}{${n?`${n}=`:""}${t}}`}if(e==="word")return r?h`\W`:h`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,r){return(r.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:r,flags:t,parent:n},s,a){const o=s.currentFlags;t&&(s.currentFlags=fe(o,t));const i=r.map(a).join("|"),u=!s.verbose&&r.length===1&&n.type!=="Quantifier"&&!e&&(!s.useFlagMods||!t)?i:`(?${ln(e,t,s.useFlagMods)}${i})`;return s.currentFlags=o,u},LookaroundAssertion({body:e,kind:r,negate:t},n,s){return`(?${`${r==="lookahead"?"":"<"}${t?"!":"="}`}${e.map(s).join("|")})`},Quantifier(e,r,t){return t(e.body)+pn(e)},Subroutine({isRecursive:e,ref:r},t){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const n=t.recursionLimit;return r===0?`(?R=${n})`:h`\g<${r}&R=${n}>`}},sn=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),an=new Set(["-","\\","]","^","["]),on=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),rr=new Map([[9,h`\t`],[10,h`\n`],[11,h`\v`],[12,h`\f`],[13,h`\r`],[8232,h`\u2028`],[8233,h`\u2029`],[65279,h`\uFEFF`]]),un=/^\p{Cased}$/u;function Re(e){return un.test(e)}function vr(e,r){const t=!!(r!=null&&r.firstOnly),n=e.min.value,s=e.max.value,a=[];if(n<65&&(s===65535||s>=131071)||n===65536&&s>=131071)return a;for(let o=n;o<=s;o++){const i=b(o);if(!Re(i))continue;const u=br(i).filter(c=>{const l=c.codePointAt(0);return l<n||l>s});if(u.length&&(a.push(...u),t))break}return a}function K(e,{escDigit:r,inCharClass:t,useFlagV:n}){if(rr.has(e))return rr.get(e);if(e<32||e>126&&e<160||e>262143||r&&fn(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const s=t?n?on:an:sn,a=b(e);return(s.has(a)?"\\":"")+a}function cn(e){const r=e.map(s=>s.codePointAt(0)).sort((s,a)=>s-a),t=[];let n=null;for(let s=0;s<r.length;s++)r[s+1]===r[s]+1?n??(n=r[s]):n===null?t.push(r[s]):(t.push([n,r[s]]),n=null);return t}function ln(e,r,t){if(e)return">";let n="";if(r&&t){const{enable:s,disable:a}=r;n=(s!=null&&s.ignoreCase?"i":"")+(s!=null&&s.dotAll?"s":"")+(a?"-":"")+(a!=null&&a.ignoreCase?"i":"")+(a!=null&&a.dotAll?"s":"")}return`${n}:`}function pn({kind:e,max:r,min:t}){let n;return!t&&r===1?n="?":!t&&r===1/0?n="*":t===1&&r===1/0?n="+":t===r?n=`{${t}}`:n=`{${t},${r===1/0?"":r}}`,n+{greedy:"",lazy:"?",possessive:"+"}[e]}function tr({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function fn(e){return e>47&&e<58}function nr({type:e,value:r}){return e==="Character"&&r===45}var O,G,j,D,X,oe,Ne,Z,dn=(Z=class extends RegExp{constructor(t,n,s){var r=(...args)=>{super(...args);z(this,oe);z(this,O,new Map);z(this,G,null);z(this,j,void 0);z(this,D,null);z(this,X,null);me(this,"rawOptions",{})};const a=!!(s!=null&&s.lazyCompile);if(t instanceof RegExp){if(s)throw new Error("Cannot provide options when copying a regexp");const o=t;r(o,n),M(this,j,o.source),o instanceof Z&&(M(this,O,$(o,O)),M(this,D,$(o,D)),M(this,X,$(o,X)),this.rawOptions=o.rawOptions)}else{const o={hiddenCaptures:[],strategy:null,transfers:[],...s};r(a?"":t,n),M(this,j,t),M(this,O,hn(o.hiddenCaptures,o.transfers)),M(this,X,o.strategy),this.rawOptions=s??{}}a||M(this,G,this)}get source(){return $(this,j)||"(?:)"}exec(t){if(!$(this,G)){const{lazyCompile:a,...o}=this.rawOptions;M(this,G,new Z($(this,j),this.flags,o))}const n=this.global||this.sticky,s=this.lastIndex;if($(this,X)==="clip_search"&&n&&s){this.lastIndex=0;const a=ye(this,oe,Ne).call(this,t.slice(s));return a&&(gn(a,s,t,this.hasIndices),this.lastIndex+=s),a}return ye(this,oe,Ne).call(this,t)}},O=new WeakMap,G=new WeakMap,j=new WeakMap,D=new WeakMap,X=new WeakMap,oe=new WeakSet,Ne=function(t){$(this,G).lastIndex=this.lastIndex;const n=Te(Z.prototype,this,"exec").call($(this,G),t);if(this.lastIndex=$(this,G).lastIndex,!n||!$(this,O).size)return n;const s=[...n];n.length=1;let a;this.hasIndices&&(a=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<s.length;i++){const{hidden:u,transferTo:c}=$(this,O).get(i)??{};if(u?o.push(null):(o.push(n.length),n.push(s[i]),this.hasIndices&&n.indices.push(a[i])),c&&s[i]!==void 0){const l=o[c];if(!l)throw new Error(`Invalid capture transfer to "${l}"`);if(n[l]=s[i],this.hasIndices&&(n.indices[l]=a[i]),n.groups){$(this,D)||M(this,D,mn(this.source));const p=$(this,D).get(c);p&&(n.groups[p]=s[i],this.hasIndices&&(n.indices.groups[p]=a[i]))}}}return n},Z);function gn(e,r,t,n){if(e.index+=r,e.input=t,n){const s=e.indices;for(let o=0;o<s.length;o++){const i=s[o];i&&(s[o]=[i[0]+r,i[1]+r])}const a=s.groups;a&&Object.keys(a).forEach(o=>{const i=a[o];i&&(a[o]=[i[0]+r,i[1]+r])})}}function hn(e,r){const t=new Map;for(const n of e)t.set(n,{hidden:!0});for(const[n,s]of r)for(const a of s)ae(t,a,{}).transferTo=n;return t}function mn(e){const r=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,t=new Map;let n=0,s=0,a;for(;a=r.exec(e);){const{0:o,groups:{capture:i,name:u}}=a;o==="["?n++:n?o==="]"&&n--:i&&(s++,u&&t.set(s,u))}return t}function wn(e,r){const t=yn(e,r);return t.options?new dn(t.pattern,t.flags,t.options):new RegExp(t.pattern,t.flags)}function yn(e,r){const t=Cr(r),n=pr(e,{flags:t.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:t.rules.captureGroup,singleline:t.rules.singleline},skipBackrefValidation:t.rules.allowOrphanBackrefs,unicodePropertyMap:Pe}),s=Vt(n,{accuracy:t.accuracy,asciiWordBoundaries:t.rules.asciiWordBoundaries,avoidSubclass:t.avoidSubclass,bestEffortTarget:t.target}),a=rn(s,t),o=Ft(a.pattern,{captureTransfers:a._captureTransfers,hiddenCaptures:a._hiddenCaptures,mode:"external"}),i=Nt(o.pattern),u=Mt(i.pattern,{captureTransfers:o.captureTransfers,hiddenCaptures:o.hiddenCaptures}),c={pattern:u.pattern,flags:`${t.hasIndices?"d":""}${t.global?"g":""}${a.flags}${a.options.disable.v?"u":"v"}`};if(t.avoidSubclass){if(t.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const l=u.hiddenCaptures.sort((d,m)=>d-m),p=Array.from(u.captureTransfers),f=s._strategy,g=c.pattern.length>=t.lazyCompileLength;(l.length||p.length||f||g)&&(c.options={...l.length&&{hiddenCaptures:l},...p.length&&{transfers:p},...f&&{strategy:f},...g&&{lazyCompile:g}})}return c}const sr=4294967295;class Cn{constructor(r,t={}){me(this,"regexps");this.patterns=r,this.options=t;const{forgiving:n=!1,cache:s,regexConstructor:a}=t;if(!a)throw new Error("Option `regexConstructor` is not provided");this.regexps=r.map(o=>{if(typeof o!="string")return o;const i=s==null?void 0:s.get(o);if(i){if(i instanceof RegExp)return i;if(n)return null;throw i}try{const u=a(o);return s==null||s.set(o,u),u}catch(u){if(s==null||s.set(o,u),n)return null;throw u}})}findNextMatchSync(r,t,n){const s=typeof r=="string"?r:r.content,a=[];function o(i,u,c=0){return{index:i,captureIndices:u.indices.map(l=>l==null?{start:sr,end:sr,length:0}:{start:l[0]+c,end:l[1]+c,length:l[1]-l[0]})}}for(let i=0;i<this.regexps.length;i++){const u=this.regexps[i];if(u)try{u.lastIndex=t;const c=u.exec(s);if(!c)continue;if(c.index===t)return o(i,c,0);a.push([i,c,0])}catch(c){if(this.options.forgiving)continue;throw c}}if(a.length){const i=Math.min(...a.map(u=>u[1].index));for(const[u,c,l]of a)if(c.index===i)return o(u,c,l)}return null}}function bn(e,r){return wn(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...r})}function En(e={}){const r=Object.assign({target:"auto",cache:new Map},e);return r.regexConstructor||(r.regexConstructor=t=>bn(t,{target:r.target})),{createScanner(t){return new Cn(t,r)},createString(t){return{content:t}}}}export{Sn as ShikiError,vn as addClassToHast,_n as applyColorReplacements,Mn as bundledLanguages,Nn as bundledLanguagesAlias,Ln as bundledLanguagesBase,Fn as bundledLanguagesInfo,Gn as bundledThemes,Pn as bundledThemesInfo,Rn as codeToHast,Un as codeToHtml,Tn as codeToTokens,On as codeToTokensBase,Dn as codeToTokensWithThemes,Bn as createBundledHighlighter,zn as createCssVariablesTheme,Hn as createHighlighter,Vn as createHighlighterCore,Wn as createHighlighterCoreSync,En as createJavaScriptRegexEngine,jn as createOnigurumaEngine,Xn as createPositionConverter,Zn as createShikiInternal,Qn as createShikiInternalSync,qn as createSingletonShorthands,Jn as createdBundledHighlighter,bn as defaultJavaScriptRegexConstructor,Kn as enableDeprecationWarnings,Yn as flatTokenVariants,es as getLastGrammarState,rs as getSingletonHighlighter,ts as getSingletonHighlighterCore,ns as getTokenStyleObject,ss as guessEmbeddedLanguages,as as hastToHtml,os as isNoneTheme,is as isPlainLang,us as isSpecialLang,cs as isSpecialTheme,ls as loadWasm,ps as makeSingletonHighlighter,fs as makeSingletonHighlighterCore,ds as normalizeGetter,gs as normalizeTheme,hs as resolveColorReplacements,ms as splitLines,ws as splitToken,ys as splitTokens,Cs as stringifyTokenStyle,bs as toArray,ks as tokenizeAnsiWithTheme,xs as tokenizeWithTheme,$s as tokensToHast,Es as transformerDecorations,As as warnDeprecated};
