Plugin Directory

Changeset 3109241

Timestamp:
06/28/2024 12:29:52 PM (6 weeks ago)
Author:
antonlukin
Message:

Update to version 3.1 from GitHub

Location:
sharing-image
Files:
21 edited
1 copied

Legend:

Unmodified
Added
Removed
  • sharing-image/tags/3.1/assets/settings/index.asset.php

    r3108262 r3109241  
    1 <?php return array('dependencies' => array(), 'version' => '928580135d65ac25e5e5');
     1<?php return array('dependencies' => array(), 'version' => '');
  • sharing-image/tags/3.1/assets/settings/index.js

    r3108262 r3109241  
    1 (()=>{"use strict";let e=e=>crypto.getRandomValues(new Uint8Array(e));const t={param:function(e){return new URL(document.location.href).searchParams.get(e)},attachment:function(e,t){if(e.hasOwnProperty("multiple")||(e.multiple=!1),!wp.media)return;const n=wp.media(e);n.on("select",(()=>{const e=n.state().get("selection").first().toJSON();e.id&&t(e.id)})),n.open()},defaults:function(e,t){return t.forEach((t=>{void 0===e[t]&&(e[t]={})})),e},uniqid:function(){return((t,n=21)=>((e,t,n)=>{let a=(2<<Math.log(e.length-1)/Math.LN2)-1,i=-~(1.6*a*t/e.length);return(o=t)=>{let r="";for(;;){let t=n(i),s=i;for(;s--;)if(r+=e[t[s]&a]||"",r.length===o)return r}}})(t,n,e))("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",12)()},dataget:function(e,t,n){const a=e.querySelector(`[data-${t}="${n}"]`);if(a)return a.value}},n=function(e,t={}){const n=document.createElement(e);if(t.hasOwnProperty("classes")&&t.classes.forEach((e=>{n.classList.add(e)})),t.hasOwnProperty("text")&&(n.textContent=t.text),t.hasOwnProperty("html")&&(n.innerHTML=t.html),t.hasOwnProperty("attributes"))for(const e in t.attributes){const a=t.attributes[e];void 0!==a&&n.setAttribute(e,a)}if(t.hasOwnProperty("dataset"))for(const e in t.dataset)n.setAttribute("data-"+e,t.dataset[e]);return t.hasOwnProperty("append")&&t.append.appendChild(n),t.hasOwnProperty("prepend")&&t.prepend.insertBefore(n,t.prepend.firstChild),n},a=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("input",{attributes:{type:"text"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if("range"===i.type){const e=p.element("em",{text:i.value,attributes:{title:wp.i18n.__("Click to change the input view.","sharing-image")},append:a});i.addEventListener("change",(()=>{e.textContent=i.value})),i.addEventListener("input",(()=>{e.textContent=i.value})),e.addEventListener("click",(()=>{i.type="text"===i.type?"range":"text"}))}return i},i=function(e,t){const a=n("label",{classes:e.classes||[],append:t}),i=n("input",{attributes:{type:"checkbox"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("checked")){const t=e.checked;t&&t===i.value&&i.setAttribute("checked","checked")}if(e.hasOwnProperty("label")){const t=n("span",{text:e.label});null!==e.label&&a.appendChild(t)}return i},o=function(e,t){const a=n("label",{classes:e.classes||[],append:t}),i=n("input",{attributes:{type:"radio"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("checked")){const t=e.checked;t&&t===i.value&&i.setAttribute("checked","checked")}if(e.hasOwnProperty("label")){const t=n("span",{text:e.label});null!==e.label&&a.appendChild(t)}return e.hasOwnProperty("help")&&n("small",{text:e.help,append:a}),i},r=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("select",{dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}const o=e.options||{};for(const t in o){const a=n("option",{text:o[t],attributes:{value:t},append:i});if(e.hasOwnProperty("selected")){const t=e.selected;t&&t===a.value&&a.setAttribute("selected","selected")}}return i},s=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("textarea",{dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("content")){const t=e.content;void 0!==t&&(i.innerHTML=t)}return i},l=function(e){const t=n("div",{classes:e.classes||[]});return e.hasOwnProperty("append")&&e.append.appendChild(t),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(t,e.prepend.firstChild),e.hasOwnProperty("label")&&n("h3",{text:e.label,append:t}),e.hasOwnProperty("description")&&n("p",{text:e.description,append:t}),e.hasOwnProperty("fields")&&e.fields.forEach((e=>{switch(e.group){case"input":a(e,t);break;case"textarea":s(e,t);break;case"radio":o(e,t);break;case"select":r(e,t);break;case"checkbox":i(e,t)}})),e.hasOwnProperty("help")&&n("small",{text:e.help,append:t}),t};function c(e,t){let a=e.querySelector("figure");if(a&&e.removeChild(a),!wp.media)return;if(a=n("figure",{prepend:e}),e.querySelector("h4")&&e.insertBefore(a,e.querySelector("h4").nextSibling),!t)return;let i=a.querySelector("img");i&&a.removeChild(i),i=n("img",{append:a}),wp.media.attachment(t).fetch().then((e=>{i.src=e.sizes?.thumbnail?.url||e.url}))}const p={element:n,control:l,layer:function(e){const t=n("div",{classes:e.classes||[]});e.hasOwnProperty("append")&&e.append.appendChild(t),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(t,e.prepend.firstChild),e.hasOwnProperty("label")||(e.label="");const a=n("h2",{text:e.label,append:t});return n("span",{append:a}),e.hasOwnProperty("description")&&n("h5",{text:e.description,append:t}),t},checkbox:i,media:function(e){const a=l({classes:e.classes||[]});if(e.hasOwnProperty("append")&&e.append.appendChild(a),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(a,e.prepend.firstChild),e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}e.labels=e.labels||{};const i=n("input",{attributes:{type:"hidden",name:e.name},append:a}),o=n("button",{classes:["button"],text:e.labels.button,attributes:{type:"button"},append:a}),r=n("a",{classes:["hidden"],text:e.labels.details,attributes:{target:"_blank"}});e.hasOwnProperty("link")&&a.appendChild(r),e.hasOwnProperty("help")&&n("small",{text:e.help,append:a});const s=t=>{i.setAttribute("value",t),i.dispatchEvent(new Event("change",{bubbles:!0}));let n=null;e.hasOwnProperty("link")&&(n=new URL(e.link),n.searchParams.set("item",t),r.setAttribute("href",n.href)),e.remove&&(o.textContent=e.labels.remove),e.image&&c(a,t),r.classList.remove("hidden")},p=()=>{i.setAttribute("value",""),i.dispatchEvent(new Event("change",{bubbles:!0})),o.textContent=e.labels.button,e.image&&c(a,0),r.classList.add("hidden")};return e.image&&c(a,0),e.value&&s(e.value),o.addEventListener("click",(()=>{if(e.remove&&i.value)return p();const n={title:e.labels.heading};e.hasOwnProperty("mime")&&(n.library={},n.library.type=e.mime),t.attachment(n,(e=>{s(e)}))})),a.addEventListener("set_attachment",(e=>{e.detail&&s(e.detail)})),a.addEventListener("remove_attachment",(()=>{p()})),a},input:a,textarea:s,radio:o,select:r};let d=null;let u=null;function g(e,t,n){const a=p.element("div",{classes:["sharing-image-catalog-card"],append:e}),i=p.element("figure",{classes:["sharing-image-catalog-preview"],append:a});t.preview&&p.element("img",{attributes:{src:t.preview,alt:""},append:i});const o=p.element("footer",{classes:["sharing-image-catalog-footer"],append:a});p.element("h2",{text:t.title||wp.i18n.__("Untitled","sharing-image"),append:o});const r=new URL(document.location.href);r.searchParams.set("template",n),p.element("a",{classes:["button"],text:wp.i18n.__("Edit template","sharing-image"),attributes:{href:r.href},append:o})}let h=null,m=null;function f(e,t){const n=[];switch(void 0===t&&(t=wp.i18n.__("Verification unsuccessful.","sharing-image")),n.push(t),e){case"LIMIT_EXCEEDED":n.push(wp.i18n.__("The number of licenses for this key has been exceeded.","sharing-image"));break;case"KEY_NOT_FOUND":n.push(wp.i18n.__("The Premium key is invalid or expired.","sharing-image"));break;case"SERVER_ERROR":n.push(wp.i18n.__("Unable to receive a response from the verification server.","sharing-image"))}return n.join(" ")}function v(e){const t=m.querySelector(".sharing-image-premium-warning");null!==t&&(t.classList.add("warning-visible"),t.textContent=e||wp.i18n.__("Unknown request error.","sharing-image"))}function b(){const e=m.querySelector(".sharing-image-premium-warning");null!==e&&e.classList.remove("warning-visible")}function _(e,t){m.classList.add("premium-enabled"),t.develop?v(wp.i18n.__("Using the plugin with a development license is prohibited in production.","sharing-image")):(t.key&&function(e,t){const n=p.element("div",{classes:["sharing-image-premium-permit"],append:e});p.element("button",{classes:["sharing-image-premium-show","button"],text:wp.i18n.__("Show License key","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{n.classList.toggle("permit-visible")})),p.element("strong",{text:t,append:n})}(e,t.key),function(e){const t=p.element("div",{classes:["sharing-image-premium-revoke"],append:e}),n=[];n.push(wp.i18n.__("Disabling premium mode will not remove the license for this domain.","sharing-image")),n.push(wp.i18n.__("Your current key will also be saved in the plugin settings.","sharing-image")),n.push(wp.i18n.__("Use key management tool to delete the license for the site.","sharing-image")),p.element("p",{text:n.join(" "),append:t}),p.element("button",{classes:["button"],text:wp.i18n.__("Disable Premium","sharing-image"),attributes:{type:"submit"},append:t}),p.element("span",{classes:["spinner"],append:t}),e.addEventListener("submit",(t=>{t.preventDefault(),function(e){e.classList.add("access-loader");const t=new XMLHttpRequest;t.open("POST",ajaxurl),t.responseType="json";const n=new window.FormData(e);n.set("action","sharing_image_revoke_premium"),b(),t.addEventListener("load",(()=>{const n=t.response||{};return e.classList.remove("access-loader"),n.data?n.success?(h.license=n.data,void w()):v(n.data):v()})),t.addEventListener("error",(()=>{v(),e.classList.remove("access-loader")})),t.send(n)}(e)}))}(e))}function w(){let e=m.querySelector(".sharing-image-premium-access");null!==e&&m.removeChild(e),e=p.element("form",{classes:["sharing-image-premium-access"],attributes:{action:"",method:"POST"},append:m}),m.classList.remove("premium-enabled"),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:h.nonce},append:e});const t=h.license||{};return t.premium||t.develop?_(e,t):function(e,t){t.error&&v(f(t.error)),p.element("strong",{text:wp.i18n.__("Do you already have a key? Enter it here","sharing-image"),append:e});const n=p.element("div",{classes:["sharing-image-premium-verify"],append:e});p.element("input",{label:wp.i18n.__("Your Premium key","sharing-image"),attributes:{type:"text",name:"sharing_image_key",value:t.key},append:n}),p.element("button",{classes:["button"],text:wp.i18n.__("Submit","sharing-image"),attributes:{type:"submit"},append:n}),p.element("span",{classes:["spinner"],append:n}),e.addEventListener("submit",(t=>{t.preventDefault(),function(e){e.classList.add("access-loader");const t=new XMLHttpRequest;t.open("POST",ajaxurl),t.responseType="json";const n=new window.FormData(e);n.set("action","sharing_image_verify_premium"),b(),t.addEventListener("load",(()=>{const n=t.response||{};return e.classList.remove("access-loader"),n.data?n.success?(h.license=n.data,void w()):v(f(n.code,n.data)):v()})),t.addEventListener("error",(()=>{v(),e.classList.remove("access-loader")})),t.send(n)}(e)}))}(e,t)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){k(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function E(e){return E="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(e)}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(){return S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},S.apply(this,arguments)}function D(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var C=D(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),T=D(/Edge/i),P=D(/firefox/i),O=D(/safari/i)&&!D(/chrome/i)&&!D(/android/i),L=D(/iP(ad|od|hone)/i),A=D(/chrome/i)&&D(/android/i),M={capture:!1,passive:!1};function N(e,t,n){e.addEventListener(t,n,!C&&M)}function I(e,t,n){e.removeEventListener(t,n,!C&&M)}function R(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 Y(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function j(e,t,n,a){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&R(e,t):R(e,t))||a&&e===n)return e;if(e===n)break}while(e=Y(e))}return null}var F,X=/\s+/g;function q(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var a=(" "+e.className+" ").replace(X," ").replace(" "+t+" "," ");e.className=(a+(n?" "+t:"")).replace(X," ")}}function z(e,t,n){var a=e&&e.style;if(a){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 a||-1!==t.indexOf("webkit")||(t="-webkit-"+t),a[t]=n+("string"==typeof n?"":"px")}}function B(e,t){var n="";if("string"==typeof e)n=e;else do{var a=z(e,"transform");a&&"none"!==a&&(n=a+" "+n)}while(!t&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function U(e,t,n){if(e){var a=e.getElementsByTagName(t),i=0,o=a.length;if(n)for(;i<o;i++)n(a[i],i);return a}return[]}function H(){return document.scrollingElement||document.documentElement}function W(e,t,n,a,i){if(e.getBoundingClientRect||e===window){var o,r,s,l,c,p,d;if(e!==window&&e.parentNode&&e!==H()?(r=(o=e.getBoundingClientRect()).top,s=o.left,l=o.bottom,c=o.right,p=o.height,d=o.width):(r=0,s=0,l=window.innerHeight,c=window.innerWidth,p=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(i=i||e.parentNode,!C))do{if(i&&i.getBoundingClientRect&&("none"!==z(i,"transform")||n&&"static"!==z(i,"position"))){var u=i.getBoundingClientRect();r-=u.top+parseInt(z(i,"border-top-width")),s-=u.left+parseInt(z(i,"border-left-width")),l=r+o.height,c=s+o.width;break}}while(i=i.parentNode);if(a&&e!==window){var g=B(i||e),h=g&&g.a,m=g&&g.d;g&&(l=(r/=m)+(p/=m),c=(s/=h)+(d/=h))}return{top:r,left:s,bottom:l,right:c,width:d,height:p}}}function G(e,t,n){for(var a=Z(e,!0),i=W(e)[t];a;){var o=W(a)[n];if(!("top"===n||"left"===n?i>=o:i<=o))return a;if(a===H())break;a=Z(a,!1)}return!1}function V(e,t,n,a){for(var i=0,o=0,r=e.children;o<r.length;){if("none"!==r[o].style.display&&r[o]!==tt.ghost&&(a||r[o]!==tt.dragged)&&j(r[o],n.draggable,e,!1)){if(i===t)return r[o];i++}o++}return null}function J(e,t){for(var n=e.lastElementChild;n&&(n===tt.ghost||"none"===z(n,"display")||t&&!R(n,t));)n=n.previousElementSibling;return n||null}function $(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===tt.clone||t&&!R(e,t)||n++;return n}function K(e){var t=0,n=0,a=H();if(e)do{var i=B(e),o=i.a,r=i.d;t+=e.scrollLeft*o,n+=e.scrollTop*r}while(e!==a&&(e=e.parentNode));return[t,n]}function Z(e,t){if(!e||!e.getBoundingClientRect)return H();var n=e,a=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=z(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return H();if(a||t)return n;a=!0}}}while(n=n.parentNode);return H()}function Q(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function ee(e,t){return function(){if(!F){var n=arguments;1===n.length?e.call(this,n[0]):e.apply(this,n),F=setTimeout((function(){F=void 0}),t)}}}function te(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function ne(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}function ae(e,t,n){var a={};return Array.from(e.children).forEach((function(i){var o,r,s,l;if(j(i,t.draggable,e,!1)&&!i.animated&&i!==n){var c=W(i);a.left=Math.min(null!==(o=a.left)&&void 0!==o?o:1/0,c.left),a.top=Math.min(null!==(r=a.top)&&void 0!==r?r:1/0,c.top),a.right=Math.max(null!==(s=a.right)&&void 0!==s?s:-1/0,c.right),a.bottom=Math.max(null!==(l=a.bottom)&&void 0!==l?l:-1/0,c.bottom)}})),a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}var ie="Sortable"+(new Date).getTime();var oe=[],re={initializeByDefault:!0},se={mount:function(e){for(var t in re)re.hasOwnProperty(t)&&!(t in e)&&(e[t]=re[t]);oe.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),oe.push(e)},pluginEvent:function(e,t,n){var a=this;this.eventCanceled=!1,n.cancel=function(){a.eventCanceled=!0};var i=e+"Global";oe.forEach((function(a){t[a.pluginName]&&(t[a.pluginName][i]&&t[a.pluginName][i](x({sortable:t},n)),t.options[a.pluginName]&&t[a.pluginName][e]&&t[a.pluginName][e](x({sortable:t},n)))}))},initializePlugins:function(e,t,n,a){for(var i in oe.forEach((function(a){var i=a.pluginName;if(e.options[i]||a.initializeByDefault){var o=new a(e,t,e.options);o.sortable=e,o.options=e.options,e[i]=o,S(n,o.defaults)}})),e.options)if(e.options.hasOwnProperty(i)){var o=this.modifyOption(e,i,e.options[i]);void 0!==o&&(e.options[i]=o)}},getEventProperties:function(e,t){var n={};return oe.forEach((function(a){"function"==typeof a.eventProperties&&S(n,a.eventProperties.call(t[a.pluginName],e))})),n},modifyOption:function(e,t,n){var a;return oe.forEach((function(i){e[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[t]&&(a=i.optionListeners[t].call(e[i.pluginName],n))})),a}};var le=["evt"],ce=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=n.evt,i=function(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(n,le);se.pluginEvent.bind(tt)(e,t,x({dragEl:de,parentEl:ue,ghostEl:ge,rootEl:he,nextEl:me,lastDownEl:fe,cloneEl:ve,cloneHidden:be,dragStarted:Le,putSortable:ke,activeSortable:tt.active,originalEvent:a,oldIndex:_e,oldDraggableIndex:ye,newIndex:we,newDraggableIndex:xe,hideGhostForTarget:Ke,unhideGhostForTarget:Ze,cloneNowHidden:function(){be=!0},cloneNowShown:function(){be=!1},dispatchSortableEvent:function(e){pe({sortable:t,name:e,originalEvent:a})}},i))};function pe(e){!function(e){var t=e.sortable,n=e.rootEl,a=e.name,i=e.targetEl,o=e.cloneEl,r=e.toEl,s=e.fromEl,l=e.oldIndex,c=e.newIndex,p=e.oldDraggableIndex,d=e.newDraggableIndex,u=e.originalEvent,g=e.putSortable,h=e.extraEventProperties;if(t=t||n&&n[ie]){var m,f=t.options,v="on"+a.charAt(0).toUpperCase()+a.substr(1);!window.CustomEvent||C||T?(m=document.createEvent("Event")).initEvent(a,!0,!0):m=new CustomEvent(a,{bubbles:!0,cancelable:!0}),m.to=r||n,m.from=s||n,m.item=i||n,m.clone=o,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=p,m.newDraggableIndex=d,m.originalEvent=u,m.pullMode=g?g.lastPutMode:void 0;var b=x(x({},h),se.getEventProperties(a,t));for(var _ in b)m[_]=b[_];n&&n.dispatchEvent(m),f[v]&&f[v].call(t,m)}}(x({putSortable:ke,cloneEl:ve,targetEl:de,rootEl:he,oldIndex:_e,oldDraggableIndex:ye,newIndex:we,newDraggableIndex:xe},e))}var de,ue,ge,he,me,fe,ve,be,_e,we,ye,xe,Ee,ke,Se,De,Ce,Te,Pe,Oe,Le,Ae,Me,Ne,Ie,Re=!1,Ye=!1,je=[],Fe=!1,Xe=!1,qe=[],ze=!1,Be=[],Ue="undefined"!=typeof document,He=L,We=T||C?"cssFloat":"float",Ge=Ue&&!A&&!L&&"draggable"in document.createElement("div"),Ve=function(){if(Ue){if(C)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Je=function(e,t){var n=z(e),a=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=V(e,0,t),o=V(e,1,t),r=i&&z(i),s=o&&z(o),l=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+W(i).width,c=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+W(o).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(i&&r.float&&"none"!==r.float){var p="left"===r.float?"left":"right";return!o||"both"!==s.clear&&s.clear!==p?"horizontal":"vertical"}return i&&("block"===r.display||"flex"===r.display||"table"===r.display||"grid"===r.display||l>=a&&"none"===n[We]||o&&"none"===n[We]&&l+c>a)?"vertical":"horizontal"},$e=function(e){function t(e,n){return function(a,i,o,r){var s=a.options.group.name&&i.options.group.name&&a.options.group.name===i.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(a,i,o,r),n)(a,i,o,r);var l=(n?a:i).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},a=e.group;a&&"object"==E(a)||(a={name:a}),n.name=a.name,n.checkPull=t(a.pull,!0),n.checkPut=t(a.put),n.revertClone=a.revertClone,e.group=n},Ke=function(){!Ve&&ge&&z(ge,"display","none")},Ze=function(){!Ve&&ge&&z(ge,"display","")};Ue&&!A&&document.addEventListener("click",(function(e){if(Ye)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ye=!1,!1}),!0);var Qe=function(e){if(de){e=e.touches?e.touches[0]:e;var t=(i=e.clientX,o=e.clientY,je.some((function(e){var t=e[ie].options.emptyInsertThreshold;if(t&&!J(e)){var n=W(e),a=i>=n.left-t&&i<=n.right+t,s=o>=n.top-t&&o<=n.bottom+t;return a&&s?r=e:void 0}})),r);if(t){var n={};for(var a in e)e.hasOwnProperty(a)&&(n[a]=e[a]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[ie]._onDragOver(n)}}var i,o,r},et=function(e){de&&de.parentNode[ie]._isOutsideThisEl(e.target)};function tt(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=S({},t),e[ie]=this;var n,a,i={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 Je(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!==tt.supportPointer&&"PointerEvent"in window&&!O,emptyInsertThreshold:5};for(var o in se.initializePlugins(this,e,i),i)!(o in t)&&(t[o]=i[o]);for(var r in $e(t),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!t.forceFallback&&Ge,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?N(e,"pointerdown",this._onTapStart):(N(e,"mousedown",this._onTapStart),N(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(N(e,"dragover",this),N(e,"dragenter",this)),je.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),S(this,(a=[],{captureAnimationState:function(){a=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){if("none"!==z(e,"display")&&e!==tt.ghost){a.push({target:e,rect:W(e)});var t=x({},a[a.length-1].rect);if(e.thisAnimationDuration){var n=B(e,!0);n&&(t.top-=n.f,t.left-=n.e)}e.fromRect=t}}))},addAnimationState:function(e){a.push(e)},removeAnimationState:function(e){a.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var a in t)if(t.hasOwnProperty(a)&&t[a]===e[n][a])return Number(n);return-1}(a,{target:e}),1)},animateAll:function(e){var t=this;if(!this.options.animation)return clearTimeout(n),void("function"==typeof e&&e());var i=!1,o=0;a.forEach((function(e){var n=0,a=e.target,r=a.fromRect,s=W(a),l=a.prevFromRect,c=a.prevToRect,p=e.rect,d=B(a,!0);d&&(s.top-=d.f,s.left-=d.e),a.toRect=s,a.thisAnimationDuration&&Q(l,s)&&!Q(r,s)&&(p.top-s.top)/(p.left-s.left)==(r.top-s.top)/(r.left-s.left)&&(n=function(e,t,n,a){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*a.animation}(p,l,c,t.options)),Q(s,r)||(a.prevFromRect=r,a.prevToRect=s,n||(n=t.options.animation),t.animate(a,p,s,n)),n&&(i=!0,o=Math.max(o,n),clearTimeout(a.animationResetTimer),a.animationResetTimer=setTimeout((function(){a.animationTime=0,a.prevFromRect=null,a.fromRect=null,a.prevToRect=null,a.thisAnimationDuration=null}),n),a.thisAnimationDuration=n)})),clearTimeout(n),i?n=setTimeout((function(){"function"==typeof e&&e()}),o):"function"==typeof e&&e(),a=[]},animate:function(e,t,n,a){if(a){z(e,"transition",""),z(e,"transform","");var i=B(this.el),o=i&&i.a,r=i&&i.d,s=(t.left-n.left)/(o||1),l=(t.top-n.top)/(r||1);e.animatingX=!!s,e.animatingY=!!l,z(e,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),z(e,"transition","transform "+a+"ms"+(this.options.easing?" "+this.options.easing:"")),z(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){z(e,"transition",""),z(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),a)}}}))}function nt(e,t,n,a,i,o,r,s){var l,c,p=e[ie],d=p.options.onMove;return!window.CustomEvent||C||T?(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=a,l.related=i||t,l.relatedRect=o||W(t),l.willInsertAfter=s,l.originalEvent=r,e.dispatchEvent(l),d&&(c=d.call(p,l,r)),c}function at(e){e.draggable=!1}function it(){ze=!1}function ot(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,a=0;n--;)a+=t.charCodeAt(n);return a.toString(36)}function rt(e){return setTimeout(e,0)}function st(e){return clearTimeout(e)}tt.prototype={constructor:tt,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Ae=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,de):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,a=this.options,i=a.preventOnFilter,o=e.type,r=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(r||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,c=a.filter;if(function(e){Be.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var a=t[n];a.checked&&Be.push(a)}}(n),!de&&!(/mousedown|pointerdown/.test(o)&&0!==e.button||a.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!O||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=j(s,a.draggable,n,!1))&&s.animated||fe===s)){if(_e=$(s),ye=$(s,a.draggable),"function"==typeof c){if(c.call(this,e,s,this))return pe({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),ce("filter",t,{evt:e}),void(i&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some((function(a){if(a=j(l,a.trim(),n,!1))return pe({sortable:t,rootEl:a,name:"filter",targetEl:s,fromEl:n,toEl:n}),ce("filter",t,{evt:e}),!0}))))return void(i&&e.cancelable&&e.preventDefault());a.handle&&!j(l,a.handle,n,!1)||this._prepareDragStart(e,r,s)}}},_prepareDragStart:function(e,t,n){var a,i=this,o=i.el,r=i.options,s=o.ownerDocument;if(n&&!de&&n.parentNode===o){var l=W(n);if(he=o,ue=(de=n).parentNode,me=de.nextSibling,fe=n,Ee=r.group,tt.dragged=de,Se={target:de,clientX:(t||e).clientX,clientY:(t||e).clientY},Pe=Se.clientX-l.left,Oe=Se.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,de.style["will-change"]="all",a=function(){ce("delayEnded",i,{evt:e}),tt.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!P&&i.nativeDraggable&&(de.draggable=!0),i._triggerDragStart(e,t),pe({sortable:i,name:"choose",originalEvent:e}),q(de,r.chosenClass,!0))},r.ignore.split(",").forEach((function(e){U(de,e.trim(),at)})),N(s,"dragover",Qe),N(s,"mousemove",Qe),N(s,"touchmove",Qe),N(s,"mouseup",i._onDrop),N(s,"touchend",i._onDrop),N(s,"touchcancel",i._onDrop),P&&this.nativeDraggable&&(this.options.touchStartThreshold=4,de.draggable=!0),ce("delayStart",this,{evt:e}),!r.delay||r.delayOnTouchOnly&&!t||this.nativeDraggable&&(T||C))a();else{if(tt.eventCanceled)return void this._onDrop();N(s,"mouseup",i._disableDelayedDrag),N(s,"touchend",i._disableDelayedDrag),N(s,"touchcancel",i._disableDelayedDrag),N(s,"mousemove",i._delayedDragTouchMoveHandler),N(s,"touchmove",i._delayedDragTouchMoveHandler),r.supportPointer&&N(s,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(a,r.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(){de&&at(de),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;I(e,"mouseup",this._disableDelayedDrag),I(e,"touchend",this._disableDelayedDrag),I(e,"touchcancel",this._disableDelayedDrag),I(e,"mousemove",this._delayedDragTouchMoveHandler),I(e,"touchmove",this._delayedDragTouchMoveHandler),I(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?N(document,"pointermove",this._onTouchMove):N(document,t?"touchmove":"mousemove",this._onTouchMove):(N(de,"dragend",this),N(he,"dragstart",this._onDragStart));try{document.selection?rt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Re=!1,he&&de){ce("dragStarted",this,{evt:t}),this.nativeDraggable&&N(document,"dragover",et);var n=this.options;!e&&q(de,n.dragClass,!1),q(de,n.ghostClass,!0),tt.active=this,e&&this._appendGhost(),pe({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(De){this._lastX=De.clientX,this._lastY=De.clientY,Ke();for(var e=document.elementFromPoint(De.clientX,De.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(De.clientX,De.clientY))!==t;)t=e;if(de.parentNode[ie]._isOutsideThisEl(e),t)do{if(t[ie]&&t[ie]._onDragOver({clientX:De.clientX,clientY:De.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break;e=t}while(t=t.parentNode);Ze()}},_onTouchMove:function(e){if(Se){var t=this.options,n=t.fallbackTolerance,a=t.fallbackOffset,i=e.touches?e.touches[0]:e,o=ge&&B(ge,!0),r=ge&&o&&o.a,s=ge&&o&&o.d,l=He&&Ie&&K(Ie),c=(i.clientX-Se.clientX+a.x)/(r||1)+(l?l[0]-qe[0]:0)/(r||1),p=(i.clientY-Se.clientY+a.y)/(s||1)+(l?l[1]-qe[1]:0)/(s||1);if(!tt.active&&!Re){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(ge){o?(o.e+=c-(Ce||0),o.f+=p-(Te||0)):o={a:1,b:0,c:0,d:1,e:c,f:p};var d="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")");z(ge,"webkitTransform",d),z(ge,"mozTransform",d),z(ge,"msTransform",d),z(ge,"transform",d),Ce=c,Te=p,De=i}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!ge){var e=this.options.fallbackOnBody?document.body:he,t=W(de,!0,He,!0,e),n=this.options;if(He){for(Ie=e;"static"===z(Ie,"position")&&"none"===z(Ie,"transform")&&Ie!==document;)Ie=Ie.parentNode;Ie!==document.body&&Ie!==document.documentElement?(Ie===document&&(Ie=H()),t.top+=Ie.scrollTop,t.left+=Ie.scrollLeft):Ie=H(),qe=K(Ie)}q(ge=de.cloneNode(!0),n.ghostClass,!1),q(ge,n.fallbackClass,!0),q(ge,n.dragClass,!0),z(ge,"transition",""),z(ge,"transform",""),z(ge,"box-sizing","border-box"),z(ge,"margin",0),z(ge,"top",t.top),z(ge,"left",t.left),z(ge,"width",t.width),z(ge,"height",t.height),z(ge,"opacity","0.8"),z(ge,"position",He?"absolute":"fixed"),z(ge,"zIndex","100000"),z(ge,"pointerEvents","none"),tt.ghost=ge,e.appendChild(ge),z(ge,"transform-origin",Pe/parseInt(ge.style.width)*100+"% "+Oe/parseInt(ge.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,a=e.dataTransfer,i=n.options;ce("dragStart",this,{evt:e}),tt.eventCanceled?this._onDrop():(ce("setupClone",this),tt.eventCanceled||((ve=ne(de)).removeAttribute("id"),ve.draggable=!1,ve.style["will-change"]="",this._hideClone(),q(ve,this.options.chosenClass,!1),tt.clone=ve),n.cloneId=rt((function(){ce("clone",n),tt.eventCanceled||(n.options.removeCloneOnHide||he.insertBefore(ve,de),n._hideClone(),pe({sortable:n,name:"clone"}))})),!t&&q(de,i.dragClass,!0),t?(Ye=!0,n._loopId=setInterval(n._emulateDragOver,50)):(I(document,"mouseup",n._onDrop),I(document,"touchend",n._onDrop),I(document,"touchcancel",n._onDrop),a&&(a.effectAllowed="move",i.setData&&i.setData.call(n,a,de)),N(document,"drop",n),z(de,"transform","translateZ(0)")),Re=!0,n._dragStartId=rt(n._dragStarted.bind(n,t,e)),N(document,"selectstart",n),Le=!0,O&&z(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,a,i,o=this.el,r=e.target,s=this.options,l=s.group,c=tt.active,p=Ee===l,d=s.sort,u=ke||c,g=this,h=!1;if(!ze){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),r=j(r,s.draggable,o,!0),O("dragOver"),tt.eventCanceled)return h;if(de.contains(e.target)||r.animated&&r.animatingX&&r.animatingY||g._ignoreWhileAnimating===r)return A(!1);if(Ye=!1,c&&!s.disabled&&(p?d||(a=ue!==he):ke===this||(this.lastPutMode=Ee.checkPull(this,c,de,e))&&l.checkPut(this,c,de,e))){if(i="vertical"===this._getDirection(e,r),t=W(de),O("dragOverValid"),tt.eventCanceled)return h;if(a)return ue=he,L(),this._hideClone(),O("revert"),tt.eventCanceled||(me?he.insertBefore(de,me):he.appendChild(de)),A(!0);var m=J(o,s.draggable);if(!m||function(e,t,n){var a=W(J(n.el,n.options.draggable)),i=ae(n.el,n.options,ge);return t?e.clientX>i.right+10||e.clientY>a.bottom&&e.clientX>a.left:e.clientY>i.bottom+10||e.clientX>a.right&&e.clientY>a.top}(e,i,this)&&!m.animated){if(m===de)return A(!1);if(m&&o===e.target&&(r=m),r&&(n=W(r)),!1!==nt(he,o,de,t,r,n,e,!!r))return L(),m&&m.nextSibling?o.insertBefore(de,m.nextSibling):o.appendChild(de),ue=o,M(),A(!0)}else if(m&&function(e,t,n){var a=W(V(n.el,0,n.options,!0)),i=ae(n.el,n.options,ge);return t?e.clientX<i.left-10||e.clientY<a.top&&e.clientX<a.right:e.clientY<i.top-10||e.clientY<a.bottom&&e.clientX<a.left}(e,i,this)){var f=V(o,0,s,!0);if(f===de)return A(!1);if(n=W(r=f),!1!==nt(he,o,de,t,r,n,e,!1))return L(),o.insertBefore(de,f),ue=o,M(),A(!0)}else if(r.parentNode===o){n=W(r);var v,b,_,w=de.parentNode!==o,y=!function(e,t,n){var a=n?e.left:e.top,i=n?e.right:e.bottom,o=n?e.width:e.height,r=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return a===r||i===s||a+o/2===r+l/2}(de.animated&&de.toRect||t,r.animated&&r.toRect||n,i),E=i?"top":"left",k=G(r,"top","top")||G(de,"top","top"),S=k?k.scrollTop:void 0;if(Ae!==r&&(b=n[E],Fe=!1,Xe=!y&&s.invertSwap||w),v=function(e,t,n,a,i,o,r,s){var l=a?e.clientY:e.clientX,c=a?n.height:n.width,p=a?n.top:n.left,d=a?n.bottom:n.right,u=!1;if(!r)if(s&&Ne<c*i){if(!Fe&&(1===Me?l>p+c*o/2:l<d-c*o/2)&&(Fe=!0),Fe)u=!0;else if(1===Me?l<p+Ne:l>d-Ne)return-Me}else if(l>p+c*(1-i)/2&&l<d-c*(1-i)/2)return function(e){return $(de)<$(e)?1:-1}(t);return(u=u||r)&&(l<p+c*o/2||l>d-c*o/2)?l>p+c/2?1:-1:0}(e,r,n,i,y?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Xe,Ae===r),0!==v){var D=$(de);do{D-=v,_=ue.children[D]}while(_&&("none"===z(_,"display")||_===ge))}if(0===v||_===r)return A(!1);Ae=r,Me=v;var C=r.nextElementSibling,T=!1,P=nt(he,o,de,t,r,n,e,T=1===v);if(!1!==P)return 1!==P&&-1!==P||(T=1===P),ze=!0,setTimeout(it,30),L(),T&&!C?o.appendChild(de):r.parentNode.insertBefore(de,T?C:r),k&&te(k,0,S-k.scrollTop),ue=de.parentNode,void 0===b||Xe||(Ne=Math.abs(b-W(r)[E])),M(),A(!0)}if(o.contains(de))return A(!1)}return!1}function O(s,l){ce(s,g,x({evt:e,isOwner:p,axis:i?"vertical":"horizontal",revert:a,dragRect:t,targetRect:n,canSort:d,fromSortable:u,target:r,completed:A,onMove:function(n,a){return nt(he,o,de,t,n,W(n),e,a)},changed:M},l))}function L(){O("dragOverAnimationCapture"),g.captureAnimationState(),g!==u&&u.captureAnimationState()}function A(t){return O("dragOverCompleted",{insertion:t}),t&&(p?c._hideClone():c._showClone(g),g!==u&&(q(de,ke?ke.options.ghostClass:c.options.ghostClass,!1),q(de,s.ghostClass,!0)),ke!==g&&g!==tt.active?ke=g:g===tt.active&&ke&&(ke=null),u===g&&(g._ignoreWhileAnimating=r),g.animateAll((function(){O("dragOverAnimationComplete"),g._ignoreWhileAnimating=null})),g!==u&&(u.animateAll(),u._ignoreWhileAnimating=null)),(r===de&&!de.animated||r===o&&!r.animated)&&(Ae=null),s.dragoverBubble||e.rootEl||r===document||(de.parentNode[ie]._isOutsideThisEl(e.target),!t&&Qe(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),h=!0}function M(){we=$(de),xe=$(de,s.draggable),pe({sortable:g,name:"change",toEl:o,newIndex:we,newDraggableIndex:xe,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){I(document,"mousemove",this._onTouchMove),I(document,"touchmove",this._onTouchMove),I(document,"pointermove",this._onTouchMove),I(document,"dragover",Qe),I(document,"mousemove",Qe),I(document,"touchmove",Qe)},_offUpEvents:function(){var e=this.el.ownerDocument;I(e,"mouseup",this._onDrop),I(e,"touchend",this._onDrop),I(e,"pointerup",this._onDrop),I(e,"touchcancel",this._onDrop),I(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;we=$(de),xe=$(de,n.draggable),ce("drop",this,{evt:e}),ue=de&&de.parentNode,we=$(de),xe=$(de,n.draggable),tt.eventCanceled||(Re=!1,Xe=!1,Fe=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),st(this.cloneId),st(this._dragStartId),this.nativeDraggable&&(I(document,"drop",this),I(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),O&&z(document.body,"user-select",""),z(de,"transform",""),e&&(Le&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),ge&&ge.parentNode&&ge.parentNode.removeChild(ge),(he===ue||ke&&"clone"!==ke.lastPutMode)&&ve&&ve.parentNode&&ve.parentNode.removeChild(ve),de&&(this.nativeDraggable&&I(de,"dragend",this),at(de),de.style["will-change"]="",Le&&!Re&&q(de,ke?ke.options.ghostClass:this.options.ghostClass,!1),q(de,this.options.chosenClass,!1),pe({sortable:this,name:"unchoose",toEl:ue,newIndex:null,newDraggableIndex:null,originalEvent:e}),he!==ue?(we>=0&&(pe({rootEl:ue,name:"add",toEl:ue,fromEl:he,originalEvent:e}),pe({sortable:this,name:"remove",toEl:ue,originalEvent:e}),pe({rootEl:ue,name:"sort",toEl:ue,fromEl:he,originalEvent:e}),pe({sortable:this,name:"sort",toEl:ue,originalEvent:e})),ke&&ke.save()):we!==_e&&we>=0&&(pe({sortable:this,name:"update",toEl:ue,originalEvent:e}),pe({sortable:this,name:"sort",toEl:ue,originalEvent:e})),tt.active&&(null!=we&&-1!==we||(we=_e,xe=ye),pe({sortable:this,name:"end",toEl:ue,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){ce("nulling",this),he=de=ue=ge=me=ve=fe=be=Se=De=Le=we=xe=_e=ye=Ae=Me=ke=Ee=tt.dragged=tt.ghost=tt.clone=tt.active=null,Be.forEach((function(e){e.checked=!0})),Be.length=Ce=Te=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":de&&(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,a=0,i=n.length,o=this.options;a<i;a++)j(e=n[a],o.draggable,this.el,!1)&&t.push(e.getAttribute(o.dataIdAttr)||ot(e));return t},sort:function(e,t){var n={},a=this.el;this.toArray().forEach((function(e,t){var i=a.children[t];j(i,this.options.draggable,a,!1)&&(n[e]=i)}),this),t&&this.captureAnimationState(),e.forEach((function(e){n[e]&&(a.removeChild(n[e]),a.appendChild(n[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return j(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(void 0===t)return n[e];var a=se.modifyOption(this,e,t);n[e]=void 0!==a?a:t,"group"===e&&$e(n)},destroy:function(){ce("destroy",this);var e=this.el;e[ie]=null,I(e,"mousedown",this._onTapStart),I(e,"touchstart",this._onTapStart),I(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(I(e,"dragover",this),I(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),je.splice(je.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!be){if(ce("hideClone",this),tt.eventCanceled)return;z(ve,"display","none"),this.options.removeCloneOnHide&&ve.parentNode&&ve.parentNode.removeChild(ve),be=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(be){if(ce("showClone",this),tt.eventCanceled)return;de.parentNode!=he||this.options.group.revertClone?me?he.insertBefore(ve,me):he.appendChild(ve):he.insertBefore(ve,de),this.options.group.revertClone&&this.animate(de,ve),z(ve,"display",""),be=!1}}else this._hideClone()}},Ue&&N(document,"touchmove",(function(e){(tt.active||Re)&&e.cancelable&&e.preventDefault()})),tt.utils={on:N,off:I,css:z,find:U,is:function(e,t){return!!j(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:ee,closest:j,toggleClass:q,clone:ne,index:$,nextTick:rt,cancelNextTick:st,detectDirection:Je,getChild:V},tt.get=function(e){return e[ie]},tt.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t[0].constructor===Array&&(t=t[0]),t.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(tt.utils=x(x({},tt.utils),e.utils)),se.mount(e)}))},tt.create=function(e,t){return new tt(e,t)},tt.version="1.15.2";var lt,ct,pt,dt,ut,gt,ht=[],mt=!1;function ft(){ht.forEach((function(e){clearInterval(e.pid)})),ht=[]}function vt(){clearInterval(gt)}var bt=ee((function(e,t,n,a){if(t.scroll){var i,o=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,l=t.scrollSpeed,c=H(),p=!1;ct!==n&&(ct=n,ft(),lt=t.scroll,i=t.scrollFn,!0===lt&&(lt=Z(n,!0)));var d=0,u=lt;do{var g=u,h=W(g),m=h.top,f=h.bottom,v=h.left,b=h.right,_=h.width,w=h.height,y=void 0,x=void 0,E=g.scrollWidth,k=g.scrollHeight,S=z(g),D=g.scrollLeft,C=g.scrollTop;g===c?(y=_<E&&("auto"===S.overflowX||"scroll"===S.overflowX||"visible"===S.overflowX),x=w<k&&("auto"===S.overflowY||"scroll"===S.overflowY||"visible"===S.overflowY)):(y=_<E&&("auto"===S.overflowX||"scroll"===S.overflowX),x=w<k&&("auto"===S.overflowY||"scroll"===S.overflowY));var T=y&&(Math.abs(b-o)<=s&&D+_<E)-(Math.abs(v-o)<=s&&!!D),P=x&&(Math.abs(f-r)<=s&&C+w<k)-(Math.abs(m-r)<=s&&!!C);if(!ht[d])for(var O=0;O<=d;O++)ht[O]||(ht[O]={});ht[d].vx==T&&ht[d].vy==P&&ht[d].el===g||(ht[d].el=g,ht[d].vx=T,ht[d].vy=P,clearInterval(ht[d].pid),0==T&&0==P||(p=!0,ht[d].pid=setInterval(function(){a&&0===this.layer&&tt.active._onTouchMove(ut);var t=ht[this.layer].vy?ht[this.layer].vy*l:0,n=ht[this.layer].vx?ht[this.layer].vx*l:0;"function"==typeof i&&"continue"!==i.call(tt.dragged.parentNode[ie],n,t,e,ut,ht[this.layer].el)||te(ht[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&u!==c&&(u=Z(u,!1)));mt=p}}),30),_t=function(e){var t=e.originalEvent,n=e.putSortable,a=e.dragEl,i=e.activeSortable,o=e.dispatchSortableEvent,r=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(t){var l=n||i;r();var c=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,p=document.elementFromPoint(c.clientX,c.clientY);s(),l&&!l.el.contains(p)&&(o("spill"),this.onSpill({dragEl:a,putSortable:n}))}};function wt(){}function yt(){}wt.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var a=V(this.sortable.el,this.startIndex,this.options);a?this.sortable.el.insertBefore(t,a):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:_t},S(wt,{pluginName:"revertOnSpill"}),yt.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:_t},S(yt,{pluginName:"removeOnSpill"}),tt.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?N(document,"dragover",this._handleAutoScroll):this.options.supportPointer?N(document,"pointermove",this._handleFallbackAutoScroll):t.touches?N(document,"touchmove",this._handleFallbackAutoScroll):N(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?I(document,"dragover",this._handleAutoScroll):(I(document,"pointermove",this._handleFallbackAutoScroll),I(document,"touchmove",this._handleFallbackAutoScroll),I(document,"mousemove",this._handleFallbackAutoScroll)),vt(),ft(),clearTimeout(F),F=void 0},nulling:function(){ut=ct=lt=mt=gt=pt=dt=null,ht.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,a=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,o=document.elementFromPoint(a,i);if(ut=e,t||this.options.forceAutoScrollFallback||T||C||O){bt(e,this.options,o,t);var r=Z(o,!0);!mt||gt&&a===pt&&i===dt||(gt&&vt(),gt=setInterval((function(){var o=Z(document.elementFromPoint(a,i),!0);o!==r&&(r=o,ft()),bt(e,n.options,o,t)}),10),pt=a,dt=i)}else{if(!this.options.bubbleScroll||Z(o,!0)===H())return void ft();bt(e,this.options,Z(o,!1),!1)}}},S(e,{pluginName:"scroll",initializeByDefault:!0})}),tt.mount(yt,wt);const xt=tt;let Et=null,kt=null,St=null;function Dt(e){const t=kt.parentNode.querySelector(".sharing-image-editor-warning");null!==t&&(t.classList.add("warning-visible"),t.textContent=e||wp.i18n.__("Unknown generation error","sharing-image"))}function Ct(){kt.classList.add("preview-loader");const e=new XMLHttpRequest;e.open("POST",ajaxurl),e.responseType="blob";const t=new window.FormData(St);t.set("action","sharing_image_show_preview"),function(){const e=kt.parentNode.querySelector(".sharing-image-editor-warning");null!==e&&e.classList.remove("warning-visible")}(),e.addEventListener("readystatechange",(()=>{2===e.readyState&&(e.responseType="json",200===e.status&&(e.responseType="blob"))})),e.addEventListener("load",(()=>{const t=e.response||{};if(kt.classList.remove("preview-blank","preview-loader"),200!==e.status)return Dt(t.data);let n=kt.querySelector("img");null===n&&(n=p.element("img",{append:kt})),n.src=window.URL.createObjectURL(t)})),e.addEventListener("error",(()=>{Dt(),kt.classList.remove("preview-blank","preview-loader")})),e.send(t)}function Tt(e,n,a){const i=[],o=p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[x]",value:a.x,placeholder:"0"},dataset:{dimension:"x"},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[y]",value:a.y,placeholder:"0"},dataset:{dimension:"y"},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[width]",value:a.width},dataset:{dimension:"width"},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[height]",value:a.height},dataset:{dimension:"height"},label:wp.i18n.__("Height","sharing-image")}],append:e});!function(e,n,a){const i=p.control({classes:["sharing-image-editor-control","control-pulled"],append:e});p.element("button",{classes:["sharing-image-editor-more"],text:wp.i18n.__("Utilize image as the poster background.","sharing-image"),attributes:{type:"button"},append:i}).addEventListener("click",(()=>{const e={};return n.querySelectorAll("input").forEach((t=>{e[t.dataset.dimension]=t})),e.x.value=0,e.y.value=0,e.width.value=t.dataget(St,"editor","width"),e.height.value=t.dataget(St,"editor","height"),s(),void Ct()}))}(e,o),Ot(e,n,a),i[i.length]=p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Image resizing principle","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"center"},label:wp.i18n.__("Center image while preserving the aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"top"},label:wp.i18n.__("Top-aligned image while preserving the aspect ratio.","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"bottom"},label:wp.i18n.__("Bottom-aligned image while preserving aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"ignore"},label:wp.i18n.__("Resize while ignoring the aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"crop"},label:wp.i18n.__("Center-crop the image","sharing-image"),checked:a.resize||"center"}],append:e});const r=[];o.querySelectorAll("input").forEach((e=>{["width","height"].includes(e.dataset.dimension)&&r.push(e)}));const s=()=>{let e=!1;r.forEach((t=>{t.value.length<1&&(e=!0)})),i.forEach((t=>{t.classList.toggle("control-disabled",e)}))};s(),r.forEach((e=>{e.addEventListener("input",s)}))}function Pt(e,t){const n=e.querySelector("h2 > span");if(null===n)return;const a={},i=": ";e.querySelectorAll("[data-caption]").forEach((e=>{a[e.dataset.caption]=e,e.addEventListener("keyup",(()=>{n.textContent=e.value?i+e.value:""}))})),n.textContent=i+a.content.value,t.checked&&(n.textContent=i+a.title.value),n.textContent===i&&(n.textContent="")}function Ot(e,t,n){p.control({classes:["sharing-image-editor-control","control-extend","control-pulled","control-upnext"],label:wp.i18n.__("Relative boundaries","sharing-image"),fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{absolute:wp.i18n.__("No Relative Positioning","sharing-image"),vertically:wp.i18n.__("Vertical Only","sharing-image"),horizontally:wp.i18n.__("Horizontal Only","sharing-image"),both:wp.i18n.__("Both Directions Alignment","sharing-image")},attributes:{name:t+"[boundary]"},selected:n.boundary}],help:wp.i18n.__("Using offset from previous layer.","sharing-image"),append:e})}function Lt(e,t){const n=[];n.push(wp.i18n.__("Write text on the current image.","sharing-image")),n.push(wp.i18n.__("If the font does not fit within your limits, its size will decrease.","sharing-image")),n.push(wp.i18n.__("Avoid using large font sizes for long text as it affects performance.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Text","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"text"},append:a}),p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[x]",value:e.x,placeholder:"10"},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[y]",value:e.y,placeholder:"10"},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[width]",value:e.width,placeholder:"1000"},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[height]",value:e.height},label:wp.i18n.__("Height","sharing-image")}],append:a}),Ot(a,t,e),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[dynamic]",value:"dynamic"},label:wp.i18n.__("Dynamic field. Filled in on the post editing screen.","sharing-image"),checked:n.dynamic},a),o=[];o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend","control-hidden"],help:wp.i18n.__("Only visible on the admin side.","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:t+"[title]",value:n.title},dataset:{caption:"title"},label:wp.i18n.__("Field name","sharing-image")}],append:e}),o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend","control-hidden"],help:wp.i18n.__("This field is for demonstration only, to preview the editor’s appearance.","sharing-image"),fields:[{group:"textarea",classes:["sharing-image-editor-control-textarea"],content:n.sample||"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",attributes:{name:t+"[sample]",rows:2},label:wp.i18n.__("Text sample","sharing-image")}],append:e});const r=p.control({classes:["sharing-image-editor-control","control-hidden"],label:wp.i18n.__("Preset text field","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"none"},dataset:{persistent:!0},label:wp.i18n.__("Fill in manually","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"title"},dataset:{persistent:!0},label:wp.i18n.__("Take from post title","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"excerpt"},dataset:{persistent:!0},label:wp.i18n.__("Use post excerpt text","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"categories"},dataset:{persistent:!0},label:wp.i18n.__("Use post categories","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"tags"},dataset:{persistent:!0},label:wp.i18n.__("Use post tags","sharing-image"),checked:n.preset||"none"}],append:e});o[o.length]=r,o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend"],help:wp.i18n.__("You can use non-breaking spaces to adjust your string position.","sharing-image"),fields:[{group:"textarea",classes:["sharing-image-editor-control-textarea"],content:n.content,attributes:{name:t+"[content]",rows:2},dataset:{caption:"content"},label:wp.i18n.__("Content","sharing-image")}],append:e});const s=()=>{o.forEach((e=>{e.classList.toggle("control-hidden")}))};i.checked&&s(),i.addEventListener("change",(()=>{s(),Pt(e,i)})),Pt(e,i)}(a,t,e),function(e,t,n){const a=[];a[a.length]=function(e,t,n){const a=p.control({classes:["sharing-image-editor-control","control-upload","control-hidden"],append:e}),i=p.select({classes:["sharing-image-editor-control-select"],options:Et.fonts,attributes:{name:t+"[fontname]"},label:wp.i18n.__("Font family","sharing-image"),selected:n.fontname},a),o=p.media({name:t+"[fontfile]",classes:["sharing-image-editor-control-media"],value:n.fontfile,link:Et.links.uploads,labels:{button:wp.i18n.__("Upload custom font","sharing-image"),heading:wp.i18n.__("Upload custom font","sharing-image"),details:wp.i18n.__("Font attachment","sharing-image"),remove:wp.i18n.__("Remove font","sharing-image")},remove:!0,mime:["font/ttf","font/otf"],append:a});p.element("small",{text:wp.i18n.__("Custom fonts can only be in .ttf or .otf format.","sharing-image"),append:a}),n.fontfile&&(i.disabled=!0);const r=o.querySelector("input");return r.addEventListener("change",(()=>{i.disabled=!1,r.value&&(i.disabled=!0)})),a}(e,t,n),a[a.length]=p.control({classes:["sharing-image-editor-control","control-hidden"],fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{type:"color",name:t+"[color]",value:n.color||"#ffffff"},label:wp.i18n.__("Text color","sharing-image")}],append:e}),a[a.length]=p.control({classes:["sharing-image-editor-control","control-series","control-hidden"],fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{left:wp.i18n.__("Left","sharing-image"),center:wp.i18n.__("Center","sharing-image"),right:wp.i18n.__("Right","sharing-image")},attributes:{name:t+"[horizontal]"},label:wp.i18n.__("Horizontal alignment","sharing-image"),selected:n.horizontal},{group:"select",classes:["sharing-image-editor-control-select"],options:{top:wp.i18n.__("Top","sharing-image"),center:wp.i18n.__("Center","sharing-image"),bottom:wp.i18n.__("Bottom","sharing-image")},attributes:{name:t+"[vertical]"},label:wp.i18n.__("Vertical alignment","sharing-image"),selected:n.vertical}],append:e});const i=p.control({classes:["sharing-image-editor-control"],append:e}),o=p.element("button",{classes:["sharing-image-editor-more"],text:wp.i18n.__("More options","sharing-image"),attributes:{type:"button"},append:i});o.addEventListener("click",(()=>{a.forEach((e=>{e.classList.remove("control-hidden")})),e.removeChild(i)})),Object.keys(n).length>0&&o.click()}(a,t,e),p.control({classes:["sharing-image-editor-control","control-series"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[fontsize]",min:10,max:200,step:1,value:e.fontsize||"48"},label:wp.i18n.__("Font size","sharing-image")},{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[lineheight]",min:0,max:4,step:.125,value:e.lineheight||"1.5"},label:wp.i18n.__("Line height","sharing-image")}],append:a}),p.element("input",{attributes:{type:"hidden",name:t+"[separator]",value:", "},append:a}),a}function At(e,n,a={}){let i=null;const o=a.uniqid||t.uniqid(),r=Et.name+`[layers][${o}]`;switch(n){case"text":i=Lt(a,r);break;case"image":i=function(e,t){const n=[];n.push(wp.i18n.__("Use JPG, GIF, or PNG image formats.","sharing-image")),n.push(wp.i18n.__("Leave the width and height fields blank to use the original image size.","sharing-image")),n.push(wp.i18n.__("Sizes are calculated proportionally if not specified.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-image"],label:wp.i18n.__("Image","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"image"},append:a}),p.control({classes:["sharing-image-editor-control","control-extend"],help:wp.i18n.__("Only visible on the admin side.","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:t+"[title]",value:e.title},dataset:{caption:"title"},label:wp.i18n.__("Field name","sharing-image")}],append:a}),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control","control-gapped"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[dynamic]",value:"dynamic"},label:wp.i18n.__("Dynamic image. Can be updated on the post editing screen.","sharing-image"),checked:n.dynamic},a);p.media({name:t+"[attachment]",classes:["sharing-image-editor-control-media"],value:n.attachment,link:Et.links.uploads,labels:{button:wp.i18n.__("Select an image","sharing-image"),heading:wp.i18n.__("Select layer image","sharing-image"),details:wp.i18n.__("Attachment details","sharing-image"),remove:wp.i18n.__("Remove image","sharing-image")},append:a,image:!0,remove:!0,help:wp.i18n.__("This field is for demonstration only, to preview the editor’s appearance.","sharing-image"),mime:["image/png","image/jpeg","image/gif","image/webp"]});const o=[],r=p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Preset image field","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"none"},dataset:{persistent:!0},label:wp.i18n.__("Manual selection","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"featured"},dataset:{persistent:!0},label:wp.i18n.__("Use Post Featured Image","sharing-image"),checked:n.preset||"featured"}],append:e});o[o.length]=r;const s=()=>{o.forEach((e=>{e.classList.toggle("control-hidden")})),a.classList.add("control-unhelp"),i.checked&&a.classList.remove("control-unhelp")};i.checked||s(),i.addEventListener("change",(()=>{s()}))}(a,t,e),Tt(a,t,e),a}(a,r);break;case"filter":i=function(e,t){const n=[];n.push(wp.i18n.__("Filters are applied sequentially to the entire editor image.","sharing-image")),n.push(wp.i18n.__("If you want to control their order, create multiple layers.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Filter","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"filter"},append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"checkbox",classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[grayscale]",value:"grayscale"},label:wp.i18n.__("Converts the image into a grayscale version","sharing-image"),checked:e.grayscale}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"checkbox",classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[blur]",value:"blur"},label:wp.i18n.__("Blur image by Gaussian effect","sharing-image"),checked:e.blur}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[contrast]",min:-50,max:50,step:5,value:e.contrast||"0"},label:wp.i18n.__("Contrast","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[brightness]",min:-50,max:50,step:5,value:e.brightness||"0"},label:wp.i18n.__("Brightness","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[blackout]",min:0,max:100,step:5,value:e.blackout||"0"},label:wp.i18n.__("Blackout","sharing-image")}],append:a}),a}(a,r);break;case"rectangle":i=function(e,t){const n=[];n.push(wp.i18n.__("Draw a colored rectangle on the current image.","sharing-image")),n.push(wp.i18n.__("You can get a filled or outlined figure with custom color and opacity.","sharing-image")),n.push(wp.i18n.__("Use a small height to draw the line.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Rectangle","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"rectangle"},append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{type:"color",name:t+"[color]",value:e.color||"#ffffff"},label:wp.i18n.__("Rectangle color","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[x]"||0,value:e.x},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[y]"||0,value:e.y},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[width]",value:e.width},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[height]",value:e.height},label:wp.i18n.__("Height","sharing-image")}],append:a}),Ot(a,t,e),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[outline]",value:"outline"},label:wp.i18n.__("Outline rectangle.","sharing-image"),checked:n.outline},a),o=p.control({classes:["sharing-image-editor-control","control-hidden"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[thickness]",min:0,max:50,step:1,value:n.thickness||"0"},label:wp.i18n.__("Border width","sharing-image")}],append:e});n.outline&&o.classList.remove("control-hidden"),i.addEventListener("change",(()=>{o.classList.add("control-hidden"),i.checked&&o.classList.remove("control-hidden")}))}(a,t,e),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[opacity]",min:0,max:100,step:5,value:e.opacity||"0"},label:wp.i18n.__("Opacity","sharing-image")}],append:a}),a}(a,r);break;default:return null}return e.appendChild(i),function(e,t){const n=p.control({classes:["sharing-image-editor-control","control-footer"],append:t});p.element("button",{classes:["sharing-image-editor-delete"],text:wp.i18n.__("Delete layer","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{e.removeChild(t),St.classList.contains("editor-suspend")||Ct()}))}(e,i),function(e,t,n){const a=e.querySelector("h2"),i=p.element("button",{classes:["sharing-image-editor-collapse"],attributes:{type:"button",title:wp.i18n.__("Collapse layer","sharing-image")},prepend:a});let o=1===t.collapsed;o&&e.classList.add("layer-collapsed");const r=p.element("input",{attributes:{type:"hidden",name:n+"[collapsed]",value:Number(o)},append:e});i.addEventListener("click",(t=>{t.preventDefault(),o=!o,e.classList.toggle("layer-collapsed",o),i.setAttribute("title",wp.i18n.__("Collapse layer","sharing-image")),o&&i.setAttribute("title",wp.i18n.__("Expand layer","sharing-image")),r.value=Number(o)}))}(i,a,r),function(e,t){p.element("button",{classes:["sharing-image-editor-order"],attributes:{type:"button",title:wp.i18n.__("Change layer position","sharing-image")},append:t}),xt.create(e,{handle:".sharing-image-editor-order",onUpdate:()=>{St.classList.contains("editor-suspend")||Ct()}})}(e,i),i}const Mt=function(e,t,n,a={}){Et=t,St=function(e,t){Et.name="sharing_image_editor";const n=p.element("form",{classes:["sharing-image-editor"],attributes:{action:Et.links.action,method:"POST"},append:e});return Et.config.suspend&&n.classList.add("editor-suspend"),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_save_editor"},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_index",value:t},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:Et.nonce},append:n}),n.addEventListener("submit",(e=>{e.preventDefault(),function(){const e=new XMLHttpRequest;e.open("POST",ajaxurl),e.responseType="json",kt.classList.add("preview-loader");const t=new window.FormData(St);t.set("action","sharing_image_save_preview"),e.addEventListener("load",(()=>{const t=e.response||{};if(!t.data)return Dt();if(!t.success)return kt.classList.remove("preview-loader"),Dt(t.data);const n=kt.querySelector("input");null!==n&&(n.value=t.data),St.submit()})),e.addEventListener("error",(()=>{kt.classList.remove("preview-loader"),Dt()})),e.send(t)}()})),n}(e,n),function(e){const t=p.element("div",{classes:["sharing-image-editor-monitor"],append:St}),n=p.element("div",{classes:["sharing-image-editor-viewport"],append:t});!function(e,t){kt=p.element("div",{classes:["sharing-image-editor-preview","preview-blank"],append:e}),t.preview&&(p.element("img",{attributes:{src:t.preview,alt:""},append:kt}),kt.classList.remove("preview-blank")),p.element("span",{classes:["sharing-image-editor-loader"],append:kt}),p.element("input",{attributes:{type:"hidden",name:Et.name+"[preview]",value:t.preview},append:kt})}(n,e),p.element("div",{classes:["sharing-image-editor-warning"],append:n});const a=p.element("div",{classes:["sharing-image-editor-manager"],append:n});!function(e,t){p.checkbox({classes:["sharing-image-editor-debug"],attributes:{name:Et.name+"[debug]",value:"debug"},label:wp.i18n.__("Show debug frames","sharing-image"),checked:t.debug},e).addEventListener("change",(()=>{Ct()}))}(a,e),function(e){p.element("button",{text:wp.i18n.__("Save changes","sharing-image"),classes:["button","button-primary"],attributes:{type:"submit"},append:e})}(a),function(e){p.element("button",{text:wp.i18n.__("Generate preview","sharing-image"),classes:["button"],attributes:{type:"button"},append:e}).addEventListener("click",(()=>{Ct()}))}(a)}(a),function(e){const t=p.element("div",{classes:["sharing-image-editor-fieldset"],append:St});p.control({classes:["sharing-image-editor-control","control-compact","control-extend"],help:wp.i18n.__("Used only in the admin panel","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[title]",value:e.title},dataset:{persistent:!0,editor:"title"},label:wp.i18n.__("Template title","sharing-image")}],append:t}),p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Fill color","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{name:Et.name+"[fill]",type:"color",value:e.fill},dataset:{editor:"fill"}}],append:t}),p.control({classes:["sharing-image-editor-control","control-compact","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[width]",value:e.width||"1200",placeholder:"1200",maxlength:4},dataset:{editor:"width"},label:wp.i18n.__("Editor width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[height]",value:e.height||"630",placeholder:"630",maxlength:4},dataset:{editor:"height"},label:wp.i18n.__("Editor height","sharing-image")}],append:t});const n=[];n.push(wp.i18n.__("You can add multiple layers on your editor.","sharing-image")),n.push(wp.i18n.__("Note that the stacking order of the layers is important.","sharing-image")),n.push(wp.i18n.__("You can change the order using the icon in the corner of each box.","sharing-image")),p.control({classes:["sharing-image-editor-control","control-reduced"],label:wp.i18n.__("Add layers","sharing-image"),description:n.join(" "),append:t}),function(e,t){const n=p.control({classes:["sharing-image-editor-control","control-select","control-compact"],fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{text:wp.i18n.__("Text","sharing-image"),image:wp.i18n.__("Image","sharing-image"),filter:wp.i18n.__("Filter","sharing-image"),rectangle:wp.i18n.__("Rectangle","sharing-image")}}],append:e});p.element("button",{classes:["button"],text:wp.i18n.__("Add new","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{const e=n.querySelector("select");null!==e&&At(a,e.value).scrollIntoView({behavior:"smooth"})}));const a=p.element("div",{classes:["sharing-image-editor-designer"],append:e});t.layers=t.layers||{};for(const e in t.layers){const n=t.layers[e];if(n.uniqid=e,n.hasOwnProperty("type")&&!At(a,n.type,n))return}}(t,e);const a=p.control({classes:["sharing-image-editor-control","control-footer"],append:t});!function(e){const t=new URL(document.location.href);t.searchParams.delete("template"),p.element("a",{classes:["button"],text:wp.i18n.__("← Back to Catalog","sharing-image"),attributes:{href:t.href},append:e})}(a),function(e){const t=new URL(document.location.href).searchParams.get("template"),n=new URL(Et.links.action);n.searchParams.set("action","sharing_image_delete_template"),n.searchParams.set("template",t),n.searchParams.set("nonce",Et.nonce),p.element("a",{classes:["sharing-image-editor-delete"],text:wp.i18n.__("Delete template","sharing-image"),attributes:{href:n.href},append:e}).addEventListener("click",(e=>{const t=wp.i18n.__("Are you sure you want to delete this template?","sharing-image");confirm(t)||e.preventDefault()}))}(a),t.addEventListener("change",(e=>{if(St.classList.contains("editor-suspend"))return;const t=e.target;t.hasAttribute("data-persistent")||t.hasAttribute("name")&&Ct()}))}(a)};let Nt=null;!function(){if(void 0===wp)return;let e=window.sharingImageSettings||{};e=t.defaults(e,["links","fonts","config","templates","license"]);const n=document.querySelector("#sharing-image-settings .sharing-image-content");if(null!==n)switch(n.classList.add("content-visible"),t.param("tab")){case"config":!function(e,t){!function(e,t){Nt=t,Nt.name="sharing_image_config";const n=e.querySelector(".sharing-image-config");if(null===n)return;const a=p.element("form",{classes:["sharing-image-config-options"],attributes:{action:Nt.links.action,method:"POST"},append:n}),i=Nt.config||{},o=Nt.templates||[];!function(e,t){const n=p.control({classes:["sharing-image-config-control","control-extra"],label:wp.i18n.__("Poster image format","sharing-image"),help:wp.i18n.__("The higher the value, the less compression. Availible for JPEG only.","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:{jpg:wp.i18n.__("JPEG","sharing-image"),png:wp.i18n.__("PNG","sharing-image"),gif:wp.i18n.__("GIF","sharing-image")},attributes:{name:Nt.name+"[format]"},selected:t.format||"jpg"},{group:"input",classes:["sharing-image-config-control-range"],attributes:{type:"range",name:Nt.name+"[quality]",min:10,max:100,step:5,value:t.quality||"90",disabled:"disabled"},label:wp.i18n.__("Image quality","sharing-image")}],append:e}),a=n.querySelector("select"),i=n.querySelector("input");"jpg"===a.value&&(i.disabled=!1),a.addEventListener("change",(()=>{i.disabled=!0,"jpg"===a.value&&(i.disabled=!1)}))}(a,i),function(e,t,n){const a={};a[""]=wp.i18n.__("Disable auto generation","sharing-image");for(const e in n)a[e]=n[e].title||wp.i18n.__("Untitled","sharing-image");let i=t.autogenerate;void 0===i&&(i=""),p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Auto generate poster","sharing-image"),help:wp.i18n.__("This template will be applied automatically when the post is saved.","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:a,attributes:{name:Nt.name+"[autogenerate]"},selected:String(i)}],append:e})}(a,i,o),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Hide post widget","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[nowidget]",value:"nowidget"},label:wp.i18n.__("Hide the widget on the post editor page","sharing-image"),checked:t.nowidget}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control","control-extra"],label:wp.i18n.__("Header Meta Tags","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:{snippets:wp.i18n.__("Display Meta Tags with consideration for SEO plugins","sharing-image"),custom:wp.i18n.__("Always display Meta Tags on all pages","sharing-image"),hidden:wp.i18n.__("Hide Sharing Image Meta Tags","sharing-image")},attributes:{name:Nt.name+"[meta]"},selected:t.meta||"snippets"}],append:e});if(0===Nt.snippets.length)return n;p.element("h4",{text:wp.i18n.__("Detected SEO plugins","sharing-image"),append:n});const a=p.element("ul",{classes:["sharing-image-config-control-list"],append:n});Nt.snippets.forEach((e=>{const t=p.element("li",{append:a});p.element("a",{attributes:{href:e.link,target:"_blank",rel:"noopener"},text:e.title,append:t})}))}(a,i),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Poster attachment","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[attachment]",value:"attachment"},label:wp.i18n.__("Save the generated poster as an attachment in the media library","sharing-image"),checked:t.attachment}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Upload directory","sharing-image"),append:e}),a=p.element("div",{classes:["sharing-image-config-control-fieldset"],append:n});p.radio({classes:["sharing-image-config-control-radio"],attributes:{name:Nt.name+"[uploads]",value:"default"},label:wp.i18n.__("Use default uploads directory","sharing-image"),checked:t.uploads||"default"},a),p.radio({classes:["sharing-image-config-control-radio"],attributes:{name:Nt.name+"[uploads]",value:"custom"},label:wp.i18n.__("Select custom storage for posters","sharing-image"),checked:t.uploads||"default"},a);const i=p.input({classes:["sharing-image-config-control-input"],attributes:{name:Nt.name+"[storage]",value:t.storage||Nt.links.storage,disabled:"disabled"}},n);p.element("small",{text:wp.i18n.__("Use a relative path from the site root. The directory should be writable.","sharing-image"),append:n}),n.querySelectorAll("input").forEach((e=>{"radio"===e.type&&(e.checked&&"custom"===e.value&&(i.disabled=!1),e.addEventListener("change",(()=>{i.disabled=!0,"custom"===e.value&&(i.disabled=!1)})))}))}(a,i),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Live-reload","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[suspend]",value:"suspend"},label:wp.i18n.__("Disable live reload on the template editor screen.","sharing-image"),checked:t.suspend}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Default poster","sharing-image"),append:e});p.media({name:Nt.name+"[default]",classes:["sharing-image-config-control-media"],value:t.default,link:Nt.links.uploads,labels:{button:wp.i18n.__("Upload image","sharing-image"),heading:wp.i18n.__("Select default poster","sharing-image"),details:wp.i18n.__("Attachment details","sharing-image"),remove:wp.i18n.__("Remove image","sharing-image")},image:!0,remove:!0,append:n});const a=[];a.push(wp.i18n.__("The default poster is used on pages where none is generated.","sharing-image")),a.push(wp.i18n.__("Best image size: 1200×630 pixels.","sharing-image")),p.element("small",{text:a.join(" "),append:n})}(a,i),function(e,t){p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_save_config"},append:e}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:Nt.nonce},append:e}),p.element("input",{attributes:{type:"hidden",name:Nt.name+"[demo]",value:t.demo||""},append:e}),p.element("button",{text:wp.i18n.__("Save changes","sharing-image"),classes:["button","button-primary"],attributes:{type:"submit"},append:e})}(a,i)}(e,t)}(n,e);break;case"tools":!function(e,t){!function(e,t){d=t;const n=e.querySelector(".sharing-image-tools");null!==n&&(function(e){const t=d.templates||[],n=p.control({classes:["sharing-image-tools-control","control-section"],label:wp.i18n.__("Clone template","sharing-image"),append:e}),a=p.element("p",{classes:["sharing-image-tools-warning"],text:wp.i18n.__("To initiate cloning, enable Premium and have at least one template.","sharing-image")}),i=d.license||{};if(0===t.length||!i.premium&&!i.develop)return n.appendChild(a);const o={};for(const e in t)o[e]=t[e].title||wp.i18n.__("Untitled","sharing-image");const r=p.element("form",{classes:["sharing-image-tools-control-cloning"],attributes:{action:d.links.action,method:"POST"},append:n}),s=p.select({classes:["sharing-image-tools-control-duplicator"],options:o,attributes:{name:"sharing_image_source"}},r);p.element("button",{classes:["button","button-primary"],attributes:{type:"submit"},text:wp.i18n.__("Create a copy","sharing-image"),append:s.parentNode}),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_clone_template"},append:r}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:d.nonce},append:r})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control"],label:wp.i18n.__("Export templates","sharing-image"),append:e}),n=p.element("div",{classes:["sharing-image-tools-control-fieldset"],append:t}),a=new URL(d.links.action);a.searchParams.set("action","sharing_image_export_templates"),a.searchParams.set("nonce",d.nonce),p.element("a",{classes:["button","button-primary"],text:wp.i18n.__("Download backup file","sharing-image"),attributes:{href:a.href},append:n}),p.element("small",{text:wp.i18n.__("Save a local copy of all template settings for later use.","sharing-image"),append:n})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control","control-section"],label:wp.i18n.__("Import templates","sharing-image"),append:e}),n=p.element("form",{classes:["sharing-image-tools-control-uploader"],attributes:{action:d.links.action,method:"POST",enctype:"multipart/form-data"},append:t});p.element("input",{classes:["sharing-image-tools-control-file"],attributes:{type:"file",name:"sharing_image_file",accept:"application/json",required:"required"},append:n}),p.element("button",{classes:["button","button-primary"],attributes:{type:"submit"},text:wp.i18n.__("Import templates","sharing-image"),append:n}),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_import_templates"},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:d.nonce},append:n})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control"],label:wp.i18n.__("Clearing settings","sharing-image"),append:e}),n=p.element("div",{classes:["sharing-image-tools-control-fieldset"],append:t}),a=new URL(d.links.action);a.searchParams.set("action","sharing_image_clear_templates"),a.searchParams.set("nonce",d.nonce),p.element("a",{classes:["sharing-image-tools-delete","button"],text:wp.i18n.__("Remove posters","sharing-image"),attributes:{href:a.href},append:n}).addEventListener("click",(e=>{const t=wp.i18n.__("Are you sure you want to clear plugin data?","sharing-image");confirm(t)||e.preventDefault()})),p.element("small",{text:wp.i18n.__("This action clears post meta options but does not delete server images.","sharing-image"),append:n})}(n))}(e,t)}(n,e);break;case"premium":!function(e,t){!function(e,t){h=t,m=e.querySelector(".sharing-image-premium"),null!==m&&(p.element("div",{classes:["sharing-image-premium-warning"],append:m}),w())}(e,t)}(n,e);break;default:!function(e,n){let a=null;n.templates=n.templates||[],t.param("template")&&(a=t.param("template"));const i=n.templates[a];void 0!==i?Mt(e,n,a,i):null===a?function(e,t){u=t;const n=p.element("div",{classes:["sharing-image-catalog"],append:e});for(const e in t.templates)g(n,t.templates[e],e);!function(e,t){const n=new URL(document.location.href);n.searchParams.set("template",t);const a=p.element("a",{classes:["sharing-image-catalog-new"],attributes:{href:n.href},append:e}),i=p.element("h2",{append:a});if(p.element("strong",{text:wp.i18n.__("Add new template","sharing-image"),append:i}),0===u.templates.length)return;const o=u.license||{};o.premium||o.develop||(p.element("span",{text:wp.i18n.__("(Availible for Premium only)","sharing-image"),append:i}),u.links.premium&&(a.href=u.links.premium))}(n,t.index)}(e,n):Mt(e,n,a)}(n,e)}}()})();
     1(()=>{"use strict";let e=e=>crypto.getRandomValues(new Uint8Array(e));const t={param:function(e){return new URL(document.location.href).searchParams.get(e)},attachment:function(e,t){if(e.hasOwnProperty("multiple")||(e.multiple=!1),!wp.media)return;const n=wp.media(e);n.on("select",(()=>{const e=n.state().get("selection").first().toJSON();e.id&&t(e.id)})),n.open()},defaults:function(e,t){return t.forEach((t=>{void 0===e[t]&&(e[t]={})})),e},uniqid:function(){return((t,n=21)=>((e,t,n)=>{let a=(2<<Math.log(e.length-1)/Math.LN2)-1,i=-~(1.6*a*t/e.length);return(o=t)=>{let r="";for(;;){let t=n(i),s=i;for(;s--;)if(r+=e[t[s]&a]||"",r.length===o)return r}}})(t,n,e))("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",12)()},dataget:function(e,t,n){const a=e.querySelector(`[data-${t}="${n}"]`);if(a)return a.value}},n=function(e,t={}){const n=document.createElement(e);if(t.hasOwnProperty("classes")&&t.classes.forEach((e=>{n.classList.add(e)})),t.hasOwnProperty("text")&&(n.textContent=t.text),t.hasOwnProperty("html")&&(n.innerHTML=t.html),t.hasOwnProperty("attributes"))for(const e in t.attributes){const a=t.attributes[e];void 0!==a&&n.setAttribute(e,a)}if(t.hasOwnProperty("dataset"))for(const e in t.dataset)n.setAttribute("data-"+e,t.dataset[e]);return t.hasOwnProperty("append")&&t.append.appendChild(n),t.hasOwnProperty("prepend")&&t.prepend.insertBefore(n,t.prepend.firstChild),n},a=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("input",{attributes:{type:"text"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if("range"===i.type){const e=p.element("em",{text:i.value,attributes:{title:wp.i18n.__("Click to change the input view.","sharing-image")},append:a});i.addEventListener("change",(()=>{e.textContent=i.value})),i.addEventListener("input",(()=>{e.textContent=i.value})),e.addEventListener("click",(()=>{i.type="text"===i.type?"range":"text"}))}return i},i=function(e,t){const a=n("label",{classes:e.classes||[],append:t}),i=n("input",{attributes:{type:"checkbox"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("checked")){const t=e.checked;t&&t===i.value&&i.setAttribute("checked","checked")}if(e.hasOwnProperty("label")){const t=n("span",{text:e.label});null!==e.label&&a.appendChild(t)}return i},o=function(e,t){const a=n("label",{classes:e.classes||[],append:t}),i=n("input",{attributes:{type:"radio"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("checked")){const t=e.checked;t&&t===i.value&&i.setAttribute("checked","checked")}if(e.hasOwnProperty("label")){const t=n("span",{text:e.label});null!==e.label&&a.appendChild(t)}return e.hasOwnProperty("help")&&n("small",{text:e.help,append:a}),i},r=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("select",{dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}const o=e.options||{};for(const t in o){const a=n("option",{text:o[t],attributes:{value:t},append:i});if(e.hasOwnProperty("selected")){const t=e.selected;t&&t===a.value&&a.setAttribute("selected","selected")}}return i},s=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("textarea",{dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("content")){const t=e.content;void 0!==t&&(i.innerHTML=t)}return i},l=function(e){const t=n("div",{classes:e.classes||[]});return e.hasOwnProperty("append")&&e.append.appendChild(t),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(t,e.prepend.firstChild),e.hasOwnProperty("label")&&n("h3",{text:e.label,append:t}),e.hasOwnProperty("description")&&n("p",{text:e.description,append:t}),e.hasOwnProperty("fields")&&e.fields.forEach((e=>{switch(e.group){case"input":a(e,t);break;case"textarea":s(e,t);break;case"radio":o(e,t);break;case"select":r(e,t);break;case"checkbox":i(e,t)}})),e.hasOwnProperty("help")&&n("small",{text:e.help,append:t}),t};function c(e,t){let a=e.querySelector("figure");if(a&&e.removeChild(a),!wp.media)return;if(a=n("figure",{prepend:e}),e.querySelector("h4")&&e.insertBefore(a,e.querySelector("h4").nextSibling),!t)return;let i=a.querySelector("img");i&&a.removeChild(i),i=n("img",{append:a}),wp.media.attachment(t).fetch().then((e=>{i.src=e.sizes?.thumbnail?.url||e.url}))}const p={element:n,control:l,layer:function(e){const t=n("div",{classes:e.classes||[]});e.hasOwnProperty("append")&&e.append.appendChild(t),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(t,e.prepend.firstChild),e.hasOwnProperty("label")||(e.label="");const a=n("h2",{text:e.label,append:t});return n("span",{append:a}),e.hasOwnProperty("description")&&n("h5",{text:e.description,append:t}),t},checkbox:i,media:function(e){const a=l({classes:e.classes||[]});if(e.hasOwnProperty("append")&&e.append.appendChild(a),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(a,e.prepend.firstChild),e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}e.labels=e.labels||{};const i=n("input",{attributes:{type:"hidden",name:e.name},append:a}),o=n("button",{classes:["button"],text:e.labels.button,attributes:{type:"button"},append:a}),r=n("a",{classes:["hidden"],text:e.labels.details,attributes:{target:"_blank"}});e.hasOwnProperty("link")&&a.appendChild(r),e.hasOwnProperty("help")&&n("small",{text:e.help,append:a});const s=t=>{i.setAttribute("value",t),i.dispatchEvent(new Event("change",{bubbles:!0}));let n=null;e.hasOwnProperty("link")&&(n=new URL(e.link),n.searchParams.set("item",t),r.setAttribute("href",n.href)),e.remove&&(o.textContent=e.labels.remove),e.image&&c(a,t),r.classList.remove("hidden")},p=()=>{i.setAttribute("value",""),i.dispatchEvent(new Event("change",{bubbles:!0})),o.textContent=e.labels.button,e.image&&c(a,0),r.classList.add("hidden")};return e.image&&c(a,0),e.value&&s(e.value),o.addEventListener("click",(()=>{if(e.remove&&i.value)return p();const n={title:e.labels.heading};e.hasOwnProperty("mime")&&(n.library={},n.library.type=e.mime),t.attachment(n,(e=>{s(e)}))})),a.addEventListener("set_attachment",(e=>{e.detail&&s(e.detail)})),a.addEventListener("remove_attachment",(()=>{p()})),a},input:a,textarea:s,radio:o,select:r};let d=null;let u=null;function g(e,t,n){const a=p.element("div",{classes:["sharing-image-catalog-card"],append:e}),i=p.element("figure",{classes:["sharing-image-catalog-preview"],append:a});t.preview&&p.element("img",{attributes:{src:t.preview,alt:""},append:i});const o=p.element("footer",{classes:["sharing-image-catalog-footer"],append:a});p.element("h2",{text:t.title||wp.i18n.__("Untitled","sharing-image"),append:o});const r=new URL(document.location.href);r.searchParams.set("template",n),p.element("a",{classes:["button"],text:wp.i18n.__("Edit template","sharing-image"),attributes:{href:r.href},append:o})}let h=null,m=null;function f(e,t){const n=[];switch(void 0===t&&(t=wp.i18n.__("Verification unsuccessful.","sharing-image")),n.push(t),e){case"LIMIT_EXCEEDED":n.push(wp.i18n.__("The number of licenses for this key has been exceeded.","sharing-image"));break;case"KEY_NOT_FOUND":n.push(wp.i18n.__("The Premium key is invalid or expired.","sharing-image"));break;case"SERVER_ERROR":n.push(wp.i18n.__("Unable to receive a response from the verification server.","sharing-image"))}return n.join(" ")}function v(e){const t=m.querySelector(".sharing-image-premium-warning");null!==t&&(t.classList.add("warning-visible"),t.textContent=e||wp.i18n.__("Unknown request error.","sharing-image"))}function b(){const e=m.querySelector(".sharing-image-premium-warning");null!==e&&e.classList.remove("warning-visible")}function _(e,t){m.classList.add("premium-enabled"),t.develop?v(wp.i18n.__("Using the plugin with a development license is prohibited in production.","sharing-image")):(t.key&&function(e,t){const n=p.element("div",{classes:["sharing-image-premium-permit"],append:e});p.element("button",{classes:["sharing-image-premium-show","button"],text:wp.i18n.__("Show License key","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{n.classList.toggle("permit-visible")})),p.element("strong",{text:t,append:n})}(e,t.key),function(e){const t=p.element("div",{classes:["sharing-image-premium-revoke"],append:e}),n=[];n.push(wp.i18n.__("Disabling premium mode will not remove the license for this domain.","sharing-image")),n.push(wp.i18n.__("Your current key will also be saved in the plugin settings.","sharing-image")),n.push(wp.i18n.__("Use key management tool to delete the license for the site.","sharing-image")),p.element("p",{text:n.join(" "),append:t}),p.element("button",{classes:["button"],text:wp.i18n.__("Disable Premium","sharing-image"),attributes:{type:"submit"},append:t}),p.element("span",{classes:["spinner"],append:t}),e.addEventListener("submit",(t=>{t.preventDefault(),function(e){e.classList.add("access-loader");const t=new XMLHttpRequest;t.open("POST",ajaxurl),t.responseType="json";const n=new window.FormData(e);n.set("action","sharing_image_revoke_premium"),b(),t.addEventListener("load",(()=>{const n=t.response||{};return e.classList.remove("access-loader"),n.data?n.success?(h.license=n.data,void w()):v(n.data):v()})),t.addEventListener("error",(()=>{v(),e.classList.remove("access-loader")})),t.send(n)}(e)}))}(e))}function w(){let e=m.querySelector(".sharing-image-premium-access");null!==e&&m.removeChild(e),e=p.element("form",{classes:["sharing-image-premium-access"],attributes:{action:"",method:"POST"},append:m}),m.classList.remove("premium-enabled"),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:h.nonce},append:e});const t=h.license||{};return t.premium||t.develop?_(e,t):function(e,t){t.error&&v(f(t.error)),p.element("strong",{text:wp.i18n.__("Do you already have a key? Enter it here","sharing-image"),append:e});const n=p.element("div",{classes:["sharing-image-premium-verify"],append:e});p.element("input",{label:wp.i18n.__("Your Premium key","sharing-image"),attributes:{type:"text",name:"sharing_image_key",value:t.key},append:n}),p.element("button",{classes:["button"],text:wp.i18n.__("Submit","sharing-image"),attributes:{type:"submit"},append:n}),p.element("span",{classes:["spinner"],append:n}),e.addEventListener("submit",(t=>{t.preventDefault(),function(e){e.classList.add("access-loader");const t=new XMLHttpRequest;t.open("POST",ajaxurl),t.responseType="json";const n=new window.FormData(e);n.set("action","sharing_image_verify_premium"),b(),t.addEventListener("load",(()=>{const n=t.response||{};return e.classList.remove("access-loader"),n.data?n.success?(h.license=n.data,void w()):v(f(n.code,n.data)):v()})),t.addEventListener("error",(()=>{v(),e.classList.remove("access-loader")})),t.send(n)}(e)}))}(e,t)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){k(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function E(e){return E="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(e)}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(){return S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},S.apply(this,arguments)}function D(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var C=D(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),T=D(/Edge/i),P=D(/firefox/i),O=D(/safari/i)&&!D(/chrome/i)&&!D(/android/i),L=D(/iP(ad|od|hone)/i),A=D(/chrome/i)&&D(/android/i),M={capture:!1,passive:!1};function N(e,t,n){e.addEventListener(t,n,!C&&M)}function I(e,t,n){e.removeEventListener(t,n,!C&&M)}function R(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 Y(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function j(e,t,n,a){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&R(e,t):R(e,t))||a&&e===n)return e;if(e===n)break}while(e=Y(e))}return null}var F,X=/\s+/g;function q(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var a=(" "+e.className+" ").replace(X," ").replace(" "+t+" "," ");e.className=(a+(n?" "+t:"")).replace(X," ")}}function z(e,t,n){var a=e&&e.style;if(a){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 a||-1!==t.indexOf("webkit")||(t="-webkit-"+t),a[t]=n+("string"==typeof n?"":"px")}}function B(e,t){var n="";if("string"==typeof e)n=e;else do{var a=z(e,"transform");a&&"none"!==a&&(n=a+" "+n)}while(!t&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function U(e,t,n){if(e){var a=e.getElementsByTagName(t),i=0,o=a.length;if(n)for(;i<o;i++)n(a[i],i);return a}return[]}function H(){return document.scrollingElement||document.documentElement}function W(e,t,n,a,i){if(e.getBoundingClientRect||e===window){var o,r,s,l,c,p,d;if(e!==window&&e.parentNode&&e!==H()?(r=(o=e.getBoundingClientRect()).top,s=o.left,l=o.bottom,c=o.right,p=o.height,d=o.width):(r=0,s=0,l=window.innerHeight,c=window.innerWidth,p=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(i=i||e.parentNode,!C))do{if(i&&i.getBoundingClientRect&&("none"!==z(i,"transform")||n&&"static"!==z(i,"position"))){var u=i.getBoundingClientRect();r-=u.top+parseInt(z(i,"border-top-width")),s-=u.left+parseInt(z(i,"border-left-width")),l=r+o.height,c=s+o.width;break}}while(i=i.parentNode);if(a&&e!==window){var g=B(i||e),h=g&&g.a,m=g&&g.d;g&&(l=(r/=m)+(p/=m),c=(s/=h)+(d/=h))}return{top:r,left:s,bottom:l,right:c,width:d,height:p}}}function G(e,t,n){for(var a=Z(e,!0),i=W(e)[t];a;){var o=W(a)[n];if(!("top"===n||"left"===n?i>=o:i<=o))return a;if(a===H())break;a=Z(a,!1)}return!1}function V(e,t,n,a){for(var i=0,o=0,r=e.children;o<r.length;){if("none"!==r[o].style.display&&r[o]!==tt.ghost&&(a||r[o]!==tt.dragged)&&j(r[o],n.draggable,e,!1)){if(i===t)return r[o];i++}o++}return null}function J(e,t){for(var n=e.lastElementChild;n&&(n===tt.ghost||"none"===z(n,"display")||t&&!R(n,t));)n=n.previousElementSibling;return n||null}function $(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===tt.clone||t&&!R(e,t)||n++;return n}function K(e){var t=0,n=0,a=H();if(e)do{var i=B(e),o=i.a,r=i.d;t+=e.scrollLeft*o,n+=e.scrollTop*r}while(e!==a&&(e=e.parentNode));return[t,n]}function Z(e,t){if(!e||!e.getBoundingClientRect)return H();var n=e,a=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=z(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return H();if(a||t)return n;a=!0}}}while(n=n.parentNode);return H()}function Q(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function ee(e,t){return function(){if(!F){var n=arguments;1===n.length?e.call(this,n[0]):e.apply(this,n),F=setTimeout((function(){F=void 0}),t)}}}function te(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function ne(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}function ae(e,t,n){var a={};return Array.from(e.children).forEach((function(i){var o,r,s,l;if(j(i,t.draggable,e,!1)&&!i.animated&&i!==n){var c=W(i);a.left=Math.min(null!==(o=a.left)&&void 0!==o?o:1/0,c.left),a.top=Math.min(null!==(r=a.top)&&void 0!==r?r:1/0,c.top),a.right=Math.max(null!==(s=a.right)&&void 0!==s?s:-1/0,c.right),a.bottom=Math.max(null!==(l=a.bottom)&&void 0!==l?l:-1/0,c.bottom)}})),a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}var ie="Sortable"+(new Date).getTime();var oe=[],re={initializeByDefault:!0},se={mount:function(e){for(var t in re)re.hasOwnProperty(t)&&!(t in e)&&(e[t]=re[t]);oe.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),oe.push(e)},pluginEvent:function(e,t,n){var a=this;this.eventCanceled=!1,n.cancel=function(){a.eventCanceled=!0};var i=e+"Global";oe.forEach((function(a){t[a.pluginName]&&(t[a.pluginName][i]&&t[a.pluginName][i](x({sortable:t},n)),t.options[a.pluginName]&&t[a.pluginName][e]&&t[a.pluginName][e](x({sortable:t},n)))}))},initializePlugins:function(e,t,n,a){for(var i in oe.forEach((function(a){var i=a.pluginName;if(e.options[i]||a.initializeByDefault){var o=new a(e,t,e.options);o.sortable=e,o.options=e.options,e[i]=o,S(n,o.defaults)}})),e.options)if(e.options.hasOwnProperty(i)){var o=this.modifyOption(e,i,e.options[i]);void 0!==o&&(e.options[i]=o)}},getEventProperties:function(e,t){var n={};return oe.forEach((function(a){"function"==typeof a.eventProperties&&S(n,a.eventProperties.call(t[a.pluginName],e))})),n},modifyOption:function(e,t,n){var a;return oe.forEach((function(i){e[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[t]&&(a=i.optionListeners[t].call(e[i.pluginName],n))})),a}};var le=["evt"],ce=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=n.evt,i=function(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(n,le);se.pluginEvent.bind(tt)(e,t,x({dragEl:de,parentEl:ue,ghostEl:ge,rootEl:he,nextEl:me,lastDownEl:fe,cloneEl:ve,cloneHidden:be,dragStarted:Le,putSortable:ke,activeSortable:tt.active,originalEvent:a,oldIndex:_e,oldDraggableIndex:ye,newIndex:we,newDraggableIndex:xe,hideGhostForTarget:Ke,unhideGhostForTarget:Ze,cloneNowHidden:function(){be=!0},cloneNowShown:function(){be=!1},dispatchSortableEvent:function(e){pe({sortable:t,name:e,originalEvent:a})}},i))};function pe(e){!function(e){var t=e.sortable,n=e.rootEl,a=e.name,i=e.targetEl,o=e.cloneEl,r=e.toEl,s=e.fromEl,l=e.oldIndex,c=e.newIndex,p=e.oldDraggableIndex,d=e.newDraggableIndex,u=e.originalEvent,g=e.putSortable,h=e.extraEventProperties;if(t=t||n&&n[ie]){var m,f=t.options,v="on"+a.charAt(0).toUpperCase()+a.substr(1);!window.CustomEvent||C||T?(m=document.createEvent("Event")).initEvent(a,!0,!0):m=new CustomEvent(a,{bubbles:!0,cancelable:!0}),m.to=r||n,m.from=s||n,m.item=i||n,m.clone=o,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=p,m.newDraggableIndex=d,m.originalEvent=u,m.pullMode=g?g.lastPutMode:void 0;var b=x(x({},h),se.getEventProperties(a,t));for(var _ in b)m[_]=b[_];n&&n.dispatchEvent(m),f[v]&&f[v].call(t,m)}}(x({putSortable:ke,cloneEl:ve,targetEl:de,rootEl:he,oldIndex:_e,oldDraggableIndex:ye,newIndex:we,newDraggableIndex:xe},e))}var de,ue,ge,he,me,fe,ve,be,_e,we,ye,xe,Ee,ke,Se,De,Ce,Te,Pe,Oe,Le,Ae,Me,Ne,Ie,Re=!1,Ye=!1,je=[],Fe=!1,Xe=!1,qe=[],ze=!1,Be=[],Ue="undefined"!=typeof document,He=L,We=T||C?"cssFloat":"float",Ge=Ue&&!A&&!L&&"draggable"in document.createElement("div"),Ve=function(){if(Ue){if(C)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Je=function(e,t){var n=z(e),a=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=V(e,0,t),o=V(e,1,t),r=i&&z(i),s=o&&z(o),l=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+W(i).width,c=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+W(o).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(i&&r.float&&"none"!==r.float){var p="left"===r.float?"left":"right";return!o||"both"!==s.clear&&s.clear!==p?"horizontal":"vertical"}return i&&("block"===r.display||"flex"===r.display||"table"===r.display||"grid"===r.display||l>=a&&"none"===n[We]||o&&"none"===n[We]&&l+c>a)?"vertical":"horizontal"},$e=function(e){function t(e,n){return function(a,i,o,r){var s=a.options.group.name&&i.options.group.name&&a.options.group.name===i.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(a,i,o,r),n)(a,i,o,r);var l=(n?a:i).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},a=e.group;a&&"object"==E(a)||(a={name:a}),n.name=a.name,n.checkPull=t(a.pull,!0),n.checkPut=t(a.put),n.revertClone=a.revertClone,e.group=n},Ke=function(){!Ve&&ge&&z(ge,"display","none")},Ze=function(){!Ve&&ge&&z(ge,"display","")};Ue&&!A&&document.addEventListener("click",(function(e){if(Ye)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ye=!1,!1}),!0);var Qe=function(e){if(de){e=e.touches?e.touches[0]:e;var t=(i=e.clientX,o=e.clientY,je.some((function(e){var t=e[ie].options.emptyInsertThreshold;if(t&&!J(e)){var n=W(e),a=i>=n.left-t&&i<=n.right+t,s=o>=n.top-t&&o<=n.bottom+t;return a&&s?r=e:void 0}})),r);if(t){var n={};for(var a in e)e.hasOwnProperty(a)&&(n[a]=e[a]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[ie]._onDragOver(n)}}var i,o,r},et=function(e){de&&de.parentNode[ie]._isOutsideThisEl(e.target)};function tt(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=S({},t),e[ie]=this;var n,a,i={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 Je(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!==tt.supportPointer&&"PointerEvent"in window&&!O,emptyInsertThreshold:5};for(var o in se.initializePlugins(this,e,i),i)!(o in t)&&(t[o]=i[o]);for(var r in $e(t),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!t.forceFallback&&Ge,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?N(e,"pointerdown",this._onTapStart):(N(e,"mousedown",this._onTapStart),N(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(N(e,"dragover",this),N(e,"dragenter",this)),je.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),S(this,(a=[],{captureAnimationState:function(){a=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){if("none"!==z(e,"display")&&e!==tt.ghost){a.push({target:e,rect:W(e)});var t=x({},a[a.length-1].rect);if(e.thisAnimationDuration){var n=B(e,!0);n&&(t.top-=n.f,t.left-=n.e)}e.fromRect=t}}))},addAnimationState:function(e){a.push(e)},removeAnimationState:function(e){a.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var a in t)if(t.hasOwnProperty(a)&&t[a]===e[n][a])return Number(n);return-1}(a,{target:e}),1)},animateAll:function(e){var t=this;if(!this.options.animation)return clearTimeout(n),void("function"==typeof e&&e());var i=!1,o=0;a.forEach((function(e){var n=0,a=e.target,r=a.fromRect,s=W(a),l=a.prevFromRect,c=a.prevToRect,p=e.rect,d=B(a,!0);d&&(s.top-=d.f,s.left-=d.e),a.toRect=s,a.thisAnimationDuration&&Q(l,s)&&!Q(r,s)&&(p.top-s.top)/(p.left-s.left)==(r.top-s.top)/(r.left-s.left)&&(n=function(e,t,n,a){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*a.animation}(p,l,c,t.options)),Q(s,r)||(a.prevFromRect=r,a.prevToRect=s,n||(n=t.options.animation),t.animate(a,p,s,n)),n&&(i=!0,o=Math.max(o,n),clearTimeout(a.animationResetTimer),a.animationResetTimer=setTimeout((function(){a.animationTime=0,a.prevFromRect=null,a.fromRect=null,a.prevToRect=null,a.thisAnimationDuration=null}),n),a.thisAnimationDuration=n)})),clearTimeout(n),i?n=setTimeout((function(){"function"==typeof e&&e()}),o):"function"==typeof e&&e(),a=[]},animate:function(e,t,n,a){if(a){z(e,"transition",""),z(e,"transform","");var i=B(this.el),o=i&&i.a,r=i&&i.d,s=(t.left-n.left)/(o||1),l=(t.top-n.top)/(r||1);e.animatingX=!!s,e.animatingY=!!l,z(e,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),z(e,"transition","transform "+a+"ms"+(this.options.easing?" "+this.options.easing:"")),z(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){z(e,"transition",""),z(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),a)}}}))}function nt(e,t,n,a,i,o,r,s){var l,c,p=e[ie],d=p.options.onMove;return!window.CustomEvent||C||T?(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=a,l.related=i||t,l.relatedRect=o||W(t),l.willInsertAfter=s,l.originalEvent=r,e.dispatchEvent(l),d&&(c=d.call(p,l,r)),c}function at(e){e.draggable=!1}function it(){ze=!1}function ot(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,a=0;n--;)a+=t.charCodeAt(n);return a.toString(36)}function rt(e){return setTimeout(e,0)}function st(e){return clearTimeout(e)}tt.prototype={constructor:tt,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Ae=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,de):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,a=this.options,i=a.preventOnFilter,o=e.type,r=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(r||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,c=a.filter;if(function(e){Be.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var a=t[n];a.checked&&Be.push(a)}}(n),!de&&!(/mousedown|pointerdown/.test(o)&&0!==e.button||a.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!O||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=j(s,a.draggable,n,!1))&&s.animated||fe===s)){if(_e=$(s),ye=$(s,a.draggable),"function"==typeof c){if(c.call(this,e,s,this))return pe({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),ce("filter",t,{evt:e}),void(i&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some((function(a){if(a=j(l,a.trim(),n,!1))return pe({sortable:t,rootEl:a,name:"filter",targetEl:s,fromEl:n,toEl:n}),ce("filter",t,{evt:e}),!0}))))return void(i&&e.cancelable&&e.preventDefault());a.handle&&!j(l,a.handle,n,!1)||this._prepareDragStart(e,r,s)}}},_prepareDragStart:function(e,t,n){var a,i=this,o=i.el,r=i.options,s=o.ownerDocument;if(n&&!de&&n.parentNode===o){var l=W(n);if(he=o,ue=(de=n).parentNode,me=de.nextSibling,fe=n,Ee=r.group,tt.dragged=de,Se={target:de,clientX:(t||e).clientX,clientY:(t||e).clientY},Pe=Se.clientX-l.left,Oe=Se.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,de.style["will-change"]="all",a=function(){ce("delayEnded",i,{evt:e}),tt.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!P&&i.nativeDraggable&&(de.draggable=!0),i._triggerDragStart(e,t),pe({sortable:i,name:"choose",originalEvent:e}),q(de,r.chosenClass,!0))},r.ignore.split(",").forEach((function(e){U(de,e.trim(),at)})),N(s,"dragover",Qe),N(s,"mousemove",Qe),N(s,"touchmove",Qe),N(s,"mouseup",i._onDrop),N(s,"touchend",i._onDrop),N(s,"touchcancel",i._onDrop),P&&this.nativeDraggable&&(this.options.touchStartThreshold=4,de.draggable=!0),ce("delayStart",this,{evt:e}),!r.delay||r.delayOnTouchOnly&&!t||this.nativeDraggable&&(T||C))a();else{if(tt.eventCanceled)return void this._onDrop();N(s,"mouseup",i._disableDelayedDrag),N(s,"touchend",i._disableDelayedDrag),N(s,"touchcancel",i._disableDelayedDrag),N(s,"mousemove",i._delayedDragTouchMoveHandler),N(s,"touchmove",i._delayedDragTouchMoveHandler),r.supportPointer&&N(s,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(a,r.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(){de&&at(de),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;I(e,"mouseup",this._disableDelayedDrag),I(e,"touchend",this._disableDelayedDrag),I(e,"touchcancel",this._disableDelayedDrag),I(e,"mousemove",this._delayedDragTouchMoveHandler),I(e,"touchmove",this._delayedDragTouchMoveHandler),I(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?N(document,"pointermove",this._onTouchMove):N(document,t?"touchmove":"mousemove",this._onTouchMove):(N(de,"dragend",this),N(he,"dragstart",this._onDragStart));try{document.selection?rt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Re=!1,he&&de){ce("dragStarted",this,{evt:t}),this.nativeDraggable&&N(document,"dragover",et);var n=this.options;!e&&q(de,n.dragClass,!1),q(de,n.ghostClass,!0),tt.active=this,e&&this._appendGhost(),pe({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(De){this._lastX=De.clientX,this._lastY=De.clientY,Ke();for(var e=document.elementFromPoint(De.clientX,De.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(De.clientX,De.clientY))!==t;)t=e;if(de.parentNode[ie]._isOutsideThisEl(e),t)do{if(t[ie]&&t[ie]._onDragOver({clientX:De.clientX,clientY:De.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break;e=t}while(t=t.parentNode);Ze()}},_onTouchMove:function(e){if(Se){var t=this.options,n=t.fallbackTolerance,a=t.fallbackOffset,i=e.touches?e.touches[0]:e,o=ge&&B(ge,!0),r=ge&&o&&o.a,s=ge&&o&&o.d,l=He&&Ie&&K(Ie),c=(i.clientX-Se.clientX+a.x)/(r||1)+(l?l[0]-qe[0]:0)/(r||1),p=(i.clientY-Se.clientY+a.y)/(s||1)+(l?l[1]-qe[1]:0)/(s||1);if(!tt.active&&!Re){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(ge){o?(o.e+=c-(Ce||0),o.f+=p-(Te||0)):o={a:1,b:0,c:0,d:1,e:c,f:p};var d="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")");z(ge,"webkitTransform",d),z(ge,"mozTransform",d),z(ge,"msTransform",d),z(ge,"transform",d),Ce=c,Te=p,De=i}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!ge){var e=this.options.fallbackOnBody?document.body:he,t=W(de,!0,He,!0,e),n=this.options;if(He){for(Ie=e;"static"===z(Ie,"position")&&"none"===z(Ie,"transform")&&Ie!==document;)Ie=Ie.parentNode;Ie!==document.body&&Ie!==document.documentElement?(Ie===document&&(Ie=H()),t.top+=Ie.scrollTop,t.left+=Ie.scrollLeft):Ie=H(),qe=K(Ie)}q(ge=de.cloneNode(!0),n.ghostClass,!1),q(ge,n.fallbackClass,!0),q(ge,n.dragClass,!0),z(ge,"transition",""),z(ge,"transform",""),z(ge,"box-sizing","border-box"),z(ge,"margin",0),z(ge,"top",t.top),z(ge,"left",t.left),z(ge,"width",t.width),z(ge,"height",t.height),z(ge,"opacity","0.8"),z(ge,"position",He?"absolute":"fixed"),z(ge,"zIndex","100000"),z(ge,"pointerEvents","none"),tt.ghost=ge,e.appendChild(ge),z(ge,"transform-origin",Pe/parseInt(ge.style.width)*100+"% "+Oe/parseInt(ge.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,a=e.dataTransfer,i=n.options;ce("dragStart",this,{evt:e}),tt.eventCanceled?this._onDrop():(ce("setupClone",this),tt.eventCanceled||((ve=ne(de)).removeAttribute("id"),ve.draggable=!1,ve.style["will-change"]="",this._hideClone(),q(ve,this.options.chosenClass,!1),tt.clone=ve),n.cloneId=rt((function(){ce("clone",n),tt.eventCanceled||(n.options.removeCloneOnHide||he.insertBefore(ve,de),n._hideClone(),pe({sortable:n,name:"clone"}))})),!t&&q(de,i.dragClass,!0),t?(Ye=!0,n._loopId=setInterval(n._emulateDragOver,50)):(I(document,"mouseup",n._onDrop),I(document,"touchend",n._onDrop),I(document,"touchcancel",n._onDrop),a&&(a.effectAllowed="move",i.setData&&i.setData.call(n,a,de)),N(document,"drop",n),z(de,"transform","translateZ(0)")),Re=!0,n._dragStartId=rt(n._dragStarted.bind(n,t,e)),N(document,"selectstart",n),Le=!0,O&&z(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,a,i,o=this.el,r=e.target,s=this.options,l=s.group,c=tt.active,p=Ee===l,d=s.sort,u=ke||c,g=this,h=!1;if(!ze){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),r=j(r,s.draggable,o,!0),O("dragOver"),tt.eventCanceled)return h;if(de.contains(e.target)||r.animated&&r.animatingX&&r.animatingY||g._ignoreWhileAnimating===r)return A(!1);if(Ye=!1,c&&!s.disabled&&(p?d||(a=ue!==he):ke===this||(this.lastPutMode=Ee.checkPull(this,c,de,e))&&l.checkPut(this,c,de,e))){if(i="vertical"===this._getDirection(e,r),t=W(de),O("dragOverValid"),tt.eventCanceled)return h;if(a)return ue=he,L(),this._hideClone(),O("revert"),tt.eventCanceled||(me?he.insertBefore(de,me):he.appendChild(de)),A(!0);var m=J(o,s.draggable);if(!m||function(e,t,n){var a=W(J(n.el,n.options.draggable)),i=ae(n.el,n.options,ge);return t?e.clientX>i.right+10||e.clientY>a.bottom&&e.clientX>a.left:e.clientY>i.bottom+10||e.clientX>a.right&&e.clientY>a.top}(e,i,this)&&!m.animated){if(m===de)return A(!1);if(m&&o===e.target&&(r=m),r&&(n=W(r)),!1!==nt(he,o,de,t,r,n,e,!!r))return L(),m&&m.nextSibling?o.insertBefore(de,m.nextSibling):o.appendChild(de),ue=o,M(),A(!0)}else if(m&&function(e,t,n){var a=W(V(n.el,0,n.options,!0)),i=ae(n.el,n.options,ge);return t?e.clientX<i.left-10||e.clientY<a.top&&e.clientX<a.right:e.clientY<i.top-10||e.clientY<a.bottom&&e.clientX<a.left}(e,i,this)){var f=V(o,0,s,!0);if(f===de)return A(!1);if(n=W(r=f),!1!==nt(he,o,de,t,r,n,e,!1))return L(),o.insertBefore(de,f),ue=o,M(),A(!0)}else if(r.parentNode===o){n=W(r);var v,b,_,w=de.parentNode!==o,y=!function(e,t,n){var a=n?e.left:e.top,i=n?e.right:e.bottom,o=n?e.width:e.height,r=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return a===r||i===s||a+o/2===r+l/2}(de.animated&&de.toRect||t,r.animated&&r.toRect||n,i),E=i?"top":"left",k=G(r,"top","top")||G(de,"top","top"),S=k?k.scrollTop:void 0;if(Ae!==r&&(b=n[E],Fe=!1,Xe=!y&&s.invertSwap||w),v=function(e,t,n,a,i,o,r,s){var l=a?e.clientY:e.clientX,c=a?n.height:n.width,p=a?n.top:n.left,d=a?n.bottom:n.right,u=!1;if(!r)if(s&&Ne<c*i){if(!Fe&&(1===Me?l>p+c*o/2:l<d-c*o/2)&&(Fe=!0),Fe)u=!0;else if(1===Me?l<p+Ne:l>d-Ne)return-Me}else if(l>p+c*(1-i)/2&&l<d-c*(1-i)/2)return function(e){return $(de)<$(e)?1:-1}(t);return(u=u||r)&&(l<p+c*o/2||l>d-c*o/2)?l>p+c/2?1:-1:0}(e,r,n,i,y?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Xe,Ae===r),0!==v){var D=$(de);do{D-=v,_=ue.children[D]}while(_&&("none"===z(_,"display")||_===ge))}if(0===v||_===r)return A(!1);Ae=r,Me=v;var C=r.nextElementSibling,T=!1,P=nt(he,o,de,t,r,n,e,T=1===v);if(!1!==P)return 1!==P&&-1!==P||(T=1===P),ze=!0,setTimeout(it,30),L(),T&&!C?o.appendChild(de):r.parentNode.insertBefore(de,T?C:r),k&&te(k,0,S-k.scrollTop),ue=de.parentNode,void 0===b||Xe||(Ne=Math.abs(b-W(r)[E])),M(),A(!0)}if(o.contains(de))return A(!1)}return!1}function O(s,l){ce(s,g,x({evt:e,isOwner:p,axis:i?"vertical":"horizontal",revert:a,dragRect:t,targetRect:n,canSort:d,fromSortable:u,target:r,completed:A,onMove:function(n,a){return nt(he,o,de,t,n,W(n),e,a)},changed:M},l))}function L(){O("dragOverAnimationCapture"),g.captureAnimationState(),g!==u&&u.captureAnimationState()}function A(t){return O("dragOverCompleted",{insertion:t}),t&&(p?c._hideClone():c._showClone(g),g!==u&&(q(de,ke?ke.options.ghostClass:c.options.ghostClass,!1),q(de,s.ghostClass,!0)),ke!==g&&g!==tt.active?ke=g:g===tt.active&&ke&&(ke=null),u===g&&(g._ignoreWhileAnimating=r),g.animateAll((function(){O("dragOverAnimationComplete"),g._ignoreWhileAnimating=null})),g!==u&&(u.animateAll(),u._ignoreWhileAnimating=null)),(r===de&&!de.animated||r===o&&!r.animated)&&(Ae=null),s.dragoverBubble||e.rootEl||r===document||(de.parentNode[ie]._isOutsideThisEl(e.target),!t&&Qe(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),h=!0}function M(){we=$(de),xe=$(de,s.draggable),pe({sortable:g,name:"change",toEl:o,newIndex:we,newDraggableIndex:xe,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){I(document,"mousemove",this._onTouchMove),I(document,"touchmove",this._onTouchMove),I(document,"pointermove",this._onTouchMove),I(document,"dragover",Qe),I(document,"mousemove",Qe),I(document,"touchmove",Qe)},_offUpEvents:function(){var e=this.el.ownerDocument;I(e,"mouseup",this._onDrop),I(e,"touchend",this._onDrop),I(e,"pointerup",this._onDrop),I(e,"touchcancel",this._onDrop),I(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;we=$(de),xe=$(de,n.draggable),ce("drop",this,{evt:e}),ue=de&&de.parentNode,we=$(de),xe=$(de,n.draggable),tt.eventCanceled||(Re=!1,Xe=!1,Fe=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),st(this.cloneId),st(this._dragStartId),this.nativeDraggable&&(I(document,"drop",this),I(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),O&&z(document.body,"user-select",""),z(de,"transform",""),e&&(Le&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),ge&&ge.parentNode&&ge.parentNode.removeChild(ge),(he===ue||ke&&"clone"!==ke.lastPutMode)&&ve&&ve.parentNode&&ve.parentNode.removeChild(ve),de&&(this.nativeDraggable&&I(de,"dragend",this),at(de),de.style["will-change"]="",Le&&!Re&&q(de,ke?ke.options.ghostClass:this.options.ghostClass,!1),q(de,this.options.chosenClass,!1),pe({sortable:this,name:"unchoose",toEl:ue,newIndex:null,newDraggableIndex:null,originalEvent:e}),he!==ue?(we>=0&&(pe({rootEl:ue,name:"add",toEl:ue,fromEl:he,originalEvent:e}),pe({sortable:this,name:"remove",toEl:ue,originalEvent:e}),pe({rootEl:ue,name:"sort",toEl:ue,fromEl:he,originalEvent:e}),pe({sortable:this,name:"sort",toEl:ue,originalEvent:e})),ke&&ke.save()):we!==_e&&we>=0&&(pe({sortable:this,name:"update",toEl:ue,originalEvent:e}),pe({sortable:this,name:"sort",toEl:ue,originalEvent:e})),tt.active&&(null!=we&&-1!==we||(we=_e,xe=ye),pe({sortable:this,name:"end",toEl:ue,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){ce("nulling",this),he=de=ue=ge=me=ve=fe=be=Se=De=Le=we=xe=_e=ye=Ae=Me=ke=Ee=tt.dragged=tt.ghost=tt.clone=tt.active=null,Be.forEach((function(e){e.checked=!0})),Be.length=Ce=Te=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":de&&(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,a=0,i=n.length,o=this.options;a<i;a++)j(e=n[a],o.draggable,this.el,!1)&&t.push(e.getAttribute(o.dataIdAttr)||ot(e));return t},sort:function(e,t){var n={},a=this.el;this.toArray().forEach((function(e,t){var i=a.children[t];j(i,this.options.draggable,a,!1)&&(n[e]=i)}),this),t&&this.captureAnimationState(),e.forEach((function(e){n[e]&&(a.removeChild(n[e]),a.appendChild(n[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return j(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(void 0===t)return n[e];var a=se.modifyOption(this,e,t);n[e]=void 0!==a?a:t,"group"===e&&$e(n)},destroy:function(){ce("destroy",this);var e=this.el;e[ie]=null,I(e,"mousedown",this._onTapStart),I(e,"touchstart",this._onTapStart),I(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(I(e,"dragover",this),I(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),je.splice(je.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!be){if(ce("hideClone",this),tt.eventCanceled)return;z(ve,"display","none"),this.options.removeCloneOnHide&&ve.parentNode&&ve.parentNode.removeChild(ve),be=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(be){if(ce("showClone",this),tt.eventCanceled)return;de.parentNode!=he||this.options.group.revertClone?me?he.insertBefore(ve,me):he.appendChild(ve):he.insertBefore(ve,de),this.options.group.revertClone&&this.animate(de,ve),z(ve,"display",""),be=!1}}else this._hideClone()}},Ue&&N(document,"touchmove",(function(e){(tt.active||Re)&&e.cancelable&&e.preventDefault()})),tt.utils={on:N,off:I,css:z,find:U,is:function(e,t){return!!j(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:ee,closest:j,toggleClass:q,clone:ne,index:$,nextTick:rt,cancelNextTick:st,detectDirection:Je,getChild:V},tt.get=function(e){return e[ie]},tt.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t[0].constructor===Array&&(t=t[0]),t.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(tt.utils=x(x({},tt.utils),e.utils)),se.mount(e)}))},tt.create=function(e,t){return new tt(e,t)},tt.version="1.15.2";var lt,ct,pt,dt,ut,gt,ht=[],mt=!1;function ft(){ht.forEach((function(e){clearInterval(e.pid)})),ht=[]}function vt(){clearInterval(gt)}var bt=ee((function(e,t,n,a){if(t.scroll){var i,o=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,l=t.scrollSpeed,c=H(),p=!1;ct!==n&&(ct=n,ft(),lt=t.scroll,i=t.scrollFn,!0===lt&&(lt=Z(n,!0)));var d=0,u=lt;do{var g=u,h=W(g),m=h.top,f=h.bottom,v=h.left,b=h.right,_=h.width,w=h.height,y=void 0,x=void 0,E=g.scrollWidth,k=g.scrollHeight,S=z(g),D=g.scrollLeft,C=g.scrollTop;g===c?(y=_<E&&("auto"===S.overflowX||"scroll"===S.overflowX||"visible"===S.overflowX),x=w<k&&("auto"===S.overflowY||"scroll"===S.overflowY||"visible"===S.overflowY)):(y=_<E&&("auto"===S.overflowX||"scroll"===S.overflowX),x=w<k&&("auto"===S.overflowY||"scroll"===S.overflowY));var T=y&&(Math.abs(b-o)<=s&&D+_<E)-(Math.abs(v-o)<=s&&!!D),P=x&&(Math.abs(f-r)<=s&&C+w<k)-(Math.abs(m-r)<=s&&!!C);if(!ht[d])for(var O=0;O<=d;O++)ht[O]||(ht[O]={});ht[d].vx==T&&ht[d].vy==P&&ht[d].el===g||(ht[d].el=g,ht[d].vx=T,ht[d].vy=P,clearInterval(ht[d].pid),0==T&&0==P||(p=!0,ht[d].pid=setInterval(function(){a&&0===this.layer&&tt.active._onTouchMove(ut);var t=ht[this.layer].vy?ht[this.layer].vy*l:0,n=ht[this.layer].vx?ht[this.layer].vx*l:0;"function"==typeof i&&"continue"!==i.call(tt.dragged.parentNode[ie],n,t,e,ut,ht[this.layer].el)||te(ht[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&u!==c&&(u=Z(u,!1)));mt=p}}),30),_t=function(e){var t=e.originalEvent,n=e.putSortable,a=e.dragEl,i=e.activeSortable,o=e.dispatchSortableEvent,r=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(t){var l=n||i;r();var c=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,p=document.elementFromPoint(c.clientX,c.clientY);s(),l&&!l.el.contains(p)&&(o("spill"),this.onSpill({dragEl:a,putSortable:n}))}};function wt(){}function yt(){}wt.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var a=V(this.sortable.el,this.startIndex,this.options);a?this.sortable.el.insertBefore(t,a):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:_t},S(wt,{pluginName:"revertOnSpill"}),yt.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:_t},S(yt,{pluginName:"removeOnSpill"}),tt.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?N(document,"dragover",this._handleAutoScroll):this.options.supportPointer?N(document,"pointermove",this._handleFallbackAutoScroll):t.touches?N(document,"touchmove",this._handleFallbackAutoScroll):N(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?I(document,"dragover",this._handleAutoScroll):(I(document,"pointermove",this._handleFallbackAutoScroll),I(document,"touchmove",this._handleFallbackAutoScroll),I(document,"mousemove",this._handleFallbackAutoScroll)),vt(),ft(),clearTimeout(F),F=void 0},nulling:function(){ut=ct=lt=mt=gt=pt=dt=null,ht.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,a=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,o=document.elementFromPoint(a,i);if(ut=e,t||this.options.forceAutoScrollFallback||T||C||O){bt(e,this.options,o,t);var r=Z(o,!0);!mt||gt&&a===pt&&i===dt||(gt&&vt(),gt=setInterval((function(){var o=Z(document.elementFromPoint(a,i),!0);o!==r&&(r=o,ft()),bt(e,n.options,o,t)}),10),pt=a,dt=i)}else{if(!this.options.bubbleScroll||Z(o,!0)===H())return void ft();bt(e,this.options,Z(o,!1),!1)}}},S(e,{pluginName:"scroll",initializeByDefault:!0})}),tt.mount(yt,wt);const xt=tt;let Et=null,kt=null,St=null;function Dt(e){const t=kt.parentNode.querySelector(".sharing-image-editor-warning");null!==t&&(t.classList.add("warning-visible"),t.textContent=e||wp.i18n.__("Unknown generation error","sharing-image"))}function Ct(){kt.classList.add("preview-loader");const e=new XMLHttpRequest;e.open("POST",ajaxurl),e.responseType="blob";const t=new window.FormData(St);t.set("action","sharing_image_show_preview"),function(){const e=kt.parentNode.querySelector(".sharing-image-editor-warning");null!==e&&e.classList.remove("warning-visible")}(),e.addEventListener("readystatechange",(()=>{2===e.readyState&&(e.responseType="json",200===e.status&&(e.responseType="blob"))})),e.addEventListener("load",(()=>{const t=e.response||{};if(kt.classList.remove("preview-blank","preview-loader"),200!==e.status)return Dt(t.data);let n=kt.querySelector("img");null===n&&(n=p.element("img",{append:kt})),n.src=window.URL.createObjectURL(t)})),e.addEventListener("error",(()=>{Dt(),kt.classList.remove("preview-blank","preview-loader")})),e.send(t)}function Tt(e,n,a){const i=[],o=p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[x]",value:a.x,placeholder:"0"},dataset:{dimension:"x"},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[y]",value:a.y,placeholder:"0"},dataset:{dimension:"y"},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[width]",value:a.width},dataset:{dimension:"width"},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[height]",value:a.height},dataset:{dimension:"height"},label:wp.i18n.__("Height","sharing-image")}],append:e});!function(e,n,a){const i=p.control({classes:["sharing-image-editor-control","control-pulled"],append:e});p.element("button",{classes:["sharing-image-editor-more"],text:wp.i18n.__("Utilize image as the poster background.","sharing-image"),attributes:{type:"button"},append:i}).addEventListener("click",(()=>{const e={};return n.querySelectorAll("input").forEach((t=>{e[t.dataset.dimension]=t})),e.x.value=0,e.y.value=0,e.width.value=t.dataget(St,"editor","width"),e.height.value=t.dataget(St,"editor","height"),s(),void Ct()}))}(e,o),Ot(e,n,a),i[i.length]=p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Image resizing principle","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"center"},label:wp.i18n.__("Center image while preserving the aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"top"},label:wp.i18n.__("Top-aligned image while preserving the aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"bottom"},label:wp.i18n.__("Bottom-aligned image while preserving aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"ignore"},label:wp.i18n.__("Resize while ignoring the aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"crop"},label:wp.i18n.__("Center-crop the image","sharing-image"),checked:a.resize||"center"}],append:e});const r=[];o.querySelectorAll("input").forEach((e=>{["width","height"].includes(e.dataset.dimension)&&r.push(e)}));const s=()=>{let e=!1;r.forEach((t=>{t.value.length<1&&(e=!0)})),i.forEach((t=>{t.classList.toggle("control-disabled",e)}))};s(),r.forEach((e=>{e.addEventListener("input",s)}))}function Pt(e,t){const n=e.querySelector("h2 > span");if(null===n)return;const a={},i=": ";e.querySelectorAll("[data-caption]").forEach((e=>{a[e.dataset.caption]=e,e.addEventListener("keyup",(()=>{n.textContent=e.value?i+e.value:""}))})),n.textContent=i+a.content.value,t.checked&&(n.textContent=i+a.title.value),n.textContent===i&&(n.textContent="")}function Ot(e,t,n){p.control({classes:["sharing-image-editor-control","control-extend","control-pulled","control-upnext"],label:wp.i18n.__("Relative boundaries","sharing-image"),fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{absolute:wp.i18n.__("No Relative Positioning","sharing-image"),vertically:wp.i18n.__("Vertical Only","sharing-image"),horizontally:wp.i18n.__("Horizontal Only","sharing-image"),both:wp.i18n.__("Both Directions Alignment","sharing-image")},attributes:{name:t+"[boundary]"},selected:n.boundary}],help:wp.i18n.__("Using offset from previous layer.","sharing-image"),append:e})}function Lt(e,t){const n=[];n.push(wp.i18n.__("Write text on the current image.","sharing-image")),n.push(wp.i18n.__("If the font does not fit within your limits, its size will decrease.","sharing-image")),n.push(wp.i18n.__("Avoid using large font sizes for long text as it affects performance.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Text","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"text"},append:a}),p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[x]",value:e.x,placeholder:"10"},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[y]",value:e.y,placeholder:"10"},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[width]",value:e.width,placeholder:"1000"},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[height]",value:e.height},label:wp.i18n.__("Height","sharing-image")}],append:a}),Ot(a,t,e),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[dynamic]",value:"dynamic"},label:wp.i18n.__("Dynamic field. Filled in on the post editing screen.","sharing-image"),checked:n.dynamic},a),o=[];o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend","control-hidden"],help:wp.i18n.__("Only visible on the admin side.","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:t+"[title]",value:n.title},dataset:{caption:"title"},label:wp.i18n.__("Field name","sharing-image")}],append:e}),o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend","control-hidden"],help:wp.i18n.__("This field is for demonstration only, to preview the editor’s appearance.","sharing-image"),fields:[{group:"textarea",classes:["sharing-image-editor-control-textarea"],content:n.sample||"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",attributes:{name:t+"[sample]",rows:2},label:wp.i18n.__("Text sample","sharing-image")}],append:e});const r=p.control({classes:["sharing-image-editor-control","control-hidden"],label:wp.i18n.__("Preset text field","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"none"},dataset:{persistent:!0},label:wp.i18n.__("Fill in manually","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"title"},dataset:{persistent:!0},label:wp.i18n.__("Take from post title","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"excerpt"},dataset:{persistent:!0},label:wp.i18n.__("Use post excerpt text","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"categories"},dataset:{persistent:!0},label:wp.i18n.__("Use post categories","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"tags"},dataset:{persistent:!0},label:wp.i18n.__("Use post tags","sharing-image"),checked:n.preset||"none"}],append:e});o[o.length]=r,o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend"],help:wp.i18n.__("You can use non-breaking spaces to adjust your string position.","sharing-image"),fields:[{group:"textarea",classes:["sharing-image-editor-control-textarea"],content:n.content,attributes:{name:t+"[content]",rows:2},dataset:{caption:"content"},label:wp.i18n.__("Content","sharing-image")}],append:e});const s=()=>{o.forEach((e=>{e.classList.toggle("control-hidden")}))};i.checked&&s(),i.addEventListener("change",(()=>{s(),Pt(e,i)})),Pt(e,i)}(a,t,e),function(e,t,n){const a=[];a[a.length]=function(e,t,n){const a=p.control({classes:["sharing-image-editor-control","control-upload","control-hidden"],append:e}),i=p.select({classes:["sharing-image-editor-control-select"],options:Et.fonts,attributes:{name:t+"[fontname]"},label:wp.i18n.__("Font family","sharing-image"),selected:n.fontname},a),o=p.media({name:t+"[fontfile]",classes:["sharing-image-editor-control-media"],value:n.fontfile,link:Et.links.uploads,labels:{button:wp.i18n.__("Upload custom font","sharing-image"),heading:wp.i18n.__("Upload custom font","sharing-image"),details:wp.i18n.__("Font attachment","sharing-image"),remove:wp.i18n.__("Remove font","sharing-image")},remove:!0,mime:["font/ttf","font/otf"],append:a});p.element("small",{text:wp.i18n.__("Custom fonts can only be in .ttf or .otf format.","sharing-image"),append:a}),n.fontfile&&(i.disabled=!0);const r=o.querySelector("input");return r.addEventListener("change",(()=>{i.disabled=!1,r.value&&(i.disabled=!0)})),a}(e,t,n),a[a.length]=p.control({classes:["sharing-image-editor-control","control-hidden"],fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{type:"color",name:t+"[color]",value:n.color||"#ffffff"},label:wp.i18n.__("Text color","sharing-image")}],append:e}),a[a.length]=p.control({classes:["sharing-image-editor-control","control-series","control-hidden"],fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{left:wp.i18n.__("Left","sharing-image"),center:wp.i18n.__("Center","sharing-image"),right:wp.i18n.__("Right","sharing-image")},attributes:{name:t+"[horizontal]"},label:wp.i18n.__("Horizontal alignment","sharing-image"),selected:n.horizontal},{group:"select",classes:["sharing-image-editor-control-select"],options:{top:wp.i18n.__("Top","sharing-image"),center:wp.i18n.__("Center","sharing-image"),bottom:wp.i18n.__("Bottom","sharing-image")},attributes:{name:t+"[vertical]"},label:wp.i18n.__("Vertical alignment","sharing-image"),selected:n.vertical}],append:e});const i=p.control({classes:["sharing-image-editor-control"],append:e}),o=p.element("button",{classes:["sharing-image-editor-more"],text:wp.i18n.__("More options","sharing-image"),attributes:{type:"button"},append:i});o.addEventListener("click",(()=>{a.forEach((e=>{e.classList.remove("control-hidden")})),e.removeChild(i)})),Object.keys(n).length>0&&o.click()}(a,t,e),p.control({classes:["sharing-image-editor-control","control-series"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[fontsize]",min:10,max:200,step:1,value:e.fontsize||"48"},label:wp.i18n.__("Font size","sharing-image")},{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[lineheight]",min:0,max:4,step:.125,value:e.lineheight||"1.5"},label:wp.i18n.__("Line height","sharing-image")}],append:a}),p.element("input",{attributes:{type:"hidden",name:t+"[separator]",value:", "},append:a}),a}function At(e,n,a={}){let i=null;const o=a.uniqid||t.uniqid(),r=Et.name+`[layers][${o}]`;switch(n){case"text":i=Lt(a,r);break;case"image":i=function(e,t){const n=[];n.push(wp.i18n.__("Use JPG, GIF, or PNG image formats.","sharing-image")),n.push(wp.i18n.__("Leave the width and height fields blank to use the original image size.","sharing-image")),n.push(wp.i18n.__("Sizes are calculated proportionally if not specified.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-image"],label:wp.i18n.__("Image","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"image"},append:a}),p.control({classes:["sharing-image-editor-control","control-extend"],help:wp.i18n.__("Only visible on the admin side.","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:t+"[title]",value:e.title},dataset:{caption:"title"},label:wp.i18n.__("Field name","sharing-image")}],append:a}),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control","control-gapped"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[dynamic]",value:"dynamic"},label:wp.i18n.__("Dynamic image. Can be updated on the post editing screen.","sharing-image"),checked:n.dynamic},a);p.media({name:t+"[attachment]",classes:["sharing-image-editor-control-media"],value:n.attachment,link:Et.links.uploads,labels:{button:wp.i18n.__("Select an image","sharing-image"),heading:wp.i18n.__("Select layer image","sharing-image"),details:wp.i18n.__("Attachment details","sharing-image"),remove:wp.i18n.__("Remove image","sharing-image")},append:a,image:!0,remove:!0,help:wp.i18n.__("This field is for demonstration only, to preview the editor’s appearance.","sharing-image"),mime:["image/png","image/jpeg","image/gif","image/webp"]});const o=[],r=p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Preset image field","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"none"},dataset:{persistent:!0},label:wp.i18n.__("Manual selection","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"featured"},dataset:{persistent:!0},label:wp.i18n.__("Use Post Featured Image","sharing-image"),checked:n.preset||"featured"}],append:e});o[o.length]=r;const s=()=>{o.forEach((e=>{e.classList.toggle("control-hidden")})),a.classList.add("control-unhelp"),i.checked&&a.classList.remove("control-unhelp")};i.checked||s(),i.addEventListener("change",(()=>{s()}))}(a,t,e),Tt(a,t,e),a}(a,r);break;case"filter":i=function(e,t){const n=[];n.push(wp.i18n.__("Filters are applied sequentially to the entire editor image.","sharing-image")),n.push(wp.i18n.__("If you want to control their order, create multiple layers.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Filter","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"filter"},append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"checkbox",classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[grayscale]",value:"grayscale"},label:wp.i18n.__("Converts the image into a grayscale version","sharing-image"),checked:e.grayscale}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"checkbox",classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[blur]",value:"blur"},label:wp.i18n.__("Blur image by Gaussian effect","sharing-image"),checked:e.blur}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[contrast]",min:-50,max:50,step:5,value:e.contrast||"0"},label:wp.i18n.__("Contrast","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[brightness]",min:-50,max:50,step:5,value:e.brightness||"0"},label:wp.i18n.__("Brightness","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[blackout]",min:0,max:100,step:5,value:e.blackout||"0"},label:wp.i18n.__("Blackout","sharing-image")}],append:a}),a}(a,r);break;case"rectangle":i=function(e,t){const n=[];n.push(wp.i18n.__("Draw a colored rectangle on the current image.","sharing-image")),n.push(wp.i18n.__("You can get a filled or outlined figure with custom color and opacity.","sharing-image")),n.push(wp.i18n.__("Use a small height to draw the line.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Rectangle","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"rectangle"},append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{type:"color",name:t+"[color]",value:e.color||"#ffffff"},label:wp.i18n.__("Rectangle color","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[x]"||0,value:e.x},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[y]"||0,value:e.y},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[width]",value:e.width},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[height]",value:e.height},label:wp.i18n.__("Height","sharing-image")}],append:a}),Ot(a,t,e),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[outline]",value:"outline"},label:wp.i18n.__("Outline rectangle.","sharing-image"),checked:n.outline},a),o=p.control({classes:["sharing-image-editor-control","control-hidden"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[thickness]",min:0,max:50,step:1,value:n.thickness||"0"},label:wp.i18n.__("Border width","sharing-image")}],append:e});n.outline&&o.classList.remove("control-hidden"),i.addEventListener("change",(()=>{o.classList.add("control-hidden"),i.checked&&o.classList.remove("control-hidden")}))}(a,t,e),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[opacity]",min:0,max:100,step:5,value:e.opacity||"0"},label:wp.i18n.__("Opacity","sharing-image")}],append:a}),a}(a,r);break;default:return null}return e.appendChild(i),function(e,t){const n=p.control({classes:["sharing-image-editor-control","control-footer"],append:t});p.element("button",{classes:["sharing-image-editor-delete"],text:wp.i18n.__("Delete layer","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{e.removeChild(t),St.classList.contains("editor-suspend")||Ct()}))}(e,i),function(e,t,n){const a=e.querySelector("h2"),i=p.element("button",{classes:["sharing-image-editor-collapse"],attributes:{type:"button",title:wp.i18n.__("Collapse layer","sharing-image")},prepend:a});let o=1===t.collapsed;o&&e.classList.add("layer-collapsed");const r=p.element("input",{attributes:{type:"hidden",name:n+"[collapsed]",value:Number(o)},append:e});i.addEventListener("click",(t=>{t.preventDefault(),o=!o,e.classList.toggle("layer-collapsed",o),i.setAttribute("title",wp.i18n.__("Collapse layer","sharing-image")),o&&i.setAttribute("title",wp.i18n.__("Expand layer","sharing-image")),r.value=Number(o)}))}(i,a,r),function(e,t){p.element("button",{classes:["sharing-image-editor-order"],attributes:{type:"button",title:wp.i18n.__("Change layer position","sharing-image")},append:t}),xt.create(e,{handle:".sharing-image-editor-order",onUpdate:()=>{St.classList.contains("editor-suspend")||Ct()}})}(e,i),i}const Mt=function(e,t,n,a={}){Et=t,St=function(e,t){Et.name="sharing_image_editor";const n=p.element("form",{classes:["sharing-image-editor"],attributes:{action:Et.links.action,method:"POST"},append:e});return Et.config.suspend&&n.classList.add("editor-suspend"),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_save_editor"},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_index",value:t},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:Et.nonce},append:n}),n.addEventListener("submit",(e=>{e.preventDefault(),function(){const e=new XMLHttpRequest;e.open("POST",ajaxurl),e.responseType="json",kt.classList.add("preview-loader");const t=new window.FormData(St);t.set("action","sharing_image_save_preview"),e.addEventListener("load",(()=>{const t=e.response||{};if(!t.data)return Dt();if(!t.success)return kt.classList.remove("preview-loader"),Dt(t.data);const n=kt.querySelector("input");null!==n&&(n.value=t.data),St.submit()})),e.addEventListener("error",(()=>{kt.classList.remove("preview-loader"),Dt()})),e.send(t)}()})),n}(e,n),function(e){const t=p.element("div",{classes:["sharing-image-editor-monitor"],append:St}),n=p.element("div",{classes:["sharing-image-editor-viewport"],append:t});!function(e,t){kt=p.element("div",{classes:["sharing-image-editor-preview","preview-blank"],append:e}),t.preview&&(p.element("img",{attributes:{src:t.preview,alt:""},append:kt}),kt.classList.remove("preview-blank")),p.element("span",{classes:["sharing-image-editor-loader"],append:kt}),p.element("input",{attributes:{type:"hidden",name:Et.name+"[preview]",value:t.preview},append:kt})}(n,e),p.element("div",{classes:["sharing-image-editor-warning"],append:n});const a=p.element("div",{classes:["sharing-image-editor-manager"],append:n});!function(e,t){p.checkbox({classes:["sharing-image-editor-debug"],attributes:{name:Et.name+"[debug]",value:"debug"},label:wp.i18n.__("Show debug frames","sharing-image"),checked:t.debug},e).addEventListener("change",(()=>{Ct()}))}(a,e),function(e){p.element("button",{text:wp.i18n.__("Save changes","sharing-image"),classes:["button","button-primary"],attributes:{type:"submit"},append:e})}(a),function(e){p.element("button",{text:wp.i18n.__("Generate preview","sharing-image"),classes:["button"],attributes:{type:"button"},append:e}).addEventListener("click",(()=>{Ct()}))}(a)}(a),function(e){const t=p.element("div",{classes:["sharing-image-editor-fieldset"],append:St});p.control({classes:["sharing-image-editor-control","control-compact","control-extend"],help:wp.i18n.__("Used only in the admin panel","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[title]",value:e.title},dataset:{persistent:!0,editor:"title"},label:wp.i18n.__("Template title","sharing-image")}],append:t}),p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Fill color","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{name:Et.name+"[fill]",type:"color",value:e.fill},dataset:{editor:"fill"}}],append:t}),p.control({classes:["sharing-image-editor-control","control-compact","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[width]",value:e.width||"1200",placeholder:"1200",maxlength:4},dataset:{editor:"width"},label:wp.i18n.__("Editor width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[height]",value:e.height||"630",placeholder:"630",maxlength:4},dataset:{editor:"height"},label:wp.i18n.__("Editor height","sharing-image")}],append:t});const n=[];n.push(wp.i18n.__("You can add multiple layers on your editor.","sharing-image")),n.push(wp.i18n.__("Note that the stacking order of the layers is important.","sharing-image")),n.push(wp.i18n.__("You can change the order using the icon in the corner of each box.","sharing-image")),p.control({classes:["sharing-image-editor-control","control-reduced"],label:wp.i18n.__("Add layers","sharing-image"),description:n.join(" "),append:t}),function(e,t){const n=p.control({classes:["sharing-image-editor-control","control-select","control-compact"],fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{text:wp.i18n.__("Text","sharing-image"),image:wp.i18n.__("Image","sharing-image"),filter:wp.i18n.__("Filter","sharing-image"),rectangle:wp.i18n.__("Rectangle","sharing-image")}}],append:e});p.element("button",{classes:["button"],text:wp.i18n.__("Add new","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{const e=n.querySelector("select");null!==e&&At(a,e.value).scrollIntoView({behavior:"smooth"})}));const a=p.element("div",{classes:["sharing-image-editor-designer"],append:e});t.layers=t.layers||{};for(const e in t.layers){const n=t.layers[e];if(n.uniqid=e,n.hasOwnProperty("type")&&!At(a,n.type,n))return}}(t,e);const a=p.control({classes:["sharing-image-editor-control","control-footer"],append:t});!function(e){const t=new URL(document.location.href);t.searchParams.delete("template"),p.element("a",{classes:["button"],text:wp.i18n.__("← Back to Catalog","sharing-image"),attributes:{href:t.href},append:e})}(a),function(e){const t=new URL(document.location.href).searchParams.get("template"),n=new URL(Et.links.action);n.searchParams.set("action","sharing_image_delete_template"),n.searchParams.set("template",t),n.searchParams.set("nonce",Et.nonce),p.element("a",{classes:["sharing-image-editor-delete"],text:wp.i18n.__("Delete template","sharing-image"),attributes:{href:n.href},append:e}).addEventListener("click",(e=>{const t=wp.i18n.__("Are you sure you want to delete this template?","sharing-image");confirm(t)||e.preventDefault()}))}(a),t.addEventListener("change",(e=>{if(St.classList.contains("editor-suspend"))return;const t=e.target;t.hasAttribute("data-persistent")||t.hasAttribute("name")&&Ct()}))}(a)};let Nt=null;!function(){if(void 0===wp)return;let e=window.sharingImageSettings||{};e=t.defaults(e,["links","fonts","config","templates","license"]);const n=document.querySelector("#sharing-image-settings .sharing-image-content");if(null!==n)switch(n.classList.add("content-visible"),t.param("tab")){case"config":!function(e,t){!function(e,t){Nt=t,Nt.name="sharing_image_config";const n=e.querySelector(".sharing-image-config");if(null===n)return;const a=p.element("form",{classes:["sharing-image-config-options"],attributes:{action:Nt.links.action,method:"POST"},append:n}),i=Nt.config||{},o=Nt.templates||[];!function(e,t){const n=p.control({classes:["sharing-image-config-control","control-extra"],label:wp.i18n.__("Poster image format","sharing-image"),help:wp.i18n.__("The higher the value, the less compression. Availible for JPEG only.","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:{jpg:wp.i18n.__("JPEG","sharing-image"),png:wp.i18n.__("PNG","sharing-image"),gif:wp.i18n.__("GIF","sharing-image")},attributes:{name:Nt.name+"[format]"},selected:t.format||"jpg"},{group:"input",classes:["sharing-image-config-control-range"],attributes:{type:"range",name:Nt.name+"[quality]",min:10,max:100,step:5,value:t.quality||"90",disabled:"disabled"},label:wp.i18n.__("Image quality","sharing-image")}],append:e}),a=n.querySelector("select"),i=n.querySelector("input");"jpg"===a.value&&(i.disabled=!1),a.addEventListener("change",(()=>{i.disabled=!0,"jpg"===a.value&&(i.disabled=!1)}))}(a,i),function(e,t,n){const a={};a[""]=wp.i18n.__("Disable auto generation","sharing-image");for(const e in n)a[e]=n[e].title||wp.i18n.__("Untitled","sharing-image");let i=t.autogenerate;void 0===i&&(i=""),p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Auto generate poster","sharing-image"),help:wp.i18n.__("This template will be applied automatically when the post is saved.","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:a,attributes:{name:Nt.name+"[autogenerate]"},selected:String(i)}],append:e})}(a,i,o),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Hide post widget","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[nowidget]",value:"nowidget"},label:wp.i18n.__("Hide the widget on the post editor page","sharing-image"),checked:t.nowidget}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control","control-extra"],label:wp.i18n.__("Header Meta Tags","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:{snippets:wp.i18n.__("Display Meta Tags with consideration for SEO plugins","sharing-image"),custom:wp.i18n.__("Always display Meta Tags on all pages","sharing-image"),hidden:wp.i18n.__("Hide Sharing Image Meta Tags","sharing-image")},attributes:{name:Nt.name+"[meta]"},selected:t.meta||"snippets"}],append:e});if(0===Nt.snippets.length)return n;p.element("h4",{text:wp.i18n.__("Detected SEO plugins","sharing-image"),append:n});const a=p.element("ul",{classes:["sharing-image-config-control-list"],append:n});Nt.snippets.forEach((e=>{const t=p.element("li",{append:a});p.element("a",{attributes:{href:e.link,target:"_blank",rel:"noopener"},text:e.title,append:t})}))}(a,i),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Poster attachment","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[attachment]",value:"attachment"},label:wp.i18n.__("Save the generated poster as an attachment in the media library","sharing-image"),checked:t.attachment}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Upload directory","sharing-image"),append:e}),a=p.element("div",{classes:["sharing-image-config-control-fieldset"],append:n});p.radio({classes:["sharing-image-config-control-radio"],attributes:{name:Nt.name+"[uploads]",value:"default"},label:wp.i18n.__("Use default uploads directory","sharing-image"),checked:t.uploads||"default"},a),p.radio({classes:["sharing-image-config-control-radio"],attributes:{name:Nt.name+"[uploads]",value:"custom"},label:wp.i18n.__("Select custom storage for posters","sharing-image"),checked:t.uploads||"default"},a);const i=p.input({classes:["sharing-image-config-control-input"],attributes:{name:Nt.name+"[storage]",value:t.storage||Nt.links.storage,disabled:"disabled"}},n);p.element("small",{text:wp.i18n.__("Use a relative path from the site root. The directory should be writable.","sharing-image"),append:n}),n.querySelectorAll("input").forEach((e=>{"radio"===e.type&&(e.checked&&"custom"===e.value&&(i.disabled=!1),e.addEventListener("change",(()=>{i.disabled=!0,"custom"===e.value&&(i.disabled=!1)})))}))}(a,i),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Live-reload","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[suspend]",value:"suspend"},label:wp.i18n.__("Disable live reload on the template editor screen.","sharing-image"),checked:t.suspend}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Default poster","sharing-image"),append:e});p.media({name:Nt.name+"[default]",classes:["sharing-image-config-control-media"],value:t.default,link:Nt.links.uploads,labels:{button:wp.i18n.__("Upload image","sharing-image"),heading:wp.i18n.__("Select default poster","sharing-image"),details:wp.i18n.__("Attachment details","sharing-image"),remove:wp.i18n.__("Remove image","sharing-image")},image:!0,remove:!0,append:n});const a=[];a.push(wp.i18n.__("The default poster is used on pages where none is generated.","sharing-image")),a.push(wp.i18n.__("Best image size: 1200×630 pixels.","sharing-image")),p.element("small",{text:a.join(" "),append:n})}(a,i),function(e,t){p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_save_config"},append:e}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:Nt.nonce},append:e}),p.element("input",{attributes:{type:"hidden",name:Nt.name+"[demo]",value:t.demo||""},append:e}),p.element("button",{text:wp.i18n.__("Save changes","sharing-image"),classes:["button","button-primary"],attributes:{type:"submit"},append:e})}(a,i)}(e,t)}(n,e);break;case"tools":!function(e,t){!function(e,t){d=t;const n=e.querySelector(".sharing-image-tools");null!==n&&(function(e){const t=d.templates||[],n=p.control({classes:["sharing-image-tools-control","control-section"],label:wp.i18n.__("Clone template","sharing-image"),append:e}),a=p.element("p",{classes:["sharing-image-tools-warning"],text:wp.i18n.__("To initiate cloning, enable Premium and have at least one template.","sharing-image")}),i=d.license||{};if(0===t.length||!i.premium&&!i.develop)return n.appendChild(a);const o={};for(const e in t)o[e]=t[e].title||wp.i18n.__("Untitled","sharing-image");const r=p.element("form",{classes:["sharing-image-tools-control-cloning"],attributes:{action:d.links.action,method:"POST"},append:n}),s=p.select({classes:["sharing-image-tools-control-duplicator"],options:o,attributes:{name:"sharing_image_source"}},r);p.element("button",{classes:["button","button-primary"],attributes:{type:"submit"},text:wp.i18n.__("Create a copy","sharing-image"),append:s.parentNode}),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_clone_template"},append:r}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:d.nonce},append:r})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control"],label:wp.i18n.__("Export templates","sharing-image"),append:e}),n=p.element("div",{classes:["sharing-image-tools-control-fieldset"],append:t}),a=new URL(d.links.action);a.searchParams.set("action","sharing_image_export_templates"),a.searchParams.set("nonce",d.nonce),p.element("a",{classes:["button","button-primary"],text:wp.i18n.__("Download backup file","sharing-image"),attributes:{href:a.href},append:n}),p.element("small",{text:wp.i18n.__("Save a local copy of all template settings for later use.","sharing-image"),append:n})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control","control-section"],label:wp.i18n.__("Import templates","sharing-image"),append:e}),n=p.element("form",{classes:["sharing-image-tools-control-uploader"],attributes:{action:d.links.action,method:"POST",enctype:"multipart/form-data"},append:t});p.element("input",{classes:["sharing-image-tools-control-file"],attributes:{type:"file",name:"sharing_image_file",accept:"application/json",required:"required"},append:n}),p.element("button",{classes:["button","button-primary"],attributes:{type:"submit"},text:wp.i18n.__("Import templates","sharing-image"),append:n}),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_import_templates"},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:d.nonce},append:n})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control"],label:wp.i18n.__("Clearing settings","sharing-image"),append:e}),n=p.element("div",{classes:["sharing-image-tools-control-fieldset"],append:t}),a=new URL(d.links.action);a.searchParams.set("action","sharing_image_clear_templates"),a.searchParams.set("nonce",d.nonce),p.element("a",{classes:["sharing-image-tools-delete","button"],text:wp.i18n.__("Remove posters","sharing-image"),attributes:{href:a.href},append:n}).addEventListener("click",(e=>{const t=wp.i18n.__("Are you sure you want to clear plugin data?","sharing-image");confirm(t)||e.preventDefault()})),p.element("small",{text:wp.i18n.__("This action clears post meta options but does not delete server images.","sharing-image"),append:n})}(n))}(e,t)}(n,e);break;case"premium":!function(e,t){!function(e,t){h=t,m=e.querySelector(".sharing-image-premium"),null!==m&&(p.element("div",{classes:["sharing-image-premium-warning"],append:m}),w())}(e,t)}(n,e);break;default:!function(e,n){let a=null;n.templates=n.templates||[],t.param("template")&&(a=t.param("template"));const i=n.templates[a];void 0!==i?Mt(e,n,a,i):null===a?function(e,t){u=t;const n=p.element("div",{classes:["sharing-image-catalog"],append:e});for(const e in t.templates)g(n,t.templates[e],e);!function(e,t){const n=new URL(document.location.href);n.searchParams.set("template",t);const a=p.element("a",{classes:["sharing-image-catalog-new"],attributes:{href:n.href},append:e}),i=p.element("h2",{append:a});if(p.element("strong",{text:wp.i18n.__("Add new template","sharing-image"),append:i}),0===u.templates.length)return;const o=u.license||{};o.premium||o.develop||(p.element("span",{text:wp.i18n.__("(Availible for Premium only)","sharing-image"),append:i}),u.links.premium&&(a.href=u.links.premium))}(n,t.index)}(e,n):Mt(e,n,a)}(n,e)}}()})();
  • sharing-image/tags/3.1/assets/sidebar/index.asset.php

    r3108262 r3109241  
    1 <?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-primitives'), 'version' => '3f29944870aa98b92603');
     1<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-primitives'), 'version' => '');
  • sharing-image/tags/3.1/assets/sidebar/index.js

    r3108262 r3109241  
    1 (()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,a=window.wp.i18n,r=window.wp.apiFetch;var n=e.n(r);const i=window.wp.element,s=window.wp.data,l=window.wp.plugins,o=window.wp.editPost,c=window.wp.components,m=window.wp.notices,u=({name:e,layer:a,fieldset:r,setFieldset:n,attribute:l})=>{const[o,m]=(0,i.useState)(!1),u=(0,s.useSelect)((e=>e("core/editor").getEditedPostAttribute(l)));return(0,i.useEffect)((()=>{o||n({...r,[e]:u})}),[u]),(0,t.createElement)(c.TextareaControl,{name:e,label:a.title,value:r[e],onChange:t=>(t=>{n({...r,[e]:t}),m(!0)})(t)})},d=({name:e,layer:a,fieldset:r,setFieldset:n,attribute:l,entity:o})=>{const[m,u]=(0,i.useState)(!1),d=(0,s.useSelect)((e=>{const t=[];let r=e("core/editor").getEditedPostAttribute(l);return r||(r=[]),r.forEach((a=>{const r=e("core").getEntityRecord("taxonomy",o,a);r&&t.push(r.name)})),t.join(a.separator||", ")}));return(0,i.useEffect)((()=>{m||n({...r,[e]:d})}),[d]),(0,t.createElement)(c.TextareaControl,{name:e,label:a.title,value:r[e],onChange:t=>(t=>{n({...r,[e]:t}),u(!0)})(t)})},g=(0,i.forwardRef)((function({icon:e,size:t=24,...a},r){return(0,i.cloneElement)(e,{width:t,height:t,...a,ref:r})})),p=window.wp.primitives,w=(0,t.createElement)(p.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)(p.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),E=window.wp.blockEditor,h=({name:e,layer:r,mode:n,fieldset:l,setFieldset:o})=>{const m=(0,s.useSelect)((e=>e("core/editor").getEditedPostAttribute("featured_media"))),u=(0,s.useSelect)((t=>{const a=t("core").getMedia(l[e]);let r=a?.media_details?.sizes?.thumbnail?.source_url;return r||(r=a?.source_url),r}),[l]);(0,i.useEffect)((()=>{"manual"!==n&&"featured"===r.preset&&o({...l,[e]:m})}),[m]);const d=()=>{o({...l,[e]:0})};return(0,t.createElement)(E.MediaUploadCheck,null,(0,t.createElement)(E.MediaUpload,{onSelect:t=>{var a;a=t.id,o({...l,[e]:a})},allowedTypes:["image"],value:l[e],render:({open:r})=>l[e]?(0,t.createElement)(t.Fragment,null,u&&(0,t.createElement)("img",{src:u,alt:"",className:"g4qkvGu7xkyoImxRZ6GR"}),(0,t.createElement)(c.Button,{variant:"link",onClick:d},(0,a.__)("Remove image","sharing-image"))):(e=>(0,t.createElement)(t.Fragment,null,(0,t.createElement)(g,{icon:w,className:"ipnonin6Xj5A9QU3K38L"}),(0,t.createElement)(c.Button,{variant:"link",onClick:e},(0,a.__)("Set layer image","sharing-image"))))(r)}))},f=({layers:e,mode:a,fieldset:r,setFieldset:n})=>{const i=(e,a)=>(0,t.createElement)(c.TextareaControl,{name:a,label:e.title,defaultValue:r[a],onChange:e=>n({...r,[a]:e})}),s=(e,s)=>{if("manual"===a)return i(e,s);const l={name:s,layer:e,fieldset:r,setFieldset:n};switch(e.preset){case"title":return(0,t.createElement)(u,{...l,attribute:"title"});case"excerpt":return(0,t.createElement)(u,{...l,attribute:"excerpt"});case"categories":return(0,t.createElement)(d,{...l,attribute:"categories",entity:"category"});case"tags":return(0,t.createElement)(d,{...l,attribute:"tags",entity:"post_tag"})}return i(e,s)},l=(e,i)=>{const s={name:i,layer:e,mode:a,fieldset:r,setFieldset:n};return(0,t.createElement)(c.BaseControl,{id:null,label:e.title},(0,t.createElement)(c.Flex,{justify:"flex-start",style:{border:"solid 1px #ccc",padding:"4px",borderRadius:"4px"}},(0,t.createElement)(h,{...s})))};return(()=>{const t=[];for(const a in e){const r=e[a];if(r.dynamic)switch(r.type){case"text":t.push(s(r,a));break;case"image":t.push(l(r,a))}}return t})()},y=({meta:e,templates:r})=>{const{createErrorNotice:l,removeNotice:o}=(0,s.useDispatch)(m.store),u=(0,s.useSelect)((e=>e("core/editor").getCurrentPostId())),d=(0,s.useSelect)((e=>e("core/editor").getEditedPostAttribute("meta")||{})),{editPost:g}=(0,s.useDispatch)("core/editor",[d]),[p,w]=(0,i.useState)(d[e.source]?.template),[E,h]=(0,i.useState)(d[e.fieldset]),[y,b]=(0,i.useState)(!1);return(0,i.useEffect)((()=>{g({meta:{[e.fieldset]:E}})}),[E]),(0,i.useEffect)((()=>{const[e]=Object.keys(r);!r[p]&&e&&w(e)}),[r,p]),(0,t.createElement)(c.Flex,{direction:"column",gap:2,style:{position:"relative"}},d[e.source]?.poster&&(0,t.createElement)("img",{src:d[e.source].poster,alt:(0,a.__)("Sharing Image poster","sharing-image")}),"auto"===d[e.source]?.mode&&(()=>{const e=(0,a.__)("Poster was generated automatically and will update on post saving.","sharing-image");return(0,t.createElement)(c.Dashicon,{icon:"awards",className:"BygBjwYpqPpeTZbVCcRT",title:e})})(),(0,t.createElement)(c.SelectControl,{value:p,options:Object.keys(r).map((e=>({label:r[e].title||(0,a.__)("Untitled","sharing-image"),value:e}))),onChange:t=>{g({meta:{[e.source]:{...d[e.source],template:t}}}),w(t)}}),r[p]&&(0,t.createElement)(c.Flex,{direction:"column",gap:2},(0,t.createElement)(f,{layers:r[p].layers||[],mode:d[e.source]?.mode,fieldset:E,setFieldset:h})),(0,t.createElement)(c.Flex,{justify:"flex-start"},(0,t.createElement)(c.Button,{variant:"secondary",type:"button",onClick:()=>(async()=>{if(y)return;o("sharing-image-generate");const t={path:"sharing-image/v1/poster/"+u,method:"POST",data:{fieldset:E,template:p}};b(!0);try{const a=await n()(t);if(!a.data)throw new Error;g({meta:{[e.source]:{...a.data,template:p}}})}catch(e){l((0,a.__)("An unexpected error occurred","sharing-image"),{id:"sharing-image-generate",type:"snackbar"})}b(!1)})()},(0,a.__)("Generate","sharing-image")),(0,t.createElement)(c.Button,{variant:"tertiary",isDestructive:!0,onClick:()=>{g({meta:{[e.source]:{}}})}},(0,a.__)("Remove","sharing-image")),y&&(0,t.createElement)(c.Spinner,null)))};(0,l.registerPlugin)("sharing-image-sidebar",{render:()=>{const e=window.sharingImageSidebar||{};if(e.meta?.source&&e.meta?.fieldset)return(0,t.createElement)(o.PluginDocumentSettingPanel,{name:"sharing-image-sidebar",title:(0,a.__)("Sharing Image","sharing-image")},(0,t.createElement)(y,{...e}))}})})();
     1(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,a=window.wp.i18n,r=window.wp.apiFetch;var n=e.n(r);const i=window.wp.element,.PluginDocumentSettingPanel,{name:"sharing-image-sidebar",title:(0,a.__)("Sharing Image","sharing-image")},(0,t.createElement)(y,{...e}))}})})();
  • sharing-image/tags/3.1/classes/class-config.php

    r3108262 r3109241  
    154154
    155155    /**
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
    156178     * Get quality of generated poster.
    157179     *
  • sharing-image/tags/3.1/classes/class-generator.php

    r3108262 r3109241  
    295295
    296296        if ( ! isset( $layer['width'] ) ) {
    297             $layer['width'] = 0;
     297            $layer['width'] = ;
    298298        }
    299299
    300300        if ( ! isset( $layer['height'] ) ) {
    301             $layer['height'] = 0;
     301            $layer['height'] = ;
    302302        }
    303303
     
    536536     */
    537537    private static function update_layer_dimensions( $layer, $poster ) {
     538
     539
     540
     541
    538542        $width = absint( $poster->width() );
    539543
  • sharing-image/tags/3.1/classes/class-widget.php

    r3108262 r3109241  
    273273            return;
    274274        }
     275
     276
     277
     278
     279
     280
     281
    275282        $asset = require SHARING_IMAGE_DIR . 'assets/sidebar/index.asset.php';
    276283
     
    295302
    296303        $data = array(
    297             'meta'      => array(
     304            'meta'      => array(
    298305                'source'   => self::META_SOURCE,
    299306                'fieldset' => self::META_FIELDSET,
    300307            ),
    301             'templates' => Templates::get_templates(),
     308            'autogenerate' => Config::get_autogenerate_index(),
     309            'templates'    => Templates::get_templates(),
    302310        );
    303311
     
    593601        }
    594602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
    595619        $meta = get_post_meta( $post_id, self::META_SOURCE, true );
    596620
     
    599623        }
    600624
    601         $config = Config::get_config();
    602 
    603         if ( empty( $config['autogenerate'] ) ) {
    604             return;
    605         }
    606 
    607         $index = sanitize_key( $config['autogenerate'] );
     625        $index = Config::get_autogenerate_index();
     626
     627        if ( empty( $index ) ) {
     628            return;
     629        }
    608630
    609631        // Compose fieldset by template index.
  • sharing-image/tags/3.1/readme.txt

    r3108262 r3109241  
    22Contributors: antonlukin
    33Donate link: https://wpset.org/about/
    4 Tags: social image, sharing image, og image, twitter image, facebook, twitter, telegram, vk.com, ok.ru
     4Tags: social image, sharing image, og image,
    55Requires at least: 5.3
    66Tested up to: 6.5
    7 Stable tag: 3.0
     7Stable tag: 3.
    88Requires PHP: 5.5
    99License: GPLv2 or later
     
    3030
    3131== Changelog ==
     32
     33
     34
     35
     36
    3237
    3338= 3.0 =
  • sharing-image/tags/3.1/sharing-image.php

    r3108262 r3109241  
    33 * Plugin Name:       Sharing Image
    44 * Description:       Create sharing image for Facebook, VK.com, Telegram and other social networks
    5  * Version:           3.0
     5 * Version:           3.
    66 * Requires at least: 5.3
    77 * Requires PHP:      5.6
     
    2525 * Plugin version.
    2626 */
    27 define( 'SHARING_IMAGE_VERSION', '3.0' );
     27define( 'SHARING_IMAGE_VERSION', '3.' );
    2828
    2929/**
  • sharing-image/trunk/assets/settings/index.asset.php

    r3108262 r3109241  
    1 <?php return array('dependencies' => array(), 'version' => '928580135d65ac25e5e5');
     1<?php return array('dependencies' => array(), 'version' => '');
  • sharing-image/trunk/assets/settings/index.js

    r3108262 r3109241  
    1 (()=>{"use strict";let e=e=>crypto.getRandomValues(new Uint8Array(e));const t={param:function(e){return new URL(document.location.href).searchParams.get(e)},attachment:function(e,t){if(e.hasOwnProperty("multiple")||(e.multiple=!1),!wp.media)return;const n=wp.media(e);n.on("select",(()=>{const e=n.state().get("selection").first().toJSON();e.id&&t(e.id)})),n.open()},defaults:function(e,t){return t.forEach((t=>{void 0===e[t]&&(e[t]={})})),e},uniqid:function(){return((t,n=21)=>((e,t,n)=>{let a=(2<<Math.log(e.length-1)/Math.LN2)-1,i=-~(1.6*a*t/e.length);return(o=t)=>{let r="";for(;;){let t=n(i),s=i;for(;s--;)if(r+=e[t[s]&a]||"",r.length===o)return r}}})(t,n,e))("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",12)()},dataget:function(e,t,n){const a=e.querySelector(`[data-${t}="${n}"]`);if(a)return a.value}},n=function(e,t={}){const n=document.createElement(e);if(t.hasOwnProperty("classes")&&t.classes.forEach((e=>{n.classList.add(e)})),t.hasOwnProperty("text")&&(n.textContent=t.text),t.hasOwnProperty("html")&&(n.innerHTML=t.html),t.hasOwnProperty("attributes"))for(const e in t.attributes){const a=t.attributes[e];void 0!==a&&n.setAttribute(e,a)}if(t.hasOwnProperty("dataset"))for(const e in t.dataset)n.setAttribute("data-"+e,t.dataset[e]);return t.hasOwnProperty("append")&&t.append.appendChild(n),t.hasOwnProperty("prepend")&&t.prepend.insertBefore(n,t.prepend.firstChild),n},a=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("input",{attributes:{type:"text"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if("range"===i.type){const e=p.element("em",{text:i.value,attributes:{title:wp.i18n.__("Click to change the input view.","sharing-image")},append:a});i.addEventListener("change",(()=>{e.textContent=i.value})),i.addEventListener("input",(()=>{e.textContent=i.value})),e.addEventListener("click",(()=>{i.type="text"===i.type?"range":"text"}))}return i},i=function(e,t){const a=n("label",{classes:e.classes||[],append:t}),i=n("input",{attributes:{type:"checkbox"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("checked")){const t=e.checked;t&&t===i.value&&i.setAttribute("checked","checked")}if(e.hasOwnProperty("label")){const t=n("span",{text:e.label});null!==e.label&&a.appendChild(t)}return i},o=function(e,t){const a=n("label",{classes:e.classes||[],append:t}),i=n("input",{attributes:{type:"radio"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("checked")){const t=e.checked;t&&t===i.value&&i.setAttribute("checked","checked")}if(e.hasOwnProperty("label")){const t=n("span",{text:e.label});null!==e.label&&a.appendChild(t)}return e.hasOwnProperty("help")&&n("small",{text:e.help,append:a}),i},r=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("select",{dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}const o=e.options||{};for(const t in o){const a=n("option",{text:o[t],attributes:{value:t},append:i});if(e.hasOwnProperty("selected")){const t=e.selected;t&&t===a.value&&a.setAttribute("selected","selected")}}return i},s=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("textarea",{dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("content")){const t=e.content;void 0!==t&&(i.innerHTML=t)}return i},l=function(e){const t=n("div",{classes:e.classes||[]});return e.hasOwnProperty("append")&&e.append.appendChild(t),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(t,e.prepend.firstChild),e.hasOwnProperty("label")&&n("h3",{text:e.label,append:t}),e.hasOwnProperty("description")&&n("p",{text:e.description,append:t}),e.hasOwnProperty("fields")&&e.fields.forEach((e=>{switch(e.group){case"input":a(e,t);break;case"textarea":s(e,t);break;case"radio":o(e,t);break;case"select":r(e,t);break;case"checkbox":i(e,t)}})),e.hasOwnProperty("help")&&n("small",{text:e.help,append:t}),t};function c(e,t){let a=e.querySelector("figure");if(a&&e.removeChild(a),!wp.media)return;if(a=n("figure",{prepend:e}),e.querySelector("h4")&&e.insertBefore(a,e.querySelector("h4").nextSibling),!t)return;let i=a.querySelector("img");i&&a.removeChild(i),i=n("img",{append:a}),wp.media.attachment(t).fetch().then((e=>{i.src=e.sizes?.thumbnail?.url||e.url}))}const p={element:n,control:l,layer:function(e){const t=n("div",{classes:e.classes||[]});e.hasOwnProperty("append")&&e.append.appendChild(t),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(t,e.prepend.firstChild),e.hasOwnProperty("label")||(e.label="");const a=n("h2",{text:e.label,append:t});return n("span",{append:a}),e.hasOwnProperty("description")&&n("h5",{text:e.description,append:t}),t},checkbox:i,media:function(e){const a=l({classes:e.classes||[]});if(e.hasOwnProperty("append")&&e.append.appendChild(a),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(a,e.prepend.firstChild),e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}e.labels=e.labels||{};const i=n("input",{attributes:{type:"hidden",name:e.name},append:a}),o=n("button",{classes:["button"],text:e.labels.button,attributes:{type:"button"},append:a}),r=n("a",{classes:["hidden"],text:e.labels.details,attributes:{target:"_blank"}});e.hasOwnProperty("link")&&a.appendChild(r),e.hasOwnProperty("help")&&n("small",{text:e.help,append:a});const s=t=>{i.setAttribute("value",t),i.dispatchEvent(new Event("change",{bubbles:!0}));let n=null;e.hasOwnProperty("link")&&(n=new URL(e.link),n.searchParams.set("item",t),r.setAttribute("href",n.href)),e.remove&&(o.textContent=e.labels.remove),e.image&&c(a,t),r.classList.remove("hidden")},p=()=>{i.setAttribute("value",""),i.dispatchEvent(new Event("change",{bubbles:!0})),o.textContent=e.labels.button,e.image&&c(a,0),r.classList.add("hidden")};return e.image&&c(a,0),e.value&&s(e.value),o.addEventListener("click",(()=>{if(e.remove&&i.value)return p();const n={title:e.labels.heading};e.hasOwnProperty("mime")&&(n.library={},n.library.type=e.mime),t.attachment(n,(e=>{s(e)}))})),a.addEventListener("set_attachment",(e=>{e.detail&&s(e.detail)})),a.addEventListener("remove_attachment",(()=>{p()})),a},input:a,textarea:s,radio:o,select:r};let d=null;let u=null;function g(e,t,n){const a=p.element("div",{classes:["sharing-image-catalog-card"],append:e}),i=p.element("figure",{classes:["sharing-image-catalog-preview"],append:a});t.preview&&p.element("img",{attributes:{src:t.preview,alt:""},append:i});const o=p.element("footer",{classes:["sharing-image-catalog-footer"],append:a});p.element("h2",{text:t.title||wp.i18n.__("Untitled","sharing-image"),append:o});const r=new URL(document.location.href);r.searchParams.set("template",n),p.element("a",{classes:["button"],text:wp.i18n.__("Edit template","sharing-image"),attributes:{href:r.href},append:o})}let h=null,m=null;function f(e,t){const n=[];switch(void 0===t&&(t=wp.i18n.__("Verification unsuccessful.","sharing-image")),n.push(t),e){case"LIMIT_EXCEEDED":n.push(wp.i18n.__("The number of licenses for this key has been exceeded.","sharing-image"));break;case"KEY_NOT_FOUND":n.push(wp.i18n.__("The Premium key is invalid or expired.","sharing-image"));break;case"SERVER_ERROR":n.push(wp.i18n.__("Unable to receive a response from the verification server.","sharing-image"))}return n.join(" ")}function v(e){const t=m.querySelector(".sharing-image-premium-warning");null!==t&&(t.classList.add("warning-visible"),t.textContent=e||wp.i18n.__("Unknown request error.","sharing-image"))}function b(){const e=m.querySelector(".sharing-image-premium-warning");null!==e&&e.classList.remove("warning-visible")}function _(e,t){m.classList.add("premium-enabled"),t.develop?v(wp.i18n.__("Using the plugin with a development license is prohibited in production.","sharing-image")):(t.key&&function(e,t){const n=p.element("div",{classes:["sharing-image-premium-permit"],append:e});p.element("button",{classes:["sharing-image-premium-show","button"],text:wp.i18n.__("Show License key","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{n.classList.toggle("permit-visible")})),p.element("strong",{text:t,append:n})}(e,t.key),function(e){const t=p.element("div",{classes:["sharing-image-premium-revoke"],append:e}),n=[];n.push(wp.i18n.__("Disabling premium mode will not remove the license for this domain.","sharing-image")),n.push(wp.i18n.__("Your current key will also be saved in the plugin settings.","sharing-image")),n.push(wp.i18n.__("Use key management tool to delete the license for the site.","sharing-image")),p.element("p",{text:n.join(" "),append:t}),p.element("button",{classes:["button"],text:wp.i18n.__("Disable Premium","sharing-image"),attributes:{type:"submit"},append:t}),p.element("span",{classes:["spinner"],append:t}),e.addEventListener("submit",(t=>{t.preventDefault(),function(e){e.classList.add("access-loader");const t=new XMLHttpRequest;t.open("POST",ajaxurl),t.responseType="json";const n=new window.FormData(e);n.set("action","sharing_image_revoke_premium"),b(),t.addEventListener("load",(()=>{const n=t.response||{};return e.classList.remove("access-loader"),n.data?n.success?(h.license=n.data,void w()):v(n.data):v()})),t.addEventListener("error",(()=>{v(),e.classList.remove("access-loader")})),t.send(n)}(e)}))}(e))}function w(){let e=m.querySelector(".sharing-image-premium-access");null!==e&&m.removeChild(e),e=p.element("form",{classes:["sharing-image-premium-access"],attributes:{action:"",method:"POST"},append:m}),m.classList.remove("premium-enabled"),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:h.nonce},append:e});const t=h.license||{};return t.premium||t.develop?_(e,t):function(e,t){t.error&&v(f(t.error)),p.element("strong",{text:wp.i18n.__("Do you already have a key? Enter it here","sharing-image"),append:e});const n=p.element("div",{classes:["sharing-image-premium-verify"],append:e});p.element("input",{label:wp.i18n.__("Your Premium key","sharing-image"),attributes:{type:"text",name:"sharing_image_key",value:t.key},append:n}),p.element("button",{classes:["button"],text:wp.i18n.__("Submit","sharing-image"),attributes:{type:"submit"},append:n}),p.element("span",{classes:["spinner"],append:n}),e.addEventListener("submit",(t=>{t.preventDefault(),function(e){e.classList.add("access-loader");const t=new XMLHttpRequest;t.open("POST",ajaxurl),t.responseType="json";const n=new window.FormData(e);n.set("action","sharing_image_verify_premium"),b(),t.addEventListener("load",(()=>{const n=t.response||{};return e.classList.remove("access-loader"),n.data?n.success?(h.license=n.data,void w()):v(f(n.code,n.data)):v()})),t.addEventListener("error",(()=>{v(),e.classList.remove("access-loader")})),t.send(n)}(e)}))}(e,t)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){k(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function E(e){return E="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(e)}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(){return S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},S.apply(this,arguments)}function D(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var C=D(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),T=D(/Edge/i),P=D(/firefox/i),O=D(/safari/i)&&!D(/chrome/i)&&!D(/android/i),L=D(/iP(ad|od|hone)/i),A=D(/chrome/i)&&D(/android/i),M={capture:!1,passive:!1};function N(e,t,n){e.addEventListener(t,n,!C&&M)}function I(e,t,n){e.removeEventListener(t,n,!C&&M)}function R(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 Y(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function j(e,t,n,a){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&R(e,t):R(e,t))||a&&e===n)return e;if(e===n)break}while(e=Y(e))}return null}var F,X=/\s+/g;function q(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var a=(" "+e.className+" ").replace(X," ").replace(" "+t+" "," ");e.className=(a+(n?" "+t:"")).replace(X," ")}}function z(e,t,n){var a=e&&e.style;if(a){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 a||-1!==t.indexOf("webkit")||(t="-webkit-"+t),a[t]=n+("string"==typeof n?"":"px")}}function B(e,t){var n="";if("string"==typeof e)n=e;else do{var a=z(e,"transform");a&&"none"!==a&&(n=a+" "+n)}while(!t&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function U(e,t,n){if(e){var a=e.getElementsByTagName(t),i=0,o=a.length;if(n)for(;i<o;i++)n(a[i],i);return a}return[]}function H(){return document.scrollingElement||document.documentElement}function W(e,t,n,a,i){if(e.getBoundingClientRect||e===window){var o,r,s,l,c,p,d;if(e!==window&&e.parentNode&&e!==H()?(r=(o=e.getBoundingClientRect()).top,s=o.left,l=o.bottom,c=o.right,p=o.height,d=o.width):(r=0,s=0,l=window.innerHeight,c=window.innerWidth,p=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(i=i||e.parentNode,!C))do{if(i&&i.getBoundingClientRect&&("none"!==z(i,"transform")||n&&"static"!==z(i,"position"))){var u=i.getBoundingClientRect();r-=u.top+parseInt(z(i,"border-top-width")),s-=u.left+parseInt(z(i,"border-left-width")),l=r+o.height,c=s+o.width;break}}while(i=i.parentNode);if(a&&e!==window){var g=B(i||e),h=g&&g.a,m=g&&g.d;g&&(l=(r/=m)+(p/=m),c=(s/=h)+(d/=h))}return{top:r,left:s,bottom:l,right:c,width:d,height:p}}}function G(e,t,n){for(var a=Z(e,!0),i=W(e)[t];a;){var o=W(a)[n];if(!("top"===n||"left"===n?i>=o:i<=o))return a;if(a===H())break;a=Z(a,!1)}return!1}function V(e,t,n,a){for(var i=0,o=0,r=e.children;o<r.length;){if("none"!==r[o].style.display&&r[o]!==tt.ghost&&(a||r[o]!==tt.dragged)&&j(r[o],n.draggable,e,!1)){if(i===t)return r[o];i++}o++}return null}function J(e,t){for(var n=e.lastElementChild;n&&(n===tt.ghost||"none"===z(n,"display")||t&&!R(n,t));)n=n.previousElementSibling;return n||null}function $(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===tt.clone||t&&!R(e,t)||n++;return n}function K(e){var t=0,n=0,a=H();if(e)do{var i=B(e),o=i.a,r=i.d;t+=e.scrollLeft*o,n+=e.scrollTop*r}while(e!==a&&(e=e.parentNode));return[t,n]}function Z(e,t){if(!e||!e.getBoundingClientRect)return H();var n=e,a=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=z(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return H();if(a||t)return n;a=!0}}}while(n=n.parentNode);return H()}function Q(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function ee(e,t){return function(){if(!F){var n=arguments;1===n.length?e.call(this,n[0]):e.apply(this,n),F=setTimeout((function(){F=void 0}),t)}}}function te(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function ne(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}function ae(e,t,n){var a={};return Array.from(e.children).forEach((function(i){var o,r,s,l;if(j(i,t.draggable,e,!1)&&!i.animated&&i!==n){var c=W(i);a.left=Math.min(null!==(o=a.left)&&void 0!==o?o:1/0,c.left),a.top=Math.min(null!==(r=a.top)&&void 0!==r?r:1/0,c.top),a.right=Math.max(null!==(s=a.right)&&void 0!==s?s:-1/0,c.right),a.bottom=Math.max(null!==(l=a.bottom)&&void 0!==l?l:-1/0,c.bottom)}})),a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}var ie="Sortable"+(new Date).getTime();var oe=[],re={initializeByDefault:!0},se={mount:function(e){for(var t in re)re.hasOwnProperty(t)&&!(t in e)&&(e[t]=re[t]);oe.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),oe.push(e)},pluginEvent:function(e,t,n){var a=this;this.eventCanceled=!1,n.cancel=function(){a.eventCanceled=!0};var i=e+"Global";oe.forEach((function(a){t[a.pluginName]&&(t[a.pluginName][i]&&t[a.pluginName][i](x({sortable:t},n)),t.options[a.pluginName]&&t[a.pluginName][e]&&t[a.pluginName][e](x({sortable:t},n)))}))},initializePlugins:function(e,t,n,a){for(var i in oe.forEach((function(a){var i=a.pluginName;if(e.options[i]||a.initializeByDefault){var o=new a(e,t,e.options);o.sortable=e,o.options=e.options,e[i]=o,S(n,o.defaults)}})),e.options)if(e.options.hasOwnProperty(i)){var o=this.modifyOption(e,i,e.options[i]);void 0!==o&&(e.options[i]=o)}},getEventProperties:function(e,t){var n={};return oe.forEach((function(a){"function"==typeof a.eventProperties&&S(n,a.eventProperties.call(t[a.pluginName],e))})),n},modifyOption:function(e,t,n){var a;return oe.forEach((function(i){e[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[t]&&(a=i.optionListeners[t].call(e[i.pluginName],n))})),a}};var le=["evt"],ce=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=n.evt,i=function(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(n,le);se.pluginEvent.bind(tt)(e,t,x({dragEl:de,parentEl:ue,ghostEl:ge,rootEl:he,nextEl:me,lastDownEl:fe,cloneEl:ve,cloneHidden:be,dragStarted:Le,putSortable:ke,activeSortable:tt.active,originalEvent:a,oldIndex:_e,oldDraggableIndex:ye,newIndex:we,newDraggableIndex:xe,hideGhostForTarget:Ke,unhideGhostForTarget:Ze,cloneNowHidden:function(){be=!0},cloneNowShown:function(){be=!1},dispatchSortableEvent:function(e){pe({sortable:t,name:e,originalEvent:a})}},i))};function pe(e){!function(e){var t=e.sortable,n=e.rootEl,a=e.name,i=e.targetEl,o=e.cloneEl,r=e.toEl,s=e.fromEl,l=e.oldIndex,c=e.newIndex,p=e.oldDraggableIndex,d=e.newDraggableIndex,u=e.originalEvent,g=e.putSortable,h=e.extraEventProperties;if(t=t||n&&n[ie]){var m,f=t.options,v="on"+a.charAt(0).toUpperCase()+a.substr(1);!window.CustomEvent||C||T?(m=document.createEvent("Event")).initEvent(a,!0,!0):m=new CustomEvent(a,{bubbles:!0,cancelable:!0}),m.to=r||n,m.from=s||n,m.item=i||n,m.clone=o,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=p,m.newDraggableIndex=d,m.originalEvent=u,m.pullMode=g?g.lastPutMode:void 0;var b=x(x({},h),se.getEventProperties(a,t));for(var _ in b)m[_]=b[_];n&&n.dispatchEvent(m),f[v]&&f[v].call(t,m)}}(x({putSortable:ke,cloneEl:ve,targetEl:de,rootEl:he,oldIndex:_e,oldDraggableIndex:ye,newIndex:we,newDraggableIndex:xe},e))}var de,ue,ge,he,me,fe,ve,be,_e,we,ye,xe,Ee,ke,Se,De,Ce,Te,Pe,Oe,Le,Ae,Me,Ne,Ie,Re=!1,Ye=!1,je=[],Fe=!1,Xe=!1,qe=[],ze=!1,Be=[],Ue="undefined"!=typeof document,He=L,We=T||C?"cssFloat":"float",Ge=Ue&&!A&&!L&&"draggable"in document.createElement("div"),Ve=function(){if(Ue){if(C)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Je=function(e,t){var n=z(e),a=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=V(e,0,t),o=V(e,1,t),r=i&&z(i),s=o&&z(o),l=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+W(i).width,c=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+W(o).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(i&&r.float&&"none"!==r.float){var p="left"===r.float?"left":"right";return!o||"both"!==s.clear&&s.clear!==p?"horizontal":"vertical"}return i&&("block"===r.display||"flex"===r.display||"table"===r.display||"grid"===r.display||l>=a&&"none"===n[We]||o&&"none"===n[We]&&l+c>a)?"vertical":"horizontal"},$e=function(e){function t(e,n){return function(a,i,o,r){var s=a.options.group.name&&i.options.group.name&&a.options.group.name===i.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(a,i,o,r),n)(a,i,o,r);var l=(n?a:i).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},a=e.group;a&&"object"==E(a)||(a={name:a}),n.name=a.name,n.checkPull=t(a.pull,!0),n.checkPut=t(a.put),n.revertClone=a.revertClone,e.group=n},Ke=function(){!Ve&&ge&&z(ge,"display","none")},Ze=function(){!Ve&&ge&&z(ge,"display","")};Ue&&!A&&document.addEventListener("click",(function(e){if(Ye)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ye=!1,!1}),!0);var Qe=function(e){if(de){e=e.touches?e.touches[0]:e;var t=(i=e.clientX,o=e.clientY,je.some((function(e){var t=e[ie].options.emptyInsertThreshold;if(t&&!J(e)){var n=W(e),a=i>=n.left-t&&i<=n.right+t,s=o>=n.top-t&&o<=n.bottom+t;return a&&s?r=e:void 0}})),r);if(t){var n={};for(var a in e)e.hasOwnProperty(a)&&(n[a]=e[a]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[ie]._onDragOver(n)}}var i,o,r},et=function(e){de&&de.parentNode[ie]._isOutsideThisEl(e.target)};function tt(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=S({},t),e[ie]=this;var n,a,i={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 Je(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!==tt.supportPointer&&"PointerEvent"in window&&!O,emptyInsertThreshold:5};for(var o in se.initializePlugins(this,e,i),i)!(o in t)&&(t[o]=i[o]);for(var r in $e(t),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!t.forceFallback&&Ge,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?N(e,"pointerdown",this._onTapStart):(N(e,"mousedown",this._onTapStart),N(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(N(e,"dragover",this),N(e,"dragenter",this)),je.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),S(this,(a=[],{captureAnimationState:function(){a=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){if("none"!==z(e,"display")&&e!==tt.ghost){a.push({target:e,rect:W(e)});var t=x({},a[a.length-1].rect);if(e.thisAnimationDuration){var n=B(e,!0);n&&(t.top-=n.f,t.left-=n.e)}e.fromRect=t}}))},addAnimationState:function(e){a.push(e)},removeAnimationState:function(e){a.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var a in t)if(t.hasOwnProperty(a)&&t[a]===e[n][a])return Number(n);return-1}(a,{target:e}),1)},animateAll:function(e){var t=this;if(!this.options.animation)return clearTimeout(n),void("function"==typeof e&&e());var i=!1,o=0;a.forEach((function(e){var n=0,a=e.target,r=a.fromRect,s=W(a),l=a.prevFromRect,c=a.prevToRect,p=e.rect,d=B(a,!0);d&&(s.top-=d.f,s.left-=d.e),a.toRect=s,a.thisAnimationDuration&&Q(l,s)&&!Q(r,s)&&(p.top-s.top)/(p.left-s.left)==(r.top-s.top)/(r.left-s.left)&&(n=function(e,t,n,a){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*a.animation}(p,l,c,t.options)),Q(s,r)||(a.prevFromRect=r,a.prevToRect=s,n||(n=t.options.animation),t.animate(a,p,s,n)),n&&(i=!0,o=Math.max(o,n),clearTimeout(a.animationResetTimer),a.animationResetTimer=setTimeout((function(){a.animationTime=0,a.prevFromRect=null,a.fromRect=null,a.prevToRect=null,a.thisAnimationDuration=null}),n),a.thisAnimationDuration=n)})),clearTimeout(n),i?n=setTimeout((function(){"function"==typeof e&&e()}),o):"function"==typeof e&&e(),a=[]},animate:function(e,t,n,a){if(a){z(e,"transition",""),z(e,"transform","");var i=B(this.el),o=i&&i.a,r=i&&i.d,s=(t.left-n.left)/(o||1),l=(t.top-n.top)/(r||1);e.animatingX=!!s,e.animatingY=!!l,z(e,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),z(e,"transition","transform "+a+"ms"+(this.options.easing?" "+this.options.easing:"")),z(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){z(e,"transition",""),z(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),a)}}}))}function nt(e,t,n,a,i,o,r,s){var l,c,p=e[ie],d=p.options.onMove;return!window.CustomEvent||C||T?(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=a,l.related=i||t,l.relatedRect=o||W(t),l.willInsertAfter=s,l.originalEvent=r,e.dispatchEvent(l),d&&(c=d.call(p,l,r)),c}function at(e){e.draggable=!1}function it(){ze=!1}function ot(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,a=0;n--;)a+=t.charCodeAt(n);return a.toString(36)}function rt(e){return setTimeout(e,0)}function st(e){return clearTimeout(e)}tt.prototype={constructor:tt,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Ae=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,de):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,a=this.options,i=a.preventOnFilter,o=e.type,r=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(r||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,c=a.filter;if(function(e){Be.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var a=t[n];a.checked&&Be.push(a)}}(n),!de&&!(/mousedown|pointerdown/.test(o)&&0!==e.button||a.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!O||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=j(s,a.draggable,n,!1))&&s.animated||fe===s)){if(_e=$(s),ye=$(s,a.draggable),"function"==typeof c){if(c.call(this,e,s,this))return pe({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),ce("filter",t,{evt:e}),void(i&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some((function(a){if(a=j(l,a.trim(),n,!1))return pe({sortable:t,rootEl:a,name:"filter",targetEl:s,fromEl:n,toEl:n}),ce("filter",t,{evt:e}),!0}))))return void(i&&e.cancelable&&e.preventDefault());a.handle&&!j(l,a.handle,n,!1)||this._prepareDragStart(e,r,s)}}},_prepareDragStart:function(e,t,n){var a,i=this,o=i.el,r=i.options,s=o.ownerDocument;if(n&&!de&&n.parentNode===o){var l=W(n);if(he=o,ue=(de=n).parentNode,me=de.nextSibling,fe=n,Ee=r.group,tt.dragged=de,Se={target:de,clientX:(t||e).clientX,clientY:(t||e).clientY},Pe=Se.clientX-l.left,Oe=Se.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,de.style["will-change"]="all",a=function(){ce("delayEnded",i,{evt:e}),tt.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!P&&i.nativeDraggable&&(de.draggable=!0),i._triggerDragStart(e,t),pe({sortable:i,name:"choose",originalEvent:e}),q(de,r.chosenClass,!0))},r.ignore.split(",").forEach((function(e){U(de,e.trim(),at)})),N(s,"dragover",Qe),N(s,"mousemove",Qe),N(s,"touchmove",Qe),N(s,"mouseup",i._onDrop),N(s,"touchend",i._onDrop),N(s,"touchcancel",i._onDrop),P&&this.nativeDraggable&&(this.options.touchStartThreshold=4,de.draggable=!0),ce("delayStart",this,{evt:e}),!r.delay||r.delayOnTouchOnly&&!t||this.nativeDraggable&&(T||C))a();else{if(tt.eventCanceled)return void this._onDrop();N(s,"mouseup",i._disableDelayedDrag),N(s,"touchend",i._disableDelayedDrag),N(s,"touchcancel",i._disableDelayedDrag),N(s,"mousemove",i._delayedDragTouchMoveHandler),N(s,"touchmove",i._delayedDragTouchMoveHandler),r.supportPointer&&N(s,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(a,r.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(){de&&at(de),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;I(e,"mouseup",this._disableDelayedDrag),I(e,"touchend",this._disableDelayedDrag),I(e,"touchcancel",this._disableDelayedDrag),I(e,"mousemove",this._delayedDragTouchMoveHandler),I(e,"touchmove",this._delayedDragTouchMoveHandler),I(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?N(document,"pointermove",this._onTouchMove):N(document,t?"touchmove":"mousemove",this._onTouchMove):(N(de,"dragend",this),N(he,"dragstart",this._onDragStart));try{document.selection?rt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Re=!1,he&&de){ce("dragStarted",this,{evt:t}),this.nativeDraggable&&N(document,"dragover",et);var n=this.options;!e&&q(de,n.dragClass,!1),q(de,n.ghostClass,!0),tt.active=this,e&&this._appendGhost(),pe({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(De){this._lastX=De.clientX,this._lastY=De.clientY,Ke();for(var e=document.elementFromPoint(De.clientX,De.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(De.clientX,De.clientY))!==t;)t=e;if(de.parentNode[ie]._isOutsideThisEl(e),t)do{if(t[ie]&&t[ie]._onDragOver({clientX:De.clientX,clientY:De.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break;e=t}while(t=t.parentNode);Ze()}},_onTouchMove:function(e){if(Se){var t=this.options,n=t.fallbackTolerance,a=t.fallbackOffset,i=e.touches?e.touches[0]:e,o=ge&&B(ge,!0),r=ge&&o&&o.a,s=ge&&o&&o.d,l=He&&Ie&&K(Ie),c=(i.clientX-Se.clientX+a.x)/(r||1)+(l?l[0]-qe[0]:0)/(r||1),p=(i.clientY-Se.clientY+a.y)/(s||1)+(l?l[1]-qe[1]:0)/(s||1);if(!tt.active&&!Re){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(ge){o?(o.e+=c-(Ce||0),o.f+=p-(Te||0)):o={a:1,b:0,c:0,d:1,e:c,f:p};var d="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")");z(ge,"webkitTransform",d),z(ge,"mozTransform",d),z(ge,"msTransform",d),z(ge,"transform",d),Ce=c,Te=p,De=i}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!ge){var e=this.options.fallbackOnBody?document.body:he,t=W(de,!0,He,!0,e),n=this.options;if(He){for(Ie=e;"static"===z(Ie,"position")&&"none"===z(Ie,"transform")&&Ie!==document;)Ie=Ie.parentNode;Ie!==document.body&&Ie!==document.documentElement?(Ie===document&&(Ie=H()),t.top+=Ie.scrollTop,t.left+=Ie.scrollLeft):Ie=H(),qe=K(Ie)}q(ge=de.cloneNode(!0),n.ghostClass,!1),q(ge,n.fallbackClass,!0),q(ge,n.dragClass,!0),z(ge,"transition",""),z(ge,"transform",""),z(ge,"box-sizing","border-box"),z(ge,"margin",0),z(ge,"top",t.top),z(ge,"left",t.left),z(ge,"width",t.width),z(ge,"height",t.height),z(ge,"opacity","0.8"),z(ge,"position",He?"absolute":"fixed"),z(ge,"zIndex","100000"),z(ge,"pointerEvents","none"),tt.ghost=ge,e.appendChild(ge),z(ge,"transform-origin",Pe/parseInt(ge.style.width)*100+"% "+Oe/parseInt(ge.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,a=e.dataTransfer,i=n.options;ce("dragStart",this,{evt:e}),tt.eventCanceled?this._onDrop():(ce("setupClone",this),tt.eventCanceled||((ve=ne(de)).removeAttribute("id"),ve.draggable=!1,ve.style["will-change"]="",this._hideClone(),q(ve,this.options.chosenClass,!1),tt.clone=ve),n.cloneId=rt((function(){ce("clone",n),tt.eventCanceled||(n.options.removeCloneOnHide||he.insertBefore(ve,de),n._hideClone(),pe({sortable:n,name:"clone"}))})),!t&&q(de,i.dragClass,!0),t?(Ye=!0,n._loopId=setInterval(n._emulateDragOver,50)):(I(document,"mouseup",n._onDrop),I(document,"touchend",n._onDrop),I(document,"touchcancel",n._onDrop),a&&(a.effectAllowed="move",i.setData&&i.setData.call(n,a,de)),N(document,"drop",n),z(de,"transform","translateZ(0)")),Re=!0,n._dragStartId=rt(n._dragStarted.bind(n,t,e)),N(document,"selectstart",n),Le=!0,O&&z(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,a,i,o=this.el,r=e.target,s=this.options,l=s.group,c=tt.active,p=Ee===l,d=s.sort,u=ke||c,g=this,h=!1;if(!ze){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),r=j(r,s.draggable,o,!0),O("dragOver"),tt.eventCanceled)return h;if(de.contains(e.target)||r.animated&&r.animatingX&&r.animatingY||g._ignoreWhileAnimating===r)return A(!1);if(Ye=!1,c&&!s.disabled&&(p?d||(a=ue!==he):ke===this||(this.lastPutMode=Ee.checkPull(this,c,de,e))&&l.checkPut(this,c,de,e))){if(i="vertical"===this._getDirection(e,r),t=W(de),O("dragOverValid"),tt.eventCanceled)return h;if(a)return ue=he,L(),this._hideClone(),O("revert"),tt.eventCanceled||(me?he.insertBefore(de,me):he.appendChild(de)),A(!0);var m=J(o,s.draggable);if(!m||function(e,t,n){var a=W(J(n.el,n.options.draggable)),i=ae(n.el,n.options,ge);return t?e.clientX>i.right+10||e.clientY>a.bottom&&e.clientX>a.left:e.clientY>i.bottom+10||e.clientX>a.right&&e.clientY>a.top}(e,i,this)&&!m.animated){if(m===de)return A(!1);if(m&&o===e.target&&(r=m),r&&(n=W(r)),!1!==nt(he,o,de,t,r,n,e,!!r))return L(),m&&m.nextSibling?o.insertBefore(de,m.nextSibling):o.appendChild(de),ue=o,M(),A(!0)}else if(m&&function(e,t,n){var a=W(V(n.el,0,n.options,!0)),i=ae(n.el,n.options,ge);return t?e.clientX<i.left-10||e.clientY<a.top&&e.clientX<a.right:e.clientY<i.top-10||e.clientY<a.bottom&&e.clientX<a.left}(e,i,this)){var f=V(o,0,s,!0);if(f===de)return A(!1);if(n=W(r=f),!1!==nt(he,o,de,t,r,n,e,!1))return L(),o.insertBefore(de,f),ue=o,M(),A(!0)}else if(r.parentNode===o){n=W(r);var v,b,_,w=de.parentNode!==o,y=!function(e,t,n){var a=n?e.left:e.top,i=n?e.right:e.bottom,o=n?e.width:e.height,r=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return a===r||i===s||a+o/2===r+l/2}(de.animated&&de.toRect||t,r.animated&&r.toRect||n,i),E=i?"top":"left",k=G(r,"top","top")||G(de,"top","top"),S=k?k.scrollTop:void 0;if(Ae!==r&&(b=n[E],Fe=!1,Xe=!y&&s.invertSwap||w),v=function(e,t,n,a,i,o,r,s){var l=a?e.clientY:e.clientX,c=a?n.height:n.width,p=a?n.top:n.left,d=a?n.bottom:n.right,u=!1;if(!r)if(s&&Ne<c*i){if(!Fe&&(1===Me?l>p+c*o/2:l<d-c*o/2)&&(Fe=!0),Fe)u=!0;else if(1===Me?l<p+Ne:l>d-Ne)return-Me}else if(l>p+c*(1-i)/2&&l<d-c*(1-i)/2)return function(e){return $(de)<$(e)?1:-1}(t);return(u=u||r)&&(l<p+c*o/2||l>d-c*o/2)?l>p+c/2?1:-1:0}(e,r,n,i,y?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Xe,Ae===r),0!==v){var D=$(de);do{D-=v,_=ue.children[D]}while(_&&("none"===z(_,"display")||_===ge))}if(0===v||_===r)return A(!1);Ae=r,Me=v;var C=r.nextElementSibling,T=!1,P=nt(he,o,de,t,r,n,e,T=1===v);if(!1!==P)return 1!==P&&-1!==P||(T=1===P),ze=!0,setTimeout(it,30),L(),T&&!C?o.appendChild(de):r.parentNode.insertBefore(de,T?C:r),k&&te(k,0,S-k.scrollTop),ue=de.parentNode,void 0===b||Xe||(Ne=Math.abs(b-W(r)[E])),M(),A(!0)}if(o.contains(de))return A(!1)}return!1}function O(s,l){ce(s,g,x({evt:e,isOwner:p,axis:i?"vertical":"horizontal",revert:a,dragRect:t,targetRect:n,canSort:d,fromSortable:u,target:r,completed:A,onMove:function(n,a){return nt(he,o,de,t,n,W(n),e,a)},changed:M},l))}function L(){O("dragOverAnimationCapture"),g.captureAnimationState(),g!==u&&u.captureAnimationState()}function A(t){return O("dragOverCompleted",{insertion:t}),t&&(p?c._hideClone():c._showClone(g),g!==u&&(q(de,ke?ke.options.ghostClass:c.options.ghostClass,!1),q(de,s.ghostClass,!0)),ke!==g&&g!==tt.active?ke=g:g===tt.active&&ke&&(ke=null),u===g&&(g._ignoreWhileAnimating=r),g.animateAll((function(){O("dragOverAnimationComplete"),g._ignoreWhileAnimating=null})),g!==u&&(u.animateAll(),u._ignoreWhileAnimating=null)),(r===de&&!de.animated||r===o&&!r.animated)&&(Ae=null),s.dragoverBubble||e.rootEl||r===document||(de.parentNode[ie]._isOutsideThisEl(e.target),!t&&Qe(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),h=!0}function M(){we=$(de),xe=$(de,s.draggable),pe({sortable:g,name:"change",toEl:o,newIndex:we,newDraggableIndex:xe,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){I(document,"mousemove",this._onTouchMove),I(document,"touchmove",this._onTouchMove),I(document,"pointermove",this._onTouchMove),I(document,"dragover",Qe),I(document,"mousemove",Qe),I(document,"touchmove",Qe)},_offUpEvents:function(){var e=this.el.ownerDocument;I(e,"mouseup",this._onDrop),I(e,"touchend",this._onDrop),I(e,"pointerup",this._onDrop),I(e,"touchcancel",this._onDrop),I(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;we=$(de),xe=$(de,n.draggable),ce("drop",this,{evt:e}),ue=de&&de.parentNode,we=$(de),xe=$(de,n.draggable),tt.eventCanceled||(Re=!1,Xe=!1,Fe=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),st(this.cloneId),st(this._dragStartId),this.nativeDraggable&&(I(document,"drop",this),I(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),O&&z(document.body,"user-select",""),z(de,"transform",""),e&&(Le&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),ge&&ge.parentNode&&ge.parentNode.removeChild(ge),(he===ue||ke&&"clone"!==ke.lastPutMode)&&ve&&ve.parentNode&&ve.parentNode.removeChild(ve),de&&(this.nativeDraggable&&I(de,"dragend",this),at(de),de.style["will-change"]="",Le&&!Re&&q(de,ke?ke.options.ghostClass:this.options.ghostClass,!1),q(de,this.options.chosenClass,!1),pe({sortable:this,name:"unchoose",toEl:ue,newIndex:null,newDraggableIndex:null,originalEvent:e}),he!==ue?(we>=0&&(pe({rootEl:ue,name:"add",toEl:ue,fromEl:he,originalEvent:e}),pe({sortable:this,name:"remove",toEl:ue,originalEvent:e}),pe({rootEl:ue,name:"sort",toEl:ue,fromEl:he,originalEvent:e}),pe({sortable:this,name:"sort",toEl:ue,originalEvent:e})),ke&&ke.save()):we!==_e&&we>=0&&(pe({sortable:this,name:"update",toEl:ue,originalEvent:e}),pe({sortable:this,name:"sort",toEl:ue,originalEvent:e})),tt.active&&(null!=we&&-1!==we||(we=_e,xe=ye),pe({sortable:this,name:"end",toEl:ue,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){ce("nulling",this),he=de=ue=ge=me=ve=fe=be=Se=De=Le=we=xe=_e=ye=Ae=Me=ke=Ee=tt.dragged=tt.ghost=tt.clone=tt.active=null,Be.forEach((function(e){e.checked=!0})),Be.length=Ce=Te=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":de&&(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,a=0,i=n.length,o=this.options;a<i;a++)j(e=n[a],o.draggable,this.el,!1)&&t.push(e.getAttribute(o.dataIdAttr)||ot(e));return t},sort:function(e,t){var n={},a=this.el;this.toArray().forEach((function(e,t){var i=a.children[t];j(i,this.options.draggable,a,!1)&&(n[e]=i)}),this),t&&this.captureAnimationState(),e.forEach((function(e){n[e]&&(a.removeChild(n[e]),a.appendChild(n[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return j(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(void 0===t)return n[e];var a=se.modifyOption(this,e,t);n[e]=void 0!==a?a:t,"group"===e&&$e(n)},destroy:function(){ce("destroy",this);var e=this.el;e[ie]=null,I(e,"mousedown",this._onTapStart),I(e,"touchstart",this._onTapStart),I(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(I(e,"dragover",this),I(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),je.splice(je.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!be){if(ce("hideClone",this),tt.eventCanceled)return;z(ve,"display","none"),this.options.removeCloneOnHide&&ve.parentNode&&ve.parentNode.removeChild(ve),be=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(be){if(ce("showClone",this),tt.eventCanceled)return;de.parentNode!=he||this.options.group.revertClone?me?he.insertBefore(ve,me):he.appendChild(ve):he.insertBefore(ve,de),this.options.group.revertClone&&this.animate(de,ve),z(ve,"display",""),be=!1}}else this._hideClone()}},Ue&&N(document,"touchmove",(function(e){(tt.active||Re)&&e.cancelable&&e.preventDefault()})),tt.utils={on:N,off:I,css:z,find:U,is:function(e,t){return!!j(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:ee,closest:j,toggleClass:q,clone:ne,index:$,nextTick:rt,cancelNextTick:st,detectDirection:Je,getChild:V},tt.get=function(e){return e[ie]},tt.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t[0].constructor===Array&&(t=t[0]),t.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(tt.utils=x(x({},tt.utils),e.utils)),se.mount(e)}))},tt.create=function(e,t){return new tt(e,t)},tt.version="1.15.2";var lt,ct,pt,dt,ut,gt,ht=[],mt=!1;function ft(){ht.forEach((function(e){clearInterval(e.pid)})),ht=[]}function vt(){clearInterval(gt)}var bt=ee((function(e,t,n,a){if(t.scroll){var i,o=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,l=t.scrollSpeed,c=H(),p=!1;ct!==n&&(ct=n,ft(),lt=t.scroll,i=t.scrollFn,!0===lt&&(lt=Z(n,!0)));var d=0,u=lt;do{var g=u,h=W(g),m=h.top,f=h.bottom,v=h.left,b=h.right,_=h.width,w=h.height,y=void 0,x=void 0,E=g.scrollWidth,k=g.scrollHeight,S=z(g),D=g.scrollLeft,C=g.scrollTop;g===c?(y=_<E&&("auto"===S.overflowX||"scroll"===S.overflowX||"visible"===S.overflowX),x=w<k&&("auto"===S.overflowY||"scroll"===S.overflowY||"visible"===S.overflowY)):(y=_<E&&("auto"===S.overflowX||"scroll"===S.overflowX),x=w<k&&("auto"===S.overflowY||"scroll"===S.overflowY));var T=y&&(Math.abs(b-o)<=s&&D+_<E)-(Math.abs(v-o)<=s&&!!D),P=x&&(Math.abs(f-r)<=s&&C+w<k)-(Math.abs(m-r)<=s&&!!C);if(!ht[d])for(var O=0;O<=d;O++)ht[O]||(ht[O]={});ht[d].vx==T&&ht[d].vy==P&&ht[d].el===g||(ht[d].el=g,ht[d].vx=T,ht[d].vy=P,clearInterval(ht[d].pid),0==T&&0==P||(p=!0,ht[d].pid=setInterval(function(){a&&0===this.layer&&tt.active._onTouchMove(ut);var t=ht[this.layer].vy?ht[this.layer].vy*l:0,n=ht[this.layer].vx?ht[this.layer].vx*l:0;"function"==typeof i&&"continue"!==i.call(tt.dragged.parentNode[ie],n,t,e,ut,ht[this.layer].el)||te(ht[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&u!==c&&(u=Z(u,!1)));mt=p}}),30),_t=function(e){var t=e.originalEvent,n=e.putSortable,a=e.dragEl,i=e.activeSortable,o=e.dispatchSortableEvent,r=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(t){var l=n||i;r();var c=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,p=document.elementFromPoint(c.clientX,c.clientY);s(),l&&!l.el.contains(p)&&(o("spill"),this.onSpill({dragEl:a,putSortable:n}))}};function wt(){}function yt(){}wt.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var a=V(this.sortable.el,this.startIndex,this.options);a?this.sortable.el.insertBefore(t,a):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:_t},S(wt,{pluginName:"revertOnSpill"}),yt.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:_t},S(yt,{pluginName:"removeOnSpill"}),tt.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?N(document,"dragover",this._handleAutoScroll):this.options.supportPointer?N(document,"pointermove",this._handleFallbackAutoScroll):t.touches?N(document,"touchmove",this._handleFallbackAutoScroll):N(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?I(document,"dragover",this._handleAutoScroll):(I(document,"pointermove",this._handleFallbackAutoScroll),I(document,"touchmove",this._handleFallbackAutoScroll),I(document,"mousemove",this._handleFallbackAutoScroll)),vt(),ft(),clearTimeout(F),F=void 0},nulling:function(){ut=ct=lt=mt=gt=pt=dt=null,ht.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,a=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,o=document.elementFromPoint(a,i);if(ut=e,t||this.options.forceAutoScrollFallback||T||C||O){bt(e,this.options,o,t);var r=Z(o,!0);!mt||gt&&a===pt&&i===dt||(gt&&vt(),gt=setInterval((function(){var o=Z(document.elementFromPoint(a,i),!0);o!==r&&(r=o,ft()),bt(e,n.options,o,t)}),10),pt=a,dt=i)}else{if(!this.options.bubbleScroll||Z(o,!0)===H())return void ft();bt(e,this.options,Z(o,!1),!1)}}},S(e,{pluginName:"scroll",initializeByDefault:!0})}),tt.mount(yt,wt);const xt=tt;let Et=null,kt=null,St=null;function Dt(e){const t=kt.parentNode.querySelector(".sharing-image-editor-warning");null!==t&&(t.classList.add("warning-visible"),t.textContent=e||wp.i18n.__("Unknown generation error","sharing-image"))}function Ct(){kt.classList.add("preview-loader");const e=new XMLHttpRequest;e.open("POST",ajaxurl),e.responseType="blob";const t=new window.FormData(St);t.set("action","sharing_image_show_preview"),function(){const e=kt.parentNode.querySelector(".sharing-image-editor-warning");null!==e&&e.classList.remove("warning-visible")}(),e.addEventListener("readystatechange",(()=>{2===e.readyState&&(e.responseType="json",200===e.status&&(e.responseType="blob"))})),e.addEventListener("load",(()=>{const t=e.response||{};if(kt.classList.remove("preview-blank","preview-loader"),200!==e.status)return Dt(t.data);let n=kt.querySelector("img");null===n&&(n=p.element("img",{append:kt})),n.src=window.URL.createObjectURL(t)})),e.addEventListener("error",(()=>{Dt(),kt.classList.remove("preview-blank","preview-loader")})),e.send(t)}function Tt(e,n,a){const i=[],o=p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[x]",value:a.x,placeholder:"0"},dataset:{dimension:"x"},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[y]",value:a.y,placeholder:"0"},dataset:{dimension:"y"},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[width]",value:a.width},dataset:{dimension:"width"},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[height]",value:a.height},dataset:{dimension:"height"},label:wp.i18n.__("Height","sharing-image")}],append:e});!function(e,n,a){const i=p.control({classes:["sharing-image-editor-control","control-pulled"],append:e});p.element("button",{classes:["sharing-image-editor-more"],text:wp.i18n.__("Utilize image as the poster background.","sharing-image"),attributes:{type:"button"},append:i}).addEventListener("click",(()=>{const e={};return n.querySelectorAll("input").forEach((t=>{e[t.dataset.dimension]=t})),e.x.value=0,e.y.value=0,e.width.value=t.dataget(St,"editor","width"),e.height.value=t.dataget(St,"editor","height"),s(),void Ct()}))}(e,o),Ot(e,n,a),i[i.length]=p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Image resizing principle","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"center"},label:wp.i18n.__("Center image while preserving the aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"top"},label:wp.i18n.__("Top-aligned image while preserving the aspect ratio.","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"bottom"},label:wp.i18n.__("Bottom-aligned image while preserving aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"ignore"},label:wp.i18n.__("Resize while ignoring the aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"crop"},label:wp.i18n.__("Center-crop the image","sharing-image"),checked:a.resize||"center"}],append:e});const r=[];o.querySelectorAll("input").forEach((e=>{["width","height"].includes(e.dataset.dimension)&&r.push(e)}));const s=()=>{let e=!1;r.forEach((t=>{t.value.length<1&&(e=!0)})),i.forEach((t=>{t.classList.toggle("control-disabled",e)}))};s(),r.forEach((e=>{e.addEventListener("input",s)}))}function Pt(e,t){const n=e.querySelector("h2 > span");if(null===n)return;const a={},i=": ";e.querySelectorAll("[data-caption]").forEach((e=>{a[e.dataset.caption]=e,e.addEventListener("keyup",(()=>{n.textContent=e.value?i+e.value:""}))})),n.textContent=i+a.content.value,t.checked&&(n.textContent=i+a.title.value),n.textContent===i&&(n.textContent="")}function Ot(e,t,n){p.control({classes:["sharing-image-editor-control","control-extend","control-pulled","control-upnext"],label:wp.i18n.__("Relative boundaries","sharing-image"),fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{absolute:wp.i18n.__("No Relative Positioning","sharing-image"),vertically:wp.i18n.__("Vertical Only","sharing-image"),horizontally:wp.i18n.__("Horizontal Only","sharing-image"),both:wp.i18n.__("Both Directions Alignment","sharing-image")},attributes:{name:t+"[boundary]"},selected:n.boundary}],help:wp.i18n.__("Using offset from previous layer.","sharing-image"),append:e})}function Lt(e,t){const n=[];n.push(wp.i18n.__("Write text on the current image.","sharing-image")),n.push(wp.i18n.__("If the font does not fit within your limits, its size will decrease.","sharing-image")),n.push(wp.i18n.__("Avoid using large font sizes for long text as it affects performance.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Text","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"text"},append:a}),p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[x]",value:e.x,placeholder:"10"},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[y]",value:e.y,placeholder:"10"},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[width]",value:e.width,placeholder:"1000"},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[height]",value:e.height},label:wp.i18n.__("Height","sharing-image")}],append:a}),Ot(a,t,e),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[dynamic]",value:"dynamic"},label:wp.i18n.__("Dynamic field. Filled in on the post editing screen.","sharing-image"),checked:n.dynamic},a),o=[];o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend","control-hidden"],help:wp.i18n.__("Only visible on the admin side.","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:t+"[title]",value:n.title},dataset:{caption:"title"},label:wp.i18n.__("Field name","sharing-image")}],append:e}),o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend","control-hidden"],help:wp.i18n.__("This field is for demonstration only, to preview the editor’s appearance.","sharing-image"),fields:[{group:"textarea",classes:["sharing-image-editor-control-textarea"],content:n.sample||"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",attributes:{name:t+"[sample]",rows:2},label:wp.i18n.__("Text sample","sharing-image")}],append:e});const r=p.control({classes:["sharing-image-editor-control","control-hidden"],label:wp.i18n.__("Preset text field","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"none"},dataset:{persistent:!0},label:wp.i18n.__("Fill in manually","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"title"},dataset:{persistent:!0},label:wp.i18n.__("Take from post title","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"excerpt"},dataset:{persistent:!0},label:wp.i18n.__("Use post excerpt text","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"categories"},dataset:{persistent:!0},label:wp.i18n.__("Use post categories","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"tags"},dataset:{persistent:!0},label:wp.i18n.__("Use post tags","sharing-image"),checked:n.preset||"none"}],append:e});o[o.length]=r,o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend"],help:wp.i18n.__("You can use non-breaking spaces to adjust your string position.","sharing-image"),fields:[{group:"textarea",classes:["sharing-image-editor-control-textarea"],content:n.content,attributes:{name:t+"[content]",rows:2},dataset:{caption:"content"},label:wp.i18n.__("Content","sharing-image")}],append:e});const s=()=>{o.forEach((e=>{e.classList.toggle("control-hidden")}))};i.checked&&s(),i.addEventListener("change",(()=>{s(),Pt(e,i)})),Pt(e,i)}(a,t,e),function(e,t,n){const a=[];a[a.length]=function(e,t,n){const a=p.control({classes:["sharing-image-editor-control","control-upload","control-hidden"],append:e}),i=p.select({classes:["sharing-image-editor-control-select"],options:Et.fonts,attributes:{name:t+"[fontname]"},label:wp.i18n.__("Font family","sharing-image"),selected:n.fontname},a),o=p.media({name:t+"[fontfile]",classes:["sharing-image-editor-control-media"],value:n.fontfile,link:Et.links.uploads,labels:{button:wp.i18n.__("Upload custom font","sharing-image"),heading:wp.i18n.__("Upload custom font","sharing-image"),details:wp.i18n.__("Font attachment","sharing-image"),remove:wp.i18n.__("Remove font","sharing-image")},remove:!0,mime:["font/ttf","font/otf"],append:a});p.element("small",{text:wp.i18n.__("Custom fonts can only be in .ttf or .otf format.","sharing-image"),append:a}),n.fontfile&&(i.disabled=!0);const r=o.querySelector("input");return r.addEventListener("change",(()=>{i.disabled=!1,r.value&&(i.disabled=!0)})),a}(e,t,n),a[a.length]=p.control({classes:["sharing-image-editor-control","control-hidden"],fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{type:"color",name:t+"[color]",value:n.color||"#ffffff"},label:wp.i18n.__("Text color","sharing-image")}],append:e}),a[a.length]=p.control({classes:["sharing-image-editor-control","control-series","control-hidden"],fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{left:wp.i18n.__("Left","sharing-image"),center:wp.i18n.__("Center","sharing-image"),right:wp.i18n.__("Right","sharing-image")},attributes:{name:t+"[horizontal]"},label:wp.i18n.__("Horizontal alignment","sharing-image"),selected:n.horizontal},{group:"select",classes:["sharing-image-editor-control-select"],options:{top:wp.i18n.__("Top","sharing-image"),center:wp.i18n.__("Center","sharing-image"),bottom:wp.i18n.__("Bottom","sharing-image")},attributes:{name:t+"[vertical]"},label:wp.i18n.__("Vertical alignment","sharing-image"),selected:n.vertical}],append:e});const i=p.control({classes:["sharing-image-editor-control"],append:e}),o=p.element("button",{classes:["sharing-image-editor-more"],text:wp.i18n.__("More options","sharing-image"),attributes:{type:"button"},append:i});o.addEventListener("click",(()=>{a.forEach((e=>{e.classList.remove("control-hidden")})),e.removeChild(i)})),Object.keys(n).length>0&&o.click()}(a,t,e),p.control({classes:["sharing-image-editor-control","control-series"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[fontsize]",min:10,max:200,step:1,value:e.fontsize||"48"},label:wp.i18n.__("Font size","sharing-image")},{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[lineheight]",min:0,max:4,step:.125,value:e.lineheight||"1.5"},label:wp.i18n.__("Line height","sharing-image")}],append:a}),p.element("input",{attributes:{type:"hidden",name:t+"[separator]",value:", "},append:a}),a}function At(e,n,a={}){let i=null;const o=a.uniqid||t.uniqid(),r=Et.name+`[layers][${o}]`;switch(n){case"text":i=Lt(a,r);break;case"image":i=function(e,t){const n=[];n.push(wp.i18n.__("Use JPG, GIF, or PNG image formats.","sharing-image")),n.push(wp.i18n.__("Leave the width and height fields blank to use the original image size.","sharing-image")),n.push(wp.i18n.__("Sizes are calculated proportionally if not specified.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-image"],label:wp.i18n.__("Image","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"image"},append:a}),p.control({classes:["sharing-image-editor-control","control-extend"],help:wp.i18n.__("Only visible on the admin side.","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:t+"[title]",value:e.title},dataset:{caption:"title"},label:wp.i18n.__("Field name","sharing-image")}],append:a}),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control","control-gapped"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[dynamic]",value:"dynamic"},label:wp.i18n.__("Dynamic image. Can be updated on the post editing screen.","sharing-image"),checked:n.dynamic},a);p.media({name:t+"[attachment]",classes:["sharing-image-editor-control-media"],value:n.attachment,link:Et.links.uploads,labels:{button:wp.i18n.__("Select an image","sharing-image"),heading:wp.i18n.__("Select layer image","sharing-image"),details:wp.i18n.__("Attachment details","sharing-image"),remove:wp.i18n.__("Remove image","sharing-image")},append:a,image:!0,remove:!0,help:wp.i18n.__("This field is for demonstration only, to preview the editor’s appearance.","sharing-image"),mime:["image/png","image/jpeg","image/gif","image/webp"]});const o=[],r=p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Preset image field","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"none"},dataset:{persistent:!0},label:wp.i18n.__("Manual selection","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"featured"},dataset:{persistent:!0},label:wp.i18n.__("Use Post Featured Image","sharing-image"),checked:n.preset||"featured"}],append:e});o[o.length]=r;const s=()=>{o.forEach((e=>{e.classList.toggle("control-hidden")})),a.classList.add("control-unhelp"),i.checked&&a.classList.remove("control-unhelp")};i.checked||s(),i.addEventListener("change",(()=>{s()}))}(a,t,e),Tt(a,t,e),a}(a,r);break;case"filter":i=function(e,t){const n=[];n.push(wp.i18n.__("Filters are applied sequentially to the entire editor image.","sharing-image")),n.push(wp.i18n.__("If you want to control their order, create multiple layers.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Filter","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"filter"},append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"checkbox",classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[grayscale]",value:"grayscale"},label:wp.i18n.__("Converts the image into a grayscale version","sharing-image"),checked:e.grayscale}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"checkbox",classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[blur]",value:"blur"},label:wp.i18n.__("Blur image by Gaussian effect","sharing-image"),checked:e.blur}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[contrast]",min:-50,max:50,step:5,value:e.contrast||"0"},label:wp.i18n.__("Contrast","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[brightness]",min:-50,max:50,step:5,value:e.brightness||"0"},label:wp.i18n.__("Brightness","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[blackout]",min:0,max:100,step:5,value:e.blackout||"0"},label:wp.i18n.__("Blackout","sharing-image")}],append:a}),a}(a,r);break;case"rectangle":i=function(e,t){const n=[];n.push(wp.i18n.__("Draw a colored rectangle on the current image.","sharing-image")),n.push(wp.i18n.__("You can get a filled or outlined figure with custom color and opacity.","sharing-image")),n.push(wp.i18n.__("Use a small height to draw the line.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Rectangle","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"rectangle"},append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{type:"color",name:t+"[color]",value:e.color||"#ffffff"},label:wp.i18n.__("Rectangle color","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[x]"||0,value:e.x},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[y]"||0,value:e.y},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[width]",value:e.width},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[height]",value:e.height},label:wp.i18n.__("Height","sharing-image")}],append:a}),Ot(a,t,e),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[outline]",value:"outline"},label:wp.i18n.__("Outline rectangle.","sharing-image"),checked:n.outline},a),o=p.control({classes:["sharing-image-editor-control","control-hidden"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[thickness]",min:0,max:50,step:1,value:n.thickness||"0"},label:wp.i18n.__("Border width","sharing-image")}],append:e});n.outline&&o.classList.remove("control-hidden"),i.addEventListener("change",(()=>{o.classList.add("control-hidden"),i.checked&&o.classList.remove("control-hidden")}))}(a,t,e),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[opacity]",min:0,max:100,step:5,value:e.opacity||"0"},label:wp.i18n.__("Opacity","sharing-image")}],append:a}),a}(a,r);break;default:return null}return e.appendChild(i),function(e,t){const n=p.control({classes:["sharing-image-editor-control","control-footer"],append:t});p.element("button",{classes:["sharing-image-editor-delete"],text:wp.i18n.__("Delete layer","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{e.removeChild(t),St.classList.contains("editor-suspend")||Ct()}))}(e,i),function(e,t,n){const a=e.querySelector("h2"),i=p.element("button",{classes:["sharing-image-editor-collapse"],attributes:{type:"button",title:wp.i18n.__("Collapse layer","sharing-image")},prepend:a});let o=1===t.collapsed;o&&e.classList.add("layer-collapsed");const r=p.element("input",{attributes:{type:"hidden",name:n+"[collapsed]",value:Number(o)},append:e});i.addEventListener("click",(t=>{t.preventDefault(),o=!o,e.classList.toggle("layer-collapsed",o),i.setAttribute("title",wp.i18n.__("Collapse layer","sharing-image")),o&&i.setAttribute("title",wp.i18n.__("Expand layer","sharing-image")),r.value=Number(o)}))}(i,a,r),function(e,t){p.element("button",{classes:["sharing-image-editor-order"],attributes:{type:"button",title:wp.i18n.__("Change layer position","sharing-image")},append:t}),xt.create(e,{handle:".sharing-image-editor-order",onUpdate:()=>{St.classList.contains("editor-suspend")||Ct()}})}(e,i),i}const Mt=function(e,t,n,a={}){Et=t,St=function(e,t){Et.name="sharing_image_editor";const n=p.element("form",{classes:["sharing-image-editor"],attributes:{action:Et.links.action,method:"POST"},append:e});return Et.config.suspend&&n.classList.add("editor-suspend"),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_save_editor"},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_index",value:t},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:Et.nonce},append:n}),n.addEventListener("submit",(e=>{e.preventDefault(),function(){const e=new XMLHttpRequest;e.open("POST",ajaxurl),e.responseType="json",kt.classList.add("preview-loader");const t=new window.FormData(St);t.set("action","sharing_image_save_preview"),e.addEventListener("load",(()=>{const t=e.response||{};if(!t.data)return Dt();if(!t.success)return kt.classList.remove("preview-loader"),Dt(t.data);const n=kt.querySelector("input");null!==n&&(n.value=t.data),St.submit()})),e.addEventListener("error",(()=>{kt.classList.remove("preview-loader"),Dt()})),e.send(t)}()})),n}(e,n),function(e){const t=p.element("div",{classes:["sharing-image-editor-monitor"],append:St}),n=p.element("div",{classes:["sharing-image-editor-viewport"],append:t});!function(e,t){kt=p.element("div",{classes:["sharing-image-editor-preview","preview-blank"],append:e}),t.preview&&(p.element("img",{attributes:{src:t.preview,alt:""},append:kt}),kt.classList.remove("preview-blank")),p.element("span",{classes:["sharing-image-editor-loader"],append:kt}),p.element("input",{attributes:{type:"hidden",name:Et.name+"[preview]",value:t.preview},append:kt})}(n,e),p.element("div",{classes:["sharing-image-editor-warning"],append:n});const a=p.element("div",{classes:["sharing-image-editor-manager"],append:n});!function(e,t){p.checkbox({classes:["sharing-image-editor-debug"],attributes:{name:Et.name+"[debug]",value:"debug"},label:wp.i18n.__("Show debug frames","sharing-image"),checked:t.debug},e).addEventListener("change",(()=>{Ct()}))}(a,e),function(e){p.element("button",{text:wp.i18n.__("Save changes","sharing-image"),classes:["button","button-primary"],attributes:{type:"submit"},append:e})}(a),function(e){p.element("button",{text:wp.i18n.__("Generate preview","sharing-image"),classes:["button"],attributes:{type:"button"},append:e}).addEventListener("click",(()=>{Ct()}))}(a)}(a),function(e){const t=p.element("div",{classes:["sharing-image-editor-fieldset"],append:St});p.control({classes:["sharing-image-editor-control","control-compact","control-extend"],help:wp.i18n.__("Used only in the admin panel","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[title]",value:e.title},dataset:{persistent:!0,editor:"title"},label:wp.i18n.__("Template title","sharing-image")}],append:t}),p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Fill color","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{name:Et.name+"[fill]",type:"color",value:e.fill},dataset:{editor:"fill"}}],append:t}),p.control({classes:["sharing-image-editor-control","control-compact","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[width]",value:e.width||"1200",placeholder:"1200",maxlength:4},dataset:{editor:"width"},label:wp.i18n.__("Editor width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[height]",value:e.height||"630",placeholder:"630",maxlength:4},dataset:{editor:"height"},label:wp.i18n.__("Editor height","sharing-image")}],append:t});const n=[];n.push(wp.i18n.__("You can add multiple layers on your editor.","sharing-image")),n.push(wp.i18n.__("Note that the stacking order of the layers is important.","sharing-image")),n.push(wp.i18n.__("You can change the order using the icon in the corner of each box.","sharing-image")),p.control({classes:["sharing-image-editor-control","control-reduced"],label:wp.i18n.__("Add layers","sharing-image"),description:n.join(" "),append:t}),function(e,t){const n=p.control({classes:["sharing-image-editor-control","control-select","control-compact"],fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{text:wp.i18n.__("Text","sharing-image"),image:wp.i18n.__("Image","sharing-image"),filter:wp.i18n.__("Filter","sharing-image"),rectangle:wp.i18n.__("Rectangle","sharing-image")}}],append:e});p.element("button",{classes:["button"],text:wp.i18n.__("Add new","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{const e=n.querySelector("select");null!==e&&At(a,e.value).scrollIntoView({behavior:"smooth"})}));const a=p.element("div",{classes:["sharing-image-editor-designer"],append:e});t.layers=t.layers||{};for(const e in t.layers){const n=t.layers[e];if(n.uniqid=e,n.hasOwnProperty("type")&&!At(a,n.type,n))return}}(t,e);const a=p.control({classes:["sharing-image-editor-control","control-footer"],append:t});!function(e){const t=new URL(document.location.href);t.searchParams.delete("template"),p.element("a",{classes:["button"],text:wp.i18n.__("← Back to Catalog","sharing-image"),attributes:{href:t.href},append:e})}(a),function(e){const t=new URL(document.location.href).searchParams.get("template"),n=new URL(Et.links.action);n.searchParams.set("action","sharing_image_delete_template"),n.searchParams.set("template",t),n.searchParams.set("nonce",Et.nonce),p.element("a",{classes:["sharing-image-editor-delete"],text:wp.i18n.__("Delete template","sharing-image"),attributes:{href:n.href},append:e}).addEventListener("click",(e=>{const t=wp.i18n.__("Are you sure you want to delete this template?","sharing-image");confirm(t)||e.preventDefault()}))}(a),t.addEventListener("change",(e=>{if(St.classList.contains("editor-suspend"))return;const t=e.target;t.hasAttribute("data-persistent")||t.hasAttribute("name")&&Ct()}))}(a)};let Nt=null;!function(){if(void 0===wp)return;let e=window.sharingImageSettings||{};e=t.defaults(e,["links","fonts","config","templates","license"]);const n=document.querySelector("#sharing-image-settings .sharing-image-content");if(null!==n)switch(n.classList.add("content-visible"),t.param("tab")){case"config":!function(e,t){!function(e,t){Nt=t,Nt.name="sharing_image_config";const n=e.querySelector(".sharing-image-config");if(null===n)return;const a=p.element("form",{classes:["sharing-image-config-options"],attributes:{action:Nt.links.action,method:"POST"},append:n}),i=Nt.config||{},o=Nt.templates||[];!function(e,t){const n=p.control({classes:["sharing-image-config-control","control-extra"],label:wp.i18n.__("Poster image format","sharing-image"),help:wp.i18n.__("The higher the value, the less compression. Availible for JPEG only.","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:{jpg:wp.i18n.__("JPEG","sharing-image"),png:wp.i18n.__("PNG","sharing-image"),gif:wp.i18n.__("GIF","sharing-image")},attributes:{name:Nt.name+"[format]"},selected:t.format||"jpg"},{group:"input",classes:["sharing-image-config-control-range"],attributes:{type:"range",name:Nt.name+"[quality]",min:10,max:100,step:5,value:t.quality||"90",disabled:"disabled"},label:wp.i18n.__("Image quality","sharing-image")}],append:e}),a=n.querySelector("select"),i=n.querySelector("input");"jpg"===a.value&&(i.disabled=!1),a.addEventListener("change",(()=>{i.disabled=!0,"jpg"===a.value&&(i.disabled=!1)}))}(a,i),function(e,t,n){const a={};a[""]=wp.i18n.__("Disable auto generation","sharing-image");for(const e in n)a[e]=n[e].title||wp.i18n.__("Untitled","sharing-image");let i=t.autogenerate;void 0===i&&(i=""),p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Auto generate poster","sharing-image"),help:wp.i18n.__("This template will be applied automatically when the post is saved.","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:a,attributes:{name:Nt.name+"[autogenerate]"},selected:String(i)}],append:e})}(a,i,o),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Hide post widget","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[nowidget]",value:"nowidget"},label:wp.i18n.__("Hide the widget on the post editor page","sharing-image"),checked:t.nowidget}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control","control-extra"],label:wp.i18n.__("Header Meta Tags","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:{snippets:wp.i18n.__("Display Meta Tags with consideration for SEO plugins","sharing-image"),custom:wp.i18n.__("Always display Meta Tags on all pages","sharing-image"),hidden:wp.i18n.__("Hide Sharing Image Meta Tags","sharing-image")},attributes:{name:Nt.name+"[meta]"},selected:t.meta||"snippets"}],append:e});if(0===Nt.snippets.length)return n;p.element("h4",{text:wp.i18n.__("Detected SEO plugins","sharing-image"),append:n});const a=p.element("ul",{classes:["sharing-image-config-control-list"],append:n});Nt.snippets.forEach((e=>{const t=p.element("li",{append:a});p.element("a",{attributes:{href:e.link,target:"_blank",rel:"noopener"},text:e.title,append:t})}))}(a,i),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Poster attachment","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[attachment]",value:"attachment"},label:wp.i18n.__("Save the generated poster as an attachment in the media library","sharing-image"),checked:t.attachment}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Upload directory","sharing-image"),append:e}),a=p.element("div",{classes:["sharing-image-config-control-fieldset"],append:n});p.radio({classes:["sharing-image-config-control-radio"],attributes:{name:Nt.name+"[uploads]",value:"default"},label:wp.i18n.__("Use default uploads directory","sharing-image"),checked:t.uploads||"default"},a),p.radio({classes:["sharing-image-config-control-radio"],attributes:{name:Nt.name+"[uploads]",value:"custom"},label:wp.i18n.__("Select custom storage for posters","sharing-image"),checked:t.uploads||"default"},a);const i=p.input({classes:["sharing-image-config-control-input"],attributes:{name:Nt.name+"[storage]",value:t.storage||Nt.links.storage,disabled:"disabled"}},n);p.element("small",{text:wp.i18n.__("Use a relative path from the site root. The directory should be writable.","sharing-image"),append:n}),n.querySelectorAll("input").forEach((e=>{"radio"===e.type&&(e.checked&&"custom"===e.value&&(i.disabled=!1),e.addEventListener("change",(()=>{i.disabled=!0,"custom"===e.value&&(i.disabled=!1)})))}))}(a,i),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Live-reload","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[suspend]",value:"suspend"},label:wp.i18n.__("Disable live reload on the template editor screen.","sharing-image"),checked:t.suspend}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Default poster","sharing-image"),append:e});p.media({name:Nt.name+"[default]",classes:["sharing-image-config-control-media"],value:t.default,link:Nt.links.uploads,labels:{button:wp.i18n.__("Upload image","sharing-image"),heading:wp.i18n.__("Select default poster","sharing-image"),details:wp.i18n.__("Attachment details","sharing-image"),remove:wp.i18n.__("Remove image","sharing-image")},image:!0,remove:!0,append:n});const a=[];a.push(wp.i18n.__("The default poster is used on pages where none is generated.","sharing-image")),a.push(wp.i18n.__("Best image size: 1200×630 pixels.","sharing-image")),p.element("small",{text:a.join(" "),append:n})}(a,i),function(e,t){p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_save_config"},append:e}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:Nt.nonce},append:e}),p.element("input",{attributes:{type:"hidden",name:Nt.name+"[demo]",value:t.demo||""},append:e}),p.element("button",{text:wp.i18n.__("Save changes","sharing-image"),classes:["button","button-primary"],attributes:{type:"submit"},append:e})}(a,i)}(e,t)}(n,e);break;case"tools":!function(e,t){!function(e,t){d=t;const n=e.querySelector(".sharing-image-tools");null!==n&&(function(e){const t=d.templates||[],n=p.control({classes:["sharing-image-tools-control","control-section"],label:wp.i18n.__("Clone template","sharing-image"),append:e}),a=p.element("p",{classes:["sharing-image-tools-warning"],text:wp.i18n.__("To initiate cloning, enable Premium and have at least one template.","sharing-image")}),i=d.license||{};if(0===t.length||!i.premium&&!i.develop)return n.appendChild(a);const o={};for(const e in t)o[e]=t[e].title||wp.i18n.__("Untitled","sharing-image");const r=p.element("form",{classes:["sharing-image-tools-control-cloning"],attributes:{action:d.links.action,method:"POST"},append:n}),s=p.select({classes:["sharing-image-tools-control-duplicator"],options:o,attributes:{name:"sharing_image_source"}},r);p.element("button",{classes:["button","button-primary"],attributes:{type:"submit"},text:wp.i18n.__("Create a copy","sharing-image"),append:s.parentNode}),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_clone_template"},append:r}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:d.nonce},append:r})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control"],label:wp.i18n.__("Export templates","sharing-image"),append:e}),n=p.element("div",{classes:["sharing-image-tools-control-fieldset"],append:t}),a=new URL(d.links.action);a.searchParams.set("action","sharing_image_export_templates"),a.searchParams.set("nonce",d.nonce),p.element("a",{classes:["button","button-primary"],text:wp.i18n.__("Download backup file","sharing-image"),attributes:{href:a.href},append:n}),p.element("small",{text:wp.i18n.__("Save a local copy of all template settings for later use.","sharing-image"),append:n})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control","control-section"],label:wp.i18n.__("Import templates","sharing-image"),append:e}),n=p.element("form",{classes:["sharing-image-tools-control-uploader"],attributes:{action:d.links.action,method:"POST",enctype:"multipart/form-data"},append:t});p.element("input",{classes:["sharing-image-tools-control-file"],attributes:{type:"file",name:"sharing_image_file",accept:"application/json",required:"required"},append:n}),p.element("button",{classes:["button","button-primary"],attributes:{type:"submit"},text:wp.i18n.__("Import templates","sharing-image"),append:n}),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_import_templates"},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:d.nonce},append:n})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control"],label:wp.i18n.__("Clearing settings","sharing-image"),append:e}),n=p.element("div",{classes:["sharing-image-tools-control-fieldset"],append:t}),a=new URL(d.links.action);a.searchParams.set("action","sharing_image_clear_templates"),a.searchParams.set("nonce",d.nonce),p.element("a",{classes:["sharing-image-tools-delete","button"],text:wp.i18n.__("Remove posters","sharing-image"),attributes:{href:a.href},append:n}).addEventListener("click",(e=>{const t=wp.i18n.__("Are you sure you want to clear plugin data?","sharing-image");confirm(t)||e.preventDefault()})),p.element("small",{text:wp.i18n.__("This action clears post meta options but does not delete server images.","sharing-image"),append:n})}(n))}(e,t)}(n,e);break;case"premium":!function(e,t){!function(e,t){h=t,m=e.querySelector(".sharing-image-premium"),null!==m&&(p.element("div",{classes:["sharing-image-premium-warning"],append:m}),w())}(e,t)}(n,e);break;default:!function(e,n){let a=null;n.templates=n.templates||[],t.param("template")&&(a=t.param("template"));const i=n.templates[a];void 0!==i?Mt(e,n,a,i):null===a?function(e,t){u=t;const n=p.element("div",{classes:["sharing-image-catalog"],append:e});for(const e in t.templates)g(n,t.templates[e],e);!function(e,t){const n=new URL(document.location.href);n.searchParams.set("template",t);const a=p.element("a",{classes:["sharing-image-catalog-new"],attributes:{href:n.href},append:e}),i=p.element("h2",{append:a});if(p.element("strong",{text:wp.i18n.__("Add new template","sharing-image"),append:i}),0===u.templates.length)return;const o=u.license||{};o.premium||o.develop||(p.element("span",{text:wp.i18n.__("(Availible for Premium only)","sharing-image"),append:i}),u.links.premium&&(a.href=u.links.premium))}(n,t.index)}(e,n):Mt(e,n,a)}(n,e)}}()})();
     1(()=>{"use strict";let e=e=>crypto.getRandomValues(new Uint8Array(e));const t={param:function(e){return new URL(document.location.href).searchParams.get(e)},attachment:function(e,t){if(e.hasOwnProperty("multiple")||(e.multiple=!1),!wp.media)return;const n=wp.media(e);n.on("select",(()=>{const e=n.state().get("selection").first().toJSON();e.id&&t(e.id)})),n.open()},defaults:function(e,t){return t.forEach((t=>{void 0===e[t]&&(e[t]={})})),e},uniqid:function(){return((t,n=21)=>((e,t,n)=>{let a=(2<<Math.log(e.length-1)/Math.LN2)-1,i=-~(1.6*a*t/e.length);return(o=t)=>{let r="";for(;;){let t=n(i),s=i;for(;s--;)if(r+=e[t[s]&a]||"",r.length===o)return r}}})(t,n,e))("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",12)()},dataget:function(e,t,n){const a=e.querySelector(`[data-${t}="${n}"]`);if(a)return a.value}},n=function(e,t={}){const n=document.createElement(e);if(t.hasOwnProperty("classes")&&t.classes.forEach((e=>{n.classList.add(e)})),t.hasOwnProperty("text")&&(n.textContent=t.text),t.hasOwnProperty("html")&&(n.innerHTML=t.html),t.hasOwnProperty("attributes"))for(const e in t.attributes){const a=t.attributes[e];void 0!==a&&n.setAttribute(e,a)}if(t.hasOwnProperty("dataset"))for(const e in t.dataset)n.setAttribute("data-"+e,t.dataset[e]);return t.hasOwnProperty("append")&&t.append.appendChild(n),t.hasOwnProperty("prepend")&&t.prepend.insertBefore(n,t.prepend.firstChild),n},a=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("input",{attributes:{type:"text"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if("range"===i.type){const e=p.element("em",{text:i.value,attributes:{title:wp.i18n.__("Click to change the input view.","sharing-image")},append:a});i.addEventListener("change",(()=>{e.textContent=i.value})),i.addEventListener("input",(()=>{e.textContent=i.value})),e.addEventListener("click",(()=>{i.type="text"===i.type?"range":"text"}))}return i},i=function(e,t){const a=n("label",{classes:e.classes||[],append:t}),i=n("input",{attributes:{type:"checkbox"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("checked")){const t=e.checked;t&&t===i.value&&i.setAttribute("checked","checked")}if(e.hasOwnProperty("label")){const t=n("span",{text:e.label});null!==e.label&&a.appendChild(t)}return i},o=function(e,t){const a=n("label",{classes:e.classes||[],append:t}),i=n("input",{attributes:{type:"radio"},dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("checked")){const t=e.checked;t&&t===i.value&&i.setAttribute("checked","checked")}if(e.hasOwnProperty("label")){const t=n("span",{text:e.label});null!==e.label&&a.appendChild(t)}return e.hasOwnProperty("help")&&n("small",{text:e.help,append:a}),i},r=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("select",{dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}const o=e.options||{};for(const t in o){const a=n("option",{text:o[t],attributes:{value:t},append:i});if(e.hasOwnProperty("selected")){const t=e.selected;t&&t===a.value&&a.setAttribute("selected","selected")}}return i},s=function(e,t){const a=n("div",{classes:e.classes||[],append:t});if(e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}const i=n("textarea",{dataset:e.dataset||{},append:a});if(e.hasOwnProperty("attributes"))for(const t in e.attributes){const n=e.attributes[t];void 0!==n&&i.setAttribute(t,n)}if(e.hasOwnProperty("content")){const t=e.content;void 0!==t&&(i.innerHTML=t)}return i},l=function(e){const t=n("div",{classes:e.classes||[]});return e.hasOwnProperty("append")&&e.append.appendChild(t),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(t,e.prepend.firstChild),e.hasOwnProperty("label")&&n("h3",{text:e.label,append:t}),e.hasOwnProperty("description")&&n("p",{text:e.description,append:t}),e.hasOwnProperty("fields")&&e.fields.forEach((e=>{switch(e.group){case"input":a(e,t);break;case"textarea":s(e,t);break;case"radio":o(e,t);break;case"select":r(e,t);break;case"checkbox":i(e,t)}})),e.hasOwnProperty("help")&&n("small",{text:e.help,append:t}),t};function c(e,t){let a=e.querySelector("figure");if(a&&e.removeChild(a),!wp.media)return;if(a=n("figure",{prepend:e}),e.querySelector("h4")&&e.insertBefore(a,e.querySelector("h4").nextSibling),!t)return;let i=a.querySelector("img");i&&a.removeChild(i),i=n("img",{append:a}),wp.media.attachment(t).fetch().then((e=>{i.src=e.sizes?.thumbnail?.url||e.url}))}const p={element:n,control:l,layer:function(e){const t=n("div",{classes:e.classes||[]});e.hasOwnProperty("append")&&e.append.appendChild(t),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(t,e.prepend.firstChild),e.hasOwnProperty("label")||(e.label="");const a=n("h2",{text:e.label,append:t});return n("span",{append:a}),e.hasOwnProperty("description")&&n("h5",{text:e.description,append:t}),t},checkbox:i,media:function(e){const a=l({classes:e.classes||[]});if(e.hasOwnProperty("append")&&e.append.appendChild(a),e.hasOwnProperty("prepend")&&e.prepend.insertBefore(a,e.prepend.firstChild),e.hasOwnProperty("label")){const t=n("h4",{text:e.label});null!==e.label&&a.appendChild(t)}e.labels=e.labels||{};const i=n("input",{attributes:{type:"hidden",name:e.name},append:a}),o=n("button",{classes:["button"],text:e.labels.button,attributes:{type:"button"},append:a}),r=n("a",{classes:["hidden"],text:e.labels.details,attributes:{target:"_blank"}});e.hasOwnProperty("link")&&a.appendChild(r),e.hasOwnProperty("help")&&n("small",{text:e.help,append:a});const s=t=>{i.setAttribute("value",t),i.dispatchEvent(new Event("change",{bubbles:!0}));let n=null;e.hasOwnProperty("link")&&(n=new URL(e.link),n.searchParams.set("item",t),r.setAttribute("href",n.href)),e.remove&&(o.textContent=e.labels.remove),e.image&&c(a,t),r.classList.remove("hidden")},p=()=>{i.setAttribute("value",""),i.dispatchEvent(new Event("change",{bubbles:!0})),o.textContent=e.labels.button,e.image&&c(a,0),r.classList.add("hidden")};return e.image&&c(a,0),e.value&&s(e.value),o.addEventListener("click",(()=>{if(e.remove&&i.value)return p();const n={title:e.labels.heading};e.hasOwnProperty("mime")&&(n.library={},n.library.type=e.mime),t.attachment(n,(e=>{s(e)}))})),a.addEventListener("set_attachment",(e=>{e.detail&&s(e.detail)})),a.addEventListener("remove_attachment",(()=>{p()})),a},input:a,textarea:s,radio:o,select:r};let d=null;let u=null;function g(e,t,n){const a=p.element("div",{classes:["sharing-image-catalog-card"],append:e}),i=p.element("figure",{classes:["sharing-image-catalog-preview"],append:a});t.preview&&p.element("img",{attributes:{src:t.preview,alt:""},append:i});const o=p.element("footer",{classes:["sharing-image-catalog-footer"],append:a});p.element("h2",{text:t.title||wp.i18n.__("Untitled","sharing-image"),append:o});const r=new URL(document.location.href);r.searchParams.set("template",n),p.element("a",{classes:["button"],text:wp.i18n.__("Edit template","sharing-image"),attributes:{href:r.href},append:o})}let h=null,m=null;function f(e,t){const n=[];switch(void 0===t&&(t=wp.i18n.__("Verification unsuccessful.","sharing-image")),n.push(t),e){case"LIMIT_EXCEEDED":n.push(wp.i18n.__("The number of licenses for this key has been exceeded.","sharing-image"));break;case"KEY_NOT_FOUND":n.push(wp.i18n.__("The Premium key is invalid or expired.","sharing-image"));break;case"SERVER_ERROR":n.push(wp.i18n.__("Unable to receive a response from the verification server.","sharing-image"))}return n.join(" ")}function v(e){const t=m.querySelector(".sharing-image-premium-warning");null!==t&&(t.classList.add("warning-visible"),t.textContent=e||wp.i18n.__("Unknown request error.","sharing-image"))}function b(){const e=m.querySelector(".sharing-image-premium-warning");null!==e&&e.classList.remove("warning-visible")}function _(e,t){m.classList.add("premium-enabled"),t.develop?v(wp.i18n.__("Using the plugin with a development license is prohibited in production.","sharing-image")):(t.key&&function(e,t){const n=p.element("div",{classes:["sharing-image-premium-permit"],append:e});p.element("button",{classes:["sharing-image-premium-show","button"],text:wp.i18n.__("Show License key","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{n.classList.toggle("permit-visible")})),p.element("strong",{text:t,append:n})}(e,t.key),function(e){const t=p.element("div",{classes:["sharing-image-premium-revoke"],append:e}),n=[];n.push(wp.i18n.__("Disabling premium mode will not remove the license for this domain.","sharing-image")),n.push(wp.i18n.__("Your current key will also be saved in the plugin settings.","sharing-image")),n.push(wp.i18n.__("Use key management tool to delete the license for the site.","sharing-image")),p.element("p",{text:n.join(" "),append:t}),p.element("button",{classes:["button"],text:wp.i18n.__("Disable Premium","sharing-image"),attributes:{type:"submit"},append:t}),p.element("span",{classes:["spinner"],append:t}),e.addEventListener("submit",(t=>{t.preventDefault(),function(e){e.classList.add("access-loader");const t=new XMLHttpRequest;t.open("POST",ajaxurl),t.responseType="json";const n=new window.FormData(e);n.set("action","sharing_image_revoke_premium"),b(),t.addEventListener("load",(()=>{const n=t.response||{};return e.classList.remove("access-loader"),n.data?n.success?(h.license=n.data,void w()):v(n.data):v()})),t.addEventListener("error",(()=>{v(),e.classList.remove("access-loader")})),t.send(n)}(e)}))}(e))}function w(){let e=m.querySelector(".sharing-image-premium-access");null!==e&&m.removeChild(e),e=p.element("form",{classes:["sharing-image-premium-access"],attributes:{action:"",method:"POST"},append:m}),m.classList.remove("premium-enabled"),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:h.nonce},append:e});const t=h.license||{};return t.premium||t.develop?_(e,t):function(e,t){t.error&&v(f(t.error)),p.element("strong",{text:wp.i18n.__("Do you already have a key? Enter it here","sharing-image"),append:e});const n=p.element("div",{classes:["sharing-image-premium-verify"],append:e});p.element("input",{label:wp.i18n.__("Your Premium key","sharing-image"),attributes:{type:"text",name:"sharing_image_key",value:t.key},append:n}),p.element("button",{classes:["button"],text:wp.i18n.__("Submit","sharing-image"),attributes:{type:"submit"},append:n}),p.element("span",{classes:["spinner"],append:n}),e.addEventListener("submit",(t=>{t.preventDefault(),function(e){e.classList.add("access-loader");const t=new XMLHttpRequest;t.open("POST",ajaxurl),t.responseType="json";const n=new window.FormData(e);n.set("action","sharing_image_verify_premium"),b(),t.addEventListener("load",(()=>{const n=t.response||{};return e.classList.remove("access-loader"),n.data?n.success?(h.license=n.data,void w()):v(f(n.code,n.data)):v()})),t.addEventListener("error",(()=>{v(),e.classList.remove("access-loader")})),t.send(n)}(e)}))}(e,t)}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){k(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function E(e){return E="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(e)}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(){return S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},S.apply(this,arguments)}function D(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var C=D(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),T=D(/Edge/i),P=D(/firefox/i),O=D(/safari/i)&&!D(/chrome/i)&&!D(/android/i),L=D(/iP(ad|od|hone)/i),A=D(/chrome/i)&&D(/android/i),M={capture:!1,passive:!1};function N(e,t,n){e.addEventListener(t,n,!C&&M)}function I(e,t,n){e.removeEventListener(t,n,!C&&M)}function R(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 Y(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function j(e,t,n,a){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&R(e,t):R(e,t))||a&&e===n)return e;if(e===n)break}while(e=Y(e))}return null}var F,X=/\s+/g;function q(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var a=(" "+e.className+" ").replace(X," ").replace(" "+t+" "," ");e.className=(a+(n?" "+t:"")).replace(X," ")}}function z(e,t,n){var a=e&&e.style;if(a){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 a||-1!==t.indexOf("webkit")||(t="-webkit-"+t),a[t]=n+("string"==typeof n?"":"px")}}function B(e,t){var n="";if("string"==typeof e)n=e;else do{var a=z(e,"transform");a&&"none"!==a&&(n=a+" "+n)}while(!t&&(e=e.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function U(e,t,n){if(e){var a=e.getElementsByTagName(t),i=0,o=a.length;if(n)for(;i<o;i++)n(a[i],i);return a}return[]}function H(){return document.scrollingElement||document.documentElement}function W(e,t,n,a,i){if(e.getBoundingClientRect||e===window){var o,r,s,l,c,p,d;if(e!==window&&e.parentNode&&e!==H()?(r=(o=e.getBoundingClientRect()).top,s=o.left,l=o.bottom,c=o.right,p=o.height,d=o.width):(r=0,s=0,l=window.innerHeight,c=window.innerWidth,p=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(i=i||e.parentNode,!C))do{if(i&&i.getBoundingClientRect&&("none"!==z(i,"transform")||n&&"static"!==z(i,"position"))){var u=i.getBoundingClientRect();r-=u.top+parseInt(z(i,"border-top-width")),s-=u.left+parseInt(z(i,"border-left-width")),l=r+o.height,c=s+o.width;break}}while(i=i.parentNode);if(a&&e!==window){var g=B(i||e),h=g&&g.a,m=g&&g.d;g&&(l=(r/=m)+(p/=m),c=(s/=h)+(d/=h))}return{top:r,left:s,bottom:l,right:c,width:d,height:p}}}function G(e,t,n){for(var a=Z(e,!0),i=W(e)[t];a;){var o=W(a)[n];if(!("top"===n||"left"===n?i>=o:i<=o))return a;if(a===H())break;a=Z(a,!1)}return!1}function V(e,t,n,a){for(var i=0,o=0,r=e.children;o<r.length;){if("none"!==r[o].style.display&&r[o]!==tt.ghost&&(a||r[o]!==tt.dragged)&&j(r[o],n.draggable,e,!1)){if(i===t)return r[o];i++}o++}return null}function J(e,t){for(var n=e.lastElementChild;n&&(n===tt.ghost||"none"===z(n,"display")||t&&!R(n,t));)n=n.previousElementSibling;return n||null}function $(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===tt.clone||t&&!R(e,t)||n++;return n}function K(e){var t=0,n=0,a=H();if(e)do{var i=B(e),o=i.a,r=i.d;t+=e.scrollLeft*o,n+=e.scrollTop*r}while(e!==a&&(e=e.parentNode));return[t,n]}function Z(e,t){if(!e||!e.getBoundingClientRect)return H();var n=e,a=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=z(n);if(n.clientWidth<n.scrollWidth&&("auto"==i.overflowX||"scroll"==i.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==i.overflowY||"scroll"==i.overflowY)){if(!n.getBoundingClientRect||n===document.body)return H();if(a||t)return n;a=!0}}}while(n=n.parentNode);return H()}function Q(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function ee(e,t){return function(){if(!F){var n=arguments;1===n.length?e.call(this,n[0]):e.apply(this,n),F=setTimeout((function(){F=void 0}),t)}}}function te(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function ne(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}function ae(e,t,n){var a={};return Array.from(e.children).forEach((function(i){var o,r,s,l;if(j(i,t.draggable,e,!1)&&!i.animated&&i!==n){var c=W(i);a.left=Math.min(null!==(o=a.left)&&void 0!==o?o:1/0,c.left),a.top=Math.min(null!==(r=a.top)&&void 0!==r?r:1/0,c.top),a.right=Math.max(null!==(s=a.right)&&void 0!==s?s:-1/0,c.right),a.bottom=Math.max(null!==(l=a.bottom)&&void 0!==l?l:-1/0,c.bottom)}})),a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}var ie="Sortable"+(new Date).getTime();var oe=[],re={initializeByDefault:!0},se={mount:function(e){for(var t in re)re.hasOwnProperty(t)&&!(t in e)&&(e[t]=re[t]);oe.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),oe.push(e)},pluginEvent:function(e,t,n){var a=this;this.eventCanceled=!1,n.cancel=function(){a.eventCanceled=!0};var i=e+"Global";oe.forEach((function(a){t[a.pluginName]&&(t[a.pluginName][i]&&t[a.pluginName][i](x({sortable:t},n)),t.options[a.pluginName]&&t[a.pluginName][e]&&t[a.pluginName][e](x({sortable:t},n)))}))},initializePlugins:function(e,t,n,a){for(var i in oe.forEach((function(a){var i=a.pluginName;if(e.options[i]||a.initializeByDefault){var o=new a(e,t,e.options);o.sortable=e,o.options=e.options,e[i]=o,S(n,o.defaults)}})),e.options)if(e.options.hasOwnProperty(i)){var o=this.modifyOption(e,i,e.options[i]);void 0!==o&&(e.options[i]=o)}},getEventProperties:function(e,t){var n={};return oe.forEach((function(a){"function"==typeof a.eventProperties&&S(n,a.eventProperties.call(t[a.pluginName],e))})),n},modifyOption:function(e,t,n){var a;return oe.forEach((function(i){e[i.pluginName]&&i.optionListeners&&"function"==typeof i.optionListeners[t]&&(a=i.optionListeners[t].call(e[i.pluginName],n))})),a}};var le=["evt"],ce=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=n.evt,i=function(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(n,le);se.pluginEvent.bind(tt)(e,t,x({dragEl:de,parentEl:ue,ghostEl:ge,rootEl:he,nextEl:me,lastDownEl:fe,cloneEl:ve,cloneHidden:be,dragStarted:Le,putSortable:ke,activeSortable:tt.active,originalEvent:a,oldIndex:_e,oldDraggableIndex:ye,newIndex:we,newDraggableIndex:xe,hideGhostForTarget:Ke,unhideGhostForTarget:Ze,cloneNowHidden:function(){be=!0},cloneNowShown:function(){be=!1},dispatchSortableEvent:function(e){pe({sortable:t,name:e,originalEvent:a})}},i))};function pe(e){!function(e){var t=e.sortable,n=e.rootEl,a=e.name,i=e.targetEl,o=e.cloneEl,r=e.toEl,s=e.fromEl,l=e.oldIndex,c=e.newIndex,p=e.oldDraggableIndex,d=e.newDraggableIndex,u=e.originalEvent,g=e.putSortable,h=e.extraEventProperties;if(t=t||n&&n[ie]){var m,f=t.options,v="on"+a.charAt(0).toUpperCase()+a.substr(1);!window.CustomEvent||C||T?(m=document.createEvent("Event")).initEvent(a,!0,!0):m=new CustomEvent(a,{bubbles:!0,cancelable:!0}),m.to=r||n,m.from=s||n,m.item=i||n,m.clone=o,m.oldIndex=l,m.newIndex=c,m.oldDraggableIndex=p,m.newDraggableIndex=d,m.originalEvent=u,m.pullMode=g?g.lastPutMode:void 0;var b=x(x({},h),se.getEventProperties(a,t));for(var _ in b)m[_]=b[_];n&&n.dispatchEvent(m),f[v]&&f[v].call(t,m)}}(x({putSortable:ke,cloneEl:ve,targetEl:de,rootEl:he,oldIndex:_e,oldDraggableIndex:ye,newIndex:we,newDraggableIndex:xe},e))}var de,ue,ge,he,me,fe,ve,be,_e,we,ye,xe,Ee,ke,Se,De,Ce,Te,Pe,Oe,Le,Ae,Me,Ne,Ie,Re=!1,Ye=!1,je=[],Fe=!1,Xe=!1,qe=[],ze=!1,Be=[],Ue="undefined"!=typeof document,He=L,We=T||C?"cssFloat":"float",Ge=Ue&&!A&&!L&&"draggable"in document.createElement("div"),Ve=function(){if(Ue){if(C)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Je=function(e,t){var n=z(e),a=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=V(e,0,t),o=V(e,1,t),r=i&&z(i),s=o&&z(o),l=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+W(i).width,c=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+W(o).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(i&&r.float&&"none"!==r.float){var p="left"===r.float?"left":"right";return!o||"both"!==s.clear&&s.clear!==p?"horizontal":"vertical"}return i&&("block"===r.display||"flex"===r.display||"table"===r.display||"grid"===r.display||l>=a&&"none"===n[We]||o&&"none"===n[We]&&l+c>a)?"vertical":"horizontal"},$e=function(e){function t(e,n){return function(a,i,o,r){var s=a.options.group.name&&i.options.group.name&&a.options.group.name===i.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(a,i,o,r),n)(a,i,o,r);var l=(n?a:i).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},a=e.group;a&&"object"==E(a)||(a={name:a}),n.name=a.name,n.checkPull=t(a.pull,!0),n.checkPut=t(a.put),n.revertClone=a.revertClone,e.group=n},Ke=function(){!Ve&&ge&&z(ge,"display","none")},Ze=function(){!Ve&&ge&&z(ge,"display","")};Ue&&!A&&document.addEventListener("click",(function(e){if(Ye)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ye=!1,!1}),!0);var Qe=function(e){if(de){e=e.touches?e.touches[0]:e;var t=(i=e.clientX,o=e.clientY,je.some((function(e){var t=e[ie].options.emptyInsertThreshold;if(t&&!J(e)){var n=W(e),a=i>=n.left-t&&i<=n.right+t,s=o>=n.top-t&&o<=n.bottom+t;return a&&s?r=e:void 0}})),r);if(t){var n={};for(var a in e)e.hasOwnProperty(a)&&(n[a]=e[a]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[ie]._onDragOver(n)}}var i,o,r},et=function(e){de&&de.parentNode[ie]._isOutsideThisEl(e.target)};function tt(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=S({},t),e[ie]=this;var n,a,i={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 Je(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!==tt.supportPointer&&"PointerEvent"in window&&!O,emptyInsertThreshold:5};for(var o in se.initializePlugins(this,e,i),i)!(o in t)&&(t[o]=i[o]);for(var r in $e(t),this)"_"===r.charAt(0)&&"function"==typeof this[r]&&(this[r]=this[r].bind(this));this.nativeDraggable=!t.forceFallback&&Ge,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?N(e,"pointerdown",this._onTapStart):(N(e,"mousedown",this._onTapStart),N(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(N(e,"dragover",this),N(e,"dragenter",this)),je.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),S(this,(a=[],{captureAnimationState:function(){a=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){if("none"!==z(e,"display")&&e!==tt.ghost){a.push({target:e,rect:W(e)});var t=x({},a[a.length-1].rect);if(e.thisAnimationDuration){var n=B(e,!0);n&&(t.top-=n.f,t.left-=n.e)}e.fromRect=t}}))},addAnimationState:function(e){a.push(e)},removeAnimationState:function(e){a.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var a in t)if(t.hasOwnProperty(a)&&t[a]===e[n][a])return Number(n);return-1}(a,{target:e}),1)},animateAll:function(e){var t=this;if(!this.options.animation)return clearTimeout(n),void("function"==typeof e&&e());var i=!1,o=0;a.forEach((function(e){var n=0,a=e.target,r=a.fromRect,s=W(a),l=a.prevFromRect,c=a.prevToRect,p=e.rect,d=B(a,!0);d&&(s.top-=d.f,s.left-=d.e),a.toRect=s,a.thisAnimationDuration&&Q(l,s)&&!Q(r,s)&&(p.top-s.top)/(p.left-s.left)==(r.top-s.top)/(r.left-s.left)&&(n=function(e,t,n,a){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*a.animation}(p,l,c,t.options)),Q(s,r)||(a.prevFromRect=r,a.prevToRect=s,n||(n=t.options.animation),t.animate(a,p,s,n)),n&&(i=!0,o=Math.max(o,n),clearTimeout(a.animationResetTimer),a.animationResetTimer=setTimeout((function(){a.animationTime=0,a.prevFromRect=null,a.fromRect=null,a.prevToRect=null,a.thisAnimationDuration=null}),n),a.thisAnimationDuration=n)})),clearTimeout(n),i?n=setTimeout((function(){"function"==typeof e&&e()}),o):"function"==typeof e&&e(),a=[]},animate:function(e,t,n,a){if(a){z(e,"transition",""),z(e,"transform","");var i=B(this.el),o=i&&i.a,r=i&&i.d,s=(t.left-n.left)/(o||1),l=(t.top-n.top)/(r||1);e.animatingX=!!s,e.animatingY=!!l,z(e,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),z(e,"transition","transform "+a+"ms"+(this.options.easing?" "+this.options.easing:"")),z(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){z(e,"transition",""),z(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),a)}}}))}function nt(e,t,n,a,i,o,r,s){var l,c,p=e[ie],d=p.options.onMove;return!window.CustomEvent||C||T?(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=a,l.related=i||t,l.relatedRect=o||W(t),l.willInsertAfter=s,l.originalEvent=r,e.dispatchEvent(l),d&&(c=d.call(p,l,r)),c}function at(e){e.draggable=!1}function it(){ze=!1}function ot(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,a=0;n--;)a+=t.charCodeAt(n);return a.toString(36)}function rt(e){return setTimeout(e,0)}function st(e){return clearTimeout(e)}tt.prototype={constructor:tt,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Ae=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,de):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,a=this.options,i=a.preventOnFilter,o=e.type,r=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(r||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,c=a.filter;if(function(e){Be.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var a=t[n];a.checked&&Be.push(a)}}(n),!de&&!(/mousedown|pointerdown/.test(o)&&0!==e.button||a.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!O||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=j(s,a.draggable,n,!1))&&s.animated||fe===s)){if(_e=$(s),ye=$(s,a.draggable),"function"==typeof c){if(c.call(this,e,s,this))return pe({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),ce("filter",t,{evt:e}),void(i&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some((function(a){if(a=j(l,a.trim(),n,!1))return pe({sortable:t,rootEl:a,name:"filter",targetEl:s,fromEl:n,toEl:n}),ce("filter",t,{evt:e}),!0}))))return void(i&&e.cancelable&&e.preventDefault());a.handle&&!j(l,a.handle,n,!1)||this._prepareDragStart(e,r,s)}}},_prepareDragStart:function(e,t,n){var a,i=this,o=i.el,r=i.options,s=o.ownerDocument;if(n&&!de&&n.parentNode===o){var l=W(n);if(he=o,ue=(de=n).parentNode,me=de.nextSibling,fe=n,Ee=r.group,tt.dragged=de,Se={target:de,clientX:(t||e).clientX,clientY:(t||e).clientY},Pe=Se.clientX-l.left,Oe=Se.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,de.style["will-change"]="all",a=function(){ce("delayEnded",i,{evt:e}),tt.eventCanceled?i._onDrop():(i._disableDelayedDragEvents(),!P&&i.nativeDraggable&&(de.draggable=!0),i._triggerDragStart(e,t),pe({sortable:i,name:"choose",originalEvent:e}),q(de,r.chosenClass,!0))},r.ignore.split(",").forEach((function(e){U(de,e.trim(),at)})),N(s,"dragover",Qe),N(s,"mousemove",Qe),N(s,"touchmove",Qe),N(s,"mouseup",i._onDrop),N(s,"touchend",i._onDrop),N(s,"touchcancel",i._onDrop),P&&this.nativeDraggable&&(this.options.touchStartThreshold=4,de.draggable=!0),ce("delayStart",this,{evt:e}),!r.delay||r.delayOnTouchOnly&&!t||this.nativeDraggable&&(T||C))a();else{if(tt.eventCanceled)return void this._onDrop();N(s,"mouseup",i._disableDelayedDrag),N(s,"touchend",i._disableDelayedDrag),N(s,"touchcancel",i._disableDelayedDrag),N(s,"mousemove",i._delayedDragTouchMoveHandler),N(s,"touchmove",i._delayedDragTouchMoveHandler),r.supportPointer&&N(s,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(a,r.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(){de&&at(de),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;I(e,"mouseup",this._disableDelayedDrag),I(e,"touchend",this._disableDelayedDrag),I(e,"touchcancel",this._disableDelayedDrag),I(e,"mousemove",this._delayedDragTouchMoveHandler),I(e,"touchmove",this._delayedDragTouchMoveHandler),I(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?N(document,"pointermove",this._onTouchMove):N(document,t?"touchmove":"mousemove",this._onTouchMove):(N(de,"dragend",this),N(he,"dragstart",this._onDragStart));try{document.selection?rt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(Re=!1,he&&de){ce("dragStarted",this,{evt:t}),this.nativeDraggable&&N(document,"dragover",et);var n=this.options;!e&&q(de,n.dragClass,!1),q(de,n.ghostClass,!0),tt.active=this,e&&this._appendGhost(),pe({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(De){this._lastX=De.clientX,this._lastY=De.clientY,Ke();for(var e=document.elementFromPoint(De.clientX,De.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(De.clientX,De.clientY))!==t;)t=e;if(de.parentNode[ie]._isOutsideThisEl(e),t)do{if(t[ie]&&t[ie]._onDragOver({clientX:De.clientX,clientY:De.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break;e=t}while(t=t.parentNode);Ze()}},_onTouchMove:function(e){if(Se){var t=this.options,n=t.fallbackTolerance,a=t.fallbackOffset,i=e.touches?e.touches[0]:e,o=ge&&B(ge,!0),r=ge&&o&&o.a,s=ge&&o&&o.d,l=He&&Ie&&K(Ie),c=(i.clientX-Se.clientX+a.x)/(r||1)+(l?l[0]-qe[0]:0)/(r||1),p=(i.clientY-Se.clientY+a.y)/(s||1)+(l?l[1]-qe[1]:0)/(s||1);if(!tt.active&&!Re){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(ge){o?(o.e+=c-(Ce||0),o.f+=p-(Te||0)):o={a:1,b:0,c:0,d:1,e:c,f:p};var d="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")");z(ge,"webkitTransform",d),z(ge,"mozTransform",d),z(ge,"msTransform",d),z(ge,"transform",d),Ce=c,Te=p,De=i}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!ge){var e=this.options.fallbackOnBody?document.body:he,t=W(de,!0,He,!0,e),n=this.options;if(He){for(Ie=e;"static"===z(Ie,"position")&&"none"===z(Ie,"transform")&&Ie!==document;)Ie=Ie.parentNode;Ie!==document.body&&Ie!==document.documentElement?(Ie===document&&(Ie=H()),t.top+=Ie.scrollTop,t.left+=Ie.scrollLeft):Ie=H(),qe=K(Ie)}q(ge=de.cloneNode(!0),n.ghostClass,!1),q(ge,n.fallbackClass,!0),q(ge,n.dragClass,!0),z(ge,"transition",""),z(ge,"transform",""),z(ge,"box-sizing","border-box"),z(ge,"margin",0),z(ge,"top",t.top),z(ge,"left",t.left),z(ge,"width",t.width),z(ge,"height",t.height),z(ge,"opacity","0.8"),z(ge,"position",He?"absolute":"fixed"),z(ge,"zIndex","100000"),z(ge,"pointerEvents","none"),tt.ghost=ge,e.appendChild(ge),z(ge,"transform-origin",Pe/parseInt(ge.style.width)*100+"% "+Oe/parseInt(ge.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,a=e.dataTransfer,i=n.options;ce("dragStart",this,{evt:e}),tt.eventCanceled?this._onDrop():(ce("setupClone",this),tt.eventCanceled||((ve=ne(de)).removeAttribute("id"),ve.draggable=!1,ve.style["will-change"]="",this._hideClone(),q(ve,this.options.chosenClass,!1),tt.clone=ve),n.cloneId=rt((function(){ce("clone",n),tt.eventCanceled||(n.options.removeCloneOnHide||he.insertBefore(ve,de),n._hideClone(),pe({sortable:n,name:"clone"}))})),!t&&q(de,i.dragClass,!0),t?(Ye=!0,n._loopId=setInterval(n._emulateDragOver,50)):(I(document,"mouseup",n._onDrop),I(document,"touchend",n._onDrop),I(document,"touchcancel",n._onDrop),a&&(a.effectAllowed="move",i.setData&&i.setData.call(n,a,de)),N(document,"drop",n),z(de,"transform","translateZ(0)")),Re=!0,n._dragStartId=rt(n._dragStarted.bind(n,t,e)),N(document,"selectstart",n),Le=!0,O&&z(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,a,i,o=this.el,r=e.target,s=this.options,l=s.group,c=tt.active,p=Ee===l,d=s.sort,u=ke||c,g=this,h=!1;if(!ze){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),r=j(r,s.draggable,o,!0),O("dragOver"),tt.eventCanceled)return h;if(de.contains(e.target)||r.animated&&r.animatingX&&r.animatingY||g._ignoreWhileAnimating===r)return A(!1);if(Ye=!1,c&&!s.disabled&&(p?d||(a=ue!==he):ke===this||(this.lastPutMode=Ee.checkPull(this,c,de,e))&&l.checkPut(this,c,de,e))){if(i="vertical"===this._getDirection(e,r),t=W(de),O("dragOverValid"),tt.eventCanceled)return h;if(a)return ue=he,L(),this._hideClone(),O("revert"),tt.eventCanceled||(me?he.insertBefore(de,me):he.appendChild(de)),A(!0);var m=J(o,s.draggable);if(!m||function(e,t,n){var a=W(J(n.el,n.options.draggable)),i=ae(n.el,n.options,ge);return t?e.clientX>i.right+10||e.clientY>a.bottom&&e.clientX>a.left:e.clientY>i.bottom+10||e.clientX>a.right&&e.clientY>a.top}(e,i,this)&&!m.animated){if(m===de)return A(!1);if(m&&o===e.target&&(r=m),r&&(n=W(r)),!1!==nt(he,o,de,t,r,n,e,!!r))return L(),m&&m.nextSibling?o.insertBefore(de,m.nextSibling):o.appendChild(de),ue=o,M(),A(!0)}else if(m&&function(e,t,n){var a=W(V(n.el,0,n.options,!0)),i=ae(n.el,n.options,ge);return t?e.clientX<i.left-10||e.clientY<a.top&&e.clientX<a.right:e.clientY<i.top-10||e.clientY<a.bottom&&e.clientX<a.left}(e,i,this)){var f=V(o,0,s,!0);if(f===de)return A(!1);if(n=W(r=f),!1!==nt(he,o,de,t,r,n,e,!1))return L(),o.insertBefore(de,f),ue=o,M(),A(!0)}else if(r.parentNode===o){n=W(r);var v,b,_,w=de.parentNode!==o,y=!function(e,t,n){var a=n?e.left:e.top,i=n?e.right:e.bottom,o=n?e.width:e.height,r=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return a===r||i===s||a+o/2===r+l/2}(de.animated&&de.toRect||t,r.animated&&r.toRect||n,i),E=i?"top":"left",k=G(r,"top","top")||G(de,"top","top"),S=k?k.scrollTop:void 0;if(Ae!==r&&(b=n[E],Fe=!1,Xe=!y&&s.invertSwap||w),v=function(e,t,n,a,i,o,r,s){var l=a?e.clientY:e.clientX,c=a?n.height:n.width,p=a?n.top:n.left,d=a?n.bottom:n.right,u=!1;if(!r)if(s&&Ne<c*i){if(!Fe&&(1===Me?l>p+c*o/2:l<d-c*o/2)&&(Fe=!0),Fe)u=!0;else if(1===Me?l<p+Ne:l>d-Ne)return-Me}else if(l>p+c*(1-i)/2&&l<d-c*(1-i)/2)return function(e){return $(de)<$(e)?1:-1}(t);return(u=u||r)&&(l<p+c*o/2||l>d-c*o/2)?l>p+c/2?1:-1:0}(e,r,n,i,y?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,Xe,Ae===r),0!==v){var D=$(de);do{D-=v,_=ue.children[D]}while(_&&("none"===z(_,"display")||_===ge))}if(0===v||_===r)return A(!1);Ae=r,Me=v;var C=r.nextElementSibling,T=!1,P=nt(he,o,de,t,r,n,e,T=1===v);if(!1!==P)return 1!==P&&-1!==P||(T=1===P),ze=!0,setTimeout(it,30),L(),T&&!C?o.appendChild(de):r.parentNode.insertBefore(de,T?C:r),k&&te(k,0,S-k.scrollTop),ue=de.parentNode,void 0===b||Xe||(Ne=Math.abs(b-W(r)[E])),M(),A(!0)}if(o.contains(de))return A(!1)}return!1}function O(s,l){ce(s,g,x({evt:e,isOwner:p,axis:i?"vertical":"horizontal",revert:a,dragRect:t,targetRect:n,canSort:d,fromSortable:u,target:r,completed:A,onMove:function(n,a){return nt(he,o,de,t,n,W(n),e,a)},changed:M},l))}function L(){O("dragOverAnimationCapture"),g.captureAnimationState(),g!==u&&u.captureAnimationState()}function A(t){return O("dragOverCompleted",{insertion:t}),t&&(p?c._hideClone():c._showClone(g),g!==u&&(q(de,ke?ke.options.ghostClass:c.options.ghostClass,!1),q(de,s.ghostClass,!0)),ke!==g&&g!==tt.active?ke=g:g===tt.active&&ke&&(ke=null),u===g&&(g._ignoreWhileAnimating=r),g.animateAll((function(){O("dragOverAnimationComplete"),g._ignoreWhileAnimating=null})),g!==u&&(u.animateAll(),u._ignoreWhileAnimating=null)),(r===de&&!de.animated||r===o&&!r.animated)&&(Ae=null),s.dragoverBubble||e.rootEl||r===document||(de.parentNode[ie]._isOutsideThisEl(e.target),!t&&Qe(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),h=!0}function M(){we=$(de),xe=$(de,s.draggable),pe({sortable:g,name:"change",toEl:o,newIndex:we,newDraggableIndex:xe,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){I(document,"mousemove",this._onTouchMove),I(document,"touchmove",this._onTouchMove),I(document,"pointermove",this._onTouchMove),I(document,"dragover",Qe),I(document,"mousemove",Qe),I(document,"touchmove",Qe)},_offUpEvents:function(){var e=this.el.ownerDocument;I(e,"mouseup",this._onDrop),I(e,"touchend",this._onDrop),I(e,"pointerup",this._onDrop),I(e,"touchcancel",this._onDrop),I(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;we=$(de),xe=$(de,n.draggable),ce("drop",this,{evt:e}),ue=de&&de.parentNode,we=$(de),xe=$(de,n.draggable),tt.eventCanceled||(Re=!1,Xe=!1,Fe=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),st(this.cloneId),st(this._dragStartId),this.nativeDraggable&&(I(document,"drop",this),I(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),O&&z(document.body,"user-select",""),z(de,"transform",""),e&&(Le&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),ge&&ge.parentNode&&ge.parentNode.removeChild(ge),(he===ue||ke&&"clone"!==ke.lastPutMode)&&ve&&ve.parentNode&&ve.parentNode.removeChild(ve),de&&(this.nativeDraggable&&I(de,"dragend",this),at(de),de.style["will-change"]="",Le&&!Re&&q(de,ke?ke.options.ghostClass:this.options.ghostClass,!1),q(de,this.options.chosenClass,!1),pe({sortable:this,name:"unchoose",toEl:ue,newIndex:null,newDraggableIndex:null,originalEvent:e}),he!==ue?(we>=0&&(pe({rootEl:ue,name:"add",toEl:ue,fromEl:he,originalEvent:e}),pe({sortable:this,name:"remove",toEl:ue,originalEvent:e}),pe({rootEl:ue,name:"sort",toEl:ue,fromEl:he,originalEvent:e}),pe({sortable:this,name:"sort",toEl:ue,originalEvent:e})),ke&&ke.save()):we!==_e&&we>=0&&(pe({sortable:this,name:"update",toEl:ue,originalEvent:e}),pe({sortable:this,name:"sort",toEl:ue,originalEvent:e})),tt.active&&(null!=we&&-1!==we||(we=_e,xe=ye),pe({sortable:this,name:"end",toEl:ue,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){ce("nulling",this),he=de=ue=ge=me=ve=fe=be=Se=De=Le=we=xe=_e=ye=Ae=Me=ke=Ee=tt.dragged=tt.ghost=tt.clone=tt.active=null,Be.forEach((function(e){e.checked=!0})),Be.length=Ce=Te=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":de&&(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,a=0,i=n.length,o=this.options;a<i;a++)j(e=n[a],o.draggable,this.el,!1)&&t.push(e.getAttribute(o.dataIdAttr)||ot(e));return t},sort:function(e,t){var n={},a=this.el;this.toArray().forEach((function(e,t){var i=a.children[t];j(i,this.options.draggable,a,!1)&&(n[e]=i)}),this),t&&this.captureAnimationState(),e.forEach((function(e){n[e]&&(a.removeChild(n[e]),a.appendChild(n[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return j(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(void 0===t)return n[e];var a=se.modifyOption(this,e,t);n[e]=void 0!==a?a:t,"group"===e&&$e(n)},destroy:function(){ce("destroy",this);var e=this.el;e[ie]=null,I(e,"mousedown",this._onTapStart),I(e,"touchstart",this._onTapStart),I(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(I(e,"dragover",this),I(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),je.splice(je.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!be){if(ce("hideClone",this),tt.eventCanceled)return;z(ve,"display","none"),this.options.removeCloneOnHide&&ve.parentNode&&ve.parentNode.removeChild(ve),be=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(be){if(ce("showClone",this),tt.eventCanceled)return;de.parentNode!=he||this.options.group.revertClone?me?he.insertBefore(ve,me):he.appendChild(ve):he.insertBefore(ve,de),this.options.group.revertClone&&this.animate(de,ve),z(ve,"display",""),be=!1}}else this._hideClone()}},Ue&&N(document,"touchmove",(function(e){(tt.active||Re)&&e.cancelable&&e.preventDefault()})),tt.utils={on:N,off:I,css:z,find:U,is:function(e,t){return!!j(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:ee,closest:j,toggleClass:q,clone:ne,index:$,nextTick:rt,cancelNextTick:st,detectDirection:Je,getChild:V},tt.get=function(e){return e[ie]},tt.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t[0].constructor===Array&&(t=t[0]),t.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(tt.utils=x(x({},tt.utils),e.utils)),se.mount(e)}))},tt.create=function(e,t){return new tt(e,t)},tt.version="1.15.2";var lt,ct,pt,dt,ut,gt,ht=[],mt=!1;function ft(){ht.forEach((function(e){clearInterval(e.pid)})),ht=[]}function vt(){clearInterval(gt)}var bt=ee((function(e,t,n,a){if(t.scroll){var i,o=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,l=t.scrollSpeed,c=H(),p=!1;ct!==n&&(ct=n,ft(),lt=t.scroll,i=t.scrollFn,!0===lt&&(lt=Z(n,!0)));var d=0,u=lt;do{var g=u,h=W(g),m=h.top,f=h.bottom,v=h.left,b=h.right,_=h.width,w=h.height,y=void 0,x=void 0,E=g.scrollWidth,k=g.scrollHeight,S=z(g),D=g.scrollLeft,C=g.scrollTop;g===c?(y=_<E&&("auto"===S.overflowX||"scroll"===S.overflowX||"visible"===S.overflowX),x=w<k&&("auto"===S.overflowY||"scroll"===S.overflowY||"visible"===S.overflowY)):(y=_<E&&("auto"===S.overflowX||"scroll"===S.overflowX),x=w<k&&("auto"===S.overflowY||"scroll"===S.overflowY));var T=y&&(Math.abs(b-o)<=s&&D+_<E)-(Math.abs(v-o)<=s&&!!D),P=x&&(Math.abs(f-r)<=s&&C+w<k)-(Math.abs(m-r)<=s&&!!C);if(!ht[d])for(var O=0;O<=d;O++)ht[O]||(ht[O]={});ht[d].vx==T&&ht[d].vy==P&&ht[d].el===g||(ht[d].el=g,ht[d].vx=T,ht[d].vy=P,clearInterval(ht[d].pid),0==T&&0==P||(p=!0,ht[d].pid=setInterval(function(){a&&0===this.layer&&tt.active._onTouchMove(ut);var t=ht[this.layer].vy?ht[this.layer].vy*l:0,n=ht[this.layer].vx?ht[this.layer].vx*l:0;"function"==typeof i&&"continue"!==i.call(tt.dragged.parentNode[ie],n,t,e,ut,ht[this.layer].el)||te(ht[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&u!==c&&(u=Z(u,!1)));mt=p}}),30),_t=function(e){var t=e.originalEvent,n=e.putSortable,a=e.dragEl,i=e.activeSortable,o=e.dispatchSortableEvent,r=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(t){var l=n||i;r();var c=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,p=document.elementFromPoint(c.clientX,c.clientY);s(),l&&!l.el.contains(p)&&(o("spill"),this.onSpill({dragEl:a,putSortable:n}))}};function wt(){}function yt(){}wt.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var a=V(this.sortable.el,this.startIndex,this.options);a?this.sortable.el.insertBefore(t,a):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:_t},S(wt,{pluginName:"revertOnSpill"}),yt.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:_t},S(yt,{pluginName:"removeOnSpill"}),tt.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?N(document,"dragover",this._handleAutoScroll):this.options.supportPointer?N(document,"pointermove",this._handleFallbackAutoScroll):t.touches?N(document,"touchmove",this._handleFallbackAutoScroll):N(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?I(document,"dragover",this._handleAutoScroll):(I(document,"pointermove",this._handleFallbackAutoScroll),I(document,"touchmove",this._handleFallbackAutoScroll),I(document,"mousemove",this._handleFallbackAutoScroll)),vt(),ft(),clearTimeout(F),F=void 0},nulling:function(){ut=ct=lt=mt=gt=pt=dt=null,ht.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,a=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,o=document.elementFromPoint(a,i);if(ut=e,t||this.options.forceAutoScrollFallback||T||C||O){bt(e,this.options,o,t);var r=Z(o,!0);!mt||gt&&a===pt&&i===dt||(gt&&vt(),gt=setInterval((function(){var o=Z(document.elementFromPoint(a,i),!0);o!==r&&(r=o,ft()),bt(e,n.options,o,t)}),10),pt=a,dt=i)}else{if(!this.options.bubbleScroll||Z(o,!0)===H())return void ft();bt(e,this.options,Z(o,!1),!1)}}},S(e,{pluginName:"scroll",initializeByDefault:!0})}),tt.mount(yt,wt);const xt=tt;let Et=null,kt=null,St=null;function Dt(e){const t=kt.parentNode.querySelector(".sharing-image-editor-warning");null!==t&&(t.classList.add("warning-visible"),t.textContent=e||wp.i18n.__("Unknown generation error","sharing-image"))}function Ct(){kt.classList.add("preview-loader");const e=new XMLHttpRequest;e.open("POST",ajaxurl),e.responseType="blob";const t=new window.FormData(St);t.set("action","sharing_image_show_preview"),function(){const e=kt.parentNode.querySelector(".sharing-image-editor-warning");null!==e&&e.classList.remove("warning-visible")}(),e.addEventListener("readystatechange",(()=>{2===e.readyState&&(e.responseType="json",200===e.status&&(e.responseType="blob"))})),e.addEventListener("load",(()=>{const t=e.response||{};if(kt.classList.remove("preview-blank","preview-loader"),200!==e.status)return Dt(t.data);let n=kt.querySelector("img");null===n&&(n=p.element("img",{append:kt})),n.src=window.URL.createObjectURL(t)})),e.addEventListener("error",(()=>{Dt(),kt.classList.remove("preview-blank","preview-loader")})),e.send(t)}function Tt(e,n,a){const i=[],o=p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[x]",value:a.x,placeholder:"0"},dataset:{dimension:"x"},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[y]",value:a.y,placeholder:"0"},dataset:{dimension:"y"},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[width]",value:a.width},dataset:{dimension:"width"},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:n+"[height]",value:a.height},dataset:{dimension:"height"},label:wp.i18n.__("Height","sharing-image")}],append:e});!function(e,n,a){const i=p.control({classes:["sharing-image-editor-control","control-pulled"],append:e});p.element("button",{classes:["sharing-image-editor-more"],text:wp.i18n.__("Utilize image as the poster background.","sharing-image"),attributes:{type:"button"},append:i}).addEventListener("click",(()=>{const e={};return n.querySelectorAll("input").forEach((t=>{e[t.dataset.dimension]=t})),e.x.value=0,e.y.value=0,e.width.value=t.dataget(St,"editor","width"),e.height.value=t.dataget(St,"editor","height"),s(),void Ct()}))}(e,o),Ot(e,n,a),i[i.length]=p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Image resizing principle","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"center"},label:wp.i18n.__("Center image while preserving the aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"top"},label:wp.i18n.__("Top-aligned image while preserving the aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"bottom"},label:wp.i18n.__("Bottom-aligned image while preserving aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"ignore"},label:wp.i18n.__("Resize while ignoring the aspect ratio","sharing-image"),checked:a.resize||"center"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:n+"[resize]",value:"crop"},label:wp.i18n.__("Center-crop the image","sharing-image"),checked:a.resize||"center"}],append:e});const r=[];o.querySelectorAll("input").forEach((e=>{["width","height"].includes(e.dataset.dimension)&&r.push(e)}));const s=()=>{let e=!1;r.forEach((t=>{t.value.length<1&&(e=!0)})),i.forEach((t=>{t.classList.toggle("control-disabled",e)}))};s(),r.forEach((e=>{e.addEventListener("input",s)}))}function Pt(e,t){const n=e.querySelector("h2 > span");if(null===n)return;const a={},i=": ";e.querySelectorAll("[data-caption]").forEach((e=>{a[e.dataset.caption]=e,e.addEventListener("keyup",(()=>{n.textContent=e.value?i+e.value:""}))})),n.textContent=i+a.content.value,t.checked&&(n.textContent=i+a.title.value),n.textContent===i&&(n.textContent="")}function Ot(e,t,n){p.control({classes:["sharing-image-editor-control","control-extend","control-pulled","control-upnext"],label:wp.i18n.__("Relative boundaries","sharing-image"),fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{absolute:wp.i18n.__("No Relative Positioning","sharing-image"),vertically:wp.i18n.__("Vertical Only","sharing-image"),horizontally:wp.i18n.__("Horizontal Only","sharing-image"),both:wp.i18n.__("Both Directions Alignment","sharing-image")},attributes:{name:t+"[boundary]"},selected:n.boundary}],help:wp.i18n.__("Using offset from previous layer.","sharing-image"),append:e})}function Lt(e,t){const n=[];n.push(wp.i18n.__("Write text on the current image.","sharing-image")),n.push(wp.i18n.__("If the font does not fit within your limits, its size will decrease.","sharing-image")),n.push(wp.i18n.__("Avoid using large font sizes for long text as it affects performance.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Text","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"text"},append:a}),p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[x]",value:e.x,placeholder:"10"},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[y]",value:e.y,placeholder:"10"},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[width]",value:e.width,placeholder:"1000"},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[height]",value:e.height},label:wp.i18n.__("Height","sharing-image")}],append:a}),Ot(a,t,e),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[dynamic]",value:"dynamic"},label:wp.i18n.__("Dynamic field. Filled in on the post editing screen.","sharing-image"),checked:n.dynamic},a),o=[];o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend","control-hidden"],help:wp.i18n.__("Only visible on the admin side.","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:t+"[title]",value:n.title},dataset:{caption:"title"},label:wp.i18n.__("Field name","sharing-image")}],append:e}),o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend","control-hidden"],help:wp.i18n.__("This field is for demonstration only, to preview the editor’s appearance.","sharing-image"),fields:[{group:"textarea",classes:["sharing-image-editor-control-textarea"],content:n.sample||"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",attributes:{name:t+"[sample]",rows:2},label:wp.i18n.__("Text sample","sharing-image")}],append:e});const r=p.control({classes:["sharing-image-editor-control","control-hidden"],label:wp.i18n.__("Preset text field","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"none"},dataset:{persistent:!0},label:wp.i18n.__("Fill in manually","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"title"},dataset:{persistent:!0},label:wp.i18n.__("Take from post title","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"excerpt"},dataset:{persistent:!0},label:wp.i18n.__("Use post excerpt text","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"categories"},dataset:{persistent:!0},label:wp.i18n.__("Use post categories","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"tags"},dataset:{persistent:!0},label:wp.i18n.__("Use post tags","sharing-image"),checked:n.preset||"none"}],append:e});o[o.length]=r,o[o.length]=p.control({classes:["sharing-image-editor-control","control-extend"],help:wp.i18n.__("You can use non-breaking spaces to adjust your string position.","sharing-image"),fields:[{group:"textarea",classes:["sharing-image-editor-control-textarea"],content:n.content,attributes:{name:t+"[content]",rows:2},dataset:{caption:"content"},label:wp.i18n.__("Content","sharing-image")}],append:e});const s=()=>{o.forEach((e=>{e.classList.toggle("control-hidden")}))};i.checked&&s(),i.addEventListener("change",(()=>{s(),Pt(e,i)})),Pt(e,i)}(a,t,e),function(e,t,n){const a=[];a[a.length]=function(e,t,n){const a=p.control({classes:["sharing-image-editor-control","control-upload","control-hidden"],append:e}),i=p.select({classes:["sharing-image-editor-control-select"],options:Et.fonts,attributes:{name:t+"[fontname]"},label:wp.i18n.__("Font family","sharing-image"),selected:n.fontname},a),o=p.media({name:t+"[fontfile]",classes:["sharing-image-editor-control-media"],value:n.fontfile,link:Et.links.uploads,labels:{button:wp.i18n.__("Upload custom font","sharing-image"),heading:wp.i18n.__("Upload custom font","sharing-image"),details:wp.i18n.__("Font attachment","sharing-image"),remove:wp.i18n.__("Remove font","sharing-image")},remove:!0,mime:["font/ttf","font/otf"],append:a});p.element("small",{text:wp.i18n.__("Custom fonts can only be in .ttf or .otf format.","sharing-image"),append:a}),n.fontfile&&(i.disabled=!0);const r=o.querySelector("input");return r.addEventListener("change",(()=>{i.disabled=!1,r.value&&(i.disabled=!0)})),a}(e,t,n),a[a.length]=p.control({classes:["sharing-image-editor-control","control-hidden"],fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{type:"color",name:t+"[color]",value:n.color||"#ffffff"},label:wp.i18n.__("Text color","sharing-image")}],append:e}),a[a.length]=p.control({classes:["sharing-image-editor-control","control-series","control-hidden"],fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{left:wp.i18n.__("Left","sharing-image"),center:wp.i18n.__("Center","sharing-image"),right:wp.i18n.__("Right","sharing-image")},attributes:{name:t+"[horizontal]"},label:wp.i18n.__("Horizontal alignment","sharing-image"),selected:n.horizontal},{group:"select",classes:["sharing-image-editor-control-select"],options:{top:wp.i18n.__("Top","sharing-image"),center:wp.i18n.__("Center","sharing-image"),bottom:wp.i18n.__("Bottom","sharing-image")},attributes:{name:t+"[vertical]"},label:wp.i18n.__("Vertical alignment","sharing-image"),selected:n.vertical}],append:e});const i=p.control({classes:["sharing-image-editor-control"],append:e}),o=p.element("button",{classes:["sharing-image-editor-more"],text:wp.i18n.__("More options","sharing-image"),attributes:{type:"button"},append:i});o.addEventListener("click",(()=>{a.forEach((e=>{e.classList.remove("control-hidden")})),e.removeChild(i)})),Object.keys(n).length>0&&o.click()}(a,t,e),p.control({classes:["sharing-image-editor-control","control-series"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[fontsize]",min:10,max:200,step:1,value:e.fontsize||"48"},label:wp.i18n.__("Font size","sharing-image")},{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[lineheight]",min:0,max:4,step:.125,value:e.lineheight||"1.5"},label:wp.i18n.__("Line height","sharing-image")}],append:a}),p.element("input",{attributes:{type:"hidden",name:t+"[separator]",value:", "},append:a}),a}function At(e,n,a={}){let i=null;const o=a.uniqid||t.uniqid(),r=Et.name+`[layers][${o}]`;switch(n){case"text":i=Lt(a,r);break;case"image":i=function(e,t){const n=[];n.push(wp.i18n.__("Use JPG, GIF, or PNG image formats.","sharing-image")),n.push(wp.i18n.__("Leave the width and height fields blank to use the original image size.","sharing-image")),n.push(wp.i18n.__("Sizes are calculated proportionally if not specified.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-image"],label:wp.i18n.__("Image","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"image"},append:a}),p.control({classes:["sharing-image-editor-control","control-extend"],help:wp.i18n.__("Only visible on the admin side.","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:t+"[title]",value:e.title},dataset:{caption:"title"},label:wp.i18n.__("Field name","sharing-image")}],append:a}),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control","control-gapped"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[dynamic]",value:"dynamic"},label:wp.i18n.__("Dynamic image. Can be updated on the post editing screen.","sharing-image"),checked:n.dynamic},a);p.media({name:t+"[attachment]",classes:["sharing-image-editor-control-media"],value:n.attachment,link:Et.links.uploads,labels:{button:wp.i18n.__("Select an image","sharing-image"),heading:wp.i18n.__("Select layer image","sharing-image"),details:wp.i18n.__("Attachment details","sharing-image"),remove:wp.i18n.__("Remove image","sharing-image")},append:a,image:!0,remove:!0,help:wp.i18n.__("This field is for demonstration only, to preview the editor’s appearance.","sharing-image"),mime:["image/png","image/jpeg","image/gif","image/webp"]});const o=[],r=p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Preset image field","sharing-image"),fields:[{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"none"},dataset:{persistent:!0},label:wp.i18n.__("Manual selection","sharing-image"),checked:n.preset||"none"},{group:"radio",classes:["sharing-image-editor-control-radio"],attributes:{name:t+"[preset]",value:"featured"},dataset:{persistent:!0},label:wp.i18n.__("Use Post Featured Image","sharing-image"),checked:n.preset||"featured"}],append:e});o[o.length]=r;const s=()=>{o.forEach((e=>{e.classList.toggle("control-hidden")})),a.classList.add("control-unhelp"),i.checked&&a.classList.remove("control-unhelp")};i.checked||s(),i.addEventListener("change",(()=>{s()}))}(a,t,e),Tt(a,t,e),a}(a,r);break;case"filter":i=function(e,t){const n=[];n.push(wp.i18n.__("Filters are applied sequentially to the entire editor image.","sharing-image")),n.push(wp.i18n.__("If you want to control their order, create multiple layers.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Filter","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"filter"},append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"checkbox",classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[grayscale]",value:"grayscale"},label:wp.i18n.__("Converts the image into a grayscale version","sharing-image"),checked:e.grayscale}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"checkbox",classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[blur]",value:"blur"},label:wp.i18n.__("Blur image by Gaussian effect","sharing-image"),checked:e.blur}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[contrast]",min:-50,max:50,step:5,value:e.contrast||"0"},label:wp.i18n.__("Contrast","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[brightness]",min:-50,max:50,step:5,value:e.brightness||"0"},label:wp.i18n.__("Brightness","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[blackout]",min:0,max:100,step:5,value:e.blackout||"0"},label:wp.i18n.__("Blackout","sharing-image")}],append:a}),a}(a,r);break;case"rectangle":i=function(e,t){const n=[];n.push(wp.i18n.__("Draw a colored rectangle on the current image.","sharing-image")),n.push(wp.i18n.__("You can get a filled or outlined figure with custom color and opacity.","sharing-image")),n.push(wp.i18n.__("Use a small height to draw the line.","sharing-image")),n.push(wp.i18n.__("You can use negative values for position and dimensions.","sharing-image"));const a=p.layer({classes:["sharing-image-editor-layer","layer-text"],label:wp.i18n.__("Rectangle","sharing-image"),description:n.join(" ")});return p.element("input",{attributes:{type:"hidden",name:t+"[type]",value:"rectangle"},append:a}),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{type:"color",name:t+"[color]",value:e.color||"#ffffff"},label:wp.i18n.__("Rectangle color","sharing-image")}],append:a}),p.control({classes:["sharing-image-editor-control","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[x]"||0,value:e.x},label:wp.i18n.__("X","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[y]"||0,value:e.y},label:wp.i18n.__("Y","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[width]",value:e.width},label:wp.i18n.__("Width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{type:"text",name:t+"[height]",value:e.height},label:wp.i18n.__("Height","sharing-image")}],append:a}),Ot(a,t,e),function(e,t,n){const a=p.control({classes:["sharing-image-editor-control"],append:e}),i=p.checkbox({classes:["sharing-image-editor-control-checkbox"],attributes:{name:t+"[outline]",value:"outline"},label:wp.i18n.__("Outline rectangle.","sharing-image"),checked:n.outline},a),o=p.control({classes:["sharing-image-editor-control","control-hidden"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[thickness]",min:0,max:50,step:1,value:n.thickness||"0"},label:wp.i18n.__("Border width","sharing-image")}],append:e});n.outline&&o.classList.remove("control-hidden"),i.addEventListener("change",(()=>{o.classList.add("control-hidden"),i.checked&&o.classList.remove("control-hidden")}))}(a,t,e),p.control({classes:["sharing-image-editor-control"],fields:[{group:"input",classes:["sharing-image-editor-control-range"],attributes:{type:"range",name:t+"[opacity]",min:0,max:100,step:5,value:e.opacity||"0"},label:wp.i18n.__("Opacity","sharing-image")}],append:a}),a}(a,r);break;default:return null}return e.appendChild(i),function(e,t){const n=p.control({classes:["sharing-image-editor-control","control-footer"],append:t});p.element("button",{classes:["sharing-image-editor-delete"],text:wp.i18n.__("Delete layer","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{e.removeChild(t),St.classList.contains("editor-suspend")||Ct()}))}(e,i),function(e,t,n){const a=e.querySelector("h2"),i=p.element("button",{classes:["sharing-image-editor-collapse"],attributes:{type:"button",title:wp.i18n.__("Collapse layer","sharing-image")},prepend:a});let o=1===t.collapsed;o&&e.classList.add("layer-collapsed");const r=p.element("input",{attributes:{type:"hidden",name:n+"[collapsed]",value:Number(o)},append:e});i.addEventListener("click",(t=>{t.preventDefault(),o=!o,e.classList.toggle("layer-collapsed",o),i.setAttribute("title",wp.i18n.__("Collapse layer","sharing-image")),o&&i.setAttribute("title",wp.i18n.__("Expand layer","sharing-image")),r.value=Number(o)}))}(i,a,r),function(e,t){p.element("button",{classes:["sharing-image-editor-order"],attributes:{type:"button",title:wp.i18n.__("Change layer position","sharing-image")},append:t}),xt.create(e,{handle:".sharing-image-editor-order",onUpdate:()=>{St.classList.contains("editor-suspend")||Ct()}})}(e,i),i}const Mt=function(e,t,n,a={}){Et=t,St=function(e,t){Et.name="sharing_image_editor";const n=p.element("form",{classes:["sharing-image-editor"],attributes:{action:Et.links.action,method:"POST"},append:e});return Et.config.suspend&&n.classList.add("editor-suspend"),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_save_editor"},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_index",value:t},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:Et.nonce},append:n}),n.addEventListener("submit",(e=>{e.preventDefault(),function(){const e=new XMLHttpRequest;e.open("POST",ajaxurl),e.responseType="json",kt.classList.add("preview-loader");const t=new window.FormData(St);t.set("action","sharing_image_save_preview"),e.addEventListener("load",(()=>{const t=e.response||{};if(!t.data)return Dt();if(!t.success)return kt.classList.remove("preview-loader"),Dt(t.data);const n=kt.querySelector("input");null!==n&&(n.value=t.data),St.submit()})),e.addEventListener("error",(()=>{kt.classList.remove("preview-loader"),Dt()})),e.send(t)}()})),n}(e,n),function(e){const t=p.element("div",{classes:["sharing-image-editor-monitor"],append:St}),n=p.element("div",{classes:["sharing-image-editor-viewport"],append:t});!function(e,t){kt=p.element("div",{classes:["sharing-image-editor-preview","preview-blank"],append:e}),t.preview&&(p.element("img",{attributes:{src:t.preview,alt:""},append:kt}),kt.classList.remove("preview-blank")),p.element("span",{classes:["sharing-image-editor-loader"],append:kt}),p.element("input",{attributes:{type:"hidden",name:Et.name+"[preview]",value:t.preview},append:kt})}(n,e),p.element("div",{classes:["sharing-image-editor-warning"],append:n});const a=p.element("div",{classes:["sharing-image-editor-manager"],append:n});!function(e,t){p.checkbox({classes:["sharing-image-editor-debug"],attributes:{name:Et.name+"[debug]",value:"debug"},label:wp.i18n.__("Show debug frames","sharing-image"),checked:t.debug},e).addEventListener("change",(()=>{Ct()}))}(a,e),function(e){p.element("button",{text:wp.i18n.__("Save changes","sharing-image"),classes:["button","button-primary"],attributes:{type:"submit"},append:e})}(a),function(e){p.element("button",{text:wp.i18n.__("Generate preview","sharing-image"),classes:["button"],attributes:{type:"button"},append:e}).addEventListener("click",(()=>{Ct()}))}(a)}(a),function(e){const t=p.element("div",{classes:["sharing-image-editor-fieldset"],append:St});p.control({classes:["sharing-image-editor-control","control-compact","control-extend"],help:wp.i18n.__("Used only in the admin panel","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[title]",value:e.title},dataset:{persistent:!0,editor:"title"},label:wp.i18n.__("Template title","sharing-image")}],append:t}),p.control({classes:["sharing-image-editor-control"],label:wp.i18n.__("Fill color","sharing-image"),fields:[{group:"input",classes:["sharing-image-editor-control-color"],attributes:{name:Et.name+"[fill]",type:"color",value:e.fill},dataset:{editor:"fill"}}],append:t}),p.control({classes:["sharing-image-editor-control","control-compact","control-sizes"],fields:[{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[width]",value:e.width||"1200",placeholder:"1200",maxlength:4},dataset:{editor:"width"},label:wp.i18n.__("Editor width","sharing-image")},{group:"input",classes:["sharing-image-editor-control-input"],attributes:{name:Et.name+"[height]",value:e.height||"630",placeholder:"630",maxlength:4},dataset:{editor:"height"},label:wp.i18n.__("Editor height","sharing-image")}],append:t});const n=[];n.push(wp.i18n.__("You can add multiple layers on your editor.","sharing-image")),n.push(wp.i18n.__("Note that the stacking order of the layers is important.","sharing-image")),n.push(wp.i18n.__("You can change the order using the icon in the corner of each box.","sharing-image")),p.control({classes:["sharing-image-editor-control","control-reduced"],label:wp.i18n.__("Add layers","sharing-image"),description:n.join(" "),append:t}),function(e,t){const n=p.control({classes:["sharing-image-editor-control","control-select","control-compact"],fields:[{group:"select",classes:["sharing-image-editor-control-select"],options:{text:wp.i18n.__("Text","sharing-image"),image:wp.i18n.__("Image","sharing-image"),filter:wp.i18n.__("Filter","sharing-image"),rectangle:wp.i18n.__("Rectangle","sharing-image")}}],append:e});p.element("button",{classes:["button"],text:wp.i18n.__("Add new","sharing-image"),attributes:{type:"button"},append:n}).addEventListener("click",(()=>{const e=n.querySelector("select");null!==e&&At(a,e.value).scrollIntoView({behavior:"smooth"})}));const a=p.element("div",{classes:["sharing-image-editor-designer"],append:e});t.layers=t.layers||{};for(const e in t.layers){const n=t.layers[e];if(n.uniqid=e,n.hasOwnProperty("type")&&!At(a,n.type,n))return}}(t,e);const a=p.control({classes:["sharing-image-editor-control","control-footer"],append:t});!function(e){const t=new URL(document.location.href);t.searchParams.delete("template"),p.element("a",{classes:["button"],text:wp.i18n.__("← Back to Catalog","sharing-image"),attributes:{href:t.href},append:e})}(a),function(e){const t=new URL(document.location.href).searchParams.get("template"),n=new URL(Et.links.action);n.searchParams.set("action","sharing_image_delete_template"),n.searchParams.set("template",t),n.searchParams.set("nonce",Et.nonce),p.element("a",{classes:["sharing-image-editor-delete"],text:wp.i18n.__("Delete template","sharing-image"),attributes:{href:n.href},append:e}).addEventListener("click",(e=>{const t=wp.i18n.__("Are you sure you want to delete this template?","sharing-image");confirm(t)||e.preventDefault()}))}(a),t.addEventListener("change",(e=>{if(St.classList.contains("editor-suspend"))return;const t=e.target;t.hasAttribute("data-persistent")||t.hasAttribute("name")&&Ct()}))}(a)};let Nt=null;!function(){if(void 0===wp)return;let e=window.sharingImageSettings||{};e=t.defaults(e,["links","fonts","config","templates","license"]);const n=document.querySelector("#sharing-image-settings .sharing-image-content");if(null!==n)switch(n.classList.add("content-visible"),t.param("tab")){case"config":!function(e,t){!function(e,t){Nt=t,Nt.name="sharing_image_config";const n=e.querySelector(".sharing-image-config");if(null===n)return;const a=p.element("form",{classes:["sharing-image-config-options"],attributes:{action:Nt.links.action,method:"POST"},append:n}),i=Nt.config||{},o=Nt.templates||[];!function(e,t){const n=p.control({classes:["sharing-image-config-control","control-extra"],label:wp.i18n.__("Poster image format","sharing-image"),help:wp.i18n.__("The higher the value, the less compression. Availible for JPEG only.","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:{jpg:wp.i18n.__("JPEG","sharing-image"),png:wp.i18n.__("PNG","sharing-image"),gif:wp.i18n.__("GIF","sharing-image")},attributes:{name:Nt.name+"[format]"},selected:t.format||"jpg"},{group:"input",classes:["sharing-image-config-control-range"],attributes:{type:"range",name:Nt.name+"[quality]",min:10,max:100,step:5,value:t.quality||"90",disabled:"disabled"},label:wp.i18n.__("Image quality","sharing-image")}],append:e}),a=n.querySelector("select"),i=n.querySelector("input");"jpg"===a.value&&(i.disabled=!1),a.addEventListener("change",(()=>{i.disabled=!0,"jpg"===a.value&&(i.disabled=!1)}))}(a,i),function(e,t,n){const a={};a[""]=wp.i18n.__("Disable auto generation","sharing-image");for(const e in n)a[e]=n[e].title||wp.i18n.__("Untitled","sharing-image");let i=t.autogenerate;void 0===i&&(i=""),p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Auto generate poster","sharing-image"),help:wp.i18n.__("This template will be applied automatically when the post is saved.","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:a,attributes:{name:Nt.name+"[autogenerate]"},selected:String(i)}],append:e})}(a,i,o),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Hide post widget","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[nowidget]",value:"nowidget"},label:wp.i18n.__("Hide the widget on the post editor page","sharing-image"),checked:t.nowidget}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control","control-extra"],label:wp.i18n.__("Header Meta Tags","sharing-image"),fields:[{group:"select",classes:["sharing-image-config-control-select"],options:{snippets:wp.i18n.__("Display Meta Tags with consideration for SEO plugins","sharing-image"),custom:wp.i18n.__("Always display Meta Tags on all pages","sharing-image"),hidden:wp.i18n.__("Hide Sharing Image Meta Tags","sharing-image")},attributes:{name:Nt.name+"[meta]"},selected:t.meta||"snippets"}],append:e});if(0===Nt.snippets.length)return n;p.element("h4",{text:wp.i18n.__("Detected SEO plugins","sharing-image"),append:n});const a=p.element("ul",{classes:["sharing-image-config-control-list"],append:n});Nt.snippets.forEach((e=>{const t=p.element("li",{append:a});p.element("a",{attributes:{href:e.link,target:"_blank",rel:"noopener"},text:e.title,append:t})}))}(a,i),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Poster attachment","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[attachment]",value:"attachment"},label:wp.i18n.__("Save the generated poster as an attachment in the media library","sharing-image"),checked:t.attachment}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Upload directory","sharing-image"),append:e}),a=p.element("div",{classes:["sharing-image-config-control-fieldset"],append:n});p.radio({classes:["sharing-image-config-control-radio"],attributes:{name:Nt.name+"[uploads]",value:"default"},label:wp.i18n.__("Use default uploads directory","sharing-image"),checked:t.uploads||"default"},a),p.radio({classes:["sharing-image-config-control-radio"],attributes:{name:Nt.name+"[uploads]",value:"custom"},label:wp.i18n.__("Select custom storage for posters","sharing-image"),checked:t.uploads||"default"},a);const i=p.input({classes:["sharing-image-config-control-input"],attributes:{name:Nt.name+"[storage]",value:t.storage||Nt.links.storage,disabled:"disabled"}},n);p.element("small",{text:wp.i18n.__("Use a relative path from the site root. The directory should be writable.","sharing-image"),append:n}),n.querySelectorAll("input").forEach((e=>{"radio"===e.type&&(e.checked&&"custom"===e.value&&(i.disabled=!1),e.addEventListener("change",(()=>{i.disabled=!0,"custom"===e.value&&(i.disabled=!1)})))}))}(a,i),function(e,t){p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Live-reload","sharing-image"),fields:[{group:"checkbox",classes:["sharing-image-config-control-checkbox"],attributes:{name:Nt.name+"[suspend]",value:"suspend"},label:wp.i18n.__("Disable live reload on the template editor screen.","sharing-image"),checked:t.suspend}],append:e})}(a,i),function(e,t){const n=p.control({classes:["sharing-image-config-control"],label:wp.i18n.__("Default poster","sharing-image"),append:e});p.media({name:Nt.name+"[default]",classes:["sharing-image-config-control-media"],value:t.default,link:Nt.links.uploads,labels:{button:wp.i18n.__("Upload image","sharing-image"),heading:wp.i18n.__("Select default poster","sharing-image"),details:wp.i18n.__("Attachment details","sharing-image"),remove:wp.i18n.__("Remove image","sharing-image")},image:!0,remove:!0,append:n});const a=[];a.push(wp.i18n.__("The default poster is used on pages where none is generated.","sharing-image")),a.push(wp.i18n.__("Best image size: 1200×630 pixels.","sharing-image")),p.element("small",{text:a.join(" "),append:n})}(a,i),function(e,t){p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_save_config"},append:e}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:Nt.nonce},append:e}),p.element("input",{attributes:{type:"hidden",name:Nt.name+"[demo]",value:t.demo||""},append:e}),p.element("button",{text:wp.i18n.__("Save changes","sharing-image"),classes:["button","button-primary"],attributes:{type:"submit"},append:e})}(a,i)}(e,t)}(n,e);break;case"tools":!function(e,t){!function(e,t){d=t;const n=e.querySelector(".sharing-image-tools");null!==n&&(function(e){const t=d.templates||[],n=p.control({classes:["sharing-image-tools-control","control-section"],label:wp.i18n.__("Clone template","sharing-image"),append:e}),a=p.element("p",{classes:["sharing-image-tools-warning"],text:wp.i18n.__("To initiate cloning, enable Premium and have at least one template.","sharing-image")}),i=d.license||{};if(0===t.length||!i.premium&&!i.develop)return n.appendChild(a);const o={};for(const e in t)o[e]=t[e].title||wp.i18n.__("Untitled","sharing-image");const r=p.element("form",{classes:["sharing-image-tools-control-cloning"],attributes:{action:d.links.action,method:"POST"},append:n}),s=p.select({classes:["sharing-image-tools-control-duplicator"],options:o,attributes:{name:"sharing_image_source"}},r);p.element("button",{classes:["button","button-primary"],attributes:{type:"submit"},text:wp.i18n.__("Create a copy","sharing-image"),append:s.parentNode}),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_clone_template"},append:r}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:d.nonce},append:r})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control"],label:wp.i18n.__("Export templates","sharing-image"),append:e}),n=p.element("div",{classes:["sharing-image-tools-control-fieldset"],append:t}),a=new URL(d.links.action);a.searchParams.set("action","sharing_image_export_templates"),a.searchParams.set("nonce",d.nonce),p.element("a",{classes:["button","button-primary"],text:wp.i18n.__("Download backup file","sharing-image"),attributes:{href:a.href},append:n}),p.element("small",{text:wp.i18n.__("Save a local copy of all template settings for later use.","sharing-image"),append:n})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control","control-section"],label:wp.i18n.__("Import templates","sharing-image"),append:e}),n=p.element("form",{classes:["sharing-image-tools-control-uploader"],attributes:{action:d.links.action,method:"POST",enctype:"multipart/form-data"},append:t});p.element("input",{classes:["sharing-image-tools-control-file"],attributes:{type:"file",name:"sharing_image_file",accept:"application/json",required:"required"},append:n}),p.element("button",{classes:["button","button-primary"],attributes:{type:"submit"},text:wp.i18n.__("Import templates","sharing-image"),append:n}),p.element("input",{attributes:{type:"hidden",name:"action",value:"sharing_image_import_templates"},append:n}),p.element("input",{attributes:{type:"hidden",name:"sharing_image_nonce",value:d.nonce},append:n})}(n),function(e){const t=p.control({classes:["sharing-image-tools-control"],label:wp.i18n.__("Clearing settings","sharing-image"),append:e}),n=p.element("div",{classes:["sharing-image-tools-control-fieldset"],append:t}),a=new URL(d.links.action);a.searchParams.set("action","sharing_image_clear_templates"),a.searchParams.set("nonce",d.nonce),p.element("a",{classes:["sharing-image-tools-delete","button"],text:wp.i18n.__("Remove posters","sharing-image"),attributes:{href:a.href},append:n}).addEventListener("click",(e=>{const t=wp.i18n.__("Are you sure you want to clear plugin data?","sharing-image");confirm(t)||e.preventDefault()})),p.element("small",{text:wp.i18n.__("This action clears post meta options but does not delete server images.","sharing-image"),append:n})}(n))}(e,t)}(n,e);break;case"premium":!function(e,t){!function(e,t){h=t,m=e.querySelector(".sharing-image-premium"),null!==m&&(p.element("div",{classes:["sharing-image-premium-warning"],append:m}),w())}(e,t)}(n,e);break;default:!function(e,n){let a=null;n.templates=n.templates||[],t.param("template")&&(a=t.param("template"));const i=n.templates[a];void 0!==i?Mt(e,n,a,i):null===a?function(e,t){u=t;const n=p.element("div",{classes:["sharing-image-catalog"],append:e});for(const e in t.templates)g(n,t.templates[e],e);!function(e,t){const n=new URL(document.location.href);n.searchParams.set("template",t);const a=p.element("a",{classes:["sharing-image-catalog-new"],attributes:{href:n.href},append:e}),i=p.element("h2",{append:a});if(p.element("strong",{text:wp.i18n.__("Add new template","sharing-image"),append:i}),0===u.templates.length)return;const o=u.license||{};o.premium||o.develop||(p.element("span",{text:wp.i18n.__("(Availible for Premium only)","sharing-image"),append:i}),u.links.premium&&(a.href=u.links.premium))}(n,t.index)}(e,n):Mt(e,n,a)}(n,e)}}()})();
  • sharing-image/trunk/assets/sidebar/index.asset.php

    r3108262 r3109241  
    1 <?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-primitives'), 'version' => '3f29944870aa98b92603');
     1<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-primitives'), 'version' => '');
  • sharing-image/trunk/assets/sidebar/index.js

    r3108262 r3109241  
    1 (()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,a=window.wp.i18n,r=window.wp.apiFetch;var n=e.n(r);const i=window.wp.element,s=window.wp.data,l=window.wp.plugins,o=window.wp.editPost,c=window.wp.components,m=window.wp.notices,u=({name:e,layer:a,fieldset:r,setFieldset:n,attribute:l})=>{const[o,m]=(0,i.useState)(!1),u=(0,s.useSelect)((e=>e("core/editor").getEditedPostAttribute(l)));return(0,i.useEffect)((()=>{o||n({...r,[e]:u})}),[u]),(0,t.createElement)(c.TextareaControl,{name:e,label:a.title,value:r[e],onChange:t=>(t=>{n({...r,[e]:t}),m(!0)})(t)})},d=({name:e,layer:a,fieldset:r,setFieldset:n,attribute:l,entity:o})=>{const[m,u]=(0,i.useState)(!1),d=(0,s.useSelect)((e=>{const t=[];let r=e("core/editor").getEditedPostAttribute(l);return r||(r=[]),r.forEach((a=>{const r=e("core").getEntityRecord("taxonomy",o,a);r&&t.push(r.name)})),t.join(a.separator||", ")}));return(0,i.useEffect)((()=>{m||n({...r,[e]:d})}),[d]),(0,t.createElement)(c.TextareaControl,{name:e,label:a.title,value:r[e],onChange:t=>(t=>{n({...r,[e]:t}),u(!0)})(t)})},g=(0,i.forwardRef)((function({icon:e,size:t=24,...a},r){return(0,i.cloneElement)(e,{width:t,height:t,...a,ref:r})})),p=window.wp.primitives,w=(0,t.createElement)(p.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)(p.Path,{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z"})),E=window.wp.blockEditor,h=({name:e,layer:r,mode:n,fieldset:l,setFieldset:o})=>{const m=(0,s.useSelect)((e=>e("core/editor").getEditedPostAttribute("featured_media"))),u=(0,s.useSelect)((t=>{const a=t("core").getMedia(l[e]);let r=a?.media_details?.sizes?.thumbnail?.source_url;return r||(r=a?.source_url),r}),[l]);(0,i.useEffect)((()=>{"manual"!==n&&"featured"===r.preset&&o({...l,[e]:m})}),[m]);const d=()=>{o({...l,[e]:0})};return(0,t.createElement)(E.MediaUploadCheck,null,(0,t.createElement)(E.MediaUpload,{onSelect:t=>{var a;a=t.id,o({...l,[e]:a})},allowedTypes:["image"],value:l[e],render:({open:r})=>l[e]?(0,t.createElement)(t.Fragment,null,u&&(0,t.createElement)("img",{src:u,alt:"",className:"g4qkvGu7xkyoImxRZ6GR"}),(0,t.createElement)(c.Button,{variant:"link",onClick:d},(0,a.__)("Remove image","sharing-image"))):(e=>(0,t.createElement)(t.Fragment,null,(0,t.createElement)(g,{icon:w,className:"ipnonin6Xj5A9QU3K38L"}),(0,t.createElement)(c.Button,{variant:"link",onClick:e},(0,a.__)("Set layer image","sharing-image"))))(r)}))},f=({layers:e,mode:a,fieldset:r,setFieldset:n})=>{const i=(e,a)=>(0,t.createElement)(c.TextareaControl,{name:a,label:e.title,defaultValue:r[a],onChange:e=>n({...r,[a]:e})}),s=(e,s)=>{if("manual"===a)return i(e,s);const l={name:s,layer:e,fieldset:r,setFieldset:n};switch(e.preset){case"title":return(0,t.createElement)(u,{...l,attribute:"title"});case"excerpt":return(0,t.createElement)(u,{...l,attribute:"excerpt"});case"categories":return(0,t.createElement)(d,{...l,attribute:"categories",entity:"category"});case"tags":return(0,t.createElement)(d,{...l,attribute:"tags",entity:"post_tag"})}return i(e,s)},l=(e,i)=>{const s={name:i,layer:e,mode:a,fieldset:r,setFieldset:n};return(0,t.createElement)(c.BaseControl,{id:null,label:e.title},(0,t.createElement)(c.Flex,{justify:"flex-start",style:{border:"solid 1px #ccc",padding:"4px",borderRadius:"4px"}},(0,t.createElement)(h,{...s})))};return(()=>{const t=[];for(const a in e){const r=e[a];if(r.dynamic)switch(r.type){case"text":t.push(s(r,a));break;case"image":t.push(l(r,a))}}return t})()},y=({meta:e,templates:r})=>{const{createErrorNotice:l,removeNotice:o}=(0,s.useDispatch)(m.store),u=(0,s.useSelect)((e=>e("core/editor").getCurrentPostId())),d=(0,s.useSelect)((e=>e("core/editor").getEditedPostAttribute("meta")||{})),{editPost:g}=(0,s.useDispatch)("core/editor",[d]),[p,w]=(0,i.useState)(d[e.source]?.template),[E,h]=(0,i.useState)(d[e.fieldset]),[y,b]=(0,i.useState)(!1);return(0,i.useEffect)((()=>{g({meta:{[e.fieldset]:E}})}),[E]),(0,i.useEffect)((()=>{const[e]=Object.keys(r);!r[p]&&e&&w(e)}),[r,p]),(0,t.createElement)(c.Flex,{direction:"column",gap:2,style:{position:"relative"}},d[e.source]?.poster&&(0,t.createElement)("img",{src:d[e.source].poster,alt:(0,a.__)("Sharing Image poster","sharing-image")}),"auto"===d[e.source]?.mode&&(()=>{const e=(0,a.__)("Poster was generated automatically and will update on post saving.","sharing-image");return(0,t.createElement)(c.Dashicon,{icon:"awards",className:"BygBjwYpqPpeTZbVCcRT",title:e})})(),(0,t.createElement)(c.SelectControl,{value:p,options:Object.keys(r).map((e=>({label:r[e].title||(0,a.__)("Untitled","sharing-image"),value:e}))),onChange:t=>{g({meta:{[e.source]:{...d[e.source],template:t}}}),w(t)}}),r[p]&&(0,t.createElement)(c.Flex,{direction:"column",gap:2},(0,t.createElement)(f,{layers:r[p].layers||[],mode:d[e.source]?.mode,fieldset:E,setFieldset:h})),(0,t.createElement)(c.Flex,{justify:"flex-start"},(0,t.createElement)(c.Button,{variant:"secondary",type:"button",onClick:()=>(async()=>{if(y)return;o("sharing-image-generate");const t={path:"sharing-image/v1/poster/"+u,method:"POST",data:{fieldset:E,template:p}};b(!0);try{const a=await n()(t);if(!a.data)throw new Error;g({meta:{[e.source]:{...a.data,template:p}}})}catch(e){l((0,a.__)("An unexpected error occurred","sharing-image"),{id:"sharing-image-generate",type:"snackbar"})}b(!1)})()},(0,a.__)("Generate","sharing-image")),(0,t.createElement)(c.Button,{variant:"tertiary",isDestructive:!0,onClick:()=>{g({meta:{[e.source]:{}}})}},(0,a.__)("Remove","sharing-image")),y&&(0,t.createElement)(c.Spinner,null)))};(0,l.registerPlugin)("sharing-image-sidebar",{render:()=>{const e=window.sharingImageSidebar||{};if(e.meta?.source&&e.meta?.fieldset)return(0,t.createElement)(o.PluginDocumentSettingPanel,{name:"sharing-image-sidebar",title:(0,a.__)("Sharing Image","sharing-image")},(0,t.createElement)(y,{...e}))}})})();
     1(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,a=window.wp.i18n,r=window.wp.apiFetch;var n=e.n(r);const i=window.wp.element,.PluginDocumentSettingPanel,{name:"sharing-image-sidebar",title:(0,a.__)("Sharing Image","sharing-image")},(0,t.createElement)(y,{...e}))}})})();
  • sharing-image/trunk/classes/class-config.php

    r3108262 r3109241  
    154154
    155155    /**
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
    156178     * Get quality of generated poster.
    157179     *
  • sharing-image/trunk/classes/class-generator.php

    r3108262 r3109241  
    295295
    296296        if ( ! isset( $layer['width'] ) ) {
    297             $layer['width'] = 0;
     297            $layer['width'] = ;
    298298        }
    299299
    300300        if ( ! isset( $layer['height'] ) ) {
    301             $layer['height'] = 0;
     301            $layer['height'] = ;
    302302        }
    303303
     
    536536     */
    537537    private static function update_layer_dimensions( $layer, $poster ) {
     538
     539
     540
     541
    538542        $width = absint( $poster->width() );
    539543
  • sharing-image/trunk/classes/class-widget.php

    r3108262 r3109241 ��
    273273            return;
    274274        }
     275
     276
     277
     278
     279
     280
     281
    275282        $asset = require SHARING_IMAGE_DIR . 'assets/sidebar/index.asset.php';
    276283
     
    295302
    296303        $data = array(
    297             'meta'      => array(
     304            'meta'      => array(
    298305                'source'   => self::META_SOURCE,
    299306                'fieldset' => self::META_FIELDSET,
    300307            ),
    301             'templates' => Templates::get_templates(),
     308            'autogenerate' => Config::get_autogenerate_index(),
     309            'templates'    => Templates::get_templates(),
    302310        );
    303311
     
    593601        }
    594602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
     615
     616
     617
     618
    595619        $meta = get_post_meta( $post_id, self::META_SOURCE, true );
    596620
     
    599623        }
    600624
    601         $config = Config::get_config();
    602 
    603         if ( empty( $config['autogenerate'] ) ) {
    604             return;
    605         }
    606 
    607         $index = sanitize_key( $config['autogenerate'] );
     625        $index = Config::get_autogenerate_index();
     626
     627        if ( empty( $index ) ) {
     628            return;
     629        }
    608630
    609631        // Compose fieldset by template index.
  • sharing-image/trunk/readme.txt

    r3108262 r3109241  
    22Contributors: antonlukin
    33Donate link: https://wpset.org/about/
    4 Tags: social image, sharing image, og image, twitter image, facebook, twitter, telegram, vk.com, ok.ru
     4Tags: social image, sharing image, og image,
    55Requires at least: 5.3
    66Tested up to: 6.5
    7 Stable tag: 3.0
     7Stable tag: 3.
    88Requires PHP: 5.5
    99License: GPLv2 or later
     
    3030
    3131== Changelog ==
     32
     33
     34
     35
     36
    3237
    3338= 3.0 =
  • sharing-image/trunk/sharing-image.php

    r3108262 r3109241  
    33 * Plugin Name:       Sharing Image
    44 * Description:       Create sharing image for Facebook, VK.com, Telegram and other social networks
    5  * Version:           3.0
     5 * Version:           3.
    66 * Requires at least: 5.3
    77 * Requires PHP:      5.6
     
    2525 * Plugin version.
    2626 */
    27 define( 'SHARING_IMAGE_VERSION', '3.0' );
     27define( 'SHARING_IMAGE_VERSION', '3.' );
    2828
    2929/**
Note: See TracChangeset for help on using the changeset viewer.