From 5c59cfb02084e101f952537afc29e44801755239 Mon Sep 17 00:00:00 2001
From: Dan Brown
1?g-1:0),P=1;P 1?arguments[1]:void 0,1),x=this.length,k=c(y),S=l(k.length),O=0;if(S+b>x)throw RangeError("Wrong length");for(;O '," =4)&&(h=e.skipChars(h,s),!(h-u{"use strict";var Fl=_e().isSpace;Rl.exports=function(e,t,n,o){var s,i,a,l,u,c,f,d,h,p,g,y,b,x,k,S,O,C,P,A,D=e.lineMax,I=e.bMarks[t]+e.tShift[t],M=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(I++)!==62)return!1;if(o)return!0;for(l=h=e.sCount[t]+1,e.src.charCodeAt(I)===32?(I++,l++,h++,s=!1,S=!0):e.src.charCodeAt(I)===9?(S=!0,(e.bsCount[t]+h)%4===3?(I++,l++,h++,s=!1):s=!0):S=!1,p=[e.bMarks[t]],e.bMarks[t]=I;I 3)&&!(e.sCount[A]<0)){for(x=!1,c=0,f=k.length;c {"use strict";var zu=Cn(),ro=[["text",lu()],["linkify",cu()],["newline",fu()],["escape",pu()],["backticks",gu()],["strikethrough",Xi().tokenize],["emphasis",Qi().tokenize],["link",xu()],["image",Eu()],["autolink",Cu()],["html_inline",ku()],["entity",Lu()]],no=[["balance_pairs",Ou()],["strikethrough",Xi().postProcess],["emphasis",Qi().postProcess],["fragments_join",Mu()]];function zr(){var r;for(this.ruler=new zu,r=0;r '," S;)C[S]=x[S++];return C},p)},7462:function(o,s,i){"use strict";var a=i(260),l=i(2092).some,u=a.aTypedArray,c=a.exportTypedArrayMethod;c("some",function(d){return l(u(this),d,arguments.length>1?arguments[1]:void 0)})},3824:function(o,s,i){"use strict";var a=i(260),l=a.aTypedArray,u=a.exportTypedArrayMethod,c=[].sort;u("sort",function(d){return c.call(l(this),d)})},5021:function(o,s,i){"use strict";var a=i(260),l=i(7466),u=i(1400),c=i(6707),f=a.aTypedArray,d=a.exportTypedArrayMethod;d("subarray",function(p,g){var y=f(this),b=y.length,x=u(p,b);return new(c(y,y.constructor))(y.buffer,y.byteOffset+x*y.BYTES_PER_ELEMENT,l((g===void 0?b:u(g,b))-x))})},2974:function(o,s,i){"use strict";var a=i(7854),l=i(260),u=i(7293),c=a.Int8Array,f=l.aTypedArray,d=l.exportTypedArrayMethod,h=[].toLocaleString,p=[].slice,g=!!c&&u(function(){h.call(new c(1))}),y=u(function(){return[1,2].toLocaleString()!=new c([1,2]).toLocaleString()})||!u(function(){c.prototype.toLocaleString.call([1,2])});d("toLocaleString",function(){return h.apply(g?p.call(f(this)):f(this),arguments)},y)},5016:function(o,s,i){"use strict";var a=i(260).exportTypedArrayMethod,l=i(7293),u=i(7854),c=u.Uint8Array,f=c&&c.prototype||{},d=[].toString,h=[].join;l(function(){d.call({})})&&(d=function(){return h.call(this)});var p=f.toString!=d;a("toString",d,p)},2472:function(o,s,i){var a=i(9843);a("Uint8",function(l){return function(c,f,d){return l(this,c,f,d)}})},4747:function(o,s,i){var a=i(7854),l=i(8324),u=i(8533),c=i(8880);for(var f in l){var d=a[f],h=d&&d.prototype;if(h&&h.forEach!==u)try{c(h,"forEach",u)}catch{h.forEach=u}}},3948:function(o,s,i){var a=i(7854),l=i(8324),u=i(6992),c=i(8880),f=i(5112),d=f("iterator"),h=f("toStringTag"),p=u.values;for(var g in l){var y=a[g],b=y&&y.prototype;if(b){if(b[d]!==p)try{c(b,d,p)}catch{b[d]=p}if(b[h]||c(b,h,g),l[g]){for(var x in u)if(b[x]!==u[x])try{c(b,x,u[x])}catch{b[x]=u[x]}}}}},1637:function(o,s,i){"use strict";i(6992);var a=i(2109),l=i(5005),u=i(590),c=i(1320),f=i(2248),d=i(8003),h=i(4994),p=i(9909),g=i(5787),y=i(6656),b=i(9974),x=i(648),k=i(9670),S=i(111),O=i(30),C=i(9114),P=i(8554),A=i(1246),D=i(5112),I=l("fetch"),M=l("Headers"),N=D("iterator"),B="URLSearchParams",H=B+"Iterator",Z=p.set,W=p.getterFor(B),te=p.getterFor(H),ne=/\+/g,be=Array(4),Ae=function(me){return be[me-1]||(be[me-1]=RegExp("((?:%[\\da-f]{2}){"+me+"})","gi"))},xe=function(me){try{return decodeURIComponent(me)}catch{return me}},Fe=function(me){var oe=me.replace(ne," "),ue=4;try{return decodeURIComponent(oe)}catch{for(;ue;)oe=oe.replace(Ae(ue--),xe);return oe}},Re=/[!'()~]|%20/g,Ne={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},he=function(me){return Ne[me]},Se=function(me){return encodeURIComponent(me).replace(Re,he)},ke=function(me,oe){if(oe)for(var ue=oe.split("&"),fe=0,le,pe;fe1114111?f+="\uFFFD\uFFFD\uFFFD\uFFFD":(c-=65536,f+=String.fromCharCode(55296+(c>>10),56320+(c&1023))),o+=9;continue}f+="\uFFFD"}return f})}vn.defaultChars=";/?:@&=+$,#";vn.componentChars="";Os.exports=vn});var Ns=ie((yg,Ms)=>{"use strict";Ms.exports=function(e){var t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||"",t}});var Hs=ie((bg,js)=>{"use strict";function yn(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var ef=/^([a-z0-9.+-]+:)/i,tf=/:[0-9]*$/,rf=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,nf=["<",">",'"',"`"," ","\r",`
-`," "],of=["{","}","|","\\","^","`"].concat(nf),sf=["'"].concat(of),_s=["%","/","?",";","#"].concat(sf),Bs=["/","?","#"],af=255,$s=/^[+a-z0-9A-Z_-]{0,63}$/,lf=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Us={javascript:!0,"javascript:":!0},zs={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function uf(r,e){if(r&&r instanceof yn)return r;var t=new yn;return t.parse(r,e),t}yn.prototype.parse=function(r,e){var t,n,o,s,i,a=r;if(a=a.trim(),!e&&r.split("#").length===1){var l=rf.exec(a);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}var u=ef.exec(a);if(u&&(u=u[0],o=u.toLowerCase(),this.protocol=u,a=a.substr(u.length)),(e||u||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)==="//",i&&!(u&&Us[u])&&(a=a.substr(2),this.slashes=!0)),!Us[u]&&(i||u&&!zs[u])){var c=-1;for(t=0;t"+Jt(r[e].content)+""};Rt.code_block=function(r,e,t,n,o){var s=r[e];return"
-`};Rt.fence=function(r,e,t,n,o){var s=r[e],i=s.info?Nf(s.info).trim():"",a="",l="",u,c,f,d,h;return i&&(f=i.split(/(\s+)/g),a=f[0],l=f.slice(2).join("")),t.highlight?u=t.highlight(s.content,a,l)||Jt(s.content):u=Jt(s.content),u.indexOf(""+Jt(r[e].content)+`>4,v=(U&15)<<4|z>>2,T=(z&3)<<6|Y,G.push(m),z!==64&&G.push(v),Y!==64&&G.push(T),m=v=T="",_=U=z=Y="",Q
1114111?f+="\uFFFD\uFFFD\uFFFD\uFFFD":(c-=65536,f+=String.fromCharCode(55296+(c>>10),56320+(c&1023))),o+=9;continue}f+="\uFFFD"}return f})}wn.defaultChars=";/?:@&=+$,#";wn.componentChars="";ba.exports=wn});var Ea=re((vv,wa)=>{"use strict";wa.exports=function(e){var t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||"",t}});var Da=re((yv,Ia)=>{"use strict";function En(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var Sf=/^([a-z0-9.+-]+:)/i,Cf=/:[0-9]*$/,Af=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,kf=["<",">",'"',"`"," ","\r",`
+`," "],Tf=["{","}","|","\\","^","`"].concat(kf),If=["'"].concat(Tf),Sa=["%","/","?",";","#"].concat(If),Ca=["/","?","#"],Df=255,Aa=/^[+a-z0-9A-Z_-]{0,63}$/,Lf=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ka={javascript:!0,"javascript:":!0},Ta={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ff(r,e){if(r&&r instanceof En)return r;var t=new En;return t.parse(r,e),t}En.prototype.parse=function(r,e){var t,n,o,s,i,a=r;if(a=a.trim(),!e&&r.split("#").length===1){var l=Af.exec(a);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}var u=Sf.exec(a);if(u&&(u=u[0],o=u.toLowerCase(),this.protocol=u,a=a.substr(u.length)),(e||u||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)==="//",i&&!(u&&ka[u])&&(a=a.substr(2),this.slashes=!0)),!ka[u]&&(i||u&&!Ta[u])){var c=-1;for(t=0;t"+tr(r[e].content)+""};Ot.code_block=function(r,e,t,n,o){var s=r[e];return"
+`};Ot.fence=function(r,e,t,n,o){var s=r[e],i=s.info?ih(s.info).trim():"",a="",l="",u,c,f,d,h;return i&&(f=i.split(/(\s+)/g),a=f[0],l=f.slice(2).join("")),t.highlight?u=t.highlight(s.content,a,l)||tr(s.content):u=tr(s.content),u.indexOf(""+tr(r[e].content)+`
`):""+u+`
-`};Rt.image=function(r,e,t,n,o){var s=r[e];return s.attrs[s.attrIndex("alt")][1]=o.renderInlineAsText(s.children,t,n),o.renderToken(r,e,t)};Rt.hardbreak=function(r,e,t){return t.xhtmlOut?`"+u+`
+`};Ot.image=function(r,e,t,n,o){var s=r[e];return s.attrs[s.attrIndex("alt")][1]=o.renderInlineAsText(s.children,t,n),o.renderToken(r,e,t)};Ot.hardbreak=function(r,e,t){return t.xhtmlOut?`
`:`
-`};Rt.softbreak=function(r,e,t){return t.breaks?t.xhtmlOut?`
+`};Ot.softbreak=function(r,e,t){return t.breaks?t.xhtmlOut?`
`:`
`:`
-`};Rt.text=function(r,e){return Jt(r[e].content)};Rt.html_block=function(r,e){return r[e].content};Rt.html_inline=function(r,e){return r[e].content};function mr(){this.rules=Mf({},Rt)}mr.prototype.renderAttrs=function(e){var t,n,o;if(!e.attrs)return"";for(o="",t=0,n=e.attrs.length;t{"use strict";var $f=Ne().arrayReplaceAt;function Uf(r){return/^\s]/i.test(r)}function zf(r){return/^<\/a\s*>/i.test(r)}ya.exports=function(e){var t,n,o,s,i,a,l,u,c,f,d,h,m,v,y,w,x=e.tokens,D;if(!!e.md.options.linkify){for(n=0,o=x.length;n=4||e.listIndent>=0&&e.sCount[t]-e.listIndent>=4&&e.sCount[t]{"use strict";Al.exports=function(e,t){var n,o,s,i,a,l,u,c,f=e.pos,d=e.src.charCodeAt(f);if(d!==96)return!1;for(n=f,f++,o=e.posMax;f=s:i=o<=s,!i)return n;if(n===Lt())break;n=Wt(n,!1)}return!1}function cr(r,e,t,n){for(var o=0,s=0,i=r.children;sn.right+o||r.clientX<=n.right&&r.clientY>n.bottom&&r.clientX>=n.left:r.clientX>n.right&&r.clientY>n.top||r.clientX<=n.right&&r.clientY>n.bottom+o}function Gd(r,e,t,n,o,s,i,a){var l=n?r.clientY:r.clientX,u=n?t.height:t.width,c=n?t.top:t.left,f=n?t.bottom:t.right,d=!1;if(!i){if(a&&enc+u*s/2:l{"use strict";var ah=_e().arrayReplaceAt;function lh(r){return/^\s]/i.test(r)}function uh(r){return/^<\/a\s*>/i.test(r)}il.exports=function(e){var t,n,o,s,i,a,l,u,c,f,d,h,p,g,y,b,x=e.tokens,k;if(!!e.md.options.linkify){for(n=0,o=x.length;n=4||e.listIndent>=0&&e.sCount[t]-e.listIndent>=4&&e.sCount[t]=s:i=o<=s,!i)return n;if(n===Ft())break;n=Kt(n,!1)}return!1}function fr(r,e,t,n){for(var o=0,s=0,i=r.children;sn.right+o||r.clientX<=n.right&&r.clientY>n.bottom&&r.clientX>=n.left:r.clientX>n.right&&r.clientY>n.top||r.clientX<=n.right&&r.clientY>n.bottom+o}function mf(r,e,t,n,o,s,i,a){var l=n?r.clientY:r.clientX,u=n?t.height:t.width,c=n?t.top:t.left,f=n?t.bottom:t.right,d=!1;if(!i){if(a&&anc+u*s/2:l`,f=r.dom.create("a",{target:"_blank",href:l.url},c);r.dom.replace(f,i)}).catch(l=>{r.dom.remove(i),window.$events.emit("error",e.translations.imageUploadErrorText),console.log(l)})},10)}}async function Ip(r,e){if(r===null||r.type.indexOf("image")!==0)throw new Error("Not an image file");let t="png";if(r.name){let i=r.name.match(/\.(.+)$/);i.length>1&&(t=i[1])}let n="image-"+Date.now()+"."+t,o=new FormData;return o.append("file",r,n),o.append("uploaded_to",e),(await window.$http.post(window.baseUrl("/images/gallery"),o)).data}function Dp(r,e){let t=r.selection.getNode();t.nodeName==="IMG"&&(rr=r.dom.getParent(t,".mceTemp"),!rr&&t.parentNode.nodeName==="A"&&!Tp(t.parentNode)&&(rr=t.parentNode)),t.hasAttribute("contenteditable")&&t.getAttribute("contenteditable")==="false"&&(Ln=t)}function Lp(r,e,t){let n=r.dom,o=tinymce.dom.RangeUtils.getCaretRangeFromPoint(t.clientX,t.clientY,r.getDoc()),s=t.dataTransfer&&t.dataTransfer.getData("bookstack/template");s&&(t.preventDefault(),window.$http.get(`/templates/${s}`).then(i=>{r.selection.setRng(o),r.undoManager.transact(function(){r.execCommand("mceInsertContent",!1,i.data.html)})})),n.getParent(o.startContainer,".mceTemp")?t.preventDefault():rr&&(t.preventDefault(),r.undoManager.transact(function(){r.selection.setRng(o),r.selection.setNode(rr),n.remove(rr)})),!t.isDefaultPrevented()&&Ln&&(t.preventDefault(),r.undoManager.transact(function(){let i=r.selection.getNode(),a=r.selection.getRng(),l=i.closest("body > *");a.startOffset>a.startContainer.length/2?r.$(l).after(Ln):r.$(l).before(Ln)})),t.isDefaultPrevented()||_c(r,e,t),rr=null}function Bc(r,e){r.on("dragstart",()=>Dp(r,e)),r.on("drop",t=>Lp(r,e,t)),r.on("paste",t=>_c(r,e,t))}function $c(r){let e=r.textDirection==="rtl"?"ltr rtl":"";return["undo redo","styleselect","bold italic underline forecolor backcolor formatoverflow","alignleft aligncenter alignright alignjustify","bullist numlist listoverflow",e,"link table imagemanager-insert insertoverflow","code about fullscreen"].filter(n=>Boolean(n)).join(" | ")}function Fp(r){r.ui.registry.addGroupToolbarButton("formatoverflow",{icon:"more-drawer",tooltip:"More",items:"strikethrough superscript subscript inlinecode removeformat"}),r.ui.registry.addGroupToolbarButton("listoverflow",{icon:"more-drawer",tooltip:"More",items:"tasklist outdent indent"}),r.ui.registry.addGroupToolbarButton("insertoverflow",{icon:"more-drawer",tooltip:"More",items:"hr codeeditor drawio media details"})}function Rp(r){r.ui.registry.addContextToolbar("linkcontexttoolbar",{predicate(e){return e.closest("a")!==null},position:"node",scope:"node",items:"link unlink openlink"})}function Uc(r,e){Fp(r),Rp(r)}function zc(r){return r.tagName.toLowerCase()==="code-block"}function Hc(r,e,t,n){window.components.first("code-editor").open(e,t,(o,s)=>{n(o,s),r.focus()})}function jc(r,e){Hc(r,e.getContent(),e.getLanguage(),(t,n)=>{e.setContent(t,n)})}function Op(r){let e=r.getDoc(),t=e.defaultView;class n extends t.HTMLElement{constructor(){super();this.attachShadow({mode:"open"});let s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("href",window.baseUrl("/dist/styles.css"));let i=document.createElement("div");i.style.pointerEvents="none",i.contentEditable="false",i.classList.add("CodeMirrorContainer"),this.shadowRoot.append(s,i)}getLanguage(){let s=l=>(l.split(" ").filter(c=>c.startsWith("language-"))[0]||"").replace("language-",""),i=this.querySelector("code"),a=this.querySelector("pre");return s(a.className)||i&&s(i.className)||""}setContent(s,i){this.cm&&importVersioned("code").then(u=>{u.setContent(this.cm,s),u.setMode(this.cm,i,s)});let a=this.querySelector("pre");a||(a=e.createElement("pre"),this.append(a)),a.innerHTML="";let l=e.createElement("code");a.append(l),l.innerText=s,l.className=`language-${i}`}getContent(){let s=this.querySelector("code")||this.querySelector("pre"),i=document.createElement("pre");return i.innerHTML=s.innerHTML.replace().replace(/
/gi,`
-`).replace(/\ufeff/g,""),i.textContent}connectedCallback(){let s=Date.now();if(this.cm)return;this.cleanChildContent();let i=this.getContent(),l=i.split(`
-`).length*19.2+18+24;this.style.height=`${l}px`;let u=this.shadowRoot.querySelector(".CodeMirrorContainer"),c=f=>{this.cm=f.wysiwygView(u,i,this.getLanguage()),f.updateLayout(this.cm),setTimeout(()=>{this.style.height=null},1)};window.importVersioned("code").then(f=>{let d=Date.now()-s<20?20:0;setTimeout(()=>c(f),d)})}cleanChildContent(){let s=this.querySelector("pre");if(!!s)for(let i of s.childNodes)i.nodeName==="#text"&&i.textContent==="\uFEFF"&&i.remove()}}t.customElements.define("code-block",n)}function Pp(r,e){r.ui.registry.addIcon("codeblock",''),r.ui.registry.addButton("codeeditor",{tooltip:"Insert code block",icon:"codeblock",onAction(){r.execCommand("codeeditor")}}),r.addCommand("codeeditor",()=>{let t=r.selection.getNode(),n=t.ownerDocument;if(zc(t))jc(r,t);else{let o=r.selection.getContent({format:"text"});Hc(r,o,"",(s,i)=>{let a=n.createElement("pre"),l=n.createElement("code");l.classList.add(`language-${i}`),l.innerText=s,a.append(l),r.insertContent(a.outerHTML)})}}),r.on("dblclick",t=>{let n=r.selection.getNode();zc(n)&&jc(r,n)}),r.on("PreInit",()=>{r.parser.addNodeFilter("pre",function(t){for(let n of t){let o=new tinymce.html.Node.create("code-block",{contenteditable:"false"}),s=n.getAll("span");for(let i of s)i.unwrap();n.attr("style",null),n.wrap(o)}}),r.parser.addNodeFilter("code-block",function(t){for(let n of t)n.attr("contenteditable","false")}),r.serializer.addNodeFilter("code-block",function(t){for(let n of t)n.unwrap()})}),r.on("PreInit",()=>{Op(r)})}function qc(r){return Pp}var kt=null,ir=null,nr={};function Ri(r){return r.hasAttribute("drawio-diagram")}function Mp(r,e=null){kt=r,ir=e,window.ImageManager.show(function(t){if(e){let n=e.querySelector("img");kt.dom.setAttrib(n,"src",t.url),kt.dom.setAttrib(e,"drawio-diagram",t.id)}else{let n=``,o+="",r.execCommand("mceInsertContent",!1,o)},"gallery")}})}function Yc(r){return $p}function Up(r,e){let t={title:"About the WYSIWYG Editor",url:window.baseUrl("/help/wysiwyg")};r.ui.registry.addButton("about",{icon:"help",tooltip:"About the editor",onAction(){tinymce.activeEditor.windowManager.openUrl(t)}})}function Kc(r){return Up}function zp(r,e){r.ui.registry.addIcon("details",''),r.ui.registry.addIcon("togglefold",''),r.ui.registry.addIcon("togglelabel",''),r.ui.registry.addButton("details",{icon:"details",tooltip:"Insert collapsible block",onAction(){r.execCommand("InsertDetailsBlock")}}),r.ui.registry.addButton("removedetails",{icon:"table-delete-table",tooltip:"Unwrap",onAction(){Vp(r)}}),r.ui.registry.addButton("editdetials",{icon:"togglelabel",tooltip:"Edit label",onAction(){Xc(r)}}),r.on("dblclick",t=>{!Fn(r)||t.target.closest("doc-root")||Xc(r)}),r.ui.registry.addButton("toggledetails",{icon:"togglefold",tooltip:"Toggle open/closed",onAction(){Fn(r).toggleAttribute("open"),r.focus()}}),r.addCommand("InsertDetailsBlock",function(){let t=r.selection.getContent({format:"html"}),n=document.createElement("details"),o=document.createElement("summary"),s="details-"+Date.now();n.setAttribute("data-id",s),n.appendChild(o),t||(t="
`,f=r.dom.create("a",{target:"_blank",href:l.url},c);r.dom.replace(f,i)}).catch(l=>{r.dom.remove(i),window.$events.emit("error",e.translations.imageUploadErrorText),console.log(l)})},10)}}async function Am(r,e){if(r===null||r.type.indexOf("image")!==0)throw new Error("Not an image file");let t=r.name||`image-${Date.now()}.png`,n=new FormData;return n.append("file",r,t),n.append("uploaded_to",e),(await window.$http.post(window.baseUrl("/images/gallery"),n)).data}function km(r,e){let t=r.selection.getNode();t.nodeName==="IMG"&&(ir=r.dom.getParent(t,".mceTemp"),!ir&&t.parentNode.nodeName==="A"&&!Cm(t.parentNode)&&(ir=t.parentNode)),t.hasAttribute("contenteditable")&&t.getAttribute("contenteditable")==="false"&&(_n=t)}function Tm(r,e,t){let n=r.dom,o=tinymce.dom.RangeUtils.getCaretRangeFromPoint(t.clientX,t.clientY,r.getDoc()),s=t.dataTransfer&&t.dataTransfer.getData("bookstack/template");s&&(t.preventDefault(),window.$http.get(`/templates/${s}`).then(i=>{r.selection.setRng(o),r.undoManager.transact(function(){r.execCommand("mceInsertContent",!1,i.data.html)})})),n.getParent(o.startContainer,".mceTemp")?t.preventDefault():ir&&(t.preventDefault(),r.undoManager.transact(function(){r.selection.setRng(o),r.selection.setNode(ir),n.remove(ir)})),!t.isDefaultPrevented()&&_n&&(t.preventDefault(),r.undoManager.transact(function(){let i=r.selection.getNode(),a=r.selection.getRng(),l=i.closest("body > *");a.startOffset>a.startContainer.length/2?r.$(l).after(_n):r.$(l).before(_n)})),t.isDefaultPrevented()||sd(r,e,t),ir=null}function ad(r,e){r.on("dragstart",()=>km(r,e)),r.on("drop",t=>Tm(r,e,t)),r.on("paste",t=>sd(r,e,t))}function ld(r){let e=r.textDirection==="rtl"?"ltr rtl":"";return["undo redo","styleselect","bold italic underline forecolor backcolor formatoverflow","alignleft aligncenter alignright alignjustify","bullist numlist listoverflow",e,"link table imagemanager-insert insertoverflow","code about fullscreen"].filter(n=>Boolean(n)).join(" | ")}function Im(r){r.ui.registry.addGroupToolbarButton("formatoverflow",{icon:"more-drawer",tooltip:"More",items:"strikethrough superscript subscript inlinecode removeformat"}),r.ui.registry.addGroupToolbarButton("listoverflow",{icon:"more-drawer",tooltip:"More",items:"tasklist outdent indent"}),r.ui.registry.addGroupToolbarButton("insertoverflow",{icon:"more-drawer",tooltip:"More",items:"hr codeeditor drawio media details"})}function Dm(r){r.ui.registry.addContextToolbar("linkcontexttoolbar",{predicate(e){return e.closest("a")!==null},position:"node",scope:"node",items:"link unlink openlink"})}function ud(r,e){Im(r),Dm(r)}function cd(r){return r.tagName.toLowerCase()==="code-block"}function fd(r,e,t,n){window.components.first("code-editor").open(e,t,(o,s)=>{n(o,s),r.focus()})}function dd(r,e){fd(r,e.getContent(),e.getLanguage(),(t,n)=>{e.setContent(t,n)})}function Lm(r){let e=r.getDoc(),t=e.defaultView;class n extends t.HTMLElement{constructor(){super(),this.attachShadow({mode:"open"});let s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("href",window.baseUrl("/dist/styles.css"));let i=document.createElement("div");i.style.pointerEvents="none",i.contentEditable="false",i.classList.add("CodeMirrorContainer"),this.shadowRoot.append(s,i)}getLanguage(){let s=l=>(l.split(" ").filter(c=>c.startsWith("language-"))[0]||"").replace("language-",""),i=this.querySelector("code"),a=this.querySelector("pre");return s(a.className)||i&&s(i.className)||""}setContent(s,i){this.cm&&importVersioned("code").then(u=>{u.setContent(this.cm,s),u.setMode(this.cm,i,s)});let a=this.querySelector("pre");a||(a=e.createElement("pre"),this.append(a)),a.innerHTML="";let l=e.createElement("code");a.append(l),l.innerText=s,l.className=`language-${i}`}getContent(){let s=this.querySelector("code")||this.querySelector("pre"),i=document.createElement("pre");i.innerHTML=s.innerHTML.replace(/\ufeff/g,"");let a=i.querySelectorAll("br");for(let l of a)l.replaceWith(`
+`);return i.textContent}connectedCallback(){let s=Date.now();if(this.cm)return;this.cleanChildContent();let i=this.getContent(),l=i.split(`
+`).length*19.2+18+24;this.style.height=`${l}px`;let u=this.shadowRoot.querySelector(".CodeMirrorContainer"),c=f=>{console.log({content:i}),this.cm=f.wysiwygView(u,i,this.getLanguage()),f.updateLayout(this.cm),setTimeout(()=>{this.style.height=null},1)};window.importVersioned("code").then(f=>{let d=Date.now()-s<20?20:0;setTimeout(()=>c(f),d)})}cleanChildContent(){let s=this.querySelector("pre");if(!!s)for(let i of s.childNodes)i.nodeName==="#text"&&i.textContent==="\uFEFF"&&i.remove()}}t.customElements.define("code-block",n)}function Fm(r,e){r.ui.registry.addIcon("codeblock",''),r.ui.registry.addButton("codeeditor",{tooltip:"Insert code block",icon:"codeblock",onAction(){r.execCommand("codeeditor")}}),r.addCommand("codeeditor",()=>{let t=r.selection.getNode(),n=t.ownerDocument;if(cd(t))dd(r,t);else{let o=r.selection.getContent({format:"text"});fd(r,o,"",(s,i)=>{let a=n.createElement("pre"),l=n.createElement("code");console.log(s),l.classList.add(`language-${i}`),l.innerText=s,a.append(l),r.insertContent(a.outerHTML)})}}),r.on("dblclick",t=>{let n=r.selection.getNode();cd(n)&&dd(r,n)}),r.on("PreInit",()=>{r.parser.addNodeFilter("pre",function(t){for(let n of t){let o=new tinymce.html.Node.create("code-block",{contenteditable:"false"}),s=n.getAll("span");for(let i of s)i.unwrap();n.attr("style",null),n.wrap(o)}}),r.parser.addNodeFilter("code-block",function(t){for(let n of t)n.attr("contenteditable","false")}),r.serializer.addNodeFilter("code-block",function(t){for(let n of t)n.unwrap()})}),r.on("PreInit",()=>{Lm(r)})}function hd(r){return Fm}var Tt=null,sr=null,or={};function Wo(r){return r.hasAttribute("drawio-diagram")}function Rm(r,e=null){Tt=r,sr=e,window.ImageManager.show(function(t){if(e){let n=e.querySelector("img");Tt.dom.setAttrib(n,"src",t.url),Tt.dom.setAttrib(e,"drawio-diagram",t.id)}else{let n=`
`,o+="",r.execCommand("mceInsertContent",!1,o)},"gallery")}})}function vd(r){return _m}function Nm(r,e){let t={title:"About the WYSIWYG Editor",url:window.baseUrl("/help/wysiwyg")};r.ui.registry.addButton("about",{icon:"help",tooltip:"About the editor",onAction(){tinymce.activeEditor.windowManager.openUrl(t)}})}function yd(r){return Nm}function Bm(r,e){r.ui.registry.addIcon("details",''),r.ui.registry.addIcon("togglefold",''),r.ui.registry.addIcon("togglelabel",''),r.ui.registry.addButton("details",{icon:"details",tooltip:"Insert collapsible block",onAction(){r.execCommand("InsertDetailsBlock")}}),r.ui.registry.addButton("removedetails",{icon:"table-delete-table",tooltip:"Unwrap",onAction(){jm(r)}}),r.ui.registry.addButton("editdetials",{icon:"togglelabel",tooltip:"Edit label",onAction(){bd(r)}}),r.on("dblclick",t=>{!Nn(r)||t.target.closest("doc-root")||bd(r)}),r.ui.registry.addButton("toggledetails",{icon:"togglefold",tooltip:"Toggle open/closed",onAction(){Nn(r).toggleAttribute("open"),r.focus()}}),r.addCommand("InsertDetailsBlock",function(){let t=r.selection.getContent({format:"html"}),n=document.createElement("details"),o=document.createElement("summary"),s="details-"+Date.now();n.setAttribute("data-id",s),n.appendChild(o),t||(t="
{i.from=n;let a=new CustomEvent(`${r}-${s}`,{bubbles:!0,detail:i});n.$el.dispatchEvent(a)},typeof n.setup=="function"&&n.setup()}catch(o){console.error("Failed to create component",o,r,e)}typeof window.components[r]>"u"&&(window.components[r]=[]),window.components[r].push(n),typeof e.components>"u"&&(e.components={}),e.components[r]=n}function lm(r,e){let t={},n={},o=`${r}@`,s=`[refs*="${o}"]`,i=[...e.querySelectorAll(s)];e.matches(s)&&i.push(e);for(let a of i){let l=a.getAttribute("refs").split(" ").filter(u=>u.startsWith(o)).map(u=>u.replace(o,"")).map(id);for(let u of l)t[u]=a,typeof n[u]>"u"&&(n[u]=[]),n[u].push(a)}return{refs:t,manyRefs:n}}function um(r,e){let t={},n=`option:${r}:`;for(let{name:o,value:s}of e.attributes)if(o.startsWith(n)){let i=o.replace(n,"");t[id(i)]=s||""}return t}function id(r){let e=n=>n.slice(0,1).toUpperCase()+n.slice(1),t=r.split("-");return t[0]+t.slice(1).map(e).join("")}function od(r){typeof r>"u"&&(r=document);for(let t of Object.keys(rd))am(t,r);let e=r.querySelectorAll("[component],[components]");for(let t of e){let n=`${t.getAttribute("component")||""} ${t.getAttribute("components")}`.toLowerCase().split(" ").filter(Boolean);for(let o of n)nd(o,t)}}window.components.init=od;window.components.first=r=>(window.components[r]||[null])[0];var sd=od;window.baseUrl=function(r){let e=document.querySelector('meta[name="base-url"]').getAttribute("content");return e[e.length-1]==="/"&&(e=e.slice(0,e.length-1)),r[0]==="/"&&(r=r.slice(1)),e+"/"+r};window.importVersioned=function(r){let e=document.querySelector('link[href*="/dist/styles.css?version="]').href.split("?version=").pop();return import(window.baseUrl(`dist/${r}.js?version=${e}`))};window.$http=$i;window.$events=_i;var yr=new zi;window.trans=yr.get.bind(yr);window.trans_choice=yr.getPlural.bind(yr);window.trans_plural=yr.parsePlural.bind(yr);sd();
+`,"")}function Ed(r){window.tinymce.addI18n(r.language,r.translationMap);let e=document.querySelector('script[src*="/dist/app.js"]').getAttribute("src").split("?version=")[1];return{width:"100%",height:"100%",selector:"#html-editor",cache_suffix:"?version="+e,content_css:[window.baseUrl("/dist/styles.css")],branding:!1,skin:r.darkMode?"oxide-dark":"oxide",body_class:"page-content",browser_spellcheck:!0,relative_urls:!1,language:r.language,directionality:r.textDirection,remove_script_host:!1,document_base_url:window.baseUrl("/"),end_container_on_empty_block:!0,remove_trailing_brs:!1,statusbar:!1,menubar:!1,paste_data_images:!1,extended_valid_elements:"pre[*],svg[*],div[drawio-diagram],details[*],summary[*],div[*],li[class|checked]",automatic_uploads:!1,custom_elements:"doc-root,code-block",valid_children:["-div[p|h1|h2|h3|h4|h5|h6|blockquote|code-block]","+div[pre|img]","-doc-root[doc-root|#text]","-li[details]","+code-block[pre]","+doc-root[code-block]"].join(","),plugins:Jm(r),imagetools_toolbar:"imageoptions",contextmenu:!1,toolbar:ld(r),content_style:ng(r),style_formats:Xm,style_formats_merge:!1,media_alt_source:!1,media_poster:!1,formats:Zm,file_picker_types:"file image",file_picker_callback:Qm,paste_preprocess(t,n){n.content.indexOf('
{i.from=n;let a=new CustomEvent(`${r}-${s}`,{bubbles:!0,detail:i});n.$el.dispatchEvent(a)},typeof n.setup=="function"&&n.setup()}catch(o){console.error("Failed to create component",o,r,e)}typeof window.components[r]>"u"&&(window.components[r]=[]),window.components[r].push(n),typeof e.components>"u"&&(e.components={}),e.components[r]=n}function og(r,e){let t={},n={},o=`${r}@`,s=`[refs*="${o}"]`,i=[...e.querySelectorAll(s)];e.matches(s)&&i.push(e);for(let a of i){let l=a.getAttribute("refs").split(" ").filter(u=>u.startsWith(o)).map(u=>u.replace(o,"")).map(kd);for(let u of l)t[u]=a,typeof n[u]>"u"&&(n[u]=[]),n[u].push(a)}return{refs:t,manyRefs:n}}function sg(r,e){let t={},n=`option:${r}:`;for(let{name:o,value:s}of e.attributes)if(o.startsWith(n)){let i=o.replace(n,"");t[kd(i)]=s||""}return t}function kd(r){let e=n=>n.slice(0,1).toUpperCase()+n.slice(1),t=r.split("-");return t[0]+t.slice(1).map(e).join("")}function Td(r){typeof r>"u"&&(r=document);for(let t of Object.keys(Cd))ig(t,r);let e=r.querySelectorAll("[component],[components]");for(let t of e){let n=`${t.getAttribute("component")||""} ${t.getAttribute("components")}`.toLowerCase().split(" ").filter(Boolean);for(let o of n)Ad(o,t)}}window.components.init=Td;window.components.first=r=>(window.components[r]||[null])[0];var Id=Td;window.baseUrl=function(r){let e=document.querySelector('meta[name="base-url"]').getAttribute("content");return e[e.length-1]==="/"&&(e=e.slice(0,e.length-1)),r[0]==="/"&&(r=r.slice(1)),e+"/"+r};window.importVersioned=function(r){let e=document.querySelector('link[href*="/dist/styles.css?version="]').href.split("?version=").pop();return import(window.baseUrl(`dist/${r}.js?version=${e}`))};window.$http=ts;window.$events=Jo;var xr=new rs;window.trans=xr.get.bind(xr);window.trans_choice=xr.getPlural.bind(xr);window.trans_plural=xr.parsePlural.bind(xr);Id();
/*!
- * clipboard.js v2.0.10
+ * clipboard.js v2.0.11
* https://clipboardjs.com/
*
* Licensed MIT © Zeno Rocha
diff --git a/public/dist/code.js b/public/dist/code.js
index 9c022d642..25358a495 100644
--- a/public/dist/code.js
+++ b/public/dist/code.js
@@ -1,31 +1,30 @@
-var nf=Object.create;var _a=Object.defineProperty;var of=Object.getOwnPropertyDescriptor;var lf=Object.getOwnPropertyNames;var af=Object.getPrototypeOf,sf=Object.prototype.hasOwnProperty;var Be=(f,q)=>()=>(q||f((q={exports:{}}).exports,q),q.exports);var uf=(f,q,A,O)=>{if(q&&typeof q=="object"||typeof q=="function")for(let P of lf(q))!sf.call(f,P)&&P!==A&&_a(f,P,{get:()=>q[P],enumerable:!(O=of(q,P))||O.enumerable});return f};var Ke=(f,q,A)=>(A=f!=null?nf(af(f)):{},uf(q||!f||!f.__esModule?_a(A,"default",{value:f,enumerable:!0}):A,f));var je=Be((go,mo)=>{(function(f,q){typeof go=="object"&&typeof mo<"u"?mo.exports=q():typeof define=="function"&&define.amd?define(q):(f=f||self,f.CodeMirror=q())})(go,function(){"use strict";var f=navigator.userAgent,q=navigator.platform,A=/gecko\/\d/i.test(f),O=/MSIE \d/.test(f),P=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(f),N=/Edge\/(\d+)/.exec(f),g=O||P||N,j=g&&(O?document.documentMode||6:+(N||P)[1]),T=!N&&/WebKit\//.test(f),D=T&&/Qt\/\d+\.\d+/.test(f),E=!N&&/Chrome\//.test(f),h=/Opera\//.test(f),v=/Apple Computer/.test(navigator.vendor),b=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(f),M=/PhantomJS/.test(f),C=v&&(/Mobile\/\w+/.test(f)||navigator.maxTouchPoints>2),y=/Android/.test(f),G=C||y||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(f),_=C||/Mac/.test(q),H=/\bCrOS\b/.test(f),K=/win/i.test(q),ee=h&&f.match(/Version\/(\d*\.\d*)/);ee&&(ee=Number(ee[1])),ee&&ee>=15&&(h=!1,T=!0);var J=_&&(D||h&&(ee==null||ee<12.11)),ne=A||g&&j>=9;function V(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var X=function(e,t){var n=e.className,r=V(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function re(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function F(e,t){return re(e).appendChild(t)}function S(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o
u&&(x={from:x.from,to:u,level:x.level}),x}var _r;function Wr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(_r==null){_r=S("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)_r.appendChild(document.createTextNode("x")),_r.appendChild(S("br"));_r.appendChild(document.createTextNode("x"))}F(e.measure,_r);var n=_r.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),re(e.measure),n||1}function Br(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=S("span","xxxxxxxxxx"),n=S("pre",[t],"CodeMirror-line-like");F(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ni(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var a=e.display.gutterSpecs[l].className;n[a]=o.offsetLeft+o.clientLeft+i,r[a]=o.clientWidth}return{fixedPos:qi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function qi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ll(e){var t=Wr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Br(e.display)-3);return function(i){if(ur(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;lf&&(w={from:w.from,to:f,level:w.level}),w}var Tr;function jr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Tr==null){Tr=c("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Tr.appendChild(document.createTextNode("x")),Tr.appendChild(c("br"));Tr.appendChild(document.createTextNode("x"))}D(e.measure,Tr);var n=Tr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),N(e.measure),n||1}function Hr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=c("span","xxxxxxxxxx"),n=c("pre",[t],"CodeMirror-line-like");D(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function qi(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l){var a=e.display.gutterSpecs[l].className;n[a]=o.offsetLeft+o.clientLeft+i,r[a]=o.clientWidth}return{fixedPos:Ri(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ri(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function al(e){var t=jr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Hr(e.display)-3);return function(i){if(cr(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l