From f1a8ef67bc0c8d6100901050190288d11d8fb192 Mon Sep 17 00:00:00 2001 From: Ro Date: Thu, 13 Jan 2022 15:43:38 -0800 Subject: [PATCH] another patch for textarea misalignment bug --- brain/views/dash/page-edit.twig | 2 +- public/assets/css/dash.css | 4 - public/assets/scripts/Start.js | 8355 ++++++++++++++++++++++++++++++- src/com/ui/TextEditor.js | 5 +- src/styles/main/_posts.sass | 4 +- 5 files changed, 8359 insertions(+), 11 deletions(-) diff --git a/brain/views/dash/page-edit.twig b/brain/views/dash/page-edit.twig index 594df25..c219148 100644 --- a/brain/views/dash/page-edit.twig +++ b/brain/views/dash/page-edit.twig @@ -32,7 +32,7 @@ {% endblock %} {% block stylesheets %} - + {% endblock %} {% block mainContent %} diff --git a/public/assets/css/dash.css b/public/assets/css/dash.css index 91e7543..732ea79 100644 --- a/public/assets/css/dash.css +++ b/public/assets/css/dash.css @@ -3194,16 +3194,12 @@ select { width: 100%; max-width: 900px; border-radius: 5px; - margin: 10px 0 50px 0; position: relative; } #post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper textarea:focus { outline: none; border-color: #fc6399; } -#post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #edit { - overflow: hidden !important; -} #post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #edit, #post-edit-index #post-edit-index-wrapper #edit-post #edit-post-wrapper #highlight { /* Both elements need the same text and space styling so they are directly on top of each other */ border: 0; diff --git a/public/assets/scripts/Start.js b/public/assets/scripts/Start.js index 17847c2..593c3fd 100644 --- a/public/assets/scripts/Start.js +++ b/public/assets/scripts/Start.js @@ -1,8 +1,8359 @@ -(()=>{function e(e){return e&&e.__esModule?e.default:e}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};const n="POST",r="json",a="x-www-form-urlencoded",i="/api/v1/status",o="/api/v1/settings/publish",s="/api/v1/mailer",l="/api/v1/login",u="writeSettings",d="publishSite",c="createNewPage",g="editPage",p="deletePage",h="getSiteSettings",m="getMemberInfo";class f{constructor(e=null){this.percentComplete=0,this.baseURL=null,this.status=!1,e&&(this.baseURL=e),this._request(this.baseURL?this.baseURL+i:i).then((e=>{"apiUseAuthorized"===e.type&&(this.token=e.token)}))}login(e){return new Promise(((t,a)=>{this.baseURL?e.remote=!0:e.remote=!1,this.key?e.key=this.key:e.key=null,this._request(this.baseURL?this.baseURL+l:l,"getAuthStatus",n,r,e).then((e=>{t(e)})).catch((e=>{a(e)}))}))}sync(e,t){return new Promise(((a,i)=>{let o="";switch(e){case"syncSite":o="/api/v1/settings/sync";break;case"syncNav":o="/api/v1/settings/nav-sync"}this._request(this.baseURL?this.baseURL+o:o,u,n,r,t).then((e=>{a(e)})).catch((e=>{i(e)}))}))}publish(e){return new Promise(((t,a)=>{this._request(this.baseURL?this.baseURL+o:o,d,n,r,e).then((e=>{t(e)})).catch((e=>{a(e)}))}))}pageActions(e,t){let i,o,s;switch(e){case c:i="/api/v1/page/create",o=c,s=a;break;case g:i="/api/v1/page/write",o=g,s=a;break;case p:i="/api/v1/page/delete",o=p,s=r}return this.baseURL?t.remote=!0:t.remote=!1,new Promise(((e,r)=>{this._request(this.baseURL?this.baseURL+i:i,o,n,s,t).then((t=>{e(t)})).catch((e=>{r(e)}))}))}sendMail(e){return new Promise(((t,a)=>{this._request(this.baseURL?this.baseURL+s:s,"sendMail",n,r,e).then((e=>{t(e)})).catch((e=>{a(e)}))}))}getInfo(e){let t,n;return"site"==e?(t="/api/v1/settings/site",n=h):(t="/api/v1/settings/member",n=m),new Promise(((e,r)=>{this._request(this.baseURL?this.baseURL+t:t,n).then((t=>{e(t)})).catch((e=>{r(e)}))}))}_request(e,t,i="GET",o="json",s=null){var l=this;return new Promise((function(f,v){var b=new XMLHttpRequest;if(b.upload.onprogress=l.handleLoadProgress,b.open(i,e,!0),b.onload=()=>{if(200==b.status){let e=JSON.parse(b.response);f(e)}else{let e=JSON.parse(b.response);v(e)}},"PUT"==i||i==n)switch(t!==u&&t!==g&&t!==c&&t!==p&&t!==d&&"reIndexPages"!==t||b.setRequestHeader("fipamo-access-token",l.token),o){case r:b.setRequestHeader("Content-type","application/"+o),b.send(JSON.stringify(s));break;case a:b.send(s)}else t!==h&&t!==m||b.setRequestHeader("fipamo-access-token",l.token),b.send()}))}handleLoadProgress(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}const v="POST",b="json",y="x-www-form-urlencoded",E="/api/v1/status",w="uploadFiles";class k{constructor(e=null,t=null){this.percentComplete=0,this.token=null,this.baseURL=null,this.key=null,t&&(this.key=t),e&&(this.baseURL=e),this._request(this.baseURL?this.baseURL+E+"?key="+this.key:"/api/v1/status?key="+this.key).then((e=>{"apiUseAuthorized"===e.type&&(this.token=e.token)}))}create(e){return new Promise(((t,n)=>{this._request("/api/v1/init","blogInit",v,b,e).then((e=>{t(e)})).catch((e=>{n(e)}))}))}restore(e){return new Promise(((t,n)=>{var r;r=new FormData(e),this._request("/api/v1/restore","restoreBackup","POST","x-www-form-urlencoded",r).then((e=>{t(e)})).catch((e=>{n(e)}))}))}backup(){return new Promise(((e,t)=>{var n;n={task:"create_backup"},this._request("/api/v1/backup","createBackup","POST","json",n).then((t=>{e(t)})).catch((e=>{t(e)}))}))}secret(e){return new Promise(((t,n)=>{this._request("/api/v1/get-secret","retrieveSecret",v,b,e).then((e=>{t(e)})).catch((e=>{n(e)}))}))}newPass(e){return new Promise(((t,n)=>{this._request("/api/v1/reset-password","resetPassword",v,b,e).then((e=>{t(e)})).catch((e=>{n(e)}))}))}imageUpload(e,t){return new Promise(((n,r)=>{let a="";switch(e){case"avatar-upload":a="/api/v1/settings/add-avatar";break;case"background-upload":a="/api/v1/settings/add-feature-background";break;default:a="/api/v1/page/add-entry-image"}var i=new FormData;this.baseURL?(i.append("key",this.key),i.append("remote",!0)):i.append("remote",!1);for(var o=0;o{n(e)})).catch((e=>{r(e)}))}))}_request(e,t,n="GET",r="json",a=null){var i=this;return new Promise((function(o,s){var l=new XMLHttpRequest;if(l.upload.onprogress=i.handleLoadProgress,l.open(n,e,!0),l.onload=()=>{if(200==l.status){let e=JSON.parse(l.response);o(e)}else{let e=JSON.parse(l.response);s(e)}},"PUT"==n||n==v)switch(t===w&&l.setRequestHeader("fipamo-access-token",i.token),r){case b:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(a));break;case y:l.send(a)}else l.send()}))}handleLoadProgress(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}const I="requestLame",S="postUpdated";new class{};var x=class{constructor(){}cleanString(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}decodeHTML(e,t){var n=0,r=0,a=!1;void 0===t&&(t=2),e=e.toString().replace(/</g,"<").replace(/>/g,">");var i={ENT_NOQUOTES:0,ENT_HTML_QUOTE_SINGLE:1,ENT_HTML_QUOTE_DOUBLE:2,ENT_COMPAT:2,ENT_QUOTES:3,ENT_IGNORE:4};if(0===t&&(a=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r{let r=new FormData,a=document.createElement("textarea");a.innerHTML=document.getElementById("highlight-content").innerHTML;let i=a.value;if(i=i.replace(/<\/?span[^>]*>/g,""),i=i.replace(/<\/?br[^>]*>/g,"\n"),r.append("id",document.getElementById("post-edit-index").getAttribute("data-index")),r.append("uuid",document.getElementById("post-edit-index").getAttribute("data-uuid")),r.append("layout",document.getElementById("post-edit-index").getAttribute("data-layout")),r.append("current_title",document.getElementById("post-edit-index").getAttribute("data-slug")),r.append("content",i),r.append("title",document.getElementById("post_title").value),r.append("created",document.getElementById("post-date").getAttribute("data-raw")),r.append("slug",(new x).cleanString(document.getElementById("post_title").value)),r.append("tags",document.getElementById("post_tags").value),r.append("menu",document.getElementById("option-menu-pin").getAttribute("data-active")),r.append("featured",document.getElementById("option-feature").getAttribute("data-active")),r.append("published",document.getElementById("option-published").getAttribute("data-active")),r.append("layout",document.getElementById("page-templates").value),r.append("form_token",document.getElementById("form_token").value),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else if(document.getElementById("featured-image")){var o=document.getElementById("featured-image").src;null!=o||null!=o?r.append("feature_image",o):r.append("feature_image",null)}t(r)}))}}const T="editorDelete",_="editorUploadImage",A="editorSave",D="editorUpdate";new class{};var B=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","boxSizing","fontFamily","fontSize","fontWeight","height","letterSpacing","lineHeight","marginBottom","marginLeft","marginRight","marginTop","outlineWidth","overflow","overflowX","overflowY","paddingBottom","paddingLeft","paddingRight","paddingTop","textAlign","textOverflow","textTransform","whiteSpace","wordBreak","wordWrap"],L=function(e,t){var n,r,a,i=document.createElement("div");return n=t,r={position:"absolute",left:-9999,top:0,zIndex:-2e3},"TEXTAREA"===e.tagName&&B.push("width"),B.forEach((function(t){r[t]=getComputedStyle(e)[t]})),a=r,Object.keys(a).forEach((function(e){i.style[e]=a[e]})),i.innerHTML=n,e.parentNode.insertBefore(i,e.nextSibling),{rect:function(){var e=i.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return i.parentNode.removeChild(i),t}}};function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var O=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.customPos,n=e.iframe,r=e.noShadowCaret;return n?{iframe:n,window:n.contentWindow,document:n.contentDocument||n.contentWindow.document,noShadowCaret:r,customPos:t}:{window:window,document:document,noShadowCaret:r,customPos:t}},M=function(e){return"object"===C(e)&&null!==e},N=function(e,t){var n=function(){return e.selectionStart},r=function(r){var a=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var i=void 0===r?n():r,o=e.value.slice(0,i),s=e.value.slice(i),l=''.concat(a(o),"");l+='|',l+=''.concat(a(s),"");var u=L(e,l).rect();return u.pos=n(),u};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var a=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,a=e.getBoundingClientRect(),i=r.documentElement,o=n.pageXOffset||i.scrollLeft,s=n.pageYOffset||i.scrollTop;return{top:a.top+s,left:a.left+o}}(e),i=r(n);return{top:a.top+i.top+t.document.body.scrollTop,left:a.left+i.left+t.document.body.scrollLeft,height:i.height}},getPosition:r}},R=function(e,t){return function(e){return!!(e.contentEditable?"true"===e.contentEditable:"true"===e.getAttribute("contenteditable"))}(e)?function(e,t){var n=function(){var n=r(),a={height:0,left:0,right:0};if(!n)return a;var i=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||i){var o=n.cloneRange(),s=i?t.customPos:n.endOffset;o.setStart(n.endContainer,s-1<0?0:s-1),o.setEnd(n.endContainer,s);var l=o.getBoundingClientRect();a={height:l.height,left:l.left+l.width,top:l.top},o.detach()}if((!a||a&&0===a.height)&&!t.noShadowCaret){var u=n.cloneRange(),d=t.document.createTextNode("|");u.insertNode(d),u.selectNode(d);var c=u.getBoundingClientRect();a={height:c.height,left:c.left,top:c.top},d.parentNode.removeChild(d),u.detach()}if(a){var g=t.document.documentElement;a.top+=t.window.pageYOffset-(g.clientTop||0),a.left+=t.window.pageXOffset-(g.clientLeft||0)}return a},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},a=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var a=n.toString().length;return n.detach(),a};return{getPos:a,setPos:function(n){var r=t.window.getSelection();if(r){var a=0,i=!1;!function e(o,s){for(var l=0;l=o){i=!0;var d=t.document.createRange();d.setStart(u,o-a),r.removeAllRanges(),r.addRange(d);break}a+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),i=a(),o=e.getBoundingClientRect(),s=o.top+t.document.body.scrollTop,l=o.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=i,r},getOffset:n,getRange:r}}(e,t):N(e,t)};var U=class{constructor(){this.listeners=new Map}addListener(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}removeListener(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce(((e,n,r)=>"function"==typeof n&&n===t?e=r:e),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}emitEvent(e,...t){var n=this.listeners.get(e);return!(!n||!n.length)&&(n.forEach((e=>{e(...t)})),!0)}},H={},F=function(e){var t=/\blang(?:uage)?-([\w-]+)\b/i,n=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=c.reach);I+=k.value.length,k=k.next){var S=k.value;if(t.length>e.length)return;if(!(S instanceof i)){var x,P=1;if(b){if(!(x=o(w,I,e,v)))break;var T=x.index,_=x.index+x[0].length,A=I;for(A+=k.value.length;T>=A;)A+=(k=k.next).value.length;if(I=A-=k.value.length,k.value instanceof i)continue;for(var D=k;D!==t.tail&&(A<_||"string"==typeof D.value);D=D.next)P++,A+=D.value.length;P--,S=e.slice(I,A),x.index-=I}else if(!(x=o(w,0,S,v)))continue;T=x.index;var B=x[0],L=S.slice(0,T),C=S.slice(T+B.length),O=I+S.length;c&&O>c.reach&&(c.reach=O);var M=k.prev;if(L&&(M=u(t,M,L),I+=L.length),d(t,M,P),k=u(t,M,new i(g,f?a.tokenize(B,f):B,y,B)),C&&u(t,k,C),P>1){var N={cause:g+","+h,reach:O};s(e,t,n,k.prev,I,N),c&&N.reach>c.reach&&(c.reach=N.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function u(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function d(e,t,n){for(var r=t.next,a=0;a"+i.content+""},!e.document)return e.addEventListener?(a.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),r=n.language,i=n.code,o=n.immediateClose;e.postMessage(a.highlight(i,a.languages[r],r)),o&&e.close()}),!1),a):a;var c=a.util.currentScript();function g(){a.manual||a.highlightAll()}if(c&&(a.filename=c.src,c.hasAttribute("data-manual")&&(a.manual=!0)),!a.manual){var p=document.readyState;"loading"===p||"interactive"===p&&c&&c.defer?document.addEventListener("DOMContentLoaded",g):window.requestAnimationFrame?window.requestAnimationFrame(g):window.setTimeout(g,16)}return a}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});H&&(H=F),void 0!==t&&(t.Prism=F),Prism.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var a={};a[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"font-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+i+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+i+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n",quot:'"'},l=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism);var q=class extends U{constructor(t,n){super(),document.getElementById("edit").addEventListener("input",(n=>{let r=document.querySelector("#highlight-content");this.textEditor=t;let a=n.target.value;r.innerHTML=a.replace(new RegExp("&","g"),"&").replace(new RegExp("<","g"),"<");let i=document.getElementById("highlight").offsetHeight;document.getElementById("edit-post-wrapper").style.height=i+"px",n.target.style.height=i+"px",e(H).highlightElement(r)})),document.getElementById("edit").addEventListener("scroll",(e=>{let t=document.querySelector("#highlight");t.scrollTop=e.scrollTop,t.scrollLeft=e.scrollLeft})),document.getElementById("edit").dispatchEvent(new Event("input")),this.setInputs(),window.addEventListener("scroll",(()=>{}))}setInputs(){for(var e=document.querySelectorAll(".editor-button"),t=0,n=e.length;tthis.handleEditorOption(e)),!1)}notify(e,t){switch(e){case S:document.getElementById("submit-update").classList.add("icon-hide"),document.getElementById("submit-good").classList.remove("icon-hide"),document.getElementById("edit-update").classList.remove("submit-start"),document.getElementById("edit-update").classList.add("submit-cool"),setTimeout((()=>{document.getElementById("submit-update").classList.remove("icon-hide"),document.getElementById("submit-good").classList.add("icon-hide"),document.getElementById("edit-update").classList.add("submit-start"),document.getElementById("edit-update").classList.remove("submit-cool")}),2e3);break;case"postAdded":break;case _:let e=this.textEditor.value.length,n=this.textEditor.selectionStart,r=this.textEditor.selectionEnd,a="![image alt text]("+t+" 'image title')";this.textEditor.value=this.textEditor.value.substring(0,n)+a+this.textEditor.value.substring(r,e),document.getElementById("edit").dispatchEvent(new Event("input"))}}handleEditorOption(e){e.preventDefault();let t=this.textEditor.value.length,n=this.textEditor.selectionStart,r=this.textEditor.selectionEnd,a=this.textEditor.value.substring(n,r),i="";switch(e.target.id){case"edit-bold":i="**"+a+"**",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-italic":i="*"+a+"*",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-strikethrough":i="~~"+a+"~~",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-header1":i="# "+a+"\n",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-header2":i="## "+a+"\n",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-header3":i="### "+a+"\n",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-link":i="["+a+"]("+prompt("Let's get that url, boss").toLowerCase()+")",this.textEditor.value=this.textEditor.value.substring(0,n)+i+this.textEditor.value.substring(r,t);break;case"edit-image":this.caretPos=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};M(t)&&(n=t,t=null);var r=O(n),a=R(e,r);return t||0===t?a.setPos(t):a.getPosition()}(this.textEditor).pos,this.emitEvent(_);break;case"submit-save":case"edit-save":this.emitEvent(A);break;case"submit-update":case"edit-update":this.emitEvent(D);break;case"edit-delete":this.emitEvent(T)}document.getElementById("edit").dispatchEvent(new Event("input"))}},X={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},j={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Y=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],W={CSS:{},springs:{}};function $(e,t,n){return Math.min(Math.max(e,t),n)}function z(e,t){return e.indexOf(t)>-1}function G(e,t){return e.apply(null,t)}var Q={arr:function(e){return Array.isArray(e)},obj:function(e){return z(Object.prototype.toString.call(e),"Object")},pth:function(e){return Q.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return e.nodeType||Q.svg(e)},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},und:function(e){return void 0===e},nil:function(e){return Q.und(e)||null===e},hex:function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)},rgb:function(e){return/^rgb/.test(e)},hsl:function(e){return/^hsl/.test(e)},col:function(e){return Q.hex(e)||Q.rgb(e)||Q.hsl(e)},key:function(e){return!X.hasOwnProperty(e)&&!j.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function V(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function J(e,t){var n=V(e),r=$(Q.und(n[0])?1:n[0],.1,100),a=$(Q.und(n[1])?100:n[1],.1,100),i=$(Q.und(n[2])?10:n[2],.1,100),o=$(Q.und(n[3])?0:n[3],.1,100),s=Math.sqrt(a/r),l=i/(2*Math.sqrt(a*r)),u=l<1?s*Math.sqrt(1-l*l):0,d=l<1?(l*s-o)/u:-o+s;function c(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+d*Math.sin(u*n)):(1+d*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?c:function(){var t=W.springs[e];if(t)return t;for(var n=1/6,r=0,a=0;;)if(1===c(r+=n)){if(++a>=16)break}else a=0;var i=r*n*1e3;return W.springs[e]=i,i}}function Z(e){return void 0===e&&(e=10),function(t){return Math.ceil($(t,1e-6,1)*e)*(1/e)}}var K,ee,te=function(){var e=.1;function t(e,t){return 1-3*t+3*e}function n(e,t){return 3*t-6*e}function r(e){return 3*e}function a(e,a,i){return((t(a,i)*e+n(a,i))*e+r(a))*e}function i(e,a,i){return 3*t(a,i)*e*e+2*n(a,i)*e+r(a)}return function(t,n,r,o){if(0<=t&&t<=1&&0<=r&&r<=1){var s=new Float32Array(11);if(t!==n||r!==o)for(var l=0;l<11;++l)s[l]=a(l*e,t,r);return function(e){return t===n&&r===o||0===e||1===e?e:a(u(e),n,o)}}function u(n){for(var o=0,l=1;10!==l&&s[l]<=n;++l)o+=e;--l;var u=o+(n-s[l])/(s[l+1]-s[l])*e,d=i(u,t,r);return d>=.001?function(e,t,n,r){for(var o=0;o<4;++o){var s=i(t,n,r);if(0===s)return t;t-=(a(t,n,r)-e)/s}return t}(n,u,t,r):0===d?u:function(e,t,n,r,i){var o,s,l=0;do{(o=a(s=t+(n-t)/2,r,i)-e)>0?n=s:t=s}while(Math.abs(o)>1e-7&&++l<10);return s}(n,o,o+e,t,r)}}}(),ne=(K={linear:function(){return function(e){return e}}},ee={Sine:function(){return function(e){return 1-Math.cos(e*Math.PI/2)}},Circ:function(){return function(e){return 1-Math.sqrt(1-e*e)}},Back:function(){return function(e){return e*e*(3*e-2)}},Bounce:function(){return function(e){for(var t,n=4;e<((t=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*t-2)/22-e,2)}},Elastic:function(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var n=$(e,1,10),r=$(t,.1,2);return function(e){return 0===e||1===e?e:-n*Math.pow(2,10*(e-1))*Math.sin((e-1-r/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/r)}}},["Quad","Cubic","Quart","Quint","Expo"].forEach((function(e,t){ee[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(ee).forEach((function(e){var t=ee[e];K["easeIn"+e]=t,K["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},K["easeInOut"+e]=function(e,n){return function(r){return r<.5?t(e,n)(2*r)/2:1-t(e,n)(-2*r+2)/2}},K["easeOutIn"+e]=function(e,n){return function(r){return r<.5?(1-t(e,n)(1-2*r))/2:(t(e,n)(2*r-1)+1)/2}}})),K);function re(e,t){if(Q.fnc(e))return e;var n=e.split("(")[0],r=ne[n],a=V(e);switch(n){case"spring":return J(e,t);case"cubicBezier":return G(te,a);case"steps":return G(Z,a);default:return G(r,a)}}function ae(e){try{return document.querySelectorAll(e)}catch(e){return}}function ie(e,t){for(var n=e.length,r=arguments.length>=2?arguments[1]:void 0,a=[],i=0;i1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(0==o)t=n=r=s;else{var d=s<.5?s*(1+o):s+o-s*o,c=2*s-d;t=u(c,d,i+1/3),n=u(c,d,i),r=u(c,d,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function pe(e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(e);if(t)return t[1]}function he(e,t){return Q.fnc(e)?e(t.target,t.id,t.total):e}function me(e,t){return e.getAttribute(t)}function fe(e,t,n){if(le([n,"deg","rad","turn"],pe(t)))return t;var r=W.CSS[t+n];if(!Q.und(r))return r;var a=document.createElement(e.tagName),i=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;i.appendChild(a),a.style.position="absolute",a.style.width=100+n;var o=100/a.offsetWidth;i.removeChild(a);var s=o*parseFloat(t);return W.CSS[t+n]=s,s}function ve(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),a=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?fe(e,a,n):a}}function be(e,t){return Q.dom(e)&&!Q.inp(e)&&(!Q.nil(me(e,t))||Q.svg(e)&&e[t])?"attribute":Q.dom(e)&&le(Y,t)?"transform":Q.dom(e)&&"transform"!==t&&ve(e,t)?"css":null!=e[t]?"object":void 0}function ye(e){if(Q.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,a=new Map;t=r.exec(n);)a.set(t[1],t[2]);return a}}function Ee(e,t,n,r){var a=z(t,"scale")?1:0+function(e){return z(e,"translate")||"perspective"===e?"px":z(e,"rotate")||z(e,"skew")?"deg":void 0}(t),i=ye(e).get(t)||a;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?fe(e,i,r):i}function we(e,t,n,r){switch(be(e,t)){case"transform":return Ee(e,t,r,n);case"css":return ve(e,t,n);case"attribute":return me(e,t);default:return e[t]||0}}function ke(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=pe(e)||0,a=parseFloat(t),i=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return a+i+r;case"-":return a-i+r;case"*":return a*i+r}}function Ie(e,t){if(Q.col(e))return ge(e);if(/\s/g.test(e))return e;var n=pe(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function Se(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function xe(e){for(var t,n=e.points,r=0,a=0;a0&&(r+=Se(t,i)),t=i}return r}function Pe(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*me(e,"r")}(e);case"rect":return function(e){return 2*me(e,"width")+2*me(e,"height")}(e);case"line":return function(e){return Se({x:me(e,"x1"),y:me(e,"y1")},{x:me(e,"x2"),y:me(e,"y2")})}(e);case"polyline":return xe(e);case"polygon":return function(e){var t=e.points;return xe(e)+Se(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Te(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;Q.svg(t)&&Q.svg(t.parentNode);)t=t.parentNode;return t}(e),a=r.getBoundingClientRect(),i=me(r,"viewBox"),o=a.width,s=a.height,l=n.viewBox||(i?i.split(" "):[0,0,o,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o,h:s,vW:l[2],vH:l[3]}}function _e(e,t,n){function r(n){void 0===n&&(n=0);var r=t+n>=1?t+n:0;return e.el.getPointAtLength(r)}var a=Te(e.el,e.svg),i=r(),o=r(-1),s=r(1),l=n?1:a.w/a.vW,u=n?1:a.h/a.vH;switch(e.property){case"x":return(i.x-a.x)*l;case"y":return(i.y-a.y)*u;case"angle":return 180*Math.atan2(s.y-o.y,s.x-o.x)/Math.PI}}function Ae(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Ie(Q.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:Q.str(e)||t?r.split(n):[]}}function De(e){return ie(e?oe(Q.arr(e)?e.map(se):se(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Be(e){var t=De(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:ye(e)}}}))}function Le(e,t){var n=ue(t);if(/^spring/.test(n.easing)&&(n.duration=J(n.easing)),Q.arr(e)){var r=e.length;2===r&&!Q.obj(e[0])?e={value:e}:Q.fnc(t.duration)||(n.duration=t.duration/r)}var a=Q.arr(e)?e:[e];return a.map((function(e,n){var r=Q.obj(e)&&!Q.pth(e)?e:{value:e};return Q.und(r.delay)&&(r.delay=n?0:t.delay),Q.und(r.endDelay)&&(r.endDelay=n===a.length-1?t.endDelay:0),r})).map((function(e){return ce(e,n)}))}function Ce(e,t){var n=[],r=t.keyframes;for(var a in r&&(t=ce(function(e){for(var t=ie(oe(e.map((function(e){return Object.keys(e)}))),(function(e){return Q.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var a=t[r];n[a]=e.map((function(e){var t={};for(var n in e)Q.key(n)?n==a&&(t.value=e[n]):t[n]=e[n];return t}))},a=0;a0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){je.suspendWhenDocumentHidden&&(Xe()?e=cancelAnimationFrame(e):(Fe.forEach((function(e){return e._onDocumentVisibility()})),qe()))})),function(){e||Xe()&&je.suspendWhenDocumentHidden||!(Fe.length>0)||(e=requestAnimationFrame(t))}}();function Xe(){return!!document&&document.hidden}function je(e){void 0===e&&(e={});var t,n=0,r=0,a=0,i=0,o=null;function s(e){var t=window.Promise&&new Promise((function(e){return o=e}));return e.finished=t,t}var l=function(e){var t=de(X,e),n=de(j,e),r=Ce(n,e),a=Be(e.targets),i=Re(a,r),o=Ue(i,n),s=He;return He++,ce(t,{id:s,children:[],animatables:a,animations:i,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(e);s(l);function u(){var e=l.direction;"alternate"!==e&&(l.direction="normal"!==e?"normal":"reverse"),l.reversed=!l.reversed,t.forEach((function(e){return e.reversed=l.reversed}))}function d(e){return l.reversed?l.duration-e:e}function c(){n=0,r=d(l.currentTime)*(1/je.speed)}function g(e,t){t&&t.seek(e-t.timelineOffset)}function p(e){for(var t=0,n=l.animations,r=n.length;t2||(b=Math.round(b*p)/p)),h.push(b)}var w=g.length;if(w){f=g[0];for(var k=0;k0&&(l.began=!0,h("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,h("loopBegin")),v<=m&&0!==l.currentTime&&p(0),(v>=f&&l.currentTime!==c||!c)&&p(c),v>m&&v=c&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=a,h("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,h("loopComplete"),h("complete"),!l.passThrough&&"Promise"in window&&(o(),s(l)))))}return l.reset=function(){var e=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed="reverse"===e,l.remaining=l.loop,t=l.children;for(var n=i=t.length;n--;)l.children[n].reset();(l.reversed&&!0!==l.loop||"alternate"===e&&1===l.loop)&&l.remaining++,p(l.reversed?l.duration:0)},l._onDocumentVisibility=c,l.set=function(e,t){return Ne(e,t),l},l.tick=function(e){a=e,n||(n=a),m((a+(r-n))*je.speed)},l.seek=function(e){m(d(e))},l.pause=function(){l.paused=!0,c()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Fe.push(l),c(),qe())},l.reverse=function(){u(),l.completed=!l.reversed,c()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){We(De(e),l)},l.reset(),l.autoplay&&l.play(),l}function Ye(e,t){for(var n=t.length;n--;)le(e,t[n].animatable.target)&&t.splice(n,1)}function We(e,t){var n=t.animations,r=t.children;Ye(e,n);for(var a=r.length;a--;){var i=r[a],o=i.animations;Ye(e,o),o.length||i.children.length||r.splice(a,1)}n.length||r.length||t.pause()}je.version="3.2.1",je.speed=1,je.suspendWhenDocumentHidden=!0,je.running=Fe,je.remove=function(e){for(var t=De(e),n=Fe.length;n--;){We(t,Fe[n])}},je.get=we,je.set=Ne,je.convertPx=fe,je.path=function(e,t){var n=Q.str(e)?ae(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Te(n),totalLength:Pe(n)*(r/100)}}},je.setDashoffset=function(e){var t=Pe(e);return e.setAttribute("stroke-dasharray",t),t},je.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?re(t.easing):null,a=t.grid,i=t.axis,o=t.from||0,s="first"===o,l="center"===o,u="last"===o,d=Q.arr(e),c=d?parseFloat(e[0]):parseFloat(e),g=d?parseFloat(e[1]):0,p=pe(d?e[1]:e)||0,h=t.start||0+(d?c:0),m=[],f=0;return function(e,t,v){if(s&&(o=0),l&&(o=(v-1)/2),u&&(o=v-1),!m.length){for(var b=0;b-1&&Fe.splice(a,1);for(var s=0;s{$e({targets:Ge,rotateX:"0",easing:"easeInOutQuint",duration:700}),$e({targets:Qe,backgroundColor:n,easing:"easeInOutQuint",duration:700,complete:()=>{setTimeout((()=>{null!==t&&$e({targets:Ge,rotateX:"-120",easing:"easeInOutQuint",duration:700,complete:()=>{$e({targets:ze,marginTop:"-55",easing:"easeInOutQuint",delay:700,duration:50})}})}),1e3)}})}})}}const et=new Ke;class tt{constructor(){this.processing=!1;let e=this;this.admin=new f(null),this.mm=new k,this.urlPieces=document.URL.split("/"),this.post=[],this.postID=null,this.postUUID=null,this.postLayout=null,document.getElementById("post-edit-index").getAttribute("data-index")&&(this.postID=document.getElementById("post-edit-index").getAttribute("data-index"),this.postUUID=document.getElementById("post-edit-index").getAttribute("data-uuid"),this.postLayout=document.getElementById("post-edit-index").getAttribute("data-layout")),document.getElementById("edit")&&(this.editor=new q(document.getElementById("edit"),document.getElementById("header").offsetHeight+document.getElementById("post-header").offsetHeight+document.getElementById("post-feature").offsetHeight),this.editor.addListener(T,(()=>this.handleEditorOptions(T)),!1),this.editor.addListener(_,(()=>this.handleEditorOptions(_)),!1),this.editor.addListener(D,(()=>this.handleEditorOptions(D)),!1),this.editor.addListener(A,(()=>this.handleEditorOptions(A)),!1),document.getElementById("post-image-upload").addEventListener("change",(t=>{e.handleImageUpload(t.target.id,t.target.files)}),!1),this.start())}start(){if(document.getElementById("featured-image-drop")){document.getElementById("featured-image-drop").addEventListener("dragover",this.handleImageActions,!1),document.getElementById("featured-image-drop").addEventListener("drop",this.handleImageActions,!1),document.getElementById("featured-image-upload").addEventListener("change",(e=>this.handleImageActions(e)),!1),document.getElementById("new-feature-upload")&&document.getElementById("new-feature-upload").addEventListener("click",(()=>{document.getElementById("featured-image-upload").click()}));for(var e=document.querySelectorAll(".post-option-btn"),t=0,n=e.length;tthis.handlePostOptions(e)),!1)}}handlePostOptions(e){let t;switch(e.target.id){case"option-page-icon":case"option-menu-pin":t=document.getElementById("option-menu-pin");break;case"option-feature-icon":case"option-feature":t=document.getElementById("option-feature");break;case"option-published-icon":case"option-published":t=document.getElementById("option-published")}"false"==t.getAttribute("data-active")?t.setAttribute("data-active","true"):t.setAttribute("data-active","false")}handleEditorOptions(e){if(this.processing)return;let t=this;switch(e){case A:case D:var n="";n=e===A?c:g,(new P).collectInfo(document.getElementById("featured-image-upload").files[0]).then((e=>{t.processing=!0,et.alert("Writing down changes",null),t.admin.pageActions(n,e).then((e=>{t.processing=!1,"postError"===e.type||"apiUseNotAuthorized"===e.type?et.alert(e.message,!1):e.type===S?et.alert(e.message,!0):(et.alert(e.message,!0),window.location="/dashboard/page/edit/"+e.id)})).catch((e=>{t.processing=!1,et.alert(e,!1)}))}));break;case T:if("index"===this.postLayout)return void et.alert("Index cannot be deleted",!1);if(confirm("AYE! You know you're deleting this post, right?")){let e={id:this.postUUID};t.processing=!0,this.admin.pageActions(p,e).then((()=>{t.processing=!1,window.location="/dashboard/pages"})).catch((e=>{t.processing=!1,et.alert(e,!1)}))}break;case _:document.getElementById("post-image-upload").click()}}handleImageActions(e){switch(e.stopPropagation(),e.preventDefault(),e.type){case"dragover":e.dataTransfer.dropEffect="copy";break;case"change":case"drop":"drop"==e.type?tt.uploadFiles=e.dataTransfer.files:tt.uploadFiles=e.target.files;for(var t,n=0;t=tt.uploadFiles[n];n++)if(t.type.match("image.*")){var r=new FileReader;r.onload=function(e){return function(t){var n=document.createElement("img");n.src=t.target.result,n.title=escape(e.name),document.createElement("div").innerHTML=[''].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(t),r.readAsDataURL(t)}}}handleImageUpload(e,t){let n=this;et.alert("Uploading Image",null),n.mm.imageUpload(e,t).then((e=>{"postImageAdded"==e.type?(n.editor.notify(_,e.url),et.alert("Image Added to Entry",!0)):et.alert("Uh oh. Image not added",!1)})).catch((()=>{et.alert("Uh oh. Image not added",!1)}))}}tt.uploadFiles=[];class nt{constructor(e){this.currentPage=null,this.choosePage(e),this.start()}start(){}choosePage(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new tt}}}class rt{constructor(){}getInfo(){let e=document.getElementById("settings-handle").value,t=document.getElementById("settings-email").value,n=document.getElementById("settings-url").value,r=document.getElementById("settings-title").value,a=document.getElementById("settings-desc").value,i=document.getElementById("render-toggle").getAttribute("data-render"),o=document.getElementById("background").src,s="",l=document.querySelectorAll(".theme-select"),u=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,c=document.getElementById("smtp-pass").value,g=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,h="",m=document.querySelectorAll(".mail-option"),f=document.getElementById("api-access-toggle").getAttribute("data-enabled"),v=document.getElementById("dynamic-render-toggle").getAttribute("data-enabled");var b,y;for(b=0,y=l.length;b{at.alert(e.message,!0)})).catch((e=>{at.alert(e.message,!1)}))}testMail(){(new f).sendMail({content:"This is a test email",mail_task:"TESTING"}).then((e=>{at.alert(e.message,!0)})).catch((e=>{at.alert(e.message,!1)}))}}const ot=new Ke;class st{constructor(){this.processing=!1,this.start(),this.admin=new f(null),this.mm=new k(null,null)}start(){let e=this;document.getElementById("save-toggle").addEventListener("click",(()=>(new rt).getInfo().then((t=>{ot.alert("Saving Settings",null),e.admin.sync("syncSite",t).then((e=>{e.type,ot.alert(e.message,!0)}))})).catch((()=>{})))),document.getElementById("avatar").addEventListener("click",(()=>{document.getElementById("avatar-upload").click()})),document.getElementById("background").addEventListener("click",(()=>{document.getElementById("background-upload").click()})),document.getElementById("avatar-upload").addEventListener("change",(t=>{e.handleImageUpload(t.target.id,t.target.files)}),!1),document.getElementById("background-upload").addEventListener("change",(t=>{e.handleImageUpload(t.target.id,t.target.files)}),!1);var t=document.getElementById("api-access-toggle"),n=document.getElementById("api-status");t.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),"false"==t.getAttribute("data-enabled")?(t.setAttribute("data-enabled","true"),n.innerHTML="EXTERNAL API ACCESS IS ENABLED"):(t.setAttribute("data-enabled","false"),n.innerHTML="EXTERNAL API ACCESS IS NOT ENABLED")}));var r=document.getElementById("dynamic-render-toggle"),a=document.getElementById("dynamic-render-status");r.addEventListener("click",(e=>{e.stopPropagation(),e.preventDefault(),"false"==r.getAttribute("data-enabled")?(r.setAttribute("data-enabled","true"),a.innerHTML="DYNAMIC PAGE RENDERING"):(r.setAttribute("data-enabled","false"),a.innerHTML="STATIC PAGE RENDERING")})),document.getElementById("send-mail").addEventListener("click",(e=>this.handleMailer(e))),document.getElementById("publish-pages").addEventListener("click",(e=>this.handlePublished(e))),document.getElementById("render-toggle").addEventListener("click",(e=>this.toggleRender(e))),document.getElementById("render-toggle-icon").addEventListener("click",(e=>this.toggleRender(e)));let i=document.querySelectorAll(".theme-select");for(var o=0,s=i.length;othis.handleThemes(e)));let l=document.querySelectorAll(".mail-option");for(o=0,s=l.length;othis.handleMailOptions(e)));document.getElementById("create-backup").addEventListener("click",(e=>this.handleBackup(e)))}togglePrivacy(e){e.stopPropagation(),e.preventDefault(),"false"==e.target.getAttribute("data-private")?(e.target.setAttribute("data-private","true"),e.target.innerHTML="SITE IS PUBLIC"):(e.target.setAttribute("data-private","false"),e.target.innerHTML="SITE IS PRIVATE")}toggleRender(e){e.stopPropagation(),e.preventDefault();let t=document.getElementById("render-toggle");"false"==t.getAttribute("data-render")?t.setAttribute("data-render","true"):t.setAttribute("data-render","false")}handleMailer(){(new it).testMail()}handleThemes(e){e.stopPropagation(),e.preventDefault();let t=document.querySelectorAll(".theme-select");for(var n=0,r=t.length;n{"avatarUploaded"==e.type?(ot.alert(e.message,!0),document.getElementById("avatar").src=e.url):(ot.alert(e.message,!0),document.getElementById("background").src=e.url)})).catch((()=>{}))}handlePublished(e){if(this.processing)return;e.preventDefault(),e.stopPropagation();let t=this;this.processing=!0,ot.alert("Publishing site...",null),this.admin.publish({task:"PUBLISH_ALL"}).then((e=>{t.processing=!1,ot.alert(e.message,!0)})).catch((e=>{t.processing=!1,ot.alert(e,!1)}))}handleBackup(e){e.preventDefault(),e.stopPropagation(),ot.alert("Creating backup",null),this.mm.backup().then((e=>{ot.alert(e.message,!0)})).catch((e=>{ot.alert(e,!1)}))}handleReindex(e){if(this.processing)return;let t=this;e.preventDefault(),e.stopPropagation();this.processing=!0,ot.alert("Cleaning up page indexes",null),this.admin.handleReindex({task:"cleanup pages indexes"}).then((e=>{t.processing=!1,ot.alert(e.message,!0)})).catch((e=>{t.processing=!1,ot.alert(e,!1)}))}}class lt{constructor(){}syncMenu(){let e=[],t=document.getElementById("nav-pages").children;for(let n=0;n numeric require +// +// anything defined in a previous bundle is accessed via the +// orig method which is the require for previous bundles + +(function (modules, entry, mainEntry, parcelRequireName, globalName) { + /* eslint-disable no-undef */ + var globalObject = + typeof globalThis !== 'undefined' + ? globalThis + : typeof self !== 'undefined' + ? self + : typeof window !== 'undefined' + ? window + : typeof global !== 'undefined' + ? global + : {}; + /* eslint-enable no-undef */ + + // Save the require from previous bundle to this closure if any + var previousRequire = + typeof globalObject[parcelRequireName] === 'function' && + globalObject[parcelRequireName]; + + var cache = previousRequire.cache || {}; + // Do not use `require` to prevent Webpack from trying to bundle this call + var nodeRequire = + typeof module !== 'undefined' && + typeof module.require === 'function' && + module.require.bind(module); + + function newRequire(name, jumped) { + if (!cache[name]) { + if (!modules[name]) { + // if we cannot find the module within our internal map or + // cache jump to the current global require ie. the last bundle + // that was added to the page. + var currentRequire = + typeof globalObject[parcelRequireName] === 'function' && + globalObject[parcelRequireName]; + if (!jumped && currentRequire) { + return currentRequire(name, true); + } + + // If there are other bundles on this page the require from the + // previous one is saved to 'previousRequire'. Repeat this as + // many times as there are bundles until the module is found or + // we exhaust the require chain. + if (previousRequire) { + return previousRequire(name, true); + } + + // Try the node require function if it exists. + if (nodeRequire && typeof name === 'string') { + return nodeRequire(name); + } + + var err = new Error("Cannot find module '" + name + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + } + + localRequire.resolve = resolve; + localRequire.cache = {}; + + var module = (cache[name] = new newRequire.Module(name)); + + modules[name][0].call( + module.exports, + localRequire, + module, + module.exports, + this + ); + } + + return cache[name].exports; + + function localRequire(x) { + return newRequire(localRequire.resolve(x)); + } + + function resolve(x) { + return modules[name][1][x] || x; + } + } + + function Module(moduleName) { + this.id = moduleName; + this.bundle = newRequire; + this.exports = {}; + } + + newRequire.isParcelRequire = true; + newRequire.Module = Module; + newRequire.modules = modules; + newRequire.cache = cache; + newRequire.parent = previousRequire; + newRequire.register = function (id, exports) { + modules[id] = [ + function (require, module) { + module.exports = exports; + }, + {}, + ]; + }; + + Object.defineProperty(newRequire, 'root', { + get: function () { + return globalObject[parcelRequireName]; + }, + }); + + globalObject[parcelRequireName] = newRequire; + + for (var i = 0; i < entry.length; i++) { + newRequire(entry[i]); + } + + if (mainEntry) { + // Expose entry point to Node, AMD or browser globals + // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js + var mainExports = newRequire(mainEntry); + + // CommonJS + if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = mainExports; + + // RequireJS + } else if (typeof define === 'function' && define.amd) { + define(function () { + return mainExports; + }); + + //