var $t=Math.min,vt=Math.max,Vt=Math.round;var ot=i=>({x:i,y:i}),on={left:"right",right:"left",bottom:"top",top:"bottom"};function Le(i,t,e){return vt(i,$t(t,e))}function Wt(i,t){return typeof i=="function"?i(t):i}function yt(i){return i.split("-")[0]}function zt(i){return i.split("-")[1]}function Re(i){return i==="x"?"y":"x"}function Te(i){return i==="y"?"height":"width"}function ft(i){let t=i[0];return t==="t"||t==="b"?"y":"x"}function Ie(i){return Re(ft(i))}function ei(i,t,e){e===void 0&&(e=!1);let n=zt(i),s=Ie(i),o=Te(s),r=s==="x"?n===(e?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(r=Ht(r)),[r,Ht(r)]}function ii(i){let t=Ht(i);return[oe(i),t,oe(t)]}function oe(i){return i.includes("start")?i.replace("start","end"):i.replace("end","start")}var Ze=["left","right"],ti=["right","left"],rn=["top","bottom"],an=["bottom","top"];function ln(i,t,e){switch(i){case"top":case"bottom":return e?t?ti:Ze:t?Ze:ti;case"left":case"right":return t?rn:an;default:return[]}}function ni(i,t,e,n){let s=zt(i),o=ln(yt(i),e==="start",n);return s&&(o=o.map(r=>r+"-"+s),t&&(o=o.concat(o.map(oe)))),o}function Ht(i){let t=yt(i);return on[t]+i.slice(t.length)}function cn(i){return{top:0,right:0,bottom:0,left:0,...i}}function si(i){return typeof i!="number"?cn(i):{top:i,right:i,bottom:i,left:i}}function Ot(i){let{x:t,y:e,width:n,height:s}=i;return{width:n,height:s,top:e,left:t,right:t+n,bottom:e+s,x:t,y:e}}function oi(i,t,e){let{reference:n,floating:s}=i,o=ft(t),r=Ie(t),a=Te(r),l=yt(t),c=o==="y",h=n.x+n.width/2-s.width/2,u=n.y+n.height/2-s.height/2,f=n[a]/2-s[a]/2,p;switch(l){case"top":p={x:h,y:n.y-s.height};break;case"bottom":p={x:h,y:n.y+n.height};break;case"right":p={x:n.x+n.width,y:u};break;case"left":p={x:n.x-s.width,y:u};break;default:p={x:n.x,y:n.y}}switch(zt(t)){case"start":p[r]-=f*(e&&c?-1:1);break;case"end":p[r]+=f*(e&&c?-1:1);break}return p}async function ri(i,t){var e;t===void 0&&(t={});let{x:n,y:s,platform:o,rects:r,elements:a,strategy:l}=i,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Wt(t,i),m=si(p),w=a[f?u==="floating"?"reference":"floating":u],x=Ot(await o.getClippingRect({element:(e=await(o.isElement==null?void 0:o.isElement(w)))==null||e?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:h,strategy:l})),S=u==="floating"?{x:n,y:s,width:r.floating.width,height:r.floating.height}:r.reference,A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),D=await(o.isElement==null?void 0:o.isElement(A))?await(o.getScale==null?void 0:o.getScale(A))||{x:1,y:1}:{x:1,y:1},_=Ot(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:S,offsetParent:A,strategy:l}):S);return{top:(x.top-_.top+m.top)/D.y,bottom:(_.bottom-x.bottom+m.bottom)/D.y,left:(x.left-_.left+m.left)/D.x,right:(_.right-x.right+m.right)/D.x}}var hn=50,ai=async(i,t,e)=>{let{placement:n="bottom",strategy:s="absolute",middleware:o=[],platform:r}=e,a=r.detectOverflow?r:{...r,detectOverflow:ri},l=await(r.isRTL==null?void 0:r.isRTL(t)),c=await r.getElementRects({reference:i,floating:t,strategy:s}),{x:h,y:u}=oi(c,n,l),f=n,p=0,m={};for(let g=0;gP<=0)){var j,tt;let P=(((j=o.flip)==null?void 0:j.index)||0)+1,N=V[P];if(N&&(!(u==="alignment"?S!==ft(N):!1)||W.every(F=>ft(F.placement)===S?F.overflows[0]>0:!0)))return{data:{index:P,overflows:W},reset:{placement:N}};let L=(tt=W.filter(q=>q.overflows[0]<=0).sort((q,F)=>q.overflows[1]-F.overflows[1])[0])==null?void 0:tt.placement;if(!L)switch(p){case"bestFit":{var z;let q=(z=W.filter(F=>{if(C){let et=ft(F.placement);return et===S||et==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(et=>et>0).reduce((et,se)=>et+se,0)]).sort((F,et)=>F[1]-et[1])[0])==null?void 0:z[0];q&&(L=q);break}case"initialPlacement":L=a;break}if(s!==L)return{reset:{placement:L}}}return{}}}};var un=new Set(["left","top"]);async function dn(i,t){let{placement:e,platform:n,elements:s}=i,o=await(n.isRTL==null?void 0:n.isRTL(s.floating)),r=yt(e),a=zt(e),l=ft(e)==="y",c=un.has(r)?-1:1,h=o&&l?-1:1,u=Wt(t,i),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),l?{x:p*h,y:f*c}:{x:f*c,y:p*h}}var ci=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(t){var e,n;let{x:s,y:o,placement:r,middlewareData:a}=t,l=await dn(t,i);return r===((e=a.offset)==null?void 0:e.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:s+l.x,y:o+l.y,data:{...l,placement:r}}}}},hi=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(t){let{x:e,y:n,placement:s,platform:o}=t,{mainAxis:r=!0,crossAxis:a=!1,limiter:l={fn:x=>{let{x:S,y:A}=x;return{x:S,y:A}}},...c}=Wt(i,t),h={x:e,y:n},u=await o.detectOverflow(t,c),f=ft(yt(s)),p=Re(f),m=h[p],g=h[f];if(r){let x=p==="y"?"top":"left",S=p==="y"?"bottom":"right",A=m+u[x],D=m-u[S];m=Le(A,m,D)}if(a){let x=f==="y"?"top":"left",S=f==="y"?"bottom":"right",A=g+u[x],D=g-u[S];g=Le(A,g,D)}let w=l.fn({...t,[p]:m,[f]:g});return{...w,data:{x:w.x-e,y:w.y-n,enabled:{[p]:r,[f]:a}}}}}};function ae(){return typeof window<"u"}function xt(i){return di(i)?(i.nodeName||"").toLowerCase():"#document"}function K(i){var t;return(i==null||(t=i.ownerDocument)==null?void 0:t.defaultView)||window}function lt(i){var t;return(t=(di(i)?i.ownerDocument:i.document)||window.document)==null?void 0:t.documentElement}function di(i){return ae()?i instanceof Node||i instanceof K(i).Node:!1}function it(i){return ae()?i instanceof Element||i instanceof K(i).Element:!1}function ct(i){return ae()?i instanceof HTMLElement||i instanceof K(i).HTMLElement:!1}function ui(i){return!ae()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof K(i).ShadowRoot}function Tt(i){let{overflow:t,overflowX:e,overflowY:n,display:s}=nt(i);return/auto|scroll|overlay|hidden|clip/.test(t+n+e)&&s!=="inline"&&s!=="contents"}function fi(i){return/^(table|td|th)$/.test(xt(i))}function Xt(i){try{if(i.matches(":popover-open"))return!0}catch{}try{return i.matches(":modal")}catch{return!1}}var fn=/transform|translate|scale|rotate|perspective|filter/,pn=/paint|layout|strict|content/,Dt=i=>!!i&&i!=="none",Me;function le(i){let t=it(i)?nt(i):i;return Dt(t.transform)||Dt(t.translate)||Dt(t.scale)||Dt(t.rotate)||Dt(t.perspective)||!ce()&&(Dt(t.backdropFilter)||Dt(t.filter))||fn.test(t.willChange||"")||pn.test(t.contain||"")}function pi(i){let t=pt(i);for(;ct(t)&&!At(t);){if(le(t))return t;if(Xt(t))return null;t=pt(t)}return null}function ce(){return Me==null&&(Me=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Me}function At(i){return/^(html|body|#document)$/.test(xt(i))}function nt(i){return K(i).getComputedStyle(i)}function jt(i){return it(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function pt(i){if(xt(i)==="html")return i;let t=i.assignedSlot||i.parentNode||ui(i)&&i.host||lt(i);return ui(t)?t.host:t}function mi(i){let t=pt(i);return At(t)?i.ownerDocument?i.ownerDocument.body:i.body:ct(t)&&Tt(t)?t:mi(t)}function re(i,t,e){var n;t===void 0&&(t=[]),e===void 0&&(e=!0);let s=mi(i),o=s===((n=i.ownerDocument)==null?void 0:n.body),r=K(s);if(o){let a=he(r);return t.concat(r,r.visualViewport||[],Tt(s)?s:[],a&&e?re(a):[])}else return t.concat(s,re(s,[],e))}function he(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function yi(i){let t=nt(i),e=parseFloat(t.width)||0,n=parseFloat(t.height)||0,s=ct(i),o=s?i.offsetWidth:e,r=s?i.offsetHeight:n,a=Vt(e)!==o||Vt(n)!==r;return a&&(e=o,n=r),{width:e,height:n,$:a}}function wi(i){return it(i)?i:i.contextElement}function It(i){let t=wi(i);if(!ct(t))return ot(1);let e=t.getBoundingClientRect(),{width:n,height:s,$:o}=yi(t),r=(o?Vt(e.width):e.width)/n,a=(o?Vt(e.height):e.height)/s;return(!r||!Number.isFinite(r))&&(r=1),(!a||!Number.isFinite(a))&&(a=1),{x:r,y:a}}var mn=ot(0);function Si(i){let t=K(i);return!ce()||!t.visualViewport?mn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gn(i,t,e){return t===void 0&&(t=!1),!e||t&&e!==K(i)?!1:t}function Yt(i,t,e,n){t===void 0&&(t=!1),e===void 0&&(e=!1);let s=i.getBoundingClientRect(),o=wi(i),r=ot(1);t&&(n?it(n)&&(r=It(n)):r=It(i));let a=gn(o,e,n)?Si(o):ot(0),l=(s.left+a.x)/r.x,c=(s.top+a.y)/r.y,h=s.width/r.x,u=s.height/r.y;if(o){let f=K(o),p=n&&it(n)?K(n):n,m=f,g=he(m);for(;g&&n&&p!==m;){let w=It(g),x=g.getBoundingClientRect(),S=nt(g),A=x.left+(g.clientLeft+parseFloat(S.paddingLeft))*w.x,D=x.top+(g.clientTop+parseFloat(S.paddingTop))*w.y;l*=w.x,c*=w.y,h*=w.x,u*=w.y,l+=A,c+=D,m=K(g),g=he(m)}}return Ot({width:h,height:u,x:l,y:c})}function ue(i,t){let e=jt(i).scrollLeft;return t?t.left+e:Yt(lt(i)).left+e}function Ei(i,t){let e=i.getBoundingClientRect(),n=e.left+t.scrollLeft-ue(i,e),s=e.top+t.scrollTop;return{x:n,y:s}}function bn(i){let{elements:t,rect:e,offsetParent:n,strategy:s}=i,o=s==="fixed",r=lt(n),a=t?Xt(t.floating):!1;if(n===r||a&&o)return e;let l={scrollLeft:0,scrollTop:0},c=ot(1),h=ot(0),u=ct(n);if((u||!u&&!o)&&((xt(n)!=="body"||Tt(r))&&(l=jt(n)),u)){let p=Yt(n);c=It(n),h.x=p.x+n.clientLeft,h.y=p.y+n.clientTop}let f=r&&!u&&!o?Ei(r,l):ot(0);return{width:e.width*c.x,height:e.height*c.y,x:e.x*c.x-l.scrollLeft*c.x+h.x+f.x,y:e.y*c.y-l.scrollTop*c.y+h.y+f.y}}function vn(i){return Array.from(i.getClientRects())}function yn(i){let t=lt(i),e=jt(i),n=i.ownerDocument.body,s=vt(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=vt(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight),r=-e.scrollLeft+ue(i),a=-e.scrollTop;return nt(n).direction==="rtl"&&(r+=vt(t.clientWidth,n.clientWidth)-s),{width:s,height:o,x:r,y:a}}var gi=25;function wn(i,t){let e=K(i),n=lt(i),s=e.visualViewport,o=n.clientWidth,r=n.clientHeight,a=0,l=0;if(s){o=s.width,r=s.height;let h=ce();(!h||h&&t==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}let c=ue(n);if(c<=0){let h=n.ownerDocument,u=h.body,f=getComputedStyle(u),p=h.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(n.clientWidth-u.clientWidth-p);m<=gi&&(o-=m)}else c<=gi&&(o+=c);return{width:o,height:r,x:a,y:l}}function Sn(i,t){let e=Yt(i,!0,t==="fixed"),n=e.top+i.clientTop,s=e.left+i.clientLeft,o=ct(i)?It(i):ot(1),r=i.clientWidth*o.x,a=i.clientHeight*o.y,l=s*o.x,c=n*o.y;return{width:r,height:a,x:l,y:c}}function bi(i,t,e){let n;if(t==="viewport")n=wn(i,e);else if(t==="document")n=yn(lt(i));else if(it(t))n=Sn(t,e);else{let s=Si(i);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Ot(n)}function Oi(i,t){let e=pt(i);return e===t||!it(e)||At(e)?!1:nt(e).position==="fixed"||Oi(e,t)}function En(i,t){let e=t.get(i);if(e)return e;let n=re(i,[],!1).filter(a=>it(a)&&xt(a)!=="body"),s=null,o=nt(i).position==="fixed",r=o?pt(i):i;for(;it(r)&&!At(r);){let a=nt(r),l=le(r);!l&&a.position==="fixed"&&(s=null),(o?!l&&!s:!l&&a.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Tt(r)&&!l&&Oi(i,r))?n=n.filter(h=>h!==r):s=a,r=pt(r)}return t.set(i,n),n}function On(i){let{element:t,boundary:e,rootBoundary:n,strategy:s}=i,r=[...e==="clippingAncestors"?Xt(t)?[]:En(t,this._c):[].concat(e),n],a=bi(t,r[0],s),l=a.top,c=a.right,h=a.bottom,u=a.left;for(let f=1;f{let n=new Map,s={platform:Ln,...e},o={...s.platform,_c:n};return ai(i,t,{...s,platform:o})};function Rn(i,t,e){return(t=_n(t))in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function gt(){return gt=Object.assign?Object.assign.bind():function(i){for(var t=1;t"&&(t=t.substring(1)),i)try{if(i.matches)return i.matches(t);if(i.msMatchesSelector)return i.msMatchesSelector(t);if(i.webkitMatchesSelector)return i.webkitMatchesSelector(t)}catch{return!1}return!1}}function $i(i){return i.host&&i!==document&&i.host.nodeType&&i.host!==i?i.host:i.parentNode}function at(i,t,e,n){if(i){e=e||document;do{if(t!=null&&(t[0]===">"?i.parentNode===e&&we(i,t):we(i,t))||n&&i===e)return i;if(i===e)break}while(i=$i(i))}return null}var Ii=/\s+/g;function Q(i,t,e){if(i&&t)if(i.classList)i.classList[e?"add":"remove"](t);else{var n=(" "+i.className+" ").replace(Ii," ").replace(" "+t+" "," ");i.className=(n+(e?" "+t:"")).replace(Ii," ")}}function b(i,t,e){var n=i&&i.style;if(n){if(e===void 0)return document.defaultView&&document.defaultView.getComputedStyle?e=document.defaultView.getComputedStyle(i,""):i.currentStyle&&(e=i.currentStyle),t===void 0?e:e[t];!(t in n)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),n[t]=e+(typeof e=="string"?"":"px")}}function Bt(i,t){var e="";if(typeof i=="string")e=i;else do{var n=b(i,"transform");n&&n!=="none"&&(e=n+" "+e)}while(!t&&(i=i.parentNode));var s=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return s&&new s(e)}function Vi(i,t,e){if(i){var n=i.getElementsByTagName(t),s=0,o=n.length;if(e)for(;s=o:r=s<=o,!r)return n;if(n===ht())break;n=Et(n,!1)}return!1}function kt(i,t,e,n){for(var s=0,o=0,r=i.children;o2&&arguments[2]!==void 0?arguments[2]:{},s=n.evt,o=Tn(n,Wn);ie.pluginEvent.bind(v)(t,e,ut({dragEl:d,parentEl:M,ghostEl:y,rootEl:R,nextEl:Rt,lastDownEl:ge,cloneEl:T,cloneHidden:St,dragStarted:qt,putSortable:$,activeSortable:v.active,originalEvent:s,oldIndex:Nt,oldDraggableIndex:Qt,newIndex:Z,newDraggableIndex:wt,hideGhostForTarget:Ui,unhideGhostForTarget:Gi,cloneNowHidden:function(){St=!0},cloneNowShown:function(){St=!1},dispatchSortableEvent:function(a){Y({sortable:e,name:a,originalEvent:s})}},o))};function Y(i){Vn(ut({putSortable:$,cloneEl:T,targetEl:d,rootEl:R,oldIndex:Nt,oldDraggableIndex:Qt,newIndex:Z,newDraggableIndex:wt},i))}var d,M,y,R,Rt,ge,T,St,Nt,Z,Qt,wt,de,$,Pt=!1,Se=!1,Ee=[],Ct,rt,Be,ke,Pi,Ni,qt,_t,Zt,te=!1,fe=!1,be,X,Fe=[],Xe=!1,Oe=[],xe=typeof document<"u",pe=Ke,Bi=ee||bt?"cssFloat":"float",zn=xe&&!Fi&&!Ke&&"draggable"in document.createElement("div"),Yi=(function(){if(xe){if(bt)return!1;var i=document.createElement("x");return i.style.cssText="pointer-events:auto",i.style.pointerEvents==="auto"}})(),qi=function(t,e){var n=b(t),s=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=kt(t,0,e),r=kt(t,1,e),a=o&&b(o),l=r&&b(r),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+k(o).width,h=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+k(r).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&a.float&&a.float!=="none"){var u=a.float==="left"?"left":"right";return r&&(l.clear==="both"||l.clear===u)?"vertical":"horizontal"}return o&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||c>=s&&n[Bi]==="none"||r&&n[Bi]==="none"&&c+h>s)?"vertical":"horizontal"},Xn=function(t,e,n){var s=n?t.left:t.top,o=n?t.right:t.bottom,r=n?t.width:t.height,a=n?e.left:e.top,l=n?e.right:e.bottom,c=n?e.width:e.height;return s===a||o===l||s+r/2===a+c/2},jn=function(t,e){var n;return Ee.some(function(s){var o=s[G].options.emptyInsertThreshold;if(!(!o||Ue(s))){var r=k(s),a=t>=r.left-o&&t<=r.right+o,l=e>=r.top-o&&e<=r.bottom+o;if(a&&l)return n=s}}),n},Ki=function(t){function e(o,r){return function(a,l,c,h){var u=a.options.group.name&&l.options.group.name&&a.options.group.name===l.options.group.name;if(o==null&&(r||u))return!0;if(o==null||o===!1)return!1;if(r&&o==="clone")return o;if(typeof o=="function")return e(o(a,l,c,h),r)(a,l,c,h);var f=(r?a:l).options.group.name;return o===!0||typeof o=="string"&&o===f||o.join&&o.indexOf(f)>-1}}var n={},s=t.group;(!s||ze(s)!="object")&&(s={name:s}),n.name=s.name,n.checkPull=e(s.pull,!0),n.checkPut=e(s.put),n.revertClone=s.revertClone,t.group=n},Ui=function(){!Yi&&y&&b(y,"display","none")},Gi=function(){!Yi&&y&&b(y,"display","")};xe&&!Fi&&document.addEventListener("click",function(i){if(Se)return i.preventDefault(),i.stopPropagation&&i.stopPropagation(),i.stopImmediatePropagation&&i.stopImmediatePropagation(),Se=!1,!1},!0);var Lt=function(t){if(d){t=t.touches?t.touches[0]:t;var e=jn(t.clientX,t.clientY);if(e){var n={};for(var s in t)t.hasOwnProperty(s)&&(n[s]=t[s]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[G]._onDragOver(n)}}},Yn=function(t){d&&d.parentNode[G]._isOutsideThisEl(t.target)};function v(i,t){if(!(i&&i.nodeType&&i.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(i));this.el=i,this.options=t=gt({},t),i[G]=this;var e={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(i.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return qi(i,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(r,a){r.setData("Text",a.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:v.supportPointer!==!1&&"PointerEvent"in window&&(!Gt||Ke),emptyInsertThreshold:5};ie.initializePlugins(this,i,e);for(var n in e)!(n in t)&&(t[n]=e[n]);Ki(t);for(var s in this)s.charAt(0)==="_"&&typeof this[s]=="function"&&(this[s]=this[s].bind(this));this.nativeDraggable=t.forceFallback?!1:zn,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?O(i,"pointerdown",this._onTapStart):(O(i,"mousedown",this._onTapStart),O(i,"touchstart",this._onTapStart)),this.nativeDraggable&&(O(i,"dragover",this),O(i,"dragenter",this)),Ee.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),gt(this,Fn())}v.prototype={constructor:v,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(_t=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,d):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,s=this.options,o=s.preventOnFilter,r=t.type,a=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,l=(a||t).target,c=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,h=s.filter;if(ts(n),!d&&!(/mousedown|pointerdown/.test(r)&&t.button!==0||s.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&Gt&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=at(l,s.draggable,n,!1),!(l&&l.animated)&&ge!==l)){if(Nt=st(l),Qt=st(l,s.draggable),typeof h=="function"){if(h.call(this,t,l,this)){Y({sortable:e,rootEl:c,name:"filter",targetEl:l,toEl:n,fromEl:n}),U("filter",e,{evt:t}),o&&t.preventDefault();return}}else if(h&&(h=h.split(",").some(function(u){if(u=at(c,u.trim(),n,!1),u)return Y({sortable:e,rootEl:u,name:"filter",targetEl:l,fromEl:n,toEl:n}),U("filter",e,{evt:t}),!0}),h)){o&&t.preventDefault();return}s.handle&&!at(c,s.handle,n,!1)||this._prepareDragStart(t,a,l)}}},_prepareDragStart:function(t,e,n){var s=this,o=s.el,r=s.options,a=o.ownerDocument,l;if(n&&!d&&n.parentNode===o){var c=k(n);if(R=o,d=n,M=d.parentNode,Rt=d.nextSibling,ge=n,de=r.group,v.dragged=d,Ct={target:d,clientX:(e||t).clientX,clientY:(e||t).clientY},Pi=Ct.clientX-c.left,Ni=Ct.clientY-c.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,d.style["will-change"]="all",l=function(){if(U("delayEnded",s,{evt:t}),v.eventCanceled){s._onDrop();return}s._disableDelayedDragEvents(),!Ti&&s.nativeDraggable&&(d.draggable=!0),s._triggerDragStart(t,e),Y({sortable:s,name:"choose",originalEvent:t}),Q(d,r.chosenClass,!0)},r.ignore.split(",").forEach(function(h){Vi(d,h.trim(),He)}),O(a,"dragover",Lt),O(a,"mousemove",Lt),O(a,"touchmove",Lt),r.supportPointer?(O(a,"pointerup",s._onDrop),!this.nativeDraggable&&O(a,"pointercancel",s._onDrop)):(O(a,"mouseup",s._onDrop),O(a,"touchend",s._onDrop),O(a,"touchcancel",s._onDrop)),Ti&&this.nativeDraggable&&(this.options.touchStartThreshold=4,d.draggable=!0),U("delayStart",this,{evt:t}),r.delay&&(!r.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(ee||bt))){if(v.eventCanceled){this._onDrop();return}r.supportPointer?(O(a,"pointerup",s._disableDelayedDrag),O(a,"pointercancel",s._disableDelayedDrag)):(O(a,"mouseup",s._disableDelayedDrag),O(a,"touchend",s._disableDelayedDrag),O(a,"touchcancel",s._disableDelayedDrag)),O(a,"mousemove",s._delayedDragTouchMoveHandler),O(a,"touchmove",s._delayedDragTouchMoveHandler),r.supportPointer&&O(a,"pointermove",s._delayedDragTouchMoveHandler),s._dragStartTimer=setTimeout(l,r.delay)}else l()}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){d&&He(d),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;E(t,"mouseup",this._disableDelayedDrag),E(t,"touchend",this._disableDelayedDrag),E(t,"touchcancel",this._disableDelayedDrag),E(t,"pointerup",this._disableDelayedDrag),E(t,"pointercancel",this._disableDelayedDrag),E(t,"mousemove",this._delayedDragTouchMoveHandler),E(t,"touchmove",this._delayedDragTouchMoveHandler),E(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?O(document,"pointermove",this._onTouchMove):e?O(document,"touchmove",this._onTouchMove):O(document,"mousemove",this._onTouchMove):(O(d,"dragend",this),O(R,"dragstart",this._onDragStart));try{document.selection?ve(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Pt=!1,R&&d){U("dragStarted",this,{evt:e}),this.nativeDraggable&&O(document,"dragover",Yn);var n=this.options;!t&&Q(d,n.dragClass,!1),Q(d,n.ghostClass,!0),v.active=this,t&&this._appendGhost(),Y({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(rt){this._lastX=rt.clientX,this._lastY=rt.clientY,Ui();for(var t=document.elementFromPoint(rt.clientX,rt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(rt.clientX,rt.clientY),t!==e);)e=t;if(d.parentNode[G]._isOutsideThisEl(t),e)do{if(e[G]){var n=void 0;if(n=e[G]._onDragOver({clientX:rt.clientX,clientY:rt.clientY,target:t,rootEl:e}),n&&!this.options.dragoverBubble)break}t=e}while(e=$i(e));Gi()}},_onTouchMove:function(t){if(Ct){var e=this.options,n=e.fallbackTolerance,s=e.fallbackOffset,o=t.touches?t.touches[0]:t,r=y&&Bt(y,!0),a=y&&r&&r.a,l=y&&r&&r.d,c=pe&&X&&_i(X),h=(o.clientX-Ct.clientX+s.x)/(a||1)+(c?c[0]-Fe[0]:0)/(a||1),u=(o.clientY-Ct.clientY+s.y)/(l||1)+(c?c[1]-Fe[1]:0)/(l||1);if(!v.active&&!Pt){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))=0&&(Y({rootEl:M,name:"add",toEl:M,fromEl:R,originalEvent:t}),Y({sortable:this,name:"remove",toEl:M,originalEvent:t}),Y({rootEl:M,name:"sort",toEl:M,fromEl:R,originalEvent:t}),Y({sortable:this,name:"sort",toEl:M,originalEvent:t})),$&&$.save()):Z!==Nt&&Z>=0&&(Y({sortable:this,name:"update",toEl:M,originalEvent:t}),Y({sortable:this,name:"sort",toEl:M,originalEvent:t})),v.active&&((Z==null||Z===-1)&&(Z=Nt,wt=Qt),Y({sortable:this,name:"end",toEl:M,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){U("nulling",this),R=d=M=y=Rt=T=ge=St=Ct=rt=qt=Z=wt=Nt=Qt=_t=Zt=$=de=v.dragged=v.ghost=v.clone=v.active=null;var t=this.el;Oe.forEach(function(e){t.contains(e)&&(e.checked=!0)}),Oe.length=Be=ke=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":d&&(this._onDragOver(t),qn(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,n=this.el.children,s=0,o=n.length,r=this.options;ss.right+o||i.clientY>n.bottom&&i.clientX>n.left:i.clientY>s.bottom+o||i.clientX>n.right&&i.clientY>n.top}function Jn(i,t,e,n,s,o,r,a){var l=n?i.clientY:i.clientX,c=n?e.height:e.width,h=n?e.top:e.left,u=n?e.bottom:e.right,f=!1;if(!r){if(a&&beh+c*o/2:lu-be)return-Zt}else if(l>h+c*(1-s)/2&&lu-c*o/2)?l>h+c/2?1:-1:0}function Qn(i){return st(d){},options:L,optionsLimit:q=null,placeholder:F,position:et=null,removeButtonLabel:se="Remove :label",searchableOptionFields:Ft=["label"],searchDebounce:Ce=1e3,searchingMessage:Zi="Searching...",searchLabel:tn="Search",searchPrompt:en="Search...",state:nn,statePath:sn=null}){this.accessibilityAttributes=t,this.ariaLabel=e,this.canOptionLabelsWrap=n,this.canSelectPlaceholder=s,this.clearButtonLabel=o,this.element=r,this.errorMessage=a,this.getOptionLabelUsing=l,this.getOptionLabelsUsing=c,this.getOptionsUsing=h,this.getSearchResultsUsing=u,this.hasDynamicOptions=f,this.hasDynamicSearchResults=p&&typeof u=="function",this.hasInitialNoOptionsMessage=m,this.id=g,this.initialOptionLabel=w,this.initialOptionLabels=x,this.initialState=S,this.isAutofocused=A,this.isDisabled=D,this.isHtmlAllowed=_,this.isMultiple=C,this.isReorderable=V,this.isSearchable=J,this.livewireId=I,this.loadingMessage=W,this.maxItems=j,this.maxItemsMessage=tt,this.noOptionsMessage=z,this.noSearchResultsMessage=P,this.onStateChange=N,this.options=L,this.optionsLimit=q,this.originalOptions=JSON.parse(JSON.stringify(L)),this.placeholder=F,this.position=et,this.removeButtonLabel=se,this.searchableOptionFields=Array.isArray(Ft)?Ft:["label"],this.searchDebounce=Ce,this.searchingMessage=Zi,this.searchLabel=tn,this.searchPrompt=en,this.state=nn,this.statePath=sn,this.activeSearchId=0,this.openId=0,this.isDestroyed=!1,this.labelRepository={},this.isOpen=!1,this.activeValue=null,this.typeahead="",this.typeaheadTime=0,this.searchQuery="",this.searchTimeout=null,this.isSearching=!1,this.isLoadingOptions=!1,this.hasOptionsError=!1,this.maxItemsMessageElement=null,this.badgesSortable=null,this.selectedDisplayVersion=0,this.render(),this.setUpEventListeners(),this.isAutofocused&&this.selectButton.focus()}populateLabelRepositoryFromOptions(t){if(!(!t||!Array.isArray(t)))for(let e of t)e.options&&Array.isArray(e.options)?this.populateLabelRepositoryFromOptions(e.options):e.value!==void 0&&e.label!==void 0&&(this.labelRepository[e.value]=e.label)}render(){this.populateLabelRepositoryFromOptions(this.options),this.container=document.createElement("div"),this.container.className="fi-select-input-ctn",this.canOptionLabelsWrap||this.container.classList.add("fi-select-input-ctn-option-labels-not-wrapped"),this.selectButton=document.createElement("button"),this.selectButton.className="fi-select-input-btn",this.selectButton.type="button",this.isSearchable||this.selectButton.setAttribute("role","combobox"),this.selectButton.setAttribute("aria-haspopup","listbox"),this.selectButton.setAttribute("aria-expanded","false"),H(this.id)&&(this.selectButton.id=this.id),H(this.ariaLabel)&&this.selectButton.setAttribute("aria-label",this.ariaLabel),this.selectedDisplay=document.createElement("div"),this.selectedDisplay.className="fi-select-input-value-ctn",this.isMultiple?(this.container.classList.add("fi-select-input-ctn-multiple"),this.isReorderable&&this.container.classList.add("fi-select-input-ctn-reorderable"),this.selectionSummary=document.createElement("span"),this.selectionSummary.className="fi-sr-only",this.selectButton.appendChild(this.selectionSummary)):this.selectButton.appendChild(this.selectedDisplay),this.dropdown=document.createElement("div"),this.dropdown.className="fi-dropdown-panel fi-scrollable",this.dropdown.style.display="none",this.dropdownId=`fi-select-input-dropdown-${Math.random().toString(36).substring(2,11)}`,this.selectButton.setAttribute("aria-controls",this.dropdownId),this.selectionSummary||(this.selectionSummary=document.createElement("span"),this.selectionSummary.className="fi-sr-only",this.container.appendChild(this.selectionSummary)),this.selectionSummary.id=`${this.dropdownId}-value`,this.isSearchable&&(this.searchContainer=document.createElement("div"),this.searchContainer.className="fi-select-input-search-ctn",this.searchInput=document.createElement("input"),this.searchInput.className="fi-input",this.searchInput.type="text",this.searchInput.placeholder=this.searchPrompt,this.searchInput.setAttribute("role","combobox"),this.searchInput.setAttribute("aria-autocomplete","list"),this.searchInput.setAttribute("aria-expanded","false"),this.searchInput.setAttribute("aria-controls",this.dropdownId),this.searchContainer.appendChild(this.searchInput),this.dropdown.appendChild(this.searchContainer),this.searchInput.addEventListener("input",t=>{this.isDisabled||this.handleSearch(t)})),this.optionsList=document.createElement("ul"),this.optionsList.id=this.dropdownId,this.optionsList.setAttribute("role","listbox"),this.isMultiple&&this.optionsList.setAttribute("aria-multiselectable","true"),this.optionsList.addEventListener("mousedown",t=>t.preventDefault()),this.dropdown.addEventListener("mousedown",t=>{t.target===this.dropdown&&t.preventDefault()}),this.statusRegion=document.createElement("div"),this.statusRegion.className="fi-sr-only",this.statusRegion.setAttribute("role","status"),this.statusRegion.setAttribute("aria-live","polite"),this.statusRegion.setAttribute("aria-atomic","true"),this.renderOptions(),this.container.appendChild(this.selectButton),this.isMultiple&&this.container.appendChild(this.selectedDisplay),this.container.appendChild(this.dropdown),this.container.appendChild(this.statusRegion),this.element.appendChild(this.container),this.setAccessibilityAttributes(this.accessibilityAttributes),this.updateSelectedDisplay(),this.applyDisabledState()}renderOptions(){if(this.isSearching||this.hasOptionsError||this.isLoadingOptions&&(!this.searchQuery||!this.hasDynamicSearchResults))return;let t=this.activeValue;this.setActiveOption(null),this.optionsList.innerHTML="";let e=0,n=this.options,s=0,o=!1;this.options.forEach(l=>{l.options&&Array.isArray(l.options)?(s+=l.options.length,o=!0):s++}),o?this.optionsList.className="fi-select-input-options-ctn":s>0&&(this.optionsList.className="fi-dropdown-list");let r=o?null:this.optionsList,a=0;for(let l of n){if(this.optionsLimit>0&&a>=this.optionsLimit)break;if(l.options&&Array.isArray(l.options)){let c=l.options;if(this.isMultiple&&Array.isArray(this.state)&&this.state.length>0&&(c=l.options.filter(h=>!this.state.includes(h.value))),c.length>0){if(this.optionsLimit>0){let h=this.optionsLimit-a;hc.dataset.value===t)??(t!==null||!this.isSearchable?l.find(c=>this.typeahead&&dt(c.textContent.trim()).startsWith(this.typeahead))??l.find(c=>c.dataset.value===this.state)??l[0]:null))}}renderOptionGroup(t,e){if(e.length===0)return;let n=document.createElement("li");n.className="fi-select-input-option-group",n.setAttribute("role","presentation");let s=document.createElement("div");s.className="fi-dropdown-header",s.textContent=t;let o=document.createElement("ul");o.className="fi-dropdown-list",o.setAttribute("role","group"),o.setAttribute("aria-label",t),e.forEach(r=>{let a=this.createOptionElement(r.value,r);o.appendChild(a)}),n.appendChild(s),n.appendChild(o),this.optionsList.appendChild(n)}createOptionElement(t,e){let n=t,s=e,o=!1;typeof e=="object"&&e!==null&&"label"in e&&"value"in e&&(n=e.value,s=e.label,o=e.isDisabled||!1);let r=document.createElement("li");r.className="fi-dropdown-list-item fi-select-input-option",o&&r.classList.add("fi-disabled");let a=`fi-select-input-option-${Math.random().toString(36).substring(2,11)}`;if(r.id=a,r.setAttribute("role","option"),r.setAttribute("data-value",n),o&&r.setAttribute("aria-disabled","true"),this.isHtmlAllowed&&typeof s=="string"){let h=document.createElement("div");h.innerHTML=s;let u=h.textContent||h.innerText||s;r.setAttribute("aria-label",u)}let l=this.isMultiple?Array.isArray(this.state)&&this.state.includes(n):this.state===n;r.setAttribute("aria-selected",l?"true":"false");let c=document.createElement("span");return this.isHtmlAllowed?c.innerHTML=s:c.textContent=s,r.appendChild(c),o||r.addEventListener("click",h=>{h.preventDefault(),h.stopPropagation(),this.selectOption(n)}),r}async updateSelectedDisplay(){if(this.isDestroyed)return;this.selectedDisplayVersion=this.selectedDisplayVersion+1;let t=this.selectedDisplayVersion,e=document.createDocumentFragment();if(this.isMultiple){if(!Array.isArray(this.state)||this.state.length===0){let s=document.createElement("span");s.textContent=this.placeholder,s.classList.add("fi-select-input-placeholder"),e.appendChild(s)}else{let s=await this.getLabelsForMultipleSelection();if(t!==this.selectedDisplayVersion)return;this.addBadgesForSelectedOptions(s,e)}t===this.selectedDisplayVersion&&(e.querySelector(".fi-select-input-value-badges-ctn")||this.destroyBadgesSortable(),this.commitSelectedDisplay(e),this.isOpen&&this.deferPositionDropdown());return}if(this.state===null||this.state===""){let s=document.createElement("span");if(s.textContent=this.placeholder,s.classList.add("fi-select-input-placeholder"),e.appendChild(s),t===this.selectedDisplayVersion){this.destroyBadgesSortable(),this.commitSelectedDisplay(e);let o=this.container.querySelector(".fi-select-input-value-remove-btn");o&&o.remove(),this.container.classList.remove("fi-select-input-ctn-clearable")}return}let n=await this.getLabelForSingleSelection();t===this.selectedDisplayVersion&&(this.addSingleSelectionDisplay(n,e),t===this.selectedDisplayVersion&&(this.destroyBadgesSortable(),this.commitSelectedDisplay(e)))}commitSelectedDisplay(t){let e=this.selectedDisplay.contains(document.activeElement)?document.activeElement:null,n=e?.closest("[data-value]")?.dataset.value;this.selectedDisplay.replaceChildren(t),this.updateSelectionSummary(),e&&(this.isOpen?this.getFocusOwner():this.selectedDisplay.querySelector(`[data-value="${CSS.escape(n??"")}"] button`)??this.selectButton).focus()}updateSelectionSummary(){this.selectionSummary.textContent=Array.from(this.selectedDisplay.querySelectorAll(".fi-badge-label, .fi-select-input-value-label, .fi-select-input-placeholder"),t=>t.textContent).join(", ")}async getLabelsForMultipleSelection(){let t=this.selectedDisplayVersion,e=this.getSelectedOptionLabels(),n=[];if(Array.isArray(this.state)){for(let o of this.state)if(!H(this.labelRepository[o])){if(H(e[o])){this.labelRepository[o]=e[o];continue}n.push(o.toString())}}if(n.length>0&&H(this.initialOptionLabels)&&JSON.stringify(this.state)===JSON.stringify(this.initialState)){if(Array.isArray(this.initialOptionLabels))for(let o of this.initialOptionLabels)H(o)&&o.value!==void 0&&o.label!==void 0&&n.includes(o.value)&&(this.labelRepository[o.value]=o.label)}else if(n.length>0&&this.getOptionLabelsUsing)try{let o=await this.getOptionLabelsUsing();if(this.isDestroyed||t!==this.selectedDisplayVersion)return[];for(let r of o)H(r)&&r.value!==void 0&&r.label!==void 0&&(this.labelRepository[r.value]=r.label)}catch(o){console.error("Error fetching option labels:",o)}let s=[];if(Array.isArray(this.state))for(let o of this.state)H(this.labelRepository[o])?s.push(this.labelRepository[o]):H(e[o])?s.push(e[o]):s.push(o);return s}createBadgeElement(t,e){let n=document.createElement("span");n.className="fi-badge fi-size-md fi-color fi-color-primary fi-text-color-700 dark:fi-text-color-200",H(t)&&n.setAttribute("data-value",t);let s=document.createElement("span");s.className="fi-badge-label-ctn";let o=document.createElement("span");o.className="fi-badge-label",this.canOptionLabelsWrap&&o.classList.add("fi-wrapped"),this.isHtmlAllowed?o.innerHTML=e:o.textContent=e,s.appendChild(o),n.appendChild(s);let r=this.createRemoveButton(t,e);return n.appendChild(r),n}createRemoveButton(t,e){let n=document.createElement("button");n.type="button",n.className="fi-badge-delete-btn",n.setAttribute("aria-label",this.removeButtonLabel.replace(":label",this.isHtmlAllowed?e.replace(/<[^>]*>/g,""):e));let s=document.createElement("span");return s.className="fi-badge-delete-btn-icon",s.setAttribute("aria-hidden","true"),n.appendChild(s),this.isDisabled&&(n.setAttribute("disabled","disabled"),n.classList.add("fi-disabled")),n.addEventListener("click",o=>{if(o.stopPropagation(),H(t)){let r=Array.from(this.selectedDisplay.querySelectorAll(".fi-badge-delete-btn")),a=r.indexOf(n),l=this.isOpen?this.getFocusOwner():r[a+1]??r[a-1]??this.selectButton;this.selectOption(t),this.isDisabled||l.focus()}}),n.addEventListener("keydown",o=>{(o.key===" "||o.key==="Enter")&&(o.preventDefault(),o.stopPropagation(),n.click())}),n}addBadgesForSelectedOptions(t,e=this.selectedDisplay){let n=document.createElement("div");n.className="fi-select-input-value-badges-ctn",t.forEach((s,o)=>{let r=Array.isArray(this.state)?this.state[o]:null,a=this.createBadgeElement(r,s);n.appendChild(a)}),e.appendChild(n),this.isReorderable&&(n.addEventListener("click",s=>{s.stopPropagation()}),n.addEventListener("mousedown",s=>{s.stopPropagation()}),this.destroyBadgesSortable(),this.badgesSortable=new Qi(n,{animation:150,disabled:this.isDisabled,onEnd:()=>{let s=[];n.querySelectorAll("[data-value]").forEach(o=>{s.push(o.getAttribute("data-value"))}),this.state=s,this.updateSelectionSummary(),this.onStateChange(this.state)}}))}destroyBadgesSortable(){this.badgesSortable?.destroy(),this.badgesSortable=null}async getLabelForSingleSelection(){let t=this.state,e=this.selectedDisplayVersion,n=this.labelRepository[this.state];if(ne(n)&&(n=this.getSelectedOptionLabel(this.state)),ne(n)&&H(this.initialOptionLabel)&&this.state===this.initialState)n=this.initialOptionLabel,H(this.state)&&(this.labelRepository[this.state]=n);else if(ne(n)&&this.getOptionLabelUsing)try{if(n=await this.getOptionLabelUsing(),this.isDestroyed||e!==this.selectedDisplayVersion||t!==this.state)return null;H(n)&&H(this.state)&&(this.labelRepository[t]=n)}catch(s){console.error("Error fetching option label:",s),n=this.state}else ne(n)&&(n=this.state);return n}addSingleSelectionDisplay(t,e=this.selectedDisplay){let n=document.createElement("span");if(n.className="fi-select-input-value-label",this.isHtmlAllowed?n.innerHTML=t:n.textContent=t,e.appendChild(n),!this.canSelectPlaceholder||this.container.querySelector(".fi-select-input-value-remove-btn"))return;let s=document.createElement("button");s.type="button",s.className="fi-select-input-value-remove-btn",s.setAttribute("aria-label",this.clearButtonLabel),this.isDisabled&&(s.setAttribute("disabled","disabled"),s.classList.add("fi-disabled")),s.addEventListener("click",o=>{o.stopPropagation(),this.selectOption("")}),s.addEventListener("keydown",o=>{(o.key===" "||o.key==="Enter")&&(o.preventDefault(),o.stopPropagation(),this.selectOption(""))}),this.container.appendChild(s),this.container.classList.add("fi-select-input-ctn-clearable")}getSelectedOptionLabel(t){if(H(this.labelRepository[t]))return this.labelRepository[t];let e="";for(let n of this.options)if(n.options&&Array.isArray(n.options)){for(let s of n.options)if(s.value===t){e=s.label,this.labelRepository[t]=e;break}}else if(n.value===t){e=n.label,this.labelRepository[t]=e;break}return e}setUpEventListeners(){this.buttonClickListener=()=>{this.toggleDropdown()},this.documentClickListener=t=>{!this.container.contains(t.target)&&this.isOpen&&this.closeDropdown()},this.buttonKeydownListener=t=>{this.isDisabled||this.handleSelectButtonKeydown(t)},this.dropdownKeydownListener=t=>{this.isDisabled||this.handleDropdownKeydown(t)},this.focusinListener=()=>this.syncActiveDescendant(),this.focusoutListener=t=>{this.selectButton.removeAttribute("aria-activedescendant"),this.searchInput?.removeAttribute("aria-activedescendant"),queueMicrotask(()=>{this.isDestroyed||!this.isOpen||(this.isTabbing||!this.container.contains(t.relatedTarget))&&(this.isTabbing=!1,this.closeDropdown())})},this.dropdownEscapeListener=t=>{this.isOpen&&(this.closeDropdown(),this.selectButton.focus(),t.preventDefault(),t.stopPropagation())},this.selectButton.addEventListener("click",this.buttonClickListener),document.addEventListener("click",this.documentClickListener),this.selectButton.addEventListener("keydown",this.buttonKeydownListener),this.dropdown.addEventListener("keydown",this.dropdownKeydownListener),this.container.addEventListener("focusin",this.focusinListener),this.container.addEventListener("focusout",this.focusoutListener),this.element.addEventListener("dropdown-escape",this.dropdownEscapeListener),!this.isMultiple&&this.livewireId&&this.statePath&&this.getOptionLabelUsing&&(this.refreshOptionLabelListener=async t=>{if(t.detail.livewireId===this.livewireId&&t.detail.statePath===this.statePath&&H(this.state))try{let e=this.state,n=++this.selectedDisplayVersion;delete this.labelRepository[this.state];let s=await this.getOptionLabelUsing();if(this.isDestroyed||e!==this.state||n!==this.selectedDisplayVersion)return;this.updateOptionLabelInList(this.state,s),this.updateSelectedDisplay()}catch(e){console.error("Error refreshing option label:",e)}},window.addEventListener("filament-forms::select.refreshSelectedOptionLabel",this.refreshOptionLabelListener))}updateOptionLabelInList(t,e){this.labelRepository[t]=e;let n=this.getVisibleOptions();for(let s of n)if(s.getAttribute("data-value")===String(t)){if(s.innerHTML="",this.isHtmlAllowed){let o=document.createElement("span");o.innerHTML=e,s.appendChild(o),s.setAttribute("aria-label",o.textContent||o.innerText||e)}else s.appendChild(document.createTextNode(e));break}for(let s of this.options)if(s.options&&Array.isArray(s.options)){for(let o of s.options)if(o.value===t){o.label=e;break}}else if(s.value===t){s.label=e;break}for(let s of this.originalOptions)if(s.options&&Array.isArray(s.options)){for(let o of s.options)if(o.value===t){o.label=e;break}}else if(s.value===t){s.label=e;break}}handleSelectButtonKeydown(t){if(!(t.isComposing||t.keyCode===229)){if((!this.isOpen||this.isSearchable)&&["Enter"," ","ArrowDown","ArrowUp"].includes(t.key)){t.preventDefault(),t.stopPropagation(),this.openDropdown();return}this.handleDropdownKeydown(t)}}handleDropdownKeydown(t){if(t.isComposing||t.keyCode===229)return;let e=t.target===this.searchInput,n=this.getEnabledOptions();switch(t.key){case"ArrowDown":t.preventDefault(),t.stopPropagation(),this.focusNextOption();break;case"ArrowUp":t.preventDefault(),t.stopPropagation(),this.focusPreviousOption();break;case" ":if(e)return;case"Enter":if(!this.isOpen)return;t.preventDefault(),t.stopPropagation();let s=n.find(o=>o.dataset.value===this.activeValue)??(e?n[0]:null);s&&this.selectOption(s.dataset.value);break;case"Escape":if(!this.isOpen)return;t.preventDefault(),t.stopPropagation(),this.closeDropdown(),this.selectButton.focus();break;case"Tab":this.isTabbing=this.isOpen;break;case"Home":case"End":if(e||!this.isOpen)return;t.preventDefault(),t.stopPropagation(),this.setActiveOption(t.key==="Home"?n[0]:n.at(-1));break;default:if(!e&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&typeof t.key=="string"&&t.key.length===1)if(t.preventDefault(),this.isOpen||this.openDropdown(),this.isSearchable)this.searchInput.value=(this.searchInput.value||"")+t.key,this.searchInput.dispatchEvent(new Event("input",{bubbles:!0}));else{let o=Date.now();this.typeahead=(o-this.typeaheadTime<1e3?this.typeahead:"")+dt(t.key),this.typeaheadTime=o;let r=this.getEnabledOptions().find(a=>dt(a.textContent.trim()).startsWith(this.typeahead));r&&this.setActiveOption(r)}break}}toggleDropdown(){if(!this.isDisabled){if(this.isOpen){this.closeDropdown();return}this.openDropdown()}}async openDropdown(){if(this.isDestroyed||this.isDisabled)return;if(this.isOpen){this.getFocusOwner().focus();return}let t=++this.openId,e=++this.activeSearchId;this.typeahead="",this.hasOptionsError=!1;let n=`${this.selectButton.offsetWidth}px`;this.dropdown.style.display="block",this.dropdown.style.opacity="0";let s=this.selectButton.closest(".fi-fixed-positioning-context")!==null&&this.selectButton.closest(".fi-absolute-positioning-context")===null;if(this.dropdown.style.position=s?"fixed":"absolute",this.dropdown.style.width=n,this.selectButton.setAttribute("aria-expanded","true"),this.searchInput?.setAttribute("aria-expanded","true"),this.isOpen=!0,this.isTabbing=!1,this.getFocusOwner().focus(),this.positionDropdown(),this.resizeListener||(this.resizeListener=()=>{this.dropdown.style.width=`${this.selectButton.offsetWidth}px`,this.positionDropdown()},window.addEventListener("resize",this.resizeListener)),this.scrollListener||(this.scrollListener=()=>this.positionDropdown(),window.addEventListener("scroll",this.scrollListener,!0)),this.dropdown.style.opacity="1",this.isSearchable&&this.searchInput&&(this.searchInput.value="",this.searchQuery=""),this.hasDynamicOptions||(this.options=JSON.parse(JSON.stringify(this.originalOptions)),this.renderOptions()),this.hasDynamicOptions&&this.getOptionsUsing){this.isLoadingOptions=!0,this.showLoadingState(!1);try{let o=await this.getOptionsUsing();if(this.isDestroyed||!this.isOpen||t!==this.openId)return;this.isLoadingOptions=!1;let r=Array.isArray(o)?o:o&&Array.isArray(o.options)?o.options:[];this.originalOptions=JSON.parse(JSON.stringify(r)),(!this.searchQuery||!this.hasDynamicSearchResults)&&(this.populateLabelRepositoryFromOptions(r),this.searchQuery?this.filterOptions(this.searchQuery):(this.options=r,this.renderOptions(),this.positionDropdown()))}catch(o){if(this.isDestroyed||!this.isOpen||t!==this.openId||(this.isLoadingOptions=!1,this.searchQuery&&this.hasDynamicSearchResults&&e!==this.activeSearchId))return;console.error("Error fetching options:",o),this.showErrorMessage()}}else(!this.hasInitialNoOptionsMessage||this.searchQuery)&&this.hideLoadingState()}positionDropdown(){if(this.isDestroyed||!this.isOpen)return;let t=this.openId,e=this.position==="top"?"top-start":"bottom-start",n=[xi(4),Ai({padding:5})];this.position!=="top"&&this.position!=="bottom"&&n.push(Ci());let s=this.selectButton.closest(".fi-fixed-positioning-context")!==null&&this.selectButton.closest(".fi-absolute-positioning-context")===null;Li(this.selectButton,this.dropdown,{placement:e,middleware:n,strategy:s?"fixed":"absolute"}).then(({x:o,y:r})=>{this.isDestroyed||!this.isOpen||t!==this.openId||Object.assign(this.dropdown.style,{left:`${o}px`,top:`${r}px`})})}deferPositionDropdown(){this.isOpen&&(this.positioningRequestAnimationFrame&&(cancelAnimationFrame(this.positioningRequestAnimationFrame),this.positioningRequestAnimationFrame=null),this.positioningRequestAnimationFrame=requestAnimationFrame(()=>{this.positionDropdown(),this.positioningRequestAnimationFrame=null}))}closeDropdown(){this.dropdown.style.display="none",this.selectButton.setAttribute("aria-expanded","false"),this.searchInput?.setAttribute("aria-expanded","false"),this.isOpen=!1,this.openId++,this.searchTimeout&&(clearTimeout(this.searchTimeout),this.searchTimeout=null),this.activeSearchId++,this.isSearching=!1,this.isLoadingOptions=!1,this.hideLoadingState(),this.hideMaxItemsMessage(),this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null),this.scrollListener&&(window.removeEventListener("scroll",this.scrollListener,!0),this.scrollListener=null),this.setActiveOption(null)}focusNextOption(){let t=this.getEnabledOptions();if(t.length===0)return;let e=t.findIndex(n=>n.dataset.value===this.activeValue);this.setActiveOption(t[Math.min(e+1,t.length-1)])}focusPreviousOption(){let t=this.getEnabledOptions();if(t.length===0)return;let e=t.findIndex(n=>n.dataset.value===this.activeValue);this.setActiveOption(t[e<0?t.length-1:Math.max(e-1,0)])}scrollOptionIntoView(t){if(!t)return;let e=this.dropdown.getBoundingClientRect(),n=t.getBoundingClientRect();n.bottom>e.bottom?this.dropdown.scrollTop+=n.bottom-e.bottom:n.topt.getAttribute("aria-disabled")!=="true")}getFocusOwner(){return this.searchInput??this.selectButton}setActiveOption(t){this.activeValue=t?.dataset.value??null,this.getVisibleOptions().forEach(e=>e.classList.toggle("fi-selected",e===t)),this.syncActiveDescendant(),t&&this.isOpen&&this.scrollOptionIntoView(t)}syncActiveDescendant(){this.selectButton.removeAttribute("aria-activedescendant"),this.searchInput?.removeAttribute("aria-activedescendant");let t=this.getFocusOwner();if(!this.isOpen||document.activeElement!==t)return;let e=this.getEnabledOptions().find(n=>n.dataset.value===this.activeValue);e&&t.setAttribute("aria-activedescendant",e.id)}setAccessibilityAttributes(t){this.accessibilityAttributes=t;for(let s of["aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-busy","aria-required"]){let o=t[s];for(let r of[this.selectButton,this.searchInput].filter(Boolean))H(o)?r.setAttribute(s,o):r.removeAttribute(s)}!this.selectButton.hasAttribute("aria-label")&&!this.selectButton.hasAttribute("aria-labelledby")&&H(this.ariaLabel)&&this.selectButton.setAttribute("aria-label",this.ariaLabel);let e=(this.selectButton.getAttribute("aria-labelledby")??"").split(/\s+/).map(s=>document.getElementById(s)?.textContent??"").join(" ").trim()||this.selectButton.getAttribute("aria-label")||Array.from(this.selectButton.labels??[],s=>s.textContent).join(" ").trim();this.optionsList.setAttribute("aria-label",e),this.isSearchable&&(this.searchInput.removeAttribute("aria-labelledby"),this.searchInput.setAttribute("aria-label",`${e}: ${this.searchLabel}`),this.selectButton.removeAttribute("aria-required"));let n=[t["aria-describedby"],this.selectionSummary.id].filter(Boolean).join(" ").split(/\s+/);this.selectButton.setAttribute("aria-describedby",[...new Set(n)].join(" "))}getSelectedOptionLabels(){if(!Array.isArray(this.state)||this.state.length===0)return{};let t={};for(let e of this.state){let n=!1;for(let s of this.options)if(s.options&&Array.isArray(s.options)){for(let o of s.options)if(o.value===e){t[e]=o.label,n=!0;break}if(n)break}else if(s.value===e){t[e]=s.label;break}}return t}handleSearch(t){if(this.isDestroyed||!this.isOpen)return;let e=t.target.value.trim();this.searchQuery=e,this.hasOptionsError=!1;let n=++this.activeSearchId;if(this.setActiveOption(null),this.searchTimeout&&clearTimeout(this.searchTimeout),e===""){if(this.isSearching=!1,this.isLoadingOptions){this.showLoadingState();return}this.hideLoadingState(),this.options=JSON.parse(JSON.stringify(this.originalOptions)),this.renderOptions(),this.positionDropdown();return}if(!this.getSearchResultsUsing||typeof this.getSearchResultsUsing!="function"||!this.hasDynamicSearchResults){this.isSearching=!1,this.filterOptions(e);return}this.isSearching=!0,this.showLoadingState(!0),this.searchTimeout=setTimeout(async()=>{this.searchTimeout=null;try{let s=await this.getSearchResultsUsing(e);if(this.isDestroyed||n!==this.activeSearchId||!this.isOpen)return;let o=Array.isArray(s)?s:s&&Array.isArray(s.options)?s.options:[];this.options=o,this.populateLabelRepositoryFromOptions(o),this.isSearching=!1,this.hideLoadingState(),this.renderOptions(),this.isOpen&&this.deferPositionDropdown(),this.options.length===0&&this.showNoResultsMessage()}catch(s){!this.isDestroyed&&this.isOpen&&n===this.activeSearchId&&(console.error("Error fetching search results:",s),this.showErrorMessage())}finally{n===this.activeSearchId&&(this.isSearching=!1)}},this.searchDebounce)}showLoadingState(t=!1){this.setActiveOption(null),this.optionsList.hidden=!0,this.hideLoadingState(),this.optionsList.setAttribute("aria-busy","true");let e=document.createElement("div");e.className="fi-select-input-message",e.textContent=t?this.searchingMessage:this.loadingMessage,this.dropdown.appendChild(e),this.isOpen&&(this.deferPositionDropdown(),this.statusRegion.textContent=e.textContent),this.positionDropdown()}hideLoadingState(){this.optionsList.removeAttribute("aria-busy");let t=this.dropdown.querySelector(".fi-select-input-message");t&&(t.remove(),this.statusRegion.textContent="")}showNoOptionsMessage(){this.setActiveOption(null),this.optionsList.hidden=!0,this.hideLoadingState();let t=document.createElement("div");t.className="fi-select-input-message",t.textContent=this.noOptionsMessage,this.dropdown.appendChild(t),this.isOpen&&(this.deferPositionDropdown(),this.statusRegion.textContent=this.noOptionsMessage)}showNoResultsMessage(){this.setActiveOption(null),this.optionsList.hidden=!0,this.hideLoadingState();let t=document.createElement("div");t.className="fi-select-input-message",t.textContent=this.noSearchResultsMessage,this.dropdown.appendChild(t),this.isOpen&&(this.deferPositionDropdown(),this.statusRegion.textContent=this.noSearchResultsMessage)}showErrorMessage(){this.hasOptionsError=!0,this.showLoadingState(),this.optionsList.removeAttribute("aria-busy"),this.dropdown.querySelector(".fi-select-input-message").textContent=this.errorMessage,this.statusRegion.textContent=this.errorMessage,this.positionDropdown()}showMaxItemsMessage(){this.hideMaxItemsMessage(),this.maxItemsMessageElement=document.createElement("div"),this.maxItemsMessageElement.className="fi-select-input-max-items-message",this.maxItemsMessageElement.textContent=this.maxItemsMessage,this.optionsList.parentNode===this.dropdown?this.dropdown.insertBefore(this.maxItemsMessageElement,this.optionsList):this.dropdown.appendChild(this.maxItemsMessageElement),this.deferPositionDropdown(),this.statusRegion.textContent=this.maxItemsMessage}hideMaxItemsMessage(){this.maxItemsMessageElement&&(this.maxItemsMessageElement.remove(),this.maxItemsMessageElement=null,this.statusRegion.textContent===this.maxItemsMessage&&(this.statusRegion.textContent=""))}filterOptions(t){let e=this.searchableOptionFields.includes("label"),n=this.searchableOptionFields.includes("value");t=dt(t);let s=[];for(let o of this.originalOptions)if(o.options&&Array.isArray(o.options)){let r=o.options.filter(a=>e&&dt(a.label).includes(t)||n&&dt(String(a.value)).includes(t));r.length>0&&s.push({label:o.label,options:r})}else(e&&dt(o.label).includes(t)||n&&dt(String(o.value)).includes(t))&&s.push(o);this.options=s,this.renderOptions(),this.isOpen&&this.positionDropdown()}selectOption(t){if(this.isDisabled)return;if(!this.isMultiple){let n=this.container.contains(document.activeElement);this.state=t,this.updateSelectedDisplay(),this.renderOptions(),this.closeDropdown(),n&&this.selectButton.focus(),this.onStateChange(this.state);return}let e=Array.isArray(this.state)?[...this.state]:[];if(e.includes(t)){this.state=e.filter(n=>n!==t),this.updateSelectedDisplay(),this.hideMaxItemsMessage(),this.renderOptions(),this.isOpen&&this.deferPositionDropdown(),this.maintainFocusInMultipleMode(),this.updateSelectionSummary(),this.onStateChange(this.state);return}if(this.maxItems&&e.length>=this.maxItems){this.maxItemsMessage&&this.showMaxItemsMessage();return}this.hideMaxItemsMessage(),e.push(t),this.state=e,this.updateSelectedDisplay(),this.renderOptions(),this.isOpen&&this.deferPositionDropdown(),this.maintainFocusInMultipleMode(),this.onStateChange(this.state)}maintainFocusInMultipleMode(){this.isOpen&&this.container.contains(document.activeElement)&&this.getFocusOwner().focus()}disable(){this.isDisabled||(this.isDisabled=!0,this.applyDisabledState(),this.isOpen&&this.closeDropdown())}enable(){this.isDisabled&&(this.isDisabled=!1,this.applyDisabledState())}applyDisabledState(){if(this.badgesSortable?.option("disabled",this.isDisabled),this.isDisabled){if(this.selectButton.setAttribute("disabled","disabled"),this.selectButton.setAttribute("aria-disabled","true"),this.selectButton.classList.add("fi-disabled"),this.isMultiple&&this.container.querySelectorAll(".fi-badge-delete-btn").forEach(e=>{e.setAttribute("disabled","disabled"),e.classList.add("fi-disabled")}),!this.isMultiple&&this.canSelectPlaceholder){let t=this.container.querySelector(".fi-select-input-value-remove-btn");t&&(t.setAttribute("disabled","disabled"),t.classList.add("fi-disabled"))}this.isSearchable&&this.searchInput&&(this.searchInput.setAttribute("disabled","disabled"),this.searchInput.classList.add("fi-disabled"))}else{if(this.selectButton.removeAttribute("disabled"),this.selectButton.removeAttribute("aria-disabled"),this.selectButton.classList.remove("fi-disabled"),this.isMultiple&&this.container.querySelectorAll(".fi-badge-delete-btn").forEach(e=>{e.removeAttribute("disabled"),e.classList.remove("fi-disabled")}),!this.isMultiple&&this.canSelectPlaceholder){let t=this.container.querySelector(".fi-select-input-value-remove-btn");t&&(t.removeAttribute("disabled"),t.classList.remove("fi-disabled"))}this.isSearchable&&this.searchInput&&(this.searchInput.removeAttribute("disabled"),this.searchInput.classList.remove("fi-disabled"))}}destroy(){this.isDestroyed=!0,this.openId++,this.activeSearchId++,this.selectedDisplayVersion++,this.destroyBadgesSortable(),this.selectButton&&this.buttonClickListener&&this.selectButton.removeEventListener("click",this.buttonClickListener),this.documentClickListener&&document.removeEventListener("click",this.documentClickListener),this.selectButton&&this.buttonKeydownListener&&this.selectButton.removeEventListener("keydown",this.buttonKeydownListener),this.dropdown&&this.dropdownKeydownListener&&this.dropdown.removeEventListener("keydown",this.dropdownKeydownListener),this.dropdownEscapeListener&&this.element.removeEventListener("dropdown-escape",this.dropdownEscapeListener),this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null),this.scrollListener&&(window.removeEventListener("scroll",this.scrollListener,!0),this.scrollListener=null),this.refreshOptionLabelListener&&window.removeEventListener("filament-forms::select.refreshSelectedOptionLabel",this.refreshOptionLabelListener),this.isOpen&&this.closeDropdown(),this.searchTimeout&&(clearTimeout(this.searchTimeout),this.searchTimeout=null),this.container&&this.container.remove()}};function Qe({name:i,recordKey:t,state:e,messages:n}){let s=o=>o.method==="updateTableColumnState"&&o.params[0]===i&&String(o.params[1])===String(t);return{error:void 0,isLoading:!1,isDestroyed:!1,isRefreshing:!1,hasRenderedState:!1,state:e,status:void 0,unsubscribeLivewireHook:null,unsubscribeRequestHook:null,initEditableColumn(){this.unsubscribeLivewireHook=Livewire.interceptMessage(({message:o,onSuccess:r})=>{if(o.component.id!==this.$wire.$id)return;let a=o.calls.some(s),l=this.isRefreshing;r(({payload:c,onMorphed:h})=>h(()=>{let u=c.effects,f=!!u.html||this.isRenderedByPartial(u.partials);(a||l)&&(this.hasRenderedState=f),l&&(this.isRefreshing=!1),f&&this.$nextTick(()=>{!this.isDestroyed&&!this.isLoading&&this.syncServerState()})}))}),this.$watch("state",async()=>{let o=this.getServerState();if(!(this.isDestroyed||this.isLoading||o===void 0||this.getNormalizedState()===o)){this.clearError(),this.isLoading=!0,this.hasRenderedState=!1,this.status=n?.saving,this.unsubscribeRequestHook=Livewire.interceptRequest(({request:r,onResponse:a})=>{r.payload.components.some(l=>JSON.parse(l.snapshot).memo.id===this.$wire.$id&&(this.isRefreshing||l.calls.some(s)))&&a(({response:l})=>{let c=l.text.bind(l);l.text=async()=>{try{return await c()}catch(h){throw r.cancel(),this.handleSaveFailure(),h}}})});try{let r=await this.$wire.updateTableColumnState(i,t,this.state);if(await this.$nextTick(),!this.isDestroyed&&!this.hasRenderedState&&(this.isRefreshing=!0,await this.$wire.$refresh(),await this.$nextTick(),!this.hasRenderedState)){this.handleSaveFailure();return}if(this.unsubscribeRequestHook?.(),this.unsubscribeRequestHook=null,this.isDestroyed)return;this.error=r?.error??void 0,this.status=this.error??n?.saved,this.isLoading=!1,this.syncServerState()}catch{this.handleSaveFailure()}}})},isRenderedByPartial(o){if(!o)return!1;let r=this.$el.closest("[wire\\:partial]");for(;r;){if(Object.hasOwn(o,r.getAttribute("wire:partial")))return!0;r=r.parentElement?.closest("[wire\\:partial]")}return!1},syncServerState(){let o=this.getServerState();o!==void 0&&(this.state=o)},getNormalizedState(){return Alpine.raw(this.state)??""},clearError(){this.isLoading||(this.error=void 0,this.status=void 0)},handleSaveFailure(){this.unsubscribeRequestHook?.(),this.unsubscribeRequestHook=null,!this.isDestroyed&&(this.error=n?.failure??"The save could not be confirmed. Refresh the page before trying again.",this.status=this.error,this.isRefreshing=!1,this.isLoading=!1)},preventEdit(o){!this.isLoading||o.type==="keydown"&&["Tab","Escape"].includes(o.key)||(o.preventDefault(),o.stopImmediatePropagation())},getAccessibilityAttributes(o={}){return{...o,"aria-invalid":this.error?"true":o["aria-invalid"]??null,"aria-busy":this.isLoading?"true":o["aria-busy"]??null,"aria-describedby":[o["aria-describedby"],this.error&&n?this.$id("table-column-error"):null].filter(Boolean).join(" ")||null}},destroy(){this.isDestroyed=!0,this.unsubscribeLivewireHook?.(),this.unsubscribeRequestHook?.(),this.unsubscribeRequestHook=null}}}function is({accessibilityAttributes:i,ariaLabel:t,canOptionLabelsWrap:e,canSelectPlaceholder:n,clearButtonLabel:s,errorMessage:o,hasDynamicOptions:r,hasDynamicSearchResults:a,hasInitialNoOptionsMessage:l,initialOptionLabel:c,isDisabled:h,isHtmlAllowed:u,isNative:f,isSearchable:p,loadingMessage:m,messages:g,name:w,noOptionsMessage:x,noSearchResultsMessage:S,options:A,optionsLimit:D,placeholder:_,position:C,recordKey:V,searchableOptionFields:J,searchDebounce:I,searchingMessage:W,searchLabel:j,searchPrompt:tt,state:z}){let P=Qe({name:w,recordKey:V,state:z,messages:g});return{...P,select:null,init(){if(!f){this.select=new Ae({accessibilityAttributes:i,ariaLabel:t,canOptionLabelsWrap:e,canSelectPlaceholder:n,clearButtonLabel:s,element:this.$refs.select,errorMessage:o,getOptionLabelUsing:()=>this.$wire.callTableColumnMethod(w,V,"getOptionLabel"),getOptionsUsing:()=>Livewire.fireAction(this.$wire.__instance,"callTableColumnMethod",[w,V,"getOptionsForJs"],{async:!0}),getSearchResultsUsing:L=>Livewire.fireAction(this.$wire.__instance,"callTableColumnMethod",[w,V,"getOptionsSearchResultsForJs",{search:L}],{async:!0}),hasDynamicOptions:r,hasDynamicSearchResults:a,hasInitialNoOptionsMessage:l,initialOptionLabel:c,initialState:this.state,isDisabled:h,isHtmlAllowed:u,isSearchable:p,loadingMessage:m,noOptionsMessage:x,noSearchResultsMessage:S,onStateChange:L=>{this.clearError(),this.state=L},options:A,optionsLimit:D,placeholder:_,position:C,searchableOptionFields:J,searchDebounce:I,searchingMessage:W,searchLabel:j,searchPrompt:tt,state:this.state});let N=()=>{this.select.setAccessibilityAttributes(this.getAccessibilityAttributes(i)),this.select.selectButton.setAttribute("aria-disabled",this.isLoading||this.select.isDisabled?"true":"false")};this.$watch("error",N),this.$watch("isLoading",N)}this.initEditableColumn(),this.$watch("state",N=>{!f&&this.select&&this.select.state!==N&&(this.select.state=N,this.select.updateSelectedDisplay(),this.select.renderOptions())})},syncServerState(){if(!f&&this.select&&this.$refs.serverState?.hasAttribute("data-option-label")){let N=this.getServerState(),L=this.$refs.serverState.dataset.optionLabel;this.select.labelRepository[N]!==L&&(this.select.updateOptionLabelInList(N,L),this.select.state===N&&this.select.updateSelectedDisplay())}P.syncServerState.call(this),!f&&this.select&&this.$refs.serverState?.hasAttribute("data-disabled")&&(this.$refs.serverState.dataset.disabled==="true"?this.select.disable():this.select.enable())},getServerState(){if(this.$refs.serverState)return[null,void 0].includes(this.$refs.serverState.value)?"":this.$refs.serverState.value.replaceAll('\\"','"')},destroy(){P.destroy.call(this),this.select&&(this.select.destroy(),this.select=null)}}}export{is as default}; /*! Bundled license information: sortablejs/modular/sortable.esm.js: (**! * Sortable 1.15.7 * @author RubaXa * @author owenm * @license MIT *) */