fipamo/public/assets/scripts/dash.min.js

11 lines
85 KiB
JavaScript

!function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function i(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=r(e);if(t){var i=r(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return a(this,n)}}var l="getAuthStatus",u="requestLame",s="apiUseAuthorized",c="apiUseNotAuthorized",d="postImageAdded",f="postError",h="postUpdated",p="avatarUploaded",g="writingItDown",m="erasingPage",v="savingSettings",y="createBackup",b="downloadBackup",w="uploadProfileImages",E="renderPages",I="reindexPages",k="blogInit",S="blogInitLame",T="sendMail",x=(new function t(){e(this,t)},"POST"),D="GET",P="json",_="x-www-form-urlencoded",B=function(){function t(){e(this,t)}return n(t,[{key:"login",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/login",l,x,P,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"init",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init",k,x,P,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"handleInitRestore",value:function(e){var t=this;return new Promise((function(n,r){var o;o=new FormData(e),t._request("/api/v1/restore","downloadBackup","POST","x-www-form-urlencoded",o).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"getPages",value:function(e){var t=this,n=e;return null!==n&&""!==n&&n||(n=1),new Promise((function(e,r){t._request("/api/v1/page/published/"+n,void 0,D).then((function(t){e(t)})).catch((function(e){r(e)}))}))}},{key:"getPage",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/page/single/"+e,void 0,D).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"_request",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:D,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:P,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=this;return new Promise((function(t,i){var l=new XMLHttpRequest;if(l.upload.onprogress=a.handleLoadProgress,l.open(n,e,!0),l.onload=function(){if(200==l.status){var e=JSON.parse(l.response);t(e)}else{var n=JSON.parse(l.response);i(n)}},"PUT"==n||n==x)switch(r){case P:l.setRequestHeader("Content-type","application/"+r),l.send(JSON.stringify(o));break;case _:l.send(o)}else l.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),O="POST",C="createNewPage",A="editPage",M="deletePage",N="json",L="x-www-form-urlencoded",R=function(){function t(){var n=this;e(this,t),this.percentComplete=0,this.token=null,this._request("/api/v1/status").then((function(e){e.type===s&&(n.token=e.token)}))}return n(t,[{key:"syncSettings",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/sync",v,O,N,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"imageUpload",value:function(e,t){var n=this;return new Promise((function(r,o){var 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"}for(var i=new FormData,l=0;l<t.length;l++){var u=t[l];u.type.match("image.*")&&("avatar-upload"===e?i.append("avatar_upload",u,u.name):"background-upload"===e?i.append("background_upload",u,u.name):i.append("post_image",u,u.name))}n._request(a,w,O,L,i).then((function(e){r(e)})).catch((function(e){o(e)}))}))}},{key:"publishSite",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/publish",E,O,N,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"pageActions",value:function(e,t){var n,r,o,a=this;switch(e){case C:n="/api/v1/page/create",r=g,o=L;break;case A:n="/api/v1/page/write",r=g,o=L;break;case M:n="/api/v1/page/delete",r=m,o=N}return new Promise((function(e,i){a._request(n,r,O,o,t).then((function(t){e(t)})).catch((function(e){i(e)}))}))}},{key:"syncNav",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/nav-sync",v,O,N,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"sendMail",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/mailer",T,O,N,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"handleBackup",value:function(e,t){var n=this;return new Promise((function(r,o){var a,i,l,u,s;if("create-backup"===e)a="/api/v1/backup",i=y,l=O,u=N,s={task:"create_backup"};else{a="/api/v1/backup/restore",i=b,l=O,u=L,s=new FormData;for(var c=0;c<t.length;c++){var d=t[c];d.type.match("application.zip")&&s.append("backup_upload",d,d.name)}}n._request(a,i,l,u,s).then((function(e){r(e)})).catch((function(e){o(e)}))}))}},{key:"handleReindex",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/settings/reindex",I,O,N,e).then((function(e){n(e)})).catch((function(e){r(e)}))}))}},{key:"_request",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:N,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=this;return new Promise((function(i,l){var u=new XMLHttpRequest;if(u.upload.onprogress=a.handleLoadProgress,u.open(n,e,!0),u.onload=function(){if(200==u.status){var e=JSON.parse(u.response);i(e)}else{var t=JSON.parse(u.response);l(t)}},"PUT"==n||n==O)switch(t!==g&&t!==w&&t!==v&&t!==m&&t!==E&&t!==y&&t!==b&&t!==I||u.setRequestHeader("fipamo-access-token",a.token),r){case N:u.setRequestHeader("Content-type","application/"+r),u.send(JSON.stringify(o));break;case L:u.send(o)}else u.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),H=function(){function t(){e(this,t)}return n(t,[{key:"imgLoad",value:function(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()}))}},{key:"loadImage",value:function(e){var 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)}))}))}},{key:"formDataToJSON",value:function(e){var t={};return new FormData(e).forEach((function(e,n){t.hasOwnProperty(n)?(Array.isArray(t[n])||(t[n]=[t[n]]),t[n].push(e)):t[n]=e})),t}}]),t}(),F=function(){function t(){e(this,t)}return n(t,[{key:"cleanString",value:function(e){return e.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g,"").toLowerCase().replace(/[\/_| -]+/g,"-")}},{key:"decodeHTML",value:function(e,t){var n=0,r=0,o=!1;void 0===t&&(t=2),e=e.toString().replace(/&lt;/g,"<").replace(/&gt;/g,">");var a={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&&(o=!0),"number"!=typeof t){for(t=[].concat(t),r=0;r<t.length;r++)0===a[t[r]]?o=!0:a[t[r]]&&(n|=a[t[r]]);t=n}return t&a.ENT_HTML_QUOTE_SINGLE&&(e=e.replace(/&#0*39;/g,"'")),o||(e=e.replace(/&quot;/g,'"')),e=e.replace(/&amp;/g,"&")}}]),t}(),X=function(){function t(){e(this,t)}return n(t,[{key:"collectInfo",value:function(e){return new Promise((function(t,n){var r=new FormData,o=document.createElement("textarea");o.innerHTML=document.getElementById("edit-post-text").innerHTML;var a=o.value;if(a=a.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",a),r.append("title",document.getElementById("post_title").value),r.append("created",document.getElementById("post-date").getAttribute("data-raw")),r.append("slug",(new F).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")),null!=e||null!=e)e.type.match("image.*")?r.append("feature_image",e,e.name):n("Not an image file");else{var i=document.getElementById("featured-image").src;null!=i||null!=i?r.append("feature_image",i):r.append("feature_image",null)}t(r)}))}}]),t}(),q="editorDelete",U="editorUploadImage",Y="editorSave",j="editorUpdate";new function t(){e(this,t)};var W=["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"],z=function(e,t){var n=document.createElement("div");return function(t){var r=function(){var t={position:"absolute",left:-9999,top:0,zIndex:-2e3};return"TEXTAREA"===e.tagName&&W.push("width"),W.forEach((function(n){t[n]=getComputedStyle(e)[n]})),t}();Object.keys(r).forEach((function(e){n.style[e]=r[e]})),n.innerHTML=t,e.parentNode.insertBefore(n,e.nextSibling)}(t),{rect:function(){var e=n.ownerDocument.getElementById("caret-position-marker"),t={left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight};return n.parentNode.removeChild(n),t}}};function G(e){return(G="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 Q=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}},V=function(e){return"object"===G(e)&&null!==e},J=function(e,t){var n=function(){return e.selectionStart},r=function(r){var o=function(e){return e.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"<br/>")};(t.customPos||0===t.customPos)&&(r=t.customPos);var a=void 0===r?n():r,i=e.value.slice(0,a),l=e.value.slice(a),u='<span style="position: relative; display: inline;">'.concat(o(i),"</span>");u+='<span id="caret-position-marker" style="position: relative; display: inline;">|</span>',u+='<span style="position: relative; display: inline;">'.concat(o(l),"</span>");var s=z(e,u).rect();return s.pos=n(),s};return{getPos:n,setPos:function(t){return e.setSelectionRange(t,t),e},getOffset:function(n){var o=function(e,t){var n=t&&t.window||window,r=t&&t.document||document,o=e.getBoundingClientRect(),a=r.documentElement,i=n.pageXOffset||a.scrollLeft,l=n.pageYOffset||a.scrollTop;return{top:o.top+l,left:o.left+i}}(e),a=r(n);return{top:o.top+a.top+t.document.body.scrollTop,left:o.left+a.left+t.document.body.scrollLeft,height:a.height}},getPosition:r}},$=function(e,t){return function(e){return!!(e.contentEditable?"true"===e.contentEditable:"true"===e.getAttribute("contenteditable"))}(e)?function(e,t){var n=function(){var n=r(),o={height:0,left:0,right:0};if(!n)return o;var a=t.customPos||0===t.customPos;if(n.endOffset-1>0&&n.endContainer!==e||a){var i=n.cloneRange(),l=a?t.customPos:n.endOffset;i.setStart(n.endContainer,l-1<0?0:l-1),i.setEnd(n.endContainer,l);var u=i.getBoundingClientRect();o={height:u.height,left:u.left+u.width,top:u.top},i.detach()}if((!o||o&&0===o.height)&&!t.noShadowCaret){var s=n.cloneRange(),c=t.document.createTextNode("|");s.insertNode(c),s.selectNode(c);var d=s.getBoundingClientRect();o={height:d.height,left:d.left,top:d.top},c.parentNode.removeChild(c),s.detach()}if(o){var f=t.document.documentElement;o.top+=t.window.pageYOffset-(f.clientTop||0),o.left+=t.window.pageXOffset-(f.clientLeft||0)}return o},r=function(){if(t.window.getSelection){var e=t.window.getSelection();return e.rangeCount>0?e.getRangeAt(0):null}},o=function(){var t=r(),n=t.cloneRange();n.selectNodeContents(e),n.setEnd(t.endContainer,t.endOffset);var o=n.toString().length;return n.detach(),o};return{getPos:o,setPos:function(n){var r=t.window.getSelection();if(r){var o=0,a=!1;!function e(i,l){for(var u=0;u<l.childNodes.length;u++){var s=l.childNodes[u];if(a)break;if(3===s.nodeType){if(o+s.length>=i){a=!0;var c=t.document.createRange();c.setStart(s,i-o),r.removeAllRanges(),r.addRange(c);break}o+=s.length}else e(n,s)}}(n,e)}return e},getPosition:function(){var r=n(),a=o(),i=e.getBoundingClientRect(),l=i.top+t.document.body.scrollTop,u=i.left+t.document.body.scrollLeft;return r.left-=u,r.top-=l,r.pos=a,r},getOffset:n,getRange:r}}(e,t):J(e,t)},Z=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;V(t)&&(r=t,t=null);var o=Q(r),a=$(e,o);return t||0===t?a.setPos(t):a.getPosition()},K=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(a,t);var r=i(a);function a(t,n){var o;return e(this,a),(o=r.call(this)).textEditor=t,o.fixLimit=n,o.caretPos=null,o.url="",o.setInputs(),window.addEventListener("scroll",(function(){})),o.refresh(),o}return n(a,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r<o;r++)n[r].addEventListener("click",(function(t){return e.handleEditorOption(t)}),!1);this.textEditor.addEventListener("input",(function(n){var r=e.textEditor.innerText;if("insertParagraph"!=n.inputType&&r.search(/<[a-z][\s\S]*>/g)>-1){var o=Z(e.textEditor).pos;t.refresh(),Z(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"<br>");var t=document.createElement("div");t.innerText=e,this.textEditor.innerHTML=t.innerText,this.textEditor.style.maxWidth="900px"}},{key:"notify",value:function(e,t){switch(e){case void 0: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((function(){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 void 0:break;case U:var n,r;Z(this.textEditor,this.caretPos),(n=window.getSelection()).rangeCount&&((r=n.getRangeAt(0)).deleteContents(),r.insertNode(document.createTextNode("![image alt text]("+t+" 'image title')"))),this.refresh()}}},{key:"handleEditorOption",value:function(e){var t,n,r;if(e.preventDefault(),(t=window.getSelection()).rangeCount)switch(n=t.getRangeAt(0),r=t.getRangeAt(0).toString(),n.deleteContents(),e.target.id){case"edit-bold":n.insertNode(document.createTextNode("**"+r+"**"));break;case"edit-italic":n.insertNode(document.createTextNode("*"+r+"*"));break;case"edit-strikethrough":n.insertNode(document.createTextNode("<del>"+r+"</del>"));break;case"edit-header1":n.insertNode(document.createTextNode("# "+r));break;case"edit-header2":n.insertNode(document.createTextNode("## "+r));break;case"edit-header3":n.insertNode(document.createTextNode("### "+r));break;case"edit-image":this.caretPos=Z(this.textEditor).pos,this.emitEvent(U);break;case"submit-save":case"edit-save":this.emitEvent(Y);break;case"submit-update":case"edit-update":this.emitEvent(j);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(q)}this.refresh()}}]),a}(function(){function t(){e(this,t),this.listeners=new Map}return n(t,[{key:"addListener",value:function(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}},{key:"removeListener",value:function(e,t){var n,r=this.listeners.get(e);return!!(r&&r.length&&(n=r.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1))>-1)&&(r.splice(n,1),this.listeners.set(e,r),!0)}},{key:"emitEvent",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=this.listeners.get(e);return!(!o||!o.length)&&(o.forEach((function(e){e.apply(void 0,n)})),!0)}}]),t}()),ee={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},te={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},ne=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],re={CSS:{},springs:{}};function oe(e,t,n){return Math.min(Math.max(e,t),n)}function ae(e,t){return e.indexOf(t)>-1}function ie(e,t){return e.apply(null,t)}var le={arr:function(e){return Array.isArray(e)},obj:function(e){return ae(Object.prototype.toString.call(e),"Object")},pth:function(e){return le.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||le.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 le.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 le.hex(e)||le.rgb(e)||le.hsl(e)},key:function(e){return!ee.hasOwnProperty(e)&&!te.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function ue(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function se(e,t){var n=ue(e),r=oe(le.und(n[0])?1:n[0],.1,100),o=oe(le.und(n[1])?100:n[1],.1,100),a=oe(le.und(n[2])?10:n[2],.1,100),i=oe(le.und(n[3])?0:n[3],.1,100),l=Math.sqrt(o/r),u=a/(2*Math.sqrt(o*r)),s=u<1?l*Math.sqrt(1-u*u):0,c=u<1?(u*l-i)/s:-i+l;function d(e){var n=t?t*e/1e3:e;return n=u<1?Math.exp(-n*u*l)*(1*Math.cos(s*n)+c*Math.sin(s*n)):(1+c*n)*Math.exp(-n*l),0===e||1===e?e:1-n}return t?d:function(){var t=re.springs[e];if(t)return t;for(var n=1/6,r=0,o=0;;)if(1===d(r+=n)){if(++o>=16)break}else o=0;var a=r*n*1e3;return re.springs[e]=a,a}}function ce(e){return void 0===e&&(e=10),function(t){return Math.ceil(oe(t,1e-6,1)*e)*(1/e)}}var de,fe,he=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 o(e,o,a){return((t(o,a)*e+n(o,a))*e+r(o))*e}function a(e,o,a){return 3*t(o,a)*e*e+2*n(o,a)*e+r(o)}return function(t,n,r,i){if(0<=t&&t<=1&&0<=r&&r<=1){var l=new Float32Array(11);if(t!==n||r!==i)for(var u=0;u<11;++u)l[u]=o(u*e,t,r);return function(e){return t===n&&r===i||0===e||1===e?e:o(s(e),n,i)}}function s(n){for(var i=0,u=1;10!==u&&l[u]<=n;++u)i+=e;--u;var s=i+(n-l[u])/(l[u+1]-l[u])*e,c=a(s,t,r);return c>=.001?function(e,t,n,r){for(var i=0;i<4;++i){var l=a(t,n,r);if(0===l)return t;t-=(o(t,n,r)-e)/l}return t}(n,s,t,r):0===c?s:function(e,t,n,r,a){var i,l,u=0;do{(i=o(l=t+(n-t)/2,r,a)-e)>0?n=l:t=l}while(Math.abs(i)>1e-7&&++u<10);return l}(n,i,i+e,t,r)}}}(),pe=(de={linear:function(){return function(e){return e}}},fe={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=oe(e,1,10),r=oe(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){fe[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(fe).forEach((function(e){var t=fe[e];de["easeIn"+e]=t,de["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},de["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}},de["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}}})),de);function ge(e,t){if(le.fnc(e))return e;var n=e.split("(")[0],r=pe[n],o=ue(e);switch(n){case"spring":return se(e,t);case"cubicBezier":return ie(he,o);case"steps":return ie(ce,o);default:return ie(r,o)}}function me(e){try{return document.querySelectorAll(e)}catch(e){return}}function ve(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],a=0;a<n;a++)if(a in e){var i=e[a];t.call(r,i,a,e)&&o.push(i)}return o}function ye(e){return e.reduce((function(e,t){return e.concat(le.arr(t)?ye(t):t)}),[])}function be(e){return le.arr(e)?e:(le.str(e)&&(e=me(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function we(e,t){return e.some((function(e){return e===t}))}function Ee(e){var t={};for(var n in e)t[n]=e[n];return t}function Ie(e,t){var n=Ee(e);for(var r in e)n[r]=t.hasOwnProperty(r)?t[r]:e[r];return n}function ke(e,t){var n=Ee(e);for(var r in t)n[r]=le.und(e[r])?t[r]:e[r];return n}function Se(e){return le.rgb(e)?(t=e,(n=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(t))?"rgba("+n[1]+",1)":t):le.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):le.hsl(e)?function(e){var t,n,r,o=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(e),a=parseInt(o[1],10)/360,i=parseInt(o[2],10)/100,l=parseInt(o[3],10)/100,u=o[4]||1;function s(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==i)t=n=r=l;else{var c=l<.5?l*(1+i):l+i-l*i,d=2*l-c;t=s(d,c,a+1/3),n=s(d,c,a),r=s(d,c,a-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+u+")"}(e):void 0;var t,n}function Te(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 xe(e,t){return le.fnc(e)?e(t.target,t.id,t.total):e}function De(e,t){return e.getAttribute(t)}function Pe(e,t,n){if(we([n,"deg","rad","turn"],Te(t)))return t;var r=re.CSS[t+n];if(!le.und(r))return r;var o=document.createElement(e.tagName),a=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=100+n;var i=100/o.offsetWidth;a.removeChild(o);var l=i*parseFloat(t);return re.CSS[t+n]=l,l}function _e(e,t,n){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return n?Pe(e,o,n):o}}function Be(e,t){return le.dom(e)&&!le.inp(e)&&(!le.nil(De(e,t))||le.svg(e)&&e[t])?"attribute":le.dom(e)&&we(ne,t)?"transform":le.dom(e)&&"transform"!==t&&_e(e,t)?"css":null!=e[t]?"object":void 0}function Oe(e){if(le.dom(e)){for(var t,n=e.style.transform||"",r=/(\w+)\(([^)]*)\)/g,o=new Map;t=r.exec(n);)o.set(t[1],t[2]);return o}}function Ce(e,t,n,r){var o=ae(t,"scale")?1:0+function(e){return ae(e,"translate")||"perspective"===e?"px":ae(e,"rotate")||ae(e,"skew")?"deg":void 0}(t),a=Oe(e).get(t)||o;return n&&(n.transforms.list.set(t,a),n.transforms.last=t),r?Pe(e,a,r):a}function Ae(e,t,n,r){switch(Be(e,t)){case"transform":return Ce(e,t,r,n);case"css":return _e(e,t,n);case"attribute":return De(e,t);default:return e[t]||0}}function Me(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=Te(e)||0,o=parseFloat(t),a=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return o+a+r;case"-":return o-a+r;case"*":return o*a+r}}function Ne(e,t){if(le.col(e))return Se(e);if(/\s/g.test(e))return e;var n=Te(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function Le(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Re(e){for(var t,n=e.points,r=0,o=0;o<n.numberOfItems;o++){var a=n.getItem(o);o>0&&(r+=Le(t,a)),t=a}return r}function He(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*De(e,"r")}(e);case"rect":return function(e){return 2*De(e,"width")+2*De(e,"height")}(e);case"line":return function(e){return Le({x:De(e,"x1"),y:De(e,"y1")},{x:De(e,"x2"),y:De(e,"y2")})}(e);case"polyline":return Re(e);case"polygon":return function(e){var t=e.points;return Re(e)+Le(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Fe(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;le.svg(t)&&le.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),a=De(r,"viewBox"),i=o.width,l=o.height,u=n.viewBox||(a?a.split(" "):[0,0,i,l]);return{el:r,viewBox:u,x:u[0]/1,y:u[1]/1,w:i,h:l,vW:u[2],vH:u[3]}}function Xe(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 o=Fe(e.el,e.svg),a=r(),i=r(-1),l=r(1),u=n?1:o.w/o.vW,s=n?1:o.h/o.vH;switch(e.property){case"x":return(a.x-o.x)*u;case"y":return(a.y-o.y)*s;case"angle":return 180*Math.atan2(l.y-i.y,l.x-i.x)/Math.PI}}function qe(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Ne(le.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:le.str(e)||t?r.split(n):[]}}function Ue(e){return ve(e?ye(le.arr(e)?e.map(be):be(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Ye(e){var t=Ue(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Oe(e)}}}))}function je(e,t){var n=Ee(t);if(/^spring/.test(n.easing)&&(n.duration=se(n.easing)),le.arr(e)){var r=e.length;2===r&&!le.obj(e[0])?e={value:e}:le.fnc(t.duration)||(n.duration=t.duration/r)}var o=le.arr(e)?e:[e];return o.map((function(e,n){var r=le.obj(e)&&!le.pth(e)?e:{value:e};return le.und(r.delay)&&(r.delay=n?0:t.delay),le.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return ke(e,n)}))}function We(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=ke(function(e){for(var t=ve(ye(e.map((function(e){return Object.keys(e)}))),(function(e){return le.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},r=function(r){var o=t[r];n[o]=e.map((function(e){var t={};for(var n in e)le.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o<t.length;o++)r(o);return n}(r),t)),t)le.key(o)&&n.push({name:o,tweens:je(t[o],e)});return n}function ze(e,t){var n;return e.tweens.map((function(r){var o=function(e,t){var n={};for(var r in e){var o=xe(e[r],t);le.arr(o)&&1===(o=o.map((function(e){return xe(e,t)}))).length&&(o=o[0]),n[r]=o}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(r,t),a=o.value,i=le.arr(a)?a[1]:a,l=Te(i),u=Ae(t.target,e.name,l,t),s=n?n.to.original:u,c=le.arr(a)?a[0]:s,d=Te(c)||Te(u),f=l||d;return le.und(i)&&(i=s),o.from=qe(c,f),o.to=qe(Me(i,c),f),o.start=n?n.end:0,o.end=o.start+o.delay+o.duration+o.endDelay,o.easing=ge(o.easing,o.duration),o.isPath=le.pth(a),o.isPathTargetInsideSVG=o.isPath&&le.svg(t.target),o.isColor=le.col(o.from.original),o.isColor&&(o.round=1),n=o,o}))}var Ge={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,o){if(r.list.set(t,n),t===r.last||o){var a="";r.list.forEach((function(e,t){a+=t+"("+e+") "})),e.style.transform=a}}};function Qe(e,t){Ye(e).forEach((function(e){for(var n in t){var r=xe(t[n],e),o=e.target,a=Te(r),i=Ae(o,n,a,e),l=Me(Ne(r,a||Te(i)),i),u=Be(o,n);Ge[u](o,n,l,e.transforms,!0)}}))}function Ve(e,t){return ve(ye(e.map((function(e){return t.map((function(t){return function(e,t){var n=Be(e.target,t.name);if(n){var r=ze(t,e),o=r[r.length-1];return{type:n,property:t.name,animatable:e,tweens:r,duration:o.end,delay:r[0].delay,endDelay:o.endDelay}}}(e,t)}))}))),(function(e){return!le.und(e)}))}function Je(e,t){var n=e.length,r=function(e){return e.timelineOffset?e.timelineOffset:0},o={};return o.duration=n?Math.max.apply(Math,e.map((function(e){return r(e)+e.duration}))):t.duration,o.delay=n?Math.min.apply(Math,e.map((function(e){return r(e)+e.delay}))):t.delay,o.endDelay=n?o.duration-Math.max.apply(Math,e.map((function(e){return r(e)+e.duration-e.endDelay}))):t.endDelay,o}var $e=0;var Ze=[],Ke=function(){var e;function t(n){for(var r=Ze.length,o=0;o<r;){var a=Ze[o];a.paused?(Ze.splice(o,1),r--):(a.tick(n),o++)}e=o>0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){tt.suspendWhenDocumentHidden&&(et()?e=cancelAnimationFrame(e):(Ze.forEach((function(e){return e._onDocumentVisibility()})),Ke()))})),function(){e||et()&&tt.suspendWhenDocumentHidden||!(Ze.length>0)||(e=requestAnimationFrame(t))}}();function et(){return!!document&&document.hidden}function tt(e){void 0===e&&(e={});var t,n=0,r=0,o=0,a=0,i=null;function l(e){var t=window.Promise&&new Promise((function(e){return i=e}));return e.finished=t,t}var u=function(e){var t=Ie(ee,e),n=Ie(te,e),r=We(n,e),o=Ye(e.targets),a=Ve(o,r),i=Je(a,n),l=$e;return $e++,ke(t,{id:l,children:[],animatables:o,animations:a,duration:i.duration,delay:i.delay,endDelay:i.endDelay})}(e);function s(){var e=u.direction;"alternate"!==e&&(u.direction="normal"!==e?"normal":"reverse"),u.reversed=!u.reversed,t.forEach((function(e){return e.reversed=u.reversed}))}function c(e){return u.reversed?u.duration-e:e}function d(){n=0,r=c(u.currentTime)*(1/tt.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=u.animations,r=n.length;t<r;){var o=n[t],a=o.animatable,i=o.tweens,l=i.length-1,s=i[l];l&&(s=ve(i,(function(t){return e<t.end}))[0]||s);for(var c=oe(e-s.start-s.delay,0,s.duration)/s.duration,d=isNaN(c)?1:s.easing(c),f=s.to.strings,h=s.round,p=[],g=s.to.numbers.length,m=void 0,v=0;v<g;v++){var y=void 0,b=s.to.numbers[v],w=s.from.numbers[v]||0;y=s.isPath?Xe(s.value,d*b,s.isPathTargetInsideSVG):w+d*(b-w),h&&(s.isColor&&v>2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I<E;I++){f[I];var k=f[I+1],S=p[I];isNaN(S)||(m+=k?S+k:S+" ")}}else m=p[0];Ge[o.type](a.target,o.property,m,a.transforms),o.currentValue=m,t++}}function p(e){u[e]&&!u.passThrough&&u[e](u)}function g(e){var d=u.duration,g=u.delay,m=d-u.endDelay,v=c(e);u.progress=oe(v/d*100,0,100),
u.reversePlayback=v<u.currentTime,t&&function(e){if(u.reversePlayback)for(var n=a;n--;)f(e,t[n]);else for(var r=0;r<a;r++)f(e,t[r])}(v),!u.began&&u.currentTime>0&&(u.began=!0,p("begin")),!u.loopBegan&&u.currentTime>0&&(u.loopBegan=!0,p("loopBegin")),v<=g&&0!==u.currentTime&&h(0),(v>=m&&u.currentTime!==d||!d)&&h(d),v>g&&v<m?(u.changeBegan||(u.changeBegan=!0,u.changeCompleted=!1,p("changeBegin")),p("change"),h(v)):u.changeBegan&&(u.changeCompleted=!0,u.changeBegan=!1,p("changeComplete")),u.currentTime=oe(v,0,d),u.began&&p("update"),e>=d&&(r=0,u.remaining&&!0!==u.remaining&&u.remaining--,u.remaining?(n=o,p("loopComplete"),u.loopBegan=!1,"alternate"===u.direction&&s()):(u.paused=!0,u.completed||(u.completed=!0,p("loopComplete"),p("complete"),!u.passThrough&&"Promise"in window&&(i(),l(u)))))}return l(u),u.reset=function(){var e=u.direction;u.passThrough=!1,u.currentTime=0,u.progress=0,u.paused=!0,u.began=!1,u.loopBegan=!1,u.changeBegan=!1,u.completed=!1,u.changeCompleted=!1,u.reversePlayback=!1,u.reversed="reverse"===e,u.remaining=u.loop,t=u.children;for(var n=a=t.length;n--;)u.children[n].reset();(u.reversed&&!0!==u.loop||"alternate"===e&&1===u.loop)&&u.remaining++,h(u.reversed?u.duration:0)},u._onDocumentVisibility=d,u.set=function(e,t){return Qe(e,t),u},u.tick=function(e){o=e,n||(n=o),g((o+(r-n))*tt.speed)},u.seek=function(e){g(c(e))},u.pause=function(){u.paused=!0,d()},u.play=function(){u.paused&&(u.completed&&u.reset(),u.paused=!1,Ze.push(u),d(),Ke())},u.reverse=function(){s(),u.completed=!u.reversed,d()},u.restart=function(){u.reset(),u.play()},u.remove=function(e){rt(Ue(e),u)},u.reset(),u.autoplay&&u.play(),u}function nt(e,t){for(var n=t.length;n--;)we(e,t[n].animatable.target)&&t.splice(n,1)}function rt(e,t){var n=t.animations,r=t.children;nt(e,n);for(var o=r.length;o--;){var a=r[o],i=a.animations;nt(e,i),i.length||a.children.length||r.splice(o,1)}n.length||r.length||t.pause()}tt.version="3.2.1",tt.speed=1,tt.suspendWhenDocumentHidden=!0,tt.running=Ze,tt.remove=function(e){for(var t=Ue(e),n=Ze.length;n--;){rt(t,Ze[n])}},tt.get=Ae,tt.set=Qe,tt.convertPx=Pe,tt.path=function(e,t){var n=le.str(e)?me(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Fe(n),totalLength:He(n)*(r/100)}}},tt.setDashoffset=function(e){var t=He(e);return e.setAttribute("stroke-dasharray",t),t},tt.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?ge(t.easing):null,o=t.grid,a=t.axis,i=t.from||0,l="first"===i,u="center"===i,s="last"===i,c=le.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=Te(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(l&&(i=0),u&&(i=(v-1)/2),s&&(i=v-1),!g.length){for(var y=0;y<v;y++){if(o){var b=u?(o[0]-1)/2:i%o[0],w=u?(o[1]-1)/2:Math.floor(i/o[0]),E=b-y%o[0],I=w-Math.floor(y/o[0]),k=Math.sqrt(E*E+I*I);"x"===a&&(k=-E),"y"===a&&(k=-I),g.push(k)}else g.push(Math.abs(i-y));m=Math.max.apply(Math,g)}r&&(g=g.map((function(e){return r(e/m)*m}))),"reverse"===n&&(g=g.map((function(e){return a?e<0?-1*e:-e:Math.abs(m-e)})))}return p+(c?(f-d)/m:d)*(Math.round(100*g[t])/100)+h}},tt.timeline=function(e){void 0===e&&(e={});var t=tt(e);return t.duration=0,t.add=function(n,r){var o=Ze.indexOf(t),a=t.children;function i(e){e.passThrough=!0}o>-1&&Ze.splice(o,1);for(var l=0;l<a.length;l++)i(a[l]);var u=ke(n,Ie(te,e));u.targets=u.targets||e.targets;var s=t.duration;u.autoplay=!1,u.direction=t.direction,u.timelineOffset=le.und(r)?s:Me(r,s),i(t),t.seek(u.timelineOffset);var c=tt(u);i(c),a.push(c);var d=Je(a,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},tt.easing=ge,tt.penner=pe,tt.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e};var ot=document.getElementById("notifications"),at=document.getElementById("notifyMessage"),it=document.getElementById("message-text"),lt=document.getElementById("notify-good"),ut=document.getElementById("notify-lame"),st=document.getElementById("notify-working"),ct=function(){function t(){e(this,t)}return n(t,[{key:"alert",value:function(e,t){st.style.display="none",lt.style.display="none",ut.style.display="none";var n="";null!==t?t?(n="#32cd32",st.style.display="none",lt.style.display="block"):(n="#F64747",st.style.display="none",ut.style.display="block"):(n="#200317",st.style.display="block"),it.innerHTML=e,tt({targets:ot,marginTop:"0",easing:"easeInOutQuint",duration:10,complete:function(){tt({targets:at,rotateX:"0",easing:"easeInOutQuint",duration:700}),tt({targets:it,backgroundColor:n,easing:"easeInOutQuint",duration:700,complete:function(){setTimeout((function(){null!==t&&tt({targets:at,rotateX:"-120",easing:"easeInOutQuint",duration:700,complete:function(){tt({targets:ot,marginTop:"-55",easing:"easeInOutQuint",delay:700,duration:50})}})}),1e3)}})}})}}]),t}(),dt=new ct,ft=function(){function t(){var n=this;e(this,t);var r=this;this.admin=new R,this.urlPieces=document.URL.split("/"),this.post=[],this.postID=null,this.postUUID=null,this.postLayout=null,document.getElementById("post-edit-index").getAttribute("data-index")&&(this.postID=document.getElementById("post-edit-index").getAttribute("data-index"),this.postUUID=document.getElementById("post-edit-index").getAttribute("data-uuid"),this.postLayout=document.getElementById("post-edit-index").getAttribute("data-layout")),document.getElementById("edit-post-text")&&(this.editor=new K(document.getElementById("edit-post-text"),document.getElementById("header").offsetHeight+document.getElementById("post-header").offsetHeight+document.getElementById("post-feature").offsetHeight),this.editor.addListener(q,(function(){return n.handleEditorOptions(q)}),!1),this.editor.addListener(U,(function(){return n.handleEditorOptions(U)}),!1),this.editor.addListener(j,(function(){return n.handleEditorOptions(j)}),!1),this.editor.addListener(Y,(function(){return n.handleEditorOptions(Y)}),!1),document.getElementById("post-image-upload").addEventListener("change",(function(e){r.handleImageUpload(e.target.id,e.target.files)}),!1),this.start())}return n(t,[{key:"start",value:function(){var e=this;if(document.getElementById("featured-image-drop")){document.getElementById("featured-image-drop").addEventListener("dragover",this.handleImageActions,!1),document.getElementById("featured-image-drop").addEventListener("drop",this.handleImageActions,!1),document.getElementById("featured-image-upload").addEventListener("change",(function(t){return e.handleImageActions(t)}),!1),document.getElementById("new-feature-upload")&&document.getElementById("new-feature-upload").addEventListener("click",(function(){document.getElementById("featured-image-upload").click()}));for(var t=document.querySelectorAll(".post-option-btn"),n=0,r=t.length;n<r;n++)t[n].addEventListener("click",(function(t){return e.handlePostOptions(t)}),!1)}}},{key:"handlePostOptions",value:function(e){var t;switch(e.target.id){case"option-page-icon":case"option-menu-pin":t=document.getElementById("option-menu-pin");break;case"option-feature-icon":case"option-feature":t=document.getElementById("option-feature");break;case"option-published-icon":case"option-published":t=document.getElementById("option-published")}"false"==t.getAttribute("data-active")?t.setAttribute("data-active","true"):t.setAttribute("data-active","false")}},{key:"handleEditorOptions",value:function(e){var t=this;switch(e){case Y:case j:var n="";n=e===Y?C:A,(new X).collectInfo(document.getElementById("featured-image-upload").files[0]).then((function(e){dt.alert("Writing down changes",null),t.admin.pageActions(n,e).then((function(e){e.type===f||e.type===c?dt.alert(e.message,!1):e.type===h?dt.alert(e.message,!0):(dt.alert(e.message,!0),window.location="/dashboard/page/edit/"+e.id)})).catch((function(e){dt.alert(e,!1)}))}));break;case q:if("index"===this.postLayout)return void dt.alert("Index cannot be deleted",!1);if(confirm("AYE! You know you're deleting this post, right?")){var r={id:this.postUUID};this.admin.pageActions(M,r).then((function(){window.location="/dashboard/pages"})).catch((function(e){dt.alert(e,!1)}))}break;case U:document.getElementById("post-image-upload").click()}}},{key:"handleImageActions",value:function(e){switch(e.stopPropagation(),e.preventDefault(),e.type){case"dragover":e.dataTransfer.dropEffect="copy";break;case"change":case"drop":"drop"==e.type?t.uploadFiles=e.dataTransfer.files:t.uploadFiles=e.target.files;for(var n,r=0;n=t.uploadFiles[r];r++)if(n.type.match("image.*")){var o=new FileReader;o.onload=function(e){return function(t){var n=document.createElement("img");n.src=t.target.result,n.title=escape(e.name),document.createElement("div").innerHTML=['<img src="',t.target.result,'" title="',escape(e.name),'"/>'].join(""),document.getElementById("featured-image-drop").innerHTML="",document.getElementById("featured-image-drop").appendChild(n)}}(n),o.readAsDataURL(n)}}}},{key:"handleImageUpload",value:function(e,t){var n=this;dt.alert("Uploading Image",null),this.admin.imageUpload(e,t).then((function(e){e.type==d&&n.editor.notify(U,e.url),dt.alert("Image Added to Entry",!0)})).catch((function(){dt.alert("Uh oh. Image not added",!1)}))}}]),t}();ft.uploadFiles=[];var ht=function(){function t(n){e(this,t),this.currentPage=null,this.choosePage(n),this.start()}return n(t,[{key:"start",value:function(){}},{key:"choosePage",value:function(e){switch(this.currentPage="",e){case"edit":case"add":this.currentPage=new ft}}}]),t}(),pt=function(){function t(){e(this,t)}return n(t,[{key:"getInfo",value:function(){var e,t,n=document.getElementById("settings-handle").value,r=document.getElementById("settings-email").value,o=document.getElementById("settings-url").value,a=document.getElementById("settings-title").value,i=document.getElementById("settings-desc").value,l=document.getElementById("render-toggle").getAttribute("data-render"),u=document.getElementById("background").src,s="",c=document.querySelectorAll(".theme-select"),d=document.getElementById("smtp-domain").value,f=document.getElementById("smtp-email").value,h=document.getElementById("smtp-pass").value,p=document.getElementById("mg-domain").value,g=document.getElementById("mg-key").value,m="",v=document.querySelectorAll(".mail-option");for(e=0,t=c.length;e<t;e++)"true"==c[e].getAttribute("data-enabled")&&(s=c[e].id);for(e=0,t=v.length;e<t;e++)"true"==v[e].getAttribute("data-enabled")&&(m=v[e].id);var y={global:{base_url:o,title:a,descriptions:i,background:u,private:!1,renderOnSave:l,theme:s},member:{handle:n,email:r},email:{active:m,smtp:{domain:d,email:f,password:h},mailgun:{domain:p,key:g}}};return new Promise((function(e){e(y)}))}}]),t}(),gt=new ct,mt=function(){function t(){e(this,t),this.admin=new R}return n(t,[{key:"sendMail",value:function(){this.admin.sendMail({content:"This is a test email"}).then((function(e){gt.alert(e.message,!0)})).catch((function(e){gt.alert(e.message,!1)}))}}]),t}(),vt=new ct,yt=function(){function t(){e(this,t),this.start(),this.admin=new R}return n(t,[{key:"start",value:function(){var e=this,t=this;document.getElementById("save-toggle").addEventListener("click",(function(){return(new pt).getInfo().then((function(e){vt.alert("Saving Settings",null),t.admin.syncSettings(e).then((function(e){e.type,vt.alert(e.message,!0)}))})).catch((function(){}))})),document.getElementById("avatar").addEventListener("click",(function(){document.getElementById("avatar-upload").click()})),document.getElementById("background").addEventListener("click",(function(){document.getElementById("background-upload").click()})),document.getElementById("restore-backup").addEventListener("click",(function(){document.getElementById("backup-upload").click()})),document.getElementById("avatar-upload").addEventListener("change",(function(e){t.handleImageUpload(e.target.id,e.target.files)}),!1),document.getElementById("background-upload").addEventListener("change",(function(e){t.handleImageUpload(e.target.id,e.target.files)}),!1),document.getElementById("backup-upload").addEventListener("change",(function(e){t.handleBackup(e)}),!1),document.getElementById("render-toggle").addEventListener("click",(function(t){return e.toggleRender(t)})),document.getElementById("send-mail").addEventListener("click",(function(t){return e.handleMailer(t)})),document.getElementById("publish-pages").addEventListener("click",(function(t){return e.handlePublished(t)}));for(var n=document.querySelectorAll(".theme-select"),r=0,o=n.length;r<o;r++)n[r].addEventListener("click",(function(t){return e.handleThemes(t)}));var a=document.querySelectorAll(".mail-option");for(r=0,o=a.length;r<o;r++)a[r].addEventListener("click",(function(t){return e.handleMailOptions(t)}));document.getElementById("create-backup").addEventListener("click",(function(t){return e.handleBackup(t)})),document.getElementById("reindex-pages").addEventListener("click",(function(t){return e.handleReindex(t)}))}},{key:"togglePrivacy",value:function(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")}},{key:"toggleRender",value:function(e){e.stopPropagation(),e.preventDefault(),"false"==e.target.getAttribute("data-render")?e.target.setAttribute("data-render","true"):e.target.setAttribute("data-render","false")}},{key:"handleMailer",value:function(){(new mt).sendMail()}},{key:"handleThemes",value:function(e){e.stopPropagation(),e.preventDefault();for(var t=document.querySelectorAll(".theme-select"),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")}},{key:"handleMailOptions",value:function(e){e.preventDefault(),e.stopPropagation();for(var t=document.getElementById("mail-smtp"),n=document.getElementById("mail-mg"),r=document.querySelectorAll(".mail-option"),o=0,a=r.length;o<a;o++)e.target.id==r[o].id?(r[o].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[o].setAttribute("data-enabled","false")}},{key:"handleImageUpload",value:function(e,t){vt.alert("Uploading Image... ",null),this.admin.imageUpload(e,t).then((function(e){e.type==p?(vt.alert(e.message,!0),document.getElementById("avatar").src=e.url):(vt.alert(e.message,!0),document.getElementById("background").src=e.url)})).catch((function(){}))}},{key:"handlePublished",value:function(e){e.preventDefault(),e.stopPropagation();vt.alert("Publishing site...",null),this.admin.publishSite({task:"publish all pages"}).then((function(e){vt.alert(e.message,!0)})).catch((function(e){vt.alert(e,!1)}))}},{key:"handleBackup",value:function(e){e.preventDefault(),e.stopPropagation(),vt.alert("Creating backup",null),this.admin.handleBackup(e.target.id,e.target.files).then((function(e){vt.alert(e.message,!0)})).catch((function(e){vt.alert(e,!1)}))}},{key:"handleReindex",value:function(e){e.preventDefault(),e.stopPropagation();vt.alert("Cleaning up page indexes",null),this.admin.handleReindex({task:"cleanup pages indexes"}).then((function(e){vt.alert(e.message,!0)})).catch((function(e){vt.alert(e,!1)}))}}]),t}(),bt=function(){function t(){e(this,t)}return n(t,[{key:"syncMenu",value:function(){for(var e=[],t=document.getElementById("nav-pages").children,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")});var r={menu:e,remove:null};return new Promise((function(e){e(r)}))}},{key:"removeItem",value:function(e){document.getElementById("nav-pages").removeChild(document.getElementById(e))}}]),t}();
/**!
* Sortable 1.13.0
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*/
function wt(e){return(wt="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 Et(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function It(){return(It=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}).apply(this,arguments)}function kt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){Et(e,t,n[t])}))}return e}function St(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Tt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var xt=Tt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Dt=Tt(/Edge/i),Pt=Tt(/firefox/i),_t=Tt(/safari/i)&&!Tt(/chrome/i)&&!Tt(/android/i),Bt=Tt(/iP(ad|od|hone)/i),Ot=Tt(/chrome/i)&&Tt(/android/i),Ct={capture:!1,passive:!1};function At(e,t,n){e.addEventListener(t,n,!xt&&Ct)}function Mt(e,t,n){e.removeEventListener(t,n,!xt&&Ct)}function Nt(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 Lt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function Rt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Nt(e,t):Nt(e,t))||r&&e===n)return e;if(e===n)break}while(e=Lt(e))}return null}var Ht,Ft=/\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(Ft," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Ft," ")}}function qt(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 Ut(e,t){var n="";if("string"==typeof e)n=e;else do{var r=qt(e,"transform");r&&"none"!==r&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function Yt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,a=r.length;if(n)for(;o<a;o++)n(r[o],o);return r}return[]}function jt(){var e=document.scrollingElement;return e||document.documentElement}function Wt(e,t,n,r,o){if(e.getBoundingClientRect||e===window){var a,i,l,u,s,c,d;if(e!==window&&e.parentNode&&e!==jt()?(i=(a=e.getBoundingClientRect()).top,l=a.left,u=a.bottom,s=a.right,c=a.height,d=a.width):(i=0,l=0,u=window.innerHeight,s=window.innerWidth,c=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(o=o||e.parentNode,!xt))do{if(o&&o.getBoundingClientRect&&("none"!==qt(o,"transform")||n&&"static"!==qt(o,"position"))){var f=o.getBoundingClientRect();i-=f.top+parseInt(qt(o,"border-top-width")),l-=f.left+parseInt(qt(o,"border-left-width")),u=i+a.height,s=l+a.width;break}}while(o=o.parentNode);if(r&&e!==window){var h=Ut(o||e),p=h&&h.a,g=h&&h.d;h&&(u=(i/=g)+(c/=g),s=(l/=p)+(d/=p))}return{top:i,left:l,bottom:u,right:s,width:d,height:c}}}function zt(e,t,n){for(var r=$t(e,!0),o=Wt(e)[t];r;){var a=Wt(r)[n];if(!("top"===n||"left"===n?o>=a:o<=a))return r;if(r===jt())break;r=$t(r,!1)}return!1}function Gt(e,t,n){for(var r=0,o=0,a=e.children;o<a.length;){if("none"!==a[o].style.display&&a[o]!==er.ghost&&a[o]!==er.dragged&&Rt(a[o],n.draggable,e,!1)){if(r===t)return a[o];r++}o++}return null}function Qt(e,t){for(var n=e.lastElementChild;n&&(n===er.ghost||"none"===qt(n,"display")||t&&!Nt(n,t));)n=n.previousElementSibling;return n||null}function Vt(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===er.clone||t&&!Nt(e,t)||n++;return n}function Jt(e){var t=0,n=0,r=jt();if(e)do{var o=Ut(e),a=o.a,i=o.d;t+=e.scrollLeft*a,n+=e.scrollTop*i}while(e!==r&&(e=e.parentNode));return[t,n]}function $t(e,t){if(!e||!e.getBoundingClientRect)return jt();var n=e,r=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=qt(n);if(n.clientWidth<n.scrollWidth&&("auto"==o.overflowX||"scroll"==o.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==o.overflowY||"scroll"==o.overflowY)){if(!n.getBoundingClientRect||n===document.body)return jt();if(r||t)return n;r=!0}}}while(n=n.parentNode);return jt()}function Zt(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 Kt(e,t){return function(){if(!Ht){var n=arguments,r=this;1===n.length?e.call(r,n[0]):e.apply(r,n),Ht=setTimeout((function(){Ht=void 0}),t)}}}function en(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function tn(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 nn="Sortable"+(new Date).getTime();function rn(){var e,t=[];return{captureAnimationState:function(){(t=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(e){if("none"!==qt(e,"display")&&e!==er.ghost){t.push({target:e,rect:Wt(e)});var n=kt({},t[t.length-1].rect);if(e.thisAnimationDuration){var r=Ut(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 o=!1,a=0;t.forEach((function(e){var t=0,n=e.target,i=n.fromRect,l=Wt(n),u=n.prevFromRect,s=n.prevToRect,c=e.rect,d=Ut(n,!0);d&&(l.top-=d.f,l.left-=d.e),n.toRect=l,n.thisAnimationDuration&&Zt(u,l)&&!Zt(i,l)&&(c.top-l.top)/(c.left-l.left)==(i.top-l.top)/(i.left-l.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,u,s,r.options)),Zt(l,i)||(n.prevFromRect=i,n.prevToRect=l,t||(t=r.options.animation),r.animate(n,c,l,t)),t&&(o=!0,a=Math.max(a,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),o?e=setTimeout((function(){"function"==typeof n&&n()}),a):"function"==typeof n&&n(),t=[]},animate:function(e,t,n,r){if(r){qt(e,"transition",""),qt(e,"transform","");var o=Ut(this.el),a=o&&o.a,i=o&&o.d,l=(t.left-n.left)/(a||1),u=(t.top-n.top)/(i||1);e.animatingX=!!l,e.animatingY=!!u,qt(e,"transform","translate3d("+l+"px,"+u+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),qt(e,"transition","transform "+r+"ms"+(this.options.easing?" "+this.options.easing:"")),qt(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){qt(e,"transition",""),qt(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),r)}}}}var on=[],an={initializeByDefault:!0},ln={mount:function(e){for(var t in an)an.hasOwnProperty(t)&&!(t in e)&&(e[t]=an[t]);on.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),on.push(e)},pluginEvent:function(e,t,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var o=e+"Global";on.forEach((function(r){t[r.pluginName]&&(t[r.pluginName][o]&&t[r.pluginName][o](kt({sortable:t},n)),t.options[r.pluginName]&&t[r.pluginName][e]&&t[r.pluginName][e](kt({sortable:t},n)))}))},initializePlugins:function(e,t,n,r){for(var o in on.forEach((function(r){var o=r.pluginName;if(e.options[o]||r.initializeByDefault){var a=new r(e,t,e.options);a.sortable=e,a.options=e.options,e[o]=a,It(n,a.defaults)}})),e.options)if(e.options.hasOwnProperty(o)){var a=this.modifyOption(e,o,e.options[o]);void 0!==a&&(e.options[o]=a)}},getEventProperties:function(e,t){var n={};return on.forEach((function(r){"function"==typeof r.eventProperties&&It(n,r.eventProperties.call(t[r.pluginName],e))})),n},modifyOption:function(e,t,n){var r;return on.forEach((function(o){e[o.pluginName]&&o.optionListeners&&"function"==typeof o.optionListeners[t]&&(r=o.optionListeners[t].call(e[o.pluginName],n))})),r}};var un=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=St(n,["evt"]);ln.pluginEvent.bind(er)(e,t,kt({dragEl:cn,parentEl:dn,ghostEl:fn,rootEl:hn,nextEl:pn,lastDownEl:gn,cloneEl:mn,cloneHidden:vn,dragStarted:Bn,putSortable:kn,activeSortable:er.active,originalEvent:r,oldIndex:yn,oldDraggableIndex:wn,newIndex:bn,newDraggableIndex:En,hideGhostForTarget:Jn,unhideGhostForTarget:$n,cloneNowHidden:function(){vn=!0},cloneNowShown:function(){vn=!1},dispatchSortableEvent:function(e){sn({sortable:t,name:e,originalEvent:r})}},o))};function sn(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,a=e.cloneEl,i=e.toEl,l=e.fromEl,u=e.oldIndex,s=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[nn]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||xt||Dt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=i||n,g.from=l||n,g.item=o||n,g.clone=a,g.oldIndex=u,g.newIndex=s,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=kt({},p,ln.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(kt({putSortable:kn,cloneEl:mn,targetEl:cn,rootEl:hn,oldIndex:yn,oldDraggableIndex:wn,newIndex:bn,newDraggableIndex:En},e))}var cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn,xn,Dn,Pn,_n,Bn,On,Cn,An,Mn,Nn=!1,Ln=!1,Rn=[],Hn=!1,Fn=!1,Xn=[],qn=!1,Un=[],Yn="undefined"!=typeof document,jn=Bt,Wn=Dt||xt?"cssFloat":"float",zn=Yn&&!Ot&&!Bt&&"draggable"in document.createElement("div"),Gn=function(){if(Yn){if(xt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Qn=function(e,t){var n=qt(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Gt(e,0,t),a=Gt(e,1,t),i=o&&qt(o),l=a&&qt(a),u=i&&parseInt(i.marginLeft)+parseInt(i.marginRight)+Wt(o).width,s=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+Wt(a).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(o&&i.float&&"none"!==i.float){var c="left"===i.float?"left":"right";return!a||"both"!==l.clear&&l.clear!==c?"horizontal":"vertical"}return o&&("block"===i.display||"flex"===i.display||"table"===i.display||"grid"===i.display||u>=r&&"none"===n[Wn]||a&&"none"===n[Wn]&&u+s>r)?"vertical":"horizontal"},Vn=function(e){function t(e,n){return function(r,o,a,i){var l=r.options.group.name&&o.options.group.name&&r.options.group.name===o.options.group.name;if(null==e&&(n||l))return!0;if(null==e||!1===e)return!1;if(n&&"clone"===e)return e;if("function"==typeof e)return t(e(r,o,a,i),n)(r,o,a,i);var u=(n?r:o).options.group.name;return!0===e||"string"==typeof e&&e===u||e.join&&e.indexOf(u)>-1}}var n={},r=e.group;r&&"object"==wt(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},Jn=function(){!Gn&&fn&&qt(fn,"display","none")},$n=function(){!Gn&&fn&&qt(fn,"display","")};Yn&&document.addEventListener("click",(function(e){if(Ln)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ln=!1,!1}),!0);var Zn=function(e){if(cn){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,a=e.clientY,Rn.some((function(e){if(!Qt(e)){var t=Wt(e),n=e[nn].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,l=a>=t.top-n&&a<=t.bottom+n;return n&&r&&l?i=e:void 0}})),i);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[nn]._onDragOver(n)}}var o,a,i},Kn=function(e){cn&&cn.parentNode[nn]._isOutsideThisEl(e.target)};function er(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=It({},t),e[nn]=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 Qn(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!==er.supportPointer&&"PointerEvent"in window&&!_t,emptyInsertThreshold:5};for(var r in ln.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Vn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&zn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?At(e,"pointerdown",this._onTapStart):(At(e,"mousedown",this._onTapStart),At(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(At(e,"dragover",this),At(e,"dragenter",this)),Rn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),It(this,rn())}function tr(e,t,n,r,o,a,i,l){var u,s,c=e[nn],d=c.options.onMove;return!window.CustomEvent||xt||Dt?(u=document.createEvent("Event")).initEvent("move",!0,!0):u=new CustomEvent("move",{bubbles:!0,cancelable:!0}),u.to=t,u.from=e,u.dragged=n,u.draggedRect=r,u.related=o||t,u.relatedRect=a||Wt(t),u.willInsertAfter=l,u.originalEvent=i,e.dispatchEvent(u),d&&(s=d.call(c,u,i)),s}function nr(e){e.draggable=!1}function rr(){qn=!1}function or(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 ar(e){return setTimeout(e,0)}function ir(e){return clearTimeout(e)}er.prototype={constructor:er,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(On=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,cn):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,r=this.options,o=r.preventOnFilter,a=e.type,i=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,l=(i||e).target,u=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,s=r.filter;if(function(e){Un.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Un.push(r)}}(n),!cn&&!(/mousedown|pointerdown/.test(a)&&0!==e.button||r.disabled)&&!u.isContentEditable&&(this.nativeDraggable||!_t||!l||"SELECT"!==l.tagName.toUpperCase())&&!((l=Rt(l,r.draggable,n,!1))&&l.animated||gn===l)){if(yn=Vt(l),wn=Vt(l,r.draggable),"function"==typeof s){if(s.call(this,e,l,this))return sn({sortable:t,rootEl:u,name:"filter",targetEl:l,toEl:n,fromEl:n}),un("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(s&&(s=s.split(",").some((function(r){if(r=Rt(u,r.trim(),n,!1))return sn({sortable:t,rootEl:r,name:"filter",targetEl:l,fromEl:n,toEl:n}),un("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!Rt(u,r.handle,n,!1)||this._prepareDragStart(e,i,l)}}},_prepareDragStart:function(e,t,n){var r,o=this,a=o.el,i=o.options,l=a.ownerDocument;if(n&&!cn&&n.parentNode===a){var u=Wt(n);if(hn=a,dn=(cn=n).parentNode,pn=cn.nextSibling,gn=n,In=i.group,er.dragged=cn,Sn={target:cn,clientX:(t||e).clientX,clientY:(t||e).clientY},Pn=Sn.clientX-u.left,_n=Sn.clientY-u.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,cn.style["will-change"]="all",r=function(){un("delayEnded",o,{evt:e}),er.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!Pt&&o.nativeDraggable&&(cn.draggable=!0),o._triggerDragStart(e,t),sn({sortable:o,name:"choose",originalEvent:e}),Xt(cn,i.chosenClass,!0))},i.ignore.split(",").forEach((function(e){Yt(cn,e.trim(),nr)})),At(l,"dragover",Zn),At(l,"mousemove",Zn),At(l,"touchmove",Zn),At(l,"mouseup",o._onDrop),At(l,"touchend",o._onDrop),At(l,"touchcancel",o._onDrop),Pt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,cn.draggable=!0),un("delayStart",this,{evt:e}),!i.delay||i.delayOnTouchOnly&&!t||this.nativeDraggable&&(Dt||xt))r();else{if(er.eventCanceled)return void this._onDrop();At(l,"mouseup",o._disableDelayedDrag),At(l,"touchend",o._disableDelayedDrag),At(l,"touchcancel",o._disableDelayedDrag),At(l,"mousemove",o._delayedDragTouchMoveHandler),At(l,"touchmove",o._delayedDragTouchMoveHandler),i.supportPointer&&At(l,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(r,i.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(){cn&&nr(cn),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Mt(e,"mouseup",this._disableDelayedDrag),Mt(e,"touchend",this._disableDelayedDrag),Mt(e,"touchcancel",this._disableDelayedDrag),Mt(e,"mousemove",this._delayedDragTouchMoveHandler),Mt(e,"touchmove",this._delayedDragTouchMoveHandler),Mt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?At(document,"pointermove",this._onTouchMove):At(document,t?"touchmove":"mousemove",this._onTouchMove):(At(cn,"dragend",this),At(hn,"dragstart",this._onDragStart));try{document.selection?ar((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Nn=!1,hn&&cn){un("dragStarted",this,{evt:t}),this.nativeDraggable&&At(document,"dragover",Kn);var n=this.options;!e&&Xt(cn,n.dragClass,!1),Xt(cn,n.ghostClass,!0),er.active=this,e&&this._appendGhost(),sn({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Tn){this._lastX=Tn.clientX,this._lastY=Tn.clientY,Jn();for(var e=document.elementFromPoint(Tn.clientX,Tn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Tn.clientX,Tn.clientY))!==t;)t=e;if(cn.parentNode[nn]._isOutsideThisEl(e),t)do{if(t[nn]){if(t[nn]._onDragOver({clientX:Tn.clientX,clientY:Tn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);$n()}},_onTouchMove:function(e){if(Sn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,a=fn&&Ut(fn,!0),i=fn&&a&&a.a,l=fn&&a&&a.d,u=jn&&Mn&&Jt(Mn),s=(o.clientX-Sn.clientX+r.x)/(i||1)+(u?u[0]-Xn[0]:0)/(i||1),c=(o.clientY-Sn.clientY+r.y)/(l||1)+(u?u[1]-Xn[1]:0)/(l||1);if(!er.active&&!Nn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(fn){a?(a.e+=s-(xn||0),a.f+=c-(Dn||0)):a={a:1,b:0,c:0,d:1,e:s,f:c};var d="matrix(".concat(a.a,",").concat(a.b,",").concat(a.c,",").concat(a.d,",").concat(a.e,",").concat(a.f,")");qt(fn,"webkitTransform",d),qt(fn,"mozTransform",d),qt(fn,"msTransform",d),qt(fn,"transform",d),xn=s,Dn=c,Tn=o}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!fn){var e=this.options.fallbackOnBody?document.body:hn,t=Wt(cn,!0,jn,!0,e),n=this.options;if(jn){for(Mn=e;"static"===qt(Mn,"position")&&"none"===qt(Mn,"transform")&&Mn!==document;)Mn=Mn.parentNode;Mn!==document.body&&Mn!==document.documentElement?(Mn===document&&(Mn=jt()),t.top+=Mn.scrollTop,t.left+=Mn.scrollLeft):Mn=jt(),Xn=Jt(Mn)}Xt(fn=cn.cloneNode(!0),n.ghostClass,!1),Xt(fn,n.fallbackClass,!0),Xt(fn,n.dragClass,!0),qt(fn,"transition",""),qt(fn,"transform",""),qt(fn,"box-sizing","border-box"),qt(fn,"margin",0),qt(fn,"top",t.top),qt(fn,"left",t.left),qt(fn,"width",t.width),qt(fn,"height",t.height),qt(fn,"opacity","0.8"),qt(fn,"position",jn?"absolute":"fixed"),qt(fn,"zIndex","100000"),qt(fn,"pointerEvents","none"),er.ghost=fn,e.appendChild(fn),qt(fn,"transform-origin",Pn/parseInt(fn.style.width)*100+"% "+_n/parseInt(fn.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,r=e.dataTransfer,o=n.options;un("dragStart",this,{evt:e}),er.eventCanceled?this._onDrop():(un("setupClone",this),er.eventCanceled||((mn=tn(cn)).draggable=!1,mn.style["will-change"]="",this._hideClone(),Xt(mn,this.options.chosenClass,!1),er.clone=mn),n.cloneId=ar((function(){un("clone",n),er.eventCanceled||(n.options.removeCloneOnHide||hn.insertBefore(mn,cn),n._hideClone(),sn({sortable:n,name:"clone"}))})),!t&&Xt(cn,o.dragClass,!0),t?(Ln=!0,n._loopId=setInterval(n._emulateDragOver,50)):(Mt(document,"mouseup",n._onDrop),Mt(document,"touchend",n._onDrop),Mt(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",o.setData&&o.setData.call(n,r,cn)),At(document,"drop",n),qt(cn,"transform","translateZ(0)")),Nn=!0,n._dragStartId=ar(n._dragStarted.bind(n,t,e)),At(document,"selectstart",n),Bn=!0,_t&&qt(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,r,o,a=this.el,i=e.target,l=this.options,u=l.group,s=er.active,c=In===u,d=l.sort,f=kn||s,h=this,p=!1;if(!qn){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),i=Rt(i,l.draggable,a,!0),P("dragOver"),er.eventCanceled)return p;if(cn.contains(e.target)||i.animated&&i.animatingX&&i.animatingY||h._ignoreWhileAnimating===i)return B(!1);if(Ln=!1,s&&!l.disabled&&(c?d||(r=!hn.contains(cn)):kn===this||(this.lastPutMode=In.checkPull(this,s,cn,e))&&u.checkPut(this,s,cn,e))){if(o="vertical"===this._getDirection(e,i),t=Wt(cn),P("dragOverValid"),er.eventCanceled)return p;if(r)return dn=hn,_(),this._hideClone(),P("revert"),er.eventCanceled||(pn?hn.insertBefore(cn,pn):hn.appendChild(cn)),B(!0);var g=Qt(a,l.draggable);if(!g||function(e,t,n){var r=Wt(Qt(n.el,n.options.draggable)),o=10;return t?e.clientX>r.right+o||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+o}(e,o,this)&&!g.animated){if(g===cn)return B(!1);if(g&&a===e.target&&(i=g),i&&(n=Wt(i)),!1!==tr(hn,a,cn,t,i,n,e,!!i))return _(),a.appendChild(cn),dn=a,O(),B(!0)}else if(i.parentNode===a){n=Wt(i);var m,v,y,b=cn.parentNode!==a,w=!function(e,t,n){var r=n?e.left:e.top,o=n?e.right:e.bottom,a=n?e.width:e.height,i=n?t.left:t.top,l=n?t.right:t.bottom,u=n?t.width:t.height;return r===i||o===l||r+a/2===i+u/2}(cn.animated&&cn.toRect||t,i.animated&&i.toRect||n,o),E=o?"top":"left",I=zt(i,"top","top")||zt(cn,"top","top"),k=I?I.scrollTop:void 0;if(On!==i&&(v=n[E],Hn=!1,Fn=!w&&l.invertSwap||b),0!==(m=function(e,t,n,r,o,a,i,l){var u=r?e.clientY:e.clientX,s=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!i)if(l&&An<s*o){if(!Hn&&(1===Cn?u>c+s*a/2:u<d-s*a/2)&&(Hn=!0),Hn)f=!0;else if(1===Cn?u<c+An:u>d-An)return-Cn}else if(u>c+s*(1-o)/2&&u<d-s*(1-o)/2)return function(e){return Vt(cn)<Vt(e)?1:-1}(t);if((f=f||i)&&(u<c+s*a/2||u>d-s*a/2))return u>c+s/2?1:-1;return 0}(e,i,n,o,w?1:l.swapThreshold,null==l.invertedSwapThreshold?l.swapThreshold:l.invertedSwapThreshold,Fn,On===i))){var S=Vt(cn);do{S-=m,y=dn.children[S]}while(y&&("none"===qt(y,"display")||y===fn))}if(0===m||y===i)return B(!1);On=i,Cn=m;var T=i.nextElementSibling,x=!1,D=tr(hn,a,cn,t,i,n,e,x=1===m);if(!1!==D)return 1!==D&&-1!==D||(x=1===D),qn=!0,setTimeout(rr,30),_(),x&&!T?a.appendChild(cn):i.parentNode.insertBefore(cn,x?T:i),I&&en(I,0,k-I.scrollTop),dn=cn.parentNode,void 0===v||Fn||(An=Math.abs(v-Wt(i)[E])),O(),B(!0)}if(a.contains(cn))return B(!1)}return!1}function P(l,u){un(l,h,kt({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:i,completed:B,onMove:function(n,r){return tr(hn,a,cn,t,n,Wt(n),e,r)},changed:O},u))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?s._hideClone():s._showClone(h),h!==f&&(Xt(cn,kn?kn.options.ghostClass:s.options.ghostClass,!1),Xt(cn,l.ghostClass,!0)),kn!==h&&h!==er.active?kn=h:h===er.active&&kn&&(kn=null),f===h&&(h._ignoreWhileAnimating=i),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(i===cn&&!cn.animated||i===a&&!i.animated)&&(On=null),l.dragoverBubble||e.rootEl||i===document||(cn.parentNode[nn]._isOutsideThisEl(e.target),!t&&Zn(e)),!l.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function O(){bn=Vt(cn),En=Vt(cn,l.draggable),sn({sortable:h,name:"change",toEl:a,newIndex:bn,newDraggableIndex:En,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Mt(document,"mousemove",this._onTouchMove),Mt(document,"touchmove",this._onTouchMove),Mt(document,"pointermove",this._onTouchMove),Mt(document,"dragover",Zn),Mt(document,"mousemove",Zn),Mt(document,"touchmove",Zn)},_offUpEvents:function(){var e=this.el.ownerDocument;Mt(e,"mouseup",this._onDrop),Mt(e,"touchend",this._onDrop),Mt(e,"pointerup",this._onDrop),Mt(e,"touchcancel",this._onDrop),Mt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;bn=Vt(cn),En=Vt(cn,n.draggable),un("drop",this,{evt:e}),dn=cn&&cn.parentNode,bn=Vt(cn),En=Vt(cn,n.draggable),er.eventCanceled||(Nn=!1,Fn=!1,Hn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),ir(this.cloneId),ir(this._dragStartId),this.nativeDraggable&&(Mt(document,"drop",this),Mt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),_t&&qt(document.body,"user-select",""),qt(cn,"transform",""),e&&(Bn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),fn&&fn.parentNode&&fn.parentNode.removeChild(fn),(hn===dn||kn&&"clone"!==kn.lastPutMode)&&mn&&mn.parentNode&&mn.parentNode.removeChild(mn),cn&&(this.nativeDraggable&&Mt(cn,"dragend",this),nr(cn),cn.style["will-change"]="",Bn&&!Nn&&Xt(cn,kn?kn.options.ghostClass:this.options.ghostClass,!1),Xt(cn,this.options.chosenClass,!1),sn({sortable:this,name:"unchoose",toEl:dn,newIndex:null,newDraggableIndex:null,originalEvent:e}),hn!==dn?(bn>=0&&(sn({rootEl:dn,name:"add",toEl:dn,fromEl:hn,originalEvent:e}),sn({sortable:this,name:"remove",toEl:dn,originalEvent:e}),sn({rootEl:dn,name:"sort",toEl:dn,fromEl:hn,originalEvent:e}),sn({sortable:this,name:"sort",toEl:dn,originalEvent:e})),kn&&kn.save()):bn!==yn&&bn>=0&&(sn({sortable:this,name:"update",toEl:dn,originalEvent:e}),sn({sortable:this,name:"sort",toEl:dn,originalEvent:e})),er.active&&(null!=bn&&-1!==bn||(bn=yn,En=wn),sn({sortable:this,name:"end",toEl:dn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){un("nulling",this),hn=cn=dn=fn=pn=mn=gn=vn=Sn=Tn=Bn=bn=En=yn=wn=On=Cn=kn=In=er.dragged=er.ghost=er.clone=er.active=null,Un.forEach((function(e){e.checked=!0})),Un.length=xn=Dn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":cn&&(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,o=n.length,a=this.options;r<o;r++)Rt(e=n[r],a.draggable,this.el,!1)&&t.push(e.getAttribute(a.dataIdAttr)||or(e));return t},sort:function(e,t){var n={},r=this.el;this.toArray().forEach((function(e,t){var o=r.children[t];Rt(o,this.options.draggable,r,!1)&&(n[e]=o)}),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 Rt(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=ln.modifyOption(this,e,t);n[e]=void 0!==r?r:t,"group"===e&&Vn(n)},destroy:function(){un("destroy",this);var e=this.el;e[nn]=null,Mt(e,"mousedown",this._onTapStart),Mt(e,"touchstart",this._onTapStart),Mt(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(Mt(e,"dragover",this),Mt(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),Rn.splice(Rn.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!vn){if(un("hideClone",this),er.eventCanceled)return;qt(mn,"display","none"),this.options.removeCloneOnHide&&mn.parentNode&&mn.parentNode.removeChild(mn),vn=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(vn){if(un("showClone",this),er.eventCanceled)return;cn.parentNode!=hn||this.options.group.revertClone?pn?hn.insertBefore(mn,pn):hn.appendChild(mn):hn.insertBefore(mn,cn),this.options.group.revertClone&&this.animate(cn,mn),qt(mn,"display",""),vn=!1}}else this._hideClone()}},Yn&&At(document,"touchmove",(function(e){(er.active||Nn)&&e.cancelable&&e.preventDefault()})),er.utils={on:At,off:Mt,css:qt,find:Yt,is:function(e,t){return!!Rt(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:Kt,closest:Rt,toggleClass:Xt,clone:tn,index:Vt,nextTick:ar,cancelNextTick:ir,detectDirection:Qn,getChild:Gt},er.get=function(e){return e[nn]},er.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&&(er.utils=kt({},er.utils,e.utils)),ln.mount(e)}))},er.create=function(e,t){return new er(e,t)},er.version="1.13.0";var lr,ur,sr,cr,dr,fr,hr=[],pr=!1;function gr(){hr.forEach((function(e){clearInterval(e.pid)})),hr=[]}function mr(){clearInterval(fr)}var vr=Kt((function(e,t,n,r){if(t.scroll){var o,a=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,l=t.scrollSensitivity,u=t.scrollSpeed,s=jt(),c=!1;ur!==n&&(ur=n,gr(),lr=t.scroll,o=t.scrollFn,!0===lr&&(lr=$t(n,!0)));var d=0,f=lr;do{var h=f,p=Wt(h),g=p.top,m=p.bottom,v=p.left,y=p.right,b=p.width,w=p.height,E=void 0,I=void 0,k=h.scrollWidth,S=h.scrollHeight,T=qt(h),x=h.scrollLeft,D=h.scrollTop;h===s?(E=b<k&&("auto"===T.overflowX||"scroll"===T.overflowX||"visible"===T.overflowX),I=w<S&&("auto"===T.overflowY||"scroll"===T.overflowY||"visible"===T.overflowY)):(E=b<k&&("auto"===T.overflowX||"scroll"===T.overflowX),I=w<S&&("auto"===T.overflowY||"scroll"===T.overflowY))
;var P=E&&(Math.abs(y-a)<=l&&x+b<k)-(Math.abs(v-a)<=l&&!!x),_=I&&(Math.abs(m-i)<=l&&D+w<S)-(Math.abs(g-i)<=l&&!!D);if(!hr[d])for(var B=0;B<=d;B++)hr[B]||(hr[B]={});hr[d].vx==P&&hr[d].vy==_&&hr[d].el===h||(hr[d].el=h,hr[d].vx=P,hr[d].vy=_,clearInterval(hr[d].pid),0==P&&0==_||(c=!0,hr[d].pid=setInterval(function(){r&&0===this.layer&&er.active._onTouchMove(dr);var t=hr[this.layer].vy?hr[this.layer].vy*u:0,n=hr[this.layer].vx?hr[this.layer].vx*u:0;"function"==typeof o&&"continue"!==o.call(er.dragged.parentNode[nn],n,t,e,dr,hr[this.layer].el)||en(hr[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&f!==s&&(f=$t(f,!1)));pr=c}}),30),yr=function(e){var t=e.originalEvent,n=e.putSortable,r=e.dragEl,o=e.activeSortable,a=e.dispatchSortableEvent,i=e.hideGhostForTarget,l=e.unhideGhostForTarget;if(t){var u=n||o;i();var s=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,c=document.elementFromPoint(s.clientX,s.clientY);l(),u&&!u.el.contains(c)&&(a("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function br(){}function wr(){}br.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=Gt(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:yr},It(br,{pluginName:"revertOnSpill"}),wr.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:yr},It(wr,{pluginName:"removeOnSpill"}),er.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,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?At(document,"dragover",this._handleAutoScroll):this.options.supportPointer?At(document,"pointermove",this._handleFallbackAutoScroll):t.touches?At(document,"touchmove",this._handleFallbackAutoScroll):At(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?Mt(document,"dragover",this._handleAutoScroll):(Mt(document,"pointermove",this._handleFallbackAutoScroll),Mt(document,"touchmove",this._handleFallbackAutoScroll),Mt(document,"mousemove",this._handleFallbackAutoScroll)),mr(),gr(),clearTimeout(Ht),Ht=void 0},nulling:function(){dr=ur=lr=pr=fr=sr=cr=null,hr.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,r=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,a=document.elementFromPoint(r,o);if(dr=e,t||Dt||xt||_t){vr(e,this.options,a,t);var i=$t(a,!0);!pr||fr&&r===sr&&o===cr||(fr&&mr(),fr=setInterval((function(){var a=$t(document.elementFromPoint(r,o),!0);a!==i&&(i=a,gr()),vr(e,n.options,a,t)}),10),sr=r,cr=o)}else{if(!this.options.bubbleScroll||$t(a,!0)===jt())return void gr();vr(e,this.options,$t(a,!1),!1)}}},It(e,{pluginName:"scroll",initializeByDefault:!0})}),er.mount(wr,br);var Er=new ct,Ir=function(){function t(){e(this,t),this.admin=new R,this.start()}return n(t,[{key:"start",value:function(){var e=this,t=this;er.create(document.getElementById("nav-pages"),{onUpdate:function(){(new bt).syncMenu().then((function(e){Er.alert("Updating Menu",null),t.admin.syncNav(e).then((function(e){e.type,Er.alert(e.message,!0)}))}))}});for(var n=document.querySelectorAll(".nav-btn"),r=0,o=n.length;r<o;r++)n[r].addEventListener("click",(function(t){return e.handleNavButton(t)}),!1)}},{key:"handleNavButton",value:function(e){var t="",n=this;switch(e.target.id){case"remove-item":t=e.target.getAttribute("data-id"),(new bt).removeItem(t),(new bt).syncMenu().then((function(t){t.remove=e.target.getAttribute("data-uuid"),Er.alert("Editing Menu",null),n.admin.syncNav(t).then((function(e){e.type,Er.alert(e.message,!0)}))}));break;case"edit-item":window.location="/dashboard/page/edit/"+e.target.getAttribute("data-id")}}}]),t}(),kr=function(){function t(){e(this,t),this.currentDisplay="",this.urlPieces=document.URL.split("/"),this.chooseDisplay(this.urlPieces[4],this.urlPieces[5])}return n(t,[{key:"start",value:function(){}},{key:"chooseDisplay",value:function(e,t){switch(this.currentDisplay="",e){case"page":this.currentDisplay=new ht(t);break;case"settings":this.currentDisplay=new yt;break;case"navigation":this.currentDisplay=new Ir}this.start()}}]),t}(),Sr=new H,Tr=new ct,xr=function(){function t(){e(this,t),this.start()}return n(t,[{key:"start",value:function(){var e=this;if(document.getElementById("dash-form")||document.getElementById("dash-init")){for(var t=document.getElementsByClassName("init-option"),n=0;n<t.length;n++)t[n].addEventListener("click",(function(t){return e.handleOptions(t)}));document.getElementById("dash-form")?document.getElementById("login-btn").addEventListener("click",(function(t){return e.handleLogin(t)})):(document.getElementById("init-blog").addEventListener("click",(function(t){return e.handleSetup(t)})),document.getElementById("blog-restore").addEventListener("click",(function(t){return e.handleRestore(t)})))}else new kr}},{key:"handleLogin",value:function(e){e.stopPropagation(),e.preventDefault();var t=Sr.formDataToJSON(document.getElementById("login"));Tr.alert("Looking, hold up",null),(new B).login(t).then((function(t){t.type===u?Tr.alert(t.message,!1):(Tr.alert(t.message,!0),e.target.innerHTML=t.message,setTimeout((function(){window.location="/dashboard"}),500))})).catch((function(e){Tr.alert(e,!1)}))}},{key:"handleSetup",value:function(e){e.stopPropagation(),e.preventDefault();var t=Sr.formDataToJSON(document.getElementById("init-form"));(new B).init(t).then((function(e){e.type===S?Tr.alert(e.message,!1):(Tr.alert(e.message,!0),setTimeout((function(){window.location="/dashboard"}),700))})).catch((function(e){Tr.alert(e,!1)}))}},{key:"handleRestore",value:function(e){e.stopPropagation(),e.preventDefault();var t=new B,n=document.getElementById("init-restore");t.handleInitRestore(n).then((function(e){e.type===u?Tr.alert(e.message,!1):(Tr.alert(e.message,!0),setTimeout((function(){window.location="/dashboard"}),700))})).catch((function(e){Tr.alert(e,!1)}))}},{key:"handleOptions",value:function(e){e.stopPropagation(),e.preventDefault();var 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="block",n.style.visibility="visible"):(t.style.display="block",t.style.visibility="visible",n.style.display="none",n.style.visibility="hidden")}}]),t}();document.addEventListener("DOMContentLoaded",(function(){new xr}),!1)}();
//# sourceMappingURL=dash.min.js.map