Socket
Socket
Sign inDemoInstall

stimulus-sortable

Package Overview
Dependencies
3
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.0 to 3.2.0

6

CHANGELOG.md

@@ -9,2 +9,8 @@ # Changelog

## [3.2.0] - 2022-02-04
### Added
- Adding `responseKind` option. Thanks @diachini!
## [3.1.0] - 2021-10-12

@@ -11,0 +17,0 @@

4

dist/stimulus-sortable.umd.js

@@ -1,2 +0,2 @@

var Wn=Object.defineProperty;var Le=Object.getOwnPropertySymbols;var Vn=Object.prototype.hasOwnProperty,Un=Object.prototype.propertyIsEnumerable;var He=(F,C,X)=>C in F?Wn(F,C,{enumerable:!0,configurable:!0,writable:!0,value:X}):F[C]=X,fe=(F,C)=>{for(var X in C||(C={}))Vn.call(C,X)&&He(F,X,C[X]);if(Le)for(var X of Le(C))Un.call(C,X)&&He(F,X,C[X]);return F};(function(F,C){typeof exports=="object"&&typeof module!="undefined"?module.exports=C():typeof define=="function"&&define.amd?define(C):(F=typeof globalThis!="undefined"?globalThis:F||self,F["stimulus-sortable"]=C())})(this,function(){"use strict";function F(e){return e.replace(/(?:[_-])([a-z0-9])/g,(t,n)=>n.toUpperCase())}function C(e){return e.charAt(0).toUpperCase()+e.slice(1)}function X(e){return e.replace(/([A-Z])/g,(t,n)=>`-${n.toLowerCase()}`)}function he(e,t){const n=pe(e);return Array.from(n.reduce((r,o)=>(Ve(o,t).forEach(i=>r.add(i)),r),new Set))}function We(e,t){return pe(e).reduce((r,o)=>(r.push(...Ue(o,t)),r),[])}function pe(e){const t=[];for(;e;)t.push(e),e=Object.getPrototypeOf(e);return t.reverse()}function Ve(e,t){const n=e[t];return Array.isArray(n)?n:[]}function Ue(e,t){const n=e[t];return n?Object.keys(n).map(r=>[r,n[r]]):[]}(()=>{function e(n){function r(){return Reflect.construct(n,arguments,new.target)}return r.prototype=Object.create(n.prototype,{constructor:{value:r}}),Reflect.setPrototypeOf(r,n),r}function t(){const r=e(function(){this.a.call(this)});return r.prototype.a=function(){},new r}try{return t(),e}catch(n){return r=>class extends r{}}})();function ze(e){return he(e,"classes").reduce((n,r)=>Object.assign(n,Ge(r)),{})}function Ge(e){return{[`${e}Class`]:{get(){const{classes:t}=this;if(t.has(e))return t.get(e);{const n=t.getAttributeName(e);throw new Error(`Missing attribute "${n}"`)}}},[`${e}Classes`]:{get(){return this.classes.getAll(e)}},[`has${C(e)}Class`]:{get(){return this.classes.has(e)}}}}function qe(e){return he(e,"targets").reduce((n,r)=>Object.assign(n,Je(r)),{})}function Je(e){return{[`${e}Target`]:{get(){const t=this.targets.find(e);if(t)return t;throw new Error(`Missing target element "${e}" for "${this.identifier}" controller`)}},[`${e}Targets`]:{get(){return this.targets.findAll(e)}},[`has${C(e)}Target`]:{get(){return this.targets.has(e)}}}}function Ke(e){const t=We(e,"values"),n={valueDescriptorMap:{get(){return t.reduce((r,o)=>{const i=ge(o),a=this.data.getAttributeNameForKey(i.key);return Object.assign(r,{[a]:i})},{})}}};return t.reduce((r,o)=>Object.assign(r,Qe(o)),n)}function Qe(e){const t=ge(e),{key:n,name:r,reader:o,writer:i}=t;return{[r]:{get(){const a=this.data.get(n);return a!==null?o(a):t.defaultValue},set(a){a===void 0?this.data.delete(n):this.data.set(n,i(a))}},[`has${C(r)}`]:{get(){return this.data.has(n)||t.hasCustomDefaultValue}}}}function ge([e,t]){return nn(e,t)}function Gt(e){switch(e){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function qt(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(e))return"array";if(Object.prototype.toString.call(e)==="[object Object]")return"object"}function Ze(e){const t=Gt(e.type);if(t){const n=qt(e.default);if(t!==n)throw new Error(`Type "${t}" must match the type of the default value. Given default value: "${e.default}" as "${n}"`);return t}}function tn(e){const t=Ze(e),n=qt(e),r=Gt(e),o=t||n||r;if(o)return o;throw new Error(`Unknown value type "${e}"`)}function en(e){const t=Gt(e);if(t)return rn[t];const n=e.default;return n!==void 0?n:e}function nn(e,t){const n=`${X(e)}-value`,r=tn(t);return{type:r,key:n,name:F(n),get defaultValue(){return en(t)},get hasCustomDefaultValue(){return qt(t)!==void 0},reader:on[r],writer:me[r]||me.default}}const rn={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},on={array(e){const t=JSON.parse(e);if(!Array.isArray(t))throw new TypeError("Expected array");return t},boolean(e){return!(e=="0"||e=="false")},number(e){return Number(e)},object(e){const t=JSON.parse(e);if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError("Expected object");return t},string(e){return e}},me={default:an,array:ve,object:ve};function ve(e){return JSON.stringify(e)}function an(e){return`${e}`}class Pt{constructor(t){this.context=t}static get shouldLoad(){return!0}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(t,{target:n=this.element,detail:r={},prefix:o=this.identifier,bubbles:i=!0,cancelable:a=!0}={}){const s=o?`${o}:${t}`:t,l=new CustomEvent(s,{detail:r,bubbles:i,cancelable:a});return n.dispatchEvent(l),l}}Pt.blessings=[ze,qe,Ke],Pt.targets=[],Pt.values={};/**!
var Wn=Object.defineProperty;var Lt=Object.getOwnPropertySymbols;var Vn=Object.prototype.hasOwnProperty,Un=Object.prototype.propertyIsEnumerable;var Ht=(F,C,X)=>C in F?Wn(F,C,{enumerable:!0,configurable:!0,writable:!0,value:X}):F[C]=X,ft=(F,C)=>{for(var X in C||(C={}))Vn.call(C,X)&&Ht(F,X,C[X]);if(Lt)for(var X of Lt(C))Un.call(C,X)&&Ht(F,X,C[X]);return F};(function(F,C){typeof exports=="object"&&typeof module!="undefined"?module.exports=C():typeof define=="function"&&define.amd?define(C):(F=typeof globalThis!="undefined"?globalThis:F||self,F["stimulus-sortable"]=C())})(this,function(){"use strict";function F(t){return t.replace(/(?:[_-])([a-z0-9])/g,(e,n)=>n.toUpperCase())}function C(t){return t.charAt(0).toUpperCase()+t.slice(1)}function X(t){return t.replace(/([A-Z])/g,(e,n)=>`-${n.toLowerCase()}`)}function ht(t,e){const n=pt(t);return Array.from(n.reduce((r,o)=>(Vt(o,e).forEach(i=>r.add(i)),r),new Set))}function Wt(t,e){return pt(t).reduce((r,o)=>(r.push(...Ut(o,e)),r),[])}function pt(t){const e=[];for(;t;)e.push(t),t=Object.getPrototypeOf(t);return e.reverse()}function Vt(t,e){const n=t[e];return Array.isArray(n)?n:[]}function Ut(t,e){const n=t[e];return n?Object.keys(n).map(r=>[r,n[r]]):[]}(()=>{function t(n){function r(){return Reflect.construct(n,arguments,new.target)}return r.prototype=Object.create(n.prototype,{constructor:{value:r}}),Reflect.setPrototypeOf(r,n),r}function e(){const r=t(function(){this.a.call(this)});return r.prototype.a=function(){},new r}try{return e(),t}catch(n){return r=>class extends r{}}})();function zt(t){return ht(t,"classes").reduce((n,r)=>Object.assign(n,Gt(r)),{})}function Gt(t){return{[`${t}Class`]:{get(){const{classes:e}=this;if(e.has(t))return e.get(t);{const n=e.getAttributeName(t);throw new Error(`Missing attribute "${n}"`)}}},[`${t}Classes`]:{get(){return this.classes.getAll(t)}},[`has${C(t)}Class`]:{get(){return this.classes.has(t)}}}}function qt(t){return ht(t,"targets").reduce((n,r)=>Object.assign(n,Jt(r)),{})}function Jt(t){return{[`${t}Target`]:{get(){const e=this.targets.find(t);if(e)return e;throw new Error(`Missing target element "${t}" for "${this.identifier}" controller`)}},[`${t}Targets`]:{get(){return this.targets.findAll(t)}},[`has${C(t)}Target`]:{get(){return this.targets.has(t)}}}}function Kt(t){const e=Wt(t,"values"),n={valueDescriptorMap:{get(){return e.reduce((r,o)=>{const i=gt(o),a=this.data.getAttributeNameForKey(i.key);return Object.assign(r,{[a]:i})},{})}}};return e.reduce((r,o)=>Object.assign(r,Qt(o)),n)}function Qt(t){const e=gt(t),{key:n,name:r,reader:o,writer:i}=e;return{[r]:{get(){const a=this.data.get(n);return a!==null?o(a):e.defaultValue},set(a){a===void 0?this.data.delete(n):this.data.set(n,i(a))}},[`has${C(r)}`]:{get(){return this.data.has(n)||e.hasCustomDefaultValue}}}}function gt([t,e]){return nn(t,e)}function Ge(t){switch(t){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function qe(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(t))return"array";if(Object.prototype.toString.call(t)==="[object Object]")return"object"}function Zt(t){const e=Ge(t.type);if(e){const n=qe(t.default);if(e!==n)throw new Error(`Type "${e}" must match the type of the default value. Given default value: "${t.default}" as "${n}"`);return e}}function en(t){const e=Zt(t),n=qe(t),r=Ge(t),o=e||n||r;if(o)return o;throw new Error(`Unknown value type "${t}"`)}function tn(t){const e=Ge(t);if(e)return rn[e];const n=t.default;return n!==void 0?n:t}function nn(t,e){const n=`${X(t)}-value`,r=en(e);return{type:r,key:n,name:F(n),get defaultValue(){return tn(e)},get hasCustomDefaultValue(){return qe(e)!==void 0},reader:on[r],writer:mt[r]||mt.default}}const rn={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},on={array(t){const e=JSON.parse(t);if(!Array.isArray(e))throw new TypeError("Expected array");return e},boolean(t){return!(t=="0"||t=="false")},number(t){return Number(t)},object(t){const e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError("Expected object");return e},string(t){return t}},mt={default:an,array:vt,object:vt};function vt(t){return JSON.stringify(t)}function an(t){return`${t}`}class Pe{constructor(e){this.context=e}static get shouldLoad(){return!0}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:n=this.element,detail:r={},prefix:o=this.identifier,bubbles:i=!0,cancelable:a=!0}={}){const s=o?`${o}:${e}`:e,l=new CustomEvent(s,{detail:r,bubbles:i,cancelable:a});return n.dispatchEvent(l),l}}Pe.blessings=[zt,qt,Kt],Pe.targets=[],Pe.values={};/**!
* Sortable 1.14.0

@@ -6,2 +6,2 @@ * @author RubaXa <trash@rubaxa.org>

* @license MIT
*/function be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?be(Object(n),!0).forEach(function(r){sn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):be(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nt(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Nt=function(t){return typeof t}:Nt=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nt(e)}function sn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function G(){return G=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},G.apply(this,arguments)}function ln(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function un(e,t){if(e==null)return{};var n=ln(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(e,r)||(n[r]=e[r]))}return n}var cn="1.14.0";function q(e){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(e)}var J=q(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),mt=q(/Edge/i),ye=q(/firefox/i),vt=q(/safari/i)&&!q(/chrome/i)&&!q(/android/i),we=q(/iP(ad|od|hone)/i),dn=q(/chrome/i)&&q(/android/i),Ee={capture:!1,passive:!1};function y(e,t,n){e.addEventListener(t,n,!J&&Ee)}function v(e,t,n){e.removeEventListener(t,n,!J&&Ee)}function Ft(e,t){if(!!t){if(t[0]===">"&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(n){return!1}return!1}}function fn(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function W(e,t,n,r){if(e){n=n||document;do{if(t!=null&&(t[0]===">"?e.parentNode===n&&Ft(e,t):Ft(e,t))||r&&e===n)return e;if(e===n)break}while(e=fn(e))}return null}var Se=/\s+/g;function M(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var r=(" "+e.className+" ").replace(Se," ").replace(" "+t+" "," ");e.className=(r+(n?" "+t:"")).replace(Se," ")}}function h(e,t,n){var r=e&&e.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),t===void 0?n:n[t];!(t in r)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),r[t]=n+(typeof n=="string"?"":"px")}}function ct(e,t){var n="";if(typeof e=="string")n=e;else do{var r=h(e,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function De(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o<i;o++)n(r[o],o);return r}return[]}function V(){var e=document.scrollingElement;return e||document.documentElement}function O(e,t,n,r,o){if(!(!e.getBoundingClientRect&&e!==window)){var i,a,s,l,u,f,d;if(e!==window&&e.parentNode&&e!==V()?(i=e.getBoundingClientRect(),a=i.top,s=i.left,l=i.bottom,u=i.right,f=i.height,d=i.width):(a=0,s=0,l=window.innerHeight,u=window.innerWidth,f=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(o=o||e.parentNode,!J))do if(o&&o.getBoundingClientRect&&(h(o,"transform")!=="none"||n&&h(o,"position")!=="static")){var m=o.getBoundingClientRect();a-=m.top+parseInt(h(o,"border-top-width")),s-=m.left+parseInt(h(o,"border-left-width")),l=a+i.height,u=s+i.width;break}while(o=o.parentNode);if(r&&e!==window){var E=ct(o||e),b=E&&E.a,w=E&&E.d;E&&(a/=w,s/=b,d/=b,f/=w,l=a+f,u=s+d)}return{top:a,left:s,bottom:l,right:u,width:d,height:f}}}function Te(e,t,n){for(var r=Z(e,!0),o=O(e)[t];r;){var i=O(r)[n],a=void 0;if(n==="top"||n==="left"?a=o>=i:a=o<=i,!a)return r;if(r===V())break;r=Z(r,!1)}return!1}function dt(e,t,n,r){for(var o=0,i=0,a=e.children;i<a.length;){if(a[i].style.display!=="none"&&a[i]!==p.ghost&&(r||a[i]!==p.dragged)&&W(a[i],n.draggable,e,!1)){if(o===t)return a[i];o++}i++}return null}function Jt(e,t){for(var n=e.lastElementChild;n&&(n===p.ghost||h(n,"display")==="none"||t&&!Ft(n,t));)n=n.previousElementSibling;return n||null}function Y(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==p.clone&&(!t||Ft(e,t))&&n++;return n}function _e(e){var t=0,n=0,r=V();if(e)do{var o=ct(e),i=o.a,a=o.d;t+=e.scrollLeft*i,n+=e.scrollTop*a}while(e!==r&&(e=e.parentNode));return[t,n]}function hn(e,t){for(var n in e)if(!!e.hasOwnProperty(n)){for(var r in t)if(t.hasOwnProperty(r)&&t[r]===e[n][r])return Number(n)}return-1}function Z(e,t){if(!e||!e.getBoundingClientRect)return V();var n=e,r=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=h(n);if(n.clientWidth<n.scrollWidth&&(o.overflowX=="auto"||o.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(o.overflowY=="auto"||o.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return V();if(r||t)return n;r=!0}}while(n=n.parentNode);return V()}function pn(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function Kt(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}var bt;function Oe(e,t){return function(){if(!bt){var n=arguments,r=this;n.length===1?e.call(r,n[0]):e.apply(r,n),bt=setTimeout(function(){bt=void 0},t)}}}function gn(){clearTimeout(bt),bt=void 0}function Ce(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function Ae(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}var j="Sortable"+new Date().getTime();function mn(){var e=[],t;return{captureAnimationState:function(){if(e=[],!!this.options.animation){var r=[].slice.call(this.el.children);r.forEach(function(o){if(!(h(o,"display")==="none"||o===p.ghost)){e.push({target:o,rect:O(o)});var i=H({},e[e.length-1].rect);if(o.thisAnimationDuration){var a=ct(o,!0);a&&(i.top-=a.f,i.left-=a.e)}o.fromRect=i}})}},addAnimationState:function(r){e.push(r)},removeAnimationState:function(r){e.splice(hn(e,{target:r}),1)},animateAll:function(r){var o=this;if(!this.options.animation){clearTimeout(t),typeof r=="function"&&r();return}var i=!1,a=0;e.forEach(function(s){var l=0,u=s.target,f=u.fromRect,d=O(u),m=u.prevFromRect,E=u.prevToRect,b=s.rect,w=ct(u,!0);w&&(d.top-=w.f,d.left-=w.e),u.toRect=d,u.thisAnimationDuration&&Kt(m,d)&&!Kt(f,d)&&(b.top-d.top)/(b.left-d.left)==(f.top-d.top)/(f.left-d.left)&&(l=bn(b,m,E,o.options)),Kt(d,f)||(u.prevFromRect=f,u.prevToRect=d,l||(l=o.options.animation),o.animate(u,b,d,l)),l&&(i=!0,a=Math.max(a,l),clearTimeout(u.animationResetTimer),u.animationResetTimer=setTimeout(function(){u.animationTime=0,u.prevFromRect=null,u.fromRect=null,u.prevToRect=null,u.thisAnimationDuration=null},l),u.thisAnimationDuration=l)}),clearTimeout(t),i?t=setTimeout(function(){typeof r=="function"&&r()},a):typeof r=="function"&&r(),e=[]},animate:function(r,o,i,a){if(a){h(r,"transition",""),h(r,"transform","");var s=ct(this.el),l=s&&s.a,u=s&&s.d,f=(o.left-i.left)/(l||1),d=(o.top-i.top)/(u||1);r.animatingX=!!f,r.animatingY=!!d,h(r,"transform","translate3d("+f+"px,"+d+"px,0)"),this.forRepaintDummy=vn(r),h(r,"transition","transform "+a+"ms"+(this.options.easing?" "+this.options.easing:"")),h(r,"transform","translate3d(0,0,0)"),typeof r.animated=="number"&&clearTimeout(r.animated),r.animated=setTimeout(function(){h(r,"transition",""),h(r,"transform",""),r.animated=!1,r.animatingX=!1,r.animatingY=!1},a)}}}}function vn(e){return e.offsetWidth}function bn(e,t,n,r){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*r.animation}var ft=[],Qt={initializeByDefault:!0},yt={mount:function(t){for(var n in Qt)Qt.hasOwnProperty(n)&&!(n in t)&&(t[n]=Qt[n]);ft.forEach(function(r){if(r.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),ft.push(t)},pluginEvent:function(t,n,r){var o=this;this.eventCanceled=!1,r.cancel=function(){o.eventCanceled=!0};var i=t+"Global";ft.forEach(function(a){!n[a.pluginName]||(n[a.pluginName][i]&&n[a.pluginName][i](H({sortable:n},r)),n.options[a.pluginName]&&n[a.pluginName][t]&&n[a.pluginName][t](H({sortable:n},r)))})},initializePlugins:function(t,n,r,o){ft.forEach(function(s){var l=s.pluginName;if(!(!t.options[l]&&!s.initializeByDefault)){var u=new s(t,n,t.options);u.sortable=t,u.options=t.options,t[l]=u,G(r,u.defaults)}});for(var i in t.options)if(!!t.options.hasOwnProperty(i)){var a=this.modifyOption(t,i,t.options[i]);typeof a!="undefined"&&(t.options[i]=a)}},getEventProperties:function(t,n){var r={};return ft.forEach(function(o){typeof o.eventProperties=="function"&&G(r,o.eventProperties.call(n[o.pluginName],t))}),r},modifyOption:function(t,n,r){var o;return ft.forEach(function(i){!t[i.pluginName]||i.optionListeners&&typeof i.optionListeners[n]=="function"&&(o=i.optionListeners[n].call(t[i.pluginName],r))}),o}};function yn(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,u=e.newIndex,f=e.oldDraggableIndex,d=e.newDraggableIndex,m=e.originalEvent,E=e.putSortable,b=e.extraEventProperties;if(t=t||n&&n[j],!!t){var w,$=t.options,K="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!J&&!mt?w=new CustomEvent(r,{bubbles:!0,cancelable:!0}):(w=document.createEvent("Event"),w.initEvent(r,!0,!0)),w.to=a||n,w.from=s||n,w.item=o||n,w.clone=i,w.oldIndex=l,w.newIndex=u,w.oldDraggableIndex=f,w.newDraggableIndex=d,w.originalEvent=m,w.pullMode=E?E.lastPutMode:void 0;var P=H(H({},b),yt.getEventProperties(r,t));for(var L in P)w[L]=P[L];n&&n.dispatchEvent(w),$[K]&&$[K].call(t,w)}}var wn=["evt"],N=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.evt,i=un(r,wn);yt.pluginEvent.bind(p)(t,n,H({dragEl:c,parentEl:D,ghostEl:g,rootEl:S,nextEl:ot,lastDownEl:Mt,cloneEl:T,cloneHidden:tt,dragStarted:Et,putSortable:A,activeSortable:p.active,originalEvent:o,oldIndex:ht,oldDraggableIndex:wt,newIndex:R,newDraggableIndex:et,hideGhostForTarget:je,unhideGhostForTarget:Re,cloneNowHidden:function(){tt=!0},cloneNowShown:function(){tt=!1},dispatchSortableEvent:function(s){I({sortable:n,name:s,originalEvent:o})}},i))};function I(e){yn(H({putSortable:A,cloneEl:T,targetEl:c,rootEl:S,oldIndex:ht,oldDraggableIndex:wt,newIndex:R,newDraggableIndex:et},e))}var c,D,g,S,ot,Mt,T,tt,ht,R,wt,et,jt,A,pt=!1,Rt=!1,kt=[],it,B,Zt,te,xe,Ie,Et,gt,St,Dt=!1,Xt=!1,Yt,x,ee=[],ne=!1,Bt=[],$t=typeof document!="undefined",Lt=we,Pe=mt||J?"cssFloat":"float",En=$t&&!dn&&!we&&"draggable"in document.createElement("div"),Ne=function(){if(!!$t){if(J)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),Fe=function(t,n){var r=h(t),o=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),i=dt(t,0,n),a=dt(t,1,n),s=i&&h(i),l=a&&h(a),u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+O(i).width,f=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+O(a).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&s.float!=="none"){var d=s.float==="left"?"left":"right";return a&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return i&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||u>=o&&r[Pe]==="none"||a&&r[Pe]==="none"&&u+f>o)?"vertical":"horizontal"},Sn=function(t,n,r){var o=r?t.left:t.top,i=r?t.right:t.bottom,a=r?t.width:t.height,s=r?n.left:n.top,l=r?n.right:n.bottom,u=r?n.width:n.height;return o===s||i===l||o+a/2===s+u/2},Dn=function(t,n){var r;return kt.some(function(o){var i=o[j].options.emptyInsertThreshold;if(!(!i||Jt(o))){var a=O(o),s=t>=a.left-i&&t<=a.right+i,l=n>=a.top-i&&n<=a.bottom+i;if(s&&l)return r=o}}),r},Me=function(t){function n(i,a){return function(s,l,u,f){var d=s.options.group.name&&l.options.group.name&&s.options.group.name===l.options.group.name;if(i==null&&(a||d))return!0;if(i==null||i===!1)return!1;if(a&&i==="clone")return i;if(typeof i=="function")return n(i(s,l,u,f),a)(s,l,u,f);var m=(a?s:l).options.group.name;return i===!0||typeof i=="string"&&i===m||i.join&&i.indexOf(m)>-1}}var r={},o=t.group;(!o||Nt(o)!="object")&&(o={name:o}),r.name=o.name,r.checkPull=n(o.pull,!0),r.checkPut=n(o.put),r.revertClone=o.revertClone,t.group=r},je=function(){!Ne&&g&&h(g,"display","none")},Re=function(){!Ne&&g&&h(g,"display","")};$t&&document.addEventListener("click",function(e){if(Rt)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Rt=!1,!1},!0);var at=function(t){if(c){t=t.touches?t.touches[0]:t;var n=Dn(t.clientX,t.clientY);if(n){var r={};for(var o in t)t.hasOwnProperty(o)&&(r[o]=t[o]);r.target=r.rootEl=n,r.preventDefault=void 0,r.stopPropagation=void 0,n[j]._onDragOver(r)}}},Tn=function(t){c&&c.parentNode[j]._isOutsideThisEl(t.target)};function p(e,t){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=G({},t),e[j]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Fe(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(a,s){a.setData("Text",s.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&&!vt,emptyInsertThreshold:5};yt.initializePlugins(this,e,n);for(var r in n)!(r in t)&&(t[r]=n[r]);Me(t);for(var o in this)o.charAt(0)==="_"&&typeof this[o]=="function"&&(this[o]=this[o].bind(this));this.nativeDraggable=t.forceFallback?!1:En,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?y(e,"pointerdown",this._onTapStart):(y(e,"mousedown",this._onTapStart),y(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(y(e,"dragover",this),y(e,"dragenter",this)),kt.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),G(this,mn())}p.prototype={constructor:p,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(gt=null)},_getDirection:function(t,n){return typeof this.options.direction=="function"?this.options.direction.call(this,t,n,c):this.options.direction},_onTapStart:function(t){if(!!t.cancelable){var n=this,r=this.el,o=this.options,i=o.preventOnFilter,a=t.type,s=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,l=(s||t).target,u=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,f=o.filter;if(Nn(r),!c&&!(/mousedown|pointerdown/.test(a)&&t.button!==0||o.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&vt&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=W(l,o.draggable,r,!1),!(l&&l.animated)&&Mt!==l)){if(ht=Y(l),wt=Y(l,o.draggable),typeof f=="function"){if(f.call(this,t,l,this)){I({sortable:n,rootEl:u,name:"filter",targetEl:l,toEl:r,fromEl:r}),N("filter",n,{evt:t}),i&&t.cancelable&&t.preventDefault();return}}else if(f&&(f=f.split(",").some(function(d){if(d=W(u,d.trim(),r,!1),d)return I({sortable:n,rootEl:d,name:"filter",targetEl:l,fromEl:r,toEl:r}),N("filter",n,{evt:t}),!0}),f)){i&&t.cancelable&&t.preventDefault();return}o.handle&&!W(u,o.handle,r,!1)||this._prepareDragStart(t,s,l)}}},_prepareDragStart:function(t,n,r){var o=this,i=o.el,a=o.options,s=i.ownerDocument,l;if(r&&!c&&r.parentNode===i){var u=O(r);if(S=i,c=r,D=c.parentNode,ot=c.nextSibling,Mt=r,jt=a.group,p.dragged=c,it={target:c,clientX:(n||t).clientX,clientY:(n||t).clientY},xe=it.clientX-u.left,Ie=it.clientY-u.top,this._lastX=(n||t).clientX,this._lastY=(n||t).clientY,c.style["will-change"]="all",l=function(){if(N("delayEnded",o,{evt:t}),p.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!ye&&o.nativeDraggable&&(c.draggable=!0),o._triggerDragStart(t,n),I({sortable:o,name:"choose",originalEvent:t}),M(c,a.chosenClass,!0)},a.ignore.split(",").forEach(function(f){De(c,f.trim(),re)}),y(s,"dragover",at),y(s,"mousemove",at),y(s,"touchmove",at),y(s,"mouseup",o._onDrop),y(s,"touchend",o._onDrop),y(s,"touchcancel",o._onDrop),ye&&this.nativeDraggable&&(this.options.touchStartThreshold=4,c.draggable=!0),N("delayStart",this,{evt:t}),a.delay&&(!a.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(mt||J))){if(p.eventCanceled){this._onDrop();return}y(s,"mouseup",o._disableDelayedDrag),y(s,"touchend",o._disableDelayedDrag),y(s,"touchcancel",o._disableDelayedDrag),y(s,"mousemove",o._delayedDragTouchMoveHandler),y(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&y(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(l,a.delay)}else l()}},_delayedDragTouchMoveHandler:function(t){var n=t.touches?t.touches[0]:t;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(){c&&re(c),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;v(t,"mouseup",this._disableDelayedDrag),v(t,"touchend",this._disableDelayedDrag),v(t,"touchcancel",this._disableDelayedDrag),v(t,"mousemove",this._delayedDragTouchMoveHandler),v(t,"touchmove",this._delayedDragTouchMoveHandler),v(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?y(document,"pointermove",this._onTouchMove):n?y(document,"touchmove",this._onTouchMove):y(document,"mousemove",this._onTouchMove):(y(c,"dragend",this),y(S,"dragstart",this._onDragStart));try{document.selection?Wt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(r){}},_dragStarted:function(t,n){if(pt=!1,S&&c){N("dragStarted",this,{evt:n}),this.nativeDraggable&&y(document,"dragover",Tn);var r=this.options;!t&&M(c,r.dragClass,!1),M(c,r.ghostClass,!0),p.active=this,t&&this._appendGhost(),I({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(B){this._lastX=B.clientX,this._lastY=B.clientY,je();for(var t=document.elementFromPoint(B.clientX,B.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(B.clientX,B.clientY),t!==n);)n=t;if(c.parentNode[j]._isOutsideThisEl(t),n)do{if(n[j]){var r=void 0;if(r=n[j]._onDragOver({clientX:B.clientX,clientY:B.clientY,target:t,rootEl:n}),r&&!this.options.dragoverBubble)break}t=n}while(n=n.parentNode);Re()}},_onTouchMove:function(t){if(it){var n=this.options,r=n.fallbackTolerance,o=n.fallbackOffset,i=t.touches?t.touches[0]:t,a=g&&ct(g,!0),s=g&&a&&a.a,l=g&&a&&a.d,u=Lt&&x&&_e(x),f=(i.clientX-it.clientX+o.x)/(s||1)+(u?u[0]-ee[0]:0)/(s||1),d=(i.clientY-it.clientY+o.y)/(l||1)+(u?u[1]-ee[1]:0)/(l||1);if(!p.active&&!pt){if(r&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<r)return;this._onDragStart(t,!0)}if(g){a?(a.e+=f-(Zt||0),a.f+=d-(te||0)):a={a:1,b:0,c:0,d:1,e:f,f:d};var m="matrix(".concat(a.a,",").concat(a.b,",").concat(a.c,",").concat(a.d,",").concat(a.e,",").concat(a.f,")");h(g,"webkitTransform",m),h(g,"mozTransform",m),h(g,"msTransform",m),h(g,"transform",m),Zt=f,te=d,B=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!g){var t=this.options.fallbackOnBody?document.body:S,n=O(c,!0,Lt,!0,t),r=this.options;if(Lt){for(x=t;h(x,"position")==="static"&&h(x,"transform")==="none"&&x!==document;)x=x.parentNode;x!==document.body&&x!==document.documentElement?(x===document&&(x=V()),n.top+=x.scrollTop,n.left+=x.scrollLeft):x=V(),ee=_e(x)}g=c.cloneNode(!0),M(g,r.ghostClass,!1),M(g,r.fallbackClass,!0),M(g,r.dragClass,!0),h(g,"transition",""),h(g,"transform",""),h(g,"box-sizing","border-box"),h(g,"margin",0),h(g,"top",n.top),h(g,"left",n.left),h(g,"width",n.width),h(g,"height",n.height),h(g,"opacity","0.8"),h(g,"position",Lt?"absolute":"fixed"),h(g,"zIndex","100000"),h(g,"pointerEvents","none"),p.ghost=g,t.appendChild(g),h(g,"transform-origin",xe/parseInt(g.style.width)*100+"% "+Ie/parseInt(g.style.height)*100+"%")}},_onDragStart:function(t,n){var r=this,o=t.dataTransfer,i=r.options;if(N("dragStart",this,{evt:t}),p.eventCanceled){this._onDrop();return}N("setupClone",this),p.eventCanceled||(T=Ae(c),T.draggable=!1,T.style["will-change"]="",this._hideClone(),M(T,this.options.chosenClass,!1),p.clone=T),r.cloneId=Wt(function(){N("clone",r),!p.eventCanceled&&(r.options.removeCloneOnHide||S.insertBefore(T,c),r._hideClone(),I({sortable:r,name:"clone"}))}),!n&&M(c,i.dragClass,!0),n?(Rt=!0,r._loopId=setInterval(r._emulateDragOver,50)):(v(document,"mouseup",r._onDrop),v(document,"touchend",r._onDrop),v(document,"touchcancel",r._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(r,o,c)),y(document,"drop",r),h(c,"transform","translateZ(0)")),pt=!0,r._dragStartId=Wt(r._dragStarted.bind(r,n,t)),y(document,"selectstart",r),Et=!0,vt&&h(document.body,"user-select","none")},_onDragOver:function(t){var n=this.el,r=t.target,o,i,a,s=this.options,l=s.group,u=p.active,f=jt===l,d=s.sort,m=A||u,E,b=this,w=!1;if(ne)return;function $(It,Ln){N(It,b,H({evt:t,isOwner:f,axis:E?"vertical":"horizontal",revert:a,dragRect:o,targetRect:i,canSort:d,fromSortable:m,target:r,completed:P,onMove:function($e,Hn){return Ht(S,n,c,o,$e,O($e),t,Hn)},changed:L},Ln))}function K(){$("dragOverAnimationCapture"),b.captureAnimationState(),b!==m&&m.captureAnimationState()}function P(It){return $("dragOverCompleted",{insertion:It}),It&&(f?u._hideClone():u._showClone(b),b!==m&&(M(c,A?A.options.ghostClass:u.options.ghostClass,!1),M(c,s.ghostClass,!0)),A!==b&&b!==p.active?A=b:b===p.active&&A&&(A=null),m===b&&(b._ignoreWhileAnimating=r),b.animateAll(function(){$("dragOverAnimationComplete"),b._ignoreWhileAnimating=null}),b!==m&&(m.animateAll(),m._ignoreWhileAnimating=null)),(r===c&&!c.animated||r===n&&!r.animated)&&(gt=null),!s.dragoverBubble&&!t.rootEl&&r!==document&&(c.parentNode[j]._isOutsideThisEl(t.target),!It&&at(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),w=!0}function L(){R=Y(c),et=Y(c,s.draggable),I({sortable:b,name:"change",toEl:n,newIndex:R,newDraggableIndex:et,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),r=W(r,s.draggable,n,!0),$("dragOver"),p.eventCanceled)return w;if(c.contains(t.target)||r.animated&&r.animatingX&&r.animatingY||b._ignoreWhileAnimating===r)return P(!1);if(Rt=!1,u&&!s.disabled&&(f?d||(a=D!==S):A===this||(this.lastPutMode=jt.checkPull(this,u,c,t))&&l.checkPut(this,u,c,t))){if(E=this._getDirection(t,r)==="vertical",o=O(c),$("dragOverValid"),p.eventCanceled)return w;if(a)return D=S,K(),this._hideClone(),$("revert"),p.eventCanceled||(ot?S.insertBefore(c,ot):S.appendChild(c)),P(!0);var U=Jt(n,s.draggable);if(!U||An(t,E,this)&&!U.animated){if(U===c)return P(!1);if(U&&n===t.target&&(r=U),r&&(i=O(r)),Ht(S,n,c,o,r,i,t,!!r)!==!1)return K(),n.appendChild(c),D=n,L(),P(!0)}else if(U&&Cn(t,E,this)){var st=dt(n,0,s,!0);if(st===c)return P(!1);if(r=st,i=O(r),Ht(S,n,c,o,r,i,t,!1)!==!1)return K(),n.insertBefore(c,st),D=n,L(),P(!0)}else if(r.parentNode===n){i=O(r);var z=0,lt,Ot=c.parentNode!==n,k=!Sn(c.animated&&c.toRect||o,r.animated&&r.toRect||i,E),Ct=E?"top":"left",nt=Te(r,"top","top")||Te(c,"top","top"),At=nt?nt.scrollTop:void 0;gt!==r&&(lt=i[Ct],Dt=!1,Xt=!k&&s.invertSwap||Ot),z=xn(t,r,i,E,k?1:s.swapThreshold,s.invertedSwapThreshold==null?s.swapThreshold:s.invertedSwapThreshold,Xt,gt===r);var Q;if(z!==0){var ut=Y(c);do ut-=z,Q=D.children[ut];while(Q&&(h(Q,"display")==="none"||Q===g))}if(z===0||Q===r)return P(!1);gt=r,St=z;var xt=r.nextElementSibling,rt=!1;rt=z===1;var zt=Ht(S,n,c,o,r,i,t,rt);if(zt!==!1)return(zt===1||zt===-1)&&(rt=zt===1),ne=!0,setTimeout(On,30),K(),rt&&!xt?n.appendChild(c):r.parentNode.insertBefore(c,rt?xt:r),nt&&Ce(nt,0,At-nt.scrollTop),D=c.parentNode,lt!==void 0&&!Xt&&(Yt=Math.abs(lt-O(r)[Ct])),L(),P(!0)}if(n.contains(c))return P(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){v(document,"mousemove",this._onTouchMove),v(document,"touchmove",this._onTouchMove),v(document,"pointermove",this._onTouchMove),v(document,"dragover",at),v(document,"mousemove",at),v(document,"touchmove",at)},_offUpEvents:function(){var t=this.el.ownerDocument;v(t,"mouseup",this._onDrop),v(t,"touchend",this._onDrop),v(t,"pointerup",this._onDrop),v(t,"touchcancel",this._onDrop),v(document,"selectstart",this)},_onDrop:function(t){var n=this.el,r=this.options;if(R=Y(c),et=Y(c,r.draggable),N("drop",this,{evt:t}),D=c&&c.parentNode,R=Y(c),et=Y(c,r.draggable),p.eventCanceled){this._nulling();return}pt=!1,Xt=!1,Dt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),oe(this.cloneId),oe(this._dragStartId),this.nativeDraggable&&(v(document,"drop",this),v(n,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),vt&&h(document.body,"user-select",""),h(c,"transform",""),t&&(Et&&(t.cancelable&&t.preventDefault(),!r.dropBubble&&t.stopPropagation()),g&&g.parentNode&&g.parentNode.removeChild(g),(S===D||A&&A.lastPutMode!=="clone")&&T&&T.parentNode&&T.parentNode.removeChild(T),c&&(this.nativeDraggable&&v(c,"dragend",this),re(c),c.style["will-change"]="",Et&&!pt&&M(c,A?A.options.ghostClass:this.options.ghostClass,!1),M(c,this.options.chosenClass,!1),I({sortable:this,name:"unchoose",toEl:D,newIndex:null,newDraggableIndex:null,originalEvent:t}),S!==D?(R>=0&&(I({rootEl:D,name:"add",toEl:D,fromEl:S,originalEvent:t}),I({sortable:this,name:"remove",toEl:D,originalEvent:t}),I({rootEl:D,name:"sort",toEl:D,fromEl:S,originalEvent:t}),I({sortable:this,name:"sort",toEl:D,originalEvent:t})),A&&A.save()):R!==ht&&R>=0&&(I({sortable:this,name:"update",toEl:D,originalEvent:t}),I({sortable:this,name:"sort",toEl:D,originalEvent:t})),p.active&&((R==null||R===-1)&&(R=ht,et=wt),I({sortable:this,name:"end",toEl:D,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){N("nulling",this),S=c=D=g=ot=T=Mt=tt=it=B=Et=R=et=ht=wt=gt=St=A=jt=p.dragged=p.ghost=p.clone=p.active=null,Bt.forEach(function(t){t.checked=!0}),Bt.length=Zt=te=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":c&&(this._onDragOver(t),_n(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],n,r=this.el.children,o=0,i=r.length,a=this.options;o<i;o++)n=r[o],W(n,a.draggable,this.el,!1)&&t.push(n.getAttribute(a.dataIdAttr)||Pn(n));return t},sort:function(t,n){var r={},o=this.el;this.toArray().forEach(function(i,a){var s=o.children[a];W(s,this.options.draggable,o,!1)&&(r[i]=s)},this),n&&this.captureAnimationState(),t.forEach(function(i){r[i]&&(o.removeChild(r[i]),o.appendChild(r[i]))}),n&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,n){return W(t,n||this.options.draggable,this.el,!1)},option:function(t,n){var r=this.options;if(n===void 0)return r[t];var o=yt.modifyOption(this,t,n);typeof o!="undefined"?r[t]=o:r[t]=n,t==="group"&&Me(r)},destroy:function(){N("destroy",this);var t=this.el;t[j]=null,v(t,"mousedown",this._onTapStart),v(t,"touchstart",this._onTapStart),v(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(v(t,"dragover",this),v(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(n){n.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),kt.splice(kt.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!tt){if(N("hideClone",this),p.eventCanceled)return;h(T,"display","none"),this.options.removeCloneOnHide&&T.parentNode&&T.parentNode.removeChild(T),tt=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(tt){if(N("showClone",this),p.eventCanceled)return;c.parentNode==S&&!this.options.group.revertClone?S.insertBefore(T,c):ot?S.insertBefore(T,ot):S.appendChild(T),this.options.group.revertClone&&this.animate(c,T),h(T,"display",""),tt=!1}}};function _n(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}function Ht(e,t,n,r,o,i,a,s){var l,u=e[j],f=u.options.onMove,d;return window.CustomEvent&&!J&&!mt?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=t,l.from=e,l.dragged=n,l.draggedRect=r,l.related=o||t,l.relatedRect=i||O(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),f&&(d=f.call(u,l,a)),d}function re(e){e.draggable=!1}function On(){ne=!1}function Cn(e,t,n){var r=O(dt(n.el,0,n.options,!0)),o=10;return t?e.clientX<r.left-o||e.clientY<r.top&&e.clientX<r.right:e.clientY<r.top-o||e.clientY<r.bottom&&e.clientX<r.left}function An(e,t,n){var r=O(Jt(n.el,n.options.draggable)),o=10;return t?e.clientX>r.right+o||e.clientX<=r.right&&e.clientY>r.bottom&&e.clientX>=r.left:e.clientX>r.right&&e.clientY>r.top||e.clientX<=r.right&&e.clientY>r.bottom+o}function xn(e,t,n,r,o,i,a,s){var l=r?e.clientY:e.clientX,u=r?n.height:n.width,f=r?n.top:n.left,d=r?n.bottom:n.right,m=!1;if(!a){if(s&&Yt<u*o){if(!Dt&&(St===1?l>f+u*i/2:l<d-u*i/2)&&(Dt=!0),Dt)m=!0;else if(St===1?l<f+Yt:l>d-Yt)return-St}else if(l>f+u*(1-o)/2&&l<d-u*(1-o)/2)return In(t)}return m=m||a,m&&(l<f+u*i/2||l>d-u*i/2)?l>f+u/2?1:-1:0}function In(e){return Y(c)<Y(e)?1:-1}function Pn(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,r=0;n--;)r+=t.charCodeAt(n);return r.toString(36)}function Nn(e){Bt.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var r=t[n];r.checked&&Bt.push(r)}}function Wt(e){return setTimeout(e,0)}function oe(e){return clearTimeout(e)}$t&&y(document,"touchmove",function(e){(p.active||pt)&&e.cancelable&&e.preventDefault()}),p.utils={on:y,off:v,css:h,find:De,is:function(t,n){return!!W(t,n,t,!1)},extend:pn,throttle:Oe,closest:W,toggleClass:M,clone:Ae,index:Y,nextTick:Wt,cancelNextTick:oe,detectDirection:Fe,getChild:dt},p.get=function(e){return e[j]},p.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t[0].constructor===Array&&(t=t[0]),t.forEach(function(r){if(!r.prototype||!r.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(r));r.utils&&(p.utils=H(H({},p.utils),r.utils)),yt.mount(r)})},p.create=function(e,t){return new p(e,t)},p.version=cn;var _=[],Tt,ie,ae=!1,se,le,Vt,_t;function Fn(){function e(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var t in this)t.charAt(0)==="_"&&typeof this[t]=="function"&&(this[t]=this[t].bind(this))}return e.prototype={dragStarted:function(n){var r=n.originalEvent;this.sortable.nativeDraggable?y(document,"dragover",this._handleAutoScroll):this.options.supportPointer?y(document,"pointermove",this._handleFallbackAutoScroll):r.touches?y(document,"touchmove",this._handleFallbackAutoScroll):y(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(n){var r=n.originalEvent;!this.options.dragOverBubble&&!r.rootEl&&this._handleAutoScroll(r)},drop:function(){this.sortable.nativeDraggable?v(document,"dragover",this._handleAutoScroll):(v(document,"pointermove",this._handleFallbackAutoScroll),v(document,"touchmove",this._handleFallbackAutoScroll),v(document,"mousemove",this._handleFallbackAutoScroll)),ke(),Ut(),gn()},nulling:function(){Vt=ie=Tt=ae=_t=se=le=null,_.length=0},_handleFallbackAutoScroll:function(n){this._handleAutoScroll(n,!0)},_handleAutoScroll:function(n,r){var o=this,i=(n.touches?n.touches[0]:n).clientX,a=(n.touches?n.touches[0]:n).clientY,s=document.elementFromPoint(i,a);if(Vt=n,r||this.options.forceAutoScrollFallback||mt||J||vt){ue(n,this.options,s,r);var l=Z(s,!0);ae&&(!_t||i!==se||a!==le)&&(_t&&ke(),_t=setInterval(function(){var u=Z(document.elementFromPoint(i,a),!0);u!==l&&(l=u,Ut()),ue(n,o.options,u,r)},10),se=i,le=a)}else{if(!this.options.bubbleScroll||Z(s,!0)===V()){Ut();return}ue(n,this.options,Z(s,!1),!1)}}},G(e,{pluginName:"scroll",initializeByDefault:!0})}function Ut(){_.forEach(function(e){clearInterval(e.pid)}),_=[]}function ke(){clearInterval(_t)}var ue=Oe(function(e,t,n,r){if(!!t.scroll){var o=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,a=t.scrollSensitivity,s=t.scrollSpeed,l=V(),u=!1,f;ie!==n&&(ie=n,Ut(),Tt=t.scroll,f=t.scrollFn,Tt===!0&&(Tt=Z(n,!0)));var d=0,m=Tt;do{var E=m,b=O(E),w=b.top,$=b.bottom,K=b.left,P=b.right,L=b.width,U=b.height,st=void 0,z=void 0,lt=E.scrollWidth,Ot=E.scrollHeight,k=h(E),Ct=E.scrollLeft,nt=E.scrollTop;E===l?(st=L<lt&&(k.overflowX==="auto"||k.overflowX==="scroll"||k.overflowX==="visible"),z=U<Ot&&(k.overflowY==="auto"||k.overflowY==="scroll"||k.overflowY==="visible")):(st=L<lt&&(k.overflowX==="auto"||k.overflowX==="scroll"),z=U<Ot&&(k.overflowY==="auto"||k.overflowY==="scroll"));var At=st&&(Math.abs(P-o)<=a&&Ct+L<lt)-(Math.abs(K-o)<=a&&!!Ct),Q=z&&(Math.abs($-i)<=a&&nt+U<Ot)-(Math.abs(w-i)<=a&&!!nt);if(!_[d])for(var ut=0;ut<=d;ut++)_[ut]||(_[ut]={});(_[d].vx!=At||_[d].vy!=Q||_[d].el!==E)&&(_[d].el=E,_[d].vx=At,_[d].vy=Q,clearInterval(_[d].pid),(At!=0||Q!=0)&&(u=!0,_[d].pid=setInterval(function(){r&&this.layer===0&&p.active._onTouchMove(Vt);var xt=_[this.layer].vy?_[this.layer].vy*s:0,rt=_[this.layer].vx?_[this.layer].vx*s:0;typeof f=="function"&&f.call(p.dragged.parentNode[j],rt,xt,e,Vt,_[this.layer].el)!=="continue"||Ce(_[this.layer].el,rt,xt)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&m!==l&&(m=Z(m,!1)));ae=u}},30),Xe=function(t){var n=t.originalEvent,r=t.putSortable,o=t.dragEl,i=t.activeSortable,a=t.dispatchSortableEvent,s=t.hideGhostForTarget,l=t.unhideGhostForTarget;if(!!n){var u=r||i;s();var f=n.changedTouches&&n.changedTouches.length?n.changedTouches[0]:n,d=document.elementFromPoint(f.clientX,f.clientY);l(),u&&!u.el.contains(d)&&(a("spill"),this.onSpill({dragEl:o,putSortable:r}))}};function ce(){}ce.prototype={startIndex:null,dragStart:function(t){var n=t.oldDraggableIndex;this.startIndex=n},onSpill:function(t){var n=t.dragEl,r=t.putSortable;this.sortable.captureAnimationState(),r&&r.captureAnimationState();var o=dt(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(n,o):this.sortable.el.appendChild(n),this.sortable.animateAll(),r&&r.animateAll()},drop:Xe},G(ce,{pluginName:"revertOnSpill"});function de(){}de.prototype={onSpill:function(t){var n=t.dragEl,r=t.putSortable,o=r||this.sortable;o.captureAnimationState(),n.parentNode&&n.parentNode.removeChild(n),o.animateAll()},drop:Xe},G(de,{pluginName:"removeOnSpill"}),p.mount(new Fn),p.mount(de,ce);class Mn{constructor(t){this.response=t}get statusCode(){return this.response.status}get redirected(){return this.response.redirected}get ok(){return this.response.ok}get unauthenticated(){return this.statusCode===401}get authenticationURL(){return this.response.headers.get("WWW-Authenticate")}get contentType(){return(this.response.headers.get("Content-Type")||"").replace(/;.*$/,"")}get headers(){return this.response.headers}get html(){return this.contentType.match(/^(application|text)\/(html|xhtml\+xml)$/)?this.text:Promise.reject(new Error(`Expected an HTML response but got "${this.contentType}" instead`))}get json(){return this.contentType.match(/^application\/json/)?this.responseJson||(this.responseJson=this.response.json()):Promise.reject(new Error(`Expected a JSON response but got "${this.contentType}" instead`))}get text(){return this.responseText||(this.responseText=this.response.text())}get isTurboStream(){return this.contentType.match(/^text\/vnd\.turbo-stream\.html/)}async renderTurboStream(){if(this.isTurboStream)window.Turbo?window.Turbo.renderStreamMessage(await this.text):console.warn("You must set `window.Turbo = Turbo` to automatically process Turbo Stream events with request.js");else return Promise.reject(new Error(`Expected a Turbo Stream response but got "${this.contentType}" instead`))}}class jn{static register(t){this.interceptor=t}static get(){return this.interceptor}static reset(){this.interceptor=void 0}}function Rn(e){const t=document.cookie?document.cookie.split("; "):[],n=`${encodeURIComponent(e)}=`,r=t.find(o=>o.startsWith(n));if(r){const o=r.split("=").slice(1).join("=");if(o)return decodeURIComponent(o)}}function kn(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=r)}return t}function Ye(e){const t=document.head.querySelector(`meta[name="${e}"]`);return t&&t.content}function Xn(e){return[...e].reduce((t,[n,r])=>t.concat(typeof r=="string"?[[n,r]]:[]),[])}function Yn(e,t){for(const[n,r]of t)r instanceof window.File||(e.has(n)?(e.delete(n),e.set(n,r)):e.append(n,r))}class Bn{constructor(t,n,r={}){this.method=t,this.options=r,this.originalUrl=n}async perform(){try{const n=jn.get();n&&await n(this)}catch(n){console.error(n)}const t=new Mn(await window.fetch(this.url,this.fetchOptions));return t.unauthenticated&&t.authenticationURL?Promise.reject(window.location.href=t.authenticationURL):(t.ok&&t.isTurboStream&&t.renderTurboStream(),t)}addHeader(t,n){const r=this.additionalHeaders;r[t]=n,this.options.headers=r}get fetchOptions(){return{method:this.method.toUpperCase(),headers:this.headers,body:this.formattedBody,signal:this.signal,credentials:"same-origin",redirect:this.redirect}}get headers(){return kn(Object.assign({"X-Requested-With":"XMLHttpRequest","X-CSRF-Token":this.csrfToken,"Content-Type":this.contentType,Accept:this.accept},this.additionalHeaders))}get csrfToken(){return Rn(Ye("csrf-param"))||Ye("csrf-token")}get contentType(){return this.options.contentType?this.options.contentType:this.body==null||this.body instanceof window.FormData?void 0:this.body instanceof window.File?this.body.type:"application/json"}get accept(){switch(this.responseKind){case"html":return"text/html, application/xhtml+xml";case"turbo-stream":return"text/vnd.turbo-stream.html, text/html, application/xhtml+xml";case"json":return"application/json";default:return"*/*"}}get body(){return this.options.body}get query(){const t=(this.originalUrl.split("?")[1]||"").split("#")[0],n=new URLSearchParams(t);let r=this.options.query;r instanceof window.FormData?r=Xn(r):r instanceof window.URLSearchParams?r=r.entries():r=Object.entries(r||{}),Yn(n,r);const o=n.toString();return o.length>0?`?${o}`:""}get url(){return this.originalUrl.split("?")[0]+this.query}get responseKind(){return this.options.responseKind||"html"}get signal(){return this.options.signal}get redirect(){return this.options.redirect||"follow"}get additionalHeaders(){return this.options.headers||{}}get formattedBody(){const t=Object.prototype.toString.call(this.body)==="[object String]";return this.headers["Content-Type"]==="application/json"&&!t?JSON.stringify(this.body):this.body}}async function $n(e,t){return new Bn("patch",e,t).perform()}class Be extends Pt{initialize(){this.end=this.end.bind(this)}connect(){this.sortable=new p(this.element,fe(fe({},this.defaultOptions),this.options))}disconnect(){this.sortable.destroy(),this.sortable=void 0}async end({item:t,newIndex:n}){if(!t.dataset.sortableUpdateUrl)return;const r=this.resourceNameValue?`${this.resourceNameValue}[${this.paramNameValue}]`:this.paramNameValue,o=new FormData;o.append(r,n+1),await $n(t.dataset.sortableUpdateUrl,{body:o})}get options(){return{animation:this.animationValue||this.defaultOptions.animation||150,handle:this.handleValue||this.defaultOptions.handle||void 0,onEnd:this.end}}get defaultOptions(){return{}}}return Be.values={resourceName:String,paramName:{type:String,default:"position"},animation:Number,handle:String},Be});
*/function bt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function H(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bt(Object(n),!0).forEach(function(r){sn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bt(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ne(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ne=function(e){return typeof e}:Ne=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ne(t)}function sn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function G(){return G=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},G.apply(this,arguments)}function ln(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,i;for(i=0;i<r.length;i++)o=r[i],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}function un(t,e){if(t==null)return{};var n=ln(t,e),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],!(e.indexOf(r)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,r)||(n[r]=t[r]))}return n}var cn="1.14.0";function q(t){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var J=q(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),me=q(/Edge/i),yt=q(/firefox/i),ve=q(/safari/i)&&!q(/chrome/i)&&!q(/android/i),wt=q(/iP(ad|od|hone)/i),dn=q(/chrome/i)&&q(/android/i),Et={capture:!1,passive:!1};function y(t,e,n){t.addEventListener(e,n,!J&&Et)}function v(t,e,n){t.removeEventListener(e,n,!J&&Et)}function Fe(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(n){return!1}return!1}}function fn(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function W(t,e,n,r){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&Fe(t,e):Fe(t,e))||r&&t===n)return t;if(t===n)break}while(t=fn(t))}return null}var St=/\s+/g;function M(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var r=(" "+t.className+" ").replace(St," ").replace(" "+e+" "," ");t.className=(r+(n?" "+e:"")).replace(St," ")}}function h(t,e,n){var r=t&&t.style;if(r){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 r)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),r[e]=n+(typeof n=="string"?"":"px")}}function ce(t,e){var n="";if(typeof t=="string")n=t;else do{var r=h(t,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!e&&(t=t.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function Dt(t,e,n){if(t){var r=t.getElementsByTagName(e),o=0,i=r.length;if(n)for(;o<i;o++)n(r[o],o);return r}return[]}function V(){var t=document.scrollingElement;return t||document.documentElement}function O(t,e,n,r,o){if(!(!t.getBoundingClientRect&&t!==window)){var i,a,s,l,u,f,d;if(t!==window&&t.parentNode&&t!==V()?(i=t.getBoundingClientRect(),a=i.top,s=i.left,l=i.bottom,u=i.right,f=i.height,d=i.width):(a=0,s=0,l=window.innerHeight,u=window.innerWidth,f=window.innerHeight,d=window.innerWidth),(e||n)&&t!==window&&(o=o||t.parentNode,!J))do if(o&&o.getBoundingClientRect&&(h(o,"transform")!=="none"||n&&h(o,"position")!=="static")){var m=o.getBoundingClientRect();a-=m.top+parseInt(h(o,"border-top-width")),s-=m.left+parseInt(h(o,"border-left-width")),l=a+i.height,u=s+i.width;break}while(o=o.parentNode);if(r&&t!==window){var E=ce(o||t),b=E&&E.a,w=E&&E.d;E&&(a/=w,s/=b,d/=b,f/=w,l=a+f,u=s+d)}return{top:a,left:s,bottom:l,right:u,width:d,height:f}}}function Tt(t,e,n){for(var r=Z(t,!0),o=O(t)[e];r;){var i=O(r)[n],a=void 0;if(n==="top"||n==="left"?a=o>=i:a=o<=i,!a)return r;if(r===V())break;r=Z(r,!1)}return!1}function de(t,e,n,r){for(var o=0,i=0,a=t.children;i<a.length;){if(a[i].style.display!=="none"&&a[i]!==p.ghost&&(r||a[i]!==p.dragged)&&W(a[i],n.draggable,t,!1)){if(o===e)return a[i];o++}i++}return null}function Je(t,e){for(var n=t.lastElementChild;n&&(n===p.ghost||h(n,"display")==="none"||e&&!Fe(n,e));)n=n.previousElementSibling;return n||null}function Y(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==p.clone&&(!e||Fe(t,e))&&n++;return n}function _t(t){var e=0,n=0,r=V();if(t)do{var o=ce(t),i=o.a,a=o.d;e+=t.scrollLeft*i,n+=t.scrollTop*a}while(t!==r&&(t=t.parentNode));return[e,n]}function hn(t,e){for(var n in t)if(!!t.hasOwnProperty(n)){for(var r in e)if(e.hasOwnProperty(r)&&e[r]===t[n][r])return Number(n)}return-1}function Z(t,e){if(!t||!t.getBoundingClientRect)return V();var n=t,r=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=h(n);if(n.clientWidth<n.scrollWidth&&(o.overflowX=="auto"||o.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(o.overflowY=="auto"||o.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return V();if(r||e)return n;r=!0}}while(n=n.parentNode);return V()}function pn(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Ke(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 be;function Ot(t,e){return function(){if(!be){var n=arguments,r=this;n.length===1?t.call(r,n[0]):t.apply(r,n),be=setTimeout(function(){be=void 0},e)}}}function gn(){clearTimeout(be),be=void 0}function Ct(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function At(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 j="Sortable"+new Date().getTime();function mn(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var r=[].slice.call(this.el.children);r.forEach(function(o){if(!(h(o,"display")==="none"||o===p.ghost)){t.push({target:o,rect:O(o)});var i=H({},t[t.length-1].rect);if(o.thisAnimationDuration){var a=ce(o,!0);a&&(i.top-=a.f,i.left-=a.e)}o.fromRect=i}})}},addAnimationState:function(r){t.push(r)},removeAnimationState:function(r){t.splice(hn(t,{target:r}),1)},animateAll:function(r){var o=this;if(!this.options.animation){clearTimeout(e),typeof r=="function"&&r();return}var i=!1,a=0;t.forEach(function(s){var l=0,u=s.target,f=u.fromRect,d=O(u),m=u.prevFromRect,E=u.prevToRect,b=s.rect,w=ce(u,!0);w&&(d.top-=w.f,d.left-=w.e),u.toRect=d,u.thisAnimationDuration&&Ke(m,d)&&!Ke(f,d)&&(b.top-d.top)/(b.left-d.left)==(f.top-d.top)/(f.left-d.left)&&(l=bn(b,m,E,o.options)),Ke(d,f)||(u.prevFromRect=f,u.prevToRect=d,l||(l=o.options.animation),o.animate(u,b,d,l)),l&&(i=!0,a=Math.max(a,l),clearTimeout(u.animationResetTimer),u.animationResetTimer=setTimeout(function(){u.animationTime=0,u.prevFromRect=null,u.fromRect=null,u.prevToRect=null,u.thisAnimationDuration=null},l),u.thisAnimationDuration=l)}),clearTimeout(e),i?e=setTimeout(function(){typeof r=="function"&&r()},a):typeof r=="function"&&r(),t=[]},animate:function(r,o,i,a){if(a){h(r,"transition",""),h(r,"transform","");var s=ce(this.el),l=s&&s.a,u=s&&s.d,f=(o.left-i.left)/(l||1),d=(o.top-i.top)/(u||1);r.animatingX=!!f,r.animatingY=!!d,h(r,"transform","translate3d("+f+"px,"+d+"px,0)"),this.forRepaintDummy=vn(r),h(r,"transition","transform "+a+"ms"+(this.options.easing?" "+this.options.easing:"")),h(r,"transform","translate3d(0,0,0)"),typeof r.animated=="number"&&clearTimeout(r.animated),r.animated=setTimeout(function(){h(r,"transition",""),h(r,"transform",""),r.animated=!1,r.animatingX=!1,r.animatingY=!1},a)}}}}function vn(t){return t.offsetWidth}function bn(t,e,n,r){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))*r.animation}var fe=[],Qe={initializeByDefault:!0},ye={mount:function(e){for(var n in Qe)Qe.hasOwnProperty(n)&&!(n in e)&&(e[n]=Qe[n]);fe.forEach(function(r){if(r.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),fe.push(e)},pluginEvent:function(e,n,r){var o=this;this.eventCanceled=!1,r.cancel=function(){o.eventCanceled=!0};var i=e+"Global";fe.forEach(function(a){!n[a.pluginName]||(n[a.pluginName][i]&&n[a.pluginName][i](H({sortable:n},r)),n.options[a.pluginName]&&n[a.pluginName][e]&&n[a.pluginName][e](H({sortable:n},r)))})},initializePlugins:function(e,n,r,o){fe.forEach(function(s){var l=s.pluginName;if(!(!e.options[l]&&!s.initializeByDefault)){var u=new s(e,n,e.options);u.sortable=e,u.options=e.options,e[l]=u,G(r,u.defaults)}});for(var i in e.options)if(!!e.options.hasOwnProperty(i)){var a=this.modifyOption(e,i,e.options[i]);typeof a!="undefined"&&(e.options[i]=a)}},getEventProperties:function(e,n){var r={};return fe.forEach(function(o){typeof o.eventProperties=="function"&&G(r,o.eventProperties.call(n[o.pluginName],e))}),r},modifyOption:function(e,n,r){var o;return fe.forEach(function(i){!e[i.pluginName]||i.optionListeners&&typeof i.optionListeners[n]=="function"&&(o=i.optionListeners[n].call(e[i.pluginName],r))}),o}};function yn(t){var e=t.sortable,n=t.rootEl,r=t.name,o=t.targetEl,i=t.cloneEl,a=t.toEl,s=t.fromEl,l=t.oldIndex,u=t.newIndex,f=t.oldDraggableIndex,d=t.newDraggableIndex,m=t.originalEvent,E=t.putSortable,b=t.extraEventProperties;if(e=e||n&&n[j],!!e){var w,$=e.options,K="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!J&&!me?w=new CustomEvent(r,{bubbles:!0,cancelable:!0}):(w=document.createEvent("Event"),w.initEvent(r,!0,!0)),w.to=a||n,w.from=s||n,w.item=o||n,w.clone=i,w.oldIndex=l,w.newIndex=u,w.oldDraggableIndex=f,w.newDraggableIndex=d,w.originalEvent=m,w.pullMode=E?E.lastPutMode:void 0;var P=H(H({},b),ye.getEventProperties(r,e));for(var L in P)w[L]=P[L];n&&n.dispatchEvent(w),$[K]&&$[K].call(e,w)}}var wn=["evt"],N=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.evt,i=un(r,wn);ye.pluginEvent.bind(p)(e,n,H({dragEl:c,parentEl:D,ghostEl:g,rootEl:S,nextEl:oe,lastDownEl:Me,cloneEl:T,cloneHidden:ee,dragStarted:Ee,putSortable:A,activeSortable:p.active,originalEvent:o,oldIndex:he,oldDraggableIndex:we,newIndex:R,newDraggableIndex:te,hideGhostForTarget:jt,unhideGhostForTarget:Rt,cloneNowHidden:function(){ee=!0},cloneNowShown:function(){ee=!1},dispatchSortableEvent:function(s){I({sortable:n,name:s,originalEvent:o})}},i))};function I(t){yn(H({putSortable:A,cloneEl:T,targetEl:c,rootEl:S,oldIndex:he,oldDraggableIndex:we,newIndex:R,newDraggableIndex:te},t))}var c,D,g,S,oe,Me,T,ee,he,R,we,te,je,A,pe=!1,Re=!1,ke=[],ie,B,Ze,et,xt,It,Ee,ge,Se,De=!1,Xe=!1,Ye,x,tt=[],nt=!1,Be=[],$e=typeof document!="undefined",Le=wt,Pt=me||J?"cssFloat":"float",En=$e&&!dn&&!wt&&"draggable"in document.createElement("div"),Nt=function(){if(!!$e){if(J)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Ft=function(e,n){var r=h(e),o=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),i=de(e,0,n),a=de(e,1,n),s=i&&h(i),l=a&&h(a),u=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+O(i).width,f=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+O(a).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&s.float!=="none"){var d=s.float==="left"?"left":"right";return a&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return i&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||u>=o&&r[Pt]==="none"||a&&r[Pt]==="none"&&u+f>o)?"vertical":"horizontal"},Sn=function(e,n,r){var o=r?e.left:e.top,i=r?e.right:e.bottom,a=r?e.width:e.height,s=r?n.left:n.top,l=r?n.right:n.bottom,u=r?n.width:n.height;return o===s||i===l||o+a/2===s+u/2},Dn=function(e,n){var r;return ke.some(function(o){var i=o[j].options.emptyInsertThreshold;if(!(!i||Je(o))){var a=O(o),s=e>=a.left-i&&e<=a.right+i,l=n>=a.top-i&&n<=a.bottom+i;if(s&&l)return r=o}}),r},Mt=function(e){function n(i,a){return function(s,l,u,f){var d=s.options.group.name&&l.options.group.name&&s.options.group.name===l.options.group.name;if(i==null&&(a||d))return!0;if(i==null||i===!1)return!1;if(a&&i==="clone")return i;if(typeof i=="function")return n(i(s,l,u,f),a)(s,l,u,f);var m=(a?s:l).options.group.name;return i===!0||typeof i=="string"&&i===m||i.join&&i.indexOf(m)>-1}}var r={},o=e.group;(!o||Ne(o)!="object")&&(o={name:o}),r.name=o.name,r.checkPull=n(o.pull,!0),r.checkPut=n(o.put),r.revertClone=o.revertClone,e.group=r},jt=function(){!Nt&&g&&h(g,"display","none")},Rt=function(){!Nt&&g&&h(g,"display","")};$e&&document.addEventListener("click",function(t){if(Re)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Re=!1,!1},!0);var ae=function(e){if(c){e=e.touches?e.touches[0]:e;var n=Dn(e.clientX,e.clientY);if(n){var r={};for(var o in e)e.hasOwnProperty(o)&&(r[o]=e[o]);r.target=r.rootEl=n,r.preventDefault=void 0,r.stopPropagation=void 0,n[j]._onDragOver(r)}}},Tn=function(e){c&&c.parentNode[j]._isOutsideThisEl(e.target)};function p(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=G({},e),t[j]=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 Ft(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(a,s){a.setData("Text",s.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&&!ve,emptyInsertThreshold:5};ye.initializePlugins(this,t,n);for(var r in n)!(r in e)&&(e[r]=n[r]);Mt(e);for(var o in this)o.charAt(0)==="_"&&typeof this[o]=="function"&&(this[o]=this[o].bind(this));this.nativeDraggable=e.forceFallback?!1:En,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?y(t,"pointerdown",this._onTapStart):(y(t,"mousedown",this._onTapStart),y(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(y(t,"dragover",this),y(t,"dragenter",this)),ke.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),G(this,mn())}p.prototype={constructor:p,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(ge=null)},_getDirection:function(e,n){return typeof this.options.direction=="function"?this.options.direction.call(this,e,n,c):this.options.direction},_onTapStart:function(e){if(!!e.cancelable){var n=this,r=this.el,o=this.options,i=o.preventOnFilter,a=e.type,s=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,l=(s||e).target,u=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,f=o.filter;if(Nn(r),!c&&!(/mousedown|pointerdown/.test(a)&&e.button!==0||o.disabled)&&!u.isContentEditable&&!(!this.nativeDraggable&&ve&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=W(l,o.draggable,r,!1),!(l&&l.animated)&&Me!==l)){if(he=Y(l),we=Y(l,o.draggable),typeof f=="function"){if(f.call(this,e,l,this)){I({sortable:n,rootEl:u,name:"filter",targetEl:l,toEl:r,fromEl:r}),N("filter",n,{evt:e}),i&&e.cancelable&&e.preventDefault();return}}else if(f&&(f=f.split(",").some(function(d){if(d=W(u,d.trim(),r,!1),d)return I({sortable:n,rootEl:d,name:"filter",targetEl:l,fromEl:r,toEl:r}),N("filter",n,{evt:e}),!0}),f)){i&&e.cancelable&&e.preventDefault();return}o.handle&&!W(u,o.handle,r,!1)||this._prepareDragStart(e,s,l)}}},_prepareDragStart:function(e,n,r){var o=this,i=o.el,a=o.options,s=i.ownerDocument,l;if(r&&!c&&r.parentNode===i){var u=O(r);if(S=i,c=r,D=c.parentNode,oe=c.nextSibling,Me=r,je=a.group,p.dragged=c,ie={target:c,clientX:(n||e).clientX,clientY:(n||e).clientY},xt=ie.clientX-u.left,It=ie.clientY-u.top,this._lastX=(n||e).clientX,this._lastY=(n||e).clientY,c.style["will-change"]="all",l=function(){if(N("delayEnded",o,{evt:e}),p.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!yt&&o.nativeDraggable&&(c.draggable=!0),o._triggerDragStart(e,n),I({sortable:o,name:"choose",originalEvent:e}),M(c,a.chosenClass,!0)},a.ignore.split(",").forEach(function(f){Dt(c,f.trim(),rt)}),y(s,"dragover",ae),y(s,"mousemove",ae),y(s,"touchmove",ae),y(s,"mouseup",o._onDrop),y(s,"touchend",o._onDrop),y(s,"touchcancel",o._onDrop),yt&&this.nativeDraggable&&(this.options.touchStartThreshold=4,c.draggable=!0),N("delayStart",this,{evt:e}),a.delay&&(!a.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(me||J))){if(p.eventCanceled){this._onDrop();return}y(s,"mouseup",o._disableDelayedDrag),y(s,"touchend",o._disableDelayedDrag),y(s,"touchcancel",o._disableDelayedDrag),y(s,"mousemove",o._delayedDragTouchMoveHandler),y(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&y(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(l,a.delay)}else l()}},_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(){c&&rt(c),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;v(e,"mouseup",this._disableDelayedDrag),v(e,"touchend",this._disableDelayedDrag),v(e,"touchcancel",this._disableDelayedDrag),v(e,"mousemove",this._delayedDragTouchMoveHandler),v(e,"touchmove",this._delayedDragTouchMoveHandler),v(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,n){n=n||e.pointerType=="touch"&&e,!this.nativeDraggable||n?this.options.supportPointer?y(document,"pointermove",this._onTouchMove):n?y(document,"touchmove",this._onTouchMove):y(document,"mousemove",this._onTouchMove):(y(c,"dragend",this),y(S,"dragstart",this._onDragStart));try{document.selection?We(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch(r){}},_dragStarted:function(e,n){if(pe=!1,S&&c){N("dragStarted",this,{evt:n}),this.nativeDraggable&&y(document,"dragover",Tn);var r=this.options;!e&&M(c,r.dragClass,!1),M(c,r.ghostClass,!0),p.active=this,e&&this._appendGhost(),I({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(B){this._lastX=B.clientX,this._lastY=B.clientY,jt();for(var e=document.elementFromPoint(B.clientX,B.clientY),n=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(B.clientX,B.clientY),e!==n);)n=e;if(c.parentNode[j]._isOutsideThisEl(e),n)do{if(n[j]){var r=void 0;if(r=n[j]._onDragOver({clientX:B.clientX,clientY:B.clientY,target:e,rootEl:n}),r&&!this.options.dragoverBubble)break}e=n}while(n=n.parentNode);Rt()}},_onTouchMove:function(e){if(ie){var n=this.options,r=n.fallbackTolerance,o=n.fallbackOffset,i=e.touches?e.touches[0]:e,a=g&&ce(g,!0),s=g&&a&&a.a,l=g&&a&&a.d,u=Le&&x&&_t(x),f=(i.clientX-ie.clientX+o.x)/(s||1)+(u?u[0]-tt[0]:0)/(s||1),d=(i.clientY-ie.clientY+o.y)/(l||1)+(u?u[1]-tt[1]:0)/(l||1);if(!p.active&&!pe){if(r&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<r)return;this._onDragStart(e,!0)}if(g){a?(a.e+=f-(Ze||0),a.f+=d-(et||0)):a={a:1,b:0,c:0,d:1,e:f,f:d};var m="matrix(".concat(a.a,",").concat(a.b,",").concat(a.c,",").concat(a.d,",").concat(a.e,",").concat(a.f,")");h(g,"webkitTransform",m),h(g,"mozTransform",m),h(g,"msTransform",m),h(g,"transform",m),Ze=f,et=d,B=i}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!g){var e=this.options.fallbackOnBody?document.body:S,n=O(c,!0,Le,!0,e),r=this.options;if(Le){for(x=e;h(x,"position")==="static"&&h(x,"transform")==="none"&&x!==document;)x=x.parentNode;x!==document.body&&x!==document.documentElement?(x===document&&(x=V()),n.top+=x.scrollTop,n.left+=x.scrollLeft):x=V(),tt=_t(x)}g=c.cloneNode(!0),M(g,r.ghostClass,!1),M(g,r.fallbackClass,!0),M(g,r.dragClass,!0),h(g,"transition",""),h(g,"transform",""),h(g,"box-sizing","border-box"),h(g,"margin",0),h(g,"top",n.top),h(g,"left",n.left),h(g,"width",n.width),h(g,"height",n.height),h(g,"opacity","0.8"),h(g,"position",Le?"absolute":"fixed"),h(g,"zIndex","100000"),h(g,"pointerEvents","none"),p.ghost=g,e.appendChild(g),h(g,"transform-origin",xt/parseInt(g.style.width)*100+"% "+It/parseInt(g.style.height)*100+"%")}},_onDragStart:function(e,n){var r=this,o=e.dataTransfer,i=r.options;if(N("dragStart",this,{evt:e}),p.eventCanceled){this._onDrop();return}N("setupClone",this),p.eventCanceled||(T=At(c),T.draggable=!1,T.style["will-change"]="",this._hideClone(),M(T,this.options.chosenClass,!1),p.clone=T),r.cloneId=We(function(){N("clone",r),!p.eventCanceled&&(r.options.removeCloneOnHide||S.insertBefore(T,c),r._hideClone(),I({sortable:r,name:"clone"}))}),!n&&M(c,i.dragClass,!0),n?(Re=!0,r._loopId=setInterval(r._emulateDragOver,50)):(v(document,"mouseup",r._onDrop),v(document,"touchend",r._onDrop),v(document,"touchcancel",r._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(r,o,c)),y(document,"drop",r),h(c,"transform","translateZ(0)")),pe=!0,r._dragStartId=We(r._dragStarted.bind(r,n,e)),y(document,"selectstart",r),Ee=!0,ve&&h(document.body,"user-select","none")},_onDragOver:function(e){var n=this.el,r=e.target,o,i,a,s=this.options,l=s.group,u=p.active,f=je===l,d=s.sort,m=A||u,E,b=this,w=!1;if(nt)return;function $(Ie,Ln){N(Ie,b,H({evt:e,isOwner:f,axis:E?"vertical":"horizontal",revert:a,dragRect:o,targetRect:i,canSort:d,fromSortable:m,target:r,completed:P,onMove:function($t,Hn){return He(S,n,c,o,$t,O($t),e,Hn)},changed:L},Ln))}function K(){$("dragOverAnimationCapture"),b.captureAnimationState(),b!==m&&m.captureAnimationState()}function P(Ie){return $("dragOverCompleted",{insertion:Ie}),Ie&&(f?u._hideClone():u._showClone(b),b!==m&&(M(c,A?A.options.ghostClass:u.options.ghostClass,!1),M(c,s.ghostClass,!0)),A!==b&&b!==p.active?A=b:b===p.active&&A&&(A=null),m===b&&(b._ignoreWhileAnimating=r),b.animateAll(function(){$("dragOverAnimationComplete"),b._ignoreWhileAnimating=null}),b!==m&&(m.animateAll(),m._ignoreWhileAnimating=null)),(r===c&&!c.animated||r===n&&!r.animated)&&(ge=null),!s.dragoverBubble&&!e.rootEl&&r!==document&&(c.parentNode[j]._isOutsideThisEl(e.target),!Ie&&ae(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),w=!0}function L(){R=Y(c),te=Y(c,s.draggable),I({sortable:b,name:"change",toEl:n,newIndex:R,newDraggableIndex:te,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),r=W(r,s.draggable,n,!0),$("dragOver"),p.eventCanceled)return w;if(c.contains(e.target)||r.animated&&r.animatingX&&r.animatingY||b._ignoreWhileAnimating===r)return P(!1);if(Re=!1,u&&!s.disabled&&(f?d||(a=D!==S):A===this||(this.lastPutMode=je.checkPull(this,u,c,e))&&l.checkPut(this,u,c,e))){if(E=this._getDirection(e,r)==="vertical",o=O(c),$("dragOverValid"),p.eventCanceled)return w;if(a)return D=S,K(),this._hideClone(),$("revert"),p.eventCanceled||(oe?S.insertBefore(c,oe):S.appendChild(c)),P(!0);var U=Je(n,s.draggable);if(!U||An(e,E,this)&&!U.animated){if(U===c)return P(!1);if(U&&n===e.target&&(r=U),r&&(i=O(r)),He(S,n,c,o,r,i,e,!!r)!==!1)return K(),n.appendChild(c),D=n,L(),P(!0)}else if(U&&Cn(e,E,this)){var se=de(n,0,s,!0);if(se===c)return P(!1);if(r=se,i=O(r),He(S,n,c,o,r,i,e,!1)!==!1)return K(),n.insertBefore(c,se),D=n,L(),P(!0)}else if(r.parentNode===n){i=O(r);var z=0,le,Oe=c.parentNode!==n,k=!Sn(c.animated&&c.toRect||o,r.animated&&r.toRect||i,E),Ce=E?"top":"left",ne=Tt(r,"top","top")||Tt(c,"top","top"),Ae=ne?ne.scrollTop:void 0;ge!==r&&(le=i[Ce],De=!1,Xe=!k&&s.invertSwap||Oe),z=xn(e,r,i,E,k?1:s.swapThreshold,s.invertedSwapThreshold==null?s.swapThreshold:s.invertedSwapThreshold,Xe,ge===r);var Q;if(z!==0){var ue=Y(c);do ue-=z,Q=D.children[ue];while(Q&&(h(Q,"display")==="none"||Q===g))}if(z===0||Q===r)return P(!1);ge=r,Se=z;var xe=r.nextElementSibling,re=!1;re=z===1;var ze=He(S,n,c,o,r,i,e,re);if(ze!==!1)return(ze===1||ze===-1)&&(re=ze===1),nt=!0,setTimeout(On,30),K(),re&&!xe?n.appendChild(c):r.parentNode.insertBefore(c,re?xe:r),ne&&Ct(ne,0,Ae-ne.scrollTop),D=c.parentNode,le!==void 0&&!Xe&&(Ye=Math.abs(le-O(r)[Ce])),L(),P(!0)}if(n.contains(c))return P(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){v(document,"mousemove",this._onTouchMove),v(document,"touchmove",this._onTouchMove),v(document,"pointermove",this._onTouchMove),v(document,"dragover",ae),v(document,"mousemove",ae),v(document,"touchmove",ae)},_offUpEvents:function(){var e=this.el.ownerDocument;v(e,"mouseup",this._onDrop),v(e,"touchend",this._onDrop),v(e,"pointerup",this._onDrop),v(e,"touchcancel",this._onDrop),v(document,"selectstart",this)},_onDrop:function(e){var n=this.el,r=this.options;if(R=Y(c),te=Y(c,r.draggable),N("drop",this,{evt:e}),D=c&&c.parentNode,R=Y(c),te=Y(c,r.draggable),p.eventCanceled){this._nulling();return}pe=!1,Xe=!1,De=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),ot(this.cloneId),ot(this._dragStartId),this.nativeDraggable&&(v(document,"drop",this),v(n,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ve&&h(document.body,"user-select",""),h(c,"transform",""),e&&(Ee&&(e.cancelable&&e.preventDefault(),!r.dropBubble&&e.stopPropagation()),g&&g.parentNode&&g.parentNode.removeChild(g),(S===D||A&&A.lastPutMode!=="clone")&&T&&T.parentNode&&T.parentNode.removeChild(T),c&&(this.nativeDraggable&&v(c,"dragend",this),rt(c),c.style["will-change"]="",Ee&&!pe&&M(c,A?A.options.ghostClass:this.options.ghostClass,!1),M(c,this.options.chosenClass,!1),I({sortable:this,name:"unchoose",toEl:D,newIndex:null,newDraggableIndex:null,originalEvent:e}),S!==D?(R>=0&&(I({rootEl:D,name:"add",toEl:D,fromEl:S,originalEvent:e}),I({sortable:this,name:"remove",toEl:D,originalEvent:e}),I({rootEl:D,name:"sort",toEl:D,fromEl:S,originalEvent:e}),I({sortable:this,name:"sort",toEl:D,originalEvent:e})),A&&A.save()):R!==he&&R>=0&&(I({sortable:this,name:"update",toEl:D,originalEvent:e}),I({sortable:this,name:"sort",toEl:D,originalEvent:e})),p.active&&((R==null||R===-1)&&(R=he,te=we),I({sortable:this,name:"end",toEl:D,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){N("nulling",this),S=c=D=g=oe=T=Me=ee=ie=B=Ee=R=te=he=we=ge=Se=A=je=p.dragged=p.ghost=p.clone=p.active=null,Be.forEach(function(e){e.checked=!0}),Be.length=Ze=et=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":c&&(this._onDragOver(e),_n(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],n,r=this.el.children,o=0,i=r.length,a=this.options;o<i;o++)n=r[o],W(n,a.draggable,this.el,!1)&&e.push(n.getAttribute(a.dataIdAttr)||Pn(n));return e},sort:function(e,n){var r={},o=this.el;this.toArray().forEach(function(i,a){var s=o.children[a];W(s,this.options.draggable,o,!1)&&(r[i]=s)},this),n&&this.captureAnimationState(),e.forEach(function(i){r[i]&&(o.removeChild(r[i]),o.appendChild(r[i]))}),n&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,n){return W(e,n||this.options.draggable,this.el,!1)},option:function(e,n){var r=this.options;if(n===void 0)return r[e];var o=ye.modifyOption(this,e,n);typeof o!="undefined"?r[e]=o:r[e]=n,e==="group"&&Mt(r)},destroy:function(){N("destroy",this);var e=this.el;e[j]=null,v(e,"mousedown",this._onTapStart),v(e,"touchstart",this._onTapStart),v(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(v(e,"dragover",this),v(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(n){n.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),ke.splice(ke.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!ee){if(N("hideClone",this),p.eventCanceled)return;h(T,"display","none"),this.options.removeCloneOnHide&&T.parentNode&&T.parentNode.removeChild(T),ee=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(ee){if(N("showClone",this),p.eventCanceled)return;c.parentNode==S&&!this.options.group.revertClone?S.insertBefore(T,c):oe?S.insertBefore(T,oe):S.appendChild(T),this.options.group.revertClone&&this.animate(c,T),h(T,"display",""),ee=!1}}};function _n(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function He(t,e,n,r,o,i,a,s){var l,u=t[j],f=u.options.onMove,d;return window.CustomEvent&&!J&&!me?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=e,l.from=t,l.dragged=n,l.draggedRect=r,l.related=o||e,l.relatedRect=i||O(e),l.willInsertAfter=s,l.originalEvent=a,t.dispatchEvent(l),f&&(d=f.call(u,l,a)),d}function rt(t){t.draggable=!1}function On(){nt=!1}function Cn(t,e,n){var r=O(de(n.el,0,n.options,!0)),o=10;return e?t.clientX<r.left-o||t.clientY<r.top&&t.clientX<r.right:t.clientY<r.top-o||t.clientY<r.bottom&&t.clientX<r.left}function An(t,e,n){var r=O(Je(n.el,n.options.draggable)),o=10;return e?t.clientX>r.right+o||t.clientX<=r.right&&t.clientY>r.bottom&&t.clientX>=r.left:t.clientX>r.right&&t.clientY>r.top||t.clientX<=r.right&&t.clientY>r.bottom+o}function xn(t,e,n,r,o,i,a,s){var l=r?t.clientY:t.clientX,u=r?n.height:n.width,f=r?n.top:n.left,d=r?n.bottom:n.right,m=!1;if(!a){if(s&&Ye<u*o){if(!De&&(Se===1?l>f+u*i/2:l<d-u*i/2)&&(De=!0),De)m=!0;else if(Se===1?l<f+Ye:l>d-Ye)return-Se}else if(l>f+u*(1-o)/2&&l<d-u*(1-o)/2)return In(e)}return m=m||a,m&&(l<f+u*i/2||l>d-u*i/2)?l>f+u/2?1:-1:0}function In(t){return Y(c)<Y(t)?1:-1}function Pn(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,r=0;n--;)r+=e.charCodeAt(n);return r.toString(36)}function Nn(t){Be.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var r=e[n];r.checked&&Be.push(r)}}function We(t){return setTimeout(t,0)}function ot(t){return clearTimeout(t)}$e&&y(document,"touchmove",function(t){(p.active||pe)&&t.cancelable&&t.preventDefault()}),p.utils={on:y,off:v,css:h,find:Dt,is:function(e,n){return!!W(e,n,e,!1)},extend:pn,throttle:Ot,closest:W,toggleClass:M,clone:At,index:Y,nextTick:We,cancelNextTick:ot,detectDirection:Ft,getChild:de},p.get=function(t){return t[j]},p.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(r){if(!r.prototype||!r.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(r));r.utils&&(p.utils=H(H({},p.utils),r.utils)),ye.mount(r)})},p.create=function(t,e){return new p(t,e)},p.version=cn;var _=[],Te,it,at=!1,st,lt,Ve,_e;function Fn(){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 r=n.originalEvent;this.sortable.nativeDraggable?y(document,"dragover",this._handleAutoScroll):this.options.supportPointer?y(document,"pointermove",this._handleFallbackAutoScroll):r.touches?y(document,"touchmove",this._handleFallbackAutoScroll):y(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(n){var r=n.originalEvent;!this.options.dragOverBubble&&!r.rootEl&&this._handleAutoScroll(r)},drop:function(){this.sortable.nativeDraggable?v(document,"dragover",this._handleAutoScroll):(v(document,"pointermove",this._handleFallbackAutoScroll),v(document,"touchmove",this._handleFallbackAutoScroll),v(document,"mousemove",this._handleFallbackAutoScroll)),kt(),Ue(),gn()},nulling:function(){Ve=it=Te=at=_e=st=lt=null,_.length=0},_handleFallbackAutoScroll:function(n){this._handleAutoScroll(n,!0)},_handleAutoScroll:function(n,r){var o=this,i=(n.touches?n.touches[0]:n).clientX,a=(n.touches?n.touches[0]:n).clientY,s=document.elementFromPoint(i,a);if(Ve=n,r||this.options.forceAutoScrollFallback||me||J||ve){ut(n,this.options,s,r);var l=Z(s,!0);at&&(!_e||i!==st||a!==lt)&&(_e&&kt(),_e=setInterval(function(){var u=Z(document.elementFromPoint(i,a),!0);u!==l&&(l=u,Ue()),ut(n,o.options,u,r)},10),st=i,lt=a)}else{if(!this.options.bubbleScroll||Z(s,!0)===V()){Ue();return}ut(n,this.options,Z(s,!1),!1)}}},G(t,{pluginName:"scroll",initializeByDefault:!0})}function Ue(){_.forEach(function(t){clearInterval(t.pid)}),_=[]}function kt(){clearInterval(_e)}var ut=Ot(function(t,e,n,r){if(!!e.scroll){var o=(t.touches?t.touches[0]:t).clientX,i=(t.touches?t.touches[0]:t).clientY,a=e.scrollSensitivity,s=e.scrollSpeed,l=V(),u=!1,f;it!==n&&(it=n,Ue(),Te=e.scroll,f=e.scrollFn,Te===!0&&(Te=Z(n,!0)));var d=0,m=Te;do{var E=m,b=O(E),w=b.top,$=b.bottom,K=b.left,P=b.right,L=b.width,U=b.height,se=void 0,z=void 0,le=E.scrollWidth,Oe=E.scrollHeight,k=h(E),Ce=E.scrollLeft,ne=E.scrollTop;E===l?(se=L<le&&(k.overflowX==="auto"||k.overflowX==="scroll"||k.overflowX==="visible"),z=U<Oe&&(k.overflowY==="auto"||k.overflowY==="scroll"||k.overflowY==="visible")):(se=L<le&&(k.overflowX==="auto"||k.overflowX==="scroll"),z=U<Oe&&(k.overflowY==="auto"||k.overflowY==="scroll"));var Ae=se&&(Math.abs(P-o)<=a&&Ce+L<le)-(Math.abs(K-o)<=a&&!!Ce),Q=z&&(Math.abs($-i)<=a&&ne+U<Oe)-(Math.abs(w-i)<=a&&!!ne);if(!_[d])for(var ue=0;ue<=d;ue++)_[ue]||(_[ue]={});(_[d].vx!=Ae||_[d].vy!=Q||_[d].el!==E)&&(_[d].el=E,_[d].vx=Ae,_[d].vy=Q,clearInterval(_[d].pid),(Ae!=0||Q!=0)&&(u=!0,_[d].pid=setInterval(function(){r&&this.layer===0&&p.active._onTouchMove(Ve);var xe=_[this.layer].vy?_[this.layer].vy*s:0,re=_[this.layer].vx?_[this.layer].vx*s:0;typeof f=="function"&&f.call(p.dragged.parentNode[j],re,xe,t,Ve,_[this.layer].el)!=="continue"||Ct(_[this.layer].el,re,xe)}.bind({layer:d}),24))),d++}while(e.bubbleScroll&&m!==l&&(m=Z(m,!1)));at=u}},30),Xt=function(e){var n=e.originalEvent,r=e.putSortable,o=e.dragEl,i=e.activeSortable,a=e.dispatchSortableEvent,s=e.hideGhostForTarget,l=e.unhideGhostForTarget;if(!!n){var u=r||i;s();var f=n.changedTouches&&n.changedTouches.length?n.changedTouches[0]:n,d=document.elementFromPoint(f.clientX,f.clientY);l(),u&&!u.el.contains(d)&&(a("spill"),this.onSpill({dragEl:o,putSortable:r}))}};function ct(){}ct.prototype={startIndex:null,dragStart:function(e){var n=e.oldDraggableIndex;this.startIndex=n},onSpill:function(e){var n=e.dragEl,r=e.putSortable;this.sortable.captureAnimationState(),r&&r.captureAnimationState();var o=de(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(n,o):this.sortable.el.appendChild(n),this.sortable.animateAll(),r&&r.animateAll()},drop:Xt},G(ct,{pluginName:"revertOnSpill"});function dt(){}dt.prototype={onSpill:function(e){var n=e.dragEl,r=e.putSortable,o=r||this.sortable;o.captureAnimationState(),n.parentNode&&n.parentNode.removeChild(n),o.animateAll()},drop:Xt},G(dt,{pluginName:"removeOnSpill"}),p.mount(new Fn),p.mount(dt,ct);class Mn{constructor(e){this.response=e}get statusCode(){return this.response.status}get redirected(){return this.response.redirected}get ok(){return this.response.ok}get unauthenticated(){return this.statusCode===401}get authenticationURL(){return this.response.headers.get("WWW-Authenticate")}get contentType(){return(this.response.headers.get("Content-Type")||"").replace(/;.*$/,"")}get headers(){return this.response.headers}get html(){return this.contentType.match(/^(application|text)\/(html|xhtml\+xml)$/)?this.text:Promise.reject(new Error(`Expected an HTML response but got "${this.contentType}" instead`))}get json(){return this.contentType.match(/^application\/json/)?this.responseJson||(this.responseJson=this.response.json()):Promise.reject(new Error(`Expected a JSON response but got "${this.contentType}" instead`))}get text(){return this.responseText||(this.responseText=this.response.text())}get isTurboStream(){return this.contentType.match(/^text\/vnd\.turbo-stream\.html/)}async renderTurboStream(){if(this.isTurboStream)window.Turbo?window.Turbo.renderStreamMessage(await this.text):console.warn("You must set `window.Turbo = Turbo` to automatically process Turbo Stream events with request.js");else return Promise.reject(new Error(`Expected a Turbo Stream response but got "${this.contentType}" instead`))}}class jn{static register(e){this.interceptor=e}static get(){return this.interceptor}static reset(){this.interceptor=void 0}}function Rn(t){const e=document.cookie?document.cookie.split("; "):[],n=`${encodeURIComponent(t)}=`,r=e.find(o=>o.startsWith(n));if(r){const o=r.split("=").slice(1).join("=");if(o)return decodeURIComponent(o)}}function kn(t){const e={};for(const n in t){const r=t[n];r!==void 0&&(e[n]=r)}return e}function Yt(t){const e=document.head.querySelector(`meta[name="${t}"]`);return e&&e.content}function Xn(t){return[...t].reduce((e,[n,r])=>e.concat(typeof r=="string"?[[n,r]]:[]),[])}function Yn(t,e){for(const[n,r]of e)r instanceof window.File||(t.has(n)?(t.delete(n),t.set(n,r)):t.append(n,r))}class Bn{constructor(e,n,r={}){this.method=e,this.options=r,this.originalUrl=n}async perform(){try{const n=jn.get();n&&await n(this)}catch(n){console.error(n)}const e=new Mn(await window.fetch(this.url,this.fetchOptions));return e.unauthenticated&&e.authenticationURL?Promise.reject(window.location.href=e.authenticationURL):(e.ok&&e.isTurboStream&&e.renderTurboStream(),e)}addHeader(e,n){const r=this.additionalHeaders;r[e]=n,this.options.headers=r}get fetchOptions(){return{method:this.method.toUpperCase(),headers:this.headers,body:this.formattedBody,signal:this.signal,credentials:"same-origin",redirect:this.redirect}}get headers(){return kn(Object.assign({"X-Requested-With":"XMLHttpRequest","X-CSRF-Token":this.csrfToken,"Content-Type":this.contentType,Accept:this.accept},this.additionalHeaders))}get csrfToken(){return Rn(Yt("csrf-param"))||Yt("csrf-token")}get contentType(){return this.options.contentType?this.options.contentType:this.body==null||this.body instanceof window.FormData?void 0:this.body instanceof window.File?this.body.type:"application/json"}get accept(){switch(this.responseKind){case"html":return"text/html, application/xhtml+xml";case"turbo-stream":return"text/vnd.turbo-stream.html, text/html, application/xhtml+xml";case"json":return"application/json";default:return"*/*"}}get body(){return this.options.body}get query(){const e=(this.originalUrl.split("?")[1]||"").split("#")[0],n=new URLSearchParams(e);let r=this.options.query;r instanceof window.FormData?r=Xn(r):r instanceof window.URLSearchParams?r=r.entries():r=Object.entries(r||{}),Yn(n,r);const o=n.toString();return o.length>0?`?${o}`:""}get url(){return this.originalUrl.split("?")[0]+this.query}get responseKind(){return this.options.responseKind||"html"}get signal(){return this.options.signal}get redirect(){return this.options.redirect||"follow"}get additionalHeaders(){return this.options.headers||{}}get formattedBody(){const e=Object.prototype.toString.call(this.body)==="[object String]";return this.headers["Content-Type"]==="application/json"&&!e?JSON.stringify(this.body):this.body}}async function $n(t,e){return new Bn("patch",t,e).perform()}class Bt extends Pe{initialize(){this.end=this.end.bind(this)}connect(){this.sortable=new p(this.element,ft(ft({},this.defaultOptions),this.options))}disconnect(){this.sortable.destroy(),this.sortable=void 0}async end({item:e,newIndex:n}){if(!e.dataset.sortableUpdateUrl)return;const r=this.resourceNameValue?`${this.resourceNameValue}[${this.paramNameValue}]`:this.paramNameValue,o=new FormData;o.append(r,n+1),await $n(e.dataset.sortableUpdateUrl,{body:o,responseKind:this.responseKindValue})}get options(){return{animation:this.animationValue||this.defaultOptions.animation||150,handle:this.handleValue||this.defaultOptions.handle||void 0,onEnd:this.end}}get defaultOptions(){return{}}}return Bt.values={resourceName:String,paramName:{type:String,default:"position"},responseKind:{type:String,default:"html"},animation:Number,handle:String},Bt});
{
"name": "stimulus-sortable",
"version": "3.1.0",
"version": "3.2.0",
"description": "A Stimulus controller to reorder lists with drag-and-drop.",

@@ -5,0 +5,0 @@ "repository": "git@github.com:stimulus-components/stimulus-sortable.git",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc