wikiparser-node 0.9.0 → 0.9.1-b
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 +38 -0
- package/extensions/editor.css +62 -0
- package/extensions/editor.js +328 -0
- package/extensions/ui.css +119 -0
- package/package.json +13 -12
- package/README.md +0 -39
- package/config/default.json +0 -832
- package/config/llwiki.json +0 -630
- package/config/moegirl.json +0 -729
- package/config/zhwiki.json +0 -1269
- package/index.js +0 -333
- package/lib/element.js +0 -611
- package/lib/node.js +0 -770
- package/lib/ranges.js +0 -130
- package/lib/text.js +0 -245
- package/lib/title.js +0 -83
- package/mixin/attributeParent.js +0 -117
- package/mixin/fixedToken.js +0 -40
- package/mixin/hidden.js +0 -21
- package/mixin/singleLine.js +0 -31
- package/mixin/sol.js +0 -54
- package/parser/brackets.js +0 -126
- package/parser/commentAndExt.js +0 -59
- package/parser/converter.js +0 -46
- package/parser/externalLinks.js +0 -33
- package/parser/hrAndDoubleUnderscore.js +0 -38
- package/parser/html.js +0 -42
- package/parser/links.js +0 -94
- package/parser/list.js +0 -59
- package/parser/magicLinks.js +0 -41
- package/parser/quotes.js +0 -64
- package/parser/selector.js +0 -177
- package/parser/table.js +0 -114
- package/src/arg.js +0 -207
- package/src/atom/hidden.js +0 -13
- package/src/atom/index.js +0 -43
- package/src/attribute.js +0 -470
- package/src/attributes.js +0 -453
- package/src/charinsert.js +0 -97
- package/src/converter.js +0 -176
- package/src/converterFlags.js +0 -284
- package/src/converterRule.js +0 -256
- package/src/extLink.js +0 -180
- package/src/gallery.js +0 -149
- package/src/hasNowiki/index.js +0 -44
- package/src/hasNowiki/pre.js +0 -40
- package/src/heading.js +0 -134
- package/src/html.js +0 -254
- package/src/imageParameter.js +0 -301
- package/src/imagemap.js +0 -199
- package/src/imagemapLink.js +0 -41
- package/src/index.js +0 -936
- package/src/link/category.js +0 -44
- package/src/link/file.js +0 -287
- package/src/link/galleryImage.js +0 -120
- package/src/link/index.js +0 -384
- package/src/magicLink.js +0 -149
- package/src/nested/choose.js +0 -24
- package/src/nested/combobox.js +0 -23
- package/src/nested/index.js +0 -93
- package/src/nested/references.js +0 -23
- package/src/nowiki/comment.js +0 -71
- package/src/nowiki/dd.js +0 -59
- package/src/nowiki/doubleUnderscore.js +0 -56
- package/src/nowiki/hr.js +0 -41
- package/src/nowiki/index.js +0 -56
- package/src/nowiki/list.js +0 -16
- package/src/nowiki/noinclude.js +0 -28
- package/src/nowiki/quote.js +0 -69
- package/src/onlyinclude.js +0 -64
- package/src/paramTag/index.js +0 -89
- package/src/paramTag/inputbox.js +0 -35
- package/src/parameter.js +0 -239
- package/src/syntax.js +0 -91
- package/src/table/index.js +0 -983
- package/src/table/td.js +0 -338
- package/src/table/tr.js +0 -319
- package/src/tagPair/ext.js +0 -148
- package/src/tagPair/include.js +0 -50
- package/src/tagPair/index.js +0 -126
- package/src/transclude.js +0 -843
- package/tool/index.js +0 -1202
- package/util/base.js +0 -17
- package/util/debug.js +0 -73
- package/util/diff.js +0 -76
- package/util/lint.js +0 -55
- package/util/string.js +0 -126
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
(()=>{var $t=Object.defineProperty;var Tt=(W,D,X)=>D in W?$t(W,D,{enumerable:!0,configurable:!0,writable:!0,value:X}):W[D]=X;var P=(W,D,X)=>(Tt(W,typeof D!="symbol"?D+"":D,X),X),st=(W,D,X)=>{if(!D.has(W))throw TypeError("Cannot "+X)};var x=(W,D,X)=>(st(W,D,"read from private field"),X?X.call(W):D.get(W)),z=(W,D,X)=>{if(D.has(W))throw TypeError("Cannot add the same private member more than once");D instanceof WeakSet?D.add(W):D.set(W,X)},M=(W,D,X,tt)=>(st(W,D,"write to private field"),tt?tt.call(W,X):D.set(W,X),X),nt=(W,D,X,tt)=>({set _(y){M(W,D,y,X)},get _(){return x(W,D,tt)}}),J=(W,D,X)=>(st(W,D,"access private method"),X);(()=>{"use strict";var W={6010:(y,F,t)=>{const c={config:void 0,minConfig:t(8166),i18n:void 0,MAX_STAGE:11,getConfig(){return{...this.minConfig,...this.config,excludes:[]}},msg(d,u){var n,i;return d=(i=(n=this.i18n)==null?void 0:n[d])!=null?i:d,d.replace("$1",u)},normalizeTitle(d,u=0,n=!1,i=c.getConfig(),s=!1,e=!1,r=!1){let o;if(!s){const h=t(8138);o=this.run(()=>{const g=new h(String(d),i),$=g.getAttribute("parseOnce");return $(0,n),$()}),d=o.firstChild}const l=t(6986);return new l(String(d),u,i,e,r)},parse(d,u,n=c.MAX_STAGE,i=c.getConfig()){if(typeof d!="string")throw new TypeError("\u5F85\u89E3\u6790\u7684\u5185\u5BB9\u5E94\u4E3A String\uFF01");const s=t(8138);let e;return this.run(()=>{e=new s(d,i);try{e.parse(n,u)}catch(r){}}),e},run(d){return d()}},m={},A=new Set(["MAX_STAGE","minConfig"]),T=new Set(["config","normalizeTitle","parse"]);for(const d in c)A.has(d)?m[d]={enumerable:!1,writable:!1}:T.has(d)||(m[d]={enumerable:!1});Object.defineProperties(c,m),typeof self=="object"&&(self.Parser=c),y.exports=c},9205:(y,F,t)=>{const{print:c}=t(231),m=t(3853),A=t(7507),T=new Set(["nowiki","pre","charinsert","score","syntaxhighlight","source","math","chem","ce","graph","mapframe","maplink","quiz","templatedata","timeline"]);class d extends m{constructor(){super(...arguments);P(this,"name")}get length(){return this.childNodes.length}closest(i){const s=new Set(i.split(",").map(r=>r.trim()));let{parentNode:e}=this;for(;e;){if(s.has(e.type))return e;({parentNode:e}=e)}}append(...i){for(const s of i)this.insertAt(s)}replaceChildren(...i){this.childNodes.length=0,this.append(...i)}setText(i,s=0){const e=this.childNodes[s],{type:r,data:o}=e;if(r==="text")return e.replaceData(i),o}toString(i,s=""){return this.childNodes.map(e=>e.toString()).join(s)}lint(i=0){const s=t(8058);if(this instanceof s||this.constructor.hidden||this.type==="ext-inner"&&T.has(this.name))return[];const e=[];for(let r=0,o=i+this.getPadding();r<this.length;r++){const l=this.childNodes[r];e.push(...l.lint(o)),o+=String(l).length+this.getGaps(r)}return e}print(i={}){return String(this)?`<span class="wpb-${i.class||this.type}">${c(this.childNodes,i)}</span>`:""}}y.exports=d},3853:(y,F,t)=>{var A,T,it;const{text:c}=t(231);class m{constructor(){z(this,T);P(this,"type");P(this,"childNodes",[]);z(this,A,void 0)}get firstChild(){return this.childNodes[0]}get lastChild(){return this.childNodes[this.childNodes.length-1]}get parentNode(){return x(this,A)}get nextSibling(){var i;const n=(i=x(this,A))==null?void 0:i.childNodes;return n&&n[n.indexOf(this)+1]}get previousSibling(){var i;const n=(i=x(this,A))==null?void 0:i.childNodes;return n&&n[n.indexOf(this)-1]}hasAttribute(n){const i=typeof n;return i==="string"||i==="number"||i==="symbol"?n in this:!1}getAttribute(n){return this.hasAttribute(n)?String(this[n]):void 0}setAttribute(n,i){return n==="parentNode"?M(this,A,i):this[n]=i,this}text(n=""){return c(this.childNodes,n)}removeAt(n){const{childNodes:i}=this,[s]=i.splice(n,1);return s}insertAt(n,i=this.childNodes.length){const{childNodes:s}=this;return-1===-1&&n.setAttribute("parentNode",this),s.splice(i,0,n),n}normalize(){var s;const n=t(7507),{childNodes:i}=this;for(let e=i.length-1;e>=0;e--){const{type:r,data:o}=i[e];this.getGaps(e-1)||(o===""?i.splice(e,1):r==="text"&&((s=i[e-1])==null?void 0:s.type)==="text"&&(i[e-1].setAttribute("data",i[e-1].data+o),i.splice(e,1)))}}getRootNode(){let{parentNode:n}=this;for(;n!=null&&n.parentNode;)({parentNode:n}=n);return n!=null?n:this}posFromIndex(n){const i=String(this);if(n>=-i.length&&n<=i.length){const s=i.slice(0,n).split(`
|
|
2
|
+
`);return{top:s.length-1,left:s[s.length-1].length}}}getPadding(){return 0}getGaps(){return 0}getRelativeIndex(n){let i;const s=(e,r)=>i.slice(0,e).reduce((o,l,a)=>o+String(l).length+r.getGaps(a),0)+r.getPadding();if(n===void 0){const{parentNode:e}=this;return e?({childNodes:i}=e,s(i.indexOf(this),e)):0}return{childNodes:i}=this,s(n,this)}get offsetHeight(){return J(this,T,it).call(this).height}get offsetWidth(){return J(this,T,it).call(this).width}}A=new WeakMap,T=new WeakSet,it=function(){const n=String(this).split(`
|
|
3
|
+
`);return{height:n.length,width:n[n.length-1].length}},y.exports=m},7507:(y,F,t)=>{var i,rt;const c=t(6010),m=t(3853),A=t(9205),T=/https?:\/\/|\{+|\}+|\[{2,}|\[(?![^[]*\])|((?:^|\])[^[]*?)\]+|<\s*\/?([a-z]\w*)(?=[\s/>])/giu,d=/\{+|\}+|\[{2,}|\[(?![^[]*\])|((?:^|\])[^[]*?)\]+|<\s*\/?([a-z]\w*)(?=[\s/>])/giu,u=["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"];class n extends m{constructor(o=""){super();z(this,i);P(this,"type","text");P(this,"data");this.data=o}toString(){return this.data}text(){return this.data}lint(o){const{data:l,parentNode:a}=this,h=a==null?void 0:a.type,g=a==null?void 0:a.name,$=h==="free-ext-link"||h==="ext-link-url"||h==="image-parameter"&&g==="link"?d:T,f=[],{ext:S,html:p}=this.getRootNode().getAttribute("config");if(l.search($)!==-1){$.lastIndex=0;const k=this.getRootNode(),{top:w,left:C}=k.posFromIndex(o),b=new Set([S,p,u].flat(2));for(let v=$.exec(l);v;v=$.exec(l)){const[,E,H]=v;let{0:I,index:R}=v;E&&(R+=E.length,I=I.slice(E.length));const O=o+R,U=l.slice(0,R).split(`
|
|
4
|
+
`),j=U.length+w-1,B=U[U.length-1],V=U.length>1?B.length:C+B.length,{0:K,length:Q}=I,q=O+Q;(K!=="h"||R>0)&&(K!=="<"||b.has(H.toLowerCase()))&&f.push({message:c.msg('lonely "$1"',K==="h"?I:K),severity:Q>1?"error":"warning",startIndex:O,endIndex:q,startLine:j,endLine:j,startCol:V,endCol:V+Q})}}return f}replaceData(o=""){J(this,i,rt).call(this,o)}}i=new WeakSet,rt=function(o){o=String(o),this.setAttribute("data",o)},y.exports=n},6986:(y,F,t)=>{const{decodeHtml:c}=t(231),m=t(6010);class A{constructor(d,u=0,n=m.getConfig(),i=!1,s=!1){P(this,"valid",!0);P(this,"ns",0);P(this,"fragment");P(this,"encoded",!1);const{namespaces:e,nsid:r}=n;let o=e[u];if(d=c(d),i&&d.includes("%"))try{const g=/%(?!21|3[ce]|5[bd]|7[b-d])[\da-f]{2}/iu.test(d);d=decodeURIComponent(d),this.encoded=g}catch(g){}d=d.replace(/_/gu," ").trim(),d[0]===":"&&(o="",d=d.slice(1).trim());const l=d.split(":");if(l.length>1){const g=e[r[l[0].trim().toLowerCase()]];g!==void 0&&(o=g,d=l.slice(1).join(":").trim())}this.ns=r[o.toLowerCase()];const a=d.indexOf("#");let h;a!==-1&&(h=d.slice(a+1).trim(),d=d.slice(0,a).trim()),this.valid=Boolean(d||s&&h!==void 0)&&!/\0\d+[eh!+-]\x7F|[<>[\]{}|]|%[\da-f]{2}/iu.test(d),this.fragment=h}}y.exports=A},2308:y=>{const F=t=>{var c;return c=class extends t{text(){return""}},P(c,"hidden",!0),c};y.exports=F},8275:(y,F,t)=>{const{removeComment:c}=t(231),m=t(6010),A=t(9450),T=t(1782),d=t(9544),u=(n,i=m.getConfig(),s=[])=>{var S,p,k,w,C;const e=`${i.excludes.includes("heading")?"":"^(\0\\d+c\x7F)*={1,6}|"}\\[\\[|\\{{2,}|-\\{(?!\\{)`,{parserFunction:[,,,r]}=i,o=[],l={"=":`
|
|
5
|
+
`,"{":"\\}{2,}|\\|","-":"\\}-","[":"\\]\\]"},a={"!":"!","!!":"+","(!":"{","!)":"}","!-":"-","=":"~"};let h=new RegExp(e,"gmu"),g=h.exec(n),$=n.includes("}}"),f;for(;g||f<=n.length&&((p=(S=o[o.length-1])==null?void 0:S[0])==null?void 0:p[0])==="=";){if(g!=null&&g[1]){const[,{length:V}]=g;g[0]=g[0].slice(V),g.index+=V}const{0:b,index:v}=g!=null?g:{0:`
|
|
6
|
+
`,index:n.length},E=(k=o.pop())!=null?k:{},{0:H,index:I,parts:R,findEqual:O,pos:U}=E,j=b==="="&&O;if(b==="]]"||b==="}-")f=v+2;else if(b===`
|
|
7
|
+
`){f=v+1;const{pos:V,findEqual:K}=(w=o[o.length-1])!=null?w:{};if(!V||K||c(n.slice(V,I))!==""){const Q=/^(={1,6})(.+)\1((?:\s|\0\d+c\x7F)*)$/u.exec(n.slice(I,v));Q&&(n=`${n.slice(0,I)}\0${s.length}h\x7F${n.slice(v)}`,f=I+4+String(s.length).length,new A(Q[1].length,Q.slice(2),i,s))}}else if(b==="|"||j)f=v+1,R[R.length-1].push(n.slice(U,v)),b==="|"&&R.push([]),E.pos=f,E.findEqual=b==="|",o.push(E);else if(b.startsWith("}}")){const V=b.slice(0,Math.min(H.length,3)),K=H.length-V.length,{length:Q}=s;f=v+V.length,R[R.length-1].push(n.slice(U,v));let q=!1,Y="t";if(V.length===3){const N=R.map(G=>G.join("=")),L=N.length>1&&c(N[1]).trim();new d(N,i,s),L&&L.endsWith(":")&&r.includes(L.slice(0,-1).toLowerCase())&&(Y="s")}else{const N=c(R[0][0]).trim();N in a?Y=a[N]:/^(?:filepath|(?:full|canonical)urle?):.|^server$/iu.test(N)?Y="m":/^#vardefine:./iu.test(N)&&(Y="c");try{new T(R[0][0],R.slice(1),i,s)}catch(L){if(L instanceof Error&&L.message.startsWith("\u975E\u6CD5\u7684\u6A21\u677F\u540D\u79F0\uFF1A"))f=I+H.length,q=!0;else throw L}}q||(n=`${n.slice(0,I+K)}\0${Q}${Y}\x7F${n.slice(f)}`,f=I+K+3+String(Q).length,K>1?o.push({0:H.slice(0,K),index:I,pos:I+K,parts:[[]]}):K===1&&n[I-1]==="-"&&o.push({0:"-{",index:I-1,pos:I+1,parts:[[]]}))}else f=v+b.length,b[0]==="{"&&(g.pos=f,g.parts=[[]]),o.push(..."0"in E?[E]:[],g);$&&($=n.slice(f).includes("}}"));let B=o[o.length-1];!$&&((C=B==null?void 0:B[0])==null?void 0:C[0])==="{"&&(o.pop(),B=o[o.length-1]),h=new RegExp(e+(B?`|${l[B[0][0]]}${B.findEqual?"|=":""}`:""),"gmu"),h.lastIndex=f,g=h.exec(n)}return n};y.exports=u},4907:(y,F,t)=>{const c=t(6010),m=t(851),A=t(3423),T=t(8655),d=t(7267),u=t(5749),n=(i,s=c.getConfig(),e=[],r=!1)=>{const o=/<onlyinclude>(.*?)<\/onlyinclude>/gsu;if(r&&i.search(o)!==-1)return i.replace(o,($,f)=>{const S=`\0${e.length}e\x7F`;return new m(f,s,e),S}).replace(/(^|\0\d+e\x7F)([^\0]+)(?=$|\0\d+e\x7F)/gu,($,f,S)=>(new A(S,s,e),`${f}\0${e.length-1}c\x7F`));const l=s.ext.join("|"),a=r?"includeonly":"(?:no|only)include",h=r?"noinclude":"includeonly",g=new RegExp(`<!--.*?(?:-->|$)|<${a}(?:\\s[^>]*?)?>|</${a}\\s*>|<(${l})(\\s[^>]*?)?(?:/>|>(.*?)</(\\1\\s*)>)|<(${h})(\\s[^>]*?)?(?:/>|>(.*?)(?:</(\\5\\s*)>|$))`,"gisu");return i.replace(g,($,f,S,p,k,w,C,b,v)=>{const E=`\0${e.length}${f?"e":"c"}\x7F`;if(f)new d(f,S,p,k,s,e);else if($.startsWith("<!--")){const H=$.endsWith("-->");new u($.slice(4,H?-3:void 0),H,s,e)}else w?new T(w,C,b,v,s,e):new A($,s,e);return E})};y.exports=n},3765:(y,F,t)=>{const c=t(6010),m=t(9910),A=(T,d=c.getConfig(),u=[])=>{const n=/-\{/gu,i=/-\{|\}-/gu,s=[];let e=n,r=e.exec(T);for(;r;){const{0:o,index:l}=r;if(o==="}-"){const a=s.pop(),{length:h}=u,g=T.slice(a.index+2,l),$=g.indexOf("|"),[f,S]=$===-1?[[],g]:[g.slice(0,$).split(";"),g.slice($+1)],p=S.replace(/(&[#a-z\d]+);/giu,"$1"),k=`(?:${d.variants.join("|")})`,w=p.split(new RegExp(`;(?=\\s*(?:${k}|[^;]*?=>\\s*${k})\\s*:)`,"u")).map(C=>C.replace(/\x01/gu,";"));new m(f,w,d,u),T=`${T.slice(0,a.index)}\0${h}v\x7F${T.slice(l+2)}`,s.length===0&&(e=n),e.lastIndex=a.index+3+String(h).length}else s.push(r),e=i,e.lastIndex=l+2;r=e.exec(T)}return T};y.exports=A},7513:(y,F,t)=>{const{extUrlChar:c,extUrlCharFirst:m}=t(231),A=t(6010),T=t(741),d=(u,n=A.getConfig(),i=[])=>{const s=new RegExp(`\\[((?:(?:${n.protocol}|//)${m}|\0\\d+m\x7F)${c})(\\p{Zs}*)([^\\]-\b
|
|
8
|
+
-\uFFFD]*)\\]`,"giu");return u.replace(s,(e,r,o,l)=>{const{length:a}=i,h=/&[lg]t;/u.exec(r);return h&&(r=r.slice(0,h.index),o="",l=`${r.slice(h.index)}${o}${l}`),new T(r,o,l,n,i),`\0${a}w\x7F`})};y.exports=d},2937:(y,F,t)=>{const c=t(6010),m=t(7507),A=t(8138),T=t(2582),d=t(7815),u=({firstChild:{data:n},type:i,name:s},e=c.getConfig(),r=[])=>{const{doubleUnderscore:o}=e,l=new Set(o[0]),a=new Set(o[1]);return i!=="root"&&(i!=="ext-inner"||s!=="poem")&&(n=`\0${n}`),n=n.replace(/^((?:\0\d+c\x7F)*)(-{4,})/gmu,(h,g,$)=>(new T($.length,e,r),`${g}\0${r.length-1}r\x7F`)).replace(new RegExp(`__(${o.flat().join("|")})__`,"giu"),(h,g)=>l.has(g.toLowerCase())||a.has(g)?(new d(g,e,r),`\0${r.length-1}u\x7F`):h),i==="root"||i==="ext-inner"&&s==="poem"?n:n.slice(1)};y.exports=u},5130:(y,F,t)=>{const c=t(6010),m=t(5649),A=t(2350),T=(d,u=c.getConfig(),n=[])=>{const i=/^(\/?)([a-z][^\s/>]*)((?:\s|\/(?!>))[^>]*?)?(\/?>)([^<]*)$/iu,s=new Set(u.html.flat()),e=d.split("<");let r=e.shift();for(const o of e){const l=i.exec(o),a=l==null?void 0:l[2],h=a==null?void 0:a.toLowerCase();if(!l||!s.has(h)){r+=`<${o}`;continue}const[,g,,$="",f,S]=l,p=new m($,"html-attrs",h,u,n),k=p.getAttr("itemprop");if(h==="meta"&&(k===void 0||p.getAttr("content")===void 0)||h==="link"&&(k===void 0||p.getAttr("href")===void 0)){r+=`<${o}`,n.pop();continue}r+=`\0${n.length}x\x7F${S}`,new A(a,p,g==="/",f==="/>",u,n)}return r};y.exports=T},1452:(y,F,t)=>{const c=t(6010),m=t(3905),A=t(7625),T=t(337),d=(u,n=c.getConfig(),i=[])=>{const s=t(3360),e=n.inExt?/^((?:(?!\0\d+!\x7F)[^\n<>[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]]))?\]\](.*)$/su:/^((?:(?!\0\d+!\x7F)[^\n<>[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]])?)?\]\](.*)$/su,r=/^((?:(?!\0\d+!\x7F)[^\n<>[\]{}|])+)(\||\0\d+!\x7F)(.*)$/su,o=new RegExp(`^\\s*(?:${n.protocol})`,"iu"),l=u.split("[[");let a=l.shift();for(let h=0;h<l.length;h++){let g,$,f,S,p;const k=l[h],w=e.exec(k);if(w)[,$,f,S,p]=w,p[0]==="]"&&(S==null?void 0:S.includes("["))&&(S+="]",p=p.slice(1));else{const I=r.exec(k);I&&(g=!0,[,$,f,S]=I)}if($===void 0||o.test($)||/\0\d+[exhbru]\x7F/u.test($)){a+=`[[${k}`;continue}const C=$.trim()[0]===":";if(C&&g){a+=`[[${k}`;continue}const b=c.normalizeTitle($,0,!1,n,!0,!0,!0),{ns:v,valid:E}=b;if(E){if(g){if(v!==6){a+=`[[${k}`;continue}let I;for(h++;h<l.length;h++){const R=l[h],O=R.split("]]");if(O.length>2){I=!0,S+=`[[${O[0]}]]${O[1]}`,p=O.slice(2).join("]]");break}else if(O.length===2)S+=`[[${O[0]}]]${O[1]}`;else{S+=`[[${R}`;break}}if(S=d(S,n,i),!I){a+=`[[${$}${f}${S}`;continue}}}else{a+=`[[${k}`;continue}S&&(S=s(S,n,i)),a+=`\0${i.length}l\x7F${p}`;let H=m;C||(v===6?H=A:v===14&&(H=T)),S===void 0&&f&&(S=""),new H($,S,n,i,f)}return a};y.exports=d},6622:(y,F,t)=>{const c=t(6010),m=t(962),A=t(3434),T=(d,u=c.getConfig(),n=[])=>{const i=/^((?:\0\d+c\x7F)*)([;:*#]+)/u.exec(d);if(!i)return d;const[s,e,r]=i;d=`${e}\0${n.length}d\x7F${d.slice(s.length)}`,new m(r,u,n);let o=r.split(";").length-1;if(!o)return d;let l=/:+|-\{/gu,a=l.exec(d),h=0;for(;a&&o;){const{0:g,index:$}=a;if(g[0]===":"){if(g.length>=o)return new A(":".repeat(o),u,n),`${d.slice(0,$)}\0${n.length-1}d\x7F${d.slice($+o)}`;d=`${d.slice(0,$)}\0${n.length}d\x7F${d.slice(l.lastIndex)}`,o-=g.length,l.lastIndex=$+4+String(n.length).length,new A(g,u,n)}else if(g==="-{"){if(!h){const{lastIndex:f}=l;l=/-\{|\}-/gu,l.lastIndex=f}h++}else if(h--,!h){const{lastIndex:f}=l;l=/:+|-\{/gu,l.lastIndex=f}a=l.exec(d)}return d};y.exports=T},4737:(y,F,t)=>{const{extUrlChar:c,extUrlCharFirst:m}=t(231),A=t(6010),T=t(8962),d=(u,n=A.getConfig(),i=[])=>{const s=new RegExp(`(^|[^\\p{L}\\d_])(?:${n.protocol})(${m}${c})`,"giu");return u.replace(s,(e,r,o)=>{let l="",a=r?e.slice(1):e;const h=/&(?:lt|gt|nbsp|#x0*(?:3[ce]|a0)|#0*(?:6[02]|160));/iu.exec(a);h&&(l=a.slice(h.index),a=a.slice(0,h.index));const g=new RegExp(`[,;.:!?${a.includes("(")?"":")"}]+$`,"u"),$=g.exec(a);if($){let f=0;$[0][0]===";"&&/&(?:[a-z]+|#x[\da-f]+|#\d+)$/iu.test(a.slice(0,$.index))&&(f=1),l=`${a.slice($.index+f)}${l}`,a=a.slice(0,$.index+f)}return l.length>=o.length?e:(new T(a,!1,n,i),`${r}\0${i.length-1}w\x7F${l}`)})};y.exports=d},3360:(y,F,t)=>{const c=t(6010),m=t(6714),A=(T,d=c.getConfig(),u=[])=>{var a;const n=T.split(/('{2,})/u),{length:i}=n;if(i===1)return T;let s=0,e=0,r,o,l;for(let h=1;h<i;h+=2){const{length:g}=n[h];switch(g){case 2:e++;break;case 4:n[h-1]+="'",n[h]="'''";case 3:if(s++,r)break;n[h-1].endsWith(" ")?!o&&!l&&(l=h):n[h-1].slice(-2,-1)===" "?r=h:o||(o=h);break;default:n[h-1]+="'".repeat(g-5),n[h]="'''''",e++,s++}}if(e%2===1&&s%2===1){const h=(a=r!=null?r:o)!=null?a:l;n[h]="''",n[h-1]+="'"}for(let h=1;h<i;h+=2)new m(n[h].length,d,u),n[h]=`\0${u.length-1}q\x7F`;return n.join("")};y.exports=A},4624:(y,F,t)=>{const c=t(6010),m=t(7507),A=t(8138),T=t(2840),d=t(3125),u=t(5567),n=t(3434),i=({firstChild:{data:s},type:e,name:r},o=c.getConfig(),l=[])=>{const a=[],h=s.split(`
|
|
9
|
+
`);let g=e==="root"||e==="parameter-value"||e==="ext-inner"&&r==="poem"?"":`
|
|
10
|
+
${h.shift()}`;const $=(f,S)=>{if(!S){g+=f;return}const{lastChild:p}=S;if(p.constructor===A)p.setText(String(p)+f);else{const k=new A(f,o,!0,l);k.type="table-inter",S.insertAt(k.setAttribute("stage",3))}};for(const f of h){let S=a.pop();const[p]=/^(?:\s|\0\d+c\x7F)*/u.exec(f),k=f.slice(p.length),w=/^(:*)((?:\s|\0\d+c\x7F)*)(\{\||\{(?:\0\d+c\x7F)*\0\d+!\x7F|\0\d+\{\x7F)(.*)$/u.exec(k);if(w){for(;S&&S.type!=="td";)S=a.pop();const[,I,R,O,U]=w;I&&new n(I,o,l),$(`
|
|
11
|
+
${p}${I&&`\0${l.length-1}d\x7F`}${R}\0${l.length}b\x7F`,S);const j=new T(O,U,o,l);a.push(...S?[S]:[],j);continue}else if(!S){g+=`
|
|
12
|
+
${f}`;continue}const C=/^(?:(\|\}|\0\d+!\x7F\}|\0\d+\}\x7F)|(\|-+|\0\d+!\x7F-+|\0\d+-\x7F-*)(?!-)|(!|(?:\||\0\d+!\x7F)\+?))(.*)$/u.exec(k);if(!C){$(`
|
|
13
|
+
${f}`,S),a.push(...S?[S]:[]);continue}const[,b,v,E,H]=C;if(b){for(;!(S instanceof T);)S=a.pop();S.close(`
|
|
14
|
+
${p}${b}`,!0),$(H,a[a.length-1])}else if(v){S.type==="td"&&(S=a.pop()),S.type==="tr"&&(S=a.pop());const I=new d(`
|
|
15
|
+
${p}${v}`,H,o,l);a.push(S,I),S.insertAt(I)}else{S.type==="td"&&(S=a.pop());const I=E==="!"?/!!|(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu:/(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu;let R=I.exec(H),O=0,U=`
|
|
16
|
+
${p}${E}`;for(;R;){const B=new u(U,H.slice(O,R.index),o,l);S.insertAt(B),{lastIndex:O}=I,[U]=R,R=I.exec(H)}const j=new u(U,H.slice(O),o,l);a.push(S,j),S.insertAt(j)}}return g.slice(1)};y.exports=i},9544:(y,F,t)=>{const{text:c}=t(231),{generateForSelf:m,generateForChild:A}=t(8277),T=t(6010),d=t(8138);class u extends d{constructor(s,e=T.getConfig(),r=[]){super(void 0,e,!0,r,{});P(this,"type","arg");for(let o=0;o<s.length;o++)if(o===0||o>1){const l=t(o===0?9237:9263),a=new l(s[o],o===0?"arg-name":void 0,e,r,{});super.insertAt(a)}else{const l=new d(s[o],e,!0,r);l.type="arg-default",super.insertAt(l.setAttribute("stage",2))}}get default(){var s,e;return(e=(s=this.childNodes[1])==null?void 0:s.text())!=null?e:!1}toString(s){return`{{{${super.toString(s,"|")}}}}`}text(){return`{{{${c(this.childNodes.slice(0,2),"|")}}}}`}getPadding(){return 3}getGaps(){return 1}print(){return super.print({pre:"{{{",post:"}}}",sep:"|"})}lint(s){if(!this.getAttribute("include"))return[m(this,{start:s},"unexpected template argument")];const{childNodes:[e,r,...o]}=this,l=e.lint(s+3);if(r&&l.push(...r.lint(s+4+String(e).length)),o.length>0){const a={start:s,...this.getRootNode().posFromIndex(s)};l.push(...o.map(h=>{const g=A(h,a,"invisible content inside triple brackets"),{startIndex:$,startCol:f}=g;return{...g,startIndex:$-1,startCol:f-1}}))}return l}}y.exports=u},9263:(y,F,t)=>{const c=t(2308),m=t(9237);class A extends c(m){constructor(){super(...arguments);P(this,"type","hidden")}}y.exports=A},9237:(y,F,t)=>{const c=t(6010),m=t(8138);class A extends m{constructor(u,n,i=c.getConfig(),s=[],e=void 0){super(u,i,!0,s,e);P(this,"type","plain");n&&(this.type=n)}}y.exports=A},5037:(y,F,t)=>{var f,S,p;const{generateForChild:c}=t(8277),{removeComment:m}=t(231),A=t(6010),T=t(8138),d=t(9237),u=new Set(["id","class","style","lang","dir","title","tabindex","aria-describedby","aria-flowto","aria-hidden","aria-label","aria-labelledby","aria-owns","role","about","property","resource","datatype","typeof","itemid","itemprop","itemref","itemscope","itemtype"]),n=new Set(["align"]),i=new Set(["cite"]),s=new Set(["cite","datetime"]),e=new Set(["width"]),r=new Set(["align","valign","abbr","axis","headers","scope","rowspan","colspan","width","height","bgcolor"]),o=new Set(["type"]),l={div:n,h1:n,h2:n,h3:n,h4:n,h5:n,h6:n,blockquote:i,q:i,p:n,br:new Set(["clear"]),pre:e,ins:s,del:s,ul:o,ol:new Set(["type","start","reversed"]),li:new Set(["type","value"]),table:new Set(["summary","width","border","frame","rules","cellspacing","cellpadding","align","bgcolor"]),caption:n,tr:new Set(["bgcolor","align","valign"]),td:r,th:r,img:new Set(["alt","src","width","height","srcset"]),font:new Set(["size","color","face"]),hr:e,rt:new Set(["rbspan"]),data:new Set(["value"]),time:new Set(["datetime"]),meta:new Set(["itemprop","content"]),link:new Set(["itemprop","href","title"]),gallery:new Set(["mode","showfilename","caption","perrow","widths","heights","showthumbnails","type"]),poem:new Set(["compact","align"]),categorytree:new Set(["align","hideroot","onlyroot","depth","mode","hideprefix","namespaces","showcount","notranslations"]),combooption:new Set(["name","for","inline","align"])},a=new Set,h={nowiki:a,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:a,inputbox:a,templatestyles:new Set(["src","wrapper"]),dynamicpagelist:a,poll:new Set(["id","show-results-before-voting"]),sm2:o,flashmp3:o,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"])},g=new RegExp("expression|(?:filter|accelerator|-o-link(?:-source)?|-o-replace)\\s*:|(?:url|image(?:-set)?)\\s*\\(|attr\\s*\\([^)]+[\\s,]url","u");class $ extends T{constructor(C,b,v,E="",H="",I=[],R=A.getConfig(),O=[]){const U=new d(v,"attr-key",R,O,{});let j;if(v==="title")j=new T(H,R,!0,O,{}).setAttribute("type","attr-value").setAttribute("stage",A.MAX_STAGE-1);else if(b==="gallery"&&v==="caption"){const B={...R,excludes:[...R.excludes,"quote","extLink","magicLink","list"]};j=new T(H,B,!0,O,{}).setAttribute("type","attr-value").setAttribute("stage",5)}else if(b==="choose"&&(v==="before"||v==="after")){const B={...R,excludes:[...R.excludes,"heading","html","table","hr","list"]};j=new T(H,B,!0,O,{}).setAttribute("type","attr-value").setAttribute("stage",1)}else j=new d(H,"attr-value",R,O,{});super(void 0,R,!0,O);z(this,f,void 0);z(this,S,void 0);z(this,p,void 0);this.type=C,this.append(U,j),M(this,f,E),M(this,S,I),M(this,p,b),this.setAttribute("name",m(v).trim().toLowerCase())}get balanced(){return!x(this,f)||x(this,S)[0]===x(this,S)[1]}get value(){return this.getValue()}get tag(){return x(this,p)}afterBuild(){x(this,f).includes("\0")&&M(this,f,this.getAttribute("buildFromStr")(x(this,f),"string")),this.parentNode&&M(this,p,this.parentNode.name),this.setAttribute("name",this.firstChild.text().trim().toLowerCase())}toString(C){const[b="",v=""]=x(this,S);return x(this,f)?`${super.toString(C,`${x(this,f)}${b}`)}${v}`:this.firstChild.toString(C)}text(){return x(this,f)?`${super.text(`${x(this,f).trim()}"`)}"`:this.firstChild.text()}getGaps(){var C,b;return x(this,f)?x(this,f).length+((b=(C=x(this,S)[0])==null?void 0:C.length)!=null?b:0):0}print(){const[C="",b=""]=x(this,S);return x(this,f)?super.print({sep:`${x(this,f)}${C}`,post:b}):super.print()}lint(C){var V;const b=super.lint(C),{balanced:v,firstChild:E,lastChild:H,type:I,name:R,parentNode:O,value:U}=this,j=O==null?void 0:O.name;let B;if(!v){const K=this.getRootNode();B={start:C,...K.posFromIndex(C)};const Q=c(H,B,"unclosed quotes","warning"),q=Q.startIndex-1,Y=Q.startCol-1;b.push({...Q,startIndex:q,startCol:Y})}return!/\{\{[^{]+\}\}/u.test(R)&&(I==="ext-attr"&&!(j in l)&&h[j]&&!h[j].has(R)||(I==="html-attr"||I==="table-attr"||j in l)&&!((V=l[j])!=null&&V.has(R))&&!/^(?:xmlns:[\w:.-]+|data-[^:]*)$/u.test(R)&&(j==="meta"||j==="link"||!u.has(R)))?(B||(B={start:C,...this.getRootNode().posFromIndex(C)}),b.push(c(E,B,"illegal attribute name"))):R==="style"&&typeof U=="string"&&g.test(U)&&(B||(B={start:C,...this.getRootNode().posFromIndex(C)}),b.push(c(H,B,"insecure style"))),b}getValue(){if(x(this,f)){const C=this.lastChild.text();return x(this,S)[1]?C:C.trim()}return!0}}f=new WeakMap,S=new WeakMap,p=new WeakMap,y.exports=$},5649:(y,F,t)=>{const{generateForSelf:c,generateForChild:m}=t(8277),{removeComment:A}=t(231),T=t(6010),d=t(8138),u=t(9237),n=t(5037);class i extends d{constructor(e,r,o,l=T.getConfig(),a=[]){if(super(void 0,l,!0,a,{}),this.type=r,this.setAttribute("name",o),e){const h=new RegExp(`([^\\s/](?:(?!\0\\d+~\x7F)[^\\s/=])*)(?:((?:\\s|\0\\d+c\x7F)*(?:=|\0\\d+~\x7F)(?:\\s|\0\\d+c\x7F)*)(?:(["'])(.*?)(\\3|$)|(\\S*)))?`,"gsu");let g="",$=h.exec(e),f=0;const S=()=>{g&&(super.insertAt(new u(g,`${r.slice(0,-1)}-dirty`,l,a,{})),g="")};for(;$;){const{index:p,0:k,1:w,2:C,3:b,4:v,5:E,6:H}=$;if(g+=e.slice(f,p),/^(?:[\w:]|\0\d+[t!~{}+-]\x7F)(?:[\w:.-]|\0\d+[t!~{}+-]\x7F)*$/u.test(A(w).trim())){const I=v!=null?v:H,R=[b,E],O=new n(r.slice(0,-1),o,w,C,I,R,l,a);S(),super.insertAt(O)}else g+=k;({lastIndex:f}=h),$=h.exec(e)}g+=e.slice(f),S()}}afterBuild(){var r,o;const e=t(5567);this.type==="table-attrs"&&this.setAttribute("name",((r=this.parentNode)==null?void 0:r.subtype)==="caption"?"caption":(o=this.parentNode)==null?void 0:o.type)}getAttrTokens(e){return this.childNodes.filter(r=>r instanceof n&&r.name===e.toLowerCase().trim())}getAttrToken(e){const r=this.getAttrTokens(e);return r[r.length-1]}getAttr(e){var r;return(r=this.getAttrToken(e))==null?void 0:r.getValue()}lint(e){const r=t(2350),o=super.lint(e),{parentNode:{closing:l},length:a,childNodes:h}=this,g={},$=new Set;let f;l&&this.text().trim()&&(f={start:e,...this.getRootNode().posFromIndex(e)},o.push(c(this,f,"attributes of a closing tag")));for(let S=0;S<a;S++){const p=h[S];if(p instanceof u&&p.text().trim())f||(f={start:e,...this.getRootNode().posFromIndex(e)}),o.push(m(p,f,"containing invalid attribute"));else if(p instanceof n){const{name:k}=p;k in g?($.add(k),g[k].push(p)):k!=="class"&&(g[k]=[p])}}if($.size>0){f||(f={start:e,...this.getRootNode().posFromIndex(e)});for(const S of $)o.push(...g[S].map(p=>m(p,f,T.msg("duplicated $1 attribute",S))))}return o}print(){const e=t(2350);return String(this)?`<span class="wpb-${this.type}">${this.childNodes.map(r=>r.print({class:r instanceof u&&r.text().trim()&&"hidden"})).join("")}</span>`:""}}y.exports=i},9910:(y,F,t)=>{const{text:c,print:m}=t(231),A=t(6010),T=t(8138),d=t(6719),u=t(8683);class n extends T{constructor(e,r,o=A.getConfig(),l=[]){super(void 0,o,!0,l);P(this,"type","converter");this.append(new d(e,o,l));const[a]=r,h=a.includes(":"),g=new u(a,h,o,l);h&&g.length===1?this.insertAt(new u(r.join(";"),!1,o,l)):this.append(g,...r.slice(1).map($=>new u($,!0,o,l)))}toString(e){const{childNodes:[r,...o]}=this;return`-{${r.toString()}${r.length>0?"|":""}${o.map(String).join(";")}}-`}text(){const{childNodes:[e,...r]}=this;return`-{${e.text()}|${c(r,";")}}-`}getPadding(){return 2}getGaps(e=0){return e=e<0?e+this.length:e,e||this.firstChild.length>0?1:0}print(){const{childNodes:[e,...r]}=this;return`<span class="wpb-converter">-{${e.print()}${e.length>0?"|":""}${m(r,{sep:";"})}}-</span>`}}y.exports=n},6719:(y,F,t)=>{var n;const{generateForChild:c}=t(8277),m=t(6010),A=t(8138),T=t(9237),d=new Set(["A","T","R","D","-","H","N"]);class u extends A{constructor(e,r=m.getConfig(),o=[]){super(void 0,r,!0,o,{});P(this,"type","converter-flags");z(this,n,void 0);this.append(...e.map(l=>new T(l,"converter-flag",r,o)))}afterBuild(){M(this,n,this.childNodes.map(e=>e.text().trim()))}toString(e){return super.toString(e,";")}text(){return super.text(";")}getGaps(){return 1}print(){return super.print({sep:";"})}lint(e){const r=this.getVariantFlags(),o=this.getUnknownFlags(),l=new Set(x(this,n).filter(p=>d.has(p))),{length:a}=x(this,n).filter(p=>!p),h=x(this,n).length-o.size-a,g=super.lint(e);if(r.size===h||l.size===h)return g;const $={start:e,...this.getRootNode().posFromIndex(e)},{childNodes:f,length:S}=this;for(let p=0;p<S;p++){const k=f[p],w=k.text().trim();if(w&&!r.has(w)&&!o.has(w)&&(r.size>0||!l.has(w))){const C=c(k,$,"invalid conversion flag");g.push(C)}}return g}getUnknownFlags(){return new Set(x(this,n).filter(e=>/\{{3}[^{}]+\}{3}/u.test(e)))}getVariantFlags(){const e=new Set(this.getAttribute("config").variants);return new Set(x(this,n).filter(r=>e.has(r)))}}n=new WeakMap,y.exports=u},8683:(y,F,t)=>{const c=t(6010),m=t(8138),A=t(9237);class T extends m{constructor(n,i=!0,s=c.getConfig(),e=[]){super(void 0,s,!0,e);P(this,"type","converter-rule");if(i){const r=n.indexOf(":"),o=n.slice(0,r).indexOf("=>"),l=o===-1?n.slice(0,r):n.slice(o+2,r);s.variants.includes(l.trim())?(super.insertAt(new A(l,"converter-rule-variant",s,e)),super.insertAt(new A(n.slice(r+1),"converter-rule-to",s,e)),o!==-1&&super.insertAt(new A(n.slice(0,o),"converter-rule-from",s,e),0)):super.insertAt(new A(n,"converter-rule-noconvert",s,e))}else super.insertAt(new A(n,"converter-rule-noconvert",s,e))}toString(n){if(this.length===3){const{childNodes:[i,s,e]}=this;return`${i.toString(n)}=>${s.toString(n)}:${e.toString(n)}`}return super.toString(n,":")}text(){if(this.length===3){const{childNodes:[n,i,s]}=this;return`${n.text()}=>${i.text()}:${s.text()}`}return super.text(":")}getGaps(n=0){const{length:i}=this;return n=n<0?n+i:n,n===0&&i===3?2:1}print(){if(this.length===3){const{childNodes:[n,i,s]}=this;return`<span class="wpb-converter-rule">${n.print()}=>${i.print()}:${s.print()}</span>`}return super.print({sep:":"})}}y.exports=T},741:(y,F,t)=>{var d;const c=t(6010),m=t(8138),A=t(8962);class T extends m{constructor(i,s="",e="",r=c.getConfig(),o=[]){super(void 0,r,!0,o,{});P(this,"type","ext-link");z(this,d,void 0);if(this.insertAt(new A(i,!0,r,o)),M(this,d,s),e){const l=new m(e,r,!0,o,{});l.type="ext-link-text",this.insertAt(l.setAttribute("stage",c.MAX_STAGE-1))}}toString(i){return this.length===1?`[${super.toString(i)}${x(this,d)}]`:`[${super.toString(i,x(this,d))}]`}text(){return`[${super.text(" ")}]`}getPadding(){return 1}getGaps(){return x(this,d).length}print(){const{length:i}=this;return super.print(i>1?{pre:"[",sep:x(this,d),post:"]"}:{pre:"[",post:`${x(this,d)}]`})}}d=new WeakMap,y.exports=T},1891:(y,F,t)=>{const c=t(6010),m=t(8138),A=t(1031),T=t(9263);class d extends m{constructor(i,s=c.getConfig(),e=[]){var r;super(void 0,s,!0,e,{});P(this,"type","ext-inner");P(this,"name","gallery");for(const o of(r=i==null?void 0:i.split(`
|
|
17
|
+
`))!=null?r:[]){const l=/^([^|]+)(?:\|(.*))?/u.exec(o);if(!l){super.insertAt(o.trim()?new T(o,void 0,s,[],{}):o);continue}const[,a,h]=l;this.normalizeTitle(a,6,!0,!0).valid?super.insertAt(new A(a,h,s,e)):super.insertAt(new T(o,void 0,s,[],{}))}}toString(i){return super.toString(i,`
|
|
18
|
+
`)}text(){return super.text(`
|
|
19
|
+
`).replace(/\n\s*\n/gu,`
|
|
20
|
+
`)}getGaps(){return 1}print(){return super.print({sep:`
|
|
21
|
+
`})}lint(i){const{top:s,left:e}=this.getRootNode().posFromIndex(i),r=[];for(let o=0,l=i;o<this.length;o++){const a=this.childNodes[o],h=String(a),{length:g}=h,$=h.trim(),f=s+o,S=o?0:e;a.type==="hidden"&&$&&!/^<!--.*-->$/u.test($)?r.push({message:c.msg("invalid content in <$1>","gallery"),severity:"error",startIndex:l,endIndex:l+g,startLine:f,endLine:f,startCol:S,endCol:S+g}):a.type!=="hidden"&&a.type!=="text"&&r.push(...a.lint(l)),l+=g+1}return r}}y.exports=d},2158:(y,F,t)=>{const c=t(6010),m=t(8138),A=t(3423);class T extends m{constructor(u,n,i=c.getConfig(),s=[]){u=u.replace(/(<nowiki>)(.*?)(<\/nowiki>)/giu,(e,r,o,l)=>(new A(r,i,s),new A(l,i,s),`\0${s.length-1}c\x7F${o}\0${s.length}c\x7F`)),super(u,i,!0,s,{}),this.type=n}}y.exports=T},428:(y,F,t)=>{const c=t(6010),m=t(2158);class A extends m{constructor(u,n=c.getConfig(),i=[]){super(u,"ext-inner",n,i);P(this,"name","pre");this.setAttribute("stage",c.MAX_STAGE-1)}isPlain(){return!0}}y.exports=A},9450:(y,F,t)=>{const{generateForSelf:c}=t(8277),m=t(6010),A=t(8138),T=t(8058);class d extends A{constructor(i,s,e=m.getConfig(),r=[]){super(void 0,e,!0,r);P(this,"type","heading");this.setAttribute("name",String(i));const o=new A(s[0],e,!0,r);o.type="heading-title",o.setAttribute("stage",2);const l=new T(s[1],/^[^\S\n]*$/u,"heading-trail",e,r,{});this.append(o,l)}toString(i){const s="=".repeat(Number(this.name));return`${s}${this.firstChild.toString()}${s}${this.lastChild.toString()}`}text(){const i="=".repeat(Number(this.name));return`${i}${this.firstChild.text()}${i}`}getPadding(){return super.getPadding()+Number(this.name)}getGaps(){return Number(this.name)}print(){const i="=".repeat(Number(this.name));return super.print({pre:i,sep:i})}lint(i){const s=super.lint(i),e=String(this.firstChild);let r;return this.name==="1"&&(r=c(this,{start:i},"<h1>"),s.push(r)),(e[0]==="="||e.endsWith("="))&&(r||(r=c(this,{start:i},"")),s.push({...r,message:m.msg('unbalanced "=" in a section header')})),this.closest("html-attrs, table-attrs")&&(r||(r=c(this,{start:i},"")),s.push({...r,message:m.msg("section header in a HTML tag")})),s}}y.exports=d},2350:(y,F,t)=>{var u,n,i;const{generateForSelf:c}=t(8277),m=t(6010),A=t(8138),T=new Set(["if","ifeq","ifexpr","ifexist","iferror","switch"]);class d extends A{constructor(r,o,l,a,h=m.getConfig(),g=[]){super(void 0,h,!0,g);P(this,"type","html");z(this,u,void 0);z(this,n,void 0);z(this,i,void 0);this.insertAt(o),this.setAttribute("name",r.toLowerCase()),M(this,u,l),M(this,n,a),M(this,i,r)}get closing(){return x(this,u)}toString(r){return`<${x(this,u)?"/":""}${x(this,i)}${super.toString()}${x(this,n)?"/":""}>`}text(){return`<${x(this,u)?"/":""}${x(this,i)}${x(this,u)?"":super.text()}${x(this,n)?"/":""}>`}getPadding(){return x(this,i).length+(x(this,u)?2:1)}print(){return super.print({pre:`<${x(this,u)?"/":""}${x(this,i)}`,post:`${x(this,n)?"/":""}>`})}lint(r){var a;const o=super.lint(r);let l;this.name==="h1"&&!x(this,u)&&(l=c(this,{start:r},"<h1>"),o.push(l)),this.closest("table-attrs")&&(l||(l=c(this,{start:r},"")),o.push({...l,message:"HTML tag in table attributes"}));try{this.findMatchingTag()}catch({message:h}){l||(l=c(this,{start:r},""));const[g]=h.split(":"),$={...l,message:m.msg(g)};(g==="unclosed tag"||g==="unmatched closing tag"&&T.has((a=this.closest("magic-word"))==null?void 0:a.name))&&($.severity="warning"),o.push($)}return o}findMatchingTag(){const{html:r}=this.getAttribute("config"),{name:o,parentNode:l}=this,a=String(this);if(x(this,u)&&(x(this,n)||r[2].includes(o)))throw new SyntaxError(`tag that is both closing and self-closing: ${a}`);if(r[2].includes(o)||x(this,n)&&r[1].includes(o))return this;if(x(this,n)&&r[0].includes(o))throw new SyntaxError(`invalid self-closing tag: ${a}`);if(!l)return;const{childNodes:h}=l,g=h.indexOf(this),$=x(this,u)?h.slice(0,g).reverse().filter(({type:S,name:p})=>S==="html"&&p===o):h.slice(g+1).filter(({type:S,name:p})=>S==="html"&&p===o);let f=x(this,u)?-1:1;for(const S of $)if(S.closing?f--:f++,f===0)return S;throw new SyntaxError(`${x(this,u)?"unmatched closing":"unclosed"} tag: ${a}`)}}u=new WeakMap,n=new WeakMap,i=new WeakMap,y.exports=d},1874:(y,F,t)=>{var r;const{print:c,extUrlChar:m,extUrlCharFirst:A}=t(231),{generateForSelf:T}=t(8277),d=t(6986),u=t(6010),n=t(8138),i=new Set(["alt","link","lang","page","caption"]),s=(l,a,h=u.getConfig(),g=!1)=>{switch(a=a.replace(/\0\d+t\x7F/gu,"").trim(),l){case"width":return/^(?:\d+x?|\d*x\d+)$/u.test(a);case"link":{if(!a)return"";if(new RegExp(`(?:(?:${h.protocol}|//)${A}|\0\\d+m\x7F)${m}(?=\0\\d+t\x7F|$)`,"iu").test(a))return a;a.startsWith("[[")&&a.endsWith("]]")&&(a=a.slice(2,-2));const f=u.normalizeTitle(a,0,!1,h,g,!0,!0);return f.valid&&f}case"lang":return h.variants.includes(a);case"alt":case"class":case"manualthumb":return!0;default:return!isNaN(a)}};class e extends n{constructor(h,g=u.getConfig(),$=[]){var a=(...o)=>{super(...o);P(this,"type","image-parameter");z(this,r,"")};let f;const S=Object.entries(g.img).map(([k,w])=>[k,w,new RegExp(`^(\\s*)${k.replace("$1","(.*)")}(\\s*)$`,"u")]),p=S.find(([,k,w])=>(f=w.exec(h),f&&(f.length!==4||s(k,f[2],g,!0)!==!1)));if(p){f.length===3?(a(void 0,g,!0,$),M(this,r,h)):(a(f[2],g,!0,$,{}),M(this,r,`${f[1]}${p[0]}${f[3]}`)),this.setAttribute("name",p[1]);return}a(h,{...g,excludes:[...g.excludes,"list"]},!0,$),this.setAttribute("name","caption").setAttribute("stage",7)}get link(){return this.name==="link"?s("link",super.text(),this.getAttribute("config")):void 0}afterBuild(){this.parentNode.type==="gallery-image"&&!i.has(this.name)&&this.setAttribute("name","invalid")}isPlain(){return this.name==="caption"}toString(h){return x(this,r)?x(this,r).replace("$1",super.toString(h)):super.toString(h)}text(){return x(this,r)?x(this,r).replace("$1",super.text()).trim():super.text().trim()}getPadding(){return Math.max(0,x(this,r).indexOf("$1"))}lint(h){var $;const g=super.lint(h);return this.name==="invalid"?g.push(T(this,{start:h},"invalid gallery image parameter")):($=this.link)!=null&&$.encoded&&g.push(T(this,{start:h},"unnecessary URL encoding in an internal link")),g}print(){return x(this,r)?`<span class="wpb-image-parameter">${x(this,r).replace("$1",`<span class="wpb-image-caption">${c(this.childNodes)}</span>`)}</span>`:super.print({class:"image-caption"})}}r=new WeakMap,y.exports=e},2641:(y,F,t)=>{const{generateForSelf:c,generateForChild:m}=t(8277),A=t(6010),T=t(8138),d=t(3423),u=t(1031),n=t(2571);class i extends T{constructor(r,o=A.getConfig(),l=[]){super(void 0,o,!0,l,{});P(this,"type","ext-inner");P(this,"name","imagemap");if(!r)return;const a=r.split(`
|
|
22
|
+
`),h=new Set(o.protocol.split("|")),g=d,$=p=>{super.insertAt(new g(p,o,l))};let f=!0,S=!1;for(const p of a){const k=p.trim();if(!(S||!k||k[0]==="#")){if(f){const[w,...C]=p.split("|"),b=this.normalizeTitle(w,0,!0);if(b.valid&&b.ns===6){const v=new u(w,C.length>0?C.join("|"):void 0,o,l);v.type="imagemap-image",super.insertAt(v),f=!1;continue}else S=!0}else if(p.trim().split(/[\t ]/u)[0]==="desc"){super.insertAt(p);continue}else if(p.includes("[")){const w=p.indexOf("["),C=p.slice(w),b=/^\[{2}([^|]+)(?:\|([^\]]+))?\]{2}[\w\s]*$/u.exec(C);if(b){if(this.normalizeTitle(b[1],0,!0,!1,!0).valid){super.insertAt(new n(p.slice(0,w),b.slice(1),C.slice(C.indexOf("]]")+2),o,l));continue}}else if(h.has(C.slice(1,C.indexOf(":")+1))||h.has(C.slice(1,C.indexOf("//")+2))){const v=/^\[([^\]\s]+)(?:(\s+)(\S[^\]]*)?)?\][\w\s]*$/u.exec(C);if(v){super.insertAt(new n(p.slice(0,w),v.slice(1),C.slice(C.indexOf("]")+1),o,l));continue}}}}$(p)}}get image(){return this.childNodes.find(({type:r})=>r==="imagemap-image")}toString(r){return super.toString(r,`
|
|
23
|
+
`)}text(){return super.text(`
|
|
24
|
+
`).replace(/\n{2,}/gu,`
|
|
25
|
+
`)}getGaps(){return 1}print(){return super.print({sep:`
|
|
26
|
+
`})}lint(r){const o=super.lint(r),l={start:r,...this.getRootNode().posFromIndex(r)};return this.image?o.push(...this.childNodes.filter(a=>{const h=String(a).trim();return a.type==="noinclude"&&h&&h[0]!=="#"}).map(a=>m(a,l,"invalid link in <imagemap>"))):o.push(c(this,l,"<imagemap> without an image")),o}}y.exports=i},2571:(y,F,t)=>{const c=t(6986),m=t(8138),A=t(3423),T=t(3905),d=t(741);class u extends m{constructor(s,e,r,o,l){const a=e.length===2?T:d;super(void 0,o,!0,l);P(this,"type","imagemap-link");this.append(s,new a(...e,o,l),new A(r,o,l))}}y.exports=u},8138:(y,F,t)=>{var n,i,s,e,r,o,l,a,ot,g,lt,f,at,p,ht,w,dt,b,pt,E,ut,I,gt,O,ct,j,ft,V,xt;const{text:c}=t(231),m=t(6010),A=t(9205),T=t(7507),{MAX_STAGE:d}=m,Q=class extends A{constructor(N,L=m.getConfig(),G=!1,Z=[],_=void 0){super();z(this,a);z(this,g);z(this,f);z(this,p);z(this,w);z(this,b);z(this,E);z(this,I);z(this,O);z(this,j);z(this,V);P(this,"type","root");z(this,n,0);z(this,i,void 0);z(this,s,void 0);z(this,e,void 0);z(this,r,(N=x(this,n),L=!1)=>{if(N<x(this,n)||!this.isPlain()||this.length===0)return this;switch(N){case 0:this.type==="root"&&x(this,s).shift(),M(this,e,Boolean(L)),J(this,a,ot).call(this,L);break;case 1:J(this,g,lt).call(this);break;case 2:J(this,f,at).call(this);break;case 3:J(this,p,ht).call(this);break;case 4:J(this,w,dt).call(this);break;case 5:J(this,b,pt).call(this);break;case 6:J(this,E,ut).call(this);break;case 7:J(this,I,gt).call(this);break;case 8:J(this,O,ct).call(this);break;case 9:J(this,j,ft).call(this);break;case 10:J(this,V,xt).call(this)}if(this.type==="root")for(const G of x(this,s))G.getAttribute("parseOnce")(N,L);return nt(this,n)._++,this});z(this,o,(N,L)=>{const G=N.split(/[\0\x7F]/u).map((Z,_)=>{if(_%2===0)return new T(Z);if(isNaN(Z[Z.length-1]))return x(this,s)[Number(Z.slice(0,-1))];throw new Error(`\u89E3\u6790\u9519\u8BEF\uFF01\u672A\u6B63\u786E\u6807\u8BB0\u7684 Token\uFF1A${Z}`)});return L==="string"?G.map(String).join(""):L==="text"?c(G):G});z(this,l,()=>{M(this,n,d);const{length:N,firstChild:L}=this,G=String(L);if(N===1&&L.type==="text"&&G.includes("\0")&&(this.replaceChildren(...x(this,o).call(this,G)),this.normalize(),this.type==="root"))for(const Z of x(this,s))Z.getAttribute("build")()});typeof N=="string"&&this.insertAt(G?N:N.replace(/[\0\x7F]/gu,"")),M(this,i,L),M(this,s,Z),Z.push(this)}getAttribute(N){switch(N){case"config":return JSON.parse(JSON.stringify(x(this,i)));case"accum":return x(this,s);case"parseOnce":return x(this,r);case"buildFromStr":return x(this,o);case"build":return x(this,l);case"include":{if(x(this,e)!==void 0)return x(this,e);const L=this.getRootNode();return L.type==="root"&&L!==this?L.getAttribute("include"):!1}default:return super.getAttribute(N)}}setAttribute(N,L){switch(N){case"stage":return x(this,n)===0&&this.type==="root"&&x(this,s).shift(),M(this,n,L),this;default:return super.setAttribute(N,L)}}isPlain(){return this.constructor===Q}insertAt(N,L=this.length){return typeof N=="string"&&(N=new T(N)),super.insertAt(N,L),N.type==="root"&&(N.type="plain"),N}normalizeTitle(N,L=0,G=!1,Z=!1,_=!1){return m.normalizeTitle(N,L,x(this,e),x(this,i),G,Z,_)}afterBuild(){if(this.type==="root")for(const N of x(this,s))N.afterBuild()}parse(N=d,L=!1){for(;x(this,n)<N;)x(this,r).call(this,x(this,n),L);return N&&(x(this,l).call(this),this.afterBuild()),this}};let u=Q;n=new WeakMap,i=new WeakMap,s=new WeakMap,e=new WeakMap,r=new WeakMap,o=new WeakMap,l=new WeakMap,a=new WeakSet,ot=function(N){const L=t(4907);this.setText(L(String(this.firstChild),x(this,i),x(this,s),N))},g=new WeakSet,lt=function(){const N=t(8275),L=this.type==="root"?String(this.firstChild):`\0${String(this.firstChild)}`,G=N(L,x(this,i),x(this,s));this.setText(this.type==="root"?G:G.slice(1))},f=new WeakSet,at=function(){if(x(this,i).excludes.includes("html"))return;const N=t(5130);this.setText(N(String(this.firstChild),x(this,i),x(this,s)))},p=new WeakSet,ht=function(){if(x(this,i).excludes.includes("table"))return;const N=t(4624),L=t(2840);this.setText(N(this,x(this,i),x(this,s)));for(const G of x(this,s))if(G instanceof L&&G.type!=="td"){G.normalize();const{childNodes:[,Z]}=G;if(typeof Z=="string"&&Z.includes("\0")){G.removeAt(1);const _=new Q(Z,x(this,i),!0,x(this,s));G.insertAt(_,1),_.setAttribute("stage",4)}}},w=new WeakSet,dt=function(){if(x(this,i).excludes.includes("hr"))return;const N=t(2937);this.setText(N(this,x(this,i),x(this,s)))},b=new WeakSet,pt=function(){const N=t(1452);this.setText(N(String(this.firstChild),x(this,i),x(this,s)))},E=new WeakSet,ut=function(){if(x(this,i).excludes.includes("quote"))return;const N=t(3360),L=String(this.firstChild).split(`
|
|
27
|
+
`);for(let G=0;G<L.length;G++)L[G]=N(L[G],x(this,i),x(this,s));this.setText(L.join(`
|
|
28
|
+
`))},I=new WeakSet,gt=function(){if(x(this,i).excludes.includes("extLink"))return;const N=t(7513);this.setText(N(String(this.firstChild),x(this,i),x(this,s)))},O=new WeakSet,ct=function(){if(x(this,i).excludes.includes("magicLink"))return;const N=t(4737);this.setText(N(String(this.firstChild),x(this,i),x(this,s)))},j=new WeakSet,ft=function(){if(x(this,i).excludes.includes("list"))return;const N=t(6622),L=String(this.firstChild).split(`
|
|
29
|
+
`);let G=this.type==="root"||this.type==="ext-inner"&&this.name==="poem"?0:1;for(;G<L.length;G++)L[G]=N(L[G],x(this,i),x(this,s));this.setText(L.join(`
|
|
30
|
+
`))},V=new WeakSet,xt=function(){var N;if(((N=x(this,i).variants)==null?void 0:N.length)>0){const L=t(3765);this.setText(L(String(this.firstChild),x(this,i),x(this,s)))}},y.exports=u},337:(y,F,t)=>{const c=t(3905);class m extends c{constructor(){super(...arguments);P(this,"type","category")}}y.exports=m},7625:(y,F,t)=>{var e,et;const{explode:c}=t(231),{generateForChild:m}=t(8277),A=t(6010),T=t(3905),d=t(1874),u=new Set(["manualthumb","frameless","framed","thumbnail"]),n=new Set(["left","right","center","none"]),i=new Set(["baseline","sub","super","top","text-top","middle","bottom","text-bottom"]);class s extends T{constructor(a,h,g=A.getConfig(),$=[],f="|"){super(a,void 0,g,$,f);z(this,e);P(this,"type","file");this.append(...c("-{","}-","|",h).map(S=>new d(S,g,$)))}lint(a){const h=super.lint(a),g=this.getAllArgs().filter(({childNodes:w})=>{const C=w.filter(b=>b.text().trim());return C.length!==1||C[0].type!=="arg"}),$=[...new Set(g.map(({name:w})=>w))].filter(w=>w!=="invalid"),f=$.filter(w=>u.has(w)),S=$.filter(w=>n.has(w)),p=$.filter(w=>i.has(w));if(g.length===$.length&&f.length<2&&S.length<2&&p.length<2)return h;const k={start:a,...this.getRootNode().posFromIndex(a)};for(const w of $){let C=g.filter(({name:b})=>b===w);w==="caption"&&(C=[...C.slice(0,-1).filter(b=>b.text()),C[C.length-1]]),C.length>1&&h.push(...C.map(b=>m(b,k,A.msg("duplicated image $1 parameter",w))))}return f.size>1&&h.push(...g.filter(({name:w})=>u.has(w)).map(w=>m(w,k,"conflicting image $1 parameter","frame"))),S.size>1&&h.push(...g.filter(({name:w})=>n.has(w)).map(w=>m(w,k,"conflicting image $1 parameter","horizontal-alignment"))),p.size>1&&h.push(...g.filter(({name:w})=>i.has(w)).map(w=>m(w,k,"conflicting image $1 parameter","vertical-alignment"))),h}getAllArgs(){return this.childNodes.slice(1)}getArgs(a){return this.getAllArgs().filter(({name:h})=>a===h)}getFrameArgs(){return J(this,e,et).call(this,u,"\u6846\u67B6")}getHorizAlignArgs(){return J(this,e,et).call(this,n,"\u6C34\u5E73\u5BF9\u9F50")}getVertAlignArgs(){return J(this,e,et).call(this,i,"\u5782\u76F4\u5BF9\u9F50")}}e=new WeakSet,et=function(a,h){return this.getAllArgs().filter(({name:$})=>a.has($))},y.exports=s},1031:(y,F,t)=>{var u;const{generateForSelf:c}=t(8277),m=t(6010),A=t(8138),T=t(7625);class d extends T{constructor(s,e,r=m.getConfig(),o=[]){let l;if(e!==void 0){l=new A(e,r,!0,o),l.type="temp";for(let a=1;a<m.MAX_STAGE;a++)l.getAttribute("parseOnce")();o.splice(o.indexOf(l),1)}super(s,l==null?void 0:l.toString(),r,o);P(this,"type","gallery-image");z(this,u,!1);this.setAttribute("bracket",!1)}afterBuild(){const s=this.type==="imagemap-image",e=this.normalizeTitle(String(this.firstChild),s?0:6,!0,!s);M(this,u,e.ns!==6)}getPadding(){return 0}lint(s){const e=super.lint(s);return x(this,u)&&e.push(c(this,{start:s},"invalid gallery image")),e}}u=new WeakMap,y.exports=d},3905:(y,F,t)=>{var n,i,s,e;const{generateForChild:c}=t(8277),m=t(6010),A=t(7507),T=t(8138),d=t(9237);class u extends T{constructor(l,a,h=m.getConfig(),g=[],$="|"){super(void 0,h,!0,g,{});P(this,"type","link");z(this,n,!0);z(this,i,void 0);z(this,s,void 0);z(this,e,!1);if(this.insertAt(new d(l,"link-target",h,g,{})),a!==void 0){const f=new T(a,h,!0,g,{});f.type="link-text",this.insertAt(f.setAttribute("stage",m.MAX_STAGE-1))}M(this,i,$)}afterBuild(){var a;const l=this.normalizeTitle(this.firstChild.text(),0,!1,!0,!0);M(this,s,l.fragment),M(this,e,l.encoded),(a=x(this,i))!=null&&a.includes("\0")&&M(this,i,this.getAttribute("buildFromStr")(x(this,i),"string"))}setAttribute(l,a){return l==="bracket"?(M(this,n,Boolean(a)),this):super.setAttribute(l,a)}toString(l){const a=super.toString(l,x(this,i));return x(this,n)?`[[${a}]]`:a}text(){const l=super.text("|");return x(this,n)?`[[${l}]]`:l}getPadding(){return 2}getGaps(){return x(this,i).length}print(){return super.print(x(this,n)?{pre:"[[",post:"]]",sep:x(this,i)}:{sep:x(this,i)})}lint(l){var S;const a=super.lint(l),{childNodes:[h,g],type:$}=this;let f;return x(this,e)&&(f={start:l,...this.getRootNode().posFromIndex(l)},a.push(c(h,f,"unnecessary URL encoding in an internal link"))),$==="link"&&((S=g==null?void 0:g.childNodes)==null?void 0:S.some(({type:p,data:k})=>p==="text"&&k.includes("|")))?(f||(f={start:l,...this.getRootNode().posFromIndex(l)}),a.push(c(g,f,'additional "|" in the link text',"warning"))):$!=="link"&&x(this,s)!==void 0&&(f||(f={start:l,...this.getRootNode().posFromIndex(l)}),a.push(c(h,f,"useless fragment"))),a}}n=new WeakMap,i=new WeakMap,s=new WeakMap,e=new WeakMap,y.exports=u},8962:(y,F,t)=>{const{generateForChild:c}=t(8277),m=t(6010),A=t(8138);class T extends A{constructor(n,i,s=m.getConfig(),e=[]){super(n,s,!0,e,{});P(this,"type","free-ext-link");i&&(this.type="ext-link-url")}lint(n){const i=super.lint(n),s=`[\uFF0C\uFF1B\u3002\uFF1A\uFF01\uFF1F\uFF08\uFF09]+${this.type==="ext-link-url"?"|\\|+":""}`;let e;for(const r of this.childNodes){const o=String(r);if(r.type!=="text"||!new RegExp(s,"u").test(o))continue;e||(e={start:n,...this.getRootNode().posFromIndex(n)});const l=c(r,e,"","warning"),a=new RegExp(s,"gu");for(let h=a.exec(o);h;h=a.exec(o)){const{index:g,0:{0:$,length:f}}=h,S=o.slice(0,g).split(`
|
|
31
|
+
`),{length:p}=S,{length:k}=S[p-1],w=n+g,C=l.startLine+p-1,b=(p>1?0:l.startCol)+k;i.push({...l,message:m.msg("$1 in URL",$==="|"?'"|"':m.msg("full-width punctuation")),startIndex:w,endIndex:w+f,startLine:C,endLine:C,startCol:b,endCol:b+f})}}return i}}y.exports=T},9389:(y,F,t)=>{const c=t(6010),m=t(8889);class A extends m{constructor(u,n=c.getConfig(),i=[]){super(u,/<(option|choicetemplate)(\s[^>]*)?>(.*?)<\/(\1)>/gsu,["option","choicetemplate"],n,i);P(this,"name","choose")}}y.exports=A},9269:(y,F,t)=>{const c=t(6010),m=t(8889);class A extends m{constructor(u,n=c.getConfig(),i=[]){super(u,/<(combooption)(\s[^>]*)?>(.*?)<\/(combooption\s*)>/gisu,["combooption"],n,i);P(this,"name","combobox")}}y.exports=A},8889:(y,F,t)=>{const{generateForChild:c}=t(8277),m=t(6010),A=t(8138),T=t(7267),d=t(3423),u=t(5749);class n extends A{constructor(e,r,o,l=m.getConfig(),a=[]){var g;const h=(g=e==null?void 0:e.replace(r,($,f,S,p,k)=>{const w=`\0${a.length+1}${f?"e":"c"}\x7F`;if(f)new T(f,S,p,k,l,a);else{const C=$.endsWith("-->");new u($.slice(4,C?-3:void 0),C,l,a)}return w}))==null?void 0:g.replace(/(^|\0\d+[ce]\x7F)([^\0]+)(?=$|\0\d+[ce]\x7F)/gu,($,f,S)=>(new d(S,l,a),`${f}\0${a.length}c\x7F`));super(h,l,!0,a,{});P(this,"type","ext-inner")}lint(e){let r;return[...super.lint(e),...this.childNodes.filter(o=>{if(o.type==="ext"||o.type==="comment")return!1;const l=String(o).trim();return l&&!/^<!--.*-->$/u.test(l)}).map(o=>(r||(r={start:e,...this.getRootNode().posFromIndex(e)}),c(o,r,m.msg("invalid content in <$1>",this.name))))]}}y.exports=n},5937:(y,F,t)=>{const c=t(6010),m=t(8889);class A extends m{constructor(u,n=c.getConfig(),i=[]){super(u,/<!--.*?(?:-->|$)|<(ref)(\s[^>]*)?>(.*?)<\/(ref\s*)>/gisu,["ref"],n,i);P(this,"name","references")}}y.exports=A},5749:(y,F,t)=>{const c=t(2308),{generateForSelf:m}=t(8277),A=t(6010),T=t(6935);class d extends c(T){constructor(i,s=!0,e=A.getConfig(),r=[]){super(i,e,r);P(this,"type","comment");P(this,"closed");this.closed=s}getPadding(){return 4}print(){return super.print({pre:"<!--",post:this.closed?"-->":""})}lint(i){return this.closed?[]:[m(this,{start:i},"unclosed HTML comment")]}toString(i){return`<!--${String(this.firstChild)}${this.closed?"-->":""}`}}y.exports=d},3434:(y,F,t)=>{const c=t(6935);class m extends c{constructor(){super(...arguments);P(this,"type","dd")}}y.exports=m},7815:(y,F,t)=>{const c=t(2308),m=t(6935);class A extends c(m){constructor(){super(...arguments);P(this,"type","double-underscore")}getPadding(){return 2}print(){return super.print({pre:"__",post:"__"})}toString(u){return`__${String(this.firstChild)}__`}}y.exports=A},2582:(y,F,t)=>{const c=t(6010),m=t(6935);class A extends m{constructor(u,n=c.getConfig(),i=[]){super("-".repeat(u),n,i);P(this,"type","hr")}}y.exports=A},6935:(y,F,t)=>{const{generateForSelf:c}=t(8277),m=t(6010),A=t(8138);class T extends A{constructor(n,i=m.getConfig(),s=[]){super(n,i,!0,s);P(this,"type","ext-inner")}lint(n){const{type:i,name:s}=this;return i==="ext-inner"&&(s==="templatestyles"||s==="section")&&String(this)?[c(this,{start:n},m.msg("nothing should be in <$1>",s))]:super.lint(n)}}y.exports=T},962:(y,F,t)=>{const c=t(3434);class m extends c{constructor(){super(...arguments);P(this,"type","list")}}y.exports=m},3423:(y,F,t)=>{const c=t(2308),m=t(6935);class A extends c(m){constructor(){super(...arguments);P(this,"type","noinclude")}}y.exports=A},6714:(y,F,t)=>{const{generateForSelf:c}=t(8277),m=t(6010),A=t(7507),T=t(6935);class d extends T{constructor(i,s=m.getConfig(),e=[]){super("'".repeat(i),s,e);P(this,"type","quote")}lint(i){const{previousSibling:s,nextSibling:e}=this,r=m.msg('lonely "$1"',"'"),o=[];let l;if((s==null?void 0:s.type)==="text"&&s.data.endsWith("'")){l=c(this,{start:i},r);const{startIndex:a,startLine:h,startCol:g}=l,[,{length:$}]=s.data.match(/(?:^|[^'])('+)$/u),f=i-$;o.push({...l,startIndex:f,endIndex:a,startCol:g-$,endLine:h,endCol:g})}if((e==null?void 0:e.type)==="text"&&e.data[0]==="'"){l||(l=c(this,{start:i},r));const{endIndex:a,endLine:h,endCol:g}=l,[{length:$}]=e.data.match(/^'+/u),f=a+$;o.push({...l,startIndex:a,endIndex:f,startLine:h,startCol:g,endCol:g+$})}return o}}y.exports=d},851:(y,F,t)=>{const c=t(6010),m=t(8138);class A extends m{constructor(u,n=c.getConfig(),i=[]){super(u,n,!0,i);P(this,"type","onlyinclude")}toString(u){return`<onlyinclude>${super.toString()}</onlyinclude>`}getPadding(){return 13}print(){return super.print({pre:'<span class="wpb-ext"><onlyinclude></span>',post:'<span class="wpb-ext"></onlyinclude></span>'})}isPlain(){return!0}}y.exports=A},9380:(y,F,t)=>{const{generateForChild:c}=t(8277),m=t(6010),A=t(8138),T=t(9237);class d extends A{constructor(i,s=m.getConfig(),e=[]){super(void 0,s,!0,e,{});P(this,"type","ext-inner");if(i){const r=T;this.append(...i.split(`
|
|
32
|
+
`).map(o=>new r(o,"param-line",s,e,{})))}}toString(i){return super.toString(i,`
|
|
33
|
+
`)}text(){return super.text(`
|
|
34
|
+
`)}getGaps(){return 1}print(){return super.print({sep:`
|
|
35
|
+
`})}lint(i){let s;return this.childNodes.filter(e=>{const{childNodes:r}=e,o=r.findIndex(({type:a})=>a!=="text"),l=(o>=0?r.slice(0,o).map(String).join(""):String(e)).trim();return l&&!(o>=0?/^[a-z]+(?:\[\])?\s*(?:=|$)/iu:/^[a-z]+(?:\[\])?\s*=/iu).test(l)}).map(e=>(s||(s={start:i,...this.getRootNode().posFromIndex(i)}),c(e,s,m.msg("invalid parameter of $1",this.name))))}}y.exports=d},6934:(y,F,t)=>{const c=t(8275),m=t(6010),A=t(9380),T=t(9237);class d extends A{constructor(i,s=m.getConfig(),e=[]){super(void 0,s,e);P(this,"name","inputbox");if(i=c(i,s,e),e.splice(e.indexOf(this),1),e.push(this),i){const r=T;this.append(...i.split(`
|
|
36
|
+
`).map(o=>new r(o,"param-line",s,e,{})))}}}y.exports=d},9799:(y,F,t)=>{const{extUrlChar:c,extUrlCharFirst:m}=t(231),{generateForChild:A}=t(8277),T=t(6010),d=t(8138);class u extends d{constructor(s,e,r=T.getConfig(),o=[]){super(void 0,r,!0,o);P(this,"type","parameter");const l=new d(typeof s=="number"?void 0:s,r,!0,o,{}),a=new d(e,r,!0,o);l.type="parameter-key",a.type="parameter-value",this.append(l,a.setAttribute("stage",2))}get anon(){return this.firstChild.length===0}afterBuild(){if(!this.anon){const s=t(1782),e=String(this.firstChild).replace(/<!--.*?-->/gu,"").replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu,"$1"),{parentNode:r}=this;this.setAttribute("name",e),r instanceof s&&r.getArgs(e,!1,!1).add(this)}}toString(s){return this.anon?this.lastChild.toString(s):super.toString(s,"=")}text(){return this.anon?this.lastChild.text():super.text("=")}getGaps(){return this.anon?0:1}print(){return super.print({sep:this.anon?"":"="})}lint(s){var l;const e=super.lint(s),{firstChild:r}=this,o=(l=new RegExp(`https?://${m}${c}$`,"iu").exec(String(r).replace(/<!--.*?-->/gu,"")))==null?void 0:l[0];if(o&&new URL(o).search){const a=A(r,{start:s},"unescaped query string in an anonymous parameter");e.push({...a,startIndex:a.endIndex,endIndex:a.endIndex+1,startLine:a.endLine,startCol:a.endCol,endCol:a.endCol+1})}return e}}y.exports=u},8058:(y,F,t)=>{const c=t(6010),m=t(8138);class A extends m{constructor(d,u,n="plain",i=c.getConfig(),s=[],e=void 0){super(d,i,!0,s,e),this.type=n}}y.exports=A},2840:(y,F,t)=>{const{generateForChild:c}=t(8277),m=t(3125),A=t(8058);class T extends m{constructor(){super(...arguments);P(this,"type","table")}get closed(){return this.lastChild.type==="table-syntax"}lint(n){const i=super.lint(n);if(!this.closed){const{firstChild:s}=this,e=c(s,{start:n},"unclosed table");i.push(e)}return i}close(n=`
|
|
37
|
+
|}`,i=!1){const s=this.getAttribute("config"),e=this.getAttribute("accum");super.insertAt(new A(n,void 0,"table-syntax",s,e))}}y.exports=T},5567:(y,F,t)=>{var u;const{generateForChild:c}=t(8277),m=t(6010),A=t(8138),T=t(3125);class d extends T{constructor(s,e,r=m.getConfig(),o=[]){let l=e==null?void 0:e.match(/\||\0\d+!\x7F/u),a=l?e.slice(0,l.index):"";/\[\[|-\{/u.test(a)&&(l=void 0,a="");super(s,a,r,o);P(this,"type","td");z(this,u,"");l&&([nt(this,u)._]=l);const h=new A(e==null?void 0:e.slice((l==null?void 0:l.index)+x(this,u).length),r,!0,o);h.type="td-inner",this.insertAt(h.setAttribute("stage",4))}get subtype(){return this.getSyntax().subtype}getSyntax(){const s=this.firstChild.text(),e=s[s.length-1];let r="td";return e==="!"?r="th":e==="+"&&(r="caption"),{subtype:r}}afterBuild(){x(this,u).includes("\0")&&M(this,u,this.getAttribute("buildFromStr")(x(this,u),"string"))}toString(s){const{childNodes:[e,r,o]}=this;return`${e.toString()}${r.toString()}${x(this,u)}${o.toString()}`}text(){const{childNodes:[s,e,r]}=this;return`${s.text()}${e.text()}${x(this,u)}${r.text()}`}getGaps(s=0){return s=s<0?s+this.length:s,s===1?x(this,u).length:0}lint(s){const e=super.lint(s);s+=this.getRelativeIndex(-1);for(const r of this.lastChild.childNodes)r.type==="text"&&r.data.includes("|")&&e.push(c(r,{start:s},'additional "|" in a table cell',"warning"));return e}print(){const{childNodes:[s,e,r]}=this;return`<span class="wpb-td">${s.print()}${e.print()}${x(this,u)}${r.print()}</span>`}}u=new WeakMap,y.exports=d},3125:(y,F,t)=>{const{generateForChild:c}=t(8277),m=t(6010),A=t(8138),T=t(8058),d=t(5649);class u extends A{constructor(s,e="",r=m.getConfig(),o=[],l=void 0){super(void 0,r,!0,o,{});P(this,"type","tr");this.append(new T(s,l,"table-syntax",r,o,{}),new d(e,"table-attrs",this.type,r,o))}lint(s){const e=t(1782),r=t(9544),o=super.lint(s),l=this.childNodes.find(({type:$})=>$==="table-inter");if(!l)return o;const a=l.childNodes.find($=>$.text().trim()),h=/^\s*(?:!|\{\{\s*![!-]?\s*\}\})/u;if(!a||h.test(String(a))||a.type==="arg"&&h.test(a.default||""))return o;if(a.type==="magic-word")try{if(a.getPossibleValues().every(f=>h.test(f.text())))return o}catch($){}const g=c(l,{start:s},"content to be moved out from the table");return o.push({...g,startIndex:g.startIndex+1,startLine:g.startLine+1,startCol:0}),o}text(){const s=super.text();return this.type==="tr"&&!s.trim().includes(`
|
|
38
|
+
`)?"":s}}y.exports=u},7267:(y,F,t)=>{const{generateForSelf:c}=t(8277),m=t(6010),A=t(8138),T=t(1074),d=t(5649);class u extends T{constructor(s,e="",r="",o=void 0,l=m.getConfig(),a=[]){e=!e||/^\s/u.test(e)?e:` ${e}`;const h=s.toLowerCase(),g=new d(e,"ext-attrs",h,l,a),$={...l,excludes:[...l.excludes]},f=new Set($.ext);let S;switch(f.delete(h),$.ext=[...f],$.inExt=!0,h){case"tab":f.delete("tabs"),$.ext=[...f];case"indicator":case"poem":case"ref":case"option":case"combooption":case"tabs":case"poll":case"seo":h==="poem"&&$.excludes.push("heading"),S=new A(r,$,!0,a);break;case"gallery":{const p=t(1891);S=new p(r,$,a);break}case"pre":{const p=t(428);S=new p(r,$,a);break}case"references":{const p=t(5937);S=new p(r,$,a);break}case"choose":{const p=t(9389);S=new p(r,$,a);break}case"combobox":{const p=t(9269);S=new p(r,$,a);break}case"imagemap":{const p=t(2641);S=new p(r,l,a);break}case"dynamicpagelist":{const p=t(9380);S=new p(r,$,a);break}case"inputbox":{$.excludes.push("heading");const p=t(6934);S=new p(r,$,a);break}default:{const p=t(6935);S=new p(r,l)}}S.setAttribute("name",h).type="ext-inner";super(s,g,S,o,l,a);P(this,"type","ext");P(this,"closed",!0)}lint(s){const e=super.lint(s);if(this.name!=="nowiki"&&this.closest("html-attrs, table-attrs")){const r=this.getRootNode(),o={start:s,...r.posFromIndex(s)};e.push(c(this,o,"extension tag in HTML tag attributes"))}return e}}y.exports=u},8655:(y,F,t)=>{const c=t(2308),m=t(6010),A=t(1074);class T extends c(A){constructor(n,i="",s=void 0,e=void 0,r=m.getConfig(),o=[]){super(n,i,s!=null?s:"",s===void 0||e!=null?e:"",r,o);P(this,"type","include")}}y.exports=T},1074:(y,F,t)=>{var T,d,u;const c=t(6010),m=t(8138);class A extends m{constructor(s,e,r,o,l=c.getConfig(),a=[]){super(void 0,l,!0);z(this,T,void 0);z(this,d,void 0);z(this,u,void 0);this.setAttribute("name",s.toLowerCase()),M(this,u,[s,o||s]),M(this,T,o===void 0),M(this,d,o!==""),this.append(e,r);let h=a.indexOf(e);h===-1&&(h=a.indexOf(r)),h===-1&&(h=1/0),a.splice(h,0,this)}get closed(){return x(this,d)}toString(s){const{firstChild:e,lastChild:r}=this,[o,l]=x(this,u);return x(this,T)?`<${o}${String(e)}/>`:`<${o}${String(e)}>${String(r)}${x(this,d)?`</${l}>`:""}`}text(){const[s,e]=x(this,u);return x(this,T)?`<${s}${this.firstChild.text()}/>`:`<${s}${super.text(">")}${x(this,d)?`</${e}>`:""}`}getPadding(){return x(this,u)[0].length+1}getGaps(){return 1}print(){const[s,e]=x(this,u);return super.print(x(this,T)?{pre:`<${s}`,post:"/>"}:{pre:`<${s}`,sep:">",post:x(this,d)?`</${e}>`:""})}}T=new WeakMap,d=new WeakMap,u=new WeakMap,y.exports=A},1782:(y,F,t)=>{var o,l,a,h,g,mt;const{removeComment:c,print:m,text:A,decodeHtml:T}=t(231),{generateForChild:d}=t(8277),u=t(6010),n=t(8138),i=t(9799),s=t(9237),e=t(8058);class r extends n{constructor(p,k,w=u.getConfig(),C=[]){var R,O;super(void 0,w,!0,C,{});z(this,g);P(this,"type","template");P(this,"modifier","");z(this,o,{});z(this,l,void 0);z(this,a,!0);z(this,h,!1);const{parserFunction:[b,v]}=w,E=(R=/^(?:\s|\0\d+c\x7F)*\0\d+s\x7F/u.exec(p))==null?void 0:R[0];if(E)this.setAttribute("modifier",E),p=p.slice(E.length);else if(p.includes(":")){const[U,...j]=p.split(":"),[B]=/^(?:\s|\0\d+c\x7F)*/u.exec((O=j[0])!=null?O:"");this.setModifier(`${U}:${B}`)&&(p=j.join(":").slice(B.length))}if(p.includes(":")||k.length===0&&!x(this,h)){const[U,...j]=p.split(":"),B=c(U),V=B.trim(),K=v.includes(V),Q=b[V.toLowerCase()];if(!(j.length>0&&/\s$/u.test(B))&&(K||Q)){this.setAttribute("name",Q||V.toLowerCase()).type="magic-word";const q=new RegExp(`^\\s*${V}\\s*$`,K?"u":"iu"),Y=new e(U,q,"magic-word-name",w,C,{});if(this.insertAt(Y),j.length>0&&k.unshift([j.join(":")]),this.name==="invoke")for(let N=0;N<2;N++){const L=k.shift();if(!L)break;const G=new s(L.join("="),`invoke-${N?"function":"module"}`,w,C,{});this.insertAt(G)}}}if(this.type==="template"){const U=c(T(p)).split("#")[0].trim();if(!U||/\0\d+[eh!+-]\x7F|[<>[\]{}\n]|%[\da-f]{2}/u.test(U))throw C.pop(),new SyntaxError(`\u975E\u6CD5\u7684\u6A21\u677F\u540D\u79F0\uFF1A${U}`);const j=new s(p,"template-name",w,C,{});this.insertAt(j)}const H=this.isTemplate();let I=1;for(let U=0;U<k.length;U++){const j=k[U];!H&&!(this.name==="switch"&&U>0)&&(j[0]=j.join("="),j.length=1),j.length===1&&(j.unshift(I),I++),this.insertAt(new i(...j,w,C))}}setModifier(p=""){const{parserFunction:[,,k,w]}=this.getAttribute("config"),C=c(p).trim();if(p&&!C.endsWith(":"))return!1;const b=C.slice(0,-1).toLowerCase(),v=k.includes(b),E=w.includes(b);return v||E||p===""?(this.setAttribute("modifier",p),M(this,h,v),Boolean(p)):!1}afterBuild(){if(this.modifier.includes("\0")&&this.setAttribute("modifier",this.getAttribute("buildFromStr")(this.modifier,"string")),this.isTemplate()){const p=this.type==="template",k=this.normalizeTitle(this.childNodes[p?0:1].text(),p?10:828);M(this,l,k.fragment),M(this,a,k.valid)}}toString(p){const{childNodes:k,firstChild:w,modifier:C}=this;return`{{${C}${this.type==="magic-word"?`${String(w)}${k.length>1?":":""}${k.slice(1).map(String).join("|")}`:super.toString(p,"|")}}}`}text(){const{childNodes:p,firstChild:k,modifier:w,type:C,name:b}=this;return C==="magic-word"&&b==="vardefine"?"":`{{${w}${this.type==="magic-word"?`${k.text()}${p.length>1?":":""}${A(p.slice(1),"|")}`:super.text("|")}}}`}getPadding(){return this.modifier.length+2}getGaps(){return 1}print(){const{childNodes:p,firstChild:k,modifier:w}=this;return`<span class="wpb-${this.type}">{{${w}${this.type==="magic-word"?`${k.print()}${p.length>1?":":""}${m(p.slice(1),{sep:"|"})}`:m(p,{sep:"|"})}}}</span>`}lint(p){const k=super.lint(p),{type:w,childNodes:C}=this;let b;if(this.isTemplate())x(this,l)!==void 0&&(b={start:p,...this.getRootNode().posFromIndex(p)},k.push(d(C[w==="template"?0:1],b,"useless fragment")));else return k;x(this,a)||(b={start:p,...this.getRootNode().posFromIndex(p)},k.push(d(C[1],b,"illegal module name")));const v=this.getDuplicatedArgs();return v.length>0&&(b||(b={start:p,...this.getRootNode().posFromIndex(p)}),k.push(...v.flatMap(([,E])=>E).map(E=>d(E,b,"duplicated parameter")))),k}isTemplate(){return this.type==="template"||this.type==="magic-word"&&this.name==="invoke"}insertAt(p,k=this.length){return super.insertAt(p,k),p.anon?J(this,g,mt).call(this,p):p.name&&this.getArgs(p.name,!1,!1).add(p),p}getAllArgs(){return this.childNodes.filter(p=>p instanceof i)}getAnonArgs(){return this.getAllArgs().filter(({anon:p})=>p)}getArgs(p,k,w=!0){const C=String(p).replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu,"$1");let b;return Object.prototype.hasOwnProperty.call(x(this,o),C)?b=x(this,o)[C]:(b=new Set(this.getAllArgs().filter(({name:v})=>C===v)),x(this,o)[C]=b),b}getDuplicatedArgs(){return this.isTemplate()?Object.entries(x(this,o)).filter(([,{size:p}])=>p>1).map(([p,k])=>[p,[...k]]):[]}getPossibleValues(){const{type:p,name:k,childNodes:w,constructor:{name:C}}=this;if(p==="template")throw new Error(`${C}.getPossibleValues \u65B9\u6CD5\u4EC5\u4F9B\u7279\u5B9A\u9B54\u672F\u5B57\u4F7F\u7528\uFF01`);let b;switch(k){case"if":case"ifexist":case"ifexpr":case"iferror":b=2;break;case"ifeq":b=3;break;default:throw new Error(`${C}.getPossibleValues \u65B9\u6CD5\u4EC5\u4F9B\u7279\u5B9A\u9B54\u672F\u5B57\u4F7F\u7528\uFF01`)}const v=w.slice(b,b+2).map(({childNodes:[,E]})=>E);for(let E=0;E<v.length;){const{length:H,0:I}=v[E].childNodes.filter(R=>R.text().trim());if(H===0)v.splice(E,1);else if(H>1||I.type!=="magic-word")E++;else try{const R=I.getPossibleValues();v.splice(E,1,...R),E+=R.length}catch(R){E++}}return v}}o=new WeakMap,l=new WeakMap,a=new WeakMap,h=new WeakMap,g=new WeakSet,mt=function(p){const k=this.getAnonArgs(),w=k.indexOf(p);for(let C=w;C<k.length;C++){const b=k[C],{name:v}=b,E=String(C+1);v!==E&&this.getArgs(E,!1,!1).add(b.setAttribute("name",E))}},y.exports=r},8277:(y,F,t)=>{const c=t(6010),m=t(8138),A=(d,u,n,i="error")=>{const s=d.getRelativeIndex(),{offsetHeight:e,offsetWidth:r,parentNode:o,length:l}=d,{top:a,left:h}=o.posFromIndex(s),{start:g}=u,{top:$,left:f}="top"in u?u:d.getRootNode().posFromIndex(g),S=g+s,p=S+l,k=$+a,w=k+e-1,C=a?h:f+h,b=e>1?r:C+r;return{message:c.msg(n),severity:i,startIndex:S,endIndex:p,startLine:k,endLine:w,startCol:C,endCol:b}},T=(d,u,n,i="error")=>{const{start:s}=u,{offsetHeight:e,offsetWidth:r,length:o}=d,{top:l,left:a}="top"in u?u:d.getRootNode().posFromIndex(s);return{message:c.msg(n),severity:i,startIndex:s,endIndex:s+o,startLine:l,endLine:l+e-1,startCol:a,endCol:e>1?r:a+r}};y.exports={generateForChild:A,generateForSelf:T}},231:(y,F,t)=>{const c='(?:\\[[\\da-f:.]+\\]|[^[\\]<>"\\0-\\x1F\\x7F\\p{Zs}\\uFFFD])',m='(?:[^[\\]<>"\\0-\\x1F\\x7F\\p{Zs}\\uFFFD]|\\0\\d+c\\x7F)*',A=s=>s.replace(/\0\d+c\x7F/gu,""),T=(s,e={})=>{const r=t(7507),o=t(9205),{pre:l="",post:a="",sep:h=""}=e,g={"&":"amp","<":"lt",">":"gt"};return`${l}${s.map($=>$ instanceof o?$.print():String($).replace(/[&<>]/gu,f=>`&${g[f]};`)).join(h)}${a}`},d=s=>s.replace(/[\\{}()|.?*+^$[\]]/gu,"\\$&"),u=(s,e,r,o)=>{if(o===void 0)return[];const l=new RegExp(`${[s,e,r].map(d).join("|")}`,"gu"),a=[];let h=l.exec(o),g=0,$=0;for(;h;){const{0:f,index:S}=h;f!==r?g+=f===s?1:-1:g===0&&(a.push(o.slice($,S)),{lastIndex:$}=l),h=l.exec(o)}return a.push(o.slice($)),a},n=(s,e="")=>{const r=t(3853);return s.map(o=>typeof o=="string"?o:o.text()).join(e)},i=s=>s==null?void 0:s.replace(/&#(\d+|x[\da-f]+);/giu,(e,r)=>String.fromCodePoint(`${r[0].toLowerCase()==="x"?"0":""}${r}`));y.exports={extUrlCharFirst:c,extUrlChar:m,removeComment:A,print:T,escapeRegExp:d,explode:u,text:n,decodeHtml:i}},8166:y=>{y.exports=JSON.parse('{"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","img"]],"namespaces":{},"nsid":{},"parserFunction":[{"#language":"language","#special":"special","#speciale":"speciale","#tag":"tag","#formatdate":"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"},[],["msg","\u539F\u59CB","raw"],["\u66FF\u4EE3","subst","\u5B89\u5168\u66FF\u4EE3","safesubst"]],"doubleUnderscore":[[],[]],"protocol":"bitcoin:|ftp://|ftps://|geo:|git://|gopher://|http://|https://|irc://|ircs://|magnet:|mailto:|mms://|news:|nntp://|redis://|sftp://|sip:|sips:|sms:|ssh://|svn://|tel:|telnet://|urn:|worldwind://|xmpp:","img":{},"variants":["zh","zh-hans","zh-hant","zh-cn","zh-tw","zh-hk","zh-sg","zh-my","zh-mo"]}')}},D={};function X(y){var F=D[y];if(F!==void 0)return F.exports;var t=D[y]={exports:{}};return W[y](t,t.exports,X),t.exports}var tt=X(6010)})();})();
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.wikiparse-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
.wikiparsed {
|
|
5
|
+
position: relative;
|
|
6
|
+
display: block;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
width: 100%;
|
|
9
|
+
resize: vertical;
|
|
10
|
+
font-family: monospace;
|
|
11
|
+
background: none !important;
|
|
12
|
+
caret-color: #000;
|
|
13
|
+
}
|
|
14
|
+
#wikiPretty {
|
|
15
|
+
position: absolute;
|
|
16
|
+
inset: 0;
|
|
17
|
+
background-color: #fff;
|
|
18
|
+
-webkit-user-select: none;
|
|
19
|
+
user-select: none;
|
|
20
|
+
}
|
|
21
|
+
#wikiPretty + .wikiparsed, #wikiPretty {
|
|
22
|
+
outline: none;
|
|
23
|
+
border: 1.5px solid #dedede !important;
|
|
24
|
+
border-radius: 0;
|
|
25
|
+
padding: .4em;
|
|
26
|
+
line-height: 1.4 !important;
|
|
27
|
+
font-size: inherit;
|
|
28
|
+
tab-size: 4;
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
word-break: normal;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* compromise for font-weight: bold */
|
|
34
|
+
.wpb-ext, .wpb-html,
|
|
35
|
+
.wpb-arg,
|
|
36
|
+
.wpb-template,
|
|
37
|
+
.wpb-magic-word,
|
|
38
|
+
.wpb-heading-title,
|
|
39
|
+
.wpb-table, .wpb-tr, .wpb-td,
|
|
40
|
+
.wpb-double-underscore, .wpb-hr, .wpb-quote, .wpb-list, .wpb-dd
|
|
41
|
+
.wpb-converter {
|
|
42
|
+
-webkit-text-stroke-width: .1ex;
|
|
43
|
+
}
|
|
44
|
+
.wpb-hidden, .wpb-table-inter, .wpb-table-inter span,
|
|
45
|
+
.wpb-noinclude, .wpb-include, .wpb-comment,
|
|
46
|
+
.wpb-ext-attrs, .wpb-html-attrs,
|
|
47
|
+
.wpb-ext-inner,
|
|
48
|
+
.wpb-arg-default,
|
|
49
|
+
.wpb-invoke-module, .wpb-invoke-function,
|
|
50
|
+
.wpb-parameter,
|
|
51
|
+
.wpb-table-attrs, .wpb-td-inner,
|
|
52
|
+
.wpb-converter-rule {
|
|
53
|
+
-webkit-text-stroke-width: 0;
|
|
54
|
+
}
|
|
55
|
+
#wikiPretty span {
|
|
56
|
+
font-weight: normal;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
#wikiPretty.active span {
|
|
60
|
+
color: transparent;
|
|
61
|
+
background: none;
|
|
62
|
+
}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
(() => {
|
|
4
|
+
const MAX_STAGE = 11;
|
|
5
|
+
|
|
6
|
+
/** web worker */
|
|
7
|
+
const workerJS = () => {
|
|
8
|
+
self.importScripts('https://fastly.jsdelivr.net/gh/bhsd-harry/wikiparser-node@0.9.1-b/bundle/bundle.min.js');
|
|
9
|
+
const /** @type {{Parser: Parser}} */ {Parser} = self,
|
|
10
|
+
entities = {'&': 'amp', '<': 'lt', '>': 'gt'};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {{data: ['setI18N|'setConfig', ParserConfig]|[string, number, string, Boolean, number]}}
|
|
14
|
+
*/
|
|
15
|
+
self.onmessage = ({data}) => {
|
|
16
|
+
const [command, qid, ...args] = data;
|
|
17
|
+
switch (command) {
|
|
18
|
+
case 'setI18N':
|
|
19
|
+
Parser.i18n = qid;
|
|
20
|
+
break;
|
|
21
|
+
case 'setConfig':
|
|
22
|
+
Parser.config = qid;
|
|
23
|
+
break;
|
|
24
|
+
case 'getConfig':
|
|
25
|
+
self.postMessage([qid, Parser.minConfig]);
|
|
26
|
+
break;
|
|
27
|
+
case 'lint':
|
|
28
|
+
self.postMessage([qid, Parser.parse(...args).lint(), args[0]]);
|
|
29
|
+
break;
|
|
30
|
+
default: {
|
|
31
|
+
const stage = args[2] === undefined ? MAX_STAGE : args[2];
|
|
32
|
+
self.postMessage([
|
|
33
|
+
qid,
|
|
34
|
+
Parser.parse(...args).childNodes.map(child => [
|
|
35
|
+
stage,
|
|
36
|
+
String(child),
|
|
37
|
+
child.type === 'text'
|
|
38
|
+
? String(child).replace(/[&<>]/gu, p => `&${entities[p]};`)
|
|
39
|
+
: child.print(),
|
|
40
|
+
]),
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const blob = new Blob([`(${String(workerJS).replace(/MAX_STAGE/gu, MAX_STAGE)})()`], {type: 'text/javascript'}),
|
|
48
|
+
url = URL.createObjectURL(blob),
|
|
49
|
+
worker = new Worker(url);
|
|
50
|
+
URL.revokeObjectURL(url);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 生成事件监听函数
|
|
54
|
+
* @param {number} qid 输入id
|
|
55
|
+
* @param {(res: *) => void} resolve Promise对象的resolve函数
|
|
56
|
+
* @param {string} raw 原始文本
|
|
57
|
+
*/
|
|
58
|
+
const getListener = (qid, resolve, raw) => {
|
|
59
|
+
const listener = /** @param {{data: [number, *, string]}} e 消息事件 */ ({data: [rid, res, resRaw]}) => {
|
|
60
|
+
if (rid === qid && (raw === undefined || raw === resRaw)) {
|
|
61
|
+
worker.removeEventListener('message', listener);
|
|
62
|
+
resolve(res);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return listener;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 更新I18N消息
|
|
70
|
+
* @param {Record<string, string>} i18n I18N消息
|
|
71
|
+
*/
|
|
72
|
+
const setI18N = i18n => {
|
|
73
|
+
worker.postMessage(['setI18N', i18n]);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 更新解析设置
|
|
78
|
+
* @param {ParserConfig} config 设置
|
|
79
|
+
*/
|
|
80
|
+
const setConfig = config => {
|
|
81
|
+
worker.postMessage(['setConfig', config]);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 获取Parser.minConfig
|
|
86
|
+
* @returns {Promise<ParserConfig>}
|
|
87
|
+
*/
|
|
88
|
+
const getConfig = () => new Promise(resolve => {
|
|
89
|
+
worker.addEventListener('message', getListener(-3, resolve));
|
|
90
|
+
worker.postMessage(['getConfig', -3]);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 将解析改为异步执行
|
|
95
|
+
* @param {string} wikitext wikitext
|
|
96
|
+
* @param {boolean} include 是否嵌入
|
|
97
|
+
* @param {number} stage 解析层级
|
|
98
|
+
* @param {number} qid Printer编号
|
|
99
|
+
* @returns {Promise<[number, string, string][]>}
|
|
100
|
+
*/
|
|
101
|
+
const print = (wikitext, include, stage, qid = -1) => new Promise(resolve => {
|
|
102
|
+
worker.addEventListener('message', getListener(qid, resolve));
|
|
103
|
+
worker.postMessage(['print', qid, wikitext, include, stage]);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 将语法分析改为异步执行
|
|
108
|
+
* @param {string} wikitext wikitext
|
|
109
|
+
* @param {boolean} include 是否嵌入
|
|
110
|
+
* @param {number} qid Linter编号,暂时固定为`-2`
|
|
111
|
+
* @returns {Promise<LintError[]>}
|
|
112
|
+
*/
|
|
113
|
+
const lint = (wikitext, include, qid = -2) => new Promise(resolve => {
|
|
114
|
+
worker.addEventListener('message', getListener(qid, resolve, wikitext));
|
|
115
|
+
worker.postMessage(['lint', qid, wikitext, include]);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
let id = 0;
|
|
119
|
+
|
|
120
|
+
/** 用于打印AST */
|
|
121
|
+
class Printer {
|
|
122
|
+
/**
|
|
123
|
+
* @param {HTMLDivElement} preview 置于下层的代码高亮
|
|
124
|
+
* @param {HTMLTextAreaElement} textbox 置于上层的文本框
|
|
125
|
+
* @param {boolean} include 是否嵌入
|
|
126
|
+
*/
|
|
127
|
+
constructor(preview, textbox, include) {
|
|
128
|
+
this.id = id++;
|
|
129
|
+
this.preview = preview;
|
|
130
|
+
this.textbox = textbox;
|
|
131
|
+
this.include = Boolean(include);
|
|
132
|
+
/** @type {[number, string, string][]} */ this.root = [];
|
|
133
|
+
/** @type {Promise<void>} */ this.running = undefined;
|
|
134
|
+
this.viewportChanged = false;
|
|
135
|
+
/** @type {[number, string]} */ this.ticks = [0, undefined];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** 倒计时 */
|
|
139
|
+
tick() {
|
|
140
|
+
setTimeout(() => {
|
|
141
|
+
const {ticks} = this;
|
|
142
|
+
if (ticks[0] > 0) {
|
|
143
|
+
ticks[0] -= 500;
|
|
144
|
+
this[ticks[0] <= 0 ? ticks[1] : 'tick']();
|
|
145
|
+
}
|
|
146
|
+
}, 500);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* 用于debounce
|
|
151
|
+
* @param {number} delay 延迟
|
|
152
|
+
* @param {string} method 方法
|
|
153
|
+
*/
|
|
154
|
+
queue(delay, method) {
|
|
155
|
+
const {ticks} = this,
|
|
156
|
+
[state] = ticks;
|
|
157
|
+
if (state <= 0 || method === 'coarsePrint' || ticks[1] !== 'coarsePrint') {
|
|
158
|
+
ticks[0] = delay;
|
|
159
|
+
ticks[1] = method;
|
|
160
|
+
if (state <= 0) {
|
|
161
|
+
this.tick();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** 渲染 */
|
|
167
|
+
paint() {
|
|
168
|
+
this.preview.innerHTML = `<span class="wpb-root">${
|
|
169
|
+
this.root.map(([,, printed]) => printed).join('')
|
|
170
|
+
}</span> `;
|
|
171
|
+
this.preview.scrollTop = this.textbox.scrollTop;
|
|
172
|
+
this.preview.classList.remove('active');
|
|
173
|
+
this.textbox.style.color = 'transparent';
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** 初步解析 */
|
|
177
|
+
async coarsePrint() {
|
|
178
|
+
if (this.running) {
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
const {include, textbox: {value}} = this,
|
|
182
|
+
parsed = await print(value, include, 2, this.id);
|
|
183
|
+
if (this.include !== include || this.textbox.value !== value) {
|
|
184
|
+
this.running = undefined;
|
|
185
|
+
this.running = this.coarsePrint();
|
|
186
|
+
return this.running;
|
|
187
|
+
}
|
|
188
|
+
this.root = parsed;
|
|
189
|
+
this.paint();
|
|
190
|
+
this.running = undefined;
|
|
191
|
+
this.running = this.finePrint();
|
|
192
|
+
return this.running;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** 根据可见范围精细解析 */
|
|
196
|
+
async finePrint() {
|
|
197
|
+
if (this.running) {
|
|
198
|
+
this.viewportChanged = true;
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
this.viewportChanged = false;
|
|
202
|
+
const {
|
|
203
|
+
root,
|
|
204
|
+
preview: {scrollHeight, offsetHeight: parentHeight, scrollTop, children: [rootNode]},
|
|
205
|
+
include,
|
|
206
|
+
textbox: {value},
|
|
207
|
+
} = this;
|
|
208
|
+
let text = value,
|
|
209
|
+
start = 0,
|
|
210
|
+
{length: end} = root;
|
|
211
|
+
if (scrollHeight > parentHeight) {
|
|
212
|
+
const /** @type {HTMLElement[]} */ childNodes = [...rootNode.childNodes],
|
|
213
|
+
headings = childNodes.filter(({className}) => className === 'wpb-heading'),
|
|
214
|
+
{length} = headings;
|
|
215
|
+
if (length > 0) {
|
|
216
|
+
let i = headings.findIndex(({offsetTop, offsetHeight}) => offsetTop + offsetHeight > scrollTop);
|
|
217
|
+
i = i === -1 ? length : i;
|
|
218
|
+
let j = headings.slice(i).findIndex(({offsetTop}) => offsetTop >= scrollTop + parentHeight);
|
|
219
|
+
j = j === -1 ? length : i + j;
|
|
220
|
+
start = i ? childNodes.indexOf(headings[i - 1]) : 0;
|
|
221
|
+
while (i <= j && root[start][0] === MAX_STAGE) {
|
|
222
|
+
start = childNodes.indexOf(headings[i++]);
|
|
223
|
+
}
|
|
224
|
+
end = j === length ? end : childNodes.indexOf(headings[j]);
|
|
225
|
+
while (i <= j && root[end - 1][0] === MAX_STAGE) {
|
|
226
|
+
end = childNodes.indexOf(headings[--j]);
|
|
227
|
+
}
|
|
228
|
+
text = root.slice(start, end).map(([, str]) => str).join('');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (start === end) {
|
|
232
|
+
this.running = undefined;
|
|
233
|
+
return undefined;
|
|
234
|
+
}
|
|
235
|
+
const parsed = await print(text, include, MAX_STAGE, this.id);
|
|
236
|
+
if (this.include === include && this.textbox.value === value) {
|
|
237
|
+
this.root.splice(start, end - start, ...parsed);
|
|
238
|
+
this.paint();
|
|
239
|
+
this.running = undefined;
|
|
240
|
+
if (this.viewportChanged) {
|
|
241
|
+
this.running = this.finePrint();
|
|
242
|
+
}
|
|
243
|
+
} else {
|
|
244
|
+
this.running = undefined;
|
|
245
|
+
this.running = this.coarsePrint();
|
|
246
|
+
}
|
|
247
|
+
return this.running;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** 用于语法分析 */
|
|
252
|
+
class Linter {
|
|
253
|
+
/** @param {boolean} include 是否嵌入 */
|
|
254
|
+
constructor(include) {
|
|
255
|
+
this.id = id++;
|
|
256
|
+
this.include = Boolean(include);
|
|
257
|
+
this.wikitext = undefined;
|
|
258
|
+
/** @type {Promise<LintError[]>} */ this.running = undefined;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* 提交语法分析
|
|
263
|
+
* @param {string} wikitext 待分析的文本
|
|
264
|
+
*/
|
|
265
|
+
queue(wikitext) {
|
|
266
|
+
this.wikitext = wikitext;
|
|
267
|
+
this.running = this.lint(wikitext);
|
|
268
|
+
return this.running;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* 执行语法分析
|
|
273
|
+
* @param {string} wikitext 待分析的文本
|
|
274
|
+
*/
|
|
275
|
+
async lint(wikitext) {
|
|
276
|
+
const {include} = this,
|
|
277
|
+
errors = await lint(wikitext, include, this.id);
|
|
278
|
+
return this.include === include && this.wikitext === wikitext ? errors : this.running;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* 高亮textarea
|
|
284
|
+
* @param {HTMLTextAreaElement} textbox textarea元素
|
|
285
|
+
* @param {boolean} include 是否嵌入
|
|
286
|
+
* @throws `TypeError` 不是textarea
|
|
287
|
+
*/
|
|
288
|
+
const wikiparse = (textbox, include) => {
|
|
289
|
+
if (!(textbox instanceof HTMLTextAreaElement)) {
|
|
290
|
+
throw new TypeError('wikiparse方法仅可用于textarea元素!');
|
|
291
|
+
}
|
|
292
|
+
const preview = document.createElement('div'),
|
|
293
|
+
container = document.createElement('div'),
|
|
294
|
+
printer = new Printer(preview, textbox, include);
|
|
295
|
+
preview.id = 'wikiPretty';
|
|
296
|
+
preview.classList.add('wikiparser', 'active');
|
|
297
|
+
container.classList.add('wikiparse-container');
|
|
298
|
+
textbox.replaceWith(container);
|
|
299
|
+
textbox.classList.add('wikiparsed');
|
|
300
|
+
container.append(preview, textbox);
|
|
301
|
+
|
|
302
|
+
textbox.addEventListener('input', ({isComposing}) => {
|
|
303
|
+
if (!isComposing) {
|
|
304
|
+
printer.queue(2000, 'coarsePrint');
|
|
305
|
+
}
|
|
306
|
+
textbox.style.color = '';
|
|
307
|
+
preview.classList.add('active');
|
|
308
|
+
});
|
|
309
|
+
textbox.addEventListener('scroll', () => {
|
|
310
|
+
if (preview.scrollHeight > preview.offsetHeight && !preview.classList.contains('active')) {
|
|
311
|
+
preview.scrollTop = textbox.scrollTop;
|
|
312
|
+
printer.queue(500, 'finePrint');
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
textbox.addEventListener('keydown', e => {
|
|
316
|
+
if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
|
|
317
|
+
e.preventDefault();
|
|
318
|
+
printer.ticks[0] = 0;
|
|
319
|
+
printer.running = printer.coarsePrint();
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
printer.running = printer.coarsePrint();
|
|
323
|
+
return printer;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
Object.assign(wikiparse, {print, lint, setI18N, setConfig, getConfig, Printer, Linter});
|
|
327
|
+
window.wikiparse = wikiparse;
|
|
328
|
+
})();
|