From 83b4aff716e0a399065fd5cd57ba07a558911295 Mon Sep 17 00:00:00 2001 From: Ro Date: Wed, 21 Jul 2021 12:46:14 -0700 Subject: [PATCH 1/2] added admin API method for getting site and member info --- brain/api/v1/SettingsAPI.inc.php | 44 +++++++++++++++++++++++++ brain/controller/APIControl.inc.php | 21 ++++++++++-- public/assets/scripts/dash.min.js | 8 ++--- src/libraries/FipamoAdminAPI.js | 51 ++++++++++++++++++++++++++++- 4 files changed, 117 insertions(+), 7 deletions(-) diff --git a/brain/api/v1/SettingsAPI.inc.php b/brain/api/v1/SettingsAPI.inc.php index da6394e..a606da7 100644 --- a/brain/api/v1/SettingsAPI.inc.php +++ b/brain/api/v1/SettingsAPI.inc.php @@ -55,6 +55,50 @@ class SettingsAPI return $result; } + public static function getInfo($request, $args) + { + $task = $args["fourth"]; + switch ($task) { + case "site": + $config = new Settings(); + $settings = $config->getSettings(); + $data = [ + "title" => $settings["global"]["title"], + "base_url" => $settings["global"]["base_url"], + "description" => $settings["global"]["descriptions"], + ]; + $result = [ + "message" => "Settings Found", + "type" => "GET_SETTINGS", + "data" => $data, + ]; + break; + case "member": + if (Session::active()) { + $member = $member = Session::get("member"); + $data = ["handle" => $member["handle"], "email" => $member["email"]]; + $result = [ + "message" => "Member Info Found", + "type" => "GET_MEMBER_INFO", + "data" => $data, + ]; + } else { + $result = [ + "message" => "Not logged in. C'mon, bruh", + "type" => "TASK_NONE", + ]; + } + break; + default: + $result = [ + "message" => "No Settings found. Frowny Face", + "type" => "TASK_NONE", + ]; + break; + } + return $result; + } + public static function createBackup() { $result = Maintenance::makeBackup(); diff --git a/brain/controller/APIControl.inc.php b/brain/controller/APIControl.inc.php index 447b70f..9e8e413 100644 --- a/brain/controller/APIControl.inc.php +++ b/brain/controller/APIControl.inc.php @@ -17,7 +17,6 @@ class APIControl array $args ): ResponseInterface { $filename = ""; - switch (isset($args["third"]) ? $args["third"] : "none") { case "status": if (Member::verifyKey($_GET["key"])) { @@ -40,7 +39,25 @@ class APIControl "type" => "API_ERROR", ]; } - + break; + case "settings": + $token = $request->getHeader("fipamo-access-token"); + //Verify token to get site info + if (isset($token[0])) { + if (Session::verifyToken($token[0])) { + $result = SettingsAPI::getInfo($request, $args); + } else { + $result = [ + "message" => "Invalid token, API access denied, homie", + "type" => "API_ERROR", + ]; + } + } else { + $result = [ + "message" => "No token, API access denied, homie", + "type" => "API_ERROR", + ]; + } break; case "files": if (Session::active()) { diff --git a/public/assets/scripts/dash.min.js b/public/assets/scripts/dash.min.js index 2df1bc7..82f3d81 100644 --- a/public/assets/scripts/dash.min.js +++ b/public/assets/scripts/dash.min.js @@ -1,11 +1,11 @@ -!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;n0&&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+c+"?key="+this.key:c+"?key="+this.key).then((function(e){e.type===w&&(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+h:h,"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 a="";switch(e){case"syncSite":a="/api/v1/settings/sync";break;case"syncNav":a="/api/v1/settings/nav-sync"}n._request(n.baseURL?n.baseURL+a+"?key="+n.key:a+"?key="+n.key,p,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,a=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.key=this.key,t.remote=!0):t.remote=!1,new Promise((function(e,i){a._request(a.baseURL?a.baseURL+n:n,r,s,o,t).then((function(t){e(t)})).catch((function(e){i(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:"_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,a=this;return new Promise((function(i,c){var d=new XMLHttpRequest;if(d.upload.onprogress=a.handleLoadProgress,d.open(n,e,!0),d.onload=function(){if(200==d.status){var e=JSON.parse(d.response);i(e)}else{var t=JSON.parse(d.response);c(t)}},"PUT"==n||n==s)switch(t!==p&&t!==v&&t!==m&&t!==y&&t!==g&&t!==b||d.setRequestHeader("fipamo-access-token",a.token),r){case l:d.setRequestHeader("Content-type","application/"+r),d.send(JSON.stringify(o));break;case u:d.send(o)}else d.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),I="POST",k="json",S="x-www-form-urlencoded",T=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.baseURL=null,this.key=null,r&&(this.key=r),n&&(this.baseURL=n)}return n(t,[{key:"create",value:function(e){var t=this;return new Promise((function(n,r){t._request("/api/v1/init","blogInit",I,k,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",I,k,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",I,k,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"}var i=new FormData;n.baseURL?(i.append("key",n.key),i.append("remote",!0)):i.append("remote",!1);for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:"GET",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:k,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=this;return new Promise((function(t,i){var s=new XMLHttpRequest;if(s.upload.onprogress=a.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);i(n)}},"PUT"==n||n==I)switch(r){case k:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case S:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),D=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}(),x="requestLame",P="postUpdated";new function t(){e(this,t)};var _=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 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]*>/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 _).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 if(document.getElementById("featured-image")){var i=document.getElementById("featured-image").src;null!=i||null!=i?r.append("feature_image",i):r.append("feature_image",null)}t(r)}))}}]),t}(),A="editorDelete",C="editorUploadImage",O="editorSave",L="editorUpdate";new function t(){e(this,t)};var M=["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"],N=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&&M.push("width"),M.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 R(e){return(R="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 U=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}},H=function(e){return"object"===R(e)&&null!==e},F=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,"
")};(t.customPos||0===t.customPos)&&(r=t.customPos);var a=void 0===r?n():r,i=e.value.slice(0,a),s=e.value.slice(a),l=''.concat(o(i),"");l+='|',l+=''.concat(o(s),"");var u=N(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(),a=r.documentElement,i=n.pageXOffset||a.scrollLeft,s=n.pageYOffset||a.scrollTop;return{top:o.top+s,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}},X=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(),s=a?t.customPos:n.endOffset;i.setStart(n.endContainer,s-1<0?0:s-1),i.setEnd(n.endContainer,s);var l=i.getBoundingClientRect();o={height:l.height,left:l.left+l.width,top:l.top},i.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,a=!1;!function e(i,s){for(var l=0;l=i){a=!0;var c=t.document.createRange();c.setStart(u,i-o),r.removeAllRanges(),r.addRange(c);break}o+=u.length}else e(n,u)}}(n,e)}return e},getPosition:function(){var r=n(),a=o(),i=e.getBoundingClientRect(),s=i.top+t.document.body.scrollTop,l=i.left+t.document.body.scrollLeft;return r.left-=l,r.top-=s,r.pos=a,r},getOffset:n,getRange:r}}(e,t):F(e,t)},Y=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;H(t)&&(r=t,t=null);var o=U(r),a=X(e,o);return t||0===t?a.setPos(t):a.getPosition()},q=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/g)>-1){var o=Y(e.textEditor).pos;t.refresh(),Y(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");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 P:document.getElementById("submit-update").classList.add("icon-hide"),document.getElementById("submit-good").classList.remove("icon-hide"),document.getElementById("edit-update").classList.remove("submit-start"),document.getElementById("edit-update").classList.add("submit-cool"),setTimeout((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 C:var n,r;Y(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(""+r+""));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=Y(this.textEditor).pos,this.emitEvent(C);break;case"submit-save":case"edit-save":this.emitEvent(O);break;case"submit-update":case"edit-update":this.emitEvent(L);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(A)}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-1}function J(e,t){return e.apply(null,t)}var $={arr:function(e){return Array.isArray(e)},obj:function(e){return V(Object.prototype.toString.call(e),"Object")},pth:function(e){return $.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||$.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 $.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 $.hex(e)||$.rgb(e)||$.hsl(e)},key:function(e){return!j.hasOwnProperty(e)&&!W.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function Z(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function K(e,t){var n=Z(e),r=Q($.und(n[0])?1:n[0],.1,100),o=Q($.und(n[1])?100:n[1],.1,100),a=Q($.und(n[2])?10:n[2],.1,100),i=Q($.und(n[3])?0:n[3],.1,100),s=Math.sqrt(o/r),l=a/(2*Math.sqrt(o*r)),u=l<1?s*Math.sqrt(1-l*l):0,c=l<1?(l*s-i)/u:-i+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=G.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 G.springs[e]=a,a}}function ee(e){return void 0===e&&(e=10),function(t){return Math.ceil(Q(t,1e-6,1)*e)*(1/e)}}var te,ne,re=function(){var e=.1;function t(e,t){return 1-3*t+3*e}function n(e,t){return 3*t-6*e}function r(e){return 3*e}function 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 s=new Float32Array(11);if(t!==n||r!==i)for(var l=0;l<11;++l)s[l]=o(l*e,t,r);return function(e){return t===n&&r===i||0===e||1===e?e:o(u(e),n,i)}}function u(n){for(var i=0,l=1;10!==l&&s[l]<=n;++l)i+=e;--l;var u=i+(n-s[l])/(s[l+1]-s[l])*e,c=a(u,t,r);return c>=.001?function(e,t,n,r){for(var i=0;i<4;++i){var s=a(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,a){var i,s,l=0;do{(i=o(s=t+(n-t)/2,r,a)-e)>0?n=s:t=s}while(Math.abs(i)>1e-7&&++l<10);return s}(n,i,i+e,t,r)}}}(),oe=(te={linear:function(){return function(e){return e}}},ne={Sine:function(){return function(e){return 1-Math.cos(e*Math.PI/2)}},Circ:function(){return function(e){return 1-Math.sqrt(1-e*e)}},Back:function(){return function(e){return e*e*(3*e-2)}},Bounce:function(){return function(e){for(var t,n=4;e<((t=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*t-2)/22-e,2)}},Elastic:function(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var n=Q(e,1,10),r=Q(t,.1,2);return function(e){return 0===e||1===e?e:-n*Math.pow(2,10*(e-1))*Math.sin((e-1-r/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/r)}}},["Quad","Cubic","Quart","Quint","Expo"].forEach((function(e,t){ne[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(ne).forEach((function(e){var t=ne[e];te["easeIn"+e]=t,te["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},te["easeInOut"+e]=function(e,n){return function(r){return r<.5?t(e,n)(2*r)/2:1-t(e,n)(-2*r+2)/2}},te["easeOutIn"+e]=function(e,n){return function(r){return r<.5?(1-t(e,n)(1-2*r))/2:(t(e,n)(2*r-1)+1)/2}}})),te);function ae(e,t){if($.fnc(e))return e;var n=e.split("(")[0],r=oe[n],o=Z(e);switch(n){case"spring":return K(e,t);case"cubicBezier":return J(re,o);case"steps":return J(ee,o);default:return J(r,o)}}function ie(e){try{return document.querySelectorAll(e)}catch(e){return}}function se(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],a=0;a1&&(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=s;else{var c=s<.5?s*(1+i):s+i-s*i,d=2*s-c;t=u(d,c,a+1/3),n=u(d,c,a),r=u(d,c,a-1/3)}return"rgba("+255*t+","+255*n+","+255*r+","+l+")"}(e):void 0;var t,n}function ge(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 me(e,t){return $.fnc(e)?e(t.target,t.id,t.total):e}function ve(e,t){return e.getAttribute(t)}function ye(e,t,n){if(ce([n,"deg","rad","turn"],ge(t)))return t;var r=G.CSS[t+n];if(!$.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 s=i*parseFloat(t);return G.CSS[t+n]=s,s}function be(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?ye(e,o,n):o}}function we(e,t){return $.dom(e)&&!$.inp(e)&&(!$.nil(ve(e,t))||$.svg(e)&&e[t])?"attribute":$.dom(e)&&ce(z,t)?"transform":$.dom(e)&&"transform"!==t&&be(e,t)?"css":null!=e[t]?"object":void 0}function Ee(e){if($.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 Ie(e,t,n,r){var o=V(t,"scale")?1:0+function(e){return V(e,"translate")||"perspective"===e?"px":V(e,"rotate")||V(e,"skew")?"deg":void 0}(t),a=Ee(e).get(t)||o;return n&&(n.transforms.list.set(t,a),n.transforms.last=t),r?ye(e,a,r):a}function ke(e,t,n,r){switch(we(e,t)){case"transform":return Ie(e,t,r,n);case"css":return be(e,t,n);case"attribute":return ve(e,t);default:return e[t]||0}}function Se(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=ge(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 Te(e,t){if($.col(e))return pe(e);if(/\s/g.test(e))return e;var n=ge(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function De(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function xe(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=De(t,a)),t=a}return r}function Pe(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*ve(e,"r")}(e);case"rect":return function(e){return 2*ve(e,"width")+2*ve(e,"height")}(e);case"line":return function(e){return De({x:ve(e,"x1"),y:ve(e,"y1")},{x:ve(e,"x2"),y:ve(e,"y2")})}(e);case"polyline":return xe(e);case"polygon":return function(e){var t=e.points;return xe(e)+De(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function _e(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;$.svg(t)&&$.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),a=ve(r,"viewBox"),i=o.width,s=o.height,l=n.viewBox||(a?a.split(" "):[0,0,i,s]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:i,h:s,vW:l[2],vH:l[3]}}function Be(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=_e(e.el,e.svg),a=r(),i=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(a.x-o.x)*l;case"y":return(a.y-o.y)*u;case"angle":return 180*Math.atan2(s.y-i.y,s.x-i.x)/Math.PI}}function Ae(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=Te($.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:$.str(e)||t?r.split(n):[]}}function Ce(e){return se(e?le($.arr(e)?e.map(ue):ue(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Oe(e){var t=Ce(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:Ee(e)}}}))}function Le(e,t){var n=de(t);if(/^spring/.test(n.easing)&&(n.duration=K(n.easing)),$.arr(e)){var r=e.length;2===r&&!$.obj(e[0])?e={value:e}:$.fnc(t.duration)||(n.duration=t.duration/r)}var o=$.arr(e)?e:[e];return o.map((function(e,n){var r=$.obj(e)&&!$.pth(e)?e:{value:e};return $.und(r.delay)&&(r.delay=n?0:t.delay),$.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return he(e,n)}))}function Me(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=he(function(e){for(var t=se(le(e.map((function(e){return Object.keys(e)}))),(function(e){return $.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)$.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){We.suspendWhenDocumentHidden&&(je()?e=cancelAnimationFrame(e):(Ye.forEach((function(e){return e._onDocumentVisibility()})),qe()))})),function(){e||je()&&We.suspendWhenDocumentHidden||!(Ye.length>0)||(e=requestAnimationFrame(t))}}();function je(){return!!document&&document.hidden}function We(e){void 0===e&&(e={});var t,n=0,r=0,o=0,a=0,i=null;function s(e){var t=window.Promise&&new Promise((function(e){return i=e}));return e.finished=t,t}var l=function(e){var t=fe(j,e),n=fe(W,e),r=Me(n,e),o=Oe(e.targets),a=He(o,r),i=Fe(a,n),s=Xe;return Xe++,he(t,{id:s,children:[],animatables:o,animations:a,duration:i.duration,delay:i.delay,endDelay:i.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/We.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("complete"),!l.passThrough&&"Promise"in window&&(i(),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=a=t.length;n--;)l.children[n].reset();(l.reversed&&!0!==l.loop||"alternate"===e&&1===l.loop)&&l.remaining++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Ue(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*We.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,Ye.push(l),d(),qe())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Ge(Ce(e),l)},l.reset(),l.autoplay&&l.play(),l}function ze(e,t){for(var n=t.length;n--;)ce(e,t[n].animatable.target)&&t.splice(n,1)}function Ge(e,t){var n=t.animations,r=t.children;ze(e,n);for(var o=r.length;o--;){var a=r[o],i=a.animations;ze(e,i),i.length||a.children.length||r.splice(o,1)}n.length||r.length||t.pause()}We.version="3.2.1",We.speed=1,We.suspendWhenDocumentHidden=!0,We.running=Ye,We.remove=function(e){for(var t=Ce(e),n=Ye.length;n--;){Ge(t,Ye[n])}},We.get=ke,We.set=Ue,We.convertPx=ye,We.path=function(e,t){var n=$.str(e)?ie(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:_e(n),totalLength:Pe(n)*(r/100)}}},We.setDashoffset=function(e){var t=Pe(e);return e.setAttribute("stroke-dasharray",t),t},We.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?ae(t.easing):null,o=t.grid,a=t.axis,i=t.from||0,s="first"===i,l="center"===i,u="last"===i,c=$.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=ge(c?e[1]:e)||0,p=t.start||0+(c?d:0),g=[],m=0;return function(e,t,v){if(s&&(i=0),l&&(i=(v-1)/2),u&&(i=v-1),!g.length){for(var y=0;y-1&&Ye.splice(o,1);for(var s=0;s'].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;tt.alert("Uploading Image",null),(new T).imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(C,e.url),tt.alert("Image Added to Entry",!0)})).catch((function(){tt.alert("Uh oh. Image not added",!1)}))}}]),t}();nt.uploadFiles=[];var rt=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 nt}}}]),t}(),ot=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,s=document.getElementById("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e0&&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+c+"?key="+this.key:c+"?key="+this.key).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+h:h,"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+"?key="+n.key:i+"?key="+n.key,p,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.key=this.key,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!==p&&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",x=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e(this,t),this.baseURL=null,this.key=null,r&&(this.key=r),n&&(this.baseURL=n)}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;s2&&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(t,a){var s=new XMLHttpRequest;if(s.upload.onprogress=i.handleLoadProgress,s.open(n,e,!0),s.onload=function(){if(200==s.status){var e=JSON.parse(s.response);t(e)}else{var n=JSON.parse(s.response);a(n)}},"PUT"==n||n==S)switch(r){case T:s.setRequestHeader("Content-type","application/"+r),s.send(JSON.stringify(o));break;case D:s.send(o)}else s.send()}))}},{key:"handleLoadProgress",value:function(e){this.percentComplete=Math.ceil(e.loaded/e.total*100)}}]),t}(),P=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}(),_="requestLame",B="postUpdated";new function t(){e(this,t)};var A=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]*>/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 A).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 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}(),O="editorDelete",L="editorUploadImage",M="editorSave",N="editorUpdate";new function t(){e(this,t)};var R=["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"],U=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&&R.push("width"),R.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 H(e){return(H="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 F=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}},X=function(e){return"object"===H(e)&&null!==e},q=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,"
")};(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=''.concat(o(a),"");l+='|',l+=''.concat(o(s),"");var u=U(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}},Y=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=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):q(e,t)},j=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n;X(t)&&(r=t,t=null);var o=F(r),i=Y(e,o);return t||0===t?i.setPos(t):i.getPosition()},W=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.refresh(),o}return n(i,[{key:"setInputs",value:function(){for(var e=this,t=this,n=document.querySelectorAll(".editor-button"),r=0,o=n.length;r/g)>-1){var o=j(e.textEditor).pos;t.refresh(),j(e.textEditor,o)}}))}},{key:"refresh",value:function(){var e=this.textEditor.innerText;e=e.replace(new RegExp("\r?\n","g"),"
");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 B: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 L:var n,r;j(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(""+r+""));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=j(this.textEditor).pos,this.emitEvent(L);break;case"submit-save":case"edit-save":this.emitEvent(M);break;case"submit-update":case"edit-update":this.emitEvent(N);break;case"edit-link":n.insertNode(document.createTextNode("["+r+"](PASTE URL HERE)"));break;case"edit-delete":this.emitEvent(O)}this.refresh()}}]),i}(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-1}function Z(e,t){return e.apply(null,t)}var K={arr:function(e){return Array.isArray(e)},obj:function(e){return $(Object.prototype.toString.call(e),"Object")},pth:function(e){return K.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||K.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 K.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 K.hex(e)||K.rgb(e)||K.hsl(e)},key:function(e){return!z.hasOwnProperty(e)&&!G.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}};function ee(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function te(e,t){var n=ee(e),r=J(K.und(n[0])?1:n[0],.1,100),o=J(K.und(n[1])?100:n[1],.1,100),i=J(K.und(n[2])?10:n[2],.1,100),a=J(K.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=V.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 V.springs[e]=i,i}}function ne(e){return void 0===e&&(e=10),function(t){return Math.ceil(J(t,1e-6,1)*e)*(1/e)}}var re,oe,ie=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)}}}(),ae=(re={linear:function(){return function(e){return e}}},oe={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=J(e,1,10),r=J(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){oe[e]=function(){return function(e){return Math.pow(e,t+2)}}})),Object.keys(oe).forEach((function(e){var t=oe[e];re["easeIn"+e]=t,re["easeOut"+e]=function(e,n){return function(r){return 1-t(e,n)(1-r)}},re["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}},re["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}}})),re);function se(e,t){if(K.fnc(e))return e;var n=e.split("(")[0],r=ae[n],o=ee(e);switch(n){case"spring":return te(e,t);case"cubicBezier":return Z(ie,o);case"steps":return Z(ne,o);default:return Z(r,o)}}function le(e){try{return document.querySelectorAll(e)}catch(e){return}}function ue(e,t){for(var n=e.length,r=arguments.length>=2?t:void 0,o=[],i=0;i1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}if(0==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 ve(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 ye(e,t){return K.fnc(e)?e(t.target,t.id,t.total):e}function be(e,t){return e.getAttribute(t)}function we(e,t,n){if(fe([n,"deg","rad","turn"],ve(t)))return t;var r=V.CSS[t+n];if(!K.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 V.CSS[t+n]=s,s}function Ee(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?we(e,o,n):o}}function Ie(e,t){return K.dom(e)&&!K.inp(e)&&(!K.nil(be(e,t))||K.svg(e)&&e[t])?"attribute":K.dom(e)&&fe(Q,t)?"transform":K.dom(e)&&"transform"!==t&&Ee(e,t)?"css":null!=e[t]?"object":void 0}function ke(e){if(K.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 Se(e,t,n,r){var o=$(t,"scale")?1:0+function(e){return $(e,"translate")||"perspective"===e?"px":$(e,"rotate")||$(e,"skew")?"deg":void 0}(t),i=ke(e).get(t)||o;return n&&(n.transforms.list.set(t,i),n.transforms.last=t),r?we(e,i,r):i}function Te(e,t,n,r){switch(Ie(e,t)){case"transform":return Se(e,t,r,n);case"css":return Ee(e,t,n);case"attribute":return be(e,t);default:return e[t]||0}}function De(e,t){var n=/^(\*=|\+=|-=)/.exec(e);if(!n)return e;var r=ve(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 xe(e,t){if(K.col(e))return me(e);if(/\s/g.test(e))return e;var n=ve(e),r=n?e.substr(0,e.length-n.length):e;return t?r+t:r}function Pe(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function _e(e){for(var t,n=e.points,r=0,o=0;o0&&(r+=Pe(t,i)),t=i}return r}function Be(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*be(e,"r")}(e);case"rect":return function(e){return 2*be(e,"width")+2*be(e,"height")}(e);case"line":return function(e){return Pe({x:be(e,"x1"),y:be(e,"y1")},{x:be(e,"x2"),y:be(e,"y2")})}(e);case"polyline":return _e(e);case"polygon":return function(e){var t=e.points;return _e(e)+Pe(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function Ae(e,t){var n=t||{},r=n.el||function(e){for(var t=e.parentNode;K.svg(t)&&K.svg(t.parentNode);)t=t.parentNode;return t}(e),o=r.getBoundingClientRect(),i=be(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 Ce(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=Ae(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 Oe(e,t){var n=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=xe(K.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(n)?r.match(n).map(Number):[0],strings:K.str(e)||t?r.split(n):[]}}function Le(e){return ue(e?ce(K.arr(e)?e.map(de):de(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function Me(e){var t=Le(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:ke(e)}}}))}function Ne(e,t){var n=he(t);if(/^spring/.test(n.easing)&&(n.duration=te(n.easing)),K.arr(e)){var r=e.length;2===r&&!K.obj(e[0])?e={value:e}:K.fnc(t.duration)||(n.duration=t.duration/r)}var o=K.arr(e)?e:[e];return o.map((function(e,n){var r=K.obj(e)&&!K.pth(e)?e:{value:e};return K.und(r.delay)&&(r.delay=n?0:t.delay),K.und(r.endDelay)&&(r.endDelay=n===o.length-1?t.endDelay:0),r})).map((function(e){return ge(e,n)}))}function Re(e,t){var n=[],r=t.keyframes;for(var o in r&&(t=ge(function(e){for(var t=ue(ce(e.map((function(e){return Object.keys(e)}))),(function(e){return K.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)K.key(n)?n==o&&(t.value=e[n]):t[n]=e[n];return t}))},o=0;o0?requestAnimationFrame(t):void 0}return"undefined"!=typeof document&&document.addEventListener("visibilitychange",(function(){Ge.suspendWhenDocumentHidden&&(ze()?e=cancelAnimationFrame(e):(je.forEach((function(e){return e._onDocumentVisibility()})),We()))})),function(){e||ze()&&Ge.suspendWhenDocumentHidden||!(je.length>0)||(e=requestAnimationFrame(t))}}();function ze(){return!!document&&document.hidden}function Ge(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=pe(z,e),n=pe(G,e),r=Re(n,e),o=Me(e.targets),i=Xe(o,r),a=qe(i,n),s=Ye;return Ye++,ge(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/Ge.speed)}function f(e,t){t&&t.seek(e-t.timelineOffset)}function h(e){for(var t=0,n=l.animations,r=n.length;t2||(y=Math.round(y*h)/h)),p.push(y)}var E=f.length;if(E){m=f[0];for(var I=0;I0&&(l.began=!0,p("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,p("loopBegin")),v<=g&&0!==l.currentTime&&h(0),(v>=m&&l.currentTime!==d||!d)&&h(d),v>g&&v=d&&(r=0,l.remaining&&!0!==l.remaining&&l.remaining--,l.remaining?(n=o,p("loopComplete"),l.loopBegan=!1,"alternate"===l.direction&&u()):(l.paused=!0,l.completed||(l.completed=!0,p("loopComplete"),p("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++,h(l.reversed?l.duration:0)},l._onDocumentVisibility=d,l.set=function(e,t){return Fe(e,t),l},l.tick=function(e){o=e,n||(n=o),g((o+(r-n))*Ge.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,je.push(l),d(),We())},l.reverse=function(){u(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.remove=function(e){Ve(Le(e),l)},l.reset(),l.autoplay&&l.play(),l}function Qe(e,t){for(var n=t.length;n--;)fe(e,t[n].animatable.target)&&t.splice(n,1)}function Ve(e,t){var n=t.animations,r=t.children;Qe(e,n);for(var o=r.length;o--;){var i=r[o],a=i.animations;Qe(e,a),a.length||i.children.length||r.splice(o,1)}n.length||r.length||t.pause()}Ge.version="3.2.1",Ge.speed=1,Ge.suspendWhenDocumentHidden=!0,Ge.running=je,Ge.remove=function(e){for(var t=Le(e),n=je.length;n--;){Ve(t,je[n])}},Ge.get=Te,Ge.set=Fe,Ge.convertPx=we,Ge.path=function(e,t){var n=K.str(e)?le(e)[0]:e,r=t||100;return function(e){return{property:e,el:n,svg:Ae(n),totalLength:Be(n)*(r/100)}}},Ge.setDashoffset=function(e){var t=Be(e);return e.setAttribute("stroke-dasharray",t),t},Ge.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",r=t.easing?se(t.easing):null,o=t.grid,i=t.axis,a=t.from||0,s="first"===a,l="center"===a,u="last"===a,c=K.arr(e),d=c?parseFloat(e[0]):parseFloat(e),f=c?parseFloat(e[1]):0,h=ve(c?e[1]:e)||0,p=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-1&&je.splice(o,1);for(var s=0;s'].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;rt.alert("Uploading Image",null),(new x).imageUpload(e,t).then((function(e){"postImageAdded"==e.type&&n.editor.notify(L,e.url),rt.alert("Image Added to Entry",!0)})).catch((function(){rt.alert("Uh oh. Image not added",!1)}))}}]),t}();ot.uploadFiles=[];var it=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 ot}}}]),t}(),at=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("background").src,l="",u=document.querySelectorAll(".theme-select"),c=document.getElementById("smtp-domain").value,d=document.getElementById("smtp-email").value,f=document.getElementById("smtp-pass").value,h=document.getElementById("mg-domain").value,p=document.getElementById("mg-key").value,g="",m=document.querySelectorAll(".mail-option"),v=document.getElementById("api-access-toggle").getAttribute("data-enabled");for(e=0,t=u.length;e * @author owenm * @license MIT */ -function ct(e){return(ct="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 dt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ft(){return(ft=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function gt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var mt=gt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),vt=gt(/Edge/i),yt=gt(/firefox/i),bt=gt(/safari/i)&&!gt(/chrome/i)&&!gt(/android/i),wt=gt(/iP(ad|od|hone)/i),Et=gt(/chrome/i)&>(/android/i),It={capture:!1,passive:!1};function kt(e,t,n){e.addEventListener(t,n,!mt&&It)}function St(e,t,n){e.removeEventListener(t,n,!mt&&It)}function Tt(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function Dt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function xt(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&Tt(e,t):Tt(e,t))||r&&e===n)return e;if(e===n)break}while(e=Dt(e))}return null}var Pt,_t=/\s+/g;function Bt(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(_t," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(_t," ")}}function At(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 Ct(e,t){var n="";if("string"==typeof e)n=e;else do{var r=At(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 Ot(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,a=r.length;if(n)for(;o=a:o<=a))return r;if(r===Lt())break;r=Xt(r,!1)}return!1}function Rt(e,t,n){for(var r=0,o=0,a=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=pt(n,["evt"]);Jt.pluginEvent.bind(jn)(e,t,ht({dragEl:Kt,parentEl:en,ghostEl:tn,rootEl:nn,nextEl:rn,lastDownEl:on,cloneEl:an,cloneHidden:sn,dragStarted:wn,putSortable:hn,activeSortable:jn.active,originalEvent:r,oldIndex:ln,oldDraggableIndex:cn,newIndex:un,newDraggableIndex:dn,hideGhostForTarget:Fn,unhideGhostForTarget:Xn,cloneNowHidden:function(){sn=!0},cloneNowShown:function(){sn=!1},dispatchSortableEvent:function(e){Zt({sortable:t,name:e,originalEvent:r})}},o))};function Zt(e){!function(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,a=e.cloneEl,i=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,c=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[zt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||mt||vt?(g=document.createEvent("Event")).initEvent(r,!0,!0):g=new CustomEvent(r,{bubbles:!0,cancelable:!0}),g.to=i||n,g.from=s||n,g.item=o||n,g.clone=a,g.oldIndex=l,g.newIndex=u,g.oldDraggableIndex=c,g.newDraggableIndex=d,g.originalEvent=f,g.pullMode=h?h.lastPutMode:void 0;var y=ht({},p,Jt.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(ht({putSortable:hn,cloneEl:an,targetEl:Kt,rootEl:nn,oldIndex:ln,oldDraggableIndex:cn,newIndex:un,newDraggableIndex:dn},e))}var Kt,en,tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn=!1,Dn=!1,xn=[],Pn=!1,_n=!1,Bn=[],An=!1,Cn=[],On="undefined"!=typeof document,Ln=wt,Mn=vt||mt?"cssFloat":"float",Nn=On&&!Et&&!wt&&"draggable"in document.createElement("div"),Rn=function(){if(On){if(mt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Un=function(e,t){var n=At(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Rt(e,0,t),a=Rt(e,1,t),i=o&&At(o),s=a&&At(a),l=i&&parseInt(i.marginLeft)+parseInt(i.marginRight)+Mt(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Mt(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"!==s.clear&&s.clear!==c?"horizontal":"vertical"}return o&&("block"===i.display||"flex"===i.display||"table"===i.display||"grid"===i.display||l>=r&&"none"===n[Mn]||a&&"none"===n[Mn]&&l+u>r)?"vertical":"horizontal"},Hn=function(e){function t(e,n){return function(r,o,a,i){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,a,i),n)(r,o,a,i);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"==ct(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},Fn=function(){!Rn&&tn&&At(tn,"display","none")},Xn=function(){!Rn&&tn&&At(tn,"display","")};On&&document.addEventListener("click",(function(e){if(Dn)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Dn=!1,!1}),!0);var Yn=function(e){if(Kt){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,a=e.clientY,xn.some((function(e){if(!Ut(e)){var t=Mt(e),n=e[zt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=a>=t.top-n&&a<=t.bottom+n;return n&&r&&s?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[zt]._onDragOver(n)}}var o,a,i},qn=function(e){Kt&&Kt.parentNode[zt]._isOutsideThisEl(e.target)};function jn(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=ft({},t),e[zt]=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 Un(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!==jn.supportPointer&&"PointerEvent"in window&&!bt,emptyInsertThreshold:5};for(var r in Jt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Hn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Nn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?kt(e,"pointerdown",this._onTapStart):(kt(e,"mousedown",this._onTapStart),kt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(kt(e,"dragover",this),kt(e,"dragenter",this)),xn.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),ft(this,Gt())}function Wn(e,t,n,r,o,a,i,s){var l,u,c=e[zt],d=c.options.onMove;return!window.CustomEvent||mt||vt?(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=a||Mt(t),l.willInsertAfter=s,l.originalEvent=i,e.dispatchEvent(l),d&&(u=d.call(c,l,i)),u}function zn(e){e.draggable=!1}function Gn(){An=!1}function Qn(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 Vn(e){return setTimeout(e,0)}function Jn(e){return clearTimeout(e)}jn.prototype={constructor:jn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(En=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Kt):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,s=(i||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,u=r.filter;if(function(e){Cn.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Cn.push(r)}}(n),!Kt&&!(/mousedown|pointerdown/.test(a)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!bt||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=xt(s,r.draggable,n,!1))&&s.animated||on===s)){if(ln=Ht(s),cn=Ht(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return Zt({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),$t("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=xt(l,r.trim(),n,!1))return Zt({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),$t("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!xt(l,r.handle,n,!1)||this._prepareDragStart(e,i,s)}}},_prepareDragStart:function(e,t,n){var r,o=this,a=o.el,i=o.options,s=a.ownerDocument;if(n&&!Kt&&n.parentNode===a){var l=Mt(n);if(nn=a,en=(Kt=n).parentNode,rn=Kt.nextSibling,on=n,fn=i.group,jn.dragged=Kt,pn={target:Kt,clientX:(t||e).clientX,clientY:(t||e).clientY},yn=pn.clientX-l.left,bn=pn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Kt.style["will-change"]="all",r=function(){$t("delayEnded",o,{evt:e}),jn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!yt&&o.nativeDraggable&&(Kt.draggable=!0),o._triggerDragStart(e,t),Zt({sortable:o,name:"choose",originalEvent:e}),Bt(Kt,i.chosenClass,!0))},i.ignore.split(",").forEach((function(e){Ot(Kt,e.trim(),zn)})),kt(s,"dragover",Yn),kt(s,"mousemove",Yn),kt(s,"touchmove",Yn),kt(s,"mouseup",o._onDrop),kt(s,"touchend",o._onDrop),kt(s,"touchcancel",o._onDrop),yt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Kt.draggable=!0),$t("delayStart",this,{evt:e}),!i.delay||i.delayOnTouchOnly&&!t||this.nativeDraggable&&(vt||mt))r();else{if(jn.eventCanceled)return void this._onDrop();kt(s,"mouseup",o._disableDelayedDrag),kt(s,"touchend",o._disableDelayedDrag),kt(s,"touchcancel",o._disableDelayedDrag),kt(s,"mousemove",o._delayedDragTouchMoveHandler),kt(s,"touchmove",o._delayedDragTouchMoveHandler),i.supportPointer&&kt(s,"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(){Kt&&zn(Kt),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;St(e,"mouseup",this._disableDelayedDrag),St(e,"touchend",this._disableDelayedDrag),St(e,"touchcancel",this._disableDelayedDrag),St(e,"mousemove",this._delayedDragTouchMoveHandler),St(e,"touchmove",this._delayedDragTouchMoveHandler),St(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?kt(document,"pointermove",this._onTouchMove):kt(document,t?"touchmove":"mousemove",this._onTouchMove):(kt(Kt,"dragend",this),kt(nn,"dragstart",this._onDragStart));try{document.selection?Vn((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Tn=!1,nn&&Kt){$t("dragStarted",this,{evt:t}),this.nativeDraggable&&kt(document,"dragover",qn);var n=this.options;!e&&Bt(Kt,n.dragClass,!1),Bt(Kt,n.ghostClass,!0),jn.active=this,e&&this._appendGhost(),Zt({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(gn){this._lastX=gn.clientX,this._lastY=gn.clientY,Fn();for(var e=document.elementFromPoint(gn.clientX,gn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(gn.clientX,gn.clientY))!==t;)t=e;if(Kt.parentNode[zt]._isOutsideThisEl(e),t)do{if(t[zt]){if(t[zt]._onDragOver({clientX:gn.clientX,clientY:gn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Xn()}},_onTouchMove:function(e){if(pn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,a=tn&&Ct(tn,!0),i=tn&&a&&a.a,s=tn&&a&&a.d,l=Ln&&Sn&&Ft(Sn),u=(o.clientX-pn.clientX+r.x)/(i||1)+(l?l[0]-Bn[0]:0)/(i||1),c=(o.clientY-pn.clientY+r.y)/(s||1)+(l?l[1]-Bn[1]:0)/(s||1);if(!jn.active&&!Tn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))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===Kt)return B(!1);if(g&&a===e.target&&(i=g),i&&(n=Mt(i)),!1!==Wn(nn,a,Kt,t,i,n,e,!!i))return _(),a.appendChild(Kt),en=a,A(),B(!0)}else if(i.parentNode===a){n=Mt(i);var m,v,y,b=Kt.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,s=n?t.right:t.bottom,l=n?t.width:t.height;return r===i||o===s||r+a/2===i+l/2}(Kt.animated&&Kt.toRect||t,i.animated&&i.toRect||n,o),E=o?"top":"left",I=Nt(i,"top","top")||Nt(Kt,"top","top"),k=I?I.scrollTop:void 0;if(En!==i&&(v=n[E],Pn=!1,_n=!w&&s.invertSwap||b),0!==(m=function(e,t,n,r,o,a,i,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(!i)if(s&&knc+u*a/2:ld-kn)return-In}else if(l>c+u*(1-o)/2&&ld-u*a/2))return l>c+u/2?1:-1;return 0}(e,i,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,_n,En===i))){var S=Ht(Kt);do{S-=m,y=en.children[S]}while(y&&("none"===At(y,"display")||y===tn))}if(0===m||y===i)return B(!1);En=i,In=m;var T=i.nextElementSibling,D=!1,x=Wn(nn,a,Kt,t,i,n,e,D=1===m);if(!1!==x)return 1!==x&&-1!==x||(D=1===x),An=!0,setTimeout(Gn,30),_(),D&&!T?a.appendChild(Kt):i.parentNode.insertBefore(Kt,D?T:i),I&&jt(I,0,k-I.scrollTop),en=Kt.parentNode,void 0===v||_n||(kn=Math.abs(v-Mt(i)[E])),A(),B(!0)}if(a.contains(Kt))return B(!1)}return!1}function P(s,l){$t(s,h,ht({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 Wn(nn,a,Kt,t,n,Mt(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(Bt(Kt,hn?hn.options.ghostClass:u.options.ghostClass,!1),Bt(Kt,s.ghostClass,!0)),hn!==h&&h!==jn.active?hn=h:h===jn.active&&hn&&(hn=null),f===h&&(h._ignoreWhileAnimating=i),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(i===Kt&&!Kt.animated||i===a&&!i.animated)&&(En=null),s.dragoverBubble||e.rootEl||i===document||(Kt.parentNode[zt]._isOutsideThisEl(e.target),!t&&Yn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){un=Ht(Kt),dn=Ht(Kt,s.draggable),Zt({sortable:h,name:"change",toEl:a,newIndex:un,newDraggableIndex:dn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){St(document,"mousemove",this._onTouchMove),St(document,"touchmove",this._onTouchMove),St(document,"pointermove",this._onTouchMove),St(document,"dragover",Yn),St(document,"mousemove",Yn),St(document,"touchmove",Yn)},_offUpEvents:function(){var e=this.el.ownerDocument;St(e,"mouseup",this._onDrop),St(e,"touchend",this._onDrop),St(e,"pointerup",this._onDrop),St(e,"touchcancel",this._onDrop),St(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;un=Ht(Kt),dn=Ht(Kt,n.draggable),$t("drop",this,{evt:e}),en=Kt&&Kt.parentNode,un=Ht(Kt),dn=Ht(Kt,n.draggable),jn.eventCanceled||(Tn=!1,_n=!1,Pn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Jn(this.cloneId),Jn(this._dragStartId),this.nativeDraggable&&(St(document,"drop",this),St(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),bt&&At(document.body,"user-select",""),At(Kt,"transform",""),e&&(wn&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),tn&&tn.parentNode&&tn.parentNode.removeChild(tn),(nn===en||hn&&"clone"!==hn.lastPutMode)&&an&&an.parentNode&&an.parentNode.removeChild(an),Kt&&(this.nativeDraggable&&St(Kt,"dragend",this),zn(Kt),Kt.style["will-change"]="",wn&&!Tn&&Bt(Kt,hn?hn.options.ghostClass:this.options.ghostClass,!1),Bt(Kt,this.options.chosenClass,!1),Zt({sortable:this,name:"unchoose",toEl:en,newIndex:null,newDraggableIndex:null,originalEvent:e}),nn!==en?(un>=0&&(Zt({rootEl:en,name:"add",toEl:en,fromEl:nn,originalEvent:e}),Zt({sortable:this,name:"remove",toEl:en,originalEvent:e}),Zt({rootEl:en,name:"sort",toEl:en,fromEl:nn,originalEvent:e}),Zt({sortable:this,name:"sort",toEl:en,originalEvent:e})),hn&&hn.save()):un!==ln&&un>=0&&(Zt({sortable:this,name:"update",toEl:en,originalEvent:e}),Zt({sortable:this,name:"sort",toEl:en,originalEvent:e})),jn.active&&(null!=un&&-1!==un||(un=ln,dn=cn),Zt({sortable:this,name:"end",toEl:en,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){$t("nulling",this),nn=Kt=en=tn=rn=an=on=sn=pn=gn=wn=un=dn=ln=cn=En=In=hn=fn=jn.dragged=jn.ghost=jn.clone=jn.active=null,Cn.forEach((function(e){e.checked=!0})),Cn.length=mn=vn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Kt&&(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=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function vt(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var yt=vt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),bt=vt(/Edge/i),wt=vt(/firefox/i),Et=vt(/safari/i)&&!vt(/chrome/i)&&!vt(/android/i),It=vt(/iP(ad|od|hone)/i),kt=vt(/chrome/i)&&vt(/android/i),St={capture:!1,passive:!1};function Tt(e,t,n){e.addEventListener(t,n,!yt&&St)}function Dt(e,t,n){e.removeEventListener(t,n,!yt&&St)}function xt(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 Pt(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function _t(e,t,n,r){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&xt(e,t):xt(e,t))||r&&e===n)return e;if(e===n)break}while(e=Pt(e))}return null}var Bt,At=/\s+/g;function Ct(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(At," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(At," ")}}function Ot(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 Lt(e,t){var n="";if("string"==typeof e)n=e;else do{var r=Ot(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 Mt(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o=i:o<=i))return r;if(r===Nt())break;r=Yt(r,!1)}return!1}function Ht(e,t,n){for(var r=0,o=0,i=e.children;o2&&void 0!==arguments[2]?arguments[2]:{},r=n.evt,o=mt(n,["evt"]);Zt.pluginEvent.bind(zn)(e,t,gt({dragEl:tn,parentEl:nn,ghostEl:rn,rootEl:on,nextEl:an,lastDownEl:sn,cloneEl:ln,cloneHidden:un,dragStarted:In,putSortable:gn,activeSortable:zn.active,originalEvent:r,oldIndex:cn,oldDraggableIndex:fn,newIndex:dn,newDraggableIndex:hn,hideGhostForTarget:qn,unhideGhostForTarget:Yn,cloneNowHidden:function(){un=!0},cloneNowShown:function(){un=!1},dispatchSortableEvent:function(e){en({sortable:t,name:e,originalEvent:r})}},o))};function en(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,h=e.putSortable,p=e.extraEventProperties;if(t=t||n&&n[Qt]){var g,m=t.options,v="on"+r.charAt(0).toUpperCase()+r.substr(1);!window.CustomEvent||yt||bt?(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=h?h.lastPutMode:void 0;var y=gt({},p,Zt.getEventProperties(r,t));for(var b in y)g[b]=y[b];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(gt({putSortable:gn,cloneEl:ln,targetEl:tn,rootEl:on,oldIndex:cn,oldDraggableIndex:fn,newIndex:dn,newDraggableIndex:hn},e))}var tn,nn,rn,on,an,sn,ln,un,cn,dn,fn,hn,pn,gn,mn,vn,yn,bn,wn,En,In,kn,Sn,Tn,Dn,xn=!1,Pn=!1,_n=[],Bn=!1,An=!1,Cn=[],On=!1,Ln=[],Mn="undefined"!=typeof document,Nn=It,Rn=bt||yt?"cssFloat":"float",Un=Mn&&!kt&&!It&&"draggable"in document.createElement("div"),Hn=function(){if(Mn){if(yt)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Fn=function(e,t){var n=Ot(e),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Ht(e,0,t),i=Ht(e,1,t),a=o&&Ot(o),s=i&&Ot(i),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Rt(o).width,u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Rt(i).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(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[Rn]||i&&"none"===n[Rn]&&l+u>r)?"vertical":"horizontal"},Xn=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"==ft(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},qn=function(){!Hn&&rn&&Ot(rn,"display","none")},Yn=function(){!Hn&&rn&&Ot(rn,"display","")};Mn&&document.addEventListener("click",(function(e){if(Pn)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Pn=!1,!1}),!0);var jn=function(e){if(tn){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,i=e.clientY,_n.some((function(e){if(!Ft(e)){var t=Rt(e),n=e[Qt].options.emptyInsertThreshold,r=o>=t.left-n&&o<=t.right+n,s=i>=t.top-n&&i<=t.bottom+n;return n&&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[Qt]._onDragOver(n)}}var o,i,a},Wn=function(e){tn&&tn.parentNode[Qt]._isOutsideThisEl(e.target)};function zn(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=pt({},t),e[Qt]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Fn(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!==zn.supportPointer&&"PointerEvent"in window&&!Et,emptyInsertThreshold:5};for(var r in Zt.initializePlugins(this,e,n),n)!(r in t)&&(t[r]=n[r]);for(var o in Xn(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&Un,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?Tt(e,"pointerdown",this._onTapStart):(Tt(e,"mousedown",this._onTapStart),Tt(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(Tt(e,"dragover",this),Tt(e,"dragenter",this)),_n.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),pt(this,Vt())}function Gn(e,t,n,r,o,i,a,s){var l,u,c=e[Qt],d=c.options.onMove;return!window.CustomEvent||yt||bt?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=n,l.draggedRect=r,l.related=o||t,l.relatedRect=i||Rt(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(u=d.call(c,l,a)),u}function Qn(e){e.draggable=!1}function Vn(){On=!1}function Jn(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,r=0;n--;)r+=t.charCodeAt(n);return r.toString(36)}function $n(e){return setTimeout(e,0)}function Zn(e){return clearTimeout(e)}zn.prototype={constructor:zn,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(kn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,tn):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){Ln.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var r=t[n];r.checked&&Ln.push(r)}}(n),!tn&&!(/mousedown|pointerdown/.test(i)&&0!==e.button||r.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!Et||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=_t(s,r.draggable,n,!1))&&s.animated||sn===s)){if(cn=Xt(s),fn=Xt(s,r.draggable),"function"==typeof u){if(u.call(this,e,s,this))return en({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Kt("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(u&&(u=u.split(",").some((function(r){if(r=_t(l,r.trim(),n,!1))return en({sortable:t,rootEl:r,name:"filter",targetEl:s,fromEl:n,toEl:n}),Kt("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());r.handle&&!_t(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&&!tn&&n.parentNode===i){var l=Rt(n);if(on=i,nn=(tn=n).parentNode,an=tn.nextSibling,sn=n,pn=a.group,zn.dragged=tn,mn={target:tn,clientX:(t||e).clientX,clientY:(t||e).clientY},wn=mn.clientX-l.left,En=mn.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,tn.style["will-change"]="all",r=function(){Kt("delayEnded",o,{evt:e}),zn.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!wt&&o.nativeDraggable&&(tn.draggable=!0),o._triggerDragStart(e,t),en({sortable:o,name:"choose",originalEvent:e}),Ct(tn,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){Mt(tn,e.trim(),Qn)})),Tt(s,"dragover",jn),Tt(s,"mousemove",jn),Tt(s,"touchmove",jn),Tt(s,"mouseup",o._onDrop),Tt(s,"touchend",o._onDrop),Tt(s,"touchcancel",o._onDrop),wt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,tn.draggable=!0),Kt("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(bt||yt))r();else{if(zn.eventCanceled)return void this._onDrop();Tt(s,"mouseup",o._disableDelayedDrag),Tt(s,"touchend",o._disableDelayedDrag),Tt(s,"touchcancel",o._disableDelayedDrag),Tt(s,"mousemove",o._delayedDragTouchMoveHandler),Tt(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&Tt(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(){tn&&Qn(tn),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Dt(e,"mouseup",this._disableDelayedDrag),Dt(e,"touchend",this._disableDelayedDrag),Dt(e,"touchcancel",this._disableDelayedDrag),Dt(e,"mousemove",this._delayedDragTouchMoveHandler),Dt(e,"touchmove",this._delayedDragTouchMoveHandler),Dt(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?Tt(document,"pointermove",this._onTouchMove):Tt(document,t?"touchmove":"mousemove",this._onTouchMove):(Tt(tn,"dragend",this),Tt(on,"dragstart",this._onDragStart));try{document.selection?$n((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(xn=!1,on&&tn){Kt("dragStarted",this,{evt:t}),this.nativeDraggable&&Tt(document,"dragover",Wn);var n=this.options;!e&&Ct(tn,n.dragClass,!1),Ct(tn,n.ghostClass,!0),zn.active=this,e&&this._appendGhost(),en({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(vn){this._lastX=vn.clientX,this._lastY=vn.clientY,qn();for(var e=document.elementFromPoint(vn.clientX,vn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(vn.clientX,vn.clientY))!==t;)t=e;if(tn.parentNode[Qt]._isOutsideThisEl(e),t)do{if(t[Qt]){if(t[Qt]._onDragOver({clientX:vn.clientX,clientY:vn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);Yn()}},_onTouchMove:function(e){if(mn){var t=this.options,n=t.fallbackTolerance,r=t.fallbackOffset,o=e.touches?e.touches[0]:e,i=rn&&Lt(rn,!0),a=rn&&i&&i.a,s=rn&&i&&i.d,l=Nn&&Dn&&qt(Dn),u=(o.clientX-mn.clientX+r.x)/(a||1)+(l?l[0]-Cn[0]:0)/(a||1),c=(o.clientY-mn.clientY+r.y)/(s||1)+(l?l[1]-Cn[1]:0)/(s||1);if(!zn.active&&!xn){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))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===tn)return B(!1);if(g&&i===e.target&&(a=g),a&&(n=Rt(a)),!1!==Gn(on,i,tn,t,a,n,e,!!a))return _(),i.appendChild(tn),nn=i,A(),B(!0)}else if(a.parentNode===i){n=Rt(a);var m,v,y,b=tn.parentNode!==i,w=!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}(tn.animated&&tn.toRect||t,a.animated&&a.toRect||n,o),E=o?"top":"left",I=Ut(a,"top","top")||Ut(tn,"top","top"),k=I?I.scrollTop:void 0;if(kn!==a&&(v=n[E],Bn=!1,An=!w&&s.invertSwap||b),0!==(m=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&&Tnc+u*i/2:ld-Tn)return-Sn}else if(l>c+u*(1-o)/2&&ld-u*i/2))return l>c+u/2?1:-1;return 0}(e,a,n,o,w?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,An,kn===a))){var S=Xt(tn);do{S-=m,y=nn.children[S]}while(y&&("none"===Ot(y,"display")||y===rn))}if(0===m||y===a)return B(!1);kn=a,Sn=m;var T=a.nextElementSibling,D=!1,x=Gn(on,i,tn,t,a,n,e,D=1===m);if(!1!==x)return 1!==x&&-1!==x||(D=1===x),On=!0,setTimeout(Vn,30),_(),D&&!T?i.appendChild(tn):a.parentNode.insertBefore(tn,D?T:a),I&&zt(I,0,k-I.scrollTop),nn=tn.parentNode,void 0===v||An||(Tn=Math.abs(v-Rt(a)[E])),A(),B(!0)}if(i.contains(tn))return B(!1)}return!1}function P(s,l){Kt(s,h,gt({evt:e,isOwner:c,axis:o?"vertical":"horizontal",revert:r,dragRect:t,targetRect:n,canSort:d,fromSortable:f,target:a,completed:B,onMove:function(n,r){return Gn(on,i,tn,t,n,Rt(n),e,r)},changed:A},l))}function _(){P("dragOverAnimationCapture"),h.captureAnimationState(),h!==f&&f.captureAnimationState()}function B(t){return P("dragOverCompleted",{insertion:t}),t&&(c?u._hideClone():u._showClone(h),h!==f&&(Ct(tn,gn?gn.options.ghostClass:u.options.ghostClass,!1),Ct(tn,s.ghostClass,!0)),gn!==h&&h!==zn.active?gn=h:h===zn.active&&gn&&(gn=null),f===h&&(h._ignoreWhileAnimating=a),h.animateAll((function(){P("dragOverAnimationComplete"),h._ignoreWhileAnimating=null})),h!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===tn&&!tn.animated||a===i&&!a.animated)&&(kn=null),s.dragoverBubble||e.rootEl||a===document||(tn.parentNode[Qt]._isOutsideThisEl(e.target),!t&&jn(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),p=!0}function A(){dn=Xt(tn),hn=Xt(tn,s.draggable),en({sortable:h,name:"change",toEl:i,newIndex:dn,newDraggableIndex:hn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Dt(document,"mousemove",this._onTouchMove),Dt(document,"touchmove",this._onTouchMove),Dt(document,"pointermove",this._onTouchMove),Dt(document,"dragover",jn),Dt(document,"mousemove",jn),Dt(document,"touchmove",jn)},_offUpEvents:function(){var e=this.el.ownerDocument;Dt(e,"mouseup",this._onDrop),Dt(e,"touchend",this._onDrop),Dt(e,"pointerup",this._onDrop),Dt(e,"touchcancel",this._onDrop),Dt(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;dn=Xt(tn),hn=Xt(tn,n.draggable),Kt("drop",this,{evt:e}),nn=tn&&tn.parentNode,dn=Xt(tn),hn=Xt(tn,n.draggable),zn.eventCanceled||(xn=!1,An=!1,Bn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Zn(this.cloneId),Zn(this._dragStartId),this.nativeDraggable&&(Dt(document,"drop",this),Dt(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Et&&Ot(document.body,"user-select",""),Ot(tn,"transform",""),e&&(In&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),rn&&rn.parentNode&&rn.parentNode.removeChild(rn),(on===nn||gn&&"clone"!==gn.lastPutMode)&&ln&&ln.parentNode&&ln.parentNode.removeChild(ln),tn&&(this.nativeDraggable&&Dt(tn,"dragend",this),Qn(tn),tn.style["will-change"]="",In&&!xn&&Ct(tn,gn?gn.options.ghostClass:this.options.ghostClass,!1),Ct(tn,this.options.chosenClass,!1),en({sortable:this,name:"unchoose",toEl:nn,newIndex:null,newDraggableIndex:null,originalEvent:e}),on!==nn?(dn>=0&&(en({rootEl:nn,name:"add",toEl:nn,fromEl:on,originalEvent:e}),en({sortable:this,name:"remove",toEl:nn,originalEvent:e}),en({rootEl:nn,name:"sort",toEl:nn,fromEl:on,originalEvent:e}),en({sortable:this,name:"sort",toEl:nn,originalEvent:e})),gn&&gn.save()):dn!==cn&&dn>=0&&(en({sortable:this,name:"update",toEl:nn,originalEvent:e}),en({sortable:this,name:"sort",toEl:nn,originalEvent:e})),zn.active&&(null!=dn&&-1!==dn||(dn=cn,hn=fn),en({sortable:this,name:"end",toEl:nn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Kt("nulling",this),on=tn=nn=rn=an=ln=sn=un=mn=vn=In=dn=hn=cn=fn=kn=Sn=gn=pn=zn.dragged=zn.ghost=zn.clone=zn.active=null,Ln.forEach((function(e){e.checked=!0})),Ln.length=yn=bn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":tn&&(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{ + console.log("Info Object", data); + * }) + * @returns {object} json object that contains data for requested information + * + * *info object example* + * ``` + { + "message":"message of affirmation!", + "task":"type of info request", + "data":json-data-object, + } + * ``` + */ + + getInfo(type) { + let url, task; + if (type == "site") { + url = API_GET_SETTINGS; + task = TASK_GET_SETTINGS; + } else { + url = API_GET_MEMBER_INFO; + task = TASK_GET_MEMBER_INFO; + } + return new Promise((resolve, reject) => { + this._request(this.baseURL ? this.baseURL + url : url, task) + .then((result) => { + resolve(result); + }) + .catch((err) => { + reject(err); + }); + }); + } + //-------------------------- // private //-------------------------- @@ -365,6 +408,12 @@ class FipamoAdminAPI { break; } } else { + if ( + eventType === TASK_GET_SETTINGS || + eventType === TASK_GET_MEMBER_INFO + ) { + request.setRequestHeader("fipamo-access-token", self.token); + } request.send(); } }); From 0ec49de8ab54ce6f122591f0a5a0fcb3562a61c1 Mon Sep 17 00:00:00 2001 From: Ro Date: Thu, 22 Jul 2021 13:06:52 -0700 Subject: [PATCH 2/2] admin api commenting tweak --- src/libraries/FipamoAdminAPI.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/FipamoAdminAPI.js b/src/libraries/FipamoAdminAPI.js index b498b7e..4922af0 100644 --- a/src/libraries/FipamoAdminAPI.js +++ b/src/libraries/FipamoAdminAPI.js @@ -323,7 +323,7 @@ class FipamoAdminAPI { /** * *Promise method for retrieving site and member info*\ * **GET** `/api/v1/settings/:type` - * @param {string} type - type of info requested + * @param {string} type - type of info requested ['site'|'member']; * @example * api.getInfo("type").then(data=>{ console.log("Info Object", data);