wikiparser-node 0.5.0 → 0.6.2-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 +34 -0
- package/package.json +10 -13
- package/README.md +0 -39
- package/config/default.json +0 -769
- package/config/llwiki.json +0 -630
- package/config/moegirl.json +0 -727
- package/config/zhwiki.json +0 -1269
- package/index.js +0 -268
- package/lib/element.js +0 -639
- package/lib/node.js +0 -743
- package/lib/ranges.js +0 -130
- package/lib/text.js +0 -175
- package/lib/title.js +0 -69
- package/mixin/attributeParent.js +0 -113
- package/mixin/fixedToken.js +0 -40
- package/mixin/hidden.js +0 -19
- package/mixin/sol.js +0 -69
- package/parser/brackets.js +0 -112
- package/parser/commentAndExt.js +0 -63
- package/parser/converter.js +0 -45
- package/parser/externalLinks.js +0 -31
- package/parser/hrAndDoubleUnderscore.js +0 -36
- package/parser/html.js +0 -42
- package/parser/links.js +0 -97
- package/parser/list.js +0 -59
- package/parser/magicLinks.js +0 -41
- package/parser/quotes.js +0 -64
- package/parser/selector.js +0 -175
- package/parser/table.js +0 -112
- package/src/arg.js +0 -193
- package/src/atom/hidden.js +0 -13
- package/src/atom/index.js +0 -41
- package/src/attribute.js +0 -449
- package/src/converter.js +0 -165
- package/src/converterFlags.js +0 -269
- package/src/converterRule.js +0 -259
- package/src/extLink.js +0 -173
- package/src/gallery.js +0 -122
- package/src/heading.js +0 -119
- package/src/html.js +0 -230
- package/src/imageParameter.js +0 -260
- package/src/index.js +0 -744
- package/src/link/category.js +0 -53
- package/src/link/file.js +0 -285
- package/src/link/galleryImage.js +0 -61
- package/src/link/index.js +0 -325
- package/src/magicLink.js +0 -136
- 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 -44
- package/src/nowiki/list.js +0 -16
- package/src/nowiki/noinclude.js +0 -28
- package/src/nowiki/quote.js +0 -63
- package/src/onlyinclude.js +0 -59
- package/src/parameter.js +0 -200
- package/src/syntax.js +0 -83
- package/src/table/index.js +0 -980
- package/src/table/td.js +0 -314
- package/src/table/tr.js +0 -299
- package/src/tagPair/ext.js +0 -104
- package/src/tagPair/include.js +0 -60
- package/src/tagPair/index.js +0 -125
- package/src/transclude.js +0 -736
- package/tool/index.js +0 -918
- package/util/debug.js +0 -73
- package/util/diff.js +0 -76
- package/util/lint.js +0 -40
- package/util/string.js +0 -105
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
(()=>{var Tt=Object.defineProperty;var $t=(R,L,j)=>L in R?Tt(R,L,{enumerable:!0,configurable:!0,writable:!0,value:j}):R[L]=j;var S=(R,L,j)=>($t(R,typeof L!="symbol"?L+"":L,j),j),tt=(R,L,j)=>{if(!L.has(R))throw TypeError("Cannot "+j)};var T=(R,L,j)=>(tt(R,L,"read from private field"),j?j.call(R):L.get(R)),w=(R,L,j)=>{if(L.has(R))throw TypeError("Cannot add the same private member more than once");L instanceof WeakSet?L.add(R):L.set(R,j)},H=(R,L,j,K)=>(tt(R,L,"write to private field"),K?K.call(R,j):L.set(R,j),j),et=(R,L,j,K)=>({set _(m){H(R,L,m,j)},get _(){return T(R,L,K)}}),D=(R,L,j)=>(tt(R,L,"access private method"),j);(()=>{var R={6010:(m,C,e)=>{"use strict";const g={config:void 0,minConfig:e(8166),MAX_STAGE:11,getConfig(){return{...this.minConfig,...this.config}},normalizeTitle(a,u=0,d=!1,p=g.getConfig(),h=!1){let t;if(!h){const i=e(8138);t=this.run(()=>{const o=new i(String(a),p),r=o.getAttribute("parseOnce");return r(0,d),r()}),a=t.firstChild}const s=e(6986);return new s(String(a),u,p)},parse(a,u,d=g.MAX_STAGE,p=g.getConfig()){const h=e(8138);let t;return this.run(()=>{typeof a=="string"?t=new h(a,p):a instanceof h&&(t=a,a=String(t)),t.parse(d,u)}),t},run(a){return a()},print(a,u=!1,d=g.getConfig()){return`<div class="wikiparser">${this.parse(a,u,this.MAX_STAGE,d).print()} </div>`}},f={};for(const a in g)["MAX_STAGE","minConfig"].includes(a)?f[a]={enumerable:!1,writable:!1}:["config","normalizeTitle","parse","print"].includes(a)||(f[a]={enumerable:!1});Object.defineProperties(g,f),typeof window!="undefined"&&(window.Parser=g),m.exports=g},9205:(m,C,e)=>{"use strict";const{print:g}=e(231),f=e(3853),a=e(7507),d=class extends f{constructor(){super(...arguments);S(this,"name")}get length(){return this.childNodes.length}get children(){return this.childNodes.filter(({type:s})=>s!=="text")}get firstElementChild(){return this.childNodes.find(({type:t})=>t!=="text")}get lastElementChild(){return this.children.at(-1)}append(...t){for(const s of t)this.insertAt(s)}replaceChildren(...t){for(let s=this.childNodes.length-1;s>=0;s--)this.removeAt(s);this.append(...t)}setText(t,s=0){const n=this.childNodes.at(s),{type:i,data:o}=n;if(i==="text")return n.replaceData(t),o}toString(t,s=""){return this.childNodes.map(n=>n.toString()).join(s)}lint(t=0){const s=e(8058);if(this instanceof s||this.constructor.hidden||this.type==="ext-inner"&&d.lintIgnoredExt.has(this.name))return[];const n=[];for(let i=0,o=t+this.getPadding();i<this.childNodes.length;i++){const r=this.childNodes[i];n.push(...r.lint(o)),o+=String(r).length+this.getGaps(i)}return n}print(t={}){var s;return String(this)?`<span class="wpb-${(s=t.class)!=null?s:this.type}">${g(this.childNodes,t)}</span>`:""}};let u=d;S(u,"lintIgnoredExt",new Set(["nowiki","pre","charinsert","score","syntaxhighlight","source","math","chem","ce","graph","mapframe","maplink","quiz","templatedata","timeline"])),m.exports=u},3853:(m,C,e)=>{var f,a,Y,d,st;"use strict";class g{constructor(){w(this,a);w(this,d);S(this,"type");S(this,"childNodes",[]);w(this,f,void 0)}get firstChild(){return this.childNodes[0]}get lastChild(){return this.childNodes.at(-1)}get parentNode(){return T(this,f)}get nextSibling(){var s;const t=(s=T(this,f))==null?void 0:s.childNodes;return t&&t[t.indexOf(this)+1]}get previousSibling(){var s;const t=(s=T(this,f))==null?void 0:s.childNodes;return t&&t[t.indexOf(this)-1]}hasAttribute(t){return t in this}getAttribute(t){return this.hasAttribute(t)?String(this[t]):void 0}setAttribute(t,s){return t==="parentNode"?H(this,f,s):this[t]=s,this}removeAt(t){const s=[...this.childNodes],[n]=s.splice(t,1);return n.setAttribute("parentNode"),this.setAttribute("childNodes",s),n}insertAt(t,s=this.childNodes.length){const n=[...this.childNodes];return-1===-1&&t.setAttribute("parentNode",this),n.splice(s,0,t),this.setAttribute("childNodes",n),t}normalize(){var n;const t=e(7507),s=[...this.childNodes];for(let i=s.length-1;i>=0;i--){const{type:o,data:r}=s[i];this.getGaps(i-1)||(r===""?s.splice(i,1):o==="text"&&((n=s[i-1])==null?void 0:n.type)==="text"&&(s[i-1].setAttribute("data",s[i-1].data+r),s.splice(i,1)))}this.setAttribute("childNodes",s)}getRootNode(){let{parentNode:t}=this;for(;t!=null&&t.parentNode;)({parentNode:t}=t);return t!=null?t:this}posFromIndex(t){const s=String(this);if(t>=-s.length&&t<=s.length){const n=s.slice(0,t).split(`
|
|
2
|
+
`);return{top:n.length-1,left:n.at(-1).length}}}getPadding(){return 0}getGaps(){return 0}getRelativeIndex(t){let s;const n=(i,o)=>s.slice(0,i).reduce((r,l,c)=>r+String(l).length+o.getGaps(c),0)+o.getPadding();if(t===void 0){const{parentNode:i}=this;return i?({childNodes:s}=i,n(s.indexOf(this),i)):0}return{childNodes:s}=this,n(t,this)}getAbsoluteIndex(){const{parentNode:t}=this;return t?t.getAbsoluteIndex()+this.getRelativeIndex():0}getBoundingClientRect(){return{...D(this,a,Y).call(this),...this.getRootNode().posFromIndex(this.getAbsoluteIndex())}}get offsetHeight(){return D(this,a,Y).call(this).height}get offsetWidth(){return D(this,a,Y).call(this).width}get style(){return{...D(this,d,st).call(this),...D(this,a,Y).call(this),padding:this.getPadding()}}}f=new WeakMap,a=new WeakSet,Y=function(){const t=String(this).split(`
|
|
3
|
+
`);return{height:t.length,width:t.at(-1).length}},d=new WeakSet,st=function(t){var s,n;return t===void 0?(n=(s=this.parentNode)==null?void 0:s.posFromIndex(this.getRelativeIndex()))!=null?n:{top:0,left:0}:this.posFromIndex(this.getRelativeIndex(t))},m.exports=g},7507:(m,C,e)=>{var a,nt;"use strict";const g=e(3853),d=class extends g{constructor(t=""){super();w(this,a);S(this,"type","text");S(this,"data");this.data=t}toString(){return this.data}replaceData(t=""){D(this,a,nt).call(this,t)}lint(t=0){const{data:s}=this,n=[...s.matchAll(d.errorSyntax)];if(n.length>0){const{top:i,left:o}=this.getRootNode().posFromIndex(t);return n.map(({0:r,1:l,index:c})=>{l&&(c+=l.length,r=r.slice(l.length));const x=s.slice(0,c).split(`
|
|
4
|
+
`),A=x.length+i-1,{length:$}=x.at(-1),k=x.length>1?$:o+$;return{message:`\u5B64\u7ACB\u7684"${r[0]}"`,severity:r[0]==="{"||r[0]==="}"?"error":"warning",startLine:A,endLine:A,startCol:k,endCol:k+r.length}})}return[]}};let f=d;a=new WeakSet,nt=function(t){return t=String(t),this.setAttribute("data",t),this},S(f,"errorSyntax",/[{}]+|\[{2,}|\[(?!(?:(?!https?\b)[^[])*\])|((?:^|\])[^[]*?)\]+|<(?=\s*\/?\w+[\s/>])/giu),m.exports=f},6986:(m,C,e)=>{"use strict";const g=e(6010);class f{constructor(u,d=0,p=g.getConfig()){S(this,"valid",!0);S(this,"ns",0);const{namespaces:h,nsid:t}=p;let s=h[d];u=u.replaceAll("_"," ").trim(),u[0]===":"&&(s="",u=u.slice(1).trim());const n=u.split(":");if(n.length>1){const r=h[t[n[0].trim().toLowerCase()]];r!==void 0&&(s=r,u=n.slice(1).join(":").trim())}this.ns=t[s.toLowerCase()];const i=u.indexOf("#");let o="";i!==-1&&(o=u.slice(i+1).trimEnd(),u=u.slice(0,i).trim()),this.valid=Boolean(u||o)&&!/\0\d+[eh!+-]\x7F|[<>[\]{}|]/u.test(u)}}m.exports=f},2308:m=>{"use strict";const C=e=>{var g;return g=class extends e{},S(g,"hidden",!0),g};m.exports=C},8275:(m,C,e)=>{"use strict";const{removeComment:g}=e(231),f=e(6010),a=(u,d=f.getConfig(),p=[])=>{var c,x,A,$,k;const h="^(\0\\d+c\x7F)*={1,6}|\\[\\[|\\{{2,}|-\\{(?!\\{)",t=[],s={"=":`
|
|
5
|
+
`,"{":"\\}{2,}|\\|","-":"\\}-","[":"\\]\\]"},n={"!":"!","!!":"+","(!":"{","!)":"}","!-":"-","=":"~"};let i=new RegExp(h,"gmu"),o=i.exec(u),r=u.includes("}}"),l;for(;o||l<=u.length&&((x=(c=t.at(-1))==null?void 0:c[0])==null?void 0:x[0])==="=";){if(o!=null&&o[1]){const[,{length:G}]=o;o[0]=o[0].slice(G),o.index+=G}const{0:N,index:v}=o!=null?o:{0:`
|
|
6
|
+
`,index:u.length},b=(A=t.pop())!=null?A:{},{0:I,index:F,parts:z,findEqual:O,pos:U}=b,M=N==="="&&O;if(N==="]]"||N==="}-")l=v+2;else if(N===`
|
|
7
|
+
`){l=v+1;const{pos:G,findEqual:W}=($=t.at(-1))!=null?$:{};if(!G||W||g(u.slice(G,F))!==""){const B=/^(={1,6})(.+)\1((?:\s|\0\d+c\x7F)*)$/u.exec(u.slice(F,v));if(B){u=`${u.slice(0,F)}\0${p.length}h\x7F${u.slice(v)}`,l=F+4+String(p.length).length;const q=e(9450);new q(B[1].length,B.slice(2),d,p)}}}else if(N==="|"||M)l=v+1,z.at(-1).push(u.slice(U,v)),N==="|"&&z.push([]),b.pos=l,b.findEqual=N==="|",t.push(b);else if(N.startsWith("}}")){const G=N.slice(0,Math.min(I.length,3)),W=I.length-G.length,{length:B}=p;l=v+G.length,z.at(-1).push(u.slice(U,v));let q=!1,Q="t";if(G.length===3){const J=e(9544);new J(z.map(V=>V.join("=")),d,p)}else{const J=g(z[0][0]);J in n?Q=n[J]:/^(?:fullurl|canonicalurl|filepath):./iu.test(J)&&(Q="m");try{const V=e(1782);new V(z[0][0],z.slice(1),d,p)}catch(V){if(V instanceof Error&&V.message.startsWith("\u975E\u6CD5\u7684\u6A21\u677F\u540D\u79F0\uFF1A"))l=F+I.length,q=!0;else throw V}}q||(u=`${u.slice(0,F+W)}\0${B}${Q}\x7F${u.slice(l)}`,l=F+W+3+String(B).length,W>1?t.push({0:I.slice(0,W),index:F,pos:F+W,parts:[[]]}):W===1&&u[F-1]==="-"&&t.push({0:"-{",index:F-1,pos:F+1,parts:[[]]}))}else l=v+N.length,N[0]==="{"&&(o.pos=l,o.parts=[[]]),t.push(..."0"in b?[b]:[],o);r&&(r=u.slice(l).includes("}}"));let X=t.at(-1);!r&&((k=X==null?void 0:X[0])==null?void 0:k[0])==="{"&&(t.pop(),X=t.at(-1)),i=new RegExp(h+(X?`|${s[X[0][0]]}${X.findEqual?"|=":""}`:""),"gmu"),i.lastIndex=l,o=i.exec(u)}return u};m.exports=a},4907:(m,C,e)=>{"use strict";const g=e(6010),f=(a,u=g.getConfig(),d=[],p=!1)=>{const h=/<onlyinclude>(.*?)<\/onlyinclude>/gsu;if(p&&a.search(h)!==-1)return a.replaceAll(h,(o,r)=>{const l=`\0${d.length}e\x7F`,c=e(851);return new c(r,u,d),l}).replaceAll(/(^|\0\d+e\x7F)(.*?)(?=$|\0\d+e\x7F)/gsu,(o,r,l)=>{if(l==="")return r;const c=e(3423);return new c(l,u,d),`${r}\0${d.length-1}c\x7F`});const t=u.ext.join("|"),s=p?"includeonly":"(?:no|only)include",n=p?"noinclude":"includeonly",i=new RegExp(`<!--.*?(?:-->|$)|<${s}(?:\\s[^>]*?)?>|</${s}\\s*>|<(${t})(\\s[^>]*?)?(?:/>|>(.*?)</(\\1\\s*)>)|<(${n})(\\s[^>]*?)?(?:/>|>(.*?)(?:</(\\5\\s*)>|$))`,"gisu");return a.replaceAll(i,(o,r,l,c,x,A,$,k,N)=>{const v=`\0${d.length}${r?"e":"c"}\x7F`;if(r){const b=e(7267);new b(r,l,c,x,u,d)}else if(o.startsWith("<!--")){const b=e(5749),I=o.endsWith("-->");new b(o.slice(4,I?-3:void 0),I,u,d)}else if(A){const b=e(8655);new b(A,$,k,N,u,d)}else{const b=e(3423);new b(o,u,d)}return v})};m.exports=f},3765:(m,C,e)=>{"use strict";const g=e(6010),f=(a,u=g.getConfig(),d=[])=>{const p=e(9910),h=/-\{/gu,t=/-\{|\}-/gu,s=[];let n=h,i=n.exec(a);for(;i;){const{0:o,index:r}=i;if(o==="}-"){const l=s.pop(),{length:c}=d,x=a.slice(l.index+2,r),A=x.indexOf("|"),[$,k]=A===-1?[[],x]:[x.slice(0,A).split(";"),x.slice(A+1)],N=k.replaceAll(/(&[#a-z\d]+);/giu,"$1"),v=`(?:${u.variants.join("|")})`,b=N.split(new RegExp(`;(?=\\s*(?:${v}|[^;]*?=>\\s*${v})\\s*:)`,"u")).map(I=>I.replaceAll("",";"));new p($,b,u,d),a=`${a.slice(0,l.index)}\0${c}v\x7F${a.slice(r+2)}`,s.length===0&&(n=h),n.lastIndex=l.index+3+String(c).length}else s.push(i),n=t;i=n.exec(a)}return a};m.exports=f},7513:(m,C,e)=>{"use strict";const{extUrlChar:g}=e(231),f=e(6010),a=(u,d=f.getConfig(),p=[])=>{const h=e(741),t=new RegExp(`\\[((?:${d.protocol}|//)${g}|\0\\d+m\x7F)(\\p{Zs}*)([^\\]-\b
|
|
8
|
+
-\uFFFD]*)\\]`,"giu");return u.replaceAll(t,(s,n,i,o)=>{const{length:r}=p,l=/&[lg]t;/u.exec(n);return l&&(n=n.slice(0,l.index),i="",o=`${n.slice(l.index)}${i}${o}`),new h(n,i,o,d,p),`\0${r}w\x7F`})};m.exports=a},2937:(m,C,e)=>{"use strict";const g=e(6010),f=({firstChild:{data:a},type:u,name:d},p=g.getConfig(),h=[])=>{const t=e(7507),s=e(8138),n=e(2582),i=e(7815),{doubleUnderscore:o}=p;return u!=="root"&&(u!=="ext-inner"||d!=="poem")&&(a=`\0${a}`),a=a.replaceAll(/^((?:\0\d+c\x7F)*)(-{4,})/gmu,(r,l,c)=>(new n(c.length,p,h),`${l}\0${h.length-1}r\x7F`)).replaceAll(new RegExp(`__(${o.flat().join("|")})__`,"giu"),(r,l)=>o[0].includes(l.toLowerCase())||o[1].includes(l)?(new i(l,p,h),`\0${h.length-1}u\x7F`):r),u==="root"||u==="ext-inner"&&d==="poem"?a:a.slice(1)};m.exports=f},5130:(m,C,e)=>{"use strict";const g=e(6010),f=(a,u=g.getConfig(),d=[])=>{const p=/^(\/?)([a-z][^\s/>]*)(\s[^>]*?)?(\/?>)([^<]*)$/iu,h=u.html.flat(),t=a.split("<");let s=t.shift();for(const n of t){const i=p.exec(n),o=i==null?void 0:i[2],r=o==null?void 0:o.toLowerCase();if(!i||!h.includes(r)){s+=`<${n}`;continue}const l=e(5037),[,c,,x="",A,$]=i,k=new l(x,"html-attr",r,u,d),N=k.getAttr("itemprop");if(r==="meta"&&(N===void 0||k.getAttr("content")===void 0)||r==="link"&&(N===void 0||k.getAttr("href")===void 0)){s+=`<${n}`,d.pop();continue}s+=`\0${d.length}x\x7F${$}`;const v=e(2350);new v(o,k,c==="/",A==="/>",u,d)}return s};m.exports=f},1452:(m,C,e)=>{"use strict";const g=e(6010),f=(a,u=g.getConfig(),d=[])=>{const p=e(3360),h=/^((?:(?!\0\d+!\x7F)[^\n<>[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]]))?\]\](.*)$/su,t=/^((?:(?!\0\d+!\x7F)[^\n<>[\]{}|])+)(\||\0\d+!\x7F)(.*)$/su,s=new RegExp(`^\\s*(?:${u.protocol})`,"iu"),n=a.split("[[");let i=n.shift();for(let o=0;o<n.length;o++){let r,l,c,x,A;const $=n[o],k=h.exec($);if(k)[,l,c,x,A]=k,A[0]==="]"&&(x==null?void 0:x.includes("["))&&(x+="]",A=A.slice(1));else{const O=t.exec($);O&&(r=!0,[,l,c,x]=O)}if(l===void 0||s.test(l)||/\0\d+[exhbru]\x7F/u.test(l)){i+=`[[${$}`;continue}let N=l;if(l.includes("%"))try{N=decodeURIComponent(l)}catch(O){}const v=l.trim()[0]===":";if(v&&r){i+=`[[${$}`;continue}const b=g.normalizeTitle(N,0,!1,u,!0),{ns:I,valid:F}=b;if(F){if(r){if(I!==6){i+=`[[${$}`;continue}let O;for(o++;o<n.length;o++){const U=n[o],M=U.split("]]");if(M.length>2){O=!0,x+=`[[${M[0]}]]${M[1]}`,A=M.slice(2).join("]]");break}else if(M.length===2)x+=`[[${M[0]}]]${M[1]}`;else{x+=`[[${U}`;break}}if(x=f(x,u,d),!O){i+=`[[${l}${c}${x}`;continue}}}else{i+=`[[${$}`;continue}x&&(x=p(x,u,d)),i+=`\0${d.length}l\x7F${A}`;let z=e(3905);v||(I===6?z=e(7625):I===14&&(z=e(337))),new z(l,x,b,u,d,c)}return i};m.exports=f},6622:(m,C,e)=>{"use strict";const g=e(6010),f=(a,u=g.getConfig(),d=[])=>{const p=/^((?:\0\d+c\x7F)*)([;:*#]+)/u.exec(a);if(!p)return a;const h=e(962),[t,s,n]=p;a=`${s}\0${d.length}d\x7F${a.slice(t.length)}`,new h(n,u,d);let i=n.split(";").length-1;if(!i)return a;const o=e(3434);let r=/:+|-\{/gu,l=r.exec(a),c=0;for(;l&&i;){const{0:x,index:A}=l;if(x[0]===":"){if(x.length>=i)return new o(":".repeat(i),u,d),`${a.slice(0,A)}\0${d.length-1}d\x7F${a.slice(A+i)}`;a=`${a.slice(0,A)}\0${d.length}d\x7F${a.slice(r.lastIndex)}`,i-=x.length,r.lastIndex=A+4+String(d.length).length,new o(x,u,d)}else if(x==="-{"){if(!c){const{lastIndex:$}=r;r=/-\{|\}-/gu,r.lastIndex=$}c++}else if(c--,!c){const{lastIndex:$}=r;r=/:+|-\{/gu,r.lastIndex=$}l=r.exec(a)}return a};m.exports=f},4737:(m,C,e)=>{"use strict";const{extUrlChar:g}=e(231),f=e(6010),a=(u,d=f.getConfig(),p=[])=>{const h=e(8962),t=new RegExp(`\\b(?:${d.protocol})(${g})`,"giu");return u.replaceAll(t,(s,n)=>{let i="",o=s;const r=/&(?:lt|gt|nbsp|#x0*(?:3[ce]|a0)|#0*(?:6[02]|160));/iu.exec(o);r&&(i=o.slice(r.index),o=o.slice(0,r.index));const l=new RegExp(`[,;.:!?${o.includes("(")?"":")"}]+$`,"u"),c=l.exec(o);if(c){let x=0;c[0][0]===";"&&/&(?:[a-z]+|#x[\da-f]+|#\d+)$/iu.test(o.slice(0,c.index))&&(x=1),i=`${o.slice(c.index+x)}${i}`,o=o.slice(0,c.index+x)}return i.length>=n.length?s:(new h(o,!1,d,p),`\0${p.length-1}w\x7F${i}`)})};m.exports=a},3360:(m,C,e)=>{"use strict";const g=e(6010),f=(a,u=g.getConfig(),d=[])=>{var l;const p=a.split(/('{2,})/u),{length:h}=p;if(h===1)return a;let t=0,s=0,n,i,o;for(let c=1;c<h;c+=2){const{length:x}=p[c];switch(x){case 2:s++;break;case 4:p[c-1]+="'",p[c]="'''";case 3:if(t++,n)break;p[c-1].at(-1)===" "?!i&&!o&&(o=c):p[c-1].at(-2)===" "?n=c:i||(i=c);break;default:p[c-1]+="'".repeat(x-5),p[c]="'''''",s++,t++}}if(s%2===1&&t%2===1){const c=(l=n!=null?n:i)!=null?l:o;p[c]="''",p[c-1]+="'"}const r=e(6714);for(let c=1;c<h;c+=2)new r(p[c].length,u,d),p[c]=`\0${d.length-1}q\x7F`;return p.join("")};m.exports=f},4624:(m,C,e)=>{"use strict";const g=e(6010),f=e(7507),a=e(8138),u=e(2840),d=e(3125),p=e(5567),h=({firstChild:{data:t},type:s,name:n},i=g.getConfig(),o=[])=>{const r=[],l=t.split(`
|
|
9
|
+
`);let c=s==="root"||s==="parameter-value"||s==="ext-inner"&&n==="poem"?"":`
|
|
10
|
+
${l.shift()}`;const x=(A,$)=>{if(!$){c+=A;return}const{lastChild:k}=$;if(k.constructor===a)k.setText(String(k)+A);else{const N=new a(A,i,!0,o);N.type="table-inter",$.insertAt(N.setAttribute("stage",3))}};for(const A of l){let $=r.pop();const[k]=/^(?:\s|\0\d+c\x7F)*/u.exec(A),N=A.slice(k.length),v=/^(:*)((?:\s|\0\d+c\x7F)*)(\{\||\{\0\d+!\x7F|\0\d+\{\x7F)(.*)$/u.exec(N);if(v){for(;$&&$.type!=="td";)$=r.pop();const[,U,M,X,G]=v;if(U){const B=e(3434);new B(U,i,o)}x(`
|
|
11
|
+
${k}${U&&`\0${o.length-1}d\x7F`}${M}\0${o.length}b\x7F`,$);const W=new u(X,G,i,o);r.push(...$?[$]:[],W);continue}else if(!$){c+=`
|
|
12
|
+
${A}`;continue}const b=/^(?:(\|\}|\0\d+!\x7F\}|\0\d+\}\x7F)|(\|-+|\0\d+!\x7F-+|\0\d+-\x7F-*)(?!-)|(!|(?:\||\0\d+!\x7F)\+?))(.*)$/u.exec(N);if(!b){x(`
|
|
13
|
+
${A}`,$),r.push(...$?[$]:[]);continue}const[,I,F,z,O]=b;if(I){for(;!($ instanceof u);)$=r.pop();$.close(`
|
|
14
|
+
${k}${I}`,!0),x(O,r.at(-1))}else if(F){$.type==="td"&&($=r.pop()),$.type==="tr"&&($=r.pop());const U=new d(`
|
|
15
|
+
${k}${F}`,O,i,o);r.push($,U),$.insertAt(U)}else{$.type==="td"&&($=r.pop());const U=z==="!"?/!!|(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu:/(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu;let M=U.exec(O),X=0,G=`
|
|
16
|
+
${k}${z}`;for(;M;){const B=new p(G,O.slice(X,M.index),i,o);$.insertAt(B),{lastIndex:X}=U,[G]=M,M=U.exec(O)}const W=new p(G,O.slice(X),i,o);r.push($,W),$.insertAt(W)}}return c.slice(1)};m.exports=h},9544:(m,C,e)=>{"use strict";const{generateForChild:g}=e(8277),f=e(6010),a=e(8138);class u extends a{constructor(h,t=f.getConfig(),s=[]){super(void 0,t,!0,s,{AtomToken:0,Token:1,HiddenToken:"2:"});S(this,"type","arg");for(let n=0;n<h.length;n++)if(n===0||n>1){const i=e(n===0?9237:9263),o=new i(h[n],n===0?"arg-name":void 0,t,s,{"Stage-2":":","!HeadingToken":""});super.insertAt(o)}else{const i=new a(h[n],t,!0,s);i.type="arg-default",super.insertAt(i.setAttribute("stage",2))}}toString(h){return`{{{${super.toString(h,"|")}}}}`}getPadding(){return 3}getGaps(){return 1}print(){return super.print({pre:"{{{",post:"}}}",sep:"|"})}lint(h=0){const{childNodes:[t,s,...n]}=this,i=t.lint(h+3);if(s&&i.push(...s.lint(h+4+String(t).length)),n.length>0){const o=this.getRootNode().posFromIndex(h);i.push(...n.map(r=>g(r,o,"\u4E09\u91CD\u62EC\u53F7\u5185\u7684\u4E0D\u53EF\u89C1\u90E8\u5206")))}return i}}m.exports=u},9263:(m,C,e)=>{"use strict";const g=e(2308),f=e(9237);class a extends g(f){constructor(){super(...arguments);S(this,"type","hidden")}}m.exports=a},9237:(m,C,e)=>{"use strict";const g=e(6010),f=e(8138);class a extends f{constructor(p,h,t=g.getConfig(),s=[],n=null){super(p,t,!0,s,n);S(this,"type","plain");h&&(this.type=h)}}m.exports=a},5037:(m,C,e)=>{var p,h,t,s,rt;"use strict";const{generateForSelf:g}=e(8277),{removeComment:f}=e(231),a=e(6010),u=e(8138);class d extends u{constructor(r,l,c,x=a.getConfig(),A=[]){super(r,x,!0,A);w(this,s);w(this,p,new Map);w(this,h,!0);w(this,t,!0);this.type=l,D(this,s,rt).call(this)}getAttr(r){return T(this,p).get(r.toLowerCase().trim())}setAttr(r,l,c){r=r.toLowerCase().trim();const x=r;if(/^(?:[\w:]|\0\d+[t!~{}+-]\x7F)(?:[\w:.-]|\0\d+[t!~{}+-]\x7F)*$/u.test(x))l===!1?T(this,p).delete(r):T(this,p).set(r,l===!0?!0:l.replaceAll(/\s/gu," ").trim());else return c,!1;return!0}lint(r=0){const l=e(2350),c=super.lint(r);let x;return this.type==="html-attr"&&this.parentNode.closing&&String(this).trim()&&(x=this.getRootNode().posFromIndex(r),c.push(g(this,x,"\u4F4D\u4E8E\u95ED\u5408\u6807\u7B7E\u7684\u5C5E\u6027"))),T(this,h)?T(this,t)||(x||(x=this.getRootNode().posFromIndex(r)),c.push(g(this,x,"\u672A\u95ED\u5408\u7684\u5F15\u53F7","warning"))):(x||(x=this.getRootNode().posFromIndex(r)),c.push(g(this,x,"\u5305\u542B\u65E0\u6548\u5C5E\u6027"))),c}}p=new WeakMap,h=new WeakMap,t=new WeakMap,s=new WeakSet,rt=function(){var l;let r=this.toString();r=f(r).replaceAll(/\0\d+~\x7F/gu,"=");for(const[,c,x,A,$,k]of r.matchAll(/([^\s/][^\s/=]*)(?:\s*=\s*(?:(["'])(.*?)(\2|$)|(\S*)))?/gsu))this.setAttr(c,(l=A!=null?A:k)!=null?l:!0,!0)?x!==$&&H(this,t,!1):H(this,h,!1)},m.exports=d},8103:(m,C,e)=>{"use strict";const g=e(6010),f=e(8138),a=e(2158);class u extends f{constructor(h,t=g.getConfig(),s=[]){super(void 0,t,!0,s,{HasNowikiToken:":"});S(this,"type","ext-inner");S(this,"name","charinsert");this.append(...h.split(`
|
|
17
|
+
`).map(n=>new a(n,"charinsert-line",t,s)))}toString(h){return super.toString(h,`
|
|
18
|
+
`)}getGaps(){return 1}print(){return super.print({sep:`
|
|
19
|
+
`})}}m.exports=u},9910:(m,C,e)=>{"use strict";const{print:g}=e(231),f=e(6010),a=e(8138),u=e(6719),d=e(8683);class p extends a{constructor(s,n,i=f.getConfig(),o=[]){super(void 0,i,!0,o);S(this,"type","converter");this.append(new u(s,i,o));const[r]=n,l=r.includes(":"),c=new d(r,l,i,o);l&&c.childNodes.length===1?this.insertAt(new d(n.join(";"),!1,i,o)):this.append(c,...n.slice(1).map(x=>new d(x,!0,i,o)))}toString(s){const{childNodes:[n,...i]}=this;return`-{${n.toString()}${n.childNodes.length>0?"|":""}${i.map(String).join(";")}}-`}getPadding(){return 2}getGaps(s=0){return s=s<0?s+this.childNodes.length:s,s||this.firstChild.childNodes.length>0?1:0}print(){const{children:[s,...n]}=this;return`<span class="wpb-converter">-{${s.print()}${s.childNodes.length>0?"|":""}${g(n,{sep:";"})}}-</span>`}}m.exports=p},6719:(m,C,e)=>{var p;"use strict";const{generateForChild:g}=e(8277),f=e(6010),a=e(8138),u=e(9237);class d extends a{constructor(s,n=f.getConfig(),i=[]){super(void 0,n,!0,i,{AtomToken:":"});S(this,"type","converter-flags");w(this,p,void 0);this.append(...s.map(o=>new u(o,"converter-flag",n,i)))}afterBuild(){return H(this,p,this.childNodes.map(s=>String(s).trim())),this}toString(s){return super.toString(s,";")}getGaps(){return 1}print(){return super.print({sep:";"})}lint(s=0){const n=this.getVariantFlags(),i=this.getUnknownFlags(),o=T(this,p).filter(A=>!A),r=T(this,p).filter(A=>["A","T","R","D","-","H","N"].includes(A)),l=T(this,p).length-i.length-o,c=super.lint(s);if(n.length===l||r.length===l)return c;const x=this.getRootNode().posFromIndex(s);for(const A of this.childNodes){const $=String(A).trim();$&&!n.includes($)&&!i.includes($)&&(n.length>0||!r.includes($))&&c.push(g(A,x,"\u65E0\u6548\u7684\u8F6C\u6362\u6807\u8BB0"))}return c}getUnknownFlags(){return T(this,p).filter(s=>/\{\{[^{}]+\}\}/u.test(s))}getVariantFlags(){const{variants:s}=this.getAttribute("config");return T(this,p).filter(n=>s.includes(n))}}p=new WeakMap,m.exports=d},8683:(m,C,e)=>{"use strict";const g=e(6010),f=e(8138),a=e(9237);class u extends f{constructor(h,t=!0,s=g.getConfig(),n=[]){super(void 0,s,!0,n);S(this,"type","converter-rule");if(t){const i=h.indexOf(":"),o=h.slice(0,i).indexOf("=>"),r=o===-1?h.slice(0,i):h.slice(o+2,i),{variants:l}=s;l.includes(r.trim())?(super.insertAt(new a(r,"converter-rule-variant",s,n)),super.insertAt(new a(h.slice(i+1),"converter-rule-to",s,n)),o!==-1&&super.insertAt(new a(h.slice(0,o),"converter-rule-from",s,n),0)):super.insertAt(new a(h,"converter-rule-noconvert",s,n))}else super.insertAt(new a(h,"converter-rule-noconvert",s,n))}toString(h){if(this.childNodes.length===3){const{childNodes:[t,s,n]}=this;return`${t.toString(h)}=>${s.toString(h)}:${n.toString(h)}`}return super.toString(h,":")}getGaps(h=0){const{length:t}=this;return h=h<0?h+t:h,h===0&&t===3?2:1}print(){if(this.childNodes.length===3){const{childNodes:[h,t,s]}=this;return`<span class="wpb-converter-rule">${h.print()}=>${t.print()}:${s.print()}</span>`}return super.print({sep:":"})}}m.exports=u},741:(m,C,e)=>{var d;"use strict";const g=e(6010),f=e(8138),a=e(8962);class u extends f{constructor(t,s,n,i=g.getConfig(),o=[]){super(void 0,i,!0,o,{MagicLinkToken:0,Token:1});S(this,"type","ext-link");w(this,d,void 0);if(this.insertAt(new a(t,!0,i,o)),H(this,d,s),n){const r=new f(n,i,!0,o,{"Stage-7":":",ConverterToken:":"});r.type="ext-link-text",this.insertAt(r.setAttribute("stage",g.MAX_STAGE-1))}}toString(t){return this.childNodes.length===1?`[${super.toString(t)}${T(this,d)}]`:`[${super.toString(t,T(this,d))}]`}getPadding(){return 1}getGaps(){return T(this,d).length}print(){const{length:t}=this;return super.print(t>1?{pre:"[",sep:T(this,d),post:"]"}:{pre:"[",post:`${T(this,d)}]`})}}d=new WeakMap,m.exports=u},1891:(m,C,e)=>{"use strict";const g=e(6010),f=e(8138),a=e(1031),u=e(9263);class d extends f{constructor(t,s=g.getConfig(),n=[]){var o;super(void 0,s,!0,n,{AstText:":",GalleryImageToken:":",HiddenToken:":"});S(this,"type","ext-inner");S(this,"name","gallery");const i=structuredClone(s);for(const[r,l]of Object.entries(s.img))l==="width"&&delete i.img[r];for(const r of(o=t==null?void 0:t.split(`
|
|
20
|
+
`))!=null?o:[]){const l=/^([^|]+)(?:\|(.*))?/u.exec(r);if(!l){super.insertAt(r.trim()?new u(r,void 0,s,[],{AstText:":"}):r);continue}const[,c,x]=l;let A;try{A=this.normalizeTitle(decodeURIComponent(c),6,!0)}catch($){A=this.normalizeTitle(c,6,!0)}A.valid?super.insertAt(new a(c,x,A,i,n)):super.insertAt(new u(r,void 0,s,[],{AstText:":"}))}}toString(t){return super.toString(t,`
|
|
21
|
+
`)}getGaps(){return 1}print(){return super.print({sep:`
|
|
22
|
+
`})}lint(t=0){const{top:s,left:n}=this.getRootNode().posFromIndex(t),i=[];for(let o=0,r=t;o<this.childNodes.length;o++){const l=this.childNodes[o],c=String(l),x=c.trim();l.type==="hidden"&&x&&!/^<!--.*-->$/u.test(x)?i.push({message:"\u56FE\u5E93\u4E2D\u7684\u65E0\u6548\u5185\u5BB9",startLine:s+o,endLine:s+o,startCol:o?0:n,endCol:o?c.length:n+c.length}):l.type!=="hidden"&&l.type!=="text"&&i.push(...l.lint(r)),r+=c.length+1}return i}}m.exports=d},2158:(m,C,e)=>{"use strict";const g=e(6010),f=e(8138);class a extends f{constructor(d,p,h=g.getConfig(),t=[]){const s=e(3423);d=d.replaceAll(/(<nowiki>)(.*?)(<\/nowiki>)/giu,(n,i,o,r)=>(new s(i,h,t),new s(r,h,t),`\0${t.length-1}c\x7F${o}\0${t.length}c\x7F`)),super(d,h,!0,t,{AstText:":",NoincludeToken:":"}),this.type=p}}m.exports=a},428:(m,C,e)=>{"use strict";const g=e(6010),f=e(2158);class a extends f{constructor(p,h=g.getConfig(),t=[]){super(p,"ext-inner",h,t);S(this,"name","pre");this.setAttribute("stage",g.MAX_STAGE-1)}isPlain(){return!0}}m.exports=a},9450:(m,C,e)=>{"use strict";const{generateForSelf:g}=e(8277),f=e(6010),a=e(8138);class u extends a{constructor(h,t,s=f.getConfig(),n=[]){super(void 0,s,!0,n);S(this,"type","heading");this.setAttribute("name",String(h));const i=new a(t[0],s,!0,n);i.type="heading-title",i.setAttribute("stage",2);const o=e(8058),r=new o(t[1],/^[^\S\n]*$/u,"heading-trail",s,n,{"Stage-1":":","!ExtToken":""});this.append(i,r)}toString(h){const t="=".repeat(Number(this.name));return`${t}${this.firstChild.toString()}${t}${this.lastChild.toString()}`}getPadding(){return super.getPadding()+Number(this.name)}getGaps(){return Number(this.name)}print(){const h="=".repeat(Number(this.name));return super.print({pre:h,sep:h})}lint(h=0){const t=super.lint(h);return this.name==="1"&&t.push(g(this,this.getRootNode().posFromIndex(h),"<h1>")),t}}m.exports=u},2350:(m,C,e)=>{var d,p,h;"use strict";const{generateForSelf:g}=e(8277),f=e(6010),a=e(8138);class u extends a{constructor(n,i,o,r,l=f.getConfig(),c=[]){super(void 0,l,!0,c);S(this,"type","html");w(this,d,void 0);w(this,p,void 0);w(this,h,void 0);this.insertAt(i),this.setAttribute("name",n.toLowerCase()),H(this,d,o),H(this,p,r),H(this,h,n)}get closing(){return T(this,d)}toString(n){return`<${T(this,d)?"/":""}${T(this,h)}${super.toString()}${T(this,p)?"/":""}>`}getPadding(){return T(this,h).length+(T(this,d)?2:1)}print(){return super.print({pre:`<${T(this,d)?"/":""}${T(this,h)}`,post:`${T(this,p)?"/":""}>`})}lint(n=0){const i=super.lint(n);let o;this.name==="h1"&&!T(this,d)&&(o=g(this,this.getRootNode().posFromIndex(n),"<h1>"),i.push(o));try{this.findMatchingTag()}catch({message:r}){const[l]=r.split("\uFF1A");o||(o=g(this,this.getRootNode().posFromIndex(n),"")),i.push({...o,message:l,severity:l==="\u672A\u95ED\u5408\u7684\u6807\u7B7E"?"warning":"error"})}return i}findMatchingTag(){const{html:n}=this.getAttribute("config"),{name:i,parentNode:o}=this,r=String(this);if(T(this,d)&&T(this,p))throw new SyntaxError(`\u540C\u65F6\u95ED\u5408\u548C\u81EA\u5C01\u95ED\u7684\u6807\u7B7E\uFF1A${r}`);if(n[2].includes(i)||T(this,p)&&n[1].includes(i))return this;if(T(this,p)&&n[0].includes(i))throw new SyntaxError(`\u65E0\u6548\u81EA\u5C01\u95ED\u6807\u7B7E\uFF1A${r}`);if(!o)return;const{childNodes:l}=o,c=l.indexOf(this),x=T(this,d)?l.slice(0,c).reverse().filter(({type:$,name:k})=>$==="html"&&k===i):l.slice(c+1).filter(({type:$,name:k})=>$==="html"&&k===i);let A=T(this,d)?-1:1;for(const $ of x)if($.closing?A--:A++,A===0)return $;throw new SyntaxError(`\u672A${T(this,d)?"\u5339\u914D\u7684\u95ED\u5408":"\u95ED\u5408\u7684"}\u6807\u7B7E\uFF1A${r}`)}}d=new WeakMap,p=new WeakMap,h=new WeakMap,m.exports=u},1874:(m,C,e)=>{var p,it,t;"use strict";const{print:g,extUrlChar:f}=e(231),a=e(6010),u=e(8138),n=class extends u{constructor(r,l=a.getConfig(),c=[]){var o=(...s)=>{super(...s);S(this,"type","image-parameter");w(this,t,"")};var $;const x=Object.entries(l.img).map(([k,N])=>[k,N,new RegExp(`^(\\s*)${k.replace("$1","(.*)")}(\\s*)$`,"u")]),A=x.find(([,,k])=>k.test(r));if(A){const k=A[2].exec(r);if(k.length!==4||D($=n,p,it).call($,A[1],k[2],l,!0)){k.length===3?(o(void 0,l,!0,c),H(this,t,r)):(o(k[2],l,!0,c,{"Stage-2":":","!HeadingToken":":"}),H(this,t,`${k[1]}${A[0]}${k[3]}`)),this.setAttribute("name",A[1]).setAttribute("stage",a.MAX_STAGE);return}}o(r,l,!0,c),this.setAttribute("name","caption").setAttribute("stage",7)}isPlain(){return!0}toString(r){return T(this,t)?T(this,t).replace("$1",super.toString(r)):super.toString(r)}getPadding(){return Math.max(0,T(this,t).indexOf("$1"))}print(){return T(this,t)?`<span class="wpb-image-parameter">${T(this,t).replace("$1",g(this.childNodes))}</span>`:super.print({class:"image-caption"})}};let d=n;p=new WeakSet,it=function(r,l,c=a.getConfig(),x=!1){switch(l=l.replaceAll(/\0\d+t\x7F/gu,"").trim(),r){case"width":return/^\d*(?:x\d*)?$/u.test(l);case"link":{if(!l||new RegExp(`(?:${c.protocol}|//)${f}(?=\0\\d+t\x7F|$)`,"iu").test(l))return!0;if(l.startsWith("[[")&&l.endsWith("]]")&&(l=l.slice(2,-2)),l.includes("%"))try{l=decodeURIComponent(l)}catch(k){}return a.normalizeTitle(l,0,!1,c,x).valid}case"lang":return c.variants.includes(l);case"alt":case"class":case"manualthumb":return!0;default:return!isNaN(l)}},t=new WeakMap,w(d,p),m.exports=d},2641:(m,C,e)=>{"use strict";const{generateForSelf:g,generateForChild:f}=e(8277),a=e(6010),u=e(7507),d=e(8138),p=e(3423),h=e(1031),t=e(2571);class s extends d{constructor(o,r=a.getConfig(),l=[]){super(void 0,r,!0,l,{GalleryImageToken:":",ImagemapLinkToken:":",NoincludeToken:":",AstText:":"});S(this,"type","ext-inner");S(this,"name","imagemap");if(!o)return;const c=o.split(`
|
|
23
|
+
`),x=k=>{super.insertAt(new p(k,r,l))};let A=!0,$=!1;for(const k of c){const N=k.trim();if(!($||!N||N[0]==="#")){if(A){const[v,...b]=k.split("|");let I;try{I=this.normalizeTitle(decodeURIComponent(v),0,!0)}catch(F){I=this.normalizeTitle(v,0,!0)}if(I.valid&&!I.interwiki&&I.ns===6){const F=new h(v,b.length>0?b.join("|"):void 0,I,r,l);F.type="imagemap-image",super.insertAt(F),A=!1;continue}else $=!0}else if(k.trim().split(/[\t ]/u)[0]==="desc"){super.insertAt(new u(k));continue}else if(k.includes("[")){const v=k.indexOf("["),b=k.slice(v),I=/^\[{2}([^|]+)(?:\|([^\]]+))?\]{2}[\w\s]*$/u.exec(b);if(I){const F=this.normalizeTitle(I[1],0,!0);if(F.valid){super.insertAt(new t(k.slice(0,v),[...I.slice(1),F],b.slice(b.indexOf("]]")+2),r,l));continue}}else{const F=r.protocol.split("|");if(F.includes(b.slice(1,b.indexOf(":")+1))||F.includes(b.slice(1,b.indexOf("//")+2))){const z=/^\[([^\]\s]+)(?:(\s+)(\S[^\]]*)?)?\][\w\s]*$/u.exec(b);if(z){super.insertAt(new t(k.slice(0,v),z.slice(1),b.slice(b.indexOf("]")+1),r,l));continue}}}}}x(k)}}toString(o){return super.toString(o,`
|
|
24
|
+
`)}getGaps(){return 1}print(){return super.print({sep:`
|
|
25
|
+
`})}lint(o=0){const r=super.lint(o),l=this.getRootNode().posFromIndex(o);return this.image?r.push(...this.childNodes.filter(c=>{const x=String(c).trim();return c.type==="noinclude"&&x&&x[0]!=="#"}).map(c=>f(c,l,"\u65E0\u6548\u7684<imagemap>\u94FE\u63A5"))):r.push(g(this,l,"\u7F3A\u5C11\u56FE\u7247\u7684<imagemap>")),r}}m.exports=s},2571:(m,C,e)=>{"use strict";const g=e(8138),f=e(3905),a=e(741);class u extends g{constructor(h,t,s,n,i){const o=e(6986),r=e(7507),l=e(3423),c=t[2]instanceof o?f:a;super(void 0,n,!0,i);S(this,"type","imagemap-link");this.append(new r(h),new c(...t,n,i),new l(s,n,i))}}m.exports=u},8138:(m,C,e)=>{var p,h,t,s,n,i,o,ot,l,lt,x,dt,$,ht,N,at,b,ut,F,pt,O,ct,M,gt,G,ft,B,xt;"use strict";const g=e(6010),f=e(9205),a=e(7507),{MAX_STAGE:u}=g,Q=class extends f{constructor(y,P=g.getConfig(),E=!1,Z=[],_=null){super();w(this,o);w(this,l);w(this,x);w(this,$);w(this,N);w(this,b);w(this,F);w(this,O);w(this,M);w(this,G);w(this,B);S(this,"type","root");w(this,p,0);w(this,h,void 0);w(this,t,void 0);w(this,s,(y=T(this,p),P=!1)=>{if(y<T(this,p)||!this.isPlain()||this.childNodes.length===0)return this;switch(y){case 0:this.type==="root"&&T(this,t).shift(),D(this,o,ot).call(this,P);break;case 1:D(this,l,lt).call(this);break;case 2:D(this,x,dt).call(this);break;case 3:D(this,$,ht).call(this);break;case 4:D(this,N,at).call(this);break;case 5:D(this,b,ut).call(this);break;case 6:D(this,F,pt).call(this);break;case 7:D(this,O,ct).call(this);break;case 8:D(this,M,gt).call(this);break;case 9:D(this,G,ft).call(this);break;case 10:D(this,B,xt).call(this)}if(this.type==="root")for(const E of T(this,t))E.getAttribute("parseOnce")(y,P);return et(this,p)._++,this});w(this,n,y=>y.split(/[\0\x7F]/u).map((P,E)=>{if(E%2===0)return new a(P);if(isNaN(P.at(-1)))return T(this,t)[Number(P.slice(0,-1))];throw new Error(`\u89E3\u6790\u9519\u8BEF\uFF01\u672A\u6B63\u786E\u6807\u8BB0\u7684 Token\uFF1A${P}`)}));w(this,i,()=>{H(this,p,u);const{length:y,firstChild:P}=this,E=String(P);if(y===1&&P.type==="text"&&E.includes("\0")&&(this.replaceChildren(...T(this,n).call(this,E)),this.normalize(),this.type==="root"))for(const Z of T(this,t))Z.getAttribute("build")()});typeof y=="string"&&this.insertAt(E?y:y.replaceAll(/[\0\x7F]/gu,"")),H(this,h,P),H(this,t,Z),Z.push(this)}getAttribute(y){switch(y){case"config":return structuredClone(T(this,h));case"accum":return T(this,t);case"parseOnce":return T(this,s);case"buildFromStr":return T(this,n);case"build":return T(this,i);default:return super.getAttribute(y)}}setAttribute(y,P){switch(y){case"stage":return T(this,p)===0&&this.type==="root"&&T(this,t).shift(),H(this,p,P),this;default:return super.setAttribute(y,P)}}isPlain(){return this.constructor===Q}insertAt(y,P=this.childNodes.length){return typeof y=="string"&&(y=new a(y)),super.insertAt(y,P),y.type==="root"&&(y.type="plain"),y}normalizeTitle(y,P=0,E=!1){return g.normalizeTitle(y,P,!1,T(this,h),E)}afterBuild(){if(this.type==="root")for(const y of T(this,t))y.afterBuild();return this}parse(y=u,P=!1){for(;T(this,p)<y;)T(this,s).call(this,T(this,p),P);return y&&(T(this,i).call(this),this.afterBuild()),this}};let d=Q;p=new WeakMap,h=new WeakMap,t=new WeakMap,s=new WeakMap,n=new WeakMap,i=new WeakMap,o=new WeakSet,ot=function(y){const P=e(4907);this.setText(P(String(this),T(this,h),T(this,t),y))},l=new WeakSet,lt=function(){const y=e(8275),P=this.type==="root"?String(this):`\0${String(this)}`,E=y(P,T(this,h),T(this,t));this.setText(this.type==="root"?E:E.slice(1))},x=new WeakSet,dt=function(){const y=e(5130);this.setText(y(String(this),T(this,h),T(this,t)))},$=new WeakSet,ht=function(){const y=e(4624),P=e(2840);this.setText(y(this,T(this,h),T(this,t)));for(const E of T(this,t))if(E instanceof P&&E.type!=="td"){E.normalize();const{childNodes:[,Z]}=E;if(typeof Z=="string"&&Z.includes("\0")){E.removeAt(1);const _=new Q(Z,T(this,h),!0,T(this,t));E.insertAt(_,1),_.setAttribute("stage",4)}}},N=new WeakSet,at=function(){const y=e(2937);this.setText(y(this,T(this,h),T(this,t)))},b=new WeakSet,ut=function(){const y=e(1452);this.setText(y(String(this),T(this,h),T(this,t)))},F=new WeakSet,pt=function(){const y=e(3360),P=String(this).split(`
|
|
26
|
+
`);for(let E=0;E<P.length;E++)P[E]=y(P[E],T(this,h),T(this,t));this.setText(P.join(`
|
|
27
|
+
`))},O=new WeakSet,ct=function(){const y=e(7513);this.setText(y(String(this),T(this,h),T(this,t)))},M=new WeakSet,gt=function(){const y=e(4737);this.setText(y(String(this),T(this,h),T(this,t)))},G=new WeakSet,ft=function(){if(this.type==="image-parameter")return;const y=e(6622),P=String(this).split(`
|
|
28
|
+
`);let E=this.type==="root"||this.type==="ext-inner"&&this.type==="poem"?0:1;for(;E<P.length;E++)P[E]=y(P[E],T(this,h),T(this,t));this.setText(P.join(`
|
|
29
|
+
`))},B=new WeakSet,xt=function(){const y=e(3765);this.setText(y(String(this),T(this,h),T(this,t)))},m.exports=d},337:(m,C,e)=>{"use strict";const g=e(3905);class f extends g{constructor(){super(...arguments);S(this,"type","category")}}m.exports=f},7625:(m,C,e)=>{"use strict";const{explode:g}=e(231),{generateForChild:f}=e(8277),a=e(6010),u=e(3905),d=e(1874);class p extends u{constructor(s,n,i,o=a.getConfig(),r=[],l="|"){super(s,void 0,i,o,r,l);S(this,"type","file");this.append(...g("-{","}-","|",n).map(c=>new d(c,o,r)))}lint(s=0){const n=super.lint(s),i=this.getFrameArgs(),o=this.getHorizAlignArgs(),r=this.getVertAlignArgs(),l=this.getArgs("caption");if(i.length>1||o.length>1||r.length>1||l.size>1){const c=this.getRootNode().posFromIndex(s);i.length>1&&n.push(...i.map(x=>f(x,c,"\u91CD\u590D\u6216\u51B2\u7A81\u7684\u56FE\u7247\u6846\u67B6\u53C2\u6570"))),o.length>1&&n.push(...o.map(x=>f(x,c,"\u91CD\u590D\u6216\u51B2\u7A81\u7684\u56FE\u7247\u6C34\u5E73\u5BF9\u9F50\u53C2\u6570"))),r.length>1&&n.push(...r.map(x=>f(x,c,"\u91CD\u590D\u6216\u51B2\u7A81\u7684\u56FE\u7247\u5782\u76F4\u5BF9\u9F50\u53C2\u6570"))),l.size>1&&n.push(...[...l].map(x=>f(x,c,"\u91CD\u590D\u7684\u56FE\u7247\u8BF4\u660E")))}return n}getAllArgs(){return this.childNodes.slice(1)}getArgs(s,n=!0){const i=this.getAllArgs().filter(({name:o})=>s===o);return n?new Set(i):i}getFrameArgs(){return this.getAllArgs().filter(({name:n})=>["manualthumb","frameless","framed","thumbnail"].includes(n))}getHorizAlignArgs(){return this.getAllArgs().filter(({name:n})=>["left","right","center","none"].includes(n))}getVertAlignArgs(){return this.getAllArgs().filter(({name:n})=>["baseline","sub","super","top","text-top","middle","bottom","text-bottom"].includes(n))}}m.exports=p},1031:(m,C,e)=>{var d;"use strict";const{generateForSelf:g}=e(8277),f=e(6010),a=e(7625);class u extends a{constructor(t,s,n,i=f.getConfig(),o=[]){let r;if(s!==void 0){const l=e(8138);r=new l(s,i,!0,o),r.type="temp";for(let c=1;c<f.MAX_STAGE;c++)r.getAttribute("parseOnce")();o.splice(o.indexOf(r),1)}super(t,r==null?void 0:r.toString(),n,i,o);S(this,"type","gallery-image");w(this,d,!1);this.setAttribute("bracket",!1)}afterBuild(){const{interwiki:t,ns:s}=this.normalizeTitle(String(this.firstChild),this.type==="imagemap-image"?0:6,!0);return H(this,d,t||s!==6),this}getPadding(){return 0}lint(t=0){const s=super.lint(t);return T(this,d)&&s.push(g(this,this.getRootNode().posFromIndex(t),"\u65E0\u6548\u7684\u56FE\u5E93\u56FE\u7247")),s}}d=new WeakMap,m.exports=u},3905:(m,C,e)=>{var u,d;"use strict";const g=e(6010),f=e(8138);class a extends f{constructor(t,s,n,i=g.getConfig(),o=[],r="|"){super(void 0,i,!0,o,{AtomToken:0,Token:1});S(this,"type","link");w(this,u,!0);w(this,d,void 0);const l=e(9237);if(this.insertAt(new l(t,"link-target",i,o,{"Stage-2":":","!ExtToken":"","!HeadingToken":""})),s!==void 0){const c=new f(s,i,!0,o,{"Stage-5":":",ConverterToken:":"});c.type="link-text",this.insertAt(c.setAttribute("stage",g.MAX_STAGE-1))}H(this,d,r)}afterBuild(){var t;return(t=T(this,d))!=null&&t.includes("\0")&&H(this,d,this.getAttribute("buildFromStr")(T(this,d)).map(String).join("")),this}setAttribute(t,s){return t==="bracket"?(H(this,u,Boolean(s)),this):super.setAttribute(t,s)}toString(t){const s=super.toString(t,T(this,d));return T(this,u)?`[[${s}]]`:s}getPadding(){return 2}getGaps(){return T(this,d).length}print(){return super.print(T(this,u)?{pre:"[[",post:"]]",sep:T(this,d)}:{sep:T(this,d)})}}u=new WeakMap,d=new WeakMap,m.exports=a},8962:(m,C,e)=>{"use strict";const{generateForChild:g}=e(8277),f=e(6010),a=e(8138);class u extends a{constructor(h,t,s=f.getConfig(),n=[]){super(h,s,!0,n,{"Stage-1":":","!ExtToken":""});S(this,"type","free-ext-link");t&&(this.type="ext-link-url")}lint(h=0){const t=super.lint(h);let s;for(const n of this.childNodes){const i=String(n);if(n.type!=="text"||!/[,;。:!?()【】]/u.test(i))continue;s||(s=this.getRootNode().posFromIndex(h));const o=g(n,s,"URL\u4E2D\u7684\u5168\u89D2\u6807\u70B9","warning");t.push(...[...i.matchAll(/[,;。:!?()【】]/gu)].map(({index:r})=>{const l=i.slice(0,r).split(`
|
|
30
|
+
`),{length:c}=l,{length:x}=l.at(-1),A=o.startLine+c-1,$=c>1?x:o.startCol+x;return{...o,startLine:A,endLine:A,startCol:$,endCol:$+1}}))}return t}}m.exports=u},9389:(m,C,e)=>{"use strict";const g=e(6010),f=e(8889);class a extends f{constructor(p,h=g.getConfig(),t=[]){super(p,/<(option|choicetemplate)(\s[^>]*)?>(.*?)<\/(\1)>/gsu,["option","choicetemplate"],h,t);S(this,"name","choose")}}m.exports=a},9269:(m,C,e)=>{"use strict";const g=e(6010),f=e(8889);class a extends f{constructor(p,h=g.getConfig(),t=[]){super(p,/<(combooption)(\s[^>]*)?>(.*?)<\/(combooption\s*)>/gisu,["combooption"],h,t);S(this,"name","combobox")}}m.exports=a},8889:(m,C,e)=>{"use strict";const{generateForChild:g}=e(8277),f=e(6010),a=e(8138);class u extends a{constructor(h,t,s,n=f.getConfig(),i=[]){var c;const o=e(7267),r=e(3423),l=(c=h==null?void 0:h.replaceAll(t,(x,A,$,k,N)=>{const v=`\0${i.length+1}e\x7F`;return new o(A,$,k,N,n,i),v}))==null?void 0:c.replaceAll(/(^|\0\d+e\x7F)(.*?)(?=$|\0\d+e\x7F)/gsu,(x,A,$)=>$===""?A:(new r($,n,i),`${A}\0${i.length}c\x7F`));super(l,n,!0,i,{NoincludeToken:":",ExtToken:":"});S(this,"type","ext-inner")}lint(h=0){let t;return[...super.lint(h),...this.childNodes.filter(s=>{if(s.type==="ext")return!1;const n=String(s).trim();return n&&!/^<!--.*-->$/u.test(n)}).map(s=>(t||(t=this.getRootNode().posFromIndex(h)),g(s,t,`<${this.name}>\u5185\u7684\u65E0\u6548\u5185\u5BB9`)))]}}m.exports=u},5937:(m,C,e)=>{"use strict";const g=e(6010),f=e(8889);class a extends f{constructor(p,h=g.getConfig(),t=[]){super(p,/<(ref)(\s[^>]*)?>(.*?)<\/(ref\s*)>/gisu,["ref"],h,t);S(this,"name","references")}}m.exports=a},7033:(m,C,e)=>{var g={"./":8889,"./choose":9389,"./choose.js":9389,"./combobox":9269,"./combobox.js":9269,"./index":8889,"./index.js":8889,"./references":5937,"./references.js":5937};function f(u){var d=a(u);return e(d)}function a(u){if(!e.o(g,u)){var d=new Error("Cannot find module '"+u+"'");throw d.code="MODULE_NOT_FOUND",d}return g[u]}f.keys=function(){return Object.keys(g)},f.resolve=a,m.exports=f,f.id=7033},5749:(m,C,e)=>{"use strict";const{generateForSelf:g}=e(8277),f=e(2308),a=e(6010),u=e(6935);class d extends f(u){constructor(t,s=!0,n=a.getConfig(),i=[]){super(t,n,i);S(this,"type","comment");S(this,"closed");this.closed=s}getPadding(){return 4}print(){return super.print({pre:"<!--",post:this.closed?"-->":""})}lint(t=0){return this.closed?[]:[g(this,this.getRootNode().posFromIndex(t),"\u672A\u95ED\u5408\u7684HTML\u6CE8\u91CA")]}toString(t){return`<!--${String(this.firstChild)}${this.closed?"-->":""}`}}m.exports=d},3434:(m,C,e)=>{"use strict";const g=e(6935);class f extends g{constructor(){super(...arguments);S(this,"type","dd")}}m.exports=f},7815:(m,C,e)=>{"use strict";const g=e(2308),f=e(6935);class a extends g(f){constructor(){super(...arguments);S(this,"type","double-underscore")}getPadding(){return 2}print(){return super.print({pre:"__",post:"__"})}toString(p){return`__${String(this.firstChild)}__`}}m.exports=a},2582:(m,C,e)=>{"use strict";const g=e(6010),f=e(6935);class a extends f{constructor(p,h=g.getConfig(),t=[]){super("-".repeat(p),h,t);S(this,"type","hr")}}m.exports=a},6935:(m,C,e)=>{"use strict";const{generateForSelf:g}=e(8277),f=e(6010),a=e(8138);class u extends a{constructor(h,t=f.getConfig(),s=[]){super(h,t,!0,s);S(this,"type","ext-inner")}lint(h=0){const{type:t,name:s}=this;return t==="ext-inner"&&(s==="templatestyles"||s==="section")&&String(this)?[g(this,this.getRootNode().posFromIndex(h),`<${s}>\u6807\u7B7E\u5185\u4E0D\u5E94\u6709\u4EFB\u4F55\u5185\u5BB9`)]:super.lint(h)}}m.exports=u},962:(m,C,e)=>{"use strict";const g=e(3434);class f extends g{constructor(){super(...arguments);S(this,"type","list")}}m.exports=f},3423:(m,C,e)=>{"use strict";const g=e(2308),f=e(6935);class a extends g(f){constructor(){super(...arguments);S(this,"type","noinclude")}}m.exports=a},6714:(m,C,e)=>{"use strict";const{generateForSelf:g}=e(8277),f=e(6010),a=e(7507),u=e(6935);class d extends u{constructor(t,s=f.getConfig(),n=[]){super("'".repeat(t),s,n);S(this,"type","quote")}lint(t=0){const{previousSibling:s,nextSibling:n}=this,i=`\u5B64\u7ACB\u7684"'"`,o=[];let r;if((s==null?void 0:s.type)==="text"&&s.data.at(-1)==="'"){r=g(this,this.getRootNode().posFromIndex(t),"");const{startLine:l,startCol:c}=r,[,{length:x}]=s.data.match(/(?:^|[^'])('+)$/u);o.push({message:i,startLine:l,startCol:c-x,endLine:l,endCol:c})}if((n==null?void 0:n.type)==="text"&&n.data[0]==="'"){r||(r=g(this,this.getRootNode().posFromIndex(t),""));const{endLine:l,endCol:c}=r,[{length:x}]=n.data.match(/^'+/u);o.push({message:i,startLine:l,startCol:c,endLine:l,endCol:c+x})}return o}}m.exports=d},851:(m,C,e)=>{"use strict";const g=e(6010),f=e(8138);class a extends f{constructor(p,h=g.getConfig(),t=[]){super(p,h,!0,t);S(this,"type","onlyinclude")}toString(p){return`<onlyinclude>${super.toString()}</onlyinclude>`}getPadding(){return 13}print(){return super.print({pre:"<onlyinclude>",post:"</onlyinclude>"})}isPlain(){return!0}}m.exports=a},9380:(m,C,e)=>{"use strict";const{generateForChild:g}=e(8277),f=e(6010),a=e(8138),u=e(9237);class d extends a{constructor(t,s=f.getConfig(),n=[]){super(void 0,s,!0,n,{AtomToken:":"});S(this,"type","ext-inner");t&&this.append(...t.split(`
|
|
31
|
+
`).map(i=>new u(i,"param-line",s,n,{AstText:":"})))}toString(t){return super.toString(t,`
|
|
32
|
+
`)}getGaps(){return 1}print(){return super.print({sep:`
|
|
33
|
+
`})}lint(t=0){let s;return this.childNodes.filter(n=>{const{childNodes:i}=n,o=i.findIndex(({type:l})=>l!=="text"),r=(o>=0?i.slice(0,o).map(String).join(""):String(n)).trim();return r&&!(o>=0?/^[a-z]+\s*(?:=|$)/iu:/^[a-z]+\s*=/iu).test(r)}).map(n=>(s||(s=this.getRootNode().posFromIndex(t)),g(n,s,`${this.name}\u7684\u65E0\u6548\u53C2\u6570`)))}}m.exports=d},9799:(m,C,e)=>{"use strict";const g=e(6010),f=e(8138);class a extends f{constructor(p,h,t=g.getConfig(),s=[]){super(void 0,t,!0,s);S(this,"type","parameter");const n=e(9237),i=new n(typeof p=="number"?void 0:p,"parameter-key",t,s,{"Stage-2":":","!HeadingToken":""}),o=new f(h,t,!0,s);o.type="parameter-value",this.append(i,o.setAttribute("stage",2))}get anon(){return this.firstChild.childNodes.length===0}afterBuild(){if(!this.anon){const p=e(1782),h=String(this.firstChild).trim(),{parentNode:t}=this;this.setAttribute("name",h),t&&t instanceof p&&t.getArgs(h,!1,!1).add(this)}return this}toString(p){return this.anon?this.lastChild.toString(p):super.toString(p,"=")}getGaps(){return this.anon?0:1}print(){return super.print({sep:this.anon?"":"="})}}m.exports=a},8058:(m,C,e)=>{"use strict";const g=e(6010),f=e(8138);class a extends f{constructor(d,p,h="plain",t=g.getConfig(),s=[],n=null){super(d,t,!0,s,n),this.type=h}}m.exports=a},2840:(m,C,e)=>{"use strict";const{generateForChild:g}=e(8277),f=e(3125),a=e(8058);class u extends f{constructor(){super(...arguments);S(this,"type","table")}get closed(){return this.lastChild.type==="table-syntax"}lint(h=0){const t=super.lint(h);return this.closed||t.push(g(this.firstChild,this.getRootNode().posFromIndex(h),"\u672A\u95ED\u5408\u7684\u8868\u683C")),t}close(h=`
|
|
34
|
+
|}`,t=!1){const s=this.getAttribute("config"),n=this.getAttribute("accum");super.insertAt(new a(h,null,"table-syntax",s,n))}}m.exports=u},5567:(m,C,e)=>{var d;"use strict";const g=e(6010),f=e(8138),a=e(3125);class u extends a{constructor(t,s,n=g.getConfig(),i=[]){let o=s==null?void 0:s.match(/\||\0\d+!\x7F/u),r=o?s.slice(0,o.index):"";/\[\[|-\{/u.test(r)&&(o=null,r="");super(t,r,n,i);S(this,"type","td");w(this,d,"");o&&([et(this,d)._]=o);const l=new f(s==null?void 0:s.slice((o==null?void 0:o.index)+T(this,d).length),n,!0,i);l.type="td-inner",this.insertAt(l.setAttribute("stage",4))}afterBuild(){return T(this,d).includes("\0")&&H(this,d,this.getAttribute("buildFromStr")(T(this,d)).map(String).join("")),this}toString(t){const{childNodes:[s,n,i]}=this;return`${s.toString()}${n.toString()}${T(this,d)}${i.toString()}`}getGaps(t=0){return t=t<0?t+this.childNodes.length:t,t===1?T(this,d).length:0}print(){const{childNodes:[t,s,n]}=this;return`<span class="wpb-td">${t.print()}${s.print()}${T(this,d)}${n.print()}</span>`}}d=new WeakMap,m.exports=u},3125:(m,C,e)=>{"use strict";const{generateForChild:g}=e(8277),f=e(6010),a=e(8138),u=e(8058);class d extends a{constructor(t,s="",n=f.getConfig(),i=[],o=null){super(void 0,n,!0,i,{Token:2,SyntaxToken:0,AttributeToken:1,TdToken:"2:"});S(this,"type","tr");const r=e(5037);this.append(new u(t,o,"table-syntax",n,i,{"Stage-1":":","!ExtToken":"",TranscludeToken:":"}),new r(s,"table-attr","tr",n,i))}lint(t=0){const s=super.lint(t),n=this.childNodes.find(({type:o})=>o==="table-inter"),i=String(n).trim();if(n&&i&&!/^<!--.*-->$/su.test(i)){const o=g(n,this.getRootNode().posFromIndex(t),"\u5C06\u88AB\u79FB\u51FA\u8868\u683C\u7684\u5185\u5BB9");o.startLine++,o.startCol=0,s.push(o)}return s}}m.exports=d},7267:(m,C,e)=>{"use strict";const g=e(6010),f=e(1074);class a extends f{constructor(p,h="",t="",s=void 0,n=g.getConfig(),i=[]){h=!h||h.trimStart()!==h?h:` ${h}`;const o=e(8138),r=e(5037),l=p.toLowerCase(),c=new r(h,"ext-attr",l,n,i),x=structuredClone(n),A=new Set(x.ext);let $;switch(A.delete(l),x.ext=[...A],l){case"tab":A.delete("tabs"),x.ext=[...A];case"indicator":case"poem":case"ref":case"option":case"combooption":case"tabs":case"poll":case"seo":case"inputbox":$=new o(t,x,!0,i);break;case"gallery":{const k=e(1891);$=new k(t,x,i);break}case"pre":{const k=e(428);$=new k(t,x,i);break}case"charinsert":{const k=e(8103);$=new k(t,x,i);break}case"references":case"choose":case"combobox":{const k=e(8889),N=e(7033)(`./${l}`);$=new N(t,x,i);break}case"imagemap":{const k=e(2641);$=new k(t,n,i);break}case"dynamicpagelist":{const k=e(9380);$=new k(t,x,i);break}default:{const k=e(6935);$=new k(t,n)}}$.setAttribute("name",l).type="ext-inner";super(p,c,$,s,n,i);S(this,"type","ext");S(this,"closed",!0)}}m.exports=a},8655:(m,C,e)=>{"use strict";const{generateForSelf:g}=e(8277),f=e(2308),a=e(6010),u=e(1074);class d extends f(u){constructor(t,s="",n=void 0,i=void 0,o=a.getConfig(),r=[]){super(t,s,n!=null?n:"",n===void 0||i!=null?i:"",o,r);S(this,"type","include")}lint(t=0){return this.closed?[]:[g(this,this.getRootNode().posFromIndex(t),"\u672A\u95ED\u5408\u7684\u6807\u7B7E")]}}m.exports=d},1074:(m,C,e)=>{var u,d,p;"use strict";const g=e(6010),f=e(8138);class a extends f{constructor(s,n,i,o,r=g.getConfig(),l=[]){super(void 0,r,!0);w(this,u,void 0);w(this,d,void 0);w(this,p,void 0);H(this,p,[s,o||s]),H(this,u,o===void 0),H(this,d,o!==""),this.append(n,i);let c=l.indexOf(n);c===-1&&(c=l.indexOf(i)),c===-1&&(c=1/0),l.splice(c,0,this)}get closed(){return T(this,d)}toString(s){const{firstChild:n,lastChild:i}=this,[o,r]=T(this,p);return T(this,u)?`<${o}${String(n)}/>`:`<${o}${String(n)}>${String(i)}${T(this,d)?`</${r}>`:""}`}getPadding(){return T(this,p)[0].length+1}getGaps(){return 1}print(){const[s,n]=T(this,p);return super.print(T(this,u)?{pre:`<${s}`,post:"/>"}:{pre:`<${s}`,sep:">",post:T(this,d)?`</${n}>`:""})}}u=new WeakMap,d=new WeakMap,p=new WeakMap,m.exports=a},1782:(m,C,e)=>{var t,s,mt;"use strict";const{removeComment:g,print:f}=e(231),{generateForChild:a}=e(8277),u=e(6010),d=e(8138),p=e(9799);class h extends d{constructor(r,l,c=u.getConfig(),x=[]){super(void 0,c,!0,x,{AtomToken:0,SyntaxToken:0,ParameterToken:"1:"});w(this,s);S(this,"type","template");S(this,"modifier","");w(this,t,{});const A=e(9237),$=e(8058),{parserFunction:[k,N,v]}=c;if(r.includes(":")){const[F,...z]=r.split(":");this.setModifier(F)&&(r=z.join(":"))}if(r.includes(":")||l.length===0&&!v.includes(this.modifier.toLowerCase())){const[F,...z]=r.split(":"),O=g(F),U=N.includes(O);if(U||k.includes(O.toLowerCase())){this.setAttribute("name",O.toLowerCase().replace(/^#/u,"")).type="magic-word";const M=new RegExp(`^\\s*${O}\\s*$`,U?"u":"iu"),X=new $(F,M,"magic-word-name",c,x,{"Stage-1":":","!ExtToken":""});if(this.insertAt(X),z.length>0&&l.unshift([z.join(":")]),this.name==="invoke")for(let G=0;G<2;G++){const W=l.shift();if(!W)break;const B=new A(W.join("="),`invoke-${G?"function":"module"}`,c,x,{"Stage-1":":","!ExtToken":""});this.insertAt(B)}}}if(this.type==="template"){const[F]=g(r).split("#");if(/\0\d+[eh!+-]\x7F|[<>[\]{}]/u.test(F))throw x.pop(),new SyntaxError(`\u975E\u6CD5\u7684\u6A21\u677F\u540D\u79F0\uFF1A${F}`);const z=new A(r,"template-name",c,x,{"Stage-2":":","!HeadingToken":""});this.insertAt(z)}const b=this.isTemplate();let I=1;for(const F of l)b||(F[0]=F.join("="),F.length=1),F.length===1&&(F.unshift(I),I++),this.insertAt(new p(...F,c,x))}setModifier(r=""){const{parserFunction:[,,l,c]}=this.getAttribute("config"),x=r.trim().toLowerCase(),A=l.includes(x),$=c.includes(x);return A||$||r===""?(this.setAttribute("modifier",r),Boolean(r)):!1}toString(r){const{childNodes:l,firstChild:c,modifier:x}=this;return`{{${x}${x&&":"}${this.type==="magic-word"?`${String(c)}${l.length>1?":":""}${l.slice(1).map(String).join("|")}`:super.toString(r,"|")}}}`}getPadding(){return this.modifier?this.modifier.length+3:2}getGaps(){return 1}print(){const{childNodes:r,firstChild:l,modifier:c}=this;return`<span class="wpb-${this.type}">{{${c}${c&&":"}${this.type==="magic-word"?`${l.print()}${r.length>1?":":""}${f(r.slice(1),{sep:"|"})}`:f(r,{sep:"|"})}}}</span>`}lint(r=0){const l=super.lint(r);if(!this.isTemplate())return l;const c=this.getDuplicatedArgs();if(c.length>0){const x=this.getRootNode().posFromIndex(r);l.push(...c.flatMap(([,A])=>[...A]).map(A=>a(A,x,"\u91CD\u590D\u53C2\u6570")))}return l}isTemplate(){return this.type==="template"||this.type==="magic-word"&&this.name==="invoke"}insertAt(r,l=this.childNodes.length){return super.insertAt(r,l),r.anon?D(this,s,mt).call(this,r):r.name&&this.getArgs(r.name,!1,!1).add(r),r}getAllArgs(){return this.childNodes.filter(r=>r instanceof p)}getAnonArgs(){return this.getAllArgs().filter(({anon:r})=>r)}getArgs(r,l,c=!0){const x=String(r).trim();let A;return Object.prototype.hasOwnProperty.call(T(this,t),x)?A=T(this,t)[x]:(A=new Set(this.getAllArgs().filter(({name:$})=>x===$)),T(this,t)[x]=A),A}getDuplicatedArgs(){return this.isTemplate()?Object.entries(T(this,t)).filter(([,{size:r}])=>r>1).map(([r,l])=>[r,new Set(l)]):[]}}t=new WeakMap,s=new WeakSet,mt=function(r){const l=this.getAnonArgs(),c=l.indexOf(r);for(let x=c;x<l.length;x++){const A=l[x],{name:$}=A,k=String(x+1);$!==k&&this.getArgs(k,!1,!1).add(A.setAttribute("name",k))}},m.exports=h},8277:(m,C,e)=>{"use strict";const g=e(8138),f=(u,d,p,h="error")=>{const{style:{top:t,left:s,height:n,width:i}}=u,{top:o,left:r}=d,l=o+t,c=l+n-1,x=t?s:r+s,A=n>1?i:x+i;return{message:p,severity:h,startLine:l,endLine:c,startCol:x,endCol:A}},a=(u,d,p,h="error")=>({message:p,severity:h,startLine:d.top,endLine:d.top+u.offsetHeight-1,startCol:d.left,endCol:u.offsetHeight>1?u.offsetWidth:d.left+u.offsetWidth});m.exports={generateForChild:f,generateForSelf:a}},231:(m,C,e)=>{"use strict";const g='(?:\\[[\\da-f:.]+\\]|[^[\\]<>"\\0-\\x1F\\x7F\\p{Zs}\\uFFFD])(?:[^[\\]<>"\\0-\\x1F\\x7F\\p{Zs}\\uFFFD]|\\0\\d+c\\x7F)*',f=p=>p.replaceAll(/\0\d+c\x7F/gu,""),a=(p,h={})=>{const t=e(7507),s=e(9205),{pre:n="",post:i="",sep:o=""}=h,r={"&":"amp","<":"lt",">":"gt"};return`${n}${p.map(l=>l instanceof s?l.print():String(l).replaceAll(/[&<>]/gu,c=>`&${r[c]};`)).join(o)}${i}`},u=p=>p.replaceAll(/[\\{}()|.?*+^$[\]]/gu,"\\$&"),d=(p,h,t,s)=>{if(s===void 0)return[];const n=new RegExp(`${[p,h,t].map(u).join("|")}`,"gu"),i=[];let o=n.exec(s),r=0,l=0;for(;o;){const{0:c,index:x}=o;c!==t?r+=c===p?1:-1:r===0&&(i.push(s.slice(l,x)),{lastIndex:l}=n),o=n.exec(s)}return i.push(s.slice(l)),i};m.exports={extUrlChar:g,removeComment:f,print:a,escapeRegExp:u,explode:d}},8166:m=>{"use strict";m.exports=JSON.parse('{"ext":["nowiki","pre","gallery","indicator"],"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":{"0":"","6":"File","14":"Category"},"nsid":{"":0,"file":6,"image":6,"\u56FE\u50CF":6,"\u5716\u50CF":6,"\u6587\u4EF6":6,"\u6863\u6848":6,"\u6A94\u6848":6,"category":14,"\u5206\u7C7B":14,"\u5206\u985E":14},"parserFunction":[["\u540D\u79F0\u7A7A\u95F4","ns","\u540D\u79F0\u7A7A\u95F4e","nse","url\u7F16\u7801","urlencode","\u5C0F\u5199\u9996\u5B57","lcfirst","\u5927\u5199\u9996\u5B57","ucfirst","\u5C0F\u5199","lc","\u5927\u5199","uc","\u672C\u5730url","localurl","\u672C\u5730urle","localurle","\u5B8C\u6574url","fullurl","\u5B8C\u6574url\u7B49\u540C","fullurle","\u89C4\u8303url","canonicalurl","\u89C4\u8303url\u7B49\u540C","canonicalurle","\u683C\u5F0F\u5316\u6570\u5B57","formatnum","\u8BED\u6CD5","grammar","\u6027\u522B","gender","\u590D\u6570","plural","bidi","#\u8BED\u8A00","#language","\u5DE6\u586B\u5145","padleft","\u53F3\u586B\u5145","padright","\u951A\u7F16\u7801","anchorencode","\u6587\u4EF6\u8DEF\u5F84","filepath","\u9875\u9762id","pageid","\u754C\u9762","int","#\u7279\u6B8A","#special","#\u7279\u6B8A\u7B49\u540C","#speciale","#\u6807\u8BB0","#tag","#\u683C\u5F0F\u5316\u65E5\u671F","#\u65E5\u671F\u683C\u5F0F\u5316","#formatdate","#dateformat","#invoke","#while","#dowhile","#loop","#forargs","#fornumargs","#\u975E\u7A7A\u5F0F","#\u82E5","#\u5982\u679C","#if","#\u76F8\u540C\u5F0F","#\u5339\u914D\u5F0F","#\u82E5\u76F8\u7B49","#\u5982\u679C\u76F8\u7B49","#ifeq","#\u591A\u9009\u5F0F","#\u591A\u6761\u4EF6\u5F0F","#\u53CC\u5C04\u5F0F","#\u5F00\u5173","#\u8F6C\u6362","#switch","#\u5B58\u5728\u5F0F","#\u82E5\u6709","#\u5982\u6709","#ifexist","#\u82E5\u8868\u8FBE\u5F0F","#ifexpr","#\u9519\u8BEF\u5F0F","#\u5982\u679C\u9519\u8BEF","#iferror","#\u65F6\u95F4","#time","#\u65F6\u95F4l","#timel","#\u8BA1\u7B97\u5F0F","#\u8868\u8FBE\u5F0F","#expr","#rel2abs","#\u6807\u9898\u7EC4\u6210\u90E8\u5206","#titleparts","#categorytree","#url\u89E3\u7801","#urldecode","#choose","#\u8C03\u7528","#var","#varexists","#var_final","#vardefine","#vardefineecho","#\u5C0F\u5DE5\u5177","#widget","\u6761\u76EE\u8DEF\u5F84","articlepath","\u670D\u52A1\u5668","server","\u670D\u52A1\u5668\u540D","servername","\u811A\u672C\u8DEF\u5F84","scriptpath","\u6837\u5F0F\u8DEF\u5F84","stylepath","msgnw","#related","#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:","interwiki":[],"img":{"thumbnail":"thumbnail","thumb":"thumbnail","\u7F29\u7565\u56FE":"thumbnail","thumbnail=$1":"manualthumb","thumb=$1":"manualthumb","\u7F29\u7565\u56FE=$1":"manualthumb","left":"left","\u5DE6":"left","right":"right","\u53F3":"right","none":"none","\u65E0":"none","$1px":"width","$1\u50CF\u7D20":"width","center":"center","centre":"center","\u5C45\u4E2D":"center","framed":"framed","enframed":"framed","frame":"framed","\u6709\u6846":"framed","frameless":"frameless","\u65E0\u6846":"frameless","upright":"upright","\u53F3\u4E0A":"upright","upright=$1":"manual-upright","upright $1":"manual-upright","\u53F3\u4E0A=$1":"manual-upright","\u53F3\u4E0A$1":"manual-upright","border":"border","\u8FB9\u6846":"border","alt=$1":"alt","\u66FF\u4EE3=$1":"alt","\u66FF\u4EE3\u6587\u672C=$1":"alt","class=$1":"class","\u7C7B=$1":"class","link=$1":"link","\u94FE\u63A5=$1":"link","baseline":"baseline","\u57FA\u7EBF":"baseline","sub":"sub","\u5B50":"sub","super":"super","sup":"super","\u8D85":"super","top":"top","\u9876\u90E8":"top","text-top":"text-top","\u6587\u5B57\u9876\u90E8":"text-top","middle":"middle","\u4E2D\u95F4":"middle","bottom":"bottom","\u5E95\u90E8":"bottom","text-bottom":"text-bottom","\u6587\u5B57\u5E95\u90E8":"text-bottom","lang=$1":"lang","\u8BED\u8A00=$1":"lang","page=$1":"page","page $1":"page","\u9875\u6570=$1":"page","$1\u9875":"page"},"variants":["zh","zh-hans","zh-hant","zh-cn","zh-tw","zh-hk","zh-sg","zh-my","zh-mo"]}')}},L={};function j(m){var C=L[m];if(C!==void 0)return C.exports;var e=L[m]={exports:{}};return R[m](e,e.exports,j),e.exports}j.o=(m,C)=>Object.prototype.hasOwnProperty.call(m,C);var K=j(6010)})();})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wikiparser-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.2-b",
|
|
4
4
|
"description": "A Node.js parser for MediaWiki markup with AST",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mediawiki",
|
|
@@ -14,31 +14,28 @@
|
|
|
14
14
|
"license": "GPL-3.0",
|
|
15
15
|
"author": "Bhsd",
|
|
16
16
|
"files": [
|
|
17
|
-
"/
|
|
18
|
-
"/parser/",
|
|
19
|
-
"/util/",
|
|
20
|
-
"/lib/",
|
|
21
|
-
"/src/",
|
|
22
|
-
"/config/",
|
|
23
|
-
"/mixin/",
|
|
24
|
-
"/tool/"
|
|
17
|
+
"/bundle/bundle.min.js"
|
|
25
18
|
],
|
|
19
|
+
"browser": "/bundle/bundle.min.js",
|
|
26
20
|
"repository": {
|
|
27
21
|
"type": "git",
|
|
28
22
|
"url": "git+https://github.com/bhsd-harry/wikiparser-node.git"
|
|
29
23
|
},
|
|
30
24
|
"scripts": {
|
|
31
|
-
"test": "
|
|
32
|
-
"real": "node test/real.js"
|
|
25
|
+
"test": "webpack && eslint ."
|
|
33
26
|
},
|
|
34
27
|
"devDependencies": {
|
|
35
28
|
"@types/node": "^17.0.23",
|
|
29
|
+
"types-mediawiki": "^1.2.0",
|
|
30
|
+
"webpack-cli": "^4.10.0",
|
|
31
|
+
"webpack": "^5.73.0",
|
|
32
|
+
"esbuild-loader": "^2.20.0",
|
|
36
33
|
"eslint": "^8.30.0",
|
|
37
34
|
"eslint-plugin-n": "^15.6.0",
|
|
35
|
+
"eslint-plugin-es-x": "^5.4.0",
|
|
38
36
|
"eslint-plugin-regexp": "^1.11.0",
|
|
39
37
|
"eslint-plugin-unicorn": "^45.0.2",
|
|
40
|
-
"eslint-plugin-jsdoc": "^1.0.0"
|
|
41
|
-
"request": "^2.88.2"
|
|
38
|
+
"eslint-plugin-jsdoc": "^1.0.0"
|
|
42
39
|
},
|
|
43
40
|
"engines": {
|
|
44
41
|
"node": "^18.4.0"
|
package/README.md
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
[](https://www.npmjs.com/package/wikiparser-node)
|
|
2
|
-
|
|
3
|
-
# 简介
|
|
4
|
-
wikiparser-node 是一款由 Bhsd 开发的基于 [Node.js](https://nodejs.org/en/) 环境的离线[维基文本](https://www.mediawiki.org/wiki/Wikitext)语法解析器,可以解析绝大部分的维基语法并生成[语法树](https://en.wikipedia.org/wiki/Abstract_syntax_tree),还可以很方便地对语法树进行查询和修改,最后返回修改后的维基文本。语法树的每个节点对应一个仿照 [HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement) 类设计的类 [Token](https://github.com/bhsd-harry/wikiparser-node/wiki/01.-Token)。
|
|
5
|
-
|
|
6
|
-
# 使用方法
|
|
7
|
-
|
|
8
|
-
```js
|
|
9
|
-
var Parser = require('wikiparser-node');
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
更多文档请查阅 [Wiki](https://github.com/bhsd-harry/wikiparser-node/wiki)。
|
|
13
|
-
|
|
14
|
-
# 目录
|
|
15
|
-
|
|
16
|
-
1. [Parser](https://github.com/bhsd-harry/wikiparser-node/wiki/Home#parser)
|
|
17
|
-
2. [AstElement](https://github.com/bhsd-harry/wikiparser-node/wiki/01.-Token#astelement)
|
|
18
|
-
3. [Token](https://github.com/bhsd-harry/wikiparser-node/wiki/01.-Token#token)
|
|
19
|
-
4. [CommentToken](https://github.com/bhsd-harry/wikiparser-node/wiki/02.-CommentToken等#commenttoken)
|
|
20
|
-
5. [ExtToken](https://github.com/bhsd-harry/wikiparser-node/wiki/03.-ExtToken)
|
|
21
|
-
6. [AttributeToken](https://github.com/bhsd-harry/wikiparser-node/wiki/04.-AttributeToken)
|
|
22
|
-
7. [HeadingToken](https://github.com/bhsd-harry/wikiparser-node/wiki/05.-HeadingToken)
|
|
23
|
-
8. [ArgToken](https://github.com/bhsd-harry/wikiparser-node/wiki/06.-ArgToken)
|
|
24
|
-
9. [TranscludeToken](https://github.com/bhsd-harry/wikiparser-node/wiki/07.-TranscludeToken)
|
|
25
|
-
10. [ParameterToken](https://github.com/bhsd-harry/wikiparser-node/wiki/08.-ParameterToken)
|
|
26
|
-
11. [HtmlToken](https://github.com/bhsd-harry/wikiparser-node/wiki/09.-HtmlToken)
|
|
27
|
-
12. [TableToken](https://github.com/bhsd-harry/wikiparser-node/wiki/10.-TableToken)
|
|
28
|
-
13. [TdToken](https://github.com/bhsd-harry/wikiparser-node/wiki/11.-TdToken)
|
|
29
|
-
14. [DoubleUnderscoreToken](https://github.com/bhsd-harry/wikiparser-node/wiki/12.-DoubleUnderscoreToken)
|
|
30
|
-
15. [LinkToken](https://github.com/bhsd-harry/wikiparser-node/wiki/13.-LinkToken)
|
|
31
|
-
16. [CategoryToken](https://github.com/bhsd-harry/wikiparser-node/wiki/14.-CategoryToken)
|
|
32
|
-
17. [FileToken](https://github.com/bhsd-harry/wikiparser-node/wiki/15.-FileToken和GalleryImageToken#filetoken)
|
|
33
|
-
18. [ImageParameterToken](https://github.com/bhsd-harry/wikiparser-node/wiki/16.-ImageParameterToken)
|
|
34
|
-
19. [ExtLinkToken](https://github.com/bhsd-harry/wikiparser-node/wiki/17.-ExtLinkToken和MagicLinkToken#extlinktoken)
|
|
35
|
-
20. [MagicLinkToken](https://github.com/bhsd-harry/wikiparser-node/wiki/17.-ExtLinkToken和MagicLinkToken#magiclinktoken)
|
|
36
|
-
21. [ConverterToken](https://github.com/bhsd-harry/wikiparser-node/wiki/18.-ConverterToken)
|
|
37
|
-
22. [ConverterRuleToken](https://github.com/bhsd-harry/wikiparser-node/wiki/19.-ConverterRuleToken)
|
|
38
|
-
23. [选择器](https://github.com/bhsd-harry/wikiparser-node/wiki/20.-选择器)
|
|
39
|
-
24. [$ (TokenCollection)](https://github.com/bhsd-harry/wikiparser-node/wiki/21.-$-(TokenCollection))
|