diff --git a/assets/bundled/bbcode-parser.min.js b/assets/bundled/bbcode-parser.min.js index f35a8a5..e33e3fb 100644 --- a/assets/bundled/bbcode-parser.min.js +++ b/assets/bundled/bbcode-parser.min.js @@ -1,3 +1,3 @@ /* Source code in bbcode-src */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).bbcodeParser={})}(this,(function(t){"use strict";const e="\n",n="\t",s="=",r='"',o=" ",i="[",a="]",c="/",l="\\";function u(t){return"object"==typeof t&&null!==t&&"tag"in t}function d(t){return"string"==typeof t}function g(t,e,n){return Object.keys(t).reduce(((n,s)=>e(n,s,t)),n)}function h(t){return u(t)&&Array.isArray(t.content)?t.content.reduce(((t,e)=>t+h(e)),0):d(t)?String(t).length:0}function p(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/(javascript|data|vbscript):/gi,"$1%3A")}function f(t,e){switch(typeof e){case"boolean":return e?`${t}`:"";case"number":return`${t}="${e}"`;case"string":return`${t}="${p(e)}"`;case"object":return`${t}="${p(JSON.stringify(e))}"`;default:return""}}function b(t){return null==t?"":g(t,((t,e,n)=>[...t,f(e,n[e])]),[""]).join(" ")}const m=(t,e)=>{const n=g(e||{},((t,e,n)=>n[e]===e?n[e]:null),null);if(n){const s=f(t,n),r={...e};delete r[String(n)];return`${s}${b(r)}`}return`${t}${b(e)}`};class y{attr(t,e){return void 0!==e&&(this.attrs[t]=e),this.attrs[t]}append(t){return function(t,e){Array.isArray(t.content)&&t.content.push(e)}(this,t)}get length(){return h(this)}toTagStart({openTag:t=i,closeTag:e=a}={}){return`${t}${m(this.tag,this.attrs)}${e}`}toTagEnd({openTag:t=i,closeTag:e=a}={}){return`${t}${c}${this.tag}${e}`}toTagNode(){return new y(this.tag.toLowerCase(),this.attrs,this.content)}toString({openTag:t=i,closeTag:e=a}={}){const n=this.content?((t,e,n)=>{const s=t=>u(t)?t.toString({openTag:e,closeTag:n}):String(t);return Array.isArray(t)?t.reduce(((t,e)=>null!==e?t+s(e):t),""):t?s(t):null})(this.content,t,e):"",s=this.toTagStart({openTag:t,closeTag:e});return null===this.content||Array.isArray(this.content)&&0===this.content.length?s:`${s}${n}${this.toTagEnd({openTag:t,closeTag:e})}`}static create(t,e={},n=null){return new y(t,e,n)}static isOf(t,e){return t.tag===e}constructor(t,e,n){this.tag=t,this.attrs=e,this.content=n}}const v="t",w=t=>t&&void 0!==t.v?t.v:"",x=t=>w(t).charCodeAt(0)===c.charCodeAt(0);class ${get type(){return this[v]}isEmpty(){return 0===this[v]||isNaN(this[v])}isText(){return!(!(t=this)||void 0===t[v]||5!==t[v]&&6!==t[v]&&1!==t[v]);var t}isTag(){return!(!(t=this)||void 0===t[v])&&2===t[v];var t}isAttrName(){return!(!(t=this)||void 0===t[v])&&3===t[v];var t}isAttrValue(){return!(!(t=this)||void 0===t[v])&&4===t[v];var t}isStart(){return!x(this)}isEnd(){return x(this)}getName(){return(t=>{const e=w(t);return x(t)?e.slice(1):e})(this)}getValue(){return w(this)}getLine(){return(t=this)&&t.l||0;var t}getColumn(){return(t=this)&&t.r||0;var t}toString(){return(t=>{let e=i;return e+=w(t),e+=a,e})(this)}constructor(t,e,n=0,s=0){this.l=n,this.r=s,this[v]=t||0,this.v=String(e)}}const k=1,T=2,A=3,_=4,j=5,C=6;class S{skip(t=1,e){this.c.pos+=t,this.o&&this.o.onSkip&&!e&&this.o.onSkip()}hasNext(){return this.c.len>this.c.pos}getCurr(){return void 0===this.s[this.c.pos]?"":this.s[this.c.pos]}getRest(){return this.s.substring(this.c.pos)}getNext(){const t=this.c.pos+1;return t<=this.s.length-1?this.s[t]:null}getPrev(){const t=this.c.pos-1;return void 0===this.s[t]?null:this.s[t]}isLast(){return this.c.pos===this.c.len}includes(t){return this.s.indexOf(t,this.c.pos)>=0}grabWhile(t,e){let n=0;if(this.hasNext())for(n=this.c.pos;this.hasNext()&&t(this.getCurr());)this.skip(1,e);return this.s.substring(n,this.c.pos)}grabN(t=0){return this.s.substring(this.c.pos,this.c.pos+t)}substrUntilChar(t){const{pos:e}=this.c,n=this.s.indexOf(t,e);return n>=0?this.s.substring(e,n):""}constructor(t,e={}){this.s=t,this.c={pos:0,len:t.length},this.o=e}}const L=(t,e)=>new S(t,e),O="!";const N=0,E=1,W=2,I=0,U=1,V=2,D=[o,n],G=[s,o,n],q=t=>D.indexOf(t)>=0,z=t=>t===l,M=t=>G.indexOf(t)>=0,B=t=>t===e,P=t=>((t,e)=>{for(;t.charAt(0)===e;)t=t.substring(1);for(;t.charAt(t.length-1)===e;)t=t.substring(0,t.length-1);return t})(t,r).replace(l+r,r);function R(t,u={}){let d=0,g=0,h=-1,p=N,f=I,b="";const m=new Array(Math.floor(t.length)),y=u.openTag||i,v=u.closeTag||a,w=!!u.enableEscapeTags,x=(u.contextFreeTags||[]).filter(Boolean).map((t=>t.toLowerCase())),S=new Map,D=u.onToken||(()=>{}),G=[v,y,r,l,o,n,s,e,O],R=[y,o,n,e],F=t=>G.indexOf(t)>=0,J=t=>-1===R.indexOf(t),Z=t=>t===y||t===v||t===l,H=()=>{g++},K=(t,e)=>{""!==b&&e&&(b=""),""===b&&x.includes(t.toLowerCase())&&(b=t)},Q=L(t,{onSkip:H});function X(t,e){const n=function(t,e,n=0,s=0){return new $(t,e,n,s)}(t,e,d,g);D(n),h+=1,m[h]=n}function Y(t,e){if(f===U){const e=t=>!(t===s||q(t)),n=t.grabWhile(e),r=t.isLast(),o=t.getCurr()!==s;return t.skip(),r||o?X(_,P(n)):X(A,n),r?I:o?U:V}if(f===V){let n=!1;const o=o=>{const i=o===r,a=t.getPrev(),c=t.getNext(),u=a===l,d=c===s,g=q(o),h=c&&q(c);return!(!n||!M(o))||!!(!i||u||(n=!n,n||d||h))&&(!!e||!g)},i=t.grabWhile(o);return t.skip(),X(_,P(i)),t.isLast()?I:U}const n=t.grabWhile((e=>!(e===s||q(e)||t.isLast())));if(X(T,n),K(n),t.skip(),e)return V;return t.includes(s)?U:V}function tt(){const t=Q.getCurr(),e=Q.getNext();Q.skip();const n=Q.substrUntilChar(v),r=0===n.length||n.indexOf(y)>=0;if(e&&F(e)||r||Q.isLast())return X(k,t),N;const o=-1===n.indexOf(s),i=n[0]===c;if(o||i){const t=Q.grabWhile((t=>t!==v));return Q.skip(),X(T,t),K(t,i),N}return W}function et(){const t=Q.grabWhile((t=>t!==v),!0),e=L(t,{onSkip:H}),n=e.includes(o);for(f=I;e.hasNext();)f=Y(e,!n);return Q.skip(),N}function nt(){if(B(Q.getCurr()))return X(C,Q.getCurr()),Q.skip(),g=0,d++,N;if(q(Q.getCurr())){const t=Q.grabWhile(q);return X(j,t),N}if(Q.getCurr()===y){if(b){const t=y.length+c.length+b.length,e=`${y}${c}${b}`;if(Q.grabN(t)===e)return E}else if(Q.includes(v))return E;return X(k,Q.getCurr()),Q.skip(),N}if(w){if(z(Q.getCurr())){const t=Q.getCurr(),e=Q.getNext();return Q.skip(),e&&Z(e)?(Q.skip(),X(k,e),N):(X(k,t),N)}const t=t=>J(t)&&!z(t),e=Q.grabWhile(t);return X(k,e),N}const t=Q.grabWhile(J);return X(k,t),N}return{tokenize:function(){for(p=N;Q.hasNext();)switch(p){case E:p=tt();break;case W:p=et();break;default:p=nt()}return m.length=h+1,m},isTokenNested:function(e){const n=y+c+e.getValue();if(S.has(n))return!!S.get(n);{const e=t.indexOf(n)>-1;return S.set(n,e),e}}}}class F{last(){return Array.isArray(this.n)&&this.n.length>0&&void 0!==this.n[this.n.length-1]?this.n[this.n.length-1]:null}flush(){return!!this.n.length&&this.n.pop()}push(t){this.n.push(t)}toArray(){return this.n}constructor(){this.n=[]}}const J=()=>new F;function Z(t,e={}){const n=e,s=n.openTag||i,r=n.closeTag||a,o=(n.onlyAllowTags||[]).filter(Boolean).map((t=>t.toLowerCase()));let c=null;const l=J(),d=J(),g=J(),h=J(),p=new Set;function f(t){return Boolean(p.has(t))}function b(){g.flush()&&h.flush()}function m(){const t=d.last();return t&&u(t)?t.content:l.toArray()}function v(t,e,n=!0){Array.isArray(t)&&void 0!==e&&(t.push(e.toTagStart({openTag:s,closeTag:r})),Array.isArray(e.content)&&e.content.length&&(e.content.forEach((e=>{t.push(e)})),n&&t.push(e.toTagEnd({openTag:s,closeTag:r}))))}function w(t,e){var n;Array.isArray(t)&&void 0!==e&&(u(e)?(n=e.tag,!o.length||o.indexOf(n.toLowerCase())>=0?t.push(e.toTagNode()):v(t,e)):t.push(e))}function x(t){b();const e=y.create(t.getValue(),{},[]),n=function(t){const e=t.getValue(),{isTokenNested:n}=c||{};return!p.has(e)&&n&&n(t)?(p.add(e),!0):p.has(e)}(t);if(g.push(e),n)d.push(e);else{w(m(),e)}}function $(t){t.isStart()&&x(t),t.isEnd()&&function(t){b();const e=d.flush();if(e)w(m(),e);else if("function"==typeof n.onError){const e=t.getValue(),s=t.getLine(),r=t.getColumn();n.onError({tagName:e,lineNumber:s,columnNumber:r})}}(t)}const k=e.createTokenizer?e.createTokenizer:R;c=k(t,{onToken:function(t){t.isTag()?$(t):function(t){const e=g.last(),n=t.getValue(),s=f(t.toString()),r=m();if(null!==e)if(t.isAttrName()){h.push(n);const t=h.last();t&&e.attr(t,"")}else if(t.isAttrValue()){const t=h.last();t?(e.attr(t,n),h.flush()):e.attr(n,n)}else t.isText()?s?e.append(n):w(r,n):t.isTag()&&w(r,t.toString());else t.isText()?w(r,n):t.isTag()&&w(r,t.toString())}(t)},openTag:s,closeTag:r,onlyAllowTags:n.onlyAllowTags,contextFreeTags:n.contextFreeTags,enableEscapeTags:n.enableEscapeTags}),c.tokenize();const T=d.flush();return null!==T&&T&&u(T)&&f(T.tag)&&v(m(),T,!1),l.toArray()}const H=t=>"object"==typeof t&&null!==t,K=t=>"boolean"==typeof t;function Q(t,e){const n=t;if(Array.isArray(n))for(let t=0;t[].some.call(e,(e=>X(t,e))))):!(!H(t)||!H(e))&&Object.keys(t).every((n=>{const s=e[n],r=t[n];return H(r)&&H(s)?X(r,s):K(r)?r!==(null===s):s===r})):t===e)}function Y(t,e){const n=t;return n.messages=[...n.messages||[]],n.options={...e,...n.options},n.walk=function(t){return Q(this,t)},n.match=function(t,e){return function(t,e,n){return Array.isArray(e)?Q(t,(t=>{for(let s=0;sX(e,t)?n(t):t))}(this,t,e)},n}const tt="/>",et="";function rt(t,e){const{stripTags:n=!1}=e||{};if(null==t)return"";if("string"==typeof t||"number"==typeof t)return String(t);if(Array.isArray(t))return ot(t,e);if(u(t)){if(n)return ot(t.content,e);const s=b(t.attrs);return null===t.content?nt+t.tag+s+tt:nt+t.tag+s+st+ot(t.content,e)+et+t.tag+st}return""}function ot(t,e){return t&&Array.isArray(t)?t.reduce(((t,n)=>t+rt(n,e)),""):t?rt(t,e):""}const it=(t,e,n=[])=>({tag:t,attrs:e,content:n,gen:!0}),at=t=>{const e=Object.keys(t).join(" "),n=Object.values(t).join(" ");return e===n?{_default:n}:t},ct=t=>{if(!t.attrs)return`[${t.tag}]`;const e=at(t.attrs);return e._default?`[${t.tag}=${e._default}]`:t.toTagStart()},lt=(t,e,n)=>{const s=t.substring(n||0).search(e);return s>=0?s+(n||0):s},ut="\x3c!-- bbcode injected newlines --\x3e\n\n",dt="\n\n\x3c!-- bbcode pre injected newlines --\x3e",gt="\x3c!-- bbcode injected newlines --\x3e",ht=new RegExp(`^${/(http|ftp|https|upload):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])/.source}|${/\!?\[.*\]\((http|ftp|https|upload):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])\)/.source}$`),pt=/((\n|^)(?```+|~~~+)(?.*\n))|(?\[(?i?code|plain)(=.*)?\])|(?(?`{1,2})(.*)(?\k))/im,ft=/^(\|[^\n]+\|\r?\n)((?:\| ?:?[-]+:? ?)+\|)(\n(?:\|[^\n]+\|\r?\n?)*)?$/m;function bt(){let t=(new Date).getTime();return window.performance&&"function"==typeof window.performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))}const mt=t=>"string"==typeof t,yt=(t,n=!1)=>{const s=t;if(Array.isArray(s)){s.some(mt)&&(s.unshift(ut),s.push(ut));for(let t=0;t{const e=t;if(Array.isArray(e))for(let t=0;t1&&" "===e[0]){let t=e.length;return[String.fromCharCode(160).repeat(t)]}return e};function wt(t,e,n,s){return e.walk((e=>{if(u(e)){const r=e.tag,o=t[r];if("function"==typeof o)return o(e,n,s)}return e}))}const xt=Symbol("slide-title-open"),$t=Symbol("slide-title-close"),kt=Symbol("slide-close"),Tt=/(?\{slide=)|(?\})|(?\{\/slide\})/i;function At(t){switch(t){case xt:return"{slide=";case $t:return"}";case kt:return"{/slide}";default:return t}}const _t={accordion:t=>{const e=bt(),n=function(t){t=[...t];const e=[];for(;t.length>0;){const n=t[0];if(u(n)){e.push(t.shift());continue}const s=lt(n,Tt);if(-1===s){e.push(t.shift());continue}const r=n.match(Tt),o=n.slice(0,s),i=n.slice(s+r[0].length);o.length&&e.push(o),r.groups.slideTitleOpen&&e.push(xt),r.groups.slideTitleClose&&e.push($t),r.groups.slideClose&&e.push(kt),i.length?t[0]=i:t.shift()}return e}(t.content),s=function(t){const e=[];let n=null,s=null;for(const r of t)if(r===xt&&null===s)n=y.create("slide"),n.content=[],n.customTitle=[],s=xt;else{if(r===$t&&s===xt){s=$t;continue}r===kt&&n&&s===$t?(e.push(n),n=null,s=null):n?s===xt?n.customTitle.push(At(r)):n.content.push(At(r)):e.push(At(r))}return e}(n),r=s.filter((t=>u(t)&&"slide"===t.tag)).map((t=>(t.isValid=!0,t.groupId=e,t)));if(!r.length)return[ct(t),...t.content,t.toTagEnd()];const o=at(t.attrs);if(o._default){const t=o._default.split("|").map((t=>t.trim()));t.includes("bright")&&(o.bright=!0),t.includes("bcenter")&&(o.bcenter=!0),t.includes("bleft")&&(o.bleft=!0),t.includes("fleft")&&(o.fleft=!0),t.includes("fright")&&(o.fright=!0),(t.some((t=>t.endsWith("px")))||t.some((t=>t.endsWith("%"))))&&(o.width=t.find((t=>t.endsWith("px")||t.endsWith("%"))))}let i=Object.keys(o).filter((t=>["bright","bcenter","bleft","fleft","fright"].includes(t))).join(" "),a="";return(o.width?.endsWith("px")||o.width?.endsWith("%"))&&(a=`width: ${o.width};`),it("div",{class:"bb-accordion "+i,"data-group-id":e,style:a},r)},slide:t=>{if(!t.isValid)return[ct(t),...t.content,t.toTagEnd()];const e=at(t.attrs);let n=[e.title||e._default||"Slide"],s=!!e.open||!1,r=e.left?"left":e.right?"right":e.center?"center":"left";if(t.customTitle?.length){n=t.customTitle;const e=n.filter((t=>"string"==typeof t)).join("").toLowerCase().split("|").map((t=>t.trim()));e.includes("open")&&(s=!0),e.includes("right")&&(r="right"),e.includes("center")&&(r="center"),e.includes("left")&&(r="left"),n=n.map((t=>(d(t)&&(t=t.replace(/\|(open|right|center|left)/gi,"")),t)))}return[it("details",{class:"bb-slide",open:s},[it("summary",{class:"bb-slide-title",style:`text-align: ${r}; ${e.style||""}`},n),it("div",{class:"bb-slide-content"},t.content)])]}},jt={left:t=>it("div",{class:"bb-left"},t.content),center:t=>it("div",{class:"bb-center"},t.content),right:t=>it("div",{class:"bb-right"},t.content)},Ct={a:t=>{const e=at(t.attrs)._default||"";return it("a",{id:`user-anchor-${e.trim()}`,name:`user-anchor-${e.trim()}`},t.content)},goto:t=>{const e=at(t.attrs)._default||"";return it("a",{href:`#user-anchor-${e.trim()}`},t.content)}},St=["arial","book antiqua","courier new","georgia","tahoma","times new roman","trebuchet ms","verdana"],Lt={thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},Ot=["ital","opsz","slnt","wdth","wght"],Nt=/(?[a-zA-Z]*)?\s?(?[0-9]*)?\s?(?italic)?/;const Et=it("div",{class:"bb-email-header"},""),Wt=it("div",{class:"bb-email-footer"},it("div",{class:"bb-email-button"},"")),It=["init","click","change","input","dblclick","mouseenter","mouseleave","scroll"];const Ut=["me","them","right","left"],Vt={..._t,...jt,...Ct,animation:(t,e)=>{e.data.previewing||e.data.commonGUID||(e.data.commonGUID="post-"+Math.random().toString(36).substring(2,7));const n=e.data.previewing?"preview":e.data.commonGUID,s=at(t.attrs)?._default||"",r=t.content.filter((t=>u(t)&&"keyframe"===t.tag)).map((t=>{t.isValid=!0;const e=at(t.attrs)._default||"";t.ident=e+(e.match(/^\d+$/)?"%":"");const n=t.content.filter(d).join("").replaceAll(/[\[\]\{\}]/g,"");return t.formatted=`${t.ident}{ ${n} }`,t})),o=`@keyframes ${n}${s} { ${r.map((t=>t.formatted)).join("\n")} }`;return e.data.styles.push(o),[]},bg:t=>{const e=at(t.attrs)._default;return it("div",{style:`background-color: ${e};`,class:"bb-background"},t.content)},block:t=>{const e="block",n=(at(t.attrs)._default||e).toLowerCase(),s=["block","dice","dice10","setting","warning","storyteller","announcement","important","question","encounter","information","character","treasure"].includes(n)?n:e;return it("table",{class:"bb-block","data-bb-block":s},[it("tbody",[it("tr",[it("td",{class:"bb-block-icon"}),it("td",{class:"bb-block-content"},t.content)])])])},blockquote:t=>{const e=at(t.attrs)._default||"";return it("div",{class:"bb-blockquote"},[it("div",{class:"bb-blockquote-left"}),it("div",{class:"bb-blockquote-content"},[t.content,it("div",{class:"bb-blockquote-speaker"},""!==e?`- ${e}`:"")]),it("div",{class:"bb-blockquote-right"})])},border:t=>{const e=at(t.attrs)._default;return it("div",{style:`border: ${e};`,class:"bb-border"},t.content)},br:()=>it("br",{},null),centerblock:t=>{const e=at(t.attrs)._default||"50";return it("div",{style:`margin: 0 auto; width: ${e}%`},t.content)},check:t=>{const e=at(t.attrs)._default||"dot";return it("div",{class:"bb-check","data-type":e},t.content)},class:(t,e)=>{const n=at(t.attrs),s=n.name||n._default;e.data.previewing||e.data.commonGUID||(e.data.commonGUID="post-"+Math.random().toString(36).substring(2,7));const r=e.data.previewing?"preview":e.data.commonGUID,o=s+"__"+r,i=t.content.filter(d).map((t=>t.replaceAll("{post_id}",r).replaceAll(/[\[\]\{\}]/g,"")));let a="";const c=[];return["hover","focus","active","focus-within","focus-visible"].includes(n.state?.toLowerCase())&&(a=":"+n.state.toLowerCase()),n.selector&&(a=n.selector.replace(/[,{}\\\n]/g,"")),n.minWidth?.match(/^[0-9]+[a-z]+$/)&&c.push(`(min-width: ${n.minWidth})`),n.maxWidth?.match(/^[0-9]+[a-z]+$/)&&c.push(`(max-width: ${n.maxWidth})`),i.unshift(`.${o}${a} {`),i.push("}"),c.length&&(i.unshift(`@media ${c.join(" and ")} {`),i.push("}")),e.data.styles.push(i.join("")),[]},code:t=>({isWhitespaceSensitive:!0,content:["```"+(at(t.attrs)._default||"bbcode")+"\n",t.content,"\n```\n"]}),color:t=>{const e=at(t.attrs)._default||"";return""===e.trim()?t.content:it("span",{style:`color: ${e}`},t.content)},comment:t=>it("span",{class:"hidden"},t.content),div:(t,e)=>{if(t.gen)return t;const n=at(t.attrs),s=n.style||n._default,r=n.class;if(!r?.trim())return it("div",{style:s},t.content);e.data.previewing||e.data.commonGUID||(e.data.commonGUID="post-"+Math.random().toString(36).substring(2,7));const o=e.data.previewing?"preview":e.data.commonGUID,i=r.split(" ").map((t=>t+"__"+o)).join(" ");return it("div",{class:i,style:s},t.content)},divide:t=>{const e=(at(t.attrs)._default||"").toLowerCase();return it("span",{class:"bb-divide","data-type":e},t.content)},fieldset:t=>{const e=at(t.attrs)._default||"";return it("fieldset",{class:"bb-fieldset"},[it("legend",{class:"bb-fieldset-legend"},e),it("div",{class:"bb-fieldset"},t.content)])},fa:t=>{const e=at(t.attrs);let n=e.style||"";return n+=e["primary-color"]?`--fa-primary-color: ${e["primary-color"]};`:"",n+=e["secondary-color"]?`--fa-secondary-color: ${e["secondary-color"]};`:"",n+=e["primary-opacity"]?`--fa-primary-opacity: ${e["primary-opacity"]};`:"",n+=e["secondary-opacity"]?`--fa-secondary-opacity: ${e["secondary-opacity"]};`:"",n+=e["rotate-angle"]?`--fa-rotate-angle: ${e["rotate-angle"]};`:"",it("i",{"data-bbcode-fa":null},[it("i",{class:(t.content||[]).join(""),style:n,"data-fa-transform":e["fa-transform"]||""},[])])},font:(t,e)=>{const n=at(t.attrs),s=n?._default||n.family||n.name;if(""===s.trim())return t.content;if(St.includes(s.trim().toLowerCase()))return it("span",{style:"font-family: "+s},t.content);const r=(t=>{let e={ital:0,wght:400};if(t?.style){const n=t.style.trim().toLowerCase(),s=Nt.exec(n).groups||{};s?.italic&&(e.ital=1);const r=s.weight;r&&r>=0&&r<=900?e.wght=r:Object.keys(Lt).includes(s.named_weight||"")&&(e.wght=Lt[s.named_weight]),e={...e,...Object.fromEntries(Object.entries(t).filter((([t])=>Ot.includes(t))))}}return e})(n),o=((t,e)=>(t=t.replaceAll(" ","+"),e=Object.keys(e).sort().reduce(((t,n)=>(t[n]=e[n],t)),{}),"https://fonts.googleapis.com/css2?family="+t+":"+Object.keys(e).join(",")+"@"+Object.values(e).join(",")))(s,r);e.data.fonts.add(o);const i=1===r.ital?"italic":"normal",a=Object.entries(r).filter((([t])=>"wght"!==t&&"ital"!==t));let c="";return a.length&&(c="font-variation-settings: "+a.map((([t,e])=>`'${t}' ${e}`)).join(", ")+";"),it("span",{style:`font-family: ${s}; font-weight: ${r.wght}; font-style: ${i}; ${c}`,"data-font":o},t.content)},h:t=>it("h1",{},t.content),h1:t=>it("h1",{},t.content),h2:t=>it("h2",{},t.content),h3:t=>it("h3",{},t.content),h4:t=>it("h4",{},t.content),h5:t=>it("h5",{},t.content),h6:t=>it("h6",{},t.content),heightrestrict:t=>{const e=function(t){const e=t&&""!==t.trim()?t.replace(/[^\d.]/g,""):0;return e&&e>=0&&e<=700?e:0===e?0:700}(at(t.attrs)._default).toString();return it("div","0"===e?{class:"bb-height-restrict"}:{class:"bb-height-restrict",style:`height: ${e}px;`},t.content)},highlight:t=>it("span",{class:"bb-highlight"},t.content),icode:t=>({isWhitespaceSensitive:!0,content:["`",t.content,"`"]}),imagefloat:t=>{const e=at(t.attrs)._default||"";return it("div",{class:`bb-float-${e}`},t.content)},inlinespoiler:t=>it("span",{class:"bb-inline-spoiler"},t.content),justify:t=>it("div",{class:"bb-justify"},t.content),keyframe:t=>t.isValid?[]:[ct(t),...t.content,t.toTagEnd()],mail:t=>{const e=at(t.attrs);let n={mailOption:(e.type||"send").toLowerCase(),person:e.person||"Unknown",subject:e.subject||"Empty"};return it("div",{class:"bb-email","data-bb-email":n.mailOption},[Et,(o=n.person,it("div",{class:"bb-email-address"},o)),(r=n.subject,it("div",{class:"bb-email-subject"},r)),(s=t.content,it("div",{class:"bb-email-content"},s)),Wt]);var s,r,o},newspaper:t=>it("div",{class:"bb-newspaper"},t.content),nobr:t=>({disableLineBreakConversion:!0,content:t.content}),note:t=>it("div",{class:"bb-note"},[it("div",{class:"bb-note-tape"},""),it("div",{class:"bb-note-content"},[t.content,it("div",{class:"bb-note-footer"},"")])]),ooc:t=>it("div",{class:"bb-ooc"},t.content),pindent:t=>it("span",{class:"bb-pindent"},t.content),plain:t=>t.content,print:t=>{const e="print",n=(at(t.attrs)._default||e).toLowerCase(),s=["print","line","graph","parchment"].includes(n)?n:e;return it("div",{class:s===e?"bb-print":`bb-print-${s}`},t.content)},progress:t=>{const e=at(t.attrs)._default;return it("div",{class:"bb-progress"},[it("div",{class:"bb-progress-text"},t.content),it("div",{class:"bb-progress-bar",style:`width: calc(${e}% - 6px)`},""),it("div",{class:"bb-progress-bar-other"},"")])},quote:t=>{const e=at(t.attrs);return"\n"===t.content[0]&&t.content.shift(),[`\n[${t.tag}="${e._default}"]\n\n`,...t.content,"\n\n[/quote]\n"]},...{row:t=>it("div",{class:"bb-row"},t.content),column:t=>{const e=at(t.attrs)._default||"8",n=e.startsWith("span")?`column-width-${e}`:`column-width-span${e}`;return it("div",{class:"bb-column","data-span":n},t.content)}},thinprogress:t=>{const e=at(t.attrs)._default;return it("div",{class:"bb-progress-thin"},[it("div",{class:"bb-progress-text"},t.content),it("div",{class:"bb-progress-bar",style:`width: calc(${e}% - 6px)`},""),it("div",{class:"bb-progress-bar-other"},"")])},savenl:t=>({isWhitespaceSensitive:!0,content:t.content}),sh:t=>it("h2",{},t.content),script:(t,e)=>{const n=at(t.attrs);e.data.previewing||e.data.commonGUID||(e.data.commonGUID="post-"+Math.random().toString(36).substring(2,7));const s=e.data.previewing?"preview":e.data.commonGUID,r=It.includes(n.on?.toLowerCase()||"init")&&n.on?.toLowerCase()||"init",o={id:s,class:n.class||"",on:r,version:n.version||"",content:t.content.join("")};return e.data.bbscripts.push(o),[]},scroll:t=>{const e=function(t){const e=t&&""!==t.trim()?t.replace(/[^\d.]/g,""):0;return e&&e>=0&&e<=700?e:0===e?0:700}(at(t.attrs)._default);return it("div",{class:"bb-scroll",style:`height: ${e}px`},t.content)},side:t=>{const e=at(t.attrs)._default||"left";return it("div",{class:"bb-side","data-side":e},t.content)},size:t=>{const e=function(t){let e,n={valid:!0};const s=/(\d+\.?\d?)(px|rem)?/i.exec(t),r=36,o=8,i=3,a=.2,c=7,l=1;if(s&&(e=s[1])){switch(n.unit=(s[2]||"").toLowerCase(),n.unit){case"px":e>r?e=r:ei?e=i:ec?e=c:e{const e=at(t.attrs)._default;return it("details",{class:"bb-spoiler"},[it("summary",{},"Spoiler"+(e?`: ${e}`:"")),it("div",{class:"bb-spoiler-content"},t.content)])},sub:t=>it("sub",{},t.content),sup:t=>it("sup",{},t.content),tab:t=>{if(!t.isValid)return[ct(t),...t.content,t.toTagEnd()];const e=at(t.attrs),n=e._default||e.name||"Tab",s=`tab-${n.replace(/\W/g,"_")}-${bt()}`;return[it("input",{type:"radio",id:s,name:"tab-group-"+t.groupId,class:"bb-tab",checked:t.open}),it("label",{class:"bb-tab-label",for:s,style:e.style},n),it("div",{class:"bb-tab-content"},t.content)]},tabs:t=>{const e=t.content.filter((t=>u(t)&&"tab"===t.tag)),n=bt();return e.forEach((t=>{t.isValid=!0,t.groupId=n})),e.length?(e[0].open=!0,it("div",{class:"bb-tabs"},e)):[ct(t),...t.content,t.toTagEnd()]},...{textmessage:t=>{const e=at(t.attrs)._default||"Recipient",n=e&&""!==e.trim()?e:"Recipient";return it("div",{class:"bb-textmessage"},[it("div",{class:"bb-textmessage-name"},n),it("div",{class:"bb-textmessage-overflow"},[it("div",{class:"bb-textmessage-content"},t.content)])])},message:t=>{let e=at(t.attrs)._default.toLowerCase();Ut.includes(e)&&"right"!==e||(e="me"),"left"===e&&(e="them");return it("div",{class:"me"===e?"bb-message-me":"bb-message-them"},[it("div",{class:"bb-message-content"},t.content)])}},b:t=>it("span",{class:"bbcode-b"},t.content),i:t=>t.gen?t:it("span",{class:"bbcode-i"},t.content),u:t=>it("span",{class:"bbcode-u"},t.content),s:t=>it("span",{class:"bbcode-s"},t.content)},Dt=Object.keys(Vt),Gt=function t(e,n=wt){const s=t=>{function r(t,r){return n(e,t,r,s.options||{})}return s.options=Object.assign(s.options||{},t),r.options=s.options,r};return s.extend=function(r){return t(r(e,s.options),n)},s}(Vt);function qt(t){return t.replaceAll(ut,"").replaceAll(dt,"").replaceAll("\n"+gt,"").replaceAll(gt+"\n","").replaceAll(gt,"")}function zt(t,e){const n=e.hoistMap;for(const[e,s]of Object.entries(n))t=t.replaceAll(e,s);return t}function Mt(t,e){if(0===e.styles.length)return t;return'"+t}function Bt(t,e){if(0===e.bbscripts.length)return t;return e.bbscripts.map((t=>``)).join("")+t}function Pt(t,e){const n={};let s=0;const r=(e,s,r,o=!1)=>{const i=bt();return-1!==s?(n[i]=t.substring(e,s),t=t.substring(0,e)+i+t.substring(s)):(n[i]=t.substring(e),t=t.substring(0,e)+i+r),o&&(n[i].startsWith("\n")&&(n[i]=n[i].substring(1)),n[i].endsWith("\n")&&(n[i]=n[i].substring(0,n[i].length-1))),e+i.length+r.length};for(;-1!==(s=lt(t,pt,s));){const e=pt.exec(t.substring(s));if(e.groups?.fence){const r=e.groups.fence,o=e.groups.fenceInfo;"\n"===t[s]&&(s+=1);const i=new RegExp("\n"+r+"(\n|$)"),a=lt(t,i,s+r.length),c=bt();n[c]=-1!==a?t.substring(s+r.length+o.length,a):t.substring(s+r.length+o.length);const l=`[saveNL]\n${r}${o}${c}\n${r}\n[/saveNL]`;t=t.substring(0,s)+l+(-1!==a?t.substring(a+1+r.length):""),s+=l.length}else if(e.groups?.bbcode){const n=e.groups.bbcode,o=`[/${e.groups.bbcodeTag.toLowerCase()}]`,i=t.toLowerCase().indexOf(o,s+1);s=r(s+n.length,i,o,!0)}else if(e.groups.backtick){const t=e.groups.backtick,n=e.groups.tickStart,o=e.groups.tickEnd;s=r(s+n.length,s+t.length-o.length,o)}}return e.hoistMap=n,[t,e]}function Rt(t,e){let n=0;for(;-1!==(n=lt(t,ft,n));){const e=ft.exec(t.substring(n))[0],s=`[saveNL]\n${e}\n[/saveNL]`;t=t.substring(0,n)+s+t.substring(n+e.length),n+=s.length}return[t,e]}const Ft={onlyAllowTags:[...Dt],contextFreeTags:["plain","code","icode","class","fa"],enableEscapeTags:!0,onError:t=>{Ft.previewing&&console.warn(t.message,t.lineNumber,t.columnNumber)}},Jt=Gt();t.RpNBBCode=(t,e)=>{const n=[Jt];e.preserveWhitespace&&n.push((t=>vt(t))),n.push((t=>yt(t)));const[s,r]=function(t){let e={};const n=[Pt,Rt];for(const s of n)[t,e]=s(t,e);return[t,e]}(t);return function(t){const e="function"==typeof t?[t]:t||[],n=()=>"";return{process(t,s){const r=s||{skipParse:!1,parser:Z,render:n,data:null},o=r.parser||Z,i=r.render,a=r.data||null;if("function"!=typeof o)throw new Error("C1");const c=r.skipParse&&Array.isArray(t)?t:o(t,r);let l=r.skipParse&&Array.isArray(t)?Y(t||[],r):Y(c,r);for(let t=0;te(n,s,t)),n)}function h(t){return u(t)&&Array.isArray(t.content)?t.content.reduce(((t,e)=>t+h(e)),0):d(t)?String(t).length:0}function f(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/(javascript|data|vbscript):/gi,"$1%3A")}function p(t,e){switch(typeof e){case"boolean":return e?`${t}`:"";case"number":return`${t}="${e}"`;case"string":return`${t}="${f(e)}"`;case"object":return`${t}="${f(JSON.stringify(e))}"`;default:return""}}function b(t){return null==t?"":g(t,((t,e,n)=>[...t,p(e,n[e])]),[""]).join(" ")}const m=(t,e)=>{const n=g(e||{},((t,e,n)=>n[e]===e?n[e]:null),null);if(n){const s=p(t,n),r={...e};delete r[String(n)];return`${s}${b(r)}`}return`${t}${b(e)}`};class y{attr(t,e){return void 0!==e&&(this.attrs[t]=e),this.attrs[t]}append(t){return function(t,e){Array.isArray(t.content)&&t.content.push(e)}(this,t)}setStart(t){this.start=t}setEnd(t){this.end=t}get length(){return h(this)}toTagStart({openTag:t=i,closeTag:e=a}={}){return`${t}${m(String(this.tag),this.attrs)}${e}`}toTagEnd({openTag:t=i,closeTag:e=a}={}){return`${t}${c}${this.tag}${e}`}toTagNode(){const t=new y(String(this.tag).toLowerCase(),this.attrs,this.content);return this.start&&t.setStart(this.start),this.end&&t.setEnd(this.end),t}toString({openTag:t=i,closeTag:e=a}={}){const n=this.content?((t,e,n)=>{const s=t=>u(t)?t.toString({openTag:e,closeTag:n}):String(t);return Array.isArray(t)?t.reduce(((t,e)=>null!==e?t+s(e):t),""):t?s(t):null})(this.content,t,e):"",s=this.toTagStart({openTag:t,closeTag:e});return null===this.content||Array.isArray(this.content)&&0===this.content.length?s:`${s}${n}${this.toTagEnd({openTag:t,closeTag:e})}`}static create(t,e={},n=null,s){const r=new y(t,e,n);return s&&r.setStart(s),r}static isOf(t,e){return t.tag===e}constructor(t,e,n){this.tag=t,this.attrs=e,this.content=n}}const w="t",v=t=>t&&void 0!==t.v?t.v:"",x=t=>v(t).charCodeAt(0)===c.charCodeAt(0);class ${get type(){return this[w]}isEmpty(){return 0===this[w]||isNaN(this[w])}isText(){return!(!(t=this)||void 0===t[w]||5!==t[w]&&6!==t[w]&&1!==t[w]);var t}isTag(){return!(!(t=this)||void 0===t[w])&&2===t[w];var t}isAttrName(){return!(!(t=this)||void 0===t[w])&&3===t[w];var t}isAttrValue(){return!(!(t=this)||void 0===t[w])&&4===t[w];var t}isStart(){return!x(this)}isEnd(){return x(this)}getName(){return(t=>{const e=v(t);return x(t)?e.slice(1):e})(this)}getValue(){return v(this)}getLine(){return(t=this)&&t.l||0;var t}getColumn(){return(t=this)&&t.r||0;var t}getStart(){return(t=this)&&t.s||0;var t}getEnd(){return(t=this)&&t.e||0;var t}toString(){return(t=>{let e=i;return e+=v(t),e+=a,e})(this)}constructor(t,e,n=0,s=0,r=0,o=0){this.l=n,this.r=s,this[w]=t||0,this.v=String(e),this.s=r,this.e=o}}const k=1,T=2,A=3,S=4,_=5,j=6;class C{skip(t=1,e){this.c.pos+=t,this.o&&this.o.onSkip&&!e&&this.o.onSkip()}hasNext(){return this.c.len>this.c.pos}getCurr(){return void 0===this.s[this.c.pos]?"":this.s[this.c.pos]}getPos(){return this.c.pos}getLength(){return this.c.len}getRest(){return this.s.substring(this.c.pos)}getNext(){const t=this.c.pos+1;return t<=this.s.length-1?this.s[t]:null}getPrev(){const t=this.c.pos-1;return void 0===this.s[t]?null:this.s[t]}isLast(){return this.c.pos===this.c.len}includes(t){return this.s.indexOf(t,this.c.pos)>=0}grabWhile(t,e){let n=0;if(this.hasNext())for(n=this.c.pos;this.hasNext()&&t(this.getCurr());)this.skip(1,e);return this.s.substring(n,this.c.pos)}grabN(t=0){return this.s.substring(this.c.pos,this.c.pos+t)}substrUntilChar(t){const{pos:e}=this.c,n=this.s.indexOf(t,e);return n>=0?this.s.substring(e,n):""}constructor(t,e={}){this.s=t,this.c={pos:0,len:t.length},this.o=e}}const L=(t,e)=>new C(t,e),E="!";const O=0,N=1,W=2,I=0,U=1,V=2,D=[o,n],G=[s,o,n],q=2,z=t=>D.indexOf(t)>=0,P=t=>t===l,M=t=>G.indexOf(t)>=0,B=t=>t===e,R=t=>((t,e)=>{for(;t.charAt(0)===e;)t=t.substring(1);for(;t.charAt(t.length-1)===e;)t=t.substring(0,t.length-1);return t})(t,r).replace(l+r,r);function F(t,u={}){let d=0,g=0,h=0,f=-1,p=O,b=I,m="";const y=new Array(Math.floor(t.length)),w=u.openTag||i,v=u.closeTag||a,x=!!u.enableEscapeTags,C=(u.contextFreeTags||[]).filter(Boolean).map((t=>t.toLowerCase())),D=new Map,G=u.onToken||(()=>{}),F=[v,w,r,l,o,n,s,e,E],J=[w,o,n,e],Z=t=>F.indexOf(t)>=0,H=t=>-1===J.indexOf(t),K=t=>t===w||t===v||t===l,Q=()=>{h++},X=(t,e)=>{""!==m&&e&&(m=""),""===m&&C.includes(t.toLowerCase())&&(m=t)},Y=L(t,{onSkip:Q});function tt(t,e,n,s){const r=function(t,e,n=0,s=0,r=0,o=0){return new $(t,e,n,s,r,o)}(t,e,d,g,n,s);G(r),g=h,f+=1,y[f]=r}function et(t,e,n){if(b===U){const e=t=>!(t===s||z(t)),n=t.grabWhile(e),r=t.isLast(),o=t.getCurr()!==s;return t.skip(),r||o?tt(S,R(n)):tt(A,n),r?I:o?U:V}if(b===V){let n=!1;const o=o=>{const i=o===r,a=t.getPrev(),c=t.getNext(),u=a===l,d=c===s,g=z(o),h=c&&z(c);return!(!n||!M(o))||!!(!i||u||(n=!n,n||d||h))&&(!!e||!g)},i=t.grabWhile(o);return t.skip(),tt(S,R(i)),t.getPrev()===r&&g++,t.isLast()?I:U}const o=n+t.getPos()-1,i=t.grabWhile((e=>!(e===s||z(e)||t.isLast())));if(tt(T,i,o,n+t.getLength()+1),X(i),t.skip(),g++,e)return V;return t.includes(s)?U:V}function nt(){const t=Y.getCurr(),e=Y.getNext();Y.skip();const n=Y.substrUntilChar(v),r=0===n.length||n.indexOf(w)>=0;if(e&&Z(e)||r||Y.isLast())return tt(k,t),O;const o=-1===n.indexOf(s),i=n[0]===c;if(o||i){const t=Y.getPos()-1,e=Y.grabWhile((t=>t!==v)),n=t+e.length+q;return Y.skip(),tt(T,e,t,n),X(e,i),O}return W}function st(){const t=Y.getPos(),e=Y.grabWhile((t=>t!==v),!0),n=L(e,{onSkip:Q}),s=n.includes(o);for(b=I;n.hasNext();)b=et(n,!s,t);return Y.skip(),O}function rt(){if(B(Y.getCurr()))return tt(j,Y.getCurr()),Y.skip(),h=0,g=0,d++,O;if(z(Y.getCurr())){const t=Y.grabWhile(z);return tt(_,t),O}if(Y.getCurr()===w){if(m){const t=w.length+c.length+m.length,e=`${w}${c}${m}`;if(Y.grabN(t)===e)return N}else if(Y.includes(v))return N;return tt(k,Y.getCurr()),Y.skip(),g++,O}if(x){if(P(Y.getCurr())){const t=Y.getCurr(),e=Y.getNext();return Y.skip(),e&&K(e)?(Y.skip(),tt(k,e),O):(tt(k,t),O)}const t=t=>H(t)&&!P(t),e=Y.grabWhile(t);return tt(k,e),O}const t=Y.grabWhile(H);return tt(k,t),O}return{tokenize:function(){for(p=O;Y.hasNext();)switch(p){case N:p=nt();break;case W:p=st();break;default:p=rt()}return y.length=f+1,y},isTokenNested:function(e){const n=w+c+e.getValue();if(D.has(n))return!!D.get(n);{const e=t.indexOf(n)>-1;return D.set(n,e),e}}}}class J{last(){return Array.isArray(this.n)&&this.n.length>0&&void 0!==this.n[this.n.length-1]?this.n[this.n.length-1]:null}flush(){return!!this.n.length&&this.n.pop()}push(t){this.n.push(t)}toArray(){return this.n}constructor(){this.n=[]}}const Z=()=>new J;function H(t,e={}){const n=e,s=n.openTag||i,r=n.closeTag||a,o=(n.onlyAllowTags||[]).filter(Boolean).map((t=>t.toLowerCase()));let c=null;const l=Z(),d=Z(),g=Z(),h=Z(),f=new Set;function p(t){return Boolean(f.has(t))}function b(){g.flush()&&h.flush()}function m(){const t=d.last();return t&&u(t)?t.content:l.toArray()}function w(t,e,n=!0){Array.isArray(t)&&void 0!==e&&(t.push(e.toTagStart({openTag:s,closeTag:r})),Array.isArray(e.content)&&e.content.length&&(e.content.forEach((e=>{t.push(e)})),n&&t.push(e.toTagEnd({openTag:s,closeTag:r}))))}function v(t,e){var n;Array.isArray(t)&&void 0!==e&&(u(e)?(n=e.tag,!o.length||o.indexOf(n.toLowerCase())>=0?t.push(e.toTagNode()):w(t,e)):t.push(e))}function x(t){b();const e=y.create(t.getValue(),{},[],{from:t.getStart(),to:t.getEnd()}),n=function(t){const e=t.getValue(),{isTokenNested:n}=c||{};return!f.has(e)&&n&&n(t)?(f.add(e),!0):f.has(e)}(t);if(g.push(e),n)d.push(e);else{v(m(),e)}}function $(t){t.isStart()&&x(t),t.isEnd()&&function(t){const e=d.last();u(e)&&e.setEnd({from:t.getStart(),to:t.getEnd()}),b();const s=d.flush();if(s)v(m(),s);else if("function"==typeof n.onError){const e=t.getValue(),s=t.getLine(),r=t.getColumn();n.onError({tagName:e,lineNumber:s,columnNumber:r})}}(t)}const k=e.createTokenizer?e.createTokenizer:F;c=k(t,{onToken:function(t){t.isTag()?$(t):function(t){const e=g.last(),n=t.getValue(),s=p(t.toString()),r=m();if(null!==e)if(t.isAttrName()){h.push(n);const t=h.last();t&&e.attr(t,"")}else if(t.isAttrValue()){const t=h.last();t?(e.attr(t,n),h.flush()):e.attr(n,n)}else t.isText()?s?e.append(n):v(r,n):t.isTag()&&v(r,t.toString());else t.isText()?v(r,n):t.isTag()&&v(r,t.toString())}(t)},openTag:s,closeTag:r,onlyAllowTags:n.onlyAllowTags,contextFreeTags:n.contextFreeTags,enableEscapeTags:n.enableEscapeTags}),c.tokenize();const T=d.flush();return null!==T&&T&&u(T)&&p(T.tag)&&w(m(),T,!1),l.toArray()}const K=t=>"object"==typeof t&&null!==t,Q=t=>"boolean"==typeof t;function X(t,e){const n=t;if(Array.isArray(n))for(let t=0;t[].some.call(e,(e=>Y(t,e))))):!(!K(t)||!K(e))&&Object.keys(t).every((n=>{const s=e[n],r=t[n];return K(r)&&K(s)?Y(r,s):Q(r)?r!==(null===s):s===r})):t===e)}function tt(t,e){const n=t;return n.messages=[...n.messages||[]],n.options={...e,...n.options},n.walk=function(t){return X(this,t)},n.match=function(t,e){return function(t,e,n){return Array.isArray(e)?X(t,(t=>{for(let s=0;sY(e,t)?n(t):t))}(this,t,e)},n}const et="/>",nt="";function ot(t,e){const{stripTags:n=!1}=e||{};if(null==t)return"";if("string"==typeof t||"number"==typeof t)return String(t);if(Array.isArray(t))return it(t,e);if(u(t)){if(n)return it(t.content,e);const s=b(t.attrs);return null===t.content?st+t.tag+s+et:st+t.tag+s+rt+it(t.content,e)+nt+t.tag+rt}return""}function it(t,e){return t&&Array.isArray(t)?t.reduce(((t,n)=>t+ot(n,e)),""):t?ot(t,e):""}const at=(t,e,n=[])=>({tag:t,attrs:e,content:n,gen:!0}),ct=(t,e)=>{const n=Object.keys(t.attrs).join(" "),s=Object.values(t.attrs).join(" ");if(n!==s)return t.attrs;if(!e||!t.start)return{_default:s};const r=e.substring(t.start.from,t.start.to).split("=");if(2!==r.length)return t.attrs;let o=r[1].slice(0,-1).trim();return o.startsWith('"')&&o.endsWith('"')&&(o=o.slice(1,-1)),{_default:o}},lt=t=>{if(!t.attrs)return`[${t.tag}]`;const e=ct(t.attrs);return e._default?`[${t.tag}=${e._default}]`:t.toTagStart()},ut=(t,e,n)=>{const s=t.substring(n||0).search(e);return s>=0?s+(n||0):s},dt="\x3c!-- bbcode injected newlines --\x3e\n\n",gt="\n\n\x3c!-- bbcode pre injected newlines --\x3e",ht="\x3c!-- bbcode injected newlines --\x3e",ft=new RegExp(`^${/(http|ftp|https|upload):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])/.source}|${/\!?\[.*\]\((http|ftp|https|upload):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])\)/.source}$`),pt=/((\n|^)(?```+|~~~+)(?.*\n))|(?\[(?i?code|plain)(=.*)?\])|(?(?`{1,2})(.*)(?\k))/im,bt=/^(\|[^\n]+\|\r?\n)((?:\| ?:?[-]+:? ?)+\|)(\n(?:\|[^\n]+\|\r?\n?)*)?$/m;function mt(){let t=(new Date).getTime();return window.performance&&"function"==typeof window.performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))}const yt=t=>"string"==typeof t,wt=(t,n=!1)=>{const s=t;if(Array.isArray(s)){s.some(yt)&&(s.unshift(dt),s.push(dt));for(let t=0;t{const e=t;if(Array.isArray(e))for(let t=0;t1&&" "===e[0]){let t=e.length;return[String.fromCharCode(160).repeat(t)]}return e};function xt(t,e,n,s){return e.walk((e=>{if(u(e)){const r=e.tag,o=t[r];if("function"==typeof o)return o(e,n,s)}return e}))}const $t=Symbol("slide-title-open"),kt=Symbol("slide-title-close"),Tt=Symbol("slide-close"),At=/(?\{slide=)|(?\})|(?\{\/slide\})/i;function St(t){switch(t){case $t:return"{slide=";case kt:return"}";case Tt:return"{/slide}";default:return t}}const _t={accordion:(t,e)=>{const n=mt(),s=function(t){t=[...t];const e=[];for(;t.length>0;){const n=t[0];if(u(n)){e.push(t.shift());continue}const s=ut(n,At);if(-1===s){e.push(t.shift());continue}const r=n.match(At),o=n.slice(0,s),i=n.slice(s+r[0].length);o.length&&e.push(o),r.groups.slideTitleOpen&&e.push($t),r.groups.slideTitleClose&&e.push(kt),r.groups.slideClose&&e.push(Tt),i.length?t[0]=i:t.shift()}return e}(t.content),r=function(t){const e=[];let n=null,s=null;for(const r of t)if(r===$t&&null===s)n=y.create("slide"),n.content=[],n.customTitle=[],s=$t;else{if(r===kt&&s===$t){s=kt;continue}r===Tt&&n&&s===kt?(e.push(n),n=null,s=null):n?s===$t?n.customTitle.push(St(r)):n.content.push(St(r)):e.push(St(r))}return e}(s),o=r.filter((t=>u(t)&&"slide"===t.tag)).map((t=>(t.isValid=!0,t.groupId=n,t)));if(!o.length)return[lt(t),...t.content,t.toTagEnd()];const i=ct(t,e.data.raw);if(i._default){const t=i._default.split("|").map((t=>t.trim()));t.includes("bright")&&(i.bright=!0),t.includes("bcenter")&&(i.bcenter=!0),t.includes("bleft")&&(i.bleft=!0),t.includes("fleft")&&(i.fleft=!0),t.includes("fright")&&(i.fright=!0),(t.some((t=>t.endsWith("px")))||t.some((t=>t.endsWith("%"))))&&(i.width=t.find((t=>t.endsWith("px")||t.endsWith("%"))))}let a=Object.keys(i).filter((t=>["bright","bcenter","bleft","fleft","fright"].includes(t))).join(" "),c="";return(i.width?.endsWith("px")||i.width?.endsWith("%"))&&(c=`width: ${i.width};`),at("div",{class:"bb-accordion "+a,"data-group-id":n,style:c},o)},slide:(t,e)=>{if(!t.isValid)return[lt(t),...t.content,t.toTagEnd()];const n=ct(t,e.data.raw);let s=[n.title||n._default||"Slide"],r=!!n.open||!1,o=n.left?"left":n.right?"right":n.center?"center":"left";if(t.customTitle?.length){s=t.customTitle;const e=s.filter((t=>"string"==typeof t)).join("").toLowerCase().split("|").map((t=>t.trim()));e.includes("open")&&(r=!0),e.includes("right")&&(o="right"),e.includes("center")&&(o="center"),e.includes("left")&&(o="left"),s=s.map((t=>(d(t)&&(t=t.replace(/\|(open|right|center|left)/gi,"")),t)))}return[at("details",{class:"bb-slide",open:r},[at("summary",{class:"bb-slide-title",style:`text-align: ${o}; ${n.style||""}`},s),at("div",{class:"bb-slide-content"},t.content)])]}},jt={left:t=>at("div",{class:"bb-left"},t.content),center:t=>at("div",{class:"bb-center"},t.content),right:t=>at("div",{class:"bb-right"},t.content)},Ct={a:(t,e)=>{const n=ct(t,e.data.raw)._default||"";return at("a",{id:`user-anchor-${n.trim()}`,name:`user-anchor-${n.trim()}`},t.content)},goto:(t,e)=>{const n=ct(t,e.data.raw)._default||"";return at("a",{href:`#user-anchor-${n.trim()}`},t.content)}},Lt=["arial","book antiqua","courier new","georgia","tahoma","times new roman","trebuchet ms","verdana"],Et={thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},Ot=["ital","opsz","slnt","wdth","wght"],Nt=/(?[a-zA-Z]*)?\s?(?[0-9]*)?\s?(?italic)?/;const Wt=at("div",{class:"bb-email-header"},""),It=at("div",{class:"bb-email-footer"},at("div",{class:"bb-email-button"},"")),Ut={row:t=>at("div",{class:"bb-row"},t.content),column:(t,e)=>{const n=ct(t,e.data.raw)._default||"8",s=n.startsWith("span")?`column-width-${n}`:`column-width-span${n}`;return at("div",{class:"bb-column","data-span":s},t.content)}},Vt=["init","click","change","input","dblclick","mouseenter","mouseleave","scroll"];const Dt=["me","them","right","left"],Gt={textmessage:(t,e)=>{const n=ct(t,e.data.raw)._default||"Recipient",s=n&&""!==n.trim()?n:"Recipient";return at("div",{class:"bb-textmessage"},[at("div",{class:"bb-textmessage-name"},s),at("div",{class:"bb-textmessage-overflow"},[at("div",{class:"bb-textmessage-content"},t.content)])])},message:(t,e)=>{let n=ct(t,e.data.raw)._default.toLowerCase();Dt.includes(n)&&"right"!==n||(n="me"),"left"===n&&(n="them");return at("div",{class:"me"===n?"bb-message-me":"bb-message-them"},[at("div",{class:"bb-message-content"},t.content)])}},qt={..._t,...jt,...Ct,animation:(t,e)=>{e.data.previewing||e.data.commonGUID||(e.data.commonGUID="post-"+Math.random().toString(36).substring(2,7));const n=e.data.previewing?"preview":e.data.commonGUID,s=ct(t,e.data.raw)?._default||"",r=t.content.filter((t=>u(t)&&"keyframe"===t.tag)).map((t=>{t.isValid=!0;const n=ct(t,e.data.raw)._default||"";t.ident=n+(n.match(/^\d+$/)?"%":"");const s=t.content.filter(d).join("").replaceAll(/[\[\]\{\}]/g,"");return t.formatted=`${t.ident}{ ${s} }`,t})),o=`@keyframes ${n}${s} { ${r.map((t=>t.formatted)).join("\n")} }`;return e.data.styles.push(o),[]},bg:(t,e)=>{const n=ct(t,e.data.raw)._default;return at("div",{style:`background-color: ${n};`,class:"bb-background"},t.content)},block:(t,e)=>{const n="block",s=(ct(t,e.data.raw)._default||n).toLowerCase(),r=["block","dice","dice10","setting","warning","storyteller","announcement","important","question","encounter","information","character","treasure"].includes(s)?s:n;return at("table",{class:"bb-block","data-bb-block":r},[at("tbody",[at("tr",[at("td",{class:"bb-block-icon"}),at("td",{class:"bb-block-content"},t.content)])])])},blockquote:(t,e)=>{const n=ct(t,e.data.raw)._default||"";return at("div",{class:"bb-blockquote"},[at("div",{class:"bb-blockquote-left"}),at("div",{class:"bb-blockquote-content"},[t.content,at("div",{class:"bb-blockquote-speaker"},""!==n?`- ${n}`:"")]),at("div",{class:"bb-blockquote-right"})])},border:(t,e)=>{const n=ct(t,e.data.raw)._default;return at("div",{style:`border: ${n};`,class:"bb-border"},t.content)},br:()=>at("br",{},null),centerblock:(t,e)=>{const n=ct(t,e.data.raw)._default||"50";return at("div",{style:`margin: 0 auto; width: ${n}%`},t.content)},check:(t,e)=>{const n=ct(t,e.data.raw)._default||"dot";return at("div",{class:"bb-check","data-type":n},t.content)},class:(t,e)=>{const n=ct(t),s=n.name||n._default;e.data.previewing||e.data.commonGUID||(e.data.commonGUID="post-"+Math.random().toString(36).substring(2,7));const r=e.data.previewing?"preview":e.data.commonGUID,o=s+"__"+r,i=t.content.filter(d).map((t=>t.replaceAll("{post_id}",r).replaceAll(/[\[\]\{\}]/g,"")));let a="";const c=[];return["hover","focus","active","focus-within","focus-visible"].includes(n.state?.toLowerCase())&&(a=":"+n.state.toLowerCase()),n.selector&&(a=n.selector.replace(/[,{}\\\n]/g,"")),n.minWidth?.match(/^[0-9]+[a-z]+$/)&&c.push(`(min-width: ${n.minWidth})`),n.maxWidth?.match(/^[0-9]+[a-z]+$/)&&c.push(`(max-width: ${n.maxWidth})`),i.unshift(`.${o}${a} {`),i.push("}"),c.length&&(i.unshift(`@media ${c.join(" and ")} {`),i.push("}")),e.data.styles.push(i.join("")),[]},code:t=>({isWhitespaceSensitive:!0,content:["```"+(ct(t)._default||"bbcode")+"\n",t.content,"\n```\n"]}),color:t=>{const e=ct(t)._default||"";return""===e.trim()?t.content:at("span",{style:`color: ${e}`},t.content)},comment:t=>at("span",{class:"hidden"},t.content),div:(t,e)=>{if(t.gen)return t;const n=ct(t,e.data.raw),s=n.style||n._default,r=n.class;if(!r?.trim())return at("div",{style:s},t.content);e.data.previewing||e.data.commonGUID||(e.data.commonGUID="post-"+Math.random().toString(36).substring(2,7));const o=e.data.previewing?"preview":e.data.commonGUID,i=r.split(" ").map((t=>t+"__"+o)).join(" ");return at("div",{class:i,style:s},t.content)},divide:t=>{const e=(ct(t)._default||"").toLowerCase();return at("span",{class:"bb-divide","data-type":e},t.content)},fieldset:(t,e)=>{const n=ct(t,e.data.raw)._default||"";return at("fieldset",{class:"bb-fieldset"},[at("legend",{class:"bb-fieldset-legend"},n),at("div",{class:"bb-fieldset"},t.content)])},fa:t=>{const e=t.attrs;let n=e.style||"";return n+=e["primary-color"]?`--fa-primary-color: ${e["primary-color"]};`:"",n+=e["secondary-color"]?`--fa-secondary-color: ${e["secondary-color"]};`:"",n+=e["primary-opacity"]?`--fa-primary-opacity: ${e["primary-opacity"]};`:"",n+=e["secondary-opacity"]?`--fa-secondary-opacity: ${e["secondary-opacity"]};`:"",n+=e["rotate-angle"]?`--fa-rotate-angle: ${e["rotate-angle"]};`:"",at("i",{"data-bbcode-fa":null},[at("i",{class:(t.content||[]).join(""),style:n,"data-fa-transform":e["fa-transform"]||""},[])])},font:(t,e)=>{const n=ct(t,e.data.raw),s=n?._default||n.family||n.name;if(""===s.trim())return t.content;if(Lt.includes(s.trim().toLowerCase()))return at("span",{style:`font-family: '${s}'`},t.content);const r=(t=>{let e={ital:0,wght:400};if(t?.style){const n=t.style.trim().toLowerCase(),s=Nt.exec(n).groups||{};s?.italic&&(e.ital=1);const r=s.weight;r&&r>=0&&r<=900?e.wght=r:Object.keys(Et).includes(s.named_weight||"")&&(e.wght=Et[s.named_weight]),e={...e,...Object.fromEntries(Object.entries(t).filter((([t])=>Ot.includes(t))))}}return e})(n),o=((t,e)=>(t=t.replaceAll(" ","+"),e=Object.keys(e).sort().reduce(((t,n)=>(t[n]=e[n],t)),{}),"https://fonts.googleapis.com/css2?family="+t+":"+Object.keys(e).join(",")+"@"+Object.values(e).join(",")))(s,r);e.data.fonts.add(o);const i=1===r.ital?"italic":"normal",a=Object.entries(r).filter((([t])=>"wght"!==t&&"ital"!==t));let c="";return a.length&&(c="font-variation-settings: "+a.map((([t,e])=>`'${t}' ${e}`)).join(", ")+";"),at("span",{style:`font-family: '${s}'; font-weight: ${r.wght}; font-style: ${i}; ${c}`,"data-font":o},t.content)},h:t=>at("h1",{},t.content),h1:t=>at("h1",{},t.content),h2:t=>at("h2",{},t.content),h3:t=>at("h3",{},t.content),h4:t=>at("h4",{},t.content),h5:t=>at("h5",{},t.content),h6:t=>at("h6",{},t.content),heightrestrict:t=>{const e=function(t){const e=t&&""!==t.trim()?t.replace(/[^\d.]/g,""):0;return e&&e>=0&&e<=700?e:0===e?0:700}(ct(t)._default).toString();return at("div","0"===e?{class:"bb-height-restrict"}:{class:"bb-height-restrict",style:`height: ${e}px;`},t.content)},highlight:t=>at("span",{class:"bb-highlight"},t.content),icode:t=>({isWhitespaceSensitive:!0,content:["`",t.content,"`"]}),imagefloat:t=>{const e=ct(t)._default||"";return at("div",{class:`bb-float-${e}`},t.content)},inlinespoiler:t=>at("span",{class:"bb-inline-spoiler"},t.content),justify:t=>at("div",{class:"bb-justify"},t.content),keyframe:t=>t.isValid?[]:[lt(t),...t.content,t.toTagEnd()],mail:t=>{const e=t.attrs;let n={mailOption:(e.type||"send").toLowerCase(),person:e.person||"Unknown",subject:e.subject||"Empty"};return at("div",{class:"bb-email","data-bb-email":n.mailOption},[Wt,(o=n.person,at("div",{class:"bb-email-address"},o)),(r=n.subject,at("div",{class:"bb-email-subject"},r)),(s=t.content,at("div",{class:"bb-email-content"},s)),It]);var s,r,o},newspaper:t=>at("div",{class:"bb-newspaper"},t.content),nobr:t=>({disableLineBreakConversion:!0,content:t.content}),note:t=>at("div",{class:"bb-note"},[at("div",{class:"bb-note-tape"},""),at("div",{class:"bb-note-content"},[t.content,at("div",{class:"bb-note-footer"},"")])]),ooc:t=>at("div",{class:"bb-ooc"},t.content),pindent:t=>at("span",{class:"bb-pindent"},t.content),plain:t=>t.content,print:t=>{const e="print",n=(ct(t)._default||e).toLowerCase(),s=["print","line","graph","parchment"].includes(n)?n:e;return at("div",{class:s===e?"bb-print":`bb-print-${s}`},t.content)},progress:t=>{const e=ct(t)._default;return at("div",{class:"bb-progress"},[at("div",{class:"bb-progress-text"},t.content),at("div",{class:"bb-progress-bar",style:`width: calc(${e}% - 6px)`},""),at("div",{class:"bb-progress-bar-other"},"")])},quote:(t,e)=>{const n=ct(t,e.data.raw);return"\n"===t.content[0]&&t.content.shift(),[`\n[${t.tag}="${n._default}"]\n\n`,...t.content,"\n\n[/quote]\n"]},...Ut,thinprogress:(t,e)=>{const n=ct(t,e.data.raw)._default;return at("div",{class:"bb-progress-thin"},[at("div",{class:"bb-progress-text"},t.content),at("div",{class:"bb-progress-bar",style:`width: calc(${n}% - 6px)`},""),at("div",{class:"bb-progress-bar-other"},"")])},savenl:t=>({isWhitespaceSensitive:!0,content:t.content}),sh:t=>at("h2",{},t.content),script:(t,e)=>{const n=ct(t,e.data.raw);e.data.previewing||e.data.commonGUID||(e.data.commonGUID="post-"+Math.random().toString(36).substring(2,7));const s=e.data.previewing?"preview":e.data.commonGUID,r=Vt.includes(n.on?.toLowerCase()||"init")&&n.on?.toLowerCase()||"init",o={id:s,class:n.class||"",on:r,version:n.version||"",content:t.content.join("")};return e.data.bbscripts.push(o),[]},scroll:(t,e)=>{const n=function(t){const e=t&&""!==t.trim()?t.replace(/[^\d.]/g,""):0;return e&&e>=0&&e<=700?e:0===e?0:700}(ct(t,e.data.raw)._default);return at("div",{class:"bb-scroll",style:`height: ${n}px`},t.content)},side:t=>{const e=ct(t)._default||"left";return at("div",{class:"bb-side","data-side":e},t.content)},size:t=>{const e=function(t){let e,n={valid:!0};const s=/(\d+\.?\d?)(px|rem)?/i.exec(t),r=36,o=8,i=3,a=.2,c=7,l=1;if(s&&(e=s[1])){switch(n.unit=(s[2]||"").toLowerCase(),n.unit){case"px":e>r?e=r:ei?e=i:ec?e=c:e{const n=ct(t,e.data.raw)._default;return at("details",{class:"bb-spoiler"},[at("summary",{},"Spoiler"+(n?`: ${n}`:"")),at("div",{class:"bb-spoiler-content"},t.content)])},sub:t=>at("sub",{},t.content),sup:t=>at("sup",{},t.content),tab:(t,e)=>{if(!t.isValid)return[lt(t),...t.content,t.toTagEnd()];const n=ct(t,e.data.raw),s=n._default||n.name||"Tab",r=`tab-${s.replace(/\W/g,"_")}-${mt()}`;return[at("input",{type:"radio",id:r,name:"tab-group-"+t.groupId,class:"bb-tab",checked:t.open}),at("label",{class:"bb-tab-label",for:r,style:n.style},s),at("div",{class:"bb-tab-content"},t.content)]},tabs:t=>{const e=t.content.filter((t=>u(t)&&"tab"===t.tag)),n=mt();return e.forEach((t=>{t.isValid=!0,t.groupId=n})),e.length?(e[0].open=!0,at("div",{class:"bb-tabs"},e)):[lt(t),...t.content,t.toTagEnd()]},...Gt,b:t=>at("span",{class:"bbcode-b"},t.content),i:t=>t.gen?t:at("span",{class:"bbcode-i"},t.content),u:t=>at("span",{class:"bbcode-u"},t.content),s:t=>at("span",{class:"bbcode-s"},t.content)},zt=Object.keys(qt),Pt=function t(e,n=xt){const s=t=>{function r(t,r){return n(e,t,r,s.options||{})}return s.options=Object.assign(s.options||{},t),r.options=s.options,r};return s.extend=function(r){return t(r(e,s.options),n)},s}(qt);function Mt(t){return t.replaceAll(dt,"").replaceAll(gt,"").replaceAll("\n"+ht,"").replaceAll(ht+"\n","").replaceAll(ht,"")}function Bt(t,e){const n=e.hoistMap;for(const[e,s]of Object.entries(n))t=t.replaceAll(e,s);return t}function Rt(t,e){if(0===e.styles.length)return t;return'"+t}function Ft(t,e){if(0===e.bbscripts.length)return t;return e.bbscripts.map((t=>``)).join("")+t}function Jt(t,e){const n={};let s=0;const r=(e,s,r,o=!1)=>{const i=mt();return-1!==s?(n[i]=t.substring(e,s),t=t.substring(0,e)+i+t.substring(s)):(n[i]=t.substring(e),t=t.substring(0,e)+i+r),o&&(n[i].startsWith("\n")&&(n[i]=n[i].substring(1)),n[i].endsWith("\n")&&(n[i]=n[i].substring(0,n[i].length-1))),e+i.length+r.length};for(;-1!==(s=ut(t,pt,s));){const e=pt.exec(t.substring(s));if(e.groups?.fence){const r=e.groups.fence,o=e.groups.fenceInfo;"\n"===t[s]&&(s+=1);const i=new RegExp("\n"+r+"(\n|$)"),a=ut(t,i,s+r.length),c=mt();n[c]=-1!==a?t.substring(s+r.length+o.length,a):t.substring(s+r.length+o.length);const l=`[saveNL]\n${r}${o}${c}\n${r}\n[/saveNL]`;t=t.substring(0,s)+l+(-1!==a?t.substring(a+1+r.length):""),s+=l.length}else if(e.groups?.bbcode){const n=e.groups.bbcode,o=`[/${e.groups.bbcodeTag.toLowerCase()}]`,i=t.toLowerCase().indexOf(o,s+1);s=r(s+n.length,i,o,!0)}else if(e.groups.backtick){const t=e.groups.backtick,n=e.groups.tickStart,o=e.groups.tickEnd;s=r(s+n.length,s+t.length-o.length,o)}}return e.hoistMap=n,[t,e]}function Zt(t,e){let n=0;for(;-1!==(n=ut(t,bt,n));){const e=bt.exec(t.substring(n))[0],s=`[saveNL]\n${e}\n[/saveNL]`;t=t.substring(0,n)+s+t.substring(n+e.length),n+=s.length}return[t,e]}const Ht={onlyAllowTags:[...zt],contextFreeTags:["plain","code","icode","class","fa"],enableEscapeTags:!0,onError:t=>{Ht.previewing&&console.warn(t.message,t.lineNumber,t.columnNumber)}},Kt=Pt();t.RpNBBCode=(t,e)=>{const n=[Kt];e.preserveWhitespace&&n.push((t=>vt(t))),n.push((t=>wt(t)));const[s,r]=function(t){let e={};const n=[Jt,Zt];for(const s of n)[t,e]=s(t,e);return[t,e]}(t);return function(t){const e="function"==typeof t?[t]:t||[],n=()=>"";return{process(t,s){const r=s||{skipParse:!1,parser:H,render:n,data:null},o=r.parser||H,i=r.render,a=r.data||null;if("function"!=typeof o)throw new Error("C1");const c=r.skipParse&&Array.isArray(t)?t:o(t,r);let l=r.skipParse&&Array.isArray(t)?tt(t||[],r):tt(c,r);for(let t=0;treduce(acc, key, obj), def);\n}\nfunction getNodeLength(node) {\n if (isTagNode(node) && Array.isArray(node.content)) {\n return node.content.reduce((count, contentNode)=>{\n return count + getNodeLength(contentNode);\n }, 0);\n }\n if (isStringNode(node)) {\n return String(node).length;\n }\n return 0;\n}\nfunction appendToNode(node, value) {\n if (Array.isArray(node.content)) {\n node.content.push(value);\n }\n}\n/**\n * Replaces \" to &qquot;\n * @param {string} value\n */ function escapeAttrValue(value) {\n return value.replace(/&/g, '&').replace(//g, '>').replace(/\"/g, '"').replace(/'/g, ''')// eslint-disable-next-line no-script-url\n .replace(/(javascript|data|vbscript):/gi, '$1%3A');\n}\n/**\n * @deprecated use escapeAttrValue\n */ const escapeHTML = escapeAttrValue;\n/**\n * Accept name and value and return valid html5 attribute string\n */ function attrValue(name, value) {\n // in case of performance\n switch(typeof value){\n case 'boolean':\n return value ? `${name}` : '';\n case 'number':\n return `${name}=\"${value}\"`;\n case 'string':\n return `${name}=\"${escapeAttrValue(value)}\"`;\n case 'object':\n return `${name}=\"${escapeAttrValue(JSON.stringify(value))}\"`;\n default:\n return '';\n }\n}\n/**\n * Transforms attrs to html params string\n * @example\n * attrsToString({ 'foo': true, 'bar': bar' }) => 'foo=\"true\" bar=\"bar\"'\n */ function attrsToString(values) {\n // To avoid some malformed attributes\n if (values == null) {\n return '';\n }\n return keysReduce(values, (arr, key, obj)=>[\n ...arr,\n attrValue(key, obj[key])\n ], [\n ''\n ]).join(' ');\n}\n/**\n * Gets value from\n * @example\n * getUniqAttr({ 'foo': true, 'bar': bar' }) => 'bar'\n */ function getUniqAttr(attrs) {\n return keysReduce(attrs || {}, (res, key, obj)=>obj[key] === key ? obj[key] : null, null);\n}\nexport { attrsToString, attrValue, appendToNode, escapeHTML, escapeAttrValue, getNodeLength, getUniqAttr, isTagNode, isStringNode, isEOL };\n","import { OPEN_BRAKET, CLOSE_BRAKET, SLASH } from './char';\nimport { getUniqAttr, getNodeLength, appendToNode, attrsToString, attrValue, isTagNode } from './helpers';\nconst getTagAttrs = (tag, params)=>{\n const uniqAttr = getUniqAttr(params);\n if (uniqAttr) {\n const tagAttr = attrValue(tag, uniqAttr);\n const attrs = {\n ...params\n };\n delete attrs[String(uniqAttr)];\n const attrsStr = attrsToString(attrs);\n return `${tagAttr}${attrsStr}`;\n }\n return `${tag}${attrsToString(params)}`;\n};\nconst renderContent = (content, openTag, closeTag)=>{\n const toString = (node)=>{\n if (isTagNode(node)) {\n return node.toString({\n openTag,\n closeTag\n });\n }\n return String(node);\n };\n if (Array.isArray(content)) {\n return content.reduce((r, node)=>{\n if (node !== null) {\n return r + toString(node);\n }\n return r;\n }, '');\n }\n if (content) {\n return toString(content);\n }\n return null;\n};\nexport class TagNode {\n attr(name, value) {\n if (typeof value !== 'undefined') {\n this.attrs[name] = value;\n }\n return this.attrs[name];\n }\n append(value) {\n return appendToNode(this, value);\n }\n get length() {\n return getNodeLength(this);\n }\n toTagStart({ openTag = OPEN_BRAKET, closeTag = CLOSE_BRAKET } = {}) {\n const tagAttrs = getTagAttrs(this.tag, this.attrs);\n return `${openTag}${tagAttrs}${closeTag}`;\n }\n toTagEnd({ openTag = OPEN_BRAKET, closeTag = CLOSE_BRAKET } = {}) {\n return `${openTag}${SLASH}${this.tag}${closeTag}`;\n }\n toTagNode() {\n return new TagNode(this.tag.toLowerCase(), this.attrs, this.content);\n }\n toString({ openTag = OPEN_BRAKET, closeTag = CLOSE_BRAKET } = {}) {\n const content = this.content ? renderContent(this.content, openTag, closeTag) : '';\n const tagStart = this.toTagStart({\n openTag,\n closeTag\n });\n if (this.content === null || Array.isArray(this.content) && this.content.length === 0) {\n return tagStart;\n }\n return `${tagStart}${content}${this.toTagEnd({\n openTag,\n closeTag\n })}`;\n }\n static create(tag, attrs = {}, content = null) {\n return new TagNode(tag, attrs, content);\n }\n static isOf(node, type) {\n return node.tag === type;\n }\n constructor(tag, attrs, content){\n this.tag = tag;\n this.attrs = attrs;\n this.content = content;\n }\n}\n","import { OPEN_BRAKET, CLOSE_BRAKET, SLASH } from '@bbob/plugin-helper';\n// type, value, line, row,\nconst TOKEN_TYPE_ID = 't'; // 0;\nconst TOKEN_VALUE_ID = 'v'; // 1;\nconst TOKEN_COLUMN_ID = 'r'; // 2;\nconst TOKEN_LINE_ID = 'l'; // 3;\nconst TOKEN_TYPE_WORD = 1; // 'word';\nconst TOKEN_TYPE_TAG = 2; // 'tag';\nconst TOKEN_TYPE_ATTR_NAME = 3; // 'attr-name';\nconst TOKEN_TYPE_ATTR_VALUE = 4; // 'attr-value';\nconst TOKEN_TYPE_SPACE = 5; // 'space';\nconst TOKEN_TYPE_NEW_LINE = 6; // 'new-line';\nconst getTokenValue = (token)=>{\n if (token && typeof token[TOKEN_VALUE_ID] !== 'undefined') {\n return token[TOKEN_VALUE_ID];\n }\n return '';\n};\nconst getTokenLine = (token)=>token && token[TOKEN_LINE_ID] || 0;\nconst getTokenColumn = (token)=>token && token[TOKEN_COLUMN_ID] || 0;\nconst isTextToken = (token)=>{\n if (token && typeof token[TOKEN_TYPE_ID] !== 'undefined') {\n return token[TOKEN_TYPE_ID] === TOKEN_TYPE_SPACE || token[TOKEN_TYPE_ID] === TOKEN_TYPE_NEW_LINE || token[TOKEN_TYPE_ID] === TOKEN_TYPE_WORD;\n }\n return false;\n};\nconst isTagToken = (token)=>{\n if (token && typeof token[TOKEN_TYPE_ID] !== 'undefined') {\n return token[TOKEN_TYPE_ID] === TOKEN_TYPE_TAG;\n }\n return false;\n};\nconst isTagEnd = (token)=>getTokenValue(token).charCodeAt(0) === SLASH.charCodeAt(0);\nconst isTagStart = (token)=>!isTagEnd(token);\nconst isAttrNameToken = (token)=>{\n if (token && typeof token[TOKEN_TYPE_ID] !== 'undefined') {\n return token[TOKEN_TYPE_ID] === TOKEN_TYPE_ATTR_NAME;\n }\n return false;\n};\nconst isAttrValueToken = (token)=>{\n if (token && typeof token[TOKEN_TYPE_ID] !== 'undefined') {\n return token[TOKEN_TYPE_ID] === TOKEN_TYPE_ATTR_VALUE;\n }\n return false;\n};\nconst getTagName = (token)=>{\n const value = getTokenValue(token);\n return isTagEnd(token) ? value.slice(1) : value;\n};\nconst tokenToText = (token)=>{\n let text = OPEN_BRAKET;\n text += getTokenValue(token);\n text += CLOSE_BRAKET;\n return text;\n};\n/**\n * @export\n * @class Token\n */ class Token {\n get type() {\n return this[TOKEN_TYPE_ID];\n }\n isEmpty() {\n return this[TOKEN_TYPE_ID] === 0 || isNaN(this[TOKEN_TYPE_ID]);\n }\n isText() {\n return isTextToken(this);\n }\n isTag() {\n return isTagToken(this);\n }\n isAttrName() {\n return isAttrNameToken(this);\n }\n isAttrValue() {\n return isAttrValueToken(this);\n }\n isStart() {\n return isTagStart(this);\n }\n isEnd() {\n return isTagEnd(this);\n }\n getName() {\n return getTagName(this);\n }\n getValue() {\n return getTokenValue(this);\n }\n getLine() {\n return getTokenLine(this);\n }\n getColumn() {\n return getTokenColumn(this);\n }\n toString() {\n return tokenToText(this);\n }\n constructor(type, value, row = 0, col = 0){\n this[TOKEN_LINE_ID] = row;\n this[TOKEN_COLUMN_ID] = col;\n this[TOKEN_TYPE_ID] = type || 0;\n this[TOKEN_VALUE_ID] = String(value);\n }\n}\nexport const TYPE_ID = TOKEN_TYPE_ID;\nexport const VALUE_ID = TOKEN_VALUE_ID;\nexport const LINE_ID = TOKEN_LINE_ID;\nexport const COLUMN_ID = TOKEN_COLUMN_ID;\nexport const TYPE_WORD = TOKEN_TYPE_WORD;\nexport const TYPE_TAG = TOKEN_TYPE_TAG;\nexport const TYPE_ATTR_NAME = TOKEN_TYPE_ATTR_NAME;\nexport const TYPE_ATTR_VALUE = TOKEN_TYPE_ATTR_VALUE;\nexport const TYPE_SPACE = TOKEN_TYPE_SPACE;\nexport const TYPE_NEW_LINE = TOKEN_TYPE_NEW_LINE;\nexport { Token };\nexport default Token;\n","import { QUOTEMARK, BACKSLASH } from '@bbob/plugin-helper';\nexport class CharGrabber {\n skip(num = 1, silent) {\n this.c.pos += num;\n if (this.o && this.o.onSkip && !silent) {\n this.o.onSkip();\n }\n }\n hasNext() {\n return this.c.len > this.c.pos;\n }\n getCurr() {\n if (typeof this.s[this.c.pos] === 'undefined') {\n return '';\n }\n return this.s[this.c.pos];\n }\n getRest() {\n return this.s.substring(this.c.pos);\n }\n getNext() {\n const nextPos = this.c.pos + 1;\n return nextPos <= this.s.length - 1 ? this.s[nextPos] : null;\n }\n getPrev() {\n const prevPos = this.c.pos - 1;\n if (typeof this.s[prevPos] === 'undefined') {\n return null;\n }\n return this.s[prevPos];\n }\n isLast() {\n return this.c.pos === this.c.len;\n }\n includes(val) {\n return this.s.indexOf(val, this.c.pos) >= 0;\n }\n grabWhile(condition, silent) {\n let start = 0;\n if (this.hasNext()) {\n start = this.c.pos;\n while(this.hasNext() && condition(this.getCurr())){\n this.skip(1, silent);\n }\n }\n return this.s.substring(start, this.c.pos);\n }\n grabN(num = 0) {\n return this.s.substring(this.c.pos, this.c.pos + num);\n }\n /**\n * Grabs rest of string until it find a char\n */ substrUntilChar(char) {\n const { pos } = this.c;\n const idx = this.s.indexOf(char, pos);\n return idx >= 0 ? this.s.substring(pos, idx) : '';\n }\n constructor(source, options = {}){\n this.s = source;\n this.c = {\n pos: 0,\n len: source.length\n };\n this.o = options;\n }\n}\n/**\n * Creates a grabber wrapper for source string, that helps to iterate over string char by char\n */ export const createCharGrabber = (source, options)=>new CharGrabber(source, options);\n/**\n * Trims string from start and end by char\n * @example\n * trimChar('*hello*', '*') ==> 'hello'\n */ export const trimChar = (str, charToRemove)=>{\n while(str.charAt(0) === charToRemove){\n // eslint-disable-next-line no-param-reassign\n str = str.substring(1);\n }\n while(str.charAt(str.length - 1) === charToRemove){\n // eslint-disable-next-line no-param-reassign\n str = str.substring(0, str.length - 1);\n }\n return str;\n};\n/**\n * Unquotes \\\" to \"\n */ export const unquote = (str)=>str.replace(BACKSLASH + QUOTEMARK, QUOTEMARK);\n","/* eslint-disable no-plusplus,no-param-reassign */ import { OPEN_BRAKET, CLOSE_BRAKET, QUOTEMARK, BACKSLASH, SLASH, SPACE, TAB, EQ, N } from '@bbob/plugin-helper';\nimport { Token, TYPE_ATTR_NAME, TYPE_ATTR_VALUE, TYPE_NEW_LINE, TYPE_SPACE, TYPE_TAG, TYPE_WORD } from './Token';\nimport { createCharGrabber, trimChar, unquote } from './utils';\n// for cases \nconst EM = '!';\nexport function createTokenOfType(type, value, r = 0, cl = 0) {\n return new Token(type, value, r, cl);\n}\nconst STATE_WORD = 0;\nconst STATE_TAG = 1;\nconst STATE_TAG_ATTRS = 2;\nconst TAG_STATE_NAME = 0;\nconst TAG_STATE_ATTR = 1;\nconst TAG_STATE_VALUE = 2;\nconst WHITESPACES = [\n SPACE,\n TAB\n];\nconst SPECIAL_CHARS = [\n EQ,\n SPACE,\n TAB\n];\nconst isWhiteSpace = (char)=>WHITESPACES.indexOf(char) >= 0;\nconst isEscapeChar = (char)=>char === BACKSLASH;\nconst isSpecialChar = (char)=>SPECIAL_CHARS.indexOf(char) >= 0;\nconst isNewLine = (char)=>char === N;\nconst unq = (val)=>unquote(trimChar(val, QUOTEMARK));\nexport function createLexer(buffer, options = {}) {\n let row = 0;\n let col = 0;\n let tokenIndex = -1;\n let stateMode = STATE_WORD;\n let tagMode = TAG_STATE_NAME;\n let contextFreeTag = '';\n const tokens = new Array(Math.floor(buffer.length));\n const openTag = options.openTag || OPEN_BRAKET;\n const closeTag = options.closeTag || CLOSE_BRAKET;\n const escapeTags = !!options.enableEscapeTags;\n const contextFreeTags = (options.contextFreeTags || []).filter(Boolean).map((tag)=>tag.toLowerCase());\n const nestedMap = new Map();\n const onToken = options.onToken || (()=>{});\n const RESERVED_CHARS = [\n closeTag,\n openTag,\n QUOTEMARK,\n BACKSLASH,\n SPACE,\n TAB,\n EQ,\n N,\n EM\n ];\n const NOT_CHAR_TOKENS = [\n openTag,\n SPACE,\n TAB,\n N\n ];\n const isCharReserved = (char)=>RESERVED_CHARS.indexOf(char) >= 0;\n const isCharToken = (char)=>NOT_CHAR_TOKENS.indexOf(char) === -1;\n const isEscapableChar = (char)=>char === openTag || char === closeTag || char === BACKSLASH;\n const onSkip = ()=>{\n col++;\n };\n const checkContextFreeMode = (name, isClosingTag)=>{\n if (contextFreeTag !== '' && isClosingTag) {\n contextFreeTag = '';\n }\n if (contextFreeTag === '' && contextFreeTags.includes(name.toLowerCase())) {\n contextFreeTag = name;\n }\n };\n const chars = createCharGrabber(buffer, {\n onSkip\n });\n /**\n * Emits newly created token to subscriber\n * @param {Number} type\n * @param {String} value\n */ function emitToken(type, value) {\n const token = createTokenOfType(type, value, row, col);\n onToken(token);\n tokenIndex += 1;\n tokens[tokenIndex] = token;\n }\n function nextTagState(tagChars, isSingleValueTag) {\n if (tagMode === TAG_STATE_ATTR) {\n const validAttrName = (char)=>!(char === EQ || isWhiteSpace(char));\n const name = tagChars.grabWhile(validAttrName);\n const isEnd = tagChars.isLast();\n const isValue = tagChars.getCurr() !== EQ;\n tagChars.skip();\n if (isEnd || isValue) {\n emitToken(TYPE_ATTR_VALUE, unq(name));\n } else {\n emitToken(TYPE_ATTR_NAME, name);\n }\n if (isEnd) {\n return TAG_STATE_NAME;\n }\n if (isValue) {\n return TAG_STATE_ATTR;\n }\n return TAG_STATE_VALUE;\n }\n if (tagMode === TAG_STATE_VALUE) {\n let stateSpecial = false;\n const validAttrValue = (char)=>{\n // const isEQ = char === EQ;\n const isQM = char === QUOTEMARK;\n const prevChar = tagChars.getPrev();\n const nextChar = tagChars.getNext();\n const isPrevSLASH = prevChar === BACKSLASH;\n const isNextEQ = nextChar === EQ;\n const isWS = isWhiteSpace(char);\n // const isPrevWS = isWhiteSpace(prevChar);\n const isNextWS = nextChar && isWhiteSpace(nextChar);\n if (stateSpecial && isSpecialChar(char)) {\n return true;\n }\n if (isQM && !isPrevSLASH) {\n stateSpecial = !stateSpecial;\n if (!stateSpecial && !(isNextEQ || isNextWS)) {\n return false;\n }\n }\n if (!isSingleValueTag) {\n return !isWS;\n // return (isEQ || isWS) === false;\n }\n return true;\n };\n const name = tagChars.grabWhile(validAttrValue);\n tagChars.skip();\n emitToken(TYPE_ATTR_VALUE, unq(name));\n if (tagChars.isLast()) {\n return TAG_STATE_NAME;\n }\n return TAG_STATE_ATTR;\n }\n const validName = (char)=>!(char === EQ || isWhiteSpace(char) || tagChars.isLast());\n const name = tagChars.grabWhile(validName);\n emitToken(TYPE_TAG, name);\n checkContextFreeMode(name);\n tagChars.skip();\n // in cases when we has [url=someval]GET[/url] and we dont need to parse all\n if (isSingleValueTag) {\n return TAG_STATE_VALUE;\n }\n const hasEQ = tagChars.includes(EQ);\n return hasEQ ? TAG_STATE_ATTR : TAG_STATE_VALUE;\n }\n function stateTag() {\n const currChar = chars.getCurr();\n const nextChar = chars.getNext();\n chars.skip();\n // detect case where we have '[My word [tag][/tag]' or we have '[My last line word'\n const substr = chars.substrUntilChar(closeTag);\n const hasInvalidChars = substr.length === 0 || substr.indexOf(openTag) >= 0;\n if (nextChar && isCharReserved(nextChar) || hasInvalidChars || chars.isLast()) {\n emitToken(TYPE_WORD, currChar);\n return STATE_WORD;\n }\n // [myTag ]\n const isNoAttrsInTag = substr.indexOf(EQ) === -1;\n // [/myTag]\n const isClosingTag = substr[0] === SLASH;\n if (isNoAttrsInTag || isClosingTag) {\n const name = chars.grabWhile((char)=>char !== closeTag);\n chars.skip(); // skip closeTag\n emitToken(TYPE_TAG, name);\n checkContextFreeMode(name, isClosingTag);\n return STATE_WORD;\n }\n return STATE_TAG_ATTRS;\n }\n function stateAttrs() {\n const silent = true;\n const tagStr = chars.grabWhile((char)=>char !== closeTag, silent);\n const tagGrabber = createCharGrabber(tagStr, {\n onSkip\n });\n const hasSpace = tagGrabber.includes(SPACE);\n tagMode = TAG_STATE_NAME;\n while(tagGrabber.hasNext()){\n tagMode = nextTagState(tagGrabber, !hasSpace);\n }\n chars.skip(); // skip closeTag\n return STATE_WORD;\n }\n function stateWord() {\n if (isNewLine(chars.getCurr())) {\n emitToken(TYPE_NEW_LINE, chars.getCurr());\n chars.skip();\n col = 0;\n row++;\n return STATE_WORD;\n }\n if (isWhiteSpace(chars.getCurr())) {\n const word = chars.grabWhile(isWhiteSpace);\n emitToken(TYPE_SPACE, word);\n return STATE_WORD;\n }\n if (chars.getCurr() === openTag) {\n if (contextFreeTag) {\n const fullTagLen = openTag.length + SLASH.length + contextFreeTag.length;\n const fullTagName = `${openTag}${SLASH}${contextFreeTag}`;\n const foundTag = chars.grabN(fullTagLen);\n const isEndContextFreeMode = foundTag === fullTagName;\n if (isEndContextFreeMode) {\n return STATE_TAG;\n }\n } else if (chars.includes(closeTag)) {\n return STATE_TAG;\n }\n emitToken(TYPE_WORD, chars.getCurr());\n chars.skip();\n return STATE_WORD;\n }\n if (escapeTags) {\n if (isEscapeChar(chars.getCurr())) {\n const currChar = chars.getCurr();\n const nextChar = chars.getNext();\n chars.skip(); // skip the \\ without emitting anything\n if (nextChar && isEscapableChar(nextChar)) {\n chars.skip(); // skip past the [, ] or \\ as well\n emitToken(TYPE_WORD, nextChar);\n return STATE_WORD;\n }\n emitToken(TYPE_WORD, currChar);\n return STATE_WORD;\n }\n const isChar = (char)=>isCharToken(char) && !isEscapeChar(char);\n const word = chars.grabWhile(isChar);\n emitToken(TYPE_WORD, word);\n return STATE_WORD;\n }\n const word = chars.grabWhile(isCharToken);\n emitToken(TYPE_WORD, word);\n return STATE_WORD;\n }\n function tokenize() {\n stateMode = STATE_WORD;\n while(chars.hasNext()){\n switch(stateMode){\n case STATE_TAG:\n stateMode = stateTag();\n break;\n case STATE_TAG_ATTRS:\n stateMode = stateAttrs();\n break;\n case STATE_WORD:\n default:\n stateMode = stateWord();\n break;\n }\n }\n tokens.length = tokenIndex + 1;\n return tokens;\n }\n function isTokenNested(token) {\n const value = openTag + SLASH + token.getValue();\n if (nestedMap.has(value)) {\n return !!nestedMap.get(value);\n } else {\n const status = buffer.indexOf(value) > -1;\n nestedMap.set(value, status);\n return status;\n }\n }\n return {\n tokenize,\n isTokenNested\n };\n}\n","import { CLOSE_BRAKET, OPEN_BRAKET, TagNode, isTagNode } from \"@bbob/plugin-helper\";\nimport { createLexer } from \"./lexer\";\nclass NodeList {\n last() {\n if (Array.isArray(this.n) && this.n.length > 0 && typeof this.n[this.n.length - 1] !== \"undefined\") {\n return this.n[this.n.length - 1];\n }\n return null;\n }\n flush() {\n return this.n.length ? this.n.pop() : false;\n }\n push(value) {\n this.n.push(value);\n }\n toArray() {\n return this.n;\n }\n constructor(){\n this.n = [];\n }\n}\nconst createList = ()=>new NodeList();\nfunction parse(input, opts = {}) {\n const options = opts;\n const openTag = options.openTag || OPEN_BRAKET;\n const closeTag = options.closeTag || CLOSE_BRAKET;\n const onlyAllowTags = (options.onlyAllowTags || []).filter(Boolean).map((tag)=>tag.toLowerCase());\n let tokenizer = null;\n /**\n * Result AST of nodes\n * @private\n * @type {NodeList}\n */ const nodes = createList();\n /**\n * Temp buffer of nodes that's nested to another node\n * @private\n */ const nestedNodes = createList();\n /**\n * Temp buffer of nodes [tag..]...[/tag]\n * @private\n * @type {NodeList}\n */ const tagNodes = createList();\n /**\n * Temp buffer of tag attributes\n * @private\n * @type {NodeList}\n */ const tagNodesAttrName = createList();\n /**\n * Cache for nested tags checks\n */ const nestedTagsMap = new Set();\n function isTokenNested(token) {\n const value = token.getValue();\n const { isTokenNested } = tokenizer || {};\n if (!nestedTagsMap.has(value) && isTokenNested && isTokenNested(token)) {\n nestedTagsMap.add(value);\n return true;\n }\n return nestedTagsMap.has(value);\n }\n /**\n * @private\n */ function isTagNested(tagName) {\n return Boolean(nestedTagsMap.has(tagName));\n }\n /**\n * @private\n */ function isAllowedTag(value) {\n if (onlyAllowTags.length) {\n return onlyAllowTags.indexOf(value.toLowerCase()) >= 0;\n }\n return true;\n }\n /**\n * Flushes temp tag nodes and its attributes buffers\n * @private\n */ function flushTagNodes() {\n if (tagNodes.flush()) {\n tagNodesAttrName.flush();\n }\n }\n /**\n * @private\n */ function getNodes() {\n const lastNestedNode = nestedNodes.last();\n if (lastNestedNode && isTagNode(lastNestedNode)) {\n return lastNestedNode.content;\n }\n return nodes.toArray();\n }\n /**\n * @private\n */ function appendNodeAsString(nodes, node, isNested = true) {\n if (Array.isArray(nodes) && typeof node !== \"undefined\") {\n nodes.push(node.toTagStart({\n openTag,\n closeTag\n }));\n if (Array.isArray(node.content) && node.content.length) {\n node.content.forEach((item)=>{\n nodes.push(item);\n });\n if (isNested) {\n nodes.push(node.toTagEnd({\n openTag,\n closeTag\n }));\n }\n }\n }\n }\n /**\n * @private\n */ function appendNodes(nodes, node) {\n if (Array.isArray(nodes) && typeof node !== \"undefined\") {\n if (isTagNode(node)) {\n if (isAllowedTag(node.tag)) {\n nodes.push(node.toTagNode());\n } else {\n appendNodeAsString(nodes, node);\n }\n } else {\n nodes.push(node);\n }\n }\n }\n /**\n * @private\n * @param {Token} token\n */ function handleTagStart(token) {\n flushTagNodes();\n const tagNode = TagNode.create(token.getValue(), {}, []);\n const isNested = isTokenNested(token);\n tagNodes.push(tagNode);\n if (isNested) {\n nestedNodes.push(tagNode);\n } else {\n const nodes = getNodes();\n appendNodes(nodes, tagNode);\n }\n }\n /**\n * @private\n * @param {Token} token\n */ function handleTagEnd(token) {\n flushTagNodes();\n const lastNestedNode = nestedNodes.flush();\n if (lastNestedNode) {\n const nodes = getNodes();\n appendNodes(nodes, lastNestedNode);\n } else if (typeof options.onError === \"function\") {\n const tag = token.getValue();\n const line = token.getLine();\n const column = token.getColumn();\n options.onError({\n tagName: tag,\n lineNumber: line,\n columnNumber: column\n });\n }\n }\n /**\n * @private\n * @param {Token} token\n */ function handleTag(token) {\n // [tag]\n if (token.isStart()) {\n handleTagStart(token);\n }\n // [/tag]\n if (token.isEnd()) {\n handleTagEnd(token);\n }\n }\n /**\n * @private\n * @param {Token} token\n */ function handleNode(token) {\n /**\n * @type {TagNode}\n */ const activeTagNode = tagNodes.last();\n const tokenValue = token.getValue();\n const isNested = isTagNested(token.toString());\n const nodes = getNodes();\n if (activeTagNode !== null) {\n if (token.isAttrName()) {\n tagNodesAttrName.push(tokenValue);\n const attrName = tagNodesAttrName.last();\n if (attrName) {\n activeTagNode.attr(attrName, \"\");\n }\n } else if (token.isAttrValue()) {\n const attrName = tagNodesAttrName.last();\n if (attrName) {\n activeTagNode.attr(attrName, tokenValue);\n tagNodesAttrName.flush();\n } else {\n activeTagNode.attr(tokenValue, tokenValue);\n }\n } else if (token.isText()) {\n if (isNested) {\n activeTagNode.append(tokenValue);\n } else {\n appendNodes(nodes, tokenValue);\n }\n } else if (token.isTag()) {\n // if tag is not allowed, just pass it as is\n appendNodes(nodes, token.toString());\n }\n } else if (token.isText()) {\n appendNodes(nodes, tokenValue);\n } else if (token.isTag()) {\n // if tag is not allowed, just pass it as is\n appendNodes(nodes, token.toString());\n }\n }\n /**\n * @private\n * @param {Token} token\n */ function onToken(token) {\n if (token.isTag()) {\n handleTag(token);\n } else {\n handleNode(token);\n }\n }\n const lexer = opts.createTokenizer ? opts.createTokenizer : createLexer;\n tokenizer = lexer(input, {\n onToken,\n openTag,\n closeTag,\n onlyAllowTags: options.onlyAllowTags,\n contextFreeTags: options.contextFreeTags,\n enableEscapeTags: options.enableEscapeTags\n });\n // eslint-disable-next-line no-unused-vars\n const tokens = tokenizer.tokenize();\n // handles situations where we open tag, but forgot close them\n // for ex [q]test[/q][u]some[/u][q]some [u]some[/u] // forgot to close [/q]\n // so we need to flush nested content to nodes array\n const lastNestedNode = nestedNodes.flush();\n if (lastNestedNode !== null && lastNestedNode && isTagNode(lastNestedNode) && isTagNested(lastNestedNode.tag)) {\n appendNodeAsString(getNodes(), lastNestedNode, false);\n }\n return nodes.toArray();\n}\nexport { parse };\nexport default parse;\n","/* eslint-disable no-plusplus */ const isObj = (value)=>typeof value === 'object' && value !== null;\nconst isBool = (value)=>typeof value === 'boolean';\nexport function iterate(t, cb) {\n const tree = t;\n if (Array.isArray(tree)) {\n for(let idx = 0; idx < tree.length; idx++){\n tree[idx] = iterate(cb(tree[idx]), cb);\n }\n } else if (isObj(tree) && 'content' in tree) {\n iterate(tree.content, cb);\n }\n return tree;\n}\nexport function same(expected, actual) {\n if (typeof expected !== typeof actual) {\n return false;\n }\n if (!isObj(expected) || expected === null) {\n return expected === actual;\n }\n if (Array.isArray(expected)) {\n return expected.every((exp)=>[].some.call(actual, (act)=>same(exp, act)));\n }\n if (isObj(expected) && isObj(actual)) {\n return Object.keys(expected).every((key)=>{\n const ao = actual[key];\n const eo = expected[key];\n if (isObj(eo) && isObj(ao)) {\n return same(eo, ao);\n }\n if (isBool(eo)) {\n return eo !== (ao === null);\n }\n return ao === eo;\n });\n }\n return false;\n}\nexport function match(t, expression, cb) {\n if (Array.isArray(expression)) {\n return iterate(t, (node)=>{\n for(let idx = 0; idx < expression.length; idx++){\n if (same(expression[idx], node)) {\n return cb(node);\n }\n }\n return node;\n });\n }\n return iterate(t, (node)=>same(expression, node) ? cb(node) : node);\n}\n","import { parse } from '@bbob/parser';\nimport { iterate, match } from './utils';\nimport { C1, C2 } from './errors';\nexport function createTree(tree, options) {\n const extendedTree = tree;\n extendedTree.messages = [\n ...extendedTree.messages || []\n ];\n extendedTree.options = {\n ...options,\n ...extendedTree.options\n };\n extendedTree.walk = function walkNodes(cb) {\n return iterate(this, cb);\n };\n extendedTree.match = function matchNodes(expr, cb) {\n return match(this, expr, cb);\n };\n return extendedTree;\n}\nexport default function bbob(plugs) {\n const plugins = typeof plugs === 'function' ? [\n plugs\n ] : plugs || [];\n const mockRender = ()=>\"\";\n return {\n process (input, opts) {\n const options = opts || {\n skipParse: false,\n parser: parse,\n render: mockRender,\n data: null\n };\n const parseFn = options.parser || parse;\n const renderFn = options.render;\n const data = options.data || null;\n if (typeof parseFn !== 'function') {\n throw new Error(C1);\n }\n // raw tree before modification with plugins\n const raw = options.skipParse && Array.isArray(input) ? input : parseFn(input, options);\n let tree = options.skipParse && Array.isArray(input) ? createTree(input || [], options) : createTree(raw, options);\n for(let idx = 0; idx < plugins.length; idx++){\n const plugin = plugins[idx];\n if (typeof plugin === 'function' && renderFn) {\n const newTree = plugin(tree, {\n parse: parseFn,\n render: renderFn,\n iterate,\n data\n });\n tree = createTree(newTree || tree, options);\n }\n }\n return {\n get html () {\n if (typeof renderFn !== 'function') {\n throw new Error(C2);\n }\n return renderFn(tree, tree.options);\n },\n tree,\n raw,\n messages: tree.messages\n };\n }\n };\n}\n","import core from '@bbob/core';\nimport { attrsToString, isTagNode } from '@bbob/plugin-helper';\nconst SELFCLOSE_END_TAG = '/>';\nconst CLOSE_START_TAG = '';\nfunction renderNode(node, options) {\n const { stripTags = false } = options || {};\n if (typeof node === 'undefined' || node === null) {\n return '';\n }\n if (typeof node === 'string' || typeof node === 'number') {\n return String(node);\n }\n if (Array.isArray(node)) {\n return render(node, options);\n }\n if (isTagNode(node)) {\n if (stripTags) {\n return render(node.content, options);\n }\n const attrs = attrsToString(node.attrs);\n if (node.content === null) {\n return START_TAG + node.tag + attrs + SELFCLOSE_END_TAG;\n }\n return START_TAG + node.tag + attrs + END_TAG + render(node.content, options) + CLOSE_START_TAG + node.tag + END_TAG;\n }\n return '';\n}\nexport function render(nodes, options) {\n if (nodes && Array.isArray(nodes)) {\n return nodes.reduce((r, node)=>r + renderNode(node, options), '');\n }\n if (nodes) {\n return renderNode(nodes, options);\n }\n return '';\n}\nexport function html(source, plugins, options) {\n return core(plugins).process(source, {\n ...options,\n render: render\n }).html;\n}\nexport default html;\n","/**\n * Generate the node object.\n *\n * Contains additional logic to help break any unintended side effects of the top down parsing of bbob.\n * @param {string} tag name of the tag\n * @param {Object} attrs attributes of the tag\n * @param {any} content contents of the tag. `[]` will create an empty tag. `null` will create a self closing tag\n *\n * @example\n * ```\n * toNode(\"div\", { class: \"class\" }, \"content\")\n * ```\n * becomes\n * ```\n * {\n * tag: \"div\",\n * attrs: { class: \"class\" },\n * content: \"content\",\n * gen: true,\n * }\n */\nconst toNode = (tag, attrs, content = []) => ({\n tag,\n attrs,\n content,\n gen: true,\n});\n\n/**\n * Preprocess attributes of a node to either combine all values into a single default value\n * or return a keyed attribute list\n * @param {any} attrs object of bbcode node attrs\n * @param {string[]} predefinedKeys array of predefined keys to be captured\n * @returns processed attributes\n */\nconst preprocessAttr = (attrs) => {\n const keys = Object.keys(attrs).join(\" \");\n const vals = Object.values(attrs).join(\" \");\n if (keys === vals) {\n return {\n _default: vals,\n };\n } else {\n return attrs;\n }\n};\n\n/**\n * Attempts to return tag into its original form with proper attributes\n * @returns string of tag start\n */\nconst toOriginalStartTag = (node) => {\n if (!node.attrs) {\n return `[${node.tag}]`;\n }\n const attrs = preprocessAttr(node.attrs);\n if (attrs._default) {\n return `[${node.tag}=${attrs._default}]`;\n } else {\n return node.toTagStart();\n }\n};\n\n/**\n * Given a string, find the first position of a regex match\n * @param {string} string to test against\n * @param {RegExp} regex to test with\n * @param {number} startpos starting position. Defaults to 0\n * @returns index of the first match of the regex in the string\n */\nconst regexIndexOf = (string, regex, startpos) => {\n const indexOf = string.substring(startpos || 0).search(regex);\n return indexOf >= 0 ? indexOf + (startpos || 0) : indexOf;\n};\n\nconst MD_NEWLINE_INJECT = \"\\n\\n\";\nconst MD_NEWLINE_PRE_INJECT = \"\\n\\n\";\nconst MD_NEWLINE_INJECT_COMMENT = \"\";\n\nconst URL_REGEX =\n /(http|ftp|https|upload):\\/\\/([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:\\/~+#-]*[\\w@?^=%&\\/~+#-])/;\nconst MD_URL_REGEX =\n /\\!?\\[.*\\]\\((http|ftp|https|upload):\\/\\/([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:\\/~+#-]*[\\w@?^=%&\\/~+#-])\\)/;\nconst URL_REGEX_SINGLE_LINE = new RegExp(`^${URL_REGEX.source}|${MD_URL_REGEX.source}$`);\nconst ESCAPABLES_REGEX =\n /((\\n|^)(?```+|~~~+)(?.*\\n))|(?\\[(?i?code|plain)(=.*)?\\])|(?(?`{1,2})(.*)(?\\k))/im;\nconst MD_TABLE_REGEX = /^(\\|[^\\n]+\\|\\r?\\n)((?:\\| ?:?[-]+:? ?)+\\|)(\\n(?:\\|[^\\n]+\\|\\r?\\n?)*)?$/m;\n\n/**\n * Generates a random GUID.\n *\n * Mini Racer doesn't have the crypto module, so we can't use the built-in `crypto.randomUUID` function.\n * @returns {string} a GUID\n */\nfunction generateGUID() {\n let d = new Date().getTime();\n if (window.performance && typeof window.performance.now === \"function\") {\n d += performance.now(); //use high-precision timer if available\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n // eslint-disable-next-line no-bitwise\n const r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n // eslint-disable-next-line no-bitwise\n return (c === \"x\" ? r : (r & 0x3) | 0x8).toString(16);\n });\n}\n\nexport {\n toNode,\n toOriginalStartTag,\n generateGUID,\n preprocessAttr,\n regexIndexOf,\n MD_NEWLINE_INJECT,\n MD_NEWLINE_INJECT_COMMENT,\n MD_NEWLINE_PRE_INJECT,\n URL_REGEX,\n MD_URL_REGEX,\n MD_TABLE_REGEX,\n URL_REGEX_SINGLE_LINE,\n ESCAPABLES_REGEX,\n};\n","/**\n * Plugin that converts line breaks to `
` tags.\n * To use, put as function similar to the presets.\n *\n * If a node is marked with `noLineBreakConversion`, then it'll skip the parsing the children\n *\n * @example\n * ```ts\n * const output = bbob([preset(), lineBreakPlugin()]).process(input, {render}).html\n * ```\n */\nimport { isEOL } from \"@bbob/plugin-helper\";\nimport { MD_NEWLINE_INJECT, MD_NEWLINE_PRE_INJECT, URL_REGEX_SINGLE_LINE } from \"../utils/common\";\n\nconst isObj = (value) => typeof value === \"object\";\nconst isString = (value) => typeof value === \"string\";\n\n/**\n * Walks the tree of nodes. Will add `br` tag to all `\\n` in format that can be used in any renderer.\n * Preserves \\n so that markdown-it doesn't try to treat everything like a block\n *\n * If a node has the property noLineBreakConversion is encountered, will skip parsing children.\n * @param t tree of nodes to be processed\n * @returns modified tree\n */\nconst walk = (t, disableLineBreakConversion = false) => {\n const tree = t;\n\n if (Array.isArray(tree)) {\n if (tree.some(isString)) {\n // array contains strings. Might be md compatible\n tree.unshift(MD_NEWLINE_INJECT);\n tree.push(MD_NEWLINE_INJECT);\n }\n for (let idx = 0; idx < tree.length; idx++) {\n const child = walk(tree[idx], disableLineBreakConversion);\n if (Array.isArray(child)) {\n tree.splice(idx, 1, ...child);\n idx += child.length - 1;\n } else {\n tree[idx] = child;\n }\n }\n } else if (tree && isObj(tree) && tree.content) {\n if (tree.isWhitespaceSensitive) {\n // applies only to [code] and [icode]\n // stop walk. children won't be parsed to have
\n return tree.tag ? tree : tree.content;\n }\n if (tree.disableLineBreakConversion) {\n disableLineBreakConversion = true;\n }\n walk(tree.content, disableLineBreakConversion);\n return tree.tag ? tree : tree.content;\n } else if (isString(tree) && URL_REGEX_SINGLE_LINE.test(tree.trim())) {\n // if the entire string is a URL, then it should be prepared for onebox.\n // BBob separates strings by newlines anyway, so we can already assume this is sitting on its own line\n // MD_NEWLINE_INJECT is already replacing newline came before or the start of the array,\n // so we only need to make sure \\n\\n is added after the URL\n return [tree, MD_NEWLINE_PRE_INJECT];\n }\n\n if (isString(tree) && isEOL(tree)) {\n return disableLineBreakConversion\n ? [\"\\n\", MD_NEWLINE_INJECT]\n : [{ tag: \"br\", content: null }, MD_NEWLINE_INJECT];\n }\n\n return tree;\n};\n\n/**\n * Converts `\\n` to `
` self closing tag. Supply this as the last plugin in the preset lists\n *\n * @example converts all line breaks to br\n * ```ts\n * const output = bbob([preset(), lineBreakPlugin()]).process(input, {render}).html\n * ```\n * @example will not convert line breaks inside [nobr]\n * ```ts\n * const nobr = (node: TagNode) => {return { disableLineBreakConversion: true, content: node.content }}; \\\\ tag in preset\n * ...\n * const output = bbob([preset(), lineBreakPlugin()]).process(input, {render}).html\n * ```\n * @returns plugin to be used in BBob process\n */\nexport const lineBreakPlugin = () => {\n return (tree) => walk(tree);\n};\n","/**\n * Plugin that converts consecutive normal spaces (U+0020) to non-breaking spaces (U+00A0).\n * To use, put as function similar to the presets.\n *\n *\n * @example\n * ```ts\n * const output = bbob([preset(), , preserveWhitespace(), lineBreakPlugin()]).process(input, {render}).html\n * ```\n */\nimport { isStringNode } from \"@bbob/plugin-helper\";\n\n/**\n * Checks if input is an object\n * @param value input\n * @returns if value is an object\n */\nconst isObj = (value) => typeof value === \"object\";\n\n/**\n * Walks the tree of nodes. Checks for node of consecutive spaces. If found replaces every space in\n * node with a nonbreaking space.\n * Preserves multiple spaces so html won't truncate them.\n *\n * Walks through entire tree.\n * @param t tree of nodes to be processed\n * @returns modified tree\n */\nconst walk = (t) => {\n const tree = t;\n\n if (Array.isArray(tree)) {\n for (let idx = 0; idx < tree.length; idx++) {\n const child = walk(tree[idx]);\n if (Array.isArray(child)) {\n tree.splice(idx, 1, ...child);\n idx += child.length - 1;\n } else {\n tree[idx] = child;\n }\n }\n } else if (tree && isObj(tree) && tree.content) {\n walk(tree.content);\n }\n\n //Bbob breaks up nodes by the presence of normal spaces.\n //So a node with a normal space can only have normal spaces in that node.\n if (isStringNode(tree)) {\n if (tree.length > 1 && tree[0] === \" \") {\n let numSpaces = tree.length;\n return [String.fromCharCode(160).repeat(numSpaces)];\n }\n }\n\n return tree;\n};\n\n/**\n * Converts consecutive normal spaces (U+0020) to nonbreaking spaces (U+00A0).\n * Supply this as a plugin in the preset lists.\n *\n * @example converts consecutive normal spaces (U+0020) to nonbreaking spaces (U+00A0)\n * ```ts\n * const output = bbob([preset(), preserveWhitespace(), lineBreakPlugin()]).process(input, {render}).html\n * ```\n *\n * @returns plugin to be used in BBob process\n */\nexport const preserveWhitespace = () => {\n return (tree) => walk(tree);\n};\n","import { isTagNode } from \"@bbob/plugin-helper\";\nexport function process(tags, tree, core, options) {\n return tree.walk((node)=>{\n if (isTagNode(node)) {\n const tag = node.tag;\n const tagCallback = tags[tag];\n if (typeof tagCallback === \"function\") {\n return tagCallback(node, core, options);\n }\n }\n return node;\n });\n}\n/**\n * Create a preset plugin for @bbob/core\n */ function createPreset(defTags, processor = process) {\n const presetFactory = (opts)=>{\n presetFactory.options = Object.assign(presetFactory.options || {}, opts);\n function presetExecutor(tree, core) {\n return processor(defTags, tree, core, presetFactory.options || {});\n }\n presetExecutor.options = presetFactory.options;\n return presetExecutor;\n };\n presetFactory.extend = function presetExtend(callback) {\n const newTags = callback(defTags, presetFactory.options);\n return createPreset(newTags, processor);\n };\n return presetFactory;\n}\nexport { createPreset };\nexport default createPreset;\n","import {\n generateGUID,\n preprocessAttr,\n regexIndexOf,\n toNode,\n toOriginalStartTag,\n} from \"../utils/common\";\nimport { TagNode, isStringNode, isTagNode } from \"@bbob/plugin-helper\";\n\nconst SLIDE_TITLE_OPEN = Symbol(\"slide-title-open\");\nconst SLIDE_TITLE_CLOSE = Symbol(\"slide-title-close\");\nconst SLIDE_CLOSE = Symbol(\"slide-close\");\nconst SLIDE_REGEX =\n /(?\\{slide=)|(?\\})|(?\\{\\/slide\\})/i;\n\n/**\n * Adds the accordion tag\n * [accordion]{slide=name}content{/slide}[/accordion]\n *\n * [accordion][slide=name]content[/slide][/accordion]\n */\nconst accordion = (node) => {\n const groupId = generateGUID();\n\n // add support for existing {slide} tags style, due to copious amounts of existing content\n // also the only way to get true custom content inside a slide due to nesting limitations\n const markedContent = generateSlideMarkersFromContent(node.content);\n const generatedSlides = generateSlidesFromMarkers(markedContent);\n\n const filteredContent = generatedSlides\n .filter((n) => isTagNode(n) && n.tag === \"slide\")\n .map((content) => {\n content.isValid = true;\n content.groupId = groupId;\n return content;\n });\n if (!filteredContent.length) {\n // no [slide] tags found\n return [toOriginalStartTag(node), ...node.content, node.toTagEnd()];\n }\n\n const attrs = preprocessAttr(node.attrs);\n\n if (attrs._default) {\n /** @type {string[]} */\n const customSettings = attrs._default.split(\"|\").map((s) => s.trim());\n if (customSettings.includes(\"bright\")) {\n attrs.bright = true;\n }\n if (customSettings.includes(\"bcenter\")) {\n attrs.bcenter = true;\n }\n if (customSettings.includes(\"bleft\")) {\n attrs.bleft = true;\n }\n if (customSettings.includes(\"fleft\")) {\n attrs.fleft = true;\n }\n if (customSettings.includes(\"fright\")) {\n attrs.fright = true;\n }\n if (\n customSettings.some((s) => s.endsWith(\"px\")) ||\n customSettings.some((s) => s.endsWith(\"%\"))\n ) {\n attrs.width = customSettings.find((s) => s.endsWith(\"px\") || s.endsWith(\"%\"));\n }\n }\n\n let classes = Object.keys(attrs)\n .filter((s) => [\"bright\", \"bcenter\", \"bleft\", \"fleft\", \"fright\"].includes(s))\n .join(\" \");\n let style = \"\";\n if (attrs.width?.endsWith(\"px\") || attrs.width?.endsWith(\"%\")) {\n style = `width: ${attrs.width};`;\n }\n return toNode(\n \"div\",\n { class: \"bb-accordion \" + classes, \"data-group-id\": groupId, style },\n filteredContent,\n );\n};\n\n/**\n * Locates and splits all {slide} tag components into their respective parts while preserving remaining content\n * @param {(TagNode|string)[]} contentArr node content of the accordion tag\n *\n * @example\n * ```\n * [\"{slide=test}\", \"lorem ipsum\", \"{/slide}\"]\n * ```\n * becomes\n * ```\n * [SLIDE_TITLE_OPEN, \"test\", SLIDE_TITLE_CLOSE, \"lorem ipsum\", SLIDE_CLOSE]\n * ```\n */\nfunction generateSlideMarkersFromContent(contentArr) {\n contentArr = [...contentArr]; // shallow clone. object nodes are not modified anyway\n\n const newArr = [];\n while (contentArr.length > 0) {\n const content = contentArr[0];\n if (isTagNode(content)) {\n newArr.push(contentArr.shift());\n continue;\n }\n const foundIndex = regexIndexOf(content, SLIDE_REGEX);\n if (foundIndex === -1) {\n newArr.push(contentArr.shift());\n continue;\n }\n const match = content.match(SLIDE_REGEX);\n const preContent = content.slice(0, foundIndex);\n const postContent = content.slice(foundIndex + match[0].length);\n if (preContent.length) {\n newArr.push(preContent);\n }\n if (match.groups.slideTitleOpen) {\n newArr.push(SLIDE_TITLE_OPEN);\n }\n if (match.groups.slideTitleClose) {\n newArr.push(SLIDE_TITLE_CLOSE);\n }\n if (match.groups.slideClose) {\n newArr.push(SLIDE_CLOSE);\n }\n if (postContent.length) {\n contentArr[0] = postContent;\n } else {\n contentArr.shift();\n }\n }\n\n return newArr;\n}\n\n/**\n * Generates slide nodes from markers\n * @param {(string | typeof SLIDE_TITLE_OPEN | typeof SLIDE_TITLE_CLOSE | typeof SLIDE_CLOSE | TagNode)[]} markedContent\n */\nfunction generateSlidesFromMarkers(markedContent) {\n const nodes = [];\n let currentSlide = null;\n /** @type {typeof SLIDE_TITLE_OPEN | typeof SLIDE_TITLE_CLOSE | null} */\n let prevMarker = null;\n for (const content of markedContent) {\n if (content === SLIDE_TITLE_OPEN && prevMarker === null) {\n currentSlide = TagNode.create(\"slide\");\n currentSlide.content = [];\n currentSlide.customTitle = [];\n prevMarker = SLIDE_TITLE_OPEN;\n } else if (content === SLIDE_TITLE_CLOSE && prevMarker === SLIDE_TITLE_OPEN) {\n prevMarker = SLIDE_TITLE_CLOSE;\n continue;\n } else if (content === SLIDE_CLOSE && currentSlide && prevMarker === SLIDE_TITLE_CLOSE) {\n nodes.push(currentSlide);\n currentSlide = null;\n prevMarker = null;\n } else if (currentSlide) {\n if (prevMarker === SLIDE_TITLE_OPEN) {\n currentSlide.customTitle.push(markerToString(content));\n } else {\n currentSlide.content.push(markerToString(content));\n }\n } else {\n // no slide open, just add content\n nodes.push(markerToString(content));\n }\n }\n return nodes;\n}\n\n/**\n * Processes content into a string. Catches stray markers and converts them back into a string\n * @param {string | typeof SLIDE_TITLE_OPEN | typeof SLIDE_TITLE_CLOSE | typeof SLIDE_CLOSE} marker\n * @returns expected string\n */\nfunction markerToString(marker) {\n switch (marker) {\n case SLIDE_TITLE_OPEN:\n return \"{slide=\";\n case SLIDE_TITLE_CLOSE:\n return \"}\";\n case SLIDE_CLOSE:\n return \"{/slide}\";\n default:\n return marker;\n }\n}\n\nconst slide = (node) => {\n if (!node.isValid) {\n // not inside an [accordion] tag\n return [toOriginalStartTag(node), ...node.content, node.toTagEnd()];\n }\n const attrs = preprocessAttr(node.attrs);\n let title = [attrs.title || attrs._default || \"Slide\"];\n let isOpen = !!attrs.open || false;\n let titleAlign = attrs.left ? \"left\" : attrs.right ? \"right\" : attrs.center ? \"center\" : \"left\";\n if (node.customTitle?.length) {\n // slide was created from markers\n title = node.customTitle;\n // pull out old options from title if they exist\n const possibleOptions = title\n .filter((t) => typeof t === \"string\")\n .join(\"\")\n .toLowerCase()\n .split(\"|\")\n .map((s) => s.trim());\n if (possibleOptions.includes(\"open\")) {\n isOpen = true;\n }\n if (possibleOptions.includes(\"right\")) {\n titleAlign = \"right\";\n }\n if (possibleOptions.includes(\"center\")) {\n titleAlign = \"center\";\n }\n if (possibleOptions.includes(\"left\")) {\n titleAlign = \"left\";\n }\n title = title.map((t) => {\n if (isStringNode(t)) {\n t = t.replace(/\\|(open|right|center|left)/gi, \"\");\n }\n return t;\n });\n }\n return [\n toNode(\"details\", { class: \"bb-slide\", open: isOpen }, [\n toNode(\n \"summary\",\n { class: \"bb-slide-title\", style: `text-align: ${titleAlign}; ${attrs.style || \"\"}` },\n title,\n ),\n toNode(\"div\", { class: \"bb-slide-content\" }, node.content),\n ]),\n ];\n};\n\nexport const accordionTags = { accordion, slide };\n","import { toNode } from \"../utils/common\";\n/**\n * @file Adds [left], [center], and [right] to bbcode\n * @example [center]content[/center]\n */\nexport const alignment = {\n left: (node) => toNode(\"div\", { class: \"bb-left\" }, node.content),\n center: (node) => toNode(\"div\", { class: \"bb-center\" }, node.content),\n right: (node) => toNode(\"div\", { class: \"bb-right\" }, node.content),\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n/**\n * @file Adds [a] and [goto] to bbcode\n * @example [a=your_anchor_name]An anchor[/a] [goto=your_anchor_name]Jump to an anchor[/goto]\n */\nexport const anchor = {\n // name is not valid in HTML5; however, it correctly displays back while id does not\n a: (node) => {\n const attrs = preprocessAttr(node.attrs)._default || \"\";\n return toNode(\n \"a\",\n { id: `user-anchor-${attrs.trim()}`, name: `user-anchor-${attrs.trim()}` },\n node.content,\n );\n },\n goto: (node) => {\n const attrs = preprocessAttr(node.attrs)._default || \"\";\n return toNode(\"a\", { href: `#user-anchor-${attrs.trim()}` }, node.content);\n },\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nconst WEB_FONTS = [\n \"arial\",\n \"book antiqua\",\n \"courier new\",\n \"georgia\",\n \"tahoma\",\n \"times new roman\",\n \"trebuchet ms\",\n \"verdana\",\n];\nconst VALID_FONT_STYLES = {\n thin: \"100\",\n extralight: \"200\",\n light: \"300\",\n regular: \"400\",\n medium: \"500\",\n semibold: \"600\",\n bold: \"700\",\n extrabold: \"800\",\n black: \"900\",\n};\n// registered axis tags https://learn.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg#registered-axis-tags\nconst REGISTERED_AXIS = [\"ital\", \"opsz\", \"slnt\", \"wdth\", \"wght\"];\n\nconst AXES_REGEX = /(?[a-zA-Z]*)?\\s?(?[0-9]*)?\\s?(?italic)?/;\n\nconst axesParser = (attrs) => {\n let axes = {\n ital: 0,\n wght: 400,\n };\n\n if (attrs?.style) {\n // user just copy pasted the name of the style on the google font site, probably\n const style = attrs.style.trim().toLowerCase();\n const matches = AXES_REGEX.exec(style).groups || {};\n if (matches?.italic) {\n axes.ital = 1;\n }\n\n const weight = matches.weight;\n if (weight && weight >= 0 && weight <= 900) {\n axes.wght = weight;\n } else if (Object.keys(VALID_FONT_STYLES).includes(matches.named_weight || \"\")) {\n axes.wght = VALID_FONT_STYLES[matches.named_weight];\n }\n\n axes = {\n ...axes,\n ...Object.fromEntries(Object.entries(attrs).filter(([key]) => REGISTERED_AXIS.includes(key))),\n };\n }\n return axes;\n};\n\n/**\n * Create google font api url\n * @param {string} family name of font\n * @param {object} axes custom font axes\n */\nconst googleFontApiBuild = (family, axes) => {\n family = family.replaceAll(\" \", \"+\");\n // google fonts requires axes names to be in alphabetical order\n axes = Object.keys(axes)\n .sort()\n .reduce((obj, key) => {\n obj[key] = axes[key];\n return obj;\n }, {});\n const axesList = Object.keys(axes).join(\",\") + \"@\" + Object.values(axes).join(\",\");\n return \"https://fonts.googleapis.com/css2?family=\" + family + \":\" + axesList;\n};\n\nexport const font = (node, options) => {\n const attrs = preprocessAttr(node.attrs);\n const fontFamily = attrs?._default || attrs.family || attrs.name;\n if (fontFamily.trim() === \"\") {\n return node.content;\n }\n if (WEB_FONTS.includes(fontFamily.trim().toLowerCase())) {\n return toNode(\"span\", { style: \"font-family: \" + fontFamily }, node.content);\n }\n\n const axes = axesParser(attrs);\n const url = googleFontApiBuild(fontFamily, axes);\n options.data.fonts.add(url);\n\n const italic = axes.ital === 1 ? \"italic\" : \"normal\";\n\n const custom = Object.entries(axes).filter(([key]) => key !== \"wght\" && key !== \"ital\");\n let fontVar = \"\";\n if (custom.length) {\n fontVar =\n \"font-variation-settings: \" + custom.map(([key, val]) => `'${key}' ${val}`).join(\", \") + \";\";\n }\n\n return toNode(\n \"span\",\n {\n style: `font-family: ${fontFamily}; font-weight: ${axes.wght}; font-style: ${italic}; ${fontVar}`,\n \"data-font\": url,\n },\n node.content,\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Parse the user provided height and return a valid height value\n * @param {Number} heightValue obtains the input of the user entered height (default is 700)\n * @returns A validated number less than 0.\n */\nfunction parseHeight(heightValue) {\n const maxHeight = 700;\n const parsedHeight =\n heightValue && heightValue.trim() !== \"\" ? heightValue.replace(/[^\\d.]/g, \"\") : 0;\n\n if (parsedHeight && parsedHeight >= 0 && parsedHeight <= maxHeight) {\n return parsedHeight;\n } else {\n // if the value = 0 then nothing will be returned\n return parsedHeight === 0 ? 0 : maxHeight;\n }\n}\n\n/**\n * @file Adds [heightrestrict] to bbcode\n * @example [heightrestrict=50]content[/heightrestrict]\n */\nexport const heightrestrict = (node) => {\n const attrs = preprocessAttr(node.attrs)._default;\n const heightInput = parseHeight(attrs).toString();\n // Return image's default size if heightrestrict did not involve a valid value\n return heightInput === \"0\"\n ? toNode(\"div\", { class: \"bb-height-restrict\" }, node.content)\n : toNode(\n \"div\",\n { class: \"bb-height-restrict\", style: `height: ${heightInput}px;` },\n node.content,\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n/**\n * @file Adds [mail] to bbcode\n * @param {string} [type=\"send\"] Denotes type of mail either send or receive\n * @param {string} [person=\"Unknown\"] Denotes the person in the To/From field\n * @param {string} [subject=\"Empty\"] Denotes the subject line of the email\n * @example [mail type=\"send\" person=\"John Doe\" subject=\"Hello World\"]content[/mail]\n */\n\nconst parseEmailContent = (content) => {\n return toNode(\"div\", { class: \"bb-email-content\" }, content);\n};\n\nconst parseEmailSubject = (subject) => {\n return toNode(\"div\", { class: \"bb-email-subject\" }, subject);\n};\n\nconst parseEmailPerson = (person) => {\n return toNode(\"div\", { class: \"bb-email-address\" }, person);\n};\n\nconst emailHeader = toNode(\"div\", { class: \"bb-email-header\" }, \"\");\nconst emailFooter = toNode(\n \"div\",\n { class: \"bb-email-footer\" },\n toNode(\"div\", { class: \"bb-email-button\" }, \"\")\n);\n\nexport const mail = (node) => {\n const attributes = preprocessAttr(node.attrs);\n let mailAttr = {\n mailOption: (attributes.type || \"send\").toLowerCase(),\n person: attributes.person || \"Unknown\",\n subject: attributes.subject || \"Empty\",\n };\n\n return toNode(\n \"div\",\n {\n class: \"bb-email\",\n \"data-bb-email\": mailAttr.mailOption,\n },\n [\n emailHeader,\n parseEmailPerson(mailAttr.person),\n parseEmailSubject(mailAttr.subject),\n parseEmailContent(node.content),\n emailFooter,\n ]\n );\n};\n","import { preprocessAttr } from \"../utils/common\";\n\nconst EVENTS = [\n \"init\",\n \"click\",\n \"change\",\n \"input\",\n \"dblclick\",\n \"mouseenter\",\n \"mouseleave\",\n \"scroll\",\n];\n\n/**\n * Script tag\n *\n * [script]content[/script]\n *\n * [script class=\"id\" on=\"event\" version=\"2\"]content[/script]\n */\nexport const script = (node, options) => {\n const attrs = preprocessAttr(node.attrs);\n\n if (!options.data.previewing && !options.data.commonGUID) {\n // create a common GUID for the post\n // only applicable for div, style, and script tags\n // this is to prevent the same class name from being used in different posts\n options.data.commonGUID = \"post-\" + Math.random().toString(36).substring(2, 7);\n }\n const classSuffix = options.data.previewing ? \"preview\" : options.data.commonGUID;\n\n const onEvent =\n (EVENTS.includes(attrs.on?.toLowerCase() || \"init\") && attrs.on?.toLowerCase()) || \"init\";\n\n const scriptSetup = {\n id: classSuffix,\n class: attrs.class || \"\",\n on: onEvent,\n version: attrs.version || \"\",\n content: node.content.join(\"\"),\n };\n options.data.bbscripts.push(scriptSetup);\n\n return [];\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Parses an inputted size value and returns the formatted valid font size\n * @param {string} fontValue the input of the size\n */\nfunction parseFontSize(fontValue) {\n let value;\n let fontSize = { valid: true };\n const parsedSize = /(\\d+\\.?\\d?)(px|rem)?/i.exec(fontValue);\n const sizeRanges = {\n px_max: 36,\n px_min: 8,\n rem_max: 3,\n rem_min: 0.2,\n unitless_max: 7,\n unitless_min: 1,\n };\n\n if (parsedSize && (value = parsedSize[1])) {\n fontSize.unit = (parsedSize[2] || \"\").toLowerCase();\n switch (fontSize.unit) {\n case \"px\":\n if (value > sizeRanges.px_max) {\n value = sizeRanges.px_max;\n } else if (value < sizeRanges.px_min) {\n value = sizeRanges.px_min;\n }\n break;\n case \"rem\":\n if (value > sizeRanges.rem_max) {\n value = sizeRanges.rem_max;\n } else if (value < sizeRanges.rem_min) {\n value = sizeRanges.rem_min;\n }\n break;\n default:\n if ((fontSize.valid = fontValue.length === value.length)) {\n if (value > sizeRanges.unitless_max) {\n value = sizeRanges.unitless_max;\n } else if (value < sizeRanges.unitless_min) {\n value = sizeRanges.unitless_min;\n }\n }\n break;\n }\n\n fontSize.value = value;\n }\n return fontSize;\n}\n\nexport const size = (node) => {\n const input = preprocessAttr(node.attrs)._default;\n const fontSize = parseFontSize(input);\n if (!fontSize.valid) {\n return node.content;\n }\n let outputAttr = {};\n if (fontSize.unit) {\n outputAttr = { style: `font-size: ${fontSize.value}${fontSize.unit}` };\n } else {\n outputAttr = { \"data-size\": fontSize.value };\n }\n return toNode(\"span\", outputAttr, node.content);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds textmessage to bbcode\n * @exmaple [textmessage=Recipient][message=them]Hi [/message][message=me] Hey![/message][/textmessage]\n */\n\nconst ACCEPTED_OPTIONS = [\"me\", \"them\", \"right\", \"left\"];\nexport const textmessage = {\n textmessage: (node) => {\n const attr = preprocessAttr(node.attrs)._default || \"Recipient\";\n const recipient = attr && attr.trim() !== \"\" ? attr : \"Recipient\";\n return toNode(\"div\", { class: \"bb-textmessage\" }, [\n toNode(\"div\", { class: \"bb-textmessage-name\" }, recipient),\n toNode(\"div\", { class: \"bb-textmessage-overflow\" }, [\n toNode(\"div\", { class: \"bb-textmessage-content\" }, node.content),\n ]),\n ]);\n },\n message: (node) => {\n let option = preprocessAttr(node.attrs)._default.toLowerCase();\n if (!ACCEPTED_OPTIONS.includes(option) || option === \"right\") {\n option = \"me\";\n }\n if (option === \"left\") {\n option = \"them\";\n }\n\n const senderAttrs = option === \"me\" ? \"bb-message-me\" : \"bb-message-them\";\n return toNode(\"div\", { class: senderAttrs }, [\n toNode(\"div\", { class: \"bb-message-content\" }, node.content),\n ]);\n },\n};\n","import { createPreset } from \"@bbob/preset\";\nimport { accordionTags } from \"./tags/accordion\";\nimport { alignment } from \"./tags/alignment\";\nimport { anchor } from \"./tags/anchor\";\nimport { animation, keyframe } from \"./tags/animation\";\nimport { bg } from \"./tags/background\";\nimport { block } from \"./tags/block\";\nimport { blockquote } from \"./tags/blockquote\";\nimport { border } from \"./tags/border\";\nimport { centerblock } from \"./tags/centerblock\";\nimport { check } from \"./tags/check\";\nimport { classStyle } from \"./tags/class\";\nimport { code, icode, savenl } from \"./tags/code\";\nimport { color } from \"./tags/color\";\nimport { comment } from \"./tags/comment\";\nimport { bold, italic, strike, underline } from \"./tags/discourse-core-replacement\";\nimport { div } from \"./tags/div\";\nimport { divide } from \"./tags/divide\";\nimport { fieldset } from \"./tags/fieldset\";\nimport { font } from \"./tags/font\";\nimport { fa } from \"./tags/fontawesome\";\nimport { h, h1, h2, h3, h4, h5, h6, sh } from \"./tags/header\";\nimport { heightrestrict } from \"./tags/heightrestrict\";\nimport { highlight } from \"./tags/highlight\";\nimport { imagefloat } from \"./tags/imagefloat\";\nimport { justify } from \"./tags/justify\";\nimport { br, nobr } from \"./tags/lineBreak\";\nimport { mail } from \"./tags/mail\";\nimport { newspaper } from \"./tags/newspaper\";\nimport { note } from \"./tags/note\";\nimport { ooc } from \"./tags/ooc\";\nimport { pindent } from \"./tags/pindent\";\nimport { plain } from \"./tags/plain\";\nimport { print } from \"./tags/print\";\nimport { progress } from \"./tags/progress\";\nimport { quote } from \"./tags/quote\";\nimport { rowcolumn } from \"./tags/rowcolumn\";\nimport { script } from \"./tags/script\";\nimport { scroll } from \"./tags/scroll\";\nimport { side } from \"./tags/side\";\nimport { size } from \"./tags/size\";\nimport { inlinespoiler, spoiler } from \"./tags/spoiler\";\nimport { sub } from \"./tags/subscript\";\nimport { sup } from \"./tags/superscript\";\nimport { tab, tabs } from \"./tags/tabs\";\nimport { textmessage } from \"./tags/textmessage\";\nimport { thinprogress } from \"./tags/thinprogress\";\n\nconst tags = {\n ...accordionTags,\n ...alignment,\n ...anchor,\n animation,\n bg,\n block,\n blockquote,\n border,\n br,\n centerblock,\n check,\n class: classStyle,\n code,\n color,\n comment,\n div,\n divide,\n fieldset,\n fa,\n font,\n h,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n heightrestrict,\n highlight,\n icode,\n imagefloat,\n inlinespoiler,\n justify,\n keyframe,\n mail,\n newspaper,\n nobr,\n note,\n ooc,\n pindent,\n plain,\n print,\n progress,\n quote,\n ...rowcolumn,\n thinprogress,\n savenl,\n sh,\n script,\n scroll,\n side,\n size,\n spoiler,\n sub,\n sup,\n tab,\n tabs,\n ...textmessage,\n\n // discourse core replacement tags\n b: bold,\n i: italic,\n u: underline,\n s: strike,\n};\n\nconst availableTags = Object.keys(tags);\nconst preventParsing = [\"plain\", \"code\", \"icode\", \"class\", \"fa\"];\n\nconst preset = createPreset(tags);\n\nexport { availableTags, tags, preset, preventParsing };\nexport default preset;\n","import { preprocessAttr, toOriginalStartTag } from \"../utils/common\";\nimport { isStringNode, isTagNode } from \"@bbob/plugin-helper\";\n\n/**\n * Renders css Keyframes\n *\n * [animation=name][keyframe=0]color: red[/keyframe][/animation]\n */\nexport const animation = (node, options) => {\n if (!options.data.previewing && !options.data.commonGUID) {\n // create a common GUID for the post\n // only applicable for div, style, and script tags\n // this is to prevent the same class name from being used in different posts\n options.data.commonGUID = \"post-\" + Math.random().toString(36).substring(2, 7);\n }\n const commonId = options.data.previewing ? \"preview\" : options.data.commonGUID;\n\n const name = preprocessAttr(node.attrs)?._default || \"\";\n const keyframes = node.content\n .filter((n) => isTagNode(n) && n.tag === \"keyframe\")\n .map((content) => {\n content.isValid = true;\n /** @type {string} */\n const ident = preprocessAttr(content.attrs)._default || \"\";\n content.ident = ident + (ident.match(/^\\d+$/) ? \"%\" : \"\");\n const cleanContent = content.content\n .filter(isStringNode)\n .join(\"\")\n .replaceAll(/[\\[\\]\\{\\}]/g, \"\");\n content.formatted = `${content.ident}{ ${cleanContent} }`;\n return content;\n });\n const keyframeContent = keyframes.map((n) => n.formatted).join(\"\\n\");\n const content = `@keyframes ${commonId}${name} { ${keyframeContent} }`;\n options.data.styles.push(content);\n return [];\n};\n\nexport const keyframe = (node) => {\n if (!node.isValid) {\n return [toOriginalStartTag(node), ...node.content, node.toTagEnd()];\n }\n return [];\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Add [bg] tag\n * @example [bg=red]Hello[/bg]\n */\nexport const bg = (node) => {\n const color = preprocessAttr(node.attrs)._default;\n return toNode(\n \"div\",\n {\n style: `background-color: ${color};`,\n class: \"bb-background\",\n },\n node.content,\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Add [block] tag\n * @example [block=treasure]content[/block]\n */\nexport const block = (node) => {\n const defaultOp = \"block\";\n const blockAttr = (preprocessAttr(node.attrs)._default || defaultOp).toLowerCase();\n\n const OPTIONS = [\n \"block\",\n \"dice\",\n \"dice10\",\n \"setting\",\n \"warning\",\n \"storyteller\",\n \"announcement\",\n \"important\",\n \"question\",\n \"encounter\",\n \"information\",\n \"character\",\n \"treasure\",\n ];\n\n // Default to block option if user did not provide anything valid\n const blockOption = OPTIONS.includes(blockAttr) ? blockAttr : defaultOp;\n\n return toNode(\"table\", { class: \"bb-block\", \"data-bb-block\": blockOption }, [\n toNode(\"tbody\", [\n toNode(\"tr\", [\n toNode(\"td\", { class: \"bb-block-icon\" }),\n toNode(\"td\", { class: \"bb-block-content\" }, node.content),\n ]),\n ]),\n ]);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds [blockquote] to bbcode\n * @example [blockquote=author]content[/blockquote]\n */\nexport const blockquote = (node) => {\n const author = preprocessAttr(node.attrs)._default || \"\";\n\n return toNode(\"div\", { class: \"bb-blockquote\" }, [\n toNode(\"div\", { class: \"bb-blockquote-left\" }),\n toNode(\"div\", { class: \"bb-blockquote-content\" }, [\n node.content,\n toNode(\"div\", { class: \"bb-blockquote-speaker\" }, author !== \"\" ? `- ${author}` : \"\"),\n ]),\n toNode(\"div\", { class: \"bb-blockquote-right\" }),\n ]);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const border = (node) => {\n const val = preprocessAttr(node.attrs)._default;\n return toNode(\n \"div\",\n {\n style: `border: ${val};`,\n class: \"bb-border\",\n },\n node.content\n );\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * Creates a line break html
tag\n */\nexport const br = () => {\n return toNode(\"br\", {}, null);\n};\n\n/**\n * Disables line breaks for given content\n * @example\n * ```\n * [nobr]test\n * test\n * test\n * [/nobr]\n *\n * test test test\n * ```\n */\nexport const nobr = (node) => {\n return { disableLineBreakConversion: true, content: node.content };\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const centerblock = (node) => {\n const percentageInput = preprocessAttr(node.attrs)._default || \"50\";\n return toNode(\"div\", { style: `margin: 0 auto; width: ${percentageInput}%` }, node.content);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const check = (node) => {\n const attrs = preprocessAttr(node.attrs)._default || \"dot\";\n return toNode(\"div\", { class: `bb-check`, \"data-type\": attrs }, node.content);\n};\n","import { isStringNode } from \"@bbob/plugin-helper\";\nimport { preprocessAttr } from \"../utils/common\";\n\n/**\n * Class style tag\n *\n * [class=name]content[/class]\n * [class name=\"className\" state=\"psuedo-class\" minWidth=\"\" maxWidth=\"\"]content[/class]\n * [class name=\"className\" selector=\"\"]content[/class]\n */\nexport const classStyle = (node, options) => {\n const attrs = preprocessAttr(node.attrs);\n const nameAttr = attrs.name || attrs._default;\n\n if (!options.data.previewing && !options.data.commonGUID) {\n // create a common GUID for the post\n // only applicable for div, style, and script tags\n // this is to prevent the same class name from being used in different posts\n options.data.commonGUID = \"post-\" + Math.random().toString(36).substring(2, 7);\n }\n const classSuffix = options.data.previewing ? \"preview\" : options.data.commonGUID;\n const className = nameAttr + \"__\" + classSuffix;\n const content = node.content\n .filter(isStringNode)\n .map((s) => s.replaceAll(\"{post_id}\", classSuffix).replaceAll(/[\\[\\]\\{\\}]/g, \"\"));\n let selector = \"\";\n const mediaQuery = [];\n if (\n [\"hover\", \"focus\", \"active\", \"focus-within\", \"focus-visible\"].includes(\n attrs.state?.toLowerCase(),\n )\n ) {\n selector = \":\" + attrs.state.toLowerCase();\n }\n if (attrs.selector) {\n selector = attrs.selector.replace(/[,{}\\\\\\n]/g, \"\");\n }\n if (attrs.minWidth?.match(/^[0-9]+[a-z]+$/)) {\n // @media (min-width: )\n mediaQuery.push(`(min-width: ${attrs.minWidth})`);\n }\n if (attrs.maxWidth?.match(/^[0-9]+[a-z]+$/)) {\n // @media (max-width: )\n mediaQuery.push(`(max-width: ${attrs.maxWidth})`);\n }\n\n content.unshift(`.${className}${selector} {`);\n content.push(\"}\");\n if (mediaQuery.length) {\n content.unshift(`@media ${mediaQuery.join(\" and \")} {`);\n content.push(\"}\");\n }\n options.data.styles.push(content.join(\"\"));\n\n return [];\n};\n","import { preprocessAttr } from \"../utils/common\";\n\n/**\n * processes [code] tag and returns a fenced code block\n */\nexport const code = (node) => {\n const lang = preprocessAttr(node.attrs)._default || \"bbcode\";\n return {\n isWhitespaceSensitive: true,\n content: [\"```\" + lang + \"\\n\", node.content, \"\\n```\\n\"],\n };\n};\n\n/**\n * processes [icode] tag and returns inline code\n */\nexport const icode = (node) => {\n return {\n isWhitespaceSensitive: true,\n content: [\"`\", node.content, \"`\"],\n };\n};\n\n/**\n * Special tag to save newlines in code blocks. Used for hoisting code blocks\n */\nexport const savenl = (node) => {\n return {\n isWhitespaceSensitive: true,\n content: node.content,\n };\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const color = (node) => {\n const inputColor = preprocessAttr(node.attrs)._default || \"\";\n if (inputColor.trim() === \"\") {\n return node.content;\n }\n return toNode(\"span\", { style: `color: ${inputColor}` }, node.content);\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds [comment] tag\n * @example [comment]Content[/comment]\n */\n\nconst comment = (node) => {\n return toNode(\"span\", { class: \"hidden\" }, node.content);\n};\n\nexport { comment };\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Adds [div] tag\n * [div=css]Content[/div]\n * [div class=\"class\" style=\"css\"]Content[/div]\n */\nexport const div = (node, options) => {\n if (node.gen) {\n // node is actually a generated node \"div\" made by another tag\n // don't process it\n return node;\n }\n const attrs = preprocessAttr(node.attrs);\n const style = attrs.style || attrs._default;\n const classAttrs = attrs.class;\n if (!classAttrs?.trim()) {\n return toNode(\n \"div\",\n {\n style,\n },\n node.content,\n );\n }\n\n if (!options.data.previewing && !options.data.commonGUID) {\n // create a common GUID for the post\n // only applicable for div, style, and script tags\n // this is to prevent the same class name from being used in different posts\n options.data.commonGUID = \"post-\" + Math.random().toString(36).substring(2, 7);\n }\n const classSuffix = options.data.previewing ? \"preview\" : options.data.commonGUID;\n const classNames = classAttrs\n .split(\" \")\n .map((c) => c + \"__\" + classSuffix)\n .join(\" \");\n\n return toNode(\n \"div\",\n {\n class: classNames,\n style,\n },\n node.content,\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const divide = (node) => {\n const type = (preprocessAttr(node.attrs)._default || \"\").toLowerCase();\n return toNode(\n \"span\",\n {\n class: \"bb-divide\",\n \"data-type\": type,\n },\n node.content\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds [fieldset] to bbcode\n * @example [fieldset=title]content[/fieldset]\n */\nexport const fieldset = (node) => {\n const title = preprocessAttr(node.attrs)._default || \"\";\n return toNode(\"fieldset\", { class: \"bb-fieldset\" }, [\n toNode(\"legend\", { class: \"bb-fieldset-legend\" }, title),\n toNode(\"div\", { class: \"bb-fieldset\" }, node.content),\n ]);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Adds [fa] tag\n * [fa]fa-icon[/fa]\n * [fa style=\"\" fa-transform=\"\"]fa-solid fa-icon[/fa]\n * [fa primary-color=\"\" secondary-color=\"\" primary-opacity=\"\" secondary-opacity=\"\" rotate-angle=\"\"]fa-duotone fa-icon[/fa]\n */\nexport const fa = (node) => {\n const attrs = preprocessAttr(node.attrs);\n let style = attrs.style || \"\";\n style += attrs[\"primary-color\"] ? `--fa-primary-color: ${attrs[\"primary-color\"]};` : \"\";\n style += attrs[\"secondary-color\"] ? `--fa-secondary-color: ${attrs[\"secondary-color\"]};` : \"\";\n style += attrs[\"primary-opacity\"] ? `--fa-primary-opacity: ${attrs[\"primary-opacity\"]};` : \"\";\n style += attrs[\"secondary-opacity\"]\n ? `--fa-secondary-opacity: ${attrs[\"secondary-opacity\"]};`\n : \"\";\n style += attrs[\"rotate-angle\"] ? `--fa-rotate-angle: ${attrs[\"rotate-angle\"]};` : \"\";\n\n return toNode(\n \"i\",\n {\n \"data-bbcode-fa\": null,\n },\n [\n toNode(\n \"i\",\n {\n class: (node.content || []).join(\"\"),\n style,\n \"data-fa-transform\": attrs[\"fa-transform\"] || \"\",\n },\n [],\n ),\n ],\n );\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds Header to bbcode\n * @example [h]content[/h], [h2]content[/h2], [h3]content[/h3],\n * [h4]content[/h4], [h5]content[/h5], [h6]content[/h6].\n */\n\nconst h = (node) => {\n return toNode(\"h1\", {}, node.content);\n};\n\nconst h1 = (node) => {\n return toNode(\"h1\", {}, node.content);\n};\n\nconst h2 = (node) => {\n return toNode(\"h2\", {}, node.content);\n};\n\nconst sh = (node) => {\n return toNode(\"h2\", {}, node.content);\n};\n\nconst h3 = (node) => {\n return toNode(\"h3\", {}, node.content);\n};\n\nconst h4 = (node) => {\n return toNode(\"h4\", {}, node.content);\n};\n\nconst h5 = (node) => {\n return toNode(\"h5\", {}, node.content);\n};\n\nconst h6 = (node) => {\n return toNode(\"h6\", {}, node.content);\n};\n\nexport { h, sh, h1, h2, h3, h4, h5, h6 };\n","import { toNode } from \"../utils/common\";\n/**\n * @file Adds [highlight] to bbcode\n * @example [highlight]content[/highlight]\n */\nexport const highlight = (node) => {\n return toNode(\"span\", { class: \"bb-highlight\" }, node.content);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n/**\n * @file Adds [imagefloat] to bbcode\n * @exmaple [imagefloat=left]content[/imagefloat]\n */\nexport const imagefloat = (node) => {\n const attrs = preprocessAttr(node.attrs)._default || \"\";\n return toNode(\"div\", { class: `bb-float-${attrs}` }, node.content);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n/**\n * @file Adds [spoiler] and [inlinespoiler] to bbcode\n *\n * Defaults to \"Spoiler\" name if no title provided\n *\n * @example `[spoiler=Title]text[/spoiler]`\n * @example `[inlinespoiler]hidden content[/inlinespoiler]\n */\n\nexport const spoiler = (node) => {\n const providedTitle = preprocessAttr(node.attrs)._default;\n const title = \"Spoiler\" + (providedTitle ? `: ${providedTitle}` : \"\");\n\n /**\n *
\n * Title\n *
\n * lorem ipsum\n *
\n *
\n */\n return toNode(\"details\", { class: \"bb-spoiler\" }, [\n toNode(\"summary\", {}, title),\n toNode(\"div\", { class: \"bb-spoiler-content\" }, node.content),\n ]);\n};\n\nexport const inlinespoiler = (node) => {\n return toNode(\"span\", { class: \"bb-inline-spoiler\" }, node.content);\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds [justify] to bbcode\n * @example [justify]content[/justify]\n */\nexport const justify = (node) => {\n return toNode(\"div\", { class: \"bb-justify\" }, node.content);\n};\n","import { toNode } from \"../utils/common\";\n/**\n * @file Adds [newspaper] to bbcode\n * @example [newspaper]content[/newspaper]\n */\nexport const newspaper = (node) => {\n return toNode(\"div\", { class: \"bb-newspaper\" }, node.content);\n};\n","import { toNode } from \"../utils/common\";\n/**\n * @file Adds [note] to bbcode\n * @example [note]content[/note]\n */\n\nexport const note = (node) => {\n return toNode(\"div\", { class: \"bb-note\" }, [\n toNode(\"div\", { class: \"bb-note-tape\" }, \"\"),\n toNode(\"div\", { class: \"bb-note-content\" }, [\n node.content,\n toNode(\"div\", { class: \"bb-note-footer\" }, \"\"),\n ]),\n ]);\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds [ooc] to bbcode\n * @example [ooc]content[/ooc]\n */\nexport const ooc = (node) => {\n return toNode(\n \"div\",\n {\n class: \"bb-ooc\",\n },\n node.content,\n );\n};\n","import { toNode } from \"../utils/common\";\n/**\n * @file Adds [pindent] to bbcode\n * @example [pindent]content[/pindent]\n */\nexport const pindent = (node) => {\n return toNode(\"span\", { class: \"bb-pindent\" }, node.content);\n};\n","/**\n * [plain] bbcode tag that prevents parsing of inner tags\n * @example\n * ```\n * [plain]This is [b]bold[/b] and [i]italic[/i][/plain]\n * ```\n * outputs to\n * ```\n * This is [b]bold[/b] and [i]italic[/i]\n * ```\n */\nexport const plain = (node) => {\n return node.content;\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Add [print] tag\n * @example [print=lined]content[/print]\n */\nexport const print = (node) => {\n const defaultOp = \"print\";\n const printAttr = (preprocessAttr(node.attrs)._default || defaultOp).toLowerCase();\n\n const OPTIONS = [\"print\", \"line\", \"graph\", \"parchment\"];\n\n // Default to print if option is not valid\n const printOption = OPTIONS.includes(printAttr) ? printAttr : defaultOp;\n\n return toNode(\n \"div\",\n { class: printOption === defaultOp ? `bb-print` : `bb-print-${printOption}` },\n node.content,\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds [progress] to bbcode\n * @exmaple [progress=percentageInt]content[/progress]\n */\nexport const progress = (node) => {\n const percentageInt = preprocessAttr(node.attrs)._default;\n return toNode(\"div\", { class: \"bb-progress\" }, [\n toNode(\"div\", { class: \"bb-progress-text\" }, node.content),\n toNode(\"div\", { class: \"bb-progress-bar\", style: `width: calc(${percentageInt}% - 6px)` }, \"\"),\n toNode(\"div\", { class: \"bb-progress-bar-other\" }, \"\"),\n ]);\n};\n","import { preprocessAttr } from \"../utils/common\";\n\n/**\n * rebuild the [quote] tag so that markdown-it engine can parse it for itself\n */\nexport const quote = (node) => {\n const attrs = preprocessAttr(node.attrs);\n if (node.content[0] === \"\\n\") {\n node.content.shift();\n }\n return [`\\n[${node.tag}=\"${attrs._default}\"]\\n\\n`, ...node.content, \"\\n\\n[/quote]\\n\"];\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds [row][column] to bbcode\n * @example Adds [row][column][/column][/row]\n */\nexport const rowcolumn = {\n row: (node) => toNode(\"div\", { class: \"bb-row\" }, node.content),\n column: (node) => {\n const columnAttrs = preprocessAttr(node.attrs)._default || \"8\";\n const columnStyle = columnAttrs.startsWith(\"span\")\n ? `column-width-${columnAttrs}`\n : `column-width-span${columnAttrs}`;\n return toNode(\"div\", { class: `bb-column`, \"data-span\": columnStyle }, node.content);\n },\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds [thinprogress] to bbcode\n * @exmaple [thinprogress=percentageInt]content[/progthinprogressress]\n */\nexport const thinprogress = (node) => {\n const percentageInt = preprocessAttr(node.attrs)._default;\n return toNode(\"div\", { class: \"bb-progress-thin\" }, [\n toNode(\"div\", { class: \"bb-progress-text\" }, node.content),\n toNode(\"div\", { class: \"bb-progress-bar\", style: `width: calc(${percentageInt}% - 6px)` }, \"\"),\n toNode(\"div\", { class: \"bb-progress-bar-other\" }, \"\"),\n ]);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Parse the user provided height and return a valid height value\n * @param {Number} heightValue obtains the input of the user entered height (default is 700)\n * @returns A validated number less than 0.\n */\nfunction parseHeight(heightValue) {\n const maxHeight = 700;\n const parsedHeight =\n heightValue && heightValue.trim() !== \"\" ? heightValue.replace(/[^\\d.]/g, \"\") : 0;\n\n if (parsedHeight && parsedHeight >= 0 && parsedHeight <= maxHeight) {\n return parsedHeight;\n } else {\n // if the value = 0 then nothing will be returned\n return parsedHeight === 0 ? 0 : maxHeight;\n }\n}\n\n/**\n * @file Adds [scroll] to bbcode\n * @example [scroll]content[/scroll]\n */\nexport const scroll = (node) => {\n const attrs = preprocessAttr(node.attrs)._default;\n const heightInput = parseHeight(attrs);\n return toNode(\"div\", { class: \"bb-scroll\", style: `height: ${heightInput}px` }, node.content);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const side = (node) => {\n const attrs = preprocessAttr(node.attrs)._default || \"left\";\n return toNode(\"div\", { class: \"bb-side\", \"data-side\": attrs }, node.content);\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds subscript to BBCode\n * @example [sub]content[/sub]\n */\n\nconst sub = (node) => {\n return toNode(\"sub\", {}, node.content);\n};\n\nexport { sub };\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds superscript to bbcode\n * @example [sup]content[/sup]\n */\n\nconst sup = (node) => {\n return toNode(\"sup\", {}, node.content);\n};\n\nexport { sup };\n","import { generateGUID, preprocessAttr, toNode, toOriginalStartTag } from \"../utils/common\";\nimport { isTagNode } from \"@bbob/plugin-helper\";\n\n/**\n * @file Adds [tabs][tab] to bbcode\n * @example [tabs][tab=name 1]content[/tab][tab=name 2]content[/tab][/tabs]\n */\nexport const tabs = (node) => {\n const tabsList = node.content.filter(\n (contentNode) => isTagNode(contentNode) && contentNode.tag === \"tab\",\n );\n const groupId = generateGUID();\n tabsList.forEach((tabNode) => {\n tabNode.isValid = true;\n tabNode.groupId = groupId;\n });\n if (!tabsList.length) {\n // no [tab] tags found\n return [toOriginalStartTag(node), ...node.content, node.toTagEnd()];\n }\n tabsList[0].open = true;\n\n return toNode(\n \"div\",\n {\n class: \"bb-tabs\",\n },\n tabsList,\n );\n};\n\n/**\n * [tab=name]content[/tab]\n * [tab name=\"name\" style=\"style\"]content[/tab]\n */\nexport const tab = (node) => {\n if (!node.isValid) {\n // not inside a [tabs] tag\n return [toOriginalStartTag(node), ...node.content, node.toTagEnd()];\n }\n const attrs = preprocessAttr(node.attrs);\n const name = attrs._default || attrs.name || \"Tab\";\n const tabId = `tab-${name.replace(/\\W/g, \"_\")}-${generateGUID()}`;\n return [\n toNode(\"input\", {\n type: \"radio\",\n id: tabId,\n name: \"tab-group-\" + node.groupId,\n class: \"bb-tab\",\n checked: node.open,\n }),\n toNode(\n \"label\",\n {\n class: \"bb-tab-label\",\n for: tabId,\n style: attrs.style,\n },\n name,\n ),\n toNode(\n \"div\",\n {\n class: \"bb-tab-content\",\n },\n node.content,\n ),\n ];\n};\n","/**\n * @file discourse-core-replacement.js\n * This is a dedicated file for replacing the standard Discourse BBCode tags in core.\n * In the markdown-it engine, discourse has added these bbcode tags in the inline parser.\n * However this means that if the parser detects a block level tag inside an inline tag,\n * it will not parse the inline tag.\n *\n * This file is meant to fix such scenarios by doing the parsing of bbcode tags for it.\n *\n * @example\n * [b][h]bold[/h][/b] // this should properly parse the bold tag inside the h tag\n *\n * https://github.com/discourse/discourse/blob/d7ece61252d7671a1f124483836279b99852c08c/app/assets/javascripts/discourse-markdown-it/src/features/bbcode-inline.js\n */\nimport { toNode } from \"../utils/common\";\n\nexport const bold = (node) => {\n return toNode(\"span\", { class: \"bbcode-b\" }, node.content);\n};\n\nexport const italic = (node) => {\n if (node.gen) {\n // node is actually a generated node \"i\" made by another tag\n // don't process it\n return node;\n }\n return toNode(\"span\", { class: \"bbcode-i\" }, node.content);\n};\n\nexport const underline = (node) => {\n return toNode(\"span\", { class: \"bbcode-u\" }, node.content);\n};\n\nexport const strike = (node) => {\n return toNode(\"span\", { class: \"bbcode-s\" }, node.content);\n};\n","import { MD_NEWLINE_INJECT, MD_NEWLINE_INJECT_COMMENT, MD_NEWLINE_PRE_INJECT } from \"./common\";\n\n/**\n * Post Processing designed to fix issues with Markdown and BBCode that the parser can't fix.\n *\n * Separate from markdown-it post processing as it'll be able to manipulate the full string.\n * @param {string} raw string from processing through both BBCode and Markdown\n * @returns post processed string\n */\nfunction removeNewlineInjects(raw) {\n const processed = raw\n .replaceAll(MD_NEWLINE_INJECT, \"\")\n .replaceAll(MD_NEWLINE_PRE_INJECT, \"\")\n .replaceAll(\"\\n\" + MD_NEWLINE_INJECT_COMMENT, \"\")\n .replaceAll(MD_NEWLINE_INJECT_COMMENT + \"\\n\", \"\")\n .replaceAll(MD_NEWLINE_INJECT_COMMENT, \"\"); // Remove all instances of the injected newline\n return processed;\n}\n\n/**\n * Injects hoisted code blocks back into the raw string\n * @param {string} raw input to inject hoisted code blocks into\n * @param {any} data contains hoist map\n * @returns string with hoisted code blocks injected\n */\nfunction renderHoistedCodeBlocks(raw, data) {\n const hoistMap = data.hoistMap;\n for (const [uuid, content] of Object.entries(hoistMap)) {\n raw = raw.replaceAll(uuid, content);\n }\n return raw;\n}\n\n/**\n * Setups the class style tag template for the post\n * @param {string} raw\n * @param {{styles: string[]}} data - contains styles array\n * @returns string\n */\nfunction createClassStyleTagTemplate(raw, data) {\n if (data.styles.length === 0) {\n return raw;\n }\n const template = '\";\n return template + raw;\n}\n\n/**\n * Setups the script tag template for the post\n * @param {string} raw\n * @param {{\n * bbscripts: {\n * id: string,\n * class: string,\n * on: string,\n * version: string,\n * content: string\n * }[]}} data - contains scripts array\n * @returns string\n */\nfunction createScriptTagTemplate(raw, data) {\n if (data.bbscripts.length === 0) {\n return raw;\n }\n const templates = data.bbscripts.map(\n (s) =>\n ``,\n );\n return templates.join(\"\") + raw;\n}\n\n/**\n * Performs post processing on the raw string to address any necessary functionality that BBob/MD can't handle with a plugin (i.e. hoisting).\n * @param {string} raw processed input from after bbob and md\n * @param {any} data from bbob data\n * @returns final processed string\n */\nexport function postprocess(raw, data) {\n let final = raw;\n const postprocessors = [\n removeNewlineInjects,\n createClassStyleTagTemplate,\n createScriptTagTemplate,\n renderHoistedCodeBlocks,\n ];\n for (const postprocessor of postprocessors) {\n final = postprocessor(final, data);\n }\n return final;\n}\n","import { ESCAPABLES_REGEX, generateGUID, MD_TABLE_REGEX, regexIndexOf } from \"./common\";\n\n/**\n * Find all code blocks and hoist them out of the content and into a map for later insertion\n * @param {string} raw input to preprocess\n * @returns processed string and hoist map\n */\nfunction fenceCodeBlockPreprocess(content, data) {\n /** @type {Object.} */\n const hoistMap = {};\n let index = 0;\n\n const addHoistAndReturnNewStartPoint = (cutOffStart, cutOffEnd, expected, trim = false) => {\n const uuid = generateGUID();\n if (cutOffEnd !== -1) {\n hoistMap[uuid] = content.substring(cutOffStart, cutOffEnd);\n content = content.substring(0, cutOffStart) + uuid + content.substring(cutOffEnd);\n } else {\n hoistMap[uuid] = content.substring(cutOffStart);\n content = content.substring(0, cutOffStart) + uuid + expected;\n }\n if (trim) {\n if (hoistMap[uuid].startsWith(\"\\n\")) {\n hoistMap[uuid] = hoistMap[uuid].substring(1);\n }\n if (hoistMap[uuid].endsWith(\"\\n\")) {\n hoistMap[uuid] = hoistMap[uuid].substring(0, hoistMap[uuid].length - 1);\n }\n }\n return cutOffStart + uuid.length + expected.length;\n };\n\n while ((index = regexIndexOf(content, ESCAPABLES_REGEX, index)) !== -1) {\n const match = ESCAPABLES_REGEX.exec(content.substring(index));\n if (match.groups?.fence) {\n const fence = match.groups.fence;\n const fenceInfo = match.groups.fenceInfo;\n if (content[index] === \"\\n\") {\n // Check if the fence is not at the start of the content\n index += 1;\n }\n const closingFenceRegex = new RegExp(\"\\n\" + fence + \"(\\n|$)\"); // Find the next fence. By commonmark spec, it should be the same fence length and type\n const nextIndex = regexIndexOf(content, closingFenceRegex, index + fence.length);\n\n const uuid = generateGUID();\n if (nextIndex !== -1) {\n hoistMap[uuid] = content.substring(index + fence.length + fenceInfo.length, nextIndex);\n } else {\n hoistMap[uuid] = content.substring(index + fence.length + fenceInfo.length);\n }\n // inject bbcode tag before and after the code block. This is to prevent BBob plugin from injecting newlines\n const replacement = `[saveNL]\\n${fence}${fenceInfo}${uuid}\\n${fence}\\n[/saveNL]`;\n content =\n content.substring(0, index) +\n replacement +\n (nextIndex !== -1 ? content.substring(nextIndex + 1 + fence.length) : \"\");\n index = index + replacement.length;\n } else if (match.groups?.bbcode) {\n const bbcode = match.groups.bbcode;\n const bbcodeTag = match.groups.bbcodeTag.toLowerCase(); // coerce to lowercase for caseinsensitive matching\n const closingTag = `[/${bbcodeTag}]`;\n const nextIndex = content.toLowerCase().indexOf(closingTag, index + 1);\n index = addHoistAndReturnNewStartPoint(index + bbcode.length, nextIndex, closingTag, true);\n } else if (match.groups.backtick) {\n const backtick = match.groups.backtick; // contains whole content\n const tickStart = match.groups.tickStart;\n const tickEnd = match.groups.tickEnd;\n index = addHoistAndReturnNewStartPoint(\n index + tickStart.length,\n index + backtick.length - tickEnd.length,\n tickEnd,\n );\n }\n }\n\n data.hoistMap = hoistMap;\n return [content, data];\n}\n\n/**\n * Find all markdown table blocks and mark them to ignore newlines\n * @param {string} raw input to preprocess\n * @returns processed string\n */\nfunction mdTableBlockPreprocess(content, data) {\n let index = 0;\n while ((index = regexIndexOf(content, MD_TABLE_REGEX, index)) !== -1) {\n const match = MD_TABLE_REGEX.exec(content.substring(index));\n const table = match[0];\n const replacement = `[saveNL]\\n${table}\\n[/saveNL]`;\n content = content.substring(0, index) + replacement + content.substring(index + table.length);\n index = index + replacement.length;\n }\n return [content, data];\n}\n\n/**\n * Preprocesses input to be formatted for bbob to intake. Handles any necessary functionality that BBob can't handle with a plugin (i.e. hoisting).\n * @param {string} raw input to preprocess\n * @returns formatted input for bbob to intake\n */\nexport function preprocessRaw(raw) {\n let data = {};\n const preprocessors = [fenceCodeBlockPreprocess, mdTableBlockPreprocess];\n for (const preprocessor of preprocessors) {\n [raw, data] = preprocessor(raw, data);\n }\n return [raw, data];\n}\n","import bbob from \"@bbob/core\";\nimport { render } from \"@bbob/html\";\nimport { lineBreakPlugin } from \"./plugins/lineBreak\";\nimport { preserveWhitespace } from \"./plugins/preserveWhitespace\";\nimport { availableTags, preset, preventParsing } from \"./preset\";\nimport { postprocess } from \"./utils/postprocess\";\nimport { preprocessRaw } from \"./utils/preprocess\";\n\nconst options = {\n onlyAllowTags: [...availableTags],\n contextFreeTags: preventParsing, // prevent parsing of children\n enableEscapeTags: true,\n onError: (err) => {\n if (options.previewing) {\n // eslint-disable-next-line no-console\n console.warn(err.message, err.lineNumber, err.columnNumber);\n }\n },\n};\nconst presetTags = preset();\n\nexport const RpNBBCode = (code, opts) => {\n const plugins = [presetTags];\n if (opts.preserveWhitespace) {\n plugins.push(preserveWhitespace());\n }\n plugins.push(lineBreakPlugin());\n const [preprocessed, preprocessedData] = preprocessRaw(code);\n return bbob(plugins).process(preprocessed, {\n render,\n ...options,\n data: {\n ...preprocessedData,\n previewing: opts.previewing,\n fonts: new Set(),\n styles: [],\n bbscripts: [],\n },\n });\n};\n\nexport { postprocess };\n","let C1 = 'C1';\nlet C2 = 'C2';\nif (process.env.NODE_ENV !== 'production') {\n C1 = '\"parser\" is not a function, please pass to \"process(input, { parser })\" right function';\n C2 = '\"render\" function not defined, please pass to \"process(input, { render })\"';\n}\nexport { C1, C2 };\n"],"names":["N","TAB","EQ","QUOTEMARK","SPACE","OPEN_BRAKET","CLOSE_BRAKET","SLASH","BACKSLASH","isTagNode","el","isStringNode","keysReduce","obj","reduce","def","Object","keys","acc","key","getNodeLength","node","Array","isArray","content","count","contentNode","String","length","escapeAttrValue","value","replace","attrValue","name","JSON","stringify","attrsToString","values","arr","join","getTagAttrs","tag","params","uniqAttr","res","tagAttr","attrs","TagNode","attr","this","append","push","appendToNode","toTagStart","openTag","closeTag","toTagEnd","toTagNode","toLowerCase","toString","r","renderContent","tagStart","create","isOf","type","constructor","TOKEN_TYPE_ID","getTokenValue","token","isTagEnd","charCodeAt","Token","isEmpty","isNaN","isText","isTag","isAttrName","isAttrValue","isStart","isEnd","getName","slice","getTagName","getValue","getLine","getColumn","text","tokenToText","row","col","TYPE_WORD","TYPE_TAG","TYPE_ATTR_NAME","TYPE_ATTR_VALUE","TYPE_SPACE","TYPE_NEW_LINE","CharGrabber","skip","num","silent","c","pos","o","onSkip","hasNext","len","getCurr","s","getRest","substring","getNext","nextPos","getPrev","prevPos","isLast","includes","val","indexOf","grabWhile","condition","start","grabN","substrUntilChar","char","idx","source","options","createCharGrabber","EM","STATE_WORD","STATE_TAG","STATE_TAG_ATTRS","TAG_STATE_NAME","TAG_STATE_ATTR","TAG_STATE_VALUE","WHITESPACES","SPECIAL_CHARS","isWhiteSpace","isEscapeChar","isSpecialChar","isNewLine","unq","str","charToRemove","charAt","trimChar","createLexer","buffer","tokenIndex","stateMode","tagMode","contextFreeTag","tokens","Math","floor","escapeTags","enableEscapeTags","contextFreeTags","filter","Boolean","map","nestedMap","Map","onToken","RESERVED_CHARS","NOT_CHAR_TOKENS","isCharReserved","isCharToken","isEscapableChar","checkContextFreeMode","isClosingTag","chars","emitToken","cl","createTokenOfType","nextTagState","tagChars","isSingleValueTag","validAttrName","isValue","stateSpecial","validAttrValue","isQM","prevChar","nextChar","isPrevSLASH","isNextEQ","isWS","isNextWS","stateTag","currChar","substr","hasInvalidChars","isNoAttrsInTag","stateAttrs","tagStr","tagGrabber","hasSpace","stateWord","word","fullTagLen","fullTagName","isChar","tokenize","isTokenNested","has","get","status","set","NodeList","last","n","flush","pop","toArray","createList","parse","input","opts","onlyAllowTags","tokenizer","nodes","nestedNodes","tagNodes","tagNodesAttrName","nestedTagsMap","Set","isTagNested","tagName","flushTagNodes","getNodes","lastNestedNode","appendNodeAsString","isNested","forEach","item","appendNodes","handleTagStart","tagNode","add","handleTag","onError","line","column","lineNumber","columnNumber","handleTagEnd","lexer","createTokenizer","activeTagNode","tokenValue","attrName","handleNode","isObj","isBool","iterate","t","cb","tree","same","expected","actual","every","exp","some","call","act","ao","eo","createTree","extendedTree","messages","walk","match","expr","expression","SELFCLOSE_END_TAG","CLOSE_START_TAG","START_TAG","END_TAG","renderNode","stripTags","render","toNode","gen","preprocessAttr","vals","_default","toOriginalStartTag","regexIndexOf","string","regex","startpos","search","MD_NEWLINE_INJECT","MD_NEWLINE_PRE_INJECT","MD_NEWLINE_INJECT_COMMENT","URL_REGEX_SINGLE_LINE","RegExp","ESCAPABLES_REGEX","MD_TABLE_REGEX","generateGUID","d","Date","getTime","window","performance","now","random","isString","disableLineBreakConversion","unshift","child","splice","isWhitespaceSensitive","test","trim","numSpaces","fromCharCode","repeat","process","tags","core","tagCallback","SLIDE_TITLE_OPEN","Symbol","SLIDE_TITLE_CLOSE","SLIDE_CLOSE","SLIDE_REGEX","markerToString","marker","accordionTags","accordion","groupId","markedContent","contentArr","newArr","shift","foundIndex","preContent","postContent","groups","slideTitleOpen","slideTitleClose","slideClose","generateSlideMarkersFromContent","generatedSlides","currentSlide","prevMarker","customTitle","generateSlidesFromMarkers","filteredContent","isValid","customSettings","split","bright","bcenter","bleft","fleft","fright","endsWith","width","find","classes","style","class","slide","title","isOpen","open","titleAlign","left","right","center","possibleOptions","alignment","anchor","a","id","goto","href","WEB_FONTS","VALID_FONT_STYLES","thin","extralight","light","regular","medium","semibold","bold","extrabold","black","REGISTERED_AXIS","AXES_REGEX","emailHeader","emailFooter","EVENTS","ACCEPTED_OPTIONS","animation","data","previewing","commonGUID","commonId","keyframes","ident","cleanContent","replaceAll","formatted","styles","bg","color","block","defaultOp","blockAttr","blockOption","blockquote","author","border","br","centerblock","percentageInput","check","nameAttr","classSuffix","className","selector","mediaQuery","state","minWidth","maxWidth","code","inputColor","comment","div","classAttrs","classNames","divide","fieldset","fa","font","fontFamily","family","axes","ital","wght","matches","exec","italic","weight","named_weight","fromEntries","entries","axesParser","url","sort","googleFontApiBuild","fonts","custom","fontVar","h","h1","h2","h3","h4","h5","h6","heightrestrict","heightInput","heightValue","parsedHeight","parseHeight","highlight","icode","imagefloat","inlinespoiler","justify","keyframe","mail","attributes","mailAttr","mailOption","person","subject","newspaper","nobr","note","ooc","pindent","plain","print","printAttr","printOption","progress","percentageInt","quote","columnAttrs","columnStyle","startsWith","thinprogress","savenl","sh","script","onEvent","on","scriptSetup","version","bbscripts","scroll","side","size","fontSize","fontValue","valid","parsedSize","sizeRanges","unit","parseFontSize","outputAttr","spoiler","providedTitle","sub","sup","tab","tabId","checked","for","tabs","tabsList","tabNode","textmessage","recipient","message","option","b","i","u","availableTags","preset","createPreset","defTags","processor","presetFactory","presetExecutor","assign","extend","callback","removeNewlineInjects","raw","renderHoistedCodeBlocks","hoistMap","uuid","createClassStyleTagTemplate","createScriptTagTemplate","fenceCodeBlockPreprocess","index","addHoistAndReturnNewStartPoint","cutOffStart","cutOffEnd","fence","fenceInfo","closingFenceRegex","nextIndex","replacement","bbcode","closingTag","bbcodeTag","backtick","tickStart","tickEnd","mdTableBlockPreprocess","table","err","console","warn","presetTags","plugins","preserveWhitespace","preprocessed","preprocessedData","preprocessors","preprocessor","preprocessRaw","plugs","mockRender","skipParse","parser","parseFn","renderFn","Error","plugin","newTree","html","bbob","final","postprocessors","postproc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SAEJ7I,EAAOW,EAAWiU,GAAW5U,EAAMpI,EACtC,CACJ,CACD,MAAO,CACH,QAAIid,GACA,GAAwB,mBAAbJ,EACP,MAAM,IAAIC,MwDxDzB,MxD0DW,OAAOD,EAASzU,EAAMA,EAAKpI,QAC9B,EACDoI,OACAiS,MACApR,SAAUb,EAAKa,SAEtB,EAET,CuDvCSiU,CAAKjB,GAAS/P,QAAQiQ,EAAc,CACzCvS,aACG5J,GACHiR,KAAM,IACDmL,EACHlL,WAAYtL,EAAKsL,WACjBwD,MAAO,IAAItO,IACXsL,OAAQ,GACRkG,UAAW,KAEb,gBFuCG,SAAqByC,EAAKpJ,GAC/B,IAAIkM,EAAQ9C,EACZ,MAAM+C,EAAiB,CACrBhD,GACAK,GACAC,GACAJ,IAEF,IAAK,MAAM+C,KAAiBD,EAC1BD,EAAQE,EAAcF,EAAOlM,GAE/B,OAAOkM,CACT","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,13,64]} \ No newline at end of file +{"version":3,"file":"bbcode-parser.min.js","sources":["../../node_modules/@bbob/plugin-helper/es/char.js","../../node_modules/@bbob/plugin-helper/es/helpers.js","../../node_modules/@bbob/plugin-helper/es/TagNode.js","../../node_modules/@bbob/parser/es/Token.js","../../node_modules/@bbob/parser/es/utils.js","../../node_modules/@bbob/parser/es/lexer.js","../../node_modules/@bbob/parser/es/parse.js","../../node_modules/@bbob/core/es/utils.js","../../node_modules/@bbob/core/es/index.js","../../node_modules/@bbob/html/es/index.js","../../bbcode-src/utils/common.js","../../bbcode-src/plugins/lineBreak.js","../../bbcode-src/plugins/preserveWhitespace.js","../../node_modules/@bbob/preset/es/preset.js","../../bbcode-src/tags/accordion.js","../../bbcode-src/tags/alignment.js","../../bbcode-src/tags/anchor.js","../../bbcode-src/tags/font.js","../../bbcode-src/tags/heightrestrict.js","../../bbcode-src/tags/mail.js","../../bbcode-src/tags/rowcolumn.js","../../bbcode-src/tags/script.js","../../bbcode-src/tags/size.js","../../bbcode-src/tags/textmessage.js","../../bbcode-src/preset.js","../../bbcode-src/tags/animation.js","../../bbcode-src/tags/background.js","../../bbcode-src/tags/block.js","../../bbcode-src/tags/blockquote.js","../../bbcode-src/tags/border.js","../../bbcode-src/tags/lineBreak.js","../../bbcode-src/tags/centerblock.js","../../bbcode-src/tags/check.js","../../bbcode-src/tags/class.js","../../bbcode-src/tags/code.js","../../bbcode-src/tags/color.js","../../bbcode-src/tags/comment.js","../../bbcode-src/tags/div.js","../../bbcode-src/tags/divide.js","../../bbcode-src/tags/fieldset.js","../../bbcode-src/tags/fontawesome.js","../../bbcode-src/tags/header.js","../../bbcode-src/tags/highlight.js","../../bbcode-src/tags/imagefloat.js","../../bbcode-src/tags/spoiler.js","../../bbcode-src/tags/justify.js","../../bbcode-src/tags/newspaper.js","../../bbcode-src/tags/note.js","../../bbcode-src/tags/ooc.js","../../bbcode-src/tags/pindent.js","../../bbcode-src/tags/plain.js","../../bbcode-src/tags/print.js","../../bbcode-src/tags/progress.js","../../bbcode-src/tags/quote.js","../../bbcode-src/tags/thinprogress.js","../../bbcode-src/tags/scroll.js","../../bbcode-src/tags/side.js","../../bbcode-src/tags/subscript.js","../../bbcode-src/tags/superscript.js","../../bbcode-src/tags/tabs.js","../../bbcode-src/tags/discourse-core-replacement.js","../../bbcode-src/utils/postprocess.js","../../bbcode-src/utils/preprocess.js","../../bbcode-src/index.js","../../node_modules/@bbob/core/es/errors.js"],"sourcesContent":["const N = '\\n';\nconst TAB = '\\t';\nconst F = '\\f';\nconst R = '\\r';\nconst EQ = '=';\nconst QUOTEMARK = '\"';\nconst SPACE = ' ';\nconst OPEN_BRAKET = '[';\nconst CLOSE_BRAKET = ']';\nconst SLASH = '/';\nconst BACKSLASH = '\\\\';\nexport { N, F, R, EQ, TAB, SPACE, SLASH, BACKSLASH, QUOTEMARK, OPEN_BRAKET, CLOSE_BRAKET };\n","import { N } from './char';\nfunction isTagNode(el) {\n return typeof el === 'object' && el !== null && 'tag' in el;\n}\nfunction isStringNode(el) {\n return typeof el === 'string';\n}\n// check string is end of line\nfunction isEOL(el) {\n return el === N;\n}\nfunction keysReduce(obj, reduce, def) {\n const keys = Object.keys(obj);\n return keys.reduce((acc, key)=>reduce(acc, key, obj), def);\n}\nfunction getNodeLength(node) {\n if (isTagNode(node) && Array.isArray(node.content)) {\n return node.content.reduce((count, contentNode)=>{\n return count + getNodeLength(contentNode);\n }, 0);\n }\n if (isStringNode(node)) {\n return String(node).length;\n }\n return 0;\n}\nfunction appendToNode(node, value) {\n if (Array.isArray(node.content)) {\n node.content.push(value);\n }\n}\n/**\n * Replaces \" to &qquot;\n * @param {string} value\n */ function escapeAttrValue(value) {\n return value.replace(/&/g, '&').replace(//g, '>').replace(/\"/g, '"').replace(/'/g, ''')// eslint-disable-next-line no-script-url\n .replace(/(javascript|data|vbscript):/gi, '$1%3A');\n}\n/**\n * @deprecated use escapeAttrValue\n */ const escapeHTML = escapeAttrValue;\n/**\n * Accept name and value and return valid html5 attribute string\n */ function attrValue(name, value) {\n // in case of performance\n switch(typeof value){\n case 'boolean':\n return value ? `${name}` : '';\n case 'number':\n return `${name}=\"${value}\"`;\n case 'string':\n return `${name}=\"${escapeAttrValue(value)}\"`;\n case 'object':\n return `${name}=\"${escapeAttrValue(JSON.stringify(value))}\"`;\n default:\n return '';\n }\n}\n/**\n * Transforms attrs to html params string\n * @example\n * attrsToString({ 'foo': true, 'bar': bar' }) => 'foo=\"true\" bar=\"bar\"'\n */ function attrsToString(values) {\n // To avoid some malformed attributes\n if (values == null) {\n return '';\n }\n return keysReduce(values, (arr, key, obj)=>[\n ...arr,\n attrValue(key, obj[key])\n ], [\n ''\n ]).join(' ');\n}\n/**\n * Gets value from\n * @example\n * getUniqAttr({ 'foo': true, 'bar': bar' }) => 'bar'\n */ function getUniqAttr(attrs) {\n return keysReduce(attrs || {}, (res, key, obj)=>obj[key] === key ? obj[key] : null, null);\n}\nexport { attrsToString, attrValue, appendToNode, escapeHTML, escapeAttrValue, getNodeLength, getUniqAttr, isTagNode, isStringNode, isEOL };\n","import { OPEN_BRAKET, CLOSE_BRAKET, SLASH } from './char';\nimport { getUniqAttr, getNodeLength, appendToNode, attrsToString, attrValue, isTagNode } from './helpers';\nconst getTagAttrs = (tag, params)=>{\n const uniqAttr = getUniqAttr(params);\n if (uniqAttr) {\n const tagAttr = attrValue(tag, uniqAttr);\n const attrs = {\n ...params\n };\n delete attrs[String(uniqAttr)];\n const attrsStr = attrsToString(attrs);\n return `${tagAttr}${attrsStr}`;\n }\n return `${tag}${attrsToString(params)}`;\n};\nconst renderContent = (content, openTag, closeTag)=>{\n const toString = (node)=>{\n if (isTagNode(node)) {\n return node.toString({\n openTag,\n closeTag\n });\n }\n return String(node);\n };\n if (Array.isArray(content)) {\n return content.reduce((r, node)=>{\n if (node !== null) {\n return r + toString(node);\n }\n return r;\n }, '');\n }\n if (content) {\n return toString(content);\n }\n return null;\n};\nexport class TagNode {\n attr(name, value) {\n if (typeof value !== 'undefined') {\n this.attrs[name] = value;\n }\n return this.attrs[name];\n }\n append(value) {\n return appendToNode(this, value);\n }\n setStart(value) {\n this.start = value;\n }\n setEnd(value) {\n this.end = value;\n }\n get length() {\n return getNodeLength(this);\n }\n toTagStart({ openTag = OPEN_BRAKET, closeTag = CLOSE_BRAKET } = {}) {\n const tagAttrs = getTagAttrs(String(this.tag), this.attrs);\n return `${openTag}${tagAttrs}${closeTag}`;\n }\n toTagEnd({ openTag = OPEN_BRAKET, closeTag = CLOSE_BRAKET } = {}) {\n return `${openTag}${SLASH}${this.tag}${closeTag}`;\n }\n toTagNode() {\n const newNode = new TagNode(String(this.tag).toLowerCase(), this.attrs, this.content);\n if (this.start) {\n newNode.setStart(this.start);\n }\n if (this.end) {\n newNode.setEnd(this.end);\n }\n return newNode;\n }\n toString({ openTag = OPEN_BRAKET, closeTag = CLOSE_BRAKET } = {}) {\n const content = this.content ? renderContent(this.content, openTag, closeTag) : '';\n const tagStart = this.toTagStart({\n openTag,\n closeTag\n });\n if (this.content === null || Array.isArray(this.content) && this.content.length === 0) {\n return tagStart;\n }\n return `${tagStart}${content}${this.toTagEnd({\n openTag,\n closeTag\n })}`;\n }\n static create(tag, attrs = {}, content = null, start) {\n const node = new TagNode(tag, attrs, content);\n if (start) {\n node.setStart(start);\n }\n return node;\n }\n static isOf(node, type) {\n return node.tag === type;\n }\n constructor(tag, attrs, content){\n this.tag = tag;\n this.attrs = attrs;\n this.content = content;\n }\n}\n","import { OPEN_BRAKET, CLOSE_BRAKET, SLASH } from '@bbob/plugin-helper';\n// type, value, line, row, start pos, end pos\nconst TOKEN_TYPE_ID = 't'; // 0;\nconst TOKEN_VALUE_ID = 'v'; // 1;\nconst TOKEN_COLUMN_ID = 'r'; // 2;\nconst TOKEN_LINE_ID = 'l'; // 3;\nconst TOKEN_START_POS_ID = 's'; // 4;\nconst TOKEN_END_POS_ID = 'e'; // 5;\nconst TOKEN_TYPE_WORD = 1; // 'word';\nconst TOKEN_TYPE_TAG = 2; // 'tag';\nconst TOKEN_TYPE_ATTR_NAME = 3; // 'attr-name';\nconst TOKEN_TYPE_ATTR_VALUE = 4; // 'attr-value';\nconst TOKEN_TYPE_SPACE = 5; // 'space';\nconst TOKEN_TYPE_NEW_LINE = 6; // 'new-line';\nconst getTokenValue = (token)=>{\n if (token && typeof token[TOKEN_VALUE_ID] !== 'undefined') {\n return token[TOKEN_VALUE_ID];\n }\n return '';\n};\nconst getTokenLine = (token)=>token && token[TOKEN_LINE_ID] || 0;\nconst getTokenColumn = (token)=>token && token[TOKEN_COLUMN_ID] || 0;\nconst getStartPosition = (token)=>token && token[TOKEN_START_POS_ID] || 0;\nconst getEndPosition = (token)=>token && token[TOKEN_END_POS_ID] || 0;\nconst isTextToken = (token)=>{\n if (token && typeof token[TOKEN_TYPE_ID] !== 'undefined') {\n return token[TOKEN_TYPE_ID] === TOKEN_TYPE_SPACE || token[TOKEN_TYPE_ID] === TOKEN_TYPE_NEW_LINE || token[TOKEN_TYPE_ID] === TOKEN_TYPE_WORD;\n }\n return false;\n};\nconst isTagToken = (token)=>{\n if (token && typeof token[TOKEN_TYPE_ID] !== 'undefined') {\n return token[TOKEN_TYPE_ID] === TOKEN_TYPE_TAG;\n }\n return false;\n};\nconst isTagEnd = (token)=>getTokenValue(token).charCodeAt(0) === SLASH.charCodeAt(0);\nconst isTagStart = (token)=>!isTagEnd(token);\nconst isAttrNameToken = (token)=>{\n if (token && typeof token[TOKEN_TYPE_ID] !== 'undefined') {\n return token[TOKEN_TYPE_ID] === TOKEN_TYPE_ATTR_NAME;\n }\n return false;\n};\nconst isAttrValueToken = (token)=>{\n if (token && typeof token[TOKEN_TYPE_ID] !== 'undefined') {\n return token[TOKEN_TYPE_ID] === TOKEN_TYPE_ATTR_VALUE;\n }\n return false;\n};\nconst getTagName = (token)=>{\n const value = getTokenValue(token);\n return isTagEnd(token) ? value.slice(1) : value;\n};\nconst tokenToText = (token)=>{\n let text = OPEN_BRAKET;\n text += getTokenValue(token);\n text += CLOSE_BRAKET;\n return text;\n};\n/**\n * @export\n * @class Token\n */ class Token {\n get type() {\n return this[TOKEN_TYPE_ID];\n }\n isEmpty() {\n return this[TOKEN_TYPE_ID] === 0 || isNaN(this[TOKEN_TYPE_ID]);\n }\n isText() {\n return isTextToken(this);\n }\n isTag() {\n return isTagToken(this);\n }\n isAttrName() {\n return isAttrNameToken(this);\n }\n isAttrValue() {\n return isAttrValueToken(this);\n }\n isStart() {\n return isTagStart(this);\n }\n isEnd() {\n return isTagEnd(this);\n }\n getName() {\n return getTagName(this);\n }\n getValue() {\n return getTokenValue(this);\n }\n getLine() {\n return getTokenLine(this);\n }\n getColumn() {\n return getTokenColumn(this);\n }\n getStart() {\n return getStartPosition(this);\n }\n getEnd() {\n return getEndPosition(this);\n }\n toString() {\n return tokenToText(this);\n }\n constructor(type, value, row = 0, col = 0, start = 0, end = 0){\n this[TOKEN_LINE_ID] = row;\n this[TOKEN_COLUMN_ID] = col;\n this[TOKEN_TYPE_ID] = type || 0;\n this[TOKEN_VALUE_ID] = String(value);\n this[TOKEN_START_POS_ID] = start;\n this[TOKEN_END_POS_ID] = end;\n }\n}\nexport const TYPE_ID = TOKEN_TYPE_ID;\nexport const VALUE_ID = TOKEN_VALUE_ID;\nexport const LINE_ID = TOKEN_LINE_ID;\nexport const COLUMN_ID = TOKEN_COLUMN_ID;\nexport const START_POS_ID = TOKEN_START_POS_ID;\nexport const END_POS_ID = TOKEN_END_POS_ID;\nexport const TYPE_WORD = TOKEN_TYPE_WORD;\nexport const TYPE_TAG = TOKEN_TYPE_TAG;\nexport const TYPE_ATTR_NAME = TOKEN_TYPE_ATTR_NAME;\nexport const TYPE_ATTR_VALUE = TOKEN_TYPE_ATTR_VALUE;\nexport const TYPE_SPACE = TOKEN_TYPE_SPACE;\nexport const TYPE_NEW_LINE = TOKEN_TYPE_NEW_LINE;\nexport { Token };\nexport default Token;\n","import { QUOTEMARK, BACKSLASH } from '@bbob/plugin-helper';\nexport class CharGrabber {\n skip(num = 1, silent) {\n this.c.pos += num;\n if (this.o && this.o.onSkip && !silent) {\n this.o.onSkip();\n }\n }\n hasNext() {\n return this.c.len > this.c.pos;\n }\n getCurr() {\n if (typeof this.s[this.c.pos] === 'undefined') {\n return '';\n }\n return this.s[this.c.pos];\n }\n getPos() {\n return this.c.pos;\n }\n getLength() {\n return this.c.len;\n }\n getRest() {\n return this.s.substring(this.c.pos);\n }\n getNext() {\n const nextPos = this.c.pos + 1;\n return nextPos <= this.s.length - 1 ? this.s[nextPos] : null;\n }\n getPrev() {\n const prevPos = this.c.pos - 1;\n if (typeof this.s[prevPos] === 'undefined') {\n return null;\n }\n return this.s[prevPos];\n }\n isLast() {\n return this.c.pos === this.c.len;\n }\n includes(val) {\n return this.s.indexOf(val, this.c.pos) >= 0;\n }\n grabWhile(condition, silent) {\n let start = 0;\n if (this.hasNext()) {\n start = this.c.pos;\n while(this.hasNext() && condition(this.getCurr())){\n this.skip(1, silent);\n }\n }\n return this.s.substring(start, this.c.pos);\n }\n grabN(num = 0) {\n return this.s.substring(this.c.pos, this.c.pos + num);\n }\n /**\n * Grabs rest of string until it find a char\n */ substrUntilChar(char) {\n const { pos } = this.c;\n const idx = this.s.indexOf(char, pos);\n return idx >= 0 ? this.s.substring(pos, idx) : '';\n }\n constructor(source, options = {}){\n this.s = source;\n this.c = {\n pos: 0,\n len: source.length\n };\n this.o = options;\n }\n}\n/**\n * Creates a grabber wrapper for source string, that helps to iterate over string char by char\n */ export const createCharGrabber = (source, options)=>new CharGrabber(source, options);\n/**\n * Trims string from start and end by char\n * @example\n * trimChar('*hello*', '*') ==> 'hello'\n */ export const trimChar = (str, charToRemove)=>{\n while(str.charAt(0) === charToRemove){\n // eslint-disable-next-line no-param-reassign\n str = str.substring(1);\n }\n while(str.charAt(str.length - 1) === charToRemove){\n // eslint-disable-next-line no-param-reassign\n str = str.substring(0, str.length - 1);\n }\n return str;\n};\n/**\n * Unquotes \\\" to \"\n */ export const unquote = (str)=>str.replace(BACKSLASH + QUOTEMARK, QUOTEMARK);\n","/* eslint-disable no-plusplus,no-param-reassign */ import { OPEN_BRAKET, CLOSE_BRAKET, QUOTEMARK, BACKSLASH, SLASH, SPACE, TAB, EQ, N } from '@bbob/plugin-helper';\nimport { Token, TYPE_ATTR_NAME, TYPE_ATTR_VALUE, TYPE_NEW_LINE, TYPE_SPACE, TYPE_TAG, TYPE_WORD } from './Token';\nimport { createCharGrabber, trimChar, unquote } from './utils';\n// for cases \nconst EM = '!';\nexport function createTokenOfType(type, value, r = 0, cl = 0, p = 0, e = 0) {\n return new Token(type, value, r, cl, p, e);\n}\nconst STATE_WORD = 0;\nconst STATE_TAG = 1;\nconst STATE_TAG_ATTRS = 2;\nconst TAG_STATE_NAME = 0;\nconst TAG_STATE_ATTR = 1;\nconst TAG_STATE_VALUE = 2;\nconst WHITESPACES = [\n SPACE,\n TAB\n];\nconst SPECIAL_CHARS = [\n EQ,\n SPACE,\n TAB\n];\nconst END_POS_OFFSET = 2; // length + start position offset\nconst isWhiteSpace = (char)=>WHITESPACES.indexOf(char) >= 0;\nconst isEscapeChar = (char)=>char === BACKSLASH;\nconst isSpecialChar = (char)=>SPECIAL_CHARS.indexOf(char) >= 0;\nconst isNewLine = (char)=>char === N;\nconst unq = (val)=>unquote(trimChar(val, QUOTEMARK));\nexport function createLexer(buffer, options = {}) {\n let row = 0;\n let prevCol = 0;\n let col = 0;\n let tokenIndex = -1;\n let stateMode = STATE_WORD;\n let tagMode = TAG_STATE_NAME;\n let contextFreeTag = '';\n const tokens = new Array(Math.floor(buffer.length));\n const openTag = options.openTag || OPEN_BRAKET;\n const closeTag = options.closeTag || CLOSE_BRAKET;\n const escapeTags = !!options.enableEscapeTags;\n const contextFreeTags = (options.contextFreeTags || []).filter(Boolean).map((tag)=>tag.toLowerCase());\n const nestedMap = new Map();\n const onToken = options.onToken || (()=>{});\n const RESERVED_CHARS = [\n closeTag,\n openTag,\n QUOTEMARK,\n BACKSLASH,\n SPACE,\n TAB,\n EQ,\n N,\n EM\n ];\n const NOT_CHAR_TOKENS = [\n openTag,\n SPACE,\n TAB,\n N\n ];\n const isCharReserved = (char)=>RESERVED_CHARS.indexOf(char) >= 0;\n const isCharToken = (char)=>NOT_CHAR_TOKENS.indexOf(char) === -1;\n const isEscapableChar = (char)=>char === openTag || char === closeTag || char === BACKSLASH;\n const onSkip = ()=>{\n col++;\n };\n const checkContextFreeMode = (name, isClosingTag)=>{\n if (contextFreeTag !== '' && isClosingTag) {\n contextFreeTag = '';\n }\n if (contextFreeTag === '' && contextFreeTags.includes(name.toLowerCase())) {\n contextFreeTag = name;\n }\n };\n const chars = createCharGrabber(buffer, {\n onSkip\n });\n /**\n * Emits newly created token to subscriber\n * @param {Number} type\n * @param {String} value\n */ function emitToken(type, value, startPos, endPos) {\n const token = createTokenOfType(type, value, row, prevCol, startPos, endPos);\n onToken(token);\n prevCol = col;\n tokenIndex += 1;\n tokens[tokenIndex] = token;\n }\n function nextTagState(tagChars, isSingleValueTag, masterStartPos) {\n if (tagMode === TAG_STATE_ATTR) {\n const validAttrName = (char)=>!(char === EQ || isWhiteSpace(char));\n const name = tagChars.grabWhile(validAttrName);\n const isEnd = tagChars.isLast();\n const isValue = tagChars.getCurr() !== EQ;\n tagChars.skip();\n if (isEnd || isValue) {\n emitToken(TYPE_ATTR_VALUE, unq(name));\n } else {\n emitToken(TYPE_ATTR_NAME, name);\n }\n if (isEnd) {\n return TAG_STATE_NAME;\n }\n if (isValue) {\n return TAG_STATE_ATTR;\n }\n return TAG_STATE_VALUE;\n }\n if (tagMode === TAG_STATE_VALUE) {\n let stateSpecial = false;\n const validAttrValue = (char)=>{\n // const isEQ = char === EQ;\n const isQM = char === QUOTEMARK;\n const prevChar = tagChars.getPrev();\n const nextChar = tagChars.getNext();\n const isPrevSLASH = prevChar === BACKSLASH;\n const isNextEQ = nextChar === EQ;\n const isWS = isWhiteSpace(char);\n // const isPrevWS = isWhiteSpace(prevChar);\n const isNextWS = nextChar && isWhiteSpace(nextChar);\n if (stateSpecial && isSpecialChar(char)) {\n return true;\n }\n if (isQM && !isPrevSLASH) {\n stateSpecial = !stateSpecial;\n if (!stateSpecial && !(isNextEQ || isNextWS)) {\n return false;\n }\n }\n if (!isSingleValueTag) {\n return !isWS;\n // return (isEQ || isWS) === false;\n }\n return true;\n };\n const name = tagChars.grabWhile(validAttrValue);\n tagChars.skip();\n emitToken(TYPE_ATTR_VALUE, unq(name));\n if (tagChars.getPrev() === QUOTEMARK) {\n prevCol++;\n }\n if (tagChars.isLast()) {\n return TAG_STATE_NAME;\n }\n return TAG_STATE_ATTR;\n }\n const start = masterStartPos + tagChars.getPos() - 1;\n const validName = (char)=>!(char === EQ || isWhiteSpace(char) || tagChars.isLast());\n const name = tagChars.grabWhile(validName);\n emitToken(TYPE_TAG, name, start, masterStartPos + tagChars.getLength() + 1);\n checkContextFreeMode(name);\n tagChars.skip();\n prevCol++;\n // in cases when we has [url=someval]GET[/url] and we dont need to parse all\n if (isSingleValueTag) {\n return TAG_STATE_VALUE;\n }\n const hasEQ = tagChars.includes(EQ);\n return hasEQ ? TAG_STATE_ATTR : TAG_STATE_VALUE;\n }\n function stateTag() {\n const currChar = chars.getCurr();\n const nextChar = chars.getNext();\n chars.skip();\n // detect case where we have '[My word [tag][/tag]' or we have '[My last line word'\n const substr = chars.substrUntilChar(closeTag);\n const hasInvalidChars = substr.length === 0 || substr.indexOf(openTag) >= 0;\n if (nextChar && isCharReserved(nextChar) || hasInvalidChars || chars.isLast()) {\n emitToken(TYPE_WORD, currChar);\n return STATE_WORD;\n }\n // [myTag ]\n const isNoAttrsInTag = substr.indexOf(EQ) === -1;\n // [/myTag]\n const isClosingTag = substr[0] === SLASH;\n if (isNoAttrsInTag || isClosingTag) {\n const startPos = chars.getPos() - 1;\n const name = chars.grabWhile((char)=>char !== closeTag);\n const endPos = startPos + name.length + END_POS_OFFSET;\n chars.skip(); // skip closeTag\n emitToken(TYPE_TAG, name, startPos, endPos);\n checkContextFreeMode(name, isClosingTag);\n return STATE_WORD;\n }\n return STATE_TAG_ATTRS;\n }\n function stateAttrs() {\n const startPos = chars.getPos();\n const silent = true;\n const tagStr = chars.grabWhile((char)=>char !== closeTag, silent);\n const tagGrabber = createCharGrabber(tagStr, {\n onSkip\n });\n const hasSpace = tagGrabber.includes(SPACE);\n tagMode = TAG_STATE_NAME;\n while(tagGrabber.hasNext()){\n tagMode = nextTagState(tagGrabber, !hasSpace, startPos);\n }\n chars.skip(); // skip closeTag\n return STATE_WORD;\n }\n function stateWord() {\n if (isNewLine(chars.getCurr())) {\n emitToken(TYPE_NEW_LINE, chars.getCurr());\n chars.skip();\n col = 0;\n prevCol = 0;\n row++;\n return STATE_WORD;\n }\n if (isWhiteSpace(chars.getCurr())) {\n const word = chars.grabWhile(isWhiteSpace);\n emitToken(TYPE_SPACE, word);\n return STATE_WORD;\n }\n if (chars.getCurr() === openTag) {\n if (contextFreeTag) {\n const fullTagLen = openTag.length + SLASH.length + contextFreeTag.length;\n const fullTagName = `${openTag}${SLASH}${contextFreeTag}`;\n const foundTag = chars.grabN(fullTagLen);\n const isEndContextFreeMode = foundTag === fullTagName;\n if (isEndContextFreeMode) {\n return STATE_TAG;\n }\n } else if (chars.includes(closeTag)) {\n return STATE_TAG;\n }\n emitToken(TYPE_WORD, chars.getCurr());\n chars.skip();\n prevCol++;\n return STATE_WORD;\n }\n if (escapeTags) {\n if (isEscapeChar(chars.getCurr())) {\n const currChar = chars.getCurr();\n const nextChar = chars.getNext();\n chars.skip(); // skip the \\ without emitting anything\n if (nextChar && isEscapableChar(nextChar)) {\n chars.skip(); // skip past the [, ] or \\ as well\n emitToken(TYPE_WORD, nextChar);\n return STATE_WORD;\n }\n emitToken(TYPE_WORD, currChar);\n return STATE_WORD;\n }\n const isChar = (char)=>isCharToken(char) && !isEscapeChar(char);\n const word = chars.grabWhile(isChar);\n emitToken(TYPE_WORD, word);\n return STATE_WORD;\n }\n const word = chars.grabWhile(isCharToken);\n emitToken(TYPE_WORD, word);\n return STATE_WORD;\n }\n function tokenize() {\n stateMode = STATE_WORD;\n while(chars.hasNext()){\n switch(stateMode){\n case STATE_TAG:\n stateMode = stateTag();\n break;\n case STATE_TAG_ATTRS:\n stateMode = stateAttrs();\n break;\n case STATE_WORD:\n default:\n stateMode = stateWord();\n break;\n }\n }\n tokens.length = tokenIndex + 1;\n return tokens;\n }\n function isTokenNested(token) {\n const value = openTag + SLASH + token.getValue();\n if (nestedMap.has(value)) {\n return !!nestedMap.get(value);\n } else {\n const status = buffer.indexOf(value) > -1;\n nestedMap.set(value, status);\n return status;\n }\n }\n return {\n tokenize,\n isTokenNested\n };\n}\n","import { CLOSE_BRAKET, OPEN_BRAKET, TagNode, isTagNode } from \"@bbob/plugin-helper\";\nimport { createLexer } from \"./lexer\";\nclass NodeList {\n last() {\n if (Array.isArray(this.n) && this.n.length > 0 && typeof this.n[this.n.length - 1] !== \"undefined\") {\n return this.n[this.n.length - 1];\n }\n return null;\n }\n flush() {\n return this.n.length ? this.n.pop() : false;\n }\n push(value) {\n this.n.push(value);\n }\n toArray() {\n return this.n;\n }\n constructor(){\n this.n = [];\n }\n}\nconst createList = ()=>new NodeList();\nfunction parse(input, opts = {}) {\n const options = opts;\n const openTag = options.openTag || OPEN_BRAKET;\n const closeTag = options.closeTag || CLOSE_BRAKET;\n const onlyAllowTags = (options.onlyAllowTags || []).filter(Boolean).map((tag)=>tag.toLowerCase());\n let tokenizer = null;\n /**\n * Result AST of nodes\n * @private\n * @type {NodeList}\n */ const nodes = createList();\n /**\n * Temp buffer of nodes that's nested to another node\n * @private\n */ const nestedNodes = createList();\n /**\n * Temp buffer of nodes [tag..]...[/tag]\n * @private\n * @type {NodeList}\n */ const tagNodes = createList();\n /**\n * Temp buffer of tag attributes\n * @private\n * @type {NodeList}\n */ const tagNodesAttrName = createList();\n /**\n * Cache for nested tags checks\n */ const nestedTagsMap = new Set();\n function isTokenNested(token) {\n const value = token.getValue();\n const { isTokenNested } = tokenizer || {};\n if (!nestedTagsMap.has(value) && isTokenNested && isTokenNested(token)) {\n nestedTagsMap.add(value);\n return true;\n }\n return nestedTagsMap.has(value);\n }\n /**\n * @private\n */ function isTagNested(tagName) {\n return Boolean(nestedTagsMap.has(tagName));\n }\n /**\n * @private\n */ function isAllowedTag(value) {\n if (onlyAllowTags.length) {\n return onlyAllowTags.indexOf(value.toLowerCase()) >= 0;\n }\n return true;\n }\n /**\n * Flushes temp tag nodes and its attributes buffers\n * @private\n */ function flushTagNodes() {\n if (tagNodes.flush()) {\n tagNodesAttrName.flush();\n }\n }\n /**\n * @private\n */ function getNodes() {\n const lastNestedNode = nestedNodes.last();\n if (lastNestedNode && isTagNode(lastNestedNode)) {\n return lastNestedNode.content;\n }\n return nodes.toArray();\n }\n /**\n * @private\n */ function appendNodeAsString(nodes, node, isNested = true) {\n if (Array.isArray(nodes) && typeof node !== \"undefined\") {\n nodes.push(node.toTagStart({\n openTag,\n closeTag\n }));\n if (Array.isArray(node.content) && node.content.length) {\n node.content.forEach((item)=>{\n nodes.push(item);\n });\n if (isNested) {\n nodes.push(node.toTagEnd({\n openTag,\n closeTag\n }));\n }\n }\n }\n }\n /**\n * @private\n */ function appendNodes(nodes, node) {\n if (Array.isArray(nodes) && typeof node !== \"undefined\") {\n if (isTagNode(node)) {\n if (isAllowedTag(node.tag)) {\n nodes.push(node.toTagNode());\n } else {\n appendNodeAsString(nodes, node);\n }\n } else {\n nodes.push(node);\n }\n }\n }\n /**\n * @private\n * @param {Token} token\n */ function handleTagStart(token) {\n flushTagNodes();\n const tagNode = TagNode.create(token.getValue(), {}, [], {\n from: token.getStart(),\n to: token.getEnd()\n });\n const isNested = isTokenNested(token);\n tagNodes.push(tagNode);\n if (isNested) {\n nestedNodes.push(tagNode);\n } else {\n const nodes = getNodes();\n appendNodes(nodes, tagNode);\n }\n }\n /**\n * @private\n * @param {Token} token\n */ function handleTagEnd(token) {\n const lastTagNode = nestedNodes.last();\n if (isTagNode(lastTagNode)) {\n lastTagNode.setEnd({\n from: token.getStart(),\n to: token.getEnd()\n });\n }\n flushTagNodes();\n const lastNestedNode = nestedNodes.flush();\n if (lastNestedNode) {\n const nodes = getNodes();\n appendNodes(nodes, lastNestedNode);\n } else if (typeof options.onError === \"function\") {\n const tag = token.getValue();\n const line = token.getLine();\n const column = token.getColumn();\n options.onError({\n tagName: tag,\n lineNumber: line,\n columnNumber: column\n });\n }\n }\n /**\n * @private\n * @param {Token} token\n */ function handleTag(token) {\n // [tag]\n if (token.isStart()) {\n handleTagStart(token);\n }\n // [/tag]\n if (token.isEnd()) {\n handleTagEnd(token);\n }\n }\n /**\n * @private\n * @param {Token} token\n */ function handleNode(token) {\n /**\n * @type {TagNode}\n */ const activeTagNode = tagNodes.last();\n const tokenValue = token.getValue();\n const isNested = isTagNested(token.toString());\n const nodes = getNodes();\n if (activeTagNode !== null) {\n if (token.isAttrName()) {\n tagNodesAttrName.push(tokenValue);\n const attrName = tagNodesAttrName.last();\n if (attrName) {\n activeTagNode.attr(attrName, \"\");\n }\n } else if (token.isAttrValue()) {\n const attrName = tagNodesAttrName.last();\n if (attrName) {\n activeTagNode.attr(attrName, tokenValue);\n tagNodesAttrName.flush();\n } else {\n activeTagNode.attr(tokenValue, tokenValue);\n }\n } else if (token.isText()) {\n if (isNested) {\n activeTagNode.append(tokenValue);\n } else {\n appendNodes(nodes, tokenValue);\n }\n } else if (token.isTag()) {\n // if tag is not allowed, just pass it as is\n appendNodes(nodes, token.toString());\n }\n } else if (token.isText()) {\n appendNodes(nodes, tokenValue);\n } else if (token.isTag()) {\n // if tag is not allowed, just pass it as is\n appendNodes(nodes, token.toString());\n }\n }\n /**\n * @private\n * @param {Token} token\n */ function onToken(token) {\n if (token.isTag()) {\n handleTag(token);\n } else {\n handleNode(token);\n }\n }\n const lexer = opts.createTokenizer ? opts.createTokenizer : createLexer;\n tokenizer = lexer(input, {\n onToken,\n openTag,\n closeTag,\n onlyAllowTags: options.onlyAllowTags,\n contextFreeTags: options.contextFreeTags,\n enableEscapeTags: options.enableEscapeTags\n });\n // eslint-disable-next-line no-unused-vars\n const tokens = tokenizer.tokenize();\n // handles situations where we open tag, but forgot close them\n // for ex [q]test[/q][u]some[/u][q]some [u]some[/u] // forgot to close [/q]\n // so we need to flush nested content to nodes array\n const lastNestedNode = nestedNodes.flush();\n if (lastNestedNode !== null && lastNestedNode && isTagNode(lastNestedNode) && isTagNested(lastNestedNode.tag)) {\n appendNodeAsString(getNodes(), lastNestedNode, false);\n }\n return nodes.toArray();\n}\nexport { parse };\nexport default parse;\n","/* eslint-disable no-plusplus */ const isObj = (value)=>typeof value === 'object' && value !== null;\nconst isBool = (value)=>typeof value === 'boolean';\nexport function iterate(t, cb) {\n const tree = t;\n if (Array.isArray(tree)) {\n for(let idx = 0; idx < tree.length; idx++){\n tree[idx] = iterate(cb(tree[idx]), cb);\n }\n } else if (isObj(tree) && 'content' in tree) {\n iterate(tree.content, cb);\n }\n return tree;\n}\nexport function same(expected, actual) {\n if (typeof expected !== typeof actual) {\n return false;\n }\n if (!isObj(expected) || expected === null) {\n return expected === actual;\n }\n if (Array.isArray(expected)) {\n return expected.every((exp)=>[].some.call(actual, (act)=>same(exp, act)));\n }\n if (isObj(expected) && isObj(actual)) {\n return Object.keys(expected).every((key)=>{\n const ao = actual[key];\n const eo = expected[key];\n if (isObj(eo) && isObj(ao)) {\n return same(eo, ao);\n }\n if (isBool(eo)) {\n return eo !== (ao === null);\n }\n return ao === eo;\n });\n }\n return false;\n}\nexport function match(t, expression, cb) {\n if (Array.isArray(expression)) {\n return iterate(t, (node)=>{\n for(let idx = 0; idx < expression.length; idx++){\n if (same(expression[idx], node)) {\n return cb(node);\n }\n }\n return node;\n });\n }\n return iterate(t, (node)=>same(expression, node) ? cb(node) : node);\n}\n","import { parse } from '@bbob/parser';\nimport { iterate, match } from './utils';\nimport { C1, C2 } from './errors';\nexport function createTree(tree, options) {\n const extendedTree = tree;\n extendedTree.messages = [\n ...extendedTree.messages || []\n ];\n extendedTree.options = {\n ...options,\n ...extendedTree.options\n };\n extendedTree.walk = function walkNodes(cb) {\n return iterate(this, cb);\n };\n extendedTree.match = function matchNodes(expr, cb) {\n return match(this, expr, cb);\n };\n return extendedTree;\n}\nexport default function bbob(plugs) {\n const plugins = typeof plugs === 'function' ? [\n plugs\n ] : plugs || [];\n const mockRender = ()=>\"\";\n return {\n process (input, opts) {\n const options = opts || {\n skipParse: false,\n parser: parse,\n render: mockRender,\n data: null\n };\n const parseFn = options.parser || parse;\n const renderFn = options.render;\n const data = options.data || null;\n if (typeof parseFn !== 'function') {\n throw new Error(C1);\n }\n // raw tree before modification with plugins\n const raw = options.skipParse && Array.isArray(input) ? input : parseFn(input, options);\n let tree = options.skipParse && Array.isArray(input) ? createTree(input || [], options) : createTree(raw, options);\n for(let idx = 0; idx < plugins.length; idx++){\n const plugin = plugins[idx];\n if (typeof plugin === 'function' && renderFn) {\n const newTree = plugin(tree, {\n parse: parseFn,\n render: renderFn,\n iterate,\n data\n });\n tree = createTree(newTree || tree, options);\n }\n }\n return {\n get html () {\n if (typeof renderFn !== 'function') {\n throw new Error(C2);\n }\n return renderFn(tree, tree.options);\n },\n tree,\n raw,\n messages: tree.messages\n };\n }\n };\n}\n","import core from '@bbob/core';\nimport { attrsToString, isTagNode } from '@bbob/plugin-helper';\nconst SELFCLOSE_END_TAG = '/>';\nconst CLOSE_START_TAG = '';\nfunction renderNode(node, options) {\n const { stripTags = false } = options || {};\n if (typeof node === 'undefined' || node === null) {\n return '';\n }\n if (typeof node === 'string' || typeof node === 'number') {\n return String(node);\n }\n if (Array.isArray(node)) {\n return render(node, options);\n }\n if (isTagNode(node)) {\n if (stripTags) {\n return render(node.content, options);\n }\n const attrs = attrsToString(node.attrs);\n if (node.content === null) {\n return START_TAG + node.tag + attrs + SELFCLOSE_END_TAG;\n }\n return START_TAG + node.tag + attrs + END_TAG + render(node.content, options) + CLOSE_START_TAG + node.tag + END_TAG;\n }\n return '';\n}\nexport function render(nodes, options) {\n if (nodes && Array.isArray(nodes)) {\n return nodes.reduce((r, node)=>r + renderNode(node, options), '');\n }\n if (nodes) {\n return renderNode(nodes, options);\n }\n return '';\n}\nexport function html(source, plugins, options) {\n return core(plugins).process(source, {\n ...options,\n render: render\n }).html;\n}\nexport default html;\n","/**\n * Generate the node object.\n *\n * Contains additional logic to help break any unintended side effects of the top down parsing of bbob.\n * @param {string} tag name of the tag\n * @param {Object} attrs attributes of the tag\n * @param {any} content contents of the tag. `[]` will create an empty tag. `null` will create a self closing tag\n *\n * @example\n * ```\n * toNode(\"div\", { class: \"class\" }, \"content\")\n * ```\n * becomes\n * ```\n * {\n * tag: \"div\",\n * attrs: { class: \"class\" },\n * content: \"content\",\n * gen: true,\n * }\n */\nconst toNode = (tag, attrs, content = []) => ({\n tag,\n attrs,\n content,\n gen: true,\n});\n\n/**\n * Preprocess attributes of a node to either return the default single attribute\n * or return a keyed attribute list\n * @param {import('@bbob/types').TagNode} node bbcode node to process\n * @param {string} [raw] raw string. Only include if the single attribute is allowed to have spaces\n * @returns processed attributes\n */\nconst preprocessAttr = (node, raw) => {\n const keys = Object.keys(node.attrs).join(\" \");\n const vals = Object.values(node.attrs).join(\" \");\n if (keys !== vals) {\n return node.attrs;\n }\n if (!raw || !node.start) {\n return {\n _default: vals,\n };\n }\n // [tag=attr]\n // node.start.from = 0\n // node.start.to = 10\n const openTagParts = raw.substring(node.start.from, node.start.to).split(\"=\");\n if (openTagParts.length !== 2) {\n return node.attrs;\n }\n let val = openTagParts[1].slice(0, -1).trim(); // `attr` or `\"attr\"`\n if (val.startsWith('\"') && val.endsWith('\"')) {\n val = val.slice(1, -1);\n }\n return {\n _default: val,\n };\n};\n\n/**\n * Attempts to return tag into its original form with proper attributes\n * @returns string of tag start\n */\nconst toOriginalStartTag = (node) => {\n if (!node.attrs) {\n return `[${node.tag}]`;\n }\n const attrs = preprocessAttr(node.attrs);\n if (attrs._default) {\n return `[${node.tag}=${attrs._default}]`;\n } else {\n return node.toTagStart();\n }\n};\n\n/**\n * Given a string, find the first position of a regex match\n * @param {string} string to test against\n * @param {RegExp} regex to test with\n * @param {number} startpos starting position. Defaults to 0\n * @returns index of the first match of the regex in the string\n */\nconst regexIndexOf = (string, regex, startpos) => {\n const indexOf = string.substring(startpos || 0).search(regex);\n return indexOf >= 0 ? indexOf + (startpos || 0) : indexOf;\n};\n\nconst MD_NEWLINE_INJECT = \"\\n\\n\";\nconst MD_NEWLINE_PRE_INJECT = \"\\n\\n\";\nconst MD_NEWLINE_INJECT_COMMENT = \"\";\n\nconst URL_REGEX =\n /(http|ftp|https|upload):\\/\\/([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:\\/~+#-]*[\\w@?^=%&\\/~+#-])/;\nconst MD_URL_REGEX =\n /\\!?\\[.*\\]\\((http|ftp|https|upload):\\/\\/([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:\\/~+#-]*[\\w@?^=%&\\/~+#-])\\)/;\nconst URL_REGEX_SINGLE_LINE = new RegExp(`^${URL_REGEX.source}|${MD_URL_REGEX.source}$`);\nconst ESCAPABLES_REGEX =\n /((\\n|^)(?```+|~~~+)(?.*\\n))|(?\\[(?i?code|plain)(=.*)?\\])|(?(?`{1,2})(.*)(?\\k))/im;\nconst MD_TABLE_REGEX = /^(\\|[^\\n]+\\|\\r?\\n)((?:\\| ?:?[-]+:? ?)+\\|)(\\n(?:\\|[^\\n]+\\|\\r?\\n?)*)?$/m;\n\n/**\n * Generates a random GUID.\n *\n * Mini Racer doesn't have the crypto module, so we can't use the built-in `crypto.randomUUID` function.\n * @returns {string} a GUID\n */\nfunction generateGUID() {\n let d = new Date().getTime();\n if (window.performance && typeof window.performance.now === \"function\") {\n d += performance.now(); //use high-precision timer if available\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n // eslint-disable-next-line no-bitwise\n const r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n // eslint-disable-next-line no-bitwise\n return (c === \"x\" ? r : (r & 0x3) | 0x8).toString(16);\n });\n}\n\nexport {\n toNode,\n toOriginalStartTag,\n generateGUID,\n preprocessAttr,\n regexIndexOf,\n MD_NEWLINE_INJECT,\n MD_NEWLINE_INJECT_COMMENT,\n MD_NEWLINE_PRE_INJECT,\n URL_REGEX,\n MD_URL_REGEX,\n MD_TABLE_REGEX,\n URL_REGEX_SINGLE_LINE,\n ESCAPABLES_REGEX,\n};\n","/**\n * Plugin that converts line breaks to `
` tags.\n * To use, put as function similar to the presets.\n *\n * If a node is marked with `noLineBreakConversion`, then it'll skip the parsing the children\n *\n * @example\n * ```ts\n * const output = bbob([preset(), lineBreakPlugin()]).process(input, {render}).html\n * ```\n */\nimport { isEOL } from \"@bbob/plugin-helper\";\nimport { MD_NEWLINE_INJECT, MD_NEWLINE_PRE_INJECT, URL_REGEX_SINGLE_LINE } from \"../utils/common\";\n\nconst isObj = (value) => typeof value === \"object\";\nconst isString = (value) => typeof value === \"string\";\n\n/**\n * Walks the tree of nodes. Will add `br` tag to all `\\n` in format that can be used in any renderer.\n * Preserves \\n so that markdown-it doesn't try to treat everything like a block\n *\n * If a node has the property noLineBreakConversion is encountered, will skip parsing children.\n * @param t tree of nodes to be processed\n * @returns modified tree\n */\nconst walk = (t, disableLineBreakConversion = false) => {\n const tree = t;\n\n if (Array.isArray(tree)) {\n if (tree.some(isString)) {\n // array contains strings. Might be md compatible\n tree.unshift(MD_NEWLINE_INJECT);\n tree.push(MD_NEWLINE_INJECT);\n }\n for (let idx = 0; idx < tree.length; idx++) {\n const child = walk(tree[idx], disableLineBreakConversion);\n if (Array.isArray(child)) {\n tree.splice(idx, 1, ...child);\n idx += child.length - 1;\n } else {\n tree[idx] = child;\n }\n }\n } else if (tree && isObj(tree) && tree.content) {\n if (tree.isWhitespaceSensitive) {\n // applies only to [code] and [icode]\n // stop walk. children won't be parsed to have
\n return tree.tag ? tree : tree.content;\n }\n if (tree.disableLineBreakConversion) {\n disableLineBreakConversion = true;\n }\n walk(tree.content, disableLineBreakConversion);\n return tree.tag ? tree : tree.content;\n } else if (isString(tree) && URL_REGEX_SINGLE_LINE.test(tree.trim())) {\n // if the entire string is a URL, then it should be prepared for onebox.\n // BBob separates strings by newlines anyway, so we can already assume this is sitting on its own line\n // MD_NEWLINE_INJECT is already replacing newline came before or the start of the array,\n // so we only need to make sure \\n\\n is added after the URL\n return [tree, MD_NEWLINE_PRE_INJECT];\n }\n\n if (isString(tree) && isEOL(tree)) {\n return disableLineBreakConversion\n ? [\"\\n\", MD_NEWLINE_INJECT]\n : [{ tag: \"br\", content: null }, MD_NEWLINE_INJECT];\n }\n\n return tree;\n};\n\n/**\n * Converts `\\n` to `
` self closing tag. Supply this as the last plugin in the preset lists\n *\n * @example converts all line breaks to br\n * ```ts\n * const output = bbob([preset(), lineBreakPlugin()]).process(input, {render}).html\n * ```\n * @example will not convert line breaks inside [nobr]\n * ```ts\n * const nobr = (node: TagNode) => {return { disableLineBreakConversion: true, content: node.content }}; \\\\ tag in preset\n * ...\n * const output = bbob([preset(), lineBreakPlugin()]).process(input, {render}).html\n * ```\n * @returns plugin to be used in BBob process\n */\nexport const lineBreakPlugin = () => {\n return (tree) => walk(tree);\n};\n","/**\n * Plugin that converts consecutive normal spaces (U+0020) to non-breaking spaces (U+00A0).\n * To use, put as function similar to the presets.\n *\n *\n * @example\n * ```ts\n * const output = bbob([preset(), , preserveWhitespace(), lineBreakPlugin()]).process(input, {render}).html\n * ```\n */\nimport { isStringNode } from \"@bbob/plugin-helper\";\n\n/**\n * Checks if input is an object\n * @param value input\n * @returns if value is an object\n */\nconst isObj = (value) => typeof value === \"object\";\n\n/**\n * Walks the tree of nodes. Checks for node of consecutive spaces. If found replaces every space in\n * node with a nonbreaking space.\n * Preserves multiple spaces so html won't truncate them.\n *\n * Walks through entire tree.\n * @param t tree of nodes to be processed\n * @returns modified tree\n */\nconst walk = (t) => {\n const tree = t;\n\n if (Array.isArray(tree)) {\n for (let idx = 0; idx < tree.length; idx++) {\n const child = walk(tree[idx]);\n if (Array.isArray(child)) {\n tree.splice(idx, 1, ...child);\n idx += child.length - 1;\n } else {\n tree[idx] = child;\n }\n }\n } else if (tree && isObj(tree) && tree.content) {\n walk(tree.content);\n }\n\n //Bbob breaks up nodes by the presence of normal spaces.\n //So a node with a normal space can only have normal spaces in that node.\n if (isStringNode(tree)) {\n if (tree.length > 1 && tree[0] === \" \") {\n let numSpaces = tree.length;\n return [String.fromCharCode(160).repeat(numSpaces)];\n }\n }\n\n return tree;\n};\n\n/**\n * Converts consecutive normal spaces (U+0020) to nonbreaking spaces (U+00A0).\n * Supply this as a plugin in the preset lists.\n *\n * @example converts consecutive normal spaces (U+0020) to nonbreaking spaces (U+00A0)\n * ```ts\n * const output = bbob([preset(), preserveWhitespace(), lineBreakPlugin()]).process(input, {render}).html\n * ```\n *\n * @returns plugin to be used in BBob process\n */\nexport const preserveWhitespace = () => {\n return (tree) => walk(tree);\n};\n","import { isTagNode } from \"@bbob/plugin-helper\";\nexport function process(tags, tree, core, options) {\n return tree.walk((node)=>{\n if (isTagNode(node)) {\n const tag = node.tag;\n const tagCallback = tags[tag];\n if (typeof tagCallback === \"function\") {\n return tagCallback(node, core, options);\n }\n }\n return node;\n });\n}\n/**\n * Create a preset plugin for @bbob/core\n */ function createPreset(defTags, processor = process) {\n const presetFactory = (opts)=>{\n presetFactory.options = Object.assign(presetFactory.options || {}, opts);\n function presetExecutor(tree, core) {\n return processor(defTags, tree, core, presetFactory.options || {});\n }\n presetExecutor.options = presetFactory.options;\n return presetExecutor;\n };\n presetFactory.extend = function presetExtend(callback) {\n const newTags = callback(defTags, presetFactory.options);\n return createPreset(newTags, processor);\n };\n return presetFactory;\n}\nexport { createPreset };\nexport default createPreset;\n","import { isStringNode, isTagNode, TagNode } from \"@bbob/plugin-helper\";\nimport {\n generateGUID,\n preprocessAttr,\n regexIndexOf,\n toNode,\n toOriginalStartTag,\n} from \"../utils/common\";\n\nconst SLIDE_TITLE_OPEN = Symbol(\"slide-title-open\");\nconst SLIDE_TITLE_CLOSE = Symbol(\"slide-title-close\");\nconst SLIDE_CLOSE = Symbol(\"slide-close\");\nconst SLIDE_REGEX =\n /(?\\{slide=)|(?\\})|(?\\{\\/slide\\})/i;\n\n/**\n * Adds the accordion tag\n * [accordion]{slide=name}content{/slide}[/accordion]\n *\n * [accordion][slide=name]content[/slide][/accordion]\n */\nconst accordion = (node, options) => {\n const groupId = generateGUID();\n\n // add support for existing {slide} tags style, due to copious amounts of existing content\n // also the only way to get true custom content inside a slide due to nesting limitations\n const markedContent = generateSlideMarkersFromContent(node.content);\n const generatedSlides = generateSlidesFromMarkers(markedContent);\n\n const filteredContent = generatedSlides\n .filter((n) => isTagNode(n) && n.tag === \"slide\")\n .map((content) => {\n content.isValid = true;\n content.groupId = groupId;\n return content;\n });\n if (!filteredContent.length) {\n // no [slide] tags found\n return [toOriginalStartTag(node), ...node.content, node.toTagEnd()];\n }\n\n const attrs = preprocessAttr(node, options.data.raw);\n\n if (attrs._default) {\n /** @type {string[]} */\n const customSettings = attrs._default.split(\"|\").map((s) => s.trim());\n if (customSettings.includes(\"bright\")) {\n attrs.bright = true;\n }\n if (customSettings.includes(\"bcenter\")) {\n attrs.bcenter = true;\n }\n if (customSettings.includes(\"bleft\")) {\n attrs.bleft = true;\n }\n if (customSettings.includes(\"fleft\")) {\n attrs.fleft = true;\n }\n if (customSettings.includes(\"fright\")) {\n attrs.fright = true;\n }\n if (\n customSettings.some((s) => s.endsWith(\"px\")) ||\n customSettings.some((s) => s.endsWith(\"%\"))\n ) {\n attrs.width = customSettings.find((s) => s.endsWith(\"px\") || s.endsWith(\"%\"));\n }\n }\n\n let classes = Object.keys(attrs)\n .filter((s) => [\"bright\", \"bcenter\", \"bleft\", \"fleft\", \"fright\"].includes(s))\n .join(\" \");\n let style = \"\";\n if (attrs.width?.endsWith(\"px\") || attrs.width?.endsWith(\"%\")) {\n style = `width: ${attrs.width};`;\n }\n return toNode(\n \"div\",\n { class: \"bb-accordion \" + classes, \"data-group-id\": groupId, style },\n filteredContent,\n );\n};\n\n/**\n * Locates and splits all {slide} tag components into their respective parts while preserving remaining content\n * @param {(TagNode|string)[]} contentArr node content of the accordion tag\n *\n * @example\n * ```\n * [\"{slide=test}\", \"lorem ipsum\", \"{/slide}\"]\n * ```\n * becomes\n * ```\n * [SLIDE_TITLE_OPEN, \"test\", SLIDE_TITLE_CLOSE, \"lorem ipsum\", SLIDE_CLOSE]\n * ```\n */\nfunction generateSlideMarkersFromContent(contentArr) {\n contentArr = [...contentArr]; // shallow clone. object nodes are not modified anyway\n\n const newArr = [];\n while (contentArr.length > 0) {\n const content = contentArr[0];\n if (isTagNode(content)) {\n newArr.push(contentArr.shift());\n continue;\n }\n const foundIndex = regexIndexOf(content, SLIDE_REGEX);\n if (foundIndex === -1) {\n newArr.push(contentArr.shift());\n continue;\n }\n const match = content.match(SLIDE_REGEX);\n const preContent = content.slice(0, foundIndex);\n const postContent = content.slice(foundIndex + match[0].length);\n if (preContent.length) {\n newArr.push(preContent);\n }\n if (match.groups.slideTitleOpen) {\n newArr.push(SLIDE_TITLE_OPEN);\n }\n if (match.groups.slideTitleClose) {\n newArr.push(SLIDE_TITLE_CLOSE);\n }\n if (match.groups.slideClose) {\n newArr.push(SLIDE_CLOSE);\n }\n if (postContent.length) {\n contentArr[0] = postContent;\n } else {\n contentArr.shift();\n }\n }\n\n return newArr;\n}\n\n/**\n * Generates slide nodes from markers\n * @param {(string | typeof SLIDE_TITLE_OPEN | typeof SLIDE_TITLE_CLOSE | typeof SLIDE_CLOSE | TagNode)[]} markedContent\n */\nfunction generateSlidesFromMarkers(markedContent) {\n const nodes = [];\n let currentSlide = null;\n /** @type {typeof SLIDE_TITLE_OPEN | typeof SLIDE_TITLE_CLOSE | null} */\n let prevMarker = null;\n for (const content of markedContent) {\n if (content === SLIDE_TITLE_OPEN && prevMarker === null) {\n currentSlide = TagNode.create(\"slide\");\n currentSlide.content = [];\n currentSlide.customTitle = [];\n prevMarker = SLIDE_TITLE_OPEN;\n } else if (content === SLIDE_TITLE_CLOSE && prevMarker === SLIDE_TITLE_OPEN) {\n prevMarker = SLIDE_TITLE_CLOSE;\n continue;\n } else if (content === SLIDE_CLOSE && currentSlide && prevMarker === SLIDE_TITLE_CLOSE) {\n nodes.push(currentSlide);\n currentSlide = null;\n prevMarker = null;\n } else if (currentSlide) {\n if (prevMarker === SLIDE_TITLE_OPEN) {\n currentSlide.customTitle.push(markerToString(content));\n } else {\n currentSlide.content.push(markerToString(content));\n }\n } else {\n // no slide open, just add content\n nodes.push(markerToString(content));\n }\n }\n return nodes;\n}\n\n/**\n * Processes content into a string. Catches stray markers and converts them back into a string\n * @param {string | typeof SLIDE_TITLE_OPEN | typeof SLIDE_TITLE_CLOSE | typeof SLIDE_CLOSE} marker\n * @returns expected string\n */\nfunction markerToString(marker) {\n switch (marker) {\n case SLIDE_TITLE_OPEN:\n return \"{slide=\";\n case SLIDE_TITLE_CLOSE:\n return \"}\";\n case SLIDE_CLOSE:\n return \"{/slide}\";\n default:\n return marker;\n }\n}\n\nconst slide = (node, options) => {\n if (!node.isValid) {\n // not inside an [accordion] tag\n return [toOriginalStartTag(node), ...node.content, node.toTagEnd()];\n }\n const attrs = preprocessAttr(node, options.data.raw);\n let title = [attrs.title || attrs._default || \"Slide\"];\n let isOpen = !!attrs.open || false;\n let titleAlign = attrs.left ? \"left\" : attrs.right ? \"right\" : attrs.center ? \"center\" : \"left\";\n if (node.customTitle?.length) {\n // slide was created from markers\n title = node.customTitle;\n // pull out old options from title if they exist\n const possibleOptions = title\n .filter((t) => typeof t === \"string\")\n .join(\"\")\n .toLowerCase()\n .split(\"|\")\n .map((s) => s.trim());\n if (possibleOptions.includes(\"open\")) {\n isOpen = true;\n }\n if (possibleOptions.includes(\"right\")) {\n titleAlign = \"right\";\n }\n if (possibleOptions.includes(\"center\")) {\n titleAlign = \"center\";\n }\n if (possibleOptions.includes(\"left\")) {\n titleAlign = \"left\";\n }\n title = title.map((t) => {\n if (isStringNode(t)) {\n t = t.replace(/\\|(open|right|center|left)/gi, \"\");\n }\n return t;\n });\n }\n return [\n toNode(\"details\", { class: \"bb-slide\", open: isOpen }, [\n toNode(\n \"summary\",\n { class: \"bb-slide-title\", style: `text-align: ${titleAlign}; ${attrs.style || \"\"}` },\n title,\n ),\n toNode(\"div\", { class: \"bb-slide-content\" }, node.content),\n ]),\n ];\n};\n\nexport const accordionTags = { accordion, slide };\n","import { toNode } from \"../utils/common\";\n/**\n * @file Adds [left], [center], and [right] to bbcode\n * @example [center]content[/center]\n */\nexport const alignment = {\n left: (node) => toNode(\"div\", { class: \"bb-left\" }, node.content),\n center: (node) => toNode(\"div\", { class: \"bb-center\" }, node.content),\n right: (node) => toNode(\"div\", { class: \"bb-right\" }, node.content),\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n/**\n * @file Adds [a] and [goto] to bbcode\n * @example [a=your_anchor_name]An anchor[/a] [goto=your_anchor_name]Jump to an anchor[/goto]\n */\nexport const anchor = {\n // name is not valid in HTML5; however, it correctly displays back while id does not\n a: (node, options) => {\n const attrs = preprocessAttr(node, options.data.raw)._default || \"\";\n return toNode(\n \"a\",\n { id: `user-anchor-${attrs.trim()}`, name: `user-anchor-${attrs.trim()}` },\n node.content,\n );\n },\n goto: (node, options) => {\n const attrs = preprocessAttr(node, options.data.raw)._default || \"\";\n return toNode(\"a\", { href: `#user-anchor-${attrs.trim()}` }, node.content);\n },\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nconst WEB_FONTS = [\n \"arial\",\n \"book antiqua\",\n \"courier new\",\n \"georgia\",\n \"tahoma\",\n \"times new roman\",\n \"trebuchet ms\",\n \"verdana\",\n];\nconst VALID_FONT_STYLES = {\n thin: \"100\",\n extralight: \"200\",\n light: \"300\",\n regular: \"400\",\n medium: \"500\",\n semibold: \"600\",\n bold: \"700\",\n extrabold: \"800\",\n black: \"900\",\n};\n// registered axis tags https://learn.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg#registered-axis-tags\nconst REGISTERED_AXIS = [\"ital\", \"opsz\", \"slnt\", \"wdth\", \"wght\"];\n\nconst AXES_REGEX = /(?[a-zA-Z]*)?\\s?(?[0-9]*)?\\s?(?italic)?/;\n\nconst axesParser = (attrs) => {\n let axes = {\n ital: 0,\n wght: 400,\n };\n\n if (attrs?.style) {\n // user just copy pasted the name of the style on the google font site, probably\n const style = attrs.style.trim().toLowerCase();\n const matches = AXES_REGEX.exec(style).groups || {};\n if (matches?.italic) {\n axes.ital = 1;\n }\n\n const weight = matches.weight;\n if (weight && weight >= 0 && weight <= 900) {\n axes.wght = weight;\n } else if (Object.keys(VALID_FONT_STYLES).includes(matches.named_weight || \"\")) {\n axes.wght = VALID_FONT_STYLES[matches.named_weight];\n }\n\n axes = {\n ...axes,\n ...Object.fromEntries(Object.entries(attrs).filter(([key]) => REGISTERED_AXIS.includes(key))),\n };\n }\n return axes;\n};\n\n/**\n * Create google font api url\n * @param {string} family name of font\n * @param {object} axes custom font axes\n */\nconst googleFontApiBuild = (family, axes) => {\n family = family.replaceAll(\" \", \"+\");\n // google fonts requires axes names to be in alphabetical order\n axes = Object.keys(axes)\n .sort()\n .reduce((obj, key) => {\n obj[key] = axes[key];\n return obj;\n }, {});\n const axesList = Object.keys(axes).join(\",\") + \"@\" + Object.values(axes).join(\",\");\n return \"https://fonts.googleapis.com/css2?family=\" + family + \":\" + axesList;\n};\n\nexport const font = (node, options) => {\n const attrs = preprocessAttr(node, options.data.raw);\n const fontFamily = attrs?._default || attrs.family || attrs.name;\n if (fontFamily.trim() === \"\") {\n return node.content;\n }\n if (WEB_FONTS.includes(fontFamily.trim().toLowerCase())) {\n return toNode(\"span\", { style: `font-family: '${fontFamily}'` }, node.content);\n }\n\n const axes = axesParser(attrs);\n const url = googleFontApiBuild(fontFamily, axes);\n options.data.fonts.add(url);\n\n const italic = axes.ital === 1 ? \"italic\" : \"normal\";\n\n const custom = Object.entries(axes).filter(([key]) => key !== \"wght\" && key !== \"ital\");\n let fontVar = \"\";\n if (custom.length) {\n fontVar =\n \"font-variation-settings: \" + custom.map(([key, val]) => `'${key}' ${val}`).join(\", \") + \";\";\n }\n\n return toNode(\n \"span\",\n {\n style: `font-family: '${fontFamily}'; font-weight: ${axes.wght}; font-style: ${italic}; ${fontVar}`,\n \"data-font\": url,\n },\n node.content,\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Parse the user provided height and return a valid height value\n * @param {Number} heightValue obtains the input of the user entered height (default is 700)\n * @returns A validated number less than 0.\n */\nfunction parseHeight(heightValue) {\n const maxHeight = 700;\n const parsedHeight =\n heightValue && heightValue.trim() !== \"\" ? heightValue.replace(/[^\\d.]/g, \"\") : 0;\n\n if (parsedHeight && parsedHeight >= 0 && parsedHeight <= maxHeight) {\n return parsedHeight;\n } else {\n // if the value = 0 then nothing will be returned\n return parsedHeight === 0 ? 0 : maxHeight;\n }\n}\n\n/**\n * @file Adds [heightrestrict] to bbcode\n * @example [heightrestrict=50]content[/heightrestrict]\n */\nexport const heightrestrict = (node) => {\n const attrs = preprocessAttr(node)._default;\n const heightInput = parseHeight(attrs).toString();\n // Return image's default size if heightrestrict did not involve a valid value\n return heightInput === \"0\"\n ? toNode(\"div\", { class: \"bb-height-restrict\" }, node.content)\n : toNode(\n \"div\",\n { class: \"bb-height-restrict\", style: `height: ${heightInput}px;` },\n node.content,\n );\n};\n","import { toNode } from \"../utils/common\";\n/**\n * @file Adds [mail] to bbcode\n * @param {string} [type=\"send\"] Denotes type of mail either send or receive\n * @param {string} [person=\"Unknown\"] Denotes the person in the To/From field\n * @param {string} [subject=\"Empty\"] Denotes the subject line of the email\n * @example [mail type=\"send\" person=\"John Doe\" subject=\"Hello World\"]content[/mail]\n */\n\nconst parseEmailContent = (content) => {\n return toNode(\"div\", { class: \"bb-email-content\" }, content);\n};\n\nconst parseEmailSubject = (subject) => {\n return toNode(\"div\", { class: \"bb-email-subject\" }, subject);\n};\n\nconst parseEmailPerson = (person) => {\n return toNode(\"div\", { class: \"bb-email-address\" }, person);\n};\n\nconst emailHeader = toNode(\"div\", { class: \"bb-email-header\" }, \"\");\nconst emailFooter = toNode(\n \"div\",\n { class: \"bb-email-footer\" },\n toNode(\"div\", { class: \"bb-email-button\" }, \"\"),\n);\n\nexport const mail = (node) => {\n const attributes = node.attrs;\n let mailAttr = {\n mailOption: (attributes.type || \"send\").toLowerCase(),\n person: attributes.person || \"Unknown\",\n subject: attributes.subject || \"Empty\",\n };\n\n return toNode(\n \"div\",\n {\n class: \"bb-email\",\n \"data-bb-email\": mailAttr.mailOption,\n },\n [\n emailHeader,\n parseEmailPerson(mailAttr.person),\n parseEmailSubject(mailAttr.subject),\n parseEmailContent(node.content),\n emailFooter,\n ],\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds [row][column] to bbcode\n * @example Adds [row][column][/column][/row]\n */\nexport const rowcolumn = {\n row: (node) => toNode(\"div\", { class: \"bb-row\" }, node.content),\n column: (node, options) => {\n const columnAttrs = preprocessAttr(node, options.data.raw)._default || \"8\";\n const columnStyle = columnAttrs.startsWith(\"span\")\n ? `column-width-${columnAttrs}`\n : `column-width-span${columnAttrs}`;\n return toNode(\"div\", { class: `bb-column`, \"data-span\": columnStyle }, node.content);\n },\n};\n","import { preprocessAttr } from \"../utils/common\";\n\nconst EVENTS = [\n \"init\",\n \"click\",\n \"change\",\n \"input\",\n \"dblclick\",\n \"mouseenter\",\n \"mouseleave\",\n \"scroll\",\n];\n\n/**\n * Script tag\n *\n * [script]content[/script]\n *\n * [script class=\"id\" on=\"event\" version=\"2\"]content[/script]\n */\nexport const script = (node, options) => {\n const attrs = preprocessAttr(node, options.data.raw);\n\n if (!options.data.previewing && !options.data.commonGUID) {\n // create a common GUID for the post\n // only applicable for div, style, and script tags\n // this is to prevent the same class name from being used in different posts\n options.data.commonGUID = \"post-\" + Math.random().toString(36).substring(2, 7);\n }\n const classSuffix = options.data.previewing ? \"preview\" : options.data.commonGUID;\n\n const onEvent =\n (EVENTS.includes(attrs.on?.toLowerCase() || \"init\") && attrs.on?.toLowerCase()) || \"init\";\n\n const scriptSetup = {\n id: classSuffix,\n class: attrs.class || \"\",\n on: onEvent,\n version: attrs.version || \"\",\n content: node.content.join(\"\"),\n };\n options.data.bbscripts.push(scriptSetup);\n\n return [];\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Parses an inputted size value and returns the formatted valid font size\n * @param {string} fontValue the input of the size\n */\nfunction parseFontSize(fontValue) {\n let value;\n let fontSize = { valid: true };\n const parsedSize = /(\\d+\\.?\\d?)(px|rem)?/i.exec(fontValue);\n const sizeRanges = {\n px_max: 36,\n px_min: 8,\n rem_max: 3,\n rem_min: 0.2,\n unitless_max: 7,\n unitless_min: 1,\n };\n\n if (parsedSize && (value = parsedSize[1])) {\n fontSize.unit = (parsedSize[2] || \"\").toLowerCase();\n switch (fontSize.unit) {\n case \"px\":\n if (value > sizeRanges.px_max) {\n value = sizeRanges.px_max;\n } else if (value < sizeRanges.px_min) {\n value = sizeRanges.px_min;\n }\n break;\n case \"rem\":\n if (value > sizeRanges.rem_max) {\n value = sizeRanges.rem_max;\n } else if (value < sizeRanges.rem_min) {\n value = sizeRanges.rem_min;\n }\n break;\n default:\n if ((fontSize.valid = fontValue.length === value.length)) {\n if (value > sizeRanges.unitless_max) {\n value = sizeRanges.unitless_max;\n } else if (value < sizeRanges.unitless_min) {\n value = sizeRanges.unitless_min;\n }\n }\n break;\n }\n\n fontSize.value = value;\n }\n return fontSize;\n}\n\nexport const size = (node) => {\n const input = preprocessAttr(node)._default;\n const fontSize = parseFontSize(input);\n if (!fontSize.valid) {\n return node.content;\n }\n let outputAttr = {};\n if (fontSize.unit) {\n outputAttr = { style: `font-size: ${fontSize.value}${fontSize.unit}` };\n } else {\n outputAttr = { \"data-size\": fontSize.value };\n }\n return toNode(\"span\", outputAttr, node.content);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds textmessage to bbcode\n * @exmaple [textmessage=Recipient][message=them]Hi [/message][message=me] Hey![/message][/textmessage]\n */\n\nconst ACCEPTED_OPTIONS = [\"me\", \"them\", \"right\", \"left\"];\nexport const textmessage = {\n textmessage: (node, options) => {\n const attr = preprocessAttr(node, options.data.raw)._default || \"Recipient\";\n const recipient = attr && attr.trim() !== \"\" ? attr : \"Recipient\";\n return toNode(\"div\", { class: \"bb-textmessage\" }, [\n toNode(\"div\", { class: \"bb-textmessage-name\" }, recipient),\n toNode(\"div\", { class: \"bb-textmessage-overflow\" }, [\n toNode(\"div\", { class: \"bb-textmessage-content\" }, node.content),\n ]),\n ]);\n },\n message: (node, options) => {\n let option = preprocessAttr(node, options.data.raw)._default.toLowerCase();\n if (!ACCEPTED_OPTIONS.includes(option) || option === \"right\") {\n option = \"me\";\n }\n if (option === \"left\") {\n option = \"them\";\n }\n\n const senderAttrs = option === \"me\" ? \"bb-message-me\" : \"bb-message-them\";\n return toNode(\"div\", { class: senderAttrs }, [\n toNode(\"div\", { class: \"bb-message-content\" }, node.content),\n ]);\n },\n};\n","import { createPreset } from \"@bbob/preset\";\nimport { accordionTags } from \"./tags/accordion\";\nimport { alignment } from \"./tags/alignment\";\nimport { anchor } from \"./tags/anchor\";\nimport { animation, keyframe } from \"./tags/animation\";\nimport { bg } from \"./tags/background\";\nimport { block } from \"./tags/block\";\nimport { blockquote } from \"./tags/blockquote\";\nimport { border } from \"./tags/border\";\nimport { centerblock } from \"./tags/centerblock\";\nimport { check } from \"./tags/check\";\nimport { classStyle } from \"./tags/class\";\nimport { code, icode, savenl } from \"./tags/code\";\nimport { color } from \"./tags/color\";\nimport { comment } from \"./tags/comment\";\nimport { bold, italic, strike, underline } from \"./tags/discourse-core-replacement\";\nimport { div } from \"./tags/div\";\nimport { divide } from \"./tags/divide\";\nimport { fieldset } from \"./tags/fieldset\";\nimport { font } from \"./tags/font\";\nimport { fa } from \"./tags/fontawesome\";\nimport { h, h1, h2, h3, h4, h5, h6, sh } from \"./tags/header\";\nimport { heightrestrict } from \"./tags/heightrestrict\";\nimport { highlight } from \"./tags/highlight\";\nimport { imagefloat } from \"./tags/imagefloat\";\nimport { justify } from \"./tags/justify\";\nimport { br, nobr } from \"./tags/lineBreak\";\nimport { mail } from \"./tags/mail\";\nimport { newspaper } from \"./tags/newspaper\";\nimport { note } from \"./tags/note\";\nimport { ooc } from \"./tags/ooc\";\nimport { pindent } from \"./tags/pindent\";\nimport { plain } from \"./tags/plain\";\nimport { print } from \"./tags/print\";\nimport { progress } from \"./tags/progress\";\nimport { quote } from \"./tags/quote\";\nimport { rowcolumn } from \"./tags/rowcolumn\";\nimport { script } from \"./tags/script\";\nimport { scroll } from \"./tags/scroll\";\nimport { side } from \"./tags/side\";\nimport { size } from \"./tags/size\";\nimport { inlinespoiler, spoiler } from \"./tags/spoiler\";\nimport { sub } from \"./tags/subscript\";\nimport { sup } from \"./tags/superscript\";\nimport { tab, tabs } from \"./tags/tabs\";\nimport { textmessage } from \"./tags/textmessage\";\nimport { thinprogress } from \"./tags/thinprogress\";\n\nconst tags = {\n ...accordionTags,\n ...alignment,\n ...anchor,\n animation,\n bg,\n block,\n blockquote,\n border,\n br,\n centerblock,\n check,\n class: classStyle,\n code,\n color,\n comment,\n div,\n divide,\n fieldset,\n fa,\n font,\n h,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n heightrestrict,\n highlight,\n icode,\n imagefloat,\n inlinespoiler,\n justify,\n keyframe,\n mail,\n newspaper,\n nobr,\n note,\n ooc,\n pindent,\n plain,\n print,\n progress,\n quote,\n ...rowcolumn,\n thinprogress,\n savenl,\n sh,\n script,\n scroll,\n side,\n size,\n spoiler,\n sub,\n sup,\n tab,\n tabs,\n ...textmessage,\n\n // discourse core replacement tags\n b: bold,\n i: italic,\n u: underline,\n s: strike,\n};\n\nconst availableTags = Object.keys(tags);\nconst preventParsing = [\"plain\", \"code\", \"icode\", \"class\", \"fa\"];\n\nconst preset = createPreset(tags);\n\nexport { availableTags, tags, preset, preventParsing };\nexport default preset;\n","import { isStringNode, isTagNode } from \"@bbob/plugin-helper\";\nimport { preprocessAttr, toOriginalStartTag } from \"../utils/common\";\n\n/**\n * Renders css Keyframes\n *\n * [animation=name][keyframe=0]color: red[/keyframe][/animation]\n */\nexport const animation = (node, options) => {\n if (!options.data.previewing && !options.data.commonGUID) {\n // create a common GUID for the post\n // only applicable for div, style, and script tags\n // this is to prevent the same class name from being used in different posts\n options.data.commonGUID = \"post-\" + Math.random().toString(36).substring(2, 7);\n }\n const commonId = options.data.previewing ? \"preview\" : options.data.commonGUID;\n\n const name = preprocessAttr(node, options.data.raw)?._default || \"\";\n const keyframes = node.content\n .filter((n) => isTagNode(n) && n.tag === \"keyframe\")\n .map((content) => {\n content.isValid = true;\n /** @type {string} */\n const ident = preprocessAttr(content, options.data.raw)._default || \"\";\n content.ident = ident + (ident.match(/^\\d+$/) ? \"%\" : \"\");\n const cleanContent = content.content\n .filter(isStringNode)\n .join(\"\")\n .replaceAll(/[\\[\\]\\{\\}]/g, \"\");\n content.formatted = `${content.ident}{ ${cleanContent} }`;\n return content;\n });\n const keyframeContent = keyframes.map((n) => n.formatted).join(\"\\n\");\n const content = `@keyframes ${commonId}${name} { ${keyframeContent} }`;\n options.data.styles.push(content);\n return [];\n};\n\nexport const keyframe = (node) => {\n if (!node.isValid) {\n return [toOriginalStartTag(node), ...node.content, node.toTagEnd()];\n }\n return [];\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Add [bg] tag\n * @example [bg=red]Hello[/bg]\n */\nexport const bg = (node, options) => {\n const color = preprocessAttr(node, options.data.raw)._default;\n return toNode(\n \"div\",\n {\n style: `background-color: ${color};`,\n class: \"bb-background\",\n },\n node.content,\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Add [block] tag\n * @example [block=treasure]content[/block]\n */\nexport const block = (node, options) => {\n const defaultOp = \"block\";\n const blockAttr = (preprocessAttr(node, options.data.raw)._default || defaultOp).toLowerCase();\n\n const OPTIONS = [\n \"block\",\n \"dice\",\n \"dice10\",\n \"setting\",\n \"warning\",\n \"storyteller\",\n \"announcement\",\n \"important\",\n \"question\",\n \"encounter\",\n \"information\",\n \"character\",\n \"treasure\",\n ];\n\n // Default to block option if user did not provide anything valid\n const blockOption = OPTIONS.includes(blockAttr) ? blockAttr : defaultOp;\n\n return toNode(\"table\", { class: \"bb-block\", \"data-bb-block\": blockOption }, [\n toNode(\"tbody\", [\n toNode(\"tr\", [\n toNode(\"td\", { class: \"bb-block-icon\" }),\n toNode(\"td\", { class: \"bb-block-content\" }, node.content),\n ]),\n ]),\n ]);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds [blockquote] to bbcode\n * @example [blockquote=author]content[/blockquote]\n */\nexport const blockquote = (node, options) => {\n const author = preprocessAttr(node, options.data.raw)._default || \"\";\n\n return toNode(\"div\", { class: \"bb-blockquote\" }, [\n toNode(\"div\", { class: \"bb-blockquote-left\" }),\n toNode(\"div\", { class: \"bb-blockquote-content\" }, [\n node.content,\n toNode(\"div\", { class: \"bb-blockquote-speaker\" }, author !== \"\" ? `- ${author}` : \"\"),\n ]),\n toNode(\"div\", { class: \"bb-blockquote-right\" }),\n ]);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const border = (node, options) => {\n const val = preprocessAttr(node, options.data.raw)._default;\n return toNode(\n \"div\",\n {\n style: `border: ${val};`,\n class: \"bb-border\",\n },\n node.content,\n );\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * Creates a line break html
tag\n */\nexport const br = () => {\n return toNode(\"br\", {}, null);\n};\n\n/**\n * Disables line breaks for given content\n * @example\n * ```\n * [nobr]test\n * test\n * test\n * [/nobr]\n *\n * test test test\n * ```\n */\nexport const nobr = (node) => {\n return { disableLineBreakConversion: true, content: node.content };\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const centerblock = (node, options) => {\n const percentageInput = preprocessAttr(node, options.data.raw)._default || \"50\";\n return toNode(\"div\", { style: `margin: 0 auto; width: ${percentageInput}%` }, node.content);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const check = (node, options) => {\n const attrs = preprocessAttr(node, options.data.raw)._default || \"dot\";\n return toNode(\"div\", { class: `bb-check`, \"data-type\": attrs }, node.content);\n};\n","import { isStringNode } from \"@bbob/plugin-helper\";\nimport { preprocessAttr } from \"../utils/common\";\n\n/**\n * Class style tag\n *\n * [class=name]content[/class]\n * [class name=\"className\" state=\"psuedo-class\" minWidth=\"\" maxWidth=\"\"]content[/class]\n * [class name=\"className\" selector=\"\"]content[/class]\n */\nexport const classStyle = (node, options) => {\n const attrs = preprocessAttr(node);\n const nameAttr = attrs.name || attrs._default;\n\n if (!options.data.previewing && !options.data.commonGUID) {\n // create a common GUID for the post\n // only applicable for div, style, and script tags\n // this is to prevent the same class name from being used in different posts\n options.data.commonGUID = \"post-\" + Math.random().toString(36).substring(2, 7);\n }\n const classSuffix = options.data.previewing ? \"preview\" : options.data.commonGUID;\n const className = nameAttr + \"__\" + classSuffix;\n const content = node.content\n .filter(isStringNode)\n .map((s) => s.replaceAll(\"{post_id}\", classSuffix).replaceAll(/[\\[\\]\\{\\}]/g, \"\"));\n let selector = \"\";\n const mediaQuery = [];\n if (\n [\"hover\", \"focus\", \"active\", \"focus-within\", \"focus-visible\"].includes(\n attrs.state?.toLowerCase(),\n )\n ) {\n selector = \":\" + attrs.state.toLowerCase();\n }\n if (attrs.selector) {\n selector = attrs.selector.replace(/[,{}\\\\\\n]/g, \"\");\n }\n if (attrs.minWidth?.match(/^[0-9]+[a-z]+$/)) {\n // @media (min-width: )\n mediaQuery.push(`(min-width: ${attrs.minWidth})`);\n }\n if (attrs.maxWidth?.match(/^[0-9]+[a-z]+$/)) {\n // @media (max-width: )\n mediaQuery.push(`(max-width: ${attrs.maxWidth})`);\n }\n\n content.unshift(`.${className}${selector} {`);\n content.push(\"}\");\n if (mediaQuery.length) {\n content.unshift(`@media ${mediaQuery.join(\" and \")} {`);\n content.push(\"}\");\n }\n options.data.styles.push(content.join(\"\"));\n\n return [];\n};\n","import { preprocessAttr } from \"../utils/common\";\n\n/**\n * processes [code] tag and returns a fenced code block\n */\nexport const code = (node) => {\n const lang = preprocessAttr(node)._default || \"bbcode\";\n return {\n isWhitespaceSensitive: true,\n content: [\"```\" + lang + \"\\n\", node.content, \"\\n```\\n\"],\n };\n};\n\n/**\n * processes [icode] tag and returns inline code\n */\nexport const icode = (node) => {\n return {\n isWhitespaceSensitive: true,\n content: [\"`\", node.content, \"`\"],\n };\n};\n\n/**\n * Special tag to save newlines in code blocks. Used for hoisting code blocks\n */\nexport const savenl = (node) => {\n return {\n isWhitespaceSensitive: true,\n content: node.content,\n };\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const color = (node) => {\n const inputColor = preprocessAttr(node)._default || \"\";\n if (inputColor.trim() === \"\") {\n return node.content;\n }\n return toNode(\"span\", { style: `color: ${inputColor}` }, node.content);\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds [comment] tag\n * @example [comment]Content[/comment]\n */\n\nconst comment = (node) => {\n return toNode(\"span\", { class: \"hidden\" }, node.content);\n};\n\nexport { comment };\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Adds [div] tag\n * [div=css]Content[/div]\n * [div class=\"class\" style=\"css\"]Content[/div]\n */\nexport const div = (node, options) => {\n if (node.gen) {\n // node is actually a generated node \"div\" made by another tag\n // don't process it\n return node;\n }\n const attrs = preprocessAttr(node, options.data.raw);\n const style = attrs.style || attrs._default;\n const classAttrs = attrs.class;\n if (!classAttrs?.trim()) {\n return toNode(\n \"div\",\n {\n style,\n },\n node.content,\n );\n }\n\n if (!options.data.previewing && !options.data.commonGUID) {\n // create a common GUID for the post\n // only applicable for div, style, and script tags\n // this is to prevent the same class name from being used in different posts\n options.data.commonGUID = \"post-\" + Math.random().toString(36).substring(2, 7);\n }\n const classSuffix = options.data.previewing ? \"preview\" : options.data.commonGUID;\n const classNames = classAttrs\n .split(\" \")\n .map((c) => c + \"__\" + classSuffix)\n .join(\" \");\n\n return toNode(\n \"div\",\n {\n class: classNames,\n style,\n },\n node.content,\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const divide = (node) => {\n const type = (preprocessAttr(node)._default || \"\").toLowerCase();\n return toNode(\n \"span\",\n {\n class: \"bb-divide\",\n \"data-type\": type,\n },\n node.content,\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds [fieldset] to bbcode\n * @example [fieldset=title]content[/fieldset]\n */\nexport const fieldset = (node, options) => {\n const title = preprocessAttr(node, options.data.raw)._default || \"\";\n return toNode(\"fieldset\", { class: \"bb-fieldset\" }, [\n toNode(\"legend\", { class: \"bb-fieldset-legend\" }, title),\n toNode(\"div\", { class: \"bb-fieldset\" }, node.content),\n ]);\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * Adds [fa] tag\n * [fa]fa-icon[/fa]\n * [fa style=\"\" fa-transform=\"\"]fa-solid fa-icon[/fa]\n * [fa primary-color=\"\" secondary-color=\"\" primary-opacity=\"\" secondary-opacity=\"\" rotate-angle=\"\"]fa-duotone fa-icon[/fa]\n */\nexport const fa = (node) => {\n const attrs = node.attrs;\n let style = attrs.style || \"\";\n style += attrs[\"primary-color\"] ? `--fa-primary-color: ${attrs[\"primary-color\"]};` : \"\";\n style += attrs[\"secondary-color\"] ? `--fa-secondary-color: ${attrs[\"secondary-color\"]};` : \"\";\n style += attrs[\"primary-opacity\"] ? `--fa-primary-opacity: ${attrs[\"primary-opacity\"]};` : \"\";\n style += attrs[\"secondary-opacity\"]\n ? `--fa-secondary-opacity: ${attrs[\"secondary-opacity\"]};`\n : \"\";\n style += attrs[\"rotate-angle\"] ? `--fa-rotate-angle: ${attrs[\"rotate-angle\"]};` : \"\";\n\n return toNode(\n \"i\",\n {\n \"data-bbcode-fa\": null,\n },\n [\n toNode(\n \"i\",\n {\n class: (node.content || []).join(\"\"),\n style,\n \"data-fa-transform\": attrs[\"fa-transform\"] || \"\",\n },\n [],\n ),\n ],\n );\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds Header to bbcode\n * @example [h]content[/h], [h2]content[/h2], [h3]content[/h3],\n * [h4]content[/h4], [h5]content[/h5], [h6]content[/h6].\n */\n\nconst h = (node) => {\n return toNode(\"h1\", {}, node.content);\n};\n\nconst h1 = (node) => {\n return toNode(\"h1\", {}, node.content);\n};\n\nconst h2 = (node) => {\n return toNode(\"h2\", {}, node.content);\n};\n\nconst sh = (node) => {\n return toNode(\"h2\", {}, node.content);\n};\n\nconst h3 = (node) => {\n return toNode(\"h3\", {}, node.content);\n};\n\nconst h4 = (node) => {\n return toNode(\"h4\", {}, node.content);\n};\n\nconst h5 = (node) => {\n return toNode(\"h5\", {}, node.content);\n};\n\nconst h6 = (node) => {\n return toNode(\"h6\", {}, node.content);\n};\n\nexport { h, sh, h1, h2, h3, h4, h5, h6 };\n","import { toNode } from \"../utils/common\";\n/**\n * @file Adds [highlight] to bbcode\n * @example [highlight]content[/highlight]\n */\nexport const highlight = (node) => {\n return toNode(\"span\", { class: \"bb-highlight\" }, node.content);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n/**\n * @file Adds [imagefloat] to bbcode\n * @exmaple [imagefloat=left]content[/imagefloat]\n */\nexport const imagefloat = (node) => {\n const attrs = preprocessAttr(node)._default || \"\";\n return toNode(\"div\", { class: `bb-float-${attrs}` }, node.content);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n/**\n * @file Adds [spoiler] and [inlinespoiler] to bbcode\n *\n * Defaults to \"Spoiler\" name if no title provided\n *\n * @example `[spoiler=Title]text[/spoiler]`\n * @example `[inlinespoiler]hidden content[/inlinespoiler]\n */\n\nexport const spoiler = (node, options) => {\n const providedTitle = preprocessAttr(node, options.data.raw)._default;\n const title = \"Spoiler\" + (providedTitle ? `: ${providedTitle}` : \"\");\n\n /**\n *
\n * Title\n *
\n * lorem ipsum\n *
\n *
\n */\n return toNode(\"details\", { class: \"bb-spoiler\" }, [\n toNode(\"summary\", {}, title),\n toNode(\"div\", { class: \"bb-spoiler-content\" }, node.content),\n ]);\n};\n\nexport const inlinespoiler = (node) => {\n return toNode(\"span\", { class: \"bb-inline-spoiler\" }, node.content);\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds [justify] to bbcode\n * @example [justify]content[/justify]\n */\nexport const justify = (node) => {\n return toNode(\"div\", { class: \"bb-justify\" }, node.content);\n};\n","import { toNode } from \"../utils/common\";\n/**\n * @file Adds [newspaper] to bbcode\n * @example [newspaper]content[/newspaper]\n */\nexport const newspaper = (node) => {\n return toNode(\"div\", { class: \"bb-newspaper\" }, node.content);\n};\n","import { toNode } from \"../utils/common\";\n/**\n * @file Adds [note] to bbcode\n * @example [note]content[/note]\n */\n\nexport const note = (node) => {\n return toNode(\"div\", { class: \"bb-note\" }, [\n toNode(\"div\", { class: \"bb-note-tape\" }, \"\"),\n toNode(\"div\", { class: \"bb-note-content\" }, [\n node.content,\n toNode(\"div\", { class: \"bb-note-footer\" }, \"\"),\n ]),\n ]);\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds [ooc] to bbcode\n * @example [ooc]content[/ooc]\n */\nexport const ooc = (node) => {\n return toNode(\n \"div\",\n {\n class: \"bb-ooc\",\n },\n node.content,\n );\n};\n","import { toNode } from \"../utils/common\";\n/**\n * @file Adds [pindent] to bbcode\n * @example [pindent]content[/pindent]\n */\nexport const pindent = (node) => {\n return toNode(\"span\", { class: \"bb-pindent\" }, node.content);\n};\n","/**\n * [plain] bbcode tag that prevents parsing of inner tags\n * @example\n * ```\n * [plain]This is [b]bold[/b] and [i]italic[/i][/plain]\n * ```\n * outputs to\n * ```\n * This is [b]bold[/b] and [i]italic[/i]\n * ```\n */\nexport const plain = (node) => {\n return node.content;\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Add [print] tag\n * @example [print=lined]content[/print]\n */\nexport const print = (node) => {\n const defaultOp = \"print\";\n const printAttr = (preprocessAttr(node)._default || defaultOp).toLowerCase();\n\n const OPTIONS = [\"print\", \"line\", \"graph\", \"parchment\"];\n\n // Default to print if option is not valid\n const printOption = OPTIONS.includes(printAttr) ? printAttr : defaultOp;\n\n return toNode(\n \"div\",\n { class: printOption === defaultOp ? `bb-print` : `bb-print-${printOption}` },\n node.content,\n );\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds [progress] to bbcode\n * @exmaple [progress=percentageInt]content[/progress]\n */\nexport const progress = (node) => {\n const percentageInt = preprocessAttr(node)._default;\n return toNode(\"div\", { class: \"bb-progress\" }, [\n toNode(\"div\", { class: \"bb-progress-text\" }, node.content),\n toNode(\"div\", { class: \"bb-progress-bar\", style: `width: calc(${percentageInt}% - 6px)` }, \"\"),\n toNode(\"div\", { class: \"bb-progress-bar-other\" }, \"\"),\n ]);\n};\n","import { preprocessAttr } from \"../utils/common\";\n\n/**\n * rebuild the [quote] tag so that markdown-it engine can parse it for itself\n */\nexport const quote = (node, options) => {\n const attrs = preprocessAttr(node, options.data.raw);\n if (node.content[0] === \"\\n\") {\n node.content.shift();\n }\n return [`\\n[${node.tag}=\"${attrs._default}\"]\\n\\n`, ...node.content, \"\\n\\n[/quote]\\n\"];\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * @file Adds [thinprogress] to bbcode\n * @exmaple [thinprogress=percentageInt]content[/progthinprogressress]\n */\nexport const thinprogress = (node, options) => {\n const percentageInt = preprocessAttr(node, options.data.raw)._default;\n return toNode(\"div\", { class: \"bb-progress-thin\" }, [\n toNode(\"div\", { class: \"bb-progress-text\" }, node.content),\n toNode(\"div\", { class: \"bb-progress-bar\", style: `width: calc(${percentageInt}% - 6px)` }, \"\"),\n toNode(\"div\", { class: \"bb-progress-bar-other\" }, \"\"),\n ]);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\n/**\n * Parse the user provided height and return a valid height value\n * @param {Number} heightValue obtains the input of the user entered height (default is 700)\n * @returns A validated number less than 0.\n */\nfunction parseHeight(heightValue) {\n const maxHeight = 700;\n const parsedHeight =\n heightValue && heightValue.trim() !== \"\" ? heightValue.replace(/[^\\d.]/g, \"\") : 0;\n\n if (parsedHeight && parsedHeight >= 0 && parsedHeight <= maxHeight) {\n return parsedHeight;\n } else {\n // if the value = 0 then nothing will be returned\n return parsedHeight === 0 ? 0 : maxHeight;\n }\n}\n\n/**\n * @file Adds [scroll] to bbcode\n * @example [scroll]content[/scroll]\n */\nexport const scroll = (node, options) => {\n const attrs = preprocessAttr(node, options.data.raw)._default;\n const heightInput = parseHeight(attrs);\n return toNode(\"div\", { class: \"bb-scroll\", style: `height: ${heightInput}px` }, node.content);\n};\n","import { preprocessAttr, toNode } from \"../utils/common\";\n\nexport const side = (node) => {\n const attrs = preprocessAttr(node)._default || \"left\";\n return toNode(\"div\", { class: \"bb-side\", \"data-side\": attrs }, node.content);\n};\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds subscript to BBCode\n * @example [sub]content[/sub]\n */\n\nconst sub = (node) => {\n return toNode(\"sub\", {}, node.content);\n};\n\nexport { sub };\n","import { toNode } from \"../utils/common\";\n\n/**\n * @file Adds superscript to bbcode\n * @example [sup]content[/sup]\n */\n\nconst sup = (node) => {\n return toNode(\"sup\", {}, node.content);\n};\n\nexport { sup };\n","import { isTagNode } from \"@bbob/plugin-helper\";\nimport { generateGUID, preprocessAttr, toNode, toOriginalStartTag } from \"../utils/common\";\n\n/**\n * @file Adds [tabs][tab] to bbcode\n * @example [tabs][tab=name 1]content[/tab][tab=name 2]content[/tab][/tabs]\n */\nexport const tabs = (node) => {\n const tabsList = node.content.filter(\n (contentNode) => isTagNode(contentNode) && contentNode.tag === \"tab\",\n );\n const groupId = generateGUID();\n tabsList.forEach((tabNode) => {\n tabNode.isValid = true;\n tabNode.groupId = groupId;\n });\n if (!tabsList.length) {\n // no [tab] tags found\n return [toOriginalStartTag(node), ...node.content, node.toTagEnd()];\n }\n tabsList[0].open = true;\n\n return toNode(\n \"div\",\n {\n class: \"bb-tabs\",\n },\n tabsList,\n );\n};\n\n/**\n * [tab=name]content[/tab]\n * [tab name=\"name\" style=\"style\"]content[/tab]\n */\nexport const tab = (node, options) => {\n if (!node.isValid) {\n // not inside a [tabs] tag\n return [toOriginalStartTag(node), ...node.content, node.toTagEnd()];\n }\n const attrs = preprocessAttr(node, options.data.raw);\n const name = attrs._default || attrs.name || \"Tab\";\n const tabId = `tab-${name.replace(/\\W/g, \"_\")}-${generateGUID()}`;\n return [\n toNode(\"input\", {\n type: \"radio\",\n id: tabId,\n name: \"tab-group-\" + node.groupId,\n class: \"bb-tab\",\n checked: node.open,\n }),\n toNode(\n \"label\",\n {\n class: \"bb-tab-label\",\n for: tabId,\n style: attrs.style,\n },\n name,\n ),\n toNode(\n \"div\",\n {\n class: \"bb-tab-content\",\n },\n node.content,\n ),\n ];\n};\n","/**\n * @file discourse-core-replacement.js\n * This is a dedicated file for replacing the standard Discourse BBCode tags in core.\n * In the markdown-it engine, discourse has added these bbcode tags in the inline parser.\n * However this means that if the parser detects a block level tag inside an inline tag,\n * it will not parse the inline tag.\n *\n * This file is meant to fix such scenarios by doing the parsing of bbcode tags for it.\n *\n * @example\n * [b][h]bold[/h][/b] // this should properly parse the bold tag inside the h tag\n *\n * https://github.com/discourse/discourse/blob/d7ece61252d7671a1f124483836279b99852c08c/app/assets/javascripts/discourse-markdown-it/src/features/bbcode-inline.js\n */\nimport { toNode } from \"../utils/common\";\n\nexport const bold = (node) => {\n return toNode(\"span\", { class: \"bbcode-b\" }, node.content);\n};\n\nexport const italic = (node) => {\n if (node.gen) {\n // node is actually a generated node \"i\" made by another tag\n // don't process it\n return node;\n }\n return toNode(\"span\", { class: \"bbcode-i\" }, node.content);\n};\n\nexport const underline = (node) => {\n return toNode(\"span\", { class: \"bbcode-u\" }, node.content);\n};\n\nexport const strike = (node) => {\n return toNode(\"span\", { class: \"bbcode-s\" }, node.content);\n};\n","import { MD_NEWLINE_INJECT, MD_NEWLINE_INJECT_COMMENT, MD_NEWLINE_PRE_INJECT } from \"./common\";\n\n/**\n * Post Processing designed to fix issues with Markdown and BBCode that the parser can't fix.\n *\n * Separate from markdown-it post processing as it'll be able to manipulate the full string.\n * @param {string} raw string from processing through both BBCode and Markdown\n * @returns post processed string\n */\nfunction removeNewlineInjects(raw) {\n const processed = raw\n .replaceAll(MD_NEWLINE_INJECT, \"\")\n .replaceAll(MD_NEWLINE_PRE_INJECT, \"\")\n .replaceAll(\"\\n\" + MD_NEWLINE_INJECT_COMMENT, \"\")\n .replaceAll(MD_NEWLINE_INJECT_COMMENT + \"\\n\", \"\")\n .replaceAll(MD_NEWLINE_INJECT_COMMENT, \"\"); // Remove all instances of the injected newline\n return processed;\n}\n\n/**\n * Injects hoisted code blocks back into the raw string\n * @param {string} raw input to inject hoisted code blocks into\n * @param {any} data contains hoist map\n * @returns string with hoisted code blocks injected\n */\nfunction renderHoistedCodeBlocks(raw, data) {\n const hoistMap = data.hoistMap;\n for (const [uuid, content] of Object.entries(hoistMap)) {\n raw = raw.replaceAll(uuid, content);\n }\n return raw;\n}\n\n/**\n * Setups the class style tag template for the post\n * @param {string} raw\n * @param {{styles: string[]}} data - contains styles array\n * @returns string\n */\nfunction createClassStyleTagTemplate(raw, data) {\n if (data.styles.length === 0) {\n return raw;\n }\n const template = '\";\n return template + raw;\n}\n\n/**\n * Setups the script tag template for the post\n * @param {string} raw\n * @param {{\n * bbscripts: {\n * id: string,\n * class: string,\n * on: string,\n * version: string,\n * content: string\n * }[]}} data - contains scripts array\n * @returns string\n */\nfunction createScriptTagTemplate(raw, data) {\n if (data.bbscripts.length === 0) {\n return raw;\n }\n const templates = data.bbscripts.map(\n (s) =>\n ``,\n );\n return templates.join(\"\") + raw;\n}\n\n/**\n * Performs post processing on the raw string to address any necessary functionality that BBob/MD can't handle with a plugin (i.e. hoisting).\n * @param {string} raw processed input from after bbob and md\n * @param {any} data from bbob data\n * @returns final processed string\n */\nexport function postprocess(raw, data) {\n let final = raw;\n const postprocessors = [\n removeNewlineInjects,\n createClassStyleTagTemplate,\n createScriptTagTemplate,\n renderHoistedCodeBlocks,\n ];\n for (const postprocessor of postprocessors) {\n final = postprocessor(final, data);\n }\n return final;\n}\n","import { ESCAPABLES_REGEX, generateGUID, MD_TABLE_REGEX, regexIndexOf } from \"./common\";\n\n/**\n * Find all code blocks and hoist them out of the content and into a map for later insertion\n * @param {string} raw input to preprocess\n * @returns processed string and hoist map\n */\nfunction fenceCodeBlockPreprocess(content, data) {\n /** @type {Object.} */\n const hoistMap = {};\n let index = 0;\n\n const addHoistAndReturnNewStartPoint = (cutOffStart, cutOffEnd, expected, trim = false) => {\n const uuid = generateGUID();\n if (cutOffEnd !== -1) {\n hoistMap[uuid] = content.substring(cutOffStart, cutOffEnd);\n content = content.substring(0, cutOffStart) + uuid + content.substring(cutOffEnd);\n } else {\n hoistMap[uuid] = content.substring(cutOffStart);\n content = content.substring(0, cutOffStart) + uuid + expected;\n }\n if (trim) {\n if (hoistMap[uuid].startsWith(\"\\n\")) {\n hoistMap[uuid] = hoistMap[uuid].substring(1);\n }\n if (hoistMap[uuid].endsWith(\"\\n\")) {\n hoistMap[uuid] = hoistMap[uuid].substring(0, hoistMap[uuid].length - 1);\n }\n }\n return cutOffStart + uuid.length + expected.length;\n };\n\n while ((index = regexIndexOf(content, ESCAPABLES_REGEX, index)) !== -1) {\n const match = ESCAPABLES_REGEX.exec(content.substring(index));\n if (match.groups?.fence) {\n const fence = match.groups.fence;\n const fenceInfo = match.groups.fenceInfo;\n if (content[index] === \"\\n\") {\n // Check if the fence is not at the start of the content\n index += 1;\n }\n const closingFenceRegex = new RegExp(\"\\n\" + fence + \"(\\n|$)\"); // Find the next fence. By commonmark spec, it should be the same fence length and type\n const nextIndex = regexIndexOf(content, closingFenceRegex, index + fence.length);\n\n const uuid = generateGUID();\n if (nextIndex !== -1) {\n hoistMap[uuid] = content.substring(index + fence.length + fenceInfo.length, nextIndex);\n } else {\n hoistMap[uuid] = content.substring(index + fence.length + fenceInfo.length);\n }\n // inject bbcode tag before and after the code block. This is to prevent BBob plugin from injecting newlines\n const replacement = `[saveNL]\\n${fence}${fenceInfo}${uuid}\\n${fence}\\n[/saveNL]`;\n content =\n content.substring(0, index) +\n replacement +\n (nextIndex !== -1 ? content.substring(nextIndex + 1 + fence.length) : \"\");\n index = index + replacement.length;\n } else if (match.groups?.bbcode) {\n const bbcode = match.groups.bbcode;\n const bbcodeTag = match.groups.bbcodeTag.toLowerCase(); // coerce to lowercase for caseinsensitive matching\n const closingTag = `[/${bbcodeTag}]`;\n const nextIndex = content.toLowerCase().indexOf(closingTag, index + 1);\n index = addHoistAndReturnNewStartPoint(index + bbcode.length, nextIndex, closingTag, true);\n } else if (match.groups.backtick) {\n const backtick = match.groups.backtick; // contains whole content\n const tickStart = match.groups.tickStart;\n const tickEnd = match.groups.tickEnd;\n index = addHoistAndReturnNewStartPoint(\n index + tickStart.length,\n index + backtick.length - tickEnd.length,\n tickEnd,\n );\n }\n }\n\n data.hoistMap = hoistMap;\n return [content, data];\n}\n\n/**\n * Find all markdown table blocks and mark them to ignore newlines\n * @param {string} raw input to preprocess\n * @returns processed string\n */\nfunction mdTableBlockPreprocess(content, data) {\n let index = 0;\n while ((index = regexIndexOf(content, MD_TABLE_REGEX, index)) !== -1) {\n const match = MD_TABLE_REGEX.exec(content.substring(index));\n const table = match[0];\n const replacement = `[saveNL]\\n${table}\\n[/saveNL]`;\n content = content.substring(0, index) + replacement + content.substring(index + table.length);\n index = index + replacement.length;\n }\n return [content, data];\n}\n\n/**\n * Preprocesses input to be formatted for bbob to intake. Handles any necessary functionality that BBob can't handle with a plugin (i.e. hoisting).\n * @param {string} raw input to preprocess\n * @returns formatted input for bbob to intake\n */\nexport function preprocessRaw(raw) {\n let data = {};\n const preprocessors = [fenceCodeBlockPreprocess, mdTableBlockPreprocess];\n for (const preprocessor of preprocessors) {\n [raw, data] = preprocessor(raw, data);\n }\n return [raw, data];\n}\n","import bbob from \"@bbob/core\";\nimport { render } from \"@bbob/html\";\nimport { lineBreakPlugin } from \"./plugins/lineBreak\";\nimport { preserveWhitespace } from \"./plugins/preserveWhitespace\";\nimport { availableTags, preset, preventParsing } from \"./preset\";\nimport { postprocess } from \"./utils/postprocess\";\nimport { preprocessRaw } from \"./utils/preprocess\";\n\nconst options = {\n onlyAllowTags: [...availableTags],\n contextFreeTags: preventParsing, // prevent parsing of children\n enableEscapeTags: true,\n onError: (err) => {\n if (options.previewing) {\n // eslint-disable-next-line no-console\n console.warn(err.message, err.lineNumber, err.columnNumber);\n }\n },\n};\nconst presetTags = preset();\n\nexport const RpNBBCode = (code, opts) => {\n const plugins = [presetTags];\n if (opts.preserveWhitespace) {\n plugins.push(preserveWhitespace());\n }\n plugins.push(lineBreakPlugin());\n const [preprocessed, preprocessedData] = preprocessRaw(code);\n return bbob(plugins).process(preprocessed, {\n render,\n ...options,\n data: {\n ...preprocessedData,\n raw: preprocessed,\n previewing: opts.previewing,\n fonts: new Set(),\n styles: [],\n bbscripts: [],\n },\n });\n};\n\nexport { postprocess };\n","let C1 = 'C1';\nlet C2 = 'C2';\nif (process.env.NODE_ENV !== 'production') {\n C1 = '\"parser\" is not a function, please pass to \"process(input, { parser })\" right function';\n C2 = '\"render\" function not defined, please pass to \"process(input, { render })\"';\n}\nexport { C1, C2 };\n"],"names":["N","TAB","EQ","QUOTEMARK","SPACE","OPEN_BRAKET","CLOSE_BRAKET","SLASH","BACKSLASH","isTagNode","el","isStringNode","keysReduce","obj","reduce","def","Object","keys","acc","key","getNodeLength","node","Array","isArray","content","count","contentNode","String","length","escapeAttrValue","value","replace","attrValue","name","JSON","stringify","attrsToString","values","arr","join","getTagAttrs","tag","params","uniqAttr","res","tagAttr","attrs","TagNode","attr","this","append","push","appendToNode","setStart","start","setEnd","end","toTagStart","openTag","closeTag","toTagEnd","toTagNode","newNode","toLowerCase","toString","r","renderContent","tagStart","create","isOf","type","constructor","TOKEN_TYPE_ID","getTokenValue","token","isTagEnd","charCodeAt","Token","isEmpty","isNaN","isText","isTag","isAttrName","isAttrValue","isStart","isEnd","getName","slice","getTagName","getValue","getLine","getColumn","getStart","getEnd","text","tokenToText","row","col","TYPE_WORD","TYPE_TAG","TYPE_ATTR_NAME","TYPE_ATTR_VALUE","TYPE_SPACE","TYPE_NEW_LINE","CharGrabber","skip","num","silent","c","pos","o","onSkip","hasNext","len","getCurr","s","getPos","getLength","getRest","substring","getNext","nextPos","getPrev","prevPos","isLast","includes","val","indexOf","grabWhile","condition","grabN","substrUntilChar","char","idx","source","options","createCharGrabber","EM","STATE_WORD","STATE_TAG","STATE_TAG_ATTRS","TAG_STATE_NAME","TAG_STATE_ATTR","TAG_STATE_VALUE","WHITESPACES","SPECIAL_CHARS","END_POS_OFFSET","isWhiteSpace","isEscapeChar","isSpecialChar","isNewLine","unq","str","charToRemove","charAt","trimChar","createLexer","buffer","prevCol","tokenIndex","stateMode","tagMode","contextFreeTag","tokens","Math","floor","escapeTags","enableEscapeTags","contextFreeTags","filter","Boolean","map","nestedMap","Map","onToken","RESERVED_CHARS","NOT_CHAR_TOKENS","isCharReserved","isCharToken","isEscapableChar","checkContextFreeMode","isClosingTag","chars","emitToken","startPos","endPos","cl","p","e","createTokenOfType","nextTagState","tagChars","isSingleValueTag","masterStartPos","validAttrName","isValue","stateSpecial","validAttrValue","isQM","prevChar","nextChar","isPrevSLASH","isNextEQ","isWS","isNextWS","stateTag","currChar","substr","hasInvalidChars","isNoAttrsInTag","stateAttrs","tagStr","tagGrabber","hasSpace","stateWord","word","fullTagLen","fullTagName","isChar","tokenize","isTokenNested","has","get","status","set","NodeList","last","n","flush","pop","toArray","createList","parse","input","opts","onlyAllowTags","tokenizer","nodes","nestedNodes","tagNodes","tagNodesAttrName","nestedTagsMap","Set","isTagNested","tagName","flushTagNodes","getNodes","lastNestedNode","appendNodeAsString","isNested","forEach","item","appendNodes","handleTagStart","tagNode","from","to","add","handleTag","lastTagNode","onError","line","column","lineNumber","columnNumber","handleTagEnd","lexer","createTokenizer","activeTagNode","tokenValue","attrName","handleNode","isObj","isBool","iterate","t","cb","tree","same","expected","actual","every","exp","some","call","act","ao","eo","createTree","extendedTree","messages","walk","match","expr","expression","SELFCLOSE_END_TAG","CLOSE_START_TAG","START_TAG","END_TAG","renderNode","stripTags","render","toNode","gen","preprocessAttr","raw","vals","_default","openTagParts","split","trim","startsWith","endsWith","toOriginalStartTag","regexIndexOf","string","regex","startpos","search","MD_NEWLINE_INJECT","MD_NEWLINE_PRE_INJECT","MD_NEWLINE_INJECT_COMMENT","URL_REGEX_SINGLE_LINE","RegExp","ESCAPABLES_REGEX","MD_TABLE_REGEX","generateGUID","d","Date","getTime","window","performance","now","random","isString","disableLineBreakConversion","unshift","child","splice","isWhitespaceSensitive","test","numSpaces","fromCharCode","repeat","process","tags","core","tagCallback","SLIDE_TITLE_OPEN","Symbol","SLIDE_TITLE_CLOSE","SLIDE_CLOSE","SLIDE_REGEX","markerToString","marker","accordionTags","accordion","groupId","markedContent","contentArr","newArr","shift","foundIndex","preContent","postContent","groups","slideTitleOpen","slideTitleClose","slideClose","generateSlideMarkersFromContent","generatedSlides","currentSlide","prevMarker","customTitle","generateSlidesFromMarkers","filteredContent","isValid","data","customSettings","bright","bcenter","bleft","fleft","fright","width","find","classes","style","class","slide","title","isOpen","open","titleAlign","left","right","center","possibleOptions","alignment","anchor","a","id","goto","href","WEB_FONTS","VALID_FONT_STYLES","thin","extralight","light","regular","medium","semibold","bold","extrabold","black","REGISTERED_AXIS","AXES_REGEX","emailHeader","emailFooter","rowcolumn","columnAttrs","columnStyle","EVENTS","ACCEPTED_OPTIONS","textmessage","recipient","message","option","animation","previewing","commonGUID","commonId","keyframes","ident","cleanContent","replaceAll","formatted","styles","bg","color","block","defaultOp","blockAttr","blockOption","blockquote","author","border","br","centerblock","percentageInput","check","nameAttr","classSuffix","className","selector","mediaQuery","state","minWidth","maxWidth","code","inputColor","comment","div","classAttrs","classNames","divide","fieldset","fa","font","fontFamily","family","axes","ital","wght","matches","exec","italic","weight","named_weight","fromEntries","entries","axesParser","url","sort","googleFontApiBuild","fonts","custom","fontVar","h","h1","h2","h3","h4","h5","h6","heightrestrict","heightInput","heightValue","parsedHeight","parseHeight","highlight","icode","imagefloat","inlinespoiler","justify","keyframe","mail","attributes","mailAttr","mailOption","person","subject","newspaper","nobr","note","ooc","pindent","plain","print","printAttr","printOption","progress","percentageInt","quote","thinprogress","savenl","sh","script","onEvent","on","scriptSetup","version","bbscripts","scroll","side","size","fontSize","fontValue","valid","parsedSize","sizeRanges","unit","parseFontSize","outputAttr","spoiler","providedTitle","sub","sup","tab","tabId","checked","for","tabs","tabsList","tabNode","b","i","u","availableTags","preset","createPreset","defTags","processor","presetFactory","presetExecutor","assign","extend","callback","removeNewlineInjects","renderHoistedCodeBlocks","hoistMap","uuid","createClassStyleTagTemplate","createScriptTagTemplate","fenceCodeBlockPreprocess","index","addHoistAndReturnNewStartPoint","cutOffStart","cutOffEnd","fence","fenceInfo","closingFenceRegex","nextIndex","replacement","bbcode","closingTag","bbcodeTag","backtick","tickStart","tickEnd","mdTableBlockPreprocess","table","err","console","warn","presetTags","plugins","preserveWhitespace","preprocessed","preprocessedData","preprocessors","preprocessor","preprocessRaw","plugs","mockRender","skipParse","parser","parseFn","renderFn","Error","plugin","newTree","html","bbob","final","postprocessors","postprocessor"],"mappings":";oPAAA,MAAMA,EAAI,KACJC,EAAM,KAGNC,EAAK,IACLC,EAAY,IACZC,EAAQ,IACRC,EAAc,IACdC,EAAe,IACfC,EAAQ,IACRC,EAAY,KCTlB,SAASC,EAAUC,GACf,MAAqB,iBAAPA,GAA0B,OAAPA,GAAe,QAASA,CAC7D,CACA,SAASC,EAAaD,GAClB,MAAqB,iBAAPA,CAClB,CAKA,SAASE,EAAWC,EAAKC,EAAQC,GAE7B,OADaC,OAAOC,KAAKJ,GACbC,QAAO,CAACI,EAAKC,IAAML,EAAOI,EAAKC,EAAKN,IAAME,EAC1D,CACA,SAASK,EAAcC,GACnB,OAAIZ,EAAUY,IAASC,MAAMC,QAAQF,EAAKG,SAC/BH,EAAKG,QAAQV,QAAO,CAACW,EAAOC,IACxBD,EAAQL,EAAcM,IAC9B,GAEHf,EAAaU,GACNM,OAAON,GAAMO,OAEjB,CACX,CASI,SAASC,EAAgBC,GACzB,OAAOA,EAAMC,QAAQ,KAAM,SAASA,QAAQ,KAAM,QAAQA,QAAQ,KAAM,QAAQA,QAAQ,KAAM,UAAUA,QAAQ,KAAM,UACrHA,QAAQ,gCAAiC,QAC9C,CAMI,SAASC,EAAUC,EAAMH,GAEzB,cAAcA,GACV,IAAK,UACD,OAAOA,EAAQ,GAAGG,IAAS,GAC/B,IAAK,SACD,MAAO,GAAGA,MAASH,KACvB,IAAK,SACD,MAAO,GAAGG,MAASJ,EAAgBC,MACvC,IAAK,SACD,MAAO,GAAGG,MAASJ,EAAgBK,KAAKC,UAAUL,OACtD,QACI,MAAO,GAEnB,CAKI,SAASM,EAAcC,GAEvB,OAAc,MAAVA,EACO,GAEJzB,EAAWyB,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U,UACAuG,SAEJpG,EAAOW,GAAWmU,GAAW9U,EAAM9I,EACtC,CACJ,CACD,MAAO,CACH,QAAI6d,GACA,GAAwB,mBAAbJ,EACP,MAAM,IAAIC,MwDxDzB,MxD0DW,OAAOD,EAAS3U,EAAMA,EAAK9I,QAC9B,EACD8I,OACA4B,MACAf,SAAUb,EAAKa,SAEtB,EAET,CuDvCSmU,CAAKjB,GAAS5P,QAAQ8P,EAAc,CACzCzS,aACGtK,GACHkP,KAAM,IACD8N,EACHtS,IAAKqS,EACLzK,WAAYnM,EAAKmM,WACjBwD,MAAO,IAAInP,IACXmM,OAAQ,GACR+F,UAAW,KAEb,gBFsCG,SAAqBnO,EAAKwE,GAC/B,IAAI6O,EAAQrT,EACZ,MAAMsT,EAAiB,CACrB/C,GACAI,GACAC,GACAJ,IAEF,IAAK,MAAM+C,KAAiBD,EAC1BD,EAAQE,EAAcF,EAAO7O,GAE/B,OAAO6O,CACT","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,13,64]} \ No newline at end of file diff --git a/bbcode-src/index.js b/bbcode-src/index.js index 606fb60..e685539 100644 --- a/bbcode-src/index.js +++ b/bbcode-src/index.js @@ -31,6 +31,7 @@ export const RpNBBCode = (code, opts) => { ...options, data: { ...preprocessedData, + raw: preprocessed, previewing: opts.previewing, fonts: new Set(), styles: [], diff --git a/bbcode-src/tags/accordion.js b/bbcode-src/tags/accordion.js index c90ae35..685de17 100644 --- a/bbcode-src/tags/accordion.js +++ b/bbcode-src/tags/accordion.js @@ -1,3 +1,4 @@ +import { isStringNode, isTagNode, TagNode } from "@bbob/plugin-helper"; import { generateGUID, preprocessAttr, @@ -5,7 +6,6 @@ import { toNode, toOriginalStartTag, } from "../utils/common"; -import { TagNode, isStringNode, isTagNode } from "@bbob/plugin-helper"; const SLIDE_TITLE_OPEN = Symbol("slide-title-open"); const SLIDE_TITLE_CLOSE = Symbol("slide-title-close"); @@ -19,7 +19,7 @@ const SLIDE_REGEX = * * [accordion][slide=name]content[/slide][/accordion] */ -const accordion = (node) => { +const accordion = (node, options) => { const groupId = generateGUID(); // add support for existing {slide} tags style, due to copious amounts of existing content @@ -39,7 +39,7 @@ const accordion = (node) => { return [toOriginalStartTag(node), ...node.content, node.toTagEnd()]; } - const attrs = preprocessAttr(node.attrs); + const attrs = preprocessAttr(node, options.data.raw); if (attrs._default) { /** @type {string[]} */ @@ -188,12 +188,12 @@ function markerToString(marker) { } } -const slide = (node) => { +const slide = (node, options) => { if (!node.isValid) { // not inside an [accordion] tag return [toOriginalStartTag(node), ...node.content, node.toTagEnd()]; } - const attrs = preprocessAttr(node.attrs); + const attrs = preprocessAttr(node, options.data.raw); let title = [attrs.title || attrs._default || "Slide"]; let isOpen = !!attrs.open || false; let titleAlign = attrs.left ? "left" : attrs.right ? "right" : attrs.center ? "center" : "left"; diff --git a/bbcode-src/tags/anchor.js b/bbcode-src/tags/anchor.js index 49997b7..6655382 100644 --- a/bbcode-src/tags/anchor.js +++ b/bbcode-src/tags/anchor.js @@ -5,16 +5,16 @@ import { preprocessAttr, toNode } from "../utils/common"; */ export const anchor = { // name is not valid in HTML5; however, it correctly displays back while id does not - a: (node) => { - const attrs = preprocessAttr(node.attrs)._default || ""; + a: (node, options) => { + const attrs = preprocessAttr(node, options.data.raw)._default || ""; return toNode( "a", { id: `user-anchor-${attrs.trim()}`, name: `user-anchor-${attrs.trim()}` }, node.content, ); }, - goto: (node) => { - const attrs = preprocessAttr(node.attrs)._default || ""; + goto: (node, options) => { + const attrs = preprocessAttr(node, options.data.raw)._default || ""; return toNode("a", { href: `#user-anchor-${attrs.trim()}` }, node.content); }, }; diff --git a/bbcode-src/tags/animation.js b/bbcode-src/tags/animation.js index 7acd081..a11f5cf 100644 --- a/bbcode-src/tags/animation.js +++ b/bbcode-src/tags/animation.js @@ -1,5 +1,5 @@ -import { preprocessAttr, toOriginalStartTag } from "../utils/common"; import { isStringNode, isTagNode } from "@bbob/plugin-helper"; +import { preprocessAttr, toOriginalStartTag } from "../utils/common"; /** * Renders css Keyframes @@ -15,13 +15,13 @@ export const animation = (node, options) => { } const commonId = options.data.previewing ? "preview" : options.data.commonGUID; - const name = preprocessAttr(node.attrs)?._default || ""; + const name = preprocessAttr(node, options.data.raw)?._default || ""; const keyframes = node.content .filter((n) => isTagNode(n) && n.tag === "keyframe") .map((content) => { content.isValid = true; /** @type {string} */ - const ident = preprocessAttr(content.attrs)._default || ""; + const ident = preprocessAttr(content, options.data.raw)._default || ""; content.ident = ident + (ident.match(/^\d+$/) ? "%" : ""); const cleanContent = content.content .filter(isStringNode) diff --git a/bbcode-src/tags/background.js b/bbcode-src/tags/background.js index 57ef717..6c401f6 100644 --- a/bbcode-src/tags/background.js +++ b/bbcode-src/tags/background.js @@ -4,8 +4,8 @@ import { preprocessAttr, toNode } from "../utils/common"; * Add [bg] tag * @example [bg=red]Hello[/bg] */ -export const bg = (node) => { - const color = preprocessAttr(node.attrs)._default; +export const bg = (node, options) => { + const color = preprocessAttr(node, options.data.raw)._default; return toNode( "div", { diff --git a/bbcode-src/tags/block.js b/bbcode-src/tags/block.js index 34c7bec..c7efc76 100644 --- a/bbcode-src/tags/block.js +++ b/bbcode-src/tags/block.js @@ -4,9 +4,9 @@ import { preprocessAttr, toNode } from "../utils/common"; * Add [block] tag * @example [block=treasure]content[/block] */ -export const block = (node) => { +export const block = (node, options) => { const defaultOp = "block"; - const blockAttr = (preprocessAttr(node.attrs)._default || defaultOp).toLowerCase(); + const blockAttr = (preprocessAttr(node, options.data.raw)._default || defaultOp).toLowerCase(); const OPTIONS = [ "block", diff --git a/bbcode-src/tags/blockquote.js b/bbcode-src/tags/blockquote.js index 16ba7c2..f62f36e 100644 --- a/bbcode-src/tags/blockquote.js +++ b/bbcode-src/tags/blockquote.js @@ -4,8 +4,8 @@ import { preprocessAttr, toNode } from "../utils/common"; * @file Adds [blockquote] to bbcode * @example [blockquote=author]content[/blockquote] */ -export const blockquote = (node) => { - const author = preprocessAttr(node.attrs)._default || ""; +export const blockquote = (node, options) => { + const author = preprocessAttr(node, options.data.raw)._default || ""; return toNode("div", { class: "bb-blockquote" }, [ toNode("div", { class: "bb-blockquote-left" }), diff --git a/bbcode-src/tags/border.js b/bbcode-src/tags/border.js index b93967c..19c22c8 100644 --- a/bbcode-src/tags/border.js +++ b/bbcode-src/tags/border.js @@ -1,13 +1,13 @@ import { preprocessAttr, toNode } from "../utils/common"; -export const border = (node) => { - const val = preprocessAttr(node.attrs)._default; +export const border = (node, options) => { + const val = preprocessAttr(node, options.data.raw)._default; return toNode( "div", { style: `border: ${val};`, class: "bb-border", }, - node.content + node.content, ); }; diff --git a/bbcode-src/tags/centerblock.js b/bbcode-src/tags/centerblock.js index 7b3ad09..f3cbf0c 100644 --- a/bbcode-src/tags/centerblock.js +++ b/bbcode-src/tags/centerblock.js @@ -1,6 +1,6 @@ import { preprocessAttr, toNode } from "../utils/common"; -export const centerblock = (node) => { - const percentageInput = preprocessAttr(node.attrs)._default || "50"; +export const centerblock = (node, options) => { + const percentageInput = preprocessAttr(node, options.data.raw)._default || "50"; return toNode("div", { style: `margin: 0 auto; width: ${percentageInput}%` }, node.content); }; diff --git a/bbcode-src/tags/check.js b/bbcode-src/tags/check.js index 1935665..e968c04 100644 --- a/bbcode-src/tags/check.js +++ b/bbcode-src/tags/check.js @@ -1,6 +1,6 @@ import { preprocessAttr, toNode } from "../utils/common"; -export const check = (node) => { - const attrs = preprocessAttr(node.attrs)._default || "dot"; +export const check = (node, options) => { + const attrs = preprocessAttr(node, options.data.raw)._default || "dot"; return toNode("div", { class: `bb-check`, "data-type": attrs }, node.content); }; diff --git a/bbcode-src/tags/class.js b/bbcode-src/tags/class.js index c9ced03..972650f 100644 --- a/bbcode-src/tags/class.js +++ b/bbcode-src/tags/class.js @@ -9,7 +9,7 @@ import { preprocessAttr } from "../utils/common"; * [class name="className" selector=""]content[/class] */ export const classStyle = (node, options) => { - const attrs = preprocessAttr(node.attrs); + const attrs = preprocessAttr(node); const nameAttr = attrs.name || attrs._default; if (!options.data.previewing && !options.data.commonGUID) { diff --git a/bbcode-src/tags/code.js b/bbcode-src/tags/code.js index 3c4d372..7c23286 100644 --- a/bbcode-src/tags/code.js +++ b/bbcode-src/tags/code.js @@ -4,7 +4,7 @@ import { preprocessAttr } from "../utils/common"; * processes [code] tag and returns a fenced code block */ export const code = (node) => { - const lang = preprocessAttr(node.attrs)._default || "bbcode"; + const lang = preprocessAttr(node)._default || "bbcode"; return { isWhitespaceSensitive: true, content: ["```" + lang + "\n", node.content, "\n```\n"], diff --git a/bbcode-src/tags/color.js b/bbcode-src/tags/color.js index a96ccd8..e0d7320 100644 --- a/bbcode-src/tags/color.js +++ b/bbcode-src/tags/color.js @@ -1,7 +1,7 @@ import { preprocessAttr, toNode } from "../utils/common"; export const color = (node) => { - const inputColor = preprocessAttr(node.attrs)._default || ""; + const inputColor = preprocessAttr(node)._default || ""; if (inputColor.trim() === "") { return node.content; } diff --git a/bbcode-src/tags/div.js b/bbcode-src/tags/div.js index bc647d5..eeb657a 100644 --- a/bbcode-src/tags/div.js +++ b/bbcode-src/tags/div.js @@ -11,7 +11,7 @@ export const div = (node, options) => { // don't process it return node; } - const attrs = preprocessAttr(node.attrs); + const attrs = preprocessAttr(node, options.data.raw); const style = attrs.style || attrs._default; const classAttrs = attrs.class; if (!classAttrs?.trim()) { diff --git a/bbcode-src/tags/divide.js b/bbcode-src/tags/divide.js index eaf33fc..2dadcf4 100644 --- a/bbcode-src/tags/divide.js +++ b/bbcode-src/tags/divide.js @@ -1,13 +1,13 @@ import { preprocessAttr, toNode } from "../utils/common"; export const divide = (node) => { - const type = (preprocessAttr(node.attrs)._default || "").toLowerCase(); + const type = (preprocessAttr(node)._default || "").toLowerCase(); return toNode( "span", { class: "bb-divide", "data-type": type, }, - node.content + node.content, ); }; diff --git a/bbcode-src/tags/fieldset.js b/bbcode-src/tags/fieldset.js index b4737ef..592266f 100644 --- a/bbcode-src/tags/fieldset.js +++ b/bbcode-src/tags/fieldset.js @@ -4,8 +4,8 @@ import { preprocessAttr, toNode } from "../utils/common"; * @file Adds [fieldset] to bbcode * @example [fieldset=title]content[/fieldset] */ -export const fieldset = (node) => { - const title = preprocessAttr(node.attrs)._default || ""; +export const fieldset = (node, options) => { + const title = preprocessAttr(node, options.data.raw)._default || ""; return toNode("fieldset", { class: "bb-fieldset" }, [ toNode("legend", { class: "bb-fieldset-legend" }, title), toNode("div", { class: "bb-fieldset" }, node.content), diff --git a/bbcode-src/tags/font.js b/bbcode-src/tags/font.js index 31548f5..f239ac8 100644 --- a/bbcode-src/tags/font.js +++ b/bbcode-src/tags/font.js @@ -74,13 +74,13 @@ const googleFontApiBuild = (family, axes) => { }; export const font = (node, options) => { - const attrs = preprocessAttr(node.attrs); + const attrs = preprocessAttr(node, options.data.raw); const fontFamily = attrs?._default || attrs.family || attrs.name; if (fontFamily.trim() === "") { return node.content; } if (WEB_FONTS.includes(fontFamily.trim().toLowerCase())) { - return toNode("span", { style: "font-family: " + fontFamily }, node.content); + return toNode("span", { style: `font-family: '${fontFamily}'` }, node.content); } const axes = axesParser(attrs); @@ -99,7 +99,7 @@ export const font = (node, options) => { return toNode( "span", { - style: `font-family: ${fontFamily}; font-weight: ${axes.wght}; font-style: ${italic}; ${fontVar}`, + style: `font-family: '${fontFamily}'; font-weight: ${axes.wght}; font-style: ${italic}; ${fontVar}`, "data-font": url, }, node.content, diff --git a/bbcode-src/tags/fontawesome.js b/bbcode-src/tags/fontawesome.js index 1053875..82bcf22 100644 --- a/bbcode-src/tags/fontawesome.js +++ b/bbcode-src/tags/fontawesome.js @@ -1,4 +1,4 @@ -import { preprocessAttr, toNode } from "../utils/common"; +import { toNode } from "../utils/common"; /** * Adds [fa] tag @@ -7,7 +7,7 @@ import { preprocessAttr, toNode } from "../utils/common"; * [fa primary-color="" secondary-color="" primary-opacity="" secondary-opacity="" rotate-angle=""]fa-duotone fa-icon[/fa] */ export const fa = (node) => { - const attrs = preprocessAttr(node.attrs); + const attrs = node.attrs; let style = attrs.style || ""; style += attrs["primary-color"] ? `--fa-primary-color: ${attrs["primary-color"]};` : ""; style += attrs["secondary-color"] ? `--fa-secondary-color: ${attrs["secondary-color"]};` : ""; diff --git a/bbcode-src/tags/heightrestrict.js b/bbcode-src/tags/heightrestrict.js index b7f2d92..8204f34 100644 --- a/bbcode-src/tags/heightrestrict.js +++ b/bbcode-src/tags/heightrestrict.js @@ -23,7 +23,7 @@ function parseHeight(heightValue) { * @example [heightrestrict=50]content[/heightrestrict] */ export const heightrestrict = (node) => { - const attrs = preprocessAttr(node.attrs)._default; + const attrs = preprocessAttr(node)._default; const heightInput = parseHeight(attrs).toString(); // Return image's default size if heightrestrict did not involve a valid value return heightInput === "0" diff --git a/bbcode-src/tags/imagefloat.js b/bbcode-src/tags/imagefloat.js index fd31424..79d85b4 100644 --- a/bbcode-src/tags/imagefloat.js +++ b/bbcode-src/tags/imagefloat.js @@ -4,6 +4,6 @@ import { preprocessAttr, toNode } from "../utils/common"; * @exmaple [imagefloat=left]content[/imagefloat] */ export const imagefloat = (node) => { - const attrs = preprocessAttr(node.attrs)._default || ""; + const attrs = preprocessAttr(node)._default || ""; return toNode("div", { class: `bb-float-${attrs}` }, node.content); }; diff --git a/bbcode-src/tags/mail.js b/bbcode-src/tags/mail.js index 9e4075b..1e1176f 100644 --- a/bbcode-src/tags/mail.js +++ b/bbcode-src/tags/mail.js @@ -1,4 +1,4 @@ -import { preprocessAttr, toNode } from "../utils/common"; +import { toNode } from "../utils/common"; /** * @file Adds [mail] to bbcode * @param {string} [type="send"] Denotes type of mail either send or receive @@ -23,11 +23,11 @@ const emailHeader = toNode("div", { class: "bb-email-header" }, ""); const emailFooter = toNode( "div", { class: "bb-email-footer" }, - toNode("div", { class: "bb-email-button" }, "") + toNode("div", { class: "bb-email-button" }, ""), ); export const mail = (node) => { - const attributes = preprocessAttr(node.attrs); + const attributes = node.attrs; let mailAttr = { mailOption: (attributes.type || "send").toLowerCase(), person: attributes.person || "Unknown", @@ -46,6 +46,6 @@ export const mail = (node) => { parseEmailSubject(mailAttr.subject), parseEmailContent(node.content), emailFooter, - ] + ], ); }; diff --git a/bbcode-src/tags/print.js b/bbcode-src/tags/print.js index 5267cf9..b87c7b7 100644 --- a/bbcode-src/tags/print.js +++ b/bbcode-src/tags/print.js @@ -6,7 +6,7 @@ import { preprocessAttr, toNode } from "../utils/common"; */ export const print = (node) => { const defaultOp = "print"; - const printAttr = (preprocessAttr(node.attrs)._default || defaultOp).toLowerCase(); + const printAttr = (preprocessAttr(node)._default || defaultOp).toLowerCase(); const OPTIONS = ["print", "line", "graph", "parchment"]; diff --git a/bbcode-src/tags/progress.js b/bbcode-src/tags/progress.js index cf5d64b..a3e2b78 100644 --- a/bbcode-src/tags/progress.js +++ b/bbcode-src/tags/progress.js @@ -5,7 +5,7 @@ import { preprocessAttr, toNode } from "../utils/common"; * @exmaple [progress=percentageInt]content[/progress] */ export const progress = (node) => { - const percentageInt = preprocessAttr(node.attrs)._default; + const percentageInt = preprocessAttr(node)._default; return toNode("div", { class: "bb-progress" }, [ toNode("div", { class: "bb-progress-text" }, node.content), toNode("div", { class: "bb-progress-bar", style: `width: calc(${percentageInt}% - 6px)` }, ""), diff --git a/bbcode-src/tags/quote.js b/bbcode-src/tags/quote.js index 42c1b91..2f81fd5 100644 --- a/bbcode-src/tags/quote.js +++ b/bbcode-src/tags/quote.js @@ -3,8 +3,8 @@ import { preprocessAttr } from "../utils/common"; /** * rebuild the [quote] tag so that markdown-it engine can parse it for itself */ -export const quote = (node) => { - const attrs = preprocessAttr(node.attrs); +export const quote = (node, options) => { + const attrs = preprocessAttr(node, options.data.raw); if (node.content[0] === "\n") { node.content.shift(); } diff --git a/bbcode-src/tags/rowcolumn.js b/bbcode-src/tags/rowcolumn.js index 46dbeab..28a6c4a 100644 --- a/bbcode-src/tags/rowcolumn.js +++ b/bbcode-src/tags/rowcolumn.js @@ -6,8 +6,8 @@ import { preprocessAttr, toNode } from "../utils/common"; */ export const rowcolumn = { row: (node) => toNode("div", { class: "bb-row" }, node.content), - column: (node) => { - const columnAttrs = preprocessAttr(node.attrs)._default || "8"; + column: (node, options) => { + const columnAttrs = preprocessAttr(node, options.data.raw)._default || "8"; const columnStyle = columnAttrs.startsWith("span") ? `column-width-${columnAttrs}` : `column-width-span${columnAttrs}`; diff --git a/bbcode-src/tags/script.js b/bbcode-src/tags/script.js index a69818e..e278c09 100644 --- a/bbcode-src/tags/script.js +++ b/bbcode-src/tags/script.js @@ -19,7 +19,7 @@ const EVENTS = [ * [script class="id" on="event" version="2"]content[/script] */ export const script = (node, options) => { - const attrs = preprocessAttr(node.attrs); + const attrs = preprocessAttr(node, options.data.raw); if (!options.data.previewing && !options.data.commonGUID) { // create a common GUID for the post diff --git a/bbcode-src/tags/scroll.js b/bbcode-src/tags/scroll.js index 7811734..7e8620a 100644 --- a/bbcode-src/tags/scroll.js +++ b/bbcode-src/tags/scroll.js @@ -22,8 +22,8 @@ function parseHeight(heightValue) { * @file Adds [scroll] to bbcode * @example [scroll]content[/scroll] */ -export const scroll = (node) => { - const attrs = preprocessAttr(node.attrs)._default; +export const scroll = (node, options) => { + const attrs = preprocessAttr(node, options.data.raw)._default; const heightInput = parseHeight(attrs); return toNode("div", { class: "bb-scroll", style: `height: ${heightInput}px` }, node.content); }; diff --git a/bbcode-src/tags/side.js b/bbcode-src/tags/side.js index c675c37..4bac06b 100644 --- a/bbcode-src/tags/side.js +++ b/bbcode-src/tags/side.js @@ -1,6 +1,6 @@ import { preprocessAttr, toNode } from "../utils/common"; export const side = (node) => { - const attrs = preprocessAttr(node.attrs)._default || "left"; + const attrs = preprocessAttr(node)._default || "left"; return toNode("div", { class: "bb-side", "data-side": attrs }, node.content); }; diff --git a/bbcode-src/tags/size.js b/bbcode-src/tags/size.js index d5ee765..82ae6f8 100644 --- a/bbcode-src/tags/size.js +++ b/bbcode-src/tags/size.js @@ -51,7 +51,7 @@ function parseFontSize(fontValue) { } export const size = (node) => { - const input = preprocessAttr(node.attrs)._default; + const input = preprocessAttr(node)._default; const fontSize = parseFontSize(input); if (!fontSize.valid) { return node.content; diff --git a/bbcode-src/tags/spoiler.js b/bbcode-src/tags/spoiler.js index dff921c..9bfbff9 100644 --- a/bbcode-src/tags/spoiler.js +++ b/bbcode-src/tags/spoiler.js @@ -8,8 +8,8 @@ import { preprocessAttr, toNode } from "../utils/common"; * @example `[inlinespoiler]hidden content[/inlinespoiler] */ -export const spoiler = (node) => { - const providedTitle = preprocessAttr(node.attrs)._default; +export const spoiler = (node, options) => { + const providedTitle = preprocessAttr(node, options.data.raw)._default; const title = "Spoiler" + (providedTitle ? `: ${providedTitle}` : ""); /** diff --git a/bbcode-src/tags/tabs.js b/bbcode-src/tags/tabs.js index 78259ae..e163f57 100644 --- a/bbcode-src/tags/tabs.js +++ b/bbcode-src/tags/tabs.js @@ -1,5 +1,5 @@ -import { generateGUID, preprocessAttr, toNode, toOriginalStartTag } from "../utils/common"; import { isTagNode } from "@bbob/plugin-helper"; +import { generateGUID, preprocessAttr, toNode, toOriginalStartTag } from "../utils/common"; /** * @file Adds [tabs][tab] to bbcode @@ -33,12 +33,12 @@ export const tabs = (node) => { * [tab=name]content[/tab] * [tab name="name" style="style"]content[/tab] */ -export const tab = (node) => { +export const tab = (node, options) => { if (!node.isValid) { // not inside a [tabs] tag return [toOriginalStartTag(node), ...node.content, node.toTagEnd()]; } - const attrs = preprocessAttr(node.attrs); + const attrs = preprocessAttr(node, options.data.raw); const name = attrs._default || attrs.name || "Tab"; const tabId = `tab-${name.replace(/\W/g, "_")}-${generateGUID()}`; return [ diff --git a/bbcode-src/tags/textmessage.js b/bbcode-src/tags/textmessage.js index 98bc8fe..9e14a2d 100644 --- a/bbcode-src/tags/textmessage.js +++ b/bbcode-src/tags/textmessage.js @@ -7,8 +7,8 @@ import { preprocessAttr, toNode } from "../utils/common"; const ACCEPTED_OPTIONS = ["me", "them", "right", "left"]; export const textmessage = { - textmessage: (node) => { - const attr = preprocessAttr(node.attrs)._default || "Recipient"; + textmessage: (node, options) => { + const attr = preprocessAttr(node, options.data.raw)._default || "Recipient"; const recipient = attr && attr.trim() !== "" ? attr : "Recipient"; return toNode("div", { class: "bb-textmessage" }, [ toNode("div", { class: "bb-textmessage-name" }, recipient), @@ -17,8 +17,8 @@ export const textmessage = { ]), ]); }, - message: (node) => { - let option = preprocessAttr(node.attrs)._default.toLowerCase(); + message: (node, options) => { + let option = preprocessAttr(node, options.data.raw)._default.toLowerCase(); if (!ACCEPTED_OPTIONS.includes(option) || option === "right") { option = "me"; } diff --git a/bbcode-src/tags/thinprogress.js b/bbcode-src/tags/thinprogress.js index 1eb08e5..9e08c86 100644 --- a/bbcode-src/tags/thinprogress.js +++ b/bbcode-src/tags/thinprogress.js @@ -4,8 +4,8 @@ import { preprocessAttr, toNode } from "../utils/common"; * @file Adds [thinprogress] to bbcode * @exmaple [thinprogress=percentageInt]content[/progthinprogressress] */ -export const thinprogress = (node) => { - const percentageInt = preprocessAttr(node.attrs)._default; +export const thinprogress = (node, options) => { + const percentageInt = preprocessAttr(node, options.data.raw)._default; return toNode("div", { class: "bb-progress-thin" }, [ toNode("div", { class: "bb-progress-text" }, node.content), toNode("div", { class: "bb-progress-bar", style: `width: calc(${percentageInt}% - 6px)` }, ""), diff --git a/bbcode-src/utils/common.js b/bbcode-src/utils/common.js index ca54c65..4071770 100644 --- a/bbcode-src/utils/common.js +++ b/bbcode-src/utils/common.js @@ -27,22 +27,37 @@ const toNode = (tag, attrs, content = []) => ({ }); /** - * Preprocess attributes of a node to either combine all values into a single default value + * Preprocess attributes of a node to either return the default single attribute * or return a keyed attribute list - * @param {any} attrs object of bbcode node attrs - * @param {string[]} predefinedKeys array of predefined keys to be captured + * @param {import('@bbob/types').TagNode} node bbcode node to process + * @param {string} [raw] raw string. Only include if the single attribute is allowed to have spaces * @returns processed attributes */ -const preprocessAttr = (attrs) => { - const keys = Object.keys(attrs).join(" "); - const vals = Object.values(attrs).join(" "); - if (keys === vals) { +const preprocessAttr = (node, raw) => { + const keys = Object.keys(node.attrs).join(" "); + const vals = Object.values(node.attrs).join(" "); + if (keys !== vals) { + return node.attrs; + } + if (!raw || !node.start) { return { _default: vals, }; - } else { - return attrs; } + // [tag=attr] + // node.start.from = 0 + // node.start.to = 10 + const openTagParts = raw.substring(node.start.from, node.start.to).split("="); + if (openTagParts.length !== 2) { + return node.attrs; + } + let val = openTagParts[1].slice(0, -1).trim(); // `attr` or `"attr"` + if (val.startsWith('"') && val.endsWith('"')) { + val = val.slice(1, -1); + } + return { + _default: val, + }; }; /** diff --git a/package.json b/package.json index 7d597e6..769d5fa 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "lint": "eslint" }, "devDependencies": { + "@bbob/types": "^4.1.0", "@discourse/lint-configs": "^1.3.9", "@rollup/plugin-node-resolve": "^15.1.0", "@rollup/plugin-replace": "^5.0.7", @@ -24,10 +25,10 @@ "rollup": "^4.18.0" }, "dependencies": { - "@bbob/core": "^4.0.3", - "@bbob/html": "^4.0.3", - "@bbob/preset": "^4.0.3", - "@bbob/preset-html5": "^4.0.3" + "@bbob/core": "^4.1.0", + "@bbob/html": "^4.1.0", + "@bbob/preset": "^4.1.0", + "@bbob/preset-html5": "^4.1.0" }, "lint-staged": { "*.js": "eslint --fix", diff --git a/yarn.lock b/yarn.lock index a571162..b862eab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -286,77 +286,60 @@ "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0" -"@bbob/core@*": - version "4.0.1" - resolved "https://registry.npmjs.org/@bbob/core/-/core-4.0.1.tgz" - integrity sha512-FtpiEQB9CD08cReDE+rpLzb2Y/xy+W3QLQ2WkymlNR1R9NMotEM0AwI6xK5ab16w/WYEgPs3+NGOiH37nZT48g== - dependencies: - "@bbob/parser" "*" - "@bbob/plugin-helper" "*" - "@bbob/types" "*" - -"@bbob/core@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@bbob/core/-/core-4.0.3.tgz#8842f8068c88abc6648a2c714e3d09a0144e1b3e" - integrity sha512-vhrOAtqq4aEdcXohl8Lrk3NgcYAbaPsG9dNZfiIIqNLFyf8c95aBE3cE/UeX/jnzpynyg0jv2Wdv9L9Knxs9mA== +"@bbob/core@*", "@bbob/core@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@bbob/core/-/core-4.1.0.tgz#32e1aa02df6709ed5d22f352c9e933b9fc85b4d5" + integrity sha512-RUhUV1JXOac3ISRXAuNLnUAGDRlBFTZYgYik8slV063Nk87C1z6e19DlDC+6hgAocBT02DQiju0z9v6bAwWIiQ== dependencies: "@bbob/parser" "*" "@bbob/plugin-helper" "*" "@bbob/types" "*" -"@bbob/html@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@bbob/html/-/html-4.0.3.tgz#bd7300e15ed1e1c7ab9e4d812813836facde7c0a" - integrity sha512-znuI7OfGzZsmpjE82WjBi6RuPhXf9o1QQH1mZVLHOheXArtc+ePhVj+W29R36MCFIydwlwpBWz8hqf2adoPZQQ== +"@bbob/html@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@bbob/html/-/html-4.1.0.tgz#08d21ce96991dc8bf76e351a8038304fa268c581" + integrity sha512-hy/87vKsjTTnm6iDfVpAW959bfITUf9EfwL1k8JmDJ8Wt5acnqsUqJmhKiJh3fVOGUGpxx4o+T3ku6AFumHKmA== dependencies: "@bbob/core" "*" "@bbob/plugin-helper" "*" "@bbob/types" "*" "@bbob/parser@*": - version "4.0.1" - resolved "https://registry.npmjs.org/@bbob/parser/-/parser-4.0.1.tgz" - integrity sha512-pcaJ4rlJQGXTOR/z6b61XMW7kIz2InylysZCov7tshkPOsvXC2eifmwFTygQAT++kIXxq4hGYsF6N/2wnLAibA== + version "4.1.0" + resolved "https://registry.yarnpkg.com/@bbob/parser/-/parser-4.1.0.tgz#40b9494bb45ab2f3a28ae37d33600e5d4cd58966" + integrity sha512-TCIENUAOhg/bV35h4HWRL8To7hOSFaiQ1qylEBvAdaBZfmcLJBXi4yiEM3zR8zwIelo/CuosaEkFLDOD2+FiUQ== dependencies: "@bbob/plugin-helper" "*" "@bbob/types" "*" "@bbob/plugin-helper@*": - version "4.0.1" - resolved "https://registry.npmjs.org/@bbob/plugin-helper/-/plugin-helper-4.0.1.tgz" - integrity sha512-5usaU1QLrKeznonaZgy0C0DjrAQ8GEzjtXA18sHjNcIVG5vILc3x99TWzp29KnaDcav43Z69Mk/nmajIw2cj3A== + version "4.1.0" + resolved "https://registry.yarnpkg.com/@bbob/plugin-helper/-/plugin-helper-4.1.0.tgz#ca5dd2452a0c2203162ddb06ba85f9d495e400d6" + integrity sha512-NQOkxmZVNpe4CCo43mbF2byOegYw9qSsC0LHNesjw7pwJSa5VW65uUGE8raXB2Q0lOXUsTEdxYUCD6rntNscug== dependencies: "@bbob/types" "*" -"@bbob/preset-html5@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@bbob/preset-html5/-/preset-html5-4.0.3.tgz#a2a8454d14e2d3aaa5305fa730362a8c438f08d3" - integrity sha512-Hl+UFocu0NA4fi5PBgZL4tFL26zpjqW9fMRw05qbrJE+JSPwE5AEDr80iDb4gJz3/dxUhBf0WnI8l3UixXI3PQ== +"@bbob/preset-html5@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@bbob/preset-html5/-/preset-html5-4.1.0.tgz#ef435c09edb3a329ea61498b4a9037ad645daf01" + integrity sha512-ZOUblxMh2rG167o2djXQBikRioGNmGeY0MD8NgwyK1Sj2/8Q2/V7yn9aUSd31bo76uj1lBpFJ4vEC9xB6ETw/Q== dependencies: "@bbob/plugin-helper" "*" "@bbob/preset" "*" "@bbob/types" "*" -"@bbob/preset@*": - version "4.0.1" - resolved "https://registry.npmjs.org/@bbob/preset/-/preset-4.0.1.tgz" - integrity sha512-cvl5xcdvu53mh9GVxzDRBNuE06fJCa/wb8iQJXn224X7JgMhM0o1mgO+uogmqAC7j7cesZqUG6oEvelAFyv5Sw== - dependencies: - "@bbob/plugin-helper" "*" - "@bbob/types" "*" - -"@bbob/preset@^4.0.3": - version "4.0.3" - resolved "https://registry.yarnpkg.com/@bbob/preset/-/preset-4.0.3.tgz#0fe34523fb3d37971bc0aeb7448a4a03c75aa411" - integrity sha512-RC00TRBEGjrkfG8cWsP+aaAMZC2KPGDKly+gv7uF9UufqyOLgOzmq3zlmgKlbnqLGJ8R8XHFPUeswnKmDP513g== +"@bbob/preset@*", "@bbob/preset@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@bbob/preset/-/preset-4.1.0.tgz#209e8501897eb3d34bf011dfcabeb08ed95bb2c5" + integrity sha512-/PEVrDOuckx1EwbqziU+xbCu2rja70a0jx/p9/x2AJdLw5j0yw1DvV6r6BM4/AazNjfP++1np7rU8+IxyDdDWA== dependencies: "@bbob/plugin-helper" "*" "@bbob/types" "*" -"@bbob/types@*": - version "4.0.1" - resolved "https://registry.npmjs.org/@bbob/types/-/types-4.0.1.tgz" - integrity sha512-ypnkJXrxxdIyVupM75eF7bHCDA8PWgKu8XRm4Kqrk574Md//V8ZlYeKG8x9M+vZGGDxFD2cFb9Cr+7Aw0oSMfw== +"@bbob/types@*", "@bbob/types@^4.1.0": + version "4.1.0" + resolved "https://registry.yarnpkg.com/@bbob/types/-/types-4.1.0.tgz#2837249c0c0e3e7aea3030ea0038063916561eb8" + integrity sha512-awahXN6FPt50IvWSHDgNTdDJR7mwJaR2vajT09idaSdWzR2715SyqTIGXPqNQgoNaeIzxWGal55h3dH77+/Z+Q== "@discourse/lint-configs@^1.3.9": version "1.3.9"