wikiparser-node 1.13.1 → 1.13.2
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.min.js +37 -0
- package/dist/addon/token.js +2 -2
- package/dist/base.d.ts +0 -1
- package/dist/index.js +5 -0
- package/dist/mixin/singleLine.d.ts +1 -0
- package/dist/mixin/singleLine.js +10 -2
- package/dist/parser/braces.js +5 -5
- package/dist/parser/commentAndExt.js +1 -1
- package/dist/parser/converter.js +4 -2
- package/dist/parser/externalLinks.js +2 -2
- package/dist/parser/hrAndDoubleUnderscore.js +2 -1
- package/dist/parser/links.js +4 -2
- package/dist/parser/magicLinks.js +2 -2
- package/dist/parser/redirect.js +2 -1
- package/dist/src/attributes.d.ts +12 -10
- package/dist/src/gallery.d.ts +8 -6
- package/dist/src/gallery.js +0 -1
- package/dist/src/imagemap.d.ts +8 -6
- package/dist/src/imagemap.js +1 -2
- package/dist/src/imagemapLink.js +1 -1
- package/dist/src/index.d.ts +1 -2
- package/dist/src/index.js +1 -0
- package/dist/src/link/galleryImage.js +1 -1
- package/dist/src/nested.d.ts +10 -9
- package/dist/src/nested.js +28 -23
- package/dist/src/paramTag/index.d.ts +1 -1
- package/dist/src/paramTag/index.js +37 -20
- package/dist/src/paramTag/inputbox.d.ts +1 -1
- package/dist/src/paramTag/inputbox.js +5 -17
- package/dist/src/pre.d.ts +8 -6
- package/dist/src/pre.js +0 -1
- package/dist/src/table/base.js +1 -1
- package/dist/src/table/index.d.ts +1 -0
- package/dist/src/table/index.js +0 -1
- package/dist/src/tagPair/ext.d.ts +2 -1
- package/dist/src/tagPair/ext.js +8 -6
- package/dist/src/transclude.d.ts +8 -6
- package/dist/src/transclude.js +10 -1
- package/extensions/dist/base.js +163 -0
- package/extensions/dist/codejar.js +53 -0
- package/extensions/dist/editor.js +159 -0
- package/extensions/dist/highlight.js +30 -0
- package/extensions/dist/lint.js +72 -0
- package/extensions/editor.css +59 -0
- package/extensions/ui.css +162 -0
- package/package.json +8 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";(()=>{var Xs=Object.create;var at=Object.defineProperty;var On=Object.getOwnPropertyDescriptor;var Qs=Object.getOwnPropertyNames;var Zs=Object.prototype.hasOwnProperty;var Mn=(d,r)=>(r=Symbol[d])?r:Symbol.for("Symbol."+d),lt=d=>{throw TypeError(d)};var Ks=(d,r,e)=>r in d?at(d,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[r]=e;var _n=(d,r)=>at(d,"name",{value:r,configurable:!0});var b=(d,r)=>()=>(d&&(r=d(d=0)),r);var Js=(d,r)=>()=>(r||d((r={exports:{}}).exports,r),r.exports),se=(d,r)=>{for(var e in r)at(d,e,{get:r[e],enumerable:!0})},Ys=(d,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Qs(r))!Zs.call(d,n)&&n!==e&&at(d,n,{get:()=>r[n],enumerable:!(t=On(r,n))||t.enumerable});return d};var Z=d=>Ys(at({},"__esModule",{value:!0}),d);var le=d=>{var r;return[,,,Xs((r=d==null?void 0:d[Mn("metadata")])!=null?r:null)]},Gn=["class","method","getter","setter","accessor","field","value","get","set"],_t=d=>d!==void 0&&typeof d!="function"?lt("Function expected"):d,eo=(d,r,e,t,n)=>({kind:Gn[d],name:r,metadata:t,addInitializer:i=>e._?lt("Already initialized"):n.push(_t(i||null))}),de=(d,r,e,t)=>{for(var n=0,i=d[r>>1],s=i&&i.length;n<s;n++)r&1?i[n].call(e):t=i[n].call(e,t);return t},ge=(d,r,e,t,n,i)=>{var s,o,a,p,g,l=r&7,c=!!(r&8),h=!!(r&16),m=l>3?d.length+1:l?c?1:2:0,k=Gn[l+5],x=l>3&&(d[m-1]=[]),A=d[m]||(d[m]=[]),S=l&&(!h&&!c&&(n=n.prototype),l<5&&(l>3||!h)&&On(l<4?n:{get[e](){return u(this,i)},set[e](w){return v(this,i,w)}},e));l?h&&l<4&&_n(i,(l>2?"set ":l>1?"get ":"")+e):_n(n,e);for(var $=t.length-1;$>=0;$--)p=eo(l,e,a={},d[3],A),l&&(p.static=c,p.private=h,g=p.access={has:h?w=>to(n,w):w=>e in w},l^3&&(g.get=h?w=>(l^1?u:R)(w,n,l^4?i:S.get):w=>w[e]),l>2&&(g.set=h?(w,L)=>v(w,n,L,l^4?i:S.set):(w,L)=>w[e]=L)),o=(0,t[$])(l?l<4?h?i:S[k]:l>4?void 0:{get:S.get,set:S.set}:n,p),a._=1,l^4||o===void 0?_t(o)&&(l>4?x.unshift(o):l?h?i=o:S[k]=o:n=o):typeof o!="object"||o===null?lt("Object expected"):(_t(s=o.get)&&(S.get=s),_t(s=o.set)&&(S.set=s),_t(s=o.init)&&x.unshift(s));return l||(n[Mn("metadata")]=d[3]),S&&at(n,e,S),h?l^4?i:S:n},X=(d,r,e)=>Ks(d,typeof r!="symbol"?r+"":r,e),Vr=(d,r,e)=>r.has(d)||lt("Cannot "+e),to=(d,r)=>Object(r)!==r?lt('Cannot use the "in" operator on this value'):d.has(r),u=(d,r,e)=>(Vr(d,r,"read from private field"),e?e.call(d):r.get(d)),T=(d,r,e)=>r.has(d)?lt("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(d):r.set(d,e),v=(d,r,e,t)=>(Vr(d,r,"write to private field"),t?t.call(d,e):r.set(d,e),e),R=(d,r,e)=>(Vr(d,r,"access private method"),e);var lr=(d,r,e,t)=>({set _(n){v(d,r,n,e)},get _(){return u(d,r,t)}});var Xr,zn,Wn=b(()=>{"use strict";Xr={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};Object.setPrototypeOf(Xr,null);zn=["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"]});var Un,Ae,we,Ue,Dn,te,Hn,Qr,pe,ro,Ot,Vn,Xn,no,io,dt,Ne,K=b(()=>{"use strict";Un=String.raw`[^[\]<>"\0-\x1F\x7F\p{Zs}\uFFFD]`,Ae=String.raw`(?:\[[\da-f:.]+\]|${Un})`,we=String.raw`(?:${Un}|\0\d+[cn!~]\x7F)*`,Ue=(d,r)=>e=>e.replace(d,r),Dn=Ue(/[\0\x7F]|\r$/gmu,""),te=Ue(/\0\d+[cn]\x7F/gu,""),Hn=Ue(/[\\{}()|.?*+^$[\]]/gu,String.raw`\$&`),Qr=d=>decodeURIComponent(d.replace(/%(?![\da-f]{2})/giu,"%25")),pe=(d,r="")=>d.map(e=>typeof e=="string"?e:e.text()).join(r),ro={lt:"<",gt:">",lbrack:"[",rbrack:"]",lbrace:"{",rbrace:"}",nbsp:" ",amp:"&",quot:'"'},Ot=Ue(/&(?:#(\d+|[Xx][\da-fA-F]+)|([lLgG][tT]|[lr]brac[ke]|nbsp|amp|AMP|quot|QUOT));/gu,(d,r,e)=>r?String.fromCodePoint(+((/^x/iu.test(r)?"0":"")+r)):ro[e.toLowerCase()]),Vn=Ue(/&#(\d+|x[\da-f]+);/giu,(d,r)=>String.fromCodePoint(+((/^x/iu.test(r)?"0":"")+r))),Xn=Ue(/\n/gu,String.raw`\n`),no={"&":"amp","<":"lt",">":"gt",'"':"quot","\n":"#10"},io=d=>Ue(d,r=>`&${no[r]};`),dt=io(/[&<>]/gu),Ne=(d,r={})=>{let{pre:e="",post:t="",sep:n=""}=r;return e+d.map(i=>i.print()).join(n)+t}});var Qn=Js((ea,so)=>{so.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","828":"Module"},nsid:{file:6,category:14},parserFunction:[{"#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","#regex":"regex","#related":"related","#cscore":"cscore"},["!","=","#FORMAL","#timef","#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:|worldwind://|xmpp:",interwiki:[],img:{},redirection:["#redirect"],variants:[]}});var Zr,Se=b(()=>{"use strict";Zr=Qn()});var De,E,Q=b(()=>{"use strict";E=class{constructor(r,e){T(this,De);X(this,"token");X(this,"start");this.token=r,this.start=e}get top(){var r;return(r=u(this,De))!=null||v(this,De,this.getPosition()),u(this,De).top}get left(){var r;return(r=u(this,De))!=null||v(this,De,this.getPosition()),u(this,De).left}getPosition(){return this.token.getRootNode().posFromIndex(this.start)}};De=new WeakMap});var Zn,C,N,_=b(()=>{"use strict";Q();F();Zn=d=>(r,e,t,n,i="error")=>{let{start:s}=e,{top:o,left:a}=e instanceof E?e:new E(r,s),{offsetHeight:p,offsetWidth:g}=r,{startIndex:l,startLine:c,startCol:h}=d(r,s,o,a);return{rule:t,message:f.msg(n),severity:i,startIndex:l,endIndex:l+r.toString().length,startLine:c,endLine:c+p-1,startCol:h,endCol:p===1?h+g:g}},C=Zn((d,r,e,t)=>{let n=d.getRelativeIndex(),{top:i,left:s}=d.parentNode.posFromIndex(n);return{startIndex:r+n,startLine:e+i,startCol:i?s:t+s}}),N=Zn((d,r,e,t)=>({startIndex:r,startLine:e,startCol:t}))});var dr,Kn=b(()=>{"use strict";dr=(d,r,e)=>({type:t,name:n})=>d.split(",").some(i=>{let[s,...o]=i.trim().split("#");return(!s||s===t)&&o.every(a=>a===n)})});var Jn,Yn,Mt,Gt,Kr,gt,Jr=b(()=>{"use strict";Jn=d=>{let r=d.split(`
|
|
2
|
+
`),e=r.length;return{height:e,width:r[e-1].length}},Yn=(d,r)=>r.childNodes.slice(0,d).reduce((e,t,n)=>e+t.toString().length+r.getGaps(n),0)+r.getAttribute("padding"),gt=class{constructor(){T(this,Gt);X(this,"childNodes",[]);T(this,Mt)}get firstChild(){return this.childNodes[0]}get lastChild(){return this.childNodes[this.childNodes.length-1]}get parentNode(){return u(this,Mt)}get nextSibling(){var e;let r=(e=this.parentNode)==null?void 0:e.childNodes;return r&&r[r.indexOf(this)+1]}get previousSibling(){var e;let r=(e=this.parentNode)==null?void 0:e.childNodes;return r&&r[r.indexOf(this)-1]}get offsetHeight(){return R(this,Gt,Kr).call(this).height}get offsetWidth(){return R(this,Gt,Kr).call(this).width}getAttribute(r){return r==="padding"?0:this[r]}setAttribute(r,e){r==="parentNode"?v(this,Mt,e):this[r]=e}getRootNode(){let{parentNode:r}=this;for(;r!=null&&r.parentNode;)({parentNode:r}=r);return r!=null?r:this}posFromIndex(r){let e=String(this);if(r>=-e.length&&r<=e.length){let{height:t,width:n}=Jn(e.slice(0,r));return{top:t-1,left:n}}}getGaps(r){return 0}getRelativeIndex(r){if(r===void 0){let{parentNode:e}=this;return e?Yn(e.childNodes.indexOf(this),e):0}return Yn(r,this)}getAbsoluteIndex(){let{parentNode:r}=this;return r?r.getAbsoluteIndex()+this.getRelativeIndex():0}seal(r,e){Object.defineProperty(this,r,{enumerable:!e&&!!this[r],configurable:!0})}is(r){return this.type===r}};Mt=new WeakMap,Gt=new WeakSet,Kr=function(){return Jn(String(this))}});var Be,Yr,en,gr,ei=b(()=>{"use strict";K();be();Kn();Jr();gr=class extends gt{constructor(){super(...arguments);T(this,Be)}get length(){return this.childNodes.length}text(e){return pe(this.childNodes,e)}normalize(){let e=[...this.childNodes],t=n=>{e.splice(n,1)};for(let n=e.length-1;n>=0;n--){let{type:i,data:s}=e[n];i!=="text"||this.getGaps(n-1)||s===""&&t(n)}this.setAttribute("childNodes",e)}removeAt(e){return tn(this,e,1)[0]}insertAt(e,t=this.length){return tn(this,t,0,[e]),e}closest(e){let t=dr(e,this),{parentNode:n}=this;for(;n;){if(t(n))return n;({parentNode:n}=n)}}querySelector(e){let t=dr(e,this);return R(this,Be,Yr).call(this,t)}querySelectorAll(e){let t=dr(e,this);return R(this,Be,en).call(this,t)}append(...e){for(let t of e)this.insertAt(t)}replaceChildren(...e){for(let t=this.length-1;t>=0;t--)this.removeAt(t);this.append(...e)}setText(e,t=0){t+=t<0?this.length:0;let n=this.childNodes[t],{data:i}=n;return n.replaceData(e),i}toString(e,t=""){return this.childNodes.map(n=>n.toString(e)).join(t)}lint(e=this.getAbsoluteIndex(),t){let n=[];for(let i=0,s=e+this.getAttribute("padding");i<this.length;i++){let o=this.childNodes[i];n.push(...o.lint(s,t)),s+=o.toString().length+this.getGaps(i)}return n}print(e={}){let t=e.class;return this.toString()?`${t===""?"":`<span class="wpb-${t!=null?t:this.type}">`}${Ne(this.childNodes,e)}${t===""?"":"</span>"}`:""}json(e,t=this.getAbsoluteIndex()){let n={...this,type:this.type,range:[t,t+this.toString().length],childNodes:[]};for(let i=0,s=t+this.getAttribute("padding");i<this.length;i++){let o=this.childNodes[i],{length:a}=o.toString();n.childNodes.push(o.type==="text"?{data:o.data,range:[s,s+a]}:o.json(void 0,s)),s+=a+this.getGaps(i)}return n}};Be=new WeakSet,Yr=function(e){var t;for(let n of this.childNodes){if(n.type==="text")continue;if(e(n))return n;let i=R(t=n,Be,Yr).call(t,e);if(i)return i}},en=function(e){var n;let t=[];for(let i of this.childNodes)i.type!=="text"&&(e(i)&&t.push(i),t.push(...R(n=i,Be,en).call(n,e)));return t}});var ti,oo,ao,lo,go,po,uo,pr,ri,zt,ni=b(()=>{"use strict";K();F();Jr();ti=String.raw`<\s*(?:/\s*)?([a-z]\w*)|\{+|\}+|\[{2,}|\[(?![^[]*?\])|((?:^|\])[^[]*?)\]+`,oo=new RegExp(String.raw`${ti}|https?[:/]/+`,"giu"),ao=new RegExp(ti,"giu"),lo=new RegExp(String.raw`^https?://${Ae}${we}\.(?:gif|png|jpg|jpeg)$`,"iu"),go={"[":/[[\]]/u,"{":/[{}]/u,"]":/[[\]](?=[^[\]]*$)/u,"}":/[{}](?=[^{}]*$)/u},po={"<":"tag-like","[":"lonely-bracket","{":"lonely-bracket","]":"lonely-bracket","}":"lonely-bracket",h:"lonely-http"},uo=["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"],zt=class extends gt{constructor(e){super();T(this,pr);X(this,"data","");Object.defineProperties(this,{childNodes:{enumerable:!1,configurable:!1},data:{value:e}})}get type(){return"text"}toString(e){var t;return e&&!((t=this.parentNode)!=null&&t.getAttribute("built"))?te(this.data):this.data}text(){return this.data}lint(e=this.getAbsoluteIndex(),t){var B,j,q;if(t===!1)return[];let{data:n,parentNode:i,nextSibling:s,previousSibling:o}=this;if(!i)throw new Error("An isolated text node cannot be linted!");let{type:a,name:p,parentNode:g}=i,l=!1;if(a==="attr-value"){let{type:D,name:H,tag:ne}=g;if(D!=="ext-attr")l=!0;else if(ne==="choose"&&(H==="before"||H==="after"))return[]}if(t!=null||(t=a==="free-ext-link"||a==="ext-link-url"||a==="ext-link-text"||a==="image-parameter"&&p==="link"||l?ao:oo),n.search(t)===-1)return[];t.lastIndex=0;let c=[],h=s==null?void 0:s.type,m=s==null?void 0:s.name,k=o==null?void 0:o.type,x=this.getRootNode(),{ext:A,html:S}=x.getAttribute("config"),{top:$,left:w}=x.posFromIndex(e),L=new Set(["onlyinclude","noinclude","includeonly",A,S,uo].flat(2));for(let D=t.exec(n);D;D=t.exec(n)){let[,H,ne]=D,{0:ee,index:W}=D;if(ne&&ne!=="]"){let{length:ae}=ne;W+=ae,ee=ee.slice(ae)}let{0:I,length:xe}=ee;if(I==="<"&&!L.has(H.toLowerCase())||I==="["&&a==="ext-link-text"&&(/&(?:rbrack|#93|#x5[Dd];);/u.test(n.slice(W+1))||s!=null&&s.is("ext")&&m==="nowiki"&&((B=s.innerText)!=null&&B.includes("]"))))continue;if(I==="]"&&(W||xe>1))t.lastIndex--;else if(I==="h"&&W===0&&a==="ext-link-text"&&lo.test(n))continue;let ke=e+W,Pe=ke+xe,ie=x.toString(),ve=ie[Pe],ot=ie[ke-1],Ur=xe>1&&!(I==="<"&&!/[\s/>]/u.test(ve!=null?ve:"")||l&&(I==="["||I==="]"))||I==="{"&&(ve===I||ot==="-")||I==="}"&&(ot===I||ve==="-")||I==="["&&(ve===I||a==="ext-link-text"||h==="free-ext-link"&&!n.slice(W+1).trim())||I==="]"&&(ot===I||k==="free-ext-link"&&!n.slice(0,W).includes("]"))?"error":"warning",Dr=I==="{"||I==="[";if(Ur==="warning"&&(Dr||(I==="]"||I==="}"))){let ae=go[I],Hr=Dr?n.slice(W+1):n.slice(0,W);if(I==="{"&&((j=ae.exec(Hr))==null?void 0:j[0])==="}"||I==="}"&&((q=ae.exec(Hr))==null?void 0:q[0])==="{")continue;if(!Hr.includes(I)){let qn=Dr?"nextSibling":"previousSibling",We=this[qn];for(;We&&(We.type!=="text"||!ae.test(We.data));)We=We[qn];if(We&&ae.exec(We.data)[0]!==I)continue}}let ar=n.slice(0,W).split(`
|
|
3
|
+
`),Pn=ar.length+$-1,Bn=ar[ar.length-1],jn=ar.length===1?w+Bn.length:Bn.length,qt={rule:po[I],message:f.msg('lonely "$1"',I==="h"?ee:I),severity:Ur,startIndex:ke,endIndex:Pe,startLine:Pn,endLine:Pn,startCol:jn,endCol:jn+xe};if(I==="<")qt.suggestions=[{desc:"escape",range:[ke,ke+1],text:"<"}];else if(I==="h"&&!(a==="ext-link-text"||a==="link-text")&&/[\p{L}\d_]/u.test(ot||""))qt.suggestions=[{desc:"whitespace",range:[ke,ke],text:" "}];else if(I==="["&&a==="ext-link-text"){let ae=i.getAbsoluteIndex()+i.toString().length;qt.suggestions=[{desc:"escape",range:[ae,ae+1],text:"]"}]}else if(I==="]"&&k==="free-ext-link"&&Ur==="error"){let ae=e-o.toString().length;qt.fix={range:[ae,ae],text:"["}}c.push(qt)}return c}replaceData(e){R(this,pr,ri).call(this,e)}print(){return dt(this.data)}};pr=new WeakSet,ri=function(e){this.setAttribute("data",e)}});var ue,He=b(()=>{"use strict";be();ue=(d=!0,r=!0)=>(e,t)=>{class n extends e{text(){return""}lint(s){return d?[]:super.lint(s)}}return ur(n,e),n}});var Wt,ce,pt=b(()=>{"use strict";P();ce=class extends y{constructor(e,t,n,i,s,o){super(e,i,s,o);T(this,Wt);v(this,Wt,n)}get type(){return u(this,Wt)}lint(e=this.getAbsoluteIndex()){return super.lint(e,!1)}};Wt=new WeakMap});var ut,G,Ee=b(()=>{"use strict";P();G=class extends y{constructor(e,t,n,i,s){super(e,n,i,s);T(this,ut);v(this,ut,t)}get type(){return u(this,ut)}set type(e){v(this,ut,e)}};ut=new WeakMap});var co,Ve,Te,je,Ce,Dt=b(()=>{"use strict";_();Se();Q();F();P();Ee();co=d=>d==="redirect-target"||d==="link",Ce=class extends y{constructor(e,t,n=f.getConfig(),i=[],s="|"){super(void 0,n,i,{});T(this,Ve,!0);T(this,Te);T(this,je);if(this.insertAt(new G(e,"link-target",n,i,{})),t!==void 0){let o=new y(t,n,i,{});o.type="link-text",o.setAttribute("stage",10),this.insertAt(o)}v(this,Te,s)}afterBuild(){v(this,je,this.getTitle()),u(this,Te).includes("\0")&&v(this,Te,this.buildFromStr(u(this,Te),0)),this.setAttribute("name",u(this,je).title),super.afterBuild()}setAttribute(e,t){e==="bracket"?v(this,Ve,t):e==="title"?v(this,je,t):super.setAttribute(e,t)}toString(e){let t=super.toString(e,u(this,Te));return u(this,Ve)?`[[${t}]]`:t}text(){let e=super.text("|");return u(this,Ve)?`[[${e}]]`:e}getAttribute(e){return e==="title"?u(this,je):e==="padding"?2:super.getAttribute(e)}getGaps(e){return e===0?u(this,Te).length:1}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),{childNodes:[i,s],type:o}=this,{encoded:a,fragment:p}=u(this,je),g=new E(this,e);if(i.childNodes.some(({type:l})=>l==="template")&&n.push(C(i,g,"unknown-page","template in an internal link target","warning")),a&&n.push(C(i,g,"url-encoding","unnecessary URL encoding in an internal link")),o==="link"||o==="category"){let l=s==null?void 0:s.childNodes.find(c=>c.type==="text"&&c.data.includes("|"));if(l){let c=C(s,g,"pipe-like",'additional "|" in the link text',"warning"),h=c.startIndex+l.getRelativeIndex();c.suggestions=[{desc:"escape",range:[h,h+l.data.length],text:l.data.replace(/\|/gu,"|")}],n.push(c)}}if(p!==void 0&&!co(o)){let l=C(i,g,"no-ignored","useless fragment"),c=i.childNodes.find(h=>h.type==="text"&&h.data.includes("#"));c&&(l.fix={range:[l.startIndex+c.getRelativeIndex()+c.data.indexOf("#"),l.endIndex],text:""}),n.push(l)}return n}getTitle(e){return this.normalizeTitle(this.firstChild.toString(!0),0,e,!0,!0)}print(){return super.print(u(this,Ve)?{pre:"[[",post:"]]",sep:u(this,Te)}:{sep:u(this,Te)})}};Ve=new WeakMap,Te=new WeakMap,je=new WeakMap});var re,qe=b(()=>{"use strict";P();re=class extends y{get innerText(){return this.firstChild.data}constructor(r="",e,t){super(r,e,t)}}});var ii,rn,ho,U,_e=b(()=>{"use strict";He();qe();ii=[ue()];U=class extends(ho=re){get type(){return"noinclude"}toString(r){return r?"":super.toString()}};rn=le(ho),U=ge(rn,0,"NoincludeToken",ii,U),de(rn,1,U)});var cr,si=b(()=>{"use strict";_();F();Dt();_e();cr=class extends Ce{get type(){return"redirect-target"}constructor(r,e,t=f.getConfig(),n=[]){super(r,void 0,t,n),e!==void 0&&this.insertAt(new U(e,t,n))}getTitle(){return this.normalizeTitle(this.firstChild.toString(),0,!0,!0)}lint(r=this.getAbsoluteIndex()){let e=super.lint(r,!1);if(this.length===2){let t=C(this.lastChild,{start:r},"no-ignored","useless link text");t.startIndex--,t.startCol--,t.fix={range:[t.startIndex,t.endIndex],text:""},e.push(t)}return e}}});var oi,Oe,ct,nn,mo,Xe,ai=b(()=>{"use strict";He();F();P();pt();si();oi=[ue(!1,!1)];Xe=class extends(mo=y){constructor(e,t,n,i,s,o=f.getConfig(),a=[]){super(void 0,o,a);T(this,Oe);T(this,ct);v(this,Oe,e),v(this,ct,s);let p=new RegExp(String.raw`^(?:${o.redirection.join("|")})\s*(?::\s*)?$`,"iu");this.append(new ce(t,p,"redirect-syntax",o,a,{}),new cr(n,i==null?void 0:i.slice(1),o,a))}get type(){return"redirect"}getAttribute(e){return e==="padding"?u(this,Oe).length:super.getAttribute(e)}toString(e){return u(this,Oe)+super.toString(e)+u(this,ct)}lint(e=this.getAbsoluteIndex()){return this.lastChild.lint(e+u(this,Oe).length+this.firstChild.toString().length)}print(){return super.print({pre:u(this,Oe),post:u(this,ct)})}};nn=le(mo),Oe=new WeakMap,ct=new WeakMap,Xe=ge(nn,0,"RedirectToken",oi,Xe),de(nn,1,Xe)});var li={};se(li,{parseRedirect:()=>fo});var fo,di=b(()=>{"use strict";F();ai();fo=(d,r,e)=>{var n;(n=r.regexRedirect)!=null||(r.regexRedirect=new RegExp(String.raw`^(\s*)((?:${r.redirection.join("|")})\s*(?::\s*)?)\[\[([^\n|\]]+)(\|.*?)?\]\](\s*)`,"iu"));let t=r.regexRedirect.exec(d);return t&&f.normalizeTitle(t[3],0,!1,r,!0,!0).valid?(d=`\0${e.length}o\x7F${d.slice(t[0].length)}`,new Xe(...t.slice(1),r,e),d):!1}});var hr,gi=b(()=>{"use strict";P();hr=class extends y{get type(){return"onlyinclude"}toString(r){return`<onlyinclude>${super.toString(r)}</onlyinclude>`}getAttribute(r){return r==="padding"?13:r==="plain"||super.getAttribute(r)}print(){return super.print({pre:'<span class="wpb-ext"><onlyinclude></span>',post:'<span class="wpb-ext"></onlyinclude></span>'})}}});var Me,ht,sn=b(()=>{"use strict";P();ht=class extends y{constructor(e,t,n,i,s,o=[]){super(void 0,s);T(this,Me);X(this,"closed");X(this,"selfClosing");this.setAttribute("name",e.toLowerCase()),v(this,Me,[e,i||e]),this.closed=i!=="",this.selfClosing=i===void 0,this.append(t,n);let a=typeof t=="string"?-1:o.indexOf(t);o.splice(a===-1?1/0:a,0,this)}get innerText(){return this.selfClosing?void 0:this.lastChild.text()}toString(e){let{selfClosing:t,firstChild:n,lastChild:i}=this,[s,o]=u(this,Me);return t?`<${s}${n.toString(e)}/>`:`<${s}${n.toString(e)}>${i.toString(e)}${this.closed?`</${o}>`:""}`}text(){let[e,t]=u(this,Me);return this.selfClosing?`<${e}${this.firstChild.text()}/>`:`<${e}${super.text(">")}${this.closed?`</${t}>`:""}`}getAttribute(e){return e==="padding"?u(this,Me)[0].length+1:super.getAttribute(e)}getGaps(){return 1}print(){let[e,t]=u(this,Me);return super.print(this.selfClosing?{pre:`<${e}`,post:"/>"}:{pre:`<${e}`,sep:">",post:this.closed?`</${t}>`:""})}};Me=new WeakMap});var pi,on,xo,Qe,ui=b(()=>{"use strict";_();Q();He();F();sn();pi=[ue(!1)];Qe=class extends(xo=ht){get type(){return"include"}constructor(r,e="",t,n,i,s){super(r,e,t!=null?t:"",t===void 0||n!=null?n:"",i,s)}toString(r){return r?"":super.toString()}lint(r=this.getAbsoluteIndex()){let e=[],{firstChild:t,closed:n,name:i}=this,s=new E(this,r);if(t.data.trim()){let o=C(t,s,"no-ignored","useless attribute","warning");o.suggestions=[{desc:"remove",range:[o.startIndex,o.endIndex],text:""}],e.push(o)}if(!n){let o=N(this,s,"unclosed-comment",f.msg("unclosed $1",`<${i}>`));o.suggestions=[{desc:"close",range:[o.endIndex,o.endIndex],text:`</${i}>`}],e.push(o)}return e}};on=le(xo),Qe=ge(on,0,"IncludeToken",pi,Qe),de(on,1,Qe)});var bo,V,ci,hi,fr,an,mi,ft,xi,bi,Ti,fi,mr,To,yo,ko,Ht,mt,Y,$e,xt,yi=b(()=>{"use strict";_();K();Se();Q();F();P();Ee();bo=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"]),V=new Set(["align"]),ci=new Set(["cite"]),hi=new Set(["cite","datetime"]),fr=new Set(["width"]),an=new Set(["axis","align","bgcolor","height","width","valign"]),mi=new Set([...an,"abbr","headers","scope","rowspan","colspan"]),ft=new Set(["type"]),xi=new Set(["summary","align","bgcolor","cellpadding","cellspacing","frame","rules","width"]),bi=new Set(["clear"]),Ti=new Set(["bgcolor","align","valign"]),fi={div:V,h1:V,h2:V,h3:V,h4:V,h5:V,h6:V,blockquote:ci,q:ci,p:V,br:bi,pre:fr,ins:hi,del:hi,ul:ft,ol:new Set(["type","start","reversed"]),li:new Set(["type","value"]),table:new Set([...xi,"border"]),caption:V,tr:Ti,td:mi,th:mi,img:new Set(["alt","src","width","height","srcset"]),font:new Set(["size","color","face"]),hr:fr,data:new Set(["value"]),time:new Set(["datetime"]),meta:new Set(["itemprop","content"]),link:new Set(["itemprop","href","title"]),gallery:ft,poem:V,categorytree:V,combooption:V},mr=new Set,To={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:mr,indicator:new Set(["name"]),langconvert:new Set(["from","to"]),ref:new Set(["group","name","extends","follow","dir"]),references:new Set(["group","responsive"]),charinsert:new Set(["label"]),choose:new Set(["uncached","before","after"]),option:new Set(["weight"]),imagemap:mr,inputbox:mr,templatestyles:new Set(["src","wrapper"]),dynamicpagelist:mr,poll:new Set(["id","show-results-before-voting"]),sm2:ft,flashmp3:ft,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"])},yo=/expression|(?:accelerator|-o-link(?:-source)?|-o-replace)\s*:|(?:url|image(?:-set)?)\s*\(|attr\s*\([^)]+[\s,]url/u,ko={table:xi,td:new Set([...an,"scope"]),th:an,br:bi,caption:V,div:V,hr:fr,h1:V,h2:V,h3:V,h4:V,h5:V,h6:V,li:ft,p:V,pre:fr,tr:Ti,ul:ft},xt=class extends y{constructor(e,t,n,i="",s,o=[],a=f.getConfig(),p=[]){let g=new G(n,"attr-key",a,p),l;if(n==="title"||t==="img"&&n==="alt")l=new y(s,a,p,{}),l.type="attr-value",l.setAttribute("stage",10);else if(t==="gallery"&&n==="caption"||t==="choose"&&(n==="before"||n==="after")){let c={...a,excludes:[...a.excludes,"heading","html","table","hr","list"]};l=new y(s,c,p,{}),l.type="attr-value",l.setAttribute("stage",1)}else l=new G(s,"attr-value",a,p,{});super(void 0,a,p);T(this,Ht);T(this,mt);T(this,Y);T(this,$e);v(this,Ht,e),this.append(g,l),v(this,Y,i),v(this,$e,[...o]),v(this,mt,t),this.setAttribute("name",te(n).trim().toLowerCase())}get type(){return u(this,Ht)}get tag(){return u(this,mt)}get balanced(){return!u(this,Y)||u(this,$e)[0]===u(this,$e)[1]}afterBuild(){u(this,Y).includes("\0")&&v(this,Y,this.buildFromStr(u(this,Y),0)),this.parentNode&&v(this,mt,this.parentNode.name),this.setAttribute("name",this.firstChild.toString(!0).trim().toLowerCase()),super.afterBuild()}toString(e){let[t="",n=""]=u(this,$e);return u(this,Y)?super.toString(e,u(this,Y)+t)+n:this.firstChild.toString(e)}text(){return u(this,Y)?`${super.text(`${u(this,Y).trim()}"`)}"`:this.firstChild.text()}getGaps(){var e,t;return u(this,Y)?u(this,Y).length+((t=(e=u(this,$e)[0])==null?void 0:e.length)!=null?t:0):0}lint(e=this.getAbsoluteIndex(),t){var m,k;let n=super.lint(e,t),{balanced:i,firstChild:s,lastChild:o,type:a,name:p,tag:g}=this,l=this.getValue(),c=new E(this,e);if(!i){let x=C(o,c,"unclosed-quote",f.msg("unclosed $1","quotes"),"warning");x.startIndex--,x.startCol--;let A={range:[x.endIndex,x.endIndex],text:u(this,$e)[0]};o.childNodes.some(({type:S,data:$})=>S==="text"&&/\s/u.test($))?x.suggestions=[{desc:"close",...A}]:x.fix=A,n.push(x)}let h=To[g];if(!(h!=null&&h.has(p))&&(a==="ext-attr"?h:!/\{\{[^{]+\}\}/u.test(p))&&(a==="ext-attr"&&!(g in fi)||!((m=fi[g])!=null&&m.has(p))&&!/^(?:xmlns:[\w:.-]+|data-(?!ooui|mw|parsoid)[^:]*)$/u.test(p)&&(g==="meta"||g==="link"||!bo.has(p))))n.push(C(s,c,"illegal-attr","illegal attribute name"));else if((k=ko[g])!=null&&k.has(p))n.push(C(s,c,"obsolete-attr","obsolete attribute","warning"));else if(p==="style"&&typeof l=="string"&&yo.test(l))n.push(C(o,c,"insecure-style","insecure style"));else if(p==="tabindex"&&typeof l=="string"&&l!=="0"){let x=C(o,c,"illegal-attr","nonzero tabindex");x.suggestions=[{desc:"remove",range:[e,x.endIndex],text:""},{desc:"0 tabindex",range:[x.startIndex,x.endIndex],text:"0"}],n.push(x)}return n}getValue(){return u(this,Y)?this.lastChild.text().trim():this.type==="ext-attr"||""}print(){let[e="",t=""]=u(this,$e);return u(this,Y)?super.print({sep:dt(u(this,Y))+e,post:t}):super.print()}};Ht=new WeakMap,mt=new WeakMap,Y=new WeakMap,$e=new WeakMap});var ki,vo,Vt,Ge,xr=b(()=>{"use strict";_();K();Q();F();P();Ee();yi();ki=d=>d.slice(0,-1),vo=d=>`${ki(d)}-dirty`,Ge=class extends y{constructor(e,t,n,i=f.getConfig(),s=[]){super(void 0,i,s,{});T(this,Vt);if(v(this,Vt,t),this.setAttribute("name",n),e){let o=/([^\s/](?:(?!\0\d+~\x7F)[^\s/=])*)(?:((?:\s(?:\s|\0\d+[cn]\x7F)*)?(?:=|\0\d+~\x7F)(?:\s|\0\d+[cn]\x7F)*)(?:(["'])(.*?)(\3|$)|(\S*)))?/gsu,a="",p=o.exec(e),g=0,l=()=>{a&&(super.insertAt(new G(a,vo(t),i,s,{})),a="")};for(;p;){let{index:c,0:h,1:m,2:k,3:x,4:A,5:S,6:$}=p;if(a+=e.slice(g,c),/^(?:[\w:]|\0\d+t\x7F)(?:[\w:.-]|\0\d+t\x7F)*$/u.test(te(m).trim())){let w=A!=null?A:$,L=[x,S],B=new xt(ki(t),n,m,k,w,L,i,s);l(),super.insertAt(B)}else a+=h;({lastIndex:g}=o),p=o.exec(e)}a+=e.slice(g),l()}}get type(){return u(this,Vt)}afterBuild(){let{parentNode:e}=this;(e==null?void 0:e.type)==="td"&&e.subtype==="caption"&&this.setAttribute("name","caption"),super.afterBuild()}getAttrTokens(e){return this.childNodes.filter(t=>t instanceof xt&&(!e||t.name===e.toLowerCase().trim()))}getAttrToken(e){let t=this.getAttrTokens(e);return t[t.length-1]}getAttr(e){var t;return(t=this.getAttrToken(e))==null?void 0:t.getValue()}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),{parentNode:i,childNodes:s}=this,o=new Map,a=new Set,p=new E(this,e);if((i==null?void 0:i.type)==="html"&&i.closing&&this.text().trim()){let g=N(this,p,"no-ignored","attributes of a closing tag");g.fix={range:[e,g.endIndex],text:""},n.push(g)}for(let g of s)if(g instanceof xt){let{name:l}=g;o.has(l)?(a.add(l),o.get(l).push(g)):o.set(l,[g])}else{let l=g.text().trim();if(l){let c=C(g,p,"no-ignored","containing invalid attribute",/[\p{L}\d]/u.test(l)?"error":"warning");c.suggestions=[{desc:"remove",range:[c.startIndex,c.endIndex],text:" "}],n.push(c)}}if(a.size>0)for(let g of a)n.push(...o.get(g).map(l=>C(l,p,"no-duplicate",f.msg("duplicated $1 attribute",g))));return n}print(){return this.toString()?`<span class="wpb-${this.type}">${this.childNodes.map(e=>e.print(e instanceof G?{class:e.toString().trim()&&"attr-dirty"}:void 0)).join("")}</span>`:""}};Vt=new WeakMap});var br,vi=b(()=>{"use strict";Se();F();P();_e();br=class extends y{get type(){return"ext-inner"}constructor(r,e=f.getConfig(),t=[]){if(r){let n=/<nowiki>/giu,i=/<\/nowiki>/giu,{length:s}=n.source,o=n.exec(r);o&&(i.lastIndex=o.index+s);let a=i.exec(r),p=0,g="";for(;o&&a;)new U(o[0],e,t),new U(a[0],e,t),g+=`${r.slice(p,o.index)}\0${t.length-1}n\x7F${r.slice(o.index+s,a.index)}\0${t.length}n\x7F`,p=a.index+s+1,n.lastIndex=p,o=n.exec(r),o&&(i.lastIndex=o.index+s),a=i.exec(r);r=g+r.slice(p)}super(r,e,t,{}),this.setAttribute("stage",10)}getAttribute(r){return r==="plain"||super.getAttribute(r)}lint(r=this.getAbsoluteIndex()){return super.lint(r,/<\s*\/\s*(pre)\b/giu)}}});var bt,ln=b(()=>{"use strict";_();Q();Xt();F();P();Ee();bt=class extends y{get type(){return"ext-inner"}constructor(r,e,t=f.getConfig(),n=[],i){if(super(void 0,t,n,{}),e){let s=G;this.append(...e.split(`
|
|
4
|
+
`).map(o=>i?o:Ze(o,t,n,r)).map(o=>new s(o,"param-line",t,n,{})))}n.splice(n.indexOf(this),1),n.push(this)}toString(r){return super.toString(r,`
|
|
5
|
+
`)}text(){return super.text(`
|
|
6
|
+
`)}getGaps(){return 1}lint(r=this.getAbsoluteIndex()){let e=new E(this,r),t=f.msg("invalid parameter of <$1>",this.name),n=[];for(let i of this.childNodes){let s=i.childNodes.filter(({type:o})=>o!=="comment"&&o!=="include"&&o!=="noinclude");if(s.some(({type:o})=>o==="ext"))n.push(C(i,e,"no-ignored",t));else{let o=s.findIndex(({type:p})=>p!=="text"),a=s.slice(0,o>=0?o:void 0).map(String).join("");if(a&&!(o>=0?/^[a-z]+(?:\[\])?\s*(?:=|$)/iu:/^[a-z]+(?:\[\])?\s*=/iu).test(a)){let p=C(i,e,"no-ignored",t);p.suggestions=[{desc:"remove",range:[p.startIndex,p.endIndex],text:""}],n.push(p)}else n.push(...i.lint(r,!1))}r+=i.toString().length+1}return n}print(){return super.print({sep:`
|
|
7
|
+
`})}}});var Qt,Tt,Tr,yt,dn=b(()=>{"use strict";_();be();Q();F();P();pt();yt=class extends y{constructor(e,t,n=f.getConfig(),i=[]){super(void 0,n,i);T(this,Tt);T(this,Qt);v(this,Qt,e);let s=new y(t[0],n,i);s.type="heading-title",s.setAttribute("stage",2);let o=new ce(t[1],/^\s*$/u,"heading-trail",n,i,{});this.append(s,o)}get type(){return"heading"}get level(){return u(this,Qt)}toString(e){let t=u(this,Tt,Tr);return t+this.firstChild.toString(e)+t+this.lastChild.toString(e)}text(){let e=u(this,Tt,Tr);return e+this.firstChild.text()+e}getAttribute(e){return e==="padding"?this.level:super.getAttribute(e)}getGaps(){return this.level}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),{firstChild:i,level:s}=this,o=i.toString(),a=i.childNodes.filter(kt("quote")),p=a.filter(({bold:c})=>c),g=a.filter(({italic:c})=>c),l=new E(this,e);return this.level===1&&n.push(C(i,l,"h1","<h1>")),(o.startsWith("=")||o.endsWith("="))&&n.push(C(i,l,"unbalanced-header",f.msg("unbalanced $1 in a section header",'"="'))),this.closest("html-attrs,table-attrs")&&n.push(N(this,l,"parsing-order","section header in a HTML tag")),p.length%2&&n.push(C(p[p.length-1],{...l,start:e+s,left:l.left+s},"format-leakage",f.msg("unbalanced $1 in a section header","bold apostrophes"))),g.length%2&&n.push(C(g[g.length-1],{start:e+s},"format-leakage",f.msg("unbalanced $1 in a section header","italic apostrophes"))),n}print(){let e=u(this,Tt,Tr);return super.print({pre:e,sep:e})}json(){let e=super.json();return e.level=this.level,e}};Qt=new WeakMap,Tt=new WeakSet,Tr=function(){return"=".repeat(this.level)}});var Ao,yr,Ai=b(()=>{"use strict";K();_();F();P();Ao=new RegExp(`https?://${Ae}${we}$`,"iu"),yr=class extends y{get type(){return"parameter"}get anon(){return this.firstChild.length===0}constructor(r,e,t=f.getConfig(),n=[]){super(void 0,t,n);let i=new y(typeof r=="number"?void 0:r,t,n,{}),s=new y(e,t,n);i.type="parameter-key",i.setAttribute("stage",2),s.type="parameter-value",s.setAttribute("stage",2),this.append(i,s)}trimName(r,e=!0){let t=(typeof r=="string"?r:r.toString(!0)).replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu,"$1");return this.setAttribute("name",t),t}afterBuild(){if(!this.anon){let{parentNode:r,firstChild:e}=this,t=this.trimName(e);r&&r.getArgs(t,!1,!1).add(this)}super.afterBuild()}toString(r){return this.anon?this.lastChild.toString(r):super.toString(r,"=")}text(){return this.anon?this.lastChild.text():super.text("=")}getGaps(){return this.anon?0:1}lint(r=this.getAbsoluteIndex(),e){var s;let t=super.lint(r,e),{firstChild:n}=this,i=(s=Ao.exec(n.text()))==null?void 0:s[0];if(i&&new URL(i).search){let o=C(n,{start:r},"unescaped","unescaped query string in an anonymous parameter");o.startIndex=o.endIndex,o.startLine=o.endLine,o.startCol=o.endCol,o.endIndex++,o.endCol++,o.fix={range:[o.startIndex,o.endIndex],text:"{{=}}"},t.push(o)}return t}print(){return super.print({sep:this.anon?"":"="})}json(){let r=super.json();return r.anon=this.anon,r}}});var wo,Kt,Ke,Je,Ye,gn,wi,Zt,Si=b(()=>{"use strict";K();_();be();Se();Q();F();P();Ai();Ee();pt();wo=new Set(["pageid","articlepath","server","servername","scriptpath","stylepath"]),Zt=class extends y{constructor(e,t,n=f.getConfig(),i=[]){var m,k;let s,o=/^(?:\s|\0\d+[cn]\x7F)*\0(\d+)h\x7F(?:\s|\0\d+[cn]\x7F)*/u.exec(e);o&&(s=Number(o[1]),e=e.replace(`\0${s}h\x7F`,i[s].toString().replace(/^\n/u,"")));super(void 0,n,i,{});T(this,Ye);X(this,"modifier","");T(this,Kt,"template");T(this,Ke,!1);T(this,Je,new Map);let{parserFunction:[a,p]}=n,g=(m=/^(?:\s|\0\d+[cn]\x7F)*\0\d+s\x7F/u.exec(e))==null?void 0:m[0];if(g)this.setAttribute("modifier",g),e=e.slice(g.length);else if(e.includes(":")){let[x,...A]=e.split(":"),[S]=/^(?:\s|\0\d+[cn]\x7F)*/u.exec((k=A[0])!=null?k:"");this.setModifier(`${x}:${S}`)&&(e=A.join(":").slice(S.length))}let l=e.includes(":");if(l||t.length===0&&!u(this,Ke)){let[x,...A]=e.split(":"),S=te(x),$=S[A.length>0?"trimStart":"trim"](),w=$.toLowerCase(),L=Object.prototype.hasOwnProperty.call(a,w)&&a[w],B=p.includes($);if(B||wo.has(L)||l&&L){this.setAttribute("name",L||w),v(this,Kt,"magic-word");let q=new RegExp(String.raw`^\s*${$}\s*$`,B?"u":"iu"),D=new ce(x,q,"magic-word-name",n,i,{});if(super.insertAt(D),A.length>0&&t.unshift([A.join(":")]),this.name==="invoke")for(let H=0;H<2;H++){let ne=t.shift();if(!ne)break;let ee=new G(ne.join("="),`invoke-${H?"function":"module"}`,n,i);super.insertAt(ee)}}}if(this.type==="template"){let x=te(e).trim();if(!this.normalizeTitle(x,10,!0).valid)throw i.pop(),new SyntaxError("Invalid template name");let A=new G(e,"template-name",n,i,{});super.insertAt(A)}typeof s=="number"&&(i[s]=void 0);let c=this.isTemplate(),h=1;for(let[x,A]of t.entries())!c&&!(this.name==="switch"&&x>0)&&(A[0]=A.join("="),A.length=1),A.length===1&&(A.unshift(h),h++),this.insertAt(new yr(...A,n,i));this.seal("modifier")}get type(){return u(this,Kt)}setModifier(e){let{parserFunction:[,,t,n]}=this.getAttribute("config"),i=te(e).trim();if(e&&!i.endsWith(":"))return!1;let s=i.slice(0,-1).toLowerCase(),o=t.includes(s),a=n.includes(s);return u(this,Ke)&&o||!u(this,Ke)&&(a||e==="")||(ye.running||this.length>1)&&(o||a||e==="")?(this.setAttribute("modifier",e),v(this,Ke,o),!!e):!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"&&this.setAttribute("name",R(this,Ye,gn).call(this).title)}toString(e){return`{{${this.modifier}${this.type==="magic-word"?`${this.firstChild.toString(e)}${this.length===1?"":":"}${this.childNodes.slice(1).map(t=>t.toString(e)).join("|")}`:super.toString(e,"|")}}}`}text(){let{childNodes:e,length:t,firstChild:n,modifier:i,type:s,name:o}=this;return s==="magic-word"&&o==="vardefine"?"":`{{${i}${s==="magic-word"?n.text()+(t===1?"":":")+pe(e.slice(1),"|"):super.text("|")}}}`}getAttribute(e){switch(e){case"padding":return this.modifier.length+2;default:return super.getAttribute(e)}}getGaps(){return 1}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t);if(!this.isTemplate())return n;let{type:i,childNodes:s,length:o}=this,a=new E(this,e),p=i==="magic-word";if(p&&!R(this,Ye,gn).call(this).valid)n.push(C(s[1],a,"invalid-invoke","illegal module name"));else{let l=s[p?1:0],c=l.childNodes.find(h=>h.type==="text"&&Ot(h.data).includes("#"));if(c){let h=C(l,a,"no-ignored","useless fragment");h.fix={range:[h.startIndex+c.getRelativeIndex()+c.data.indexOf("#"),h.endIndex],text:""},n.push(h)}}if(p&&o===2)return n.push(N(this,a,"invalid-invoke","missing module function")),n;let g=this.getDuplicatedArgs().filter(([,l])=>!l[0].querySelector("ext"));return g.length>0&&n.push(...g.flatMap(([,l])=>l).map(l=>C(l,a,"no-duplicate","duplicated parameter"))),n}insertAt(e,t=this.length){return super.insertAt(e,t),e.anon?R(this,Ye,wi).call(this,e):e.name&&this.getArgs(e.name,!1,!1).add(e),e}getAllArgs(){return this.childNodes.filter(kt("parameter"))}getAnonArgs(){return this.getAllArgs().filter(({anon:e})=>e)}getArgs(e,t,n=!0){let i=String(e).replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu,"$1"),s;return u(this,Je).has(i)?s=u(this,Je).get(i):(s=new Set(this.getAllArgs().filter(({name:o})=>i===o)),u(this,Je).set(i,s)),s}getDuplicatedArgs(){return[...u(this,Je)].filter(([,{size:e}])=>e>1).map(([e,t])=>[e,[...t]])}getPossibleValues(){let{type:e,name:t,childNodes:n}=this;if(e==="template")throw new Error("TranscludeToken.getPossibleValues method is only for specific magic words!");let i;switch(t){case"if":case"ifexist":case"ifexpr":case"iferror":i=2;break;case"ifeq":i=3;break;default:throw new Error("TranscludeToken.getPossibleValues method is only for specific magic words!")}let s=n.slice(i,i+2).map(({childNodes:[,o]})=>o);for(let o=0;o<s.length;){let{length:a,0:p}=s[o].childNodes.filter(g=>g.text().trim());if(a===0)s.splice(o,1);else if(a>1||p.type!=="magic-word")o++;else try{let g=p.getPossibleValues();s.splice(o,1,...g),o+=g.length}catch(g){o++}}return s}print(){let{childNodes:e,length:t,firstChild:n,modifier:i,type:s}=this;return`<span class="wpb-${s}">{{${dt(i)}${s==="magic-word"?n.print()+(t===1?"":":")+Ne(e.slice(1),{sep:"|"}):Ne(e,{sep:"|"})}}}</span>`}};Kt=new WeakMap,Ke=new WeakMap,Je=new WeakMap,Ye=new WeakSet,gn=function(){let e=this.type==="template",t=this.childNodes[e?0:1];return this.normalizeTitle(t.toString(!0),e?10:828)},wi=function(e){let t=this.getAnonArgs(),n=typeof e!="number";for(let i=n?t.indexOf(e):e-1;i<t.length;i++){let s=t[i],{name:o}=s,a=String(i+1);o!==a&&(s.setAttribute("name",a),this.getArgs(a,!1,!1).add(s))}}});var Ci,pn,So,et,$i=b(()=>{"use strict";He();P();Ci=[ue()];et=class extends(So=y){get type(){return"hidden"}};pn=le(So),et=ge(pn,0,"HiddenToken",Ci,et),de(pn,1,et)});var vr,Ni,kr,Ei=b(()=>{"use strict";K();_();Q();F();P();Ee();$i();kr=class extends y{constructor(e,t=f.getConfig(),n=[]){super(void 0,t,n,{});T(this,vr);for(let[i,s]of e.entries())if(i===0){let o=new G(s,"arg-name",t,n,{});super.insertAt(o)}else if(i>1){let o=new et(s,t,n);super.insertAt(o)}else{let o=new y(s,t,n);o.type="arg-default",o.setAttribute("stage",2),super.insertAt(o)}}get type(){return"arg"}get default(){var e,t;return(t=(e=this.childNodes[1])==null?void 0:e.text())!=null?t:!1}toString(e){return`{{{${super.toString(e,"|")}}}}`}text(){return`{{{${pe(this.childNodes.slice(0,2),"|")}}}}`}getAttribute(e){return e==="padding"?3:super.getAttribute(e)}getGaps(){return 1}afterBuild(){R(this,vr,Ni).call(this),super.afterBuild()}lint(e=this.getAbsoluteIndex(),t){let{childNodes:[n,i,...s]}=this;if(!this.getAttribute("include")){let a=N(this,{start:e},"no-arg","unexpected template argument");return i&&(a.fix={range:[e,a.endIndex],text:i.text()}),[a]}let o=n.lint(e+3,t);if(i&&o.push(...i.lint(e+4+n.toString().length,t)),s.length>0){let a=new E(this,e);o.push(...s.map(p=>{let g=C(p,a,"no-ignored","invisible content inside triple braces");return g.startIndex--,g.startCol--,g.suggestions=[{desc:"remove",range:[g.startIndex,g.endIndex],text:""},{desc:"escape",range:[g.startIndex,g.startIndex+1],text:"{{!}}"}],g}))}return o}print(){return super.print({pre:"{{{",post:"}}}",sep:"|"})}};vr=new WeakSet,Ni=function(){this.setAttribute("name",this.firstChild.toString(!0).trim())}});var Li={};se(Li,{parseBraces:()=>Jt});var Co,un,$o,Jt,Ar=b(()=>{"use strict";K();dn();Si();Ei();Co={"=":String.raw`\n(?!(?:[^\S\n]|\0\d+[cn]\x7F)*\n)`,"{":String.raw`\}{2,}|\|`,"-":String.raw`\}-`,"[":String.raw`\]\]`},un=new Map([["!","!"],["!!","+"],["(!","{"],["!)","}"],["!-","-"],["=","~"],["server","m"]]),$o=/\{\{\s*([^\s\0<>[\]{}|_#&%:.]+)\s*\}\}(?!\})/gu,Jt=(d,r,e)=>{var c,h,m,k,x,A;let t=String.raw`${(c=r.excludes)!=null&&c.includes("heading")?"":String.raw`^((?:\0\d+[cno]\x7F)*)={1,6}|`}\[\[|-\{(?!\{)`,n=String.raw`|\{{2,}`,{parserFunction:[,,,i]}=r,s=[];d=d.replace($o,(S,$)=>{var w;return new Zt(S.slice(2,-2),[],r,e),`\0${e.length-2}${(w=un.get($.toLowerCase()))!=null?w:"t"}\x7F`});let o=d.lastIndexOf("}}")-d.length,a=o+d.length!==-1,p=new RegExp(t+(a?n:""),"gmu"),g=p.exec(d),l;for(;g||l!==void 0&&l<=d.length&&((m=(h=s[s.length-1])==null?void 0:h[0])!=null&&m.startsWith("="));){if(g!=null&&g[1]){let[,{length:W}]=g;g[0]=g[0].slice(W),g.index+=W}let{0:S,index:$}=g!=null?g:{0:`
|
|
8
|
+
`,index:d.length},w=(k=s.pop())!=null?k:{},{0:L,index:B,parts:j,findEqual:q,pos:D}=w,H=S==="="&&q,ne=W=>{j[j.length-1].push(W.slice(D,$))};if(S==="]]"||S==="}-")l=$+2;else if(S===`
|
|
9
|
+
`){l=$+1;let{pos:W,findEqual:I}=(x=s[s.length-1])!=null?x:{};if(W===void 0||I||te(d.slice(W,B))!==""){let xe=/^(={1,6})(.+)\1((?:\s|\0\d+[cn]\x7F)*)$/u.exec(d.slice(B,$));xe&&(d=`${d.slice(0,B)}\0${e.length}h\x7F${d.slice($)}`,l=B+4+String(e.length).length,new yt(xe[1].length,xe.slice(2),r,e))}}else if(S==="|"||H)l=$+1,ne(d),S==="|"&&j.push([]),w.pos=l,w.findEqual=S==="|",s.push(w);else if(S.startsWith("}}")){let W=S.slice(0,Math.min(L.length,3)),I=L.length-W.length,{length:xe}=e;l=$+W.length,ne(d);let ke=!1,Pe="t";if(W.length===3){let ie=j.map(ot=>ot.join("=")),ve=ie.length>1&&te(ie[1]).trim();new kr(ie,r,e),ve&&ve.endsWith(":")&&i.includes(ve.slice(0,-1).toLowerCase())&&(Pe="s")}else try{new Zt(j[0][0],j.slice(1),r,e);let ie=te(j[0][0]).trim();un.has(ie.toLowerCase())?Pe=un.get(ie.toLowerCase()):/^(?:filepath|(?:full|canonical)urle?):./iu.test(ie)?Pe="m":/^#vardefine:./iu.test(ie)&&(Pe="n")}catch(ie){if(ie instanceof SyntaxError&&ie.message==="Invalid template name")ke=!0;else throw ie}ke||(d=`${d.slice(0,B+I)}\0${xe}${Pe}\x7F${d.slice(l)}`,l=B+I+3+String(xe).length,I>1?s.push({0:L.slice(0,I),index:B,pos:B+I,parts:[[]]}):I===1&&d[B-1]==="-"&&s.push({0:"-{",index:B-1,pos:B+1,parts:[[]]}))}else l=$+S.length,S.startsWith("{")&&(g.pos=l,g.parts=[[]]),s.push(..."0"in w?[w]:[],g);let ee=s[s.length-1];if(a&&o+d.length<l)for(a=!1;(A=ee==null?void 0:ee[0])!=null&&A.startsWith("{");)s.pop(),ee=s[s.length-1];p=new RegExp(t+(a?n:"")+(ee?`|${Co[ee[0][0]]}${ee.findEqual?"|=":""}`:""),"gmu"),p.lastIndex=l,g=p.exec(d)}return d}});var wr,Ii=b(()=>{"use strict";Xt();Ar();F();ln();wr=class extends bt{constructor(r,e,t=f.getConfig(),n=[]){let i=Symbol("InputboxToken"),{length:s}=n;n.push(i),e&&(e=Ze(e,t,n,r)),e&&(e=Jt(e,t,n)),n.splice(s,1),super(r,e,t,n,{})}}});function Fi(d,r,e,t,n){r=r.trim();let i=r.replace(d==="link"?/\0\d+[tq]\x7F/gu:/\0\d+t\x7F/gu,"").trim();switch(d){case"width":return!i&&!!r||/^(?:\d+x?|\d*x\d+)(?:\s*px)?$/u.test(i);case"link":{if(!i)return r;let s=new RegExp(String.raw`^(?:${e.protocol}|//|\0\d+m\x7F)`,"iu"),o=new RegExp(String.raw`^(?:(?:${e.protocol}|//)${Ae}|\0\d+m\x7F)${we}$`,"iu");if(s.test(i))return o.test(i)&&r;i.startsWith("[[")&&i.endsWith("]]")&&(i=i.slice(2,-2));let a=f.normalizeTitle(i,0,!1,e,t,!0,!0);return a.valid&&a}case"lang":return(n==="svg"||n==="svgz")&&!/[^a-z\d-]/u.test(i);case"alt":case"class":case"manualthumb":return!0;case"page":return(n==="djvu"||n==="djv"||n==="pdf")&&Number(i)>0;default:return!!i&&!isNaN(i)}}var No,oe,Cr,Ri,Sr,Pi=b(()=>{"use strict";K();_();F();P();No=new Set(["alt","link","lang","page","caption"]);Sr=class extends y{constructor(e,t,n=f.getConfig(),i){var r=(...Wd)=>(super(...Wd),T(this,Cr),T(this,oe,""),this);var p;let s,o=Object.entries(n.img).map(([g,l])=>[g,l,new RegExp(String.raw`^(\s*(?!\s))${g.replace("$1","(.*)")}${g.endsWith("$1")?`(?=$|
|
|
10
|
+
)`:""}(\s*)$`,"u")]),a=o.find(([,g,l])=>(s=l.exec(e),s&&(s.length!==4||Fi(g,s[2],n,!0,t)!==!1)));if(a&&s){s.length===3?(r(void 0,n,i),v(this,oe,e)):(r(s[2],n,i,{}),v(this,oe,s[1]+a[0]+s[3])),this.setAttribute("name",a[1]);return}r(e,{...n,excludes:[...(p=n.excludes)!=null?p:[],"list"]},i),this.setAttribute("name","caption"),this.setAttribute("stage",7)}get type(){return"image-parameter"}get link(){return this.name==="link"?Fi("link",super.text(),this.getAttribute("config")):void 0}afterBuild(){var e;((e=this.parentNode)==null?void 0:e.type)==="gallery-image"&&!No.has(this.name)&&this.setAttribute("name","invalid"),super.afterBuild()}toString(e){return u(this,oe)?u(this,oe).replace("$1",super.toString(e)):super.toString(e)}text(){return u(this,oe)?u(this,oe).replace("$1",super.text()).trim():super.text().trim()}getAttribute(e){return e==="plain"?this.name==="caption":e==="padding"?Math.max(0,u(this,oe).indexOf("$1")):super.getAttribute(e)}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),{link:i,name:s}=this;if(s==="invalid"){let o=N(this,{start:e},"invalid-gallery","invalid image parameter");o.fix={range:[e-1,o.endIndex],text:""},n.push(o)}else typeof i=="object"&&i.encoded&&n.push(N(this,{start:e},"url-encoding","unnecessary URL encoding in an internal link"));return n}getValue(){return this.name==="invalid"?this.text():R(this,Cr,Ri).call(this)||super.text()}print(){return u(this,oe)?`<span class="wpb-image-parameter">${u(this,oe).replace("$1",`<span class="wpb-image-caption">${Ne(this.childNodes)}</span>`)}</span>`:super.print({class:"image-caption"})}};oe=new WeakMap,Cr=new WeakSet,Ri=function(){return u(this,oe)&&!u(this,oe).includes("$1")}});var Bi,ji,qi,Eo,vt,cn=b(()=>{"use strict";K();_();Q();F();Dt();Pi();Bi=new Map([["manualthumb","Thumb"],["frameless","Frameless"],["framed","Frame"],["thumbnail","Thumb"]]),ji=new Set(["left","right","center","none"]),qi=new Set(["baseline","sub","super","top","text-top","middle","bottom","text-bottom"]),Eo=(d,r,e,t)=>{if(t===void 0)return[];let n=new RegExp(`${[d,r,e].map(Hn).join("|")}`,"gu"),i=[],s=n.exec(t),o=0,a=0;for(;s;){let{0:p,index:g}=s;p!==e?o+=p===d?1:-1:o===0&&(i.push(t.slice(a,g)),{lastIndex:a}=n),s=n.exec(t)}return i.push(t.slice(a)),i},vt=class extends Ce{get type(){return"file"}get extension(){return this.getTitle().extension}constructor(r,e,t=f.getConfig(),n=[],i="|"){super(r,void 0,t,n,i);let{extension:s}=this.getTitle(!0);this.append(...Eo("-{","}-","|",e).map(o=>new Sr(o,s,t,n)))}lint(r=this.getAbsoluteIndex(),e){var h;let t=super.lint(r,e),n=this.getAllArgs().filter(({childNodes:m})=>{let k=m.filter(x=>x.text().trim());return k.length!==1||k[0].type!=="arg"}),i=[...new Set(n.map(({name:m})=>m))],s=i.filter(m=>Bi.has(m)),o=i.filter(m=>ji.has(m)),a=i.filter(m=>qi.has(m)),[p]=s,g=p==="framed"||p==="manualthumb",l=new E(this,r);if(this.closest("ext-link-text")&&((h=this.getValue("link"))==null?void 0:h.trim())!==""&&t.push(N(this,l,"nested-link","internal link in an external link")),g)for(let m of n.filter(({name:k})=>k==="width")){let k=C(m,l,"invalid-gallery","invalid image parameter");k.fix={range:[k.startIndex-1,k.endIndex],text:""},t.push(k)}if(n.length===i.length&&s.length<2&&o.length<2&&a.length<2)return t;let c=(m,k)=>x=>C(x,l,"no-duplicate",f.msg(`${m} image $1 parameter`,k));for(let m of i){if(m==="invalid"||m==="width"&&g)continue;let k=n.filter(({name:x})=>x===m);m==="caption"&&(k=[...k.slice(0,-1).filter(x=>x.text()),...k.slice(-1)]),k.length>1&&t.push(...k.map(c("duplicated",m)))}return s.length>1&&t.push(...n.filter(({name:m})=>Bi.has(m)).map(c("conflicting","frame"))),o.length>1&&t.push(...n.filter(({name:m})=>ji.has(m)).map(c("conflicting","horizontal-alignment"))),a.length>1&&t.push(...n.filter(({name:m})=>qi.has(m)).map(c("conflicting","vertical-alignment"))),t}getAllArgs(){return this.childNodes.slice(1)}getArgs(r){return this.getAllArgs().filter(({name:e})=>r===e)}getArg(r){let e=this.getArgs(r);return e[r==="manualthumb"?0:e.length-1]}getValue(r){var e;return(e=this.getArg(r))==null?void 0:e.getValue()}}});var At,hn=b(()=>{"use strict";_();Se();F();P();cn();At=class extends vt{constructor(e,t,n,i=f.getConfig(),s=[]){let o;if(n!==void 0){let{length:a}=s;o=new y(n,i,s);for(let p=1;p<11;p++)o.parseOnce();s.splice(a,1)}super(t,o==null?void 0:o.toString(),i,s);X(this,"privateType","imagemap-image");this.setAttribute("bracket",!1),this.privateType=`${e}-image`,this.seal("privateType",!0)}get type(){return this.privateType}getTitle(){let e=this.type==="imagemap-image";return this.normalizeTitle(this.firstChild.toString(),e?0:6,!0,!e)}getAttribute(e){return e==="padding"?0:super.getAttribute(e)}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),{ns:i,interwiki:s}=this.getAttribute("title");return(s||i!==6)&&n.push(N(this,{start:e},"invalid-gallery","invalid gallery image")),n}}});var Nr,_i,$r,Oi=b(()=>{"use strict";F();P();hn();_e();$r=class extends y{constructor(e,t=f.getConfig(),n=[]){var i;super(void 0,t,n,{});T(this,Nr);for(let s of(i=e==null?void 0:e.split(`
|
|
11
|
+
`))!=null?i:[]){let o=/^([^|]+)(?:\|(.*))?/u.exec(s);if(!o){super.insertAt(s.trim()?new U(s,t,n):s);continue}let[,a,p]=o;R(this,Nr,_i).call(this,a)?super.insertAt(new At("gallery",a,p,t,n)):super.insertAt(new U(s,t,n))}}get type(){return"ext-inner"}toString(e){return super.toString(e,`
|
|
12
|
+
`)}text(){return super.text(`
|
|
13
|
+
`).replace(/\n\s*\n/gu,`
|
|
14
|
+
`)}getGaps(){return 1}lint(e=this.getAbsoluteIndex(),t){let{top:n,left:i}=this.getRootNode().posFromIndex(e),s=[];for(let[o,a]of this.childNodes.entries()){let p=a.toString(),{length:g}=p,l=p.trim(),c=n+o,h=o?0:i;if(a.type==="noinclude"&&l&&!/^<!--.*-->$/u.test(l)){let m=e+g;s.push({rule:"no-ignored",message:f.msg("invalid content in <$1>","gallery"),severity:l.startsWith("|")?"warning":"error",startIndex:e,endIndex:m,startLine:c,endLine:c,startCol:h,endCol:h+g,suggestions:[{desc:"remove",range:[e,m],text:""},{desc:"comment",range:[e,m],text:`<!--${p}-->`}]})}else a.type!=="noinclude"&&a.type!=="text"&&s.push(...a.lint(e,t));e+=g+1}return s}print(){return super.print({sep:`
|
|
15
|
+
`})}};Nr=new WeakSet,_i=function(e){return this.normalizeTitle(e,6,!0,!0).valid}});var wt,mn=b(()=>{"use strict";_();Dt();wt=class extends Ce{get type(){return"link"}lint(r=this.getAbsoluteIndex(),e){let t=super.lint(r,e);return this.closest("ext-link-text")&&t.push(N(this,{start:r},"nested-link","internal link in an external link")),t}}});var Lo,Io,Yt,Le,Er=b(()=>{"use strict";_();K();Q();F();P();Lo=String.raw`(?:[\p{Zs}\t]| |�*160;|&#[xX]0*[aA]0;)`,Io=new RegExp(`${Lo}+`,"gu"),Le=class extends y{constructor(e,t="free-ext-link",n=f.getConfig(),i){super(e,n,i,{});T(this,Yt);v(this,Yt,t)}get type(){return u(this,Yt)}get innerText(){let e=new Map([["!","|"],["=","="]]),t=pe(this.childNodes.map(n=>{let{type:i}=n,s=String(n.name);return i==="magic-word"&&e.has(s)?e.get(s):n}));return this.type==="magic-link"&&(t=t.replace(Io," ")),t}get link(){let{innerText:e}=this;return this.type==="magic-link"?e.startsWith("ISBN")?`ISBN ${e.slice(5).replace(/[- ]/gu,"").replace(/x$/u,"X")}`:e:Vn(e)}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),i=new E(this,e);if(this.type==="magic-link"){let{link:p}=this;if(p.startsWith("ISBN")){let g=[...p.slice(5)].map(l=>l==="X"?10:Number(l));(g.length===10&&g.reduce((l,c,h)=>l+c*(10-h),0)%11||g.length===13&&(g[12]===10||g.reduce((l,c,h)=>l+c*(h%2?3:1),0)%10))&&n.push(N(this,i,"invalid-isbn","invalid ISBN"))}return n}let s=this.type==="ext-link-url",o=s?/\|/u:/[,;。:!?()]+/u,a=this.childNodes.find(p=>p.type==="text"&&o.test(p.data));if(a){let{data:p}=a,g=C(a,i,"unterminated-url",f.msg("$1 in URL",s?'"|"':"full-width punctuation"),"warning"),{index:l,0:c}=o.exec(p),h=g.startIndex+l;g.suggestions=s?[{desc:"whitespace",range:[h,h+1],text:" "}]:[{desc:"whitespace",range:[h,h],text:" "},{desc:"escape",range:[h,h+c.length],text:encodeURI(c)}],n.push(g)}return n}};Yt=new WeakMap});var Ie,St,fn=b(()=>{"use strict";Se();_();F();P();Er();St=class extends y{constructor(e,t="",n="",i=f.getConfig(),s=[]){super(void 0,i,s,{});T(this,Ie);let o=e&&/^\0\d+f\x7F$/u.test(e)?s[Number(e.slice(1,-2))]:new Le(e,"ext-link-url",i,s);if(this.insertAt(o),v(this,Ie,t),n){let a=new y(n,i,s,{});a.type="ext-link-text",a.setAttribute("stage",10),this.insertAt(a)}}get type(){return"ext-link"}toString(e){return this.length===1?`[${super.toString(e)}${u(this,Ie)}]`:`[${super.toString(e,u(this,Ie))}]`}text(){return`[${super.text(" ")}]`}getAttribute(e){return e==="padding"?1:super.getAttribute(e)}getGaps(){return u(this,Ie).length}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t);return this.length===1&&this.closest("heading-title")&&n.push(N(this,{start:e},"var-anchor","variable anchor in a section header")),n}print(){return super.print(this.length===1?{pre:"[",post:`${u(this,Ie)}]`}:{pre:"[",sep:u(this,Ie),post:"]"})}};Ie=new WeakMap});var er,Mi=b(()=>{"use strict";F();P();_e();mn();fn();er=class extends y{get type(){return"imagemap-link"}constructor(r,e,t,n=f.getConfig(),i=[]){super(void 0,n,i),this.append(r,e.length===2?new wt(...e,n,i):new St(...e,n,i),new U(t,n,i))}}});var Lr,Gi=b(()=>{"use strict";_();be();Q();F();P();_e();hn();Mi();Lr=class extends y{get type(){return"ext-inner"}get image(){return this.childNodes.find(kt("imagemap-image"))}constructor(r,e=f.getConfig(),t=[]){if(super(void 0,e,t,{}),!r)return;let n=r.split(`
|
|
16
|
+
`),i=new Set(e.protocol.split("|")),s=U,o=!0,a=!1;for(let p of n){let g=p.trim();if(!(a||!g||g.startsWith("#"))){if(o){let[l,...c]=p.split("|"),h=this.normalizeTitle(l,0,!0);if(h.valid&&!h.interwiki&&h.ns===6){let m=new At("imagemap",l,c.length>0?c.join("|"):void 0,e,t);super.insertAt(m),o=!1;continue}else a=!0}else if(p.trim().split(/[\t ]/u)[0]==="desc"){super.insertAt(p);continue}else if(p.includes("[")){let l=p.indexOf("["),c=p.slice(l),h=/^\[\[([^|]+)(?:\|([^\]]+))?\]\][\w\s]*$/u.exec(c);if(h){if(this.normalizeTitle(h[1],0,!0,!1,!0).valid){super.insertAt(new er(p.slice(0,l),h.slice(1),c.slice(c.indexOf("]]")+2),e,t));continue}}else if(i.has(c.slice(1,c.indexOf(":")+1))||i.has(c.slice(1,c.indexOf("//")+2))){let m=/^\[([^\]\s]+)(?:(\s+(?!\s))([^\]]*))?\][\w\s]*$/u.exec(c);if(m){super.insertAt(new er(p.slice(0,l),m.slice(1),c.slice(c.indexOf("]")+1),e,t));continue}}}}super.insertAt(new s(p,e,t))}}toString(r){return super.toString(r,`
|
|
17
|
+
`)}text(){return super.text(`
|
|
18
|
+
`).replace(/\n{2,}/gu,`
|
|
19
|
+
`)}getGaps(){return 1}lint(r=this.getAbsoluteIndex(),e){let t=super.lint(r,e),n=new E(this,r);return this.image?t.push(...this.childNodes.filter(i=>{let s=i.toString().trim();return i.type==="noinclude"&&s&&!s.startsWith("#")}).map(i=>C(i,n,"invalid-imagemap","invalid link in <imagemap>"))):t.push(N(this,n,"invalid-imagemap","<imagemap> without an image")),t}print(){return super.print({sep:`
|
|
20
|
+
`})}}});var Ir,zi=b(()=>{"use strict";_();F();qe();Ir=class extends re{get type(){return"ext-inner"}lint(r=this.getAbsoluteIndex()){let{name:e,firstChild:{data:t}}=this;if((e==="templatestyles"||e==="section")&&t){let n=N(this,{start:r},"void-ext",f.msg("nothing should be in <$1>",e));return n.fix={range:[r,n.endIndex],text:""},[n]}return super.lint(r,new RegExp(String.raw`<\s*(?:/\s*)${e==="nowiki"?"":"?"}(${e})\b`,"giu"))}}});var Fr={};se(Fr,{NestedToken:()=>xn});var Fo,tr,Ct,xn,Rr=b(()=>{"use strict";_();Q();Xt();Ar();F();P();bn();_e();Fo=new Set(["comment","include","arg","template","magic-word"]),xn=class extends y{constructor(e,t,n,i=f.getConfig(),s=[]){if(typeof t=="boolean"){let o=Symbol("InputboxToken"),{length:a}=s;s.push(o),e&&(e=Ze(e,i,s,t)),e&&(e=Jt(e,i,s)),s.splice(a,1)}else e&&(e=e.replace(t,(o,a,p,g,l)=>{let c=`\0${s.length+1}e\x7F`;return new $t(a,p,g,l,i,!1,s),c}));e&&(e=e.replace(/(^|\0\d+.\x7F)([^\0]+)(?=$|\0\d+.\x7F)/gu,(o,a,p)=>(new U(p,i,s),`${a}\0${s.length}n\x7F`)));super(e,i,s);T(this,tr);T(this,Ct);v(this,tr,[...n]),v(this,Ct,t)}get type(){return"ext-inner"}lint(e=this.getAbsoluteIndex(),t){let n=new E(this,e),i=u(this,Ct)?"includeonly":"noinclude",s=typeof u(this,Ct)=="boolean"?new RegExp(String.raw`^(?:<${i}(?:\s[^>]*)?/?>|</${i}\s*>)$`,"iu"):/^<!--.*-->$/su;return[...super.lint(e,t),...this.childNodes.filter(o=>{if(o.type==="ext")return!u(this,tr).includes(o.name);if(Fo.has(o.type))return!1;let a=o.toString().trim();return a&&!s.test(a)}).map(o=>{let a=C(o,n,"no-ignored",f.msg("invalid content in <$1>",this.name));return a.suggestions=[{desc:"remove",range:[a.startIndex,a.endIndex],text:""},{desc:"comment",range:[a.startIndex,a.endIndex],text:`<!--${o.toString()}-->`}],a})]}};tr=new WeakMap,Ct=new WeakMap});var Wi,$t,bn=b(()=>{"use strict";_();Q();F();P();sn();xr();vi();ln();Ii();Oi();Gi();zi();Wi=(d,r)=>{let e=new Set(d);return e.delete(r),[...e]},$t=class extends ht{get type(){return"ext"}constructor(r,e,t,n,i=f.getConfig(),s=!1,o=[]){var c;let a=r.toLowerCase(),p=new Ge(!e||e.trimStart()!==e?e:` ${e}`,"ext-attrs",a,i,o),g={...i,ext:Wi(i.ext,a),excludes:[...(c=i.excludes)!=null?c:[]]},l;switch(g.inExt=!0,a){case"tab":g.ext=Wi(g.ext,"tabs");case"indicator":case"poem":case"ref":case"option":case"combooption":case"tabs":case"poll":case"seo":a==="poem"&&g.excludes.push("heading"),l=new y(t,g,o);break;case"pre":l=new br(t,g,o);break;case"dynamicpagelist":l=new bt(s,t,g,o);break;case"inputbox":g.excludes.push("heading"),l=new wr(s,t,g,o);break;case"references":{let{NestedToken:h}=(Rr(),Z(Fr));g.excludes.push("heading"),l=new h(t,s,["ref"],g,o);break}case"choose":{let{NestedToken:h}=(Rr(),Z(Fr));l=new h(t,/<(option|choicetemplate)(\s[^>]*?)?(?:\/>|>(.*?)<\/(\1)>)/gsu,["option","choicetemplate"],g,o);break}case"combobox":{let{NestedToken:h}=(Rr(),Z(Fr));l=new h(t,/<(combooption)(\s[^>]*?)?(?:\/>|>(.*?)<\/(combooption\s*)>)/gisu,["combooption"],g,o);break}case"gallery":l=new $r(t,g,o);break;case"imagemap":l=new Lr(t,g,o);break;default:l=new Ir(t,g,o)}l.setAttribute("name",a),l.type==="plain"&&(l.type="ext-inner"),super(r,p,l,n,i,o),this.seal("closed",!0)}lint(r=this.getAbsoluteIndex(),e){let t=super.lint(r,e),n=new E(this,r);return this.name!=="nowiki"&&this.closest("html-attrs,table-attrs")&&t.push(N(this,n,"parsing-order","extension tag in HTML tag attributes")),this.name==="ref"&&this.closest("heading-title")&&t.push(N(this,n,"var-anchor","variable anchor in a section header")),t}}});var Ui,Tn,Ro,tt,Di=b(()=>{"use strict";_();He();F();qe();Ui=[ue(!1)];tt=class extends(Ro=re){constructor(e,t=!0,n,i){super(e,n,i);X(this,"closed");this.closed=t}get type(){return"comment"}getAttribute(e){return e==="padding"?4:super.getAttribute(e)}lint(e=this.getAbsoluteIndex()){if(this.closed)return[];let t=N(this,{start:e},"unclosed-comment",f.msg("unclosed $1","HTML comment"));return t.fix={range:[t.endIndex,t.endIndex],text:"-->"},[t]}toString(e){return e?"":`<!--${this.innerText}${this.closed?"-->":""}`}print(){return super.print({pre:"<!--",post:this.closed?"-->":""})}};Tn=le(Ro),tt=ge(Tn,0,"CommentToken",Ui,tt),de(Tn,1,tt)});var Hi={};se(Hi,{parseCommentAndExt:()=>Ze});var Ze,Xt=b(()=>{"use strict";gi();_e();ui();bn();Di();Ze=(d,r,e,t)=>{let n="<onlyinclude>",i="</onlyinclude>",{length:s}=n,o=()=>{let c=d.indexOf(n);return{i:c,j:d.indexOf(i,c+s)}};if(t){let{i:c,j:h}=o();if(c!==-1&&h!==-1){let m="",k=x=>{new U(x,r,e),m+=`\0${e.length-1}n\x7F`};for(;c!==-1&&h!==-1;){let x=`\0${e.length}e\x7F`;new hr(d.slice(c+s,h),r,e),c>0&&k(d.slice(0,c)),m+=x,d=d.slice(h+s+1),{i:c,j:h}=o()}return d&&k(d),m}}let a=r.ext.join("|"),p=t?"includeonly":"(?:no|only)include",g=t?"noinclude":"includeonly",l=new RegExp(String.raw`<!--.*?(?:-->|$)|<${p}(?:\s[^>]*)?/?>|</${p}\s*>|<(${a})(\s[^>]*?)?(?:/>|>(.*?)</(\1\s*)>)|<(${g})(\s[^>]*?)?(?:/>|>(.*?)(?:</(${g}\s*)>|$))`,"gisu");return d.replace(l,(c,h,m,k,x,A,S,$,w)=>{let L=e.length,B="n";if(h)B="e",new $t(h,m,k,x,r,A,e);else if(c.startsWith("<!--")){B="c";let j=c.endsWith("-->");new tt(c.slice(4,j?-3:void 0),j,r,e)}else A?new Qe(A,S,$,w,r,e):new U(c,r,e);return`\0${L}${B}\x7F`})}});var Po,Bo,jo,Nt,he,ze,Pr,Vi=b(()=>{"use strict";_();K();Q();P();Po=new Set(["if","ifeq","ifexpr","ifexist","iferror","switch"]),Bo=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"]),jo=new Set(["strike","big","center","font","tt"]),Pr=class extends y{constructor(e,t,n,i,s,o){super(void 0,s,o);T(this,Nt);T(this,he);T(this,ze);this.insertAt(t),this.setAttribute("name",e.toLowerCase()),v(this,Nt,n),v(this,he,i),v(this,ze,e)}get type(){return"html"}get selfClosing(){return u(this,he)}get closing(){return u(this,Nt)}toString(e){return`<${this.closing?"/":""}${u(this,ze)}${super.toString(e)}${u(this,he)?"/":""}>`}text(){let{closing:e}=this,t=u(this,ze)+(e?"":super.text());return`<${e?"/":""}${t}${u(this,he)?"/":""}>`}getAttribute(e){return e==="padding"?u(this,ze).length+(this.closing?2:1):super.getAttribute(e)}lint(e=this.getAbsoluteIndex(),t){var s;let n=super.lint(e,t),i=new E(this,e);this.name==="h1"&&!this.closing&&n.push(N(this,i,"h1","<h1>")),this.closest("table-attrs")&&n.push(N(this,i,"parsing-order","HTML tag in table attributes"));try{this.findMatchingTag()}catch(o){if(o instanceof SyntaxError){let{message:a}=o,p=a.split(":")[0].toLowerCase(),g=N(this,i,"unmatched-tag",p);if(p==="unclosed tag"&&!this.closest("heading-title"))if(Bo.has(this.name)){let l=(s=this.parentNode)==null?void 0:s.childNodes,c=l==null?void 0:l.indexOf(this);l!=null&&l.slice(0,c).some(({type:h,name:m})=>h==="html"&&m===this.name)||(g.severity="warning")}else g.severity="warning";else if(p==="unmatched closing tag"){let l=this.closest("magic-word");l&&Po.has(l.name)?g.severity="warning":g.suggestions=[{desc:"remove",range:[e,g.endIndex],text:""}]}else if(p==="tag that is both closing and self-closing"){let{html:[,,l]}=this.getAttribute("config");l.includes(this.name)&&(g.fix={range:[e+1,e+2],text:""})}n.push(g)}}return jo.has(this.name)&&n.push(N(this,i,"obsolete-tag","obsolete HTML tag","warning")),(this.name==="b"||this.name==="strong")&&this.closest("heading-title")&&n.push(N(this,i,"bold-header","bold in section header","warning")),n}findMatchingTag(){let{html:[e,t,n]}=this.getAttribute("config"),{name:i,parentNode:s,closing:o}=this,a=Xn(this.toString());if(o&&(u(this,he)||n.includes(i)))throw new SyntaxError(`Tag that is both closing and self-closing: ${a}`);if(n.includes(i)||u(this,he)&&t.includes(i))return this;if(u(this,he)&&e.includes(i))throw new SyntaxError(`Invalid self-closing tag: ${a}`);if(!s)return;let{childNodes:p}=s,g=p.indexOf(this),l=(o?p.slice(0,g).reverse():p.slice(g+1)).filter(h=>h.type==="html"&&h.name===i),c=o?-1:1;for(let h of l)if(u(h,Nt)?c--:c++,c===0)return h;throw new SyntaxError(`${o?"Unmatched closing":"Unclosed"} tag: ${a}`)}print(){return super.print({pre:`<${this.closing?"/":""}${u(this,ze)}`,post:`${u(this,he)?"/":""}>`})}json(){let e=super.json();return Object.assign(e,{closing:this.closing,selfClosing:u(this,he)}),e}};Nt=new WeakMap,he=new WeakMap,ze=new WeakMap});var Xi={};se(Xi,{parseHtml:()=>qo});var qo,Qi=b(()=>{"use strict";xr();Vi();qo=(d,r,e)=>{let t=/^(\/?)([a-z][^\s/>]*)((?:\s|\/(?!>))[^>]*?)?(\/?>)([^<]*)$/iu,{html:n}=r,i=new Set([...n[0],...n[1],...n[2]]),s=d.split("<"),o=s.shift();for(let a of s){let p=t.exec(a),g=p==null?void 0:p[2],l=g==null?void 0:g.toLowerCase();if(!p||!i.has(l)){o+=`<${a}`;continue}let[,c,,h="",m,k]=p,{length:x}=e,A=new Ge(h,"html-attrs",l,r,e),S=A.getAttr("itemprop");if(l==="meta"&&(S===void 0||A.getAttr("content")===void 0)||l==="link"&&(S===void 0||A.getAttr("href")===void 0)){o+=`<${a}`,e.length=x;continue}o+=`\0${e.length}x\x7F${k}`,new Pr(g,A,c==="/",m==="/>",r,e)}return o}});var Zi,Ji=b(()=>{"use strict";be();Zi=(d=0)=>(r,e)=>{var n,Ki;class t extends r{constructor(){super(...arguments);T(this,n)}getAttr(a){return u(this,n,Ki).getAttr(a)}}return n=new WeakSet,Ki=function(){return this.childNodes[d]},ur(t,r),t}});var Et,yn=b(()=>{"use strict";Ji();F();P();pt();xr();Et=class extends Zi(1)(y){constructor(r,e,t,n,i=f.getConfig(),s=[],o){super(void 0,i,s,o),this.append(new ce(e,r,"table-syntax",i,s,{}),new Ge(n,"table-attrs",t,i,s))}}});var me,rr,nt,kn,Yi,rt,vn=b(()=>{"use strict";_();Se();be();Q();F();P();yn();rt=class extends Et{constructor(e,t,n=f.getConfig(),i=[]){var p;let s=/\||\0\d+!\x7F/u.exec(t!=null?t:""),o=s?t.slice(0,s.index):"";/\[\[|-\{/u.test(o)&&(s=null,o="");super(/^(?:\n[^\S\n]*(?:[|!]|\|\+|\{\{\s*!\s*\}\}\+?)|(?:\||\{\{\s*!\s*\}\}){2}|!!|\{\{\s*!!\s*\}\})$/u,e,"td",o,n,i);T(this,nt);T(this,me,"");T(this,rr);s&&([lr(this,me)._]=s);let a=new y(t==null?void 0:t.slice(((p=s==null?void 0:s.index)!=null?p:NaN)+u(this,me).length),n,i);a.type="td-inner",a.setAttribute("stage",4),this.insertAt(a)}get type(){return"td"}get rowspan(){return this.getAttr("rowspan")}get colspan(){return this.getAttr("colspan")}get subtype(){return R(this,nt,kn).call(this).subtype}afterBuild(){u(this,me).includes("\0")&&v(this,me,this.buildFromStr(u(this,me),0)),super.afterBuild()}toString(e){let{childNodes:[t,n,i]}=this;return t.toString(e)+n.toString(e)+u(this,me)+i.toString(e)}text(){let{childNodes:[e,t,n]}=this;return e.text()+t.text()+u(this,me)+n.text()}getGaps(e){return e===1?u(this,me).length:0}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),i=new E(this,e+this.getRelativeIndex(this.length-1));for(let s of this.lastChild.childNodes)if(s.type==="text"){let{data:o}=s;if(o.includes("|")){let a=o.includes("||"),p=C(s,i,"pipe-like",'additional "|" in a table cell',a?"error":"warning");if(a){let g={caption:"|+",td:"|",th:"!"}[this.subtype];p.fix={range:[p.startIndex,p.endIndex],text:o.replace(/\|\|/gu,`
|
|
21
|
+
${g}`)}}else p.suggestions=[{desc:"escape",range:[p.startIndex,p.endIndex],text:o.replace(/\|/gu,"|")}];n.push(p)}}return n}isIndependent(){return this.firstChild.text().startsWith(`
|
|
22
|
+
`)}getAttr(e){let t=super.getAttr(e);return e==="rowspan"||e==="colspan"?parseInt(t)||1:t}print(){let{childNodes:[e,t,n]}=this;return`<span class="wpb-td">${e.print()}${t.print()}${u(this,me)}${n.print()}</span>`}json(){let e=super.json();return e.subtype=this.subtype,e}};me=new WeakMap,rr=new WeakMap,nt=new WeakSet,kn=function(){var t;let{rev:e}=ye;return(t=u(this,rr))!=null||v(this,rr,[e,R(this,nt,Yi).call(this)]),u(this,rr)[1]},Yi=function(){var o;let e=this.firstChild.text(),t=e.slice(-1),n="td";if(t==="!"?n="th":t==="+"&&(n="caption"),this.isIndependent())return{subtype:n};let{previousSibling:i}=this;return{...R(o=i,nt,kn).call(o)}}});var Lt,An=b(()=>{"use strict";_();yn();vn();Lt=class extends Et{lint(r=this.getAbsoluteIndex(),e){let t=super.lint(r,e),n=this.childNodes.find(({type:a})=>a==="table-inter");if(!n)return t;let i=n.childNodes.find(a=>a.text().trim()),s=/^\s*(?:!|\{\{\s*![!-]?\s*\}\})/u;if(!i||s.test(i.toString())||i.is("arg")&&s.test(i.default||""))return t;if(i.is("magic-word"))try{if(i.getPossibleValues().every(a=>s.test(a.text())))return t}catch(a){}let o=C(n,{start:r},"fostered-content","content to be moved out from the table");return o.severity=i.type==="template"?"warning":"error",o.startIndex++,o.startLine++,o.startCol=0,t.push(o),t}getRowCount(){return Number(this.childNodes.some(r=>r instanceof rt&&r.isIndependent()&&!r.firstChild.text().endsWith("+")))}getNthCol(r,e){let t=0;for(let n of this.childNodes.slice(2))if(n instanceof rt&&(n.isIndependent()&&(t=+(n.subtype!=="caption")),r-=t,r<0))return n}}});var _o,Oo,wn,Br,es=b(()=>{"use strict";_();be();Q();F();An();pt();_o=/^\n[^\S\n]*(?:\|\}|\{\{\s*!\s*\}\}\}|\{\{\s*!\)\s*\}\})$/u,Oo=({type:d})=>d==="tr"||d==="table-syntax",wn=class extends Array{},Br=class extends Lt{get type(){return"table"}get closed(){return this.lastChild.type==="table-syntax"}constructor(r,e,t,n){super(/^(?:\{\||\{\{\{\s*!\s*\}\}|\{\{\s*\(!\s*\}\})$/u,r,"table",e,t,n,{})}lint(r=this.getAbsoluteIndex(),e){let t=super.lint(r,e),n=new E(this,r);this.closed||t.push(C(this.firstChild,n,"unclosed-table",f.msg("unclosed $1","table")));let i=this.getLayout(),{length:s}=i;if(s>1){let o=1,a=1/0,p=0;for(;p<s;p++){let g=i[p],l=g.length;if(l<o)break;l<a&&(a=l);let c=g.indexOf(g[l-1])+1;if(c>a)break;c>o&&(o=c)}if(p<s){let g=C(this.getNthRow(p),n,"table-layout","inconsistent table layout","warning");g.startIndex++,g.startLine++,g.startCol=0,t.push(g)}}return t}close(r=`
|
|
23
|
+
|}`,e){let t=this.getAttribute("config"),n=this.getAttribute("accum"),i=e?[r]:f.parse(r,this.getAttribute("include"),2,t).childNodes;ye.run(()=>{let s=new ce(void 0,_o,"table-syntax",t,n,{});super.insertAt(s)}),this.lastChild.replaceChildren(...i)}getLayout(r){let e=this.getAllRows(),{length:t}=e,n=new wn(...ts(t,()=>[]));for(let[i,s]of n.entries()){let o=0,a=0,p;for(let g of e[i].childNodes.slice(2))if(g.type==="td"){if(g.isIndependent()&&(p=g.subtype!=="caption"),p){let l={row:i,column:o},{rowspan:c,colspan:h}=g;for(o++;s[a];)a++;for(let m=i;m<Math.min(i+c,t);m++)for(let k=a;k<a+h;k++)n[m][k]=l;a+=h}}else if(Oo(g))break}return n}getAllRows(){return[...super.getRowCount()?[this]:[],...this.childNodes.slice(1).filter(r=>r.type==="tr"&&r.getRowCount()>0)]}getNthCell(r){var t;let e=r;return e&&((t=this.getNthRow(e.row,!1,!1))==null?void 0:t.getNthCol(e.column))}getNthRow(r,e,t){let n=super.getRowCount();if(r===0&&n)return this;n&&r--;for(let i of this.childNodes.slice(2))if(i.type==="tr"&&i.getRowCount()&&(r--,r<0))return i}json(){let r=super.json();return r.closed=this.closed,r}}});var jr,rs=b(()=>{"use strict";An();jr=class extends Lt{get type(){return"tr"}constructor(r,e,t,n){super(/^\n[^\S\n]*(?:\|-+|\{\{\s*!\s*\}\}-+|\{\{\s*!-\s*\}\}-*)$/u,r,"tr",e,t,n,{})}}});var It,Sn=b(()=>{"use strict";qe();It=class extends re{}});var Ft,Cn=b(()=>{"use strict";Sn();Ft=class extends It{get type(){return"dd"}}});var ns={};se(ns,{parseTable:()=>Go});var Mo,Go,is=b(()=>{"use strict";P();es();rs();vn();Cn();Mo=d=>d.lastChild.constructor!==y,Go=({firstChild:{data:d},type:r,name:e},t,n)=>{let i=[],s=d.split(`
|
|
24
|
+
`),o=r==="root"||r==="parameter-value"||r==="ext-inner"&&e==="poem"?"":`
|
|
25
|
+
${s.shift()}`,a,p=(l,c)=>{if(!c){o+=l;return}let{lastChild:h}=c;if(Mo(c)){let m=new y(l,t,n);m.type="table-inter",m.setAttribute("stage",3),c.insertAt(m)}else h.setText(h.toString()+l)},g=()=>a.type==="td"?i.pop():a;for(let l of s){a=i.pop();let[c]=/^(?:\s|\0\d+[cno]\x7F)*/u.exec(l),h=l.slice(c.length),m=/^(:*)((?:\s|\0\d+[cn]\x7F)*)(\{\||\{(?:\0\d+[cn]\x7F)*\0\d+!\x7F|\0\d+\{\x7F)(.*)$/u.exec(h);if(m){for(;a&&a.type!=="td";)a=i.pop();let[,w,L,B,j]=m;w&&new Ft(w,t,n),p(`
|
|
26
|
+
${c}${w&&`\0${n.length-1}d\x7F`}${L}\0${n.length}b\x7F`,a),i.push(...a?[a]:[],new Br(B,j,t,n));continue}else if(!a){o+=`
|
|
27
|
+
${l}`;continue}let k=/^(?:(\|\}|\0\d+!\x7F\}|\0\d+\}\x7F)|(\|-+|\0\d+!\x7F-+|\0\d+-\x7F-*)(?!-)|(!|(?:\||\0\d+!\x7F)\+?))(.*)$/u.exec(h);if(!k){p(`
|
|
28
|
+
${l}`,a),i.push(a);continue}let[,x,A,S,$]=k;if(x){for(;a.type!=="table";)a=i.pop();a.close(`
|
|
29
|
+
${c}${x}`,!0),p($,i[i.length-1])}else if(A){a=g(),a.type==="tr"&&(a=i.pop());let w=new jr(`
|
|
30
|
+
${c}${A}`,$,t,n);i.push(a,w),a.insertAt(w)}else{a=g();let w=S==="!"?/!!|(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu:/(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu,L=w.exec($),B=0,j=`
|
|
31
|
+
${c}${S}`,q=D=>{let H=new rt(j,$.slice(B,L==null?void 0:L.index),t,n);return D.insertAt(H),H};for(;L;)q(a),{lastIndex:B}=w,[j]=L,L=w.exec($);i.push(a,q(a))}}return o.slice(1)}});var qr,ss=b(()=>{"use strict";qe();qr=class extends re{get type(){return"hr"}}});var os,$n,zo,it,as=b(()=>{"use strict";He();F();qe();os=[ue()];it=class extends(zo=re){get type(){return"double-underscore"}constructor(r,e,t=f.getConfig(),n){super(r,t,n)}getAttribute(r){return r==="padding"?2:super.getAttribute(r)}toString(){return`__${this.innerText}__`}print(){return super.print({pre:"__",post:"__"})}};$n=le(zo),it=ge($n,0,"DoubleUnderscoreToken",os,it),de($n,1,it)});var ls={};se(ls,{parseHrAndDoubleUnderscore:()=>Wo});var Wo,ds=b(()=>{"use strict";ss();as();dn();Wo=({firstChild:{data:d},type:r,name:e},t,n)=>{var a;let{doubleUnderscore:i}=t,s=new Set(i[0]),o=new Set(i[1]);return(a=t.regexHrAndDoubleUnderscore)!=null||(t.regexHrAndDoubleUnderscore=new RegExp(`__(${[...s,...o].join("|")})__`,"giu")),r!=="root"&&(r!=="ext-inner"||e!=="poem")&&(d=`\0${d}`),d=d.replace(/^((?:\0\d+[cno]\x7F)*)(-{4,})/gmu,(p,g,l)=>(new qr(l,t,n),`${g}\0${n.length-1}r\x7F`)).replace(t.regexHrAndDoubleUnderscore,(p,g)=>{var m,k;let l=o.has(g),c=g.toLowerCase(),h=s.has(c);return l||h?(new it(g,l,t,n),`\0${n.length-1}${h&&((k=(m=i[2])==null?void 0:m[c])!=null?k:c)==="toc"?"u":"n"}\x7F`):p}).replace(/^((?:\0\d+[cn]\x7F)*)(={1,6})(.+)\2((?:\s|\0\d+[cn]\x7F)*)$/gmu,(p,g,l,c,h)=>{let m=`${g}\0${n.length}h\x7F`;return new yt(l.length,[c,h],t,n),m}),r==="root"||r==="ext-inner"&&e==="poem"?d:d.slice(1)}});var _r,gs=b(()=>{"use strict";_();Q();F();qe();_r=class extends re{get type(){return"quote"}get bold(){return this.innerText.length!==2}get italic(){return this.innerText.length!==3}text(){let{parentNode:r,innerText:e}=this;return(r==null?void 0:r.type)==="image-parameter"&&r.name!=="caption"?"":e}lint(r=this.getAbsoluteIndex()){let{previousSibling:e,nextSibling:t,bold:n}=this,i=f.msg('lonely "$1"',"'"),s=[],o=new E(this,r),a,p=(g,l,c)=>({desc:"escape",range:[g,l],text:"'".repeat(c)});if((e==null?void 0:e.type)==="text"&&e.data.endsWith("'")){a=N(this,o,"lonely-apos",i);let{startIndex:g,startLine:l,startCol:c}=a,[,{length:h}]=/(?:^|[^'])('+)$/u.exec(e.data),m=r-h;s.push({...a,startIndex:m,endIndex:g,startCol:c-h,endLine:l,endCol:c,suggestions:[p(m,g,h)]})}if((t==null?void 0:t.type)==="text"&&t.data.startsWith("'")){a!=null||(a=N(this,o,"lonely-apos",i));let{endIndex:g,endLine:l,endCol:c}=a,[{length:h}]=/^'+/u.exec(t.data),m=g+h;s.push({...a,startIndex:g,endIndex:m,startLine:l,startCol:c,endCol:c+h,suggestions:[p(g,m,h)]})}return n&&this.closest("heading-title")&&s.push(N(this,o,"bold-header","bold in section header","warning")),s}json(){let r=super.json();return Object.assign(r,{bold:this.bold,italic:this.italic}),r}}});var ps={};se(ps,{parseQuotes:()=>Nn});var Nn,En=b(()=>{"use strict";gs();Nn=(d,r,e)=>{var g;let t=d.split(/('{2,})/u),{length:n}=t;if(n===1)return d;let i=0,s=0,o,a,p;for(let l=1;l<n;l+=2){let c=t[l].length;switch(c){case 2:s++;break;case 4:t[l-1]+="'",t[l]="'''";case 3:if(i++,o!==void 0)break;t[l-1].endsWith(" ")?a===void 0&&p===void 0&&(p=l):t[l-1].slice(-2,-1)===" "?o=l:a!=null||(a=l);break;default:t[l-1]+="'".repeat(c-5),t[l]="'''''",s++,i++}}if(s%2===1&&i%2===1){let l=(g=o!=null?o:a)!=null?g:p;l!==void 0&&(t[l]="''",t[l-1]+="'")}for(let l=1;l<n;l+=2)new _r(t[l],r,e),t[l]=`\0${e.length-1}q\x7F`;return t.join("")}});var us={};se(us,{parseExternalLinks:()=>Ln});var Ln,In=b(()=>{"use strict";K();fn();Er();Ln=(d,r,e,t)=>{var n;return(n=r.regexExternalLinks)!=null||(r.regexExternalLinks=new RegExp(String.raw`\[(\0\d+f\x7F|(?:(?:${r.protocol}|//)${Ae}|\0\d+m\x7F)${we}(?=[[\]<>"\t\p{Zs}]|\0\d))(\p{Zs}*(?!\p{Zs}))([^\]\x01-\x08\x0A-\x1F\uFFFD]*)\]`,"giu")),d.replace(r.regexExternalLinks,(i,s,o,a)=>{let{length:p}=e,g=/&[lg]t;/u.exec(s);return g&&(s=s.slice(0,g.index),o="",a=s.slice(g.index)+o+a),t?(new Le(s,"ext-link-url",r,e),`[\0${p}f\x7F${o}${a}]`):(new St(s,o,a,r,e),`\0${p}w\x7F`)})}});var Or,cs=b(()=>{"use strict";Dt();Or=class extends Ce{get type(){return"category"}}});var ms={};se(ms,{parseLinks:()=>hs});var Uo,hs,fs=b(()=>{"use strict";F();En();In();mn();cn();cs();Uo=/^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(\||\0\d+!\x7F)(.*)$/su,hs=(d,r,e)=>{var s;(s=r.regexLinks)!=null||(r.regexLinks=new RegExp(String.raw`^\s*(?:${r.protocol}|//)`,"iu"));let t=r.inExt?/^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]]))?\]\](.*)$/su:/^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]])?)?\]\](.*)$/su,n=d.split("[["),i=n.shift();for(let o=0;o<n.length;o++){let a=!1,p,g,l,c,h=n[o],m=t.exec(h);if(m)[,p,g,l,c]=m,c.startsWith("]")&&(l!=null&&l.includes("["))&&(l+="]",c=c.slice(1));else{let L=Uo.exec(h);L&&(a=!0,[,p,g,l]=L)}if(p===void 0||r.regexLinks.test(p)||/\0\d+[exhbru]\x7F/u.test(p)){i+=`[[${h}`;continue}let k=p.trim().startsWith(":");if(k&&a){i+=`[[${h}`;continue}let x=f.normalizeTitle(p,0,!1,r,!0,!0,!0),{ns:A,valid:S,interwiki:$}=x;if(S){if(a){if($||A!==6){i+=`[[${h}`;continue}let L=!1;for(o++;o<n.length;o++){let B=n[o],j=B.split("]]");if(j.length>2){L=!0,l+=`[[${j[0]}]]${j[1]}`,c=j.slice(2).join("]]");break}else if(j.length===2)l+=`[[${j[0]}]]${j[1]}`;else{l+=`[[${B}`;break}}if(l=hs(l,r,e),!L){i+=`[[${p}${g}${l}`;continue}}}else{i+=`[[${h}`;continue}l&&(l=Nn(l,r,e));let w=wt;k||(!$&&A===6?(l&&(l=Ln(l,r,e,!0)),w=vt):!$&&A===14&&(w=Or)),l===void 0&&g&&(l=""),i+=`\0${e.length}l\x7F${c}`,new w(p,l,r,e,g)}return i}});var ys={};se(ys,{parseMagicLinks:()=>Ho});var Ts,xs,bs,Do,Ho,ks=b(()=>{"use strict";K();Er();Ts=String.raw`[\p{Zs}\t]| |�*160;|�*a0;`,xs=`(?:${Ts})+`,bs=`(?:${Ts}|-)`,Do=String.raw`(?:RFC|PMID)${xs}\d+\b|ISBN${xs}(?:97[89]${bs}?)?(?:\d${bs}?){9}[\dx]\b`,Ho=(d,r,e)=>{var t;return(t=r.regexMagicLinks)!=null||(r.regexMagicLinks=new RegExp(String.raw`(^|[^\p{L}\d_])(?:(?:${r.protocol})(${Ae}${we})|${Do})`,"giu")),d.replace(r.regexMagicLinks,(n,i,s)=>{let o=i?n.slice(i.length):n;if(s){let a="",p=/&(?:lt|gt|nbsp|#x0*(?:3[ce]|a0)|#0*(?:6[02]|160));/iu.exec(o);p&&(a=o.slice(p.index),o=o.slice(0,p.index));let g=o.includes("(")?/[^,;\\.:!?][,;\\.:!?]+$/u:/[^,;\\.:!?)][,;\\.:!?)]+$/u,l=g.exec(o);if(l){let c=1;l[0][1]===";"&&/&(?:[a-z]+|#x[\da-f]+|#\d+)$/iu.test(o.slice(0,l.index))&&(c=2),a=o.slice(l.index+c)+a,o=o.slice(0,l.index+c)}return a.length>=s.length?n:(new Le(o,void 0,r,e),`${i}\0${e.length-1}w\x7F${a}`)}else if(!/^(?:RFC|PMID|ISBN)/u.test(o))return n;return new Le(o,"magic-link",r,e),`${i}\0${e.length-1}i\x7F`})}});var vs,As=b(()=>{"use strict";vs=(d,r)=>d.startsWith(r)?r.length:[...r].findIndex((e,t)=>e!==d[t])});var Mr,ws=b(()=>{"use strict";Sn();Mr=class extends It{get type(){return"list"}}});var Ss={};se(Ss,{parseList:()=>Vo});var Vo,Cs=b(()=>{"use strict";As();ws();Cn();Vo=(d,r,e,t)=>{let n=/^((?:\0\d+[cno]\x7F)*)([;:*#]+\s*)/u.exec(d);if(!n)return r.lastPrefix="",d;let[i,s,o]=n,a=o.replace(/;/gu,":"),p=vs(a,r.lastPrefix),g=(p>1?o.slice(p-1):o).split(/(?=;)/u),l=g[0].startsWith(";"),c=g.length-(l?0:1);if(p>1){let q=o.slice(0,p-1);l?g.unshift(q):g[0]=q+g[0]}r.lastPrefix=a;let h=s+g.map((q,D)=>`\0${t.length+D}d\x7F`).join("")+d.slice(i.length);for(let q of g)new Mr(q,e,t);if(!c)return h;let{html:[m]}=e,k=/:+|-\{|\0\d+[xq]\x7F/gu,x=k,A=x.exec(h),S=0,$=!1,w=!1,L=0,B=(q,D)=>(new Ft(q,e,t),`${h.slice(0,D)}\0${t.length-1}d\x7F${h.slice(D+q.length)}`),j=q=>{q?S&&S--:S++};for(;A&&c;){let{0:q,index:D}=A;if(q==="-{"){if(!L){let{lastIndex:H}=x;x=/-\{|\}-/gu,x.lastIndex=H}L++}else if(q==="}-"){if(L--,!L){let{lastIndex:H}=x;x=k,x.lastIndex=H}}else if(q.endsWith("x\x7F")){let{name:H,closing:ne,selfClosing:ee}=t[Number(q.slice(1,-2))];(!ee||m.includes(H))&&j(ne)}else if(q.endsWith("q\x7F")){let{bold:H,italic:ne}=t[Number(q.slice(1,-2))];H&&(j($),$=!$),ne&&(j(w),w=!w)}else if(S===0){if(q.length>=c)return B(q.slice(0,c),D);c-=q.length,x.lastIndex=D+4+String(t.length).length,h=B(q,D)}A=x.exec(h)}return h}});var $s,Fe,Gr,Ns=b(()=>{"use strict";_();Q();F();P();Ee();$s=new Set(["A","T","R","D","-","H","N"]),Gr=class extends y{constructor(e,t=f.getConfig(),n=[]){super(void 0,t,n,{});T(this,Fe);this.append(...e.map(i=>new G(i,"converter-flag",t,n)))}get type(){return"converter-flags"}afterBuild(){v(this,Fe,this.childNodes.map(e=>e.text().trim())),super.afterBuild()}toString(e){return super.toString(e,";")}text(){return super.text(";")}getGaps(){return 1}getUnknownFlags(){return new Set(u(this,Fe).filter(e=>/\{{3}[^{}]+\}{3}/u.test(e)))}getVariantFlags(){let e=new Set(this.getAttribute("config").variants);return new Set(u(this,Fe).filter(t=>e.has(t)))}lint(e=this.getAbsoluteIndex(),t){let n=this.getVariantFlags(),i=this.getUnknownFlags(),s=new Set(u(this,Fe).filter(l=>$s.has(l))),o=u(this,Fe).filter(l=>!l).length,a=u(this,Fe).length-i.size-o,p=super.lint(e,t);if(n.size===a||s.size===a)return p;let g=new E(this,e);for(let[l,c]of this.childNodes.entries()){let h=c.text().trim();if(h&&!n.has(h)&&!i.has(h)&&(n.size>0||!s.has(h))){let m=C(c,g,"no-ignored","invalid conversion flag");n.size===0&&$s.has(h.toUpperCase())?m.fix={range:[m.startIndex,m.endIndex],text:h.toUpperCase()}:m.suggestions=[{desc:"remove",range:[m.startIndex-(l&&1),m.endIndex],text:""}],p.push(m)}}return p}print(){return super.print({sep:";"})}};Fe=new WeakMap});var Rt,Es=b(()=>{"use strict";F();P();Ee();Rt=class extends y{get type(){return"converter-rule"}constructor(r,e=!0,t=f.getConfig(),n=[]){super(void 0,t,n);let i=r.indexOf(":"),s=r.slice(0,i).indexOf("=>"),o=s===-1?r.slice(0,i):r.slice(s+2,i);e&&t.variants.includes(o.trim())?(super.insertAt(new G(o,"converter-rule-variant",t,n)),super.insertAt(new G(r.slice(i+1),"converter-rule-to",t,n)),s!==-1&&super.insertAt(new G(r.slice(0,s),"converter-rule-from",t,n),0)):super.insertAt(new G(r,"converter-rule-to",t,n))}toString(r){let{childNodes:e,firstChild:t,lastChild:n}=this;return e.length===3?`${t.toString(r)}=>${e[1].toString(r)}:${n.toString(r)}`:super.toString(r,":")}text(){let{childNodes:r,firstChild:e,lastChild:t}=this;return r.length===3?`${e.text()}=>${r[1].text()}:${t.text()}`:super.text(":")}getGaps(r){return r===0&&this.length===3?2:1}print(){let{childNodes:r}=this;if(r.length===3){let[e,t,n]=r;return`<span class="wpb-converter-rule">${e.print()}=>${t.print()}:${n.print()}</span>`}return super.print({sep:":"})}}});var zr,Ls=b(()=>{"use strict";K();F();P();Ns();Es();zr=class extends y{get type(){return"converter"}constructor(r,e,t=f.getConfig(),n=[]){super(void 0,t,n),this.append(new Gr(r,t,n));let[i]=e,s=i.includes(":"),o=new Rt(i,s,t,n);s&&o.length===1||!s&&e.length===2&&!te(e[1]).trim()?this.insertAt(new Rt(e.join(";"),!1,t,n)):this.append(o,...e.slice(1).map(a=>new Rt(a,!0,t,n)))}toString(r){let{childNodes:[e,...t]}=this;return`-{${e.toString(r)}${e.length>0?"|":""}${t.map(n=>n.toString(r)).join(";")}}-`}text(){let{childNodes:[r,...e]}=this;return`-{${r.text()}|${pe(e,";")}}-`}getAttribute(r){return r==="padding"?2:super.getAttribute(r)}getGaps(r){return r||this.firstChild.length>0?1:0}print(){let{childNodes:[r,...e]}=this;return`<span class="wpb-converter">-{${r.print()}${r.length>0?"|":""}${Ne(e,{sep:";"})}}-</span>`}}});var Is={};se(Is,{parseConverter:()=>Xo});var Xo,Fs=b(()=>{"use strict";Ls();Xo=(d,r,e)=>{var a;(a=r.regexConverter)!=null||(r.regexConverter=new RegExp(String.raw`;(?=(?:[^;]*?=>)?\s*(?:${r.variants.join("|")})\s*:|(?:\s|\0\d+[cn]\x7F)*$)`,"u"));let t=/-\{/gu,n=/-\{|\}-/gu,i=[],s=t,o=s.exec(d);for(;o;){let{0:p,index:g}=o;if(p==="}-"){let l=i.pop(),{length:c}=e,h=d.slice(l.index+2,g),m=h.indexOf("|"),[k,x]=m===-1?[[],h]:[h.slice(0,m).split(";"),h.slice(m+1)],A=x.replace(/(&[#a-z\d]+);/giu,"$1"),S=A.split(r.regexConverter).map($=>$.replace(/\x01/gu,";"));new zr(k,S,r,e),d=`${d.slice(0,l.index)}\0${c}v\x7F${d.slice(g+2)}`,i.length===0&&(s=t),s.lastIndex=l.index+3+String(c).length}else i.push(o),s=n,s.lastIndex=g+2;o=s.exec(d)}return d}});var Wr={};se(Wr,{Token:()=>y});var nr,fe,O,z,st,Pt,ir,M,Rs,Ps,Bs,js,qs,_s,Os,Ms,Gs,zs,Ws,Us,Fn,y,P=b(()=>{"use strict";K();Se();be();_();F();ei();ni();Fn=class Fn extends gr{constructor(e,t=f.getConfig(),n=[],i){super();T(this,M);T(this,nr,"plain");T(this,fe,0);T(this,O);T(this,z);T(this,st);T(this,Pt,!1);T(this,ir);typeof e=="string"&&this.insertAt(e),v(this,O,t),v(this,z,n),n.push(this)}get type(){return u(this,nr)}set type(e){v(this,nr,e)}parseOnce(e=u(this,fe),t=!1){if(e<u(this,fe)||this.length===0||!this.getAttribute("plain"))return this;if(u(this,fe)>=11)return this;switch(e){case 0:if(this.type==="root"){u(this,z).pop();let n=R(this,M,Rs).call(this);t&&(t=!n)}v(this,st,t),R(this,M,Ps).call(this,t);break;case 1:R(this,M,Bs).call(this);break;case 2:R(this,M,js).call(this);break;case 3:R(this,M,qs).call(this);break;case 4:R(this,M,_s).call(this);break;case 5:R(this,M,Os).call(this);break;case 6:R(this,M,Ms).call(this);break;case 7:R(this,M,Gs).call(this);break;case 8:R(this,M,zs).call(this);break;case 9:R(this,M,Ws).call(this);break;case 10:R(this,M,Us).call(this)}if(this.type==="root")for(let n of u(this,z))n==null||n.parseOnce(e,t);return lr(this,fe)._++,this}buildFromStr(e,t){let n=e.split(/[\0\x7F]/u).map((i,s)=>{if(s%2===0)return new zt(i);if(isNaN(i.slice(-1)))return u(this,z)[Number(i.slice(0,-1))];throw new Error(`Failed to build! Unrecognized token: ${i}`)});return t===0?n.map(String).join(""):t===1?pe(n):n}build(){v(this,fe,11);let{length:e,firstChild:t}=this,n=t==null?void 0:t.toString();if(e===1&&t.type==="text"&&n.includes("\0")&&(this.replaceChildren(...this.buildFromStr(n)),this.normalize(),this.type==="root"))for(let i of u(this,z))i==null||i.build()}afterBuild(){if(this.type==="root")for(let e of u(this,z))e==null||e.afterBuild();v(this,Pt,!0)}parse(e=11,t){for(e=Math.min(e,11);u(this,fe)<e;)this.parseOnce(u(this,fe),t);return e&&(this.build(),this.afterBuild()),this}getAttribute(e){var t;switch(e){case"plain":return this.constructor===Fn;case"config":return u(this,O);case"include":return(t=u(this,st))!=null?t:!!u(this.getRootNode(),st);case"accum":return u(this,z);case"built":return u(this,Pt);default:return super.getAttribute(e)}}setAttribute(e,t){switch(e){case"stage":u(this,fe)===0&&this.type==="root"&&u(this,z).shift(),v(this,fe,t);break;default:super.setAttribute(e,t)}}insertAt(e,t=this.length){let n=typeof e=="string"?new zt(e):e;return super.insertAt(n,t),n.type==="root"&&(n.type="plain"),n}normalizeTitle(e,t=0,n,i,s){return f.normalizeTitle(e,t,u(this,st),u(this,O),n,i,s)}lint(e=this.getAbsoluteIndex(),t){var i;let n=super.lint(e,t);if(this.type==="root"){let s={},o="category,html-attr#id,ext-attr#id,table-attr#id";for(let m of this.querySelectorAll(o)){let k;if(m.type==="category")k=m.name;else{let A=m.getValue();k=`#${A===!0?"":A}`}let x=s[k];x?x.add(m):s[k]=new Set([m])}for(let[m,k]of Object.entries(s))if(k.size>1&&!m.startsWith("#mw-customcollapsible-")){let x=!m.startsWith("#"),A=`duplicated ${x?"category":"id"}`,S=x?"error":"warning";n.push(...[...k].map($=>{let w=N($,{start:$.getAbsoluteIndex()},"no-duplicate",A,S);return x&&(w.suggestions=[{desc:"remove",range:[w.startIndex,w.endIndex],text:""}]),w}))}let a=/<!--\s*lint-(disable(?:(?:-next)?-line)?|enable)(\s[\sa-z,-]*)?-->/gu,p=this.toString(),g=[],l=a.exec(p),c=0,h=0;for(;l;){let{1:m,index:k}=l,x=(i=l[2])==null?void 0:i.trim();h+=p.slice(c,k).split(`
|
|
32
|
+
`).length-1,c=k,g.push({line:h+(m==="disable-line"?0:1),from:m==="disable"?a.lastIndex:void 0,to:m==="enable"?a.lastIndex:void 0,rules:x?new Set(x.split(",").map(A=>A.trim())):void 0}),l=a.exec(p)}n=n.filter(({rule:m,startLine:k,startIndex:x})=>{let A={pos:0};for(let{line:S,from:$,to:w,rules:L}of g){if(S>k+1)break;if(L&&!L.has(m))continue;if(S===k&&$===void 0&&w===void 0)return!1;$<=x&&$>A.pos?(A.pos=$,A.type="from"):w<=x&&w>A.pos&&(A.pos=w,A.type="to")}return A.type!=="from"})}return n}toString(e,t){var s;let{rev:n}=ye,i=this.getRootNode();return!e&&i.type==="root"&&u(i,Pt)?((s=u(this,ir))!=null||v(this,ir,[n,super.toString(!1,t)]),u(this,ir)[1]):super.toString(e,t)}};nr=new WeakMap,fe=new WeakMap,O=new WeakMap,z=new WeakMap,st=new WeakMap,Pt=new WeakMap,ir=new WeakMap,M=new WeakSet,Rs=function(){let{parseRedirect:e}=(di(),Z(li)),t=this.firstChild.toString(),n=e(t,u(this,O),u(this,z));return n&&this.setText(n),!!n},Ps=function(e){let{parseCommentAndExt:t}=(Xt(),Z(Hi));this.setText(t(this.firstChild.toString(),u(this,O),u(this,z),e))},Bs=function(){let{parseBraces:e}=(Ar(),Z(Li)),t=this.type==="root"?this.firstChild.toString():`\0${this.firstChild.toString()}`,n=e(t,u(this,O),u(this,z));this.setText(this.type==="root"?n:n.slice(1))},js=function(){var t;if((t=u(this,O).excludes)!=null&&t.includes("html"))return;let{parseHtml:e}=(Qi(),Z(Xi));this.setText(e(this.firstChild.toString(),u(this,O),u(this,z)))},qs=function(){var t;if((t=u(this,O).excludes)!=null&&t.includes("table"))return;let{parseTable:e}=(is(),Z(ns));this.setText(e(this,u(this,O),u(this,z)))},_s=function(){var t;if((t=u(this,O).excludes)!=null&&t.includes("hr"))return;let{parseHrAndDoubleUnderscore:e}=(ds(),Z(ls));this.setText(e(this,u(this,O),u(this,z)))},Os=function(){let{parseLinks:e}=(fs(),Z(ms));this.setText(e(this.firstChild.toString(),u(this,O),u(this,z)))},Ms=function(){var n;if((n=u(this,O).excludes)!=null&&n.includes("quote"))return;let{parseQuotes:e}=(En(),Z(ps)),t=this.firstChild.toString().split(`
|
|
33
|
+
`);for(let i=0;i<t.length;i++)t[i]=e(t[i],u(this,O),u(this,z));this.setText(t.join(`
|
|
34
|
+
`))},Gs=function(){var t;if((t=u(this,O).excludes)!=null&&t.includes("extLink"))return;let{parseExternalLinks:e}=(In(),Z(us));this.setText(e(this.firstChild.toString(),u(this,O),u(this,z)))},zs=function(){var t;if((t=u(this,O).excludes)!=null&&t.includes("magicLink"))return;let{parseMagicLinks:e}=(ks(),Z(ys));this.setText(e(this.firstChild.toString(),u(this,O),u(this,z)))},Ws=function(){var s;if((s=u(this,O).excludes)!=null&&s.includes("list"))return;let{parseList:e}=(Cs(),Z(Ss)),t=this.firstChild.toString().split(`
|
|
35
|
+
`),n={lastPrefix:""},i=this.type==="root"||this.type==="ext-inner"&&this.name==="poem"?0:1;for(;i<t.length;i++)t[i]=e(t[i],n,u(this,O),u(this,z));this.setText(t.join(`
|
|
36
|
+
`))},Us=function(){if(u(this,O).variants.length>0){let{parseConverter:e}=(Fs(),Z(Is));this.setText(e(this.firstChild.toString(),u(this,O),u(this,z)))}};y=Fn});var ye,kt,tn,ts,ur,be=b(()=>{"use strict";ye={running:!1,run(d){let{running:r}=this;this.running=!0;try{let{Token:e}=(P(),Z(Wr)),t=d();return t instanceof e&&!t.getAttribute("built")&&t.afterBuild(),this.running=r,t}catch(e){throw this.running=r,e}},rev:0},kt=d=>r=>r.type===d,tn=(d,r,e,t=[])=>{let n=[...d.childNodes],i=n.splice(r,e,...t);d.setAttribute("childNodes",n);for(let s of t)s.setAttribute("parentNode",d);return i},ts=(d,r)=>new Array(d).fill(void 0).map((e,t)=>r(t)),ur=(d,r)=>{Object.defineProperty(d,"name",{value:r.name})}});var Ds={};se(Ds,{Title:()=>Rn});var sr,or,Bt,Re,Rn,Hs=b(()=>{"use strict";K();Rn=class{constructor(r,e,t,n,i){T(this,sr);T(this,or);T(this,Bt);T(this,Re);X(this,"interwiki","");X(this,"valid");X(this,"encoded",!1);let s=r.trim().startsWith("../");if(n&&r.includes("%"))try{let a=/%(?!21|3[ce]|5[bd]|7[b-d])[\da-f]{2}/iu.test(r);r=Qr(r),this.encoded=a}catch(a){}if(r=Ot(r).replace(/[_ ]+/gu," ").trim(),s)v(this,Bt,0);else{let a=e;r.startsWith(":")&&(a=0,r=r.slice(1).trim());let p=r.split(":");if(p.length>1){let g=p[0].trim().toLowerCase(),l=Object.prototype.hasOwnProperty.call(t.nsid,g)&&t.nsid[g];l&&(a=l,r=p.slice(1).join(":").trim())}v(this,Bt,a)}let o=r.indexOf("#");if(o!==-1){let a=r.slice(o+1).trimEnd();if(a.includes("%"))try{a=Qr(a)}catch(p){}v(this,Re,a.replace(/ /gu,"_")),r=r.slice(0,o).trim()}this.valid=!!(r||this.interwiki||i&&this.ns===0&&u(this,Re)!==void 0)&&Ot(r)===r&&!/^:|\0\d+[eh!+-]\x7F|[<>[\]{}|\n]|%[\da-f]{2}|(?:^|\/)\.{1,2}(?:$|\/)/iu.test(s?/^(?:\.\.\/)+(.*)/u.exec(r)[1]:r),this.main=r,Object.defineProperties(this,{encoded:{enumerable:!1,writable:!1}}),v(this,or,t.namespaces)}get ns(){return u(this,Bt)}get fragment(){return u(this,Re)}get main(){return u(this,sr)}set main(r){r=r.replace(/_/gu," ").trim(),v(this,sr,r&&r[0].toUpperCase()+r.slice(1))}get prefix(){let r=u(this,or)[this.ns];return r+(r&&":")}get title(){return this.getRedirection()[1]}get extension(){let{main:r}=this,e=r.lastIndexOf(".");return e===-1?void 0:r.slice(e+1).toLowerCase()}toString(r){return`${r?this.title.replace(/_/gu," "):this.title}${u(this,Re)===void 0?"":`#${u(this,Re)}`}`}getRedirection(){return[!1,(this.interwiki+(this.interwiki&&":")+this.prefix+this.main).replace(/ /gu,"_")]}setFragment(r){v(this,Re,r)}};sr=new WeakMap,or=new WeakMap,Bt=new WeakMap,Re=new WeakMap});var jt,Vs,Qo,f,F=b(()=>{Wn();be();Se();K();jt={config:Zr,i18n:void 0,rules:zn,getConfig(){let{doubleUnderscore:d}=this.config;return d.length>2&&d[0].length===0&&(d[0]=Object.keys(d[2])),{...Zr,...this.config,excludes:[]}},msg(d,r=""){var e,t;return d&&((t=(e=this.i18n)==null?void 0:e[d])!=null?t:d).replace("$1",this.msg(r))},normalizeTitle(d,r=0,e,t=jt.getConfig(),n,i=!1,s=!1){let{Title:o}=(Hs(),Z(Ds)),a;if(n)a=new o(d,r,t,i,s);else{let{Token:p}=(P(),Z(Wr));a=ye.run(()=>{let g=new p(d,t);g.type="root",g.parseOnce(0,e).parseOnce();let l=new o(g.toString(),r,t,i,s);for(let c of["main","fragment"]){let h=l[c];if(h!=null&&h.includes("\0")){let m=g.buildFromStr(h,1);c==="main"?l.main=m:l.setFragment(m)}}return l})}return a},parse(d,r,e=11,t=jt.getConfig()){if(d=Dn(d),typeof e!="number"){let s=Array.isArray(e)?e:[e];e=Math.max(...s.map(o=>Xr[o]||11))}let{Token:n}=(P(),Z(Wr));return ye.run(()=>{let s=new n(d,t);return s.type="root",s.parse(e,r)})}},Vs={},Qo=new Set(["normalizeTitle","parse"]);for(let d in jt)Qo.has(d)||(Vs[d]={enumerable:!1});Object.defineProperties(jt,Vs);Object.assign(globalThis,{Parser:jt});f=jt});F();})();
|
|
37
|
+
//# sourceMappingURL=bundle.min.js.map
|
package/dist/addon/token.js
CHANGED
|
@@ -26,7 +26,7 @@ index_2.Token.prototype.createElement = /** @implements */ function (tagName, {
|
|
|
26
26
|
}
|
|
27
27
|
else if (config.ext.includes(tagName)) {
|
|
28
28
|
// @ts-expect-error abstract class
|
|
29
|
-
return debug_1.Shadow.run(() => new ext_1.ExtToken(tagName, '', undefined, selfClosing ? undefined : '', config));
|
|
29
|
+
return debug_1.Shadow.run(() => new ext_1.ExtToken(tagName, '', undefined, selfClosing ? undefined : '', config, include));
|
|
30
30
|
}
|
|
31
31
|
else if (config.html.some(tags => tags.includes(tagName))) {
|
|
32
32
|
return debug_1.Shadow.run(() => {
|
|
@@ -101,7 +101,7 @@ index_2.Token.prototype.sections = /** @implements */ function () {
|
|
|
101
101
|
return sections;
|
|
102
102
|
};
|
|
103
103
|
index_2.Token.prototype.findEnclosingHtml = /** @implements */ function (tag) {
|
|
104
|
-
tag
|
|
104
|
+
tag &&= tag.toLowerCase();
|
|
105
105
|
const { html } = this.getAttribute('config'), normalTags = new Set(html[0]), voidTags = new Set(html[2]);
|
|
106
106
|
if (html[2].includes(tag)) {
|
|
107
107
|
throw new RangeError(`Void tag: ${tag}`);
|
package/dist/base.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export interface Config {
|
|
|
9
9
|
readonly img: Record<string, string>;
|
|
10
10
|
readonly redirection: string[];
|
|
11
11
|
readonly variants: string[];
|
|
12
|
-
readonly excludes?: string[];
|
|
13
12
|
readonly interwiki: string[];
|
|
14
13
|
readonly conversionTable?: [string, string][];
|
|
15
14
|
readonly redirects?: [string, string][];
|
package/dist/index.js
CHANGED
|
@@ -153,6 +153,11 @@ const Parser = {
|
|
|
153
153
|
catch (e) {
|
|
154
154
|
if (e instanceof Error) {
|
|
155
155
|
const file = path.join(__dirname, '..', 'errors', new Date().toISOString()), stage = token.getAttribute('stage');
|
|
156
|
+
for (const k in config) {
|
|
157
|
+
if (k.startsWith('regex')) {
|
|
158
|
+
delete config[k];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
156
161
|
fs.writeFileSync(file, stage === constants_1.MAX_STAGE ? wikitext : token.toString());
|
|
157
162
|
fs.writeFileSync(`${file}.err`, e.stack);
|
|
158
163
|
fs.writeFileSync(`${file}.json`, JSON.stringify({ stage, include, config }, null, '\t'));
|
package/dist/mixin/singleLine.js
CHANGED
|
@@ -5,14 +5,22 @@ const debug_1 = require("../util/debug");
|
|
|
5
5
|
const constants_1 = require("../util/constants");
|
|
6
6
|
/**
|
|
7
7
|
* 不可包含换行符的类
|
|
8
|
+
* @param strict 是否严格
|
|
8
9
|
* @param constructor 基类
|
|
9
10
|
* @param _ context
|
|
10
11
|
*/
|
|
11
|
-
const singleLine = (constructor, _) => {
|
|
12
|
+
const singleLine = (strict = true) => (constructor, _) => {
|
|
12
13
|
/** 不可包含换行符的类 */
|
|
13
14
|
class SingleLineToken extends constructor {
|
|
14
15
|
toString(skip) {
|
|
15
|
-
|
|
16
|
+
if (strict) {
|
|
17
|
+
return super.toString(skip).replaceAll('\n', ' ');
|
|
18
|
+
}
|
|
19
|
+
// InputboxToken
|
|
20
|
+
return this.childNodes.map(child => {
|
|
21
|
+
const str = child.toString(skip), { type } = child;
|
|
22
|
+
return type === 'comment' || type === 'include' || type === 'ext' ? str : str.replaceAll('\n', ' ');
|
|
23
|
+
}).join('');
|
|
16
24
|
}
|
|
17
25
|
text() {
|
|
18
26
|
return super.text().replaceAll('\n', ' ');
|
package/dist/parser/braces.js
CHANGED
|
@@ -15,7 +15,7 @@ const closes = {
|
|
|
15
15
|
'{': String.raw `\}{2,}|\|`,
|
|
16
16
|
'-': String.raw `\}-`,
|
|
17
17
|
'[': String.raw `\]\]`,
|
|
18
|
-
}, marks = new Map([['!', '!'], ['!!', '+'], ['(!', '{'], ['!)', '}'], ['!-', '-'], ['=', '~']]), re =
|
|
18
|
+
}, marks = new Map([['!', '!'], ['!!', '+'], ['(!', '{'], ['!)', '}'], ['!-', '-'], ['=', '~'], ['server', 'm']]), re = /\{\{\s*([^\s\0<>[\]{}|_#&%:.]+)\s*\}\}(?!\})/gu;
|
|
19
19
|
/**
|
|
20
20
|
* 解析花括号
|
|
21
21
|
* @param wikitext
|
|
@@ -28,7 +28,7 @@ const parseBraces = (wikitext, config, accum) => {
|
|
|
28
28
|
wikitext = wikitext.replace(re, (m, p1) => {
|
|
29
29
|
// @ts-expect-error abstract class
|
|
30
30
|
new transclude_1.TranscludeToken(m.slice(2, -2), [], config, accum);
|
|
31
|
-
return `\0${accum.length - 2}${marks.get(p1)}\x7F`;
|
|
31
|
+
return `\0${accum.length - 2}${marks.get(p1.toLowerCase()) ?? 't'}\x7F`;
|
|
32
32
|
});
|
|
33
33
|
const lastBraces = wikitext.lastIndexOf('}}') - wikitext.length;
|
|
34
34
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
@@ -94,10 +94,10 @@ const parseBraces = (wikitext, config, accum) => {
|
|
|
94
94
|
// @ts-expect-error abstract class
|
|
95
95
|
new transclude_1.TranscludeToken(parts[0][0], parts.slice(1), config, accum);
|
|
96
96
|
const name = (0, string_1.removeComment)(parts[0][0]).trim();
|
|
97
|
-
if (marks.has(name)) {
|
|
98
|
-
ch = marks.get(name); // 标记{{!}}等
|
|
97
|
+
if (marks.has(name.toLowerCase())) {
|
|
98
|
+
ch = marks.get(name.toLowerCase()); // 标记{{!}}等
|
|
99
99
|
}
|
|
100
|
-
else if (/^(?:filepath|(?:full|canonical)urle?)
|
|
100
|
+
else if (/^(?:filepath|(?:full|canonical)urle?):./iu.test(name)) {
|
|
101
101
|
ch = 'm';
|
|
102
102
|
}
|
|
103
103
|
else if (/^#vardefine:./iu.test(name)) {
|
|
@@ -61,7 +61,7 @@ const parseCommentAndExt = (wikitext, config, accum, includeOnly) => {
|
|
|
61
61
|
if (name) {
|
|
62
62
|
ch = 'e';
|
|
63
63
|
// @ts-expect-error abstract class
|
|
64
|
-
new ext_1.ExtToken(name, attr, inner, closing, config, accum);
|
|
64
|
+
new ext_1.ExtToken(name, attr, inner, closing, config, include, accum);
|
|
65
65
|
}
|
|
66
66
|
else if (substr.startsWith('<!--')) {
|
|
67
67
|
ch = 'c';
|
package/dist/parser/converter.js
CHANGED
|
@@ -14,12 +14,14 @@ const constants_1 = require("../util/constants");
|
|
|
14
14
|
const parseConverter = (text, config, accum) => {
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
16
16
|
/;(?=(?:[^;]*?=>)?\s*zh\s*:|(?:\s|\0\d+[cn]\x7F)*$)/u;
|
|
17
|
-
|
|
17
|
+
config.regexConverter ??= new RegExp(String.raw `;(?=(?:[^;]*?=>)?\s*(?:${config.variants.join('|')})\s*:|(?:\s|\0\d+[cn]\x7F)*$)`, 'u');
|
|
18
|
+
const regex1 = /-\{/gu, regex2 = /-\{|\}-/gu, stack = [];
|
|
18
19
|
let regex = regex1, mt = regex.exec(text);
|
|
19
20
|
while (mt) {
|
|
20
21
|
const { 0: syntax, index } = mt;
|
|
21
22
|
if (syntax === '}-') {
|
|
22
|
-
const top = stack.pop(), { length } = accum, str = text.slice(top.index + 2, index), i = str.indexOf('|'), [flags, raw] = i === -1 ? [[], str] : [str.slice(0, i).split(';'), str.slice(i + 1)], temp = raw.replace(/(&[#a-z\d]+);/giu, '$1\x01'), rules = temp.split(
|
|
23
|
+
const top = stack.pop(), { length } = accum, str = text.slice(top.index + 2, index), i = str.indexOf('|'), [flags, raw] = i === -1 ? [[], str] : [str.slice(0, i).split(';'), str.slice(i + 1)], temp = raw.replace(/(&[#a-z\d]+);/giu, '$1\x01'), rules = temp.split(config.regexConverter)
|
|
24
|
+
.map(rule => rule.replace(/\x01/gu, ';'));
|
|
23
25
|
// @ts-expect-error abstract class
|
|
24
26
|
new converter_1.ConverterToken(flags, rules, config, accum);
|
|
25
27
|
text = `${text.slice(0, top.index)}\0${length}v\x7F${text.slice(index + 2)}`;
|
|
@@ -17,8 +17,8 @@ const constants_1 = require("../util/constants");
|
|
|
17
17
|
const parseExternalLinks = (wikitext, config, accum, inFile) => {
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
19
19
|
/\[((?:ftp:\/\/|\/\/)(?:\[[\da-f:.]+\]|[^[\]<>"\t\n\p{Zs}])[^[\]<>"\t\n\p{Zs}]*(?=[[\]<>"\t\p{Zs}]|\0\d))(\p{Zs}*(?!\p{Zs}))([^\]\n]*)\]/giu;
|
|
20
|
-
|
|
21
|
-
return wikitext.replace(
|
|
20
|
+
config.regexExternalLinks ??= new RegExp(String.raw `\[(\0\d+f\x7F|(?:(?:${config.protocol}|//)${string_1.extUrlCharFirst}|\0\d+m\x7F)${string_1.extUrlChar}(?=[[\]<>"\t\p{Zs}]|\0\d))(\p{Zs}*(?!\p{Zs}))([^\]\x01-\x08\x0A-\x1F\uFFFD]*)\]`, 'giu');
|
|
21
|
+
return wikitext.replace(config.regexExternalLinks, (_, url, space, text) => {
|
|
22
22
|
const { length } = accum, mt = /&[lg]t;/u.exec(url);
|
|
23
23
|
if (mt) {
|
|
24
24
|
url = url.slice(0, mt.index);
|
|
@@ -15,6 +15,7 @@ const constants_1 = require("../util/constants");
|
|
|
15
15
|
*/
|
|
16
16
|
const parseHrAndDoubleUnderscore = ({ firstChild: { data }, type, name }, config, accum) => {
|
|
17
17
|
const { doubleUnderscore } = config, insensitive = new Set(doubleUnderscore[0]), sensitive = new Set(doubleUnderscore[1]);
|
|
18
|
+
config.regexHrAndDoubleUnderscore ??= new RegExp(`__(${[...insensitive, ...sensitive].join('|')})__`, 'giu');
|
|
18
19
|
if (type !== 'root' && (type !== 'ext-inner' || name !== 'poem')) {
|
|
19
20
|
data = `\0${data}`;
|
|
20
21
|
}
|
|
@@ -24,7 +25,7 @@ const parseHrAndDoubleUnderscore = ({ firstChild: { data }, type, name }, config
|
|
|
24
25
|
// @ts-expect-error abstract class
|
|
25
26
|
new hr_1.HrToken(m, config, accum);
|
|
26
27
|
return `${lead}\0${accum.length - 1}r\x7F`;
|
|
27
|
-
}).replace(
|
|
28
|
+
}).replace(config.regexHrAndDoubleUnderscore, (m, p1) => {
|
|
28
29
|
const caseSensitive = sensitive.has(p1), lc = p1.toLowerCase(), caseInsensitive = insensitive.has(lc);
|
|
29
30
|
if (caseSensitive || caseInsensitive) {
|
|
30
31
|
// @ts-expect-error abstract class
|
package/dist/parser/links.js
CHANGED
|
@@ -10,6 +10,7 @@ const category_1 = require("../src/link/category");
|
|
|
10
10
|
/* NOT FOR BROWSER */
|
|
11
11
|
const constants_1 = require("../util/constants");
|
|
12
12
|
/* NOT FOR BROWSER END */
|
|
13
|
+
const regexImg = /^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(\||\0\d+!\x7F)(.*)$/su;
|
|
13
14
|
/**
|
|
14
15
|
* 解析内部链接
|
|
15
16
|
* @param wikitext
|
|
@@ -19,9 +20,10 @@ const constants_1 = require("../util/constants");
|
|
|
19
20
|
const parseLinks = (wikitext, config, accum) => {
|
|
20
21
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
21
22
|
/^\s*(?:ftp:\/\/|\/\/)/iu;
|
|
23
|
+
config.regexLinks ??= new RegExp(String.raw `^\s*(?:${config.protocol}|//)`, 'iu');
|
|
22
24
|
const regex = true // eslint-disable-line no-constant-condition, @typescript-eslint/no-unnecessary-condition
|
|
23
25
|
? /^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]]))?\]\](.*)$/su
|
|
24
|
-
: /^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]])?)?\]\](.*)$/su,
|
|
26
|
+
: /^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]])?)?\]\](.*)$/su, bits = wikitext.split('[[');
|
|
25
27
|
let s = bits.shift();
|
|
26
28
|
for (let i = 0; i < bits.length; i++) {
|
|
27
29
|
let mightBeImg = false, link, delimiter, text, after;
|
|
@@ -40,7 +42,7 @@ const parseLinks = (wikitext, config, accum) => {
|
|
|
40
42
|
[, link, delimiter, text] = m2;
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
|
-
if (link === undefined ||
|
|
45
|
+
if (link === undefined || config.regexLinks.test(link) || /\0\d+[exhbru]\x7F/u.test(link)) {
|
|
44
46
|
s += `[[${x}`;
|
|
45
47
|
continue;
|
|
46
48
|
}
|
|
@@ -16,8 +16,8 @@ const space = String.raw `[\p{Zs}\t]| |�*160;|�*a0;`, sp = `(?:${space
|
|
|
16
16
|
const parseMagicLinks = (wikitext, config, accum) => {
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
18
18
|
/(^|[^\p{L}\d_])(?:(?:ftp:\/\/|http:\/\/)((?:\[[\da-f:.]+\]|[^[\]<>"\t\n\p{Zs}])[^[\]<>"\0\t\n\p{Zs}]*)|(?:rfc|pmid)[\p{Zs}\t]+\d+\b|isbn[\p{Zs}\t]+(?:97[89][\p{Zs}\t-]?)?(?:\d[\p{Zs}\t-]?){9}[\dx]\b)/giu;
|
|
19
|
-
|
|
20
|
-
return wikitext.replace(
|
|
19
|
+
config.regexMagicLinks ??= new RegExp(String.raw `(^|[^\p{L}\d_])(?:(?:${config.protocol})(${string_1.extUrlCharFirst}${string_1.extUrlChar})|${magicLinkPattern})`, 'giu');
|
|
20
|
+
return wikitext.replace(config.regexMagicLinks, (m, lead, p1) => {
|
|
21
21
|
let url = lead ? m.slice(lead.length) : m;
|
|
22
22
|
if (p1) {
|
|
23
23
|
let trail = '';
|
package/dist/parser/redirect.js
CHANGED
|
@@ -15,7 +15,8 @@ const constants_1 = require("../util/constants");
|
|
|
15
15
|
const parseRedirect = (text, config, accum) => {
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
17
17
|
/^(\s*)((?:#redirect|#重定向)\s*(?::\s*)?)\[\[([^\n|\]]+)(\|.*?)?\]\](\s*)/iu;
|
|
18
|
-
|
|
18
|
+
config.regexRedirect ??= new RegExp(String.raw `^(\s*)((?:${config.redirection.join('|')})\s*(?::\s*)?)\[\[([^\n|\]]+)(\|.*?)?\]\](\s*)`, 'iu');
|
|
19
|
+
const mt = config.regexRedirect.exec(text);
|
|
19
20
|
if (mt && index_1.default.normalizeTitle(mt[3], 0, false, config, true, true).valid) {
|
|
20
21
|
text = `\0${accum.length}o\x7F${text.slice(mt[0].length)}`;
|
|
21
22
|
// @ts-expect-error abstract class
|
package/dist/src/attributes.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ import { Token } from './index';
|
|
|
3
3
|
import { AtomToken } from './atom';
|
|
4
4
|
import { AttributeToken } from './attribute';
|
|
5
5
|
import type { LintError } from '../base';
|
|
6
|
-
import type { ExtToken, HtmlToken,
|
|
6
|
+
import type { ExtToken, HtmlToken, SyntaxToken } from '../internal';
|
|
7
7
|
import type { AttributeTypes } from './attribute';
|
|
8
|
+
import type { TableTokens } from './table/index';
|
|
8
9
|
declare type AttributesTypes = `${AttributeTypes}s`;
|
|
10
|
+
declare type Child = AtomToken | AttributeToken;
|
|
9
11
|
/**
|
|
10
12
|
* 扩展和HTML标签属性
|
|
11
13
|
* @classdesc `{childNodes: ...AtomToken|AttributeToken}`
|
|
@@ -13,15 +15,15 @@ declare type AttributesTypes = `${AttributeTypes}s`;
|
|
|
13
15
|
export declare abstract class AttributesToken extends Token {
|
|
14
16
|
#private;
|
|
15
17
|
readonly name: string;
|
|
16
|
-
readonly childNodes: readonly
|
|
17
|
-
abstract get firstChild():
|
|
18
|
-
abstract get lastChild():
|
|
19
|
-
abstract get parentNode(): ExtToken | HtmlToken |
|
|
18
|
+
readonly childNodes: readonly Child[];
|
|
19
|
+
abstract get firstChild(): Child | undefined;
|
|
20
|
+
abstract get lastChild(): Child | undefined;
|
|
21
|
+
abstract get parentNode(): ExtToken | HtmlToken | TableTokens | undefined;
|
|
20
22
|
abstract get previousSibling(): SyntaxToken | undefined;
|
|
21
|
-
abstract get children():
|
|
22
|
-
abstract get firstElementChild():
|
|
23
|
-
abstract get lastElementChild():
|
|
24
|
-
abstract get parentElement(): ExtToken | HtmlToken |
|
|
23
|
+
abstract get children(): Child[];
|
|
24
|
+
abstract get firstElementChild(): Child | undefined;
|
|
25
|
+
abstract get lastElementChild(): Child | undefined;
|
|
26
|
+
abstract get parentElement(): ExtToken | HtmlToken | TableTokens | undefined;
|
|
25
27
|
abstract get previousElementSibling(): SyntaxToken | undefined;
|
|
26
28
|
get type(): AttributesTypes;
|
|
27
29
|
/** getAttrs()方法的getter写法 */
|
|
@@ -68,7 +70,7 @@ export declare abstract class AttributesToken extends Token {
|
|
|
68
70
|
* @param i 插入位置
|
|
69
71
|
* @throws `RangeError` 标签不匹配
|
|
70
72
|
*/
|
|
71
|
-
insertAt<T extends
|
|
73
|
+
insertAt<T extends Child>(token: T, i?: number): T;
|
|
72
74
|
/**
|
|
73
75
|
* 设置指定属性
|
|
74
76
|
* @param key 属性键
|
package/dist/src/gallery.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { GalleryImageToken } from './link/galleryImage';
|
|
|
4
4
|
import { NoincludeToken } from './nowiki/noinclude';
|
|
5
5
|
import type { LintError } from '../base';
|
|
6
6
|
import type { AstText, AttributesToken, ExtToken, AstNodes } from '../internal';
|
|
7
|
+
declare type Child = GalleryImageToken | NoincludeToken;
|
|
7
8
|
/**
|
|
8
9
|
* gallery标签
|
|
9
10
|
* @classdesc `{childNodes: ...(GalleryImageToken|NoincludeToken|AstText)}`
|
|
@@ -11,15 +12,15 @@ import type { AstText, AttributesToken, ExtToken, AstNodes } from '../internal';
|
|
|
11
12
|
export declare abstract class GalleryToken extends Token {
|
|
12
13
|
#private;
|
|
13
14
|
readonly name: 'gallery';
|
|
14
|
-
readonly childNodes: readonly (
|
|
15
|
-
abstract get firstChild():
|
|
16
|
-
abstract get lastChild():
|
|
15
|
+
readonly childNodes: readonly (Child | AstText)[];
|
|
16
|
+
abstract get firstChild(): Child | AstText | undefined;
|
|
17
|
+
abstract get lastChild(): Child | AstText | undefined;
|
|
17
18
|
abstract get nextSibling(): undefined;
|
|
18
19
|
abstract get previousSibling(): AttributesToken;
|
|
19
20
|
abstract get parentNode(): ExtToken | undefined;
|
|
20
|
-
abstract get children():
|
|
21
|
-
abstract get firstElementChild():
|
|
22
|
-
abstract get lastElementChild():
|
|
21
|
+
abstract get children(): Child[];
|
|
22
|
+
abstract get firstElementChild(): Child | undefined;
|
|
23
|
+
abstract get lastElementChild(): Child | undefined;
|
|
23
24
|
abstract get nextElementSibling(): undefined;
|
|
24
25
|
abstract get previousElementSibling(): AttributesToken;
|
|
25
26
|
abstract get parentElement(): ExtToken | undefined;
|
|
@@ -49,3 +50,4 @@ export declare abstract class GalleryToken extends Token {
|
|
|
49
50
|
insertAt(token: string, i?: number): AstText;
|
|
50
51
|
insertAt<T extends AstNodes>(token: T, i?: number): T;
|
|
51
52
|
}
|
|
53
|
+
export {};
|