!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).wtfHtml=e()}(this,(function(){"use strict";const t={title:!0,infoboxes:!0,headers:!0,sections:!0,links:!0},e=function(e){let n="";return!0===(e=Object.assign({},t,e)).title&&this._title&&(n+=""+this._title+"\n"),!0===this.isRedirect()?(n+=function(t){let e=t.redirectTo(),n=e.page;return n="./"+n.replace(/ /g,"_"),e.anchor&&(n+="#"+e.anchor),`
\n ↳ ${e.text}\n
`}(this),n):(!0===e.infoboxes&&(n+=this.infoboxes().map((t=>t.html(e))).join("\n")),!0!==e.sections&&!0!==e.paragraphs&&!0!==e.sentences||(n+=this.sections().map((t=>t.html(e))).join("\n")),!0===e.references&&(n+="

References

",n+=this.references().map((t=>t.html(e))).join("\n")),n)},n={headers:!0,images:!0,tables:!0,lists:!0,paragraphs:!0},i=function(t){t=Object.assign({},n,t);let e="";if(!0===t.headers&&this.title()){let t=1+this.depth();e+=" "+this.title()+"",e+="\n"}if(!0===t.images){let n=this.images();n.length>0&&(e+=n.map((e=>e.html(t))).join("\n"))}return!0===t.tables&&(e+=this.tables().map((e=>e.html(t))).join("\n")),!0===t.lists&&(e+=this.lists().map((e=>e.html(t))).join("\n")),!0===t.paragraphs&&this.paragraphs().length>0?(e+='
\n',this.paragraphs().forEach((n=>{e+='

\n',e+=" "+n.sentences().map((e=>e.html(t))).join(" "),e+="\n

\n"})),e+="
\n"):!0===t.sentences&&(e+=" "+this.sentences().map((e=>e.html(t))).join(" ")),'
\n'+e+"
\n"},s={sentences:!0},a=function(t){let e="";return!0===(t=Object.assign({},s,t)).sentences&&(e+=this.sentences().map((e=>e.html(t))).join("\n")),e};const l=function(t,e,n){if(!e||!t)return t;"number"==typeof t&&(t=String(t)),e=e.replace(/[\-[\]/{}()*+?.\\^$|]/g,"\\$&");let i=new RegExp("\\b"+e+"\\b");return t=!0===i.test(t)?t.replace(i,n):t.replace(e,n)},r={links:!0,formatting:!0},h=function(t){t=Object.assign({},r,t);let e=this.text();return!0===t.links&&this.links().forEach((t=>{let n=t.text()||t.page(),i=t.html();e=l(e,n,i)})),!0===t.formatting&&(this.bolds().forEach((t=>{e=l(e,t,""+t+"")})),this.italics().forEach((t=>{e=l(e,t,""+t+"")}))),''+e+""},o=function(){let t=this.href();return t=t.replace(/ /g,"_"),`${this.text()||this.page()}`},c={images:!0},d={image:!0,caption:!0,alt:!0,signature:!0,"signature alt":!0},p=function(t){t=Object.assign({},c,t);let e='\n';if(e+=" \n",e+=" \n",e+=" \n",!0===t.images&&this.data.image){if(e+=" \n",e+=' \n",this.data.caption||this.data.alt){let n=this.data.caption?this.data.caption.html(t):this.data.alt.html(t);e+=' \n"}e+=" \n"}return Object.keys(this.data).forEach((n=>{if(!0===d[n])return;let i=this.data[n],s=n.replace(/_/g," ");s=s.charAt(0).toUpperCase()+s.substring(1);let a=i.html(t);e+=" \n",e+=" \n",e+=" \n",e+=" \n"})),e+=" \n",e+="
\n',e+=" "+this.image().html()+"\n",e+=" \n',e+=" "+n+"\n",e+="
"+s+""+a+"
\n",e},f=function(){return' '+this.alt()+''},m=function(t){let e=' \n",e},u=function(t){if(this.data&&this.data.url&&this.data.title){let e=this.data.title;return!0===t.links&&(e=`${e}`),`
⌃ ${e}
`}if(this.data.encyclopedia)return`
⌃ ${this.data.encyclopedia}
`;if(this.data.title){let t=this.data.title;return this.data.author&&(t+=this.data.author),this.data.first&&this.data.last&&(t+=this.data.first+" "+this.data.last),`
⌃ ${t}
`}return this.inline?`
⌃ ${this.inline.html()}
`:""},g=function(t){let e=this.data,n='\n';return n+=" \n",n+=" \n",Object.keys(e[0]).forEach((t=>{!0!==/^col[0-9]/.test(t)&&(n+=" \n")})),n+=" \n",n+=" \n",n+=" \n",e.forEach((e=>{n+=" \n",Object.keys(e).forEach((i=>{let s=e[i].html(t);n+=" \n"})),n+=" \n"})),n+=" \n",n+="
"+t+"
"+s+"
\n",n};return function(t){t.Doc.prototype.html=e,t.Section.prototype.html=i,t.Paragraph.prototype.html=a,t.Sentence.prototype.html=h,t.Image.prototype.html=f,t.Infobox.prototype.html=p,t.Link.prototype.html=o,t.List.prototype.html=m,t.Reference.prototype.html=u,t.Table.prototype.html=g}}));