(()=>{function le(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);t&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),e.push.apply(e,o)}return e}function G(n){for(var t=1;t=0)&&(e[i]=n[i]);return e}function xe(n,t){if(n==null)return{};var e=Me(n,t),o,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);for(i=0;i=0)&&(!Object.prototype.propertyIsEnumerable.call(n,o)||(e[o]=n[o]))}return e}var Fe="1.14.0";function q(n){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(n)}var $=q(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),bt=q(/Edge/i),se=q(/firefox/i),wt=q(/safari/i)&&!q(/chrome/i)&&!q(/android/i),ue=q(/iP(ad|od|hone)/i),Re=q(/chrome/i)&&q(/android/i),ce={capture:!1,passive:!1};function w(n,t,e){n.addEventListener(t,e,!$&&ce)}function b(n,t,e){n.removeEventListener(t,e,!$&&ce)}function Nt(n,t){if(!!t){if(t[0]===">"&&(t=t.substring(1)),n)try{if(n.matches)return n.matches(t);if(n.msMatchesSelector)return n.msMatchesSelector(t);if(n.webkitMatchesSelector)return n.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function ke(n){return n.host&&n!==document&&n.host.nodeType?n.host:n.parentNode}function W(n,t,e,o){if(n){e=e||document;do{if(t!=null&&(t[0]===">"?n.parentNode===e&&Nt(n,t):Nt(n,t))||o&&n===e)return n;if(n===e)break}while(n=ke(n))}return null}var fe=/\s+/g;function x(n,t,e){if(n&&t)if(n.classList)n.classList[e?"add":"remove"](t);else{var o=(" "+n.className+" ").replace(fe," ").replace(" "+t+" "," ");n.className=(o+(e?" "+t:"")).replace(fe," ")}}function h(n,t,e){var o=n&&n.style;if(o){if(e===void 0)return document.defaultView&&document.defaultView.getComputedStyle?e=document.defaultView.getComputedStyle(n,""):n.currentStyle&&(e=n.currentStyle),t===void 0?e:e[t];!(t in o)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),o[t]=e+(typeof e=="string"?"":"px")}}function lt(n,t){var e="";if(typeof n=="string")e=n;else do{var o=h(n,"transform");o&&o!=="none"&&(e=o+" "+e)}while(!t&&(n=n.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(e)}function de(n,t,e){if(n){var o=n.getElementsByTagName(t),i=0,r=o.length;if(e)for(;i=r:a=i<=r,!a)return o;if(o===K())break;o=Q(o,!1)}return!1}function st(n,t,e,o){for(var i=0,r=0,a=n.children;r2&&arguments[2]!==void 0?arguments[2]:{},i=o.evt,r=xe(o,Ke);Et.pluginEvent.bind(p)(t,e,G({dragEl:c,parentEl:D,ghostEl:g,rootEl:S,nextEl:it,lastDownEl:Pt,cloneEl:_,cloneHidden:J,dragStarted:Dt,putSortable:T,activeSortable:p.active,originalEvent:i,oldIndex:ct,oldDraggableIndex:St,newIndex:R,newDraggableIndex:tt,hideGhostForTarget:_e,unhideGhostForTarget:Ce,cloneNowHidden:function(){J=!0},cloneNowShown:function(){J=!1},dispatchSortableEvent:function(l){N({sortable:e,name:l,originalEvent:i})}},r))};function N(n){We(G({putSortable:T,cloneEl:_,targetEl:c,rootEl:S,oldIndex:ct,oldDraggableIndex:St,newIndex:R,newDraggableIndex:tt},n))}var c,D,g,S,it,Pt,_,J,ct,R,St,tt,Mt,T,ft=!1,xt=!1,Ft=[],rt,B,Ut,qt,be,we,Dt,dt,_t,Ct=!1,Rt=!1,kt,A,$t=[],Vt=!1,Xt=[],Yt=typeof document!="undefined",Bt=ue,ye=bt||$?"cssFloat":"float",je=Yt&&!Re&&!ue&&"draggable"in document.createElement("div"),Ee=function(){if(!!Yt){if($)return!1;var n=document.createElement("x");return n.style.cssText="pointer-events:auto",n.style.pointerEvents==="auto"}}(),Se=function(t,e){var o=h(t),i=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),r=st(t,0,e),a=st(t,1,e),l=r&&h(r),s=a&&h(a),u=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+O(r).width,d=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+O(a).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 f=l.float==="left"?"left":"right";return a&&(s.clear==="both"||s.clear===f)?"vertical":"horizontal"}return r&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||u>=i&&o[ye]==="none"||a&&o[ye]==="none"&&u+d>i)?"vertical":"horizontal"},ze=function(t,e,o){var i=o?t.left:t.top,r=o?t.right:t.bottom,a=o?t.width:t.height,l=o?e.left:e.top,s=o?e.right:e.bottom,u=o?e.width:e.height;return i===l||r===s||i+a/2===l+u/2},Ue=function(t,e){var o;return Ft.some(function(i){var r=i[F].options.emptyInsertThreshold;if(!(!r||Kt(i))){var a=O(i),l=t>=a.left-r&&t<=a.right+r,s=e>=a.top-r&&e<=a.bottom+r;if(l&&s)return o=i}}),o},De=function(t){function e(r,a){return function(l,s,u,d){var f=l.options.group.name&&s.options.group.name&&l.options.group.name===s.options.group.name;if(r==null&&(a||f))return!0;if(r==null||r===!1)return!1;if(a&&r==="clone")return r;if(typeof r=="function")return e(r(l,s,u,d),a)(l,s,u,d);var m=(a?l:s).options.group.name;return r===!0||typeof r=="string"&&r===m||r.join&&r.indexOf(m)>-1}}var o={},i=t.group;(!i||It(i)!="object")&&(i={name:i}),o.name=i.name,o.checkPull=e(i.pull,!0),o.checkPut=e(i.put),o.revertClone=i.revertClone,t.group=o},_e=function(){!Ee&&g&&h(g,"display","none")},Ce=function(){!Ee&&g&&h(g,"display","")};Yt&&document.addEventListener("click",function(n){if(xt)return n.preventDefault(),n.stopPropagation&&n.stopPropagation(),n.stopImmediatePropagation&&n.stopImmediatePropagation(),xt=!1,!1},!0);var at=function(t){if(c){t=t.touches?t.touches[0]:t;var e=Ue(t.clientX,t.clientY);if(e){var o={};for(var i in t)t.hasOwnProperty(i)&&(o[i]=t[i]);o.target=o.rootEl=e,o.preventDefault=void 0,o.stopPropagation=void 0,e[F]._onDragOver(o)}}},qe=function(t){c&&c.parentNode[F]._isOutsideThisEl(t.target)};function p(n,t){if(!(n&&n.nodeType&&n.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(n));this.el=n,this.options=t=U({},t),n[F]=this;var e={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(n.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Se(n,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(a,l){a.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:p.supportPointer!==!1&&"PointerEvent"in window&&!wt,emptyInsertThreshold:5};Et.initializePlugins(this,n,e);for(var o in e)!(o in t)&&(t[o]=e[o]);De(t);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=t.forceFallback?!1:je,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?w(n,"pointerdown",this._onTapStart):(w(n,"mousedown",this._onTapStart),w(n,"touchstart",this._onTapStart)),this.nativeDraggable&&(w(n,"dragover",this),w(n,"dragenter",this)),Ft.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),U(this,He())}p.prototype={constructor:p,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(dt=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,c):this.options.direction},_onTapStart:function(t){if(!!t.cancelable){var e=this,o=this.el,i=this.options,r=i.preventOnFilter,a=t.type,l=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,s=(l||t).target,u=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||s,d=i.filter;if(nn(o),!c&&!(/mousedown|pointerdown/.test(a)&&t.button!==0||i.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&wt&&s&&s.tagName.toUpperCase()==="SELECT")&&(s=W(s,i.draggable,o,!1),!(s&&s.animated)&&Pt!==s)){if(ct=k(s),St=k(s,i.draggable),typeof d=="function"){if(d.call(this,t,s,this)){N({sortable:e,rootEl:u,name:"filter",targetEl:s,toEl:o,fromEl:o}),P("filter",e,{evt:t}),r&&t.cancelable&&t.preventDefault();return}}else if(d&&(d=d.split(",").some(function(f){if(f=W(u,f.trim(),o,!1),f)return N({sortable:e,rootEl:f,name:"filter",targetEl:s,fromEl:o,toEl:o}),P("filter",e,{evt:t}),!0}),d)){r&&t.cancelable&&t.preventDefault();return}i.handle&&!W(u,i.handle,o,!1)||this._prepareDragStart(t,l,s)}}},_prepareDragStart:function(t,e,o){var i=this,r=i.el,a=i.options,l=r.ownerDocument,s;if(o&&!c&&o.parentNode===r){var u=O(o);if(S=r,c=o,D=c.parentNode,it=c.nextSibling,Pt=o,Mt=a.group,p.dragged=c,rt={target:c,clientX:(e||t).clientX,clientY:(e||t).clientY},be=rt.clientX-u.left,we=rt.clientY-u.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,c.style["will-change"]="all",s=function(){if(P("delayEnded",i,{evt:t}),p.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!se&&i.nativeDraggable&&(c.draggable=!0),i._triggerDragStart(t,e),N({sortable:i,name:"choose",originalEvent:t}),x(c,a.chosenClass,!0)},a.ignore.split(",").forEach(function(d){de(c,d.trim(),Zt)}),w(l,"dragover",at),w(l,"mousemove",at),w(l,"touchmove",at),w(l,"mouseup",i._onDrop),w(l,"touchend",i._onDrop),w(l,"touchcancel",i._onDrop),se&&this.nativeDraggable&&(this.options.touchStartThreshold=4,c.draggable=!0),P("delayStart",this,{evt:t}),a.delay&&(!a.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(bt||$))){if(p.eventCanceled){this._onDrop();return}w(l,"mouseup",i._disableDelayedDrag),w(l,"touchend",i._disableDelayedDrag),w(l,"touchcancel",i._disableDelayedDrag),w(l,"mousemove",i._delayedDragTouchMoveHandler),w(l,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&w(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(s,a.delay)}else s()}},_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(){c&&Zt(c),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;b(t,"mouseup",this._disableDelayedDrag),b(t,"touchend",this._disableDelayedDrag),b(t,"touchcancel",this._disableDelayedDrag),b(t,"mousemove",this._delayedDragTouchMoveHandler),b(t,"touchmove",this._delayedDragTouchMoveHandler),b(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?w(document,"pointermove",this._onTouchMove):e?w(document,"touchmove",this._onTouchMove):w(document,"mousemove",this._onTouchMove):(w(c,"dragend",this),w(S,"dragstart",this._onDragStart));try{document.selection?Lt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(o){}},_dragStarted:function(t,e){if(ft=!1,S&&c){P("dragStarted",this,{evt:e}),this.nativeDraggable&&w(document,"dragover",qe);var o=this.options;!t&&x(c,o.dragClass,!1),x(c,o.ghostClass,!0),p.active=this,t&&this._appendGhost(),N({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(B){this._lastX=B.clientX,this._lastY=B.clientY,_e();for(var t=document.elementFromPoint(B.clientX,B.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(B.clientX,B.clientY),t!==e);)e=t;if(c.parentNode[F]._isOutsideThisEl(t),e)do{if(e[F]){var o=void 0;if(o=e[F]._onDragOver({clientX:B.clientX,clientY:B.clientY,target:t,rootEl:e}),o&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Ce()}},_onTouchMove:function(t){if(rt){var e=this.options,o=e.fallbackTolerance,i=e.fallbackOffset,r=t.touches?t.touches[0]:t,a=g&<(g,!0),l=g&&a&&a.a,s=g&&a&&a.d,u=Bt&&A&&pe(A),d=(r.clientX-rt.clientX+i.x)/(l||1)+(u?u[0]-$t[0]:0)/(l||1),f=(r.clientY-rt.clientY+i.y)/(s||1)+(u?u[1]-$t[1]:0)/(s||1);if(!p.active&&!ft){if(o&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))=0&&(N({rootEl:D,name:"add",toEl:D,fromEl:S,originalEvent:t}),N({sortable:this,name:"remove",toEl:D,originalEvent:t}),N({rootEl:D,name:"sort",toEl:D,fromEl:S,originalEvent:t}),N({sortable:this,name:"sort",toEl:D,originalEvent:t})),T&&T.save()):R!==ct&&R>=0&&(N({sortable:this,name:"update",toEl:D,originalEvent:t}),N({sortable:this,name:"sort",toEl:D,originalEvent:t})),p.active&&((R==null||R===-1)&&(R=ct,tt=St),N({sortable:this,name:"end",toEl:D,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){P("nulling",this),S=c=D=g=it=_=Pt=J=rt=B=Dt=R=tt=ct=St=dt=_t=T=Mt=p.dragged=p.ghost=p.clone=p.active=null,Xt.forEach(function(t){t.checked=!0}),Xt.length=Ut=qt=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":c&&(this._onDragOver(t),$e(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,o=this.el.children,i=0,r=o.length,a=this.options;io.right+i||n.clientX<=o.right&&n.clientY>o.bottom&&n.clientX>=o.left:n.clientX>o.right&&n.clientY>o.top||n.clientX<=o.right&&n.clientY>o.bottom+i}function Je(n,t,e,o,i,r,a,l){var s=o?n.clientY:n.clientX,u=o?e.height:e.width,d=o?e.top:e.left,f=o?e.bottom:e.right,m=!1;if(!a){if(l&&ktd+u*r/2:sf-kt)return-_t}else if(s>d+u*(1-i)/2&&sf-u*r/2)?s>d+u/2?1:-1:0}function tn(n){return k(c){t.modifiers.length>0||(n.livewire_sortable=window.Sortable.create(n,{draggable:"[wire\\:sortable\\.item]",handle:n.querySelector("[wire\\:sortable\\.handle]")?"[wire\\:sortable\\.handle]":null,sort:!0,dataIdAttr:"wire:sortable.item",group:{name:n.getAttribute("wire:sortable"),pull:!1,put:!1},store:{set:function(o){let i=o.toArray().map((r,a)=>({order:a+1,value:r}));e.call(t.method,i)}}}))});window.Livewire.directive("sortable-group",(n,t,e)=>{!t.modifiers.includes("item-group")||(n.livewire_sortable=window.Sortable.create(n,{draggable:"[wire\\:sortable-group\\.item]",handle:n.querySelector("[wire\\:sortable-group\\.handle]")?"[wire\\:sortable-group\\.handle]":null,sort:!0,dataIdAttr:"wire:sortable-group.item",group:{name:n.closest("[wire\\:sortable-group]").getAttribute("wire:sortable-group"),pull:!0,put:!0},onSort:()=>{let o=n.closest("[wire\\:sortable-group]"),i=Array.from(o.querySelectorAll("[wire\\:sortable-group\\.item-group]")).map((r,a)=>({order:a+1,value:r.getAttribute("wire:sortable-group.item-group"),items:r.livewire_sortable.toArray().map((l,s)=>({order:s+1,value:l}))}));e.call(o.getAttribute("wire:sortable-group"),i)}}))});})(); /**! * Sortable 1.14.0 * @author RubaXa * @author owenm * @license MIT */ //# sourceMappingURL=livewire-sortable.js.map