wikiparser-node 1.24.0 → 1.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/bundle-lsp.min.js +36 -0
- package/bundle/bundle.min.js +29 -0
- package/dist/bin/config.js +1 -1
- package/dist/lib/lsp.d.ts +2 -2
- package/dist/lib/lsp.js +2 -2
- package/extensions/dist/base.js +375 -0
- package/extensions/dist/codejar.js +57 -0
- package/extensions/dist/editor.js +159 -0
- package/extensions/dist/highlight.js +30 -0
- package/extensions/dist/lint.js +80 -0
- package/extensions/dist/lsp.js +89 -0
- package/extensions/editor.css +59 -0
- package/extensions/ui.css +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";(()=>{var rh=Object.defineProperty;var on=e=>{throw TypeError(e)};var nh=(e,t,s)=>t in e?rh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var lh=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ce=(e,t,s)=>nh(e,typeof t!="symbol"?t+"":t,s),Qs=(e,t,s)=>t.has(e)||on("Cannot "+s);var v=(e,t,s)=>(Qs(e,t,"read from private field"),s?s.call(e):t.get(e)),B=(e,t,s)=>t.has(e)?on("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),E=(e,t,s,i)=>(Qs(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),P=(e,t,s)=>(Qs(e,t,"access private method"),s);var an=(e,t,s,i)=>({set _(l){E(e,t,l,s)},get _(){return v(e,t,i)}});var lu=lh((au,ih)=>{var oh=Object.create,Nt=Object.defineProperty,go=Object.getOwnPropertyDescriptor,Nr=Object.getOwnPropertyNames,ah=Object.prototype.hasOwnProperty,po=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Lt=e=>{throw TypeError(e)},fo=(e,t,s)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,hn=(e,t)=>Nt(e,"name",{value:t,configurable:!0}),I=(e,t)=>function(){return e&&(t=(0,e[Nr(e)[0]])(e=0)),t},hh=(e,t)=>function(){return t||(0,e[Nr(e)[0]])((t={exports:{}}).exports,t),t.exports},oe=(e,t)=>{for(var s in t)Nt(e,s,{get:t[s],enumerable:!0})},uh=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Nr(t))!ah.call(e,l)&&l!==s&&Nt(e,l,{get:()=>t[l],enumerable:!(i=go(t,l))||i.enumerable});return e},Y=e=>uh(Nt({},"__esModule",{value:!0}),e),ne=e=>{var t;return[,,,oh((t=e==null?void 0:e[po("metadata")])!=null?t:null)]},mo=["class","method","getter","setter","accessor","field","value","get","set"],Ht=e=>e!==void 0&&typeof e!="function"?Lt("Function expected"):e,dh=(e,t,s,i,l)=>({kind:mo[e],name:t,metadata:i,addInitializer:r=>s._?Lt("Already initialized"):l.push(Ht(r||null))}),Lr=(e,t)=>fo(t,po("metadata"),e[3]),se=(e,t,s,i)=>{for(var l=0,r=e[t>>1],n=r&&r.length;l<n;l++)t&1?r[l].call(s):i=r[l].call(s,i);return i},ie=(e,t,s,i,l,r)=>{var n,o,a,h,u,d=t&7,f=!!(t&8),p=!!(t&16),x=d>3?e.length+1:d?f?1:2:0,A=mo[d+5],S=d>3&&(e[x-1]=[]),y=e[x]||(e[x]=[]),$=d&&(!p&&!f&&(l=l.prototype),d<5&&(d>3||!p)&&go(d<4?l:{get[s](){return de(this,r)},set[s](c){return ke(this,r,c)}},s));d?p&&d<4&&hn(r,(d>2?"set ":d>1?"get ":"")+s):hn(l,s);for(var g=i.length-1;g>=0;g--)h=dh(d,s,a={},e[3],y),d&&(h.static=f,h.private=p,u=h.access={has:p?c=>gh(l,c):c=>s in c},d^3&&(u.get=p?c=>(d^1?de:ur)(c,l,d^4?r:$.get):c=>c[s]),d>2&&(u.set=p?(c,b)=>ke(c,l,b,d^4?r:$.set):(c,b)=>c[s]=b)),o=(0,i[g])(d?d<4?p?r:$[A]:d>4?void 0:{get:$.get,set:$.set}:l,h),a._=1,d^4||o===void 0?Ht(o)&&(d>4?S.unshift(o):d?p?r=o:$[A]=o:l=o):typeof o!="object"||o===null?Lt("Object expected"):(Ht(n=o.get)&&($.get=n),Ht(n=o.set)&&($.set=n),Ht(n=o.init)&&S.unshift(n));return d||Lr(e,l),$&&Nt(l,s,$),p?d^4?r:$:l},ch=(e,t,s)=>fo(e,typeof t!="symbol"?t+"":t,s),Fr=(e,t,s)=>t.has(e)||Lt("Cannot "+s),gh=(e,t)=>Object(t)!==t?Lt('Cannot use the "in" operator on this value'):e.has(t),de=(e,t,s)=>(Fr(e,t,"read from private field"),s?s.call(e):t.get(e)),He=(e,t,s)=>t.has(e)?Lt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),ke=(e,t,s,i)=>(Fr(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),ur=(e,t,s)=>(Fr(e,t,"access private method"),s),ph=(e,t,s,i)=>({set _(l){ke(e,t,l,s)},get _(){return de(e,t,i)}}),xo,Ps,jr=I({"base.ts"(){"use strict";xo=(()=>{const e={redirect:1,onlyinclude:1,noinclude:1,include:1,comment:1,ext:1,arg:2,"magic-word":2,template:2,heading:2,html:3,table:4,hr:5,"double-underscore":5,link:6,category:6,file:6,quote:7,"ext-link":8,"free-ext-link":9,"magic-link":9,list:10,dd:10,converter:11,"list-range":11};return Object.setPrototypeOf(e,null),e})(),Ps=(()=>{const e=["bold-header","format-leakage","fostered-content","h1","illegal-attr","insecure-style","invalid-gallery","invalid-imagemap","invalid-invoke","invalid-isbn","lonely-apos","lonely-bracket","lonely-http","nested-link","no-arg","no-duplicate","no-ignored","obsolete-attr","obsolete-tag","parsing-order","pipe-like","table-layout","tag-like","unbalanced-header","unclosed-comment","unclosed-quote","unclosed-table","unescaped","unknown-page","unmatched-tag","unterminated-url","url-encoding","var-anchor","void-ext"];return Object.freeze(e),e})()}});function Ne(e,t,s){return s===1?e.replace(/\0(\d+)g\x7F/gu,(i,l)=>Ne(String(t[l]),t,2)):s===2?e.replace(/\0(\d+)n\x7F/gu,(i,l)=>String(t[l])):e.replace(/\0(\d+)\x7F/gu,(i,l)=>t[l])}var Ge,Js,$t,_t,Tt,pt,os,Le,ht,un,dn,as,vo,cn,gn,hs,Ct,ce=I({"util/string.ts"(){"use strict";Ge=String.raw` \xA0\u1680\u2000-\u200A\u202F\u205F\u3000`,Js=String.raw`[^[\]<>"\0-\x1F\x7F${Ge}\uFFFD]`,$t=String.raw`(?:\[[\da-f:.]+\]|${Js})`,_t=String.raw`(?:${Js}|\0\d+[cn!~]\x7F)*`,Tt=e=>e.trim().toLowerCase(),pt=(e,t)=>s=>s.replace(e,t),os=pt(/[\0\x7F]|\r$/gmu,""),Le=pt(/\0\d+[cn]\x7F/gu,""),ht=(e,t="")=>e.map(s=>typeof s=="string"?s:s.text()).join(t),un={lt:"<",gt:">",lbrack:"[",rbrack:"]",lbrace:"{",rbrace:"}",nbsp:" ",amp:"&",quot:'"'},dn=pt(/&(?:#(\d+|[Xx][\da-fA-F]+)|([lg]t|[LG]T|[lr]brac[ke]|nbsp|amp|AMP|quot|QUOT));/gu,(e,t,s)=>t?String.fromCodePoint(+((/^x/iu.test(t)?"0":"")+t)):un[s.toLowerCase()]),as=e=>dn(e),vo=pt(/&#(\d+|x[\da-f]+);/giu,(e,t)=>String.fromCodePoint(+((/^x/iu.test(t)?"0":"")+t))),cn={"&":"amp","<":"lt",">":"gt",'"':"quot","\n":"#10"},gn=e=>pt(e,t=>`&${cn[t]};`),hs=gn(/[&<>]/gu),Ct=(e,t={})=>{const{pre:s="",post:i="",sep:l=""}=t;return s+e.map(r=>r.print()).join(l)+i}}}),fh=hh({"config/minimum.json"(e,t){t.exports={ext:[],html:[["b","bdi","del","i","ins","u","font","big","small","sub","sup","h1","h2","h3","h4","h5","h6","cite","code","em","s","strike","strong","tt","var","div","center","blockquote","ol","ul","dl","table","caption","pre","ruby","rb","rp","rt","rtc","p","span","abbr","dfn","kbd","samp","data","time","mark","tr","td","th","q","bdo"],["li","dt","dd"],["br","wbr","hr","meta","link"]],namespaces:{0:"",6:"File",10:"Template",14:"Category",828:"Module"},nsid:{"":0,file:6,template:10,category:14,module:828},functionHook:["msgnw"],variable:["!","=","pageid","articlepath","server","servername","scriptpath","stylepath"],parserFunction:[{msgnw:"msgnw",pageid:"pageid",articlepath:"articlepath",server:"server",servername:"servername",scriptpath:"scriptpath",stylepath:"stylepath","#language":"language","#special":"special","#speciale":"speciale","#tag":"tag","#formatdate":"formatdate","#dateformat":"formatdate","#invoke":"invoke","#while":"while","#dowhile":"dowhile","#loop":"loop","#forargs":"forargs","#fornumargs":"fornumargs","#if":"if","#ifeq":"ifeq","#switch":"switch","#ifexist":"ifexist","#ifexpr":"ifexpr","#iferror":"iferror","#time":"time","#timel":"timel","#expr":"expr","#rel2abs":"rel2abs","#titleparts":"titleparts","#categorytree":"categorytree","#urldecode":"urldecode","#choose":"choose","#var":"var","#varexists":"varexists","#var_final":"var_final","#vardefine":"vardefine","#vardefineecho":"vardefineecho","#widget":"widget","#related":"related","#regex":"regex","#regex_var":"regex_var","#regexquote":"regexquote","#regexall":"regexall","#len":"len","#pos":"pos","#rpos":"rpos","#sub":"sub","#count":"count","#rmatch":"rmatch","#rreplace":"rreplace","#replace":"replace","#rsplit":"rsplit","#explode":"explode","#tab":"tab","#seo":"seo","#babel":"babel","#translation":"translation","#commaseparatedlist":"commaseparatedlist","#coordinates":"coordinates","#lst":"lst","#lsth":"lsth","#lstx":"lstx","#assessment":"assessment","#mentor":"mentor","#property":"property","#target":"target","#section":"lst","#section-x":"lstx","#section-h":"lsth","#statements":"statements","#useliquidthreads":"useliquidthreads","#lqtpagelimit":"lqtpagelimit","#avatar":"avatar","#img":"img","#chart":"chart"},{"!":"!","=":"=","#FORMAL":"formal","#bcp47":"bcp47","#dir":"dir","#interwikilink":"interwikilink","#interlanguagelink":"interlanguagelink","#timef":"timef","#timefl":"timefl"},["msg","raw"],["subst","safesubst"]],doubleUnderscore:[[],[]],protocol:"bitcoin:|ftp://|ftps://|geo:|git://|gopher://|http://|https://|irc://|ircs://|magnet:|mailto:|matrix:|mms://|news:|nntp://|redis://|sftp://|sip:|sips:|sms:|ssh://|svn://|tel:|telnet://|urn:|wikipedia://|worldwind://|xmpp:",interwiki:[],img:{},redirection:["#redirect"],variants:[]}}}),$e,dr,ut=I({"util/constants.ts"(){"use strict";$e=11,dr=fh()}});function ot(e){const t=new Map,s=new WeakMap;return i=>{const l=typeof i=="string"?t:s;if(l.has(i)){const n=l.get(i);return n.lastIndex=0,n}const r=e(i);return l.set(i,r),r}}var us,bo,pn,wo,yo,Je=I({"../common/dist/index.mjs"(){"use strict";us=e=>decodeURIComponent(e.replace(/%(?![\da-f]{2})/giu,"%25")),bo=e=>Math.round(e*255).toString(16).padStart(2,"0"),pn=(()=>{const e=String.raw`#(?:[\da-f]{3,4}|(?:[\da-f]{2}){3,4})(?![\p{L}\p{N}_])`,t=String.raw`(?:\d*\.)?\d+%?`,s=String.raw`(?:\d*\.)?\d+(?:deg|grad|rad|turn)?`,i=String.raw`rgba?\(\s*(?:${String.raw`${new Array(3).fill(t).join(String.raw`\s+`)}(?:\s*\/\s*${t})?`}|${String.raw`${new Array(3).fill(t).join(String.raw`\s*,\s*`)}(?:\s*,\s*${t})?`})\s*\)`,l=String.raw`hsla?\(\s*(?:${String.raw`${s}\s+${t}\s+${t}(?:\s*\/\s*${t})?`}|${String.raw`${s}${String.raw`\s*,\s*(?:\d*\.)?\d+%`.repeat(2)}(?:\s*,\s*${t})?`})\s*\)`;return{full:new RegExp(String.raw`(^|[^\p{L}\p{N}_])(${e}|${i}|${l})`,"giu"),rgb:new RegExp(String.raw`(^|[^\p{L}\p{N}_])(${e}|${i})`,"giu")}})(),wo=(e,t=!0)=>{const s=[],i=pn[t?"full":"rgb"];i.lastIndex=0;let l=i.exec(e),r=0;for(;l;){const n=l.index+l[1].length;n>r&&s.push([e.slice(r,n),r,n,!1]),{lastIndex:r}=i,s.push([l[2],n,r,e[n-1]!=="&"||!/^#\d+$/u.test(l[2])]),l=i.exec(e)}return e.length>r&&s.push([e.slice(r),r,e.length,!1]),s},yo=ot}}),ue,ge=I({"lib/rect.ts"(){"use strict";var e,t,s,i,cr,r;ue=(r=class{constructor(n,o){B(this,i);B(this,e);B(this,t);B(this,s);E(this,e,n),E(this,t,o)}get start(){return v(this,t)}get top(){return P(this,i,cr).call(this).top}get left(){return P(this,i,cr).call(this).left}},e=new WeakMap,t=new WeakMap,s=new WeakMap,i=new WeakSet,cr=function(){var n;return(n=v(this,s))!=null||E(this,s,v(this,e).getRootNode().posFromIndex(v(this,t))),v(this,s)},r)}}),fn,mn,ns,ds,Xs,Q,te,je,Os,Z,Er,Ve,Rr,Pr,Or,cs,It,Br,at,qr,X=I({"util/lint.ts"(){"use strict";Je(),Re(),ge(),G(),fn=new Set(["tr","td","th","caption"]),mn=new Set(["Template:!!","Template:!-"]),ns=e=>{const t=e.childNodes.find(s=>s.text().trim());if(!t||t.type==="text"&&t.data.trim().startsWith("!")||t.is("magic-word")&&t.name==="!"||t.is("template")&&mn.has(t.name)||t.is("html")&&fn.has(t.name))return!1;if(t.is("arg"))return t.length>1&&ns(t.childNodes[1]);if(t.is("magic-word"))try{const s=t.getPossibleValues().map(ns);return s.includes(2)?2:s.includes(1)&&1}catch{}return t.is("template")||t.is("magic-word")&&t.name==="invoke"?1:2},ds=(e,t,s,i)=>({line:e+s-1,character:(s===1?t:0)+i}),Xs=e=>(t,s,i,l,r="error")=>{const{start:n}=s,{top:o,left:a}=s instanceof ue?s:new ue(t,n),{offsetHeight:h,offsetWidth:u}=t,{startIndex:d,startLine:f,startCol:p}=e(t,n,o,a),{line:x,character:A}=ds(f,p,h,u);return{rule:i,message:C.msg(l),severity:r,startIndex:d,endIndex:d+t.toString().length,startLine:f,endLine:x,startCol:p,endCol:A}},Q=Xs((e,t,s,i)=>{const l=e.getRelativeIndex(),{top:r,left:n}=e.parentNode.posFromIndex(l);return{startIndex:t+l,startLine:s+r,startCol:r?n:i+n}}),te=Xs((e,t,s,i)=>({startIndex:t,startLine:s,startCol:i})),je=(e,t,s,i=0)=>({desc:t,range:[e.startIndex+i,e.endIndex],text:s}),Os=(e,t,s)=>({desc:t,range:[e,e],text:s}),Z=(e,t=0,s="")=>typeof e=="number"?{desc:"remove",range:[e,e+t],text:s}:je(e,"remove",s,t),Er=(e,t)=>je(e,"decode",us(t.text().replace(/%(?=21|3[ce]|5[bd]|7[b-d])/giu,"%25"))),Ve=(e,t,s=0)=>({desc:"close",range:[e+s,e],text:t}),Rr=e=>({desc:"open",range:[e+1,e+2],text:""}),Pr=(e,t)=>je(e,"comment",`<!--${t}-->`),Or=(e,t)=>je(e,"uppercase",t.toUpperCase()),cs=(e,t=0)=>({desc:"whitespace",range:[e,e+t],text:" "}),It=(e,t,s=1)=>({desc:"escape",range:[e,e+s],text:t.repeat(s)}),Br=(e,t)=>({desc:"escape",range:[e,e+t.length],text:t.replace(/\|/gu,"|")}),at=(e,t,s,i)=>{if(e&&(i||C.viewOnly&&e[0]===ve.rev))return e[1];const l=t();return(i||C.viewOnly)&&s([ve.rev,l]),l},qr=(e,t)=>e==="ol"&&t==="type"?["1","a","A","i","I"]:e==="th"&&t==="scope"?["row","col","rowgroup","colgroup"]:t==="dir"?["ltr","rtl","auto"]:t==="aria-hidden"?["true","false"]:[]}}),xn,Wr,So=I({"parser/selector.ts"(){"use strict";xn=(e,t,s)=>{if(e.includes("#")){const i=e.indexOf("#");return(i===0||e.slice(0,i)===t)&&e.slice(i+1)===s}return!e||e===t},Wr=(e,t,s)=>{const i=e.split(",");return({type:l,name:r})=>i.some(n=>xn(n.trim(),l,r))}}}),Bs,Ur=I({"mixin/cached.ts"(){"use strict";X(),Bs=(e=!0)=>t=>{const s=new WeakMap;return function(...i){return at(s.get(this),()=>t.apply(this,i),l=>{s.set(this,l)},e)}}}}),Ao,mh=I({"mixin/nodeLike.ts"(){"use strict";Ao=e=>{class t extends e{get firstChild(){return this.childNodes[0]}get lastChild(){return this.childNodes[this.childNodes.length-1]}get offsetHeight(){return this.getDimension().height}get offsetWidth(){return this.getDimension().width}}return t}}}),vn,bn,xs,Et,Rt,vs,Pt,Ot,Bt,rt,ko=I({"lib/node.ts"(){"use strict";X(),Re(),Ur(),mh(),G(),bn=[Ao],vn=[Bs(!1)],rt=class{constructor(){se(Bt,5,this),ch(this,"childNodes",[]),He(this,xs),He(this,Et),He(this,Rt),He(this,vs),He(this,Pt),He(this,Ot,{})}get parentNode(){return de(this,xs)}get nextSibling(){return de(this,Et)}get previousSibling(){return de(this,Rt)}getChildNodes(){const{childNodes:e}=this;return Object.isFrozen(e)?[...e]:e}getAttribute(e){return e==="padding"?0:this[e]}setAttribute(e,t){switch(e){case"parentNode":ke(this,xs,t),t||(ke(this,Et,void 0),ke(this,Rt,void 0));break;case"nextSibling":ke(this,Et,t);break;case"previousSibling":ke(this,Rt,t);break;case"aIndex":C.viewOnly&&ke(this,Pt,[ve.rev,t]);break;default:this[e]=t}}getRootNode(){return at(de(this,vs),()=>{var e,t;return(t=(e=this.parentNode)==null?void 0:e.getRootNode())!=null?t:this},e=>{const[,t]=e;t.type==="root"&&ke(this,vs,e)})}indexFromPos(e,t){{if(e<0||t<0)return;const s=this.getLines();if(e>=s.length)return;const[,i,l]=s[e],r=i+t;return r>l?void 0:r}this.lspError("AstNode.indexFromPos")}posFromIndex(e){const{length:t}=String(this);if(e+=e<0?t:0,e>=0&&e<=t){const s=this.getLines(),i=s.findIndex(([,,l])=>e<=l);return{top:i,left:e-s[i][1]}}}getDimension(){const e=this.getLines(),t=e[e.length-1];return{height:e.length,width:t[2]-t[1]}}getGaps(e){return 0}getRelativeIndex(e){if(e===void 0){const{parentNode:t}=this;return t?t.getRelativeIndex(t.childNodes.indexOf(this)):0}return at(de(this,Ot)[e],()=>{const{childNodes:t}=this,s=e+(e<0?t.length:0);let i=this.getAttribute("padding");for(let l=0;l<s;l++)C.viewOnly&&(de(this,Ot)[l]=[ve.rev,i]),i+=t[l].toString().length+this.getGaps(l);return i},t=>{de(this,Ot)[e]=t})}getAbsoluteIndex(){return at(de(this,Pt),()=>{const{parentNode:e}=this;return e?e.getAbsoluteIndex()+this.getRelativeIndex():0},e=>{ke(this,Pt,e)})}getBoundingClientRect(){return{...this.getDimension(),...this.getRootNode().posFromIndex(this.getAbsoluteIndex())}}is(e){return this.type===e}getLines(){const e=[];let t=0;for(const s of String(this).split(`
|
|
2
|
+
`)){const i=t+s.length;e.push([s,t,i]),t=i+1}return e}seal(e,t){const s=!t&&!!this[e];Object.defineProperty(this,e,{enumerable:s,configurable:!0})}lspError(e){throw new Error(`${e} method is only available in the LSP version!`)}},Bt=ne(null),xs=new WeakMap,Et=new WeakMap,Rt=new WeakMap,vs=new WeakMap,Pt=new WeakMap,Ot=new WeakMap,ie(Bt,1,"getLines",vn,rt),rt=ie(Bt,0,"AstNode",bn,rt),se(Bt,1,rt)}}),$o,xh=I({"mixin/elementLike.ts"(){"use strict";So(),$o=e=>{var s,gr;class t extends e{constructor(){super(...arguments);B(this,s)}getElementBy(n){for(const o of this.childNodes){if(o.type==="text")continue;if(n(o))return o;const a=o.getElementBy(n);if(a)return a}}querySelector(n){return this.getElementBy(P(this,s,gr).call(this,n))}getElementsBy(n,o=[]){for(const a of this.childNodes)a.type!=="text"&&(n(a)&&o.push(a),a.getElementsBy(n,o));return o}querySelectorAll(n){return this.getElementsBy(P(this,s,gr).call(this,n))}escape(){for(const n of this.childNodes)n.escape()}}return s=new WeakSet,gr=function(n){return Wr(n,this)},t}}}),wn,Ks,yn,Dt,vh=I({"lib/element.ts"(){"use strict";ce(),Re(),So(),ko(),xh(),wn=[$o],Dt=class extends(yn=rt){get length(){return this.childNodes.length}text(e){return ht(this.childNodes,e)}normalize(){const e=this.getChildNodes(),t=s=>{var i,l;e.splice(s,1),(i=e[s-1])==null||i.setAttribute("nextSibling",e[s]),(l=e[s])==null||l.setAttribute("previousSibling",e[s-1])};for(let s=e.length-1;s>=0;s--){const{type:i,data:l}=e[s];i!=="text"||e.length===1||this.getGaps(s-(s&&1))||l===""&&t(s)}this.setAttribute("childNodes",e)}removeAt(e){return ps(this,e,1)[0]}insertAt(e,t=this.length){return ps(this,t,0,[e]),e}closest(e){const t=Wr(e,this);let{parentNode:s}=this;for(;s;){if(t(s))return s;({parentNode:s}=s)}}append(...e){this.safeAppend(e)}safeAppend(e){for(const t of e)this.insertAt(t)}safeReplaceChildren(e){for(let t=this.length-1;t>=0;t--)this.removeAt(t);this.safeAppend(e)}setText(e,t=0){t+=t<0?this.length:0;const s=this.childNodes[t],{data:i}=s;return s.replaceData(e),i}toString(e,t=""){return this.childNodes.map(s=>s.toString(e)).join(t)}caretPositionFromIndex(e){{if(e===void 0)return;const{length:t}=this.toString();if(e>t||e<-t)return;e+=e<0?t:0;let s=this,i=0,l=0;for(;s.type!=="text";){const{childNodes:r}=s;i+=s.getAttribute("padding");for(let n=0;i<=e&&n<r.length;n++){const o=r[n],{nextSibling:a}=o,h=o.toString(),u=h.length;if(o.setAttribute("aIndex",i),i+=u,i>e||i===e&&u>0&&(!a||a.type==="text"||o.type!=="text"&&(h.trim()||!a.toString().trim()))){s=o,i-=u,l=i;break}i+=s.getGaps(n)}if(s.childNodes===r)return{offsetNode:s,offset:e-l}}return{offsetNode:s,offset:e-l}}this.lspError("AstElement.caretPositionFromIndex")}elementFromIndex(e){var t;{const s=(t=this.caretPositionFromIndex(e))==null?void 0:t.offsetNode;return(s==null?void 0:s.type)==="text"?s.parentNode:s}this.lspError("AstElement.elementFromIndex")}elementFromPoint(e,t){return this.elementFromIndex(this.indexFromPos(t,e))}lint(e=this.getAbsoluteIndex(),t){const s=[];for(let i=0,l=e+this.getAttribute("padding");i<this.length;i++){const r=this.childNodes[i];r.setAttribute("aIndex",l);const n=r.lint(l,t);n.length>0&&s.push(...n),l+=r.toString().length+this.getGaps(i)}return s}print(e={}){const t=e.class;return this.toString()?(t===""?"":`<span class="wpb-${t!=null?t:this.type}${this.getAttribute("invalid")?" wpb-invalid":""}">`)+Ct(this.childNodes,e)+(t===""?"":"</span>"):""}json(e,t=this.getAbsoluteIndex()){const s={...this,type:this.type,range:[t,t+this.toString().length],childNodes:[]};for(let i=0,l=t+this.getAttribute("padding");i<this.length;i++){const r=this.childNodes[i],{length:n}=r.toString();r.setAttribute("aIndex",l),s.childNodes.push(r.type==="text"?{data:r.data,range:[l,l+n]}:r.json(void 0,l)),l+=n+this.getGaps(i)}return s}},Ks=ne(yn),Dt=ie(Ks,0,"AstElement",wn,Dt),se(Ks,1,Dt)}}),fs,qs=I({"mixin/gapped.ts"(){"use strict";fs=(e=1)=>t=>{class s extends t{getGaps(){return e}}return s}}}),Oe,qe=I({"mixin/noEscape.ts"(){"use strict";Oe=e=>{class t extends e{escape(){}}return t}}}),Sn,_o,bh=I({"src/parameter.ts"(){"use strict";ce(),X(),G(),V(),Sn=new RegExp(`https?://${$t}${_t}$`,"iu"),_o=class extends z{get type(){return"parameter"}get anon(){return this.firstChild.length===0}get duplicated(){var e;try{return!!((e=this.parentNode)!=null&&e.getDuplicatedArgs().some(([t])=>t===this.name))}catch{return!1}}constructor(e,t,s,i=[]){super(void 0,s,i);const l=new z(typeof e=="number"?void 0:e,s,i,{}),r=new z(t,s,i);l.type="parameter-key",l.setAttribute("stage",2),r.type="parameter-value",r.setAttribute("stage",2),this.append(l,r)}trimName(e,t=!0){const s=(typeof e=="string"?e:e.toString(!0)).replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu,"$1");return this.setAttribute("name",s),s}afterBuild(){if(!this.anon){const{parentNode:e,firstChild:t}=this,s=this.trimName(t);e&&e.getArgs(s,!1,!1).add(this)}super.afterBuild()}toString(e){return this.anon?this.lastChild.toString(e):super.toString(e,"=")}text(){return this.anon?this.lastChild.text():super.text("=")}getGaps(){return this.anon?0:1}lint(e=this.getAbsoluteIndex(),t){var r;const s=super.lint(e,t),i="unescaped",l=C.lintConfig.getSeverity(i);if(l){const{firstChild:n}=this,o=(r=Sn.exec(n.text()))==null?void 0:r[0];try{if(o&&new URL(o).search){const a="unescaped query string in an anonymous parameter",h=Q(n,{start:e},i,a,l);h.startIndex=h.endIndex,h.startLine=h.endLine,h.startCol=h.endCol,h.endIndex++,h.endCol++,h.fix=It(h.startIndex,"{{=}}"),s.push(h)}}catch{}}return s}print(){return super.print({sep:this.anon?"":"="})}json(e,t=this.getAbsoluteIndex()){const s=super.json(void 0,t);return Object.assign(s,{anon:this.anon},this.duplicated&&{duplicated:!0}),s}}}}),Se,Xe=I({"src/atom.ts"(){"use strict";var e,t;V(),Se=(t=class extends z{constructor(i,l,r,n,o){super(i,r,n,o);B(this,e);E(this,e,l)}get type(){return v(this,e)}set type(i){E(this,e,i)}getAttribute(i){var l;return i==="invalid"?this.type==="converter-flag"&&!!((l=this.parentNode)!=null&&l.isInvalidFlag(this)):super.getAttribute(i)}},e=new WeakMap,t)}}),Qe,Ft=I({"src/syntax.ts"(){"use strict";var e,t;V(),Qe=(t=class extends z{constructor(i,l,r,n,o){super(i,r,n,o);B(this,e);E(this,e,l)}get type(){return v(this,e)}lint(i=this.getAbsoluteIndex()){return super.lint(i,!1)}},e=new WeakMap,t)}}),To={};oe(To,{TranscludeToken:()=>nt});var An,Ys,kn,nt,Co=I({"src/transclude.ts"(){"use strict";var e,t,s,i,l,r,Gt,Io,a;ce(),X(),Re(),ge(),qs(),qe(),G(),V(),bh(),Xe(),Ft(),An=[Oe,fs()],nt=(a=class extends(kn=z){constructor(u,d,f,p=[]){var T,O;let x;const A=/^(?:\s|\0\d+[cn]\x7F)*\0(\d+)h\x7F(?:\s|\0\d+[cn]\x7F)*/u.exec(u);A&&(x=Number(A[1]),u=u.replace(`\0${x}h`,p[x].toString().replace(/^\n/u,"")));super(void 0,f,p,{});B(this,r);Ce(this,"modifier","");B(this,e,"template");B(this,t,":");B(this,s,!1);B(this,i,new Map);B(this,l);const{parserFunction:[S,y],variable:$,functionHook:g}=f,c=(T=/^(?:\s|\0\d+[cn]\x7F)*\0\d+s\x7F/u.exec(u))==null?void 0:T[0];if(c)this.setAttribute("modifier",c),u=u.slice(c.length);else if(u.includes(":")){const[L,...j]=u.split(":"),[W]=/^(?:\s|\0\d+[cn]\x7F)*/u.exec((O=j[0])!=null?O:"");this.setModifier(`${L}:${W}`)&&(u=j.join(":").slice(W.length))}const b=u.search(/[::]/u),w=u[b]===":",m=b!==-1;if(m||d.length===0&&!v(this,s)){const L=m?u.slice(0,b):u,j=m&&u.slice(b+1),W=Le(L),N=m?W.slice(W.search(/\S/u))+(w?":":""):W.trim(),R=N.toLowerCase(),J=Array.isArray(y),q=J?y.includes(N):Object.prototype.hasOwnProperty.call(y,N),F=!J&&q?y[N]:Object.prototype.hasOwnProperty.call(S,R)&&S[R],U=J&&q||!("functionHook"in f)||g.includes(F),H=J&&q||$.includes(F);if(m?F&&U:H){this.setAttribute("name",F||R.replace(/^#|:$/u,"")),E(this,e,"magic-word"),w&&E(this,t,":");const D=new Qe(L,"magic-word-name",f,p);if(super.insertAt(D),j!==!1&&d.unshift([j]),this.name==="invoke")for(let ee=0;ee<2;ee++){const re=d.shift();if(!re)break;const he=new Se(re.join("="),`invoke-${ee?"function":"module"}`,f,p);super.insertAt(he)}}}if(this.type==="template"){const L=Le(u).trim();if(!this.normalizeTitle(L,10,{halfParsed:!0,temporary:!0}).valid)throw p.pop(),new SyntaxError("Invalid template name");const j=new Se(u,"template-name",f,p,{});super.insertAt(j)}typeof x=="number"&&(p[x]=void 0);const _=this.isTemplate();let k=1;for(let L=0;L<d.length;L++){const j=d[L];_||this.name==="switch"&&L>0||this.name==="tag"&&L>1||(j[0]=j.join("="),j.length=1),j.length===1&&(j.unshift(k),k++),this.insertAt(new _o(...j,f,p))}this.seal("modifier")}get type(){return v(this,e)}get module(){return this.type==="magic-word"&&this.name==="invoke"?P(this,r,Gt).call(this).title:void 0}get function(){var u;return this.type==="magic-word"&&this.name==="invoke"?(u=this.childNodes[2])==null?void 0:u.text().trim():void 0}setModifier(u){const{parserFunction:[,,d,f]}=this.getAttribute("config"),p=Le(u).trim();if(u&&!p.endsWith(":"))return!1;const x=p.slice(0,-1).toLowerCase(),A=d.includes(x),S=f.includes(x);return v(this,s)&&A||!v(this,s)&&(S||!u)||(ve.running||this.length>1)&&(A||S||!u)?(this.setAttribute("modifier",u),E(this,s,A),!!u):!1}isTemplate(){return this.type==="template"||this.name==="invoke"}afterBuild(){this.modifier.includes("\0")&&this.setAttribute("modifier",this.buildFromStr(this.modifier,0)),super.afterBuild(),this.isTemplate()&&this.type==="template"&&(E(this,l,P(this,r,Gt).call(this)),this.setAttribute("name",v(this,l).title))}toString(u){const{childNodes:d,length:f,firstChild:p,modifier:x,type:A}=this;return`{{${x}${A==="magic-word"?p.toString(u)+(f===1?"":v(this,t))+d.slice(1).map(S=>S.toString(u)).join("|"):super.toString(u,"|")}}}`}text(){const{childNodes:u,length:d,firstChild:f,modifier:p,type:x,name:A}=this;return x==="magic-word"&&A==="vardefine"?"":`{{${p}${x==="magic-word"?f.text()+(d===1?"":v(this,t))+ht(u.slice(1),"|"):super.text("|")}}}`}getAttribute(u){switch(u){case"padding":return this.modifier.length+2;case"title":return v(this,l);case"colon":return v(this,t);case"invalid":return this.type==="magic-word"&&this.name==="invoke"&&(this.length===2||!P(this,r,Gt).call(this).valid);default:return super.getAttribute(u)}}lint(u=this.getAbsoluteIndex(),d){const f=super.lint(u,d);if(!this.isTemplate())return f;const{type:p,childNodes:x,length:A}=this,S=new ue(this,u),y=p==="magic-word";let $="no-ignored",g=C.lintConfig.getSeverity($,"fragment");if(y&&!P(this,r,Gt).call(this).valid)$="invalid-invoke",g=C.lintConfig.getSeverity($,"name"),g&&f.push(Q(x[1],S,$,"illegal module name",g));else if(g){const c=x[y?1:0],b=c.childNodes.findIndex(m=>m.type==="text"&&as(m.data).includes("#")),w=c.childNodes[b];if(w){const m=Q(c,S,$,"useless fragment",g);m.suggestions=[Z(m,c.getRelativeIndex(b)+w.data.indexOf("#"))],f.push(m)}}if($="invalid-invoke",g=C.lintConfig.getSeverity($,"function"),g&&y&&A===2)return f.push(te(this,S,$,"missing module function",g)),f;if($="no-duplicate",g=C.lintConfig.getSeverity($,"parameter"),g){const c=this.getDuplicatedArgs().filter(([,w])=>!w[0].querySelector("ext")),b="duplicated parameter";for(const[,w]of c)f.push(...w.map(m=>{const _=Q(m,S,$,b,g);return _.suggestions=[Z(_,-1)],_}))}return f}insertAt(u,d=this.length){return super.insertAt(u,d),u.anon?P(this,r,Io).call(this,u):u.name&&this.getArgs(u.name,!1,!1).add(u),u}getAllArgs(){return this.childNodes.filter(Gs("parameter"))}getAnonArgs(){return this.getAllArgs().filter(({anon:u})=>u)}getArgs(u,d,f=!0){const p=String(u).replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu,"$1");let x;return v(this,i).has(p)?x=v(this,i).get(p):(x=new Set(this.getAllArgs().filter(({name:A})=>p===A)),v(this,i).set(p,x)),x}getDuplicatedArgs(){return[...v(this,i)].filter(([,{size:u}])=>u>1).map(([u,d])=>[u,[...d]])}getPossibleValues(){const{type:u,name:d,childNodes:f}=this;if(u==="template")throw new Error("TranscludeToken.getPossibleValues method is only for specific magic words!");let p,x;switch(d){case"if":case"ifexist":case"ifexpr":case"iferror":p=2;break;case"ifeq":p=3;break;case"switch":{const A=f.slice(2),S=A[A.length-1];x=[...A.filter(({anon:y})=>!y),...S!=null&&S.anon?[S]:[]].map(({lastChild:y})=>y);break}default:throw new Error("TranscludeToken.getPossibleValues method is only for specific magic words!")}x!=null||(x=f.slice(p,p+2).map(({lastChild:A})=>A));for(let A=0;A<x.length;){const{length:S,0:y}=x[A].childNodes.filter($=>$.text().trim());if(S===0)x.splice(A,1);else if(S>1||y.type!=="magic-word")A++;else try{const $=y.getPossibleValues();x.splice(A,1,...$),A+=$.length}catch{A++}}return x}print(){const{childNodes:u,length:d,firstChild:f,modifier:p,type:x}=this;return`<span class="wpb-${x}${this.getAttribute("invalid")?" wpb-invalid":""}">{{${x==="magic-word"?hs(p)+f.print()+(d===1?"":v(this,t))+Ct(u.slice(1),{sep:"|"}):(p?`<span class="wpb-magic-word">${hs(p)}</span>`:"")+Ct(u,{sep:"|"})}}}</span>`}},e=new WeakMap,t=new WeakMap,s=new WeakMap,i=new WeakMap,l=new WeakMap,r=new WeakSet,Gt=function(){const u=this.type==="template";return this.normalizeTitle(this.childNodes[u?0:1].text(),u?10:828,{temporary:!0})},Io=function(u){const d=this.getAnonArgs(),f=typeof u!="number";for(let p=f?d.indexOf(u):u-1;p<d.length;p++){const x=d[p],{name:A}=x,S=String(p+1);(A!==S||x===u)&&(x.setAttribute("name",S),this.getArgs(S,!1,!1).add(x))}},a),Ys=ne(kn),nt=ie(Ys,0,"TranscludeToken",An,nt),se(Ys,1,nt)}}),bs,Zs,ei,$n,_n,Tn,Cn,ti,si,pr,wh=I({"lib/text.ts"(){"use strict";var e,fr,s;ce(),X(),Re(),G(),ko(),bs=String.raw`[${Ge}\t]*`,Zs=String.raw`[^\S\n]*`,ei=String.raw`<${Zs}(?:/${Zs})?([a-z]\w*)|\{+|\}+|\[{2,}|\[(?![^[]*?\])|((?:^|\])[^[]*?)\]+|(?:rfc|pmid)(?=[-::]?${bs}\d)|isbn(?=[-::]?${bs}(?:\d(?:${bs}|-)){6})`,$n=new RegExp(String.raw`${ei}|https?[:/]/+`,"giu"),_n=new RegExp(ei,"giu"),Tn=new Set(["attr-value","ext-link-text","link-text"]),Cn={"[":/[[\]]/u,"{":/[{}]/u,"]":/[[\]](?=[^[\]]*$)/u,"}":/[{}](?=[^{}]*$)/u},ti=new Set(["html","head","style","title","body","a","audio","img","video","embed","iframe","object","canvas","script","col","colgroup","tbody","tfoot","thead","button","input","label","option","select","textarea"]);try{si=new RegExp(String.raw`[\p{L}\p{N}_]`,"u")}catch{si=/\w/u}pr=(s=class extends rt{constructor(r){super();B(this,e);Ce(this,"data","");this.data=r}get type(){return"text"}toString(r){var n;return r&&!((n=this.parentNode)!=null&&n.getAttribute("built"))?Le(this.data):this.data}text(){return this.data}lint(r=this.getAbsoluteIndex(),n){var L,j,W;if(n===!1)return[];const{data:o,parentNode:a,nextSibling:h,previousSibling:u}=this;if(!a)throw new Error("An isolated text node cannot be linted!");const{type:d,name:f,parentNode:p}=a;if(d==="attr-value"){const{name:N,tag:R}=p;if(R==="ref"&&(N==="name"||N==="follow")||N==="group"&&(R==="ref"||R==="references")||R==="choose"&&(N==="before"||N==="after"))return[]}if(n!=null||(n=d==="free-ext-link"||d==="ext-link-url"||d==="ext-link-text"||d==="image-parameter"&&f==="link"||d==="attr-value"?_n:$n),o.search(n)===-1)return[];n.lastIndex=0;const x=[],A=h==null?void 0:h.type,S=h==null?void 0:h.name,y=u==null?void 0:u.type,$=this.getRootNode(),g=$.toString(),{ext:c,html:b,variants:w}=$.getAttribute("config"),{top:m,left:_}=$.posFromIndex(r),k=C.lintConfig["tag-like"],T=typeof k=="number"?new Set:new Set(Object.keys(k[1]).filter(N=>N!=="invalid"&&N!=="disallowed")),O=new Set(["onlyinclude","noinclude","includeonly",...c,...b[0],...b[1],...b[2],...T,...ti]);for(let N=n.exec(o);N;N=n.exec(o)){const[,R,J]=N;let{index:q,0:F}=N;if(J&&J!=="]"){const{length:we}=J;q+=we,F=F.slice(we)}F=F.toLowerCase();const[U]=F,H=U==="r"||U==="p"||U==="i",D=U==="{",ee=U==="}",re=U==="[",he=U==="]";let{length:Te}=F;if(U==="<"&&!O.has(R.toLowerCase())||re&&d==="ext-link-text"&&(/&(?:rbrack|#93|#x5[Dd];);/u.test(o.slice(q+1))||h!=null&&h.is("ext")&&S==="nowiki"&&((L=h.innerText)!=null&&L.includes("]")))||H&&(!a.isPlain()||Tn.has(d)))continue;he&&(q||Te>1)&&n.lastIndex--;let Be=r+q,Ze=Be+Te,fe,M;const le=g[Ze],be=g[Be-1],me=D||re,_e=D&&be==="-"&&w.length>0,Ue=ee&&le==="-"&&w.length>0,Ae=re&&A==="free-ext-link"&&!o.slice(q+1).trim()||he&&y==="free-ext-link"&&!o.slice(0,q).includes("]");if(H)fe="lonely-http",F=F.toUpperCase(),M=C.lintConfig.getSeverity(fe,F);else if(U==="<"){fe="tag-like";let we;/^<\/?\s/u.test(F)||!/[\s/>]/u.test(le!=null?le:"")?we="invalid":T.has(R)?we=R:ti.has(R)&&!c.includes(R)&&(we="disallowed"),M=C.lintConfig.getSeverity(fe,we)}else if(_e||Ue)fe="lonely-bracket",M=C.lintConfig.getSeverity(fe,"converter"),_e&&q>0?(F="-{",q--,Be--,Te=2):Ue&&q<o.length-1&&(F="}-",Ze++,Te=2);else if(Ae)fe="lonely-bracket",M=C.lintConfig.getSeverity(fe,"extLink");else if(me||ee||he)if(fe="lonely-bracket",Te>1||D&&le===U||ee&&be===U)M=C.lintConfig.getSeverity(fe,"double");else{if(!re||d!=="ext-link-text"){const we=Cn[U],Vs=me?o.slice(q+1):o.slice(0,q);if(D&&((j=we.exec(Vs))==null?void 0:j[0])==="}"||ee&&((W=we.exec(Vs))==null?void 0:W[0])==="{")continue;if(!Vs.includes(U)){const ln=me?"nextSibling":"previousSibling";let tt=this[ln];for(;tt&&(tt.type!=="text"||!we.test(tt.data));)tt=tt[ln];if(tt&&we.exec(tt.data)[0]!==U)continue}}M=C.lintConfig.getSeverity(fe,"single")}else fe="lonely-http",M=C.lintConfig.getSeverity(fe);if(!M)continue;const gt=this.posFromIndex(q),{line:K,character:et}=ds(m,_,gt.top+1,gt.left),Pe={rule:fe,message:C.msg('lonely "$1"',H||U==="h"||_e||Ue?F:U),severity:M,startIndex:Be,endIndex:Ze,startLine:K,endLine:K,startCol:et,endCol:et+Te};if(U==="<")Pe.suggestions=[It(Be,"<")];else if(U==="h"&&d!=="link-text"&&si.test(be||""))Pe.suggestions=[cs(Be)];else if(re&&d==="ext-link-text"){const we=a.getAbsoluteIndex()+a.toString().length;Pe.suggestions=[It(we,"]")]}else if(he&&Ae){const we=r-u.toString().length;Pe.suggestions=[Os(we,"left bracket","[")]}else H&&(Pe.suggestions=[...N[0]===F?[]:[Or(Pe,F)],...le===":"||le===":"?[cs(Ze,1)]:[]]);x.push(Pe)}return x}replaceData(r){P(this,e,fr).call(this,r)}splitText(r){{const{parentNode:n,data:o}=this;if(!n)throw new Error("The text node to be split has no parent node!");const a=new s(o.slice(r));return ps(n,n.childNodes.indexOf(this)+1,0,[a]),this.setAttribute("data",o.slice(0,r)),a}this.lspError("AstText.splitText")}escape(){{const{parentNode:r}=this;if(!r)throw new Error("The text node to be escaped has no parent node!");const{TranscludeToken:n}=(Co(),Y(To)),o=r.getAttribute("config"),a=r.childNodes.indexOf(this)+1,h=f=>Math.max(this.data.lastIndexOf("=",f),this.data.lastIndexOf("|",f));let u=h();const d=()=>new n(this.data[u]==="="?"=":"!",[],o);for(;u>=0;u=h(u-1))u<this.data.length-1&&this.splitText(u+1),r.insertAt(ve.run(d),a),P(this,e,fr).call(this,this.data.slice(0,u))}}print(){return hs(this.data)}},e=new WeakSet,fr=function(r){this.setAttribute("data",r)},s)}}),dt,jt=I({"mixin/hidden.ts"(){"use strict";dt=(e=!0,t=!0)=>s=>{class i extends s{text(){return""}lint(r){return e?[]:super.lint(r)}}return i}}}),We,Ke=I({"mixin/padded.ts"(){"use strict";We=({length:e})=>t=>{class s extends t{getAttribute(l){return l==="padding"?e:super.getAttribute(l)}}return s}}}),In,Nn,ii,Ln,De,Ws=I({"src/link/base.ts"(){"use strict";var e,t,s,i;X(),ut(),ge(),Ke(),qe(),G(),V(),Xe(),In=l=>l==="redirect-target"||l==="link",Nn=[Oe,We("[[")],De=(i=class extends(Ln=z){constructor(r,n,o,a=[],h="|"){super(void 0,o,a,{});B(this,e,!0);B(this,t);B(this,s);if(this.insertAt(new Se(r,"link-target",o,a,{})),n!==void 0){const u=new z(n,o,a,{});u.type="link-text",u.setAttribute("stage",$e-1),this.insertAt(u)}E(this,t,h)}get link(){return v(this,s)}get fragment(){return v(this,s).fragment}afterBuild(){E(this,s,this.getTitle()),v(this,t).includes("\0")&&E(this,t,this.buildFromStr(v(this,t),0)),this.setAttribute("name",v(this,s).title),super.afterBuild()}setAttribute(r,n){r==="bracket"?E(this,e,n):r==="title"?E(this,s,n):super.setAttribute(r,n)}toString(r){const n=super.toString(r,v(this,t));return v(this,e)?`[[${n}]]`:n}text(){const r=super.text("|");return v(this,e)?`[[${r}]]`:r}getAttribute(r){return r==="title"?v(this,s):super.getAttribute(r)}getGaps(r){return r===0?v(this,t).length:1}lint(r=this.getAbsoluteIndex(),n){const o=super.lint(r,n),{childNodes:[a,h],type:u}=this,{encoded:d,fragment:f}=v(this,s),p=new ue(this,r);let x="unknown-page",A=C.lintConfig.getSeverity(x);if(A&&a.childNodes.some(({type:S})=>S==="template")&&o.push(Q(a,p,x,"template in an internal link target",A)),x="url-encoding",A=C.lintConfig.getSeverity(x),A&&d){const S=Q(a,p,x,"unnecessary URL encoding in an internal link",A);S.fix=Er(S,a),o.push(S)}if(x="pipe-like",A=C.lintConfig.getSeverity(x,"link"),A&&(u==="link"||u==="category")){const S=h==null?void 0:h.childNodes.findIndex($=>$.type==="text"&&$.data.includes("|")),y=h==null?void 0:h.childNodes[S];if(y){const $=Q(h,p,x,'additional "|" in the link text',A),g=$.startIndex+h.getRelativeIndex(S);$.suggestions=[Br(g,y.data)],o.push($)}}if(x="no-ignored",A=C.lintConfig.getSeverity(x,"fragment"),A&&f!==void 0&&!In(u)){const S=Q(a,p,x,"useless fragment",A),y=a.childNodes.findIndex(g=>g.type==="text"&&g.data.includes("#")),$=a.childNodes[y];$&&(S.fix=Z(S,a.getRelativeIndex(y)+$.data.indexOf("#"))),o.push(S)}return o}getTitle(r,n){return this.normalizeTitle(this.firstChild.text(),0,{halfParsed:n,temporary:r,decode:!0,selfLink:!0})}print(){return super.print(v(this,e)?{pre:"[[",post:"]]",sep:v(this,t)}:{sep:v(this,t)})}json(r,n=this.getAbsoluteIndex()){const o=super.json(void 0,n),{type:a,fragment:h}=this;return h!==void 0&&(a==="link"||a==="redirect-target")&&(o.fragment=h),o}},e=new WeakMap,t=new WeakMap,s=new WeakMap,i),ii=ne(Ln),De=ie(ii,0,"LinkBaseToken",Nn,De),se(ii,1,De)}}),Fn,ri,jn,Ee,ct=I({"src/nowiki/base.ts"(){"use strict";qe(),V(),Fn=[Oe],Ee=class extends(jn=z){get innerText(){return this.firstChild.data}constructor(e="",t,s){super(e,t,s)}},ri=ne(jn),Ee=ie(ri,0,"NowikiBaseToken",Fn,Ee),se(ri,1,Ee)}}),En,ni,Rn,pe,Ye=I({"src/nowiki/noinclude.ts"(){"use strict";jt(),ct(),En=[dt()],pe=class extends(Rn=Ee){get type(){return"noinclude"}toString(e){return e?"":super.toString()}},ni=ne(Rn),pe=ie(ni,0,"NoincludeToken",En,pe),se(ni,1,pe)}}),No,yh=I({"src/link/redirectTarget.ts"(){"use strict";X(),G(),Ws(),Ye(),No=class extends De{get type(){return"redirect-target"}constructor(e,t,s,i){super(e,void 0,s,i),t!==void 0&&this.insertAt(new pe(t,s,i))}getTitle(){return this.normalizeTitle(this.firstChild.toString(),0,{halfParsed:!0,decode:!0})}lint(e=this.getAbsoluteIndex()){const t=super.lint(e,!1),s="no-ignored",i=C.lintConfig.getSeverity(s,"redirect");if(i&&this.length===2){const l=Q(this.lastChild,{start:e},s,"useless link text",i);l.startIndex--,l.startCol--,l.fix=Z(l),t.push(l)}return t}}}}),Pn,li,On,Vt,Sh=I({"src/redirect.ts"(){"use strict";var e,t,s;jt(),qe(),V(),Ft(),yh(),Pn=[dt(!1,!1),Oe],Vt=(s=class extends(On=z){constructor(l,r,n,o,a,h,u=[]){super(void 0,h,u);B(this,e);B(this,t);E(this,e,l),E(this,t,a),this.append(new Qe(r,"redirect-syntax",h,u),new No(n,o==null?void 0:o.slice(1),h,u))}get type(){return"redirect"}getAttribute(l){return l==="padding"?v(this,e).length:super.getAttribute(l)}toString(l){return v(this,e)+super.toString(l)+v(this,t)}lint(l=this.getAbsoluteIndex()){const r=l+v(this,e).length+this.firstChild.toString().length;return this.lastChild.setAttribute("aIndex",r),this.lastChild.lint(r)}print(){return super.print({pre:v(this,e),post:v(this,t)})}},e=new WeakMap,t=new WeakMap,s),li=ne(On),Vt=ie(li,0,"RedirectToken",Pn,Vt),se(li,1,Vt)}}),Lo={};oe(Lo,{parseRedirect:()=>Fo});var Fo,Ah=I({"parser/redirect.ts"(){"use strict";G(),Sh(),Fo=(e,t,s)=>{var l;(l=t.regexRedirect)!=null||(t.regexRedirect=new RegExp(String.raw`^(\s*)((?:${t.redirection.join("|")})\s*(?::\s*)?)\[\[([^\n|\]]+)(\|.*?)?\]\](\s*)`,"iu"));const i=t.regexRedirect.exec(e);return i&&C.normalizeTitle(i[3],0,!1,t,{halfParsed:!0,temporary:!0,decode:!0}).valid?(e=`\0${s.length}o${e.slice(i[0].length)}`,new Vt(...i.slice(1),t,s),e):!1}}}),Bn,oi,qn,Qt,kh=I({"src/onlyinclude.ts"(){"use strict";Ke(),qe(),V(),Bn=[Oe,We("<onlyinclude>")],Qt=class extends(qn=z){get type(){return"onlyinclude"}toString(e){return`<onlyinclude>${super.toString(e)}</onlyinclude>`}isPlain(){return!0}print(){return super.print({pre:'<span class="wpb-ext"><onlyinclude></span>',post:'<span class="wpb-ext"></onlyinclude></span>'})}},oi=ne(qn),Qt=ie(oi,0,"OnlyincludeToken",Bn,Qt),se(oi,1,Qt)}}),Wn,ai,Un,lt,Mr=I({"src/tagPair/index.ts"(){"use strict";var e,t;qs(),qe(),V(),Wn=[fs(),Oe],lt=(t=class extends(Un=z){constructor(i,l,r,n,o,a=[]){super(void 0,o);B(this,e);Ce(this,"closed");Ce(this,"selfClosing");this.setAttribute("name",i.toLowerCase()),E(this,e,[i,n||i]),this.closed=n!=="",this.selfClosing=n===void 0,this.append(l,r);const h=typeof l=="string"?-1:a.indexOf(l);a.splice(h===-1?1/0:h,0,this)}get innerText(){return this.selfClosing?void 0:this.lastChild.text()}toString(i){const{selfClosing:l,firstChild:r,lastChild:n}=this,[o,a]=v(this,e);return l?`<${o}${r.toString(i)}/>`:`<${o}${r.toString(i)}>${n.toString(i)}${this.closed?`</${a}>`:""}`}text(){const[i,l]=v(this,e);return this.selfClosing?`<${i}${this.firstChild.text()}/>`:`<${i}${super.text(">")}${this.closed?`</${l}>`:""}`}getAttribute(i){return i==="padding"?v(this,e)[0].length+1:super.getAttribute(i)}print(){const[i,l]=v(this,e);return super.print(this.selfClosing?{pre:`<${i}`,post:"/>"}:{pre:`<${i}`,sep:">",post:this.closed?`</${l}>`:""})}},e=new WeakMap,t),ai=ne(Un),lt=ie(ai,0,"TagPairToken",Wn,lt),se(ai,1,lt)}}),jo,$h=I({"src/tagPair/translate.ts"(){"use strict";var e,Eo,s;V(),Mr(),Ft(),Ye(),jo=(s=class extends lt{constructor(l,r,n,o=[]){const a=new Qe(l,"translate-attr",n,o);r=r==null?void 0:r.replace(/(<tvar\|[^>]+>)([\s\S]*?)(<\/>)/gu,(u,d,f,p)=>(new pe(d,n,o),new pe(p,n,o),`\0${o.length-1}n${f}\0${o.length}n`)).replace(/(<tvar\s+name\s*=(?:\s*(?:(["'])[\s\S]*?\2|[^"'\s>]+))?\s*>)([\s\S]*?)(<\/tvar\s*>)/giu,(u,d,f,p,x)=>(new pe(d,n,o),new pe(x,n,o),`\0${o.length-1}n${p}\0${o.length}n`));const h=new z(r,n,o);h.type="translate-inner";super("translate",a,h,"translate",n,o);B(this,e);this.seal("closed",!0),this.seal("selfClosing",!0)}get type(){return"translate"}toString(l){return l?this.lastChild.toString(!0):super.toString()}text(){return this.lastChild.text()}print(){return`<span class="wpb-ext"><translate${P(this,e,Eo).call(this)?'<span class="wpb-ext-attrs"> <span class="wpb-ext-attr"><span class="wpb-attr-key">nowrap</span></span></span>':""}>${this.lastChild.print({class:"ext-inner"})}</translate></span>`}},e=new WeakSet,Eo=function(){return this.firstChild.toString()===" nowrap"},s)}}),Mn,hi,zn,Jt,_h=I({"src/tagPair/include.ts"(){"use strict";X(),ge(),jt(),G(),Mr(),Mn=[dt(!1)],Jt=class extends(zn=lt){get type(){return"include"}constructor(e,t="",s,i,l,r){super(e,t,s!=null?s:"",s===void 0||i!=null?i:"",l,r)}toString(e){return e?"":super.toString()}lint(e=this.getAbsoluteIndex()){const t=[],{firstChild:s,closed:i,name:l}=this,r=new ue(this,e),n=["no-ignored","unclosed-comment"],o=n.map(a=>C.lintConfig.getSeverity(a,"include"));if(o[0]&&s.data.trim()){const a=Q(s,r,n[0],"useless attribute",o[0]);a.suggestions=[Z(a)],t.push(a)}if(o[1]&&!i){const a=te(this,r,n[1],C.msg("unclosed $1",`<${l}>`),o[1]);a.suggestions=[Ve(a.endIndex,`</${l}>`)],t.push(a)}return t}},hi=ne(zn),Jt=ie(hi,0,"IncludeToken",Mn,Jt),se(hi,1,Jt)}}),Us,zr=I({"mixin/attributesParent.ts"(){"use strict";Us=(e=0)=>t=>{var i,mr;class s extends t{constructor(){super(...arguments);B(this,i)}hasAttr(o){return P(this,i,mr).call(this).hasAttr(o)}getAttr(o){return P(this,i,mr).call(this).getAttr(o)}}return i=new WeakSet,mr=function(){return this.childNodes[e]},s}}}),ae,ui,di,qt,ws,ci,st,gi,pi,fi,ys,mi,Fe,Hr,Dr,Gr,Ro,Po=I({"util/sharable.ts"(){"use strict";ae=new Set(["align"]),ui=new Set(["cite"]),di=new Set(["cite","datetime"]),qt=new Set(["width"]),ws=new Set(["axis","align","bgcolor","height","width","valign"]),ci=new Set([...ws,"abbr","headers","scope","rowspan","colspan"]),st=new Set(["type"]),gi=new Set(["summary","align","bgcolor","cellpadding","cellspacing","frame","rules","width"]),pi=new Set(["clear"]),fi=new Set(["bgcolor","align","valign"]),ys=new Set(["qid","forcemathmode","type","display"]),mi=new Set(["enclose","inline","lang","line","linelinks","style","class","id","dir","copy","highlight","start"]),Fe=new Set,Hr=new Set(["id","class","style","lang","dir","title","tabindex","aria-describedby","aria-flowto","aria-hidden","aria-label","aria-labelledby","aria-level","aria-owns","role","about","property","resource","datatype","typeof","itemid","itemprop","itemref","itemscope","itemtype"]),Dr={div:ae,h1:ae,h2:ae,h3:ae,h4:ae,h5:ae,h6:ae,blockquote:ui,q:ui,p:ae,br:pi,pre:qt,ins:di,del:di,ul:st,ol:new Set(["type","start","reversed"]),li:new Set(["type","value"]),table:new Set([...gi,"border"]),caption:ae,tr:fi,td:ci,th:ci,font:new Set(["size","color","face"]),hr:qt,data:new Set(["value"]),time:new Set(["datetime"]),meta:new Set(["itemprop","content"]),link:new Set(["itemprop","href","title"]),gallery:st,poem:ae,categorytree:ae,combooption:ae,math:Fe,chem:Fe,ce:Fe,img:new Set(["alt","src","width","height","loading","srcset"])},Gr={gallery:new Set(["mode","showfilename","caption","perrow","widths","heights","showthumbnails"]),poem:new Set(["compact"]),categorytree:new Set(["hideroot","onlyroot","depth","mode","hideprefix","namespaces","showcount","notranslations"]),combooption:new Set(["name","for","inline"]),nowiki:Fe,indicator:new Set(["name"]),langconvert:new Set(["from","to"]),ref:new Set(["group","name","follow","dir","details"]),references:new Set(["group","responsive"]),charinsert:new Set(["label"]),choose:new Set(["uncached","before","after"]),option:new Set(["weight"]),imagemap:Fe,inputbox:Fe,templatestyles:new Set(["src","wrapper"]),dynamicpagelist:Fe,poll:new Set(["id","show-results-before-voting"]),sm2:st,flashmp3:st,score:new Set(["line_width_inches","lang","override_midi","raw","note-language","override_audio","override_ogg","sound","vorbis"]),seo:new Set(["title","title_mode","title_separator","keywords","description","robots","google_bot","image","image_width","image_height","image_alt","type","site_name","locale","section","author","published_time","twitter_site"]),tab:new Set(["nested","name","index","class","block","inline","openname","closename","collapsed","dropdown","style","bgcolor","container","id","title"]),tabs:new Set(["plain","class","container","id","title","style"]),combobox:new Set(["placeholder","value","id","class","text","dropdown","style"]),math:new Set([...ys,"chem"]),chem:ys,ce:ys,hiero:Fe,phonos:new Set(["ipa","class","text","lang","wikibase","file"]),section:new Set(["begin","end"]),source:mi,syntaxhighlight:mi,templatedata:Fe,timeline:new Set(["method","font"]),quiz:new Set(["display","shuffleanswers","points","shuffle","case"]),languages:Fe},Ro={table:gi,td:new Set([...ws,"scope"]),th:ws,br:pi,caption:ae,div:ae,hr:qt,h1:ae,h2:ae,h3:ae,h4:ae,h5:ae,h6:ae,li:st,p:ae,pre:qt,tr:fi,ul:st}}}),Hn,Dn,Gn,Vn,Cs,Th=I({"src/attribute.ts"(){"use strict";var e,t,s,i,l,xr,n;X(),ce(),ut(),Po(),ge(),G(),V(),Xe(),Hn=/expression|(?:accelerator|-o-link(?:-source)?|-o-replace)\s*:|(?:url|src|image(?:-set)?)\s*\(|attr\s*\([^)]+[\s,]url/u,Dn=/(?:^|\s|\*\/)(?:javascript|vbscript)(?:\W|$)/iu,Gn=new Set(["ext","arg","magic-word","template"]),Vn=new Set(["about","property","resource","datatype","typeof","itemid","itemprop","itemref","itemscope","itemtype"]),Cs=(n=class extends z{constructor(a,h,u,d="",f,p=[],x=C.getConfig(),A=[]){const S=new Se(u,"attr-key",x,A);let y;if(u==="title"||h==="img"&&u==="alt")y=new z(f,x,A,{}),y.type="attr-value",y.setAttribute("stage",$e-1);else if(h==="gallery"&&u==="caption"||h==="choose"&&(u==="before"||u==="after")){const $={...x,excludes:[...x.excludes,"heading","html","table","hr","list"]};y=new z(f,$,A,{}),y.type="attr-value",y.setAttribute("stage",1)}else y=new Se(f,"attr-value",x,A,{});super(void 0,x,A);B(this,l);B(this,e);B(this,t);B(this,s);B(this,i);E(this,e,a),this.append(S,y),E(this,s,d),E(this,i,[...p]),E(this,t,h),this.setAttribute("name",Tt(Le(u)))}get type(){return v(this,e)}get tag(){return v(this,t)}get balanced(){return!v(this,s)||v(this,i)[0]===v(this,i)[1]}afterBuild(){v(this,s).includes("\0")&&E(this,s,this.buildFromStr(v(this,s),0)),this.parentNode&&E(this,t,this.parentNode.name),this.setAttribute("name",Tt(this.firstChild.text())),super.afterBuild()}toString(a){const[h="",u=""]=v(this,i);return v(this,s)?super.toString(a,v(this,s)+h)+u:this.firstChild.toString(a)}text(){return v(this,s)?`${super.text(`${v(this,s).trim()}"`)}"`:this.firstChild.text()}getGaps(){var a,h;return v(this,s)?v(this,s).length+((h=(a=v(this,i)[0])==null?void 0:a.length)!=null?h:0):0}lint(a=this.getAbsoluteIndex(),h){var c;const u=super.lint(a,h),{balanced:d,firstChild:f,lastChild:p,name:x,tag:A}=this,S=new ue(this,a),y=["unclosed-quote","obsolete-attr"],$=y.map(b=>C.lintConfig.getSeverity(b,x));if($[0]&&!d){const b=Q(p,S,y[0],C.msg("unclosed $1","quotes"),$[0]);b.startIndex--,b.startCol--,b.suggestions=[Ve(b.endIndex,v(this,i)[0])],u.push(b)}const g=P(this,l,xr).call(this,a,S);return g&&u.push(g),$[1]&&((c=Ro[A])!=null&&c.has(x))&&u.push(Q(f,S,y[1],"obsolete attribute",$[1])),u}getValue(){return v(this,s)?this.lastChild.text().trim():this.type==="ext-attr"||""}escape(){E(this,s,"{{=}}"),this.lastChild.escape()}getAttribute(a){return a==="invalid"?P(this,l,xr).call(this):super.getAttribute(a)}print(){const[a="",h=""]=v(this,i);return v(this,s)?super.print({sep:hs(v(this,s))+a,post:h}):super.print()}json(a,h=this.getAbsoluteIndex()){const u=super.json(void 0,h);return u.tag=this.tag,u}},e=new WeakMap,t=new WeakMap,s=new WeakMap,i=new WeakMap,l=new WeakSet,xr=function(a,h){const{firstChild:u,lastChild:d,type:f,name:p,tag:x,parentNode:A}=this,S=!d.childNodes.some(({type:w})=>Gn.has(w)),y=this.getValue(),$=Gr[x],g=Dr[x],{length:c}=this.toString();let b="illegal-attr";if(!($!=null&&$.has(p))&&!(g!=null&&g.has(p))&&(f==="ext-attr"?$||g:!/\{\{[^{]+\}\}/u.test(p))&&(f==="ext-attr"&&!g||!/^(?:xmlns:[\w:.-]+|data-(?!ooui|mw|parsoid)[^:]*)$/u.test(p)&&(x==="meta"||x==="link"||!Hr.has(p)))||(p==="itemtype"||p==="itemid"||p==="itemref")&&!(A!=null&&A.hasAttr("itemscope"))){if(a===void 0)return!0;const w=C.lintConfig.getSeverity(b,"unknown");if(w){const m=Q(u,h,b,"illegal attribute name",w);return m.suggestions=[Z(a,c)],m}}else if(p==="style"&&typeof y=="string"&&Hn.test(y)){if(a===void 0)return!0;b="insecure-style";const w=C.lintConfig.getSeverity(b);return w&&Q(d,h,b,"insecure style",w)}else if(p==="tabindex"&&typeof y=="string"&&y!=="0"){if(a===void 0)return!0;const w=C.lintConfig.getSeverity(b,"tabindex");if(w){const m=Q(d,h,b,"nonzero tabindex",w);return m.suggestions=[Z(a,c),je(m,"0 tabindex","0")],m}}else if(S&&f!=="ext-attr"){const w=qr(x,p),m=String(y).toLowerCase();if(w.length>0&&w.every(_=>_!==m)){if(a===void 0)return!0;const _=C.lintConfig.getSeverity(b,"value");return _&&Q(d,h,b,"illegal attribute value",_)}}else if(typeof y=="string"&&((/^xmlns:[\w:.-]+$/u.test(p)||Vn.has(p))&&Dn.test(y)||S&&(p==="href"||x==="img"&&p==="src")&&!new RegExp(String.raw`^(?:${this.getAttribute("config").protocol}|//)\S+$`,"iu").test(y))){if(a===void 0)return!0;const w=C.lintConfig.getSeverity(b,"value");return w&&Q(d,h,b,"illegal attribute value",w)}return!1},n)}}),xi,Qn,vi,Ms,Vr=I({"src/attributes.ts"(){"use strict";var e,t,Is,i;X(),ce(),ge(),G(),V(),Xe(),Th(),xi=l=>l.slice(0,-1),Qn=l=>`${xi(l)}-dirty`;try{vi=new RegExp(String.raw`[\p{L}\p{N}]`,"u")}catch{vi=/[^\W_]/u}Ms=(i=class extends z{constructor(r,n,o,a,h=[]){super(void 0,a,h,{});B(this,t);B(this,e);if(E(this,e,n),this.setAttribute("name",o),r){const u=/([^\s/](?:(?!\0\d+~\x7F)[^\s/=])*)(?:((?:\s(?:\s|\0\d+[cn]\x7F)*)?(?:=|\0\d+~\x7F)(?:\s|\0\d+[cn]\x7F)*)(?:(["'])([\s\S]*?)(\3|$)|(\S*)))?/gu;let d="",f=u.exec(r),p=0;const x=()=>{d&&(super.insertAt(new Se(d,Qn(n),a,h,{})),d="")};for(;f;){const{index:A,0:S,1:y,2:$,3:g,4:c,5:b,6:w}=f;if(d+=r.slice(p,A),/^(?:[\w:]|\0\d+t\x7F)(?:[\w:.-]|\0\d+t\x7F)*$/u.test(Le(y).trim())){const m=c!=null?c:w,_=[g,b],k=new Cs(xi(n),o,y,$,m,_,a,h);x(),super.insertAt(k)}else d+=S;({lastIndex:p}=u),f=u.exec(r)}d+=r.slice(p),x()}}get type(){return v(this,e)}afterBuild(){const{parentNode:r}=this;r!=null&&r.is("td")&&this.setAttribute("name",r.subtype),super.afterBuild()}getAttrTokens(r){return this.childNodes.filter(n=>n instanceof Cs&&(!r||n.name===Tt(r)))}hasAttr(r){return this.getAttrTokens(r).length>0}getAttrToken(r){const n=this.getAttrTokens(r);return n[n.length-1]}getAttr(r){var n;return(n=this.getAttrToken(r))==null?void 0:n.getValue()}lint(r=this.getAbsoluteIndex(),n){const o=super.lint(r,n),{parentNode:a,childNodes:h}=this,u=new Map,d=new Set,f=new ue(this,r),p=["no-ignored","no-duplicate"],x=["closingTag","invalidAttributes","nonWordAttributes"].map(S=>C.lintConfig.getSeverity(p[0],S));if(x[0]&&P(this,t,Is).call(this)){const S=te(this,f,p[0],"attributes of a closing tag",x[0]),y=a.getAbsoluteIndex();S.suggestions=[Z(S),Rr(y)],o.push(S)}for(const S of h)if(S instanceof Cs){const{name:y}=S;u.has(y)?(d.add(y),u.get(y).push(S)):u.set(y,[S])}else{const y=S.text().trim(),$=x[vi.test(y)?1:2];if(y&&$){const g=Q(S,f,p[0],"containing invalid attribute",$);g.suggestions=[Z(g,0," ")],o.push(g)}}const A=C.lintConfig.getSeverity(p[1],"attribute");if(A&&d.size>0)for(const S of d){const y=u.get(S).map($=>{const g=$.getValue();return[$,g===!0?"":g]});o.push(...y.map(([$,g],c)=>{const b=Q($,f,p[1],C.msg("duplicated $1 attribute",S),A),w=Z(b);return!g||y.slice(0,c).some(([,m])=>m===g)?b.fix=w:b.suggestions=[w],b}))}return o}getAttribute(r){return r==="invalid"?P(this,t,Is).call(this):super.getAttribute(r)}print(){return this.toString()?`<span class="wpb-${this.type}${P(this,t,Is).call(this)?" wpb-invalid":""}">${this.childNodes.map(r=>r.print(r instanceof Se?{class:r.toString().trim()&&"attr-dirty"}:void 0)).join("")}</span>`:""}},e=new WeakMap,t=new WeakSet,Is=function(){const{parentNode:r}=this;return(r==null?void 0:r.type)==="html"&&r.closing&&this.text().trim()!==""},i)}}),Oo={};oe(Oo,{PreToken:()=>Bo});var Bo,Ch=I({"src/pre.ts"(){"use strict";ut(),V(),Ye(),Bo=class extends z{get type(){return"ext-inner"}constructor(e,t,s=[]){if(e){const i=/<nowiki>/giu,l=/<\/nowiki>/giu,{length:r}=i.source;let n=i.exec(e);n&&(l.lastIndex=n.index+r);let o=l.exec(e),a=0,h="";for(;n&&o;)new pe(n[0],t,s),new pe(o[0],t,s),h+=`${e.slice(a,n.index)}\0${s.length-1}n${e.slice(n.index+r,o.index)}\0${s.length}n`,a=o.index+r+1,i.lastIndex=a,n=i.exec(e),n&&(l.lastIndex=n.index+r),o=l.exec(e);e=h+e.slice(a)}super(e,t,s,{}),this.setAttribute("stage",$e-1)}isPlain(){return!0}lint(e=this.getAbsoluteIndex()){return super.lint(e,/<\s*\/\s*(pre)\b/giu)}}}}),zs,Qr=I({"mixin/multiLine.ts"(){"use strict";zs=e=>{class t extends e{toString(i){return super.toString(i,`
|
|
3
|
+
`)}text(){return super.text(`
|
|
4
|
+
`).replace(/\n\s*\n/gu,`
|
|
5
|
+
`)}getGaps(){return 1}print(){return super.print({sep:`
|
|
6
|
+
`})}}return t}}}),qo={};oe(qo,{ParamTagToken:()=>bt});var Jn,bi,Xn,bt,Wo=I({"src/paramTag/index.ts"(){"use strict";X(),ge(),Ds(),Qr(),G(),V(),Xe(),Jn=[zs],bt=class extends(Xn=z){get type(){return"ext-inner"}constructor(e,t,s=C.getConfig(),i=[],l){if(super(void 0,s,i,{}),t){const r=Se;this.append(...t.split(`
|
|
7
|
+
`).map(n=>l?n:ms(n,s,i,e)).map(n=>new r(n,"param-line",s,i,{})))}i.splice(i.indexOf(this),1),i.push(this)}lint(e=this.getAbsoluteIndex()){const t="no-ignored",s=C.lintConfig.getSeverity(t,this.name);if(!s)return[];const i=new ue(this,e),l=C.msg("invalid parameter of <$1>",this.name),r=[];for(const n of this.childNodes){n.setAttribute("aIndex",e);const o=n.childNodes.filter(({type:a})=>a!=="comment"&&a!=="include"&&a!=="noinclude");if(o.some(({type:a})=>a==="ext"))r.push(Q(n,i,t,l,s));else{const a=o.findIndex(({type:u})=>u!=="text"),h=o.slice(0,a===-1?void 0:a).map(String).join("");if(h&&!(a===-1?/^[a-z]+(?:\[\])?\s*=/iu:/^[a-z]+(?:\[\])?\s*(?:=|$)/iu).test(h)){const u=Q(n,i,t,l,s);u.suggestions=[Z(u)],r.push(u)}else{const u=n.lint(e,!1);u.length>0&&r.push(...u)}}e+=n.toString().length+1}return r}},bi=ne(Xn),bt=ie(bi,0,"ParamTagToken",Jn,bt),se(bi,1,bt)}}),Kn,wi,Yn,wt,Uo=I({"src/heading.ts"(){"use strict";var e,t,Ns,i;X(),Re(),ge(),qe(),G(),V(),Ft(),Kn=[Oe],wt=(i=class extends(Yn=z){constructor(r,n,o,a=[]){super(void 0,o,a);B(this,t);B(this,e);E(this,e,r);const h=new z(n[0],o,a);h.type="heading-title",h.setAttribute("stage",2);const u=new Qe(n[1],"heading-trail",o,a);this.append(h,u)}get type(){return"heading"}get level(){return v(this,e)}toString(r){const n=P(this,t,Ns).call(this);return n+this.firstChild.toString(r)+n+this.lastChild.toString(r)}text(){const r=P(this,t,Ns).call(this);return r+this.firstChild.text()+r}getAttribute(r){return r==="invalid"?this.inHtmlAttrs()===2:r==="padding"?this.level:super.getAttribute(r)}getGaps(){return this.level}lint(r=this.getAbsoluteIndex(),n){const o=super.lint(r,n),{firstChild:a,level:h}=this,u=a.toString(),d=u.startsWith("="),f=d||u.endsWith("="),p=new ue(this,r),x=this.inHtmlAttrs(),A=["h1","unbalanced-header","format-leakage"],S=A.map(y=>C.lintConfig.getSeverity(y,"apostrophe"));if(S[0]&&this.level===1){const y=Q(a,p,A[0],"<h1>",S[0]);f||(y.suggestions=[je(y,"h2",`=${u}=`)]),o.push(y)}if(S[1]&&f){const y=C.msg("unbalanced $1 in a section header",'"="'),$=Q(a,p,A[1],y,S[1]);if(u!=="=")if(d){const[g]=/^=+/u.exec(u),c=h+g.length;$.suggestions=[{desc:`h${h}`,range:[$.startIndex,$.startIndex+g.length],text:""}],c<7&&$.suggestions.push({desc:`h${c}`,range:[$.endIndex,$.endIndex],text:g})}else{const g=/[^=](=+)$/u.exec(u)[1],c=h+g.length;$.suggestions=[{desc:`h${h}`,range:[$.endIndex-g.length,$.endIndex],text:""}],c<7&&$.suggestions.push({desc:`h${c}`,range:[$.startIndex,$.startIndex],text:g})}o.push($)}if(x){const y="parsing-order",$=C.lintConfig.getSeverity(y,x===2?"heading":"templateInTable");$&&o.push(te(this,p,y,"section header in HTML tag attributes",$))}if(S[2]){const y=this.getRootNode().toString(),$=a.childNodes.filter(Gs("quote")),g=$.filter(({bold:b})=>b),c=$.filter(({italic:b})=>b);if(g.length%2){const b=Q(g[g.length-1],{...p,start:r+h,left:p.left+h},A[2],C.msg("unbalanced $1 in a section header","bold apostrophes"),S[2]),w=r+h+u.length,m=Z(b);y.slice(b.endIndex,w).trim()?b.suggestions=[m,Ve(w,"'''")]:g.length===1&&c.length===0?b.fix=m:b.suggestions=[m],o.push(b)}if(c.length%2){const b=Q(c[c.length-1],{start:r+h},A[2],C.msg("unbalanced $1 in a section header","italic apostrophes"),S[2]),w=r+h+u.length;y.slice(b.endIndex,w).trim()?b.suggestions=[Ve(w,"''")]:c.length===1&&g.length===0?b.fix=Z(b):b.suggestions=[Z(b)],o.push(b)}}return o}print(){const r=P(this,t,Ns).call(this);return super.print({pre:r,sep:r})}json(r,n=this.getAbsoluteIndex()){const o=super.json(void 0,n);return o.level=this.level,o}},e=new WeakMap,t=new WeakSet,Ns=function(){return"=".repeat(this.level)},i),wi=ne(Yn),wt=ie(wi,0,"HeadingToken",Kn,wt),se(wi,1,wt)}}),Zn,yi,el,Xt,Ih=I({"src/hidden.ts"(){"use strict";jt(),V(),Zn=[dt()],Xt=class extends(el=z){get type(){return"hidden"}getAttribute(e){return e==="invalid"||super.getAttribute(e)}},yi=ne(el),Xt=ie(yi,0,"HiddenToken",Zn,Xt),se(yi,1,Xt)}}),tl,Si,sl,Kt,Nh=I({"src/arg.ts"(){"use strict";var e,Mo,s;ce(),X(),ge(),Ke(),qs(),qe(),G(),V(),Xe(),Ih(),tl=[Oe,We("{{{"),fs()],Kt=(s=class extends(sl=z){constructor(l,r,n=[]){super(void 0,r,n,{});B(this,e);for(let o=0;o<l.length;o++){const a=l[o];if(o===0){const h=new Se(a,"arg-name",r,n,{});super.insertAt(h)}else if(o>1){const h=new Xt(a,r,n);super.insertAt(h)}else{const h=new z(a,r,n);h.type="arg-default",h.setAttribute("stage",2),super.insertAt(h)}}}get type(){return"arg"}get default(){var l,r;return(r=(l=this.childNodes[1])==null?void 0:l.text())!=null?r:!1}toString(l){return`{{{${super.toString(l,"|")}}}}`}text(){return`{{{${ht(this.childNodes.slice(0,2),"|")}}}}`}afterBuild(){P(this,e,Mo).call(this),super.afterBuild()}lint(l=this.getAbsoluteIndex(),r){const{childNodes:[n,o,...a]}=this;n.setAttribute("aIndex",l+3);const h=n.lint(l+3,r);if(o){const f=l+4+n.toString().length;o.setAttribute("aIndex",f);const p=o.lint(f,r);p.length>0&&h.push(...p)}const u=["no-ignored","no-arg"],d=u.map(f=>C.lintConfig.getSeverity(f,"arg"));if(d[0]&&a.length>0){const f=new ue(this,l);h.push(...a.map(p=>{const x=Q(p,f,u[0],"invisible content inside triple braces",d[0]);return x.startIndex--,x.startCol--,x.suggestions=[Z(x),It(x.startIndex,"{{!}}")],x}))}if(d[1]&&!this.getAttribute("include")){const f=te(this,{start:l},u[1],"unexpected template argument",d[1]);o&&(f.suggestions=[je(f,"expand",o.text())]),h.push(f)}return h}print(){return super.print({pre:"{{{",post:"}}}",sep:"|"})}json(l,r=this.getAbsoluteIndex()){const n=super.json(void 0,r);return n.default=this.default,n}},e=new WeakSet,Mo=function(){this.setAttribute("name",this.firstChild.text().trim())},s),Si=ne(sl),Kt=ie(Si,0,"ArgToken",tl,Kt),se(Si,1,Kt)}}),zo={};oe(zo,{parseBraces:()=>Hs});var il,Ai,Ss,ki,$i,_i,rl,Ti,Hs,Jr=I({"parser/braces.ts"(){"use strict";Je(),ce(),Uo(),Co(),Nh(),il={"=":String.raw`\n(?!(?:[^\S\n]|\0\d+[cn]\x7F)*\n)`,"{":String.raw`\}{2,}|\|`,"-":String.raw`\}-`,"[":String.raw`\]\]`},Ai=String.raw`\[(?!\[)`,Ss=String.raw`\n(?![=\0])`,ki=String.raw`|\{{2,}`,$i=new Map([["!","!"],["!!","+"],["(!","{"],["!)","}"],["!-","-"],["=","~"],["server","m"]]),_i=ot(e=>new RegExp(e,"gmu")),rl=new RegExp(String.raw`\{\{((?:[^\n{}[]|${Ai}|${Ss})*)\}\}(?!\})`+"|"+String.raw`\[\[(?:[^\n[\]{]|${Ss})*\]\]`+"|"+String.raw`-\{(?:[^\n{}[]|${Ai}|${Ss})*\}-`,"gu"),Ti=e=>{const t=Tt(Le(e));return $i.has(t)?$i.get(t):/^(?:filepath|(?:full|canonical)urle?):./u.test(t)?"m":/^#vardefine:./u.test(t)?"n":"t"},Hs=(e,t,s)=>{var x,A,S,y,$;const i=String.raw`${t.excludes.includes("heading")?"":String.raw`^((?:\0\d+[cno]\x7F)*)={1,6}|`}\[\[|-\{(?!\{)`,{parserFunction:[,,,l]}=t,r=[],n=[],o=(g,c,b,w)=>{c[c.length-1].push(Ne(g.slice(b,w),n))};let a;do a!==void 0&&(e=a),a=e.replace(rl,(g,c,b)=>{if(c!==void 0||typeof b=="string")try{const{length:w}=s,m=(c!=null?c:b).split("|");return new nt(Ne(m[0],n),m.slice(1).map(_=>{const k=_.indexOf("=");return(k===-1?[_]:[_.slice(0,k),_.slice(k+1)]).map(T=>Ne(T,n))}),t,s),`\0${w}${Ti(m[0])}`}catch(w){if(!(w instanceof SyntaxError)||w.message!=="Invalid template name")throw w}return n.push(Ne(g,n)),`\0${n.length-1}`});while(a!==e);e=a;const h=e.lastIndexOf("}}")-e.length;let u=h+e.length!==-1,d=_i(i+(u?ki:"")),f=d.exec(e),p;for(;f||p!==void 0&&p<=e.length&&((A=(x=r[r.length-1])==null?void 0:x[0])!=null&&A.startsWith("="));){if(f!=null&&f[1]){const[,{length:j}]=f;f[0]=f[0].slice(j),f.index+=j}const{0:g,index:c}=f!=null?f:{0:`
|
|
8
|
+
`,index:e.length},b=(S=r.pop())!=null?S:{},{0:w,index:m,parts:_,findEqual:k,pos:T}=b,O=g==="="&&k;if(g==="]]"||g==="}-")p=c+2;else if(g===`
|
|
9
|
+
`){p=c+1;const{pos:j,findEqual:W}=(y=r[r.length-1])!=null?y:{};if(j===void 0||W||Le(e.slice(j,m))!==""){const N=/^(={1,6})(.+)\1((?:\s|\0\d+[cn]\x7F)*)$/u.exec(e.slice(m,c));N&&(N[2]=Ne(N[2],n),N[2].includes(`
|
|
10
|
+
`)||(e=`${e.slice(0,m)}\0${s.length}h${e.slice(c)}`,p=m+4+String(s.length).length,new wt(N[1].length,N.slice(2),t,s)))}}else if(g==="|"||O)p=c+1,o(e,_,T,c),g==="|"&&_.push([]),b.pos=p,b.findEqual=g==="|",r.push(b);else if(g.startsWith("}}")){const j=g.slice(0,Math.min(w.length,3)),W=w.length-j.length,{length:N}=s;p=c+j.length,o(e,_,T,c);let R=!1,J="t";if(j.length===3){const q=_.map(U=>U.join("=")),F=q.length>1&&Le(q[1]).trim();new Kt(q,t,s),F&&F.endsWith(":")&&l.includes(F.slice(0,-1).toLowerCase())&&(J="s")}else try{new nt(_[0][0],_.slice(1),t,s),J=Ti(_[0][0])}catch(q){if(q instanceof SyntaxError&&q.message==="Invalid template name")R=!0;else throw q}R||(e=`${e.slice(0,m+W)}\0${N}${J}${e.slice(p)}`,p=m+W+3+String(N).length,W>1?r.push({0:w.slice(0,W),index:m,pos:m+W,parts:[[]]}):W===1&&e[m-1]==="-"&&r.push({0:"-{",index:m-1,pos:m+1,parts:[[]]}))}else p=c+g.length,g.startsWith("{")&&(f.pos=p,f.parts=[[]]),r.push(..."0"in b?[b]:[],f);let L=r[r.length-1];if(u&&h+e.length<p)for(u=!1;($=L==null?void 0:L[0])!=null&&$.startsWith("{");)r.pop(),L=r[r.length-1];d=_i(i+(u?ki:"")+(L?`|${il[L[0][0]]}${L.findEqual?"|=":""}`:"")),d.lastIndex=p,f=d.exec(e)}return Ne(e,n)}}}),Ho={};oe(Ho,{InputboxToken:()=>Do});var Do,Lh=I({"src/paramTag/inputbox.ts"(){"use strict";Ds(),Jr(),G(),Wo(),Do=class extends bt{constructor(e,t,s=C.getConfig(),i=[]){const l=Symbol("InputboxToken"),r=s.excludes.includes("heading")?s:{...s,excludes:[...s.excludes,"heading"]},{length:n}=i;i.push(l),t&&(t=ms(t,r,i,e)),t&&(t=Hs(t,r,i)),i.splice(n,1),super(e,t,r,i,{})}}}}),Ls={};oe(Ls,{NestedToken:()=>Go});var nl,ll,Go,Ci=I({"src/nested.ts"(){"use strict";var e,t,s;X(),ge(),Ds(),Jr(),G(),V(),ha(),Ye(),nl=new Set(["comment","include","arg","template","magic-word"]),ll=[!1,!0].map(i=>{const l=i?"includeonly":"noinclude";return new RegExp(String.raw`^(?:<${l}(?:\s[^>]*)?/?>|</${l}\s*>)$`,"iu")}),Go=(s=class extends z{constructor(l,r,n,o,a=[]){if(typeof r=="boolean"){const h=Symbol("NestedToken"),{length:u}=a;a.push(h),l&&(l=ms(l,o,a,r)),l&&(l=Hs(l,o,a)),a.splice(u,1)}else l&&(l=l.replace(r,(h,u,d,f,p)=>{const x=`\0${a.length+1}e`;return new kt(u,d,f,p,o,!1,a),x}));l&&(l=l.replace(/(^|\0\d+.\x7F)([^\0]+)(?=$|\0\d+.\x7F)/gu,(h,u,d)=>(new pe(d,o,a),`${u}\0${a.length}n`)));super(l,o,a);B(this,e);B(this,t);E(this,e,[...n]),E(this,t,r)}get type(){return"ext-inner"}lint(l=this.getAbsoluteIndex(),r){const n=super.lint(l,r),o="no-ignored",a=C.lintConfig.getSeverity(o,this.name);if(!a)return n;const h=new ue(this,l),u=typeof v(this,t)=="boolean"?ll[v(this,t)?1:0]:/^<!--[\s\S]*-->$/u;return[...n,...this.childNodes.filter(d=>{const{type:f,name:p}=d;if(f==="ext")return!v(this,e).includes(p);if(nl.has(f))return!1;const x=d.toString().trim();return x&&!u.test(x)}).map(d=>{const f=Q(d,h,o,C.msg("invalid content in <$1>",this.name),a);return f.suggestions=[Z(f),Pr(f,d.toString())],f})]}},e=new WeakMap,t=new WeakMap,s)}});function ol(e,t,s,i,l){t=Le(t).trim();let r=t.replace(e==="link"?/\0\d+[tq]\x7F/gu:/\0\d+t\x7F/gu,"").trim();switch(e){case"width":return!r&&!!t||/^(?:\d+x?|\d*x\d+)(?:\s*px)?$/u.test(r);case"link":{if(r){if(Vo(s.protocol).test(r))return Qo(s.protocol).test(r)&&t;r.startsWith("[[")&&r.endsWith("]]")&&(r=r.slice(2,-2))}else return t;const n=C.normalizeTitle(r,0,!1,s,{halfParsed:i,decode:!0,selfLink:!0});return n.valid&&n}case"lang":return(l==="svg"||l==="svgz")&&!/[^a-z\d-]/u.test(r);case"alt":case"class":case"manualthumb":return!0;case"page":return(l==="djvu"||l==="djv"||l==="pdf")&&Number(r)>0;default:return!!r&&!isNaN(r)}}var Vo,Qo,al,hl,Jo,Fh=I({"src/imageParameter.ts"(){"use strict";var e,t,Xo,l;Je(),ce(),X(),G(),V(),Vo=ot(r=>new RegExp(String.raw`^(?:${r}|//|\0\d+m\x7F)`,"iu")),Qo=ot(r=>new RegExp(String.raw`^(?:(?:${r}|//)${$t}|\0\d+m\x7F)${_t}$`,"iu")),al=ot(r=>new RegExp(String.raw`^(\s*(?!\s))${r.replace("$1","(.*)")}${r.endsWith("$1")?`(?=$|
|
|
11
|
+
)`:""}(\s*)$`,"u")),hl=new Set(["alt","link","lang","page","caption"]),Jo=(l=class extends z{constructor(n,o,a,h){var r=(...i)=>(super(...i),B(this,t),B(this,e,""),this);let u;const d=Object.entries(a.img).map(([p,x])=>[p,x,al(p)]),f=d.find(([,p,x])=>(u=x.exec(n),u&&(u.length!==4||ol(p,u[2],a,!0,o)!==!1)));if(f&&u){u.length===3?(r(void 0,a,h),E(this,e,n)):(r(u[2],a,h,{}),E(this,e,u[1]+f[0]+u[3])),this.setAttribute("name",f[1]);return}r(n,a.excludes.includes("list")?a:{...a,excludes:[...a.excludes,"list"]},h),this.setAttribute("name","caption"),this.setAttribute("stage",7)}get type(){return"image-parameter"}get link(){return this.name==="link"?ol("link",super.text(),this.getAttribute("config")):void 0}afterBuild(){var n;(n=this.parentNode)!=null&&n.is("gallery-image")&&!hl.has(this.name)&&this.setAttribute("name","invalid"),super.afterBuild()}toString(n){return v(this,e)?v(this,e).replace("$1",super.toString(n)):super.toString(n)}text(){return v(this,e)?v(this,e).replace("$1",super.text()).trim():super.text().trim()}isPlain(){return this.name==="caption"}getAttribute(n){return n==="invalid"?this.name==="invalid":n==="padding"?Math.max(0,v(this,e).indexOf("$1")):super.getAttribute(n)}lint(n=this.getAbsoluteIndex(),o){const a=super.lint(n,o),{link:h,name:u}=this;if(u==="invalid"){const d="invalid-gallery",f=C.lintConfig.getSeverity(d,"parameter");if(f){const p=te(this,{start:n},d,"invalid image parameter",f);p.fix=Z(p,-1),a.push(p)}}else if(typeof h=="object"&&h.encoded){const d="url-encoding",f=C.lintConfig.getSeverity(d,"file");if(f){const p=te(this,{start:n},d,"unnecessary URL encoding in an internal link",f);p.fix=Er(p,this),a.push(p)}}return a}getValue(){return this.name==="invalid"?this.text():P(this,t,Xo).call(this)||super.text()}print(){return v(this,e)?`<span class="wpb-image-parameter${this.name==="invalid"?" wpb-invalid":""}">${v(this,e).replace("$1",`<span class="wpb-image-caption">${Ct(this.childNodes)}</span>`)}</span>`:super.print({class:"image-caption"})}},e=new WeakMap,t=new WeakSet,Xo=function(){return v(this,e)&&!v(this,e).includes("$1")},l)}}),Ii,ul,dl,Ni,Li,Fi,cl,ji,Xr,Ko=I({"src/link/file.ts"(){"use strict";X(),ge(),G(),Ws(),Fh(),Ii=new Map([["manualthumb","Thumb"],["frameless","Frameless"],["framed","Frame"],["thumbnail","Thumb"]]),ul=new Set(["arg"]),dl=new Set(["template","magic-word"]),Ni=new Set(["left","right","center","none"]),Li=new Set(["baseline","sub","super","top","text-top","middle","bottom","text-bottom"]),Fi=new Set(["tiff","tif","png","gif","jpg","jpeg","webp","xcf","pdf","svg","djvu"]),cl=e=>{if(e===void 0)return[];const t=/-\{|\}-|\|/gu,s=[];let i=t.exec(e),l=0,r=0;for(;i;){const{0:n,index:o}=i;n!=="|"?l+=n==="-{"?1:-1:l===0&&(s.push(e.slice(r,o)),{lastIndex:r}=t),i=t.exec(e)}return s.push(e.slice(r)),s},ji=(e,t)=>e.filter(({childNodes:s})=>{const i=s.filter(l=>l.text().trim());return i.length!==1||!t.has(i[0].type)}),Xr=class extends De{get type(){return"file"}get extension(){return this.getAttribute("title").extension}constructor(e,t,s,i=[],l="|"){super(e,void 0,s,i,l);const{extension:r}=this.getTitle(!0,!0);this.safeAppend(cl(t).map(n=>new Jo(n,r,s,i)))}lint(e=this.getAbsoluteIndex(),t){var S;const s=super.lint(e,t),i=ji(this.getAllArgs(),ul),l=[...new Set(i.map(({name:y})=>y))],r=l.filter(y=>Ii.has(y)),n=l.filter(y=>Ni.has(y)),o=l.filter(y=>Li.has(y)),[a]=r,h=a==="framed"||a==="manualthumb",u=new ue(this,e),{extension:d}=this;let f="nested-link",p=C.lintConfig.getSeverity(f,"file");if(p&&Fi.has(d)&&this.closest("ext-link-text")&&((S=this.getValue("link"))==null?void 0:S.trim())!==""){const y=te(this,u,f,"internal link in an external link",p),$=this.getArg("link");if($){const g=e+$.getRelativeIndex();y.fix={desc:"delink",range:[g,g+$.toString().length],text:"link="}}else y.fix=Os(y.endIndex-2,"delink","|link=");s.push(y)}if(f="invalid-gallery",p=C.lintConfig.getSeverity(f,"parameter"),p&&h)for(const y of i.filter(({name:$})=>$==="width")){const $=Q(y,u,f,"invalid image parameter",p);$.fix=Z($,-1),s.push($)}if(i.length===l.length&&r.length<2&&n.length<2&&o.length<2)return s;f="no-duplicate";const x=["unknownImageParameter","imageParameter"].map(y=>C.lintConfig.getSeverity(f,y)),A=(y,$,g,c=!0)=>y.map(b=>{if(p=x[Number(typeof c=="function"?c(b):c)],!p)return!1;const w=Q(b,u,f,C.msg(`${$} image $1 parameter`,g),p);return w.suggestions=[Z(w,-1)],w}).filter(b=>b!==!1);for(const y of l){if(y==="invalid"||y==="width"&&h)continue;const $=y==="caption";let g=i.filter(({name:c})=>c===y);if($&&(g=[...g.slice(0,-1).filter(c=>c.text()),...g.slice(-1)]),g.length>1){let c=!$||!d||Fi.has(d);if($&&c){const b=ji(g,dl);c=b.length>1&&(w=>b.includes(w))}s.push(...A(g,"duplicated",y,c))}}return r.length>1&&s.push(...A(i.filter(({name:y})=>Ii.has(y)),"conflicting","frame")),n.length>1&&s.push(...A(i.filter(({name:y})=>Ni.has(y)),"conflicting","horizontal-alignment")),o.length>1&&s.push(...A(i.filter(({name:y})=>Li.has(y)),"conflicting","vertical-alignment")),s}getAllArgs(){return this.childNodes.slice(1)}getArgs(e){return this.getAllArgs().filter(({name:t})=>e===t)}getArg(e){const t=this.getArgs(e);return t[e==="manualthumb"?0:t.length-1]}getValue(e){var t;return(t=this.getArg(e))==null?void 0:t.getValue()}json(e,t=this.getAbsoluteIndex()){const s=super.json(void 0,t),{extension:i}=this;return i&&(s.extension=i),s}}}}),gl,Ei,pl,yt,Yo=I({"src/link/galleryImage.ts"(){"use strict";var e,vr,s;X(),ut(),Ke(),G(),V(),Ko(),gl=[We("")],yt=(s=class extends(pl=Xr){constructor(l,r,n,o,a=[]){let h;if(n!==void 0){const{length:u}=a;h=new z(n,o,a);for(let d=0;d<$e-1;d++)h.parseOnce();a.splice(u,1)}super(r,h==null?void 0:h.toString(),o,a);B(this,e);Ce(this,"privateType","imagemap-image");this.setAttribute("bracket",!1),this.privateType=`${l}-image`,this.seal("privateType",!0)}get type(){return this.privateType}getTitle(l){const r=this.type==="imagemap-image";return this.normalizeTitle(this.firstChild.toString(),r?0:6,{halfParsed:!0,temporary:l,decode:!r})}lint(l=this.getAbsoluteIndex(),r){const n=super.lint(l,r),o="invalid-gallery",a=C.lintConfig.getSeverity(o,"image");if(a&&P(this,e,vr).call(this)){const h=te(this,{start:l},o,"invalid gallery image",a);h.suggestions=[Os(l,"prefix","File:")],n.push(h)}return n}getAttribute(l){return l==="invalid"?P(this,e,vr).call(this):super.getAttribute(l)}},e=new WeakSet,vr=function(){const{ns:l}=this.getAttribute("title");return l!==6},s),Ei=ne(pl),yt=ie(Ei,0,"GalleryImageToken",gl,yt),se(Ei,1,yt)}}),Zo={};oe(Zo,{GalleryToken:()=>Yt});var fl,Ri,ml,Yt,jh=I({"src/gallery.ts"(){"use strict";var e,ea,br,i;X(),Qr(),G(),V(),Yo(),Ye(),fl=[zs],Yt=(i=class extends(ml=z){constructor(r,n,o=[]){var a;super(void 0,n,o,{});B(this,e);for(const h of(a=r==null?void 0:r.split(`
|
|
12
|
+
`))!=null?a:[]){const u=/^([^|]+)(?:\|(.*))?/u.exec(h);if(!u){super.insertAt(h.trim()?new pe(h,n,o):h);continue}const[,d,f]=u;P(this,e,ea).call(this,d)?super.insertAt(new yt("gallery",d,f,n,o)):super.insertAt(new pe(h,n,o))}}get type(){return"ext-inner"}get widths(){return P(this,e,br).call(this,"widths")}get heights(){return P(this,e,br).call(this,"heights")}lint(r=this.getAbsoluteIndex(),n){const{top:o,left:a}=this.getRootNode().posFromIndex(r),h=[],u="no-ignored",d=["Image","NoImage","Comment"].map(f=>C.lintConfig.getSeverity(u,`gallery${f}`));for(let f=0;f<this.length;f++){const p=this.childNodes[f],x=p.toString(),{length:A}=x,S=x.trim(),{type:y}=p,$=o+f,g=f?0:a;if(p.setAttribute("aIndex",r),y==="noinclude"&&S&&!/^<!--.*-->$/u.test(S)){let[c]=d;if(S.startsWith("|")?[,c]=d:(S.startsWith("<!--")||S.endsWith("-->"))&&([,,c]=d),c){const b=r+A,w={rule:u,message:C.msg("invalid content in <$1>","gallery"),severity:c,startIndex:r,endIndex:b,startLine:$,endLine:$,startCol:g,endCol:g+A};w.suggestions=[Z(w),Pr(w,x)],h.push(w)}}else if(y!=="noinclude"&&y!=="text"){const c=p.lint(r,n);c.length>0&&h.push(...c)}r+=A+1}return h}json(r,n=this.getAbsoluteIndex()){const o=super.json(void 0,n);return Object.assign(o,{widths:this.widths,heights:this.heights}),o}},e=new WeakSet,ea=function(r){return this.normalizeTitle(r,6,{halfParsed:!0,temporary:!0,decode:!0}).valid},br=function(r){var a,h;const n=(a=this.parentNode)==null?void 0:a.getAttr(r),o=typeof n=="string"&&((h=/^(\d+)\s*(?:px)?$/u.exec(n))==null?void 0:h[1]);return o&&Number(o)||120},i),Ri=ne(ml),Yt=ie(Ri,0,"GalleryToken",fl,Yt),se(Ri,1,Yt)}}),Kr,ta=I({"src/link/index.ts"(){"use strict";Je(),X(),G(),Ws(),Kr=class extends De{get type(){return"link"}get innerText(){return this.length>1?this.lastChild.text():us(this.firstChild.text().replace(/^\s*:?/u,""))}lint(e=this.getAbsoluteIndex(),t){const s=super.lint(e,t),i="nested-link",l=C.lintConfig.getSeverity(i);if(l&&this.closest("ext-link-text")){const r=te(this,{start:e},i,"internal link in an external link",l);r.fix=je(r,"delink",this.innerText),s.push(r)}return s}}}}),xl,vl,gs,Yr=I({"src/magicLink.ts"(){"use strict";var e,t,wr,i;X(),ce(),ge(),G(),V(),xl=String.raw`(?:[${Ge}\t]| |�*160;|&#[xX]0*[aA]0;)`,vl=new RegExp(`${xl}+`,"gu"),gs=(i=class extends z{constructor(r,n="free-ext-link",o=C.getConfig(),a){super(r,o,a,{});B(this,t);B(this,e);E(this,e,n)}get type(){return v(this,e)}get innerText(){const r=new Map([["!","|"],["=","="]]);let n=ht(this.childNodes.map(o=>{const{type:a}=o,h=String(o.name);return a==="magic-word"&&r.has(h)?r.get(h):o}));return this.type==="magic-link"&&(n=n.replace(vl," ")),n}get link(){const{innerText:r}=this;return this.type==="magic-link"?r.startsWith("ISBN")?`ISBN ${r.slice(5).replace(/[- ]/gu,"").replace(/x$/u,"X")}`:r:vo(r).replace(/\n/gu,"%0A")}lint(r=this.getAbsoluteIndex(),n){const o=super.lint(r,n),a=new ue(this,r),{type:h,childNodes:u}=this;if(h==="magic-link"){const x="invalid-isbn",A=C.lintConfig.getSeverity(x);return A&&P(this,t,wr).call(this)&&o.push(te(this,a,x,"invalid ISBN",A)),o}const d=h==="ext-link-url",f="unterminated-url",p=C.lintConfig.getSeverity(f,d?"pipe":"punctuation");if(p){const x=d?/\|/u:/[,;。:!?()]+/u,A=u.find(S=>S.type==="text"&&x.test(S.data));if(A){const{data:S}=A,y=Q(A,a,f,C.msg("$1 in URL",d?'"|"':"full-width punctuation"),p),{index:$,0:g}=x.exec(S),c=y.startIndex+$;y.suggestions=d?[cs(c,1)]:[cs(c),{desc:"encode",range:[c,c+g.length],text:encodeURI(g)}],o.push(y)}}return o}getUrl(r){{const{type:n}=this;let{link:o}=this;if(n==="magic-link"){if(o.startsWith("ISBN"))return this.normalizeTitle(`BookSources/${o.slice(5)}`,-1,{temporary:!0}).getUrl(r);o=o.startsWith("RFC")?`https://datatracker.ietf.org/doc/html/rfc${o.slice(4)}`:`https://pubmed.ncbi.nlm.nih.gov/${o.slice(5)}`}else o.startsWith("//")&&(o=`https:${o}`);return new URL(o)}this.lspError("MagicLinkToken.getUrl")}getAttribute(r){return r==="invalid"?P(this,t,wr).call(this):super.getAttribute(r)}},e=new WeakMap,t=new WeakSet,wr=function(){if(this.type==="magic-link"){const{link:r}=this;if(r.startsWith("ISBN")){const n=[...r.slice(5)].map(o=>o==="X"?10:Number(o));return n.length===10?n.reduce((o,a,h)=>o+a*(10-h),0)%11!==0:n.length===13&&(n[12]===10||n.reduce((o,a,h)=>o+a*(h%2?3:1),0)%10!==0)}}return!1},i)}}),bl,Pi,wl,St,sa=I({"src/extLink.ts"(){"use strict";var e,t;ut(),X(),Ke(),G(),V(),Yr(),bl=[We("[")],St=(t=class extends(wl=z){constructor(i,l="",r="",n,o=[]){super(void 0,n,o,{});B(this,e);const a=i&&/^\0\d+f\x7F$/u.test(i)?o[Number(i.slice(1,-2))]:new gs(i,"ext-link-url",n,o);if(this.insertAt(a),E(this,e,l),r){const h=new z(r,n,o,{});h.type="ext-link-text",h.setAttribute("stage",$e-1),this.insertAt(h)}}get type(){return"ext-link"}toString(i){return this.length===1?`[${super.toString(i)}${v(this,e)}]`:`[${super.toString(i,v(this,e))}]`}text(){return`[${super.text(" ")}]`}getGaps(){return v(this,e).length}lint(i=this.getAbsoluteIndex(),l){const r=super.lint(i,l),n="var-anchor",o=C.lintConfig.getSeverity(n,"extLink");return o&&this.length===1&&this.closest("heading-title")&&r.push(te(this,{start:i},n,"variable anchor in a section header",o)),r}print(){return super.print(this.length===1?{pre:"[",post:`${v(this,e)}]`}:{pre:"[",sep:v(this,e),post:"]"})}},e=new WeakMap,t),Pi=ne(wl),St=ie(Pi,0,"ExtLinkToken",bl,St),se(Pi,1,St)}}),yr,Eh=I({"src/imagemapLink.ts"(){"use strict";V(),Ye(),ta(),sa(),yr=class extends z{get type(){return"imagemap-link"}constructor(e,t,s,i,l=[]){super(void 0,i,l),this.append(e,t.length===2?new Kr(...t,i,l):new St(...t,i,l),new pe(s,i,l))}}}}),ia={};oe(ia,{ImagemapToken:()=>Zt});var yl,Oi,Sl,Zt,Rh=I({"src/imagemap.ts"(){"use strict";X(),Re(),ge(),Qr(),G(),V(),Ye(),Yo(),Eh(),yl=[zs],Zt=class extends(Sl=z){get type(){return"ext-inner"}get image(){return this.childNodes.find(Gs("imagemap-image"))}constructor(e,t=C.getConfig(),s=[]){if(super(void 0,t,s,{}),!e)return;const i=e.split(`
|
|
13
|
+
`),l=new Set(t.protocol.split("|")),r=pe;let n=!0,o=!1;for(const a of i){const h=a.trim();if(!(o||!h||h.startsWith("#"))){if(n){const u=a.indexOf("|"),d=u===-1?a:a.slice(0,u),{valid:f,ns:p}=this.normalizeTitle(d,0,{halfParsed:!0,temporary:!0});if(f&&p===6){const x=new yt("imagemap",d,u===-1?void 0:a.slice(u+1),t,s);super.insertAt(x),n=!1;continue}else o=!0}else if(a.trim().split(/[\t ]/u,1)[0]==="desc"){super.insertAt(a);continue}else if(a.includes("[")){const u=a.indexOf("["),d=a.slice(u),f=/^\[\[([^|]+)(?:\|([^\]]*))?\]\][\w\s]*$/u.exec(d);if(f){if(this.normalizeTitle(f[1],0,{halfParsed:!0,temporary:!0,selfLink:!0}).valid){super.insertAt(new yr(a.slice(0,u),f.slice(1),d.slice(d.indexOf("]]")+2),t,s));continue}}else if(d.startsWith("[//")||l.has(d.slice(1,d.indexOf(":")+1))||l.has(d.slice(1,d.indexOf("//")+2))){const p=/^\[([^\]\s]+)(?:(\s+(?!\s))([^\]]*))?\][\w\s]*$/u.exec(d);if(p){super.insertAt(new yr(a.slice(0,u),p.slice(1),d.slice(d.indexOf("]")+1),t,s));continue}}}}super.insertAt(new r(a,t,s))}}lint(e=this.getAbsoluteIndex(),t){const s=super.lint(e,t),i=new ue(this,e),{childNodes:l,image:r}=this,n="invalid-imagemap",o=C.lintConfig.getSeverity(n,r?"link":"image");return o&&(r?s.push(...l.filter(a=>{const h=a.toString().trim();return a.is("noinclude")&&h&&!h.startsWith("#")}).map(a=>{const h=Q(a,i,n,"invalid link in <imagemap>",o);return h.suggestions=[Z(h,-1),je(h,"comment","# ")],h})):s.push(te(this,i,n,"<imagemap> without an image",o))),s}getAttribute(e){return e==="invalid"?!this.image:super.getAttribute(e)}},Oi=ne(Sl),Zt=ie(Oi,0,"ImagemapToken",yl,Zt),se(Oi,1,Zt)}}),Al,Bi,kl,At,ra=I({"src/nowiki/comment.ts"(){"use strict";X(),jt(),Ke(),G(),ct(),Al=[dt(!1),We("<!--")],At=class extends(kl=Ee){constructor(t,s,i,l){super(t,i,l);Ce(this,"closed");this.closed=s}get type(){return"comment"}lint(t=this.getAbsoluteIndex()){if(this.closed)return[];const s="unclosed-comment",i=C.lintConfig.getSeverity(s);if(!i)return[];const l=te(this,{start:t},s,C.msg("unclosed $1","HTML comment"),i);return l.suggestions=[Ve(l.endIndex,"-->")],[l]}toString(t){return t?"":`<!--${this.innerText}${this.closed?"-->":""}`}print(){return super.print({pre:"<!--",post:this.closed?"-->":""})}},Bi=ne(kl),At=ie(Bi,0,"CommentToken",Al,At),se(Bi,1,At)}}),na={};oe(na,{CommentedToken:()=>la});var la,Ph=I({"src/commented.ts"(){"use strict";V(),ra(),la=class extends z{get type(){return"ext-inner"}constructor(e,t,s=[]){if(super(void 0,t,s,{AstText:":",CommentToken:":"}),e){let i=e.indexOf("<!--"),l=i!==-1&&e.indexOf("-->",i+4),r=0;for(;l!==!1&&l!==-1;)i>r&&this.insertAt(e.slice(r,i)),this.insertAt(new At(e.slice(i+4,l),!0,t,s)),r=l+3,i=e.indexOf("<!--",r),l=i!==-1&&e.indexOf("-->",i+4);r<e.length&&this.insertAt(e.slice(r))}}lint(e=this.getAbsoluteIndex()){return super.lint(e,new RegExp(String.raw`<\s*(?:\/\s*)?(${this.name})\b`,"giu"))}}}}),oa={};oe(oa,{NowikiToken:()=>aa});var $l,_l,aa,Oh=I({"src/nowiki/index.ts"(){"use strict";var e,Sr,s;Je(),X(),G(),ct(),$l=ot(i=>new RegExp(String.raw`<\s*(?:/\s*)${i==="nowiki"?"":"?"}(${i})\b`,"giu")),_l=new Set(["languages","section","templatestyles"]),aa=(s=class extends Ee{constructor(){super(...arguments);B(this,e)}get type(){return"ext-inner"}lint(l=this.getAbsoluteIndex()){const{name:r}=this,n="void-ext",o=C.lintConfig.getSeverity(n,r);if(o&&P(this,e,Sr).call(this)){const a=te(this,{start:l},n,C.msg("nothing should be in <$1>",r),o);return a.suggestions=[Z(a)],[a]}return super.lint(l,$l(r))}getAttribute(l){return l==="invalid"?P(this,e,Sr).call(this):super.getAttribute(l)}},e=new WeakSet,Sr=function(){const{name:l,firstChild:{data:r}}=this;return _l.has(l)&&!!r},s)}}),Tl,qi,Cl,kt,ha=I({"src/tagPair/ext.ts"(){"use strict";X(),ge(),G(),zr(),V(),Mr(),Vr(),Tl=[Us()],kt=class extends(Cl=lt){get type(){return"ext"}constructor(e,t,s,i,l=C.getConfig(),r=!1,n=[]){const o=e.toLowerCase(),a=new Ms(!t||/^\s/u.test(t)?t:` ${t}`,"ext-attrs",o,l,n),h={...l,ext:l.ext.filter(d=>d!==o),excludes:[...l.excludes]};let u;switch(h.inExt=!0,o){case"tab":h.ext=h.ext.filter(d=>d!=="tabs");case"indicator":case"poem":case"ref":case"option":case"combooption":case"tabs":case"poll":case"seo":case"langconvert":case"phonos":o==="poem"&&h.excludes.push("heading"),u=new z(s,h,n);break;case"pre":{const{PreToken:d}=(Ch(),Y(Oo));u=new d(s,h,n);break}case"dynamicpagelist":{const{ParamTagToken:d}=(Wo(),Y(qo));u=new d(r,s,h,n);break}case"inputbox":{const{InputboxToken:d}=(Lh(),Y(Ho));u=new d(r,s,h,n);break}case"references":{const{NestedToken:d}=(Ci(),Y(Ls));h.excludes.push("heading"),u=new d(s,r,["ref"],h,n);break}case"choose":{const{NestedToken:d}=(Ci(),Y(Ls));u=new d(s,/<(option|choicetemplate)(\s[^>]*?)?(?:\/>|>([\s\S]*?)<\/(\1)>)/gu,["option","choicetemplate"],h,n);break}case"combobox":{const{NestedToken:d}=(Ci(),Y(Ls));u=new d(s,/<(combooption)(\s[^>]*?)?(?:\/>|>([\s\S]*?)<\/(combooption\s*)>)/giu,["combooption"],h,n);break}case"gallery":{const{GalleryToken:d}=(jh(),Y(Zo));u=new d(s,h,n);break}case"imagemap":{const{ImagemapToken:d}=(Rh(),Y(ia));u=new d(s,h,n);break}case"hiero":{const{CommentedToken:d}=(Ph(),Y(na));u=new d(s,h,n);break}default:{const{NowikiToken:d}=(Oh(),Y(oa));u=new d(s,h,n)}}u.setAttribute("name",o),u.type==="plain"&&(u.type="ext-inner"),super(e,a,u,i,l,n),this.seal("closed",!0)}lint(e=this.getAbsoluteIndex(),t){const s=super.lint(e,t),i=new ue(this,e);if(this.name!=="nowiki"){const n=this.inHtmlAttrs(),o="parsing-order",a=n&&C.lintConfig.getSeverity(o,n===2?"ext":"templateInTable");a&&s.push(te(this,i,o,"extension tag in HTML tag attributes",a))}const l="var-anchor",r=C.lintConfig.getSeverity(l,"ref");return r&&this.name==="ref"&&this.closest("heading-title")&&s.push(te(this,i,l,"variable anchor in a section header",r)),s}},qi=ne(Cl),kt=ie(qi,0,"ExtToken",Tl,kt),se(qi,1,kt)}}),ua={};oe(ua,{parseCommentAndExt:()=>ms});var Wi,Il,As,Nl,Ui,ms,Ds=I({"parser/commentAndExt.ts"(){"use strict";Je(),ce(),kh(),Ye(),$h(),_h(),ha(),ra(),Wi="<onlyinclude>",Il="</onlyinclude>",{length:As}=Wi,Nl=[!1,!0].map(e=>{const t=e?"includeonly":"(?:no|only)include",s=e?"noinclude":"includeonly";return yo(i=>new RegExp(String.raw`<!--[\s\S]*?(?:-->|$)|<${t}(?:\s[^>]*)?/?>|</${t}\s*>|<(${i.join("|")})(\s[^>]*?)?(?:/>|>([\s\S]*?)</(${"\\1"}\s*)>)|<(${s})(\s[^>]*?)?(?:/>|>([\s\S]*?)(?:</(${s}\s*)>|$))`,"giu"))}),Ui=e=>{const t=e.indexOf(Wi);return{i:t,j:e.indexOf(Il,t+As)}},ms=(e,t,s,i)=>{if(i){let{i:o,j:a}=Ui(e);if(o!==-1&&a!==-1){let h="";const u=d=>{new pe(d,t,s),h+=`\0${s.length-1}n`};for(;o!==-1&&a!==-1;){const d=`\0${s.length}e`;new Qt(e.slice(o+As,a),t,s),o>0&&u(e.slice(0,o)),h+=d,e=e.slice(a+As+1),{i:o,j:a}=Ui(e)}return e&&u(e),h}}const{ext:l}=t,r=l.filter(o=>o!=="translate"&&o!=="tvar"),n={...t,ext:r};if(l.includes("translate")){const o=[];e=e.replace(/<nowiki>[\s\S]*?<\/nowiki>/giu,a=>(o.push(a),`\0${o.length-1}`)).replace(/<translate( nowrap)?>([\s\S]+?)?<\/translate>/gu,(a,h,u)=>{const d=s.length;return new jo(h,u&&Ne(u,o),n,s),`\0${d}g`}),e=Ne(e,o)}return e.replace(Nl[i?1:0](r),(o,a,h,u,d,f,p,x,A)=>{const S=s.length;let y="n";if(a)y="e",new kt(a,h,u,d,n,f,s);else if(o.startsWith("<!--")){y="c";const $=o.endsWith("-->");new At(Ne(o,s,1).slice(4,$?-3:void 0),$,t,s)}else f?new Jt(f,p&&Ne(p,s,1),x&&Ne(x,s,1),A,t,s):new pe(o,t,s);return`\0${S}${y}`})}}}),Ll,Fl,jl,El,Mi,Rl,es,Bh=I({"src/html.ts"(){"use strict";var e,t,s,i,l;X(),Re(),ge(),zr(),G(),V(),Ll=new Set(["if","ifeq","ifexpr","ifexist","iferror","switch"]),Fl=new Set(["b","big","center","cite","code","del","dfn","em","font","i","ins","kbd","mark","pre","q","s","samp","small","strike","strong","sub","sup","tt","u","var"]),jl=new Set(["strike","big","center","font","tt"]),El=[Us()],es=(l=class extends(Rl=z){constructor(n,o,a,h,u,d){super(void 0,u,d);B(this,e);B(this,t);B(this,s);B(this,i);this.insertAt(o),this.setAttribute("name",n.toLowerCase()),E(this,e,a),E(this,t,h),E(this,s,n)}get type(){return"html"}get selfClosing(){return v(this,t)}get closing(){return v(this,e)}toString(n){return`<${this.closing?"/":""}${v(this,s)}${super.toString(n)}${v(this,t)?"/":""}>`}text(){const{closing:n}=this,o=v(this,s)+(n?"":super.text());return`<${n?"/":""}${o}${v(this,t)?"/":""}>`}getAttribute(n){return n==="invalid"?this.inTableAttrs()===2:n==="padding"?v(this,s).length+(this.closing?2:1):super.getAttribute(n)}lint(n=this.getAbsoluteIndex(),o){var w;const a=super.lint(n,o),{name:h,parentNode:u,closing:d,selfClosing:f}=this,p=new ue(this,n),x=this.inTableAttrs();let A="h1",S=C.lintConfig.getSeverity(A,"html");if(S&&h==="h1"&&!d){const m=te(this,p,A,"<h1>",S);m.suggestions=[{desc:"h2",range:[n+2,n+3],text:"2"}],a.push(m)}if(A="parsing-order",S=x&&C.lintConfig.getSeverity(A,x===2?"html":"templateInTable"),S){const m=te(this,p,A,"HTML tag in table attributes",S);x===2&&(m.suggestions=[Z(m)]),a.push(m)}if(A="obsolete-tag",S=C.lintConfig.getSeverity(A,h),S&&jl.has(h)&&a.push(te(this,p,A,"obsolete HTML tag",S)),A="bold-header",S=C.lintConfig.getSeverity(A,h),S&&(h==="b"||h==="strong")&&((w=this.closest("heading-title,ext"))==null?void 0:w.type)==="heading-title"){const m=te(this,p,A,"bold in section header",S);m.suggestions=[Z(m)],a.push(m)}const{html:[,y,$]}=this.getAttribute("config"),g=$.includes(h),c=y.includes(h),b=!g&&!c;if(A="unmatched-tag",d&&(f||g)||f&&b){if(S=C.lintConfig.getSeverity(A,d?"both":"selfClosing"),S){const m=te(this,p,A,d?"tag that is both closing and self-closing":"invalid self-closing tag",S),_=Rr(n),k={desc:"no self-closing",range:[m.endIndex-2,m.endIndex-1],text:""};c?m.suggestions=[_,k]:d?m.fix=g?_:k:m.suggestions=[k,Ve(m.endIndex,`></${h}>`,-2)],a.push(m)}}else if(!this.findMatchingTag()){const m=te(this,p,A,d?"unmatched closing tag":"unclosed tag"),_=this.closest("magic-word");if(_&&Ll.has(_.name))S=C.lintConfig.getSeverity(A,"conditional");else if(d)S=C.lintConfig.getSeverity(A,"closing"),m.suggestions=[Z(m)];else{S=C.lintConfig.getSeverity(A,"opening");const k=u==null?void 0:u.childNodes;Fl.has(h)&&(k!=null&&k.slice(0,k.indexOf(this)).some(T=>T.type==="html"&&T.name===h&&!T.findMatchingTag())&&(m.suggestions=[Ve(n+1,"/")]),this.closest("heading-title")&&(m.rule="format-leakage",S=C.lintConfig.getSeverity("format-leakage",h)))}S&&(m.severity=S,a.push(m))}return a}findMatchingTag(){return at(v(this,i),()=>{const{name:n,parentNode:o,closing:a,selfClosing:h}=this,{html:[,u,d]}=this.getAttribute("config"),f=d.includes(n),p=u.includes(n);if(f||p&&h)return this;if(!o)return;const{childNodes:x}=o,A=x.indexOf(this),S=a?x.slice(0,A).reverse():x.slice(A+1),y=[this],{rev:$}=ve;for(const g of S)if(!(!g.is("html")||g.name!==n||p&&v(g,t)))if(v(g,e)===a)y.push(g);else{const c=y.pop();if(c===this)return g;C.viewOnly&&(E(c,i,[$,g]),E(g,i,[$,c]))}if(C.viewOnly)for(const g of y)E(g,i,[$,void 0])},n=>{E(this,i,n),n[1]&&n[1]!==this&&E(n[1],i,[ve.rev,this])})}print(){return super.print({pre:`<${this.closing?"/":""}${v(this,s)}`,post:`${v(this,t)?"/":""}>`})}json(n,o=this.getAbsoluteIndex()){const a=super.json(void 0,o);return Object.assign(a,{closing:this.closing,selfClosing:v(this,t)}),a}},e=new WeakMap,t=new WeakMap,s=new WeakMap,i=new WeakMap,l),Mi=ne(Rl),es=ie(Mi,0,"HtmlToken",El,es),se(Mi,1,es)}}),da={};oe(da,{parseHtml:()=>ca});var Pl,ca,qh=I({"parser/html.ts"(){"use strict";Vr(),Bh(),Pl=/^(\/?)([a-z][^\s/>]*)((?:\s|\/(?!>))[^>]*?)?(\/?>)([^<]*)$/iu,ca=(e,t,s)=>{var n;const{html:i}=t;(n=t.htmlElements)!=null||(t.htmlElements=new Set([...i[0],...i[1],...i[2]]));const l=e.split("<");let r=l.shift();for(const o of l){const a=Pl.exec(o),h=a==null?void 0:a[2],u=h==null?void 0:h.toLowerCase();if(!a||!t.htmlElements.has(u)){r+=`<${o}`;continue}const[,d,,f="",p,x]=a,{length:A}=s,S=new Ms(f,"html-attrs",u,t,s),y=S.hasAttr("itemprop");if(u==="meta"&&!(y&&S.hasAttr("content"))||u==="link"&&!(y&&S.hasAttr("href"))){r+=`<${o}`,s.length=A;continue}r+=`\0${s.length}x${x}`,new es(h,S,d==="/",p==="/>",t,s)}return r}}}),Ol,Zr,ga=I({"src/table/base.ts"(){"use strict";zr(),G(),V(),Ft(),Vr(),Ol=e=>{const t=e.childNodes.map(i=>i.type==="text"?i.data.replace(/\|\|/gu,"{{!!}}").replace(/\|/gu,"{{!}}"):i.toString()).join(""),{childNodes:s}=C.parse(t,e.getAttribute("include"),2,e.getAttribute("config"));e.safeReplaceChildren(s)},Zr=class extends Us(1)(z){constructor(e,t,s,i,l,r=[],n){super(void 0,l,r,n),this.append(new Qe(t,"table-syntax",l,r),new Ms(i,"table-attrs",s,l,r))}escape(){for(const e of this.childNodes)e instanceof Qe?Ol(e):e.escape()}}}}),Bl,zi,ye,ks,Wt,Ut,Rs,pa=I({"src/table/td.ts"(){"use strict";X(),ge(),Ur(),G(),V(),ga(),Rs=class extends(zi=Zr,Bl=[Bs(!1)],zi){constructor(e,t,s,i=[]){var o;let l=/\||\0\d+!\x7F/u.exec(t!=null?t:""),r=l?t.slice(0,l.index):"";/\[\[|-\{/u.test(r)&&(l=null,r=""),super(/^(?:\n[^\S\n]*(?:[|!]|\|\+|\{\{\s*!\s*\}\}\+?)|(?:\||\{\{\s*!\s*\}\}){2}|!!|\{\{\s*!!\s*\}\})$/u,e,"td",r,s,i),se(ks,5,this),He(this,Wt),He(this,ye,""),l&&([ph(this,ye)._]=l);const n=new z(t==null?void 0:t.slice(((o=l==null?void 0:l.index)!=null?o:NaN)+de(this,ye).length),s,i);n.type="td-inner",n.setAttribute("stage",4),this.insertAt(n)}get type(){return"td"}get rowspan(){return this.getAttr("rowspan")}get colspan(){return this.getAttr("colspan")}get subtype(){return ur(this,Wt,Ut).call(this).subtype}afterBuild(){de(this,ye).includes("\0")&&ke(this,ye,this.buildFromStr(de(this,ye),0)),super.afterBuild()}toString(e){const{childNodes:[t,s,i]}=this;return t.toString(e)+s.toString(e)+de(this,ye)+i.toString(e)}text(){const{childNodes:[e,t,s]}=this;return e.text()+t.text()+de(this,ye)+s.text()}getGaps(e){return e===1?de(this,ye).length:0}lint(e=this.getAbsoluteIndex(),t){const s=super.lint(e,t),i=new ue(this,e+this.getRelativeIndex(this.length-1)),l="pipe-like",r=["td","double"].map(n=>C.lintConfig.getSeverity(l,n));for(const n of this.lastChild.childNodes)if(n.type==="text"){const{data:o}=n;if(o.includes("|")){const a=o.includes("||"),h=r[a?1:0];if(h){const u=Q(n,i,l,'additional "|" in a table cell',h);if(a){const d={caption:"|+",td:"|",th:"!"}[this.subtype];u.fix=je(u,"newline",o.replace(/\|\|/gu,`
|
|
14
|
+
${d}`))}else u.suggestions=[Br(u.startIndex,o)];s.push(u)}}}return s}isIndependent(){return this.firstChild.text().startsWith(`
|
|
15
|
+
`)}getAttr(e){const t=super.getAttr(e);return e==="rowspan"||e==="colspan"?parseInt(t)||1:t}escape(){super.escape(),this.childNodes[1].toString()&&(de(this,ye)||ke(this,ye,"{{!}}")),de(this,ye)==="|"&&ke(this,ye,"{{!}}")}print(){const{childNodes:[e,t,s]}=this;return`<span class="wpb-td">${e.print()}${t.print()}${de(this,ye)}${s.print()}</span>`}json(e,t=this.getAbsoluteIndex()){const s=super.json(void 0,t),{rowspan:i,colspan:l}=this;return Object.assign(s,{subtype:this.subtype},i!==1&&{rowspan:i},l!==1&&{colspan:l}),s}},ks=ne(zi),ye=new WeakMap,Wt=new WeakSet,Ut=function(){var e;const t=this.firstChild.text(),s=t.slice(-1);let i="td";if(s==="!"?i="th":s==="+"&&(i="caption"),this.isIndependent())return{subtype:i};const{previousSibling:l}=this;return{...ur(e=l,Wt,Ut).call(e)}},Ut=ie(ks,17,"#getSyntax",Bl,Wt,Ut),Lr(ks,Rs)}}),en,fa=I({"src/table/trBase.ts"(){"use strict";X(),G(),ga(),pa(),en=class extends Zr{lint(e=this.getAbsoluteIndex(),t){const s=super.lint(e,t),i=this.childNodes.find(({type:o})=>o==="table-inter");if(!i)return s;const l=ns(i),r="fostered-content",n=l&&C.lintConfig.getSeverity(r,l===2?void 0:"transclusion");if(n){const o=Q(i,{start:e},r,"content to be moved outside the table",n);o.startIndex++,o.startLine++,o.startCol=0,s.push(o)}return s}getRowCount(){return Number(this.childNodes.some(e=>e instanceof Rs&&e.isIndependent()&&!e.firstChild.text().endsWith("+")))}}}}),ql,Wl,Ul,Ml,Hi,$s,Fs,Wh=I({"src/table/index.ts"(){"use strict";X(),Re(),ge(),Ur(),G(),fa(),Ft(),ql=(e,t)=>new Array(e).fill(void 0).map((s,i)=>t(i)),Wl=({type:e})=>e==="tr"||e==="table-syntax",Ul=class extends Array{},Fs=class extends(Hi=en,Ml=[Bs(!1)],Hi){constructor(e,t,s,i){super(/^(?:\{\||\{\{\{\s*!\s*\}\}|\{\{\s*\(!\s*\}\})$/u,e,"table",t,s,i,{}),se($s,5,this)}get type(){return"table"}get closed(){return this.lastChild.is("table-syntax")}lint(e=this.getAbsoluteIndex(),t){const s=super.lint(e,t),i=new ue(this,e),l=["unclosed-table","table-layout"],r=l.map(n=>C.lintConfig.getSeverity(n));if(r[0]&&!this.closed&&s.push(Q(this.firstChild,i,l[0],C.msg("unclosed $1","table"),r[0])),r[1]){const n=this.getLayout(),{length:o}=n;if(o>1){let a=1,h=1/0,u=0;for(;u<o;u++){const d=n[u],f=d.length;if(f<a)break;f<h&&(h=f);const p=d.indexOf(d[f-1])+1;if(p>h)break;p>a&&(a=p)}if(u<o){const d=this.getNthRow(u),f=Q(d,i,l[1],"inconsistent table layout",r[1]);f.startIndex++,f.startLine++,f.startCol=0,s.push(f)}}}return s}close(e=`
|
|
16
|
+
|}`,t){const s=this.getAttribute("config"),i=this.getAttribute("accum");ve.run(()=>{const l=new Qe(t?e:void 0,"table-syntax",s,i);super.insertAt(l)})}getLayout(e){const t=this.getAllRows(),{length:s}=t,i=Ul.from(ql(s,()=>[]));for(let l=0;l<i.length;l++){const r=i[l];let n=0,o=0,a;for(const h of t[l].childNodes.slice(2))if(h.is("td")){if(h.isIndependent()&&(a=h.subtype!=="caption"),a){const u={row:l,column:n},{rowspan:d,colspan:f}=h;for(n++;r[o];)o++;for(let p=l;p<Math.min(l+d,s);p++)for(let x=o;x<o+f;x++)i[p][x]=u;o+=f}}else if(Wl(h))break}return i}getAllRows(){return[...super.getRowCount()?[this]:[],...this.childNodes.slice(1).filter(e=>e.is("tr")&&e.getRowCount()>0)]}getNthRow(e,t,s){const i=super.getRowCount();if(e===0&&i)return this;i&&e--;for(const l of this.childNodes.slice(2)){const{type:r}=l;if(r==="tr"&&l.getRowCount()&&(e--,e<0))return l}}json(e,t=this.getAbsoluteIndex()){const s=super.json(void 0,t);return s.closed=this.closed,s}},$s=ne(Hi),ie($s,1,"getLayout",Ml,Fs),Lr($s,Fs)}}),ma,Uh=I({"src/table/tr.ts"(){"use strict";fa(),ma=class extends en{get type(){return"tr"}constructor(e,t,s,i){super(/^\n[^\S\n]*(?:\|-+|\{\{\s*!\s*\}\}-+|\{\{\s*!-\s*\}\}-*)$/u,e,"tr",t,s,i)}}}}),tn,xa=I({"src/nowiki/listBase.ts"(){"use strict";ct(),tn=class extends Ee{get indent(){return this.innerText.split(":").length-1}json(e,t=this.getAbsoluteIndex()){const s=super.json(void 0,t),{indent:i}=this;return i&&(s.indent=i),s}}}}),sn,va=I({"src/nowiki/dd.ts"(){"use strict";xa(),sn=class extends tn{get type(){return"dd"}}}}),ba={};oe(ba,{parseTable:()=>wa});var zl,Di,wa,Mh=I({"parser/table.ts"(){"use strict";V(),Wh(),Uh(),pa(),va(),zl=e=>e.lastChild.constructor!==z,Di=(e,t)=>e.is("td")?t.pop():e,wa=({firstChild:{data:e},type:t,name:s},i,l)=>{const r=[],n=e.split(`
|
|
17
|
+
`);let o=t==="root"||t==="parameter-value"||t==="ext-inner"&&s==="poem"?"":`
|
|
18
|
+
${n.shift()}`,a;const h=(u,d)=>{if(!d){o+=u;return}const{lastChild:f}=d;if(zl(d)){const p=new z(u,i,l);p.type="table-inter",p.setAttribute("stage",3),d.insertAt(p)}else f.setText(f.toString()+u)};for(const u of n){a=r.pop();const[d]=/^(?:\s|\0\d+[cno]\x7F)*/u.exec(u),f=u.slice(d.length),p=/^(:*)((?:\s|\0\d+[cn]\x7F)*)(\{\||\{(?:\0\d+[cn]\x7F)*\0\d+!\x7F|\0\d+\{\x7F)(.*)$/u.exec(f);if(p){for(;a&&!a.is("td");)a=r.pop();const[,g,c,b,w]=p;g&&new sn(g,i,l),h(`
|
|
19
|
+
${d}${g&&`\0${l.length-1}d`}${c}\0${l.length}b`,a),r.push(...a?[a]:[],new Fs(b,w,i,l));continue}else if(!a){o+=`
|
|
20
|
+
${u}`;continue}const x=/^(?:(\|\}|\0\d+!\x7F\}|\0\d+\}\x7F)|(\|-+|\0\d+!\x7F-+|\0\d+-\x7F-*)(?!-)|(!|(?:\||\0\d+!\x7F)\+?))(.*)$/u.exec(f);if(!x){h(`
|
|
21
|
+
${u}`,a),r.push(a);continue}const[,A,S,y,$]=x;if(A){for(;!a.is("table");)a=r.pop();a.close(`
|
|
22
|
+
${d}${A}`,!0),h($,r[r.length-1])}else if(S){a=Di(a,r),a.is("tr")&&(a=r.pop());const g=new ma(`
|
|
23
|
+
${d}${S}`,$,i,l);r.push(a,g),a.insertAt(g)}else{a=Di(a,r);const g=y==="!"?/!!|(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu:/(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu;let c=g.exec($),b=0,w=`
|
|
24
|
+
${d}${y}`;const m=_=>{const k=new Rs(w,$.slice(b,c==null?void 0:c.index),i,l);return _.insertAt(k),k};for(;c;)m(a),{lastIndex:b}=g,[w]=c,c=g.exec($);r.push(a,m(a))}}return o.slice(1)}}}),ya,zh=I({"src/nowiki/hr.ts"(){"use strict";ct(),ya=class extends Ee{get type(){return"hr"}}}}),Hl,Gi,Dl,ts,Hh=I({"src/nowiki/doubleUnderscore.ts"(){"use strict";jt(),Ke(),ct(),Hl=[dt(),We("__")],ts=class extends(Dl=Ee){get type(){return"double-underscore"}constructor(e,t,s,i){var o,a;super(e,s,i);const l=e.toLowerCase(),{doubleUnderscore:[,,r,n]}=s;this.setAttribute("name",(a=t?(o=n==null?void 0:n[e])==null?void 0:o.toLowerCase():r==null?void 0:r[l])!=null?a:l)}toString(){return`__${this.innerText}__`}print(){return super.print({pre:"__",post:"__"})}},Gi=ne(Dl),ts=ie(Gi,0,"DoubleUnderscoreToken",Hl,ts),se(Gi,1,ts)}}),Sa={};oe(Sa,{parseHrAndDoubleUnderscore:()=>Aa});var Aa,Dh=I({"parser/hrAndDoubleUnderscore.ts"(){"use strict";zh(),Hh(),Uo(),Aa=({firstChild:{data:e},type:t,name:s},i,l)=>{var a,h,u;const{doubleUnderscore:[r,n,o]}=i;return(a=i.insensitiveDoubleUnderscore)!=null||(i.insensitiveDoubleUnderscore=new Set(r)),(h=i.sensitiveDoubleUnderscore)!=null||(i.sensitiveDoubleUnderscore=new Set(n)),(u=i.regexHrAndDoubleUnderscore)!=null||(i.regexHrAndDoubleUnderscore=new RegExp(`__(${[...r,...n].join("|")})__`,"giu")),t!=="root"&&(t!=="ext-inner"||s!=="poem")&&(e=`\0${e}`),e=e.replace(/^((?:\0\d+[cno]\x7F)*)(-{4,})/gmu,(d,f,p)=>(new ya(p,i,l),`${f}\0${l.length-1}r`)).replace(i.regexHrAndDoubleUnderscore,(d,f)=>{var S;const p=i.sensitiveDoubleUnderscore.has(f),x=f.toLowerCase(),A=i.insensitiveDoubleUnderscore.has(x);return p||A?(new ts(f,p,i,l),`\0${l.length-1}${A&&((S=o==null?void 0:o[x])!=null?S:x)==="toc"?"u":"n"}`):d}),i.excludes.includes("heading")||(e=e.replace(/^((?:\0\d+[cn]\x7F)*)(={1,6})(.+)\2((?:\s|\0\d+[cn]\x7F)*)$/gmu,(d,f,p,x,A)=>{const S=`${f}\0${l.length}h`;return new wt(p.length,[x,A],i,l),S})),t==="root"||t==="ext-inner"&&s==="poem"?e:e.slice(1)}}}),ka,Gh=I({"src/nowiki/quote.ts"(){"use strict";var e,t;X(),ge(),G(),ct(),ka=(t=class extends Ee{constructor(i,l,r,n){super(i,r,n);B(this,e);E(this,e,l)}get type(){return"quote"}get bold(){return this.innerText.length!==2}get italic(){return this.innerText.length!==3}get closing(){return{...this.bold?{bold:v(this,e).bold}:void 0,...this.italic?{italic:v(this,e).italic}:void 0}}text(){const{parentNode:i,innerText:l}=this;return i!=null&&i.is("image-parameter")&&i.name!=="caption"?"":l}lint(i=this.getAbsoluteIndex()){var p;const{previousSibling:l,bold:r,closing:n}=this,o=(l==null?void 0:l.type)==="text"?l.data:void 0,a=[],h=new ue(this,i),u=["lonely-apos","bold-header"],d=[void 0,"word"].map(x=>C.lintConfig.getSeverity(u[0],x)),f=C.lintConfig.getSeverity(u[1]);if(o!=null&&o.endsWith("'")){const x=d[(n.bold||n.italic)&&/[a-z\d]'$/iu.test(o)?1:0];if(x){const A=te(this,h,u[0],C.msg('lonely "$1"',"'"),x),{startLine:S,startCol:y}=A,[,{length:$}]=/(?:^|[^'])('+)$/u.exec(o),g=i-$,c={...A,startIndex:g,endIndex:i,endLine:S,startCol:y-$,endCol:y};c.suggestions=[It(g,"'",$),Z(c)],a.push(c)}}if(f&&r&&((p=this.closest("heading-title,ext"))==null?void 0:p.type)==="heading-title"){const x=te(this,h,u[1],"bold in section header",f);x.suggestions=[Z(x)],a.push(x)}return a}json(i,l=this.getAbsoluteIndex()){const r=super.json(void 0,l);return Object.assign(r,{bold:this.bold,italic:this.italic}),r}},e=new WeakMap,t)}}),$a={};oe($a,{parseQuotes:()=>rn});var rn,_a=I({"parser/quotes.ts"(){"use strict";Gh(),rn=(e,t,s,i)=>{var p;const l=e.split(/('{2,})/u),{length:r}=l;if(r===1)return e;let n=0,o=0,a,h,u;for(let x=1;x<r;x+=2){const A=l[x].length;switch(A){case 2:o++;break;case 4:l[x-1]+="'",l[x]="'''";case 3:if(n++,a!==void 0)break;l[x-1].endsWith(" ")?h===void 0&&u===void 0&&(u=x):l[x-1].slice(-2,-1)===" "?a=x:h!=null||(h=x);break;default:l[x-1]+="'".repeat(A-5),l[x]="'''''",o++,n++}}if(o%2===1&&n%2===1){const x=(p=a!=null?a:h)!=null?p:u;x!==void 0&&(l[x]="''",l[x-1]+="'")}let d=!0,f=!0;for(let x=1;x<r;x+=2){const A=l[x].length,S=A!==2,y=A!==3;S&&(d=!d),y&&(f=!f),new ka(l[x],{bold:S&&d,italic:y&&f},t,s),l[x]=`\0${s.length-1}q`}return l.join("")}}}),Ta={};oe(Ta,{parseExternalLinks:()=>nn});var nn,Ca=I({"parser/externalLinks.ts"(){"use strict";ce(),sa(),Yr(),nn=(e,t,s,i)=>{var l;return(l=t.regexExternalLinks)!=null||(t.regexExternalLinks=new RegExp(String.raw`\[((?:\0\d+[cn]\x7F)*(?:\0\d+f\x7F|(?:(?:${t.protocol}|//)${$t}|\0\d+m\x7F)${_t}(?=[[\]<>"\t${Ge}]|\0\d)))([${Ge}]*(?![${Ge}]))([^\]\x01-\x08\x0A-\x1F\uFFFD]*)\]`,"giu")),e.replace(t.regexExternalLinks,(r,n,o,a)=>{const{length:h}=s,u=/&[lg]t;/u.exec(n);return u&&(o="",a=n.slice(u.index)+o+a,n=n.slice(0,u.index)),i?(new gs(n,"ext-link-url",t,s),`[\0${h}f${o}${a}]`):(new St(n,o,a,t,s),`\0${h}w`)})}}}),Ia,Vh=I({"src/link/category.ts"(){"use strict";ce(),Ws(),Ia=class extends De{get type(){return"category"}get sortkey(){const{childNodes:[,e]}=this;return e&&as(e.text())}json(e,t=this.getAbsoluteIndex()){const s=super.json(void 0,t),{sortkey:i}=this;return i&&(s.sortkey=i),s}}}}),Na={};oe(Na,{parseLinks:()=>Ar});var Gl,Ar,Qh=I({"parser/links.ts"(){"use strict";G(),_a(),Ca(),ta(),Ko(),Vh(),Gl=/^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(\||\0\d+!\x7F)([\s\S]*)$/u,Ar=(e,t,s,i)=>{var o;(o=t.regexLinks)!=null||(t.regexLinks=new RegExp(String.raw`^\s*(?:${t.protocol}|//)`,"iu"));const l=t.inExt?/^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)([\s\S]*?[^\]]))?\]\]([\s\S]*)$/u:/^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)([\s\S]*?[^\]])?)?\]\]([\s\S]*)$/u,r=e.split("[[");let n=r.shift();for(let a=0;a<r.length;a++){let h=!1,u,d,f,p;const x=r[a],A=l.exec(x);if(A)[,u,d,f,p]=A,p.startsWith("]")&&(f!=null&&f.includes("["))&&(f+="]",p=p.slice(1));else{const c=Gl.exec(x);c&&(h=!0,[,u,d,f]=c)}if(u===void 0||t.regexLinks.test(u)||/\0\d+[exhbru]\x7F/u.test(u)){n+=`[[${x}`;continue}const S=u.trim().startsWith(":");if(S&&h){n+=`[[${x}`;continue}const{ns:y,valid:$}=C.normalizeTitle(u,0,!1,t,{halfParsed:!0,temporary:!0,decode:!0,selfLink:!0});if($){if(h){if(y!==6){n+=`[[${x}`;continue}let c=!1;for(a++;a<r.length;a++){const b=r[a],w=b.split("]]");if(w.length>2){c=!0,f+=`[[${w[0]}]]${w[1]}`,p=w.slice(2).join("]]");break}else if(w.length===2)f+=`[[${w[0]}]]${w[1]}`;else{f+=`[[${b}`;break}}if(f=Ar(f,t,s,i),!c){n+=`[[${u}${d}${f}`;continue}}}else{n+=`[[${x}`;continue}f&&(f=rn(f,t,s,i));let g=Kr;S||(y===6?(f&&(f=nn(f,t,s,!0)),g=Xr):y===14&&(g=Ia)),f===void 0&&d&&(f=""),n+=`\0${s.length}l${p}`,new g(u,f,t,s,d)}return n}}}),La={};oe(La,{parseMagicLinks:()=>Fa});var Vi,Qi,Ji,Xi,Fa,Jh=I({"parser/magicLinks.ts"(){"use strict";ce(),Yr(),Vi=String.raw`[${Ge}\t]| |�*160;|�*a0;`,Qi=`(?:${Vi})+`,Ji=`(?:${Vi}|-)`,Xi=String.raw`(?:RFC|PMID)${Qi}\d+\b|ISBN${Qi}(?:97[89]${Ji}?)?(?:\d${Ji}?){9}[\dx]\b`,Fa=(e,t,s)=>{if(!t.regexMagicLinks)try{t.regexMagicLinks=new RegExp(String.raw`(^|[^\p{L}\p{N}_])(?:(?:${t.protocol})(${$t}${_t})|${Xi})`,"giu")}catch{t.regexMagicLinks=new RegExp(String.raw`(^|\W)(?:(?:${t.protocol})(${$t}${_t})|${Xi})`,"giu")}return e.replace(t.regexMagicLinks,(i,l,r)=>{let n=l?i.slice(l.length):i;if(r){let o="";const a=/&(?:lt|gt|nbsp|#x0*(?:3[ce]|a0)|#0*(?:6[02]|160));/iu.exec(n);a&&(o=n.slice(a.index),n=n.slice(0,a.index));const h=n.includes("(")?/[^,;\\.:!?][,;\\.:!?]+$/u:/[^,;\\.:!?)][,;\\.:!?)]+$/u,u=h.exec(n);if(u){let d=1;u[0][1]===";"&&/&(?:[a-z]+|#x[\da-f]+|#\d+)$/iu.test(n.slice(0,u.index))&&(d=2),o=n.slice(u.index+d)+o,n=n.slice(0,u.index+d)}return o.length>=r.length?i:(new gs(n,void 0,t,s),`${l}\0${s.length-1}w${o}`)}else if(!/^(?:RFC|PMID|ISBN)/u.test(n))return i;return new gs(n,"magic-link",t,s),`${l}\0${s.length-1}i`})}}}),ja,Xh=I({"util/html.ts"(){"use strict";ja=(e,t)=>e.startsWith(t)?t.length:[...t].findIndex((s,i)=>s!==e[i])}}),Ea,Kh=I({"src/nowiki/list.ts"(){"use strict";xa(),Ea=class extends tn{get type(){return"list"}}}}),Ra={};oe(Ra,{parseList:()=>Pa});var Pa,Yh=I({"parser/list.ts"(){"use strict";Xh(),Kh(),va(),Pa=(e,t,s,i)=>{const l=/^((?:\0\d+[cno]\x7F)*)([;:*#]+)(\s*)/u.exec(e);if(!l)return t.lastPrefix="",e;const[r,n,o,a]=l,h=o.replace(/;/gu,":"),u=ja(h,t.lastPrefix),d=((u>1?o.slice(u-1):o)+a).split(/(?=;)/u),f=d[0].startsWith(";");let p=d.length-(f?0:1);if(u>1){const T=o.slice(0,u-1);if(f){const O=T.split(/(?=;)/u);d.unshift(...O),p+=T.includes(";")?O.length:0}else d[0]=T+d[0]}t.lastPrefix=h;let x=n+d.map((T,O)=>`\0${i.length+O}d`).join("")+e.slice(r.length);for(const T of d)new Ea(T,s,i);if(!p)return x;const{html:[A,,S]}=s,y=/:+|-\{|\0\d+[xq]\x7F/gu;let $=y,g=$.exec(x),c=0,b=!1,w=!1,m=0;const _=(T,O)=>(new sn(T,s,i),`${x.slice(0,O)}\0${i.length-1}d${x.slice(O+T.length)}`),k=T=>{T?c&&c--:c++};for(;g&&p;){const{0:T,index:O}=g;if(T==="-{"){if(!m){const{lastIndex:L}=$;$=/-\{|\}-/gu,$.lastIndex=L}m++}else if(T==="}-"){if(m--,!m){const{lastIndex:L}=$;$=y,$.lastIndex=L}}else if(T.endsWith("x")){const{name:L,closing:j,selfClosing:W}=i[Number(T.slice(1,-2))];(A.includes(L)||!W&&!S.includes(L))&&k(j)}else if(T.endsWith("q")){const{bold:L,italic:j}=i[Number(T.slice(1,-2))];L&&(k(b),b=!b),j&&(k(w),w=!w)}else if(c===0){if(T.length>=p)return _(T.slice(0,p),O);p-=T.length,$.lastIndex=O+4+String(i.length).length,x=_(T,O)}g=$.exec(x)}return x}}}),_s,Vl,Ki,Ql,ss,Zh=I({"src/converterFlags.ts"(){"use strict";var e,t;X(),ge(),qs(),G(),V(),Xe(),_s=new Set(["A","T","R","D","-","H","N"]),Vl=[fs()],ss=(t=class extends(Ql=z){constructor(i,l,r=[]){super(void 0,l,r,{});B(this,e);this.safeAppend(i.map(n=>new Se(n,"converter-flag",l,r)))}get type(){return"converter-flags"}afterBuild(){E(this,e,this.childNodes.map(i=>i.text().trim())),super.afterBuild()}toString(i){return super.toString(i,";")}text(){return super.text(";")}getUnknownFlags(){return new Set(v(this,e).filter(i=>/\{{3}[^{}]+\}{3}/u.test(i)))}getVariantFlags(){const i=new Set(this.getAttribute("config").variants);return new Set(v(this,e).filter(l=>i.has(l)))}isInvalidFlag(i,l,r,n){return typeof i=="object"&&(i=i.text().trim(),l=this.getVariantFlags(),r=this.getUnknownFlags(),n=new Set(v(this,e).filter(o=>_s.has(o)))),!!i&&!l.has(i)&&!r.has(i)&&(l.size>0||!n.has(i))}lint(i=this.getAbsoluteIndex(),l){const r=this.getVariantFlags(),n=this.getUnknownFlags(),o=new Set(v(this,e).filter(p=>_s.has(p))),a=v(this,e).filter(p=>!p).length,h=v(this,e).length-n.size-a,u=super.lint(i,l);if(r.size===h||o.size===h)return u;const d="no-ignored",f=C.lintConfig.getSeverity(d,"conversionFlag");if(f){const p=new ue(this,i);for(let x=0;x<this.length;x++){const A=this.childNodes[x],S=A.text().trim();if(this.isInvalidFlag(S,r,n,o)){const y=Q(A,p,d,"invalid conversion flag",f);r.size===0&&_s.has(S.toUpperCase())?y.fix=Or(y,S):y.suggestions=[Z(y,x&&-1)],u.push(y)}}}return u}print(){return super.print({sep:";"})}},e=new WeakMap,t),Ki=ne(Ql),ss=ie(Ki,0,"ConverterFlagsToken",Vl,ss),se(Ki,1,ss)}}),js,eu=I({"src/converterRule.ts"(){"use strict";G(),V(),Xe(),js=class extends z{get type(){return"converter-rule"}get variant(){var e,t;return(t=(e=this.childNodes[this.length-2])==null?void 0:e.text().trim().toLowerCase())!=null?t:""}constructor(e,t=!0,s=C.getConfig(),i=[]){super(void 0,s,i);const l=e.indexOf(":"),r=e.slice(0,l).indexOf("=>"),n=r===-1?e.slice(0,l):e.slice(r+2,l);t&&s.variants.includes(n.trim().toLowerCase())?(super.insertAt(new Se(n,"converter-rule-variant",s,i)),super.insertAt(new Se(e.slice(l+1),"converter-rule-to",s,i)),r!==-1&&super.insertAt(new Se(e.slice(0,r),"converter-rule-from",s,i),0)):super.insertAt(new Se(e,"converter-rule-to",s,i))}toString(e){const{childNodes:t,firstChild:s,lastChild:i}=this;return t.length===3?`${s.toString(e)}=>${t[1].toString(e)}:${i.toString(e)}`:super.toString(e,":")}text(){const{childNodes:e,firstChild:t,lastChild:s}=this;return e.length===3?`${t.text()}=>${e[1].text()}:${s.text()}`:super.text(":")}getGaps(e){return e===0&&this.length===3?2:1}print(){const{childNodes:e}=this;if(e.length===3){const[t,s,i]=e;return`<span class="wpb-converter-rule">${t.print()}=>${s.print()}:${i.print()}</span>`}return super.print({sep:":"})}json(e,t=this.getAbsoluteIndex()){const s=super.json(void 0,t);return s.variant=this.variant,s}}}}),Jl,Yi,Xl,is,tu=I({"src/converter.ts"(){"use strict";ce(),Ke(),qe(),V(),Zh(),eu(),Jl=[Oe,We("-{")],is=class extends(Xl=z){get type(){return"converter"}constructor(e,t,s,i=[]){super(void 0,s,i),this.insertAt(new ss(e,s,i));const[l]=t,r=l.includes(":"),n=new js(l,r,s,i);r&&n.length===1||!r&&t.length===2&&!Le(t[1]).trim()?this.insertAt(new js(t.join(";"),!1,s,i)):this.append(n,...t.slice(1).map(o=>new js(o,!0,s,i)))}toString(e){const{childNodes:[t,...s]}=this;return`-{${t.toString(e)}${t.length>0?"|":""}${s.map(i=>i.toString(e)).join(";")}}-`}text(){const{childNodes:[e,...t]}=this;return`-{${e.text()}|${ht(t,";")}}-`}getGaps(e){return e||this.firstChild.length>0?1:0}print(){const{childNodes:[e,...t]}=this;return`<span class="wpb-converter">-{${e.print()}${e.length>0?"|":""}${Ct(t,{sep:";"})}}-</span>`}},Yi=ne(Xl),is=ie(Yi,0,"ConverterToken",Jl,is),se(Yi,1,is)}}),Oa={};oe(Oa,{parseConverter:()=>Ba});var Ba,su=I({"parser/converter.ts"(){"use strict";tu(),Ba=(e,t,s)=>{var a;(a=t.regexConverter)!=null||(t.regexConverter=new RegExp(String.raw`;(?=(?:[^;]*?=>)?\s*(?:${t.variants.join("|")})\s*:|(?:\s|\0\d+[cn]\x7F)*$)`,"iu"));const i=/-\{/gu,l=/-\{|\}-/gu,r=[];let n=i,o=n.exec(e);for(;o;){const{0:h,index:u}=o;if(h==="}-"){const d=r.pop(),{length:f}=s,p=e.slice(d.index+2,u),x=p.indexOf("|"),[A,S]=x===-1?[[],p]:[p.slice(0,x).split(";"),p.slice(x+1)],y=S.replace(/(&[#a-z\d]+);/giu,"$1"),$=y.split(t.regexConverter).map(g=>g.replace(/\x01/gu,";"));new is(A,$,t,s),e=`${e.slice(0,d.index)}\0${f}v${e.slice(u+2)}`,r.length===0&&(n=i),n.lastIndex=d.index+3+String(f).length}else r.push(o),n=l,n.lastIndex=u+2;o=n.exec(e)}return e}}}),ls={};oe(ls,{Token:()=>z});var Kl,z,V=I({"src/index.ts"(){"use strict";var e,t,s,i,l,r,n,o,qa,Wa,Ua,Ma,za,Ha,Da,Ga,Va,Qa,Ja,Xa,c;ce(),ut(),X(),Re(),G(),vh(),wh(),Kl=["category","html-attr#id,ext-attr#id,table-attr#id"],z=(c=class extends Dt{constructor(m,_=C.getConfig(),k=[],T){super();B(this,o);B(this,e,"plain");B(this,t,0);B(this,s);B(this,i);B(this,l);B(this,r,!1);B(this,n);typeof m=="string"&&this.insertAt(m),E(this,s,_),E(this,i,k),k.push(this)}get type(){return v(this,e)}set type(m){E(this,e,m)}parseOnce(m=v(this,t),_=!1,k){if(m<v(this,t)||this.length===0||!this.isPlain())return this;if(v(this,t)>=$e)return this;switch(m){case 0:if(this.type==="root"){v(this,i).pop();const T=P(this,o,qa).call(this);_&&(_=!T)}E(this,l,_),P(this,o,Wa).call(this,_);break;case 1:P(this,o,Ua).call(this);break;case 2:P(this,o,Ma).call(this);break;case 3:P(this,o,za).call(this);break;case 4:P(this,o,Ha).call(this);break;case 5:P(this,o,Da).call(this,k);break;case 6:P(this,o,Ga).call(this,k);break;case 7:P(this,o,Va).call(this);break;case 8:P(this,o,Qa).call(this);break;case 9:P(this,o,Ja).call(this);break;case 10:P(this,o,Xa).call(this)}if(this.type==="root")for(const T of v(this,i))T==null||T.parseOnce(m,_,k);return an(this,t)._++,this}buildFromStr(m,_){const k=m.split(/[\0\x7F]/u).map((T,O)=>{if(O%2===0)return new pr(T);if(isNaN(T.slice(-1)))return v(this,i)[Number(T.slice(0,-1))];throw new Error(`Failed to build! Unrecognized token: ${T}`)});return _===0?k.map(String).join(""):_===1?ht(k):k}build(){E(this,t,$e);const{length:m,firstChild:_}=this,k=_==null?void 0:_.toString();if(m===1&&_.type==="text"&&k.includes("\0")&&(ps(this,0,1,this.buildFromStr(k)),this.normalize(),this.type==="root"))for(const T of v(this,i))T==null||T.build()}afterBuild(){if(this.type==="root")for(const m of v(this,i))m==null||m.afterBuild();E(this,r,!0)}parse(m=$e,_,k){for(m=Math.min(m,$e);v(this,t)<m;)this.parseOnce(v(this,t),_,k);return m&&(this.build(),this.afterBuild()),this}isPlain(){return this.constructor===c}getAttribute(m){var _;switch(m){case"config":return v(this,s);case"include":return(_=v(this,l))!=null?_:!!v(this.getRootNode(),l);case"accum":return v(this,i);case"built":return v(this,r);case"stage":return v(this,t);case"invalid":return this.type==="table-inter"&&ns(this)===2;default:return super.getAttribute(m)}}setAttribute(m,_){switch(m){case"stage":v(this,t)===0&&this.type==="root"&&v(this,i).shift(),E(this,t,_);break;default:super.setAttribute(m,_)}}insertAt(m,_=this.length){const k=typeof m=="string"?new pr(m):m;super.insertAt(k,_);const{type:T}=k;return T==="root"&&(k.type="plain"),k}normalizeTitle(m,_=0,k){return C.normalizeTitle(m,_,v(this,l),v(this,s),k)}inTableAttrs(){var m,_;return((m=this.closest("table-attrs,ext"))==null?void 0:m.type)==="table-attrs"&&((_=this.closest("table-attrs,arg,magic-word,template"))!=null&&_.is("table-attrs")?2:1)}inHtmlAttrs(){var m;return(m=this.closest("html-attrs,ext"))!=null&&m.is("html-attrs")?2:this.inTableAttrs()}lint(m=this.getAbsoluteIndex(),_){var T;let k=super.lint(m,_);if(this.type==="root"){const O=new Map,L="no-duplicate",j=["category","id"].map(F=>C.lintConfig.getSeverity(L,F)),W=Kl.filter((F,U)=>j[U]).join();if(W){for(const F of this.querySelectorAll(W)){let U;if(F.is("category"))U=F.name;else{const H=F.getValue();H&&H!==!0&&(U=`#${H}`)}if(U){const H=O.get(U);H?H.add(F):O.set(U,new Set([F]))}}for(const[F,U]of O)if(U.size>1&&!F.startsWith("#mw-customcollapsible-")){const H=!F.startsWith("#"),D=`duplicated ${H?"category":"id"}`,ee=j[H?0:1];k.push(...[...U].map(re=>{const he=te(re,{start:re.getAbsoluteIndex()},L,D,ee);return H&&(he.suggestions=[Z(he)]),he}))}}const N=/<!--\s*lint-(disable(?:(?:-next)?-line)?|enable)(\s[\sa-z,-]*)?-->/gu,R=this.toString(),J=[];let q=N.exec(R);for(;q;){const{1:F,index:U}=q,H=(T=q[2])==null?void 0:T.trim();J.push({line:this.posFromIndex(U).top+(F==="disable-line"?0:1),from:F==="disable"?N.lastIndex:void 0,to:F==="enable"?N.lastIndex:void 0,rules:H?new Set(H.split(",").map(D=>D.trim())):void 0}),q=N.exec(R)}if(k=k.filter(({rule:F,startLine:U,startIndex:H})=>{const D={pos:0};for(const{line:ee,from:re,to:he,rules:Te}of J){if(ee>U+1)break;if(Te&&!Te.has(F))continue;if(ee===U&&re===void 0&&he===void 0)return!1;re<=H&&re>D.pos?(D.pos=re,D.type="from"):he<=H&&he>D.pos&&(D.pos=he,D.type="to")}return D.type!=="from"}),k.some(({fix:F})=>F)){const F=k.map(({fix:D})=>D).filter(Boolean).sort(({range:[D,ee]},{range:[re,he]})=>ee===he?re-D:he-ee);let U=1/0,H=R;for(const{range:[D,ee],text:re}of F)ee<=U&&(H=H.slice(0,D)+re+H.slice(ee),U=D);Object.assign(k,{output:H})}}return k}toString(m,_){return m?super.toString(!0,_):at(v(this,n),()=>super.toString(!1,_),k=>{const T=this.getRootNode();T.type==="root"&&v(T,r)&&E(this,n,k)})}},e=new WeakMap,t=new WeakMap,s=new WeakMap,i=new WeakMap,l=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakSet,qa=function(){const{parseRedirect:m}=(Ah(),Y(Lo)),_=this.firstChild.toString(),k=m(_,v(this,s),v(this,i));return k&&this.setText(k),!!k},Wa=function(m){const{parseCommentAndExt:_}=(Ds(),Y(ua));this.setText(_(this.firstChild.toString(),v(this,s),v(this,i),m))},Ua=function(){const{parseBraces:m}=(Jr(),Y(zo)),_=this.type==="root"?this.firstChild.toString():`\0${this.firstChild.toString()}`,k=m(_,v(this,s),v(this,i));this.setText(this.type==="root"?k:k.slice(1))},Ma=function(){if(v(this,s).excludes.includes("html"))return;const{parseHtml:m}=(qh(),Y(da));this.setText(m(this.firstChild.toString(),v(this,s),v(this,i)))},za=function(){if(v(this,s).excludes.includes("table"))return;const{parseTable:m}=(Mh(),Y(ba));this.setText(m(this,v(this,s),v(this,i)))},Ha=function(){if(v(this,s).excludes.includes("hr"))return;const{parseHrAndDoubleUnderscore:m}=(Dh(),Y(Sa));this.setText(m(this,v(this,s),v(this,i)))},Da=function(m){const{parseLinks:_}=(Qh(),Y(Na));this.setText(_(this.firstChild.toString(),v(this,s),v(this,i),m))},Ga=function(m){if(v(this,s).excludes.includes("quote"))return;const{parseQuotes:_}=(_a(),Y($a)),k=this.firstChild.toString().split(`
|
|
25
|
+
`);for(let T=0;T<k.length;T++)k[T]=_(k[T],v(this,s),v(this,i),m);this.setText(k.join(`
|
|
26
|
+
`))},Va=function(){if(v(this,s).excludes.includes("extLink"))return;const{parseExternalLinks:m}=(Ca(),Y(Ta));this.setText(m(this.firstChild.toString(),v(this,s),v(this,i)))},Qa=function(){if(v(this,s).excludes.includes("magicLink"))return;const{parseMagicLinks:m}=(Jh(),Y(La));this.setText(m(this.firstChild.toString(),v(this,s),v(this,i)))},Ja=function(){if(v(this,s).excludes.includes("list"))return;const{parseList:m}=(Yh(),Y(Ra)),{firstChild:_,type:k,name:T}=this,O=_.toString().split(`
|
|
27
|
+
`),L={lastPrefix:""};let j=k==="root"||k==="ext-inner"&&T==="poem"?0:1;for(;j<O.length;j++)O[j]=m(O[j],L,v(this,s),v(this,i));this.setText(O.join(`
|
|
28
|
+
`))},Xa=function(){if(v(this,s).variants.length>0){const{parseConverter:m}=(su(),Y(Oa));this.setText(m(this.firstChild.toString(),v(this,s),v(this,i)))}},c)}}),ve,Gs,ps,Re=I({"util/debug.ts"(){"use strict";ve={running:!1,run(e){const{running:t}=this;this.running=!0;try{const{Token:s}=(V(),Y(ls)),i=e();return i instanceof s&&!i.getAttribute("built")&&i.afterBuild(),this.running=t,i}catch(s){throw this.running=t,s}},rev:0},Gs=e=>t=>t.type===e,ps=(e,t,s,i=[])=>{var n,o;let l=e.getChildNodes(),r;l.length===s?(r=l,l=i):r=l.splice(t,s,...i);for(let a=0;a<i.length;a++){const h=i[a];h.setAttribute("parentNode",e),h.setAttribute("nextSibling",l[t+a+1]),h.setAttribute("previousSibling",l[t+a-1])}return(n=l[t-1])==null||n.setAttribute("nextSibling",l[t]),(o=l[t+i.length])==null||o.setAttribute("previousSibling",l[t+i.length-1]),l===i&&e.setAttribute("childNodes",l),r}}}),Yl,Mt,Zi,er,Zl,tr,eo,kr,iu=I({"lib/lintConfig.ts"(){"use strict";jr(),Yl=new Set([0,1,2]),Mt=new Map([[0,!1],[1,"warning"],[2,"error"]]),Zi={"bold-header":[1,{}],"format-leakage":[1,{}],"fostered-content":[1,{}],h1:[1,{}],"illegal-attr":[2,{}],"insecure-style":2,"invalid-gallery":[2,{parameter:1}],"invalid-imagemap":[2,{}],"invalid-invoke":[2,{}],"invalid-isbn":2,"lonely-apos":[1,{}],"lonely-bracket":[1,{extLink:2}],"lonely-http":[1,{}],"nested-link":[2,{}],"no-arg":1,"no-duplicate":[2,{category:1,id:1,unknownImageParameter:1}],"no-ignored":[2,{fragment:1,galleryComment:1,galleryNoImage:1,include:1,nonWordAttributes:1,redirect:1}],"obsolete-attr":1,"obsolete-tag":1,"parsing-order":[2,{templateInTable:1}],"pipe-like":[1,{double:2}],"table-layout":1,"tag-like":[2,{disallowed:1,invalid:1}],"unbalanced-header":2,"unclosed-comment":[1,{}],"unclosed-quote":1,"unclosed-table":2,unescaped:2,"unknown-page":1,"unmatched-tag":[1,{}],"unterminated-url":[1,{}],"url-encoding":[1,{}],"var-anchor":[1,{}],"void-ext":[2,{}]},Object.freeze(Zi),er=e=>typeof e=="number"&&Yl.has(e),Zl=e=>er(e)||Array.isArray(e)&&e.length===2&&er(e[0])&&e[1]&&typeof e[1]=="object",tr=(e,t,s)=>{if(Ps.includes(t)){if(Zl(s))return e[t]=s,!0}else throw new RangeError(`Unknown lint rule: ${t}`);throw new RangeError(`Invalid lint config for ${t}: ${JSON.stringify(s)}`)},eo=class{constructor(e){if(Object.assign(this,JSON.parse(JSON.stringify(Zi))),!!e)for(const[t,s]of Object.entries(e))tr(this,t,s)}getSeverity(e,t){var i;const s=this[e];return typeof s=="number"?Mt.get(s):t&&(i=Mt.get(s[1][t]))!=null?i:Mt.get(s[0])}},kr=e=>new Proxy(new eo(e),{set:tr})}}),Ka={};oe(Ka,{Title:()=>Ya});var Ya,ru=I({"lib/title.ts"(){"use strict";var e,t,s,i,l,r;Je(),ce(),Ya=(r=class{constructor(n,o,a,{temporary:h,decode:u,selfLink:d}={}){B(this,e);B(this,t);B(this,s);B(this,i);B(this,l);Ce(this,"valid");Ce(this,"encoded",!1);const f=n.trim().startsWith("../");if(u&&n.includes("%"))try{const x=/%(?!21|3[ce]|5[bd]|7[b-d])[\da-f]{2}/iu.test(n);n=us(n),this.encoded=x}catch{}if(n=as(n).replace(/[_ ]+/gu," ").trim(),f)E(this,i,0);else{let x=o;n.startsWith(":")&&(x=0,n=n.slice(1).trim());const A=n.split(":");if(A.length>1){const S=Tt(A[0]),y=Object.prototype.hasOwnProperty.call(a.nsid,S)&&a.nsid[S];y&&(x=y,n=A.slice(1).join(":").trim())}E(this,i,x)}const p=n.indexOf("#");if(p!==-1){let x=n.slice(p).trim().slice(1);if(x.includes("%"))try{x=us(x)}catch{}E(this,l,x.replace(/ /gu,"_")),n=n.slice(0,p).trim()}this.valid=!!(n||d&&this.ns===0&&v(this,l)!==void 0)&&as(n)===n&&!/^:|\0\d+[eh!+-]\x7F|[<>[\]{}|\n]|%[\da-f]{2}|(?:^|\/)\.{1,2}(?:$|\/)/iu.test(f?/^(?:\.\.\/)+(.*)/u.exec(n)[1]:n),this.main=n,E(this,t,a.namespaces),E(this,s,a.articlePath||"/wiki/$1"),v(this,s).includes("$1")||E(this,s,v(this,s)+`${v(this,s).endsWith("/")?"":"/"}$1`),h||Object.defineProperties(this,{encoded:{enumerable:!1,writable:!1}})}get ns(){return v(this,i)}get fragment(){return v(this,l)}get main(){return v(this,e)}set main(n){n=n.replace(/_/gu," ").trim(),E(this,e,n&&n[0].toUpperCase()+n.slice(1))}get prefix(){const n=v(this,t)[this.ns];return n+(n&&":")}get title(){return this.getRedirection()[1]}get extension(){const{main:n}=this,o=n.lastIndexOf(".");return o===-1?void 0:n.slice(o+1).toLowerCase()}getRedirection(){return[!1,(this.prefix+this.main).replace(/ /gu,"_")]}setFragment(n){E(this,l,n)}getUrl(n){{typeof n=="string"&&(E(this,s,n),v(this,s).includes("$1")||E(this,s,v(this,s)+`${v(this,s).endsWith("/")?"":"/"}$1`));const{title:o,fragment:a}=this;return o?v(this,s).replace("$1",encodeURIComponent(o)+(a?`#${encodeURIComponent(a)}`:"")):a===void 0?"":`#${encodeURIComponent(a)}`}throw new Error("Title.getUrl method is only available in the LSP version!")}},e=new WeakMap,t=new WeakMap,s=new WeakMap,i=new WeakMap,l=new WeakMap,r)}}),Za={};oe(Za,{LanguageService:()=>eh,isAttr:()=>Es,tasks:()=>$r});var $r,to,so,io,ro,sr,no,lo,oo,ao,Es,ho,ir,ft,rr,Me,xe,nr,lr,mt,xt,it,zt,or,uo,eh,nu=I({"lib/lsp.ts"(){"use strict";var e,t,s,i,l,r,n,o,a,h,rs,Ie,_r,Tr,Cr,th,Ir,vt,$;Je(),jr(),Po(),X(),ce(),G(),$r=new WeakMap,to=new Set(["ref"]),so=new Set(["ref","references"]),io=new Set(["name","follow"]),ro=new Set(["group"]),sr=new Set(["arg-name","template-name","link-target","parameter-key"]),no=new Set(["ext","html","attr-key","image-parameter","heading-title","heading","magic-word-name",...sr]),lo=new Set(["text","comment","noinclude","include"]),oo=["ext","html","table"].map(g=>`${g}-attr#style`).join(),ao=ot(g=>new RegExp(`^(?:${g}|//)`,"iu")),Es=({type:g,parentNode:c,length:b,firstChild:w},m)=>g==="attr-value"&&b===1&&w.type==="text"&&(!m||c.name==="style"),ho=g=>g.is("html-attr")||g.is("table-attr"),ir=g=>g.childNodes.every(({type:c})=>lo.has(c)),ft=(g,c)=>{const{top:b,left:w}=g.posFromIndex(c);return{line:b,character:w}},rr=(g,c,b)=>({start:ft(g,c),end:ft(g,b)}),Me=g=>{const{top:c,left:b,height:w,width:m}=g.getBoundingClientRect();return{start:{line:c,character:b},end:ds(c,b,w,m)}},xe=(g,c,b,{line:w,character:m},_,k)=>[...new Set(g)].map(T=>{var L;const O=(L=k==null?void 0:k(T))==null?void 0:L.description;return{label:T,kind:c,textEdit:{range:{start:{line:w,character:m-b.length},end:{line:w,character:m}},newText:T+(_!=null?_:"")},...O&&{documentation:{kind:"markdown",value:O}}}}),nr=(g,c,{line:b,character:w})=>{const m=g.indexFromPos(b,w);return g.caretPositionFromIndex(m+Number(/\w/u.test(c.charAt(m))))},lr=(g,c,b)=>{const{type:w,parentNode:m={}}=g,{name:_,tag:k}=m;return w==="attr-value"&&c.has(k)&&b.has(_)?g.toString().trim():NaN},mt=g=>lr(g,to,io),xt=g=>lr(g,so,ro),it=(g,c)=>{const b=g==null?void 0:g.getAttr(c);return b!==!0&&b||!1},zt=g=>{const{type:c,name:b,parentNode:w}=g;switch(c){case"heading":return g.level;case"heading-title":return w.level;case"parameter-key":return`${w.parentNode.name}|${w.name}`;case"ext":case"html":case"image-parameter":return b;default:return w.name}},or=(g,c,b=!1)=>({range:rr(g,...c.range),newText:c.text,title:`${b?"Fix":"Suggestion"}: ${c.desc}`,fix:b}),uo=(g,c)=>{const{lintConfig:b}=C;if(c){C.lintConfig={};for(const m of Ps)C.lintConfig[m]=m===c?b[m]:0}const{output:w}=g.lint();return c&&(C.lintConfig=b),w===void 0?[]:[{range:Me(g),newText:w}]},eh=($=class{constructor(g){B(this,h);B(this,e);B(this,t);B(this,s);B(this,i);B(this,l);B(this,r);B(this,n);B(this,o);B(this,a);Ce(this,"include",!0);Ce(this,"config");Ce(this,"data");$r.set(g,this),Object.defineProperties(this,{config:{enumerable:!1},data:{enumerable:!1}})}destroy(){Object.setPrototypeOf(this,null)}async provideDocumentColors(g,c,b=!0){const w=await P(this,h,Ie).call(this,c);return w.querySelectorAll("attr-value,parameter-value,arg-default").reverse().flatMap(m=>{const{type:_,childNodes:k}=m;return _!=="attr-value"&&!ir(m)?[]:k.filter(T=>T.type==="text").reverse().flatMap(T=>{const{data:O}=T,L=wo(O,b).filter(([,,,W])=>W);if(L.length===0)return[];const j=T.getAbsoluteIndex();return L.map(([W,N,R])=>{const J=g(W);return J.length===4&&{color:{red:J[0]/255,green:J[1]/255,blue:J[2]/255,alpha:J[3]},range:rr(w,j+N,j+R)}}).filter(Boolean)})})}provideColorPresentations(g){const{color:{red:c,green:b,blue:w,alpha:m},range:_}=g,k=[c,b,w],T=m<1?`rgba(${k.map(O=>Math.round(O*255)).join()},${m})`:`#${k.map(bo).join("")}`;return[{label:T,textEdit:{range:_,newText:T}}]}async provideCompletionItems(g,c){var ee,re,he,Te,Be,Ze,fe;const{re:b,allTags:w,functions:m,switches:_,protocols:k,params:T,tags:O,ext:L}=P(this,h,th).call(this),{line:j,character:W}=c,N=g.split(/\r?\n/u,j+1)[j],R=b.exec((ee=N==null?void 0:N.slice(0,W))!=null?ee:""),[,,J={},q={}]=this.config.doubleUnderscore;if((R==null?void 0:R[1])!==void 0){const M=R[1].startsWith("/");return xe(w,"Class",R[1].slice(M?1:0),c,M&&!(N!=null&&N.slice(W).trim().startsWith(">"))?">":"")}else{if(R!=null&&R[4])return xe(_,"Constant",R[4],c,"",M=>{if(this.data)return M=M.slice(2,-2),M in J?M=J[M]:M in q&&(M=q[M]),P(this,h,Ir).call(this,M.toLowerCase())});if((R==null?void 0:R[5])!==void 0)return xe(k,"Reference",R[5],c)}const F=await P(this,h,Ie).call(this,g);let U;if(R!=null&&R[2]){U=F.elementFromPoint(R.index+R[2].length-1,j);const M=(re=R[3])!=null?re:"";if(R[2]==="{{{")return xe(F.querySelectorAll("arg").filter(K=>K.name&&K!==U).map(({name:K})=>K),"Variable",M,c);const[le,be]=this.config.parserFunction,me=Array.isArray(be),_e=N.charAt(W),Ue=M.startsWith(":"),Ae=Ue?M.slice(1).trimStart():M;if(R[2]==="[[")return xe(F.querySelectorAll("link,file,category,redirect-target").filter(K=>K!==U).map(({name:K})=>K),"Folder",Ae,c);let gt=m;return _e===":"?gt=m.filter(K=>!K.endsWith(":")):_e===":"&&(gt=m.filter(K=>K.endsWith(":")).map(K=>K.slice(0,-1))),[...xe(gt,"Function",M,c,"",K=>{if(this.data)K in le?K=le[K]:!me&&K in be&&(K=be[K]);else return;return P(this,h,vt).call(this,K.toLowerCase())}),...M.startsWith("#")?[]:xe(F.querySelectorAll("template").filter(K=>K!==U).map(K=>{const{name:et}=K;if(Ue)return et;const{ns:Pe}=K.getAttribute("title");return Pe===0?`:${et}`:Pe===10?et.slice(9):et}),"Folder",Ae,c)]}let H,D;if((R==null?void 0:R[7])===void 0&&(U=F.elementFromPoint(W,j),{type:H,parentNode:D}=U),(R==null?void 0:R[6])!==void 0||H==="image-parameter"){const M=F.indexFromPos(j,W),le=(Te=(he=R==null?void 0:R[6])==null?void 0:he.trimStart())!=null?Te:v(this,e).slice(U.getAbsoluteIndex(),M).trimStart(),be=v(this,e)[M]==="=";return[...xe(T,"Property",le,c).filter(({label:me})=>!be||!/[= ]$/u.test(me)),...xe(F.querySelectorAll("image-parameter#width").filter(me=>me!==U).map(me=>me.text()),"Unit",le,c)]}else if((R==null?void 0:R[7])!==void 0||H==="attr-key"){const M=(Ze=(Be=R==null?void 0:R[7])==null?void 0:Be.toLowerCase())!=null?Ze:D.tag,le=(fe=R==null?void 0:R[9])!=null?fe:U.toString().slice(0,W-F.posFromIndex(U.getAbsoluteIndex()).left);if(!O.has(M))return;const be=Dr[M],me=Gr[M],_e=me&&xe(me,"Field",le,c);return L.includes(M)&&!be?_e:[..._e!=null?_e:[],...M==="meta"||M==="link"?[]:xe(Hr,"Property",le,c),...be?xe(be,"Property",le,c):[],...xe(["data-"],"Variable",le,c),...xe(["xmlns:"],"Interface",le,c)]}else if(H==="parameter-key"||H==="parameter-value"&&D.anon){const M=D.parentNode,{type:le,name:be}=M;if(le==="magic-word"&&be!=="invoke")return;const me=v(this,e).slice(U.getAbsoluteIndex(),F.indexFromPos(j,W)).trimStart(),{module:_e,function:Ue}=M;return me?xe(F.querySelectorAll("parameter").filter(Ae=>Ae===D||Ae.anon||Ae.parentNode.type!==le||Ae.parentNode.name!==be?!1:le==="template"?!0:Ae.parentNode.module===_e&&Ae.parentNode.function===Ue).map(({name:Ae})=>Ae),"Variable",me,c,H==="parameter-value"?"=":""):void 0}else if(Es(U)&&ho(D)){const M=qr(D.tag,D.name);if(M.length===0)return;const le=v(this,e).slice(U.getAbsoluteIndex(),F.indexFromPos(j,W)).trimStart();return xe(M,"Value",le,c)}}async provideDiagnostics(g,c=!0){const b=await P(this,h,Ie).call(this,g),w=b.lint();return[(c?w:w.filter(({severity:T})=>T==="error")).map(({startLine:T,startCol:O,endLine:L,endCol:j,severity:W,rule:N,message:R,fix:J,suggestions:q})=>({range:{start:{line:T,character:O},end:{line:L,character:j}},severity:W==="error"?1:2,source:"WikiLint",code:N,message:R,data:[...J?[or(b,J,!0)]:[],...q?q.map(F=>or(b,F)):[]]})),[],[]].flat(2)}resolveCodeAction(g){if(g.kind!=="source.fixAll")return g;const{rule:c}=g.data;return{...g,edit:{changes:{"":uo(v(this,l),c)}}}}async provideFoldingRanges(g){const c=await P(this,h,Ie).call(this,g),{length:b}=c.getLines(),w=[],m=new Array(6),_=c.querySelectorAll("heading-title,table,template,magic-word");for(const k of[..._].reverse())k.getRelativeIndex();for(const k of _){const{offsetHeight:T}=k;if(k.type==="heading-title"||T>2){const{top:O}=c.posFromIndex(k.getAbsoluteIndex());if(k.type==="heading-title"){const{level:L}=k.parentNode;for(let j=L-1;j<6;j++){const W=m[j];W!==void 0&&W<O-1&&w.push({startLine:W,endLine:O-1,kind:"region"}),m[j]=void 0}m[L-1]=O+T-1}else w.push({startLine:O,endLine:O+T-2,kind:"region"})}}for(const k of m)k!==void 0&&k<b-1&&w.push({startLine:k,endLine:b-1,kind:"region"});return w}async provideLinks(g){var _;(_=this.config)!=null||(this.config=C.getConfig());const{articlePath:c,protocol:b}=this.config,w=c==null?void 0:c.includes("//"),m=ao(b);return(await P(this,h,Ie).call(this,g)).querySelectorAll(`magic-link,ext-link-url,free-ext-link,attr-value,image-parameter#link${w?",link-target,template-name,invoke-module,magic-word#filepath,magic-word#widget":""}`).reverse().map(k=>{let T;k.is("magic-word")&&({name:T}=k,k=k.childNodes[1].lastChild);const{type:O,parentNode:L,firstChild:j,lastChild:W,childNodes:N,length:R}=k,{tag:J}=L;if(T!=null||(T=L.name),!(O!=="attr-value"||T==="src"&&["templatestyles","img"].includes(J)||T==="cite"&&["blockquote","del","ins","q"].includes(J))||!ir(k))return!1;let q=N.filter(F=>F.type==="text").map(({data:F})=>F).join("").trim();if(!q)return!1;try{if(k.is("magic-link")||k.is("ext-link-url")||k.is("free-ext-link"))q=k.getUrl(c);else if(O==="link-target"&&(L.is("link")||L.is("redirect-target")||L.is("category"))){if(q.startsWith("/"))return!1;q=L.link.getUrl(c)}else if(O==="template-name")q=L.getAttribute("title").getUrl(c);else if(["link-target","invoke-module","parameter-value"].includes(O)||O==="attr-value"&&T==="src"&&J==="templatestyles"||O==="image-parameter"&&!m.test(q)){if(!w||q.startsWith("/"))return!1;let F=0;switch(O){case"attr-value":F=10;break;case"invoke-module":F=828;break;case"parameter-value":F=T==="filepath"?6:274}const U=C.normalizeTitle(q,F,!1,this.config,{temporary:!0});if(!U.valid)return!1;q=U.getUrl()}if(typeof q=="string"&&q.startsWith("//")&&(q=`https:${q}`),q=new URL(q).href,O==="image-parameter"){const F=j.getBoundingClientRect(),{top:U,left:H,height:D,width:ee}=R===1?F:W.getBoundingClientRect();return{range:{start:{line:F.top,character:F.left},end:ds(U,H,D,ee)},target:q}}return{range:Me(k),target:q}}catch{return!1}}).filter(Boolean)}async provideReferences(g,c){const b=await P(this,h,Ie).call(this,g),{offsetNode:w,offset:m}=nr(b,v(this,e),c),_=w.type==="text"?w.parentNode:w,k=m===0&&(_.type==="ext-attr-dirty"||_.type==="html-attr-dirty")?_.parentNode.parentNode:_,{type:T}=k,O=mt(k),L=xt(k);if(!O&&!L&&!no.has(T))return;const j=zt(k),W=b.querySelectorAll(T==="heading-title"?"heading":T).filter(N=>T==="attr-value"?mt(N)===O||xt(N)===L:zt(N)===j).reverse().map(N=>({range:Me(N.type==="parameter-key"?N.parentNode:N)}));return W.length===0?void 0:W}async provideDefinition(g,c){const b=await P(this,h,Ie).call(this,g),w=b.elementFromPoint(c.character,c.line),m=w.is("ext")&&w.name==="ref"?w:w.closest("ext#ref"),_=it(m,"name");if(!_)return;const k=it(m,"group"),T=b.querySelectorAll("ext#ref").filter(O=>O.innerText&&it(O,"name")===_&&it(O,"group")===k).reverse().map(({lastChild:O})=>({range:Me(O)}));return T.length===0?void 0:T}async resolveRenameLocation(g,c){const b=await P(this,h,Ie).call(this,g),w=b.elementFromPoint(c.character,c.line),{type:m}=w,_=mt(w),k=xt(w);return!_&&!k&&(!sr.has(m)||m==="parameter-key"&&/^[1-9]\d*$/u.test(w.parentNode.name)||m==="link-target"&&!["link","redirect-target"].includes(w.parentNode.type))?void 0:Me(w)}async provideRenameEdits(g,c,b){const w=await P(this,h,Ie).call(this,g),m=w.elementFromPoint(c.character,c.line),{type:_}=m,k=mt(m),T=k&&it(m.parentNode.parentNode,"group"),O=xt(m),L=zt(m),j=w.querySelectorAll(_).filter(W=>{const{type:N}=W.parentNode;return _==="link-target"&&N!=="link"&&N!=="redirect-target"?!1:_==="attr-value"?xt(W)===O||mt(W)===k&&it(W.parentNode.parentNode,"group")===T:zt(W)===L});return j.length===0?void 0:{changes:{"":j.reverse().map(W=>({range:Me(W),newText:b}))}}}async provideHover(g,c){if(!this.data)return;const b=await P(this,h,Ie).call(this,g);let{offsetNode:w,offset:m}=nr(b,v(this,e),c);w.type==="text"&&(m+=w.getRelativeIndex(),w=w.parentNode);const{type:_,parentNode:k,length:T,name:O}=w;let L,j,W,N;if(w.is("double-underscore")&&m>0)L=P(this,h,Ir).call(this,w.name);else if(_==="magic-word-name")L=P(this,h,vt).call(this,k.name),j=w.text().trim(),W=k.getAttribute("colon");else if(w.is("magic-word")&&!w.modifier&&T===1&&(m>0||b.posFromIndex(w.getAbsoluteIndex()).left===c.character))L=P(this,h,vt).call(this,O),j=w.firstChild.text().trim(),W=w.getAttribute("colon");else if((w.is("magic-word")||w.is("template"))&&w.modifier&&m>=2&&w.getRelativeIndex(0)>m&&(j=w.modifier.trim().slice(0,-1),L=P(this,h,vt).call(this,j.toLowerCase()),W=":",L)){const R=w.getAbsoluteIndex();N={start:ft(b,R+2),end:ft(b,R+w.modifier.trimEnd().length+1)}}return L&&{contents:{kind:"markdown",value:(L.signatures?`${L.signatures.map(R=>`- **{{ ${j}${R.length===0?"**":`${W}** `}${R.map(({label:J,const:q})=>q?J:`*${J}*`).join(" **|** ")} **}}**`).join(`
|
|
29
|
+
`)}
|
|
30
|
+
|
|
31
|
+
`:"")+L.description},range:N!=null?N:Me(w)}}async provideSignatureHelp(g,c){if(!this.data)return;const{line:b,character:w}=c,m=g.split(/\r?\n/u,b+1)[b],{lastChild:_}=await P(this,h,Tr).call(this,`${m.slice(0,w+/^[^{}<]*/u.exec(m.slice(w))[0].length)}}}`);if(!_.is("magic-word")||_.length===1)return;const{name:k,childNodes:T,firstChild:O}=_,L=P(this,h,vt).call(this,k);if(!(L!=null&&L.signatures))return;const j=T.length-1,W=L.signatures.filter(q=>{var F;return(q.length>=j||((F=q[q.length-1])==null?void 0:F.rest))&&q.every(({label:U,const:H},D)=>{var re;const ee=H&&D<j&&((re=T[D+1])==null?void 0:re.text().trim());return!ee||U.toLowerCase().includes(ee.toLowerCase())})});if(W.length===0)return;let N=-1;for(let q=_.getAbsoluteIndex()+_.getAttribute("padding");N<j&&(q+=T[N+1].toString().length+1,!(q>w));N++);const R=O.text().trim(),J=_.getAttribute("colon");return{signatures:W.map(q=>({label:`{{${R}${q.length===0?"":J}${q.map(({label:F})=>F).join("|")}}}`,parameters:q.map(({label:F,const:U})=>({label:F,...U?{documentation:"Predefined parameter"}:void 0})),...q.length<j?{activeParameter:Math.min(N,q.length-1)}:void 0})),activeParameter:N}}async provideInlayHints(g){const c=await P(this,h,Ie).call(this,g);let b=[];for(const w of c.querySelectorAll("template,magic-word#invoke").reverse()){const{type:m,childNodes:_}=w;b=[...b,..._.slice(m==="template"?1:3).filter(({anon:k})=>k).reverse().map(k=>({position:ft(c,k.getAbsoluteIndex()),label:`${k.name}=`,kind:2}))]}return b}findStyleTokens(){return v(this,l).querySelectorAll(oo).filter(({lastChild:g})=>Es(g))}async provideRefactoringAction(g,c){let b,w;if(c){const{start:k,end:T}=c;if(k.line===T.line&&k.character===T.character)return[];b=g.split(/\r?\n/u,T.line+1),w=k.line===T.line?b[T.line].slice(k.character,T.character):`${b[k.line].slice(k.character)}
|
|
32
|
+
${b.slice(k.line+1,T.line).join(`
|
|
33
|
+
`)}${b.length===2?"":`
|
|
34
|
+
`}${b[T.line].slice(0,T.character)}`}else if(g)b=g.split(/\r?\n/u),w=b.join(`
|
|
35
|
+
`),c={start:{line:0,character:0},end:{line:b.length-1,character:b[b.length-1].length}};else return[];const m=await P(this,h,Tr).call(this,w),{viewOnly:_}=C;return C.viewOnly=!1,m.escape(),C.viewOnly=_,[{title:"Escape with magic words",kind:"refactor.rewrite",edit:{changes:{"":[{range:c,newText:m.toString()}]}}}]}},e=new WeakMap,t=new WeakMap,s=new WeakMap,i=new WeakMap,l=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakMap,a=new WeakMap,h=new WeakSet,rs=function(){return v(this,n)===this.config&&v(this,o)===this.include},Ie=async function(g){var c;return g=os(g),!v(this,s)&&P(this,h,rs).call(this)&&v(this,e)===g?v(this,l):(E(this,e,g),(c=v(this,s))!=null||E(this,s,P(this,h,_r).call(this)),v(this,s))},_r=async function(){var b;(b=this.config)!=null||(this.config=C.getConfig()),E(this,n,this.config),E(this,o,this.include);const g=v(this,e),c=await C.partialParse(g,()=>v(this,e),this.include,this.config);return P(this,h,rs).call(this)&&v(this,e)===g?(E(this,l,c),E(this,s,void 0),c):(E(this,s,P(this,h,_r).call(this)),v(this,s))},Tr=async function(g){var c;return g=os(g),!v(this,i)&&P(this,h,rs).call(this)&&v(this,t)===g?v(this,r):(E(this,t,g),(c=v(this,i))!=null||E(this,i,P(this,h,Cr).call(this)),v(this,i))},Cr=async function(){var b;(b=this.config)!=null||(this.config=C.getConfig()),E(this,n,this.config),E(this,o,this.include);const g=v(this,t),c=await C.partialParse(g,()=>v(this,t),this.include,this.config);return P(this,h,rs).call(this)&&v(this,t)===g?(E(this,r,c),E(this,i,void 0),c):(E(this,i,P(this,h,Cr).call(this)),v(this,i))},th=function(){var g;if(!v(this,a)||v(this,a)[1]!==this.config){(g=this.config)!=null||(this.config=C.getConfig());const{nsid:c,ext:b,html:w,parserFunction:[m,_,...k],doubleUnderscore:T,protocol:O,img:L}=this.config,j=new Set([b,w].flat(2)),W=new RegExp("(?:"+String.raw`<(\/?\w*)`+"|"+String.raw`(\{{2,4}|\[\[)\s*([^|{}<>[\]\s][^|{}<>[\]#]*)?`+"|"+String.raw`(__(?:(?!__)[\p{L}\p{N}_])*)`+"|"+String.raw`(?<!\[)\[([a-z:/]*)`+"|"+String.raw`\[\[\s*(?:${Object.entries(c).filter(([,N])=>N===6).map(([N])=>N).join("|")})\s*:[^[\]{}<>]+\|([^[\]{}<>|=]*)`+"|"+String.raw`<(\w+)(?:\s(?:[^<>{}|=\s]+(?:\s*=\s*(?:[^\s"']\S*|(["']).*?\8))?(?=\s))*)?\s(\w*)`+")$","iu");E(this,a,[{re:W,ext:b,tags:j,allTags:[...j,"onlyinclude","includeonly","noinclude"],functions:[Object.keys(m),Array.isArray(_)?_:Object.keys(_),k].flat(2),switches:T.slice(0,2).flat().map(N=>`__${N}__`),protocols:O.split("|"),params:Object.keys(L).filter(N=>N.endsWith("$1")||!N.includes("$1")).map(N=>N.replace(/\$1$/u,""))},this.config])}return v(this,a)[0]},Ir=function(g){return this.data.behaviorSwitches.find(({aliases:c})=>c.includes(g))},vt=function(g){return this.data.parserFunctions.find(({aliases:c})=>c.some(b=>b.replace(/^#/u,"")===g))},$)}}),sh={};oe(sh,{default:()=>C});ih.exports=Y(sh);var Ts,ar,ze,hr,co,C,G=I({"index.ts"(){jr(),Re(),ut(),ce(),iu(),Ts=!0,ar=kr(),ze={config:dr,i18n:void 0,rules:Ps,get lintConfig(){return ar},set lintConfig(e){ar=kr(e)},get viewOnly(){return Ts},set viewOnly(e){Ts&&!e&&ve.rev++,Ts=e},getConfig(e){const t=e!=null?e:this.config,{doubleUnderscore:s,ext:i,parserFunction:l,variable:r}=t;for(let n=0;n<2;n++)s.length>n+2&&s[n].length===0&&(s[n]=Object.keys(s[n+2]));return i.includes("translate")&&!r.includes("translationlanguage")&&(r.push("translationlanguage"),Array.isArray(l[1])?l[1].push("TRANSLATIONLANGUAGE"):l[1].TRANSLATIONLANGUAGE="translationlanguage"),{...dr,...t,excludes:[]}},msg(e,t=""){var s,i;return e&&((i=(s=this.i18n)==null?void 0:s[e])!=null?i:e).replace("$1",this.msg(t))},normalizeTitle(e,t=0,s,i=ze.getConfig(),l){const{Title:r}=(ru(),Y(Ka));let n;if(l!=null&&l.halfParsed)n=new r(e,t,i,l);else{const{Token:o}=(V(),Y(ls));n=ve.run(()=>{const a=new o(e,i);a.type="root",a.parseOnce(0,s).parseOnce();const h=new r(a.toString(),t,i,l);a.build();for(const u of["main","fragment"]){const d=h[u];if(d!=null&&d.includes("\0")){const f=a.buildFromStr(d,1);u==="main"?h.main=f:h.setFragment(f)}}return h})}return n},parse(e,t,s=$e,i=ze.getConfig()){e=os(e);let l;typeof s!="number"&&(l=Array.isArray(s)?s:[s],s=Math.max(...l.map(o=>xo[o]||$e)));const{Token:r}=(V(),Y(ls));return ve.run(()=>{const o=new r(e,i);return o.type="root",o.parse(s,t)})},async partialParse(e,t,s,i=ze.getConfig()){{const{Token:l}=(V(),Y(ls)),r=typeof setImmediate=="function"?setImmediate:setTimeout,{running:n}=ve;ve.running=!0;const o=new l(os(e),i);o.type="root";let a=0;try{await new Promise(h=>{const u=()=>{t()===e?(a++,r(d,0)):h()},d=()=>{a===$e+1?(o.afterBuild(),h()):(o[a===$e?"build":"parseOnce"](a,s),u())};r(d,0)})}catch(h){throw ve.running=n,h}return ve.running=n,o}},createLanguageService(e={}){var t;{const s=(nu(),Y(Za)),{LanguageService:i,tasks:l}=s;return(t=l.get(e))!=null?t:new i(e)}throw new Error("Parser.createLanguageService method is only available in the LSP version!")}},hr={},co=new Set(["lintConfig","normalizeTitle","parse","createLanguageService"]);for(const e in ze)co.has(e)||(hr[e]={enumerable:!1});Object.defineProperties(ze,hr),Object.assign(typeof globalThis=="object"?globalThis:self,{Parser:ze}),C=ze}});G()});lu();})();
|
|
36
|
+
//# sourceMappingURL=bundle-lsp.min.js.map
|