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