fipamo/public/assets/scripts/Start.js

9 lines
101 KiB
JavaScript

(()=>{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,t=null){this.percentComplete=0,this.baseURL=null,this.progressBar=t,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 r,i,o;switch(e){case c:r="/api/v1/page/create",i=c,o=a;break;case g:r="/api/v1/page/write",i=g,o=a;break;case p:r="/api/v1/page/delete",i=p,o=a}return this.baseURL?t.remote=!0:t.remote=!1,new Promise(((e,a)=>{this._request(this.baseURL?this.baseURL+r:r,i,n,o,t).then((t=>{e(t)})).catch((e=>{a(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 y=new XMLHttpRequest;if(y.upload.addEventListener("progress",(e=>l.handleLoadProgress(e,l.progressBar))),y.open(i,e,!0),y.onload=()=>{if(200==y.status){let e=JSON.parse(y.response);f(e)}else{let e=JSON.parse(y.response);v(e)}},"PUT"==i||i==n)switch(t!==u&&t!==g&&t!==c&&t!==p&&t!==d&&"reIndexPages"!==t||y.setRequestHeader("fipamo-access-token",l.token),o){case r:y.setRequestHeader("Content-type","application/"+o),y.send(JSON.stringify(s));break;case a:y.send(s)}else t!==h&&t!==m||y.setRequestHeader("fipamo-access-token",l.token),y.send()}))}handleLoadProgress(e,t){let n=Math.ceil(e.loaded/e.total*100);null!=t&&(t.style.width=n+"%")}}const v="POST",y="json",b="x-www-form-urlencoded",E="/api/v1/status",w="uploadFiles";class k{constructor(e=null,t=null,n=null){this.percentComplete=0,this.token=null,this.baseURL=null,this.progressBar=n,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,y,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,y,e).then((e=>{t(e)})).catch((e=>{n(e)}))}))}newPass(e){return new Promise(((t,n)=>{this._request("/api/v1/reset-password","resetPassword",v,y,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<t.length;o++){var s=t[o];s.type.match("image.*")&&("avatar-upload"===e?i.append("avatar_upload",s,s.name):"background-upload"===e?i.append("background_upload",s,s.name):i.append("post_image",s,s.name))}this._request(a,w,v,b,i).then((e=>{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.addEventListener("progress",(e=>i.handleLoadProgress(e,i.progressBar))),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 y:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(a));break;case b:l.send(a)}else l.send()}))}handleLoadProgress(e,t){let n=Math.ceil(e.loaded/e.total*100);null!=t&&(t.style.width=n+"%")}}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(/&lt;/g,"<").replace(/&gt;/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<t.length;r++)0===i[t[r]]?a=!0:i[t[r]]&&(n|=i[t[r]]);t=n}return t&i.ENT_HTML_QUOTE_SINGLE&&(e=e.replace(/&#0*39;/g,"'")),a||(e=e.replace(/&quot;/g,'"')),e=e.replace(/&amp;/g,"&")}};class P{constructor(){}collectInfo(e){return new Promise(((t,n)=>{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",B="editorUpdate";new class{};var D=["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&&D.push("width"),D.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,"<br/>")};(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='<span style="position: relative; display: inline;">'.concat(a(o),"</span>");l+='<span id="caret-position-marker" style="position: relative; display: inline;">|</span>',l+='<span style="position: relative; display: inline;">'.concat(a(s),"</span>");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<s.childNodes.length;l++){var u=s.childNodes[l];if(i)break;if(3===u.nodeType){if(a+u.length>=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,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){var r,i;switch(n=n||{},a.util.type(t)){case"Object":if(i=a.util.objId(t),n[i])return n[i];for(var o in r={},n[i]=r,t)t.hasOwnProperty(o)&&(r[o]=e(t[o],n));return r;case"Array":return i=a.util.objId(t),n[i]?n[i]:(r=[],n[i]=r,t.forEach((function(t,a){r[a]=e(t,n)})),r);default:return t}},getLanguage:function(e){for(;e&&!t.test(e.className);)e=e.parentElement;return e?(e.className.match(t)||[,"none"])[1].toLowerCase():"none"},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r="no-"+t;e;){var a=e.classList;if(a.contains(t))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var n=a.util.clone(a.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){var i=(r=r||a.languages)[e],o={};for(var s in i)if(i.hasOwnProperty(s)){if(s==t)for(var l in n)n.hasOwnProperty(l)&&(o[l]=n[l]);n.hasOwnProperty(s)||(o[s]=i[s])}var u=r[e];return r[e]=o,a.languages.DFS(a.languages,(function(t,n){n===u&&t!=e&&(this[t]=o)})),o},DFS:function e(t,n,r,i){i=i||{};var o=a.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],r||s);var l=t[s],u=a.util.type(l);"Object"!==u||i[o(l)]?"Array"!==u||i[o(l)]||(i[o(l)]=!0,e(l,n,s,i)):(i[o(l)]=!0,e(l,n,null,i))}}},plugins:{},highlightAll:function(e,t){a.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};a.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),a.hooks.run("before-all-elements-highlight",r);for(var i,o=0;i=r.elements[o++];)a.highlightElement(i,!0===t,r.callback)},highlightElement:function(n,r,i){var o=a.util.getLanguage(n),s=a.languages[o];n.className=n.className.replace(t,"").replace(/\s+/g," ")+" language-"+o;var l=n.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&(l.className=l.className.replace(t,"").replace(/\s+/g," ")+" language-"+o);var u={element:n,language:o,grammar:s,code:n.textContent};function d(e){u.highlightedCode=e,a.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,a.hooks.run("after-highlight",u),a.hooks.run("complete",u),i&&i.call(u.element)}if(a.hooks.run("before-sanity-check",u),(l=u.element.parentElement)&&"pre"===l.nodeName.toLowerCase()&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!u.code)return a.hooks.run("complete",u),void(i&&i.call(u.element));if(a.hooks.run("before-highlight",u),u.grammar)if(r&&e.Worker){var c=new Worker(a.filename);c.onmessage=function(e){d(e.data)},c.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else d(a.highlight(u.code,u.grammar,u.language));else d(a.util.encode(u.code))},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};return a.hooks.run("before-tokenize",r),r.tokens=a.tokenize(r.code,r.grammar),a.hooks.run("after-tokenize",r),i.stringify(a.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var a=new l;return u(a,a.head,e),s(e,a,t,a.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(a)},hooks:{all:{},add:function(e,t){var n=a.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=a.hooks.all[e];if(n&&n.length)for(var r,i=0;r=n[i++];)r(t)}},Token:i};function i(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length}function o(e,t,n,r){e.lastIndex=t;var a=e.exec(n);if(a&&r&&a[1]){var i=a[1].length;a.index+=i,a[0]=a[0].slice(i)}return a}function s(e,t,n,r,l,c){for(var g in n)if(n.hasOwnProperty(g)&&n[g]){var p=n[g];p=Array.isArray(p)?p:[p];for(var h=0;h<p.length;++h){if(c&&c.cause==g+","+h)return;var m=p[h],f=m.inside,v=!!m.lookbehind,y=!!m.greedy,b=m.alias;if(y&&!m.pattern.global){var E=m.pattern.toString().match(/[imsuy]*$/)[0];m.pattern=RegExp(m.pattern.source,E+"g")}for(var w=m.pattern||m,k=r.next,I=l;k!==t.tail&&!(c&&I>=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(y){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 B=k;B!==t.tail&&(A<_||"string"==typeof B.value);B=B.next)P++,A+=B.value.length;P--,S=e.slice(I,A),x.index-=I}else if(!(x=o(w,0,S,v)))continue;T=x.index;var D=x[0],L=S.slice(0,T),C=S.slice(T+D.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(D,f):D,b,D)),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<n&&r!==e.tail;a++)r=r.next;t.next=r,r.prev=t,e.length-=a}if(e.Prism=a,i.stringify=function e(t,n){if("string"==typeof t)return t;if(Array.isArray(t)){var r="";return t.forEach((function(t){r+=e(t,n)})),r}var i={type:t.type,content:e(t.content,n),tag:"span",classes:["token",t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(i.classes,o):i.classes.push(o)),a.hooks.run("wrap",i);var s="";for(var l in i.attributes)s+=" "+l+'="'+(i.attributes[l]||"").replace(/"/g,"&quot;")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+s+">"+i.content+"</"+i.tag+">"},!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:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\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:/<!\[CDATA\[[\s\S]*?\]\]>/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(/&amp;/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;var r={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var a={};a[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.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(/<inner>/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__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~)<inner>)+\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(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.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<r;n++){var a=t[n];if("code"===a.type){var i=a.content[1],o=a.content[3];if(i&&o&&"code-language"===i.type&&"code-block"===o.type&&"string"==typeof i.content){var s=i.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),l="language-"+(s=(/[a-z][\w-]*/i.exec(s)||[""])[0].toLowerCase());o.alias?"string"==typeof o.alias?o.alias=[o.alias,l]:o.alias.push(l):o.alias=[l]}}else e(a.content)}}(e.tokens)})),e.hooks.add("wrap",(function(t){if("code-block"===t.type){for(var n="",r=0,a=t.classes.length;r<a;r++){var i=t.classes[r],u=/language-(.+)/.exec(i);if(u){n=u[1];break}}var d,c=e.languages[n];if(c)t.content=e.highlight((d=t.content,d.replace(o,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(e,t){var n;if("#"===(t=t.toLowerCase())[0])return n="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),l(n);var r=s[t];return r||e}))),c,n);else if(n&&"none"!==n&&e.plugins.autoloader){var g="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=g,e.plugins.autoloader.loadLanguages(n,(function(){var t=document.getElementById(g);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[n],n))}))}}}));var o=RegExp(e.languages.markup.tag.pattern.source,"gi"),s={amp:"&",lt:"<",gt:">",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"),"&amp;").replace(new RegExp("<","g"),"&lt;");let i=document.getElementById("highlight").offsetHeight;document.getElementById("edit-post-wrapper").style.height=i+"px",n.target.style.height=i+30+"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",(()=>{var e=n;window.pageYOffset+5>=e?document.getElementById("edit-control").style.position="fixed":document.getElementById("edit-control").style.position="relative"}))}setInputs(){for(var e=document.querySelectorAll(".editor-button"),t=0,n=e.length;t<n;t++)e[t].addEventListener("click",(e=>this.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+")";this.textEditor.value=this.textEditor.value.substring(0,n)+a+this.textEditor.value.substring(r,e),document.getElementById("edit").dispatchEvent(new Event("input"));break}}}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(B);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;i<n;i++)if(i in e){var o=e[i];t.call(r,o,i,e)&&a.push(o)}return a}function oe(e){return e.reduce((function(e,t){return e.concat(Q.arr(t)?oe(t):t)}),[])}function se(e){return Q.arr(e)?e:(Q.str(e)&&(e=ae(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function le(e,t){return e.some((function(e){return e===t}))}function ue(e){var t={};for(var n in e)t[n]=e[n];return t}function de(e,t){var n=ue(e);for(var r in e)n[r]=t.hasOwnProperty(r)?t[r]:e[r];return n}function ce(e,t){var n=ue(e);for(var r in t)n[r]=Q.und(e[r])?t[r]:e[r];return n}function ge(e){return Q.rgb(e)?(n=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t=e))?"rgba("+n[1]+",1)":t:Q.hex(e)?function(e){var t=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,t,n,r){return t+t+n+n+r+r})),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}(e):Q.hsl(e)?function(e){var t,n,r,a=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(e),i=parseInt(a[1],10)/360,o=parseInt(a[2],10)/100,s=parseInt(a[3],10)/100,l=a[4]||1;function u(e,t,n){return n<0&&(n+=1),n>1&&(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 ye(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 be(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=be(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(ye(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;a<n.numberOfItems;a++){var i=n.getItem(a);a>0&&(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 Be(e){return ie(e?oe(Q.arr(e)?e.map(se):se(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function De(e){var t=Be(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:be(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;a<t.length;a++)r(a);return n}(r),t)),t)Q.key(a)&&n.push({name:a,tweens:Le(t[a],e)});return n}function Oe(e,t){var n;return e.tweens.map((function(r){var a=function(e,t){var n={};for(var r in e){var a=he(e[r],t);Q.arr(a)&&1===(a=a.map((function(e){return he(e,t)}))).length&&(a=a[0]),n[r]=a}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(r,t),i=a.value,o=Q.arr(i)?i[1]:i,s=pe(o),l=we(t.target,e.name,s,t),u=n?n.to.original:l,d=Q.arr(i)?i[0]:u,c=pe(d)||pe(l),g=s||c;return Q.und(o)&&(o=u),a.from=Ae(d,g),a.to=Ae(ke(o,d),g),a.start=n?n.end:0,a.end=a.start+a.delay+a.duration+a.endDelay,a.easing=re(a.easing,a.duration),a.isPath=Q.pth(i),a.isPathTargetInsideSVG=a.isPath&&Q.svg(t.target),a.isColor=Q.col(a.from.original),a.isColor&&(a.round=1),n=a,a}))}var Me={css:function(e,t,n){return e.style[t]=n},attribute:function(e,t,n){return e.setAttribute(t,n)},object:function(e,t,n){return e[t]=n},transform:function(e,t,n,r,a){if(r.list.set(t,n),t===r.last||a){var i="";r.list.forEach((function(e,t){i+=t+"("+e+") "})),e.style.transform=i}}};function Ne(e,t){De(e).forEach((function(e){for(var n in t){var r=he(t[n],e),a=e.target,i=pe(r),o=we(a,n,i,e),s=ke(Ie(r,i||pe(o)),o),l=ye(a,n);Me[l](a,n,s,e.transforms,!0)}}))}function Re(e,t){return ie(oe(e.map((function(e){return t.map((function(t){return function(e,t){var n=ye(e.target,t.name);if(n){var r=Oe(t,e),a=r[r.length-1];return{type:n,property:t.name,animatable:e,tweens:r,duration:a.end,delay:r[0].delay,endDelay:a.endDelay}}}(e,t)}))}))),(function(e){return!Q.und(e)}))}function Ue(e,t){var n=e.length,r=function(e){return e.timelineOffset?e.timelineOffset:0},a={};return a.duration=n?Math.max.apply(Math,e.map((function(e){return r(e)+e.duration}))):t.duration,a.delay=n?Math.min.apply(Math,e.map((function(e){return r(e)+e.delay}))):t.delay,a.endDelay=n?a.duration-Math.max.apply(Math,e.map((function(e){return r(e)+e.duration-e.endDelay}))):t.endDelay,a}var He=0;var Fe=[],qe=function(){var e;function t(n){for(var r=Fe.length,a=0;a<r;){var i=Fe[a];i.paused?(Fe.splice(a,1),r--):(i.tick(n),a++)}e=a>0?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=De(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;t<r;){var a=n[t],i=a.animatable,o=a.tweens,s=o.length-1,u=o[s];s&&(u=ie(o,(function(t){return e<t.end}))[0]||u);for(var d=$(e-u.start-u.delay,0,u.duration)/u.duration,c=isNaN(d)?1:u.easing(d),g=u.to.strings,p=u.round,h=[],m=u.to.numbers.length,f=void 0,v=0;v<m;v++){var y=void 0,b=u.to.numbers[v],E=u.from.numbers[v]||0;y=u.isPath?_e(u.value,c*b,u.isPathTargetInsideSVG):E+c*(b-E),p&&(u.isColor&&v>2||(y=Math.round(y*p)/p)),h.push(y)}var w=g.length;if(w){f=g[0];for(var k=0;k<w;k++){g[k];var I=g[k+1],S=h[k];isNaN(S)||(f+=I?S+I:S+" ")}}else f=h[0];Me[a.type](i.target,a.property,f,i.transforms),a.currentValue=f,t++}}function h(e){l[e]&&!l.passThrough&&l[e](l)}function m(e){var c=l.duration,m=l.delay,f=c-l.endDelay,v=d(e);l.progress=$(v/c*100,0,100),l.reversePlayback=v<l.currentTime,t&&function(e){if(l.reversePlayback)for(var n=i;n--;)g(e,t[n]);else for(var r=0;r<i;r++)g(e,t[r])}(v),!l.began&&l.currentTime>0&&(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<f?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,h("changeBegin")),h("change"),p(v)):l.changeBegan&&(l.changeCompleted=!0,l.changeBegan=!1,h("changeComplete")),l.currentTime=$(v,0,c),l.began&&h("update"),e>=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(Be(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=Be(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 y=0;y<v;y++){if(a){var b=l?(a[0]-1)/2:o%a[0],E=l?(a[1]-1)/2:Math.floor(o/a[0]),w=b-y%a[0],k=E-Math.floor(y/a[0]),I=Math.sqrt(w*w+k*k);"x"===i&&(I=-w),"y"===i&&(I=-k),m.push(I)}else m.push(Math.abs(o-y));f=Math.max.apply(Math,m)}r&&(m=m.map((function(e){return r(e/f)*f}))),"reverse"===n&&(m=m.map((function(e){return i?e<0?-1*e:-e:Math.abs(f-e)})))}return h+(d?(g-c)/f:c)*(Math.round(100*m[t])/100)+p}},je.timeline=function(e){void 0===e&&(e={});var t=je(e);return t.duration=0,t.add=function(n,r){var a=Fe.indexOf(t),i=t.children;function o(e){e.passThrough=!0}a>-1&&Fe.splice(a,1);for(var s=0;s<i.length;s++)o(i[s]);var l=ce(n,de(j,e));l.targets=l.targets||e.targets;var u=t.duration;l.autoplay=!1,l.direction=t.direction,l.timelineOffset=Q.und(r)?u:ke(r,u),o(t),t.seek(l.timelineOffset);var d=je(l);o(d),i.push(d);var c=Ue(i,e);return t.delay=c.delay,t.endDelay=c.endDelay,t.duration=c.duration,t.seek(0),t.reset(),t.autoplay&&t.play(),t},t},je.easing=re,je.penner=ne,je.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e};var $e=je;const ze=document.getElementById("notifications"),Ge=document.getElementById("notifyMessage"),Qe=document.getElementById("message-text"),Ve=document.getElementById("notify-text"),Je=document.getElementById("notify-progress"),Ze=document.getElementById("notify-good"),Ke=document.getElementById("notify-lame"),et=document.getElementById("notify-working");class tt{constructor(){}alert(e,t){et.style.display="none",Ze.style.display="none",Ke.style.display="none";var n="";null!==t?($e({targets:Je,opacity:0,easing:"easeInOutQuint",duration:500}),t?(n="#32cd32",et.style.display="none",Ze.style.display="block"):(n="#F64747",et.style.display="none",Ke.style.display="block")):(n="#200317",et.style.display="block",$e({targets:Je,opacity:1,easing:"easeInOutQuint",duration:500})),Qe.innerHTML=e,$e({targets:ze,marginTop:"-10",easing:"easeInOutQuint",duration:10,complete:()=>{$e({targets:Ge,rotateX:"0",easing:"easeInOutQuint",duration:700}),$e({targets:Ve,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 nt=new tt;class rt{constructor(){this.processing=!1;let e=this;this.admin=new f(null,document.getElementById("notify-progress")),this.mm=new k(null,null,document.getElementById("notify-progress")),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(B,(()=>this.handleEditorOptions(B)),!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;t<n;t++)e[t].addEventListener("click",(e=>this.handlePostOptions(e)),!1)}}handlePostOptions(e){let t=null;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")}if(null!=t){"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 B:var n="";n=e===A?c:g,(new P).collectInfo(document.getElementById("featured-image-upload").files[0]).then((e=>{t.processing=!0,nt.alert("Writing down changes",null),t.admin.pageActions(n,e).then((e=>{t.processing=!1,"postError"===e.type||"apiUseNotAuthorized"===e.type?nt.alert(e.message,!1):e.type===S?nt.alert(e.message,!0):(nt.alert(e.message,!0),window.location="/dashboard/page/edit/"+e.id)})).catch((e=>{t.processing=!1,nt.alert(e,!1)}))}));break;case T:if("index"===this.postLayout)return void nt.alert("Index cannot be deleted",!1);confirm("AYE! You know you're deleting this post, right?")&&(new P).collectInfo(document.getElementById("featured-image-upload").files[0]).then((e=>{t.processing=!0,this.admin.pageActions(p,e).then((()=>{t.processing=!1,window.location="/dashboard/pages"})).catch((e=>{t.processing=!1,nt.alert(e,!1)}))})).catch((()=>{}));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?rt.uploadFiles=e.dataTransfer.files:rt.uploadFiles=e.target.files;for(var t,n=0;t=rt.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=['<img src="',t.target.result,'" title="',escape(e.name),'"/>'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(t),r.readAsDataURL(t)}else alert("This is not an image. \nBad user. BAD.")}}handleImageUpload(e,t){let n=this;nt.alert("Uploading Image",null),n.mm.imageUpload(e,t).then((e=>{"postImageAdded"==e.type?(n.editor.notify(_,e.url),nt.alert("Image Added to Entry",!0)):nt.alert("Uh oh. Image not added",!1)})).catch((()=>{nt.alert("Uh oh. Image not added",!1)}))}}rt.uploadFiles=[];class at{constructor(e){this.currentPage=null,this.choosePage(e),this.start()}start(){}choosePage(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new rt}}}class it{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 y,b;for(y=0,b=l.length;y<b;y++)"true"==l[y].getAttribute("data-enabled")&&(s=l[y].id);for(y=0,b=m.length;y<b;y++)"true"==m[y].getAttribute("data-enabled")&&(h=m[y].id);let E={global:{base_url:n,title:r,descriptions:a,background:o,private:!1,renderOnSave:i,theme:s,externalAPI:f,dynamicRender:v},member:{handle:e,email:t},email:{active:h,smtp:{domain:u,email:d,password:c},mailgun:{domain:g,key:p}}};return new Promise((function(e){e(E)}))}}const ot=new tt;class st{constructor(){}sendMail(){(new f).sendMail({content:"This is a test email"}).then((e=>{ot.alert(e.message,!0)})).catch((e=>{ot.alert(e.message,!1)}))}testMail(){(new f).sendMail({content:"This is a test email",mail_task:"TESTING"}).then((e=>{ot.alert(e.message,!0)})).catch((e=>{ot.alert(e.message,!1)}))}}const lt=new tt;class ut{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 it).getInfo().then((t=>{lt.alert("Saving Settings",null),e.admin.sync("syncSite",t).then((e=>{e.type,lt.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;o<s;o++)i[o].addEventListener("click",(e=>this.handleThemes(e)));let l=document.querySelectorAll(".mail-option");for(o=0,s=l.length;o<s;o++)l[o].addEventListener("click",(e=>this.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 st).testMail()}handleThemes(e){e.stopPropagation(),e.preventDefault();let t=document.querySelectorAll(".theme-select");for(var n=0,r=t.length;n<r;n++)e.target.id==t[n].id?t[n].setAttribute("data-enabled","true"):t[n].setAttribute("data-enabled","false")}handleMailOptions(e){e.preventDefault(),e.stopPropagation();let t=document.getElementById("mail-smtp"),n=document.getElementById("mail-mg"),r=document.querySelectorAll(".mail-option");for(var a=0,i=r.length;a<i;a++)e.target.id==r[a].id?(r[a].setAttribute("data-enabled","true"),"option-smtp"==e.target.id?(t.setAttribute("data-enabled","true"),n.setAttribute("data-enabled","false")):"option-none"==e.target.id?(t.setAttribute("data-enabled","false"),n.setAttribute("data-enabled","false")):(t.setAttribute("data-enabled","false"),n.setAttribute("data-enabled","true"))):r[a].setAttribute("data-enabled","false")}handleImageUpload(e,t){lt.alert("Uploading Image... ",null),this.mm.imageUpload(e,t).then((e=>{"avatarUploaded"==e.type?(lt.alert(e.message,!0),document.getElementById("avatar").src=e.url):(lt.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,lt.alert("Publishing site...",null),this.admin.publish({task:"PUBLISH_ALL"}).then((e=>{t.processing=!1,lt.alert(e.message,!0)})).catch((e=>{t.processing=!1,lt.alert(e,!1)}))}handleBackup(e){e.preventDefault(),e.stopPropagation(),lt.alert("Creating backup",null),this.mm.backup().then((e=>{lt.alert(e.message,!0)})).catch((e=>{lt.alert(e,!1)}))}handleReindex(e){if(this.processing)return;let t=this;e.preventDefault(),e.stopPropagation();this.processing=!0,lt.alert("Cleaning up page indexes",null),this.admin.handleReindex({task:"cleanup pages indexes"}).then((e=>{t.processing=!1,lt.alert(e.message,!0)})).catch((e=>{t.processing=!1,lt.alert(e,!1)}))}}class dt{constructor(){}syncMenu(){let e=[],t=document.getElementById("nav-pages").children;for(let n=0;n<t.length;n++)e.push({title:t[n].getElementsByTagName("label")[0].innerHTML,id:t[n].id,slug:t[n].getAttribute("data-slug"),uuid:t[n].getAttribute("data-uuid"),path:t[n].getAttribute("data-path")});let n={menu:e,remove:null};return new Promise((function(e){e(n)}))}removeItem(e){document.getElementById("nav-pages").removeChild(document.getElementById(e))}}
/**!
* Sortable 1.14.0
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function gt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach((function(t){ht(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function pt(e){return(pt="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)}function ht(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mt(){return mt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mt.apply(this,arguments)}function ft(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function vt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var yt=vt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),bt=vt(/Edge/i),Et=vt(/firefox/i),wt=vt(/safari/i)&&!vt(/chrome/i)&&!vt(/android/i),kt=vt(/iP(ad|od|hone)/i),It=vt(/chrome/i)&&vt(/android/i),St={capture:!1,passive:!1};function xt(e,t,n){e.addEventListener(t,n,!yt&&St)}function Pt(e,t,n){e.removeEventListener(t,n,!yt&&St)}function Tt(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function _t(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function At(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Tt(e,t):Tt(e,t))||r&&e===n)return e;if(e===n)break}while(e=_t(e))}return null}var Bt,Dt=/\s+/g;function Lt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Dt," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Dt," ")}}function Ct(e,t,n){var r=e&&e.style;if(r){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in r||-1!==t.indexOf("webkit")||(t="-webkit-"+t),r[t]=n+("string"==typeof n?"":"px")}}function Ot(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Ct(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var a=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return a&&new a(n)}function Mt(e,t,n){if(e){var r=e.getElementsByTagName(t),a=0,i=r.length;if(n)for(;a<i;a++)n(r[a],a);return r}return[]}function Nt(){var e=document.scrollingElement;return e||document.documentElement}function Rt(e,t,n,r,a){if(e.getBoundingClientRect||e===window){var i,o,s,l,u,d,c;if(e!==window&&e.parentNode&&e!==Nt()?(o=(i=e.getBoundingClientRect()).top,s=i.left,l=i.bottom,u=i.right,d=i.height,c=i.width):(o=0,s=0,l=window.innerHeight,u=window.innerWidth,d=window.innerHeight,c=window.innerWidth),(t||n)&&e!==window&&(a=a||e.parentNode,!yt))do{if(a&&a.getBoundingClientRect&&("none"!==Ct(a,"transform")||n&&"static"!==Ct(a,"position"))){var g=a.getBoundingClientRect();o-=g.top+parseInt(Ct(a,"border-top-width")),s-=g.left+parseInt(Ct(a,"border-left-width")),l=o+i.height,u=s+i.width;break}}while(a=a.parentNode);if(r&&e!==window){var p=Ot(a||e),h=p&&p.a,m=p&&p.d;p&&(l=(o/=m)+(d/=m),u=(s/=h)+(c/=h))}return{top:o,left:s,bottom:l,right:u,width:c,height:d}}}function Ut(e,t,n){for(var r=jt(e,!0),a=Rt(e)[t];r;){var i=Rt(r)[n];if(!("top"===n||"left"===n?a>=i:a<=i))return r;if(r===Nt())break;r=jt(r,!1)}return!1}function Ht(e,t,n,r){for(var a=0,i=0,o=e.children;i<o.length;){if("none"!==o[i].style.display&&o[i]!==Gn.ghost&&(r||o[i]!==Gn.dragged)&&At(o[i],n.draggable,e,!1)){if(a===t)return o[i];a++}i++}return null}function Ft(e,t){for(var n=e.lastElementChild;n&&(n===Gn.ghost||"none"===Ct(n,"display")||t&&!Tt(n,t));)n=n.previousElementSibling;return n||null}function qt(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===Gn.clone||t&&!Tt(e,t)||n++;return n}function Xt(e){var t=0,n=0,r=Nt();if(e)do{var a=Ot(e),i=a.a,o=a.d;t+=e.scrollLeft*i,n+=e.scrollTop*o}while(e!==r&&(e=e.parentNode));return[t,n]}function jt(e,t){if(!e||!e.getBoundingClientRect)return Nt();var n=e,r=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var a=Ct(n);if(n.clientWidth<n.scrollWidth&&("auto"==a.overflowX||"scroll"==a.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==a.overflowY||"scroll"==a.overflowY)){if(!n.getBoundingClientRect||n===document.body)return Nt();if(r||t)return n;r=!0}}}while(n=n.parentNode);return Nt()}function Yt(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function Wt(e,t){return function(){if(!Bt){var n=arguments,r=this;1===n.length?e.call(r,n[0]):e.apply(r,n),Bt=setTimeout((function(){Bt=void 0}),t)}}}function $t(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function zt(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}var Gt="Sortable"+(new Date).getTime();function Qt(){var e,t=[];return{captureAnimationState:function(){(t=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(e){if("none"!==Ct(e,"display")&&e!==Gn.ghost){t.push({target:e,rect:Rt(e)});var n=gt({},t[t.length-1].rect);if(e.thisAnimationDuration){var r=Ot(e,!0);r&&(n.top-=r.f,n.left-=r.e)}e.fromRect=n}}))},addAnimationState:function(e){t.push(e)},removeAnimationState:function(e){t.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var r in t)if(t.hasOwnProperty(r)&&t[r]===e[n][r])return Number(n);return-1}(t,{target:e}),1)},animateAll:function(n){var r=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof n&&n());var a=!1,i=0;t.forEach((function(e){var t=0,n=e.target,o=n.fromRect,s=Rt(n),l=n.prevFromRect,u=n.prevToRect,d=e.rect,c=Ot(n,!0);c&&(s.top-=c.f,s.left-=c.e),n.toRect=s,n.thisAnimationDuration&&Yt(l,s)&&!Yt(o,s)&&(d.top-s.top)/(d.left-s.left)==(o.top-s.top)/(o.left-s.left)&&(t=function(e,t,n,r){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*r.animation}(d,l,u,r.options)),Yt(s,o)||(n.prevFromRect=o,n.prevToRect=s,t||(t=r.options.animation),r.animate(n,d,s,t)),t&&(a=!0,i=Math.max(i,t),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout((function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null}),t),n.thisAnimationDuration=t)})),clearTimeout(e),a?e=setTimeout((function(){"function"==typeof n&&n()}),i):"function"==typeof n&&n(),t=[]},animate:function(e,t,n,r){if(r){Ct(e,"transition",""),Ct(e,"transform","");var a=Ot(this.el),i=a&&a.a,o=a&&a.d,s=(t.left-n.left)/(i||1),l=(t.top-n.top)/(o||1);e.animatingX=!!s,e.animatingY=!!l,Ct(e,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),Ct(e,"transition","transform "+r+"ms"+(this.options.easing?" "+this.options.easing:"")),Ct(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){Ct(e,"transition",""),Ct(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),r)}}}}var Vt=[],Jt={initializeByDefault:!0},Zt={mount:function(e){for(var t in Jt)Jt.hasOwnProperty(t)&&!(t in e)&&(e[t]=Jt[t]);Vt.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),Vt.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var a=e+"Global";Vt.forEach((function(r){t[r.pluginName]&&(t[r.pluginName][a]&&t[r.pluginName][a](gt({sortable:t},n)),t.options[r.pluginName]&&t[r.pluginName][e]&&t[r.pluginName][e](gt({sortable:t},n)))}))},initializePlugins:function(e,t,n,r){for(var a in Vt.forEach((function(r){var a=r.pluginName;if(e.options[a]||r.initializeByDefault){var i=new r(e,t,e.options);i.sortable=e,i.options=e.options,e[a]=i,mt(n,i.defaults)}})),e.options)if(e.options.hasOwnProperty(a)){var i=this.modifyOption(e,a,e.options[a]);void 0!==i&&(e.options[a]=i)}},getEventProperties:function(e,t){var n={};return Vt.forEach((function(r){"function"==typeof r.eventProperties&&mt(n,r.eventProperties.call(t[r.pluginName],e))})),n},modifyOption:function(e,t,n){var r;return Vt.forEach((function(a){e[a.pluginName]&&a.optionListeners&&"function"==typeof a.optionListeners[t]&&(r=a.optionListeners[t].call(e[a.pluginName],n))})),r}};function Kt(e){var t=e.sortable,n=e.rootEl,r=e.name,a=e.targetEl,i=e.cloneEl,o=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,d=e.oldDraggableIndex,c=e.newDraggableIndex,g=e.originalEvent,p=e.putSortable,h=e.extraEventProperties;if(t=t||n&&n[Gt]){var m,f=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||yt||bt?(m=document.createEvent("Event")).initEvent(r,!0,!0):m=new CustomEvent(r,{bubbles:!0,cancelable:!0}),m.to=o||n,m.from=s||n,m.item=a||n,m.clone=i,m.oldIndex=l,m.newIndex=u,m.oldDraggableIndex=d,m.newDraggableIndex=c,m.originalEvent=g,m.pullMode=p?p.lastPutMode:void 0;var y=gt(gt({},h),Zt.getEventProperties(r,t));for(var b in y)m[b]=y[b];n&&n.dispatchEvent(m),f[v]&&f[v].call(t,m)}}var en=["evt"],tn=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,a=ft(n,en);Zt.pluginEvent.bind(Gn)(e,t,gt({dragEl:rn,parentEl:an,ghostEl:on,rootEl:sn,nextEl:ln,lastDownEl:un,cloneEl:dn,cloneHidden:cn,dragStarted:Sn,putSortable:vn,activeSortable:Gn.active,originalEvent:r,oldIndex:gn,oldDraggableIndex:hn,newIndex:pn,newDraggableIndex:mn,hideGhostForTarget:Yn,unhideGhostForTarget:Wn,cloneNowHidden:function(){cn=!0},cloneNowShown:function(){cn=!1},dispatchSortableEvent:function(e){nn({sortable:t,name:e,originalEvent:r})}},a))};function nn(e){Kt(gt({putSortable:vn,cloneEl:dn,targetEl:rn,rootEl:sn,oldIndex:gn,oldDraggableIndex:hn,newIndex:pn,newDraggableIndex:mn},e))}var rn,an,on,sn,ln,un,dn,cn,gn,pn,hn,mn,fn,vn,yn,bn,En,wn,kn,In,Sn,xn,Pn,Tn,_n,An=!1,Bn=!1,Dn=[],Ln=!1,Cn=!1,On=[],Mn=!1,Nn=[],Rn="undefined"!=typeof document,Un=kt,Hn=bt||yt?"cssFloat":"float",Fn=Rn&&!It&&!kt&&"draggable"in document.createElement("div"),qn=function(){if(Rn){if(yt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Xn=function(e,t){var n=Ct(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),a=Ht(e,0,t),i=Ht(e,1,t),o=a&&Ct(a),s=i&&Ct(i),l=o&&parseInt(o.marginLeft)+parseInt(o.marginRight)+Rt(a).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Rt(i).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(a&&o.float&&"none"!==o.float){var d="left"===o.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==d?"horizontal":"vertical"}return a&&("block"===o.display||"flex"===o.display||"table"===o.display||"grid"===o.display||l>=r&&"none"===n[Hn]||i&&"none"===n[Hn]&&l+u>r)?"vertical":"horizontal"},jn=function(e){function t(e,n){return function(r,a,i,o){var s=r.options.group.name&&a.options.group.name&&r.options.group.name===a.options.group.name;if(null==e&&(n||s))return!0;if(null==e||!1===e)return!1;if(n&&"clone"===e)return e;if("function"==typeof e)return t(e(r,a,i,o),n)(r,a,i,o);var l=(n?r:a).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},r=e.group;r&&"object"==pt(r)||(r={name:r}),n.name=r.name,n.checkPull=t(r.pull,!0),n.checkPut=t(r.put),n.revertClone=r.revertClone,e.group=n},Yn=function(){!qn&&on&&Ct(on,"display","none")},Wn=function(){!qn&&on&&Ct(on,"display","")};Rn&&document.addEventListener("click",(function(e){if(Bn)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Bn=!1,!1}),!0);var $n=function(e){if(rn){e=e.touches?e.touches[0]:e;var t=(a=e.clientX,i=e.clientY,Dn.some((function(e){var t=e[Gt].options.emptyInsertThreshold;if(t&&!Ft(e)){var n=Rt(e),r=a>=n.left-t&&a<=n.right+t,s=i>=n.top-t&&i<=n.bottom+t;return r&&s?o=e:void 0}})),o);if(t){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[Gt]._onDragOver(n)}}var a,i,o},zn=function(e){rn&&rn.parentNode[Gt]._isOutsideThisEl(e.target)};function Gn(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=mt({},t),e[Gt]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Xn(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==Gn.supportPointer&&"PointerEvent"in window&&!wt,emptyInsertThreshold:5};for(var r in Zt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var a in jn(t),this)"_"===a.charAt(0)&&"function"==typeof this[a]&&(this[a]=this[a].bind(this));this.nativeDraggable=!t.forceFallback&&Fn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?xt(e,"pointerdown",this._onTapStart):(xt(e,"mousedown",this._onTapStart),xt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(xt(e,"dragover",this),xt(e,"dragenter",this)),Dn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),mt(this,Qt())}function Qn(e,t,n,r,a,i,o,s){var l,u,d=e[Gt],c=d.options.onMove;return!window.CustomEvent||yt||bt?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=n,l.draggedRect=r,l.related=a||t,l.relatedRect=i||Rt(t),l.willInsertAfter=s,l.originalEvent=o,e.dispatchEvent(l),c&&(u=c.call(d,l,o)),u}function Vn(e){e.draggable=!1}function Jn(){Mn=!1}function Zn(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,r=0;n--;)r+=t.charCodeAt(n);return r.toString(36)}function Kn(e){return setTimeout(e,0)}function er(e){return clearTimeout(e)}Gn.prototype={constructor:Gn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(xn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,rn):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,a=r.preventOnFilter,i=e.type,o=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(o||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Nn.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Nn.push(r)}}(n),!rn&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!wt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=At(s,r.draggable,n,!1))&&s.animated||un===s)){if(gn=qt(s),hn=qt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return nn({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),tn("filter",t,{evt:e}),void(a&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=At(l,r.trim(),n,!1))return nn({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),tn("filter",t,{evt:e}),!0}))))return void(a&&e.cancelable&&e.preventDefault());r.handle&&!At(l,r.handle,n,!1)||this._prepareDragStart(e,o,s)}}},_prepareDragStart:function(e,t,n){var r,a=this,i=a.el,o=a.options,s=i.ownerDocument;if(n&&!rn&&n.parentNode===i){var l=Rt(n);if(sn=i,an=(rn=n).parentNode,ln=rn.nextSibling,un=n,fn=o.group,Gn.dragged=rn,yn={target:rn,clientX:(t||e).clientX,clientY:(t||e).clientY},kn=yn.clientX-l.left,In=yn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,rn.style["will-change"]="all",r=function(){tn("delayEnded",a,{evt:e}),Gn.eventCanceled?a._onDrop():(a._disableDelayedDragEvents(),!Et&&a.nativeDraggable&&(rn.draggable=!0),a._triggerDragStart(e,t),nn({sortable:a,name:"choose",originalEvent:e}),Lt(rn,o.chosenClass,!0))},o.ignore.split(",").forEach((function(e){Mt(rn,e.trim(),Vn)})),xt(s,"dragover",$n),xt(s,"mousemove",$n),xt(s,"touchmove",$n),xt(s,"mouseup",a._onDrop),xt(s,"touchend",a._onDrop),xt(s,"touchcancel",a._onDrop),Et&&this.nativeDraggable&&(this.options.touchStartThreshold=4,rn.draggable=!0),tn("delayStart",this,{evt:e}),!o.delay||o.delayOnTouchOnly&&!t||this.nativeDraggable&&(bt||yt))r();else{if(Gn.eventCanceled)return void this._onDrop();xt(s,"mouseup",a._disableDelayedDrag),xt(s,"touchend",a._disableDelayedDrag),xt(s,"touchcancel",a._disableDelayedDrag),xt(s,"mousemove",a._delayedDragTouchMoveHandler),xt(s,"touchmove",a._delayedDragTouchMoveHandler),o.supportPointer&&xt(s,"pointermove",a._delayedDragTouchMoveHandler),a._dragStartTimer=setTimeout(r,o.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){rn&&Vn(rn),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Pt(e,"mouseup",this._disableDelayedDrag),Pt(e,"touchend",this._disableDelayedDrag),Pt(e,"touchcancel",this._disableDelayedDrag),Pt(e,"mousemove",this._delayedDragTouchMoveHandler),Pt(e,"touchmove",this._delayedDragTouchMoveHandler),Pt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?xt(document,"pointermove",this._onTouchMove):xt(document,t?"touchmove":"mousemove",this._onTouchMove):(xt(rn,"dragend",this),xt(sn,"dragstart",this._onDragStart));try{document.selection?Kn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(An=!1,sn&&rn){tn("dragStarted",this,{evt:t}),this.nativeDraggable&&xt(document,"dragover",zn);var n=this.options;!e&&Lt(rn,n.dragClass,!1),Lt(rn,n.ghostClass,!0),Gn.active=this,e&&this._appendGhost(),nn({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(bn){this._lastX=bn.clientX,this._lastY=bn.clientY,Yn();for(var e=document.elementFromPoint(bn.clientX,bn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(bn.clientX,bn.clientY))!==t;)t=e;if(rn.parentNode[Gt]._isOutsideThisEl(e),t)do{if(t[Gt]){if(t[Gt]._onDragOver({clientX:bn.clientX,clientY:bn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Wn()}},_onTouchMove:function(e){if(yn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,a=e.touches?e.touches[0]:e,i=on&&Ot(on,!0),o=on&&i&&i.a,s=on&&i&&i.d,l=Un&&_n&&Xt(_n),u=(a.clientX-yn.clientX+r.x)/(o||1)+(l?l[0]-On[0]:0)/(o||1),d=(a.clientY-yn.clientY+r.y)/(s||1)+(l?l[1]-On[1]:0)/(s||1);if(!Gn.active&&!An){if(n&&Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(on){i?(i.e+=u-(En||0),i.f+=d-(wn||0)):i={a:1,b:0,c:0,d:1,e:u,f:d};var c="matrix(".concat(i.a,",").concat(i.b,",").concat(i.c,",").concat(i.d,",").concat(i.e,",").concat(i.f,")");Ct(on,"webkitTransform",c),Ct(on,"mozTransform",c),Ct(on,"msTransform",c),Ct(on,"transform",c),En=u,wn=d,bn=a}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!on){var e=this.options.fallbackOnBody?document.body:sn,t=Rt(rn,!0,Un,!0,e),n=this.options;if(Un){for(_n=e;"static"===Ct(_n,"position")&&"none"===Ct(_n,"transform")&&_n!==document;)_n=_n.parentNode;_n!==document.body&&_n!==document.documentElement?(_n===document&&(_n=Nt()),t.top+=_n.scrollTop,t.left+=_n.scrollLeft):_n=Nt(),On=Xt(_n)}Lt(on=rn.cloneNode(!0),n.ghostClass,!1),Lt(on,n.fallbackClass,!0),Lt(on,n.dragClass,!0),Ct(on,"transition",""),Ct(on,"transform",""),Ct(on,"box-sizing","border-box"),Ct(on,"margin",0),Ct(on,"top",t.top),Ct(on,"left",t.left),Ct(on,"width",t.width),Ct(on,"height",t.height),Ct(on,"opacity","0.8"),Ct(on,"position",Un?"absolute":"fixed"),Ct(on,"zIndex","100000"),Ct(on,"pointerEvents","none"),Gn.ghost=on,e.appendChild(on),Ct(on,"transform-origin",kn/parseInt(on.style.width)*100+"% "+In/parseInt(on.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,r=e.dataTransfer,a=n.options;tn("dragStart",this,{evt:e}),Gn.eventCanceled?this._onDrop():(tn("setupClone",this),Gn.eventCanceled||((dn=zt(rn)).draggable=!1,dn.style["will-change"]="",this._hideClone(),Lt(dn,this.options.chosenClass,!1),Gn.clone=dn),n.cloneId=Kn((function(){tn("clone",n),Gn.eventCanceled||(n.options.removeCloneOnHide||sn.insertBefore(dn,rn),n._hideClone(),nn({sortable:n,name:"clone"}))})),!t&&Lt(rn,a.dragClass,!0),t?(Bn=!0,n._loopId=setInterval(n._emulateDragOver,50)):(Pt(document,"mouseup",n._onDrop),Pt(document,"touchend",n._onDrop),Pt(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",a.setData&&a.setData.call(n,r,rn)),xt(document,"drop",n),Ct(rn,"transform","translateZ(0)")),An=!0,n._dragStartId=Kn(n._dragStarted.bind(n,t,e)),xt(document,"selectstart",n),Sn=!0,wt&&Ct(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,r,a,i=this.el,o=e.target,s=this.options,l=s.group,u=Gn.active,d=fn===l,c=s.sort,g=vn||u,p=this,h=!1;if(!Mn){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),o=At(o,s.draggable,i,!0),A("dragOver"),Gn.eventCanceled)return h;if(rn.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||p._ignoreWhileAnimating===o)return D(!1);if(Bn=!1,u&&!s.disabled&&(d?c||(r=an!==sn):vn===this||(this.lastPutMode=fn.checkPull(this,u,rn,e))&&l.checkPut(this,u,rn,e))){if(a="vertical"===this._getDirection(e,o),t=Rt(rn),A("dragOverValid"),Gn.eventCanceled)return h;if(r)return an=sn,B(),this._hideClone(),A("revert"),Gn.eventCanceled||(ln?sn.insertBefore(rn,ln):sn.appendChild(rn)),D(!0);var m=Ft(i,s.draggable);if(!m||function(e,t,n){var r=Rt(Ft(n.el,n.options.draggable)),a=10;return t?e.clientX>r.right+a||e.clientX<=r.right&&e.clientY>r.bottom&&e.clientX>=r.left:e.clientX>r.right&&e.clientY>r.top||e.clientX<=r.right&&e.clientY>r.bottom+a}(e,a,this)&&!m.animated){if(m===rn)return D(!1);if(m&&i===e.target&&(o=m),o&&(n=Rt(o)),!1!==Qn(sn,i,rn,t,o,n,e,!!o))return B(),i.appendChild(rn),an=i,L(),D(!0)}else if(m&&function(e,t,n){var r=Rt(Ht(n.el,0,n.options,!0)),a=10;return t?e.clientX<r.left-a||e.clientY<r.top&&e.clientX<r.right:e.clientY<r.top-a||e.clientY<r.bottom&&e.clientX<r.left}(e,a,this)){var f=Ht(i,0,s,!0);if(f===rn)return D(!1);if(n=Rt(o=f),!1!==Qn(sn,i,rn,t,o,n,e,!1))return B(),i.insertBefore(rn,f),an=i,L(),D(!0)}else if(o.parentNode===i){n=Rt(o);var v,y,b,E=rn.parentNode!==i,w=!function(e,t,n){var r=n?e.left:e.top,a=n?e.right:e.bottom,i=n?e.width:e.height,o=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===o||a===s||r+i/2===o+l/2}(rn.animated&&rn.toRect||t,o.animated&&o.toRect||n,a),k=a?"top":"left",I=Ut(o,"top","top")||Ut(rn,"top","top"),S=I?I.scrollTop:void 0;if(xn!==o&&(y=n[k],Ln=!1,Cn=!w&&s.invertSwap||E),v=function(e,t,n,r,a,i,o,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,d=r?n.top:n.left,c=r?n.bottom:n.right,g=!1;if(!o)if(s&&Tn<u*a){if(!Ln&&(1===Pn?l>d+u*i/2:l<c-u*i/2)&&(Ln=!0),Ln)g=!0;else if(1===Pn?l<d+Tn:l>c-Tn)return-Pn}else if(l>d+u*(1-a)/2&&l<c-u*(1-a)/2)return function(e){return qt(rn)<qt(e)?1:-1}(t);if((g=g||o)&&(l<d+u*i/2||l>c-u*i/2))return l>d+u/2?1:-1;return 0}(e,o,n,a,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Cn,xn===o),0!==v){var x=qt(rn);do{x-=v,b=an.children[x]}while(b&&("none"===Ct(b,"display")||b===on))}if(0===v||b===o)return D(!1);xn=o,Pn=v;var P=o.nextElementSibling,T=!1,_=Qn(sn,i,rn,t,o,n,e,T=1===v);if(!1!==_)return 1!==_&&-1!==_||(T=1===_),Mn=!0,setTimeout(Jn,30),B(),T&&!P?i.appendChild(rn):o.parentNode.insertBefore(rn,T?P:o),I&&$t(I,0,S-I.scrollTop),an=rn.parentNode,void 0===y||Cn||(Tn=Math.abs(y-Rt(o)[k])),L(),D(!0)}if(i.contains(rn))return D(!1)}return!1}function A(s,l){tn(s,p,gt({evt:e,isOwner:d,axis:a?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:c,fromSortable:g,target:o,completed:D,onMove:function(n,r){return Qn(sn,i,rn,t,n,Rt(n),e,r)},changed:L},l))}function B(){A("dragOverAnimationCapture"),p.captureAnimationState(),p!==g&&g.captureAnimationState()}function D(t){return A("dragOverCompleted",{insertion:t}),t&&(d?u._hideClone():u._showClone(p),p!==g&&(Lt(rn,vn?vn.options.ghostClass:u.options.ghostClass,!1),Lt(rn,s.ghostClass,!0)),vn!==p&&p!==Gn.active?vn=p:p===Gn.active&&vn&&(vn=null),g===p&&(p._ignoreWhileAnimating=o),p.animateAll((function(){A("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==g&&(g.animateAll(),g._ignoreWhileAnimating=null)),(o===rn&&!rn.animated||o===i&&!o.animated)&&(xn=null),s.dragoverBubble||e.rootEl||o===document||(rn.parentNode[Gt]._isOutsideThisEl(e.target),!t&&$n(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),h=!0}function L(){pn=qt(rn),mn=qt(rn,s.draggable),nn({sortable:p,name:"change",toEl:i,newIndex:pn,newDraggableIndex:mn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Pt(document,"mousemove",this._onTouchMove),Pt(document,"touchmove",this._onTouchMove),Pt(document,"pointermove",this._onTouchMove),Pt(document,"dragover",$n),Pt(document,"mousemove",$n),Pt(document,"touchmove",$n)},_offUpEvents:function(){var e=this.el.ownerDocument;Pt(e,"mouseup",this._onDrop),Pt(e,"touchend",this._onDrop),Pt(e,"pointerup",this._onDrop),Pt(e,"touchcancel",this._onDrop),Pt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;pn=qt(rn),mn=qt(rn,n.draggable),tn("drop",this,{evt:e}),an=rn&&rn.parentNode,pn=qt(rn),mn=qt(rn,n.draggable),Gn.eventCanceled||(An=!1,Cn=!1,Ln=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),er(this.cloneId),er(this._dragStartId),this.nativeDraggable&&(Pt(document,"drop",this),Pt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),wt&&Ct(document.body,"user-select",""),Ct(rn,"transform",""),e&&(Sn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),on&&on.parentNode&&on.parentNode.removeChild(on),(sn===an||vn&&"clone"!==vn.lastPutMode)&&dn&&dn.parentNode&&dn.parentNode.removeChild(dn),rn&&(this.nativeDraggable&&Pt(rn,"dragend",this),Vn(rn),rn.style["will-change"]="",Sn&&!An&&Lt(rn,vn?vn.options.ghostClass:this.options.ghostClass,!1),Lt(rn,this.options.chosenClass,!1),nn({sortable:this,name:"unchoose",toEl:an,newIndex:null,newDraggableIndex:null,originalEvent:e}),sn!==an?(pn>=0&&(nn({rootEl:an,name:"add",toEl:an,fromEl:sn,originalEvent:e}),nn({sortable:this,name:"remove",toEl:an,originalEvent:e}),nn({rootEl:an,name:"sort",toEl:an,fromEl:sn,originalEvent:e}),nn({sortable:this,name:"sort",toEl:an,originalEvent:e})),vn&&vn.save()):pn!==gn&&pn>=0&&(nn({sortable:this,name:"update",toEl:an,originalEvent:e}),nn({sortable:this,name:"sort",toEl:an,originalEvent:e})),Gn.active&&(null!=pn&&-1!==pn||(pn=gn,mn=hn),nn({sortable:this,name:"end",toEl:an,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){tn("nulling",this),sn=rn=an=on=ln=dn=un=cn=yn=bn=Sn=pn=mn=gn=hn=xn=Pn=vn=fn=Gn.dragged=Gn.ghost=Gn.clone=Gn.active=null,Nn.forEach((function(e){e.checked=!0})),Nn.length=En=wn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":rn&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move");e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],n=this.el.children,r=0,a=n.length,i=this.options;r<a;r++)At(e=n[r],i.draggable,this.el,!1)&&t.push(e.getAttribute(i.dataIdAttr)||Zn(e));return t},sort:function(e,t){var n={},r=this.el;this.toArray().forEach((function(e,t){var a=r.children[t];At(a,this.options.draggable,r,!1)&&(n[e]=a)}),this),t&&this.captureAnimationState(),e.forEach((function(e){n[e]&&(r.removeChild(n[e]),r.appendChild(n[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return At(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(void 0===t)return n[e];var r=Zt.modifyOption(this,e,t);n[e]=void 0!==r?r:t,"group"===e&&jn(n)},destroy:function(){tn("destroy",this);var e=this.el;e[Gt]=null,Pt(e,"mousedown",this._onTapStart),Pt(e,"touchstart",this._onTapStart),Pt(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(Pt(e,"dragover",this),Pt(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),Dn.splice(Dn.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!cn){if(tn("hideClone",this),Gn.eventCanceled)return;Ct(dn,"display","none"),this.options.removeCloneOnHide&&dn.parentNode&&dn.parentNode.removeChild(dn),cn=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(cn){if(tn("showClone",this),Gn.eventCanceled)return;rn.parentNode!=sn||this.options.group.revertClone?ln?sn.insertBefore(dn,ln):sn.appendChild(dn):sn.insertBefore(dn,rn),this.options.group.revertClone&&this.animate(rn,dn),Ct(dn,"display",""),cn=!1}}else this._hideClone()}},Rn&&xt(document,"touchmove",(function(e){(Gn.active||An)&&e.cancelable&&e.preventDefault()})),Gn.utils={on:xt,off:Pt,css:Ct,find:Mt,is:function(e,t){return!!At(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:Wt,closest:At,toggleClass:Lt,clone:zt,index:qt,nextTick:Kn,cancelNextTick:er,detectDirection:Xn,getChild:Ht},Gn.get=function(e){return e[Gt]},Gn.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t[0].constructor===Array&&(t=t[0]),t.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(Gn.utils=gt(gt({},Gn.utils),e.utils)),Zt.mount(e)}))},Gn.create=function(e,t){return new Gn(e,t)},Gn.version="1.14.0";var tr,nr,rr,ar,ir,or,sr=[],lr=!1;function ur(){sr.forEach((function(e){clearInterval(e.pid)})),sr=[]}function dr(){clearInterval(or)}var cr=Wt((function(e,t,n,r){if(t.scroll){var a,i=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,l=t.scrollSpeed,u=Nt(),d=!1;nr!==n&&(nr=n,ur(),tr=t.scroll,a=t.scrollFn,!0===tr&&(tr=jt(n,!0)));var c=0,g=tr;do{var p=g,h=Rt(p),m=h.top,f=h.bottom,v=h.left,y=h.right,b=h.width,E=h.height,w=void 0,k=void 0,I=p.scrollWidth,S=p.scrollHeight,x=Ct(p),P=p.scrollLeft,T=p.scrollTop;p===u?(w=b<I&&("auto"===x.overflowX||"scroll"===x.overflowX||"visible"===x.overflowX),k=E<S&&("auto"===x.overflowY||"scroll"===x.overflowY||"visible"===x.overflowY)):(w=b<I&&("auto"===x.overflowX||"scroll"===x.overflowX),k=E<S&&("auto"===x.overflowY||"scroll"===x.overflowY));var _=w&&(Math.abs(y-i)<=s&&P+b<I)-(Math.abs(v-i)<=s&&!!P),A=k&&(Math.abs(f-o)<=s&&T+E<S)-(Math.abs(m-o)<=s&&!!T);if(!sr[c])for(var B=0;B<=c;B++)sr[B]||(sr[B]={});sr[c].vx==_&&sr[c].vy==A&&sr[c].el===p||(sr[c].el=p,sr[c].vx=_,sr[c].vy=A,clearInterval(sr[c].pid),0==_&&0==A||(d=!0,sr[c].pid=setInterval(function(){r&&0===this.layer&&Gn.active._onTouchMove(ir);var t=sr[this.layer].vy?sr[this.layer].vy*l:0,n=sr[this.layer].vx?sr[this.layer].vx*l:0;"function"==typeof a&&"continue"!==a.call(Gn.dragged.parentNode[Gt],n,t,e,ir,sr[this.layer].el)||$t(sr[this.layer].el,n,t)}.bind({layer:c}),24))),c++}while(t.bubbleScroll&&g!==u&&(g=jt(g,!1)));lr=d}}),30),gr=function(e){var t=e.originalEvent,n=e.putSortable,r=e.dragEl,a=e.activeSortable,i=e.dispatchSortableEvent,o=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(t){var l=n||a;o();var u=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,d=document.elementFromPoint(u.clientX,u.clientY);s(),l&&!l.el.contains(d)&&(i("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function pr(){}function hr(){}pr.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var r=Ht(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(t,r):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:gr},mt(pr,{pluginName:"revertOnSpill"}),hr.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:gr},mt(hr,{pluginName:"removeOnSpill"});Gn.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?xt(document,"dragover",this._handleAutoScroll):this.options.supportPointer?xt(document,"pointermove",this._handleFallbackAutoScroll):t.touches?xt(document,"touchmove",this._handleFallbackAutoScroll):xt(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?Pt(document,"dragover",this._handleAutoScroll):(Pt(document,"pointermove",this._handleFallbackAutoScroll),Pt(document,"touchmove",this._handleFallbackAutoScroll),Pt(document,"mousemove",this._handleFallbackAutoScroll)),dr(),ur(),clearTimeout(Bt),Bt=void 0},nulling:function(){ir=nr=tr=lr=or=rr=ar=null,sr.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,r=(e.touches?e.touches[0]:e).clientX,a=(e.touches?e.touches[0]:e).clientY,i=document.elementFromPoint(r,a);if(ir=e,t||this.options.forceAutoScrollFallback||bt||yt||wt){cr(e,this.options,i,t);var o=jt(i,!0);!lr||or&&r===rr&&a===ar||(or&&dr(),or=setInterval((function(){var i=jt(document.elementFromPoint(r,a),!0);i!==o&&(o=i,ur()),cr(e,n.options,i,t)}),10),rr=r,ar=a)}else{if(!this.options.bubbleScroll||jt(i,!0)===Nt())return void ur();cr(e,this.options,jt(i,!1),!1)}}},mt(e,{pluginName:"scroll",initializeByDefault:!0})}),Gn.mount(hr,pr);var mr=Gn;const fr=new tt;class vr{constructor(){this.processing=!1,this.admin=new f(null),this.start()}start(){let e=this;mr.create(document.getElementById("nav-pages"),{onUpdate:()=>{(new dt).syncMenu().then((t=>{fr.alert("Updating Menu",null),e.admin.sync("syncNav",t).then((e=>{e.type,fr.alert(e.message,!0)}))}))}});for(var t=document.querySelectorAll(".nav-btn"),n=0,r=t.length;n<r;n++)t[n].addEventListener("click",(e=>this.handleNavButton(e)),!1)}handleNavButton(e){if(this.processing)return;let t="",n=this;switch(e.target.id){case"remove-item":t=e.target.getAttribute("data-id"),(new dt).removeItem(t),(new dt).syncMenu().then((t=>{t.remove=e.target.getAttribute("data-uuid"),fr.alert("Editing Menu",null),n.processing=!0,n.admin.syncNav(t).then((e=>{n.processing=!1,e.type,fr.alert(e.message,!0)}))}));break;case"edit-item":n.processing=!1,window.location="/dashboard/page/edit/"+e.target.getAttribute("data-id")}}}class yr{constructor(){this.currentDisplay="",this.urlPieces=document.URL.split("/"),this.chooseDisplay(this.urlPieces[4],this.urlPieces[5])}start(){}chooseDisplay(e,t){switch(this.currentDisplay="",e){case"page":this.currentDisplay=new at(t);break;case"settings":this.currentDisplay=new ut;break;case"navigation":this.currentDisplay=new vr}this.start()}}const br=new class{constructor(){}imgLoad(e){return new Promise((function(t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){200===r.status?t(r.response):n(new Error("Image didn't load successfully; error code:"+r.statusText))},r.onerror=function(){n(new Error("There was a network error."))},r.send()}))}loadImage(e){let t=this;return new Promise((function(n,r){(new Image).crossOrigin="",t.imgLoad(e).then((function(e){var t=window.URL.createObjectURL(e);n(t)}),(function(e){r(e)}))}))}formDataToJSON(e){let t={};return new FormData(e).forEach(((e,n)=>{t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}},Er=new tt;class wr{constructor(){this.processing=!1,this.start()}start(){if(document.getElementById("dash-form")||document.getElementById("dash-init")){var e=document.getElementsByClassName("init-option");for(let t=0;t<e.length;t++)e[t].addEventListener("click",(e=>this.handleOptions(e)));document.getElementById("dash-form")?document.getElementById("login-btn").addEventListener("click",(e=>this.handleLogin(e))):(document.getElementById("init-blog").addEventListener("click",(e=>this.handleSetup(e))),document.getElementById("blog-restore").addEventListener("click",(e=>this.handleRestore(e))))}else document.getElementById("dash-reset")?(document.getElementById("get-secret-btn").addEventListener("click",(e=>this.handleReset(e))),document.getElementById("reset-btn").addEventListener("click",(e=>this.handleReset(e)))):new yr}handleLogin(e){if(this.processing)return;let t=this;e.stopPropagation(),e.preventDefault();let n=br.formDataToJSON(document.getElementById("login"));Er.alert("Looking, hold up",null);let r=new f;this.processing=!0,r.login(n).then((n=>{t.processing=!1,n.type===I?Er.alert(n.message,!1):(Er.alert(n.message,!0),e.target.innerHTML=n.message,setTimeout((()=>{window.location="/dashboard"}),500))})).catch((e=>{t.processing=!1,Er.alert(e,!1)}))}handleSetup(e){if(this.processing)return;let t=this;e.stopPropagation(),e.preventDefault();let n=br.formDataToJSON(document.getElementById("init-form")),r=new k;this.processing=!0,r.create(n).then((e=>{"blogInitLame"===e.type?(t.processing=!1,Er.alert(e.message,!1)):(t.processing=!1,Er.alert(e.message,!0),setTimeout((()=>{window.location="/dashboard"}),700))})).catch((e=>{t.processing=!1,Er.alert(e,!1)}))}handleRestore(e){if(this.processing)return;let t=this;e.stopPropagation(),e.preventDefault();let n=new k;var r=document.getElementById("init-restore");this.processing=!0,n.restore(r).then((e=>{e.type===I?(t.processing=!1,Er.alert(e.message,!1)):(t.processing=!1,Er.alert(e.message,!0),setTimeout((()=>{window.location="/dashboard"}),1500))})).catch((e=>{t.processing=!1,Er.alert(e,!1)}))}handleReset(e){e.stopPropagation(),e.preventDefault();let t=this,n=new k;if("get-secret-btn"==e.target.id){let e={email:document.getElementById("email").value,task:"retrieveSecret"};this.processing=!0,n.secret(e).then((e=>{t.processing=!1,e.secret?(document.getElementById("secret").value=e.secret,Er.alert(e.message,!0)):"mailSent"==e.type?Er.alert(e.message,!0):Er.alert(e.message,!1)})).catch((e=>{t.processing=!1,Er.alert(e,!1)}))}else{let e={newPass:document.getElementById("new_password").value,newPassConfirm:document.getElementById("new_password2").value,secret:document.getElementById("secret").value};n.newPass(e).then((e=>{t.processing=!1,"passNotCreated"==e.type?Er.alert(e.message,!1):(Er.alert(e.message,!0),setTimeout((()=>{window.location="/dashboard"}),1e3))})).catch((e=>{t.processing=!1,Er.alert(e,!1)}))}}handleOptions(e){e.stopPropagation(),e.preventDefault();let t=document.getElementById("dash-init"),n=document.getElementById("dash-restore");"init-switch-restore"===e.target.id?(t.style.display="none",t.style.visibility="hidden",n.style.display="flex",n.style.visibility="visible"):(t.style.display="flex",t.style.visibility="visible",n.style.display="none",n.style.visibility="hidden")}}document.addEventListener("DOMContentLoaded",(function(){new wr}),!1)})();
//# sourceMappingURL=Start.js.map