UNPKG

wikiparser-node

Version:

A Node.js parser for MediaWiki markup with AST

12 lines 88 kB
"use strict";(()=>{var Ha=Object.defineProperty;var fr=t=>{throw TypeError(t)};var Ga=(t,e,s)=>e in t?Ha(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var Va=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var lt=(t,e,s)=>Ga(t,typeof e!="symbol"?e+"":e,s),He=(t,e,s)=>e.has(t)||fr("Cannot "+s);var p=(t,e,s)=>(He(t,e,"read from private field"),s?s.call(t):e.get(t)),k=(t,e,s)=>e.has(t)?fr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),C=(t,e,s,r)=>(He(t,e,"write to private field"),r?r.call(t,s):e.set(t,s),s),E=(t,e,s)=>(He(t,e,"access private method"),s);var mr=(t,e,s,r)=>({set _(i){C(t,e,i,s)},get _(){return p(t,e,r)}});var Xl=Va((Kl,Ma)=>{var Qa=Object.create,qt=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,Qs=Object.getOwnPropertyNames,Xa=Object.prototype.hasOwnProperty,Ki=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Wt=t=>{throw TypeError(t)},Yi=(t,e,s)=>e in t?qt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,vr=(t,e)=>qt(t,"name",{value:e,configurable:!0}),m=(t,e)=>function(){return t&&(e=(0,t[Qs(t)[0]])(t=0)),e},Ja=(t,e)=>function(){return e||(0,t[Qs(t)[0]])((e={exports:{}}).exports,e),e.exports},M=(t,e)=>{for(var s in e)qt(t,s,{get:e[s],enumerable:!0})},Ka=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qs(e))!Xa.call(t,i)&&i!==s&&qt(t,i,{get:()=>e[i],enumerable:!(r=Ji(e,i))||r.enumerable});return t},R=t=>Ka(qt({},"__esModule",{value:!0}),t),q=t=>{var e;return[,,,Qa((e=t==null?void 0:t[Ki("metadata")])!=null?e:null)]},Zi=["class","method","getter","setter","accessor","field","value","get","set"],Kt=t=>t!==void 0&&typeof t!="function"?Wt("Function expected"):t,Ya=(t,e,s,r,i)=>({kind:Zi[t],name:e,metadata:r,addInitializer:n=>s._?Wt("Already initialized"):i.push(Kt(n||null))}),Xs=(t,e)=>Yi(e,Ki("metadata"),t[3]),O=(t,e,s,r)=>{for(var i=0,n=t[e>>1],a=n&&n.length;i<a;i++)e&1?n[i].call(s):r=n[i].call(s,r);return r},B=(t,e,s,r,i,n)=>{var a,l,o,d,h,u=e&7,x=!!(e&8),c=!!(e&16),g=u>3?t.length+1:u?x?1:2:0,v=Zi[u+5],A=u>3&&(t[g-1]=[]),_=t[g]||(t[g]=[]),S=u&&(!c&&!x&&(i=i.prototype),u<5&&(u>3||!c)&&Ji(u<4?i:{get[s](){return D(this,n)},set[s](w){return Y(this,n,w)}},s));u?c&&u<4&&vr(n,(u>2?"set ":u>1?"get ":"")+s):vr(i,s);for(var T=r.length-1;T>=0;T--)d=Ya(u,s,o={},t[3],_),u&&(d.static=x,d.private=c,h=d.access={has:c?w=>tl(i,w):w=>s in w},u^3&&(h.get=c?w=>(u^1?D:Bs)(w,i,u^4?n:S.get):w=>w[s]),u>2&&(h.set=c?(w,N)=>Y(w,i,N,u^4?n:S.set):(w,N)=>w[s]=N)),l=(0,r[T])(u?u<4?c?n:S[v]:u>4?void 0:{get:S.get,set:S.set}:i,d),o._=1,u^4||l===void 0?Kt(l)&&(u>4?A.unshift(l):u?c?n=l:S[v]=l:i=l):typeof l!="object"||l===null?Wt("Object expected"):(Kt(a=l.get)&&(S.get=a),Kt(a=l.set)&&(S.set=a),Kt(a=l.init)&&A.unshift(a));return u||Xs(t,i),S&&qt(i,s,S),c?u^4?n:S:i},Za=(t,e,s)=>Yi(t,typeof e!="symbol"?e+"":e,s),Js=(t,e,s)=>e.has(t)||Wt("Cannot "+s),tl=(t,e)=>Object(e)!==e?Wt('Cannot use the "in" operator on this value'):t.has(e),D=(t,e,s)=>(Js(t,e,"read from private field"),s?s.call(t):e.get(t)),gt=(t,e,s)=>e.has(t)?Wt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),Y=(t,e,s,r)=>(Js(t,e,"write to private field"),r?r.call(t,s):e.set(t,s),s),Bs=(t,e,s)=>(Js(t,e,"access private method"),s),el=(t,e,s,r)=>({set _(i){Y(t,e,i,s)},get _(){return D(t,e,r)}});function Z(t,e,s){return s===1?t.replace(/\0(\d+)g\x7F/gu,(r,i)=>Z(String(e[i]),e,2)):s===2?t.replace(/\0(\d+)n\x7F/gu,(r,i)=>String(e[i])):t.replace(/\0(\d+)\x7F/gu,(r,i)=>e[i])}var At,Ge,de,pe,Ot,It,tn,J,St,br,wr,qs,en,_r,Ar,ce,Bt,G=m({"util/string.ts"(){"use strict";At=String.raw` \xA0\u1680\u2000-\u200A\u202F\u205F\u3000`,Ge=String.raw`[^[\]<>"\0-\x1F\x7F${At}\uFFFD]`,de=String.raw`(?:\[[\da-f:.]+\]|${Ge})`,pe=String.raw`(?:${Ge}|\0\d+[cn!~]\x7F)*`,Ot=t=>t.trim().toLowerCase(),It=(t,e)=>s=>s.replace(t,e),tn=It(/[\0\x7F]|\r$/gmu,""),J=It(/\0\d+[cn]\x7F/gu,""),St=(t,e="")=>t.map(s=>typeof s=="string"?s:s.text()).join(e),br={lt:"<",gt:">",lbrack:"[",rbrack:"]",lbrace:"{",rbrace:"}",nbsp:" ",amp:"&",quot:'"'},wr=It(/&(?:#(\d+|[Xx][\da-fA-F]+)|([lg]t|[LG]T|[lr]brac[ke]|nbsp|amp|AMP|quot|QUOT));/gu,(t,e,s)=>e?String.fromCodePoint(+((/^x/iu.test(e)?"0":"")+e)):br[s.toLowerCase()]),qs=t=>wr(t),en=It(/&#(\d+|x[\da-f]+);/giu,(t,e)=>String.fromCodePoint(+((/^x/iu.test(e)?"0":"")+e))),_r={"&":"amp","<":"lt",">":"gt",'"':"quot","\n":"#10"},Ar=t=>It(t,e=>`&${_r[e]};`),ce=Ar(/[&<>]/gu),Bt=(t,e={})=>{const{pre:s="",post:r="",sep:i=""}=e;return s+t.map(n=>n.print()).join(i)+r}}}),sl=Ja({"config/minimum.json"(t,e){e.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","#contentmodel":"contentmodel","#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:[]}}}),tt,Ws,ft=m({"util/constants.ts"(){"use strict";tt=11,Ws=sl()}});function ue(t){const e=new Map,s=new WeakMap;return r=>{const i=typeof r=="string"?e:s;if(i.has(r)){const a=i.get(r);return a.lastIndex=0,a}const n=t(r);return i.set(r,n),n}}var Le,sn,xe=m({"../common/dist/index.mjs"(){"use strict";Le=t=>decodeURIComponent(t.replace(/%(?![\da-f]{2})/giu,"%25")),sn=ue}}),yr,Sr,ke,yt,rn,fe=m({"util/lint.ts"(){"use strict";ut(),Q(),yr=new Set(["tr","td","th","caption"]),Sr=new Set(["Template:!!","Template:!-"]),ke=t=>{const e=t.childNodes.find(s=>s.text().trim());if(!e||e.type==="text"&&e.data.trim().startsWith("!")||e.is("magic-word")&&e.name==="!"||e.is("template")&&Sr.has(e.name)||e.is("html")&&yr.has(e.name))return!1;if(e.is("arg"))return e.length>1&&ke(e.childNodes[1]);if(e.is("magic-word"))try{const s=e.getPossibleValues().map(ke);return s.includes(2)?2:s.includes(1)&&1}catch{}return e.is("template")||e.is("magic-word")&&e.name==="invoke"?1:2},yt=(t,e,s,r)=>{if(t&&(r||U.viewOnly&&t[0]===et.rev))return t[1];const i=e();return(r||U.viewOnly)&&s([et.rev,i]),i},rn=(t,e)=>t==="ol"&&e==="type"?["1","a","A","i","I"]:t==="th"&&e==="scope"?["row","col","rowgroup","colgroup"]:e==="dir"?["ltr","rtl","auto"]:e==="aria-hidden"?["true","false"]:[]}}),Tr,Ks,nn=m({"parser/selector.ts"(){"use strict";Tr=(t,e,s)=>{if(t.includes("#")){const r=t.indexOf("#");return(r===0||t.slice(0,r)===e)&&t.slice(r+1)===s}return!t||t===e},Ks=(t,e,s)=>{const r=t.split(",");return({type:i,name:n})=>r.some(a=>Tr(a.trim(),i,n))}}}),je,Ys=m({"mixin/cached.ts"(){"use strict";fe(),je=(t=!0)=>e=>{const s=new WeakMap;return function(...r){return yt(s.get(this),()=>e.apply(this,r),i=>{s.set(this,i)},t)}}}}),an,rl=m({"mixin/nodeLike.ts"(){"use strict";an=t=>{class e extends t{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 e}}}),$r,kr,be,Dt,zt,we,Ht,Gt,Vt,wt,ln=m({"lib/node.ts"(){"use strict";fe(),ut(),Ys(),rl(),Q(),kr=[an],$r=[je(!1)],wt=class{constructor(){O(Vt,5,this),Za(this,"childNodes",[]),gt(this,be),gt(this,Dt),gt(this,zt),gt(this,we),gt(this,Ht),gt(this,Gt,{})}get parentNode(){return D(this,be)}get nextSibling(){return D(this,Dt)}get previousSibling(){return D(this,zt)}getChildNodes(){const{childNodes:t}=this;return Object.isFrozen(t)?[...t]:t}getAttribute(t){return t==="padding"?0:this[t]}setAttribute(t,e){switch(t){case"parentNode":Y(this,be,e),e||(Y(this,Dt,void 0),Y(this,zt,void 0));break;case"nextSibling":Y(this,Dt,e);break;case"previousSibling":Y(this,zt,e);break;case"aIndex":U.viewOnly&&Y(this,Ht,[et.rev,e]);break;default:this[t]=e}}getRootNode(){return yt(D(this,we),()=>{var t,e;return(e=(t=this.parentNode)==null?void 0:t.getRootNode())!=null?e:this},t=>{const[,e]=t;e.type==="root"&&Y(this,we,t)})}indexFromPos(t,e){this.lspError("AstNode.indexFromPos")}posFromIndex(t){const{length:e}=String(this);if(t+=t<0?e:0,t>=0&&t<=e){const s=this.getLines(),r=s.findIndex(([,,i])=>t<=i);return{top:r,left:t-s[r][1]}}}getDimension(){const t=this.getLines(),e=t[t.length-1];return{height:t.length,width:e[2]-e[1]}}getGaps(t){return 0}getRelativeIndex(t){if(t===void 0){const{parentNode:e}=this;return e?e.getRelativeIndex(e.childNodes.indexOf(this)):0}return yt(D(this,Gt)[t],()=>{const{childNodes:e}=this,s=t+(t<0?e.length:0);let r=this.getAttribute("padding");for(let i=0;i<s;i++)U.viewOnly&&(D(this,Gt)[i]=[et.rev,r]),r+=e[i].toString().length+this.getGaps(i);return r},e=>{D(this,Gt)[t]=e})}getAbsoluteIndex(){return yt(D(this,Ht),()=>{const{parentNode:t}=this;return t?t.getAbsoluteIndex()+this.getRelativeIndex():0},t=>{Y(this,Ht,t)})}getBoundingClientRect(){this.lspError("AstNode.getBoundingClientRect")}is(t){return this.type===t}getLines(){const t=[];let e=0;for(const s of String(this).split(` `)){const r=e+s.length;t.push([s,e,r]),e=r+1}return t}seal(t,e){const s=!e&&!!this[t];Object.defineProperty(this,t,{enumerable:s,configurable:!0})}lspError(t){throw new Error(`${t} method is only available in the LSP version!`)}},Vt=q(null),be=new WeakMap,Dt=new WeakMap,zt=new WeakMap,we=new WeakMap,Ht=new WeakMap,Gt=new WeakMap,B(Vt,1,"getLines",$r,wt),wt=B(Vt,0,"AstNode",kr,wt),O(Vt,1,wt)}}),on,il=m({"mixin/elementLike.ts"(){"use strict";nn(),on=t=>{var s,Ms;class e extends t{constructor(){super(...arguments);k(this,s)}getElementBy(a){for(const l of this.childNodes){if(l.type==="text")continue;if(a(l))return l;const o=l.getElementBy(a);if(o)return o}}querySelector(a){return this.getElementBy(E(this,s,Ms).call(this,a))}getElementsBy(a,l=[]){for(const o of this.childNodes)o.type!=="text"&&(a(o)&&l.push(o),o.getElementsBy(a,l));return l}querySelectorAll(a){return this.getElementsBy(E(this,s,Ms).call(this,a))}escape(){}}return s=new WeakSet,Ms=function(a){return Ks(a,this)},e}}}),Cr,Ve,Ir,Yt,nl=m({"lib/element.ts"(){"use strict";G(),ut(),nn(),ln(),il(),Cr=[on],Yt=class extends(Ir=wt){get length(){return this.childNodes.length}text(t){return St(this.childNodes,t)}normalize(){const t=this.getChildNodes(),e=s=>{var r,i;t.splice(s,1),(r=t[s-1])==null||r.setAttribute("nextSibling",t[s]),(i=t[s])==null||i.setAttribute("previousSibling",t[s-1])};for(let s=t.length-1;s>=0;s--){const{type:r,data:i}=t[s];r!=="text"||t.length===1||this.getGaps(s-(s&&1))||i===""&&e(s)}this.setAttribute("childNodes",t)}removeAt(t){this.lspError("AstElement.removeAt")}insertAt(t,e=this.length){return gr(this,e,0,[t]),t}closest(t){const e=Ks(t,this);let{parentNode:s}=this;for(;s;){if(e(s))return s;({parentNode:s}=s)}}append(...t){this.safeAppend(t)}safeAppend(t){for(const e of t)this.insertAt(e)}safeReplaceChildren(t){}setText(t,e=0){e+=e<0?this.length:0;const s=this.childNodes[e],{data:r}=s;return s.replaceData(t),r}toString(t,e=""){return this.childNodes.map(s=>s.toString(t)).join(e)}caretPositionFromIndex(t){this.lspError("AstElement.caretPositionFromIndex")}elementFromIndex(t){this.lspError("AstElement.elementFromIndex")}elementFromPoint(t,e){this.lspError("AstElement.elementFromPoint")}lint(t=this.getAbsoluteIndex(),e){}print(t={}){const e=t.class;return this.toString()?(e===""?"":`<span class="wpb-${e!=null?e:this.type}${this.getAttribute("invalid")?" wpb-invalid":""}">`)+Bt(this.childNodes,t)+(e===""?"":"</span>"):""}json(t,e=this.getAbsoluteIndex()){this.lspError("AstElement.json")}},Ve=q(Ir),Yt=B(Ve,0,"AstElement",Cr,Yt),O(Ve,1,Yt)}}),Us,al=m({"lib/text.ts"(){"use strict";var t,hn,s;G(),ln(),Us=(s=class extends wt{constructor(i){super();k(this,t);lt(this,"data","");this.data=i}get type(){return"text"}toString(i){var n;return i&&!((n=this.parentNode)!=null&&n.getAttribute("built"))?J(this.data):this.data}text(){return this.data}lint(i=this.getAbsoluteIndex(),n){}replaceData(i){E(this,t,hn).call(this,i)}splitText(i){this.lspError("AstText.splitText")}escape(){}print(){return ce(this.data)}},t=new WeakSet,hn=function(i){this.setAttribute("data",i)},s)}}),Tt,Mt=m({"mixin/hidden.ts"(){"use strict";Tt=(t=!0,e=!0)=>s=>{class r extends s{text(){return""}lint(n){}}return r}}}),at,ot=m({"mixin/noEscape.ts"(){"use strict";at=t=>{}}}),$t,Ut=m({"src/syntax.ts"(){"use strict";var t,e;F(),$t=(e=class extends I{constructor(r,i,n,a,l){super(r,n,a,l);k(this,t);C(this,t,i)}get type(){return p(this,t)}lint(r=this.getAbsoluteIndex()){}},t=new WeakMap,e)}}),ht,mt=m({"mixin/padded.ts"(){"use strict";ht=({length:t})=>e=>{class s extends e{getAttribute(i){return i==="padding"?t:super.getAttribute(i)}}return s}}}),V,vt=m({"src/atom.ts"(){"use strict";var t,e;F(),V=(e=class extends I{constructor(r,i,n,a,l){super(r,n,a,l);k(this,t);C(this,t,i)}get type(){return p(this,t)}set type(r){C(this,t,r)}getAttribute(r){var i;return r==="invalid"?this.type==="converter-flag"&&!!((i=this.parentNode)!=null&&i.isInvalidFlag(this)):super.getAttribute(r)}},t=new WeakMap,e)}}),Nr,Qe,Fr,xt,Re=m({"src/link/base.ts"(){"use strict";var t,e,s,r;ft(),mt(),ot(),F(),vt(),Nr=[at,ht("[[")],xt=(r=class extends(Fr=I){constructor(n,a,l,o=[],d="|"){super(void 0,l,o,{});k(this,t,!0);k(this,e);k(this,s);if(this.insertAt(new V(n,"link-target",l,o,{})),a!==void 0){const h=new I(a,l,o,{});h.type="link-text",h.setAttribute("stage",tt-1),this.insertAt(h)}C(this,e,d)}get link(){}get fragment(){}afterBuild(){C(this,s,this.getTitle()),p(this,e).includes("\0")&&C(this,e,this.buildFromStr(p(this,e),0)),this.setAttribute("name",p(this,s).title),super.afterBuild()}setAttribute(n,a){n==="bracket"?C(this,t,a):n==="title"?C(this,s,a):super.setAttribute(n,a)}toString(n){const a=super.toString(n,p(this,e));return p(this,t)?`[[${a}]]`:a}text(){const n=super.text("|");return p(this,t)?`[[${n}]]`:n}getAttribute(n){return n==="title"?p(this,s):super.getAttribute(n)}getGaps(n){return n===0?p(this,e).length:1}lint(n=this.getAbsoluteIndex(),a){}getTitle(n,a){return this.normalizeTitle(this.firstChild.text(),0,{halfParsed:a,temporary:n,decode:!0,selfLink:!0})}print(){return super.print(p(this,t)?{pre:"[[",post:"]]",sep:p(this,e)}:{sep:p(this,e)})}json(n,a=this.getAbsoluteIndex()){const l=super.json(void 0,a)}},t=new WeakMap,e=new WeakMap,s=new WeakMap,r),Qe=q(Fr),xt=B(Qe,0,"LinkBaseToken",Nr,xt),O(Qe,1,xt)}}),Lr,Xe,Er,nt,kt=m({"src/nowiki/base.ts"(){"use strict";ot(),F(),Lr=[at],nt=class extends(Er=I){get innerText(){return this.firstChild.data}constructor(t="",e,s){super(t,e,s)}},Xe=q(Er),nt=B(Xe,0,"NowikiBaseToken",Lr,nt),O(Xe,1,nt)}}),Pr,Je,jr,z,bt=m({"src/nowiki/noinclude.ts"(){"use strict";Mt(),kt(),Pr=[Tt()],z=class extends(jr=nt){get type(){return"noinclude"}toString(t){return t?"":super.toString()}},Je=q(jr),z=B(Je,0,"NoincludeToken",Pr,z),O(Je,1,z)}}),un,ll=m({"src/link/redirectTarget.ts"(){"use strict";Re(),bt(),un=class extends xt{get type(){return"redirect-target"}constructor(t,e,s,r){super(t,void 0,s,r),e!==void 0&&this.insertAt(new z(e,s,r))}getTitle(){return this.normalizeTitle(this.firstChild.toString(),0,{halfParsed:!0,decode:!0})}lint(t=this.getAbsoluteIndex()){}}}}),Rr,Ke,Or,Zt,ol=m({"src/redirect.ts"(){"use strict";var t,e,s;Mt(),ot(),F(),Ut(),ll(),Rr=[Tt(!1,!1),at],Zt=(s=class extends(Or=I){constructor(i,n,a,l,o,d,h=[]){super(void 0,d,h);k(this,t);k(this,e);C(this,t,i),C(this,e,o),this.append(new $t(n,"redirect-syntax",d,h),new un(a,l==null?void 0:l.slice(1),d,h))}get type(){return"redirect"}getAttribute(i){return i==="padding"?p(this,t).length:super.getAttribute(i)}toString(i){return p(this,t)+super.toString(i)+p(this,e)}lint(i=this.getAbsoluteIndex()){}print(){return super.print({pre:p(this,t),post:p(this,e)})}},t=new WeakMap,e=new WeakMap,s),Ke=q(Or),Zt=B(Ke,0,"RedirectToken",Rr,Zt),O(Ke,1,Zt)}}),dn={};M(dn,{parseRedirect:()=>pn});var pn,hl=m({"parser/redirect.ts"(){"use strict";Q(),ol(),pn=(t,e,s)=>{var i;(i=e.regexRedirect)!=null||(e.regexRedirect=new RegExp(String.raw`^(\s*)((?:${e.redirection.join("|")})\s*(?::\s*)?)\[\[([^\n|\]]+)(\|.*?)?\]\](\s*)`,"iu"));const r=e.regexRedirect.exec(t);return r&&U.normalizeTitle(r[3],0,!1,e,{halfParsed:!0,temporary:!0,decode:!0}).valid?(t=`\0${s.length}o${t.slice(r[0].length)}`,new Zt(...r.slice(1),e,s),t):!1}}}),Br,Ye,qr,te,ul=m({"src/onlyinclude.ts"(){"use strict";mt(),ot(),F(),Br=[at,ht("<onlyinclude>")],te=class extends(qr=I){get type(){return"onlyinclude"}toString(t){return`<onlyinclude>${super.toString(t)}</onlyinclude>`}isPlain(){return!0}print(){return super.print({pre:'<span class="wpb-ext">&lt;onlyinclude&gt;</span>',post:'<span class="wpb-ext">&lt;/onlyinclude&gt;</span>'})}},Ye=q(qr),te=B(Ye,0,"OnlyincludeToken",Br,te),O(Ye,1,te)}}),me,Oe=m({"mixin/gapped.ts"(){"use strict";me=(t=1)=>e=>{class s extends e{getGaps(){return t}}return s}}}),Wr,Ze,Mr,_t,Zs=m({"src/tagPair/index.ts"(){"use strict";var t,e;Oe(),ot(),F(),Wr=[me(),at],_t=(e=class extends(Mr=I){constructor(r,i,n,a,l,o=[]){super(void 0,l);k(this,t);lt(this,"closed");lt(this,"selfClosing");this.setAttribute("name",r.toLowerCase()),C(this,t,[r,a||r]),this.closed=a!=="",this.selfClosing=a===void 0,this.append(i,n);const d=typeof i=="string"?-1:o.indexOf(i);o.splice(d===-1?1/0:d,0,this)}get innerText(){return this.selfClosing?void 0:this.lastChild.text()}toString(r){const{selfClosing:i,firstChild:n,lastChild:a}=this,[l,o]=p(this,t);return i?`<${l}${n.toString(r)}/>`:`<${l}${n.toString(r)}>${a.toString(r)}${this.closed?`</${o}>`:""}`}text(){const[r,i]=p(this,t);return this.selfClosing?`<${r}${this.firstChild.text()}/>`:`<${r}${super.text(">")}${this.closed?`</${i}>`:""}`}getAttribute(r){return r==="padding"?p(this,t)[0].length+1:super.getAttribute(r)}print(){const[r,i]=p(this,t);return super.print(this.selfClosing?{pre:`&lt;${r}`,post:"/&gt;"}:{pre:`&lt;${r}`,sep:"&gt;",post:this.closed?`&lt;/${i}&gt;`:""})}},t=new WeakMap,e),Ze=q(Mr),_t=B(Ze,0,"TagPairToken",Wr,_t),O(Ze,1,_t)}}),cn,dl=m({"src/tagPair/translate.ts"(){"use strict";var t,gn,s;F(),Zs(),Ut(),bt(),cn=(s=class extends _t{constructor(i,n,a,l=[]){const o=new $t(i,"translate-attr",a,l);n=n==null?void 0:n.replace(/(<tvar\|[^>]+>)([\s\S]*?)(<\/>)/gu,(h,u,x,c)=>(new z(u,a,l),new z(c,a,l),`\0${l.length-1}n${x}\0${l.length}n`)).replace(/(<tvar\s+name\s*=(?:\s*(?:(["'])[\s\S]*?\2|[^"'\s>]+))?\s*>)([\s\S]*?)(<\/tvar\s*>)/giu,(h,u,x,c,g)=>(new z(u,a,l),new z(g,a,l),`\0${l.length-1}n${c}\0${l.length}n`));const d=new I(n,a,l);d.type="translate-inner";super("translate",o,d,"translate",a,l);k(this,t);this.seal("closed",!0),this.seal("selfClosing",!0)}get type(){return"translate"}toString(i){return i?this.lastChild.toString(!0):super.toString()}text(){return this.lastChild.text()}print(){return`<span class="wpb-ext">&lt;translate${E(this,t,gn).call(this)?'<span class="wpb-ext-attrs"> <span class="wpb-ext-attr"><span class="wpb-attr-key">nowrap</span></span></span>':""}&gt;${this.lastChild.print({class:"ext-inner"})}&lt;/translate&gt;</span>`}},t=new WeakSet,gn=function(){return this.firstChild.toString()===" nowrap"},s)}}),Ur,ts,Dr,ee,pl=m({"src/tagPair/include.ts"(){"use strict";Mt(),Zs(),Ur=[Tt(!1)],ee=class extends(Dr=_t){get type(){return"include"}constructor(t,e="",s,r,i,n){super(t,e,s!=null?s:"",s===void 0||r!=null?r:"",i,n)}toString(t){return t?"":super.toString()}lint(t=this.getAbsoluteIndex()){}},ts=q(Dr),ee=B(ts,0,"IncludeToken",Ur,ee),O(ts,1,ee)}}),Be,tr=m({"mixin/attributesParent.ts"(){"use strict";Be=(t=0)=>e=>{var r,xn;class s extends e{constructor(){super(...arguments);k(this,r)}hasAttr(l){this.lspError("AttributesParent.hasAttr")}getAttr(l){return E(this,r,xn).call(this).getAttr(l)}}return r=new WeakSet,xn=function(){return this.childNodes[t]},s}}}),K,es,ss,rs,zr,is,Qt,Hr,Gr,Vr,_e,ns,rt,fn,mn,vn,cl=m({"util/sharable.ts"(){"use strict";K=new Set(["align"]),es=new Set(["cite"]),ss=new Set(["cite","datetime"]),rs=new Set(["width"]),zr=new Set(["axis","align","bgcolor","height","width","valign"]),is=new Set([...zr,"abbr","headers","scope","rowspan","colspan"]),Qt=new Set(["type"]),Hr=new Set(["summary","align","bgcolor","cellpadding","cellspacing","frame","rules","width"]),Gr=new Set(["clear"]),Vr=new Set(["bgcolor","align","valign"]),_e=new Set(["qid","forcemathmode","type","display"]),ns=new Set(["enclose","inline","lang","line","linelinks","style","class","id","dir","copy","highlight","start"]),rt=new Set,fn=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"]),mn={div:K,h1:K,h2:K,h3:K,h4:K,h5:K,h6:K,blockquote:es,q:es,p:K,br:Gr,pre:rs,ins:ss,del:ss,ul:Qt,ol:new Set(["type","start","reversed"]),li:new Set(["type","value"]),table:new Set([...Hr,"border"]),caption:K,tr:Vr,td:is,th:is,font:new Set(["size","color","face"]),hr:rs,data:new Set(["value"]),time:new Set(["datetime"]),meta:new Set(["itemprop","content"]),link:new Set(["itemprop","href","title"]),gallery:Qt,poem:K,categorytree:K,combooption:K,math:rt,chem:rt,ce:rt,img:new Set(["alt","src","width","height","loading","srcset"])},vn={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:rt,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:rt,inputbox:rt,templatestyles:new Set(["src","wrapper"]),dynamicpagelist:rt,poll:new Set(["id","show-results-before-voting"]),sm2:Qt,flashmp3:Qt,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([..._e,"chem"]),chem:_e,ce:_e,hiero:rt,phonos:new Set(["ipa","class","text","lang","wikibase","file"]),section:new Set(["begin","end"]),source:ns,syntaxhighlight:ns,templatedata:rt,timeline:new Set(["method","font"]),quiz:new Set(["display","shuffleanswers","points","shuffle","case"]),languages:rt}}}),Qr,Xr,Jr,Kr,Ds,gl=m({"src/attribute.ts"(){"use strict";var t,e,s,r,i,bn,a;fe(),G(),ft(),cl(),Q(),F(),vt(),Qr=/expression|(?:accelerator|-o-link(?:-source)?|-o-replace)\s*:|(?:url|src|image(?:-set)?)\s*\(|attr\s*\([^)]+[\s,]url/u,Xr=/(?:^|\s|\*\/)(?:javascript|vbscript)(?:\W|$)/iu,Jr=new Set(["ext","arg","magic-word","template"]),Kr=new Set(["about","property","resource","datatype","typeof","itemid","itemprop","itemref","itemscope","itemtype"]),Ds=(a=class extends I{constructor(o,d,h,u="",x,c=[],g=U.getConfig(),v=[]){const A=new V(h,"attr-key",g,v);let _;if(h==="title"||d==="img"&&h==="alt")_=new I(x,g,v,{}),_.type="attr-value",_.setAttribute("stage",tt-1);else if(d==="gallery"&&h==="caption"||d==="choose"&&(h==="before"||h==="after")){const S={...g,excludes:[...g.excludes,"heading","html","table","hr","list"]};_=new I(x,S,v,{}),_.type="attr-value",_.setAttribute("stage",1)}else _=new V(x,"attr-value",g,v,{});super(void 0,g,v);k(this,i);k(this,t);k(this,e);k(this,s);k(this,r);C(this,t,o),this.append(A,_),C(this,s,u),C(this,r,[...c]),C(this,e,d),this.setAttribute("name",Ot(J(h)))}get type(){return p(this,t)}get tag(){return p(this,e)}get balanced(){return!p(this,s)||p(this,r)[0]===p(this,r)[1]}afterBuild(){p(this,s).includes("\0")&&C(this,s,this.buildFromStr(p(this,s),0)),this.parentNode&&C(this,e,this.parentNode.name),this.setAttribute("name",Ot(this.firstChild.text())),super.afterBuild()}toString(o){const[d="",h=""]=p(this,r);return p(this,s)?super.toString(o,p(this,s)+d)+h:this.firstChild.toString(o)}text(){return p(this,s)?`${super.text(`${p(this,s).trim()}"`)}"`:this.firstChild.text()}getGaps(){var o,d;return p(this,s)?p(this,s).length+((d=(o=p(this,r)[0])==null?void 0:o.length)!=null?d:0):0}lint(o=this.getAbsoluteIndex(),d){}getValue(){return p(this,s)?this.lastChild.text().trim():this.type==="ext-attr"||""}escape(){}getAttribute(o){return o==="invalid"?E(this,i,bn).call(this):super.getAttribute(o)}print(){const[o="",d=""]=p(this,r);return p(this,s)?super.print({sep:ce(p(this,s))+o,post:d}):super.print()}json(o,d=this.getAbsoluteIndex()){const h=super.json(void 0,d)}},t=new WeakMap,e=new WeakMap,s=new WeakMap,r=new WeakMap,i=new WeakSet,bn=function(o,d){const{firstChild:h,lastChild:u,type:x,name:c,tag:g,parentNode:v}=this,A=!u.childNodes.some(({type:b})=>Jr.has(b)),_=this.getValue(),S=vn[g],T=mn[g],{length:w}=this.toString();let N="illegal-attr",j,f;if(!(S!=null&&S.has(c))&&!(T!=null&&T.has(c))&&(x==="ext-attr"?S||T:!/\{\{[^{]+\}\}/u.test(c))&&(x==="ext-attr"&&!T||!/^(?:xmlns:[\w:.-]+|data-(?!ooui|mw|parsoid)[^:]*)$/u.test(c)&&(g==="meta"||g==="link"||!fn.has(c)))||(c==="itemtype"||c==="itemid"||c==="itemref")&&!(v!=null&&v.hasAttr("itemscope"))){if(o===void 0)return!0}else if(c==="style"&&typeof _=="string"&&Qr.test(_)){if(o===void 0)return!0}else if(c==="tabindex"&&typeof _=="string"&&_!=="0"){if(o===void 0)return!0}else if(typeof _=="string"&&((/^xmlns:[\w:.-]+$/u.test(c)||Kr.has(c))&&Xr.test(_)||A&&(c==="href"||g==="img"&&c==="src")&&!new RegExp(String.raw`^(?:${this.getAttribute("config").protocol}|//)\S+$`,"iu").test(_))){if(o===void 0)return!0}else if(A&&x!=="ext-attr"){const b=rn(g,c),$=String(_).toLowerCase();if(b.length>0&&b.every(y=>y!==$)&&o===void 0)return!0}return!1},a)}}),as,Yr,qe,er=m({"src/attributes.ts"(){"use strict";var t,e,zs,r;G(),F(),vt(),gl(),as=i=>i.slice(0,-1),Yr=i=>`${as(i)}-dirty`,qe=(r=class extends I{constructor(n,a,l,o,d=[]){super(void 0,o,d,{});k(this,e);k(this,t);if(C(this,t,a),this.setAttribute("name",l),n){const h=/([^\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 u="",x=h.exec(n),c=0;const g=()=>{u&&(super.insertAt(new V(u,Yr(a),o,d,{})),u="")};for(;x;){const{index:v,0:A,1:_,2:S,3:T,4:w,5:N,6:j}=x;if(u+=n.slice(c,v),/^(?:[\w:]|\0\d+t\x7F)(?:[\w:.-]|\0\d+t\x7F)*$/u.test(J(_).trim())){const f=w!=null?w:j,b=[T,N],$=new Ds(as(a),l,_,S,f,b,o,d);g(),super.insertAt($)}else u+=A;({lastIndex:c}=h),x=h.exec(n)}u+=n.slice(c),g()}}get type(){return p(this,t)}afterBuild(){const{parentNode:n}=this;n!=null&&n.is("td")&&this.setAttribute("name",n.subtype),super.afterBuild()}getAttrTokens(n){return this.childNodes.filter(a=>a instanceof Ds&&(!n||a.name===Ot(n)))}hasAttr(n){return this.getAttrTokens(n).length>0}getAttrToken(n){const a=this.getAttrTokens(n);return a[a.length-1]}getAttr(n){var a;return(a=this.getAttrToken(n))==null?void 0:a.getValue()}lint(n=this.getAbsoluteIndex(),a){}getAttribute(n){return n==="invalid"?E(this,e,zs).call(this):super.getAttribute(n)}print(){return this.toString()?`<span class="wpb-${this.type}${E(this,e,zs).call(this)?" wpb-invalid":""}">${this.childNodes.map(n=>n.print(n instanceof V?{class:n.toString().trim()&&"attr-dirty"}:void 0)).join("")}</span>`:""}},t=new WeakMap,e=new WeakSet,zs=function(){const{parentNode:n}=this;return(n==null?void 0:n.type)==="html"&&n.closing&&this.text().trim()!==""},r)}}),wn={};M(wn,{PreToken:()=>_n});var _n,xl=m({"src/pre.ts"(){"use strict";ft(),F(),bt(),_n=class extends I{get type(){return"ext-inner"}constructor(t,e,s=[]){if(t){const r=/<nowiki>/giu,i=/<\/nowiki>/giu,{length:n}=r.source;let a=r.exec(t);a&&(i.lastIndex=a.index+n);let l=i.exec(t),o=0,d="";for(;a&&l;)new z(a[0],e,s),new z(l[0],e,s),d+=`${t.slice(o,a.index)}\0${s.length-1}n${t.slice(a.index+n,l.index)}\0${s.length}n`,o=l.index+n+1,r.lastIndex=o,a=r.exec(t),a&&(i.lastIndex=a.index+n),l=i.exec(t);t=d+t.slice(o)}super(t,e,s,{}),this.setAttribute("stage",tt-1)}isPlain(){return!0}lint(t=this.getAbsoluteIndex()){}}}}),We,sr=m({"mixin/multiLine.ts"(){"use strict";We=t=>{class e extends t{toString(r){return super.toString(r,` `)}text(){return super.text(` `).replace(/\n\s*\n/gu,` `)}getGaps(){return 1}print(){return super.print({sep:` `})}}return e}}}),An={};M(An,{ParamTagToken:()=>Nt});var Zr,ls,ti,Nt,yn=m({"src/paramTag/index.ts"(){"use strict";Ue(),sr(),Q(),F(),vt(),Zr=[We],Nt=class extends(ti=I){get type(){return"ext-inner"}constructor(t,e,s=U.getConfig(),r=[],i){if(super(void 0,s,r,{}),e){const n=V;this.append(...e.split(` `).map(a=>i?a:ve(a,s,r,t)).map(a=>new n(a,"param-line",s,r,{})))}r.splice(r.indexOf(this),1),r.push(this)}lint(t=this.getAbsoluteIndex()){}},ls=q(ti),Nt=B(ls,0,"ParamTagToken",Zr,Nt),O(ls,1,Nt)}}),ei,os,si,Ft,Sn=m({"src/heading.ts"(){"use strict";var t,e,Ce,r;ot(),F(),Ut(),ei=[at],Ft=(r=class extends(si=I){constructor(n,a,l,o=[]){super(void 0,l,o);k(this,e);k(this,t);C(this,t,n);const d=new I(a[0],l,o);d.type="heading-title",d.setAttribute("stage",2);const h=new $t(a[1],"heading-trail",l,o);this.append(d,h)}get type(){return"heading"}get level(){return p(this,t)}toString(n){const a=E(this,e,Ce).call(this);return a+this.firstChild.toString(n)+a+this.lastChild.toString(n)}text(){const n=E(this,e,Ce).call(this);return n+this.firstChild.text()+n}getAttribute(n){return n==="invalid"?this.inHtmlAttrs()===2:n==="padding"?this.level:super.getAttribute(n)}getGaps(){return this.level}lint(n=this.getAbsoluteIndex(),a){}print(){const n=E(this,e,Ce).call(this);return super.print({pre:n,sep:n})}json(n,a=this.getAbsoluteIndex()){const l=super.json(void 0,a)}},t=new WeakMap,e=new WeakSet,Ce=function(){return"=".repeat(this.level)},r),os=q(si),Ft=B(os,0,"HeadingToken",ei,Ft),O(os,1,Ft)}}),Tn,fl=m({"src/parameter.ts"(){"use strict";F(),Tn=class extends I{get type(){return"parameter"}get anon(){return this.firstChild.length===0}get duplicated(){}constructor(t,e,s,r=[]){super(void 0,s,r);const i=new I(typeof t=="number"?void 0:t,s,r,{}),n=new I(e,s,r);i.type="parameter-key",i.setAttribute("stage",2),n.type="parameter-value",n.setAttribute("stage",2),this.append(i,n)}trimName(t,e=!0){const s=(typeof t=="string"?t:t.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:t,firstChild:e}=this,s=this.trimName(e);t&&t.getArgs(s,!1,!1).add(this)}super.afterBuild()}toString(t){return this.anon?this.lastChild.toString(t):super.toString(t,"=")}text(){return this.anon?this.lastChild.text():super.text("=")}getGaps(){return this.anon?0:1}lint(t=this.getAbsoluteIndex(),e){}print(){return super.print({sep:this.anon?"":"="})}json(t,e=this.getAbsoluteIndex()){const s=super.json(void 0,e)}}}}),ri,hs,ii,Lt,ml=m({"src/transclude.ts"(){"use strict";var t,e,s,r,i,n,Hs,$n,o;G(),ut(),Oe(),ot(),F(),fl(),vt(),Ut(),ri=[at,me()],Lt=(o=class extends(ii=I){constructor(h,u,x,c=[]){var y,W;let g;const v=/^(?:\s|\0\d+[cn]\x7F)*\0(\d+)h\x7F(?:\s|\0\d+[cn]\x7F)*/u.exec(h);v&&(g=Number(v[1]),h=h.replace(`\0${g}h`,c[g].toString().replace(/^\n/u,"")));super(void 0,x,c,{});k(this,n);lt(this,"modifier","");k(this,t,"template");k(this,e,":");k(this,s,!1);k(this,r,new Map);k(this,i);const{parserFunction:[A,_],variable:S,functionHook:T}=x,w=(y=/^(?:\s|\0\d+[cn]\x7F)*\0\d+s\x7F/u.exec(h))==null?void 0:y[0];if(w)this.setAttribute("modifier",w),h=h.slice(w.length);else if(h.includes(":")){const[P,...L]=h.split(":"),[H]=/^(?:\s|\0\d+[cn]\x7F)*/u.exec((W=L[0])!=null?W:"");this.setModifier(`${P}:${H}`)&&(h=L.join(":").slice(H.length))}const N=h.search(/[::]/u),j=h[N]===":",f=N!==-1;if(f||u.length===0&&!p(this,s)){const P=f?h.slice(0,N):h,L=f&&h.slice(N+1),H=J(P),X=f?H.slice(H.search(/\S/u))+(j?":":""):H.trim(),Ct=X.toLowerCase(),dt=Array.isArray(_),st=dt?_.includes(X):Object.prototype.hasOwnProperty.call(_,X),pt=!dt&&st?_[X]:Object.prototype.hasOwnProperty.call(A,Ct)&&A[Ct],De=dt&&st||!("functionHook"in x)||T.includes(pt),Ua=dt&&st||S.includes(pt);if(f?pt&&De:Ua){this.setAttribute("name",pt||Ct.replace(/^#|:$/u,"")),C(this,t,"magic-word"),j&&C(this,e,":");const Da=new $t(P,"magic-word-name",x,c);if(super.insertAt(Da),L!==!1&&u.unshift([L]),this.name==="invoke")for(let ze=0;ze<2;ze++){const xr=u.shift();if(!xr)break;const za=new V(xr.join("="),`invoke-${ze?"function":"module"}`,x,c);super.insertAt(za)}}}if(this.type==="template"){const P=J(h).trim();if(!this.normalizeTitle(P,10,{halfParsed:!0,temporary:!0}).valid)throw c.pop(),new SyntaxError("Invalid template name");const L=new V(h,"template-name",x,c,{});super.insertAt(L)}typeof g=="number"&&(c[g]=void 0);const b=this.isTemplate();let $=1;for(let P=0;P<u.length;P++){const L=u[P];b||this.name==="switch"&&P>0||this.name==="tag"&&P>1||(L[0]=L.join("="),L.length=1),L.length===1&&(L.unshift($),$++),this.insertAt(new Tn(...L,x,c))}this.seal("modifier")}get type(){return p(this,t)}get module(){}get function(){}setModifier(h){const{parserFunction:[,,u,x]}=this.getAttribute("config"),c=J(h).trim();if(h&&!c.endsWith(":"))return!1;const g=c.slice(0,-1).toLowerCase(),v=u.includes(g),A=x.includes(g);return p(this,s)&&v||!p(this,s)&&(A||!h)||(et.running||this.length>1)&&(v||A||!h)?(this.setAttribute("modifier",h),C(this,s,v),!!h):!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"&&(C(this,i,E(this,n,Hs).call(this)),this.setAttribute("name",p(this,i).title))}toString(h){const{childNodes:u,length:x,firstChild:c,modifier:g,type:v}=this;return`{{${g}${v==="magic-word"?c.toString(h)+(x===1?"":p(this,e))+u.slice(1).map(A=>A.toString(h)).join("|"):super.toString(h,"|")}}}`}text(){const{childNodes:h,length:u,firstChild:x,modifier:c,type:g,name:v}=this;return g==="magic-word"&&v==="vardefine"?"":`{{${c}${g==="magic-word"?x.text()+(u===1?"":p(this,e))+St(h.slice(1),"|"):super.text("|")}}}`}getAttribute(h){switch(h){case"padding":return this.modifier.length+2;case"title":return p(this,i);case"colon":return p(this,e);case"invalid":return this.type==="magic-word"&&this.name==="invoke"&&(this.length===2||!E(this,n,Hs).call(this).valid);default:return super.getAttribute(h)}}lint(h=this.getAbsoluteIndex(),u){}insertAt(h,u=this.length){return super.insertAt(h,u),h.anon?E(this,n,$n).call(this,h):h.name&&this.getArgs(h.name,!1,!1).add(h),h}getAllArgs(){return this.childNodes.filter(cr("parameter"))}getAnonArgs(){return this.getAllArgs().filter(({anon:h})=>h)}getArgs(h,u,x=!0){const c=String(h).replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu,"$1");let g;return p(this,r).has(c)?g=p(this,r).get(c):(g=new Set(this.getAllArgs().filter(({name:v})=>c===v)),p(this,r).set(c,g)),g}getDuplicatedArgs(){return[...p(this,r)].filter(([,{size:h}])=>h>1).map(([h,u])=>[h,[...u]])}getPossibleValues(){const{type:h,name:u,childNodes:x}=this;if(h==="template")throw new Error("TranscludeToken.getPossibleValues method is only for specific magic words!");let c,g;switch(u){case"if":case"ifexist":case"ifexpr":case"iferror":c=2;break;case"ifeq":c=3;break;case"switch":{const v=x.slice(2),A=v[v.length-1];g=[...v.filter(({anon:_})=>!_),...A!=null&&A.anon?[A]:[]].map(({lastChild:_})=>_);break}default:throw new Error("TranscludeToken.getPossibleValues method is only for specific magic words!")}g!=null||(g=x.slice(c,c+2).map(({lastChild:v})=>v));for(let v=0;v<g.length;){const{length:A,0:_}=g[v].childNodes.filter(S=>S.text().trim());if(A===0)g.splice(v,1);else if(A>1||_.type!=="magic-word")v++;else try{const S=_.getPossibleValues();g.splice(v,1,...S),v+=S.length}catch{v++}}return g}print(){const{childNodes:h,length:u,firstChild:x,modifier:c,type:g}=this;return`<span class="wpb-${g}${this.getAttribute("invalid")?" wpb-invalid":""}">{{${g==="magic-word"?ce(c)+x.print()+(u===1?"":p(this,e))+Bt(h.slice(1),{sep:"|"}):(c?`<span class="wpb-magic-word">${ce(c)}</span>`:"")+Bt(h,{sep:"|"})}}}</span>`}},t=new WeakMap,e=new WeakMap,s=new WeakMap,r=new WeakMap,i=new WeakMap,n=new WeakSet,Hs=function(){const h=this.type==="template";return this.normalizeTitle(this.childNodes[h?0:1].text(),h?10:828,{temporary:!0})},$n=function(h){const u=this.getAnonArgs(),x=typeof h!="number";for(let c=x?u.indexOf(h):h-1;c<u.length;c++){const g=u[c],{name:v}=g,A=String(c+1);(v!==A||g===h)&&(g.setAttribute("name",A),this.getArgs(A,!1,!1).add(g))}},o),hs=q(ii),Lt=B(hs,0,"TranscludeToken",ri,Lt),O(hs,1,Lt)}}),ni,us,ai,se,vl=m({"src/hidden.ts"(){"use strict";Mt(),F(),ni=[Tt()],se=class extends(ai=I){get type(){return"hidden"}getAttribute(t){return t==="invalid"||super.getAttribute(t)}},us=q(ai),se=B(us,0,"HiddenToken",ni,se),O(us,1,se)}}),li,ds,oi,re,bl=m({"src/arg.ts"(){"use strict";var t,wl,s;G(),mt(),Oe(),ot(),F(),vt(),vl(),li=[at,ht("{{{"),me()],re=(s=class extends(oi=I){constructor(i,n,a=[]){super(void 0,n,a,{});k(this,t);for(let l=0;l<i.length;l++){const o=i[l];if(l===0){const d=new V(o,"arg-name",n,a,{});super.insertAt(d)}else if(l>1){const d=new se(o,n,a);super.insertAt(d)}else{const d=new I(o,n,a);d.type="arg-default",d.setAttribute("stage",2),super.insertAt(d)}}}get type(){return"arg"}get default(){}toString(i){return`{{{${super.toString(i,"|")}}}}`}text(){return`{{{${St(this.childNodes.slice(0,2),"|")}}}}`}afterBuild(){super.afterBuild()}lint(i=this.getAbsoluteIndex(),n){}print(){return super.print({pre:"{{{",post:"}}}",sep:"|"})}json(i,n=this.getAbsoluteIndex()){const a=super.json(void 0,n)}},t=new WeakSet,wl=function(){},s),ds=q(oi),re=B(ds,0,"ArgToken",li,re),O(ds,1,re)}}),kn={};M(kn,{parseBraces:()=>Me});var hi,ps,Ae,cs,gs,xs,ui,fs,Me,rr=m({"parser/braces.ts"(){"use strict";xe(),G(),Sn(),ml(),bl(),hi={"=":String.raw`\n(?!(?:[^\S\n]|\0\d+[cn]\x7F)*\n)`,"{":String.raw`\}{2,}|\|`,"-":String.raw`\}-`,"[":String.raw`\]\]`},ps=String.raw`\[(?!\[)`,Ae=String.raw`\n(?![=\0])`,cs=String.raw`|\{{2,}`,gs=new Map([["!","!"],["!!","+"],["(!","{"],["!)","}"],["!-","-"],["=","~"],["server","m"]]),xs=ue(t=>new RegExp(t,"gmu")),ui=new RegExp(String.raw`\{\{((?:[^\n{}[]|${ps}|${Ae})*)\}\}(?!\})`+"|"+String.raw`\[\[(?:[^\n[\]{]|${Ae})*\]\]`+"|"+String.raw`-\{(?:[^\n{}[]|${ps}|${Ae})*\}-`,"gu"),fs=t=>{const e=Ot(J(t));return gs.has(e)?gs.get(e):/^(?:filepath|(?:full|canonical)urle?):./u.test(e)?"m":/^#vardefine:./u.test(e)?"n":"t"},Me=(t,e,s)=>{var g,v,A,_,S;const r=String.raw`${e.excludes.includes("heading")?"":String.raw`^((?:\0\d+[cno]\x7F)*)={1,6}|`}\[\[|-\{(?!\{)`,{parserFunction:[,,,i]}=e,n=[],a=[],l=(T,w,N,j)=>{w[w.length-1].push(Z(T.slice(N,j),a))};let o;do o!==void 0&&(t=o),o=t.replace(ui,(T,w,N)=>{if(w!==void 0||typeof N=="string")try{const{length:j}=s,f=(w!=null?w:N).split("|");return new Lt(Z(f[0],a),f.slice(1).map(b=>{const $=b.indexOf("=");return($===-1?[b]:[b.slice(0,$),b.slice($+1)]).map(y=>Z(y,a))}),e,s),`\0${j}${fs(f[0])}`}catch(j){if(!(j instanceof SyntaxError)||j.message!=="Invalid template name")throw j}return a.push(Z(T,a)),`\0${a.length-1}`});while(o!==t);t=o;const d=t.lastIndexOf("}}")-t.length;let h=d+t.length!==-1,u=xs(r+(h?cs:"")),x=u.exec(t),c;for(;x||c!==void 0&&c<=t.length&&((v=(g=n[n.length-1])==null?void 0:g[0])!=null&&v.startsWith("="));){if(x!=null&&x[1]){const[,{length:L}]=x;x[0]=x[0].slice(L),x.index+=L}const{0:T,index:w}=x!=null?x:{0:` `,index:t.length},N=(A=n.pop())!=null?A:{},{0:j,index:f,parts:b,findEqual:$,pos:y}=N,W=T==="="&&$;if(T==="]]"||T==="}-")c=w+2;else if(T===` `){c=w+1;const{pos:L,findEqual:H}=(_=n[n.length-1])!=null?_:{};if(L===void 0||H||J(t.slice(L,f))!==""){const X=/^(={1,6})(.+)\1((?:\s|\0\d+[cn]\x7F)*)$/u.exec(t.slice(f,w));X&&(X[2]=Z(X[2],a),X[2].includes(` `)||(t=`${t.slice(0,f)}\0${s.length}h${t.slice(w)}`,c=f+4+String(s.length).length,new Ft(X[1].length,X.slice(2),e,s)))}}else if(T==="|"||W)c=w+1,l(t,b,y,w),T==="|"&&b.push([]),N.pos=c,N.findEqual=T==="|",n.push(N);else if(T.startsWith("}}")){const L=T.slice(0,Math.min(j.length,3)),H=j.length-L.length,{length:X}=s;c=w+L.length,l(t,b,y,w);let Ct=!1,dt="t";if(L.length===3){const st=b.map(De=>De.join("=")),pt=st.length>1&&J(st[1]).trim();new re(st,e,s),pt&&pt.endsWith(":")&&i.includes(pt.slice(0,-1).toLowerCase())&&(dt="s")}else try{new Lt(b[0][0],b.slice(1),e,s),dt=fs(b[0][0])}catch(st){if(st instanceof SyntaxError&&st.message==="Invalid template name")Ct=!0;else throw st}Ct||(t=`${t.slice(0,f+H)}\0${X}${dt}${t.slice(c)}`,c=f+H+3+String(X).length,H>1?n.push({0:j.slice(0,H),index:f,pos:f+H,parts:[[]]}):H===1&&t[f-1]==="-"&&n.push({0:"-{",index:f-1,pos:f+1,parts:[[]]}))}else c=w+T.length,T.startsWith("{")&&(x.pos=c,x.parts=[[]]),n.push(..."0"in N?[N]:[],x);let P=n[n.length-1];if(h&&d+t.length<c)for(h=!1;(S=P==null?void 0:P[0])!=null&&S.startsWith("{");)n.pop(),P=n[n.length-1];u=xs(r+(h?cs:"")+(P?`|${hi[P[0][0]]}${P.findEqual?"|=":""}`:"")),u.lastIndex=c,x=u.exec(t)}return Z(t,a)}}}),Cn={};M(Cn,{InputboxToken:()=>In});var In,_l=m({"src/paramTag/inputbox.ts"(){"use strict";Ue(),rr(),Q(),yn(),In=class extends Nt{constructor(t,e,s=U.getConfig(),r=[]){const i=Symbol("InputboxToken"),n=s.excludes.includes("heading")?s:{...s,excludes:[...s.excludes,"heading"]},{length:a}=r;r.push(i),e&&(e=ve(e,n,r,t)),e&&(e=Me(e,n,r)),r.splice(a,1),super(t,e,n,r,{})}}}}),Ie={};M(Ie,{NestedToken:()=>Nn});var Nn,ms=m({"src/nested.ts"(){"use strict";var t,e,s;Ue(),rr(),F(),Jn(),bt(),Nn=(s=class extends I{constructor(i,n,a,l,o=[]){if(typeof n=="boolean"){const d=Symbol("NestedToken"),{length:h}=o;o.push(d),i&&(i=ve(i,l,o,n)),i&&(i=Me(i,l,o)),o.splice(h,1)}else i&&(i=i.replace(n,(d,h,u,x,c)=>{const g=`\0${o.length+1}e`;return new Rt(h,u,x,c,l,!1,o),g}));i&&(i=i.replace(/(^|\0\d+.\x7F)([^\0]+)(?=$|\0\d+.\x7F)/gu,(d,h,u)=>(new z(u,l,o),`${h}\0${o.length}n`)));super(i,l,o);k(this,t);k(this,e);C(this,t,[...a]),C(this,e,n)}get type(){return"ext-inner"}lint(i=this.getAbsoluteIndex(),n){}},t=new WeakMap,e=new WeakMap,s)}});function di(t,e,s,r,i){e=J(e).trim();let n=e.replace(t==="link"?/\0\d+[tq]\x7F/gu:/\0\d+t\x7F/gu,"").trim();switch(t){case"width":return!n&&!!e||/^(?:\d+x?|\d*x\d+)(?:\s*px)?$/u.test(n);case"link":{if(n){if(Fn(s.protocol).test(n))return Ln(s.protocol).test(n)&&e;n.startsWith("[[")&&n.endsWith("]]")&&(n=n.slice(2,-2))}else return e;const a=U.normalizeTitle(n,0,!1,s,{halfParsed:r,decode:!0,selfLink:!0});return a.valid&&a}case"lang":return(i==="svg"||i==="svgz")&&!/[^a-z\d-]/u.test(n);case"alt":case"class":case"manualthumb":return!0;case"page":return(i==="djvu"||i==="djv"||i==="pdf")&&Number(n)>0;default:return!!n&&!isNaN(n)}}var Fn,Ln,pi,ci,En,Al=m({"src/imageParameter.ts"(){"use strict";var t,e,Pn,i;xe(),G(),ft(),Q(),F(),Fn=ue(n=>new RegExp(String.raw`^(?:${n}|//|\0\d+m\x7F)`,"iu")),Ln=ue(n=>new RegExp(String.raw`^(?:(?:${n}|//)${de}|\0\d+m\x7F)${pe}$`,"iu")),pi=ue(n=>new RegExp(String.raw`^(\s*(?!\s))${n.replace("$1","(.*)")}${n.endsWith("$1")?`(?=$| )`:""}(\s*)$`,"u")),ci=new Set(["alt","link","lang","page","caption"]),En=(i=class extends I{constructor(a,l,o,d){var n=(...r)=>(super(...r),k(this,e),k(this,t,""),this);let h;const u=Object.entries(o.img).map(([c,g])=>[c,g,pi(c)]),x=u.find(([,c,g])=>(h=g.exec(a),h&&(h.length!==4||di(c,h[2],o,!0,l)!==!1)));if(x&&h){h.length===3?(n(void 0,o,d),C(this,t,a)):(n(h[2],o,d,{}),C(this,t,h[1]+x[0]+h[3])),this.setAttribute("name",x[1]),x[1]==="alt"&&this.setAttribute("stage",tt-1);return}n(a,o.excludes.includes("list")?o:{...o,excludes:[...o.excludes,"list"]},d),this.setAttribute("name","caption"),this.setAttribute("stage",7)}get type(){return"image-parameter"}get link(){return this.name==="link"?di("link",super.text(),this.getAttribute("config")):void 0}afterBuild(){var a;(a=this.parentNode)!=null&&a.is("gallery-image")&&!ci.has(this.name)&&this.setAttribute("name","invalid"),super.afterBuild()}toString(a){return p(this,t)?p(this,t).replace("$1",super.toString(a)):super.toString(a)}text(){return p(this,t)?p(this,t).replace("$1",super.text()).trim():super.text().trim()}isPlain(){return this.name==="caption"||this.name==="alt"}getAttribute(a){return a==="invalid"?this.name==="invalid":a==="padding"?Math.max(0,p(this,t).indexOf("$1")):super.getAttribute(a)}lint(a=this.getAbsoluteIndex(),l){}getValue(){return this.name==="invalid"?this.text():E(this,e,Pn).call(this)||super.text()}print(){return p(this,t)?`<span class="wpb-image-parameter${this.name==="invalid"?" wpb-invalid":""}">${p(this,t).replace("$1",`<span class="wpb-image-caption">${Bt(this.childNodes)}</span>`)}</span>`:super.print({class:"image-caption"})}},t=new WeakMap,e=new WeakSet,Pn=function(){return p(this,t)&&!p(this,t).includes("$1")},i)}}),gi,ir,jn=m({"src/link/file.ts"(){"use strict";Re(),Al(),gi=t=>{if(t===void 0)return[];const e=/-\{|\}-|\|/gu,s=[];let r=e.exec(t),i=0,n=0;for(;r;){const{0:a,index:l}=r;a!=="|"?i+=a==="-{"?1:-1:i===0&&(s.push(t.slice(n,l)),{lastIndex:n}=e),r=e.exec(t)}return s.push(t.slice(n)),s},ir=class extends xt{get type(){return"file"}get extension(){}constructor(t,e,s,r=[],i="|"){super(t,void 0,s,r,i);const{extension:n}=this.getTitle(!0,!0);this.safeAppend(gi(e).map(a=>new En(a,n,s,r)))}lint(t=this.getAbsoluteIndex(),e){}getAllArgs(){return this.childNodes.slice(1)}getArgs(t){return this.getAllArgs().filter(({name:e})=>t===e)}getArg(t){const e=this.getArgs(t);return e[t==="manualthumb"?0:e.length-1]}getValue(t){var e;return(e=this.getArg(t))==null?void 0:e.getValue()}json(t,e=this.getAbsoluteIndex()){const s=super.json(void 0,e)}}}}),xi,vs,fi,Et,Rn=m({"src/link/galleryImage.ts"(){"use strict";var t,On,s;ft(),mt(),F(),jn(),xi=[ht("")],Et=(s=class extends(fi=ir){constructor(i,n,a,l,o=[]){let d;if(a!==void 0){const{length:h}=o;d=new I(a,l,o);for(let u=0;u<tt-1;u++)d.parseOnce();o.splice(h,1)}super(n,d==null?void 0:d.toString(),l,o);k(this,t);lt(this,"privateType","imagemap-image");this.setAttribute("bracket",!1),this.privateType=`${i}-image`,this.seal("privateType",!0)}get type(){return this.privateType}getTitle(i){const n=this.type==="imagemap-image";return this.normalizeTitle(this.firstChild.toString(),n?0:6,{halfParsed:!0,temporary:i,decode:!n})}lint(i=this.getAbsoluteIndex(),n){}getAttribute(i){return i==="invalid"?E(this,t,On).call(this):super.getAttribute(i)}},t=new WeakSet,On=function(){const{ns:i}=this.getAttribute("title");return i!==6},s),vs=q(fi),Et=B(vs,0,"GalleryImageToken",xi,Et),O(vs,1,Et)}}),Bn={};M(Bn,{GalleryToken:()=>ie});var mi,bs,vi,ie,yl=m({"src/gallery.ts"(){"use strict";var t,qn,Sl,r;sr(),F(),Rn(),bt(),mi=[We],ie=(r=class extends(vi=I){constructor(n,a,l=[]){var o;super(void 0,a,l,{});k(this,t);for(const d of(o=n==null?void 0:n.split(` `))!=null?o:[]){const h=/^([^|]+)(?:\|(.*))?/u.exec(d);if(!h){super.insertAt(d.trim()?new z(d,a,l):d);continue}const[,u,x]=h;E(this,t,qn).call(this,u)?super.insertAt(new Et("gallery",u,x,a,l)):super.insertAt(new z(d,a,l))}}get type(){return"ext-inner"}get widths(){}get heights(){}lint(n=this.getAbsoluteIndex(),a){}json(n,a=this.getAbsoluteIndex()){const l=super.json(void 0,a)}},t=new WeakSet,qn=function(n){return this.normalizeTitle(n,6,{halfParsed:!0,temporary:!0,decode:!0}).valid},Sl=function(n){},r),bs=q(vi),ie=B(bs,0,"GalleryToken",mi,ie),O(bs,1,ie)}}),nr,Wn=m({"src/link/index.ts"(){"use strict";xe(),Re(),nr=class extends xt{get type(){return"link"}get innerText(){return this.length>1?this.lastChild.text():Le(this.firstChild.text().replace(/^\s*:?/u,""))}lint(t=this.getAbsoluteIndex(),e){}}}}),bi,wi,ge,ar=m({"src/magicLink.ts"(){"use strict";var t,e,Mn,r;G(),Q(