@verdocs/web-sdk 5.0.27 → 5.0.29
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/verdocs-preview_6.cjs.entry.js +15 -7
- package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +1 -1
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js +15 -7
- package/dist/collection/components/templates/verdocs-template-roles/verdocs-template-roles.js.map +1 -1
- package/dist/components/{p-0e4ebc84.js → p-cecfbe2f.js} +16 -8
- package/dist/components/p-cecfbe2f.js.map +1 -0
- package/dist/components/verdocs-build.js +1 -1
- package/dist/components/verdocs-template-roles.js +1 -1
- package/dist/custom-elements.json +2156 -0
- package/dist/esm/verdocs-preview_6.entry.js +15 -7
- package/dist/esm/verdocs-preview_6.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js.map +1 -1
- package/dist/verdocs-web-sdk/{p-6e93814f.system.entry.js → p-4ae786e9.system.entry.js} +3 -3
- package/dist/verdocs-web-sdk/p-4ae786e9.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-4e9a8e8e.entry.js → p-6369fc93.entry.js} +3 -3
- package/dist/verdocs-web-sdk/p-6369fc93.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/components/p-0e4ebc84.js.map +0 -1
- package/dist/verdocs-web-sdk/p-4e9a8e8e.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-6e93814f.system.entry.js.map +0 -1
@@ -4,5 +4,5 @@ var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e)
|
|
4
4
|
* @author RubaXa <trash@rubaxa.org>
|
5
5
|
* @author owenm <owen23355@gmail.com>
|
6
6
|
* @license MIT
|
7
|
-
*/function ownKeys(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))}o.push.apply(o,n)}return o}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};if(t%2){ownKeys(Object(o),true).forEach((function(t){_defineProperty(e,t,o[t])}))}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(o))}else{ownKeys(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}}return e}function _typeof(e){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(e){return typeof e}}else{_typeof=function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof(e)}function _defineProperty(e,t,o){if(t in e){Object.defineProperty(e,t,{value:o,enumerable:true,configurable:true,writable:true})}else{e[t]=o}return e}function _extends(){_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o){if(Object.prototype.hasOwnProperty.call(o,n)){e[n]=o[n]}}}return e};return _extends.apply(this,arguments)}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var o={};var n=Object.keys(e);var r,i;for(i=0;i<n.length;i++){r=n[i];if(t.indexOf(r)>=0)continue;o[r]=e[r]}return o}function _objectWithoutProperties(e,t){if(e==null)return{};var o=_objectWithoutPropertiesLoose(e,t);var n,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){n=i[r];if(t.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;o[n]=e[n]}}return o}var version="1.15.6";function userAgent(e){if(typeof window!=="undefined"&&window.navigator){return!!navigator.userAgent.match(e)}}var IE11OrLess=userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);var Edge=userAgent(/Edge/i);var FireFox=userAgent(/firefox/i);var Safari=userAgent(/safari/i)&&!userAgent(/chrome/i)&&!userAgent(/android/i);var IOS=userAgent(/iP(ad|od|hone)/i);var ChromeForAndroid=userAgent(/chrome/i)&&userAgent(/android/i);var captureMode={capture:false,passive:false};function on(e,t,o){e.addEventListener(t,o,!IE11OrLess&&captureMode)}function off(e,t,o){e.removeEventListener(t,o,!IE11OrLess&&captureMode)}function matches(e,t){if(!t)return;t[0]===">"&&(t=t.substring(1));if(e){try{if(e.matches){return e.matches(t)}else if(e.msMatchesSelector){return e.msMatchesSelector(t)}else if(e.webkitMatchesSelector){return e.webkitMatchesSelector(t)}}catch(e){return false}}return false}function getParentOrHost(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function closest(e,t,o,n){if(e){o=o||document;do{if(t!=null&&(t[0]===">"?e.parentNode===o&&matches(e,t):matches(e,t))||n&&e===o){return e}if(e===o)break}while(e=getParentOrHost(e))}return null}var R_SPACE=/\s+/g;function toggleClass(e,t,o){if(e&&t){if(e.classList){e.classList[o?"add":"remove"](t)}else{var n=(" "+e.className+" ").replace(R_SPACE," ").replace(" "+t+" "," ");e.className=(n+(o?" "+t:"")).replace(R_SPACE," ")}}}function css(e,t,o){var n=e&&e.style;if(n){if(o===void 0){if(document.defaultView&&document.defaultView.getComputedStyle){o=document.defaultView.getComputedStyle(e,"")}else if(e.currentStyle){o=e.currentStyle}return t===void 0?o:o[t]}else{if(!(t in n)&&t.indexOf("webkit")===-1){t="-webkit-"+t}n[t]=o+(typeof o==="string"?"":"px")}}}function matrix(e,t){var o="";if(typeof e==="string"){o=e}else{do{var n=css(e,"transform");if(n&&n!=="none"){o=n+" "+o}}while(!t&&(e=e.parentNode))}var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(o)}function find(e,t,o){if(e){var n=e.getElementsByTagName(t),r=0,i=n.length;if(o){for(;r<i;r++){o(n[r],r)}}return n}return[]}function getWindowScrollingElement(){var e=document.scrollingElement;if(e){return e}else{return document.documentElement}}function getRect(e,t,o,n,r){if(!e.getBoundingClientRect&&e!==window)return;var i,s,l,a,c,d,u;if(e!==window&&e.parentNode&&e!==getWindowScrollingElement()){i=e.getBoundingClientRect();s=i.top;l=i.left;a=i.bottom;c=i.right;d=i.height;u=i.width}else{s=0;l=0;a=window.innerHeight;c=window.innerWidth;d=window.innerHeight;u=window.innerWidth}if((t||o)&&e!==window){r=r||e.parentNode;if(!IE11OrLess){do{if(r&&r.getBoundingClientRect&&(css(r,"transform")!=="none"||o&&css(r,"position")!=="static")){var f=r.getBoundingClientRect();s-=f.top+parseInt(css(r,"border-top-width"));l-=f.left+parseInt(css(r,"border-left-width"));a=s+i.height;c=l+i.width;break}}while(r=r.parentNode)}}if(n&&e!==window){var h=matrix(r||e),v=h&&h.a,p=h&&h.d;if(h){s/=p;l/=v;u/=v;d/=p;a=s+d;c=l+u}}return{top:s,left:l,bottom:a,right:c,width:u,height:d}}function isScrolledPast(e,t,o){var n=getParentAutoScrollElement(e,true),r=getRect(e)[t];while(n){var i=getRect(n)[o],s=void 0;if(o==="top"||o==="left"){s=r>=i}else{s=r<=i}if(!s)return n;if(n===getWindowScrollingElement())break;n=getParentAutoScrollElement(n,false)}return false}function getChild(e,t,o,n){var r=0,i=0,s=e.children;while(i<s.length){if(s[i].style.display!=="none"&&s[i]!==Sortable.ghost&&(n||s[i]!==Sortable.dragged)&&closest(s[i],o.draggable,e,false)){if(r===t){return s[i]}r++}i++}return null}function lastChild(e,t){var o=e.lastElementChild;while(o&&(o===Sortable.ghost||css(o,"display")==="none"||t&&!matches(o,t))){o=o.previousElementSibling}return o||null}function index(e,t){var o=0;if(!e||!e.parentNode){return-1}while(e=e.previousElementSibling){if(e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==Sortable.clone&&(!t||matches(e,t))){o++}}return o}function getRelativeScrollOffset(e){var t=0,o=0,n=getWindowScrollingElement();if(e){do{var r=matrix(e),i=r.a,s=r.d;t+=e.scrollLeft*i;o+=e.scrollTop*s}while(e!==n&&(e=e.parentNode))}return[t,o]}function indexOfObject(e,t){for(var o in e){if(!e.hasOwnProperty(o))continue;for(var n in t){if(t.hasOwnProperty(n)&&t[n]===e[o][n])return Number(o)}}return-1}function getParentAutoScrollElement(e,t){if(!e||!e.getBoundingClientRect)return getWindowScrollingElement();var o=e;var n=false;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var r=css(o);if(o.clientWidth<o.scrollWidth&&(r.overflowX=="auto"||r.overflowX=="scroll")||o.clientHeight<o.scrollHeight&&(r.overflowY=="auto"||r.overflowY=="scroll")){if(!o.getBoundingClientRect||o===document.body)return getWindowScrollingElement();if(n||t)return o;n=true}}}while(o=o.parentNode);return getWindowScrollingElement()}function extend(e,t){if(e&&t){for(var o in t){if(t.hasOwnProperty(o)){e[o]=t[o]}}}return e}function isRectEqual(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 _throttleTimeout;function throttle(e,t){return function(){if(!_throttleTimeout){var o=arguments,n=this;if(o.length===1){e.call(n,o[0])}else{e.apply(n,o)}_throttleTimeout=setTimeout((function(){_throttleTimeout=void 0}),t)}}}function cancelThrottle(){clearTimeout(_throttleTimeout);_throttleTimeout=void 0}function scrollBy(e,t,o){e.scrollLeft+=t;e.scrollTop+=o}function clone(e){var t=window.Polymer;var o=window.jQuery||window.Zepto;if(t&&t.dom){return t.dom(e).cloneNode(true)}else if(o){return o(e).clone(true)[0]}else{return e.cloneNode(true)}}function getChildContainingRectFromElement(e,t,o){var n={};Array.from(e.children).forEach((function(r){var i,s,l,a;if(!closest(r,t.draggable,e,false)||r.animated||r===o)return;var c=getRect(r);n.left=Math.min((i=n.left)!==null&&i!==void 0?i:Infinity,c.left);n.top=Math.min((s=n.top)!==null&&s!==void 0?s:Infinity,c.top);n.right=Math.max((l=n.right)!==null&&l!==void 0?l:-Infinity,c.right);n.bottom=Math.max((a=n.bottom)!==null&&a!==void 0?a:-Infinity,c.bottom)}));n.width=n.right-n.left;n.height=n.bottom-n.top;n.x=n.left;n.y=n.top;return n}var expando="Sortable"+(new Date).getTime();function AnimationStateManager(){var e=[],t;return{captureAnimationState:function t(){e=[];if(!this.options.animation)return;var o=[].slice.call(this.el.children);o.forEach((function(t){if(css(t,"display")==="none"||t===Sortable.ghost)return;e.push({target:t,rect:getRect(t)});var o=_objectSpread2({},e[e.length-1].rect);if(t.thisAnimationDuration){var n=matrix(t,true);if(n){o.top-=n.f;o.left-=n.e}}t.fromRect=o}))},addAnimationState:function t(o){e.push(o)},removeAnimationState:function t(o){e.splice(indexOfObject(e,{target:o}),1)},animateAll:function o(n){var r=this;if(!this.options.animation){clearTimeout(t);if(typeof n==="function")n();return}var i=false,s=0;e.forEach((function(e){var t=0,o=e.target,n=o.fromRect,l=getRect(o),a=o.prevFromRect,c=o.prevToRect,d=e.rect,u=matrix(o,true);if(u){l.top-=u.f;l.left-=u.e}o.toRect=l;if(o.thisAnimationDuration){if(isRectEqual(a,l)&&!isRectEqual(n,l)&&(d.top-l.top)/(d.left-l.left)===(n.top-l.top)/(n.left-l.left)){t=calculateRealTime(d,a,c,r.options)}}if(!isRectEqual(l,n)){o.prevFromRect=n;o.prevToRect=l;if(!t){t=r.options.animation}r.animate(o,d,l,t)}if(t){i=true;s=Math.max(s,t);clearTimeout(o.animationResetTimer);o.animationResetTimer=setTimeout((function(){o.animationTime=0;o.prevFromRect=null;o.fromRect=null;o.prevToRect=null;o.thisAnimationDuration=null}),t);o.thisAnimationDuration=t}}));clearTimeout(t);if(!i){if(typeof n==="function")n()}else{t=setTimeout((function(){if(typeof n==="function")n()}),s)}e=[]},animate:function e(t,o,n,r){if(r){css(t,"transition","");css(t,"transform","");var i=matrix(this.el),s=i&&i.a,l=i&&i.d,a=(o.left-n.left)/(s||1),c=(o.top-n.top)/(l||1);t.animatingX=!!a;t.animatingY=!!c;css(t,"transform","translate3d("+a+"px,"+c+"px,0)");this.forRepaintDummy=repaint(t);css(t,"transition","transform "+r+"ms"+(this.options.easing?" "+this.options.easing:""));css(t,"transform","translate3d(0,0,0)");typeof t.animated==="number"&&clearTimeout(t.animated);t.animated=setTimeout((function(){css(t,"transition","");css(t,"transform","");t.animated=false;t.animatingX=false;t.animatingY=false}),r)}}}}function repaint(e){return e.offsetWidth}function calculateRealTime(e,t,o,n){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-o.top,2)+Math.pow(t.left-o.left,2))*n.animation}var plugins=[];var defaults={initializeByDefault:true};var PluginManager={mount:function e(t){for(var o in defaults){if(defaults.hasOwnProperty(o)&&!(o in t)){t[o]=defaults[o]}}plugins.forEach((function(e){if(e.pluginName===t.pluginName){throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}}));plugins.push(t)},pluginEvent:function e(t,o,n){var r=this;this.eventCanceled=false;n.cancel=function(){r.eventCanceled=true};var i=t+"Global";plugins.forEach((function(e){if(!o[e.pluginName])return;if(o[e.pluginName][i]){o[e.pluginName][i](_objectSpread2({sortable:o},n))}if(o.options[e.pluginName]&&o[e.pluginName][t]){o[e.pluginName][t](_objectSpread2({sortable:o},n))}}))},initializePlugins:function e(t,o,n,r){plugins.forEach((function(e){var r=e.pluginName;if(!t.options[r]&&!e.initializeByDefault)return;var i=new e(t,o,t.options);i.sortable=t;i.options=t.options;t[r]=i;_extends(n,i.defaults)}));for(var i in t.options){if(!t.options.hasOwnProperty(i))continue;var s=this.modifyOption(t,i,t.options[i]);if(typeof s!=="undefined"){t.options[i]=s}}},getEventProperties:function e(t,o){var n={};plugins.forEach((function(e){if(typeof e.eventProperties!=="function")return;_extends(n,e.eventProperties.call(o[e.pluginName],t))}));return n},modifyOption:function e(t,o,n){var r;plugins.forEach((function(e){if(!t[e.pluginName])return;if(e.optionListeners&&typeof e.optionListeners[o]==="function"){r=e.optionListeners[o].call(t[e.pluginName],n)}}));return r}};function dispatchEvent(e){var t=e.sortable,o=e.rootEl,n=e.name,r=e.targetEl,i=e.cloneEl,s=e.toEl,l=e.fromEl,a=e.oldIndex,c=e.newIndex,d=e.oldDraggableIndex,u=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,v=e.extraEventProperties;t=t||o&&o[expando];if(!t)return;var p,g=t.options,m="on"+n.charAt(0).toUpperCase()+n.substr(1);if(window.CustomEvent&&!IE11OrLess&&!Edge){p=new CustomEvent(n,{bubbles:true,cancelable:true})}else{p=document.createEvent("Event");p.initEvent(n,true,true)}p.to=s||o;p.from=l||o;p.item=r||o;p.clone=i;p.oldIndex=a;p.newIndex=c;p.oldDraggableIndex=d;p.newDraggableIndex=u;p.originalEvent=f;p.pullMode=h?h.lastPutMode:undefined;var b=_objectSpread2(_objectSpread2({},v),PluginManager.getEventProperties(n,t));for(var x in b){p[x]=b[x]}if(o){o.dispatchEvent(p)}if(g[m]){g[m].call(t,p)}}var _excluded=["evt"];var pluginEvent=function e(t,o){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},r=n.evt,i=_objectWithoutProperties(n,_excluded);PluginManager.pluginEvent.bind(Sortable)(t,o,_objectSpread2({dragEl:dragEl,parentEl:parentEl,ghostEl:ghostEl,rootEl:rootEl,nextEl:nextEl,lastDownEl:lastDownEl,cloneEl:cloneEl,cloneHidden:cloneHidden,dragStarted:moved,putSortable:putSortable,activeSortable:Sortable.active,originalEvent:r,oldIndex:oldIndex,oldDraggableIndex:oldDraggableIndex,newIndex:newIndex,newDraggableIndex:newDraggableIndex,hideGhostForTarget:_hideGhostForTarget,unhideGhostForTarget:_unhideGhostForTarget,cloneNowHidden:function e(){cloneHidden=true},cloneNowShown:function e(){cloneHidden=false},dispatchSortableEvent:function e(t){_dispatchEvent({sortable:o,name:t,originalEvent:r})}},i))};function _dispatchEvent(e){dispatchEvent(_objectSpread2({putSortable:putSortable,cloneEl:cloneEl,targetEl:dragEl,rootEl:rootEl,oldIndex:oldIndex,oldDraggableIndex:oldDraggableIndex,newIndex:newIndex,newDraggableIndex:newDraggableIndex},e))}var dragEl,parentEl,ghostEl,rootEl,nextEl,lastDownEl,cloneEl,cloneHidden,oldIndex,newIndex,oldDraggableIndex,newDraggableIndex,activeGroup,putSortable,awaitingDragStarted=false,ignoreNextClick=false,sortables=[],tapEvt,touchEvt,lastDx,lastDy,tapDistanceLeft,tapDistanceTop,moved,lastTarget,lastDirection,pastFirstInvertThresh=false,isCircumstantialInvert=false,targetMoveDistance,ghostRelativeParent,ghostRelativeParentInitialScroll=[],_silent=false,savedInputChecked=[];var documentExists=typeof document!=="undefined",PositionGhostAbsolutely=IOS,CSSFloatProperty=Edge||IE11OrLess?"cssFloat":"float",supportDraggable=documentExists&&!ChromeForAndroid&&!IOS&&"draggable"in document.createElement("div"),supportCssPointerEvents=function(){if(!documentExists)return;if(IE11OrLess){return false}var e=document.createElement("x");e.style.cssText="pointer-events:auto";return e.style.pointerEvents==="auto"}(),_detectDirection=function e(t,o){var n=css(t),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=getChild(t,0,o),s=getChild(t,1,o),l=i&&css(i),a=s&&css(s),c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+getRect(i).width,d=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+getRect(s).width;if(n.display==="flex"){return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal"}if(n.display==="grid"){return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal"}if(i&&l["float"]&&l["float"]!=="none"){var u=l["float"]==="left"?"left":"right";return s&&(a.clear==="both"||a.clear===u)?"vertical":"horizontal"}return i&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||c>=r&&n[CSSFloatProperty]==="none"||s&&n[CSSFloatProperty]==="none"&&c+d>r)?"vertical":"horizontal"},_dragElInRowColumn=function e(t,o,n){var r=n?t.left:t.top,i=n?t.right:t.bottom,s=n?t.width:t.height,l=n?o.left:o.top,a=n?o.right:o.bottom,c=n?o.width:o.height;return r===l||i===a||r+s/2===l+c/2},_detectNearestEmptySortable=function e(t,o){var n;sortables.some((function(e){var r=e[expando].options.emptyInsertThreshold;if(!r||lastChild(e))return;var i=getRect(e),s=t>=i.left-r&&t<=i.right+r,l=o>=i.top-r&&o<=i.bottom+r;if(s&&l){return n=e}}));return n},_prepareGroup=function e(t){function o(e,t){return function(n,r,i,s){var l=n.options.group.name&&r.options.group.name&&n.options.group.name===r.options.group.name;if(e==null&&(t||l)){return true}else if(e==null||e===false){return false}else if(t&&e==="clone"){return e}else if(typeof e==="function"){return o(e(n,r,i,s),t)(n,r,i,s)}else{var a=(t?n:r).options.group.name;return e===true||typeof e==="string"&&e===a||e.join&&e.indexOf(a)>-1}}}var n={};var r=t.group;if(!r||_typeof(r)!="object"){r={name:r}}n.name=r.name;n.checkPull=o(r.pull,true);n.checkPut=o(r.put);n.revertClone=r.revertClone;t.group=n},_hideGhostForTarget=function e(){if(!supportCssPointerEvents&&ghostEl){css(ghostEl,"display","none")}},_unhideGhostForTarget=function e(){if(!supportCssPointerEvents&&ghostEl){css(ghostEl,"display","")}};if(documentExists&&!ChromeForAndroid){document.addEventListener("click",(function(e){if(ignoreNextClick){e.preventDefault();e.stopPropagation&&e.stopPropagation();e.stopImmediatePropagation&&e.stopImmediatePropagation();ignoreNextClick=false;return false}}),true)}var nearestEmptyInsertDetectEvent=function e(t){if(dragEl){t=t.touches?t.touches[0]:t;var o=_detectNearestEmptySortable(t.clientX,t.clientY);if(o){var n={};for(var r in t){if(t.hasOwnProperty(r)){n[r]=t[r]}}n.target=n.rootEl=o;n.preventDefault=void 0;n.stopPropagation=void 0;o[expando]._onDragOver(n)}}};var _checkOutsideTargetEl=function e(t){if(dragEl){dragEl.parentNode[expando]._isOutsideThisEl(t.target)}};function Sortable(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=_extends({},t);e[expando]=this;var o={group:null,sort:true,disabled:false,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:false,invertedSwapThreshold:null,removeCloneOnHide:true,direction:function t(){return _detectDirection(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:true,animation:0,easing:null,setData:function e(t,o){t.setData("Text",o.textContent)},dropBubble:false,dragoverBubble:false,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:false,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:false,fallbackClass:"sortable-fallback",fallbackOnBody:false,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:Sortable.supportPointer!==false&&"PointerEvent"in window&&(!Safari||IOS),emptyInsertThreshold:5};PluginManager.initializePlugins(this,e,o);for(var n in o){!(n in t)&&(t[n]=o[n])}_prepareGroup(t);for(var r in this){if(r.charAt(0)==="_"&&typeof this[r]==="function"){this[r]=this[r].bind(this)}}this.nativeDraggable=t.forceFallback?false:supportDraggable;if(this.nativeDraggable){this.options.touchStartThreshold=1}if(t.supportPointer){on(e,"pointerdown",this._onTapStart)}else{on(e,"mousedown",this._onTapStart);on(e,"touchstart",this._onTapStart)}if(this.nativeDraggable){on(e,"dragover",this);on(e,"dragenter",this)}sortables.push(this.el);t.store&&t.store.get&&this.sort(t.store.get(this)||[]);_extends(this,AnimationStateManager())}Sortable.prototype={constructor:Sortable,_isOutsideThisEl:function e(t){if(!this.el.contains(t)&&t!==this.el){lastTarget=null}},_getDirection:function e(t,o){return typeof this.options.direction==="function"?this.options.direction.call(this,t,o,dragEl):this.options.direction},_onTapStart:function e(t){if(!t.cancelable)return;var o=this,n=this.el,r=this.options,i=r.preventOnFilter,s=t.type,l=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(l||t).target,c=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,d=r.filter;_saveInputCheckedState(n);if(dragEl){return}if(/mousedown|pointerdown/.test(s)&&t.button!==0||r.disabled){return}if(c.isContentEditable){return}if(!this.nativeDraggable&&Safari&&a&&a.tagName.toUpperCase()==="SELECT"){return}a=closest(a,r.draggable,n,false);if(a&&a.animated){return}if(lastDownEl===a){return}oldIndex=index(a);oldDraggableIndex=index(a,r.draggable);if(typeof d==="function"){if(d.call(this,t,a,this)){_dispatchEvent({sortable:o,rootEl:c,name:"filter",targetEl:a,toEl:n,fromEl:n});pluginEvent("filter",o,{evt:t});i&&t.preventDefault();return}}else if(d){d=d.split(",").some((function(e){e=closest(c,e.trim(),n,false);if(e){_dispatchEvent({sortable:o,rootEl:e,name:"filter",targetEl:a,fromEl:n,toEl:n});pluginEvent("filter",o,{evt:t});return true}}));if(d){i&&t.preventDefault();return}}if(r.handle&&!closest(c,r.handle,n,false)){return}this._prepareDragStart(t,l,a)},_prepareDragStart:function e(t,o,n){var r=this,i=r.el,s=r.options,l=i.ownerDocument,a;if(n&&!dragEl&&n.parentNode===i){var c=getRect(n);rootEl=i;dragEl=n;parentEl=dragEl.parentNode;nextEl=dragEl.nextSibling;lastDownEl=n;activeGroup=s.group;Sortable.dragged=dragEl;tapEvt={target:dragEl,clientX:(o||t).clientX,clientY:(o||t).clientY};tapDistanceLeft=tapEvt.clientX-c.left;tapDistanceTop=tapEvt.clientY-c.top;this._lastX=(o||t).clientX;this._lastY=(o||t).clientY;dragEl.style["will-change"]="all";a=function e(){pluginEvent("delayEnded",r,{evt:t});if(Sortable.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents();if(!FireFox&&r.nativeDraggable){dragEl.draggable=true}r._triggerDragStart(t,o);_dispatchEvent({sortable:r,name:"choose",originalEvent:t});toggleClass(dragEl,s.chosenClass,true)};s.ignore.split(",").forEach((function(e){find(dragEl,e.trim(),_disableDraggable)}));on(l,"dragover",nearestEmptyInsertDetectEvent);on(l,"mousemove",nearestEmptyInsertDetectEvent);on(l,"touchmove",nearestEmptyInsertDetectEvent);if(s.supportPointer){on(l,"pointerup",r._onDrop);!this.nativeDraggable&&on(l,"pointercancel",r._onDrop)}else{on(l,"mouseup",r._onDrop);on(l,"touchend",r._onDrop);on(l,"touchcancel",r._onDrop)}if(FireFox&&this.nativeDraggable){this.options.touchStartThreshold=4;dragEl.draggable=true}pluginEvent("delayStart",this,{evt:t});if(s.delay&&(!s.delayOnTouchOnly||o)&&(!this.nativeDraggable||!(Edge||IE11OrLess))){if(Sortable.eventCanceled){this._onDrop();return}if(s.supportPointer){on(l,"pointerup",r._disableDelayedDrag);on(l,"pointercancel",r._disableDelayedDrag)}else{on(l,"mouseup",r._disableDelayedDrag);on(l,"touchend",r._disableDelayedDrag);on(l,"touchcancel",r._disableDelayedDrag)}on(l,"mousemove",r._delayedDragTouchMoveHandler);on(l,"touchmove",r._delayedDragTouchMoveHandler);s.supportPointer&&on(l,"pointermove",r._delayedDragTouchMoveHandler);r._dragStartTimer=setTimeout(a,s.delay)}else{a()}}},_delayedDragTouchMoveHandler:function e(t){var o=t.touches?t.touches[0]:t;if(Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))){this._disableDelayedDrag()}},_disableDelayedDrag:function e(){dragEl&&_disableDraggable(dragEl);clearTimeout(this._dragStartTimer);this._disableDelayedDragEvents()},_disableDelayedDragEvents:function e(){var t=this.el.ownerDocument;off(t,"mouseup",this._disableDelayedDrag);off(t,"touchend",this._disableDelayedDrag);off(t,"touchcancel",this._disableDelayedDrag);off(t,"pointerup",this._disableDelayedDrag);off(t,"pointercancel",this._disableDelayedDrag);off(t,"mousemove",this._delayedDragTouchMoveHandler);off(t,"touchmove",this._delayedDragTouchMoveHandler);off(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function e(t,o){o=o||t.pointerType=="touch"&&t;if(!this.nativeDraggable||o){if(this.options.supportPointer){on(document,"pointermove",this._onTouchMove)}else if(o){on(document,"touchmove",this._onTouchMove)}else{on(document,"mousemove",this._onTouchMove)}}else{on(dragEl,"dragend",this);on(rootEl,"dragstart",this._onDragStart)}try{if(document.selection){_nextTick((function(){document.selection.empty()}))}else{window.getSelection().removeAllRanges()}}catch(e){}},_dragStarted:function e(t,o){awaitingDragStarted=false;if(rootEl&&dragEl){pluginEvent("dragStarted",this,{evt:o});if(this.nativeDraggable){on(document,"dragover",_checkOutsideTargetEl)}var n=this.options;!t&&toggleClass(dragEl,n.dragClass,false);toggleClass(dragEl,n.ghostClass,true);Sortable.active=this;t&&this._appendGhost();_dispatchEvent({sortable:this,name:"start",originalEvent:o})}else{this._nulling()}},_emulateDragOver:function e(){if(touchEvt){this._lastX=touchEvt.clientX;this._lastY=touchEvt.clientY;_hideGhostForTarget();var t=document.elementFromPoint(touchEvt.clientX,touchEvt.clientY);var o=t;while(t&&t.shadowRoot){t=t.shadowRoot.elementFromPoint(touchEvt.clientX,touchEvt.clientY);if(t===o)break;o=t}dragEl.parentNode[expando]._isOutsideThisEl(t);if(o){do{if(o[expando]){var n=void 0;n=o[expando]._onDragOver({clientX:touchEvt.clientX,clientY:touchEvt.clientY,target:t,rootEl:o});if(n&&!this.options.dragoverBubble){break}}t=o}while(o=getParentOrHost(o))}_unhideGhostForTarget()}},_onTouchMove:function e(t){if(tapEvt){var o=this.options,n=o.fallbackTolerance,r=o.fallbackOffset,i=t.touches?t.touches[0]:t,s=ghostEl&&matrix(ghostEl,true),l=ghostEl&&s&&s.a,a=ghostEl&&s&&s.d,c=PositionGhostAbsolutely&&ghostRelativeParent&&getRelativeScrollOffset(ghostRelativeParent),d=(i.clientX-tapEvt.clientX+r.x)/(l||1)+(c?c[0]-ghostRelativeParentInitialScroll[0]:0)/(l||1),u=(i.clientY-tapEvt.clientY+r.y)/(a||1)+(c?c[1]-ghostRelativeParentInitialScroll[1]:0)/(a||1);if(!Sortable.active&&!awaitingDragStarted){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n){return}this._onDragStart(t,true)}if(ghostEl){if(s){s.e+=d-(lastDx||0);s.f+=u-(lastDy||0)}else{s={a:1,b:0,c:0,d:1,e:d,f:u}}var f="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");css(ghostEl,"webkitTransform",f);css(ghostEl,"mozTransform",f);css(ghostEl,"msTransform",f);css(ghostEl,"transform",f);lastDx=d;lastDy=u;touchEvt=i}t.cancelable&&t.preventDefault()}},_appendGhost:function e(){if(!ghostEl){var t=this.options.fallbackOnBody?document.body:rootEl,o=getRect(dragEl,true,PositionGhostAbsolutely,true,t),n=this.options;if(PositionGhostAbsolutely){ghostRelativeParent=t;while(css(ghostRelativeParent,"position")==="static"&&css(ghostRelativeParent,"transform")==="none"&&ghostRelativeParent!==document){ghostRelativeParent=ghostRelativeParent.parentNode}if(ghostRelativeParent!==document.body&&ghostRelativeParent!==document.documentElement){if(ghostRelativeParent===document)ghostRelativeParent=getWindowScrollingElement();o.top+=ghostRelativeParent.scrollTop;o.left+=ghostRelativeParent.scrollLeft}else{ghostRelativeParent=getWindowScrollingElement()}ghostRelativeParentInitialScroll=getRelativeScrollOffset(ghostRelativeParent)}ghostEl=dragEl.cloneNode(true);toggleClass(ghostEl,n.ghostClass,false);toggleClass(ghostEl,n.fallbackClass,true);toggleClass(ghostEl,n.dragClass,true);css(ghostEl,"transition","");css(ghostEl,"transform","");css(ghostEl,"box-sizing","border-box");css(ghostEl,"margin",0);css(ghostEl,"top",o.top);css(ghostEl,"left",o.left);css(ghostEl,"width",o.width);css(ghostEl,"height",o.height);css(ghostEl,"opacity","0.8");css(ghostEl,"position",PositionGhostAbsolutely?"absolute":"fixed");css(ghostEl,"zIndex","100000");css(ghostEl,"pointerEvents","none");Sortable.ghost=ghostEl;t.appendChild(ghostEl);css(ghostEl,"transform-origin",tapDistanceLeft/parseInt(ghostEl.style.width)*100+"% "+tapDistanceTop/parseInt(ghostEl.style.height)*100+"%")}},_onDragStart:function e(t,o){var n=this;var r=t.dataTransfer;var i=n.options;pluginEvent("dragStart",this,{evt:t});if(Sortable.eventCanceled){this._onDrop();return}pluginEvent("setupClone",this);if(!Sortable.eventCanceled){cloneEl=clone(dragEl);cloneEl.removeAttribute("id");cloneEl.draggable=false;cloneEl.style["will-change"]="";this._hideClone();toggleClass(cloneEl,this.options.chosenClass,false);Sortable.clone=cloneEl}n.cloneId=_nextTick((function(){pluginEvent("clone",n);if(Sortable.eventCanceled)return;if(!n.options.removeCloneOnHide){rootEl.insertBefore(cloneEl,dragEl)}n._hideClone();_dispatchEvent({sortable:n,name:"clone"})}));!o&&toggleClass(dragEl,i.dragClass,true);if(o){ignoreNextClick=true;n._loopId=setInterval(n._emulateDragOver,50)}else{off(document,"mouseup",n._onDrop);off(document,"touchend",n._onDrop);off(document,"touchcancel",n._onDrop);if(r){r.effectAllowed="move";i.setData&&i.setData.call(n,r,dragEl)}on(document,"drop",n);css(dragEl,"transform","translateZ(0)")}awaitingDragStarted=true;n._dragStartId=_nextTick(n._dragStarted.bind(n,o,t));on(document,"selectstart",n);moved=true;window.getSelection().removeAllRanges();if(Safari){css(document.body,"user-select","none")}},_onDragOver:function e(t){var o=this.el,n=t.target,r,i,s,l=this.options,a=l.group,c=Sortable.active,d=activeGroup===a,u=l.sort,f=putSortable||c,h,v=this,p=false;if(_silent)return;function g(e,l){pluginEvent(e,v,_objectSpread2({evt:t,isOwner:d,axis:h?"vertical":"horizontal",revert:s,dragRect:r,targetRect:i,canSort:u,fromSortable:f,target:n,completed:b,onMove:function e(n,i){return _onMove(rootEl,o,dragEl,r,n,getRect(n),t,i)},changed:x},l))}function m(){g("dragOverAnimationCapture");v.captureAnimationState();if(v!==f){f.captureAnimationState()}}function b(e){g("dragOverCompleted",{insertion:e});if(e){if(d){c._hideClone()}else{c._showClone(v)}if(v!==f){toggleClass(dragEl,putSortable?putSortable.options.ghostClass:c.options.ghostClass,false);toggleClass(dragEl,l.ghostClass,true)}if(putSortable!==v&&v!==Sortable.active){putSortable=v}else if(v===Sortable.active&&putSortable){putSortable=null}if(f===v){v._ignoreWhileAnimating=n}v.animateAll((function(){g("dragOverAnimationComplete");v._ignoreWhileAnimating=null}));if(v!==f){f.animateAll();f._ignoreWhileAnimating=null}}if(n===dragEl&&!dragEl.animated||n===o&&!n.animated){lastTarget=null}if(!l.dragoverBubble&&!t.rootEl&&n!==document){dragEl.parentNode[expando]._isOutsideThisEl(t.target);!e&&nearestEmptyInsertDetectEvent(t)}!l.dragoverBubble&&t.stopPropagation&&t.stopPropagation();return p=true}function x(){newIndex=index(dragEl);newDraggableIndex=index(dragEl,l.draggable);_dispatchEvent({sortable:v,name:"change",toEl:o,newIndex:newIndex,newDraggableIndex:newDraggableIndex,originalEvent:t})}if(t.preventDefault!==void 0){t.cancelable&&t.preventDefault()}n=closest(n,l.draggable,o,true);g("dragOver");if(Sortable.eventCanceled)return p;if(dragEl.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||v._ignoreWhileAnimating===n){return b(false)}ignoreNextClick=false;if(c&&!l.disabled&&(d?u||(s=parentEl!==rootEl):putSortable===this||(this.lastPutMode=activeGroup.checkPull(this,c,dragEl,t))&&a.checkPut(this,c,dragEl,t))){h=this._getDirection(t,n)==="vertical";r=getRect(dragEl);g("dragOverValid");if(Sortable.eventCanceled)return p;if(s){parentEl=rootEl;m();this._hideClone();g("revert");if(!Sortable.eventCanceled){if(nextEl){rootEl.insertBefore(dragEl,nextEl)}else{rootEl.appendChild(dragEl)}}return b(true)}var E=lastChild(o,l.draggable);if(!E||_ghostIsLast(t,h,this)&&!E.animated){if(E===dragEl){return b(false)}if(E&&o===t.target){n=E}if(n){i=getRect(n)}if(_onMove(rootEl,o,dragEl,r,n,i,t,!!n)!==false){m();if(E&&E.nextSibling){o.insertBefore(dragEl,E.nextSibling)}else{o.appendChild(dragEl)}parentEl=o;x();return b(true)}}else if(E&&_ghostIsFirst(t,h,this)){var w=getChild(o,0,l,true);if(w===dragEl){return b(false)}n=w;i=getRect(n);if(_onMove(rootEl,o,dragEl,r,n,i,t,false)!==false){m();o.insertBefore(dragEl,w);parentEl=o;x();return b(true)}}else if(n.parentNode===o){i=getRect(n);var S=0,_,y=dragEl.parentNode!==o,I=!_dragElInRowColumn(dragEl.animated&&dragEl.toRect||r,n.animated&&n.toRect||i,h),C=h?"top":"left",k=isScrolledPast(n,"top","top")||isScrolledPast(dragEl,"top","top"),T=k?k.scrollTop:void 0;if(lastTarget!==n){_=i[C];pastFirstInvertThresh=false;isCircumstantialInvert=!I&&l.invertSwap||y}S=_getSwapDirection(t,n,i,h,I?1:l.swapThreshold,l.invertedSwapThreshold==null?l.swapThreshold:l.invertedSwapThreshold,isCircumstantialInvert,lastTarget===n);var D;if(S!==0){var q=index(dragEl);do{q-=S;D=parentEl.children[q]}while(D&&(css(D,"display")==="none"||D===ghostEl))}if(S===0||D===n){return b(false)}lastTarget=n;lastDirection=S;var M=n.nextElementSibling,R=false;R=S===1;var A=_onMove(rootEl,o,dragEl,r,n,i,t,R);if(A!==false){if(A===1||A===-1){R=A===1}_silent=true;setTimeout(_unsilent,30);m();if(R&&!M){o.appendChild(dragEl)}else{n.parentNode.insertBefore(dragEl,R?M:n)}if(k){scrollBy(k,0,T-k.scrollTop)}parentEl=dragEl.parentNode;if(_!==undefined&&!isCircumstantialInvert){targetMoveDistance=Math.abs(_-getRect(n)[C])}x();return b(true)}}if(o.contains(dragEl)){return b(false)}}return false},_ignoreWhileAnimating:null,_offMoveEvents:function e(){off(document,"mousemove",this._onTouchMove);off(document,"touchmove",this._onTouchMove);off(document,"pointermove",this._onTouchMove);off(document,"dragover",nearestEmptyInsertDetectEvent);off(document,"mousemove",nearestEmptyInsertDetectEvent);off(document,"touchmove",nearestEmptyInsertDetectEvent)},_offUpEvents:function e(){var t=this.el.ownerDocument;off(t,"mouseup",this._onDrop);off(t,"touchend",this._onDrop);off(t,"pointerup",this._onDrop);off(t,"pointercancel",this._onDrop);off(t,"touchcancel",this._onDrop);off(document,"selectstart",this)},_onDrop:function e(t){var o=this.el,n=this.options;newIndex=index(dragEl);newDraggableIndex=index(dragEl,n.draggable);pluginEvent("drop",this,{evt:t});parentEl=dragEl&&dragEl.parentNode;newIndex=index(dragEl);newDraggableIndex=index(dragEl,n.draggable);if(Sortable.eventCanceled){this._nulling();return}awaitingDragStarted=false;isCircumstantialInvert=false;pastFirstInvertThresh=false;clearInterval(this._loopId);clearTimeout(this._dragStartTimer);_cancelNextTick(this.cloneId);_cancelNextTick(this._dragStartId);if(this.nativeDraggable){off(document,"drop",this);off(o,"dragstart",this._onDragStart)}this._offMoveEvents();this._offUpEvents();if(Safari){css(document.body,"user-select","")}css(dragEl,"transform","");if(t){if(moved){t.cancelable&&t.preventDefault();!n.dropBubble&&t.stopPropagation()}ghostEl&&ghostEl.parentNode&&ghostEl.parentNode.removeChild(ghostEl);if(rootEl===parentEl||putSortable&&putSortable.lastPutMode!=="clone"){cloneEl&&cloneEl.parentNode&&cloneEl.parentNode.removeChild(cloneEl)}if(dragEl){if(this.nativeDraggable){off(dragEl,"dragend",this)}_disableDraggable(dragEl);dragEl.style["will-change"]="";if(moved&&!awaitingDragStarted){toggleClass(dragEl,putSortable?putSortable.options.ghostClass:this.options.ghostClass,false)}toggleClass(dragEl,this.options.chosenClass,false);_dispatchEvent({sortable:this,name:"unchoose",toEl:parentEl,newIndex:null,newDraggableIndex:null,originalEvent:t});if(rootEl!==parentEl){if(newIndex>=0){_dispatchEvent({rootEl:parentEl,name:"add",toEl:parentEl,fromEl:rootEl,originalEvent:t});_dispatchEvent({sortable:this,name:"remove",toEl:parentEl,originalEvent:t});_dispatchEvent({rootEl:parentEl,name:"sort",toEl:parentEl,fromEl:rootEl,originalEvent:t});_dispatchEvent({sortable:this,name:"sort",toEl:parentEl,originalEvent:t})}putSortable&&putSortable.save()}else{if(newIndex!==oldIndex){if(newIndex>=0){_dispatchEvent({sortable:this,name:"update",toEl:parentEl,originalEvent:t});_dispatchEvent({sortable:this,name:"sort",toEl:parentEl,originalEvent:t})}}}if(Sortable.active){if(newIndex==null||newIndex===-1){newIndex=oldIndex;newDraggableIndex=oldDraggableIndex}_dispatchEvent({sortable:this,name:"end",toEl:parentEl,originalEvent:t});this.save()}}}this._nulling()},_nulling:function e(){pluginEvent("nulling",this);rootEl=dragEl=parentEl=ghostEl=nextEl=cloneEl=lastDownEl=cloneHidden=tapEvt=touchEvt=moved=newIndex=newDraggableIndex=oldIndex=oldDraggableIndex=lastTarget=lastDirection=putSortable=activeGroup=Sortable.dragged=Sortable.ghost=Sortable.clone=Sortable.active=null;savedInputChecked.forEach((function(e){e.checked=true}));savedInputChecked.length=lastDx=lastDy=0},handleEvent:function e(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":if(dragEl){this._onDragOver(t);_globalDragOver(t)}break;case"selectstart":t.preventDefault();break}},toArray:function e(){var t=[],o,n=this.el.children,r=0,i=n.length,s=this.options;for(;r<i;r++){o=n[r];if(closest(o,s.draggable,this.el,false)){t.push(o.getAttribute(s.dataIdAttr)||_generateId(o))}}return t},sort:function e(t,o){var n={},r=this.el;this.toArray().forEach((function(e,t){var o=r.children[t];if(closest(o,this.options.draggable,r,false)){n[e]=o}}),this);o&&this.captureAnimationState();t.forEach((function(e){if(n[e]){r.removeChild(n[e]);r.appendChild(n[e])}}));o&&this.animateAll()},save:function e(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function e(t,o){return closest(t,o||this.options.draggable,this.el,false)},option:function e(t,o){var n=this.options;if(o===void 0){return n[t]}else{var r=PluginManager.modifyOption(this,t,o);if(typeof r!=="undefined"){n[t]=r}else{n[t]=o}if(t==="group"){_prepareGroup(n)}}},destroy:function e(){pluginEvent("destroy",this);var t=this.el;t[expando]=null;off(t,"mousedown",this._onTapStart);off(t,"touchstart",this._onTapStart);off(t,"pointerdown",this._onTapStart);if(this.nativeDraggable){off(t,"dragover",this);off(t,"dragenter",this)}Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")}));this._onDrop();this._disableDelayedDragEvents();sortables.splice(sortables.indexOf(this.el),1);this.el=t=null},_hideClone:function e(){if(!cloneHidden){pluginEvent("hideClone",this);if(Sortable.eventCanceled)return;css(cloneEl,"display","none");if(this.options.removeCloneOnHide&&cloneEl.parentNode){cloneEl.parentNode.removeChild(cloneEl)}cloneHidden=true}},_showClone:function e(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(cloneHidden){pluginEvent("showClone",this);if(Sortable.eventCanceled)return;if(dragEl.parentNode==rootEl&&!this.options.group.revertClone){rootEl.insertBefore(cloneEl,dragEl)}else if(nextEl){rootEl.insertBefore(cloneEl,nextEl)}else{rootEl.appendChild(cloneEl)}if(this.options.group.revertClone){this.animate(dragEl,cloneEl)}css(cloneEl,"display","");cloneHidden=false}}};function _globalDragOver(e){if(e.dataTransfer){e.dataTransfer.dropEffect="move"}e.cancelable&&e.preventDefault()}function _onMove(e,t,o,n,r,i,s,l){var a,c=e[expando],d=c.options.onMove,u;if(window.CustomEvent&&!IE11OrLess&&!Edge){a=new CustomEvent("move",{bubbles:true,cancelable:true})}else{a=document.createEvent("Event");a.initEvent("move",true,true)}a.to=t;a.from=e;a.dragged=o;a.draggedRect=n;a.related=r||t;a.relatedRect=i||getRect(t);a.willInsertAfter=l;a.originalEvent=s;e.dispatchEvent(a);if(d){u=d.call(c,a,s)}return u}function _disableDraggable(e){e.draggable=false}function _unsilent(){_silent=false}function _ghostIsFirst(e,t,o){var n=getRect(getChild(o.el,0,o.options,true));var r=getChildContainingRectFromElement(o.el,o.options,ghostEl);var i=10;return t?e.clientX<r.left-i||e.clientY<n.top&&e.clientX<n.right:e.clientY<r.top-i||e.clientY<n.bottom&&e.clientX<n.left}function _ghostIsLast(e,t,o){var n=getRect(lastChild(o.el,o.options.draggable));var r=getChildContainingRectFromElement(o.el,o.options,ghostEl);var i=10;return t?e.clientX>r.right+i||e.clientY>n.bottom&&e.clientX>n.left:e.clientY>r.bottom+i||e.clientX>n.right&&e.clientY>n.top}function _getSwapDirection(e,t,o,n,r,i,s,l){var a=n?e.clientY:e.clientX,c=n?o.height:o.width,d=n?o.top:o.left,u=n?o.bottom:o.right,f=false;if(!s){if(l&&targetMoveDistance<c*r){if(!pastFirstInvertThresh&&(lastDirection===1?a>d+c*i/2:a<u-c*i/2)){pastFirstInvertThresh=true}if(!pastFirstInvertThresh){if(lastDirection===1?a<d+targetMoveDistance:a>u-targetMoveDistance){return-lastDirection}}else{f=true}}else{if(a>d+c*(1-r)/2&&a<u-c*(1-r)/2){return _getInsertDirection(t)}}}f=f||s;if(f){if(a<d+c*i/2||a>u-c*i/2){return a>d+c/2?1:-1}}return 0}function _getInsertDirection(e){if(index(dragEl)<index(e)){return 1}else{return-1}}function _generateId(e){var t=e.tagName+e.className+e.src+e.href+e.textContent,o=t.length,n=0;while(o--){n+=t.charCodeAt(o)}return n.toString(36)}function _saveInputCheckedState(e){savedInputChecked.length=0;var t=e.getElementsByTagName("input");var o=t.length;while(o--){var n=t[o];n.checked&&savedInputChecked.push(n)}}function _nextTick(e){return setTimeout(e,0)}function _cancelNextTick(e){return clearTimeout(e)}if(documentExists){on(document,"touchmove",(function(e){if((Sortable.active||awaitingDragStarted)&&e.cancelable){e.preventDefault()}}))}Sortable.utils={on:on,off:off,css:css,find:find,is:function e(t,o){return!!closest(t,o,t,false)},extend:extend,throttle:throttle,closest:closest,toggleClass:toggleClass,clone:clone,index:index,nextTick:_nextTick,cancelNextTick:_cancelNextTick,detectDirection:_detectDirection,getChild:getChild,expando:expando};Sortable.get=function(e){return e[expando]};Sortable.mount=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++){t[o]=arguments[o]}if(t[0].constructor===Array)t=t[0];t.forEach((function(e){if(!e.prototype||!e.prototype.constructor){throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e))}if(e.utils)Sortable.utils=_objectSpread2(_objectSpread2({},Sortable.utils),e.utils);PluginManager.mount(e)}))};Sortable.create=function(e,t){return new Sortable(e,t)};Sortable.version=version;var autoScrolls=[],scrollEl,scrollRootEl,scrolling=false,lastAutoScrollX,lastAutoScrollY,touchEvt$1,pointerElemChangedInterval;function AutoScrollPlugin(){function e(){this.defaults={scroll:true,forceAutoScrollFallback:false,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:true};for(var e in this){if(e.charAt(0)==="_"&&typeof this[e]==="function"){this[e]=this[e].bind(this)}}}e.prototype={dragStarted:function e(t){var o=t.originalEvent;if(this.sortable.nativeDraggable){on(document,"dragover",this._handleAutoScroll)}else{if(this.options.supportPointer){on(document,"pointermove",this._handleFallbackAutoScroll)}else if(o.touches){on(document,"touchmove",this._handleFallbackAutoScroll)}else{on(document,"mousemove",this._handleFallbackAutoScroll)}}},dragOverCompleted:function e(t){var o=t.originalEvent;if(!this.options.dragOverBubble&&!o.rootEl){this._handleAutoScroll(o)}},drop:function e(){if(this.sortable.nativeDraggable){off(document,"dragover",this._handleAutoScroll)}else{off(document,"pointermove",this._handleFallbackAutoScroll);off(document,"touchmove",this._handleFallbackAutoScroll);off(document,"mousemove",this._handleFallbackAutoScroll)}clearPointerElemChangedInterval();clearAutoScrolls();cancelThrottle()},nulling:function e(){touchEvt$1=scrollRootEl=scrollEl=scrolling=pointerElemChangedInterval=lastAutoScrollX=lastAutoScrollY=null;autoScrolls.length=0},_handleFallbackAutoScroll:function e(t){this._handleAutoScroll(t,true)},_handleAutoScroll:function e(t,o){var n=this;var r=(t.touches?t.touches[0]:t).clientX,i=(t.touches?t.touches[0]:t).clientY,s=document.elementFromPoint(r,i);touchEvt$1=t;if(o||this.options.forceAutoScrollFallback||Edge||IE11OrLess||Safari){autoScroll(t,this.options,s,o);var l=getParentAutoScrollElement(s,true);if(scrolling&&(!pointerElemChangedInterval||r!==lastAutoScrollX||i!==lastAutoScrollY)){pointerElemChangedInterval&&clearPointerElemChangedInterval();pointerElemChangedInterval=setInterval((function(){var e=getParentAutoScrollElement(document.elementFromPoint(r,i),true);if(e!==l){l=e;clearAutoScrolls()}autoScroll(t,n.options,e,o)}),10);lastAutoScrollX=r;lastAutoScrollY=i}}else{if(!this.options.bubbleScroll||getParentAutoScrollElement(s,true)===getWindowScrollingElement()){clearAutoScrolls();return}autoScroll(t,this.options,getParentAutoScrollElement(s,false),false)}}};return _extends(e,{pluginName:"scroll",initializeByDefault:true})}function clearAutoScrolls(){autoScrolls.forEach((function(e){clearInterval(e.pid)}));autoScrolls=[]}function clearPointerElemChangedInterval(){clearInterval(pointerElemChangedInterval)}var autoScroll=throttle((function(e,t,o,n){if(!t.scroll)return;var r=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,l=t.scrollSpeed,a=getWindowScrollingElement();var c=false,d;if(scrollRootEl!==o){scrollRootEl=o;clearAutoScrolls();scrollEl=t.scroll;d=t.scrollFn;if(scrollEl===true){scrollEl=getParentAutoScrollElement(o,true)}}var u=0;var f=scrollEl;do{var h=f,v=getRect(h),p=v.top,g=v.bottom,m=v.left,b=v.right,x=v.width,E=v.height,w=void 0,S=void 0,_=h.scrollWidth,y=h.scrollHeight,I=css(h),C=h.scrollLeft,k=h.scrollTop;if(h===a){w=x<_&&(I.overflowX==="auto"||I.overflowX==="scroll"||I.overflowX==="visible");S=E<y&&(I.overflowY==="auto"||I.overflowY==="scroll"||I.overflowY==="visible")}else{w=x<_&&(I.overflowX==="auto"||I.overflowX==="scroll");S=E<y&&(I.overflowY==="auto"||I.overflowY==="scroll")}var T=w&&(Math.abs(b-r)<=s&&C+x<_)-(Math.abs(m-r)<=s&&!!C);var D=S&&(Math.abs(g-i)<=s&&k+E<y)-(Math.abs(p-i)<=s&&!!k);if(!autoScrolls[u]){for(var q=0;q<=u;q++){if(!autoScrolls[q]){autoScrolls[q]={}}}}if(autoScrolls[u].vx!=T||autoScrolls[u].vy!=D||autoScrolls[u].el!==h){autoScrolls[u].el=h;autoScrolls[u].vx=T;autoScrolls[u].vy=D;clearInterval(autoScrolls[u].pid);if(T!=0||D!=0){c=true;autoScrolls[u].pid=setInterval(function(){if(n&&this.layer===0){Sortable.active._onTouchMove(touchEvt$1)}var t=autoScrolls[this.layer].vy?autoScrolls[this.layer].vy*l:0;var o=autoScrolls[this.layer].vx?autoScrolls[this.layer].vx*l:0;if(typeof d==="function"){if(d.call(Sortable.dragged.parentNode[expando],o,t,e,touchEvt$1,autoScrolls[this.layer].el)!=="continue"){return}}scrollBy(autoScrolls[this.layer].el,o,t)}.bind({layer:u}),24)}}u++}while(t.bubbleScroll&&f!==a&&(f=getParentAutoScrollElement(f,false)));scrolling=c}),30);var drop=function e(t){var o=t.originalEvent,n=t.putSortable,r=t.dragEl,i=t.activeSortable,s=t.dispatchSortableEvent,l=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(!o)return;var c=n||i;l();var d=o.changedTouches&&o.changedTouches.length?o.changedTouches[0]:o;var u=document.elementFromPoint(d.clientX,d.clientY);a();if(c&&!c.el.contains(u)){s("spill");this.onSpill({dragEl:r,putSortable:n})}};function Revert(){}Revert.prototype={startIndex:null,dragStart:function e(t){var o=t.oldDraggableIndex;this.startIndex=o},onSpill:function e(t){var o=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState();if(n){n.captureAnimationState()}var r=getChild(this.sortable.el,this.startIndex,this.options);if(r){this.sortable.el.insertBefore(o,r)}else{this.sortable.el.appendChild(o)}this.sortable.animateAll();if(n){n.animateAll()}},drop:drop};_extends(Revert,{pluginName:"revertOnSpill"});function Remove(){}Remove.prototype={onSpill:function e(t){var o=t.dragEl,n=t.putSortable;var r=n||this.sortable;r.captureAnimationState();o.parentNode&&o.parentNode.removeChild(o);r.animateAll()},drop:drop};_extends(Remove,{pluginName:"removeOnSpill"});Sortable.mount(new AutoScrollPlugin);Sortable.mount(Remove,Revert);var verdocsTemplateRolesCss='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;max-width:600px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles .roles{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:10px;margin-top:10px}verdocs-template-roles .roles .sequence{gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;padding:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;border-bottom:1px dotted #e3e3e3}verdocs-template-roles .roles .sequence.add-sequence{color:#777777;line-height:34px}verdocs-template-roles .roles .sequence-label{font-size:18px;line-height:32px}verdocs-template-roles .roles .sequence-roles{gap:10px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .roles .role{height:32px;cursor:move;display:-ms-flexbox;display:flex;max-width:200px;position:relative;border-radius:32px;background-color:#eff7fb;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 14px 0 34px;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column}verdocs-template-roles .roles .role .role-name{font-size:14px;overflow:hidden;font-weight:400;line-height:30px;white-space:nowrap;text-overflow:ellipsis}verdocs-template-roles .roles .role .icons{position:absolute;left:1px;top:-3px;cursor:pointer;padding:5px;z-index:10}verdocs-template-roles .roles .role .icons .gear-button{display:none;-webkit-transform:scale(1.1);transform:scale(1.1);margin:4px 0 0 1px}verdocs-template-roles .roles .role .icons .type-icon{opacity:0.6;display:block;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-roles .roles .role .icons:hover .gear-button{display:block}verdocs-template-roles .roles .role .icons:hover .type-icon{display:none}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{opacity:0.3;padding:0 10px;cursor:pointer;background:none;height:32px;border:1px solid #cccccc;border-radius:32px}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles .sequence-roles{display:-ms-flexbox;display:flex;max-width:400px}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';var VerdocsTemplateRolesStyle0=verdocsTemplateRolesCss;var settingsIcon='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';var plusIcon='<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';var iconSigner='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';var iconApprover='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>';var iconCC='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>';var VerdocsTemplateRoles=function(){function e(e){registerInstance(this,e);this.next=createEvent(this,"next",7);this.exit=createEvent(this,"exit",7);this.sdkError=createEvent(this,"sdkError",7);this.rolesUpdated=createEvent(this,"rolesUpdated",7);this.templateListenerId=null;this.sortableRefs=[];this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.showingRoleDialog=null;this.sender=null;this.dragging=false;this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate();this.cleanupSortables()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[ROLES] Loading template",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){console.log("[ROLES] Template Updated",t);e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o;return __generator(this,(function(n){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(n){console.log("[ROLES] Error with preview session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(o=n.response)===null||o===void 0?void 0:o.data))}return[2]}))}))};e.prototype.cleanupSortables=function(){this.sortableRefs.forEach((function(e){return e.destroy()}));this.sortableRefs.length=0};e.prototype.componentDidRender=function(){var e=this;this.cleanupSortables();var t=this.getSequenceNumbers();(t||[]).forEach((function(t){var o=document.getElementById("verdocs-roles-sequence-".concat(t));if(o){var n=new Sortable(o,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:e.handleMoveEnd.bind(e),onChoose:function(){return e.dragging=true},onUnchoose:function(){return e.dragging=false}});e.sortableRefs.push(n)}}));var o=document.getElementById("verdocs-roles-sequence-add-target");if(o){console.log("[ROLES] Applying sortable to add-sequence slot");var n=new Sortable(o,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:this.handleMoveEnd.bind(this),onChoose:function(){return e.dragging=true},onUnchoose:function(){return e.dragging=false}});this.sortableRefs.push(n)}};e.prototype.handleMoveEnd=function(e){var t=this;var o=+e.from.dataset.sequence;var n=+e.to.dataset.sequence;var r=+e.oldIndex+1;var i=+e.newIndex+1;console.log("Move from ".concat(o,":").concat(r," to ").concat(n,":").concat(i),e.item);var s={};var l=this.getSequenceNumbers();l.forEach((function(e){var o=t.getRolesAtSequence(e);s[String(e)]=JSON.parse(JSON.stringify(o))}));s[l[l.length-1]+1]=[];var a=s[o].splice(r-1,1)[0];s[n]||(s[n]=[]);s[n].splice(i-1,0,a);var c=[];Object.entries(s).forEach((function(e){var o=e[0],n=e[1];n.forEach((function(e,n){if(!e){return}var r=+n+1;if(e.sequence!==+o||e.order!==r){e.sequence=+o;e.order=r;c.push(updateTemplateRole(t.endpoint,t.templateId,e.name,{sequence:+o,order:r}).then((function(t){return console.log("[ROLES] Updated role",e.name,t)})).catch((function(e){return console.log("[ROLES] Error updating role",e)})))}}))}));return Promise.all(c).then((function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){return[2,console.log("[ROLES] Done renumbering")]}))}))})).catch((function(e){return console.log("[ROLES] Error updating roles",e)}))};e.prototype.handleCancel=function(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()};e.prototype.handleSubmit=function(){var e;(e=this.next)===null||e===void 0?void 0:e.emit()};e.prototype.getSortedRoles=function(){var e;return(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).sort((function(e,t){return e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence}))};e.prototype.getSequenceNumbers=function(){var e;var t=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.sequence}));var o=__spreadArray([],new Set(t),true);o.sort((function(e,t){return e-t}));return o};e.prototype.getRoleNames=function(){var e=this.getSortedRoles();return e.map((function(e){return e.name}))};e.prototype.getRolesAtSequence=function(e){var t;return(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t&&t.sequence===e}))};e.prototype.renumberTemplateRoles=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,n;var r=this;return __generator(this,(function(i){switch(i.label){case 0:t={};o=[];n=this.getSequenceNumbers();(n||[]).forEach((function(e){(t[e]||[]).forEach((function(t,n){var i=+n+1;if(t.sequence!==+e||t.order!==i){console.log("[ROLES] Updating role",t.name,"from",t.sequence,t.order,"to",e,i);t.sequence=+e;t.order=i;o.push(updateTemplateRole(r.endpoint,r.templateId,t.name,{sequence:+e,order:i}).then((function(e){return console.log("[ROLES] Updated role",t.name,e)})).catch((function(e){return console.log("[ROLES] Error updating role",e)})))}}))}));console.log("[ROLES] Awaiting ".concat(o.length," renumber requests"));return[4,Promise.all(o).then((function(){return __awaiter(r,void 0,void 0,(function(){var e;return __generator(this,(function(o){e=JSON.parse(JSON.stringify(this.template));e.roles=Object.keys(t).reduce((function(e,o){return e.concat(t[o])}),[]);console.log("[ROLES] Done renumbering",e.roles.map((function(e){return{name:e.name,sequence:e.sequence,order:e.order}})));Store.updateTemplate(this.templateId,e);return[2]}))}))}))];case 1:i.sent();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))};e.prototype.getNextRoleName=function(){var e,t;var o="";var n=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).length;do{n++;o="Recipient ".concat(n)}while(!o||(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).some((function(e){return e&&e.name===o})));return o};e.prototype.callCreateRole=function(e,t,o){var n=this;console.log("[ROLES] Will create role",{name:e,sequence:t,order:o});createTemplateRole(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,message:"",order:o,full_name:null,first_name:"",last_name:"",email:"",phone:"",type:"signer",delegator:false,kba_method:null}).then((function(e){return __awaiter(n,void 0,void 0,(function(){var t;return __generator(this,(function(o){switch(o.label){case 0:console.log("[ROLES] Created role",e);console.log("Updating template in data store");return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 1:o.sent();(t=this.rolesUpdated)===null||t===void 0?void 0:t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))})).catch((function(e){console.log("[ROLES] Error creating role",e)}))};e.prototype.handleAddRole=function(e,t){e.stopPropagation();var o=this.getRolesAtSequence(t).length+1;var n=this.getNextRoleName();this.callCreateRole(n,t,o)};e.prototype.handleAddStep=function(e,t){e.stopPropagation();var o=1;var n=this.getNextRoleName();this.callCreateRole(n,t,o)};e.prototype.render=function(){var e=this;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return h(Host,{class:"loading"},h("verdocs-loader",null))}console.log("[ROLES] Rendering",this.template.roles.map((function(e){return{name:e.name,sequence:e.sequence,order:e.order}})));var t=this.getRoleNames();var o=this.getSequenceNumbers();var n=o&&o.length>0?(o[o.length-1]||0)+1:1;return h(Host,{class:{dragging:this.dragging}},h("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},h("h5",null,"Roles and Workflow"),h("div",{class:"roles"},o.map((function(t,o){return h("div",{class:"sequence"},h("div",{class:"sequence-label no-drag"},o+1,"."),h("div",{class:"sequence-roles",id:"verdocs-roles-sequence-".concat(t),"data-sequence":t},e.getRolesAtSequence(t).map((function(o){var n=!o.email||!o.first_name||!o.last_name;return n?h("div",{class:"role","data-rolename":o.name,"data-sequence":t,"data-order":o.order},h("div",{class:"role-name"},o.name),h("div",{class:"icons"},h("div",{class:"gear-button",innerHTML:settingsIcon,onClick:function(){return e.showingRoleDialog=o.name},"aria-role":"button"}),h("span",{class:"type-icon",innerHTML:o.type==="signer"?iconSigner:o.type==="cc"?iconCC:iconApprover}))):h("div",{class:"role","data-rolename":o.name,"data-sequence":t,"data-order":o.order},h("div",{class:"role-name"},formatFullName(o)),h("div",{class:"icons"},h("div",{class:"gear-button",innerHTML:settingsIcon,onClick:function(){return e.showingRoleDialog=o.name},"aria-role":"button"}),h("span",{class:"type-icon",innerHTML:o.type==="signer"?iconSigner:o.type==="cc"?iconCC:iconApprover})))}))),h("button",{class:"add-role no-drag",onClick:function(o){return e.handleAddRole(o,t)}},"+ Add Role"))})),h("div",{class:"sequence add-sequence"},h("div",{class:"sequence-label no-drag"},o.length+1,"."),h("div",{class:"sequence-roles",id:"verdocs-roles-sequence-add-target","data-sequence":n}),h("button",{class:"add-role no-drag",onClick:function(t){return e.handleAddRole(t,n)}},"+ Add Role"))),t.length<1&&h("div",{class:"empty"},"You must add at least one Role before proceeding.",h("br",null)," Click the ",h("span",{innerHTML:plusIcon})," Add button above to get started."),h("div",{class:"buttons"},h("div",{class:"flex-fill"}),h("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(){return e.handleCancel()}}),h("verdocs-button",{label:"OK",size:"small",onClick:function(){return e.handleSubmit()},disabled:t.length<1}))),this.showingRoleDialog&&h("verdocs-menu-panel",{onClose:function(){return e.showingRoleDialog=null}},h("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:function(){var t;(t=document.getElementById("verdocs-menu-panel-overlay"))===null||t===void 0?void 0:t.remove();e.showingRoleDialog=null},onDelete:function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:this.showingRoleDialog=null;return[4,this.renumberTemplateRoles()];case 1:t.sent();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))}})))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsTemplateRoles.style=VerdocsTemplateRolesStyle0;export{VerdocsPreview as verdocs_preview,VerdocsSend as verdocs_send,VerdocsTemplateAttachments as verdocs_template_attachments,VerdocsTemplateBuildTabs as verdocs_template_build_tabs,VerdocsTemplateFields as verdocs_template_fields,VerdocsTemplateRoles as verdocs_template_roles};
|
7
|
+
*/function ownKeys(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))}o.push.apply(o,n)}return o}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};if(t%2){ownKeys(Object(o),true).forEach((function(t){_defineProperty(e,t,o[t])}))}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(o))}else{ownKeys(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}}return e}function _typeof(e){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function(e){return typeof e}}else{_typeof=function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof(e)}function _defineProperty(e,t,o){if(t in e){Object.defineProperty(e,t,{value:o,enumerable:true,configurable:true,writable:true})}else{e[t]=o}return e}function _extends(){_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o){if(Object.prototype.hasOwnProperty.call(o,n)){e[n]=o[n]}}}return e};return _extends.apply(this,arguments)}function _objectWithoutPropertiesLoose(e,t){if(e==null)return{};var o={};var n=Object.keys(e);var r,i;for(i=0;i<n.length;i++){r=n[i];if(t.indexOf(r)>=0)continue;o[r]=e[r]}return o}function _objectWithoutProperties(e,t){if(e==null)return{};var o=_objectWithoutPropertiesLoose(e,t);var n,r;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){n=i[r];if(t.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;o[n]=e[n]}}return o}var version="1.15.6";function userAgent(e){if(typeof window!=="undefined"&&window.navigator){return!!navigator.userAgent.match(e)}}var IE11OrLess=userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);var Edge=userAgent(/Edge/i);var FireFox=userAgent(/firefox/i);var Safari=userAgent(/safari/i)&&!userAgent(/chrome/i)&&!userAgent(/android/i);var IOS=userAgent(/iP(ad|od|hone)/i);var ChromeForAndroid=userAgent(/chrome/i)&&userAgent(/android/i);var captureMode={capture:false,passive:false};function on(e,t,o){e.addEventListener(t,o,!IE11OrLess&&captureMode)}function off(e,t,o){e.removeEventListener(t,o,!IE11OrLess&&captureMode)}function matches(e,t){if(!t)return;t[0]===">"&&(t=t.substring(1));if(e){try{if(e.matches){return e.matches(t)}else if(e.msMatchesSelector){return e.msMatchesSelector(t)}else if(e.webkitMatchesSelector){return e.webkitMatchesSelector(t)}}catch(e){return false}}return false}function getParentOrHost(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function closest(e,t,o,n){if(e){o=o||document;do{if(t!=null&&(t[0]===">"?e.parentNode===o&&matches(e,t):matches(e,t))||n&&e===o){return e}if(e===o)break}while(e=getParentOrHost(e))}return null}var R_SPACE=/\s+/g;function toggleClass(e,t,o){if(e&&t){if(e.classList){e.classList[o?"add":"remove"](t)}else{var n=(" "+e.className+" ").replace(R_SPACE," ").replace(" "+t+" "," ");e.className=(n+(o?" "+t:"")).replace(R_SPACE," ")}}}function css(e,t,o){var n=e&&e.style;if(n){if(o===void 0){if(document.defaultView&&document.defaultView.getComputedStyle){o=document.defaultView.getComputedStyle(e,"")}else if(e.currentStyle){o=e.currentStyle}return t===void 0?o:o[t]}else{if(!(t in n)&&t.indexOf("webkit")===-1){t="-webkit-"+t}n[t]=o+(typeof o==="string"?"":"px")}}}function matrix(e,t){var o="";if(typeof e==="string"){o=e}else{do{var n=css(e,"transform");if(n&&n!=="none"){o=n+" "+o}}while(!t&&(e=e.parentNode))}var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(o)}function find(e,t,o){if(e){var n=e.getElementsByTagName(t),r=0,i=n.length;if(o){for(;r<i;r++){o(n[r],r)}}return n}return[]}function getWindowScrollingElement(){var e=document.scrollingElement;if(e){return e}else{return document.documentElement}}function getRect(e,t,o,n,r){if(!e.getBoundingClientRect&&e!==window)return;var i,s,l,a,c,d,u;if(e!==window&&e.parentNode&&e!==getWindowScrollingElement()){i=e.getBoundingClientRect();s=i.top;l=i.left;a=i.bottom;c=i.right;d=i.height;u=i.width}else{s=0;l=0;a=window.innerHeight;c=window.innerWidth;d=window.innerHeight;u=window.innerWidth}if((t||o)&&e!==window){r=r||e.parentNode;if(!IE11OrLess){do{if(r&&r.getBoundingClientRect&&(css(r,"transform")!=="none"||o&&css(r,"position")!=="static")){var f=r.getBoundingClientRect();s-=f.top+parseInt(css(r,"border-top-width"));l-=f.left+parseInt(css(r,"border-left-width"));a=s+i.height;c=l+i.width;break}}while(r=r.parentNode)}}if(n&&e!==window){var h=matrix(r||e),v=h&&h.a,p=h&&h.d;if(h){s/=p;l/=v;u/=v;d/=p;a=s+d;c=l+u}}return{top:s,left:l,bottom:a,right:c,width:u,height:d}}function isScrolledPast(e,t,o){var n=getParentAutoScrollElement(e,true),r=getRect(e)[t];while(n){var i=getRect(n)[o],s=void 0;if(o==="top"||o==="left"){s=r>=i}else{s=r<=i}if(!s)return n;if(n===getWindowScrollingElement())break;n=getParentAutoScrollElement(n,false)}return false}function getChild(e,t,o,n){var r=0,i=0,s=e.children;while(i<s.length){if(s[i].style.display!=="none"&&s[i]!==Sortable.ghost&&(n||s[i]!==Sortable.dragged)&&closest(s[i],o.draggable,e,false)){if(r===t){return s[i]}r++}i++}return null}function lastChild(e,t){var o=e.lastElementChild;while(o&&(o===Sortable.ghost||css(o,"display")==="none"||t&&!matches(o,t))){o=o.previousElementSibling}return o||null}function index(e,t){var o=0;if(!e||!e.parentNode){return-1}while(e=e.previousElementSibling){if(e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==Sortable.clone&&(!t||matches(e,t))){o++}}return o}function getRelativeScrollOffset(e){var t=0,o=0,n=getWindowScrollingElement();if(e){do{var r=matrix(e),i=r.a,s=r.d;t+=e.scrollLeft*i;o+=e.scrollTop*s}while(e!==n&&(e=e.parentNode))}return[t,o]}function indexOfObject(e,t){for(var o in e){if(!e.hasOwnProperty(o))continue;for(var n in t){if(t.hasOwnProperty(n)&&t[n]===e[o][n])return Number(o)}}return-1}function getParentAutoScrollElement(e,t){if(!e||!e.getBoundingClientRect)return getWindowScrollingElement();var o=e;var n=false;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var r=css(o);if(o.clientWidth<o.scrollWidth&&(r.overflowX=="auto"||r.overflowX=="scroll")||o.clientHeight<o.scrollHeight&&(r.overflowY=="auto"||r.overflowY=="scroll")){if(!o.getBoundingClientRect||o===document.body)return getWindowScrollingElement();if(n||t)return o;n=true}}}while(o=o.parentNode);return getWindowScrollingElement()}function extend(e,t){if(e&&t){for(var o in t){if(t.hasOwnProperty(o)){e[o]=t[o]}}}return e}function isRectEqual(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 _throttleTimeout;function throttle(e,t){return function(){if(!_throttleTimeout){var o=arguments,n=this;if(o.length===1){e.call(n,o[0])}else{e.apply(n,o)}_throttleTimeout=setTimeout((function(){_throttleTimeout=void 0}),t)}}}function cancelThrottle(){clearTimeout(_throttleTimeout);_throttleTimeout=void 0}function scrollBy(e,t,o){e.scrollLeft+=t;e.scrollTop+=o}function clone(e){var t=window.Polymer;var o=window.jQuery||window.Zepto;if(t&&t.dom){return t.dom(e).cloneNode(true)}else if(o){return o(e).clone(true)[0]}else{return e.cloneNode(true)}}function getChildContainingRectFromElement(e,t,o){var n={};Array.from(e.children).forEach((function(r){var i,s,l,a;if(!closest(r,t.draggable,e,false)||r.animated||r===o)return;var c=getRect(r);n.left=Math.min((i=n.left)!==null&&i!==void 0?i:Infinity,c.left);n.top=Math.min((s=n.top)!==null&&s!==void 0?s:Infinity,c.top);n.right=Math.max((l=n.right)!==null&&l!==void 0?l:-Infinity,c.right);n.bottom=Math.max((a=n.bottom)!==null&&a!==void 0?a:-Infinity,c.bottom)}));n.width=n.right-n.left;n.height=n.bottom-n.top;n.x=n.left;n.y=n.top;return n}var expando="Sortable"+(new Date).getTime();function AnimationStateManager(){var e=[],t;return{captureAnimationState:function t(){e=[];if(!this.options.animation)return;var o=[].slice.call(this.el.children);o.forEach((function(t){if(css(t,"display")==="none"||t===Sortable.ghost)return;e.push({target:t,rect:getRect(t)});var o=_objectSpread2({},e[e.length-1].rect);if(t.thisAnimationDuration){var n=matrix(t,true);if(n){o.top-=n.f;o.left-=n.e}}t.fromRect=o}))},addAnimationState:function t(o){e.push(o)},removeAnimationState:function t(o){e.splice(indexOfObject(e,{target:o}),1)},animateAll:function o(n){var r=this;if(!this.options.animation){clearTimeout(t);if(typeof n==="function")n();return}var i=false,s=0;e.forEach((function(e){var t=0,o=e.target,n=o.fromRect,l=getRect(o),a=o.prevFromRect,c=o.prevToRect,d=e.rect,u=matrix(o,true);if(u){l.top-=u.f;l.left-=u.e}o.toRect=l;if(o.thisAnimationDuration){if(isRectEqual(a,l)&&!isRectEqual(n,l)&&(d.top-l.top)/(d.left-l.left)===(n.top-l.top)/(n.left-l.left)){t=calculateRealTime(d,a,c,r.options)}}if(!isRectEqual(l,n)){o.prevFromRect=n;o.prevToRect=l;if(!t){t=r.options.animation}r.animate(o,d,l,t)}if(t){i=true;s=Math.max(s,t);clearTimeout(o.animationResetTimer);o.animationResetTimer=setTimeout((function(){o.animationTime=0;o.prevFromRect=null;o.fromRect=null;o.prevToRect=null;o.thisAnimationDuration=null}),t);o.thisAnimationDuration=t}}));clearTimeout(t);if(!i){if(typeof n==="function")n()}else{t=setTimeout((function(){if(typeof n==="function")n()}),s)}e=[]},animate:function e(t,o,n,r){if(r){css(t,"transition","");css(t,"transform","");var i=matrix(this.el),s=i&&i.a,l=i&&i.d,a=(o.left-n.left)/(s||1),c=(o.top-n.top)/(l||1);t.animatingX=!!a;t.animatingY=!!c;css(t,"transform","translate3d("+a+"px,"+c+"px,0)");this.forRepaintDummy=repaint(t);css(t,"transition","transform "+r+"ms"+(this.options.easing?" "+this.options.easing:""));css(t,"transform","translate3d(0,0,0)");typeof t.animated==="number"&&clearTimeout(t.animated);t.animated=setTimeout((function(){css(t,"transition","");css(t,"transform","");t.animated=false;t.animatingX=false;t.animatingY=false}),r)}}}}function repaint(e){return e.offsetWidth}function calculateRealTime(e,t,o,n){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-o.top,2)+Math.pow(t.left-o.left,2))*n.animation}var plugins=[];var defaults={initializeByDefault:true};var PluginManager={mount:function e(t){for(var o in defaults){if(defaults.hasOwnProperty(o)&&!(o in t)){t[o]=defaults[o]}}plugins.forEach((function(e){if(e.pluginName===t.pluginName){throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}}));plugins.push(t)},pluginEvent:function e(t,o,n){var r=this;this.eventCanceled=false;n.cancel=function(){r.eventCanceled=true};var i=t+"Global";plugins.forEach((function(e){if(!o[e.pluginName])return;if(o[e.pluginName][i]){o[e.pluginName][i](_objectSpread2({sortable:o},n))}if(o.options[e.pluginName]&&o[e.pluginName][t]){o[e.pluginName][t](_objectSpread2({sortable:o},n))}}))},initializePlugins:function e(t,o,n,r){plugins.forEach((function(e){var r=e.pluginName;if(!t.options[r]&&!e.initializeByDefault)return;var i=new e(t,o,t.options);i.sortable=t;i.options=t.options;t[r]=i;_extends(n,i.defaults)}));for(var i in t.options){if(!t.options.hasOwnProperty(i))continue;var s=this.modifyOption(t,i,t.options[i]);if(typeof s!=="undefined"){t.options[i]=s}}},getEventProperties:function e(t,o){var n={};plugins.forEach((function(e){if(typeof e.eventProperties!=="function")return;_extends(n,e.eventProperties.call(o[e.pluginName],t))}));return n},modifyOption:function e(t,o,n){var r;plugins.forEach((function(e){if(!t[e.pluginName])return;if(e.optionListeners&&typeof e.optionListeners[o]==="function"){r=e.optionListeners[o].call(t[e.pluginName],n)}}));return r}};function dispatchEvent(e){var t=e.sortable,o=e.rootEl,n=e.name,r=e.targetEl,i=e.cloneEl,s=e.toEl,l=e.fromEl,a=e.oldIndex,c=e.newIndex,d=e.oldDraggableIndex,u=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,v=e.extraEventProperties;t=t||o&&o[expando];if(!t)return;var p,g=t.options,m="on"+n.charAt(0).toUpperCase()+n.substr(1);if(window.CustomEvent&&!IE11OrLess&&!Edge){p=new CustomEvent(n,{bubbles:true,cancelable:true})}else{p=document.createEvent("Event");p.initEvent(n,true,true)}p.to=s||o;p.from=l||o;p.item=r||o;p.clone=i;p.oldIndex=a;p.newIndex=c;p.oldDraggableIndex=d;p.newDraggableIndex=u;p.originalEvent=f;p.pullMode=h?h.lastPutMode:undefined;var b=_objectSpread2(_objectSpread2({},v),PluginManager.getEventProperties(n,t));for(var x in b){p[x]=b[x]}if(o){o.dispatchEvent(p)}if(g[m]){g[m].call(t,p)}}var _excluded=["evt"];var pluginEvent=function e(t,o){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},r=n.evt,i=_objectWithoutProperties(n,_excluded);PluginManager.pluginEvent.bind(Sortable)(t,o,_objectSpread2({dragEl:dragEl,parentEl:parentEl,ghostEl:ghostEl,rootEl:rootEl,nextEl:nextEl,lastDownEl:lastDownEl,cloneEl:cloneEl,cloneHidden:cloneHidden,dragStarted:moved,putSortable:putSortable,activeSortable:Sortable.active,originalEvent:r,oldIndex:oldIndex,oldDraggableIndex:oldDraggableIndex,newIndex:newIndex,newDraggableIndex:newDraggableIndex,hideGhostForTarget:_hideGhostForTarget,unhideGhostForTarget:_unhideGhostForTarget,cloneNowHidden:function e(){cloneHidden=true},cloneNowShown:function e(){cloneHidden=false},dispatchSortableEvent:function e(t){_dispatchEvent({sortable:o,name:t,originalEvent:r})}},i))};function _dispatchEvent(e){dispatchEvent(_objectSpread2({putSortable:putSortable,cloneEl:cloneEl,targetEl:dragEl,rootEl:rootEl,oldIndex:oldIndex,oldDraggableIndex:oldDraggableIndex,newIndex:newIndex,newDraggableIndex:newDraggableIndex},e))}var dragEl,parentEl,ghostEl,rootEl,nextEl,lastDownEl,cloneEl,cloneHidden,oldIndex,newIndex,oldDraggableIndex,newDraggableIndex,activeGroup,putSortable,awaitingDragStarted=false,ignoreNextClick=false,sortables=[],tapEvt,touchEvt,lastDx,lastDy,tapDistanceLeft,tapDistanceTop,moved,lastTarget,lastDirection,pastFirstInvertThresh=false,isCircumstantialInvert=false,targetMoveDistance,ghostRelativeParent,ghostRelativeParentInitialScroll=[],_silent=false,savedInputChecked=[];var documentExists=typeof document!=="undefined",PositionGhostAbsolutely=IOS,CSSFloatProperty=Edge||IE11OrLess?"cssFloat":"float",supportDraggable=documentExists&&!ChromeForAndroid&&!IOS&&"draggable"in document.createElement("div"),supportCssPointerEvents=function(){if(!documentExists)return;if(IE11OrLess){return false}var e=document.createElement("x");e.style.cssText="pointer-events:auto";return e.style.pointerEvents==="auto"}(),_detectDirection=function e(t,o){var n=css(t),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=getChild(t,0,o),s=getChild(t,1,o),l=i&&css(i),a=s&&css(s),c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+getRect(i).width,d=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+getRect(s).width;if(n.display==="flex"){return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal"}if(n.display==="grid"){return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal"}if(i&&l["float"]&&l["float"]!=="none"){var u=l["float"]==="left"?"left":"right";return s&&(a.clear==="both"||a.clear===u)?"vertical":"horizontal"}return i&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||c>=r&&n[CSSFloatProperty]==="none"||s&&n[CSSFloatProperty]==="none"&&c+d>r)?"vertical":"horizontal"},_dragElInRowColumn=function e(t,o,n){var r=n?t.left:t.top,i=n?t.right:t.bottom,s=n?t.width:t.height,l=n?o.left:o.top,a=n?o.right:o.bottom,c=n?o.width:o.height;return r===l||i===a||r+s/2===l+c/2},_detectNearestEmptySortable=function e(t,o){var n;sortables.some((function(e){var r=e[expando].options.emptyInsertThreshold;if(!r||lastChild(e))return;var i=getRect(e),s=t>=i.left-r&&t<=i.right+r,l=o>=i.top-r&&o<=i.bottom+r;if(s&&l){return n=e}}));return n},_prepareGroup=function e(t){function o(e,t){return function(n,r,i,s){var l=n.options.group.name&&r.options.group.name&&n.options.group.name===r.options.group.name;if(e==null&&(t||l)){return true}else if(e==null||e===false){return false}else if(t&&e==="clone"){return e}else if(typeof e==="function"){return o(e(n,r,i,s),t)(n,r,i,s)}else{var a=(t?n:r).options.group.name;return e===true||typeof e==="string"&&e===a||e.join&&e.indexOf(a)>-1}}}var n={};var r=t.group;if(!r||_typeof(r)!="object"){r={name:r}}n.name=r.name;n.checkPull=o(r.pull,true);n.checkPut=o(r.put);n.revertClone=r.revertClone;t.group=n},_hideGhostForTarget=function e(){if(!supportCssPointerEvents&&ghostEl){css(ghostEl,"display","none")}},_unhideGhostForTarget=function e(){if(!supportCssPointerEvents&&ghostEl){css(ghostEl,"display","")}};if(documentExists&&!ChromeForAndroid){document.addEventListener("click",(function(e){if(ignoreNextClick){e.preventDefault();e.stopPropagation&&e.stopPropagation();e.stopImmediatePropagation&&e.stopImmediatePropagation();ignoreNextClick=false;return false}}),true)}var nearestEmptyInsertDetectEvent=function e(t){if(dragEl){t=t.touches?t.touches[0]:t;var o=_detectNearestEmptySortable(t.clientX,t.clientY);if(o){var n={};for(var r in t){if(t.hasOwnProperty(r)){n[r]=t[r]}}n.target=n.rootEl=o;n.preventDefault=void 0;n.stopPropagation=void 0;o[expando]._onDragOver(n)}}};var _checkOutsideTargetEl=function e(t){if(dragEl){dragEl.parentNode[expando]._isOutsideThisEl(t.target)}};function Sortable(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=_extends({},t);e[expando]=this;var o={group:null,sort:true,disabled:false,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:false,invertedSwapThreshold:null,removeCloneOnHide:true,direction:function t(){return _detectDirection(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:true,animation:0,easing:null,setData:function e(t,o){t.setData("Text",o.textContent)},dropBubble:false,dragoverBubble:false,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:false,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:false,fallbackClass:"sortable-fallback",fallbackOnBody:false,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:Sortable.supportPointer!==false&&"PointerEvent"in window&&(!Safari||IOS),emptyInsertThreshold:5};PluginManager.initializePlugins(this,e,o);for(var n in o){!(n in t)&&(t[n]=o[n])}_prepareGroup(t);for(var r in this){if(r.charAt(0)==="_"&&typeof this[r]==="function"){this[r]=this[r].bind(this)}}this.nativeDraggable=t.forceFallback?false:supportDraggable;if(this.nativeDraggable){this.options.touchStartThreshold=1}if(t.supportPointer){on(e,"pointerdown",this._onTapStart)}else{on(e,"mousedown",this._onTapStart);on(e,"touchstart",this._onTapStart)}if(this.nativeDraggable){on(e,"dragover",this);on(e,"dragenter",this)}sortables.push(this.el);t.store&&t.store.get&&this.sort(t.store.get(this)||[]);_extends(this,AnimationStateManager())}Sortable.prototype={constructor:Sortable,_isOutsideThisEl:function e(t){if(!this.el.contains(t)&&t!==this.el){lastTarget=null}},_getDirection:function e(t,o){return typeof this.options.direction==="function"?this.options.direction.call(this,t,o,dragEl):this.options.direction},_onTapStart:function e(t){if(!t.cancelable)return;var o=this,n=this.el,r=this.options,i=r.preventOnFilter,s=t.type,l=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(l||t).target,c=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,d=r.filter;_saveInputCheckedState(n);if(dragEl){return}if(/mousedown|pointerdown/.test(s)&&t.button!==0||r.disabled){return}if(c.isContentEditable){return}if(!this.nativeDraggable&&Safari&&a&&a.tagName.toUpperCase()==="SELECT"){return}a=closest(a,r.draggable,n,false);if(a&&a.animated){return}if(lastDownEl===a){return}oldIndex=index(a);oldDraggableIndex=index(a,r.draggable);if(typeof d==="function"){if(d.call(this,t,a,this)){_dispatchEvent({sortable:o,rootEl:c,name:"filter",targetEl:a,toEl:n,fromEl:n});pluginEvent("filter",o,{evt:t});i&&t.preventDefault();return}}else if(d){d=d.split(",").some((function(e){e=closest(c,e.trim(),n,false);if(e){_dispatchEvent({sortable:o,rootEl:e,name:"filter",targetEl:a,fromEl:n,toEl:n});pluginEvent("filter",o,{evt:t});return true}}));if(d){i&&t.preventDefault();return}}if(r.handle&&!closest(c,r.handle,n,false)){return}this._prepareDragStart(t,l,a)},_prepareDragStart:function e(t,o,n){var r=this,i=r.el,s=r.options,l=i.ownerDocument,a;if(n&&!dragEl&&n.parentNode===i){var c=getRect(n);rootEl=i;dragEl=n;parentEl=dragEl.parentNode;nextEl=dragEl.nextSibling;lastDownEl=n;activeGroup=s.group;Sortable.dragged=dragEl;tapEvt={target:dragEl,clientX:(o||t).clientX,clientY:(o||t).clientY};tapDistanceLeft=tapEvt.clientX-c.left;tapDistanceTop=tapEvt.clientY-c.top;this._lastX=(o||t).clientX;this._lastY=(o||t).clientY;dragEl.style["will-change"]="all";a=function e(){pluginEvent("delayEnded",r,{evt:t});if(Sortable.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents();if(!FireFox&&r.nativeDraggable){dragEl.draggable=true}r._triggerDragStart(t,o);_dispatchEvent({sortable:r,name:"choose",originalEvent:t});toggleClass(dragEl,s.chosenClass,true)};s.ignore.split(",").forEach((function(e){find(dragEl,e.trim(),_disableDraggable)}));on(l,"dragover",nearestEmptyInsertDetectEvent);on(l,"mousemove",nearestEmptyInsertDetectEvent);on(l,"touchmove",nearestEmptyInsertDetectEvent);if(s.supportPointer){on(l,"pointerup",r._onDrop);!this.nativeDraggable&&on(l,"pointercancel",r._onDrop)}else{on(l,"mouseup",r._onDrop);on(l,"touchend",r._onDrop);on(l,"touchcancel",r._onDrop)}if(FireFox&&this.nativeDraggable){this.options.touchStartThreshold=4;dragEl.draggable=true}pluginEvent("delayStart",this,{evt:t});if(s.delay&&(!s.delayOnTouchOnly||o)&&(!this.nativeDraggable||!(Edge||IE11OrLess))){if(Sortable.eventCanceled){this._onDrop();return}if(s.supportPointer){on(l,"pointerup",r._disableDelayedDrag);on(l,"pointercancel",r._disableDelayedDrag)}else{on(l,"mouseup",r._disableDelayedDrag);on(l,"touchend",r._disableDelayedDrag);on(l,"touchcancel",r._disableDelayedDrag)}on(l,"mousemove",r._delayedDragTouchMoveHandler);on(l,"touchmove",r._delayedDragTouchMoveHandler);s.supportPointer&&on(l,"pointermove",r._delayedDragTouchMoveHandler);r._dragStartTimer=setTimeout(a,s.delay)}else{a()}}},_delayedDragTouchMoveHandler:function e(t){var o=t.touches?t.touches[0]:t;if(Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))){this._disableDelayedDrag()}},_disableDelayedDrag:function e(){dragEl&&_disableDraggable(dragEl);clearTimeout(this._dragStartTimer);this._disableDelayedDragEvents()},_disableDelayedDragEvents:function e(){var t=this.el.ownerDocument;off(t,"mouseup",this._disableDelayedDrag);off(t,"touchend",this._disableDelayedDrag);off(t,"touchcancel",this._disableDelayedDrag);off(t,"pointerup",this._disableDelayedDrag);off(t,"pointercancel",this._disableDelayedDrag);off(t,"mousemove",this._delayedDragTouchMoveHandler);off(t,"touchmove",this._delayedDragTouchMoveHandler);off(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function e(t,o){o=o||t.pointerType=="touch"&&t;if(!this.nativeDraggable||o){if(this.options.supportPointer){on(document,"pointermove",this._onTouchMove)}else if(o){on(document,"touchmove",this._onTouchMove)}else{on(document,"mousemove",this._onTouchMove)}}else{on(dragEl,"dragend",this);on(rootEl,"dragstart",this._onDragStart)}try{if(document.selection){_nextTick((function(){document.selection.empty()}))}else{window.getSelection().removeAllRanges()}}catch(e){}},_dragStarted:function e(t,o){awaitingDragStarted=false;if(rootEl&&dragEl){pluginEvent("dragStarted",this,{evt:o});if(this.nativeDraggable){on(document,"dragover",_checkOutsideTargetEl)}var n=this.options;!t&&toggleClass(dragEl,n.dragClass,false);toggleClass(dragEl,n.ghostClass,true);Sortable.active=this;t&&this._appendGhost();_dispatchEvent({sortable:this,name:"start",originalEvent:o})}else{this._nulling()}},_emulateDragOver:function e(){if(touchEvt){this._lastX=touchEvt.clientX;this._lastY=touchEvt.clientY;_hideGhostForTarget();var t=document.elementFromPoint(touchEvt.clientX,touchEvt.clientY);var o=t;while(t&&t.shadowRoot){t=t.shadowRoot.elementFromPoint(touchEvt.clientX,touchEvt.clientY);if(t===o)break;o=t}dragEl.parentNode[expando]._isOutsideThisEl(t);if(o){do{if(o[expando]){var n=void 0;n=o[expando]._onDragOver({clientX:touchEvt.clientX,clientY:touchEvt.clientY,target:t,rootEl:o});if(n&&!this.options.dragoverBubble){break}}t=o}while(o=getParentOrHost(o))}_unhideGhostForTarget()}},_onTouchMove:function e(t){if(tapEvt){var o=this.options,n=o.fallbackTolerance,r=o.fallbackOffset,i=t.touches?t.touches[0]:t,s=ghostEl&&matrix(ghostEl,true),l=ghostEl&&s&&s.a,a=ghostEl&&s&&s.d,c=PositionGhostAbsolutely&&ghostRelativeParent&&getRelativeScrollOffset(ghostRelativeParent),d=(i.clientX-tapEvt.clientX+r.x)/(l||1)+(c?c[0]-ghostRelativeParentInitialScroll[0]:0)/(l||1),u=(i.clientY-tapEvt.clientY+r.y)/(a||1)+(c?c[1]-ghostRelativeParentInitialScroll[1]:0)/(a||1);if(!Sortable.active&&!awaitingDragStarted){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n){return}this._onDragStart(t,true)}if(ghostEl){if(s){s.e+=d-(lastDx||0);s.f+=u-(lastDy||0)}else{s={a:1,b:0,c:0,d:1,e:d,f:u}}var f="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");css(ghostEl,"webkitTransform",f);css(ghostEl,"mozTransform",f);css(ghostEl,"msTransform",f);css(ghostEl,"transform",f);lastDx=d;lastDy=u;touchEvt=i}t.cancelable&&t.preventDefault()}},_appendGhost:function e(){if(!ghostEl){var t=this.options.fallbackOnBody?document.body:rootEl,o=getRect(dragEl,true,PositionGhostAbsolutely,true,t),n=this.options;if(PositionGhostAbsolutely){ghostRelativeParent=t;while(css(ghostRelativeParent,"position")==="static"&&css(ghostRelativeParent,"transform")==="none"&&ghostRelativeParent!==document){ghostRelativeParent=ghostRelativeParent.parentNode}if(ghostRelativeParent!==document.body&&ghostRelativeParent!==document.documentElement){if(ghostRelativeParent===document)ghostRelativeParent=getWindowScrollingElement();o.top+=ghostRelativeParent.scrollTop;o.left+=ghostRelativeParent.scrollLeft}else{ghostRelativeParent=getWindowScrollingElement()}ghostRelativeParentInitialScroll=getRelativeScrollOffset(ghostRelativeParent)}ghostEl=dragEl.cloneNode(true);toggleClass(ghostEl,n.ghostClass,false);toggleClass(ghostEl,n.fallbackClass,true);toggleClass(ghostEl,n.dragClass,true);css(ghostEl,"transition","");css(ghostEl,"transform","");css(ghostEl,"box-sizing","border-box");css(ghostEl,"margin",0);css(ghostEl,"top",o.top);css(ghostEl,"left",o.left);css(ghostEl,"width",o.width);css(ghostEl,"height",o.height);css(ghostEl,"opacity","0.8");css(ghostEl,"position",PositionGhostAbsolutely?"absolute":"fixed");css(ghostEl,"zIndex","100000");css(ghostEl,"pointerEvents","none");Sortable.ghost=ghostEl;t.appendChild(ghostEl);css(ghostEl,"transform-origin",tapDistanceLeft/parseInt(ghostEl.style.width)*100+"% "+tapDistanceTop/parseInt(ghostEl.style.height)*100+"%")}},_onDragStart:function e(t,o){var n=this;var r=t.dataTransfer;var i=n.options;pluginEvent("dragStart",this,{evt:t});if(Sortable.eventCanceled){this._onDrop();return}pluginEvent("setupClone",this);if(!Sortable.eventCanceled){cloneEl=clone(dragEl);cloneEl.removeAttribute("id");cloneEl.draggable=false;cloneEl.style["will-change"]="";this._hideClone();toggleClass(cloneEl,this.options.chosenClass,false);Sortable.clone=cloneEl}n.cloneId=_nextTick((function(){pluginEvent("clone",n);if(Sortable.eventCanceled)return;if(!n.options.removeCloneOnHide){rootEl.insertBefore(cloneEl,dragEl)}n._hideClone();_dispatchEvent({sortable:n,name:"clone"})}));!o&&toggleClass(dragEl,i.dragClass,true);if(o){ignoreNextClick=true;n._loopId=setInterval(n._emulateDragOver,50)}else{off(document,"mouseup",n._onDrop);off(document,"touchend",n._onDrop);off(document,"touchcancel",n._onDrop);if(r){r.effectAllowed="move";i.setData&&i.setData.call(n,r,dragEl)}on(document,"drop",n);css(dragEl,"transform","translateZ(0)")}awaitingDragStarted=true;n._dragStartId=_nextTick(n._dragStarted.bind(n,o,t));on(document,"selectstart",n);moved=true;window.getSelection().removeAllRanges();if(Safari){css(document.body,"user-select","none")}},_onDragOver:function e(t){var o=this.el,n=t.target,r,i,s,l=this.options,a=l.group,c=Sortable.active,d=activeGroup===a,u=l.sort,f=putSortable||c,h,v=this,p=false;if(_silent)return;function g(e,l){pluginEvent(e,v,_objectSpread2({evt:t,isOwner:d,axis:h?"vertical":"horizontal",revert:s,dragRect:r,targetRect:i,canSort:u,fromSortable:f,target:n,completed:b,onMove:function e(n,i){return _onMove(rootEl,o,dragEl,r,n,getRect(n),t,i)},changed:x},l))}function m(){g("dragOverAnimationCapture");v.captureAnimationState();if(v!==f){f.captureAnimationState()}}function b(e){g("dragOverCompleted",{insertion:e});if(e){if(d){c._hideClone()}else{c._showClone(v)}if(v!==f){toggleClass(dragEl,putSortable?putSortable.options.ghostClass:c.options.ghostClass,false);toggleClass(dragEl,l.ghostClass,true)}if(putSortable!==v&&v!==Sortable.active){putSortable=v}else if(v===Sortable.active&&putSortable){putSortable=null}if(f===v){v._ignoreWhileAnimating=n}v.animateAll((function(){g("dragOverAnimationComplete");v._ignoreWhileAnimating=null}));if(v!==f){f.animateAll();f._ignoreWhileAnimating=null}}if(n===dragEl&&!dragEl.animated||n===o&&!n.animated){lastTarget=null}if(!l.dragoverBubble&&!t.rootEl&&n!==document){dragEl.parentNode[expando]._isOutsideThisEl(t.target);!e&&nearestEmptyInsertDetectEvent(t)}!l.dragoverBubble&&t.stopPropagation&&t.stopPropagation();return p=true}function x(){newIndex=index(dragEl);newDraggableIndex=index(dragEl,l.draggable);_dispatchEvent({sortable:v,name:"change",toEl:o,newIndex:newIndex,newDraggableIndex:newDraggableIndex,originalEvent:t})}if(t.preventDefault!==void 0){t.cancelable&&t.preventDefault()}n=closest(n,l.draggable,o,true);g("dragOver");if(Sortable.eventCanceled)return p;if(dragEl.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||v._ignoreWhileAnimating===n){return b(false)}ignoreNextClick=false;if(c&&!l.disabled&&(d?u||(s=parentEl!==rootEl):putSortable===this||(this.lastPutMode=activeGroup.checkPull(this,c,dragEl,t))&&a.checkPut(this,c,dragEl,t))){h=this._getDirection(t,n)==="vertical";r=getRect(dragEl);g("dragOverValid");if(Sortable.eventCanceled)return p;if(s){parentEl=rootEl;m();this._hideClone();g("revert");if(!Sortable.eventCanceled){if(nextEl){rootEl.insertBefore(dragEl,nextEl)}else{rootEl.appendChild(dragEl)}}return b(true)}var E=lastChild(o,l.draggable);if(!E||_ghostIsLast(t,h,this)&&!E.animated){if(E===dragEl){return b(false)}if(E&&o===t.target){n=E}if(n){i=getRect(n)}if(_onMove(rootEl,o,dragEl,r,n,i,t,!!n)!==false){m();if(E&&E.nextSibling){o.insertBefore(dragEl,E.nextSibling)}else{o.appendChild(dragEl)}parentEl=o;x();return b(true)}}else if(E&&_ghostIsFirst(t,h,this)){var w=getChild(o,0,l,true);if(w===dragEl){return b(false)}n=w;i=getRect(n);if(_onMove(rootEl,o,dragEl,r,n,i,t,false)!==false){m();o.insertBefore(dragEl,w);parentEl=o;x();return b(true)}}else if(n.parentNode===o){i=getRect(n);var S=0,_,y=dragEl.parentNode!==o,I=!_dragElInRowColumn(dragEl.animated&&dragEl.toRect||r,n.animated&&n.toRect||i,h),C=h?"top":"left",k=isScrolledPast(n,"top","top")||isScrolledPast(dragEl,"top","top"),T=k?k.scrollTop:void 0;if(lastTarget!==n){_=i[C];pastFirstInvertThresh=false;isCircumstantialInvert=!I&&l.invertSwap||y}S=_getSwapDirection(t,n,i,h,I?1:l.swapThreshold,l.invertedSwapThreshold==null?l.swapThreshold:l.invertedSwapThreshold,isCircumstantialInvert,lastTarget===n);var D;if(S!==0){var q=index(dragEl);do{q-=S;D=parentEl.children[q]}while(D&&(css(D,"display")==="none"||D===ghostEl))}if(S===0||D===n){return b(false)}lastTarget=n;lastDirection=S;var M=n.nextElementSibling,R=false;R=S===1;var A=_onMove(rootEl,o,dragEl,r,n,i,t,R);if(A!==false){if(A===1||A===-1){R=A===1}_silent=true;setTimeout(_unsilent,30);m();if(R&&!M){o.appendChild(dragEl)}else{n.parentNode.insertBefore(dragEl,R?M:n)}if(k){scrollBy(k,0,T-k.scrollTop)}parentEl=dragEl.parentNode;if(_!==undefined&&!isCircumstantialInvert){targetMoveDistance=Math.abs(_-getRect(n)[C])}x();return b(true)}}if(o.contains(dragEl)){return b(false)}}return false},_ignoreWhileAnimating:null,_offMoveEvents:function e(){off(document,"mousemove",this._onTouchMove);off(document,"touchmove",this._onTouchMove);off(document,"pointermove",this._onTouchMove);off(document,"dragover",nearestEmptyInsertDetectEvent);off(document,"mousemove",nearestEmptyInsertDetectEvent);off(document,"touchmove",nearestEmptyInsertDetectEvent)},_offUpEvents:function e(){var t=this.el.ownerDocument;off(t,"mouseup",this._onDrop);off(t,"touchend",this._onDrop);off(t,"pointerup",this._onDrop);off(t,"pointercancel",this._onDrop);off(t,"touchcancel",this._onDrop);off(document,"selectstart",this)},_onDrop:function e(t){var o=this.el,n=this.options;newIndex=index(dragEl);newDraggableIndex=index(dragEl,n.draggable);pluginEvent("drop",this,{evt:t});parentEl=dragEl&&dragEl.parentNode;newIndex=index(dragEl);newDraggableIndex=index(dragEl,n.draggable);if(Sortable.eventCanceled){this._nulling();return}awaitingDragStarted=false;isCircumstantialInvert=false;pastFirstInvertThresh=false;clearInterval(this._loopId);clearTimeout(this._dragStartTimer);_cancelNextTick(this.cloneId);_cancelNextTick(this._dragStartId);if(this.nativeDraggable){off(document,"drop",this);off(o,"dragstart",this._onDragStart)}this._offMoveEvents();this._offUpEvents();if(Safari){css(document.body,"user-select","")}css(dragEl,"transform","");if(t){if(moved){t.cancelable&&t.preventDefault();!n.dropBubble&&t.stopPropagation()}ghostEl&&ghostEl.parentNode&&ghostEl.parentNode.removeChild(ghostEl);if(rootEl===parentEl||putSortable&&putSortable.lastPutMode!=="clone"){cloneEl&&cloneEl.parentNode&&cloneEl.parentNode.removeChild(cloneEl)}if(dragEl){if(this.nativeDraggable){off(dragEl,"dragend",this)}_disableDraggable(dragEl);dragEl.style["will-change"]="";if(moved&&!awaitingDragStarted){toggleClass(dragEl,putSortable?putSortable.options.ghostClass:this.options.ghostClass,false)}toggleClass(dragEl,this.options.chosenClass,false);_dispatchEvent({sortable:this,name:"unchoose",toEl:parentEl,newIndex:null,newDraggableIndex:null,originalEvent:t});if(rootEl!==parentEl){if(newIndex>=0){_dispatchEvent({rootEl:parentEl,name:"add",toEl:parentEl,fromEl:rootEl,originalEvent:t});_dispatchEvent({sortable:this,name:"remove",toEl:parentEl,originalEvent:t});_dispatchEvent({rootEl:parentEl,name:"sort",toEl:parentEl,fromEl:rootEl,originalEvent:t});_dispatchEvent({sortable:this,name:"sort",toEl:parentEl,originalEvent:t})}putSortable&&putSortable.save()}else{if(newIndex!==oldIndex){if(newIndex>=0){_dispatchEvent({sortable:this,name:"update",toEl:parentEl,originalEvent:t});_dispatchEvent({sortable:this,name:"sort",toEl:parentEl,originalEvent:t})}}}if(Sortable.active){if(newIndex==null||newIndex===-1){newIndex=oldIndex;newDraggableIndex=oldDraggableIndex}_dispatchEvent({sortable:this,name:"end",toEl:parentEl,originalEvent:t});this.save()}}}this._nulling()},_nulling:function e(){pluginEvent("nulling",this);rootEl=dragEl=parentEl=ghostEl=nextEl=cloneEl=lastDownEl=cloneHidden=tapEvt=touchEvt=moved=newIndex=newDraggableIndex=oldIndex=oldDraggableIndex=lastTarget=lastDirection=putSortable=activeGroup=Sortable.dragged=Sortable.ghost=Sortable.clone=Sortable.active=null;savedInputChecked.forEach((function(e){e.checked=true}));savedInputChecked.length=lastDx=lastDy=0},handleEvent:function e(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":if(dragEl){this._onDragOver(t);_globalDragOver(t)}break;case"selectstart":t.preventDefault();break}},toArray:function e(){var t=[],o,n=this.el.children,r=0,i=n.length,s=this.options;for(;r<i;r++){o=n[r];if(closest(o,s.draggable,this.el,false)){t.push(o.getAttribute(s.dataIdAttr)||_generateId(o))}}return t},sort:function e(t,o){var n={},r=this.el;this.toArray().forEach((function(e,t){var o=r.children[t];if(closest(o,this.options.draggable,r,false)){n[e]=o}}),this);o&&this.captureAnimationState();t.forEach((function(e){if(n[e]){r.removeChild(n[e]);r.appendChild(n[e])}}));o&&this.animateAll()},save:function e(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function e(t,o){return closest(t,o||this.options.draggable,this.el,false)},option:function e(t,o){var n=this.options;if(o===void 0){return n[t]}else{var r=PluginManager.modifyOption(this,t,o);if(typeof r!=="undefined"){n[t]=r}else{n[t]=o}if(t==="group"){_prepareGroup(n)}}},destroy:function e(){pluginEvent("destroy",this);var t=this.el;t[expando]=null;off(t,"mousedown",this._onTapStart);off(t,"touchstart",this._onTapStart);off(t,"pointerdown",this._onTapStart);if(this.nativeDraggable){off(t,"dragover",this);off(t,"dragenter",this)}Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")}));this._onDrop();this._disableDelayedDragEvents();sortables.splice(sortables.indexOf(this.el),1);this.el=t=null},_hideClone:function e(){if(!cloneHidden){pluginEvent("hideClone",this);if(Sortable.eventCanceled)return;css(cloneEl,"display","none");if(this.options.removeCloneOnHide&&cloneEl.parentNode){cloneEl.parentNode.removeChild(cloneEl)}cloneHidden=true}},_showClone:function e(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(cloneHidden){pluginEvent("showClone",this);if(Sortable.eventCanceled)return;if(dragEl.parentNode==rootEl&&!this.options.group.revertClone){rootEl.insertBefore(cloneEl,dragEl)}else if(nextEl){rootEl.insertBefore(cloneEl,nextEl)}else{rootEl.appendChild(cloneEl)}if(this.options.group.revertClone){this.animate(dragEl,cloneEl)}css(cloneEl,"display","");cloneHidden=false}}};function _globalDragOver(e){if(e.dataTransfer){e.dataTransfer.dropEffect="move"}e.cancelable&&e.preventDefault()}function _onMove(e,t,o,n,r,i,s,l){var a,c=e[expando],d=c.options.onMove,u;if(window.CustomEvent&&!IE11OrLess&&!Edge){a=new CustomEvent("move",{bubbles:true,cancelable:true})}else{a=document.createEvent("Event");a.initEvent("move",true,true)}a.to=t;a.from=e;a.dragged=o;a.draggedRect=n;a.related=r||t;a.relatedRect=i||getRect(t);a.willInsertAfter=l;a.originalEvent=s;e.dispatchEvent(a);if(d){u=d.call(c,a,s)}return u}function _disableDraggable(e){e.draggable=false}function _unsilent(){_silent=false}function _ghostIsFirst(e,t,o){var n=getRect(getChild(o.el,0,o.options,true));var r=getChildContainingRectFromElement(o.el,o.options,ghostEl);var i=10;return t?e.clientX<r.left-i||e.clientY<n.top&&e.clientX<n.right:e.clientY<r.top-i||e.clientY<n.bottom&&e.clientX<n.left}function _ghostIsLast(e,t,o){var n=getRect(lastChild(o.el,o.options.draggable));var r=getChildContainingRectFromElement(o.el,o.options,ghostEl);var i=10;return t?e.clientX>r.right+i||e.clientY>n.bottom&&e.clientX>n.left:e.clientY>r.bottom+i||e.clientX>n.right&&e.clientY>n.top}function _getSwapDirection(e,t,o,n,r,i,s,l){var a=n?e.clientY:e.clientX,c=n?o.height:o.width,d=n?o.top:o.left,u=n?o.bottom:o.right,f=false;if(!s){if(l&&targetMoveDistance<c*r){if(!pastFirstInvertThresh&&(lastDirection===1?a>d+c*i/2:a<u-c*i/2)){pastFirstInvertThresh=true}if(!pastFirstInvertThresh){if(lastDirection===1?a<d+targetMoveDistance:a>u-targetMoveDistance){return-lastDirection}}else{f=true}}else{if(a>d+c*(1-r)/2&&a<u-c*(1-r)/2){return _getInsertDirection(t)}}}f=f||s;if(f){if(a<d+c*i/2||a>u-c*i/2){return a>d+c/2?1:-1}}return 0}function _getInsertDirection(e){if(index(dragEl)<index(e)){return 1}else{return-1}}function _generateId(e){var t=e.tagName+e.className+e.src+e.href+e.textContent,o=t.length,n=0;while(o--){n+=t.charCodeAt(o)}return n.toString(36)}function _saveInputCheckedState(e){savedInputChecked.length=0;var t=e.getElementsByTagName("input");var o=t.length;while(o--){var n=t[o];n.checked&&savedInputChecked.push(n)}}function _nextTick(e){return setTimeout(e,0)}function _cancelNextTick(e){return clearTimeout(e)}if(documentExists){on(document,"touchmove",(function(e){if((Sortable.active||awaitingDragStarted)&&e.cancelable){e.preventDefault()}}))}Sortable.utils={on:on,off:off,css:css,find:find,is:function e(t,o){return!!closest(t,o,t,false)},extend:extend,throttle:throttle,closest:closest,toggleClass:toggleClass,clone:clone,index:index,nextTick:_nextTick,cancelNextTick:_cancelNextTick,detectDirection:_detectDirection,getChild:getChild,expando:expando};Sortable.get=function(e){return e[expando]};Sortable.mount=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++){t[o]=arguments[o]}if(t[0].constructor===Array)t=t[0];t.forEach((function(e){if(!e.prototype||!e.prototype.constructor){throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e))}if(e.utils)Sortable.utils=_objectSpread2(_objectSpread2({},Sortable.utils),e.utils);PluginManager.mount(e)}))};Sortable.create=function(e,t){return new Sortable(e,t)};Sortable.version=version;var autoScrolls=[],scrollEl,scrollRootEl,scrolling=false,lastAutoScrollX,lastAutoScrollY,touchEvt$1,pointerElemChangedInterval;function AutoScrollPlugin(){function e(){this.defaults={scroll:true,forceAutoScrollFallback:false,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:true};for(var e in this){if(e.charAt(0)==="_"&&typeof this[e]==="function"){this[e]=this[e].bind(this)}}}e.prototype={dragStarted:function e(t){var o=t.originalEvent;if(this.sortable.nativeDraggable){on(document,"dragover",this._handleAutoScroll)}else{if(this.options.supportPointer){on(document,"pointermove",this._handleFallbackAutoScroll)}else if(o.touches){on(document,"touchmove",this._handleFallbackAutoScroll)}else{on(document,"mousemove",this._handleFallbackAutoScroll)}}},dragOverCompleted:function e(t){var o=t.originalEvent;if(!this.options.dragOverBubble&&!o.rootEl){this._handleAutoScroll(o)}},drop:function e(){if(this.sortable.nativeDraggable){off(document,"dragover",this._handleAutoScroll)}else{off(document,"pointermove",this._handleFallbackAutoScroll);off(document,"touchmove",this._handleFallbackAutoScroll);off(document,"mousemove",this._handleFallbackAutoScroll)}clearPointerElemChangedInterval();clearAutoScrolls();cancelThrottle()},nulling:function e(){touchEvt$1=scrollRootEl=scrollEl=scrolling=pointerElemChangedInterval=lastAutoScrollX=lastAutoScrollY=null;autoScrolls.length=0},_handleFallbackAutoScroll:function e(t){this._handleAutoScroll(t,true)},_handleAutoScroll:function e(t,o){var n=this;var r=(t.touches?t.touches[0]:t).clientX,i=(t.touches?t.touches[0]:t).clientY,s=document.elementFromPoint(r,i);touchEvt$1=t;if(o||this.options.forceAutoScrollFallback||Edge||IE11OrLess||Safari){autoScroll(t,this.options,s,o);var l=getParentAutoScrollElement(s,true);if(scrolling&&(!pointerElemChangedInterval||r!==lastAutoScrollX||i!==lastAutoScrollY)){pointerElemChangedInterval&&clearPointerElemChangedInterval();pointerElemChangedInterval=setInterval((function(){var e=getParentAutoScrollElement(document.elementFromPoint(r,i),true);if(e!==l){l=e;clearAutoScrolls()}autoScroll(t,n.options,e,o)}),10);lastAutoScrollX=r;lastAutoScrollY=i}}else{if(!this.options.bubbleScroll||getParentAutoScrollElement(s,true)===getWindowScrollingElement()){clearAutoScrolls();return}autoScroll(t,this.options,getParentAutoScrollElement(s,false),false)}}};return _extends(e,{pluginName:"scroll",initializeByDefault:true})}function clearAutoScrolls(){autoScrolls.forEach((function(e){clearInterval(e.pid)}));autoScrolls=[]}function clearPointerElemChangedInterval(){clearInterval(pointerElemChangedInterval)}var autoScroll=throttle((function(e,t,o,n){if(!t.scroll)return;var r=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,l=t.scrollSpeed,a=getWindowScrollingElement();var c=false,d;if(scrollRootEl!==o){scrollRootEl=o;clearAutoScrolls();scrollEl=t.scroll;d=t.scrollFn;if(scrollEl===true){scrollEl=getParentAutoScrollElement(o,true)}}var u=0;var f=scrollEl;do{var h=f,v=getRect(h),p=v.top,g=v.bottom,m=v.left,b=v.right,x=v.width,E=v.height,w=void 0,S=void 0,_=h.scrollWidth,y=h.scrollHeight,I=css(h),C=h.scrollLeft,k=h.scrollTop;if(h===a){w=x<_&&(I.overflowX==="auto"||I.overflowX==="scroll"||I.overflowX==="visible");S=E<y&&(I.overflowY==="auto"||I.overflowY==="scroll"||I.overflowY==="visible")}else{w=x<_&&(I.overflowX==="auto"||I.overflowX==="scroll");S=E<y&&(I.overflowY==="auto"||I.overflowY==="scroll")}var T=w&&(Math.abs(b-r)<=s&&C+x<_)-(Math.abs(m-r)<=s&&!!C);var D=S&&(Math.abs(g-i)<=s&&k+E<y)-(Math.abs(p-i)<=s&&!!k);if(!autoScrolls[u]){for(var q=0;q<=u;q++){if(!autoScrolls[q]){autoScrolls[q]={}}}}if(autoScrolls[u].vx!=T||autoScrolls[u].vy!=D||autoScrolls[u].el!==h){autoScrolls[u].el=h;autoScrolls[u].vx=T;autoScrolls[u].vy=D;clearInterval(autoScrolls[u].pid);if(T!=0||D!=0){c=true;autoScrolls[u].pid=setInterval(function(){if(n&&this.layer===0){Sortable.active._onTouchMove(touchEvt$1)}var t=autoScrolls[this.layer].vy?autoScrolls[this.layer].vy*l:0;var o=autoScrolls[this.layer].vx?autoScrolls[this.layer].vx*l:0;if(typeof d==="function"){if(d.call(Sortable.dragged.parentNode[expando],o,t,e,touchEvt$1,autoScrolls[this.layer].el)!=="continue"){return}}scrollBy(autoScrolls[this.layer].el,o,t)}.bind({layer:u}),24)}}u++}while(t.bubbleScroll&&f!==a&&(f=getParentAutoScrollElement(f,false)));scrolling=c}),30);var drop=function e(t){var o=t.originalEvent,n=t.putSortable,r=t.dragEl,i=t.activeSortable,s=t.dispatchSortableEvent,l=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(!o)return;var c=n||i;l();var d=o.changedTouches&&o.changedTouches.length?o.changedTouches[0]:o;var u=document.elementFromPoint(d.clientX,d.clientY);a();if(c&&!c.el.contains(u)){s("spill");this.onSpill({dragEl:r,putSortable:n})}};function Revert(){}Revert.prototype={startIndex:null,dragStart:function e(t){var o=t.oldDraggableIndex;this.startIndex=o},onSpill:function e(t){var o=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState();if(n){n.captureAnimationState()}var r=getChild(this.sortable.el,this.startIndex,this.options);if(r){this.sortable.el.insertBefore(o,r)}else{this.sortable.el.appendChild(o)}this.sortable.animateAll();if(n){n.animateAll()}},drop:drop};_extends(Revert,{pluginName:"revertOnSpill"});function Remove(){}Remove.prototype={onSpill:function e(t){var o=t.dragEl,n=t.putSortable;var r=n||this.sortable;r.captureAnimationState();o.parentNode&&o.parentNode.removeChild(o);r.animateAll()},drop:drop};_extends(Remove,{pluginName:"removeOnSpill"});Sortable.mount(new AutoScrollPlugin);Sortable.mount(Remove,Revert);var verdocsTemplateRolesCss='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;max-width:600px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles .roles{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:10px;margin-top:10px}verdocs-template-roles .roles .sequence{gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;padding:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;border-bottom:1px dotted #e3e3e3}verdocs-template-roles .roles .sequence.add-sequence{color:#777777;line-height:34px}verdocs-template-roles .roles .sequence-label{font-size:18px;line-height:32px}verdocs-template-roles .roles .sequence-roles{gap:10px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .roles .role{height:32px;cursor:move;display:-ms-flexbox;display:flex;max-width:200px;position:relative;border-radius:32px;background-color:#eff7fb;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 14px 0 34px;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column}verdocs-template-roles .roles .role .role-name{font-size:14px;overflow:hidden;font-weight:400;line-height:30px;white-space:nowrap;text-overflow:ellipsis}verdocs-template-roles .roles .role .icons{position:absolute;left:1px;top:-3px;cursor:pointer;padding:5px;z-index:10}verdocs-template-roles .roles .role .icons .gear-button{display:none;-webkit-transform:scale(1.1);transform:scale(1.1);margin:4px 0 0 1px}verdocs-template-roles .roles .role .icons .type-icon{opacity:0.6;display:block;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-roles .roles .role .icons:hover .gear-button{display:block}verdocs-template-roles .roles .role .icons:hover .type-icon{display:none}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{opacity:0.3;padding:0 10px;cursor:pointer;background:none;height:32px;border:1px solid #cccccc;border-radius:32px}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles .sequence-roles{display:-ms-flexbox;display:flex;max-width:400px}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';var VerdocsTemplateRolesStyle0=verdocsTemplateRolesCss;var settingsIcon='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';var plusIcon='<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';var iconSigner='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';var iconApprover='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>';var iconCC='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>';var VerdocsTemplateRoles=function(){function e(e){registerInstance(this,e);this.next=createEvent(this,"next",7);this.exit=createEvent(this,"exit",7);this.sdkError=createEvent(this,"sdkError",7);this.rolesUpdated=createEvent(this,"rolesUpdated",7);this.templateListenerId=null;this.sortableRefs=[];this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.showingRoleDialog=null;this.sender=null;this.dragging=false;this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate();this.cleanupSortables()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[ROLES] Loading template",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){console.log("[ROLES] Template Updated",t);e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o;return __generator(this,(function(n){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(n){console.log("[ROLES] Error with preview session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(o=n.response)===null||o===void 0?void 0:o.data))}return[2]}))}))};e.prototype.cleanupSortables=function(){this.sortableRefs.forEach((function(e){return e.destroy()}));this.sortableRefs.length=0};e.prototype.componentDidRender=function(){var e=this;this.cleanupSortables();var t=this.getSequenceNumbers();(t||[]).forEach((function(t){var o=document.getElementById("verdocs-roles-sequence-".concat(t));if(o){var n=new Sortable(o,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:e.handleMoveEnd.bind(e),onChoose:function(){return e.dragging=true},onUnchoose:function(){return e.dragging=false}});e.sortableRefs.push(n)}}));var o=document.getElementById("verdocs-roles-sequence-add-target");if(o){console.log("[ROLES] Applying sortable to add-sequence slot");var n=new Sortable(o,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:this.handleMoveEnd.bind(this),onChoose:function(){return e.dragging=true},onUnchoose:function(){return e.dragging=false}});this.sortableRefs.push(n)}};e.prototype.handleMoveEnd=function(e){var t=this;var o=+e.from.dataset.sequence;var n=+e.to.dataset.sequence;var r=+e.oldIndex+1;var i=+e.newIndex+1;console.log("Move from ".concat(o,":").concat(r," to ").concat(n,":").concat(i),e.item);var s={};var l=this.getSequenceNumbers();l.forEach((function(e){var o=t.getRolesAtSequence(e);s[String(e)]=JSON.parse(JSON.stringify(o))}));s[l[l.length-1]+1]=[];var a=s[o].splice(r-1,1)[0];s[n]||(s[n]=[]);s[n].splice(i-1,0,a);var c=[];Object.entries(s).forEach((function(e){var o=e[0],n=e[1];n.forEach((function(e,n){if(!e){return}var r=+n+1;if(e.sequence!==+o||e.order!==r){e.sequence=+o;e.order=r;c.push(updateTemplateRole(t.endpoint,t.templateId,e.name,{sequence:+o,order:r}).then((function(t){return console.log("[ROLES] Updated role",e.name,t)})).catch((function(e){return console.log("[ROLES] Error updating role",e)})))}}))}));return Promise.all(c).then((function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){return[2,console.log("[ROLES] Done renumbering")]}))}))})).catch((function(e){return console.log("[ROLES] Error updating roles",e)}))};e.prototype.handleCancel=function(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()};e.prototype.handleSubmit=function(){var e;(e=this.next)===null||e===void 0?void 0:e.emit()};e.prototype.getSortedRoles=function(){var e;return(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).sort((function(e,t){return e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence}))};e.prototype.getSequenceNumbers=function(){var e={};this.getSortedRoles().forEach((function(t){e[t.sequence]=true}));console.log("[ROLES] Sequences",e);return Object.keys(e).map((function(e){return+e})).sort((function(e,t){return e-t}))};e.prototype.getRoleNames=function(){var e=this.getSortedRoles();return e.map((function(e){return e.name}))};e.prototype.getRolesAtSequence=function(e){var t;return(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t&&t.sequence===e}))};e.prototype.renumberTemplateRoles=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,o,n;var r=this;return __generator(this,(function(i){switch(i.label){case 0:t={};o=[];n=this.getSequenceNumbers();(n||[]).forEach((function(e){(t[e]||[]).forEach((function(t,n){var i=+n+1;if(t.sequence!==+e||t.order!==i){console.log("[ROLES] Updating role",t.name,"from",t.sequence,t.order,"to",e,i);t.sequence=+e;t.order=i;o.push(updateTemplateRole(r.endpoint,r.templateId,t.name,{sequence:+e,order:i}).then((function(e){return console.log("[ROLES] Updated role",t.name,e)})).catch((function(e){return console.log("[ROLES] Error updating role",e)})))}}))}));console.log("[ROLES] Awaiting ".concat(o.length," renumber requests"));return[4,Promise.all(o).then((function(){return __awaiter(r,void 0,void 0,(function(){var e;return __generator(this,(function(o){e=JSON.parse(JSON.stringify(this.template));e.roles=Object.keys(t).reduce((function(e,o){return e.concat(t[o])}),[]);console.log("[ROLES] Done renumbering",e.roles.map((function(e){return{name:e.name,sequence:e.sequence,order:e.order}})));Store.updateTemplate(this.templateId,e);return[2]}))}))}))];case 1:i.sent();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))};e.prototype.getNextRoleName=function(){var e,t;var o="";var n=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).length;do{n++;o="Recipient ".concat(n)}while(!o||(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).some((function(e){return e&&e.name===o})));return o};e.prototype.callCreateRole=function(e,t,o){var n=this;console.log("[ROLES] Will create role",{name:e,sequence:t,order:o});createTemplateRole(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,message:"",order:o,full_name:null,first_name:"",last_name:"",email:"",phone:"",type:"signer",delegator:false,kba_method:null}).then((function(e){return __awaiter(n,void 0,void 0,(function(){var t;return __generator(this,(function(o){switch(o.label){case 0:console.log("[ROLES] Created role",e);console.log("Updating template in data store");return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 1:o.sent();(t=this.rolesUpdated)===null||t===void 0?void 0:t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))})).catch((function(e){console.log("[ROLES] Error creating role",e)}))};e.prototype.handleAddRole=function(e,t){e.stopPropagation();var o=this.getRolesAtSequence(t).length+1;var n=this.getNextRoleName();this.callCreateRole(n,t,o)};e.prototype.handleAddStep=function(e,t){e.stopPropagation();var o=1;var n=this.getNextRoleName();this.callCreateRole(n,t,o)};e.prototype.render=function(){var e=this;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return h(Host,{class:"loading"},h("verdocs-loader",null))}var t=this.getRoleNames();var o=this.getSequenceNumbers();var n=o&&o.length>0?(o[o.length-1]||0)+1:1;console.log("[ROLES] Rendering",{roleNames:t,sequences:o,nextSequence:n});return h(Host,{class:{dragging:this.dragging}},h("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},h("h5",null,"Roles and Workflow"),h("div",{class:"roles"},o.map((function(t,o){return h("div",{class:"sequence"},h("div",{class:"sequence-label no-drag"},o+1,"."),h("div",{class:"sequence-roles",id:"verdocs-roles-sequence-".concat(t),"data-sequence":t},e.getRolesAtSequence(t).map((function(o){var n=!o.email||!o.first_name||!o.last_name;return n?h("div",{class:"role","data-rolename":o.name,"data-sequence":t,"data-order":o.order},h("div",{class:"role-name"},o.name),h("div",{class:"icons"},h("div",{class:"gear-button",innerHTML:settingsIcon,onClick:function(){return e.showingRoleDialog=o.name},"aria-role":"button"}),h("span",{class:"type-icon",innerHTML:o.type==="signer"?iconSigner:o.type==="cc"?iconCC:iconApprover}))):h("div",{class:"role","data-rolename":o.name,"data-sequence":t,"data-order":o.order},h("div",{class:"role-name"},formatFullName(o)),h("div",{class:"icons"},h("div",{class:"gear-button",innerHTML:settingsIcon,onClick:function(){return e.showingRoleDialog=o.name},"aria-role":"button"}),h("span",{class:"type-icon",innerHTML:o.type==="signer"?iconSigner:o.type==="cc"?iconCC:iconApprover})))}))),h("button",{class:"add-role no-drag",onClick:function(o){return e.handleAddRole(o,t)}},"+ Add Role"))})),h("div",{class:"sequence add-sequence"},h("div",{class:"sequence-label no-drag"},o.length+1,"."),h("div",{class:"sequence-roles",id:"verdocs-roles-sequence-add-target","data-sequence":n}),h("button",{class:"add-role no-drag",onClick:function(t){return e.handleAddRole(t,n)}},"+ Add Role"))),t.length<1&&h("div",{class:"empty"},"You must add at least one Role before proceeding.",h("br",null)," Click the ",h("span",{innerHTML:plusIcon})," Add button above to get started."),h("div",{class:"buttons"},h("div",{class:"flex-fill"}),h("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(){return e.handleCancel()}}),h("verdocs-button",{label:"OK",size:"small",onClick:function(){return e.handleSubmit()},disabled:t.length<1}))),this.showingRoleDialog&&h("verdocs-menu-panel",{onClose:function(){return e.showingRoleDialog=null}},h("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:function(){var t;(t=document.getElementById("verdocs-menu-panel-overlay"))===null||t===void 0?void 0:t.remove();e.showingRoleDialog=null},onDelete:function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:this.showingRoleDialog=null;return[4,this.renumberTemplateRoles()];case 1:t.sent();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))}})))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsTemplateRoles.style=VerdocsTemplateRolesStyle0;export{VerdocsPreview as verdocs_preview,VerdocsSend as verdocs_send,VerdocsTemplateAttachments as verdocs_template_attachments,VerdocsTemplateBuildTabs as verdocs_template_build_tabs,VerdocsTemplateFields as verdocs_template_fields,VerdocsTemplateRoles as verdocs_template_roles};
|
8
8
|
//# sourceMappingURL=verdocs-preview_6.entry.js.map
|