PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.1
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.1
1.7.1 1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 All 51 releases
← All changes | assets/chunks/AttrGroups.js +3 -3 1.5.2 → 1.7.1 View file →
@@ -1,5 +1,5 @@
1 -var Yn=Object.defineProperty;var Xn=(t,e,n)=>e in t?Yn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Bt=(t,e,n)=>Xn(t,typeof e!="symbol"?e+"":e,n);import{I as Un,r as te,X as un,e as C,b as oe,o as y,F as re,g as Le,t as V,h as R,v as Dn,d as g,a as v,m as Sn,n as Oe,z as He,u as S,G as Ze,c as Ae,x as At,J as Cn,w as B,f as Ee,l as ce,q as Ne,K as Hn,S as Wn,U as Kn,s as zn}from"./vue.esm-bundler.js?ver=1.5.2";import{t as d}from"./Translator.js?ver=1.5.2";import{R as Me}from"./Rest.js?ver=1.5.2";import{E as cn}from"./index.js?ver=1.5.2";import{n as me}from"./Notify.js?ver=1.5.2";import{_ as le}from"./DynamicIcon.js?ver=1.5.2";import{h as kn,a as qn}from"./common.js?ver=1.5.2";import{_ as Jn}from"./_plugin-vue_export-helper.js?ver=1.5.2";const Rt={"dark navy":"#1A2332","dark slate":"#374151","slate gray":"#6b7280","light gray":"#9CA3AF",pearl:"#D1D5DB",white:"#ffffff",red:"#ef4444",orange:"#F97316",yellow:"#eab308",amber:"#CA8A04",green:"#22c55e","dark green":"#4D7C0F",teal:"#0D9488",blue:"#3b82f6",navy:"#1E3A8A",purple:"#7C3AED",pink:"#EC4899","dark red":"#991B1B",brown:"#92400E",cream:"#FEF3C7",mint:"#5EEAD4",steel:"#475569","burnt orange":"#EA580C",forest:"#15803D",black:"#000000",grey:"#6b7280",gray:"#6b7280",violet:"#7C3AED",indigo:"#1E3A8A",cyan:"#0D9488",turquoise:"#0D9488",lime:"#15803D",coral:"#F97316",maroon:"#991B1B",olive:"#4D7C0F",magenta:"#EC4899",gold:"#d4af37",silver:"#c0c0c0",beige:"#f5f5dc"},Zn=[...new Set(Object.values(Rt))],Qn=Object.entries(Rt).reduce((t,[e,n])=>{const o=(n||"").toLowerCase();return o&&!t[o]&&(t[o]=e),t},{});function eo(t){return t&&Rt[t.trim().toLowerCase()]||null}function dn(t){return t&&Qn[t.trim().toLowerCase()]||null}/*!
1 +var Yn=Object.defineProperty;var Xn=(t,e,n)=>e in t?Yn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Bt=(t,e,n)=>Xn(t,typeof e!="symbol"?e+"":e,n);import{d as Un,v as te,h as un,g as S,l as oe,j as y,F as re,D as Le,x as V,f as R,w as Dn,C as v,G as g,k as Sn,V as He,A as Oe,u as k,P as Qe,m as Ae,n as At,r as Cn,t as B,q as Ee,e as ce,E as Ne,Q as Hn,O as Wn,X as Kn,J as zn}from"./vue.esm-bundler.js?ver=1.7.1";import{t as d}from"./Translator.js?ver=1.7.1";import{R as Me}from"./Rest.js?ver=1.7.1";import{a as kn,b as qn}from"./common.js?ver=1.7.1";import{a as cn}from"./index.js?ver=1.7.1";import{n as me}from"./Notify.js?ver=1.7.1";import{_ as le}from"./DynamicIcon.js?ver=1.7.1";import{_ as Jn}from"./_plugin-vue_export-helper.js?ver=1.7.1";import{P as Qn}from"./PageHeading.js?ver=1.7.1";const Rt={"dark navy":"#1A2332","dark slate":"#374151","slate gray":"#6b7280","light gray":"#9CA3AF",pearl:"#D1D5DB",white:"#ffffff",red:"#ef4444",orange:"#F97316",yellow:"#eab308",amber:"#CA8A04",green:"#22c55e","dark green":"#4D7C0F",teal:"#0D9488",blue:"#3b82f6",navy:"#1E3A8A",purple:"#7C3AED",pink:"#EC4899","dark red":"#991B1B",brown:"#92400E",cream:"#FEF3C7",mint:"#5EEAD4",steel:"#475569","burnt orange":"#EA580C",forest:"#15803D",black:"#000000",grey:"#6b7280",gray:"#6b7280",violet:"#7C3AED",indigo:"#1E3A8A",cyan:"#0D9488",turquoise:"#0D9488",lime:"#15803D",coral:"#F97316",maroon:"#991B1B",olive:"#4D7C0F",magenta:"#EC4899",gold:"#d4af37",silver:"#c0c0c0",beige:"#f5f5dc"},Zn=[...new Set(Object.values(Rt))],eo=Object.entries(Rt).reduce((t,[e,n])=>{const o=(n||"").toLowerCase();return o&&!t[o]&&(t[o]=e),t},{});function to(t){return t&&Rt[t.trim().toLowerCase()]||null}function dn(t){return t&&eo[t.trim().toLowerCase()]||null}/*!
2 2 * vue-draggable-next v2.2.0
3 3 * (c) 2023 Anish George
4 4 * @license MIT
5 5 *//**!
@@ -6,6 +6,6 @@
6 6 * Sortable 1.14.0
7 7 * @author RubaXa <[email protected]>
8 8 * @author owenm <[email protected]>
9 9 * @license MIT
10 - */function fn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,o)}return n}function Fe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fn(Object(n),!0).forEach(function(o){to(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function Ct(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ct=function(e){return typeof e}:Ct=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ct(t)}function to(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ge(){return Ge=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Ge.apply(this,arguments)}function no(t,e){if(t==null)return{};var n={},o=Object.keys(t),a,r;for(r=0;r<o.length;r++)a=o[r],!(e.indexOf(a)>=0)&&(n[a]=t[a]);return n}function oo(t,e){if(t==null)return{};var n=no(t,e),o,a;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(a=0;a<r.length;a++)o=r[a],!(e.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var ao="1.14.0";function Be(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var je=Be(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),yt=Be(/Edge/i),pn=Be(/firefox/i),mt=Be(/safari/i)&&!Be(/chrome/i)&&!Be(/android/i),Tn=Be(/iP(ad|od|hone)/i),ro=Be(/chrome/i)&&Be(/android/i),In={capture:!1,passive:!1};function G(t,e,n){t.addEventListener(e,n,!je&&In)}function L(t,e,n){t.removeEventListener(e,n,!je&&In)}function xt(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function io(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Pe(t,e,n,o){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&xt(t,e):xt(t,e))||o&&t===n)return t;if(t===n)break}while(t=io(t))}return null}var mn=/\s+/g;function _e(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(mn," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(mn," ")}}function I(t,e,n){var o=t&&t.style;if(o){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),e===void 0?n:n[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=n+(typeof n=="string"?"":"px")}}function at(t,e){var n="";if(typeof t=="string")n=t;else do{var o=I(t,"transform");o&&o!=="none"&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var a=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return a&&new a(n)}function On(t,e,n){if(t){var o=t.getElementsByTagName(e),a=0,r=o.length;if(n)for(;a<r;a++)n(o[a],a);return o}return[]}function Re(){var t=document.scrollingElement;return t||document.documentElement}function ae(t,e,n,o,a){if(!(!t.getBoundingClientRect&&t!==window)){var r,i,l,c,s,p,u;if(t!==window&&t.parentNode&&t!==Re()?(r=t.getBoundingClientRect(),i=r.top,l=r.left,c=r.bottom,s=r.right,p=r.height,u=r.width):(i=0,l=0,c=window.innerHeight,s=window.innerWidth,p=window.innerHeight,u=window.innerWidth),(e||n)&&t!==window&&(a=a||t.parentNode,!je))do if(a&&a.getBoundingClientRect&&(I(a,"transform")!=="none"||n&&I(a,"position")!=="static")){var m=a.getBoundingClientRect();i-=m.top+parseInt(I(a,"border-top-width")),l-=m.left+parseInt(I(a,"border-left-width")),c=i+r.height,s=l+r.width;break}while(a=a.parentNode);if(o&&t!==window){var D=at(a||t),h=D&&D.a,T=D&&D.d;D&&(i/=T,l/=h,u/=h,p/=T,c=i+p,s=l+u)}return{top:i,left:l,bottom:c,right:s,width:u,height:p}}}function hn(t,e,n){for(var o=We(t,!0),a=ae(t)[e];o;){var r=ae(o)[n],i=void 0;if(i=a>=r,!i)return o;if(o===Re())break;o=We(o,!1)}return!1}function rt(t,e,n,o){for(var a=0,r=0,i=t.children;r<i.length;){if(i[r].style.display!=="none"&&i[r]!==O.ghost&&(o||i[r]!==O.dragged)&&Pe(i[r],n.draggable,t,!1)){if(a===e)return i[r];a++}r++}return null}function rn(t,e){for(var n=t.lastElementChild;n&&(n===O.ghost||I(n,"display")==="none"||e&&!xt(n,e));)n=n.previousElementSibling;return n||null}function ke(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==O.clone&&(!e||xt(t,e))&&n++;return n}function gn(t){var e=0,n=0,o=Re();if(t)do{var a=at(t),r=a.a,i=a.d;e+=t.scrollLeft*r,n+=t.scrollTop*i}while(t!==o&&(t=t.parentNode));return[e,n]}function lo(t,e){for(var n in t)if(t.hasOwnProperty(n)){for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n)}return-1}function We(t,e){if(!t||!t.getBoundingClientRect)return Re();var n=t,o=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var a=I(n);if(n.clientWidth<n.scrollWidth&&(a.overflowX=="auto"||a.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(a.overflowY=="auto"||a.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return Re();if(o||e)return n;o=!0}}while(n=n.parentNode);return Re()}function so(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Gt(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}var ht;function An(t,e){return function(){if(!ht){var n=arguments,o=this;n.length===1?t.call(o,n[0]):t.apply(o,n),ht=setTimeout(function(){ht=void 0},e)}}}function uo(){clearTimeout(ht),ht=void 0}function xn(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function $n(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}var De="Sortable"+new Date().getTime();function co(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var o=[].slice.call(this.el.children);o.forEach(function(a){if(!(I(a,"display")==="none"||a===O.ghost)){t.push({target:a,rect:ae(a)});var r=Fe({},t[t.length-1].rect);if(a.thisAnimationDuration){var i=at(a,!0);i&&(r.top-=i.f,r.left-=i.e)}a.fromRect=r}})}},addAnimationState:function(o){t.push(o)},removeAnimationState:function(o){t.splice(lo(t,{target:o}),1)},animateAll:function(o){var a=this;if(!this.options.animation){clearTimeout(e),typeof o=="function"&&o();return}var r=!1,i=0;t.forEach(function(l){var c=0,s=l.target,p=s.fromRect,u=ae(s),m=s.prevFromRect,D=s.prevToRect,h=l.rect,T=at(s,!0);T&&(u.top-=T.f,u.left-=T.e),s.toRect=u,s.thisAnimationDuration&&Gt(m,u)&&!Gt(p,u)&&(h.top-u.top)/(h.left-u.left)===(p.top-u.top)/(p.left-u.left)&&(c=po(h,m,D,a.options)),Gt(u,p)||(s.prevFromRect=p,s.prevToRect=u,c||(c=a.options.animation),a.animate(s,h,u,c)),c&&(r=!0,i=Math.max(i,c),clearTimeout(s.animationResetTimer),s.animationResetTimer=setTimeout(function(){s.animationTime=0,s.prevFromRect=null,s.fromRect=null,s.prevToRect=null,s.thisAnimationDuration=null},c),s.thisAnimationDuration=c)}),clearTimeout(e),r?e=setTimeout(function(){typeof o=="function"&&o()},i):typeof o=="function"&&o(),t=[]},animate:function(o,a,r,i){if(i){I(o,"transition",""),I(o,"transform","");var l=at(this.el),c=l&&l.a,s=l&&l.d,p=(a.left-r.left)/(c||1),u=(a.top-r.top)/(s||1);o.animatingX=!!p,o.animatingY=!!u,I(o,"transform","translate3d("+p+"px,"+u+"px,0)"),this.forRepaintDummy=fo(o),I(o,"transition","transform "+i+"ms"+(this.options.easing?" "+this.options.easing:"")),I(o,"transform","translate3d(0,0,0)"),typeof o.animated=="number"&&clearTimeout(o.animated),o.animated=setTimeout(function(){I(o,"transition",""),I(o,"transform",""),o.animated=!1,o.animatingX=!1,o.animatingY=!1},i)}}}}function fo(t){return t.offsetWidth}function po(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}var et=[],jt={initializeByDefault:!0},_t={mount:function(e){for(var n in jt)jt.hasOwnProperty(n)&&!(n in e)&&(e[n]=jt[n]);et.forEach(function(o){if(o.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),et.push(e)},pluginEvent:function(e,n,o){var a=this;this.eventCanceled=!1,o.cancel=function(){a.eventCanceled=!0};var r=e+"Global";et.forEach(function(i){n[i.pluginName]&&(n[i.pluginName][r]&&n[i.pluginName][r](Fe({sortable:n},o)),n.options[i.pluginName]&&n[i.pluginName][e]&&n[i.pluginName][e](Fe({sortable:n},o)))})},initializePlugins:function(e,n,o,a){et.forEach(function(l){var c=l.pluginName;if(!(!e.options[c]&&!l.initializeByDefault)){var s=new l(e,n,e.options);s.sortable=e,s.options=e.options,e[c]=s,Ge(o,s.defaults)}});for(var r in e.options)if(e.options.hasOwnProperty(r)){var i=this.modifyOption(e,r,e.options[r]);typeof i<"u"&&(e.options[r]=i)}},getEventProperties:function(e,n){var o={};return et.forEach(function(a){typeof a.eventProperties=="function"&&Ge(o,a.eventProperties.call(n[a.pluginName],e))}),o},modifyOption:function(e,n,o){var a;return et.forEach(function(r){e[r.pluginName]&&r.optionListeners&&typeof r.optionListeners[n]=="function"&&(a=r.optionListeners[n].call(e[r.pluginName],o))}),a}};function mo(t){var e=t.sortable,n=t.rootEl,o=t.name,a=t.targetEl,r=t.cloneEl,i=t.toEl,l=t.fromEl,c=t.oldIndex,s=t.newIndex,p=t.oldDraggableIndex,u=t.newDraggableIndex,m=t.originalEvent,D=t.putSortable,h=t.extraEventProperties;if(e=e||n&&n[De],!!e){var T,j=e.options,z="on"+o.charAt(0).toUpperCase()+o.substr(1);window.CustomEvent&&!je&&!yt?T=new CustomEvent(o,{bubbles:!0,cancelable:!0}):(T=document.createEvent("Event"),T.initEvent(o,!0,!0)),T.to=i||n,T.from=l||n,T.item=a||n,T.clone=r,T.oldIndex=c,T.newIndex=s,T.oldDraggableIndex=p,T.newDraggableIndex=u,T.originalEvent=m,T.pullMode=D?D.lastPutMode:void 0;var X=Fe(Fe({},h),_t.getEventProperties(o,e));for(var Z in X)T[Z]=X[Z];n&&n.dispatchEvent(T),j[z]&&j[z].call(e,T)}}var ho=["evt"],ye=function(e,n){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.evt,r=oo(o,ho);_t.pluginEvent.bind(O)(e,n,Fe({dragEl:f,parentEl:Q,ghostEl:M,rootEl:J,nextEl:Je,lastDownEl:kt,cloneEl:ee,cloneHidden:Ue,dragStarted:ct,putSortable:ue,activeSortable:O.active,originalEvent:a,oldIndex:ot,oldDraggableIndex:gt,newIndex:we,newDraggableIndex:Xe,hideGhostForTarget:Rn,unhideGhostForTarget:Fn,cloneNowHidden:function(){Ue=!0},cloneNowShown:function(){Ue=!1},dispatchSortableEvent:function(l){he({sortable:n,name:l,originalEvent:a})}},r))};function he(t){mo(Fe({putSortable:ue,cloneEl:ee,targetEl:f,rootEl:J,oldIndex:ot,oldDraggableIndex:gt,newIndex:we,newDraggableIndex:Xe},t))}var f,Q,M,J,Je,kt,ee,Ue,ot,we,gt,Xe,wt,ue,nt=!1,$t=!1,Nt=[],ze,Ie,Yt,Xt,vn,bn,ct,tt,vt,bt=!1,Et=!1,Tt,pe,Ut=[],Qt=!1,Pt=[],Ft=typeof document<"u",Dt=Tn,yn=yt||je?"cssFloat":"float",go=Ft&&!ro&&!Tn&&"draggable"in document.createElement("div"),Nn=function(){if(Ft){if(je)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Pn=function(e,n){var o=I(e),a=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),r=rt(e,0,n),i=rt(e,1,n),l=r&&I(r),c=i&&I(i),s=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+ae(r).width,p=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+ae(i).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&l.float&&l.float!=="none"){var u=l.float==="left"?"left":"right";return i&&(c.clear==="both"||c.clear===u)?"vertical":"horizontal"}return r&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||s>=a&&o[yn]==="none"||i&&o[yn]==="none"&&s+p>a)?"vertical":"horizontal"},vo=function(e,n,o){var a=o?e.left:e.top,r=o?e.right:e.bottom,i=o?e.width:e.height,l=o?n.left:n.top,c=o?n.right:n.bottom,s=o?n.width:n.height;return a===l||r===c||a+i/2===l+s/2},bo=function(e,n){var o;return Nt.some(function(a){var r=a[De].options.emptyInsertThreshold;if(!(!r||rn(a))){var i=ae(a),l=e>=i.left-r&&e<=i.right+r,c=n>=i.top-r&&n<=i.bottom+r;if(l&&c)return o=a}}),o},Mn=function(e){function n(r,i){return function(l,c,s,p){var u=l.options.group.name&&c.options.group.name&&l.options.group.name===c.options.group.name;if(r==null&&(i||u))return!0;if(r==null||r===!1)return!1;if(i&&r==="clone")return r;if(typeof r=="function")return n(r(l,c,s,p),i)(l,c,s,p);var m=(i?l:c).options.group.name;return r===!0||typeof r=="string"&&r===m||r.join&&r.indexOf(m)>-1}}var o={},a=e.group;(!a||Ct(a)!="object")&&(a={name:a}),o.name=a.name,o.checkPull=n(a.pull,!0),o.checkPut=n(a.put),o.revertClone=a.revertClone,e.group=o},Rn=function(){!Nn&&M&&I(M,"display","none")},Fn=function(){!Nn&&M&&I(M,"display","")};Ft&&document.addEventListener("click",function(t){if($t)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),$t=!1,!1},!0);var qe=function(e){if(f){e=e.touches?e.touches[0]:e;var n=bo(e.clientX,e.clientY);if(n){var o={};for(var a in e)e.hasOwnProperty(a)&&(o[a]=e[a]);o.target=o.rootEl=n,o.preventDefault=void 0,o.stopPropagation=void 0,n[De]._onDragOver(o)}}},yo=function(e){f&&f.parentNode[De]._isOutsideThisEl(e.target)};function O(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=Ge({},e),t[De]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Pn(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(i,l){i.setData("Text",l.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:O.supportPointer!==!1&&"PointerEvent"in window&&!mt,emptyInsertThreshold:5};_t.initializePlugins(this,t,n);for(var o in n)!(o in e)&&(e[o]=n[o]);Mn(e);for(var a in this)a.charAt(0)==="_"&&typeof this[a]=="function"&&(this[a]=this[a].bind(this));this.nativeDraggable=e.forceFallback?!1:go,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?G(t,"pointerdown",this._onTapStart):(G(t,"mousedown",this._onTapStart),G(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(G(t,"dragover",this),G(t,"dragenter",this)),Nt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Ge(this,co())}O.prototype={constructor:O,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(tt=null)},_getDirection:function(e,n){return typeof this.options.direction=="function"?this.options.direction.call(this,e,n,f):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,a=this.options,r=a.preventOnFilter,i=e.type,l=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,c=(l||e).target,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||c,p=a.filter;if(To(o),!f&&!(/mousedown|pointerdown/.test(i)&&e.button!==0||a.disabled)&&!s.isContentEditable&&!(!this.nativeDraggable&&mt&&c&&c.tagName.toUpperCase()==="SELECT")&&(c=Pe(c,a.draggable,o,!1),!(c&&c.animated)&&kt!==c)){if(ot=ke(c),gt=ke(c,a.draggable),typeof p=="function"){if(p.call(this,e,c,this)){he({sortable:n,rootEl:s,name:"filter",targetEl:c,toEl:o,fromEl:o}),ye("filter",n,{evt:e}),r&&e.cancelable&&e.preventDefault();return}}else if(p&&(p=p.split(",").some(function(u){if(u=Pe(s,u.trim(),o,!1),u)return he({sortable:n,rootEl:u,name:"filter",targetEl:c,fromEl:o,toEl:o}),ye("filter",n,{evt:e}),!0}),p)){r&&e.cancelable&&e.preventDefault();return}a.handle&&!Pe(s,a.handle,o,!1)||this._prepareDragStart(e,l,c)}}},_prepareDragStart:function(e,n,o){var a=this,r=a.el,i=a.options,l=r.ownerDocument,c;if(o&&!f&&o.parentNode===r){var s=ae(o);if(J=r,f=o,Q=f.parentNode,Je=f.nextSibling,kt=o,wt=i.group,O.dragged=f,ze={target:f,clientX:(n||e).clientX,clientY:(n||e).clientY},vn=ze.clientX-s.left,bn=ze.clientY-s.top,this._lastX=(n||e).clientX,this._lastY=(n||e).clientY,f.style["will-change"]="all",c=function(){if(ye("delayEnded",a,{evt:e}),O.eventCanceled){a._onDrop();return}a._disableDelayedDragEvents(),!pn&&a.nativeDraggable&&(f.draggable=!0),a._triggerDragStart(e,n),he({sortable:a,name:"choose",originalEvent:e}),_e(f,i.chosenClass,!0)},i.ignore.split(",").forEach(function(p){On(f,p.trim(),Ht)}),G(l,"dragover",qe),G(l,"mousemove",qe),G(l,"touchmove",qe),G(l,"mouseup",a._onDrop),G(l,"touchend",a._onDrop),G(l,"touchcancel",a._onDrop),pn&&this.nativeDraggable&&(this.options.touchStartThreshold=4,f.draggable=!0),ye("delayStart",this,{evt:e}),i.delay&&(!i.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(yt||je))){if(O.eventCanceled){this._onDrop();return}G(l,"mouseup",a._disableDelayedDrag),G(l,"touchend",a._disableDelayedDrag),G(l,"touchcancel",a._disableDelayedDrag),G(l,"mousemove",a._delayedDragTouchMoveHandler),G(l,"touchmove",a._delayedDragTouchMoveHandler),i.supportPointer&&G(l,"pointermove",a._delayedDragTouchMoveHandler),a._dragStartTimer=setTimeout(c,i.delay)}else c()}},_delayedDragTouchMoveHandler:function(e){var n=e.touches?e.touches[0]:e;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){f&&Ht(f),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;L(e,"mouseup",this._disableDelayedDrag),L(e,"touchend",this._disableDelayedDrag),L(e,"touchcancel",this._disableDelayedDrag),L(e,"mousemove",this._delayedDragTouchMoveHandler),L(e,"touchmove",this._delayedDragTouchMoveHandler),L(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,n){n=n||e.pointerType=="touch"&&e,!this.nativeDraggable||n?this.options.supportPointer?G(document,"pointermove",this._onTouchMove):n?G(document,"touchmove",this._onTouchMove):G(document,"mousemove",this._onTouchMove):(G(f,"dragend",this),G(J,"dragstart",this._onDragStart));try{document.selection?It(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,n){if(nt=!1,J&&f){ye("dragStarted",this,{evt:n}),this.nativeDraggable&&G(document,"dragover",yo);var o=this.options;!e&&_e(f,o.dragClass,!1),_e(f,o.ghostClass,!0),O.active=this,e&&this._appendGhost(),he({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Ie){this._lastX=Ie.clientX,this._lastY=Ie.clientY,Rn();for(var e=document.elementFromPoint(Ie.clientX,Ie.clientY),n=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Ie.clientX,Ie.clientY),e!==n);)n=e;if(f.parentNode[De]._isOutsideThisEl(e),n)do{if(n[De]){var o=void 0;if(o=n[De]._onDragOver({clientX:Ie.clientX,clientY:Ie.clientY,target:e,rootEl:n}),o&&!this.options.dragoverBubble)break}e=n}while(n=n.parentNode);Fn()}},_onTouchMove:function(e){if(ze){var n=this.options,o=n.fallbackTolerance,a=n.fallbackOffset,r=e.touches?e.touches[0]:e,i=M&&at(M,!0),l=M&&i&&i.a,c=M&&i&&i.d,s=Dt&&pe&&gn(pe),p=(r.clientX-ze.clientX+a.x)/(l||1)+(s?s[0]-Ut[0]:0)/(l||1),u=(r.clientY-ze.clientY+a.y)/(c||1)+(s?s[1]-Ut[1]:0)/(c||1);if(!O.active&&!nt){if(o&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(M){i?(i.e+=p-(Yt||0),i.f+=u-(Xt||0)):i={a:1,b:0,c:0,d:1,e:p,f:u};var m="matrix(".concat(i.a,",").concat(i.b,",").concat(i.c,",").concat(i.d,",").concat(i.e,",").concat(i.f,")");I(M,"webkitTransform",m),I(M,"mozTransform",m),I(M,"msTransform",m),I(M,"transform",m),Yt=p,Xt=u,Ie=r}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!M){var e=this.options.fallbackOnBody?document.body:J,n=ae(f,!0,Dt,!0,e),o=this.options;if(Dt){for(pe=e;I(pe,"position")==="static"&&I(pe,"transform")==="none"&&pe!==document;)pe=pe.parentNode;pe!==document.body&&pe!==document.documentElement?(pe===document&&(pe=Re()),n.top+=pe.scrollTop,n.left+=pe.scrollLeft):pe=Re(),Ut=gn(pe)}M=f.cloneNode(!0),_e(M,o.ghostClass,!1),_e(M,o.fallbackClass,!0),_e(M,o.dragClass,!0),I(M,"transition",""),I(M,"transform",""),I(M,"box-sizing","border-box"),I(M,"margin",0),I(M,"top",n.top),I(M,"left",n.left),I(M,"width",n.width),I(M,"height",n.height),I(M,"opacity","0.8"),I(M,"position",Dt?"absolute":"fixed"),I(M,"zIndex","100000"),I(M,"pointerEvents","none"),O.ghost=M,e.appendChild(M),I(M,"transform-origin",vn/parseInt(M.style.width)*100+"% "+bn/parseInt(M.style.height)*100+"%")}},_onDragStart:function(e,n){var o=this,a=e.dataTransfer,r=o.options;if(ye("dragStart",this,{evt:e}),O.eventCanceled){this._onDrop();return}ye("setupClone",this),O.eventCanceled||(ee=$n(f),ee.draggable=!1,ee.style["will-change"]="",this._hideClone(),_e(ee,this.options.chosenClass,!1),O.clone=ee),o.cloneId=It(function(){ye("clone",o),!O.eventCanceled&&(o.options.removeCloneOnHide||J.insertBefore(ee,f),o._hideClone(),he({sortable:o,name:"clone"}))}),!n&&_e(f,r.dragClass,!0),n?($t=!0,o._loopId=setInterval(o._emulateDragOver,50)):(L(document,"mouseup",o._onDrop),L(document,"touchend",o._onDrop),L(document,"touchcancel",o._onDrop),a&&(a.effectAllowed="move",r.setData&&r.setData.call(o,a,f)),G(document,"drop",o),I(f,"transform","translateZ(0)")),nt=!0,o._dragStartId=It(o._dragStarted.bind(o,n,e)),G(document,"selectstart",o),ct=!0,mt&&I(document.body,"user-select","none")},_onDragOver:function(e){var n=this.el,o=e.target,a,r,i,l=this.options,c=l.group,s=O.active,p=wt===c,u=l.sort,m=ue||s,D,h=this,T=!1;if(Qt)return;function j(se,Ve){ye(se,h,Fe({evt:e,isOwner:p,axis:D?"vertical":"horizontal",revert:i,dragRect:a,targetRect:r,canSort:u,fromSortable:m,target:o,completed:X,onMove:function($e,Qe){return St(J,n,f,a,$e,ae($e),e,Qe)},changed:Z},Ve))}function z(){j("dragOverAnimationCapture"),h.captureAnimationState(),h!==m&&m.captureAnimationState()}function X(se){return j("dragOverCompleted",{insertion:se}),se&&(p?s._hideClone():s._showClone(h),h!==m&&(_e(f,ue?ue.options.ghostClass:s.options.ghostClass,!1),_e(f,l.ghostClass,!0)),ue!==h&&h!==O.active?ue=h:h===O.active&&ue&&(ue=null),m===h&&(h._ignoreWhileAnimating=o),h.animateAll(function(){j("dragOverAnimationComplete"),h._ignoreWhileAnimating=null}),h!==m&&(m.animateAll(),m._ignoreWhileAnimating=null)),(o===f&&!f.animated||o===n&&!o.animated)&&(tt=null),!l.dragoverBubble&&!e.rootEl&&o!==document&&(f.parentNode[De]._isOutsideThisEl(e.target),!se&&qe(e)),!l.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),T=!0}function Z(){we=ke(f),Xe=ke(f,l.draggable),he({sortable:h,name:"change",toEl:n,newIndex:we,newDraggableIndex:Xe,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),o=Pe(o,l.draggable,n,!0),j("dragOver"),O.eventCanceled)return T;if(f.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||h._ignoreWhileAnimating===o)return X(!1);if($t=!1,s&&!l.disabled&&(p?u||(i=Q!==J):ue===this||(this.lastPutMode=wt.checkPull(this,s,f,e))&&c.checkPut(this,s,f,e))){if(D=this._getDirection(e,o)==="vertical",a=ae(f),j("dragOverValid"),O.eventCanceled)return T;if(i)return Q=J,z(),this._hideClone(),j("revert"),O.eventCanceled||(Je?J.insertBefore(f,Je):J.appendChild(f)),X(!0);var W=rn(n,l.draggable);if(!W||Do(e,D,this)&&!W.animated){if(W===f)return X(!1);if(W&&n===e.target&&(o=W),o&&(r=ae(o)),St(J,n,f,a,o,r,e,!!o)!==!1)return z(),n.appendChild(f),Q=n,Z(),X(!0)}else if(W&&Eo(e,D,this)){var _=rt(n,0,l,!0);if(_===f)return X(!1);if(o=_,r=ae(o),St(J,n,f,a,o,r,e,!1)!==!1)return z(),n.insertBefore(f,_),Q=n,Z(),X(!0)}else if(o.parentNode===n){r=ae(o);var w=0,U,K=f.parentNode!==n,E=!vo(f.animated&&f.toRect||a,o.animated&&o.toRect||r,D),de=D?"top":"left",fe=hn(o,"top","top")||hn(f,"top","top"),ge=fe?fe.scrollTop:void 0;tt!==o&&(U=r[de],bt=!1,Et=!E&&l.invertSwap||K),w=So(e,o,r,D,E?1:l.swapThreshold,l.invertedSwapThreshold==null?l.swapThreshold:l.invertedSwapThreshold,Et,tt===o);var ve;if(w!==0){var Se=ke(f);do Se-=w,ve=Q.children[Se];while(ve&&(I(ve,"display")==="none"||ve===M))}if(w===0||ve===o)return X(!1);tt=o,vt=w;var xe=o.nextElementSibling,Y=!1;Y=w===1;var Ce=St(J,n,f,a,o,r,e,Y);if(Ce!==!1)return(Ce===1||Ce===-1)&&(Y=Ce===1),Qt=!0,setTimeout(wo,30),z(),Y&&!xe?n.appendChild(f):o.parentNode.insertBefore(f,Y?xe:o),fe&&xn(fe,0,ge-fe.scrollTop),Q=f.parentNode,U!==void 0&&!Et&&(Tt=Math.abs(U-ae(o)[de])),Z(),X(!0)}if(n.contains(f))return X(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){L(document,"mousemove",this._onTouchMove),L(document,"touchmove",this._onTouchMove),L(document,"pointermove",this._onTouchMove),L(document,"dragover",qe),L(document,"mousemove",qe),L(document,"touchmove",qe)},_offUpEvents:function(){var e=this.el.ownerDocument;L(e,"mouseup",this._onDrop),L(e,"touchend",this._onDrop),L(e,"pointerup",this._onDrop),L(e,"touchcancel",this._onDrop),L(document,"selectstart",this)},_onDrop:function(e){var n=this.el,o=this.options;if(we=ke(f),Xe=ke(f,o.draggable),ye("drop",this,{evt:e}),Q=f&&f.parentNode,we=ke(f),Xe=ke(f,o.draggable),O.eventCanceled){this._nulling();return}nt=!1,Et=!1,bt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),en(this.cloneId),en(this._dragStartId),this.nativeDraggable&&(L(document,"drop",this),L(n,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),mt&&I(document.body,"user-select",""),I(f,"transform",""),e&&(ct&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),M&&M.parentNode&&M.parentNode.removeChild(M),(J===Q||ue&&ue.lastPutMode!=="clone")&&ee&&ee.parentNode&&ee.parentNode.removeChild(ee),f&&(this.nativeDraggable&&L(f,"dragend",this),Ht(f),f.style["will-change"]="",ct&&!nt&&_e(f,ue?ue.options.ghostClass:this.options.ghostClass,!1),_e(f,this.options.chosenClass,!1),he({sortable:this,name:"unchoose",toEl:Q,newIndex:null,newDraggableIndex:null,originalEvent:e}),J!==Q?(we>=0&&(he({rootEl:Q,name:"add",toEl:Q,fromEl:J,originalEvent:e}),he({sortable:this,name:"remove",toEl:Q,originalEvent:e}),he({rootEl:Q,name:"sort",toEl:Q,fromEl:J,originalEvent:e}),he({sortable:this,name:"sort",toEl:Q,originalEvent:e})),ue&&ue.save()):we!==ot&&we>=0&&(he({sortable:this,name:"update",toEl:Q,originalEvent:e}),he({sortable:this,name:"sort",toEl:Q,originalEvent:e})),O.active&&((we==null||we===-1)&&(we=ot,Xe=gt),he({sortable:this,name:"end",toEl:Q,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){ye("nulling",this),J=f=Q=M=Je=ee=kt=Ue=ze=Ie=ct=we=Xe=ot=gt=tt=vt=ue=wt=O.dragged=O.ghost=O.clone=O.active=null,Pt.forEach(function(e){e.checked=!0}),Pt.length=Yt=Xt=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":f&&(this._onDragOver(e),_o(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],n,o=this.el.children,a=0,r=o.length,i=this.options;a<r;a++)n=o[a],Pe(n,i.draggable,this.el,!1)&&e.push(n.getAttribute(i.dataIdAttr)||ko(n));return e},sort:function(e,n){var o={},a=this.el;this.toArray().forEach(function(r,i){var l=a.children[i];Pe(l,this.options.draggable,a,!1)&&(o[r]=l)},this),n&&this.captureAnimationState(),e.forEach(function(r){o[r]&&(a.removeChild(o[r]),a.appendChild(o[r]))}),n&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,n){return Pe(e,n||this.options.draggable,this.el,!1)},option:function(e,n){var o=this.options;if(n===void 0)return o[e];var a=_t.modifyOption(this,e,n);typeof a<"u"?o[e]=a:o[e]=n,e==="group"&&Mn(o)},destroy:function(){ye("destroy",this);var e=this.el;e[De]=null,L(e,"mousedown",this._onTapStart),L(e,"touchstart",this._onTapStart),L(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(L(e,"dragover",this),L(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(n){n.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Nt.splice(Nt.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Ue){if(ye("hideClone",this),O.eventCanceled)return;I(ee,"display","none"),this.options.removeCloneOnHide&&ee.parentNode&&ee.parentNode.removeChild(ee),Ue=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(Ue){if(ye("showClone",this),O.eventCanceled)return;f.parentNode==J&&!this.options.group.revertClone?J.insertBefore(ee,f):Je?J.insertBefore(ee,Je):J.appendChild(ee),this.options.group.revertClone&&this.animate(f,ee),I(ee,"display",""),Ue=!1}}};function _o(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function St(t,e,n,o,a,r,i,l){var c,s=t[De],p=s.options.onMove,u;return window.CustomEvent&&!je&&!yt?c=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(c=document.createEvent("Event"),c.initEvent("move",!0,!0)),c.to=e,c.from=t,c.dragged=n,c.draggedRect=o,c.related=a||e,c.relatedRect=r||ae(e),c.willInsertAfter=l,c.originalEvent=i,t.dispatchEvent(c),p&&(u=p.call(s,c,i)),u}function Ht(t){t.draggable=!1}function wo(){Qt=!1}function Eo(t,e,n){var o=ae(rt(n.el,0,n.options,!0)),a=10;return e?t.clientX<o.left-a||t.clientY<o.top&&t.clientX<o.right:t.clientY<o.top-a||t.clientY<o.bottom&&t.clientX<o.left}function Do(t,e,n){var o=ae(rn(n.el,n.options.draggable)),a=10;return e?t.clientX>o.right+a||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+a}function So(t,e,n,o,a,r,i,l){var c=o?t.clientY:t.clientX,s=o?n.height:n.width,p=o?n.top:n.left,u=o?n.bottom:n.right,m=!1;if(!i){if(l&&Tt<s*a){if(!bt&&(vt===1?c>p+s*r/2:c<u-s*r/2)&&(bt=!0),bt)m=!0;else if(vt===1?c<p+Tt:c>u-Tt)return-vt}else if(c>p+s*(1-a)/2&&c<u-s*(1-a)/2)return Co(e)}return m=m||i,m&&(c<p+s*r/2||c>u-s*r/2)?c>p+s/2?1:-1:0}function Co(t){return ke(f)<ke(t)?1:-1}function ko(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function To(t){Pt.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var o=e[n];o.checked&&Pt.push(o)}}function It(t){return setTimeout(t,0)}function en(t){return clearTimeout(t)}Ft&&G(document,"touchmove",function(t){(O.active||nt)&&t.cancelable&&t.preventDefault()});O.utils={on:G,off:L,css:I,find:On,is:function(e,n){return!!Pe(e,n,e,!1)},extend:so,throttle:An,closest:Pe,toggleClass:_e,clone:$n,index:ke,nextTick:It,cancelNextTick:en,detectDirection:Pn,getChild:rt};O.get=function(t){return t[De]};O.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach(function(o){if(!o.prototype||!o.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));o.utils&&(O.utils=Fe(Fe({},O.utils),o.utils)),_t.mount(o)})};O.create=function(t,e){return new O(t,e)};O.version=ao;var ne=[],dt,tn,nn=!1,Wt,Kt,Mt,ft;function Io(){function t(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return t.prototype={dragStarted:function(n){var o=n.originalEvent;this.sortable.nativeDraggable?G(document,"dragover",this._handleAutoScroll):this.options.supportPointer?G(document,"pointermove",this._handleFallbackAutoScroll):o.touches?G(document,"touchmove",this._handleFallbackAutoScroll):G(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(n){var o=n.originalEvent;!this.options.dragOverBubble&&!o.rootEl&&this._handleAutoScroll(o)},drop:function(){this.sortable.nativeDraggable?L(document,"dragover",this._handleAutoScroll):(L(document,"pointermove",this._handleFallbackAutoScroll),L(document,"touchmove",this._handleFallbackAutoScroll),L(document,"mousemove",this._handleFallbackAutoScroll)),_n(),Ot(),uo()},nulling:function(){Mt=tn=dt=nn=ft=Wt=Kt=null,ne.length=0},_handleFallbackAutoScroll:function(n){this._handleAutoScroll(n,!0)},_handleAutoScroll:function(n,o){var a=this,r=(n.touches?n.touches[0]:n).clientX,i=(n.touches?n.touches[0]:n).clientY,l=document.elementFromPoint(r,i);if(Mt=n,o||this.options.forceAutoScrollFallback||yt||je||mt){zt(n,this.options,l,o);var c=We(l,!0);nn&&(!ft||r!==Wt||i!==Kt)&&(ft&&_n(),ft=setInterval(function(){var s=We(document.elementFromPoint(r,i),!0);s!==c&&(c=s,Ot()),zt(n,a.options,s,o)},10),Wt=r,Kt=i)}else{if(!this.options.bubbleScroll||We(l,!0)===Re()){Ot();return}zt(n,this.options,We(l,!1),!1)}}},Ge(t,{pluginName:"scroll",initializeByDefault:!0})}function Ot(){ne.forEach(function(t){clearInterval(t.pid)}),ne=[]}function _n(){clearInterval(ft)}var zt=An(function(t,e,n,o){if(e.scroll){var a=(t.touches?t.touches[0]:t).clientX,r=(t.touches?t.touches[0]:t).clientY,i=e.scrollSensitivity,l=e.scrollSpeed,c=Re(),s=!1,p;tn!==n&&(tn=n,Ot(),dt=e.scroll,p=e.scrollFn,dt===!0&&(dt=We(n,!0)));var u=0,m=dt;do{var D=m,h=ae(D),T=h.top,j=h.bottom,z=h.left,X=h.right,Z=h.width,W=h.height,_=void 0,w=void 0,U=D.scrollWidth,K=D.scrollHeight,E=I(D),de=D.scrollLeft,fe=D.scrollTop;D===c?(_=Z<U&&(E.overflowX==="auto"||E.overflowX==="scroll"||E.overflowX==="visible"),w=W<K&&(E.overflowY==="auto"||E.overflowY==="scroll"||E.overflowY==="visible")):(_=Z<U&&(E.overflowX==="auto"||E.overflowX==="scroll"),w=W<K&&(E.overflowY==="auto"||E.overflowY==="scroll"));var ge=_&&(Math.abs(X-a)<=i&&de+Z<U)-(Math.abs(z-a)<=i&&!!de),ve=w&&(Math.abs(j-r)<=i&&fe+W<K)-(Math.abs(T-r)<=i&&!!fe);if(!ne[u])for(var Se=0;Se<=u;Se++)ne[Se]||(ne[Se]={});(ne[u].vx!=ge||ne[u].vy!=ve||ne[u].el!==D)&&(ne[u].el=D,ne[u].vx=ge,ne[u].vy=ve,clearInterval(ne[u].pid),(ge!=0||ve!=0)&&(s=!0,ne[u].pid=setInterval((function(){o&&this.layer===0&&O.active._onTouchMove(Mt);var xe=ne[this.layer].vy?ne[this.layer].vy*l:0,Y=ne[this.layer].vx?ne[this.layer].vx*l:0;typeof p=="function"&&p.call(O.dragged.parentNode[De],Y,xe,t,Mt,ne[this.layer].el)!=="continue"||xn(ne[this.layer].el,Y,xe)}).bind({layer:u}),24))),u++}while(e.bubbleScroll&&m!==c&&(m=We(m,!1)));nn=s}},30),Vn=function(e){var n=e.originalEvent,o=e.putSortable,a=e.dragEl,r=e.activeSortable,i=e.dispatchSortableEvent,l=e.hideGhostForTarget,c=e.unhideGhostForTarget;if(n){var s=o||r;l();var p=n.changedTouches&&n.changedTouches.length?n.changedTouches[0]:n,u=document.elementFromPoint(p.clientX,p.clientY);c(),s&&!s.el.contains(u)&&(i("spill"),this.onSpill({dragEl:a,putSortable:o}))}};function ln(){}ln.prototype={startIndex:null,dragStart:function(e){var n=e.oldDraggableIndex;this.startIndex=n},onSpill:function(e){var n=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var a=rt(this.sortable.el,this.startIndex,this.options);a?this.sortable.el.insertBefore(n,a):this.sortable.el.appendChild(n),this.sortable.animateAll(),o&&o.animateAll()},drop:Vn};Ge(ln,{pluginName:"revertOnSpill"});function sn(){}sn.prototype={onSpill:function(e){var n=e.dragEl,o=e.putSortable,a=o||this.sortable;a.captureAnimationState(),n.parentNode&&n.parentNode.removeChild(n),a.animateAll()},drop:Vn};Ge(sn,{pluginName:"removeOnSpill"});O.mount(new Io);O.mount(sn,ln);function Oo(){return typeof window<"u"?window.console:global.console}const Ao=Oo();function xo(t){const e=Object.create(null);return function(o){return e[o]||(e[o]=t(o))}}const $o=/-(\w)/g,wn=xo(t=>t.replace($o,(e,n)=>n?n.toUpperCase():""));function qt(t){t.parentElement!==null&&t.parentElement.removeChild(t)}function En(t,e,n){const o=n===0?t.children[0]:t.children[n-1].nextSibling;t.insertBefore(e,o)}function No(t,e){return Object.values(t).indexOf(e)}function Po(t,e,n,o){if(!t)return[];const a=Object.values(t),r=e.length-o;return[...e].map((l,c)=>c>=r?a.length:a.indexOf(l))}function Ln(t,e){this.$nextTick(()=>this.$emit(t.toLowerCase(),e))}function Mo(t){return e=>{this.realList!==null&&this["onDrag"+t](e),Ln.call(this,t,e)}}function Ro(t){return["transition-group","TransitionGroup"].includes(t)}function Fo(t){if(!t||t.length!==1)return!1;const[{type:e}]=t;return e?Ro(e.name):!1}function Vo(t,e){return e?{...e.props,...e.attrs}:t}const on=["Start","Add","Remove","Update","End"],an=["Choose","Unchoose","Sort","Filter","Clone"],Lo=["Move",...on,...an].map(t=>"on"+t);let Jt=null;const Bo={options:Object,list:{type:Array,required:!1,default:null},noTransitionOnDrag:{type:Boolean,default:!1},clone:{type:Function,default:t=>t},tag:{type:String,default:"div"},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null},component:{type:String,default:null},modelValue:{type:Array,required:!1,default:null}},Bn=Un({name:"VueDraggableNext",inheritAttrs:!1,emits:["update:modelValue","move","change",...on.map(t=>t.toLowerCase()),...an.map(t=>t.toLowerCase())],props:Bo,data(){return{transitionMode:!1,noneFunctionalComponentMode:!1,headerOffset:0,footerOffset:0,_sortable:{},visibleIndexes:[],context:{}}},render(){const t=this.$slots.default?this.$slots.default():null,e=Vo(this.$attrs,this.componentData);return t?(this.transitionMode=Fo(t),un(this.getTag(),e,t)):un(this.getTag(),e,[])},created(){this.list!==null&&this.modelValue!==null&&Ao.error("list props are mutually exclusive! Please set one.")},mounted(){const t={};on.forEach(a=>{t["on"+a]=Mo.call(this,a)}),an.forEach(a=>{t["on"+a]=Ln.bind(this,a)});const e=Object.keys(this.$attrs).reduce((a,r)=>(a[wn(r)]=this.$attrs[r],a),{}),n=Object.assign({},e,t,{onMove:(a,r)=>this.onDragMove(a,r)});!("draggable"in n)&&(n.draggable=">*");const o=this.$el.nodeType===1?this.$el:this.$el.parentElement;this._sortable=new O(o,n),o.__draggable_component__=this,this.computeIndexes()},beforeUnmount(){try{this._sortable!==void 0&&this._sortable.destroy()}catch{}},computed:{realList(){return this.list?this.list:this.modelValue}},watch:{$attrs:{handler(t){this.updateOptions(t)},deep:!0},realList(){this.computeIndexes()}},methods:{getTag(){return this.component?te(this.component):this.tag},updateOptions(t){for(var e in t){const n=wn(e);Lo.indexOf(n)===-1&&this._sortable.option(n,t[e])}},getChildrenNodes(){return this.$el.children},computeIndexes(){this.$nextTick(()=>{this.visibleIndexes=Po(this.getChildrenNodes(),this.$el.children,this.transitionMode,this.footerOffset)})},getUnderlyingVm(t){const e=No(this.getChildrenNodes()||[],t);if(e===-1)return null;const n=this.realList[e];return{index:e,element:n}},emitChanges(t){this.$nextTick(()=>{this.$emit("change",t)})},alterList(t){if(this.list){t(this.list);return}const e=[...this.modelValue];t(e),this.$emit("update:modelValue",e)},spliceList(){const t=e=>e.splice(...arguments);this.alterList(t)},updatePosition(t,e){const n=o=>o.splice(e,0,o.splice(t,1)[0]);this.alterList(n)},getVmIndex(t){const e=this.visibleIndexes,n=e.length;return t>n-1?n:e[t]},getComponent(){return this.$slots.default?this.$slots.default()[0].componentInstance:null},resetTransitionData(t){if(!this.noTransitionOnDrag||!this.transitionMode)return;var e=this.getChildrenNodes();e[t].data=null;const n=this.getComponent();n.children=[],n.kept=void 0},onDragStart(t){this.computeIndexes(),this.context=this.getUnderlyingVm(t.item),this.context&&(t.item._underlying_vm_=this.clone(this.context.element),Jt=t.item)},onDragAdd(t){const e=t.item._underlying_vm_;if(e===void 0)return;qt(t.item);const n=this.getVmIndex(t.newIndex);this.spliceList(n,0,e),this.computeIndexes();const o={element:e,newIndex:n};this.emitChanges({added:o})},onDragRemove(t){if(En(this.$el,t.item,t.oldIndex),t.pullMode==="clone"){qt(t.clone);return}if(!this.context)return;const e=this.context.index;this.spliceList(e,1);const n={element:this.context.element,oldIndex:e};this.resetTransitionData(e),this.emitChanges({removed:n})},onDragUpdate(t){qt(t.item),En(t.from,t.item,t.oldIndex);const e=this.context.index,n=this.getVmIndex(t.newIndex);this.updatePosition(e,n);const o={element:this.context.element,oldIndex:e,newIndex:n};this.emitChanges({moved:o})},updateProperty(t,e){t.hasOwnProperty(e)&&(t[e]+=this.headerOffset)},onDragMove(t,e){const n=this.move;if(!n||!this.realList)return!0;const o=this.getRelatedContextFromMoveEvent(t),a=this.context,r=this.computeFutureIndex(o,t);Object.assign(a,{futureIndex:r});const i=Object.assign({},t,{relatedContext:o,draggedContext:a});return n(i,e)},onDragEnd(){this.computeIndexes(),Jt=null},getTrargetedComponent(t){return t.__draggable_component__},getRelatedContextFromMoveEvent({to:t,related:e}){const n=this.getTrargetedComponent(t);if(!n)return{component:n};const o=n.realList,a={list:o,component:n};if(t!==e&&o&&n.getUnderlyingVm){const r=n.getUnderlyingVm(e);if(r)return Object.assign(r,a)}return a},computeFutureIndex(t,e){const n=[...e.to.children].filter(i=>i.style.display!=="none");if(n.length===0)return 0;const o=n.indexOf(e.related),a=t.component.getVmIndex(o);return n.indexOf(Jt)!==-1||!e.willInsertAfter?a:a+1}}}),Go={key:0,class:"fluent-cart-admin-validation-error-wrapper"},pt=Object.assign({name:"ValidationError"},{__name:"ValidationError",props:{validationErrors:Object,fieldKey:String},setup(t){const e=t,n=()=>{if(typeof e.validationErrors[e.fieldKey]!="object")return"";const[[a,r]]=Object.entries(e.validationErrors[e.fieldKey]);return{[a]:r}};return(o,a)=>t.validationErrors&&t.validationErrors.hasOwnProperty(t.fieldKey)?(y(),C("div",Go,[(y(!0),C(re,null,Le(n(),(r,i)=>(y(),C("span",{class:"fluent-cart-admin-validation-error",key:r.toLowerCase().replace(/\s/g,"")},V(r),1))),128))])):oe("",!0)}});class jo{constructor(){Bt(this,"confirmBox",cn.confirm);Bt(this,"promptBox",cn.prompt)}confirm(e,n,o){return this.confirmBox(e,n,o)}ofDelete(e=null,n=null,o){return e===null&&(e=d("Are you sure you want to delete this?. This action is not recoverable")),n===null&&(n=d("Confirm Delete!")),o={confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),confirmButtonClass:"el-button--primary",type:"warning",...o??{}},this.confirm(e,n,o)}confirmWithInput(e,n,o){return this.promptBox(e,n,o)}confirmDeleteWithInput(e,n=null,o=null,a){n===null&&(n=d("Are you sure you want to delete this?. This action is not recoverable"));const r=d('You must type "%s" exactly to proceed',`<span >${e}</span>`);return n=`<label for=""><p>${n}</p>
11 - <p>${r}</p></label>`,o===null&&(o=d("Confirm Delete!")),a={confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),confirmButtonClass:"el-button--primary",inputPattern:new RegExp(`^${e}$`),inputErrorMessage:d("You must type %s exactly to proceed",e),dangerouslyUseHTMLString:!0,type:"warning",...a??{}},this.confirmWithInput(n,o,a)}}const Gn=new jo,Yo={class:"fct-term-draft-form-title-line"},Xo=["aria-label"],Uo=["aria-label"],Ho=["title","aria-label","aria-pressed","tabindex","onClick"],Wo={class:"fct-color-custom-row fct-term-draft-custom-row"},Ko={class:"fct-term-color-picker-wrap--lg fct-term-draft-custom-swatch-wrap"},zo=["disabled","aria-label"],qo={class:"fct-term-draft-image-row"},Jo=["aria-label"],Zo=["src"],Zt={__name:"TermForm",props:{term:{type:Object,required:!0},groupType:{type:String,default:"options"},showRemoveButton:{type:Boolean,default:!0},validationErrors:{type:Object,default:()=>({})},fieldKey:{type:String,default:""}},emits:["remove","submit"],setup(t,{expose:e,emit:n}){const o=t,a=n,r=R(null),i=R([]),l=R(0),c=Zn,s=_=>_.replace(/\b\w/g,w=>w.toUpperCase()),p=_=>{const w=dn(_);return w?s(w):_},u=_=>{if(!_){l.value=0;return}const w=c.indexOf(_);l.value=w>=0?w:0},m=_=>o.fieldKey?`${o.fieldKey}.${_}`:_,D=_=>!!o.validationErrors[m(_)],h=_=>{const w=m(_);o.validationErrors&&o.validationErrors[w]&&delete o.validationErrors[w]},T=()=>{if(h("title"),o.groupType!=="color"||o.term.settings.color)return;const _=eo(o.term.title);_&&(o.term.settings.color=_,u(_),h("settings.color"))},j=_=>{o.term.settings.color=_,h("settings.color");const w=c.indexOf(_);w>=0&&(l.value=w);const U=(o.term.title||"").trim().toLowerCase(),K=U&&Rt[U]!==void 0;if(!U||K){const E=dn(_);E&&(o.term.title=s(E),h("title"))}},z=_=>{const w=_.target;if(!w||!w.classList||!w.classList.contains("fct-color-swatch"))return;const U=i.value.indexOf(w);if(U===-1)return;const K=c.length-1;let E=-1;switch(_.key){case"ArrowRight":case"ArrowDown":E=U===K?0:U+1;break;case"ArrowLeft":case"ArrowUp":E=U===0?K:U-1;break;case"Home":E=0;break;case"End":E=K;break;default:return}_.preventDefault(),l.value=E;const de=i.value[E];de&&typeof de.focus=="function"&&de.focus(),j(c[E])},X=()=>{o.term.title="",o.term.settings.color="",o.term.settings.image="",u(""),W()},Z=()=>{if(!(window.wp&&window.wp.media))return;const _=window.wp.media({title:d("Select Image"),multiple:!1,library:{type:"image"}});_.on("select",()=>{const w=_.state().get("selection").first().toJSON();o.term.settings.image=w.url,h("settings.image")}),_.open()},W=()=>{At(()=>{r.value&&typeof r.value.focus=="function"&&r.value.focus()})};return Dn(()=>o.term,_=>{var w;u(((w=_==null?void 0:_.settings)==null?void 0:w.color)||""),W()},{immediate:!0}),e({focus:W}),(_,w)=>{const U=te("el-input"),K=te("el-color-picker");return y(),C("div",{class:Oe(["fct-term-draft-form",`fct-term-draft-form--${t.groupType}`])},[g("div",Yo,[v(U,{ref_key:"titleInputRef",ref:r,modelValue:t.term.title,"onUpdate:modelValue":w[0]||(w[0]=E=>t.term.title=E),placeholder:t.groupType==="color"?S(d)("e.g. Navy Blue"):S(d)("Term title"),size:"default",class:Oe({"is-error":D("title")}),onInput:T,onKeyup:[w[1]||(w[1]=He(E=>a("submit"),["enter"])),w[2]||(w[2]=He(E=>a("remove"),["escape"]))]},null,8,["modelValue","placeholder","class"]),t.showRemoveButton?(y(),C("button",{key:0,type:"button",class:"fct-term-draft-form-close","aria-label":S(d)("Remove"),onClick:w[3]||(w[3]=E=>a("remove"))},[v(le,{name:"Cross"})],8,Xo)):oe("",!0)]),v(pt,{"validation-errors":t.validationErrors,"field-key":m("title")},null,8,["validation-errors","field-key"]),t.groupType==="color"?(y(),C(re,{key:0},[g("div",{class:"fct-color-swatch-grid fct-term-draft-swatches",role:"group","aria-label":S(d)("Color presets"),onKeydown:z},[(y(!0),C(re,null,Le(S(c),(E,de)=>(y(),C("button",{key:E,ref_for:!0,ref:fe=>i.value[de]=fe,type:"button",class:Oe(["fct-color-swatch",{"is-active":t.term.settings.color===E}]),style:Ze({background:E,"--swatch-color":E}),title:p(E),"aria-label":p(E),"aria-pressed":t.term.settings.color===E,tabindex:de===l.value?0:-1,onClick:fe=>j(E)},null,14,Ho))),128))],40,Uo),g("div",Wo,[g("div",Ko,[v(K,{modelValue:t.term.settings.color,"onUpdate:modelValue":w[4]||(w[4]=E=>t.term.settings.color=E),"aria-label":S(d)("Pick a custom color"),onChange:w[5]||(w[5]=E=>h("settings.color"))},null,8,["modelValue","aria-label"])]),v(U,{modelValue:t.term.settings.color,"onUpdate:modelValue":w[6]||(w[6]=E=>t.term.settings.color=E),placeholder:"#000000",size:"default",class:Oe({"is-error":D("settings.color")}),onInput:w[7]||(w[7]=E=>h("settings.color"))},null,8,["modelValue","class"]),g("button",{type:"button",class:"fct-term-draft-clear-btn",disabled:!t.term.title&&!t.term.settings.color,"aria-label":S(d)("Clear title and color"),onClick:X},V(S(d)("Clear")),9,zo)]),v(pt,{"validation-errors":t.validationErrors,"field-key":m("settings.color")},null,8,["validation-errors","field-key"])],64)):t.groupType==="image"?(y(),C(re,{key:1},[g("div",qo,[g("button",{type:"button",class:"fct-term-draft-img-btn fct-term-draft-img-btn--lg","aria-label":S(d)("Upload image"),onClick:Z},[t.term.settings.image?(y(),C("img",{key:0,src:t.term.settings.image,alt:""},null,8,Zo)):(y(),Ae(le,{key:1,name:"Plus"}))],8,Jo),v(U,{modelValue:t.term.settings.image,"onUpdate:modelValue":w[8]||(w[8]=E=>t.term.settings.image=E),placeholder:S(d)("https://..."),size:"default",class:Oe({"is-error":D("settings.image")}),onInput:w[9]||(w[9]=E=>h("settings.image"))},null,8,["modelValue","placeholder","class"])]),v(pt,{"validation-errors":t.validationErrors,"field-key":m("settings.image")},null,8,["validation-errors","field-key"])],64)):oe("",!0),v(pt,{"validation-errors":t.validationErrors,"field-key":"terms"},null,8,["validation-errors"]),Sn(_.$slots,"actions")],2)}}},Qo={class:"fct-attr-group-modal"},ea={class:"dialog-footer"},ta=Object.assign({name:"AddGroupModal"},{__name:"AddGroupModal",emits:["whenGroupCreateIsDone"],setup(t,{expose:e,emit:n}){const o=n,a=R(!1),r=R({}),i=R(null),l=Cn({title:"",settings:{type:"options",styling:"button"}});e({focusTitle:()=>{var u,m;(m=(u=i.value)==null?void 0:u.focus)==null||m.call(u)}});const s=()=>{a.value=!0,r.value={},Me.post("options/attr/group/",{title:l.title,settings:l.settings}).then(u=>{kn(u.message),o("whenGroupCreateIsDone",u.data)}).catch(u=>{var m;(u==null?void 0:u.status_code)==422&&u.data?r.value=u.data:me.error(((m=u==null?void 0:u.data)==null?void 0:m.message)||(u==null?void 0:u.message))}).finally(()=>{a.value=!1})},p=u=>{u.key==="Enter"&&(a.value||!l.title||s())};return(u,m)=>{const D=te("el-input"),h=te("el-form-item"),T=te("el-col"),j=te("el-option"),z=te("el-select"),X=te("el-row"),Z=te("el-button"),W=te("el-form");return y(),C("div",Qo,[v(W,{"label-position":"top",data:l},{default:B(()=>[v(X,{gutter:24},{default:B(()=>[v(T,{span:24},{default:B(()=>[v(h,{label:u.$t("Group Title"),required:""},{default:B(()=>[v(D,{ref_key:"titleInputRef",ref:i,type:"text",modelValue:l.title,"onUpdate:modelValue":m[0]||(m[0]=_=>l.title=_),placeholder:u.$t("Group Title"),class:Oe(r.value.title?"is-error":""),onKeyup:p},null,8,["modelValue","placeholder","class"]),v(pt,{"validation-errors":r.value,"field-key":"title"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1}),v(T,{span:12},{default:B(()=>[v(h,{label:u.$t("Attribute Type")},{default:B(()=>[v(z,{modelValue:l.settings.type,"onUpdate:modelValue":m[1]||(m[1]=_=>l.settings.type=_),style:{width:"100%"}},{default:B(()=>[v(j,{label:u.$t("Options"),value:"options"},null,8,["label"]),v(j,{label:u.$t("Color"),value:"color"},null,8,["label"]),v(j,{label:u.$t("Image"),value:"image"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1}),v(T,{span:12},{default:B(()=>[v(h,{label:u.$t("Styling")},{default:B(()=>[v(z,{modelValue:l.settings.styling,"onUpdate:modelValue":m[2]||(m[2]=_=>l.settings.styling=_),clearable:"",style:{width:"100%"}},{default:B(()=>[v(j,{label:u.$t("Dropdown"),value:"dropdown"},null,8,["label"]),v(j,{label:u.$t("Button"),value:"button"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),g("div",ea,[v(Z,{disabled:!l.title||a.value,loading:a.value,onClick:m[3]||(m[3]=_=>s()),type:"primary"},{default:B(()=>[Ee(V(u.$t("Add Group")),1)]),_:1},8,["disabled","loading"])])]),_:1},8,["data"])])}}}),na={class:"fct-term-rows-list"},oa={key:0,class:"fct-term-rows-empty"},aa={key:0,class:"fct-term-edit-slot"},ra={key:1,class:"fct-term-row-item"},ia=["aria-label","aria-disabled","title"],la=["src","alt"],sa={class:"fct-term-row-name"},ua={class:"fct-term-row-actions"},ca=["aria-label","onClick"],da=["aria-label","onClick"],fa={__name:"AttrTermsTableBody",props:{rows:{type:Array,default:()=>[]},group:{type:Object,default:()=>({})},editingTermId:{type:[String,Number],default:null},disableReorder:{type:Boolean,default:!1}},emits:["edit","delete","reorder"],setup(t,{emit:e}){const n=t,o=ce(()=>{const l=n.group&&n.group.settings;return l&&l.type?l.type:"options"}),a=e,r=()=>{a("reorder",n.rows.map(l=>l.id))},i=l=>{const c=n.editingTermId;return c==null?!1:String(l.id)===String(c)};return(l,c)=>(y(),C("div",na,[t.rows.length?(y(),Ae(S(Bn),{key:1,list:t.rows,handle:".fct-term-row-handle",animation:150,"ghost-class":"fct-term-row--ghost",disabled:t.disableReorder,tag:"div",class:"fct-term-rows-inner",onEnd:r},{default:B(()=>[(y(!0),C(re,null,Le(t.rows,s=>(y(),C(re,{key:s.id},[i(s)?(y(),C("div",aa,[Sn(l.$slots,"edit-form",{term:s})])):(y(),C("div",ra,[g("span",{class:Oe(["fct-term-row-handle",{"is-disabled":t.disableReorder}]),"aria-label":t.disableReorder?S(d)("Load all terms before reordering"):S(d)("Drag to reorder"),"aria-disabled":t.disableReorder?"true":null,title:t.disableReorder?S(d)("Load all terms before reordering"):null},[v(le,{name:"ReorderDotsVertical"})],10,ia),o.value==="color"&&s.settings&&s.settings.color?(y(),C("span",{key:0,class:"fct-term-row-color-dot",style:Ze({background:s.settings.color})},null,4)):o.value==="image"&&s.settings&&s.settings.image?(y(),C("img",{key:1,src:s.settings.image,alt:s.title,class:"fct-term-row-img"},null,8,la)):oe("",!0),g("span",sa,V(s.title||S(d)("No Name")),1),g("div",ua,[g("button",{type:"button",class:"fct-term-row-edit","aria-label":S(d)("Edit"),onClick:p=>a("edit",s)},[v(le,{name:"Edit"})],8,ca),g("button",{type:"button",class:"fct-term-row-delete","aria-label":S(d)("Delete"),onClick:p=>a("delete",s)},[v(le,{name:"Delete"})],8,da)])]))],64))),128))]),_:3},8,["list","disabled"])):(y(),C("div",oa,V(S(d)("No terms yet — click + Add Terms below to create one.")),1))]))}},pa={class:"fct-term-rows-list fct-term-rows-loader"},ma={__name:"AttrTermsTableLoader",setup(t){const e=["60%","40%","70%","35%","55%","45%"],n=o=>e[(o-1)%e.length];return(o,a)=>(y(),C("div",pa,[(y(),C(re,null,Le(6,r=>g("div",{key:r,class:"fct-term-row-item fct-term-row-item--skeleton"},[a[0]||(a[0]=g("span",{class:"fct-skel-block fct-skel-handle"},null,-1)),a[1]||(a[1]=g("span",{class:"fct-skel-block fct-skel-dot"},null,-1)),g("span",{class:"fct-skel-block fct-skel-title",style:Ze({width:n(r)})},null,4),a[2]||(a[2]=g("span",{class:"fct-skel-block fct-skel-action"},null,-1))])),64))]))}},ha={class:"fct-group-terms-panel"},ga={class:"fct-attr-panel-header"},va={class:"fct-attr-panel-header-top"},ba={class:"fct-attr-panel-breadcrumb"},ya={class:"fct-attr-panel-breadcrumb-root"},_a={class:"fct-attr-panel-breadcrumb-current"},wa=["aria-label"],Ea={class:"fct-attr-panel-chips"},Da={class:"fct-attr-meta-chip"},Sa={class:"fct-attr-meta-chip"},Ca={class:"fct-attr-meta-chip-label"},ka={class:"fct-attr-meta-chip"},Ta={class:"fct-attr-meta-chip-label"},Ia={key:0,class:"fct-term-reorder-locked",role:"status","aria-live":"polite"},Oa={class:"fct-term-edit-actions"},Aa={key:1,class:"fct-term-drafts-completed"},xa=["aria-label","onClick","onKeydown"],$a={class:"fct-term-row-handle","aria-hidden":"true"},Na=["src","alt"],Pa={class:"fct-term-row-name"},Ma=["aria-label","onClick"],Ra={key:0,class:"fct-attr-panel-footer fct-attr-panel-footer--split"},Fa=["disabled","title"],Va=["disabled","title","aria-label"],La=15,ut=10,Ba={__name:"GroupTermsPanel",props:{group:{type:Object,required:!0}},emits:["edit-group"],setup(t,{expose:e,emit:n}){const o=t,a=n,r=ce(()=>String(o.group.id)),i=ce(()=>{const A=o.group&&o.group.settings;return A&&A.type?A.type:"options"}),l=ce(()=>({options:d("Options"),color:d("Color"),image:d("Image")})[i.value]||d("Options")),c=ce(()=>{var x;return{dropdown:d("Dropdown"),button:d("Button")}[((x=o.group.settings)==null?void 0:x.styling)||"button"]||d("Button")}),s=R(null),p=R(null),u=R(!1),m=R({}),D=R(1),h=R([]),T=R(0),j=R(!0),z=R(!1),X=ce(()=>h.value.length<T.value),Z=ce(()=>X.value?d("Load More (%1$s/%2$s)",h.value.length,T.value):d("All loaded (%1$s)",T.value));let W=0;const _=(A,x)=>{const $=++W;return x?z.value=!0:j.value=!0,Me.get("options/attr/group/"+r.value+"/terms",{per_page:La,page:A}).then(N=>{if($!==W)return!1;const H=N.terms&&N.terms.data?N.terms.data:[];return T.value=N.terms&&N.terms.total?Number(N.terms.total):0,h.value=x?h.value.concat(H):H,!0}).catch(N=>{var H;return $!==W||me.error(((H=N.data)==null?void 0:H.message)||d("Failed to load terms")),!1}).finally(()=>{$===W&&(j.value=!1,z.value=!1)})};_(1,!1);const w=()=>{!X.value||z.value||j.value||(D.value++,_(D.value,!0))},U=A=>{const x=A.target;if(!x)return;x.scrollHeight-x.scrollTop-x.clientHeight<120&&w()},K=()=>{D.value=1,_(1,!1)},E=R(null),de=async A=>{if(D.value=1,!await _(1,!1))return;let x=0;for(;A&&!h.value.some($=>$.id===A)&&X.value&&x<50;)if(x++,D.value++,!await _(D.value,!0))return;At(()=>{const $=E.value;$&&$.scrollTo({top:$.scrollHeight,behavior:"smooth"})})};e({refresh:K});const fe=A=>{p.value=JSON.parse(JSON.stringify(A)),s.value=JSON.parse(JSON.stringify(A)),s.value.settings||(s.value.settings={color:"",image:""}),m.value={}},ge=()=>{s.value=null,p.value=null,m.value={}},ve=()=>{var x,$;if(!s.value)return;const A=(s.value.title||"").trim();!A||u.value||(u.value=!0,m.value={},Me.post("options/attr/group/"+r.value+"/term/"+s.value.id,{title:A,settings:{color:((x=s.value.settings)==null?void 0:x.color)||"",image:(($=s.value.settings)==null?void 0:$.image)||""}}).then(N=>{me.success(N.message||d("Term updated")),s.value=null,p.value=null,K()}).catch(N=>{var H;(N==null?void 0:N.status_code)==422&&N.data?m.value=N.data:me.error(((H=N.data)==null?void 0:H.message)||(N==null?void 0:N.message)||d("Failed to update term"))}).finally(()=>{u.value=!1}))},Se=A=>{Gn.ofDelete(d("Are you sure you want to delete this term? This action is not recoverable."),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete")}).then(()=>{Me.delete("options/attr/group/"+r.value+"/term/"+A.id).then(x=>{me.success(x.message),K()}).catch(x=>{var $;me.error((($=x.data)==null?void 0:$.message)||d("Delete failed"))})}).catch(()=>{})},xe=A=>{Me.post("options/attr/group/"+r.value+"/terms/reorder",{ids:A}).then(x=>{me.success(x.message)}).catch(x=>{var $;me.error((($=x.data)==null?void 0:$.message)||d("Failed to save order")),K()})},Y=R([]),Ce=R(!1),se=R(null),Ve=R({}),Ye=R({}),$e=ce(()=>Y.value.length?Y.value[Y.value.length-1]:null),Qe=ce(()=>Y.value.slice(0,-1)),it=A=>{const x=Ye.value[A];return x===void 0?"":`terms.${x}`},lt=A=>{const x=it(A);if(!x)return!1;const $=`${x}.`;return Object.keys(Ve.value).some(N=>N.indexOf($)===0)},st=A=>{se.value=A},P=()=>{se.value=null},b=A=>!A||!A.title||!A.title.trim()?!1:i.value==="color"?!!(A.settings&&A.settings.color):i.value==="image"?!!(A.settings&&A.settings.image):!0,F=ce(()=>Y.value.filter(b)),be=ce(()=>b($e.value)),k=ce(()=>!(Y.value.length>=ut||$e.value&&!be.value)),q=ce(()=>Y.value.length>=ut?d("Limit reached (%1$s)",ut):d("Add more")),ie=ce(()=>Y.value.length>=ut?d("Save these %1$s and add more after.",ut):i.value==="color"?d("Fill the title and color before adding another."):i.value==="image"?d("Fill the title and image before adding another."):d("Fill the title before adding another.")),Ke=()=>{k.value&&Y.value.push({title:"",settings:{color:"",image:""}})},Te=A=>{Y.value.splice(A,1),se.value===A?se.value=null:se.value!==null&&se.value>A&&(se.value-=1);const x={};Object.entries(Ye.value).forEach(([$,N])=>{const H=Number($);H<A?x[H]=N:H>A&&(x[H-1]=N)}),Ye.value=x},Vt=()=>{i.value==="options"&&Ke()},jn=()=>{if(!F.value.length||Ce.value)return;Ce.value=!0,Ve.value={};const A={},x=[];Y.value.forEach(($,N)=>{$.title&&$.title.trim()!==""&&(A[N]=x.length,x.push({title:$.title.trim(),settings:{color:$.settings.color||"",image:$.settings.image||""}}))}),Ye.value=A,Me.post("options/attr/group/"+r.value+"/terms",{terms:x}).then($=>{me.success($.message||d("Terms added")),Y.value=[],se.value=null,Ye.value={};const N=($.data||[]).map(H=>H.id);de(N.length?N[N.length-1]:null)}).catch($=>{var N;($==null?void 0:$.status_code)==422&&$.data?Ve.value=$.data:me.error(((N=$.data)==null?void 0:N.message)||d("Failed to save terms"))}).finally(()=>{Ce.value=!1})};return(A,x)=>{const $=te("el-button");return y(),C("div",ha,[g("div",ga,[g("div",va,[g("div",ba,[g("span",ya,V(S(d)("Attributes")),1),x[2]||(x[2]=g("span",{class:"fct-attr-panel-breadcrumb-sep"},"›",-1)),g("span",_a,V(t.group.title),1),g("button",{type:"button",class:"fct-attr-icon-btn","aria-label":S(d)("Edit group"),onClick:x[0]||(x[0]=N=>a("edit-group"))},[v(le,{name:"Edit"})],8,wa)]),Y.value.length?(y(),Ae($,{key:0,size:"small",type:"primary",disabled:!F.value.length||Ce.value,loading:Ce.value,onClick:jn},{default:B(()=>[Ee(V(S(d)("Save"))+" ",1),F.value.length?(y(),C(re,{key:0},[Ee(" ("+V(F.value.length)+")",1)],64)):oe("",!0)]),_:1},8,["disabled","loading"])):oe("",!0)]),g("div",Ea,[g("span",Da,V(T.value)+" "+V(S(d)("Terms")),1),g("span",Sa,[g("span",Ca,V(S(d)("Type")),1),Ee(" "+V(l.value),1)]),g("span",ka,[g("span",Ta,V(S(d)("Styling")),1),Ee(" "+V(c.value),1)])])]),g("div",{ref_key:"panelBodyRef",ref:E,class:"fct-attr-panel-body",onScrollPassive:U},[j.value?(y(),Ae(ma,{key:0})):(y(),C(re,{key:1},[X.value?(y(),C("div",Ia,V(S(d)("Load every term before reordering.")),1)):oe("",!0),v(fa,{rows:h.value,group:t.group,"editing-term-id":s.value?s.value.id:null,"disable-reorder":X.value,onEdit:fe,onDelete:Se,onReorder:xe},{"edit-form":B(()=>[s.value?(y(),Ae(Zt,{key:0,class:"fct-term-edit-form",term:s.value,"group-type":i.value,"show-remove-button":!1,"validation-errors":m.value,onRemove:ge,onSubmit:ve},{actions:B(()=>[g("div",Oa,[v($,{size:"small",onClick:ge},{default:B(()=>[Ee(V(S(d)("Cancel")),1)]),_:1}),v($,{size:"small",type:"primary",disabled:!(s.value.title||"").trim()||u.value,loading:u.value,onClick:ve},{default:B(()=>[Ee(V(S(d)("Save")),1)]),_:1},8,["disabled","loading"])])]),_:1},8,["term","group-type","validation-errors"])):oe("",!0)]),_:1},8,["rows","group","editing-term-id","disable-reorder"]),Qe.value.length?(y(),C("div",Aa,[(y(!0),C(re,null,Le(Qe.value,(N,H)=>(y(),C("div",{key:"completed-"+H,class:"fct-term-row-item-wrap"},[se.value===H?(y(),Ae(Zt,{key:0,term:Y.value[H],"group-type":i.value,"validation-errors":Ve.value,"field-key":it(H),onRemove:P,onSubmit:P},null,8,["term","group-type","validation-errors","field-key"])):(y(),C("div",{key:1,class:Oe(["fct-term-row-item fct-term-row-item--draft",{"is-error":lt(H),"is-clickable":lt(H)}]),role:"button",tabindex:"0","aria-label":S(d)("Edit draft"),onClick:Lt=>st(H),onKeydown:[He(Ne(Lt=>st(H),["prevent"]),["enter"]),He(Ne(Lt=>st(H),["prevent"]),["space"])]},[g("span",$a,[v(le,{name:"ReorderDotsVertical"})]),i.value==="color"&&N.settings.color?(y(),C("span",{key:0,class:"fct-term-row-color-dot",style:Ze({background:N.settings.color})},null,4)):i.value==="image"&&N.settings.image?(y(),C("img",{key:1,src:N.settings.image,alt:N.title,class:"fct-term-row-img"},null,8,Na)):oe("",!0),g("span",Pa,V(N.title||S(d)("No Name")),1),g("button",{type:"button",class:"fct-term-row-delete","aria-label":S(d)("Remove draft"),onClick:Ne(Lt=>Te(H),["stop"])},[v(le,{name:"Delete"})],8,Ma)],42,xa))]))),128))])):oe("",!0),$e.value?(y(),Ae(Zt,{key:2,term:$e.value,"group-type":i.value,"validation-errors":Ve.value,"field-key":it(Y.value.length-1),onRemove:x[1]||(x[1]=N=>Te(Y.value.length-1)),onSubmit:Vt},null,8,["term","group-type","validation-errors","field-key"])):oe("",!0)],64))],544),j.value?oe("",!0):(y(),C("div",Ra,[g("button",{type:"button",class:"fct-attr-add-attr-btn fct-attr-add-attr-btn--main",disabled:!k.value,title:k.value?null:ie.value,onClick:Ke},[v(le,{name:"Plus"}),k.value?(y(),C(re,{key:1},[Ee(V(Y.value.length?S(d)("Add more"):S(d)("Add Terms")),1)],64)):(y(),C(re,{key:0},[Ee(V(q.value),1)],64))],8,Fa),T.value>0?(y(),C("button",{key:0,type:"button",class:"fct-attr-panel-footer-sync",disabled:!X.value||z.value,title:Z.value,"aria-label":Z.value,onClick:w},[v(le,{name:"Reload",class:Oe({"fct-spin":z.value})},null,8,["class"])],8,Va)):oe("",!0)]))])}}},Ga={name:"EditGroupModal",props:["group","groupId"],setup(t,e){const n=R(!1),o=R(!1),a=R({}),r=R(null),i=()=>{var u,m;(m=(u=r.value)==null?void 0:u.focus)==null||m.call(u)};e.expose({focusTitle:i});const l=t.group.settings||{},c=Cn({type:l.type||"options",styling:l.styling||"button"}),s=()=>{n.value=!0,a.value={};const u={...c};Me.put("options/attr/group/"+t.groupId,{title:t.group.title,settings:u}).then(m=>{kn(m.message),t.group.settings=u,e.emit("whenGroupEditIsDone",t.group)}).catch(m=>{if(m.message)return qn(m);if(typeof m=="object")return a.value=m}).finally(()=>{n.value=!1})};return{loading:n,is_group_loading:o,updateGroup:s,handleTitleKeyup:u=>{u.key==="Enter"&&(n.value||!t.group.title||s())},validationErrors:a,groupSettings:c,titleInputRef:r}}},ja={class:"fct-attr-group-edit-modal"},Ya={class:"dialog-footer"};function Xa(t,e,n,o,a,r){const i=te("el-input"),l=te("el-form-item"),c=te("el-col"),s=te("el-option"),p=te("el-select"),u=te("el-row"),m=te("el-form"),D=te("el-button");return y(),C("div",ja,[v(m,{"label-position":"top",data:n.group},{default:B(()=>[v(u,{gutter:24},{default:B(()=>[v(c,{span:24},{default:B(()=>[v(l,{label:t.$t("Group Title")},{default:B(()=>[v(i,{ref:"titleInputRef",type:"text",modelValue:n.group.title,"onUpdate:modelValue":e[0]||(e[0]=h=>n.group.title=h),placeholder:t.$t("Group Title"),onKeyup:o.handleTitleKeyup},null,8,["modelValue","placeholder","onKeyup"]),o.validationErrors.title?(y(!0),C(re,{key:0},Le(o.validationErrors.title,(h,T)=>(y(),C("span",{class:"error",key:T},V(h),1))),128)):oe("",!0)]),_:1},8,["label"])]),_:1}),v(c,{span:12},{default:B(()=>[v(l,{label:t.$t("Attribute Type")},{default:B(()=>[v(p,{modelValue:o.groupSettings.type,"onUpdate:modelValue":e[1]||(e[1]=h=>o.groupSettings.type=h),style:{width:"100%"}},{default:B(()=>[v(s,{label:t.$t("Options"),value:"options"},null,8,["label"]),v(s,{label:t.$t("Color"),value:"color"},null,8,["label"]),v(s,{label:t.$t("Image"),value:"image"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1}),v(c,{span:12},{default:B(()=>[v(l,{label:t.$t("Styling")},{default:B(()=>[v(p,{modelValue:o.groupSettings.styling,"onUpdate:modelValue":e[2]||(e[2]=h=>o.groupSettings.styling=h),clearable:"",style:{width:"100%"}},{default:B(()=>[v(s,{label:t.$t("Dropdown"),value:"dropdown"},null,8,["label"]),v(s,{label:t.$t("Button"),value:"button"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1},8,["data"]),g("div",Ya,[v(D,{disabled:!n.group.title||o.loading,loading:o.is_group_loading,onClick:e[3]||(e[3]=h=>o.updateGroup()),type:"primary"},{default:B(()=>[Ee(V(t.$t("Save changes")),1)]),_:1},8,["disabled","loading"])])])}const Ua=Jn(Ga,[["render",Xa]]),Ha={class:"fct-attr-split-page fct-layout-width"},Wa={class:"fct-attr-split-page-title"},Ka={class:"fct-attr-split-card"},za={class:"fct-attr-split-left"},qa={class:"fct-attr-split-left-header"},Ja={class:"fct-attr-split-title"},Za={class:"fct-attr-split-count"},Qa=["aria-label"],er={class:"fct-attr-split-search"},tr=["aria-pressed","aria-label","onClick","onKeydown"],nr=["data-group-id","aria-label","onKeydown"],or={class:"fct-attr-group-item-body"},ar={class:"fct-attr-group-item-name"},rr={class:"fct-attr-group-item-meta"},ir=["aria-label","onClick"],lr=["aria-label","onClick"],sr={key:0,class:"fct-attr-group-empty"},ur={key:1,class:"fct-attr-group-loading"},cr={class:"fct-attr-split-left-footer"},dr=["disabled"],fr={class:"fct-attr-load-more-count"},pr={class:"fct-attr-split-right"},mr={key:1,class:"fct-attr-panel-skeleton"},hr={class:"fct-attr-panel-skeleton-body"},gr={key:2,class:"fct-attr-split-empty"},vr=10,Tr={__name:"AttrGroups",setup(t){const e=R(null),n=R(!1),o=R(null),a=R(null),r=R(!1),i=R({}),l=R(""),c=R(null),s=R([]),p=R(1),u=R(1),m=R(0),D=R(!0),h=R(!1),T=ce(()=>p.value<u.value),j=R(null),z=ce(()=>!l.value.trim()&&s.value.length>1),X=P=>l.value.trim()?(P.title||"").toLowerCase().includes(l.value.toLowerCase()):!0,Z=R(!1);let W=!1;const _=()=>{if(Z.value){W=!0;return}const P=s.value.map(b=>b.id);P.length<2||(Z.value=!0,Me.post("options/attr/groups/reorder",{ids:P}).then(b=>{me.success(b.message||d("Groups reordered"))}).catch(b=>{var F;me.error(((F=b.data)==null?void 0:F.message)||d("Failed to reorder groups")),fe()}).finally(()=>{Z.value=!1,W&&(W=!1,_())}))},w=(P,b)=>{if(!z.value)return;const F=s.value,be=F.findIndex(ie=>ie.id===P.id),k=be+b;if(be===-1||k<0||k>=F.length)return;const q=F[k];F[k]=F[be],F[be]=q,_(),At(()=>{const ie=document.querySelector('.fct-attr-group-handle[data-group-id="'+P.id+'"]');ie&&ie.focus()})};let U=0;const K=(P=1,b=!1)=>{const F=++U;b?h.value=!0:D.value=!0;const be={per_page:vr,page:P};return l.value&&l.value.trim()&&(be.search=l.value.trim()),Me.get("options/attr/groups",be).then(k=>{if(F!==U)return!1;const q=k.groups||{},ie=q.data||[];if(s.value=b?s.value.concat(ie):ie,m.value=Number(q.total||0),u.value=Number(q.last_page||1),p.value=Number(q.current_page||P),!b){const Ke=e.value&&s.value.some(Vt=>Vt.id===e.value.id),Te=e.value&&e.value.id===j.value;!Ke&&!Te&&(e.value=s.value.length?s.value[0]:null),j.value=null}return!0}).catch(k=>{var q;return F!==U||me.error(((q=k.data)==null?void 0:q.message)||d("Failed to load attributes")),!1}).finally(()=>{F===U&&(D.value=!1,h.value=!1)})};K(1,!1);const E=()=>{!T.value||h.value||D.value||K(p.value+1,!0)},de=P=>{const b=P.target;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<120&&E()},fe=()=>{p.value=1,K(1,!1)};let ge=null;Dn(l,()=>{ge&&clearTimeout(ge),ge=setTimeout(()=>{p.value=1,K(1,!1)},300)}),Hn(()=>{ge&&clearTimeout(ge)});const ve=ce(()=>{if(!l.value.trim())return s.value;const P=l.value.toLowerCase();return s.value.filter(b=>(b.title||"").toLowerCase().includes(P))}),Se=["65%","50%","70%","45%","60%","55%"],xe=["80%","70%","85%","65%","75%","90%"],Y=P=>Se[(P-1)%Se.length],Ce=P=>xe[(P-1)%xe.length],se=P=>{var F;return{options:d("Options"),color:d("Color"),image:d("Image")}[((F=P.settings)==null?void 0:F.type)||"options"]||d("Options")},Ve=P=>{var F;return{dropdown:d("Dropdown"),button:d("Button")}[((F=P.settings)==null?void 0:F.styling)||"button"]||d("Button")},Ye=P=>d("Open attribute group: %1$s",P.title||d("No Name")),$e=P=>{i.value=P,r.value=!0},Qe=P=>{if(P.used_terms_count>0){me.error(d("Group's terms are already in use, please remove the terms from product first."));return}Gn.ofDelete(d("Are you sure you want to delete this group? This action is not recoverable."),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete this group")}).then(()=>{Me.delete("options/attr/group/"+P.id).then(b=>{var F;me.success(b.message),((F=e.value)==null?void 0:F.id)===P.id&&(e.value=null),fe()}).catch(b=>{var F;me.error(((F=b.data)==null?void 0:F.message)||d("Delete failed"))})}).catch(()=>{})},it=async P=>{n.value=!1;const b=P&&P.id?P.id:null;if(b&&(e.value=P,j.value=b),!await K(1,!1))return;let F=0;for(;b&&!s.value.some(be=>be.id===b)&&T.value&&F<50;)if(F++,!await K(p.value+1,!0))return;lt()},lt=(P=10)=>{At(()=>{const b=document.querySelector(".fct-attr-group-list");if(b){const F=b.querySelector(".fct-attr-group-item.is-active");F&&F.scrollIntoView({block:"nearest",behavior:"smooth"});return}P>0&&requestAnimationFrame(()=>lt(P-1))})},st=()=>{i.value={},r.value=!1};return(P,b)=>{const F=te("el-input"),be=te("el-dialog");return y(),C("div",Ha,[g("h1",Wa,V(S(d)("Attributes & Terms")),1),g("div",Ka,[g("div",za,[g("div",qa,[g("div",Ja,[g("span",null,V(S(d)("Attributes")),1),g("span",Za,V(s.value.length),1)]),g("button",{class:"fct-attr-icon-btn","aria-label":S(d)("Add attribute group"),onClick:b[0]||(b[0]=k=>n.value=!0)},[v(le,{name:"Plus"})],8,Qa)]),g("div",er,[v(F,{modelValue:l.value,"onUpdate:modelValue":b[1]||(b[1]=k=>l.value=k),placeholder:S(d)("Search attributes"),size:"small",clearable:""},{prefix:B(()=>[v(le,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),g("div",{class:"fct-attr-group-list",onScrollPassive:de},[v(S(Bn),{list:s.value,handle:".fct-attr-group-handle",disabled:!z.value||D.value||h.value||Z.value,animation:150,"ghost-class":"fct-attr-group-item--ghost",tag:"div",class:"fct-attr-group-list-inner",onEnd:_},{default:B(()=>[(y(!0),C(re,null,Le(s.value,k=>{var q,ie,Ke;return Wn((y(),C("div",{key:k.id,class:Oe(["fct-attr-group-item",{"is-active":((q=e.value)==null?void 0:q.id)===k.id}]),role:"button",tabindex:"0","aria-pressed":((ie=e.value)==null?void 0:ie.id)===k.id,"aria-label":Ye(k),onClick:Te=>e.value=k,onKeydown:[He(Ne(Te=>e.value=k,["prevent"]),["enter"]),He(Ne(Te=>e.value=k,["prevent"]),["space"])]},[z.value?(y(),C("button",{key:0,type:"button",class:"fct-attr-group-handle","data-group-id":k.id,"aria-label":S(d)("Reorder %1$s — drag, or use arrow up and down keys",k.title||S(d)("No Name")),onClick:b[2]||(b[2]=Ne(()=>{},["stop"])),onMousedown:b[3]||(b[3]=Ne(()=>{},["stop"])),onKeydown:[He(Ne(Te=>w(k,-1),["prevent","stop"]),["up"]),He(Ne(Te=>w(k,1),["prevent","stop"]),["down"])]},[v(le,{name:"ReorderDotsVertical"})],40,nr)):oe("",!0),g("div",or,[g("span",ar,V(k.title||S(d)("No Name")),1),g("span",rr,V(se(k))+" · "+V(Ve(k))+" · "+V(k.terms_count||0)+" "+V(S(d)("terms")),1)]),g("div",{class:"fct-attr-group-item-actions",onClick:b[4]||(b[4]=Ne(()=>{},["stop"]))},[g("button",{class:"fct-attr-icon-btn fct-attr-group-action","aria-label":S(d)("Edit group"),onClick:Te=>$e(k)},[v(le,{name:"Edit"})],8,ir),g("button",{class:"fct-attr-icon-btn fct-attr-group-action fct-attr-group-action--delete","aria-label":S(d)("Delete group"),onClick:Te=>Qe(k)},[v(le,{name:"Delete"})],8,lr)]),((Ke=e.value)==null?void 0:Ke.id)===k.id?(y(),Ae(le,{key:1,name:"ChevronRight",class:"fct-attr-group-chevron"})):oe("",!0)],42,tr)),[[Kn,X(k)]])}),128))]),_:1},8,["list","disabled"]),!D.value&&!h.value&&!ve.value.length?(y(),C("div",sr,V(l.value?S(d)("No results found"):S(d)("No attributes yet")),1)):oe("",!0),D.value?(y(),C("div",ur,[(y(),C(re,null,Le(6,k=>g("div",{key:k,class:"fct-attr-group-skeleton"},[g("span",{class:"fct-skel-block fct-skel-group-title",style:Ze({width:Y(k)})},null,4),g("span",{class:"fct-skel-block fct-skel-group-meta",style:Ze({width:Ce(k)})},null,4)])),64))])):oe("",!0)],32),g("div",cr,[g("button",{class:"fct-attr-add-attr-btn",disabled:!T.value||h.value,onClick:E},[v(le,{name:"Reload",class:Oe({"fct-spin":h.value})},null,8,["class"]),h.value?(y(),C(re,{key:0},[Ee(V(S(d)("Loading...")),1)],64)):T.value?(y(),C(re,{key:1},[Ee(V(S(d)("Load More"))+" ",1),g("span",fr,"("+V(s.value.length)+"/"+V(m.value)+")",1)],64)):(y(),C(re,{key:2},[Ee(V(S(d)("All loaded"))+" ("+V(m.value)+")",1)],64))],8,dr)])]),g("div",pr,[e.value?(y(),Ae(Ba,{ref_key:"panelRef",ref:c,key:e.value.id,group:e.value,onEditGroup:b[5]||(b[5]=k=>$e(e.value))},null,8,["group"])):D.value?(y(),C("div",mr,[b[13]||(b[13]=zn('<div class="fct-attr-panel-skeleton-header"><div class="fct-skel-block fct-skel-breadcrumb"></div><div class="fct-attr-panel-skeleton-chips"><span class="fct-skel-block fct-skel-chip"></span><span class="fct-skel-block fct-skel-chip"></span><span class="fct-skel-block fct-skel-chip"></span></div></div>',1)),g("div",hr,[(y(),C(re,null,Le(6,k=>g("div",{key:k,class:"fct-term-row-item fct-term-row-item--skeleton"},[b[10]||(b[10]=g("span",{class:"fct-skel-block fct-skel-handle"},null,-1)),b[11]||(b[11]=g("span",{class:"fct-skel-block fct-skel-dot"},null,-1)),g("span",{class:"fct-skel-block fct-skel-title",style:Ze({width:Y(k)})},null,4),b[12]||(b[12]=g("span",{class:"fct-skel-block fct-skel-action"},null,-1))])),64))])])):(y(),C("div",gr,[v(le,{name:"Empty/ListView"}),g("p",null,V(S(d)("Select an attribute to manage its terms")),1)]))])]),v(be,{"append-to-body":!0,width:"50%",modelValue:n.value,"onUpdate:modelValue":b[6]||(b[6]=k=>n.value=k),title:S(d)("Add new attribute group"),onOpened:b[7]||(b[7]=k=>{var q,ie;return(ie=(q=o.value)==null?void 0:q.focusTitle)==null?void 0:ie.call(q)})},{default:B(()=>[n.value?(y(),Ae(ta,{key:0,ref_key:"addGroupModalRef",ref:o,onWhenGroupCreateIsDone:it},null,512)):oe("",!0)]),_:1},8,["modelValue","title"]),v(be,{"append-to-body":!0,width:"50%",modelValue:r.value,"onUpdate:modelValue":b[8]||(b[8]=k=>r.value=k),title:S(d)("Edit attribute group"),onOpened:b[9]||(b[9]=k=>{var q,ie;return(ie=(q=a.value)==null?void 0:q.focusTitle)==null?void 0:ie.call(q)})},{default:B(()=>[r.value?(y(),Ae(Ua,{key:0,ref_key:"editGroupModalRef",ref:a,group:i.value,"group-id":i.value.id,onWhenGroupEditIsDone:st},null,8,["group","group-id"])):oe("",!0)]),_:1},8,["modelValue","title"])])}}};export{Zn as C,Bn as V,pt as _,Zt as a,ta as b,Gn as c,Tr as d};
10 + */function fn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,o)}return n}function Fe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fn(Object(n),!0).forEach(function(o){no(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fn(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function Ct(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ct=function(e){return typeof e}:Ct=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ct(t)}function no(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ge(){return Ge=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Ge.apply(this,arguments)}function oo(t,e){if(t==null)return{};var n={},o=Object.keys(t),a,r;for(r=0;r<o.length;r++)a=o[r],!(e.indexOf(a)>=0)&&(n[a]=t[a]);return n}function ao(t,e){if(t==null)return{};var n=oo(t,e),o,a;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(a=0;a<r.length;a++)o=r[a],!(e.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(t,o)&&(n[o]=t[o])}return n}var ro="1.14.0";function Be(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var je=Be(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),yt=Be(/Edge/i),pn=Be(/firefox/i),mt=Be(/safari/i)&&!Be(/chrome/i)&&!Be(/android/i),Tn=Be(/iP(ad|od|hone)/i),io=Be(/chrome/i)&&Be(/android/i),In={capture:!1,passive:!1};function G(t,e,n){t.addEventListener(e,n,!je&&In)}function L(t,e,n){t.removeEventListener(e,n,!je&&In)}function xt(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function lo(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Pe(t,e,n,o){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&xt(t,e):xt(t,e))||o&&t===n)return t;if(t===n)break}while(t=lo(t))}return null}var mn=/\s+/g;function _e(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(mn," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(mn," ")}}function I(t,e,n){var o=t&&t.style;if(o){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),e===void 0?n:n[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=n+(typeof n=="string"?"":"px")}}function at(t,e){var n="";if(typeof t=="string")n=t;else do{var o=I(t,"transform");o&&o!=="none"&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var a=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return a&&new a(n)}function On(t,e,n){if(t){var o=t.getElementsByTagName(e),a=0,r=o.length;if(n)for(;a<r;a++)n(o[a],a);return o}return[]}function Re(){var t=document.scrollingElement;return t||document.documentElement}function ae(t,e,n,o,a){if(!(!t.getBoundingClientRect&&t!==window)){var r,i,l,c,s,p,u;if(t!==window&&t.parentNode&&t!==Re()?(r=t.getBoundingClientRect(),i=r.top,l=r.left,c=r.bottom,s=r.right,p=r.height,u=r.width):(i=0,l=0,c=window.innerHeight,s=window.innerWidth,p=window.innerHeight,u=window.innerWidth),(e||n)&&t!==window&&(a=a||t.parentNode,!je))do if(a&&a.getBoundingClientRect&&(I(a,"transform")!=="none"||n&&I(a,"position")!=="static")){var m=a.getBoundingClientRect();i-=m.top+parseInt(I(a,"border-top-width")),l-=m.left+parseInt(I(a,"border-left-width")),c=i+r.height,s=l+r.width;break}while(a=a.parentNode);if(o&&t!==window){var D=at(a||t),h=D&&D.a,T=D&&D.d;D&&(i/=T,l/=h,u/=h,p/=T,c=i+p,s=l+u)}return{top:i,left:l,bottom:c,right:s,width:u,height:p}}}function hn(t,e,n){for(var o=We(t,!0),a=ae(t)[e];o;){var r=ae(o)[n],i=void 0;if(i=a>=r,!i)return o;if(o===Re())break;o=We(o,!1)}return!1}function rt(t,e,n,o){for(var a=0,r=0,i=t.children;r<i.length;){if(i[r].style.display!=="none"&&i[r]!==O.ghost&&(o||i[r]!==O.dragged)&&Pe(i[r],n.draggable,t,!1)){if(a===e)return i[r];a++}r++}return null}function rn(t,e){for(var n=t.lastElementChild;n&&(n===O.ghost||I(n,"display")==="none"||e&&!xt(n,e));)n=n.previousElementSibling;return n||null}function ke(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==O.clone&&(!e||xt(t,e))&&n++;return n}function gn(t){var e=0,n=0,o=Re();if(t)do{var a=at(t),r=a.a,i=a.d;e+=t.scrollLeft*r,n+=t.scrollTop*i}while(t!==o&&(t=t.parentNode));return[e,n]}function so(t,e){for(var n in t)if(t.hasOwnProperty(n)){for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n)}return-1}function We(t,e){if(!t||!t.getBoundingClientRect)return Re();var n=t,o=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var a=I(n);if(n.clientWidth<n.scrollWidth&&(a.overflowX=="auto"||a.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(a.overflowY=="auto"||a.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return Re();if(o||e)return n;o=!0}}while(n=n.parentNode);return Re()}function uo(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Gt(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}var ht;function An(t,e){return function(){if(!ht){var n=arguments,o=this;n.length===1?t.call(o,n[0]):t.apply(o,n),ht=setTimeout(function(){ht=void 0},e)}}}function co(){clearTimeout(ht),ht=void 0}function xn(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function $n(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}var De="Sortable"+new Date().getTime();function fo(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var o=[].slice.call(this.el.children);o.forEach(function(a){if(!(I(a,"display")==="none"||a===O.ghost)){t.push({target:a,rect:ae(a)});var r=Fe({},t[t.length-1].rect);if(a.thisAnimationDuration){var i=at(a,!0);i&&(r.top-=i.f,r.left-=i.e)}a.fromRect=r}})}},addAnimationState:function(o){t.push(o)},removeAnimationState:function(o){t.splice(so(t,{target:o}),1)},animateAll:function(o){var a=this;if(!this.options.animation){clearTimeout(e),typeof o=="function"&&o();return}var r=!1,i=0;t.forEach(function(l){var c=0,s=l.target,p=s.fromRect,u=ae(s),m=s.prevFromRect,D=s.prevToRect,h=l.rect,T=at(s,!0);T&&(u.top-=T.f,u.left-=T.e),s.toRect=u,s.thisAnimationDuration&&Gt(m,u)&&!Gt(p,u)&&(h.top-u.top)/(h.left-u.left)===(p.top-u.top)/(p.left-u.left)&&(c=mo(h,m,D,a.options)),Gt(u,p)||(s.prevFromRect=p,s.prevToRect=u,c||(c=a.options.animation),a.animate(s,h,u,c)),c&&(r=!0,i=Math.max(i,c),clearTimeout(s.animationResetTimer),s.animationResetTimer=setTimeout(function(){s.animationTime=0,s.prevFromRect=null,s.fromRect=null,s.prevToRect=null,s.thisAnimationDuration=null},c),s.thisAnimationDuration=c)}),clearTimeout(e),r?e=setTimeout(function(){typeof o=="function"&&o()},i):typeof o=="function"&&o(),t=[]},animate:function(o,a,r,i){if(i){I(o,"transition",""),I(o,"transform","");var l=at(this.el),c=l&&l.a,s=l&&l.d,p=(a.left-r.left)/(c||1),u=(a.top-r.top)/(s||1);o.animatingX=!!p,o.animatingY=!!u,I(o,"transform","translate3d("+p+"px,"+u+"px,0)"),this.forRepaintDummy=po(o),I(o,"transition","transform "+i+"ms"+(this.options.easing?" "+this.options.easing:"")),I(o,"transform","translate3d(0,0,0)"),typeof o.animated=="number"&&clearTimeout(o.animated),o.animated=setTimeout(function(){I(o,"transition",""),I(o,"transform",""),o.animated=!1,o.animatingX=!1,o.animatingY=!1},i)}}}}function po(t){return t.offsetWidth}function mo(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}var et=[],jt={initializeByDefault:!0},_t={mount:function(e){for(var n in jt)jt.hasOwnProperty(n)&&!(n in e)&&(e[n]=jt[n]);et.forEach(function(o){if(o.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),et.push(e)},pluginEvent:function(e,n,o){var a=this;this.eventCanceled=!1,o.cancel=function(){a.eventCanceled=!0};var r=e+"Global";et.forEach(function(i){n[i.pluginName]&&(n[i.pluginName][r]&&n[i.pluginName][r](Fe({sortable:n},o)),n.options[i.pluginName]&&n[i.pluginName][e]&&n[i.pluginName][e](Fe({sortable:n},o)))})},initializePlugins:function(e,n,o,a){et.forEach(function(l){var c=l.pluginName;if(!(!e.options[c]&&!l.initializeByDefault)){var s=new l(e,n,e.options);s.sortable=e,s.options=e.options,e[c]=s,Ge(o,s.defaults)}});for(var r in e.options)if(e.options.hasOwnProperty(r)){var i=this.modifyOption(e,r,e.options[r]);typeof i<"u"&&(e.options[r]=i)}},getEventProperties:function(e,n){var o={};return et.forEach(function(a){typeof a.eventProperties=="function"&&Ge(o,a.eventProperties.call(n[a.pluginName],e))}),o},modifyOption:function(e,n,o){var a;return et.forEach(function(r){e[r.pluginName]&&r.optionListeners&&typeof r.optionListeners[n]=="function"&&(a=r.optionListeners[n].call(e[r.pluginName],o))}),a}};function ho(t){var e=t.sortable,n=t.rootEl,o=t.name,a=t.targetEl,r=t.cloneEl,i=t.toEl,l=t.fromEl,c=t.oldIndex,s=t.newIndex,p=t.oldDraggableIndex,u=t.newDraggableIndex,m=t.originalEvent,D=t.putSortable,h=t.extraEventProperties;if(e=e||n&&n[De],!!e){var T,j=e.options,z="on"+o.charAt(0).toUpperCase()+o.substr(1);window.CustomEvent&&!je&&!yt?T=new CustomEvent(o,{bubbles:!0,cancelable:!0}):(T=document.createEvent("Event"),T.initEvent(o,!0,!0)),T.to=i||n,T.from=l||n,T.item=a||n,T.clone=r,T.oldIndex=c,T.newIndex=s,T.oldDraggableIndex=p,T.newDraggableIndex=u,T.originalEvent=m,T.pullMode=D?D.lastPutMode:void 0;var X=Fe(Fe({},h),_t.getEventProperties(o,e));for(var Q in X)T[Q]=X[Q];n&&n.dispatchEvent(T),j[z]&&j[z].call(e,T)}}var go=["evt"],ye=function(e,n){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=o.evt,r=ao(o,go);_t.pluginEvent.bind(O)(e,n,Fe({dragEl:f,parentEl:Z,ghostEl:M,rootEl:J,nextEl:Je,lastDownEl:kt,cloneEl:ee,cloneHidden:Ue,dragStarted:ct,putSortable:ue,activeSortable:O.active,originalEvent:a,oldIndex:ot,oldDraggableIndex:gt,newIndex:we,newDraggableIndex:Xe,hideGhostForTarget:Rn,unhideGhostForTarget:Fn,cloneNowHidden:function(){Ue=!0},cloneNowShown:function(){Ue=!1},dispatchSortableEvent:function(l){he({sortable:n,name:l,originalEvent:a})}},r))};function he(t){ho(Fe({putSortable:ue,cloneEl:ee,targetEl:f,rootEl:J,oldIndex:ot,oldDraggableIndex:gt,newIndex:we,newDraggableIndex:Xe},t))}var f,Z,M,J,Je,kt,ee,Ue,ot,we,gt,Xe,wt,ue,nt=!1,$t=!1,Nt=[],ze,Ie,Yt,Xt,vn,bn,ct,tt,vt,bt=!1,Et=!1,Tt,pe,Ut=[],Zt=!1,Pt=[],Ft=typeof document<"u",Dt=Tn,yn=yt||je?"cssFloat":"float",vo=Ft&&!io&&!Tn&&"draggable"in document.createElement("div"),Nn=function(){if(Ft){if(je)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Pn=function(e,n){var o=I(e),a=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),r=rt(e,0,n),i=rt(e,1,n),l=r&&I(r),c=i&&I(i),s=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+ae(r).width,p=c&&parseInt(c.marginLeft)+parseInt(c.marginRight)+ae(i).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&l.float&&l.float!=="none"){var u=l.float==="left"?"left":"right";return i&&(c.clear==="both"||c.clear===u)?"vertical":"horizontal"}return r&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||s>=a&&o[yn]==="none"||i&&o[yn]==="none"&&s+p>a)?"vertical":"horizontal"},bo=function(e,n,o){var a=o?e.left:e.top,r=o?e.right:e.bottom,i=o?e.width:e.height,l=o?n.left:n.top,c=o?n.right:n.bottom,s=o?n.width:n.height;return a===l||r===c||a+i/2===l+s/2},yo=function(e,n){var o;return Nt.some(function(a){var r=a[De].options.emptyInsertThreshold;if(!(!r||rn(a))){var i=ae(a),l=e>=i.left-r&&e<=i.right+r,c=n>=i.top-r&&n<=i.bottom+r;if(l&&c)return o=a}}),o},Mn=function(e){function n(r,i){return function(l,c,s,p){var u=l.options.group.name&&c.options.group.name&&l.options.group.name===c.options.group.name;if(r==null&&(i||u))return!0;if(r==null||r===!1)return!1;if(i&&r==="clone")return r;if(typeof r=="function")return n(r(l,c,s,p),i)(l,c,s,p);var m=(i?l:c).options.group.name;return r===!0||typeof r=="string"&&r===m||r.join&&r.indexOf(m)>-1}}var o={},a=e.group;(!a||Ct(a)!="object")&&(a={name:a}),o.name=a.name,o.checkPull=n(a.pull,!0),o.checkPut=n(a.put),o.revertClone=a.revertClone,e.group=o},Rn=function(){!Nn&&M&&I(M,"display","none")},Fn=function(){!Nn&&M&&I(M,"display","")};Ft&&document.addEventListener("click",function(t){if($t)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),$t=!1,!1},!0);var qe=function(e){if(f){e=e.touches?e.touches[0]:e;var n=yo(e.clientX,e.clientY);if(n){var o={};for(var a in e)e.hasOwnProperty(a)&&(o[a]=e[a]);o.target=o.rootEl=n,o.preventDefault=void 0,o.stopPropagation=void 0,n[De]._onDragOver(o)}}},_o=function(e){f&&f.parentNode[De]._isOutsideThisEl(e.target)};function O(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=Ge({},e),t[De]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Pn(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(i,l){i.setData("Text",l.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:O.supportPointer!==!1&&"PointerEvent"in window&&!mt,emptyInsertThreshold:5};_t.initializePlugins(this,t,n);for(var o in n)!(o in e)&&(e[o]=n[o]);Mn(e);for(var a in this)a.charAt(0)==="_"&&typeof this[a]=="function"&&(this[a]=this[a].bind(this));this.nativeDraggable=e.forceFallback?!1:vo,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?G(t,"pointerdown",this._onTapStart):(G(t,"mousedown",this._onTapStart),G(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(G(t,"dragover",this),G(t,"dragenter",this)),Nt.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),Ge(this,fo())}O.prototype={constructor:O,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(tt=null)},_getDirection:function(e,n){return typeof this.options.direction=="function"?this.options.direction.call(this,e,n,f):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,a=this.options,r=a.preventOnFilter,i=e.type,l=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,c=(l||e).target,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||c,p=a.filter;if(Io(o),!f&&!(/mousedown|pointerdown/.test(i)&&e.button!==0||a.disabled)&&!s.isContentEditable&&!(!this.nativeDraggable&&mt&&c&&c.tagName.toUpperCase()==="SELECT")&&(c=Pe(c,a.draggable,o,!1),!(c&&c.animated)&&kt!==c)){if(ot=ke(c),gt=ke(c,a.draggable),typeof p=="function"){if(p.call(this,e,c,this)){he({sortable:n,rootEl:s,name:"filter",targetEl:c,toEl:o,fromEl:o}),ye("filter",n,{evt:e}),r&&e.cancelable&&e.preventDefault();return}}else if(p&&(p=p.split(",").some(function(u){if(u=Pe(s,u.trim(),o,!1),u)return he({sortable:n,rootEl:u,name:"filter",targetEl:c,fromEl:o,toEl:o}),ye("filter",n,{evt:e}),!0}),p)){r&&e.cancelable&&e.preventDefault();return}a.handle&&!Pe(s,a.handle,o,!1)||this._prepareDragStart(e,l,c)}}},_prepareDragStart:function(e,n,o){var a=this,r=a.el,i=a.options,l=r.ownerDocument,c;if(o&&!f&&o.parentNode===r){var s=ae(o);if(J=r,f=o,Z=f.parentNode,Je=f.nextSibling,kt=o,wt=i.group,O.dragged=f,ze={target:f,clientX:(n||e).clientX,clientY:(n||e).clientY},vn=ze.clientX-s.left,bn=ze.clientY-s.top,this._lastX=(n||e).clientX,this._lastY=(n||e).clientY,f.style["will-change"]="all",c=function(){if(ye("delayEnded",a,{evt:e}),O.eventCanceled){a._onDrop();return}a._disableDelayedDragEvents(),!pn&&a.nativeDraggable&&(f.draggable=!0),a._triggerDragStart(e,n),he({sortable:a,name:"choose",originalEvent:e}),_e(f,i.chosenClass,!0)},i.ignore.split(",").forEach(function(p){On(f,p.trim(),Ht)}),G(l,"dragover",qe),G(l,"mousemove",qe),G(l,"touchmove",qe),G(l,"mouseup",a._onDrop),G(l,"touchend",a._onDrop),G(l,"touchcancel",a._onDrop),pn&&this.nativeDraggable&&(this.options.touchStartThreshold=4,f.draggable=!0),ye("delayStart",this,{evt:e}),i.delay&&(!i.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(yt||je))){if(O.eventCanceled){this._onDrop();return}G(l,"mouseup",a._disableDelayedDrag),G(l,"touchend",a._disableDelayedDrag),G(l,"touchcancel",a._disableDelayedDrag),G(l,"mousemove",a._delayedDragTouchMoveHandler),G(l,"touchmove",a._delayedDragTouchMoveHandler),i.supportPointer&&G(l,"pointermove",a._delayedDragTouchMoveHandler),a._dragStartTimer=setTimeout(c,i.delay)}else c()}},_delayedDragTouchMoveHandler:function(e){var n=e.touches?e.touches[0]:e;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){f&&Ht(f),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;L(e,"mouseup",this._disableDelayedDrag),L(e,"touchend",this._disableDelayedDrag),L(e,"touchcancel",this._disableDelayedDrag),L(e,"mousemove",this._delayedDragTouchMoveHandler),L(e,"touchmove",this._delayedDragTouchMoveHandler),L(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,n){n=n||e.pointerType=="touch"&&e,!this.nativeDraggable||n?this.options.supportPointer?G(document,"pointermove",this._onTouchMove):n?G(document,"touchmove",this._onTouchMove):G(document,"mousemove",this._onTouchMove):(G(f,"dragend",this),G(J,"dragstart",this._onDragStart));try{document.selection?It(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,n){if(nt=!1,J&&f){ye("dragStarted",this,{evt:n}),this.nativeDraggable&&G(document,"dragover",_o);var o=this.options;!e&&_e(f,o.dragClass,!1),_e(f,o.ghostClass,!0),O.active=this,e&&this._appendGhost(),he({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Ie){this._lastX=Ie.clientX,this._lastY=Ie.clientY,Rn();for(var e=document.elementFromPoint(Ie.clientX,Ie.clientY),n=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Ie.clientX,Ie.clientY),e!==n);)n=e;if(f.parentNode[De]._isOutsideThisEl(e),n)do{if(n[De]){var o=void 0;if(o=n[De]._onDragOver({clientX:Ie.clientX,clientY:Ie.clientY,target:e,rootEl:n}),o&&!this.options.dragoverBubble)break}e=n}while(n=n.parentNode);Fn()}},_onTouchMove:function(e){if(ze){var n=this.options,o=n.fallbackTolerance,a=n.fallbackOffset,r=e.touches?e.touches[0]:e,i=M&&at(M,!0),l=M&&i&&i.a,c=M&&i&&i.d,s=Dt&&pe&&gn(pe),p=(r.clientX-ze.clientX+a.x)/(l||1)+(s?s[0]-Ut[0]:0)/(l||1),u=(r.clientY-ze.clientY+a.y)/(c||1)+(s?s[1]-Ut[1]:0)/(c||1);if(!O.active&&!nt){if(o&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(M){i?(i.e+=p-(Yt||0),i.f+=u-(Xt||0)):i={a:1,b:0,c:0,d:1,e:p,f:u};var m="matrix(".concat(i.a,",").concat(i.b,",").concat(i.c,",").concat(i.d,",").concat(i.e,",").concat(i.f,")");I(M,"webkitTransform",m),I(M,"mozTransform",m),I(M,"msTransform",m),I(M,"transform",m),Yt=p,Xt=u,Ie=r}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!M){var e=this.options.fallbackOnBody?document.body:J,n=ae(f,!0,Dt,!0,e),o=this.options;if(Dt){for(pe=e;I(pe,"position")==="static"&&I(pe,"transform")==="none"&&pe!==document;)pe=pe.parentNode;pe!==document.body&&pe!==document.documentElement?(pe===document&&(pe=Re()),n.top+=pe.scrollTop,n.left+=pe.scrollLeft):pe=Re(),Ut=gn(pe)}M=f.cloneNode(!0),_e(M,o.ghostClass,!1),_e(M,o.fallbackClass,!0),_e(M,o.dragClass,!0),I(M,"transition",""),I(M,"transform",""),I(M,"box-sizing","border-box"),I(M,"margin",0),I(M,"top",n.top),I(M,"left",n.left),I(M,"width",n.width),I(M,"height",n.height),I(M,"opacity","0.8"),I(M,"position",Dt?"absolute":"fixed"),I(M,"zIndex","100000"),I(M,"pointerEvents","none"),O.ghost=M,e.appendChild(M),I(M,"transform-origin",vn/parseInt(M.style.width)*100+"% "+bn/parseInt(M.style.height)*100+"%")}},_onDragStart:function(e,n){var o=this,a=e.dataTransfer,r=o.options;if(ye("dragStart",this,{evt:e}),O.eventCanceled){this._onDrop();return}ye("setupClone",this),O.eventCanceled||(ee=$n(f),ee.draggable=!1,ee.style["will-change"]="",this._hideClone(),_e(ee,this.options.chosenClass,!1),O.clone=ee),o.cloneId=It(function(){ye("clone",o),!O.eventCanceled&&(o.options.removeCloneOnHide||J.insertBefore(ee,f),o._hideClone(),he({sortable:o,name:"clone"}))}),!n&&_e(f,r.dragClass,!0),n?($t=!0,o._loopId=setInterval(o._emulateDragOver,50)):(L(document,"mouseup",o._onDrop),L(document,"touchend",o._onDrop),L(document,"touchcancel",o._onDrop),a&&(a.effectAllowed="move",r.setData&&r.setData.call(o,a,f)),G(document,"drop",o),I(f,"transform","translateZ(0)")),nt=!0,o._dragStartId=It(o._dragStarted.bind(o,n,e)),G(document,"selectstart",o),ct=!0,mt&&I(document.body,"user-select","none")},_onDragOver:function(e){var n=this.el,o=e.target,a,r,i,l=this.options,c=l.group,s=O.active,p=wt===c,u=l.sort,m=ue||s,D,h=this,T=!1;if(Zt)return;function j(se,Ve){ye(se,h,Fe({evt:e,isOwner:p,axis:D?"vertical":"horizontal",revert:i,dragRect:a,targetRect:r,canSort:u,fromSortable:m,target:o,completed:X,onMove:function($e,Ze){return St(J,n,f,a,$e,ae($e),e,Ze)},changed:Q},Ve))}function z(){j("dragOverAnimationCapture"),h.captureAnimationState(),h!==m&&m.captureAnimationState()}function X(se){return j("dragOverCompleted",{insertion:se}),se&&(p?s._hideClone():s._showClone(h),h!==m&&(_e(f,ue?ue.options.ghostClass:s.options.ghostClass,!1),_e(f,l.ghostClass,!0)),ue!==h&&h!==O.active?ue=h:h===O.active&&ue&&(ue=null),m===h&&(h._ignoreWhileAnimating=o),h.animateAll(function(){j("dragOverAnimationComplete"),h._ignoreWhileAnimating=null}),h!==m&&(m.animateAll(),m._ignoreWhileAnimating=null)),(o===f&&!f.animated||o===n&&!o.animated)&&(tt=null),!l.dragoverBubble&&!e.rootEl&&o!==document&&(f.parentNode[De]._isOutsideThisEl(e.target),!se&&qe(e)),!l.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),T=!0}function Q(){we=ke(f),Xe=ke(f,l.draggable),he({sortable:h,name:"change",toEl:n,newIndex:we,newDraggableIndex:Xe,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),o=Pe(o,l.draggable,n,!0),j("dragOver"),O.eventCanceled)return T;if(f.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||h._ignoreWhileAnimating===o)return X(!1);if($t=!1,s&&!l.disabled&&(p?u||(i=Z!==J):ue===this||(this.lastPutMode=wt.checkPull(this,s,f,e))&&c.checkPut(this,s,f,e))){if(D=this._getDirection(e,o)==="vertical",a=ae(f),j("dragOverValid"),O.eventCanceled)return T;if(i)return Z=J,z(),this._hideClone(),j("revert"),O.eventCanceled||(Je?J.insertBefore(f,Je):J.appendChild(f)),X(!0);var W=rn(n,l.draggable);if(!W||So(e,D,this)&&!W.animated){if(W===f)return X(!1);if(W&&n===e.target&&(o=W),o&&(r=ae(o)),St(J,n,f,a,o,r,e,!!o)!==!1)return z(),n.appendChild(f),Z=n,Q(),X(!0)}else if(W&&Do(e,D,this)){var _=rt(n,0,l,!0);if(_===f)return X(!1);if(o=_,r=ae(o),St(J,n,f,a,o,r,e,!1)!==!1)return z(),n.insertBefore(f,_),Z=n,Q(),X(!0)}else if(o.parentNode===n){r=ae(o);var w=0,U,K=f.parentNode!==n,E=!bo(f.animated&&f.toRect||a,o.animated&&o.toRect||r,D),de=D?"top":"left",fe=hn(o,"top","top")||hn(f,"top","top"),ge=fe?fe.scrollTop:void 0;tt!==o&&(U=r[de],bt=!1,Et=!E&&l.invertSwap||K),w=Co(e,o,r,D,E?1:l.swapThreshold,l.invertedSwapThreshold==null?l.swapThreshold:l.invertedSwapThreshold,Et,tt===o);var ve;if(w!==0){var Se=ke(f);do Se-=w,ve=Z.children[Se];while(ve&&(I(ve,"display")==="none"||ve===M))}if(w===0||ve===o)return X(!1);tt=o,vt=w;var xe=o.nextElementSibling,Y=!1;Y=w===1;var Ce=St(J,n,f,a,o,r,e,Y);if(Ce!==!1)return(Ce===1||Ce===-1)&&(Y=Ce===1),Zt=!0,setTimeout(Eo,30),z(),Y&&!xe?n.appendChild(f):o.parentNode.insertBefore(f,Y?xe:o),fe&&xn(fe,0,ge-fe.scrollTop),Z=f.parentNode,U!==void 0&&!Et&&(Tt=Math.abs(U-ae(o)[de])),Q(),X(!0)}if(n.contains(f))return X(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){L(document,"mousemove",this._onTouchMove),L(document,"touchmove",this._onTouchMove),L(document,"pointermove",this._onTouchMove),L(document,"dragover",qe),L(document,"mousemove",qe),L(document,"touchmove",qe)},_offUpEvents:function(){var e=this.el.ownerDocument;L(e,"mouseup",this._onDrop),L(e,"touchend",this._onDrop),L(e,"pointerup",this._onDrop),L(e,"touchcancel",this._onDrop),L(document,"selectstart",this)},_onDrop:function(e){var n=this.el,o=this.options;if(we=ke(f),Xe=ke(f,o.draggable),ye("drop",this,{evt:e}),Z=f&&f.parentNode,we=ke(f),Xe=ke(f,o.draggable),O.eventCanceled){this._nulling();return}nt=!1,Et=!1,bt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),en(this.cloneId),en(this._dragStartId),this.nativeDraggable&&(L(document,"drop",this),L(n,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),mt&&I(document.body,"user-select",""),I(f,"transform",""),e&&(ct&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),M&&M.parentNode&&M.parentNode.removeChild(M),(J===Z||ue&&ue.lastPutMode!=="clone")&&ee&&ee.parentNode&&ee.parentNode.removeChild(ee),f&&(this.nativeDraggable&&L(f,"dragend",this),Ht(f),f.style["will-change"]="",ct&&!nt&&_e(f,ue?ue.options.ghostClass:this.options.ghostClass,!1),_e(f,this.options.chosenClass,!1),he({sortable:this,name:"unchoose",toEl:Z,newIndex:null,newDraggableIndex:null,originalEvent:e}),J!==Z?(we>=0&&(he({rootEl:Z,name:"add",toEl:Z,fromEl:J,originalEvent:e}),he({sortable:this,name:"remove",toEl:Z,originalEvent:e}),he({rootEl:Z,name:"sort",toEl:Z,fromEl:J,originalEvent:e}),he({sortable:this,name:"sort",toEl:Z,originalEvent:e})),ue&&ue.save()):we!==ot&&we>=0&&(he({sortable:this,name:"update",toEl:Z,originalEvent:e}),he({sortable:this,name:"sort",toEl:Z,originalEvent:e})),O.active&&((we==null||we===-1)&&(we=ot,Xe=gt),he({sortable:this,name:"end",toEl:Z,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){ye("nulling",this),J=f=Z=M=Je=ee=kt=Ue=ze=Ie=ct=we=Xe=ot=gt=tt=vt=ue=wt=O.dragged=O.ghost=O.clone=O.active=null,Pt.forEach(function(e){e.checked=!0}),Pt.length=Yt=Xt=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":f&&(this._onDragOver(e),wo(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],n,o=this.el.children,a=0,r=o.length,i=this.options;a<r;a++)n=o[a],Pe(n,i.draggable,this.el,!1)&&e.push(n.getAttribute(i.dataIdAttr)||To(n));return e},sort:function(e,n){var o={},a=this.el;this.toArray().forEach(function(r,i){var l=a.children[i];Pe(l,this.options.draggable,a,!1)&&(o[r]=l)},this),n&&this.captureAnimationState(),e.forEach(function(r){o[r]&&(a.removeChild(o[r]),a.appendChild(o[r]))}),n&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,n){return Pe(e,n||this.options.draggable,this.el,!1)},option:function(e,n){var o=this.options;if(n===void 0)return o[e];var a=_t.modifyOption(this,e,n);typeof a<"u"?o[e]=a:o[e]=n,e==="group"&&Mn(o)},destroy:function(){ye("destroy",this);var e=this.el;e[De]=null,L(e,"mousedown",this._onTapStart),L(e,"touchstart",this._onTapStart),L(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(L(e,"dragover",this),L(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(n){n.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Nt.splice(Nt.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Ue){if(ye("hideClone",this),O.eventCanceled)return;I(ee,"display","none"),this.options.removeCloneOnHide&&ee.parentNode&&ee.parentNode.removeChild(ee),Ue=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(Ue){if(ye("showClone",this),O.eventCanceled)return;f.parentNode==J&&!this.options.group.revertClone?J.insertBefore(ee,f):Je?J.insertBefore(ee,Je):J.appendChild(ee),this.options.group.revertClone&&this.animate(f,ee),I(ee,"display",""),Ue=!1}}};function wo(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function St(t,e,n,o,a,r,i,l){var c,s=t[De],p=s.options.onMove,u;return window.CustomEvent&&!je&&!yt?c=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(c=document.createEvent("Event"),c.initEvent("move",!0,!0)),c.to=e,c.from=t,c.dragged=n,c.draggedRect=o,c.related=a||e,c.relatedRect=r||ae(e),c.willInsertAfter=l,c.originalEvent=i,t.dispatchEvent(c),p&&(u=p.call(s,c,i)),u}function Ht(t){t.draggable=!1}function Eo(){Zt=!1}function Do(t,e,n){var o=ae(rt(n.el,0,n.options,!0)),a=10;return e?t.clientX<o.left-a||t.clientY<o.top&&t.clientX<o.right:t.clientY<o.top-a||t.clientY<o.bottom&&t.clientX<o.left}function So(t,e,n){var o=ae(rn(n.el,n.options.draggable)),a=10;return e?t.clientX>o.right+a||t.clientX<=o.right&&t.clientY>o.bottom&&t.clientX>=o.left:t.clientX>o.right&&t.clientY>o.top||t.clientX<=o.right&&t.clientY>o.bottom+a}function Co(t,e,n,o,a,r,i,l){var c=o?t.clientY:t.clientX,s=o?n.height:n.width,p=o?n.top:n.left,u=o?n.bottom:n.right,m=!1;if(!i){if(l&&Tt<s*a){if(!bt&&(vt===1?c>p+s*r/2:c<u-s*r/2)&&(bt=!0),bt)m=!0;else if(vt===1?c<p+Tt:c>u-Tt)return-vt}else if(c>p+s*(1-a)/2&&c<u-s*(1-a)/2)return ko(e)}return m=m||i,m&&(c<p+s*r/2||c>u-s*r/2)?c>p+s/2?1:-1:0}function ko(t){return ke(f)<ke(t)?1:-1}function To(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function Io(t){Pt.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var o=e[n];o.checked&&Pt.push(o)}}function It(t){return setTimeout(t,0)}function en(t){return clearTimeout(t)}Ft&&G(document,"touchmove",function(t){(O.active||nt)&&t.cancelable&&t.preventDefault()});O.utils={on:G,off:L,css:I,find:On,is:function(e,n){return!!Pe(e,n,e,!1)},extend:uo,throttle:An,closest:Pe,toggleClass:_e,clone:$n,index:ke,nextTick:It,cancelNextTick:en,detectDirection:Pn,getChild:rt};O.get=function(t){return t[De]};O.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach(function(o){if(!o.prototype||!o.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));o.utils&&(O.utils=Fe(Fe({},O.utils),o.utils)),_t.mount(o)})};O.create=function(t,e){return new O(t,e)};O.version=ro;var ne=[],dt,tn,nn=!1,Wt,Kt,Mt,ft;function Oo(){function t(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return t.prototype={dragStarted:function(n){var o=n.originalEvent;this.sortable.nativeDraggable?G(document,"dragover",this._handleAutoScroll):this.options.supportPointer?G(document,"pointermove",this._handleFallbackAutoScroll):o.touches?G(document,"touchmove",this._handleFallbackAutoScroll):G(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(n){var o=n.originalEvent;!this.options.dragOverBubble&&!o.rootEl&&this._handleAutoScroll(o)},drop:function(){this.sortable.nativeDraggable?L(document,"dragover",this._handleAutoScroll):(L(document,"pointermove",this._handleFallbackAutoScroll),L(document,"touchmove",this._handleFallbackAutoScroll),L(document,"mousemove",this._handleFallbackAutoScroll)),_n(),Ot(),co()},nulling:function(){Mt=tn=dt=nn=ft=Wt=Kt=null,ne.length=0},_handleFallbackAutoScroll:function(n){this._handleAutoScroll(n,!0)},_handleAutoScroll:function(n,o){var a=this,r=(n.touches?n.touches[0]:n).clientX,i=(n.touches?n.touches[0]:n).clientY,l=document.elementFromPoint(r,i);if(Mt=n,o||this.options.forceAutoScrollFallback||yt||je||mt){zt(n,this.options,l,o);var c=We(l,!0);nn&&(!ft||r!==Wt||i!==Kt)&&(ft&&_n(),ft=setInterval(function(){var s=We(document.elementFromPoint(r,i),!0);s!==c&&(c=s,Ot()),zt(n,a.options,s,o)},10),Wt=r,Kt=i)}else{if(!this.options.bubbleScroll||We(l,!0)===Re()){Ot();return}zt(n,this.options,We(l,!1),!1)}}},Ge(t,{pluginName:"scroll",initializeByDefault:!0})}function Ot(){ne.forEach(function(t){clearInterval(t.pid)}),ne=[]}function _n(){clearInterval(ft)}var zt=An(function(t,e,n,o){if(e.scroll){var a=(t.touches?t.touches[0]:t).clientX,r=(t.touches?t.touches[0]:t).clientY,i=e.scrollSensitivity,l=e.scrollSpeed,c=Re(),s=!1,p;tn!==n&&(tn=n,Ot(),dt=e.scroll,p=e.scrollFn,dt===!0&&(dt=We(n,!0)));var u=0,m=dt;do{var D=m,h=ae(D),T=h.top,j=h.bottom,z=h.left,X=h.right,Q=h.width,W=h.height,_=void 0,w=void 0,U=D.scrollWidth,K=D.scrollHeight,E=I(D),de=D.scrollLeft,fe=D.scrollTop;D===c?(_=Q<U&&(E.overflowX==="auto"||E.overflowX==="scroll"||E.overflowX==="visible"),w=W<K&&(E.overflowY==="auto"||E.overflowY==="scroll"||E.overflowY==="visible")):(_=Q<U&&(E.overflowX==="auto"||E.overflowX==="scroll"),w=W<K&&(E.overflowY==="auto"||E.overflowY==="scroll"));var ge=_&&(Math.abs(X-a)<=i&&de+Q<U)-(Math.abs(z-a)<=i&&!!de),ve=w&&(Math.abs(j-r)<=i&&fe+W<K)-(Math.abs(T-r)<=i&&!!fe);if(!ne[u])for(var Se=0;Se<=u;Se++)ne[Se]||(ne[Se]={});(ne[u].vx!=ge||ne[u].vy!=ve||ne[u].el!==D)&&(ne[u].el=D,ne[u].vx=ge,ne[u].vy=ve,clearInterval(ne[u].pid),(ge!=0||ve!=0)&&(s=!0,ne[u].pid=setInterval((function(){o&&this.layer===0&&O.active._onTouchMove(Mt);var xe=ne[this.layer].vy?ne[this.layer].vy*l:0,Y=ne[this.layer].vx?ne[this.layer].vx*l:0;typeof p=="function"&&p.call(O.dragged.parentNode[De],Y,xe,t,Mt,ne[this.layer].el)!=="continue"||xn(ne[this.layer].el,Y,xe)}).bind({layer:u}),24))),u++}while(e.bubbleScroll&&m!==c&&(m=We(m,!1)));nn=s}},30),Vn=function(e){var n=e.originalEvent,o=e.putSortable,a=e.dragEl,r=e.activeSortable,i=e.dispatchSortableEvent,l=e.hideGhostForTarget,c=e.unhideGhostForTarget;if(n){var s=o||r;l();var p=n.changedTouches&&n.changedTouches.length?n.changedTouches[0]:n,u=document.elementFromPoint(p.clientX,p.clientY);c(),s&&!s.el.contains(u)&&(i("spill"),this.onSpill({dragEl:a,putSortable:o}))}};function ln(){}ln.prototype={startIndex:null,dragStart:function(e){var n=e.oldDraggableIndex;this.startIndex=n},onSpill:function(e){var n=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var a=rt(this.sortable.el,this.startIndex,this.options);a?this.sortable.el.insertBefore(n,a):this.sortable.el.appendChild(n),this.sortable.animateAll(),o&&o.animateAll()},drop:Vn};Ge(ln,{pluginName:"revertOnSpill"});function sn(){}sn.prototype={onSpill:function(e){var n=e.dragEl,o=e.putSortable,a=o||this.sortable;a.captureAnimationState(),n.parentNode&&n.parentNode.removeChild(n),a.animateAll()},drop:Vn};Ge(sn,{pluginName:"removeOnSpill"});O.mount(new Oo);O.mount(sn,ln);function Ao(){return typeof window<"u"?window.console:global.console}const xo=Ao();function $o(t){const e=Object.create(null);return function(o){return e[o]||(e[o]=t(o))}}const No=/-(\w)/g,wn=$o(t=>t.replace(No,(e,n)=>n?n.toUpperCase():""));function qt(t){t.parentElement!==null&&t.parentElement.removeChild(t)}function En(t,e,n){const o=n===0?t.children[0]:t.children[n-1].nextSibling;t.insertBefore(e,o)}function Po(t,e){return Object.values(t).indexOf(e)}function Mo(t,e,n,o){if(!t)return[];const a=Object.values(t),r=e.length-o;return[...e].map((l,c)=>c>=r?a.length:a.indexOf(l))}function Ln(t,e){this.$nextTick(()=>this.$emit(t.toLowerCase(),e))}function Ro(t){return e=>{this.realList!==null&&this["onDrag"+t](e),Ln.call(this,t,e)}}function Fo(t){return["transition-group","TransitionGroup"].includes(t)}function Vo(t){if(!t||t.length!==1)return!1;const[{type:e}]=t;return e?Fo(e.name):!1}function Lo(t,e){return e?{...e.props,...e.attrs}:t}const on=["Start","Add","Remove","Update","End"],an=["Choose","Unchoose","Sort","Filter","Clone"],Bo=["Move",...on,...an].map(t=>"on"+t);let Jt=null;const Go={options:Object,list:{type:Array,required:!1,default:null},noTransitionOnDrag:{type:Boolean,default:!1},clone:{type:Function,default:t=>t},tag:{type:String,default:"div"},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null},component:{type:String,default:null},modelValue:{type:Array,required:!1,default:null}},Bn=Un({name:"VueDraggableNext",inheritAttrs:!1,emits:["update:modelValue","move","change",...on.map(t=>t.toLowerCase()),...an.map(t=>t.toLowerCase())],props:Go,data(){return{transitionMode:!1,noneFunctionalComponentMode:!1,headerOffset:0,footerOffset:0,_sortable:{},visibleIndexes:[],context:{}}},render(){const t=this.$slots.default?this.$slots.default():null,e=Lo(this.$attrs,this.componentData);return t?(this.transitionMode=Vo(t),un(this.getTag(),e,t)):un(this.getTag(),e,[])},created(){this.list!==null&&this.modelValue!==null&&xo.error("list props are mutually exclusive! Please set one.")},mounted(){const t={};on.forEach(a=>{t["on"+a]=Ro.call(this,a)}),an.forEach(a=>{t["on"+a]=Ln.bind(this,a)});const e=Object.keys(this.$attrs).reduce((a,r)=>(a[wn(r)]=this.$attrs[r],a),{}),n=Object.assign({},e,t,{onMove:(a,r)=>this.onDragMove(a,r)});!("draggable"in n)&&(n.draggable=">*");const o=this.$el.nodeType===1?this.$el:this.$el.parentElement;this._sortable=new O(o,n),o.__draggable_component__=this,this.computeIndexes()},beforeUnmount(){try{this._sortable!==void 0&&this._sortable.destroy()}catch{}},computed:{realList(){return this.list?this.list:this.modelValue}},watch:{$attrs:{handler(t){this.updateOptions(t)},deep:!0},realList(){this.computeIndexes()}},methods:{getTag(){return this.component?te(this.component):this.tag},updateOptions(t){for(var e in t){const n=wn(e);Bo.indexOf(n)===-1&&this._sortable.option(n,t[e])}},getChildrenNodes(){return this.$el.children},computeIndexes(){this.$nextTick(()=>{this.visibleIndexes=Mo(this.getChildrenNodes(),this.$el.children,this.transitionMode,this.footerOffset)})},getUnderlyingVm(t){const e=Po(this.getChildrenNodes()||[],t);if(e===-1)return null;const n=this.realList[e];return{index:e,element:n}},emitChanges(t){this.$nextTick(()=>{this.$emit("change",t)})},alterList(t){if(this.list){t(this.list);return}const e=[...this.modelValue];t(e),this.$emit("update:modelValue",e)},spliceList(){const t=e=>e.splice(...arguments);this.alterList(t)},updatePosition(t,e){const n=o=>o.splice(e,0,o.splice(t,1)[0]);this.alterList(n)},getVmIndex(t){const e=this.visibleIndexes,n=e.length;return t>n-1?n:e[t]},getComponent(){return this.$slots.default?this.$slots.default()[0].componentInstance:null},resetTransitionData(t){if(!this.noTransitionOnDrag||!this.transitionMode)return;var e=this.getChildrenNodes();e[t].data=null;const n=this.getComponent();n.children=[],n.kept=void 0},onDragStart(t){this.computeIndexes(),this.context=this.getUnderlyingVm(t.item),this.context&&(t.item._underlying_vm_=this.clone(this.context.element),Jt=t.item)},onDragAdd(t){const e=t.item._underlying_vm_;if(e===void 0)return;qt(t.item);const n=this.getVmIndex(t.newIndex);this.spliceList(n,0,e),this.computeIndexes();const o={element:e,newIndex:n};this.emitChanges({added:o})},onDragRemove(t){if(En(this.$el,t.item,t.oldIndex),t.pullMode==="clone"){qt(t.clone);return}if(!this.context)return;const e=this.context.index;this.spliceList(e,1);const n={element:this.context.element,oldIndex:e};this.resetTransitionData(e),this.emitChanges({removed:n})},onDragUpdate(t){qt(t.item),En(t.from,t.item,t.oldIndex);const e=this.context.index,n=this.getVmIndex(t.newIndex);this.updatePosition(e,n);const o={element:this.context.element,oldIndex:e,newIndex:n};this.emitChanges({moved:o})},updateProperty(t,e){t.hasOwnProperty(e)&&(t[e]+=this.headerOffset)},onDragMove(t,e){const n=this.move;if(!n||!this.realList)return!0;const o=this.getRelatedContextFromMoveEvent(t),a=this.context,r=this.computeFutureIndex(o,t);Object.assign(a,{futureIndex:r});const i=Object.assign({},t,{relatedContext:o,draggedContext:a});return n(i,e)},onDragEnd(){this.computeIndexes(),Jt=null},getTrargetedComponent(t){return t.__draggable_component__},getRelatedContextFromMoveEvent({to:t,related:e}){const n=this.getTrargetedComponent(t);if(!n)return{component:n};const o=n.realList,a={list:o,component:n};if(t!==e&&o&&n.getUnderlyingVm){const r=n.getUnderlyingVm(e);if(r)return Object.assign(r,a)}return a},computeFutureIndex(t,e){const n=[...e.to.children].filter(i=>i.style.display!=="none");if(n.length===0)return 0;const o=n.indexOf(e.related),a=t.component.getVmIndex(o);return n.indexOf(Jt)!==-1||!e.willInsertAfter?a:a+1}}}),jo={key:0,class:"fluent-cart-admin-validation-error-wrapper"},pt=Object.assign({name:"ValidationError"},{__name:"ValidationError",props:{validationErrors:Object,fieldKey:String},setup(t){const e=t,n=()=>{if(typeof e.validationErrors[e.fieldKey]!="object")return"";const[[a,r]]=Object.entries(e.validationErrors[e.fieldKey]);return{[a]:r}};return(o,a)=>t.validationErrors&&t.validationErrors.hasOwnProperty(t.fieldKey)?(y(),S("div",jo,[(y(!0),S(re,null,Le(n(),(r,i)=>(y(),S("span",{class:"fluent-cart-admin-validation-error",key:r.toLowerCase().replace(/\s/g,"")},V(r),1))),128))])):oe("",!0)}});class Yo{constructor(){Bt(this,"confirmBox",cn.confirm);Bt(this,"promptBox",cn.prompt)}confirm(e,n,o){return this.confirmBox(e,n,o)}ofDelete(e=null,n=null,o){return e===null&&(e=d("Are you sure you want to delete this?. This action is not recoverable")),n===null&&(n=d("Confirm Delete!")),o={confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),confirmButtonClass:"el-button--primary",type:"warning",...o??{}},this.confirm(e,n,o)}confirmWithInput(e,n,o){return this.promptBox(e,n,o)}confirmDeleteWithInput(e,n=null,o=null,a){n===null&&(n=d("Are you sure you want to delete this?. This action is not recoverable"));const r=d('You must type "%1$s" exactly to proceed',`<span >${e}</span>`);return n=`<label for=""><p>${n}</p>
11 + <p>${r}</p></label>`,o===null&&(o=d("Confirm Delete!")),a={confirmButtonText:d("Yes, Delete!"),cancelButtonText:d("Cancel"),confirmButtonClass:"el-button--primary",inputPattern:new RegExp(`^${e}$`),inputErrorMessage:d("You must type %s exactly to proceed",e),dangerouslyUseHTMLString:!0,type:"warning",...a??{}},this.confirmWithInput(n,o,a)}}const Gn=new Yo,Xo={class:"fct-term-draft-form-title-line"},Uo=["aria-label"],Ho=["aria-label"],Wo=["title","aria-label","aria-pressed","tabindex","onClick"],Ko={class:"fct-color-custom-row fct-term-draft-custom-row"},zo={class:"fct-term-color-picker-wrap--lg fct-term-draft-custom-swatch-wrap"},qo=["disabled","aria-label"],Jo={class:"fct-term-draft-image-row"},Qo=["aria-label"],Zo=["src"],Qt={__name:"TermForm",props:{term:{type:Object,required:!0},groupType:{type:String,default:"options"},showRemoveButton:{type:Boolean,default:!0},validationErrors:{type:Object,default:()=>({})},fieldKey:{type:String,default:""}},emits:["remove","submit"],setup(t,{expose:e,emit:n}){const o=t,a=n,r=R(null),i=R([]),l=R(0),c=Zn,s=_=>_.replace(/\b\w/g,w=>w.toUpperCase()),p=_=>{const w=dn(_);return w?s(w):_},u=_=>{if(!_){l.value=0;return}const w=c.indexOf(_);l.value=w>=0?w:0},m=_=>o.fieldKey?`${o.fieldKey}.${_}`:_,D=_=>!!o.validationErrors[m(_)],h=_=>{const w=m(_);o.validationErrors&&o.validationErrors[w]&&delete o.validationErrors[w]},T=()=>{if(h("title"),o.groupType!=="color"||o.term.settings.color)return;const _=to(o.term.title);_&&(o.term.settings.color=_,u(_),h("settings.color"))},j=_=>{o.term.settings.color=_,h("settings.color");const w=c.indexOf(_);w>=0&&(l.value=w);const U=(o.term.title||"").trim().toLowerCase(),K=U&&Rt[U]!==void 0;if(!U||K){const E=dn(_);E&&(o.term.title=s(E),h("title"))}},z=_=>{const w=_.target;if(!w||!w.classList||!w.classList.contains("fct-color-swatch"))return;const U=i.value.indexOf(w);if(U===-1)return;const K=c.length-1;let E=-1;switch(_.key){case"ArrowRight":case"ArrowDown":E=U===K?0:U+1;break;case"ArrowLeft":case"ArrowUp":E=U===0?K:U-1;break;case"Home":E=0;break;case"End":E=K;break;default:return}_.preventDefault(),l.value=E;const de=i.value[E];de&&typeof de.focus=="function"&&de.focus(),j(c[E])},X=()=>{o.term.title="",o.term.settings.color="",o.term.settings.image="",u(""),W()},Q=()=>{if(!(window.wp&&window.wp.media))return;const _=window.wp.media({title:d("Select Image"),multiple:!1,library:{type:"image"}});_.on("select",()=>{const w=_.state().get("selection").first().toJSON();o.term.settings.image=w.url,h("settings.image")}),_.open()},W=()=>{At(()=>{r.value&&typeof r.value.focus=="function"&&r.value.focus()})};return Dn(()=>o.term,_=>{var w;u(((w=_==null?void 0:_.settings)==null?void 0:w.color)||""),W()},{immediate:!0}),e({focus:W}),(_,w)=>{const U=te("el-input"),K=te("el-color-picker");return y(),S("div",{class:Oe(["fct-term-draft-form",`fct-term-draft-form--${t.groupType}`])},[v("div",Xo,[g(U,{ref_key:"titleInputRef",ref:r,modelValue:t.term.title,"onUpdate:modelValue":w[0]||(w[0]=E=>t.term.title=E),placeholder:t.groupType==="color"?k(d)("e.g. Navy Blue"):k(d)("Term title"),size:"default",class:Oe({"is-error":D("title")}),onInput:T,onKeyup:[w[1]||(w[1]=He(E=>a("submit"),["enter"])),w[2]||(w[2]=He(E=>a("remove"),["escape"]))]},null,8,["modelValue","placeholder","class"]),t.showRemoveButton?(y(),S("button",{key:0,type:"button",class:"fct-term-draft-form-close","aria-label":k(d)("Remove"),onClick:w[3]||(w[3]=E=>a("remove"))},[g(le,{name:"Cross"})],8,Uo)):oe("",!0)]),g(pt,{"validation-errors":t.validationErrors,"field-key":m("title")},null,8,["validation-errors","field-key"]),t.groupType==="color"?(y(),S(re,{key:0},[v("div",{class:"fct-color-swatch-grid fct-term-draft-swatches",role:"group","aria-label":k(d)("Color presets"),onKeydown:z},[(y(!0),S(re,null,Le(k(c),(E,de)=>(y(),S("button",{key:E,ref_for:!0,ref:fe=>i.value[de]=fe,type:"button",class:Oe(["fct-color-swatch",{"is-active":t.term.settings.color===E}]),style:Qe({background:E,"--swatch-color":E}),title:p(E),"aria-label":p(E),"aria-pressed":t.term.settings.color===E,tabindex:de===l.value?0:-1,onClick:fe=>j(E)},null,14,Wo))),128))],40,Ho),v("div",Ko,[v("div",zo,[g(K,{modelValue:t.term.settings.color,"onUpdate:modelValue":w[4]||(w[4]=E=>t.term.settings.color=E),"aria-label":k(d)("Pick a custom color"),onChange:w[5]||(w[5]=E=>h("settings.color"))},null,8,["modelValue","aria-label"])]),g(U,{modelValue:t.term.settings.color,"onUpdate:modelValue":w[6]||(w[6]=E=>t.term.settings.color=E),placeholder:"#000000",size:"default",class:Oe({"is-error":D("settings.color")}),onInput:w[7]||(w[7]=E=>h("settings.color"))},null,8,["modelValue","class"]),v("button",{type:"button",class:"fct-term-draft-clear-btn",disabled:!t.term.title&&!t.term.settings.color,"aria-label":k(d)("Clear title and color"),onClick:X},V(k(d)("Clear")),9,qo)]),g(pt,{"validation-errors":t.validationErrors,"field-key":m("settings.color")},null,8,["validation-errors","field-key"])],64)):t.groupType==="image"?(y(),S(re,{key:1},[v("div",Jo,[v("button",{type:"button",class:"fct-term-draft-img-btn fct-term-draft-img-btn--lg","aria-label":k(d)("Upload image"),onClick:Q},[t.term.settings.image?(y(),S("img",{key:0,src:t.term.settings.image,alt:""},null,8,Zo)):(y(),Ae(le,{key:1,name:"Plus"}))],8,Qo),g(U,{modelValue:t.term.settings.image,"onUpdate:modelValue":w[8]||(w[8]=E=>t.term.settings.image=E),placeholder:k(d)("https://..."),size:"default",class:Oe({"is-error":D("settings.image")}),onInput:w[9]||(w[9]=E=>h("settings.image"))},null,8,["modelValue","placeholder","class"])]),g(pt,{"validation-errors":t.validationErrors,"field-key":m("settings.image")},null,8,["validation-errors","field-key"])],64)):oe("",!0),g(pt,{"validation-errors":t.validationErrors,"field-key":"terms"},null,8,["validation-errors"]),Sn(_.$slots,"actions")],2)}}},ea={class:"fct-attr-group-modal"},ta={class:"dialog-footer"},na=Object.assign({name:"AddGroupModal"},{__name:"AddGroupModal",emits:["whenGroupCreateIsDone"],setup(t,{expose:e,emit:n}){const o=n,a=R(!1),r=R({}),i=R(null),l=Cn({title:"",settings:{type:"options",styling:"button"}});e({focusTitle:()=>{var u,m;(m=(u=i.value)==null?void 0:u.focus)==null||m.call(u)}});const s=()=>{a.value=!0,r.value={},Me.post("options/attr/group/",{title:l.title,settings:l.settings}).then(u=>{kn(u.message),o("whenGroupCreateIsDone",u.data)}).catch(u=>{var m;(u==null?void 0:u.status_code)==422&&u.data?r.value=u.data:me.error(((m=u==null?void 0:u.data)==null?void 0:m.message)||(u==null?void 0:u.message))}).finally(()=>{a.value=!1})},p=u=>{u.key==="Enter"&&(a.value||!l.title||s())};return(u,m)=>{const D=te("el-input"),h=te("el-form-item"),T=te("el-col"),j=te("el-option"),z=te("el-select"),X=te("el-row"),Q=te("el-button"),W=te("el-form");return y(),S("div",ea,[g(W,{"label-position":"top",data:l},{default:B(()=>[g(X,{gutter:24},{default:B(()=>[g(T,{span:24},{default:B(()=>[g(h,{label:u.$t("Group Title"),required:""},{default:B(()=>[g(D,{ref_key:"titleInputRef",ref:i,type:"text",modelValue:l.title,"onUpdate:modelValue":m[0]||(m[0]=_=>l.title=_),placeholder:u.$t("Group Title"),class:Oe(r.value.title?"is-error":""),onKeyup:p},null,8,["modelValue","placeholder","class"]),g(pt,{"validation-errors":r.value,"field-key":"title"},null,8,["validation-errors"])]),_:1},8,["label"])]),_:1}),g(T,{span:12},{default:B(()=>[g(h,{label:u.$t("Attribute Type")},{default:B(()=>[g(z,{modelValue:l.settings.type,"onUpdate:modelValue":m[1]||(m[1]=_=>l.settings.type=_),style:{width:"100%"}},{default:B(()=>[g(j,{label:u.$t("Options"),value:"options"},null,8,["label"]),g(j,{label:u.$t("Color"),value:"color"},null,8,["label"]),g(j,{label:u.$t("Image"),value:"image"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1}),g(T,{span:12},{default:B(()=>[g(h,{label:u.$t("Styling")},{default:B(()=>[g(z,{modelValue:l.settings.styling,"onUpdate:modelValue":m[2]||(m[2]=_=>l.settings.styling=_),clearable:"",style:{width:"100%"}},{default:B(()=>[g(j,{label:u.$t("Dropdown"),value:"dropdown"},null,8,["label"]),g(j,{label:u.$t("Button"),value:"button"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),v("div",ta,[g(Q,{disabled:!l.title||a.value,loading:a.value,onClick:m[3]||(m[3]=_=>s()),type:"primary"},{default:B(()=>[Ee(V(u.$t("Add Group")),1)]),_:1},8,["disabled","loading"])])]),_:1},8,["data"])])}}}),oa={class:"fct-term-rows-list"},aa={key:0,class:"fct-term-rows-empty"},ra={key:0,class:"fct-term-edit-slot"},ia={key:1,class:"fct-term-row-item"},la=["aria-label","aria-disabled","title"],sa=["src","alt"],ua={class:"fct-term-row-name"},ca={class:"fct-term-row-actions"},da=["aria-label","onClick"],fa=["aria-label","onClick"],pa={__name:"AttrTermsTableBody",props:{rows:{type:Array,default:()=>[]},group:{type:Object,default:()=>({})},editingTermId:{type:[String,Number],default:null},disableReorder:{type:Boolean,default:!1}},emits:["edit","delete","reorder"],setup(t,{emit:e}){const n=t,o=ce(()=>{const l=n.group&&n.group.settings;return l&&l.type?l.type:"options"}),a=e,r=()=>{a("reorder",n.rows.map(l=>l.id))},i=l=>{const c=n.editingTermId;return c==null?!1:String(l.id)===String(c)};return(l,c)=>(y(),S("div",oa,[t.rows.length?(y(),Ae(k(Bn),{key:1,list:t.rows,handle:".fct-term-row-handle",animation:150,"ghost-class":"fct-term-row--ghost",disabled:t.disableReorder,tag:"div",class:"fct-term-rows-inner",onEnd:r},{default:B(()=>[(y(!0),S(re,null,Le(t.rows,s=>(y(),S(re,{key:s.id},[i(s)?(y(),S("div",ra,[Sn(l.$slots,"edit-form",{term:s})])):(y(),S("div",ia,[v("span",{class:Oe(["fct-term-row-handle",{"is-disabled":t.disableReorder}]),"aria-label":t.disableReorder?k(d)("Load all terms before reordering"):k(d)("Drag to reorder"),"aria-disabled":t.disableReorder?"true":null,title:t.disableReorder?k(d)("Load all terms before reordering"):null},[g(le,{name:"ReorderDotsVertical"})],10,la),o.value==="color"&&s.settings&&s.settings.color?(y(),S("span",{key:0,class:"fct-term-row-color-dot",style:Qe({background:s.settings.color})},null,4)):o.value==="image"&&s.settings&&s.settings.image?(y(),S("img",{key:1,src:s.settings.image,alt:s.title,class:"fct-term-row-img"},null,8,sa)):oe("",!0),v("span",ua,V(s.title||k(d)("No Name")),1),v("div",ca,[v("button",{type:"button",class:"fct-term-row-edit","aria-label":k(d)("Edit"),onClick:p=>a("edit",s)},[g(le,{name:"Edit"})],8,da),v("button",{type:"button",class:"fct-term-row-delete","aria-label":k(d)("Delete"),onClick:p=>a("delete",s)},[g(le,{name:"Delete"})],8,fa)])]))],64))),128))]),_:3},8,["list","disabled"])):(y(),S("div",aa,V(k(d)("No terms yet — click + Add Terms below to create one.")),1))]))}},ma={class:"fct-term-rows-list fct-term-rows-loader"},ha={__name:"AttrTermsTableLoader",setup(t){const e=["60%","40%","70%","35%","55%","45%"],n=o=>e[(o-1)%e.length];return(o,a)=>(y(),S("div",ma,[(y(),S(re,null,Le(6,r=>v("div",{key:r,class:"fct-term-row-item fct-term-row-item--skeleton"},[a[0]||(a[0]=v("span",{class:"fct-skel-block fct-skel-handle"},null,-1)),a[1]||(a[1]=v("span",{class:"fct-skel-block fct-skel-dot"},null,-1)),v("span",{class:"fct-skel-block fct-skel-title",style:Qe({width:n(r)})},null,4),a[2]||(a[2]=v("span",{class:"fct-skel-block fct-skel-action"},null,-1))])),64))]))}},ga={class:"fct-group-terms-panel"},va={class:"fct-attr-panel-header"},ba={class:"fct-attr-panel-header-top"},ya={class:"fct-attr-panel-breadcrumb"},_a={class:"fct-attr-panel-breadcrumb-current"},wa=["aria-label"],Ea={class:"fct-attr-panel-chips"},Da={class:"fct-attr-meta-chip"},Sa={class:"fct-attr-meta-chip"},Ca={class:"fct-attr-meta-chip-label"},ka={class:"fct-attr-meta-chip"},Ta={class:"fct-attr-meta-chip-label"},Ia={key:0,class:"fct-term-reorder-locked",role:"status","aria-live":"polite"},Oa={class:"fct-term-edit-actions"},Aa={key:1,class:"fct-term-drafts-completed"},xa=["aria-label","onClick","onKeydown"],$a={class:"fct-term-row-handle","aria-hidden":"true"},Na=["src","alt"],Pa={class:"fct-term-row-name"},Ma=["aria-label","onClick"],Ra={key:0,class:"fct-attr-panel-footer fct-attr-panel-footer--split"},Fa=["disabled","title"],Va=["disabled","title","aria-label"],La=15,ut=10,Ba={__name:"GroupTermsPanel",props:{group:{type:Object,required:!0}},emits:["edit-group"],setup(t,{expose:e,emit:n}){const o=t,a=n,r=ce(()=>String(o.group.id)),i=ce(()=>{const A=o.group&&o.group.settings;return A&&A.type?A.type:"options"}),l=ce(()=>({options:d("Options"),color:d("Color"),image:d("Image")})[i.value]||d("Options")),c=ce(()=>{var x;return{dropdown:d("Dropdown"),button:d("Button")}[((x=o.group.settings)==null?void 0:x.styling)||"button"]||d("Button")}),s=R(null),p=R(null),u=R(!1),m=R({}),D=R(1),h=R([]),T=R(0),j=R(!0),z=R(!1),X=ce(()=>h.value.length<T.value),Q=ce(()=>X.value?d("Load More (%1$s/%2$s)",h.value.length,T.value):d("All loaded (%1$s)",T.value));let W=0;const _=(A,x)=>{const $=++W;return x?z.value=!0:j.value=!0,Me.get("options/attr/group/"+r.value+"/terms",{per_page:La,page:A}).then(N=>{if($!==W)return!1;const H=N.terms&&N.terms.data?N.terms.data:[];return T.value=N.terms&&N.terms.total?Number(N.terms.total):0,h.value=x?h.value.concat(H):H,!0}).catch(N=>{var H;return $!==W||me.error(((H=N.data)==null?void 0:H.message)||d("Failed to load terms")),!1}).finally(()=>{$===W&&(j.value=!1,z.value=!1)})};_(1,!1);const w=()=>{!X.value||z.value||j.value||(D.value++,_(D.value,!0))},U=A=>{const x=A.target;if(!x)return;x.scrollHeight-x.scrollTop-x.clientHeight<120&&w()},K=()=>{D.value=1,_(1,!1)},E=R(null),de=async A=>{if(D.value=1,!await _(1,!1))return;let x=0;for(;A&&!h.value.some($=>$.id===A)&&X.value&&x<50;)if(x++,D.value++,!await _(D.value,!0))return;At(()=>{const $=E.value;$&&$.scrollTo({top:$.scrollHeight,behavior:"smooth"})})};e({refresh:K});const fe=A=>{p.value=JSON.parse(JSON.stringify(A)),s.value=JSON.parse(JSON.stringify(A)),s.value.settings||(s.value.settings={color:"",image:""}),m.value={}},ge=()=>{s.value=null,p.value=null,m.value={}},ve=()=>{var x,$;if(!s.value)return;const A=(s.value.title||"").trim();!A||u.value||(u.value=!0,m.value={},Me.post("options/attr/group/"+r.value+"/term/"+s.value.id,{title:A,settings:{color:((x=s.value.settings)==null?void 0:x.color)||"",image:(($=s.value.settings)==null?void 0:$.image)||""}}).then(N=>{me.success(N.message||d("Term updated")),s.value=null,p.value=null,K()}).catch(N=>{var H;(N==null?void 0:N.status_code)==422&&N.data?m.value=N.data:me.error(((H=N.data)==null?void 0:H.message)||(N==null?void 0:N.message)||d("Failed to update term"))}).finally(()=>{u.value=!1}))},Se=A=>{Gn.ofDelete(d("Are you sure you want to delete this term? This action is not recoverable."),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete")}).then(()=>{Me.delete("options/attr/group/"+r.value+"/term/"+A.id).then(x=>{me.success(x.message),K()}).catch(x=>{var $;me.error((($=x.data)==null?void 0:$.message)||d("Delete failed"))})}).catch(()=>{})},xe=A=>{Me.post("options/attr/group/"+r.value+"/terms/reorder",{ids:A}).then(x=>{me.success(x.message)}).catch(x=>{var $;me.error((($=x.data)==null?void 0:$.message)||d("Failed to save order")),K()})},Y=R([]),Ce=R(!1),se=R(null),Ve=R({}),Ye=R({}),$e=ce(()=>Y.value.length?Y.value[Y.value.length-1]:null),Ze=ce(()=>Y.value.slice(0,-1)),it=A=>{const x=Ye.value[A];return x===void 0?"":`terms.${x}`},lt=A=>{const x=it(A);if(!x)return!1;const $=`${x}.`;return Object.keys(Ve.value).some(N=>N.indexOf($)===0)},st=A=>{se.value=A},P=()=>{se.value=null},b=A=>!A||!A.title||!A.title.trim()?!1:i.value==="color"?!!(A.settings&&A.settings.color):i.value==="image"?!!(A.settings&&A.settings.image):!0,F=ce(()=>Y.value.filter(b)),be=ce(()=>b($e.value)),C=ce(()=>!(Y.value.length>=ut||$e.value&&!be.value)),q=ce(()=>Y.value.length>=ut?d("Limit reached (%1$s)",ut):d("Add more")),ie=ce(()=>Y.value.length>=ut?d("Save these %1$s and add more after.",ut):i.value==="color"?d("Fill the title and color before adding another."):i.value==="image"?d("Fill the title and image before adding another."):d("Fill the title before adding another.")),Ke=()=>{C.value&&Y.value.push({title:"",settings:{color:"",image:""}})},Te=A=>{Y.value.splice(A,1),se.value===A?se.value=null:se.value!==null&&se.value>A&&(se.value-=1);const x={};Object.entries(Ye.value).forEach(([$,N])=>{const H=Number($);H<A?x[H]=N:H>A&&(x[H-1]=N)}),Ye.value=x},Vt=()=>{i.value==="options"&&Ke()},jn=()=>{if(!F.value.length||Ce.value)return;Ce.value=!0,Ve.value={};const A={},x=[];Y.value.forEach(($,N)=>{$.title&&$.title.trim()!==""&&(A[N]=x.length,x.push({title:$.title.trim(),settings:{color:$.settings.color||"",image:$.settings.image||""}}))}),Ye.value=A,Me.post("options/attr/group/"+r.value+"/terms",{terms:x}).then($=>{me.success($.message||d("Terms added")),Y.value=[],se.value=null,Ye.value={};const N=($.data||[]).map(H=>H.id);de(N.length?N[N.length-1]:null)}).catch($=>{var N;($==null?void 0:$.status_code)==422&&$.data?Ve.value=$.data:me.error(((N=$.data)==null?void 0:N.message)||d("Failed to save terms"))}).finally(()=>{Ce.value=!1})};return(A,x)=>{const $=te("el-button");return y(),S("div",ga,[v("div",va,[v("div",ba,[v("div",ya,[v("span",_a,V(t.group.title),1),v("button",{type:"button",class:"fct-attr-icon-btn","aria-label":k(d)("Edit group"),onClick:x[0]||(x[0]=N=>a("edit-group"))},[g(le,{name:"Edit"})],8,wa)]),Y.value.length?(y(),Ae($,{key:0,size:"small",type:"primary",disabled:!F.value.length||Ce.value,loading:Ce.value,onClick:jn},{default:B(()=>[Ee(V(k(d)("Save"))+" ",1),F.value.length?(y(),S(re,{key:0},[Ee(" ("+V(F.value.length)+")",1)],64)):oe("",!0)]),_:1},8,["disabled","loading"])):oe("",!0)]),v("div",Ea,[v("span",Da,V(T.value)+" "+V(k(d)("Terms")),1),v("span",Sa,[v("span",Ca,V(k(d)("Type")),1),Ee(" "+V(l.value),1)]),v("span",ka,[v("span",Ta,V(k(d)("Styling")),1),Ee(" "+V(c.value),1)])])]),v("div",{ref_key:"panelBodyRef",ref:E,class:"fct-attr-panel-body",onScrollPassive:U},[j.value?(y(),Ae(ha,{key:0})):(y(),S(re,{key:1},[X.value?(y(),S("div",Ia,V(k(d)("Load every term before reordering.")),1)):oe("",!0),g(pa,{rows:h.value,group:t.group,"editing-term-id":s.value?s.value.id:null,"disable-reorder":X.value,onEdit:fe,onDelete:Se,onReorder:xe},{"edit-form":B(()=>[s.value?(y(),Ae(Qt,{key:0,class:"fct-term-edit-form",term:s.value,"group-type":i.value,"show-remove-button":!1,"validation-errors":m.value,onRemove:ge,onSubmit:ve},{actions:B(()=>[v("div",Oa,[g($,{size:"small",onClick:ge},{default:B(()=>[Ee(V(k(d)("Cancel")),1)]),_:1}),g($,{size:"small",type:"primary",disabled:!(s.value.title||"").trim()||u.value,loading:u.value,onClick:ve},{default:B(()=>[Ee(V(k(d)("Save")),1)]),_:1},8,["disabled","loading"])])]),_:1},8,["term","group-type","validation-errors"])):oe("",!0)]),_:1},8,["rows","group","editing-term-id","disable-reorder"]),Ze.value.length?(y(),S("div",Aa,[(y(!0),S(re,null,Le(Ze.value,(N,H)=>(y(),S("div",{key:"completed-"+H,class:"fct-term-row-item-wrap"},[se.value===H?(y(),Ae(Qt,{key:0,term:Y.value[H],"group-type":i.value,"validation-errors":Ve.value,"field-key":it(H),onRemove:P,onSubmit:P},null,8,["term","group-type","validation-errors","field-key"])):(y(),S("div",{key:1,class:Oe(["fct-term-row-item fct-term-row-item--draft",{"is-error":lt(H),"is-clickable":lt(H)}]),role:"button",tabindex:"0","aria-label":k(d)("Edit draft"),onClick:Lt=>st(H),onKeydown:[He(Ne(Lt=>st(H),["prevent"]),["enter"]),He(Ne(Lt=>st(H),["prevent"]),["space"])]},[v("span",$a,[g(le,{name:"ReorderDotsVertical"})]),i.value==="color"&&N.settings.color?(y(),S("span",{key:0,class:"fct-term-row-color-dot",style:Qe({background:N.settings.color})},null,4)):i.value==="image"&&N.settings.image?(y(),S("img",{key:1,src:N.settings.image,alt:N.title,class:"fct-term-row-img"},null,8,Na)):oe("",!0),v("span",Pa,V(N.title||k(d)("No Name")),1),v("button",{type:"button",class:"fct-term-row-delete","aria-label":k(d)("Remove draft"),onClick:Ne(Lt=>Te(H),["stop"])},[g(le,{name:"Delete"})],8,Ma)],42,xa))]))),128))])):oe("",!0),$e.value?(y(),Ae(Qt,{key:2,term:$e.value,"group-type":i.value,"validation-errors":Ve.value,"field-key":it(Y.value.length-1),onRemove:x[1]||(x[1]=N=>Te(Y.value.length-1)),onSubmit:Vt},null,8,["term","group-type","validation-errors","field-key"])):oe("",!0)],64))],544),j.value?oe("",!0):(y(),S("div",Ra,[v("button",{type:"button",class:"fct-attr-add-attr-btn fct-attr-add-attr-btn--main",disabled:!C.value,title:C.value?null:ie.value,onClick:Ke},[g(le,{name:"Plus"}),C.value?(y(),S(re,{key:1},[Ee(V(Y.value.length?k(d)("Add more"):k(d)("Add Terms")),1)],64)):(y(),S(re,{key:0},[Ee(V(q.value),1)],64))],8,Fa),T.value>0?(y(),S("button",{key:0,type:"button",class:"fct-attr-panel-footer-sync",disabled:!X.value||z.value,title:Q.value,"aria-label":Q.value,onClick:w},[g(le,{name:"Reload",class:Oe({"fct-spin":z.value})},null,8,["class"])],8,Va)):oe("",!0)]))])}}},Ga={name:"EditGroupModal",props:["group","groupId"],setup(t,e){const n=R(!1),o=R(!1),a=R({}),r=R(null),i=()=>{var u,m;(m=(u=r.value)==null?void 0:u.focus)==null||m.call(u)};e.expose({focusTitle:i});const l=t.group.settings||{},c=Cn({type:l.type||"options",styling:l.styling||"button"}),s=()=>{n.value=!0,a.value={};const u={...c};Me.put("options/attr/group/"+t.groupId,{title:t.group.title,settings:u}).then(m=>{kn(m.message),t.group.settings=u,e.emit("whenGroupEditIsDone",t.group)}).catch(m=>{if(m.message)return qn(m);if(typeof m=="object")return a.value=m}).finally(()=>{n.value=!1})};return{loading:n,is_group_loading:o,updateGroup:s,handleTitleKeyup:u=>{u.key==="Enter"&&(n.value||!t.group.title||s())},validationErrors:a,groupSettings:c,titleInputRef:r}}},ja={class:"fct-attr-group-edit-modal"},Ya={class:"dialog-footer"};function Xa(t,e,n,o,a,r){const i=te("el-input"),l=te("el-form-item"),c=te("el-col"),s=te("el-option"),p=te("el-select"),u=te("el-row"),m=te("el-form"),D=te("el-button");return y(),S("div",ja,[g(m,{"label-position":"top",data:n.group},{default:B(()=>[g(u,{gutter:24},{default:B(()=>[g(c,{span:24},{default:B(()=>[g(l,{label:t.$t("Group Title")},{default:B(()=>[g(i,{ref:"titleInputRef",type:"text",modelValue:n.group.title,"onUpdate:modelValue":e[0]||(e[0]=h=>n.group.title=h),placeholder:t.$t("Group Title"),onKeyup:o.handleTitleKeyup},null,8,["modelValue","placeholder","onKeyup"]),o.validationErrors.title?(y(!0),S(re,{key:0},Le(o.validationErrors.title,(h,T)=>(y(),S("span",{class:"error",key:T},V(h),1))),128)):oe("",!0)]),_:1},8,["label"])]),_:1}),g(c,{span:12},{default:B(()=>[g(l,{label:t.$t("Attribute Type")},{default:B(()=>[g(p,{modelValue:o.groupSettings.type,"onUpdate:modelValue":e[1]||(e[1]=h=>o.groupSettings.type=h),style:{width:"100%"}},{default:B(()=>[g(s,{label:t.$t("Options"),value:"options"},null,8,["label"]),g(s,{label:t.$t("Color"),value:"color"},null,8,["label"]),g(s,{label:t.$t("Image"),value:"image"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1}),g(c,{span:12},{default:B(()=>[g(l,{label:t.$t("Styling")},{default:B(()=>[g(p,{modelValue:o.groupSettings.styling,"onUpdate:modelValue":e[2]||(e[2]=h=>o.groupSettings.styling=h),clearable:"",style:{width:"100%"}},{default:B(()=>[g(s,{label:t.$t("Dropdown"),value:"dropdown"},null,8,["label"]),g(s,{label:t.$t("Button"),value:"button"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1},8,["data"]),v("div",Ya,[g(D,{disabled:!n.group.title||o.loading,loading:o.is_group_loading,onClick:e[3]||(e[3]=h=>o.updateGroup()),type:"primary"},{default:B(()=>[Ee(V(t.$t("Save changes")),1)]),_:1},8,["disabled","loading"])])])}const Ua=Jn(Ga,[["render",Xa]]),Ha={class:"fct-attr-split-page fct-layout-width"},Wa={class:"fct-attr-split-card"},Ka={class:"fct-attr-split-left"},za={class:"fct-attr-split-left-header"},qa={class:"fct-attr-split-title"},Ja={class:"fct-attr-split-count"},Qa=["aria-label"],Za={class:"fct-attr-split-search"},er=["aria-pressed","aria-label","onClick","onKeydown"],tr=["data-group-id","aria-label","onKeydown"],nr={class:"fct-attr-group-item-body"},or={class:"fct-attr-group-item-name"},ar={class:"fct-attr-group-item-meta"},rr=["aria-label","onClick"],ir=["aria-label","onClick"],lr={key:0,class:"fct-attr-group-empty"},sr={key:1,class:"fct-attr-group-loading"},ur={class:"fct-attr-split-left-footer"},cr=["disabled"],dr={class:"fct-attr-load-more-count"},fr={class:"fct-attr-split-right"},pr={key:1,class:"fct-attr-panel-skeleton"},mr={class:"fct-attr-panel-skeleton-body"},hr={key:2,class:"fct-attr-split-empty"},gr=10,Tr={__name:"AttrGroups",setup(t){const e=R(null),n=R(!1),o=R(null),a=R(null),r=R(!1),i=R({}),l=R(""),c=R(null),s=R([]),p=R(1),u=R(1),m=R(0),D=R(!0),h=R(!1),T=ce(()=>p.value<u.value),j=R(null),z=ce(()=>!l.value.trim()&&s.value.length>1),X=P=>l.value.trim()?(P.title||"").toLowerCase().includes(l.value.toLowerCase()):!0,Q=R(!1);let W=!1;const _=()=>{if(Q.value){W=!0;return}const P=s.value.map(b=>b.id);P.length<2||(Q.value=!0,Me.post("options/attr/groups/reorder",{ids:P}).then(b=>{me.success(b.message||d("Groups reordered"))}).catch(b=>{var F;me.error(((F=b.data)==null?void 0:F.message)||d("Failed to reorder groups")),fe()}).finally(()=>{Q.value=!1,W&&(W=!1,_())}))},w=(P,b)=>{if(!z.value)return;const F=s.value,be=F.findIndex(ie=>ie.id===P.id),C=be+b;if(be===-1||C<0||C>=F.length)return;const q=F[C];F[C]=F[be],F[be]=q,_(),At(()=>{const ie=document.querySelector('.fct-attr-group-handle[data-group-id="'+P.id+'"]');ie&&ie.focus()})};let U=0;const K=(P=1,b=!1)=>{const F=++U;b?h.value=!0:D.value=!0;const be={per_page:gr,page:P};return l.value&&l.value.trim()&&(be.search=l.value.trim()),Me.get("options/attr/groups",be).then(C=>{if(F!==U)return!1;const q=C.groups||{},ie=q.data||[];if(s.value=b?s.value.concat(ie):ie,m.value=Number(q.total||0),u.value=Number(q.last_page||1),p.value=Number(q.current_page||P),!b){const Ke=e.value&&s.value.some(Vt=>Vt.id===e.value.id),Te=e.value&&e.value.id===j.value;!Ke&&!Te&&(e.value=s.value.length?s.value[0]:null),j.value=null}return!0}).catch(C=>{var q;return F!==U||me.error(((q=C.data)==null?void 0:q.message)||d("Failed to load attributes")),!1}).finally(()=>{F===U&&(D.value=!1,h.value=!1)})};K(1,!1);const E=()=>{!T.value||h.value||D.value||K(p.value+1,!0)},de=P=>{const b=P.target;if(!b)return;b.scrollHeight-b.scrollTop-b.clientHeight<120&&E()},fe=()=>{p.value=1,K(1,!1)};let ge=null;Dn(l,()=>{ge&&clearTimeout(ge),ge=setTimeout(()=>{p.value=1,K(1,!1)},300)}),Hn(()=>{ge&&clearTimeout(ge)});const ve=ce(()=>{if(!l.value.trim())return s.value;const P=l.value.toLowerCase();return s.value.filter(b=>(b.title||"").toLowerCase().includes(P))}),Se=["65%","50%","70%","45%","60%","55%"],xe=["80%","70%","85%","65%","75%","90%"],Y=P=>Se[(P-1)%Se.length],Ce=P=>xe[(P-1)%xe.length],se=P=>{var F;return{options:d("Options"),color:d("Color"),image:d("Image")}[((F=P.settings)==null?void 0:F.type)||"options"]||d("Options")},Ve=P=>{var F;return{dropdown:d("Dropdown"),button:d("Button")}[((F=P.settings)==null?void 0:F.styling)||"button"]||d("Button")},Ye=P=>d("Open attribute group: %1$s",P.title||d("No Name")),$e=P=>{i.value=P,r.value=!0},Ze=P=>{if(P.used_terms_count>0){me.error(d("Group's terms are already in use, please remove the terms from product first."));return}Gn.ofDelete(d("Are you sure you want to delete this group? This action is not recoverable."),d("Confirm Delete!"),{confirmButtonText:d("Yes, Delete this group")}).then(()=>{Me.delete("options/attr/group/"+P.id).then(b=>{var F;me.success(b.message),((F=e.value)==null?void 0:F.id)===P.id&&(e.value=null),fe()}).catch(b=>{var F;me.error(((F=b.data)==null?void 0:F.message)||d("Delete failed"))})}).catch(()=>{})},it=async P=>{n.value=!1;const b=P&&P.id?P.id:null;if(b&&(e.value=P,j.value=b),!await K(1,!1))return;let F=0;for(;b&&!s.value.some(be=>be.id===b)&&T.value&&F<50;)if(F++,!await K(p.value+1,!0))return;lt()},lt=(P=10)=>{At(()=>{const b=document.querySelector(".fct-attr-group-list");if(b){const F=b.querySelector(".fct-attr-group-item.is-active");F&&F.scrollIntoView({block:"nearest",behavior:"smooth"});return}P>0&&requestAnimationFrame(()=>lt(P-1))})},st=()=>{i.value={},r.value=!1};return(P,b)=>{const F=te("el-input"),be=te("el-dialog");return y(),S("div",Ha,[g(Qn,{title:k(d)("Attributes")},null,8,["title"]),v("div",Wa,[v("div",Ka,[v("div",za,[v("div",qa,[v("span",null,V(k(d)("Attributes")),1),v("span",Ja,V(s.value.length),1)]),v("button",{class:"fct-attr-icon-btn","aria-label":k(d)("Add attribute group"),onClick:b[0]||(b[0]=C=>n.value=!0)},[g(le,{name:"Plus"})],8,Qa)]),v("div",Za,[g(F,{modelValue:l.value,"onUpdate:modelValue":b[1]||(b[1]=C=>l.value=C),placeholder:k(d)("Search attributes"),size:"small",clearable:""},{prefix:B(()=>[g(le,{name:"Search"})]),_:1},8,["modelValue","placeholder"])]),v("div",{class:"fct-attr-group-list",onScrollPassive:de},[g(k(Bn),{list:s.value,handle:".fct-attr-group-handle",disabled:!z.value||D.value||h.value||Q.value,animation:150,"ghost-class":"fct-attr-group-item--ghost",tag:"div",class:"fct-attr-group-list-inner",onEnd:_},{default:B(()=>[(y(!0),S(re,null,Le(s.value,C=>{var q,ie,Ke;return Wn((y(),S("div",{key:C.id,class:Oe(["fct-attr-group-item",{"is-active":((q=e.value)==null?void 0:q.id)===C.id}]),role:"button",tabindex:"0","aria-pressed":((ie=e.value)==null?void 0:ie.id)===C.id,"aria-label":Ye(C),onClick:Te=>e.value=C,onKeydown:[He(Ne(Te=>e.value=C,["prevent"]),["enter"]),He(Ne(Te=>e.value=C,["prevent"]),["space"])]},[z.value?(y(),S("button",{key:0,type:"button",class:"fct-attr-group-handle","data-group-id":C.id,"aria-label":k(d)("Reorder %1$s — drag, or use arrow up and down keys",C.title||k(d)("No Name")),onClick:b[2]||(b[2]=Ne(()=>{},["stop"])),onMousedown:b[3]||(b[3]=Ne(()=>{},["stop"])),onKeydown:[He(Ne(Te=>w(C,-1),["prevent","stop"]),["up"]),He(Ne(Te=>w(C,1),["prevent","stop"]),["down"])]},[g(le,{name:"ReorderDotsVertical"})],40,tr)):oe("",!0),v("div",nr,[v("span",or,V(C.title||k(d)("No Name")),1),v("span",ar,V(se(C))+" · "+V(Ve(C))+" · "+V(C.terms_count||0)+" "+V(k(d)("terms")),1)]),v("div",{class:"fct-attr-group-item-actions",onClick:b[4]||(b[4]=Ne(()=>{},["stop"]))},[v("button",{class:"fct-attr-icon-btn fct-attr-group-action","aria-label":k(d)("Edit group"),onClick:Te=>$e(C)},[g(le,{name:"Edit"})],8,rr),v("button",{class:"fct-attr-icon-btn fct-attr-group-action fct-attr-group-action--delete","aria-label":k(d)("Delete group"),onClick:Te=>Ze(C)},[g(le,{name:"Delete"})],8,ir)]),((Ke=e.value)==null?void 0:Ke.id)===C.id?(y(),Ae(le,{key:1,name:"ChevronRight",class:"fct-attr-group-chevron"})):oe("",!0)],42,er)),[[Kn,X(C)]])}),128))]),_:1},8,["list","disabled"]),!D.value&&!h.value&&!ve.value.length?(y(),S("div",lr,V(l.value?k(d)("No results found"):k(d)("No attributes yet")),1)):oe("",!0),D.value?(y(),S("div",sr,[(y(),S(re,null,Le(6,C=>v("div",{key:C,class:"fct-attr-group-skeleton"},[v("span",{class:"fct-skel-block fct-skel-group-title",style:Qe({width:Y(C)})},null,4),v("span",{class:"fct-skel-block fct-skel-group-meta",style:Qe({width:Ce(C)})},null,4)])),64))])):oe("",!0)],32),v("div",ur,[v("button",{class:"fct-attr-add-attr-btn",disabled:!T.value||h.value,onClick:E},[g(le,{name:"Reload",class:Oe({"fct-spin":h.value})},null,8,["class"]),h.value?(y(),S(re,{key:0},[Ee(V(k(d)("Loading...")),1)],64)):T.value?(y(),S(re,{key:1},[Ee(V(k(d)("Load More"))+" ",1),v("span",dr,"("+V(s.value.length)+"/"+V(m.value)+")",1)],64)):(y(),S(re,{key:2},[Ee(V(k(d)("All loaded"))+" ("+V(m.value)+")",1)],64))],8,cr)])]),v("div",fr,[e.value?(y(),Ae(Ba,{ref_key:"panelRef",ref:c,key:e.value.id,group:e.value,onEditGroup:b[5]||(b[5]=C=>$e(e.value))},null,8,["group"])):D.value?(y(),S("div",pr,[b[13]||(b[13]=zn('<div class="fct-attr-panel-skeleton-header"><div class="fct-skel-block fct-skel-breadcrumb"></div><div class="fct-attr-panel-skeleton-chips"><span class="fct-skel-block fct-skel-chip"></span><span class="fct-skel-block fct-skel-chip"></span><span class="fct-skel-block fct-skel-chip"></span></div></div>',1)),v("div",mr,[(y(),S(re,null,Le(6,C=>v("div",{key:C,class:"fct-term-row-item fct-term-row-item--skeleton"},[b[10]||(b[10]=v("span",{class:"fct-skel-block fct-skel-handle"},null,-1)),b[11]||(b[11]=v("span",{class:"fct-skel-block fct-skel-dot"},null,-1)),v("span",{class:"fct-skel-block fct-skel-title",style:Qe({width:Y(C)})},null,4),b[12]||(b[12]=v("span",{class:"fct-skel-block fct-skel-action"},null,-1))])),64))])])):(y(),S("div",hr,[g(le,{name:"Empty/ListView"}),v("p",null,V(k(d)("Select an attribute to manage its terms")),1)]))])]),g(be,{"append-to-body":!0,width:"50%",modelValue:n.value,"onUpdate:modelValue":b[6]||(b[6]=C=>n.value=C),title:k(d)("Add new attribute group"),onOpened:b[7]||(b[7]=C=>{var q,ie;return(ie=(q=o.value)==null?void 0:q.focusTitle)==null?void 0:ie.call(q)})},{default:B(()=>[n.value?(y(),Ae(na,{key:0,ref_key:"addGroupModalRef",ref:o,onWhenGroupCreateIsDone:it},null,512)):oe("",!0)]),_:1},8,["modelValue","title"]),g(be,{"append-to-body":!0,width:"50%",modelValue:r.value,"onUpdate:modelValue":b[8]||(b[8]=C=>r.value=C),title:k(d)("Edit attribute group"),onOpened:b[9]||(b[9]=C=>{var q,ie;return(ie=(q=a.value)==null?void 0:q.focusTitle)==null?void 0:ie.call(q)})},{default:B(()=>[r.value?(y(),Ae(Ua,{key:0,ref_key:"editGroupModalRef",ref:a,group:i.value,"group-id":i.value.id,onWhenGroupEditIsDone:st},null,8,["group","group-id"])):oe("",!0)]),_:1},8,["modelValue","title"])])}}};export{Zn as C,Bn as V,Tr as _,pt as a,Qt as b,Gn as c,na as d};