| 121 | Z |
| 122 | ;if("object"!=typeof e.endScope||null===e.endScope)throw K("endScope must be object"), |
| 123 | Z;G(e,e.end,{key:"endScope"}),e.end=f(e.end,{joinWith:""})}})(e)}function Q(e){ |
| 124 | function n(n,t){ |
| 125 | return RegExp(d(n),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(t?"g":"")) |
| 126 | }class t{constructor(){ |
| 127 | this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0} |
| 128 | addRule(e,n){ |
| 129 | n.position=this.position++,this.matchIndexes[this.matchAt]=n,this.regexes.push([n,e]), |
| 130 | this.matchAt+=_(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null) |
| 131 | ;const e=this.regexes.map((e=>e[1]));this.matcherRe=n(f(e,{joinWith:"|" |
| 132 | }),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex |
| 133 | ;const n=this.matcherRe.exec(e);if(!n)return null |
| 134 | ;const t=n.findIndex(((e,n)=>n>0&&void 0!==e)),a=this.matchIndexes[t] |
| 135 | ;return n.splice(0,t),Object.assign(n,a)}}class a{constructor(){ |
| 136 | this.rules=[],this.multiRegexes=[], |
| 137 | this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){ |
| 138 | if(this.multiRegexes[e])return this.multiRegexes[e];const n=new t |
| 139 | ;return this.rules.slice(e).forEach((([e,t])=>n.addRule(e,t))), |
| 140 | n.compile(),this.multiRegexes[e]=n,n}resumingScanAtSamePosition(){ |
| 141 | return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,n){ |
| 142 | this.rules.push([e,n]),"begin"===n.type&&this.count++}exec(e){ |
| 143 | const n=this.getMatcher(this.regexIndex);n.lastIndex=this.lastIndex |
| 144 | ;let t=n.exec(e) |
| 145 | ;if(this.resumingScanAtSamePosition())if(t&&t.index===this.lastIndex);else{ |
| 146 | const n=this.getMatcher(0);n.lastIndex=this.lastIndex+1,t=n.exec(e)} |
| 147 | return t&&(this.regexIndex+=t.position+1, |
| 148 | this.regexIndex===this.count&&this.considerAll()),t}} |
| 149 | if(e.compilerExtensions||(e.compilerExtensions=[]), |
| 150 | e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.") |
| 151 | ;return e.classNameAliases=i(e.classNameAliases||{}),function t(r,s){const o=r |
| 152 | ;if(r.isCompiled)return o |
| 153 | ;[D,B,W,z].forEach((e=>e(r,s))),e.compilerExtensions.forEach((e=>e(r,s))), |
| 154 | r.__beforeBegin=null,[I,L,$].forEach((e=>e(r,s))),r.isCompiled=!0;let l=null |
| 155 | ;return"object"==typeof r.keywords&&r.keywords.$pattern&&(r.keywords=Object.assign({},r.keywords), |
| 156 | l=r.keywords.$pattern, |
| 157 | delete r.keywords.$pattern),l=l||/\w+/,r.keywords&&(r.keywords=U(r.keywords,e.case_insensitive)), |
| 158 | o.keywordPatternRe=n(l,!0), |
| 159 | s&&(r.begin||(r.begin=/\B|\b/),o.beginRe=n(o.begin),r.end||r.endsWithParent||(r.end=/\B|\b/), |
| 160 | r.end&&(o.endRe=n(o.end)), |
| 161 | o.terminatorEnd=d(o.end)||"",r.endsWithParent&&s.terminatorEnd&&(o.terminatorEnd+=(r.end?"|":"")+s.terminatorEnd)), |
| 162 | r.illegal&&(o.illegalRe=n(r.illegal)), |
| 163 | r.contains||(r.contains=[]),r.contains=[].concat(...r.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((n=>i(e,{ |
| 164 | variants:null},n)))),e.cachedVariants?e.cachedVariants:X(e)?i(e,{ |
| 165 | starts:e.starts?i(e.starts):null |
| 166 | }):Object.isFrozen(e)?i(e):e))("self"===e?r:e)))),r.contains.forEach((e=>{t(e,o) |
| 167 | })),r.starts&&t(r.starts,s),o.matcher=(e=>{const n=new a |
| 168 | ;return e.contains.forEach((e=>n.addRule(e.begin,{rule:e,type:"begin" |
| 169 | }))),e.terminatorEnd&&n.addRule(e.terminatorEnd,{type:"end" |
| 170 | }),e.illegal&&n.addRule(e.illegal,{type:"illegal"}),n})(o),o}(e)}function X(e){ |
| 171 | return!!e&&(e.endsWithParent||X(e.starts))}class V extends Error{ |
| 172 | constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}} |
| 173 | const J=a,Y=i,ee=Symbol("nomatch");var ne=(n=>{ |