mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-12-03 10:33:17 +00:00
5 lines
24 KiB
JavaScript
5 lines
24 KiB
JavaScript
function nt(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const g in i)if(g!=="default"&&!(g in e)){const c=Object.getOwnPropertyDescriptor(i,g);c&&Object.defineProperty(e,g,c.get?c:{enumerable:!0,get:()=>i[g]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var $={};function he(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(t){var n=e[t];typeof n=="object"&&!Object.isFrozen(n)&&he(n)}),e}var ke=he,rt=he;ke.default=rt;class Ne{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function z(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function P(e,...t){const n=Object.create(null);for(const i in e)n[i]=e[i];return t.forEach(function(i){for(const g in i)n[g]=i[g]}),n}const it="</span>",ye=e=>!!e.kind;class st{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=z(t)}openNode(t){if(!ye(t))return;let n=t.kind;t.sublanguage||(n=`${this.classPrefix}${n}`),this.span(n)}closeNode(t){ye(t)&&(this.buffer+=it)}value(){return this.buffer}span(t){this.buffer+=`<span class="${t}">`}}class de{constructor(){this.rootNode={children:[]},this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n={kind:t,children:[]};this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(i=>this._walk(t,i)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{de._collapse(n)}))}}class at extends de{constructor(t){super(),this.options=t}addKeyword(t,n){t!==""&&(this.openNode(n),this.addText(t),this.closeNode())}addText(t){t!==""&&this.add(t)}addSublanguage(t,n){const i=t.root;i.kind=n,i.sublanguage=!0,this.add(i)}toHTML(){return new st(this,this.options).value()}finalize(){return!0}}function lt(e){return new RegExp(e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"m")}function V(e){return e?typeof e=="string"?e:e.source:null}function ot(...e){return e.map(n=>V(n)).join("")}function ct(...e){return"("+e.map(n=>V(n)).join("|")+")"}function ut(e){return new RegExp(e.toString()+"|").exec("").length-1}function gt(e,t){const n=e&&e.exec(t);return n&&n.index===0}const ft=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function ht(e,t="|"){let n=0;return e.map(i=>{n+=1;const g=n;let c=V(i),d="";for(;c.length>0;){const s=ft.exec(c);if(!s){d+=c;break}d+=c.substring(0,s.index),c=c.substring(s.index+s[0].length),s[0][0]==="\\"&&s[1]?d+="\\"+String(Number(s[1])+g):(d+=s[0],s[0]==="("&&n++)}return d}).map(i=>`(${i})`).join(t)}const dt=/\b\B/,Se="[a-zA-Z]\\w*",pe="[a-zA-Z_]\\w*",Ee="\\b\\d+(\\.\\d+)?",Le="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Ie="\\b(0b[01]+)",pt="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Et=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=ot(t,/.*\b/,e.binary,/\b.*/)),P({className:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,i)=>{n.index!==0&&i.ignoreMatch()}},e)},X={begin:"\\\\[\\s\\S]",relevance:0},bt={className:"string",begin:"'",end:"'",illegal:"\\n",contains:[X]},xt={className:"string",begin:'"',end:'"',illegal:"\\n",contains:[X]},Te={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},re=function(e,t,n={}){const i=P({className:"comment",begin:e,end:t,contains:[]},n);return i.contains.push(Te),i.contains.push({className:"doctag",begin:"(?:TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):",relevance:0}),i},_t=re("//","$"),vt=re("/\\*","\\*/"),Rt=re("#","$"),Nt={className:"number",begin:Ee,relevance:0},yt={className:"number",begin:Le,relevance:0},Mt={className:"number",begin:Ie,relevance:0},wt={className:"number",begin:Ee+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},mt={begin:/(?=\/[^/\n]*\/)/,contains:[{className:"regexp",begin:/\//,end:/\/[gimuy]*/,illegal:/\n/,contains:[X,{begin:/\[/,end:/\]/,relevance:0,contains:[X]}]}]},Ot={className:"title",begin:Se,relevance:0},At={className:"title",begin:pe,relevance:0},kt={begin:"\\.\\s*"+pe,relevance:0},St=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var te=Object.freeze({__proto__:null,MATCH_NOTHING_RE:dt,IDENT_RE:Se,UNDERSCORE_IDENT_RE:pe,NUMBER_RE:Ee,C_NUMBER_RE:Le,BINARY_NUMBER_RE:Ie,RE_STARTERS_RE:pt,SHEBANG:Et,BACKSLASH_ESCAPE:X,APOS_STRING_MODE:bt,QUOTE_STRING_MODE:xt,PHRASAL_WORDS_MODE:Te,COMMENT:re,C_LINE_COMMENT_MODE:_t,C_BLOCK_COMMENT_MODE:vt,HASH_COMMENT_MODE:Rt,NUMBER_MODE:Nt,C_NUMBER_MODE:yt,BINARY_NUMBER_MODE:Mt,CSS_NUMBER_MODE:wt,REGEXP_MODE:mt,TITLE_MODE:Ot,UNDERSCORE_TITLE_MODE:At,METHOD_GUARD:kt,END_SAME_AS_BEGIN:St});function Lt(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function It(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=Lt,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function Tt(e,t){Array.isArray(e.illegal)&&(e.illegal=ct(...e.illegal))}function Bt(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function Dt(e,t){e.relevance===void 0&&(e.relevance=1)}const Pt=["of","and","for","in","not","or","if","then","parent","list","value"],Ct="keyword";function Be(e,t,n=Ct){const i={};return typeof e=="string"?g(n,e.split(" ")):Array.isArray(e)?g(n,e):Object.keys(e).forEach(function(c){Object.assign(i,Be(e[c],t,c))}),i;function g(c,d){t&&(d=d.map(s=>s.toLowerCase())),d.forEach(function(s){const a=s.split("|");i[a[0]]=[c,Ht(a[0],a[1])]})}}function Ht(e,t){return t?Number(t):Ut(e)?0:1}function Ut(e){return Pt.includes(e.toLowerCase())}function jt(e,{plugins:t}){function n(s,a){return new RegExp(V(s),"m"+(e.case_insensitive?"i":"")+(a?"g":""))}class i{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(a,h){h.position=this.position++,this.matchIndexes[this.matchAt]=h,this.regexes.push([h,a]),this.matchAt+=ut(a)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const a=this.regexes.map(h=>h[1]);this.matcherRe=n(ht(a),!0),this.lastIndex=0}exec(a){this.matcherRe.lastIndex=this.lastIndex;const h=this.matcherRe.exec(a);if(!h)return null;const u=h.findIndex((w,I)=>I>0&&w!==void 0),x=this.matchIndexes[u];return h.splice(0,u),Object.assign(h,x)}}class g{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(a){if(this.multiRegexes[a])return this.multiRegexes[a];const h=new i;return this.rules.slice(a).forEach(([u,x])=>h.addRule(u,x)),h.compile(),this.multiRegexes[a]=h,h}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(a,h){this.rules.push([a,h]),h.type==="begin"&&this.count++}exec(a){const h=this.getMatcher(this.regexIndex);h.lastIndex=this.lastIndex;let u=h.exec(a);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const x=this.getMatcher(0);x.lastIndex=this.lastIndex+1,u=x.exec(a)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function c(s){const a=new g;return s.contains.forEach(h=>a.addRule(h.begin,{rule:h,type:"begin"})),s.terminatorEnd&&a.addRule(s.terminatorEnd,{type:"end"}),s.illegal&&a.addRule(s.illegal,{type:"illegal"}),a}function d(s,a){const h=s;if(s.isCompiled)return h;[Bt].forEach(x=>x(s,a)),e.compilerExtensions.forEach(x=>x(s,a)),s.__beforeBegin=null,[It,Tt,Dt].forEach(x=>x(s,a)),s.isCompiled=!0;let u=null;if(typeof s.keywords=="object"&&(u=s.keywords.$pattern,delete s.keywords.$pattern),s.keywords&&(s.keywords=Be(s.keywords,e.case_insensitive)),s.lexemes&&u)throw new Error("ERR: Prefer `keywords.$pattern` to `mode.lexemes`, BOTH are not allowed. (see mode reference) ");return u=u||s.lexemes||/\w+/,h.keywordPatternRe=n(u,!0),a&&(s.begin||(s.begin=/\B|\b/),h.beginRe=n(s.begin),s.endSameAsBegin&&(s.end=s.begin),!s.end&&!s.endsWithParent&&(s.end=/\B|\b/),s.end&&(h.endRe=n(s.end)),h.terminatorEnd=V(s.end)||"",s.endsWithParent&&a.terminatorEnd&&(h.terminatorEnd+=(s.end?"|":"")+a.terminatorEnd)),s.illegal&&(h.illegalRe=n(s.illegal)),s.contains||(s.contains=[]),s.contains=[].concat(...s.contains.map(function(x){return $t(x==="self"?s:x)})),s.contains.forEach(function(x){d(x,h)}),s.starts&&d(s.starts,a),h.matcher=c(h),h}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=P(e.classNameAliases||{}),d(e)}function De(e){return e?e.endsWithParent||De(e.starts):!1}function $t(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return P(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:De(e)?P(e,{starts:e.starts?P(e.starts):null}):Object.isFrozen(e)?P(e):e}var Gt="10.7.3";function Kt(e){return!!(e||e==="")}function Ft(e){const t={props:["language","code","autodetect"],data:function(){return{detectedLanguage:"",unknownLanguage:!1}},computed:{className(){return this.unknownLanguage?"":"hljs "+this.detectedLanguage},highlighted(){if(!this.autoDetect&&!e.getLanguage(this.language))return console.warn(`The language "${this.language}" you specified could not be found.`),this.unknownLanguage=!0,z(this.code);let i={};return this.autoDetect?(i=e.highlightAuto(this.code),this.detectedLanguage=i.language):(i=e.highlight(this.language,this.code,this.ignoreIllegals),this.detectedLanguage=this.language),i.value},autoDetect(){return!this.language||Kt(this.autodetect)},ignoreIllegals(){return!0}},render(i){return i("pre",{},[i("code",{class:this.className,domProps:{innerHTML:this.highlighted}})])}};return{Component:t,VuePlugin:{install(i){i.component("highlightjs",t)}}}}const zt={"after:highlightElement":({el:e,result:t,text:n})=>{const i=Me(e);if(!i.length)return;const g=document.createElement("div");g.innerHTML=t.value,t.value=Wt(i,Me(g),n)}};function fe(e){return e.nodeName.toLowerCase()}function Me(e){const t=[];return function n(i,g){for(let c=i.firstChild;c;c=c.nextSibling)c.nodeType===3?g+=c.nodeValue.length:c.nodeType===1&&(t.push({event:"start",offset:g,node:c}),g=n(c,g),fe(c).match(/br|hr|img|input/)||t.push({event:"stop",offset:g,node:c}));return g}(e,0),t}function Wt(e,t,n){let i=0,g="";const c=[];function d(){return!e.length||!t.length?e.length?e:t:e[0].offset!==t[0].offset?e[0].offset<t[0].offset?e:t:t[0].event==="start"?e:t}function s(u){function x(w){return" "+w.nodeName+'="'+z(w.value)+'"'}g+="<"+fe(u)+[].map.call(u.attributes,x).join("")+">"}function a(u){g+="</"+fe(u)+">"}function h(u){(u.event==="start"?s:a)(u.node)}for(;e.length||t.length;){let u=d();if(g+=z(n.substring(i,u[0].offset)),i=u[0].offset,u===e){c.reverse().forEach(a);do h(u.splice(0,1)[0]),u=d();while(u===e&&u.length&&u[0].offset===i);c.reverse().forEach(s)}else u[0].event==="start"?c.push(u[0].node):c.pop(),h(u.splice(0,1)[0])}return g+z(n.substr(i))}const we={},ue=e=>{console.error(e)},me=(e,...t)=>{console.log(`WARN: ${e}`,...t)},m=(e,t)=>{we[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),we[`${e}/${t}`]=!0)},ge=z,Oe=P,Ae=Symbol("nomatch"),Vt=function(e){const t=Object.create(null),n=Object.create(null),i=[];let g=!0;const c=/(^(<[^>]+>|\t|)+|\n)/gm,d="Could not find the language '{}', did you forget to load/include a language module?",s={disableAutodetect:!0,name:"Plain text",contains:[]};let a={noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:null,__emitter:at};function h(r){return a.noHighlightRe.test(r)}function u(r){let l=r.className+" ";l+=r.parentNode?r.parentNode.className:"";const b=a.languageDetectRe.exec(l);if(b){const v=T(b[1]);return v||(me(d.replace("{}",b[1])),me("Falling back to no-highlight mode for this block.",r)),v?b[1]:"no-highlight"}return l.split(/\s+/).find(v=>h(v)||T(v))}function x(r,l,b,v){let N="",j="";typeof l=="object"?(N=r,b=l.ignoreIllegals,j=l.language,v=void 0):(m("10.7.0","highlight(lang, code, ...args) has been deprecated."),m("10.7.0",`Please use highlight(code, options) instead.
|
|
https://github.com/highlightjs/highlight.js/issues/2277`),j=r,N=l);const A={code:N,language:j};J("before:highlight",A);const k=A.result?A.result:w(A.language,A.code,b,v);return k.code=A.code,J("after:highlight",k),k}function w(r,l,b,v){function N(o,f){const E=K.case_insensitive?f[0].toLowerCase():f[0];return Object.prototype.hasOwnProperty.call(o.keywords,E)&&o.keywords[E]}function j(){if(!p.keywords){y.addText(R);return}let o=0;p.keywordPatternRe.lastIndex=0;let f=p.keywordPatternRe.exec(R),E="";for(;f;){E+=R.substring(o,f.index);const _=N(p,f);if(_){const[M,ee]=_;if(y.addText(E),E="",Q+=ee,M.startsWith("_"))E+=f[0];else{const tt=K.classNameAliases[M]||M;y.addKeyword(f[0],tt)}}else E+=f[0];o=p.keywordPatternRe.lastIndex,f=p.keywordPatternRe.exec(R)}E+=R.substr(o),y.addText(E)}function A(){if(R==="")return;let o=null;if(typeof p.subLanguage=="string"){if(!t[p.subLanguage]){y.addText(R);return}o=w(p.subLanguage,R,!0,Re[p.subLanguage]),Re[p.subLanguage]=o.top}else o=U(R,p.subLanguage.length?p.subLanguage:null);p.relevance>0&&(Q+=o.relevance),y.addSublanguage(o.emitter,o.language)}function k(){p.subLanguage!=null?A():j(),R=""}function S(o){return o.className&&y.openNode(K.classNameAliases[o.className]||o.className),p=Object.create(o,{parent:{value:p}}),p}function D(o,f,E){let _=gt(o.endRe,E);if(_){if(o["on:end"]){const M=new Ne(o);o["on:end"](f,M),M.isMatchIgnored&&(_=!1)}if(_){for(;o.endsParent&&o.parent;)o=o.parent;return o}}if(o.endsWithParent)return D(o.parent,f,E)}function Ye(o){return p.matcher.regexIndex===0?(R+=o[0],1):(ce=!0,0)}function Je(o){const f=o[0],E=o.rule,_=new Ne(E),M=[E.__beforeBegin,E["on:begin"]];for(const ee of M)if(ee&&(ee(o,_),_.isMatchIgnored))return Ye(f);return E&&E.endSameAsBegin&&(E.endRe=lt(f)),E.skip?R+=f:(E.excludeBegin&&(R+=f),k(),!E.returnBegin&&!E.excludeBegin&&(R=f)),S(E),E.returnBegin?0:f.length}function Ze(o){const f=o[0],E=l.substr(o.index),_=D(p,o,E);if(!_)return Ae;const M=p;M.skip?R+=f:(M.returnEnd||M.excludeEnd||(R+=f),k(),M.excludeEnd&&(R=f));do p.className&&y.closeNode(),!p.skip&&!p.subLanguage&&(Q+=p.relevance),p=p.parent;while(p!==_.parent);return _.starts&&(_.endSameAsBegin&&(_.starts.endRe=_.endRe),S(_.starts)),M.returnEnd?0:f.length}function Qe(){const o=[];for(let f=p;f!==K;f=f.parent)f.className&&o.unshift(f.className);o.forEach(f=>y.openNode(f))}let Z={};function ve(o,f){const E=f&&f[0];if(R+=o,E==null)return k(),0;if(Z.type==="begin"&&f.type==="end"&&Z.index===f.index&&E===""){if(R+=l.slice(f.index,f.index+1),!g){const _=new Error("0 width match regex");throw _.languageName=r,_.badRule=Z.rule,_}return 1}if(Z=f,f.type==="begin")return Je(f);if(f.type==="illegal"&&!b){const _=new Error('Illegal lexeme "'+E+'" for mode "'+(p.className||"<unnamed>")+'"');throw _.mode=p,_}else if(f.type==="end"){const _=Ze(f);if(_!==Ae)return _}if(f.type==="illegal"&&E==="")return 1;if(oe>1e5&&oe>f.index*3)throw new Error("potential infinite loop, way more iterations than matches");return R+=E,E.length}const K=T(r);if(!K)throw ue(d.replace("{}",r)),new Error('Unknown language: "'+r+'"');const et=jt(K,{plugins:i});let le="",p=v||et;const Re={},y=new a.__emitter(a);Qe();let R="",Q=0,F=0,oe=0,ce=!1;try{for(p.matcher.considerAll();;){oe++,ce?ce=!1:p.matcher.considerAll(),p.matcher.lastIndex=F;const o=p.matcher.exec(l);if(!o)break;const f=l.substring(F,o.index),E=ve(f,o);F=o.index+E}return ve(l.substr(F)),y.closeAllNodes(),y.finalize(),le=y.toHTML(),{relevance:Math.floor(Q),value:le,language:r,illegal:!1,emitter:y,top:p}}catch(o){if(o.message&&o.message.includes("Illegal"))return{illegal:!0,illegalBy:{msg:o.message,context:l.slice(F-100,F+100),mode:o.mode},sofar:le,relevance:0,value:ge(l),emitter:y};if(g)return{illegal:!1,relevance:0,value:ge(l),emitter:y,language:r,top:p,errorRaised:o};throw o}}function I(r){const l={relevance:0,emitter:new a.__emitter(a),value:ge(r),illegal:!1,top:s};return l.emitter.addText(r),l}function U(r,l){l=l||a.languages||Object.keys(t);const b=I(r),v=l.filter(T).filter(_e).map(S=>w(S,r,!1));v.unshift(b);const N=v.sort((S,D)=>{if(S.relevance!==D.relevance)return D.relevance-S.relevance;if(S.language&&D.language){if(T(S.language).supersetOf===D.language)return 1;if(T(D.language).supersetOf===S.language)return-1}return 0}),[j,A]=N,k=j;return k.second_best=A,k}function G(r){return a.tabReplace||a.useBR?r.replace(c,l=>l===`
|
|
`?a.useBR?"<br>":l:a.tabReplace?l.replace(/\t/g,a.tabReplace):l):r}function q(r,l,b){const v=l?n[l]:b;r.classList.add("hljs"),v&&r.classList.add(v)}const O={"before:highlightElement":({el:r})=>{a.useBR&&(r.innerHTML=r.innerHTML.replace(/\n/g,"").replace(/<br[ /]*>/g,`
|
|
`))},"after:highlightElement":({result:r})=>{a.useBR&&(r.value=r.value.replace(/\n/g,"<br>"))}},ie=/^(<[^>]+>|\t)+/gm,W={"after:highlightElement":({result:r})=>{a.tabReplace&&(r.value=r.value.replace(ie,l=>l.replace(/\t/g,a.tabReplace)))}};function Y(r){let l=null;const b=u(r);if(h(b))return;J("before:highlightElement",{el:r,language:b}),l=r;const v=l.textContent,N=b?x(v,{language:b,ignoreIllegals:!0}):U(v);J("after:highlightElement",{el:r,result:N,text:v}),r.innerHTML=N.value,q(r,b,N.language),r.result={language:N.language,re:N.relevance,relavance:N.relevance},N.second_best&&(r.second_best={language:N.second_best.language,re:N.second_best.relevance,relavance:N.second_best.relevance})}function Ue(r){r.useBR&&(m("10.3.0","'useBR' will be removed entirely in v11.0"),m("10.3.0","Please see https://github.com/highlightjs/highlight.js/issues/2559")),a=Oe(a,r)}const se=()=>{if(se.called)return;se.called=!0,m("10.6.0","initHighlighting() is deprecated. Use highlightAll() instead."),document.querySelectorAll("pre code").forEach(Y)};function je(){m("10.6.0","initHighlightingOnLoad() is deprecated. Use highlightAll() instead."),ae=!0}let ae=!1;function be(){if(document.readyState==="loading"){ae=!0;return}document.querySelectorAll("pre code").forEach(Y)}function $e(){ae&&be()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",$e,!1);function Ge(r,l){let b=null;try{b=l(e)}catch(v){if(ue("Language definition for '{}' could not be registered.".replace("{}",r)),g)ue(v);else throw v;b=s}b.name||(b.name=r),t[r]=b,b.rawDefinition=l.bind(null,e),b.aliases&&xe(b.aliases,{languageName:r})}function Ke(r){delete t[r];for(const l of Object.keys(n))n[l]===r&&delete n[l]}function Fe(){return Object.keys(t)}function ze(r){m("10.4.0","requireLanguage will be removed entirely in v11."),m("10.4.0","Please see https://github.com/highlightjs/highlight.js/pull/2844");const l=T(r);if(l)return l;throw new Error("The '{}' language is required, but not loaded.".replace("{}",r))}function T(r){return r=(r||"").toLowerCase(),t[r]||t[n[r]]}function xe(r,{languageName:l}){typeof r=="string"&&(r=[r]),r.forEach(b=>{n[b.toLowerCase()]=l})}function _e(r){const l=T(r);return l&&!l.disableAutodetect}function We(r){r["before:highlightBlock"]&&!r["before:highlightElement"]&&(r["before:highlightElement"]=l=>{r["before:highlightBlock"](Object.assign({block:l.el},l))}),r["after:highlightBlock"]&&!r["after:highlightElement"]&&(r["after:highlightElement"]=l=>{r["after:highlightBlock"](Object.assign({block:l.el},l))})}function Ve(r){We(r),i.push(r)}function J(r,l){const b=r;i.forEach(function(v){v[b]&&v[b](l)})}function Xe(r){return m("10.2.0","fixMarkup will be removed entirely in v11.0"),m("10.2.0","Please see https://github.com/highlightjs/highlight.js/issues/2534"),G(r)}function qe(r){return m("10.7.0","highlightBlock will be removed entirely in v12.0"),m("10.7.0","Please use highlightElement now."),Y(r)}Object.assign(e,{highlight:x,highlightAuto:U,highlightAll:be,fixMarkup:Xe,highlightElement:Y,highlightBlock:qe,configure:Ue,initHighlighting:se,initHighlightingOnLoad:je,registerLanguage:Ge,unregisterLanguage:Ke,listLanguages:Fe,getLanguage:T,registerAliases:xe,requireLanguage:ze,autoDetection:_e,inherit:Oe,addPlugin:Ve,vuePlugin:Ft(e).VuePlugin}),e.debugMode=function(){g=!1},e.safeMode=function(){g=!0},e.versionString=Gt;for(const r in te)typeof te[r]=="object"&&ke(te[r]);return Object.assign(e,te),e.addPlugin(O),e.addPlugin(zt),e.addPlugin(W),e};var Xt=Vt({}),qt=Xt,Pe={exports:{}};(function(e){(function(){var t;t=e.exports=g,t.format=g,t.vsprintf=i,typeof console<"u"&&typeof console.log=="function"&&(t.printf=n);function n(){console.log(g.apply(null,arguments))}function i(c,d){return g.apply(null,[c].concat(d))}function g(c){for(var d=1,s=[].slice.call(arguments),a=0,h=c.length,u="",x,w=!1,I,U,G=!1,q,O=function(){return s[d++]},ie=function(){for(var W="";/\d/.test(c[a]);)W+=c[a++],x=c[a];return W.length>0?parseInt(W):null};a<h;++a)if(x=c[a],w)switch(w=!1,x=="."?(G=!1,x=c[++a]):x=="0"&&c[a+1]=="."?(G=!0,a+=2,x=c[a]):G=!0,q=ie(),x){case"b":u+=parseInt(O(),10).toString(2);break;case"c":I=O(),typeof I=="string"||I instanceof String?u+=I:u+=String.fromCharCode(parseInt(I,10));break;case"d":u+=parseInt(O(),10);break;case"f":U=String(parseFloat(O()).toFixed(q||6)),u+=G?U:U.replace(/^0/,"");break;case"j":u+=JSON.stringify(O());break;case"o":u+="0"+parseInt(O(),10).toString(8);break;case"s":u+=O();break;case"x":u+="0x"+parseInt(O(),10).toString(16);break;case"X":u+="0x"+parseInt(O(),10).toString(16).toUpperCase();break;default:u+=x;break}else x==="%"?w=!0:u+=x;return u}})()})(Pe);var Yt=Pe.exports,Jt=Yt,C=H(Error),Zt=C;C.eval=H(EvalError);C.range=H(RangeError);C.reference=H(ReferenceError);C.syntax=H(SyntaxError);C.type=H(TypeError);C.uri=H(URIError);C.create=H;function H(e){return t.displayName=e.displayName||e.name,t;function t(n){return n&&(n=Jt.apply(null,arguments)),new e(n)}}var L=qt,ne=Zt,Qt=$.highlight=Ce,en=$.highlightAuto=an,tn=$.registerLanguage=ln,nn=$.listLanguages=on,rn=$.registerAlias=cn;B.prototype.addText=fn;B.prototype.addKeyword=un;B.prototype.addSublanguage=gn;B.prototype.openNode=hn;B.prototype.closeNode=dn;B.prototype.closeAllNodes=He;B.prototype.finalize=He;B.prototype.toHTML=pn;var sn="hljs-";function Ce(e,t,n){var i=L.configure({}),g=n||{},c=g.prefix,d;if(typeof e!="string")throw ne("Expected `string` for name, got `%s`",e);if(!L.getLanguage(e))throw ne("Unknown language: `%s` is not registered",e);if(typeof t!="string")throw ne("Expected `string` for value, got `%s`",t);if(c==null&&(c=sn),L.configure({__emitter:B,classPrefix:c}),d=L.highlight(t,{language:e,ignoreIllegals:!0}),L.configure(i||{}),d.errorRaised)throw d.errorRaised;return{relevance:d.relevance,language:d.language,value:d.emitter.rootNode.children}}function an(e,t){var n=t||{},i=n.subset||L.listLanguages();n.prefix;var g=i.length,c=-1,d,s,a,h;if(typeof e!="string")throw ne("Expected `string` for value, got `%s`",e);for(s={relevance:0,language:null,value:[]},d={relevance:0,language:null,value:[]};++c<g;)h=i[c],L.getLanguage(h)&&(a=Ce(h,e,t),a.language=h,a.relevance>s.relevance&&(s=a),a.relevance>d.relevance&&(s=d,d=a));return s.language&&(d.secondBest=s),d}function ln(e,t){L.registerLanguage(e,t)}function on(){return L.listLanguages()}function cn(e,t){var n=e,i;t&&(n={},n[e]=t);for(i in n)L.registerAliases(n[i],{languageName:i})}function B(e){this.options=e,this.rootNode={children:[]},this.stack=[this.rootNode]}function un(e,t){this.openNode(t),this.addText(e),this.closeNode()}function gn(e,t){var n=this.stack,i=n[n.length-1],g=e.rootNode.children,c=t?{type:"element",tagName:"span",properties:{className:[t]},children:g}:g;i.children=i.children.concat(c)}function fn(e){var t=this.stack,n,i;e!==""&&(n=t[t.length-1],i=n.children[n.children.length-1],i&&i.type==="text"?i.value+=e:n.children.push({type:"text",value:e}))}function hn(e){var t=this.stack,n=this.options.classPrefix+e,i=t[t.length-1],g={type:"element",tagName:"span",properties:{className:[n]},children:[]};i.children.push(g),t.push(g)}function dn(){this.stack.pop()}function pn(){return""}function He(){}const En=nt({__proto__:null,default:$,highlight:Qt,highlightAuto:en,listLanguages:nn,registerAlias:rn,registerLanguage:tn},[$]);export{En as c};
|