You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
103 KiB
JavaScript
9 lines
103 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",c="publishSite",d="createNewPage",g="editPage",p="deletePage",h="syncNav",m="getSiteSettings",f="getMemberInfo";class v{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,c,n,r,e).then((e=>{t(e)})).catch((e=>{a(e)}))}))}pageActions(e,t){let r,i,o;switch(e){case d:r="/api/v1/page/create",i=d,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=m):(t="/api/v1/settings/member",n=f),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(h,v){var b=new XMLHttpRequest;if(b.upload.addEventListener("progress",(e=>l.handleLoadProgress(e,l.progressBar))),b.open(i,e,!0),b.onload=()=>{if(200==b.status){let e=JSON.parse(b.response);h(e)}else{let e=JSON.parse(b.response);v(e)}},"PUT"==i||i==n)switch(t!==u&&t!==g&&t!==d&&t!==p&&t!==c&&"reIndexPages"!==t||b.setRequestHeader("fipamo-access-token",l.token),o){case r:b.setRequestHeader("Content-type","application/"+o),b.send(JSON.stringify(s));break;case a:b.send(s)}else t!==m&&t!==f||b.setRequestHeader("fipamo-access-token",l.token),b.send()}))}handleLoadProgress(e,t){let n=Math.ceil(e.loaded/e.total*100);null!=t&&(t.style.width=n+"%")}}const b="POST",y="json",E="x-www-form-urlencoded",w="/api/v1/status",k="uploadFiles";class I{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+w+"?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",b,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",b,y,e).then((e=>{t(e)})).catch((e=>{n(e)}))}))}newPass(e){return new Promise(((t,n)=>{this._request("/api/v1/reset-password","resetPassword",b,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,k,b,E,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==b)switch(t===k&&l.setRequestHeader("fipamo-access-token",i.token),r){case y:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(a));break;case E:l.send(a)}else l.send()}))}handleLoadProgress(e,t){let n=Math.ceil(e.loaded/e.total*100);null!=t&&(t.style.width=n+"%")}}class S{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}}const x="requestLame",P="postUpdated";new class{};var T=class{constructor(){}cleanString(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}decodeHTML(e,t){var n=0,r=0,a=!1;void 0===t&&(t=2),e=e.toString().replace(/</g,"<").replace(/>/g,">");var i={ENT_NOQUOTES:0,ENT_HTML_QUOTE_SINGLE:1,ENT_HTML_QUOTE_DOUBLE:2,ENT_COMPAT:2,ENT_QUOTES:3,ENT_IGNORE:4};if(0===t&&(a=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r<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(/�*39;/g,"'")),a||(e=e.replace(/"/g,'"')),e=e.replace(/&/g,"&")}};class A{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 T).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),e.length>0&&null!=e)for(var o=0;o<e.length;o++){var s=e[o];s.type.match("image.*")||s.type.match("video.mp4")||s.type.match("audio.mpeg")||s.type.match("application.pdf")||s.type.match("text.plain")||s.type.match("text.rtf")?r.append("page_files[]",s,s.name):n("Not an image file")}else if(document.getElementById("featured-image")){var l=document.getElementById("featured-image").src;null!=l||null!=l?r.append("feature_image",l):r.append("feature_image",null)}t(r)}))}}const _="editorDelete",D="editorUploadImage",B="editorSave",L="editorUpdate";new class{};var C=["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"],O=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&&C.push("width"),C.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 M(e){return(M="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 N=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}},R=function(e){return"object"===M(e)&&null!==e},F=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=O(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}},U=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(),c=t.document.createTextNode("|");u.insertNode(c),u.selectNode(c);var d=u.getBoundingClientRect();a={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),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 c=t.document.createRange();c.setStart(u,o-a),r.removeAllRanges(),r.addRange(c);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):F(e,t)};var H=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)}},q={},X=function(e){var t=/\blang(?:uage)?-([\w-]+)\b/i,n=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").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 c(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 d=new Worker(a.filename);d.onmessage=function(e){c(e.data)},d.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else c(a.highlight(u.code,u.grammar,u.language));else c(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,d){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(d&&d.cause==g+","+h)return;var m=p[h],f=m.inside,v=!!m.lookbehind,b=!!m.greedy,y=m.alias;if(b&&!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&&!(d&&I>=d.reach);I+=k.value.length,k=k.next){var S=k.value;if(t.length>e.length)return;if(!(S instanceof i)){var x,P=1;if(b){if(!(x=o(w,I,e,v)))break;var T=x.index,A=x.index+x[0].length,_=I;for(_+=k.value.length;T>=_;)_+=(k=k.next).value.length;if(I=_-=k.value.length,k.value instanceof i)continue;for(var D=k;D!==t.tail&&(_<A||"string"==typeof D.value);D=D.next)P++,_+=D.value.length;P--,S=e.slice(I,_),x.index-=I}else if(!(x=o(w,0,S,v)))continue;T=x.index;var B=x[0],L=S.slice(0,T),C=S.slice(T+B.length),O=I+S.length;d&&O>d.reach&&(d.reach=O);var M=k.prev;if(L&&(M=u(t,M,L),I+=L.length),c(t,M,P),k=u(t,M,new i(g,f?a.tokenize(B,f):B,y,B)),C&&u(t,k,C),P>1){var N={cause:g+","+h,reach:O};s(e,t,n,k.prev,I,N),d&&N.reach>d.reach&&(d.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 c(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,""")+'"';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 d=a.util.currentScript();function g(){a.manual||a.highlightAll()}if(d&&(a.filename=d.src,d.hasAttribute("data-manual")&&(a.manual=!0)),!a.manual){var p=document.readyState;"loading"===p||"interactive"===p&&d&&d.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:{});q&&(q=X),void 0!==t&&(t.Prism=X),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(/&/,"&"))})),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 c,d=e.languages[n];if(d)t.content=e.highlight((c=t.content,c.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}))),d,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 j=class extends H{constructor(t,n){super(),document.getElementById("edit").addEventListener("input",(n=>{let r=document.querySelector("#highlight-content");this.textEditor=t;let a=n.target.value;r.innerHTML=a.replace(new RegExp("&","g"),"&").replace(new RegExp("<","g"),"<");let i=document.getElementById("highlight").offsetHeight;document.getElementById("edit-post-wrapper").style.height=i+"px",n.target.style.height=i+30+"px",e(q).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 P: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 D:{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]:{};R(t)&&(n=t,t=null);var r=N(n),a=U(e,r);return t||0===t?a.setPos(t):a.getPosition()}(this.textEditor).pos,this.emitEvent(D);break;case"submit-save":case"edit-save":this.emitEvent(B);break;case"submit-update":case"edit-update":this.emitEvent(L);break;case"edit-delete":this.emitEvent(_)}document.getElementById("edit").dispatchEvent(new Event("input"))}},Y={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},W={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},$=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],z={CSS:{},springs:{}};function G(e,t,n){return Math.min(Math.max(e,t),n)}function Q(e,t){return e.indexOf(t)>-1}function V(e,t){return e.apply(null,t)}var J={arr:function(e){return Array.isArray(e)},obj:function(e){return Q(Object.prototype.toString.call(e),"Object")},pth:function(e){return J.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||J.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 J.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 J.hex(e)||J.rgb(e)||J.hsl(e)},key:function(e){return!Y.hasOwnProperty(e)&&!W.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function Z(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function K(e,t){var n=Z(e),r=G(J.und(n[0])?1:n[0],.1,100),a=G(J.und(n[1])?100:n[1],.1,100),i=G(J.und(n[2])?10:n[2],.1,100),o=G(J.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,c=l<1?(l*s-o)/u:-o+s;function d(e){var n=t?t*e/1e3:e;return n=l<1?Math.exp(-n*l*s)*(1*Math.cos(u*n)+c*Math.sin(u*n)):(1+c*n)*Math.exp(-n*s),0===e||1===e?e:1-n}return t?d:function(){var t=z.springs[e];if(t)return t;for(var n=1/6,r=0,a=0;;)if(1===d(r+=n)){if(++a>=16)break}else a=0;var i=r*n*1e3;return z.springs[e]=i,i}}function ee(e){return void 0===e&&(e=10),function(t){return Math.ceil(G(t,1e-6,1)*e)*(1/e)}}var te,ne,re=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,c=i(u,t,r);return c>=.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===c?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)}}}(),ae=(te={linear:function(){return function(e){return e}}},ne={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=G(e,1,10),r=G(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){ne[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(ne).forEach((function(e){var t=ne[e];te["easeIn"+e]=t,te["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},te["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}},te["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}}})),te);function ie(e,t){if(J.fnc(e))return e;var n=e.split("(")[0],r=ae[n],a=Z(e);switch(n){case"spring":return K(e,t);case"cubicBezier":return V(re,a);case"steps":return V(ee,a);default:return V(r,a)}}function oe(e){try{return document.querySelectorAll(e)}catch(e){return}}function se(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 le(e){return e.reduce((function(e,t){return e.concat(J.arr(t)?le(t):t)}),[])}function ue(e){return J.arr(e)?e:(J.str(e)&&(e=oe(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function ce(e,t){return e.some((function(e){return e===t}))}function de(e){var t={};for(var n in e)t[n]=e[n];return t}function ge(e,t){var n=de(e);for(var r in e)n[r]=t.hasOwnProperty(r)?t[r]:e[r];return n}function pe(e,t){var n=de(e);for(var r in t)n[r]=J.und(e[r])?t[r]:e[r];return n}function he(e){return J.rgb(e)?(n=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t=e))?"rgba("+n[1]+",1)":t:J.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):J.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 c=s<.5?s*(1+o):s+o-s*o,d=2*s-c;t=u(d,c,i+1/3),n=u(d,c,i),r=u(d,c,i-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function me(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 fe(e,t){return J.fnc(e)?e(t.target,t.id,t.total):e}function ve(e,t){return e.getAttribute(t)}function be(e,t,n){if(ce([n,"deg","rad","turn"],me(t)))return t;var r=z.CSS[t+n];if(!J.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 z.CSS[t+n]=s,s}function ye(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?be(e,a,n):a}}function Ee(e,t){return J.dom(e)&&!J.inp(e)&&(!J.nil(ve(e,t))||J.svg(e)&&e[t])?"attribute":J.dom(e)&&ce($,t)?"transform":J.dom(e)&&"transform"!==t&&ye(e,t)?"css":null!=e[t]?"object":void 0}function we(e){if(J.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 ke(e,t,n,r){var a=Q(t,"scale")?1:0+function(e){return Q(e,"translate")||"perspective"===e?"px":Q(e,"rotate")||Q(e,"skew")?"deg":void 0}(t),i=we(e).get(t)||a;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?be(e,i,r):i}function Ie(e,t,n,r){switch(Ee(e,t)){case"transform":return ke(e,t,r,n);case"css":return ye(e,t,n);case"attribute":return ve(e,t);default:return e[t]||0}}function Se(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=me(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 xe(e,t){if(J.col(e))return he(e);if(/\s/g.test(e))return e;var n=me(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function Pe(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Te(e){for(var t,n=e.points,r=0,a=0;a<n.numberOfItems;a++){var i=n.getItem(a);a>0&&(r+=Pe(t,i)),t=i}return r}function Ae(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*ve(e,"r")}(e);case"rect":return function(e){return 2*ve(e,"width")+2*ve(e,"height")}(e);case"line":return function(e){return Pe({x:ve(e,"x1"),y:ve(e,"y1")},{x:ve(e,"x2"),y:ve(e,"y2")})}(e);case"polyline":return Te(e);case"polygon":return function(e){var t=e.points;return Te(e)+Pe(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function _e(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;J.svg(t)&&J.svg(t.parentNode);)t=t.parentNode;return t}(e),a=r.getBoundingClientRect(),i=ve(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 De(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=_e(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 Be(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=xe(J.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:J.str(e)||t?r.split(n):[]}}function Le(e){return se(e?le(J.arr(e)?e.map(ue):ue(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Ce(e){var t=Le(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:we(e)}}}))}function Oe(e,t){var n=de(t);if(/^spring/.test(n.easing)&&(n.duration=K(n.easing)),J.arr(e)){var r=e.length;2===r&&!J.obj(e[0])?e={value:e}:J.fnc(t.duration)||(n.duration=t.duration/r)}var a=J.arr(e)?e:[e];return a.map((function(e,n){var r=J.obj(e)&&!J.pth(e)?e:{value:e};return J.und(r.delay)&&(r.delay=n?0:t.delay),J.und(r.endDelay)&&(r.endDelay=n===a.length-1?t.endDelay:0),r})).map((function(e){return pe(e,n)}))}function Me(e,t){var n=[],r=t.keyframes;for(var a in r&&(t=pe(function(e){for(var t=se(le(e.map((function(e){return Object.keys(e)}))),(function(e){return J.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)J.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)J.key(a)&&n.push({name:a,tweens:Oe(t[a],e)});return n}function Ne(e,t){var n;return e.tweens.map((function(r){var a=function(e,t){var n={};for(var r in e){var a=fe(e[r],t);J.arr(a)&&1===(a=a.map((function(e){return fe(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=J.arr(i)?i[1]:i,s=me(o),l=Ie(t.target,e.name,s,t),u=n?n.to.original:l,c=J.arr(i)?i[0]:u,d=me(c)||me(l),g=s||d;return J.und(o)&&(o=u),a.from=Be(c,g),a.to=Be(Se(o,c),g),a.start=n?n.end:0,a.end=a.start+a.delay+a.duration+a.endDelay,a.easing=ie(a.easing,a.duration),a.isPath=J.pth(i),a.isPathTargetInsideSVG=a.isPath&&J.svg(t.target),a.isColor=J.col(a.from.original),a.isColor&&(a.round=1),n=a,a}))}var Re={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 Fe(e,t){Ce(e).forEach((function(e){for(var n in t){var r=fe(t[n],e),a=e.target,i=me(r),o=Ie(a,n,i,e),s=Se(xe(r,i||me(o)),o),l=Ee(a,n);Re[l](a,n,s,e.transforms,!0)}}))}function Ue(e,t){return se(le(e.map((function(e){return t.map((function(t){return function(e,t){var n=Ee(e.target,t.name);if(n){var r=Ne(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!J.und(e)}))}function He(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 qe=0;var Xe=[],je=function(){var e;function t(n){for(var r=Xe.length,a=0;a<r;){var i=Xe[a];i.paused?(Xe.splice(a,1),r--):(i.tick(n),a++)}e=a>0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){We.suspendWhenDocumentHidden&&(Ye()?e=cancelAnimationFrame(e):(Xe.forEach((function(e){return e._onDocumentVisibility()})),je()))})),function(){e||Ye()&&We.suspendWhenDocumentHidden||!(Xe.length>0)||(e=requestAnimationFrame(t))}}();function Ye(){return!!document&&document.hidden}function We(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=ge(Y,e),n=ge(W,e),r=Me(n,e),a=Ce(e.targets),i=Ue(a,r),o=He(i,n),s=qe;return qe++,pe(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 c(e){return l.reversed?l.duration-e:e}function d(){n=0,r=c(l.currentTime)*(1/We.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=se(o,(function(t){return e<t.end}))[0]||u);for(var c=G(e-u.start-u.delay,0,u.duration)/u.duration,d=isNaN(c)?1:u.easing(c),g=u.to.strings,p=u.round,h=[],m=u.to.numbers.length,f=void 0,v=0;v<m;v++){var b=void 0,y=u.to.numbers[v],E=u.from.numbers[v]||0;b=u.isPath?De(u.value,d*y,u.isPathTargetInsideSVG):E+d*(y-E),p&&(u.isColor&&v>2||(b=Math.round(b*p)/p)),h.push(b)}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];Re[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 d=l.duration,m=l.delay,f=d-l.endDelay,v=c(e);l.progress=G(v/d*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!==d||!d)&&p(d),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=G(v,0,d),l.began&&h("update"),e>=d&&(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=d,l.set=function(e,t){return Fe(e,t),l},l.tick=function(e){a=e,n||(n=a),m((a+(r-n))*We.speed)},l.seek=function(e){m(c(e))},l.pause=function(){l.paused=!0,d()},l.play=function(){l.paused&&(l.completed&&l.reset(),l.paused=!1,Xe.push(l),d(),je())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){ze(Le(e),l)},l.reset(),l.autoplay&&l.play(),l}function $e(e,t){for(var n=t.length;n--;)ce(e,t[n].animatable.target)&&t.splice(n,1)}function ze(e,t){var n=t.animations,r=t.children;$e(e,n);for(var a=r.length;a--;){var i=r[a],o=i.animations;$e(e,o),o.length||i.children.length||r.splice(a,1)}n.length||r.length||t.pause()}We.version="3.2.1",We.speed=1,We.suspendWhenDocumentHidden=!0,We.running=Xe,We.remove=function(e){for(var t=Le(e),n=Xe.length;n--;){ze(t,Xe[n])}},We.get=Ie,We.set=Fe,We.convertPx=be,We.path=function(e,t){var n=J.str(e)?oe(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:_e(n),totalLength:Ae(n)*(r/100)}}},We.setDashoffset=function(e){var t=Ae(e);return e.setAttribute("stroke-dasharray",t),t},We.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?ie(t.easing):null,a=t.grid,i=t.axis,o=t.from||0,s="first"===o,l="center"===o,u="last"===o,c=J.arr(e),d=c?parseFloat(e[0]):parseFloat(e),g=c?parseFloat(e[1]):0,p=me(c?e[1]:e)||0,h=t.start||0+(c?d:0),m=[],f=0;return function(e,t,v){if(s&&(o=0),l&&(o=(v-1)/2),u&&(o=v-1),!m.length){for(var b=0;b<v;b++){if(a){var y=l?(a[0]-1)/2:o%a[0],E=l?(a[1]-1)/2:Math.floor(o/a[0]),w=y-b%a[0],k=E-Math.floor(b/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-b));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+(c?(g-d)/f:d)*(Math.round(100*m[t])/100)+p}},We.timeline=function(e){void 0===e&&(e={});var t=We(e);return t.duration=0,t.add=function(n,r){var a=Xe.indexOf(t),i=t.children;function o(e){e.passThrough=!0}a>-1&&Xe.splice(a,1);for(var s=0;s<i.length;s++)o(i[s]);var l=pe(n,ge(W,e));l.targets=l.targets||e.targets;var u=t.duration;l.autoplay=!1,l.direction=t.direction,l.timelineOffset=J.und(r)?u:Se(r,u),o(t),t.seek(l.timelineOffset);var c=We(l);o(c),i.push(c);var d=He(i,e);return t.delay=d.delay,t.endDelay=d.endDelay,t.duration=d.duration,t.seek(0),t.reset(),t.autoplay&&t.play(),t},t},We.easing=ie,We.penner=ae,We.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e};var Ge=We;const Qe=document.getElementById("notifications"),Ve=document.getElementById("notifyMessage"),Je=document.getElementById("message-text"),Ze=document.getElementById("notify-text"),Ke=document.getElementById("notify-progress"),et=document.getElementById("notify-good"),tt=document.getElementById("notify-lame"),nt=document.getElementById("notify-working");class rt{constructor(){}alert(e,t){nt.style.display="none",et.style.display="none",tt.style.display="none";var n="";null!==t?(Ge({targets:Ke,opacity:0,easing:"easeInOutQuint",duration:500}),t?(n="#32cd32",nt.style.display="none",et.style.display="block"):(n="#F64747",nt.style.display="none",tt.style.display="block")):(n="#200317",nt.style.display="block",Ge({targets:Ke,opacity:1,easing:"easeInOutQuint",duration:500})),Je.innerHTML=e,Ge({targets:Qe,marginTop:"-10",easing:"easeInOutQuint",duration:10,complete:()=>{Ge({targets:Ve,rotateX:"0",easing:"easeInOutQuint",duration:700}),Ge({targets:Ze,backgroundColor:n,easing:"easeInOutQuint",duration:700,complete:()=>{setTimeout((()=>{null!==t&&Ge({targets:Ve,rotateX:"-120",easing:"easeInOutQuint",duration:700,complete:()=>{Ge({targets:Qe,marginTop:"-55",easing:"easeInOutQuint",delay:700,duration:50})}})}),1e3)}})}})}}
|
|
/**!
|
|
* Sortable 1.14.0
|
|
* @author RubaXa <trash@rubaxa.org>
|
|
* @author owenm <owen23355@gmail.com>
|
|
* @license MIT
|
|
*/function at(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 it(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?at(Object(n),!0).forEach((function(t){st(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):at(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ot(e){return(ot="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 st(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lt(){return lt=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},lt.apply(this,arguments)}function ut(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 ct(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var dt=ct(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),gt=ct(/Edge/i),pt=ct(/firefox/i),ht=ct(/safari/i)&&!ct(/chrome/i)&&!ct(/android/i),mt=ct(/iP(ad|od|hone)/i),ft=ct(/chrome/i)&&ct(/android/i),vt={capture:!1,passive:!1};function bt(e,t,n){e.addEventListener(t,n,!dt&&vt)}function yt(e,t,n){e.removeEventListener(t,n,!dt&&vt)}function Et(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 wt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function kt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Et(e,t):Et(e,t))||r&&e===n)return e;if(e===n)break}while(e=wt(e))}return null}var It,St=/\s+/g;function xt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(St," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(St," ")}}function Pt(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 Tt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Pt(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 At(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 _t(){var e=document.scrollingElement;return e||document.documentElement}function Dt(e,t,n,r,a){if(e.getBoundingClientRect||e===window){var i,o,s,l,u,c,d;if(e!==window&&e.parentNode&&e!==_t()?(o=(i=e.getBoundingClientRect()).top,s=i.left,l=i.bottom,u=i.right,c=i.height,d=i.width):(o=0,s=0,l=window.innerHeight,u=window.innerWidth,c=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(a=a||e.parentNode,!dt))do{if(a&&a.getBoundingClientRect&&("none"!==Pt(a,"transform")||n&&"static"!==Pt(a,"position"))){var g=a.getBoundingClientRect();o-=g.top+parseInt(Pt(a,"border-top-width")),s-=g.left+parseInt(Pt(a,"border-left-width")),l=o+i.height,u=s+i.width;break}}while(a=a.parentNode);if(r&&e!==window){var p=Tt(a||e),h=p&&p.a,m=p&&p.d;p&&(l=(o/=m)+(c/=m),u=(s/=h)+(d/=h))}return{top:o,left:s,bottom:l,right:u,width:d,height:c}}}function Bt(e,t,n){for(var r=Nt(e,!0),a=Dt(e)[t];r;){var i=Dt(r)[n];if(!("top"===n||"left"===n?a>=i:a<=i))return r;if(r===_t())break;r=Nt(r,!1)}return!1}function Lt(e,t,n,r){for(var a=0,i=0,o=e.children;i<o.length;){if("none"!==o[i].style.display&&o[i]!==qn.ghost&&(r||o[i]!==qn.dragged)&&kt(o[i],n.draggable,e,!1)){if(a===t)return o[i];a++}i++}return null}function Ct(e,t){for(var n=e.lastElementChild;n&&(n===qn.ghost||"none"===Pt(n,"display")||t&&!Et(n,t));)n=n.previousElementSibling;return n||null}function Ot(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===qn.clone||t&&!Et(e,t)||n++;return n}function Mt(e){var t=0,n=0,r=_t();if(e)do{var a=Tt(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 Nt(e,t){if(!e||!e.getBoundingClientRect)return _t();var n=e,r=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var a=Pt(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 _t();if(r||t)return n;r=!0}}}while(n=n.parentNode);return _t()}function Rt(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 Ft(e,t){return function(){if(!It){var n=arguments,r=this;1===n.length?e.call(r,n[0]):e.apply(r,n),It=setTimeout((function(){It=void 0}),t)}}}function Ut(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function Ht(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 qt="Sortable"+(new Date).getTime();function Xt(){var e,t=[];return{captureAnimationState:function(){(t=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(e){if("none"!==Pt(e,"display")&&e!==qn.ghost){t.push({target:e,rect:Dt(e)});var n=it({},t[t.length-1].rect);if(e.thisAnimationDuration){var r=Tt(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=Dt(n),l=n.prevFromRect,u=n.prevToRect,c=e.rect,d=Tt(n,!0);d&&(s.top-=d.f,s.left-=d.e),n.toRect=s,n.thisAnimationDuration&&Rt(l,s)&&!Rt(o,s)&&(c.top-s.top)/(c.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}(c,l,u,r.options)),Rt(s,o)||(n.prevFromRect=o,n.prevToRect=s,t||(t=r.options.animation),r.animate(n,c,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){Pt(e,"transition",""),Pt(e,"transform","");var a=Tt(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,Pt(e,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),Pt(e,"transition","transform "+r+"ms"+(this.options.easing?" "+this.options.easing:"")),Pt(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){Pt(e,"transition",""),Pt(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),r)}}}}var jt=[],Yt={initializeByDefault:!0},Wt={mount:function(e){for(var t in Yt)Yt.hasOwnProperty(t)&&!(t in e)&&(e[t]=Yt[t]);jt.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),jt.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var a=e+"Global";jt.forEach((function(r){t[r.pluginName]&&(t[r.pluginName][a]&&t[r.pluginName][a](it({sortable:t},n)),t.options[r.pluginName]&&t[r.pluginName][e]&&t[r.pluginName][e](it({sortable:t},n)))}))},initializePlugins:function(e,t,n,r){for(var a in jt.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,lt(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 jt.forEach((function(r){"function"==typeof r.eventProperties&<(n,r.eventProperties.call(t[r.pluginName],e))})),n},modifyOption:function(e,t,n){var r;return jt.forEach((function(a){e[a.pluginName]&&a.optionListeners&&"function"==typeof a.optionListeners[t]&&(r=a.optionListeners[t].call(e[a.pluginName],n))})),r}};function $t(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,c=e.oldDraggableIndex,d=e.newDraggableIndex,g=e.originalEvent,p=e.putSortable,h=e.extraEventProperties;if(t=t||n&&n[qt]){var m,f=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||dt||gt?(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=c,m.newDraggableIndex=d,m.originalEvent=g,m.pullMode=p?p.lastPutMode:void 0;var b=it(it({},h),Wt.getEventProperties(r,t));for(var y in b)m[y]=b[y];n&&n.dispatchEvent(m),f[v]&&f[v].call(t,m)}}var zt=["evt"],Gt=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,a=ut(n,zt);Wt.pluginEvent.bind(qn)(e,t,it({dragEl:Vt,parentEl:Jt,ghostEl:Zt,rootEl:Kt,nextEl:en,lastDownEl:tn,cloneEl:nn,cloneHidden:rn,dragStarted:vn,putSortable:cn,activeSortable:qn.active,originalEvent:r,oldIndex:an,oldDraggableIndex:sn,newIndex:on,newDraggableIndex:ln,hideGhostForTarget:Rn,unhideGhostForTarget:Fn,cloneNowHidden:function(){rn=!0},cloneNowShown:function(){rn=!1},dispatchSortableEvent:function(e){Qt({sortable:t,name:e,originalEvent:r})}},a))};function Qt(e){$t(it({putSortable:cn,cloneEl:nn,targetEl:Vt,rootEl:Kt,oldIndex:an,oldDraggableIndex:sn,newIndex:on,newDraggableIndex:ln},e))}var Vt,Jt,Zt,Kt,en,tn,nn,rn,an,on,sn,ln,un,cn,dn,gn,pn,hn,mn,fn,vn,bn,yn,En,wn,kn=!1,In=!1,Sn=[],xn=!1,Pn=!1,Tn=[],An=!1,_n=[],Dn="undefined"!=typeof document,Bn=mt,Ln=gt||dt?"cssFloat":"float",Cn=Dn&&!ft&&!mt&&"draggable"in document.createElement("div"),On=function(){if(Dn){if(dt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Mn=function(e,t){var n=Pt(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),a=Lt(e,0,t),i=Lt(e,1,t),o=a&&Pt(a),s=i&&Pt(i),l=o&&parseInt(o.marginLeft)+parseInt(o.marginRight)+Dt(a).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Dt(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 c="left"===o.float?"left":"right";return!i||"both"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return a&&("block"===o.display||"flex"===o.display||"table"===o.display||"grid"===o.display||l>=r&&"none"===n[Ln]||i&&"none"===n[Ln]&&l+u>r)?"vertical":"horizontal"},Nn=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"==ot(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},Rn=function(){!On&&Zt&&Pt(Zt,"display","none")},Fn=function(){!On&&Zt&&Pt(Zt,"display","")};Dn&&document.addEventListener("click",(function(e){if(In)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),In=!1,!1}),!0);var Un=function(e){if(Vt){e=e.touches?e.touches[0]:e;var t=(a=e.clientX,i=e.clientY,Sn.some((function(e){var t=e[qt].options.emptyInsertThreshold;if(t&&!Ct(e)){var n=Dt(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[qt]._onDragOver(n)}}var a,i,o},Hn=function(e){Vt&&Vt.parentNode[qt]._isOutsideThisEl(e.target)};function qn(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=lt({},t),e[qt]=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 Mn(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!==qn.supportPointer&&"PointerEvent"in window&&!ht,emptyInsertThreshold:5};for(var r in Wt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var a in Nn(t),this)"_"===a.charAt(0)&&"function"==typeof this[a]&&(this[a]=this[a].bind(this));this.nativeDraggable=!t.forceFallback&&Cn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?bt(e,"pointerdown",this._onTapStart):(bt(e,"mousedown",this._onTapStart),bt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(bt(e,"dragover",this),bt(e,"dragenter",this)),Sn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),lt(this,Xt())}function Xn(e,t,n,r,a,i,o,s){var l,u,c=e[qt],d=c.options.onMove;return!window.CustomEvent||dt||gt?(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||Dt(t),l.willInsertAfter=s,l.originalEvent=o,e.dispatchEvent(l),d&&(u=d.call(c,l,o)),u}function jn(e){e.draggable=!1}function Yn(){An=!1}function Wn(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 $n(e){return setTimeout(e,0)}function zn(e){return clearTimeout(e)}qn.prototype={constructor:qn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(bn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Vt):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){_n.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&_n.push(r)}}(n),!Vt&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!ht||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=kt(s,r.draggable,n,!1))&&s.animated||tn===s)){if(an=Ot(s),sn=Ot(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Qt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Gt("filter",t,{evt:e}),void(a&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=kt(l,r.trim(),n,!1))return Qt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Gt("filter",t,{evt:e}),!0}))))return void(a&&e.cancelable&&e.preventDefault());r.handle&&!kt(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&&!Vt&&n.parentNode===i){var l=Dt(n);if(Kt=i,Jt=(Vt=n).parentNode,en=Vt.nextSibling,tn=n,un=o.group,qn.dragged=Vt,dn={target:Vt,clientX:(t||e).clientX,clientY:(t||e).clientY},mn=dn.clientX-l.left,fn=dn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Vt.style["will-change"]="all",r=function(){Gt("delayEnded",a,{evt:e}),qn.eventCanceled?a._onDrop():(a._disableDelayedDragEvents(),!pt&&a.nativeDraggable&&(Vt.draggable=!0),a._triggerDragStart(e,t),Qt({sortable:a,name:"choose",originalEvent:e}),xt(Vt,o.chosenClass,!0))},o.ignore.split(",").forEach((function(e){At(Vt,e.trim(),jn)})),bt(s,"dragover",Un),bt(s,"mousemove",Un),bt(s,"touchmove",Un),bt(s,"mouseup",a._onDrop),bt(s,"touchend",a._onDrop),bt(s,"touchcancel",a._onDrop),pt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Vt.draggable=!0),Gt("delayStart",this,{evt:e}),!o.delay||o.delayOnTouchOnly&&!t||this.nativeDraggable&&(gt||dt))r();else{if(qn.eventCanceled)return void this._onDrop();bt(s,"mouseup",a._disableDelayedDrag),bt(s,"touchend",a._disableDelayedDrag),bt(s,"touchcancel",a._disableDelayedDrag),bt(s,"mousemove",a._delayedDragTouchMoveHandler),bt(s,"touchmove",a._delayedDragTouchMoveHandler),o.supportPointer&&bt(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(){Vt&&jn(Vt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;yt(e,"mouseup",this._disableDelayedDrag),yt(e,"touchend",this._disableDelayedDrag),yt(e,"touchcancel",this._disableDelayedDrag),yt(e,"mousemove",this._delayedDragTouchMoveHandler),yt(e,"touchmove",this._delayedDragTouchMoveHandler),yt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?bt(document,"pointermove",this._onTouchMove):bt(document,t?"touchmove":"mousemove",this._onTouchMove):(bt(Vt,"dragend",this),bt(Kt,"dragstart",this._onDragStart));try{document.selection?$n((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(kn=!1,Kt&&Vt){Gt("dragStarted",this,{evt:t}),this.nativeDraggable&&bt(document,"dragover",Hn);var n=this.options;!e&&xt(Vt,n.dragClass,!1),xt(Vt,n.ghostClass,!0),qn.active=this,e&&this._appendGhost(),Qt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(gn){this._lastX=gn.clientX,this._lastY=gn.clientY,Rn();for(var e=document.elementFromPoint(gn.clientX,gn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(gn.clientX,gn.clientY))!==t;)t=e;if(Vt.parentNode[qt]._isOutsideThisEl(e),t)do{if(t[qt]){if(t[qt]._onDragOver({clientX:gn.clientX,clientY:gn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Fn()}},_onTouchMove:function(e){if(dn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,a=e.touches?e.touches[0]:e,i=Zt&&Tt(Zt,!0),o=Zt&&i&&i.a,s=Zt&&i&&i.d,l=Bn&&wn&&Mt(wn),u=(a.clientX-dn.clientX+r.x)/(o||1)+(l?l[0]-Tn[0]:0)/(o||1),c=(a.clientY-dn.clientY+r.y)/(s||1)+(l?l[1]-Tn[1]:0)/(s||1);if(!qn.active&&!kn){if(n&&Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(Zt){i?(i.e+=u-(pn||0),i.f+=c-(hn||0)):i={a:1,b:0,c:0,d:1,e:u,f:c};var d="matrix(".concat(i.a,",").concat(i.b,",").concat(i.c,",").concat(i.d,",").concat(i.e,",").concat(i.f,")");Pt(Zt,"webkitTransform",d),Pt(Zt,"mozTransform",d),Pt(Zt,"msTransform",d),Pt(Zt,"transform",d),pn=u,hn=c,gn=a}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!Zt){var e=this.options.fallbackOnBody?document.body:Kt,t=Dt(Vt,!0,Bn,!0,e),n=this.options;if(Bn){for(wn=e;"static"===Pt(wn,"position")&&"none"===Pt(wn,"transform")&&wn!==document;)wn=wn.parentNode;wn!==document.body&&wn!==document.documentElement?(wn===document&&(wn=_t()),t.top+=wn.scrollTop,t.left+=wn.scrollLeft):wn=_t(),Tn=Mt(wn)}xt(Zt=Vt.cloneNode(!0),n.ghostClass,!1),xt(Zt,n.fallbackClass,!0),xt(Zt,n.dragClass,!0),Pt(Zt,"transition",""),Pt(Zt,"transform",""),Pt(Zt,"box-sizing","border-box"),Pt(Zt,"margin",0),Pt(Zt,"top",t.top),Pt(Zt,"left",t.left),Pt(Zt,"width",t.width),Pt(Zt,"height",t.height),Pt(Zt,"opacity","0.8"),Pt(Zt,"position",Bn?"absolute":"fixed"),Pt(Zt,"zIndex","100000"),Pt(Zt,"pointerEvents","none"),qn.ghost=Zt,e.appendChild(Zt),Pt(Zt,"transform-origin",mn/parseInt(Zt.style.width)*100+"% "+fn/parseInt(Zt.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,r=e.dataTransfer,a=n.options;Gt("dragStart",this,{evt:e}),qn.eventCanceled?this._onDrop():(Gt("setupClone",this),qn.eventCanceled||((nn=Ht(Vt)).draggable=!1,nn.style["will-change"]="",this._hideClone(),xt(nn,this.options.chosenClass,!1),qn.clone=nn),n.cloneId=$n((function(){Gt("clone",n),qn.eventCanceled||(n.options.removeCloneOnHide||Kt.insertBefore(nn,Vt),n._hideClone(),Qt({sortable:n,name:"clone"}))})),!t&&xt(Vt,a.dragClass,!0),t?(In=!0,n._loopId=setInterval(n._emulateDragOver,50)):(yt(document,"mouseup",n._onDrop),yt(document,"touchend",n._onDrop),yt(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",a.setData&&a.setData.call(n,r,Vt)),bt(document,"drop",n),Pt(Vt,"transform","translateZ(0)")),kn=!0,n._dragStartId=$n(n._dragStarted.bind(n,t,e)),bt(document,"selectstart",n),vn=!0,ht&&Pt(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=qn.active,c=un===l,d=s.sort,g=cn||u,p=this,h=!1;if(!An){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),o=kt(o,s.draggable,i,!0),_("dragOver"),qn.eventCanceled)return h;if(Vt.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||p._ignoreWhileAnimating===o)return B(!1);if(In=!1,u&&!s.disabled&&(c?d||(r=Jt!==Kt):cn===this||(this.lastPutMode=un.checkPull(this,u,Vt,e))&&l.checkPut(this,u,Vt,e))){if(a="vertical"===this._getDirection(e,o),t=Dt(Vt),_("dragOverValid"),qn.eventCanceled)return h;if(r)return Jt=Kt,D(),this._hideClone(),_("revert"),qn.eventCanceled||(en?Kt.insertBefore(Vt,en):Kt.appendChild(Vt)),B(!0);var m=Ct(i,s.draggable);if(!m||function(e,t,n){var r=Dt(Ct(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===Vt)return B(!1);if(m&&i===e.target&&(o=m),o&&(n=Dt(o)),!1!==Xn(Kt,i,Vt,t,o,n,e,!!o))return D(),i.appendChild(Vt),Jt=i,L(),B(!0)}else if(m&&function(e,t,n){var r=Dt(Lt(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=Lt(i,0,s,!0);if(f===Vt)return B(!1);if(n=Dt(o=f),!1!==Xn(Kt,i,Vt,t,o,n,e,!1))return D(),i.insertBefore(Vt,f),Jt=i,L(),B(!0)}else if(o.parentNode===i){n=Dt(o);var v,b,y,E=Vt.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}(Vt.animated&&Vt.toRect||t,o.animated&&o.toRect||n,a),k=a?"top":"left",I=Bt(o,"top","top")||Bt(Vt,"top","top"),S=I?I.scrollTop:void 0;if(bn!==o&&(b=n[k],xn=!1,Pn=!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,c=r?n.top:n.left,d=r?n.bottom:n.right,g=!1;if(!o)if(s&&En<u*a){if(!xn&&(1===yn?l>c+u*i/2:l<d-u*i/2)&&(xn=!0),xn)g=!0;else if(1===yn?l<c+En:l>d-En)return-yn}else if(l>c+u*(1-a)/2&&l<d-u*(1-a)/2)return function(e){return Ot(Vt)<Ot(e)?1:-1}(t);if((g=g||o)&&(l<c+u*i/2||l>d-u*i/2))return l>c+u/2?1:-1;return 0}(e,o,n,a,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Pn,bn===o),0!==v){var x=Ot(Vt);do{x-=v,y=Jt.children[x]}while(y&&("none"===Pt(y,"display")||y===Zt))}if(0===v||y===o)return B(!1);bn=o,yn=v;var P=o.nextElementSibling,T=!1,A=Xn(Kt,i,Vt,t,o,n,e,T=1===v);if(!1!==A)return 1!==A&&-1!==A||(T=1===A),An=!0,setTimeout(Yn,30),D(),T&&!P?i.appendChild(Vt):o.parentNode.insertBefore(Vt,T?P:o),I&&Ut(I,0,S-I.scrollTop),Jt=Vt.parentNode,void 0===b||Pn||(En=Math.abs(b-Dt(o)[k])),L(),B(!0)}if(i.contains(Vt))return B(!1)}return!1}function _(s,l){Gt(s,p,it({evt:e,isOwner:c,axis:a?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:g,target:o,completed:B,onMove:function(n,r){return Xn(Kt,i,Vt,t,n,Dt(n),e,r)},changed:L},l))}function D(){_("dragOverAnimationCapture"),p.captureAnimationState(),p!==g&&g.captureAnimationState()}function B(t){return _("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(p),p!==g&&(xt(Vt,cn?cn.options.ghostClass:u.options.ghostClass,!1),xt(Vt,s.ghostClass,!0)),cn!==p&&p!==qn.active?cn=p:p===qn.active&&cn&&(cn=null),g===p&&(p._ignoreWhileAnimating=o),p.animateAll((function(){_("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==g&&(g.animateAll(),g._ignoreWhileAnimating=null)),(o===Vt&&!Vt.animated||o===i&&!o.animated)&&(bn=null),s.dragoverBubble||e.rootEl||o===document||(Vt.parentNode[qt]._isOutsideThisEl(e.target),!t&&Un(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),h=!0}function L(){on=Ot(Vt),ln=Ot(Vt,s.draggable),Qt({sortable:p,name:"change",toEl:i,newIndex:on,newDraggableIndex:ln,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){yt(document,"mousemove",this._onTouchMove),yt(document,"touchmove",this._onTouchMove),yt(document,"pointermove",this._onTouchMove),yt(document,"dragover",Un),yt(document,"mousemove",Un),yt(document,"touchmove",Un)},_offUpEvents:function(){var e=this.el.ownerDocument;yt(e,"mouseup",this._onDrop),yt(e,"touchend",this._onDrop),yt(e,"pointerup",this._onDrop),yt(e,"touchcancel",this._onDrop),yt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;on=Ot(Vt),ln=Ot(Vt,n.draggable),Gt("drop",this,{evt:e}),Jt=Vt&&Vt.parentNode,on=Ot(Vt),ln=Ot(Vt,n.draggable),qn.eventCanceled||(kn=!1,Pn=!1,xn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),zn(this.cloneId),zn(this._dragStartId),this.nativeDraggable&&(yt(document,"drop",this),yt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ht&&Pt(document.body,"user-select",""),Pt(Vt,"transform",""),e&&(vn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),Zt&&Zt.parentNode&&Zt.parentNode.removeChild(Zt),(Kt===Jt||cn&&"clone"!==cn.lastPutMode)&&nn&&nn.parentNode&&nn.parentNode.removeChild(nn),Vt&&(this.nativeDraggable&&yt(Vt,"dragend",this),jn(Vt),Vt.style["will-change"]="",vn&&!kn&&xt(Vt,cn?cn.options.ghostClass:this.options.ghostClass,!1),xt(Vt,this.options.chosenClass,!1),Qt({sortable:this,name:"unchoose",toEl:Jt,newIndex:null,newDraggableIndex:null,originalEvent:e}),Kt!==Jt?(on>=0&&(Qt({rootEl:Jt,name:"add",toEl:Jt,fromEl:Kt,originalEvent:e}),Qt({sortable:this,name:"remove",toEl:Jt,originalEvent:e}),Qt({rootEl:Jt,name:"sort",toEl:Jt,fromEl:Kt,originalEvent:e}),Qt({sortable:this,name:"sort",toEl:Jt,originalEvent:e})),cn&&cn.save()):on!==an&&on>=0&&(Qt({sortable:this,name:"update",toEl:Jt,originalEvent:e}),Qt({sortable:this,name:"sort",toEl:Jt,originalEvent:e})),qn.active&&(null!=on&&-1!==on||(on=an,ln=sn),Qt({sortable:this,name:"end",toEl:Jt,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Gt("nulling",this),Kt=Vt=Jt=Zt=en=nn=tn=rn=dn=gn=vn=on=ln=an=sn=bn=yn=cn=un=qn.dragged=qn.ghost=qn.clone=qn.active=null,_n.forEach((function(e){e.checked=!0})),_n.length=pn=hn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Vt&&(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++)kt(e=n[r],i.draggable,this.el,!1)&&t.push(e.getAttribute(i.dataIdAttr)||Wn(e));return t},sort:function(e,t){var n={},r=this.el;this.toArray().forEach((function(e,t){var a=r.children[t];kt(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 kt(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=Wt.modifyOption(this,e,t);n[e]=void 0!==r?r:t,"group"===e&&Nn(n)},destroy:function(){Gt("destroy",this);var e=this.el;e[qt]=null,yt(e,"mousedown",this._onTapStart),yt(e,"touchstart",this._onTapStart),yt(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(yt(e,"dragover",this),yt(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),Sn.splice(Sn.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!rn){if(Gt("hideClone",this),qn.eventCanceled)return;Pt(nn,"display","none"),this.options.removeCloneOnHide&&nn.parentNode&&nn.parentNode.removeChild(nn),rn=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(rn){if(Gt("showClone",this),qn.eventCanceled)return;Vt.parentNode!=Kt||this.options.group.revertClone?en?Kt.insertBefore(nn,en):Kt.appendChild(nn):Kt.insertBefore(nn,Vt),this.options.group.revertClone&&this.animate(Vt,nn),Pt(nn,"display",""),rn=!1}}else this._hideClone()}},Dn&&bt(document,"touchmove",(function(e){(qn.active||kn)&&e.cancelable&&e.preventDefault()})),qn.utils={on:bt,off:yt,css:Pt,find:At,is:function(e,t){return!!kt(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:Ft,closest:kt,toggleClass:xt,clone:Ht,index:Ot,nextTick:$n,cancelNextTick:zn,detectDirection:Mn,getChild:Lt},qn.get=function(e){return e[qt]},qn.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&&(qn.utils=it(it({},qn.utils),e.utils)),Wt.mount(e)}))},qn.create=function(e,t){return new qn(e,t)},qn.version="1.14.0";var Gn,Qn,Vn,Jn,Zn,Kn,er=[],tr=!1;function nr(){er.forEach((function(e){clearInterval(e.pid)})),er=[]}function rr(){clearInterval(Kn)}var ar=Ft((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=_t(),c=!1;Qn!==n&&(Qn=n,nr(),Gn=t.scroll,a=t.scrollFn,!0===Gn&&(Gn=Nt(n,!0)));var d=0,g=Gn;do{var p=g,h=Dt(p),m=h.top,f=h.bottom,v=h.left,b=h.right,y=h.width,E=h.height,w=void 0,k=void 0,I=p.scrollWidth,S=p.scrollHeight,x=Pt(p),P=p.scrollLeft,T=p.scrollTop;p===u?(w=y<I&&("auto"===x.overflowX||"scroll"===x.overflowX||"visible"===x.overflowX),k=E<S&&("auto"===x.overflowY||"scroll"===x.overflowY||"visible"===x.overflowY)):(w=y<I&&("auto"===x.overflowX||"scroll"===x.overflowX),k=E<S&&("auto"===x.overflowY||"scroll"===x.overflowY));var A=w&&(Math.abs(b-i)<=s&&P+y<I)-(Math.abs(v-i)<=s&&!!P),_=k&&(Math.abs(f-o)<=s&&T+E<S)-(Math.abs(m-o)<=s&&!!T);if(!er[d])for(var D=0;D<=d;D++)er[D]||(er[D]={});er[d].vx==A&&er[d].vy==_&&er[d].el===p||(er[d].el=p,er[d].vx=A,er[d].vy=_,clearInterval(er[d].pid),0==A&&0==_||(c=!0,er[d].pid=setInterval(function(){r&&0===this.layer&&qn.active._onTouchMove(Zn);var t=er[this.layer].vy?er[this.layer].vy*l:0,n=er[this.layer].vx?er[this.layer].vx*l:0;"function"==typeof a&&"continue"!==a.call(qn.dragged.parentNode[qt],n,t,e,Zn,er[this.layer].el)||Ut(er[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&g!==u&&(g=Nt(g,!1)));tr=c}}),30),ir=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,c=document.elementFromPoint(u.clientX,u.clientY);s(),l&&!l.el.contains(c)&&(i("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function or(){}function sr(){}or.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=Lt(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:ir},lt(or,{pluginName:"revertOnSpill"}),sr.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:ir},lt(sr,{pluginName:"removeOnSpill"});qn.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?bt(document,"dragover",this._handleAutoScroll):this.options.supportPointer?bt(document,"pointermove",this._handleFallbackAutoScroll):t.touches?bt(document,"touchmove",this._handleFallbackAutoScroll):bt(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?yt(document,"dragover",this._handleAutoScroll):(yt(document,"pointermove",this._handleFallbackAutoScroll),yt(document,"touchmove",this._handleFallbackAutoScroll),yt(document,"mousemove",this._handleFallbackAutoScroll)),rr(),nr(),clearTimeout(It),It=void 0},nulling:function(){Zn=Qn=Gn=tr=Kn=Vn=Jn=null,er.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(Zn=e,t||this.options.forceAutoScrollFallback||gt||dt||ht){ar(e,this.options,i,t);var o=Nt(i,!0);!tr||Kn&&r===Vn&&a===Jn||(Kn&&rr(),Kn=setInterval((function(){var i=Nt(document.elementFromPoint(r,a),!0);i!==o&&(o=i,nr()),ar(e,n.options,i,t)}),10),Vn=r,Jn=a)}else{if(!this.options.bubbleScroll||Nt(i,!0)===_t())return void nr();ar(e,this.options,Nt(i,!1),!1)}}},lt(e,{pluginName:"scroll",initializeByDefault:!0})}),qn.mount(sr,or);var lr=qn;const ur=new rt;class cr{constructor(e,t,n,r){this.upload=e,this.input=t,this.imageList=n,this.fileList=r,this.accetableFiles=["image/jpeg","image/gif","image/png","image/svg","audio/mpeg","video/mp4","application/pdf","text/plain","text/rtf"],this.files=[],this.sortedFiles=[],this.storage=[],this.start()}start(){this.upload.addEventListener("dragover",(e=>this.handleFileActions(e)),!1),this.upload.addEventListener("drop",(e=>this.handleFileActions(e)),!1),this.input.addEventListener("change",(e=>this.handleFileActions(e)),!1),lr.create(this.imageList,{onUpdate:e=>{ur.alert("REINDEXING FILES",null);let t=[],n=e.target.children;for(let e=0;e<n.length;e++){var r=n[e];let a="";a="img-item"==r.className?r.style.backgroundImage.slice(4,-1).replace(/"/g,""):r.getAttribute("data-source"),t.push({earl:a})}this.reindexFiles(t,0)}}),lr.create(this.fileList,{onUpdate:e=>{ur.alert("REINDEXING FILES",null);let t=[],n=e.target.children;for(let e=0;e<n.length;e++){let r=n[e].getAttribute("data-source");t.push({earl:r})}this.reindexFiles(t,0)}})}getFiles(){return this.files}reindexFiles(e,t){let n=e.length;0==t&&(this.files=[]);var r=new S,a=e[t].earl.split("/");r.imgLoad(e[t].earl).then((r=>{var i=new File([r],a[6],{type:r.type});this.files.push(i),this.files.length<=n-1?this.reindexFiles(e,++t):ur.alert("FILES READY TO UPLOAD",!0)}))}sortFiles(e){var t=this;this.files=[],this.imageList.innerHTML="",this.fileList.innerHTML="";for(var n,r=0;n=e[r];r++){var a=new FileReader;a.onload=(e=>function(n){switch(e.type){case"image/jpg":case"image/jpeg":case"image/gif":case"image/svg":case"image/png":var a=document.createElement("img");a.src=n.target.result,a.title=escape(e.name);var i=document.createElement("div");i.style.background="url("+n.target.result+") no-repeat center center / cover",i.className="img-item",a.setAttribute("id",r),t.storage.push([{id:"page_image"+r,data:n.target.result,type:e.type,name:escape(e.name)}]),t.imageList.appendChild(i),t.files.push(e);break;case"video/mp4":var o=document.createElement("div");o.className="video-item",o.setAttribute("data-source",n.target.result),t.imageList.appendChild(o),t.files.push(e);break;case"audio/mpeg":var s=document.createElement("div");s.className="audio-item",s.setAttribute("data-source",n.target.result),t.fileList.appendChild(s),t.files.push(e);break;case"application/pdf":case"text/plain":case"text/rtf":var l=document.createElement("div");l.className="file-item",l.setAttribute("data-source",n.target.result),t.fileList.appendChild(l),t.files.push(e)}})(n),a.readAsDataURL(n)}}handleFileActions(e){e.stopPropagation(),e.preventDefault();let t=this,n=[],r=[],a=[];switch(e.type){case"dragover":e.dataTransfer.dropEffect="copy";break;case"change":case"drop":n="drop"==e.type?e.dataTransfer.files:e.target.files;for(var i,o=0;i=n[o];o++)this.accetableFiles.includes(i.type)?r.push(i):a.push(i);t.sortFiles(r)}}}const dr=new rt;class gr{constructor(){this.processing=!1;this.admin=new v(null,document.getElementById("notify-progress")),this.mm=new I(null,null,document.getElementById("notify-progress")),this.urlPieces=document.URL.split("/"),this.post=[],this.postID=null,this.postUUID=null,this.postLayout=null,this.fm=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 j(document.getElementById("edit"),document.getElementById("header").offsetHeight+document.getElementById("post-header").offsetHeight+document.getElementById("post-feature").offsetHeight),this.editor.addListener(_,(()=>this.handleEditorOptions(_)),!1),this.editor.addListener(D,(()=>this.handleEditorOptions(D)),!1),this.editor.addListener(L,(()=>this.handleEditorOptions(L)),!1),this.editor.addListener(B,(()=>this.handleEditorOptions(B)),!1),document.getElementById("post-image-upload").addEventListener("change",(e=>{"this".handleImageUpload(e.target.id,e.target.files)}),!1),this.start())}start(){if(document.getElementById("page-file-drop")){this.fm=new cr(document.getElementById("page-file-drop"),document.getElementById("page-files-upload"),document.getElementById("page-images-list"),document.getElementById("page-files-list"));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 B:case L:var n="";n=e===B?d:g,(new A).collectInfo(this.fm.getFiles()).then((e=>{t.processing=!0,dr.alert("Writing down changes",null),t.admin.pageActions(n,e).then((e=>{t.processing=!1,"postError"===e.type||"apiUseNotAuthorized"===e.type?dr.alert(e.message,!1):e.type===P?dr.alert(e.message,!0):(dr.alert(e.message,!0),window.location="/dashboard/page/edit/"+e.id)})).catch((e=>{t.processing=!1,dr.alert(e,!1)}))}));break;case _:if("index"===this.postLayout)return void dr.alert("Index cannot be deleted",!1);confirm("AYE! You know you're deleting this post, right?")&&(new A).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,dr.alert(e,!1)}))})).catch((()=>{}));break;case D:document.getElementById("post-image-upload").click()}}handleImageUpload(e,t){let n=this;dr.alert("Uploading Image",null),n.mm.imageUpload(e,t).then((e=>{"postImageAdded"==e.type?(n.editor.notify(D,e.url),dr.alert("Image Added to Entry",!0)):dr.alert("Uh oh. Image not added",!1)})).catch((()=>{dr.alert("Uh oh. Image not added",!1)}))}}gr.uploadFiles=[];class pr{constructor(e){this.currentPage=null,this.choosePage(e),this.start()}start(){}choosePage(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new gr}}}class hr{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,c=document.getElementById("smtp-email").value,d=document.getElementById("smtp-pass").value,g=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,h="",m=document.querySelectorAll(".mail-option"),f=document.getElementById("api-access-toggle").getAttribute("data-enabled"),v=document.getElementById("dynamic-render-toggle").getAttribute("data-enabled");var b,y;for(b=0,y=l.length;b<y;b++)"true"==l[b].getAttribute("data-enabled")&&(s=l[b].id);for(b=0,y=m.length;b<y;b++)"true"==m[b].getAttribute("data-enabled")&&(h=m[b].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:c,password:d},mailgun:{domain:g,key:p}}};return new Promise((function(e){e(E)}))}}const mr=new rt;class fr{constructor(){}sendMail(){(new v).sendMail({content:"This is a test email"}).then((e=>{mr.alert(e.message,!0)})).catch((e=>{mr.alert(e.message,!1)}))}testMail(){(new v).sendMail({content:"This is a test email",mail_task:"TESTING"}).then((e=>{mr.alert(e.message,!0)})).catch((e=>{mr.alert(e.message,!1)}))}}const vr=new rt;class br{constructor(){this.processing=!1,this.start(),this.admin=new v(null),this.mm=new I(null,null)}start(){let e=this;document.getElementById("save-toggle").addEventListener("click",(()=>(new hr).getInfo().then((t=>{vr.alert("Saving Settings",null),e.admin.sync("syncSite",t).then((e=>{e.type,vr.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 fr).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){vr.alert("Uploading Image... ",null),this.mm.imageUpload(e,t).then((e=>{"avatarUploaded"==e.type?(vr.alert(e.message,!0),document.getElementById("avatar").src=e.url):(vr.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,vr.alert("Publishing site...",null),this.admin.publish({task:"PUBLISH_ALL"}).then((e=>{t.processing=!1,vr.alert(e.message,!0)})).catch((e=>{t.processing=!1,vr.alert(e,!1)}))}handleBackup(e){e.preventDefault(),e.stopPropagation(),vr.alert("Creating backup",null),this.mm.backup().then((e=>{vr.alert(e.message,!0)})).catch((e=>{vr.alert(e,!1)}))}handleReindex(e){if(this.processing)return;let t=this;e.preventDefault(),e.stopPropagation();this.processing=!0,vr.alert("Cleaning up page indexes",null),this.admin.handleReindex({task:"cleanup pages indexes"}).then((e=>{t.processing=!1,vr.alert(e.message,!0)})).catch((e=>{t.processing=!1,vr.alert(e,!1)}))}}class yr{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))}}const Er=new rt;class wr{constructor(){this.processing=!1,this.admin=new v(null),this.start()}start(){let e=this;lr.create(document.getElementById("nav-pages"),{onUpdate:()=>{(new yr).syncMenu().then((t=>{Er.alert("Updating Menu",null),e.admin.sync(h,t).then((e=>{e.type,Er.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 yr).removeItem(t),(new yr).syncMenu().then((t=>{t.remove=e.target.getAttribute("data-uuid"),Er.alert("Editing Menu",null),n.processing=!0,n.admin.sync(h,t).then((e=>{n.processing=!1,e.type,Er.alert(e.message,!0)}))}));break;case"edit-item":n.processing=!1,window.location="/dashboard/page/edit/"+e.target.getAttribute("data-id")}}}class kr{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 pr(t);break;case"settings":this.currentDisplay=new br;break;case"navigation":this.currentDisplay=new wr}this.start()}}const Ir=new S,Sr=new rt;class xr{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 kr}handleLogin(e){if(this.processing)return;let t=this;e.preventDefault();let n=Ir.formDataToJSON(document.getElementById("login"));Sr.alert("Looking, hold up",null);let r=new v;this.processing=!0,r.login(n).then((n=>{t.processing=!1,n.type===x?Sr.alert(n.message,!1):(Sr.alert(n.message,!0),e.target.innerHTML=n.message,setTimeout((()=>{window.location="/dashboard"}),500))})).catch((e=>{t.processing=!1,Sr.alert(e,!1)}))}handleSetup(e){if(this.processing)return;let t=this;e.stopPropagation(),e.preventDefault();let n=Ir.formDataToJSON(document.getElementById("init-form")),r=new I;this.processing=!0,r.create(n).then((e=>{"blogInitLame"===e.type?(t.processing=!1,Sr.alert(e.message,!1)):(t.processing=!1,Sr.alert(e.message,!0),setTimeout((()=>{window.location="/dashboard"}),700))})).catch((e=>{t.processing=!1,Sr.alert(e,!1)}))}handleRestore(e){if(this.processing)return;let t=this;e.stopPropagation(),e.preventDefault();let n=new I;var r=document.getElementById("init-restore");this.processing=!0,n.restore(r).then((e=>{e.type===x?(t.processing=!1,Sr.alert(e.message,!1)):(t.processing=!1,Sr.alert(e.message,!0),setTimeout((()=>{window.location="/dashboard"}),1500))})).catch((e=>{t.processing=!1,Sr.alert(e,!1)}))}handleReset(e){e.stopPropagation(),e.preventDefault();let t=this,n=new I;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,Sr.alert(e.message,!0)):"mailSent"==e.type?Sr.alert(e.message,!0):Sr.alert(e.message,!1)})).catch((e=>{t.processing=!1,Sr.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?Sr.alert(e.message,!1):(Sr.alert(e.message,!0),setTimeout((()=>{window.location="/dashboard"}),1e3))})).catch((e=>{t.processing=!1,Sr.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 xr}),!1)})();
|
|
//# sourceMappingURL=Start.js.map
|